201035
authorhgs
Mon, 06 Sep 2010 15:00:47 +0300
changeset 51 98307c651589
parent 42 0ff24a8f6ca2
child 52 c2f44e33b468
201035
analyzetool/analyzetoolcleaner/bwins/atoolcleaneru.def
analyzetool/analyzetoolcleaner/eabi/atoolcleaneru.def
analyzetool/analyzetoolcleaner/group/analyzetoolcleaner.mmp
analyzetool/analyzetoolcleaner/group/bld.inf
analyzetool/analyzetoolcleaner/inc/analyzetoolcleaner.h
analyzetool/analyzetoolcleaner/src/analyzetoolcleaner.cpp
analyzetool/commandlineengine/group/atool.vcproj
analyzetool/commandlineengine/group/bld.inf
analyzetool/commandlineengine/inc/ATCommonDefines.h
analyzetool/commandlineengine/inc/CATBase.h
analyzetool/commandlineengine/inc/CATDatParser.h
analyzetool/commandlineengine/inc/CATDataSaver.h
analyzetool/commandlineengine/inc/CATMemoryAddress.h
analyzetool/commandlineengine/inc/CATMmp.h
analyzetool/commandlineengine/inc/CATModule2.h
analyzetool/commandlineengine/inc/CATParseTraceFile.h
analyzetool/commandlineengine/inc/CATParseXML.h
analyzetool/commandlineengine/inc/CATProject.h
analyzetool/commandlineengine/inc/cataddr2line.h
analyzetool/commandlineengine/inc/cataddr2lineserver.h
analyzetool/commandlineengine/inc/catalloc.h
analyzetool/commandlineengine/inc/catallocs.h
analyzetool/commandlineengine/inc/catdbghelper.h
analyzetool/commandlineengine/inc/catfilereader.h
analyzetool/commandlineengine/inc/catromsymbol.h
analyzetool/commandlineengine/inc/iaddresstoline.h
analyzetool/commandlineengine/inc/stdafx.h
analyzetool/commandlineengine/install/addr2line.exe
analyzetool/commandlineengine/install/atool.exe
analyzetool/commandlineengine/install/binutils-2.19.1-src.zip
analyzetool/commandlineengine/install/xerces-c_2_7.dll
analyzetool/commandlineengine/lib/xerces-c_2.lib
analyzetool/commandlineengine/src/CATBase.cpp
analyzetool/commandlineengine/src/CATDatParser.cpp
analyzetool/commandlineengine/src/CATDataSaver.cpp
analyzetool/commandlineengine/src/CATMemoryAddress.cpp
analyzetool/commandlineengine/src/CATMmp.cpp
analyzetool/commandlineengine/src/CATModule2.cpp
analyzetool/commandlineengine/src/CATParseTraceFile.cpp
analyzetool/commandlineengine/src/CATParseXML.cpp
analyzetool/commandlineengine/src/CATProject.cpp
analyzetool/commandlineengine/src/arguments.cpp
analyzetool/commandlineengine/src/atool.cpp
analyzetool/commandlineengine/src/cataddr2line.cpp
analyzetool/commandlineengine/src/cataddr2lineserver.cpp
analyzetool/commandlineengine/src/catalloc.cpp
analyzetool/commandlineengine/src/catallocs.cpp
analyzetool/commandlineengine/src/catdbghelper.cpp
analyzetool/commandlineengine/src/catfilereader.cpp
analyzetool/commandlineengine/src/catromsymbol.cpp
analyzetool/commandlineengine/src/helps.cpp
analyzetool/commandlineengine/src/librarychecks.cpp
analyzetool/commandlineengine/src/stdafx.cpp
analyzetool/commandlineengine/src/utility.cpp
analyzetool/commandlineengine/src/version.cpp
analyzetool/dynamicmemoryhook/bwins/atoolmemoryhooku.def
analyzetool/dynamicmemoryhook/eabi/atoolmemoryhooku.def
analyzetool/dynamicmemoryhook/group/atoolmemoryhook.mmp
analyzetool/dynamicmemoryhook/group/bld.inf
analyzetool/dynamicmemoryhook/inc/analyzetoolallocator.h
analyzetool/dynamicmemoryhook/inc/analyzetooleventhandler.h
analyzetool/dynamicmemoryhook/inc/analyzetooleventhandlernotifier.h
analyzetool/dynamicmemoryhook/inc/analyzetoolfastlog.h
analyzetool/dynamicmemoryhook/inc/analyzetoolmainallocator.h
analyzetool/dynamicmemoryhook/inc/analyzetoolmainallocator.inl
analyzetool/dynamicmemoryhook/inc/analyzetoolmemoryallocator.h
analyzetool/dynamicmemoryhook/inc/analyzetoolmemoryallocator.inl
analyzetool/dynamicmemoryhook/inc/analyzetoolpanics.pan
analyzetool/dynamicmemoryhook/inc/codeblock.h
analyzetool/dynamicmemoryhook/inc/customuser.h
analyzetool/dynamicmemoryhook/inc/threadstack.h
analyzetool/dynamicmemoryhook/sis/analyzetoolmemoryhook.pkg
analyzetool/dynamicmemoryhook/src/analyzetoolallocator.cpp
analyzetool/dynamicmemoryhook/src/analyzetooleventhandler.cpp
analyzetool/dynamicmemoryhook/src/analyzetoolfastlog.cpp
analyzetool/dynamicmemoryhook/src/analyzetoolmainallocator.cpp
analyzetool/dynamicmemoryhook/src/analyzetoolmemoryallocator.cpp
analyzetool/dynamicmemoryhook/src/codeblock.cpp
analyzetool/dynamicmemoryhook/src/customuser.cpp
analyzetool/dynamicmemoryhook/src/threadstack.cpp
analyzetool/envpatcher/EnvPatcher.pl
analyzetool/envpatcher/ReadMe.txt
analyzetool/group/ReleaseNotes_AnalyzeTool.txt
analyzetool/group/atool_stub_sis.mk
analyzetool/group/bld.inf
analyzetool/inc/atlog.h
analyzetool/kerneleventhandler/group/atoolkerneleventhandler.mmp
analyzetool/kerneleventhandler/group/bld.inf
analyzetool/kerneleventhandler/inc/analyzetool.h
analyzetool/kerneleventhandler/inc/analyzetool.inl
analyzetool/kerneleventhandler/inc/analyzetoolchannel.h
analyzetool/kerneleventhandler/inc/analyzetooldevice.h
analyzetool/kerneleventhandler/inc/analyzetooleventhandler.h
analyzetool/kerneleventhandler/inc/analyzetooltraceconstants.h
analyzetool/kerneleventhandler/inc/atcommon.h
analyzetool/kerneleventhandler/sis/analyzetooldevicedriver.pkg
analyzetool/kerneleventhandler/src/analyzetoolchannel.cpp
analyzetool/kerneleventhandler/src/analyzetooldevice.cpp
analyzetool/kerneleventhandler/src/analyzetooleventhandler.cpp
analyzetool/rom/analyzetool.iby
analyzetool/rom/analyzetool_rom.iby
analyzetool/sis/AnalyzeTool.pkg
analyzetool/sis/AnalyzeTool_udeb.pkg
analyzetool/sis/analyzeTool_stub.pkg
analyzetool/staticlib/group/atoolstaticlib.mmp
analyzetool/staticlib/group/bld.inf
analyzetool/staticlib/src/atoolstaticlib.cpp
analyzetool/storageserver/client/bwins/atoolstorageserverclntu.def
analyzetool/storageserver/client/eabi/atoolstorageserverclntu.def
analyzetool/storageserver/client/group/atoolstorageserverclnt.mmp
analyzetool/storageserver/client/inc/atstorageserverclnt.h
analyzetool/storageserver/client/src/atstorageserverclnt.cpp
analyzetool/storageserver/group/bld.inf
analyzetool/storageserver/inc/atstorageservercommon.h
analyzetool/storageserver/server/group/atoolstorageserver.mmp
analyzetool/storageserver/server/inc/atdllinfo.h
analyzetool/storageserver/server/inc/atdriveinfo.h
analyzetool/storageserver/server/inc/atdynprocessinfo.h
analyzetool/storageserver/server/inc/atmemoryentry.h
analyzetool/storageserver/server/inc/atstorageserver.h
analyzetool/storageserver/server/inc/atstorageserversession.h
analyzetool/storageserver/server/src/atdllinfo.cpp
analyzetool/storageserver/server/src/atdriveinfo.cpp
analyzetool/storageserver/server/src/atdynprocessinfo.cpp
analyzetool/storageserver/server/src/atmemoryentry.cpp
analyzetool/storageserver/server/src/atstorageserver.cpp
analyzetool/storageserver/server/src/atstorageserversession.cpp
analyzetool/storageserver/sis/atstorageserver.pkg
analyzetool/storageserver/sis/atstorageserver_udeb.pkg
analyzetool/symbian_version.hrh
group/bld.inf
layers.sysdef.xml
memspy/CommandLine/Include/MemSpyCommandLine.h
memspy/CommandLine/Include/MemSpyCommands.h
memspy/CommandLine/Source/MemSpyCommandLine.cpp
memspy/CommandLine/Source/MemSpyCommandLineMain.cpp
memspy/CommandLine/group/MemSpyCommandLine.mmp
memspy/CommandLine/group/bld.inf
memspy/Console/Include/ConsoleConstants.h
memspy/Console/Include/ConsoleDWOperation.h
memspy/Console/Include/ConsoleMenu.h
memspy/Console/Source/ConsoleDWOperation.cpp
memspy/Console/Source/ConsoleMain.cpp
memspy/Console/Source/ConsoleMenu.cpp
memspy/Console/data/MemSpyEComInterfaceIds.xml
memspy/Console/data/MemSpyProcessMemoryTrackingAutoStartConfig.xml
memspy/Console/data/backup_registration.xml
memspy/Console/group/MemSpyConsole.mmp
memspy/Console/group/bld.inf
memspy/Driver/BWINS/memspydriverclientu.def
memspy/Driver/Kernel/Include/MemSpyDriverDevice.h
memspy/Driver/Kernel/Include/MemSpyDriverEventMonitor.h
memspy/Driver/Kernel/Include/MemSpyDriverHeap.h
memspy/Driver/Kernel/Include/MemSpyDriverHeapStatistics.h
memspy/Driver/Kernel/Include/MemSpyDriverHeapWalker.h
memspy/Driver/Kernel/Include/MemSpyDriverInspectedProcess.h
memspy/Driver/Kernel/Include/MemSpyDriverInspectedProcessManager.h
memspy/Driver/Kernel/Include/MemSpyDriverLog.h
memspy/Driver/Kernel/Include/MemSpyDriverLogicalChannel.h
memspy/Driver/Kernel/Include/MemSpyDriverOSAdaption.h
memspy/Driver/Kernel/Include/MemSpyDriverObjectIx.h
memspy/Driver/Kernel/Include/MemSpyDriverPAndS.h
memspy/Driver/Kernel/Include/MemSpyDriverStreamWriter.h
memspy/Driver/Kernel/Include/MemSpyDriverSuspensionManager.h
memspy/Driver/Kernel/Include/MemSpyDriverUserEventMonitor.h
memspy/Driver/Kernel/Include/MemSpyDriverUtils.h
memspy/Driver/Kernel/Include/MemSpyDriverXferBuffer.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanBase.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanChunks.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanClientServer.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanCodeSegs.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanContainerBase.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanContainers.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapBase.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapData.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapInfo.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapWalk.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanMisc.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanProcessInspection.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanRawMemory.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanStack.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanThreadAndProcess.h
memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanUserEventMonitor.h
memspy/Driver/Kernel/Source/MemSpyDriverDevice.cpp
memspy/Driver/Kernel/Source/MemSpyDriverEntryPoint.cpp
memspy/Driver/Kernel/Source/MemSpyDriverEventMonitor.cpp
memspy/Driver/Kernel/Source/MemSpyDriverHeap.cpp
memspy/Driver/Kernel/Source/MemSpyDriverHeapWalker.cpp
memspy/Driver/Kernel/Source/MemSpyDriverInspectedProcess.cpp
memspy/Driver/Kernel/Source/MemSpyDriverInspectedProcessManager.cpp
memspy/Driver/Kernel/Source/MemSpyDriverLogicalChannel.cpp
memspy/Driver/Kernel/Source/MemSpyDriverOSAdaption.cpp
memspy/Driver/Kernel/Source/MemSpyDriverObjectIx.cpp
memspy/Driver/Kernel/Source/MemSpyDriverStreamWriter.cpp
memspy/Driver/Kernel/Source/MemSpyDriverSuspensionManager.cpp
memspy/Driver/Kernel/Source/MemSpyDriverUserEventMonitor.cpp
memspy/Driver/Kernel/Source/MemSpyDriverUtils.cpp
memspy/Driver/Kernel/Source/MemSpyDriverXferBuffer.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanBase.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanChunks.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanClientServer.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanCodeSegs.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanContainerBase.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanContainers.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapBase.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapData.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapInfo.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapWalk.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanMisc.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanProcessInspection.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanRawMemory.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanStack.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanThreadAndProcess.cpp
memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanUserEventMonitor.cpp
memspy/Driver/Shared/MemSpyDriverEnumerationsInternal.h
memspy/Driver/Shared/MemSpyDriverObjectsInternal.h
memspy/Driver/Shared/MemSpyDriverOpCodes.h
memspy/Driver/Shared/heaputils.cpp
memspy/Driver/Shared/heaputils.h
memspy/Driver/User/Include/MemSpyDriverStreamReaderImp.h
memspy/Driver/User/Source/MemSpyDriverClient.cpp
memspy/Driver/User/Source/MemSpyDriverStreamReader.cpp
memspy/Driver/User/Source/MemSpyDriverStreamReaderImp.cpp
memspy/Driver/eabi/memspydriverclientu.def
memspy/Driver/group/MemSpyDriver.mmp
memspy/Driver/group/MemSpyDriverClient.mmp
memspy/Driver/group/bld.inf
memspy/Engine/BWINS/MemSpyEngineu.def
memspy/Engine/Include/ClientServer/MemSpyEngineServer.h
memspy/Engine/Include/EventHandlers/MemSpyEngineChunkWatcher.h
memspy/Engine/Include/Sink/MemSpyEngineOutputListItem.h
memspy/Engine/Include/Sink/MemSpyEngineOutputSinkDebug.h
memspy/Engine/Include/Sink/MemSpyEngineOutputSinkFile.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntries.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryBitmap.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryChunk.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryCode.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryDiskSpace.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFbserv.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFileServerCache.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryGlobalData.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHeap.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryManager.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryOpenFile.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryRamDrive.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryStack.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntrySystemMemory.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryWindowServer.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerImp.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerLog.h
memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerOutputFormatter.h
memspy/Engine/Source/ClientServer/MemSpyEngineServer.cpp
memspy/Engine/Source/DeviceWideOps/MemSpyDeviceWideOperations.cpp
memspy/Engine/Source/EventHandlers/MemSpyEngineChunkWatcher.cpp
memspy/Engine/Source/EventHandlers/MemSpyEngineMidwife.cpp
memspy/Engine/Source/EventHandlers/MemSpyEngineUndertaker.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperActiveObject.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperChunk.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperCodeSegment.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperCondVar.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperECom.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperFbServ.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperFileSystem.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperHeap.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperKernelContainers.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperProcess.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperRAM.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperROM.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperServer.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperStack.cpp
memspy/Engine/Source/Helpers/MemSpyEngineHelperThread.cpp
memspy/Engine/Source/MemSpyEngine.cpp
memspy/Engine/Source/MemSpyEngineImp.cpp
memspy/Engine/Source/MemSpyEngineProcessMemoryTracker.cpp
memspy/Engine/Source/MemSpyEngineTwiddlableItemArray.cpp
memspy/Engine/Source/MemSpyEngineUtils.cpp
memspy/Engine/Source/Sink/MemSpyEngineOutputList.cpp
memspy/Engine/Source/Sink/MemSpyEngineOutputListItem.cpp
memspy/Engine/Source/Sink/MemSpyEngineOutputSink.cpp
memspy/Engine/Source/Sink/MemSpyEngineOutputSinkDebug.cpp
memspy/Engine/Source/Sink/MemSpyEngineOutputSinkFile.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTracker.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycle.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycleChange.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntries.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryBitmap.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryChunk.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryCode.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryDiskSpace.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFbserv.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFileServerCache.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryGlobalData.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHeap.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryManager.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryOpenFile.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryRamDrive.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryStack.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntrySystemMemory.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryWindowServer.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerImp.cpp
memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerOutputFormatter.cpp
memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObject.cpp
memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectContainer.cpp
memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectProcess.cpp
memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThread.cpp
memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoContainer.cpp
memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.cpp
memspy/Engine/eabi/MemSpyEngineu.def
memspy/Engine/group/MemSpyEngine.config
memspy/Engine/group/MemSpyEngine.mmp
memspy/Engine/group/bld.inf
memspy/MemSpyClient/bwins/MemSpyClientu.def
memspy/MemSpyClient/eabi/MemSpyClientu.def
memspy/MemSpyClient/group/MemSpyClient.mmp
memspy/MemSpyClient/group/bld.inf
memspy/MemSpyClient/inc/memspyapiheap.h
memspy/MemSpyClient/inc/memspyapikernelobject.h
memspy/MemSpyClient/inc/memspyapikernelobjectitem.h
memspy/MemSpyClient/inc/memspyapimemorytrackingcycle.h
memspy/MemSpyClient/inc/memspyapiprocess.h
memspy/MemSpyClient/inc/memspyapithread.h
memspy/MemSpyClient/inc/memspyapithreadinfoitem.h
memspy/MemSpyClient/inc/memspyheapdata.h
memspy/MemSpyClient/inc/memspykernelobjectdata.h
memspy/MemSpyClient/inc/memspymemorytrackingcycledata.h
memspy/MemSpyClient/inc/memspyprocessdata.h
memspy/MemSpyClient/inc/memspysession.h
memspy/MemSpyClient/inc/memspythreaddata.h
memspy/MemSpyClient/inc/memspythreadinfoitemdata.h
memspy/MemSpyClient/src/memspyapiheap.cpp
memspy/MemSpyClient/src/memspyapikernelobject.cpp
memspy/MemSpyClient/src/memspyapikernelobjectitem.cpp
memspy/MemSpyClient/src/memspyapimemorytrackingcycle.cpp
memspy/MemSpyClient/src/memspyapiprocess.cpp
memspy/MemSpyClient/src/memspyapithread.cpp
memspy/MemSpyClient/src/memspyapithreadinfoitem.cpp
memspy/MemSpyClient/src/memspysession.cpp
memspy/MemSpyServer/Source/MemSpyServerMain.cpp
memspy/MemSpyServer/group/MemSpyServer.mmp
memspy/MemSpyServer/group/bld.inf
memspy/group/MemSpyCapabilities.mmh
memspy/group/ReleaseNotes_MemSpy.txt
memspy/group/bld.inf
memspy/memspy_plat/group/bld.inf
memspy/memspy_plat/memspy_api/group/bld.inf
memspy/memspy_plat/memspy_api/include/MemSpyEngineClientInterface.h
memspy/memspy_plat/memspy_api/include/memspy/driver/kernel/MemSpyDriverPanics.h
memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverConstants.h
memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverEnumerationsShared.h
memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverObjectsShared.h
memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverObjectsSharedRHeap.h
memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverClient.h
memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverLightweightClient.h
memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverStreamReader.h
memspy/memspy_plat/memspy_api/include/memspy/engine/DeviceWideOps/MemSpyDeviceWideOperations.h
memspy/memspy_plat/memspy_api/include/memspy/engine/EventHandlers/MemSpyEngineMidwife.h
memspy/memspy_plat/memspy_api/include/memspy/engine/EventHandlers/MemSpyEngineUndertaker.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperActiveObject.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperChunk.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperCodeSegment.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperCondVar.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperECom.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperFbServ.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperFileSystem.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperHeap.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperKernelContainers.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperProcess.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperRAM.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperROM.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperServer.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperStack.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperThread.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperWindowServer.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Logger/MemSpyEngineLogger.h
memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngine.h
memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineImp.h
memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineObserver.h
memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineProcessMemoryTracker.h
memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineTwiddlableItemArray.h
memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineTwiddlableItemArray.inl
memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineUtils.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputList.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputSink.h
memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputSinkType.h
memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTracker.h
memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerConfig.h
memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycle.h
memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycleChange.h
memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerEnums.h
memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerObserver.h
memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObject.h
memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectContainer.h
memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectProcess.h
memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThread.h
memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoContainer.h
memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.h
memspy/memspy_plat/memspy_api/memspy_api.metaxml
memspy/rom/memspy.iby
memspy/rom/memspy_rom.iby
memspy/symbian_version.hrh
memspy/techview/group/bld.inf
memspy/techview/include/data_caging_paths.hrh
package_definition.xml
package_map.xml
perfsrv/analyzetool/analyzetool_plat/analyzetool_api/analyzetool_api.metaxml
perfsrv/analyzetool/analyzetool_plat/analyzetool_api/group/bld.inf
perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.h
perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.inl
perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetoolcleaner.h
perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetooltraceconstants.h
perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/atcommon.h
perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/customuser.h
perfsrv/analyzetool/analyzetool_plat/group/bld.inf
perfsrv/analyzetool/analyzetoolcleaner/bwins/atoolcleaneru.def
perfsrv/analyzetool/analyzetoolcleaner/eabi/atoolcleaneru.def
perfsrv/analyzetool/analyzetoolcleaner/group/analyzetoolcleaner.mmp
perfsrv/analyzetool/analyzetoolcleaner/group/bld.inf
perfsrv/analyzetool/analyzetoolcleaner/src/analyzetoolcleaner.cpp
perfsrv/analyzetool/commandlineengine/group/atool.vcproj
perfsrv/analyzetool/commandlineengine/group/bld.inf
perfsrv/analyzetool/commandlineengine/inc/ATCommonDefines.h
perfsrv/analyzetool/commandlineengine/inc/CATBase.h
perfsrv/analyzetool/commandlineengine/inc/CATDatParser.h
perfsrv/analyzetool/commandlineengine/inc/CATDataSaver.h
perfsrv/analyzetool/commandlineengine/inc/CATMemoryAddress.h
perfsrv/analyzetool/commandlineengine/inc/CATMmp.h
perfsrv/analyzetool/commandlineengine/inc/CATModule2.h
perfsrv/analyzetool/commandlineengine/inc/CATParseBinaryFile.h
perfsrv/analyzetool/commandlineengine/inc/CATParseTraceFile.h
perfsrv/analyzetool/commandlineengine/inc/CATParseXML.h
perfsrv/analyzetool/commandlineengine/inc/CATProcessData.h
perfsrv/analyzetool/commandlineengine/inc/CATProject.h
perfsrv/analyzetool/commandlineengine/inc/cataddr2line.h
perfsrv/analyzetool/commandlineengine/inc/cataddr2lineserver.h
perfsrv/analyzetool/commandlineengine/inc/catalloc.h
perfsrv/analyzetool/commandlineengine/inc/catallocs.h
perfsrv/analyzetool/commandlineengine/inc/catdbghelper.h
perfsrv/analyzetool/commandlineengine/inc/catfilereader.h
perfsrv/analyzetool/commandlineengine/inc/catromsymbol.h
perfsrv/analyzetool/commandlineengine/inc/iaddresstoline.h
perfsrv/analyzetool/commandlineengine/inc/stdafx.h
perfsrv/analyzetool/commandlineengine/install/addr2line.exe
perfsrv/analyzetool/commandlineengine/install/atool.exe
perfsrv/analyzetool/commandlineengine/install/binutils-2.19.1-src.zip
perfsrv/analyzetool/commandlineengine/install/xerces-c_2_7.dll
perfsrv/analyzetool/commandlineengine/lib/xerces-c_2.lib
perfsrv/analyzetool/commandlineengine/src/CATBase.cpp
perfsrv/analyzetool/commandlineengine/src/CATDatParser.cpp
perfsrv/analyzetool/commandlineengine/src/CATDataSaver.cpp
perfsrv/analyzetool/commandlineengine/src/CATMemoryAddress.cpp
perfsrv/analyzetool/commandlineengine/src/CATMmp.cpp
perfsrv/analyzetool/commandlineengine/src/CATModule2.cpp
perfsrv/analyzetool/commandlineengine/src/CATParseBinaryFile.cpp
perfsrv/analyzetool/commandlineengine/src/CATParseTraceFile.cpp
perfsrv/analyzetool/commandlineengine/src/CATParseXML.cpp
perfsrv/analyzetool/commandlineengine/src/CATProject.cpp
perfsrv/analyzetool/commandlineengine/src/arguments.cpp
perfsrv/analyzetool/commandlineengine/src/atool.cpp
perfsrv/analyzetool/commandlineengine/src/cataddr2line.cpp
perfsrv/analyzetool/commandlineengine/src/cataddr2lineserver.cpp
perfsrv/analyzetool/commandlineengine/src/catalloc.cpp
perfsrv/analyzetool/commandlineengine/src/catallocs.cpp
perfsrv/analyzetool/commandlineengine/src/catdbghelper.cpp
perfsrv/analyzetool/commandlineengine/src/catfilereader.cpp
perfsrv/analyzetool/commandlineengine/src/catromsymbol.cpp
perfsrv/analyzetool/commandlineengine/src/helps.cpp
perfsrv/analyzetool/commandlineengine/src/librarychecks.cpp
perfsrv/analyzetool/commandlineengine/src/stdafx.cpp
perfsrv/analyzetool/commandlineengine/src/utility.cpp
perfsrv/analyzetool/commandlineengine/src/version.cpp
perfsrv/analyzetool/dynamicmemoryhook/bwins/atoolmemoryhooku.def
perfsrv/analyzetool/dynamicmemoryhook/eabi/atoolmemoryhooku.def
perfsrv/analyzetool/dynamicmemoryhook/group/atoolmemoryhook.mmp
perfsrv/analyzetool/dynamicmemoryhook/group/bld.inf
perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolallocator.h
perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetooleventhandler.h
perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetooleventhandlernotifier.h
perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolfastlog.h
perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolfilelog.h
perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolmainallocator.h
perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolmainallocator.inl
perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolmemoryallocator.h
perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolmemoryallocator.inl
perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolpanics.pan
perfsrv/analyzetool/dynamicmemoryhook/inc/atdriveinfo.h
perfsrv/analyzetool/dynamicmemoryhook/inc/codeblock.h
perfsrv/analyzetool/dynamicmemoryhook/inc/threadstack.h
perfsrv/analyzetool/dynamicmemoryhook/sis/analyzetoolmemoryhook.pkg
perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolallocator.cpp
perfsrv/analyzetool/dynamicmemoryhook/src/analyzetooleventhandler.cpp
perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolfastlog.cpp
perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolfilelog.cpp
perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolmainallocator.cpp
perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolmemoryallocator.cpp
perfsrv/analyzetool/dynamicmemoryhook/src/atdriveinfo.cpp
perfsrv/analyzetool/dynamicmemoryhook/src/codeblock.cpp
perfsrv/analyzetool/dynamicmemoryhook/src/customuser.cpp
perfsrv/analyzetool/dynamicmemoryhook/src/threadstack.cpp
perfsrv/analyzetool/envpatcher/EnvPatcher.pl
perfsrv/analyzetool/envpatcher/ReadMe.txt
perfsrv/analyzetool/group/ReleaseNotes_AnalyzeTool.txt
perfsrv/analyzetool/group/atool_stub_sis.mk
perfsrv/analyzetool/group/bld.inf
perfsrv/analyzetool/inc/atlog.h
perfsrv/analyzetool/kerneleventhandler/group/atoolkerneleventhandler.mmp
perfsrv/analyzetool/kerneleventhandler/group/bld.inf
perfsrv/analyzetool/kerneleventhandler/inc/analyzetoolchannel.h
perfsrv/analyzetool/kerneleventhandler/inc/analyzetooldevice.h
perfsrv/analyzetool/kerneleventhandler/inc/analyzetooleventhandler.h
perfsrv/analyzetool/kerneleventhandler/sis/analyzetooldevicedriver.pkg
perfsrv/analyzetool/kerneleventhandler/src/analyzetoolchannel.cpp
perfsrv/analyzetool/kerneleventhandler/src/analyzetooldevice.cpp
perfsrv/analyzetool/kerneleventhandler/src/analyzetooleventhandler.cpp
perfsrv/analyzetool/rom/analyzetool.iby
perfsrv/analyzetool/rom/analyzetool_rom.iby
perfsrv/analyzetool/sis/AnalyzeTool.pkg
perfsrv/analyzetool/sis/AnalyzeTool_udeb.pkg
perfsrv/analyzetool/sis/analyzeTool_stub.pkg
perfsrv/analyzetool/staticlib/group/atoolstaticlib.mmp
perfsrv/analyzetool/staticlib/group/bld.inf
perfsrv/analyzetool/staticlib/src/atoolstaticlib.cpp
perfsrv/analyzetool/symbian_version.hrh
perfsrv/memspy/CommandLine/Include/MemSpyCommandLine.h
perfsrv/memspy/CommandLine/Include/MemSpyCommands.h
perfsrv/memspy/CommandLine/Source/MemSpyCommandLine.cpp
perfsrv/memspy/CommandLine/Source/MemSpyCommandLineMain.cpp
perfsrv/memspy/CommandLine/group/MemSpyCommandLine.mmp
perfsrv/memspy/CommandLine/group/bld.inf
perfsrv/memspy/Console/Include/ConsoleConstants.h
perfsrv/memspy/Console/Include/ConsoleDWOperation.h
perfsrv/memspy/Console/Include/ConsoleMenu.h
perfsrv/memspy/Console/Source/ConsoleDWOperation.cpp
perfsrv/memspy/Console/Source/ConsoleMain.cpp
perfsrv/memspy/Console/Source/ConsoleMenu.cpp
perfsrv/memspy/Console/data/MemSpyEComInterfaceIds.xml
perfsrv/memspy/Console/data/MemSpyProcessMemoryTrackingAutoStartConfig.xml
perfsrv/memspy/Console/data/backup_registration.xml
perfsrv/memspy/Console/group/MemSpyConsole.mmp
perfsrv/memspy/Console/group/bld.inf
perfsrv/memspy/Driver/BWINS/memspydriverclientu.def
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverDevice.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverEventMonitor.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeap.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeapStatistics.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeapWalker.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverInspectedProcess.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverInspectedProcessManager.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverLog.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverLogicalChannel.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverOSAdaption.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverObjectIx.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverPAndS.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverStreamWriter.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverSuspensionManager.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverUserEventMonitor.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverUtils.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverXferBuffer.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanBase.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanChunks.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanClientServer.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanCodeSegs.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanContainerBase.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanContainers.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapBase.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapData.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapInfo.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapWalk.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanMisc.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanProcessInspection.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanRawMemory.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanStack.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanThreadAndProcess.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanUserEventMonitor.h
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverDevice.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverEntryPoint.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverEventMonitor.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverHeap.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverHeapWalker.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverInspectedProcess.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverInspectedProcessManager.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverLogicalChannel.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverOSAdaption.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverObjectIx.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverStreamWriter.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverSuspensionManager.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverUserEventMonitor.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverUtils.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverXferBuffer.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanBase.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanChunks.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanClientServer.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanCodeSegs.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanContainerBase.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanContainers.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapBase.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapData.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapInfo.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapWalk.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanMisc.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanProcessInspection.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanRawMemory.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanStack.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanThreadAndProcess.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanUserEventMonitor.cpp
perfsrv/memspy/Driver/Shared/MemSpyDriverEnumerationsInternal.h
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/Include/MemSpyDriverStreamReaderImp.h
perfsrv/memspy/Driver/User/Source/MemSpyDriverClient.cpp
perfsrv/memspy/Driver/User/Source/MemSpyDriverStreamReader.cpp
perfsrv/memspy/Driver/User/Source/MemSpyDriverStreamReaderImp.cpp
perfsrv/memspy/Driver/eabi/memspydriverclientu.def
perfsrv/memspy/Driver/group/MemSpyDriver.mmp
perfsrv/memspy/Driver/group/MemSpyDriverClient.mmp
perfsrv/memspy/Driver/group/bld.inf
perfsrv/memspy/Engine/BWINS/MemSpyEngineu.def
perfsrv/memspy/Engine/Include/ClientServer/MemSpyEngineServer.h
perfsrv/memspy/Engine/Include/EventHandlers/MemSpyEngineChunkWatcher.h
perfsrv/memspy/Engine/Include/Sink/MemSpyEngineOutputListItem.h
perfsrv/memspy/Engine/Include/Sink/MemSpyEngineOutputSinkDebug.h
perfsrv/memspy/Engine/Include/Sink/MemSpyEngineOutputSinkFile.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntries.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryBitmap.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryChunk.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryCode.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryDiskSpace.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFbserv.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFileServerCache.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryGlobalData.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHeap.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryManager.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryOpenFile.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryRamDrive.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryStack.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntrySystemMemory.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryWindowServer.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerImp.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerLog.h
perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerOutputFormatter.h
perfsrv/memspy/Engine/Source/ClientServer/MemSpyEngineServer.cpp
perfsrv/memspy/Engine/Source/DeviceWideOps/MemSpyDeviceWideOperations.cpp
perfsrv/memspy/Engine/Source/EventHandlers/MemSpyEngineChunkWatcher.cpp
perfsrv/memspy/Engine/Source/EventHandlers/MemSpyEngineMidwife.cpp
perfsrv/memspy/Engine/Source/EventHandlers/MemSpyEngineUndertaker.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperActiveObject.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperChunk.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperCodeSegment.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperCondVar.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperECom.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperFbServ.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperFileSystem.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperHeap.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperKernelContainers.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperProcess.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperRAM.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperROM.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperServer.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperStack.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperThread.cpp
perfsrv/memspy/Engine/Source/MemSpyEngine.cpp
perfsrv/memspy/Engine/Source/MemSpyEngineImp.cpp
perfsrv/memspy/Engine/Source/MemSpyEngineProcessMemoryTracker.cpp
perfsrv/memspy/Engine/Source/MemSpyEngineTwiddlableItemArray.cpp
perfsrv/memspy/Engine/Source/MemSpyEngineUtils.cpp
perfsrv/memspy/Engine/Source/Sink/MemSpyEngineOutputList.cpp
perfsrv/memspy/Engine/Source/Sink/MemSpyEngineOutputListItem.cpp
perfsrv/memspy/Engine/Source/Sink/MemSpyEngineOutputSink.cpp
perfsrv/memspy/Engine/Source/Sink/MemSpyEngineOutputSinkDebug.cpp
perfsrv/memspy/Engine/Source/Sink/MemSpyEngineOutputSinkFile.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTracker.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycle.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycleChange.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntries.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryBitmap.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryChunk.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryCode.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryDiskSpace.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFbserv.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFileServerCache.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryGlobalData.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHeap.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryManager.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryOpenFile.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryRamDrive.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryStack.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntrySystemMemory.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryWindowServer.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerImp.cpp
perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerOutputFormatter.cpp
perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObject.cpp
perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectContainer.cpp
perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectProcess.cpp
perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThread.cpp
perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoContainer.cpp
perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.cpp
perfsrv/memspy/Engine/eabi/MemSpyEngineu.def
perfsrv/memspy/Engine/group/MemSpyEngine.config
perfsrv/memspy/Engine/group/MemSpyEngine.mmp
perfsrv/memspy/Engine/group/bld.inf
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/memspyapiecom.h
perfsrv/memspy/MemSpyClient/inc/memspyapiheap.h
perfsrv/memspy/MemSpyClient/inc/memspyapikernelobject.h
perfsrv/memspy/MemSpyClient/inc/memspyapikernelobjectitem.h
perfsrv/memspy/MemSpyClient/inc/memspyapimemorytrackingcycle.h
perfsrv/memspy/MemSpyClient/inc/memspyapiprocess.h
perfsrv/memspy/MemSpyClient/inc/memspyapiserver.h
perfsrv/memspy/MemSpyClient/inc/memspyapithread.h
perfsrv/memspy/MemSpyClient/inc/memspyapithreadinfoitem.h
perfsrv/memspy/MemSpyClient/inc/memspyecomdata.h
perfsrv/memspy/MemSpyClient/inc/memspyheapdata.h
perfsrv/memspy/MemSpyClient/inc/memspykernelobjectdata.h
perfsrv/memspy/MemSpyClient/inc/memspymemorytrackingcycledata.h
perfsrv/memspy/MemSpyClient/inc/memspyprocessdata.h
perfsrv/memspy/MemSpyClient/inc/memspyserverdata.h
perfsrv/memspy/MemSpyClient/inc/memspysession.h
perfsrv/memspy/MemSpyClient/inc/memspythreaddata.h
perfsrv/memspy/MemSpyClient/inc/memspythreadinfoitemdata.h
perfsrv/memspy/MemSpyClient/src/memspyapiecom.cpp
perfsrv/memspy/MemSpyClient/src/memspyapiheap.cpp
perfsrv/memspy/MemSpyClient/src/memspyapikernelobject.cpp
perfsrv/memspy/MemSpyClient/src/memspyapikernelobjectitem.cpp
perfsrv/memspy/MemSpyClient/src/memspyapimemorytrackingcycle.cpp
perfsrv/memspy/MemSpyClient/src/memspyapiprocess.cpp
perfsrv/memspy/MemSpyClient/src/memspyapiserver.cpp
perfsrv/memspy/MemSpyClient/src/memspyapithread.cpp
perfsrv/memspy/MemSpyClient/src/memspyapithreadinfoitem.cpp
perfsrv/memspy/MemSpyClient/src/memspysession.cpp
perfsrv/memspy/MemSpyServer/Source/MemSpyServerMain.cpp
perfsrv/memspy/MemSpyServer/data/MemSpyEComInterfaceIds.xml
perfsrv/memspy/MemSpyServer/group/MemSpyServer.mmp
perfsrv/memspy/MemSpyServer/group/bld.inf
perfsrv/memspy/group/MemSpyCapabilities.mmh
perfsrv/memspy/group/ReleaseNotes_MemSpy.txt
perfsrv/memspy/group/bld.inf
perfsrv/memspy/memspy_plat/group/bld.inf
perfsrv/memspy/memspy_plat/memspy_api/group/bld.inf
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/shared/MemSpyDriverConstants.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverEnumerationsShared.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverObjectsShared.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverObjectsSharedRHeap.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverClient.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverLightweightClient.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverStreamReader.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/DeviceWideOps/MemSpyDeviceWideOperations.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/EventHandlers/MemSpyEngineMidwife.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/EventHandlers/MemSpyEngineUndertaker.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperActiveObject.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperChunk.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperCodeSegment.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperCondVar.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperECom.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperFbServ.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperFileSystem.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperHeap.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperKernelContainers.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperProcess.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperRAM.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperROM.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperServer.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperStack.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperThread.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperWindowServer.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Logger/MemSpyEngineLogger.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngine.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineImp.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineObserver.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineProcessMemoryTracker.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineTwiddlableItemArray.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineTwiddlableItemArray.inl
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineUtils.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputList.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputSink.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputSinkType.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTracker.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerConfig.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycle.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycleChange.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerEnums.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerObserver.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObject.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectContainer.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectProcess.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThread.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoContainer.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.h
perfsrv/memspy/memspy_plat/memspy_api/memspy_api.metaxml
perfsrv/memspy/rom/memspy.iby
perfsrv/memspy/rom/memspy_rom.iby
perfsrv/memspy/symbian_version.hrh
perfsrv/memspy/techview/group/bld.inf
perfsrv/memspy/techview/include/data_caging_paths.hrh
perfsrv/piprofiler/engine/group/ProfilerEngine.mmp
perfsrv/piprofiler/engine/group/ProfilerEshell.mmp
perfsrv/piprofiler/engine/group/bld.inf
perfsrv/piprofiler/engine/inc/ProfilerEngine.h
perfsrv/piprofiler/engine/inc/ProfilerErrorChecker.h
perfsrv/piprofiler/engine/inc/ProfilerEshell.h
perfsrv/piprofiler/engine/inc/ProfilerTimer.h
perfsrv/piprofiler/engine/inc/SamplerController.h
perfsrv/piprofiler/engine/inc/SamplerPluginLoader.h
perfsrv/piprofiler/engine/inc/WriterController.h
perfsrv/piprofiler/engine/inc/WriterPluginLoader.h
perfsrv/piprofiler/engine/src/ProfilerEngine.cpp
perfsrv/piprofiler/engine/src/ProfilerErrorChecker.cpp
perfsrv/piprofiler/engine/src/ProfilerEshell.cpp
perfsrv/piprofiler/engine/src/ProfilerTimer.cpp
perfsrv/piprofiler/engine/src/SamplerController.cpp
perfsrv/piprofiler/engine/src/SamplerPluginLoader.cpp
perfsrv/piprofiler/engine/src/WriterController.cpp
perfsrv/piprofiler/engine/src/WriterPluginLoader.cpp
perfsrv/piprofiler/group/ReleaseNotes_PIProfiler.txt
perfsrv/piprofiler/group/bld.inf
perfsrv/piprofiler/piprofiler_plat/group/bld.inf
perfsrv/piprofiler/piprofiler_plat/inc/EngineUIDs.h
perfsrv/piprofiler/piprofiler_plat/inc/PluginDriver.h
perfsrv/piprofiler/piprofiler_plat/inc/PluginDriver.inl
perfsrv/piprofiler/piprofiler_plat/inc/PluginSampler.h
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerAttributes.h
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerConfig.h
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerEngineAPI.h
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerEngineStatusChecker.h
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerEngineStatusChecker.inl
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesCommon.h
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesKrn.h
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesKrn.inl
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesUsr.h
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesUsr.inl
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerSession.h
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerTraces.h
perfsrv/piprofiler/piprofiler_plat/inc/ProfilerVersion.h
perfsrv/piprofiler/piprofiler_plat/inc/SamplerPluginInterface.h
perfsrv/piprofiler/piprofiler_plat/inc/SamplerPluginInterface.inl
perfsrv/piprofiler/piprofiler_plat/inc/WriterPluginInterface.h
perfsrv/piprofiler/piprofiler_plat/inc/WriterPluginInterface.inl
perfsrv/piprofiler/piprofiler_plat/piprofiler_api.metaxml
perfsrv/piprofiler/plugins/BUPplugin/data/2001E5B6.rss
perfsrv/piprofiler/plugins/BUPplugin/group/BUPPlugin.mmp
perfsrv/piprofiler/plugins/BUPplugin/group/TouchAnimDll.mmp
perfsrv/piprofiler/plugins/BUPplugin/group/bld.inf
perfsrv/piprofiler/plugins/BUPplugin/inc/BupPlugin.h
perfsrv/piprofiler/plugins/BUPplugin/inc/TouchEventAnimDll.h
perfsrv/piprofiler/plugins/BUPplugin/inc/TouchEventClientDll.h
perfsrv/piprofiler/plugins/BUPplugin/sis/BupPlugin_S60-30.pkg
perfsrv/piprofiler/plugins/BUPplugin/src/BupPlugin.cpp
perfsrv/piprofiler/plugins/BUPplugin/src/BupPluginImplementationTable.cpp
perfsrv/piprofiler/plugins/BUPplugin/src/TouchEventAnimDll.cpp
perfsrv/piprofiler/plugins/BUPplugin/src/TouchEventClientDll.cpp
perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/data/2001E5BA.rss
perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/group/DebOutWriterPlugin.mmp
perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/group/bld.inf
perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/inc/DebOutWriterPlugin.h
perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/sis/DebOutWriterPlugin_EKA2.pkg
perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/src/DebOutWriterPlugin.cpp
perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/src/DebOutWriterPluginImplementationTable.cpp
perfsrv/piprofiler/plugins/DiskWriterPlugin/data/2001E5BB.rss
perfsrv/piprofiler/plugins/DiskWriterPlugin/group/DiskWriterPlugin.mmp
perfsrv/piprofiler/plugins/DiskWriterPlugin/group/bld.inf
perfsrv/piprofiler/plugins/DiskWriterPlugin/inc/DiskWriterPlugin.h
perfsrv/piprofiler/plugins/DiskWriterPlugin/sis/DiskWriterPlugin_EKA2.pkg
perfsrv/piprofiler/plugins/DiskWriterPlugin/src/DiskWriterPlugin.cpp
perfsrv/piprofiler/plugins/DiskWriterPlugin/src/DiskWriterPluginImplementationTable.cpp
perfsrv/piprofiler/plugins/GeneralsPlugin/data/2001E5B2.rss
perfsrv/piprofiler/plugins/GeneralsPlugin/group/GeneralsPlugin.mmp
perfsrv/piprofiler/plugins/GeneralsPlugin/group/GeneralsSampler.mmp
perfsrv/piprofiler/plugins/GeneralsPlugin/group/bld.inf
perfsrv/piprofiler/plugins/GeneralsPlugin/inc/GeneralsConfig.h
perfsrv/piprofiler/plugins/GeneralsPlugin/inc/GeneralsDriver.h
perfsrv/piprofiler/plugins/GeneralsPlugin/inc/GeneralsPlugin.h
perfsrv/piprofiler/plugins/GeneralsPlugin/inc/GfcSamplerImpl.h
perfsrv/piprofiler/plugins/GeneralsPlugin/inc/GppSamplerImpl.h
perfsrv/piprofiler/plugins/GeneralsPlugin/inc/IttEventHandler.h
perfsrv/piprofiler/plugins/GeneralsPlugin/inc/IttSamplerImpl.h
perfsrv/piprofiler/plugins/GeneralsPlugin/inc/MemSamplerImpl.h
perfsrv/piprofiler/plugins/GeneralsPlugin/inc/MemoryEventHandler.h
perfsrv/piprofiler/plugins/GeneralsPlugin/inc/PriSamplerImpl.h
perfsrv/piprofiler/plugins/GeneralsPlugin/src/GeneralsDriver.cpp
perfsrv/piprofiler/plugins/GeneralsPlugin/src/GeneralsPlugin.cpp
perfsrv/piprofiler/plugins/GeneralsPlugin/src/GeneralsPluginImplementationTable.cpp
perfsrv/piprofiler/plugins/GeneralsPlugin/src/GeneralsSampler.cia
perfsrv/piprofiler/plugins/GeneralsPlugin/src/GppSamplerImpl.cpp
perfsrv/piprofiler/plugins/GeneralsPlugin/src/IttEventHandler.cpp
perfsrv/piprofiler/plugins/GeneralsPlugin/src/IttSamplerImpl.cpp
perfsrv/piprofiler/plugins/GeneralsPlugin/src/MemSamplerImpl.cpp
perfsrv/piprofiler/plugins/GeneralsPlugin/src/MemoryEventHandler.cpp
perfsrv/piprofiler/plugins/GeneralsPlugin/src/PriSamplerImpl.cpp
perfsrv/piprofiler/plugins/PWRplugin/data/2001E5B9.rss
perfsrv/piprofiler/plugins/PWRplugin/group/PWRPlugin.mmp
perfsrv/piprofiler/plugins/PWRplugin/group/bld.inf
perfsrv/piprofiler/plugins/PWRplugin/inc/PwrPlugin.h
perfsrv/piprofiler/plugins/PWRplugin/sis/PWRPlugin.pkg
perfsrv/piprofiler/plugins/PWRplugin/src/PwrPlugin.cpp
perfsrv/piprofiler/plugins/PWRplugin/src/PwrPluginImplementationTable.cpp
perfsrv/piprofiler/rom/piprofiler.iby
perfsrv/piprofiler/rom/piprofiler_ldd.iby
perfsrv/piprofiler/rom/piprofiler_s2.iby
perfsrv/piprofiler/symbian_version.hrh
piprofiler/engine/group/ProfilerEngine.mmp
piprofiler/engine/group/ProfilerEshell.mmp
piprofiler/engine/group/bld.inf
piprofiler/engine/inc/ProfilerEngine.h
piprofiler/engine/inc/ProfilerErrorChecker.h
piprofiler/engine/inc/ProfilerEshell.h
piprofiler/engine/inc/ProfilerTimer.h
piprofiler/engine/inc/SamplerController.h
piprofiler/engine/inc/SamplerPluginLoader.h
piprofiler/engine/inc/WriterController.h
piprofiler/engine/inc/WriterPluginLoader.h
piprofiler/engine/src/ProfilerEngine.cpp
piprofiler/engine/src/ProfilerErrorChecker.cpp
piprofiler/engine/src/ProfilerEshell.cpp
piprofiler/engine/src/ProfilerTimer.cpp
piprofiler/engine/src/SamplerController.cpp
piprofiler/engine/src/SamplerPluginLoader.cpp
piprofiler/engine/src/WriterController.cpp
piprofiler/engine/src/WriterPluginLoader.cpp
piprofiler/group/ReleaseNotes_PIProfiler.txt
piprofiler/group/bld.inf
piprofiler/piprofiler_plat/group/bld.inf
piprofiler/piprofiler_plat/inc/EngineUIDs.h
piprofiler/piprofiler_plat/inc/PluginDriver.h
piprofiler/piprofiler_plat/inc/PluginDriver.inl
piprofiler/piprofiler_plat/inc/PluginSampler.h
piprofiler/piprofiler_plat/inc/ProfilerAttributes.h
piprofiler/piprofiler_plat/inc/ProfilerConfig.h
piprofiler/piprofiler_plat/inc/ProfilerEngineAPI.h
piprofiler/piprofiler_plat/inc/ProfilerEngineStatusChecker.h
piprofiler/piprofiler_plat/inc/ProfilerEngineStatusChecker.inl
piprofiler/piprofiler_plat/inc/ProfilerGenericClassesCommon.h
piprofiler/piprofiler_plat/inc/ProfilerGenericClassesKrn.h
piprofiler/piprofiler_plat/inc/ProfilerGenericClassesKrn.inl
piprofiler/piprofiler_plat/inc/ProfilerGenericClassesUsr.h
piprofiler/piprofiler_plat/inc/ProfilerGenericClassesUsr.inl
piprofiler/piprofiler_plat/inc/ProfilerSession.h
piprofiler/piprofiler_plat/inc/ProfilerTraces.h
piprofiler/piprofiler_plat/inc/ProfilerVersion.h
piprofiler/piprofiler_plat/inc/SamplerPluginInterface.h
piprofiler/piprofiler_plat/inc/SamplerPluginInterface.inl
piprofiler/piprofiler_plat/inc/WriterPluginInterface.h
piprofiler/piprofiler_plat/inc/WriterPluginInterface.inl
piprofiler/piprofiler_plat/piprofiler_api.metaxml
piprofiler/plugins/BUPplugin/data/2001E5B6.rss
piprofiler/plugins/BUPplugin/group/BUPPlugin.mmp
piprofiler/plugins/BUPplugin/group/TouchAnimDll.mmp
piprofiler/plugins/BUPplugin/group/bld.inf
piprofiler/plugins/BUPplugin/inc/BupPlugin.h
piprofiler/plugins/BUPplugin/inc/TouchEventAnimDll.h
piprofiler/plugins/BUPplugin/inc/TouchEventClientDll.h
piprofiler/plugins/BUPplugin/sis/BupPlugin_S60-30.pkg
piprofiler/plugins/BUPplugin/src/BupPlugin.cpp
piprofiler/plugins/BUPplugin/src/BupPluginImplementationTable.cpp
piprofiler/plugins/BUPplugin/src/TouchEventAnimDll.cpp
piprofiler/plugins/BUPplugin/src/TouchEventClientDll.cpp
piprofiler/plugins/DebugOutputWriterPlugin/data/2001E5BA.rss
piprofiler/plugins/DebugOutputWriterPlugin/group/DebOutWriterPlugin.mmp
piprofiler/plugins/DebugOutputWriterPlugin/group/bld.inf
piprofiler/plugins/DebugOutputWriterPlugin/inc/DebOutWriterPlugin.h
piprofiler/plugins/DebugOutputWriterPlugin/sis/DebOutWriterPlugin_EKA2.pkg
piprofiler/plugins/DebugOutputWriterPlugin/src/DebOutWriterPlugin.cpp
piprofiler/plugins/DebugOutputWriterPlugin/src/DebOutWriterPluginImplementationTable.cpp
piprofiler/plugins/DiskWriterPlugin/data/2001E5BB.rss
piprofiler/plugins/DiskWriterPlugin/group/DiskWriterPlugin.mmp
piprofiler/plugins/DiskWriterPlugin/group/bld.inf
piprofiler/plugins/DiskWriterPlugin/inc/DiskWriterPlugin.h
piprofiler/plugins/DiskWriterPlugin/sis/DiskWriterPlugin_EKA2.pkg
piprofiler/plugins/DiskWriterPlugin/src/DiskWriterPlugin.cpp
piprofiler/plugins/DiskWriterPlugin/src/DiskWriterPluginImplementationTable.cpp
piprofiler/plugins/GeneralsPlugin/data/2001E5B2.rss
piprofiler/plugins/GeneralsPlugin/group/GeneralsPlugin.mmp
piprofiler/plugins/GeneralsPlugin/group/GeneralsSampler.mmp
piprofiler/plugins/GeneralsPlugin/group/bld.inf
piprofiler/plugins/GeneralsPlugin/inc/GeneralsConfig.h
piprofiler/plugins/GeneralsPlugin/inc/GeneralsDriver.h
piprofiler/plugins/GeneralsPlugin/inc/GeneralsPlugin.h
piprofiler/plugins/GeneralsPlugin/inc/GfcSamplerImpl.h
piprofiler/plugins/GeneralsPlugin/inc/GppSamplerImpl.h
piprofiler/plugins/GeneralsPlugin/inc/IttEventHandler.h
piprofiler/plugins/GeneralsPlugin/inc/IttSamplerImpl.h
piprofiler/plugins/GeneralsPlugin/inc/MemSamplerImpl.h
piprofiler/plugins/GeneralsPlugin/inc/MemoryEventHandler.h
piprofiler/plugins/GeneralsPlugin/inc/PriSamplerImpl.h
piprofiler/plugins/GeneralsPlugin/src/GeneralsDriver.cpp
piprofiler/plugins/GeneralsPlugin/src/GeneralsPlugin.cpp
piprofiler/plugins/GeneralsPlugin/src/GeneralsPluginImplementationTable.cpp
piprofiler/plugins/GeneralsPlugin/src/GeneralsSampler.cia
piprofiler/plugins/GeneralsPlugin/src/GppSamplerImpl.cpp
piprofiler/plugins/GeneralsPlugin/src/IttEventHandler.cpp
piprofiler/plugins/GeneralsPlugin/src/IttSamplerImpl.cpp
piprofiler/plugins/GeneralsPlugin/src/MemSamplerImpl.cpp
piprofiler/plugins/GeneralsPlugin/src/MemoryEventHandler.cpp
piprofiler/plugins/GeneralsPlugin/src/PriSamplerImpl.cpp
piprofiler/plugins/PWRplugin/data/2001E5B9.rss
piprofiler/plugins/PWRplugin/group/PWRPlugin.mmp
piprofiler/plugins/PWRplugin/group/bld.inf
piprofiler/plugins/PWRplugin/inc/PwrPlugin.h
piprofiler/plugins/PWRplugin/sis/PWRPlugin.pkg
piprofiler/plugins/PWRplugin/src/PwrPlugin.cpp
piprofiler/plugins/PWRplugin/src/PwrPluginImplementationTable.cpp
piprofiler/rom/piprofiler.iby
piprofiler/rom/piprofiler_ldd.iby
piprofiler/rom/piprofiler_s2.iby
piprofiler/symbian_version.hrh
--- a/analyzetool/analyzetoolcleaner/bwins/atoolcleaneru.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	?GetCallBackAddress@@YAPAV?$TFixedArray@K$09@@XZ @ 1 NONAME ; class TFixedArray<unsigned long, 10> * GetCallBackAddress(void)
-
--- a/analyzetool/analyzetoolcleaner/eabi/atoolcleaneru.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	_Z18GetCallBackAddressv @ 1 NONAME
-
--- a/analyzetool/analyzetoolcleaner/group/analyzetoolcleaner.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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:  The .mmp file for atoolcleaner.
-*
-*/
-
-#include <platform_paths.hrh>
-
-TARGET			atoolcleaner.dll
-TARGETTYPE	  	dll
-UID 			0x1000008d 0x2002DC71
-CAPABILITY		ALL -TCB
-EPOCALLOWDLLDATA
-
-SMPSAFE
-
-SOURCEPATH  ../src
-SOURCE analyzetoolcleaner.cpp
-
-USERINCLUDE   ../inc
-USERINCLUDE   ../../inc
-
-OS_LAYER_SYSTEMINCLUDE
-
-LIBRARY euser.lib
-LIBRARY flogger.lib
-
-// End of File
--- a/analyzetool/analyzetoolcleaner/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-PRJ_PLATFORMS
-ARMV5 WINSCW
-
-PRJ_EXPORTS
-../inc/analyzetoolcleaner.h  OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/analyzetoolcleaner.h)
-
-PRJ_MMPFILES
-analyzetoolcleaner.mmp
--- a/analyzetool/analyzetoolcleaner/inc/analyzetoolcleaner.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +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:  Definitions for the class TAnalyzeToolCleanerBase.
-*
-*/
-
-#ifndef __ANALYZETOOLCLEANER_H__
-#define __ANALYZETOOLCLEANER_H__
-
-// INCLUDES
-#include <e32std.h>
-
-// CONSTANTS
-#define ATCLEANERTABLESIZE 10
-#define ATCLEANERTABLE TFixedArray<TUint32, ATCLEANERTABLESIZE>
-_LIT( KATCleanerDllName, "atoolcleaner.dll" );
-
-// CLASS DECLARATION
-
-/**
-*  Cleaner base class
-*/
-class TAnalyzeToolCleanerBase
-    {
-public:
-    /**
-    * Cleanup function which uninstall allocator
-    */
-    virtual void Cleanup() = 0;
-    };
-
-// CLASS DECLARATION
-
-/**
-*  Cleaner class
-*/
-class THookCleaner
-    {
-public:
-    /**
-    * C++ default constructor.
-    */
-    THookCleaner();
-    
-    /**
-    * Destructor.
-    */
-    ~THookCleaner();
-    
-    ATCLEANERTABLE iTable;
-    };
-#endif // __ANALYZETOOLCLEANER_H__
--- a/analyzetool/analyzetoolcleaner/src/analyzetoolcleaner.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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:  THookCleaner implementation
-*
-*/
-
-// INCLUDES
-#include "analyzetoolcleaner.h"
-#include <e32debug.h>
-#include "atlog.h"
-
-// Global cleaner object
-static THookCleaner cleaner;
-
-// ordinal 1
-EXPORT_C ATCLEANERTABLE* GetCallBackAddress()
-    {
-    LOGSTR1( "ATC GetCallBackAddress()" );
-    
-    return &( cleaner.iTable );
-    }
-
-// -----------------------------------------------------------------------------
-// THookCleaner::THookCleaner()
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-THookCleaner::THookCleaner()
-    {
-    LOGSTR1( "ATC THookCleaner::THookCleaner()" );
-    
-    iTable.Reset();
-    }
-
-// -----------------------------------------------------------------------------
-// THookCleaner::~THookCleaner()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-THookCleaner::~THookCleaner()
-    {
-    LOGSTR1( "ATC THookCleaner::~THookCleaner()" );
-    
-    for ( TUint i = 0; i < ATCLEANERTABLESIZE; i++ )
-        {
-        if ( iTable.At( i ) )
-            {
-            TAnalyzeToolCleanerBase* obj =
-                    ( TAnalyzeToolCleanerBase* ) iTable.At( i );
-            obj->Cleanup();
-            }
-        }
-    }
-
-// End of File
--- a/analyzetool/commandlineengine/group/atool.vcproj	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,375 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="atool"
-	ProjectGUID="{2C50DD86-958B-4189-8DA2-DB388C71F65F}"
-	RootNamespace="atool"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="131072"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				TreatWChar_tAsBuiltInType="false"
-				UsePrecompiledHeader="0"
-				PrecompiledHeaderThrough="..\inc\stdafx.h"
-				WarningLevel="4"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="..\lib\xerces-c_2.lib ..\lib\dbghelp.lib Version.lib"
-				OutputFile="..\install\atool.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/atool.pdb"
-				SubSystem="1"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				RuntimeLibrary="0"
-				TreatWChar_tAsBuiltInType="false"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="..\lib\xerces-c_2.lib ..\lib\dbghelp.lib Version.lib"
-				OutputFile="..\install\atool.exe"
-				LinkIncremental="1"
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\src\arguments.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\atool.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\cataddr2line.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\cataddr2lineserver.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\catalloc.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\catallocs.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\CATBase.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\CATDataSaver.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\CATDatParser.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\catdbghelper.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\catfilereader.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\CATMemoryAddress.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\CATMmp.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\CATModule2.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\CATParseTraceFile.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\CATParseXML.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\CATProject.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\catromsymbol.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\helps.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\librarychecks.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\stdafx.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\utility.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\src\version.cpp"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath="..\inc\ATCommonDefines.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\cataddr2line.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\cataddr2lineserver.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\catalloc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\catallocs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\CATBase.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\CATDataSaver.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\CATDatParser.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\catdbghelper.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\catfilereader.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\CATMemoryAddress.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\CATMmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\CATModule2.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\CATParseTraceFile.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\CATParseXML.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\CATProject.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\catromsymbol.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\iaddresstoline.h"
-				>
-			</File>
-			<File
-				RelativePath="..\inc\stdafx.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-		<File
-			RelativePath=".\ReadMe.txt"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
--- a/analyzetool/commandlineengine/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +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: 
-*
-*/
-
-
-PRJ_EXPORTS
-../install/atool.exe          +/tools/
-../install/addr2line.exe      +/tools/
-../install/xerces-c_2_7.dll   +/tools/
--- a/analyzetool/commandlineengine/inc/ATCommonDefines.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,598 +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:  Common defines for cpp files.
-*
-*/
-
-
-#ifndef __ATCOMMONDEFINES_H__
-#define __ATCOMMONDEFINES_H__
-
-#include "../inc/stdafx.h"
-
-using namespace std;
-
-/**
-* Atool return code.
-*/
-struct AT_RETURN_CODE {
-	/**
-	* Enumeration containing all return codes used by atool.
-	* When error happens this value set as the exit code.
-	* Note! Values can be only added not modified/deleted.
-	*/
-	enum RETURN_CODE {
-		/* basic */
-		OK = 0,							/** All ok. */
-		INVALID_ARGUMENT_ERROR = 1,		/** Arguments failty. */
-		AT_LIBS_MISSING = 2,			/** Missing at libraries cannot compile hooked apps. */
-		CANNOT_FIND_EPOCROOT = 3,		/** Epocroot not set. */
-		UNHANDLED_EXCEPTION = 4,		/** General return code when unhandled exception occurs. */
-		/* compile errors */
-		MAKEFILE_ERROR = 5,				/** Cannot read/create etc makefiles sbs1/2. */
-		COMPILE_ERROR = 6,				/** Some error related to compilation of code. */
-		UNKNOWN = 7,					/** General compilation error not specific. */
-		NO_SUPPORTED_MODULES_ERROR = 8,	/** Cannot find supported modules from project. */
-		KERNEL_SIDE_MODULE_ERROR = 9,	/** Cannot find supported modules from project because kernel side. */
-		/* Analyze errors */
-		WRONG_DATA_FILE_VERSION = 10,	/** Invalid data file version in internal gathering mode. */
-		INVALID_DATA_FILE = 11,			/** Data file content invalid. */
-		ANALYZE_ERROR = 12,				/** General error in analyze part not specific. */
-		EMPTY_DATA_FILE = 13,			/** Data file is empty. */
-		SYMBOL_FILE_ERROR = 14,			/** Symbol file content invalid or do not exist. */
-		/* building&releasing errors */
-		RELEASABLES_ERROR = 20,			/** Cannot find the binaries of module. */
-		RESTORE_MODULES_ERROR = 21,		/** Error restoring mmp file to original. */
-		CREATING_TEMP_CPP_ERROR = 22,	/** Error creating temporary cpps to store variables to s60 core.*/
-		CLEANING_TEMP_ERROR = 23,		/** Error cleaning atool_temp folder from module. */
-		READ_MAKEFILE_ERROR = 24,		/** Some error when reading makefile of module / project (sbs1/2). */
-		MODIFY_MODULES_ERROR = 25,		/** Error modifying module mmp file. */
-		INVALID_MMP_DEFINED = 27,		/** Specified module does not exist in project. */
-		/* Attribute file related */
-		WRITE_ATTRIBUTES_ERROR = 30,	/** Error writing the cfg file into atool_temp folder (contains arguments).*/
-		READ_ATTRIBUTES_ERROR = 31,		/** Error reading hooking related arguments from cfg file. */
-		/* User issued exit */
-		USER_ISSUED_EXIT = 40,			/** User aborted the run of application. */
-	};
-};
-
-// Debug logging to console
-extern bool g_bDebugConsole;
-// Debug logging to windows api debug
-extern bool g_bDebugDbgView;
-// Debug (low level functions).
-extern bool g_bDebugLowLevel;
-
-// Temporary directory definition's.
-const char AT_TEMP_DIR[] = "atool_temp";
-const char AT_TEMP_LST_DIR[] = "atool_temp\\static_lsts\\";
-
-// makefile dir is used in atool.cpp to check will we use sbs2 (in analyze and clear)
-#define RAPTOR_MAKEFILE_DIR "atool_temp\\build"
-
-// Atool version number and date
-#define ATOOL_VERSION "1.9.1" // NOTE! This version number is written also to temporary cpp file.
-#define ATOOL_DATE "29th April 2010"
-
-// Default/min/max call stack sizes
-const int AT_ALLOC_CALL_STACK_SIZE_DEFAULT = 40;
-const int AT_FREE_CALL_STACK_SIZE_DEFAULT = 0;
-const int AT_CALL_STACK_SIZE_MIN = 0;
-const int AT_CALL_STACK_SIZE_MAX = 256;
-
-// What version of data file contains timestamps in dll's.
-const int AT_DLL_TIMESTAMP_DATA_VERSION = 2;
-
-// Constant compatibility string in temporary cpp.
-// Api version ; current version.
-#define ATOOL_COMPATIBILITY_STRING "1.7.5;1.9.1"
-
-// Datafile version
-#define AT_DATA_FILE_VERSION "DATA_FILE_VERSION 11"
-
-// Latest dbghelp.dll version
-const int DBGHELP_VERSION_MAJ = 6;
-const int DBGHELP_VERSION_MIN = 3;
-const int DBGHELP_VERSION_BUILD = 0;
-const int DBGHELP_VERSION_REVIS = 0;
-const char DBGHELP_DLL_NAME[] = "dbghelp.dll";
-
-
-// Build summary constants
-const string AT_BUILD_SUMMARY_HEADER = "\n###  AnalyzeTool  ###\n### Build Summary ###\n\n";
-const string AT_BUILD_SUMMARY_INSTRUMENTED_BUILD_COMPLETE = "Instrumented build complete: ";
-const string AT_BUILD_SUMMARY_TARGET = "\tTarget: ";
-const string AT_BUILD_SUMMARY_FAILED = "Build failed: ";
-const string AT_BUILD_SUMMARY_ERRORS = "\tErrors: ";
-const string AT_BUILD_SUMMARY_DATA_FILE_NAME = "\tInternal data gathering filename: ";
-const string AT_BUILD_SUMMARY_NORMAL_BUILD_COMPLETE = "Normal build complete: ";
-const string AT_BUILD_SUMMARY_STATIC_LIBRARY = "\tModule is static library.";
-const string AT_BUILD_SUMMARY_UNSUPPORTED_TARGET_TYPE = "\tModule has unsupported target type.";
-const string AT_BUILD_SUMMARY_UNSUPPORTED_COMPILE_DEFINITION = "\tModule defined unsupported compile definition.";
-const string AT_BUILD_SUMMARY_BUILD_TYPE = "Build type: ";
-const string AT_BUILD_SUMMARY_BUILD_TARGET = "Build target: ";
-const string AT_BUILD_SUMMARY_BUILD_PLATFORM = "Build platform: ";
-const string AT_BUILD_SUMMARY_BUILD_VARIANT = "Build variant: ";
-const string AT_BUILD_SUMMARY_LOGGING_MODE = "Data gathering mode: ";
-const string AT_BUILD_SUMMARY_ALLOC_CALL_STACK_SIZE = "Allocation call stack size: ";
-const string AT_BUILD_SUMMARY_FREE_CALL_STACK_SIZE = "Free call stack size: ";
-const string AT_BUILD_SUMMARY_FILE = "monitored internal";
-const string AT_BUILD_SUMMARY_TRACE = "monitored external";
-const string AT_BUILD_SUMMARY_TRACE_FAST = "external";
-
-const string AT_UNSUPPORTED_TARGET_TYPE = "\tModule has unsupported target type.";
-const string AT_UNSUPPORTED_COMPILE_DEFINITION = "\tModule defined unsupported compile definition.";
-
-// List of locations under epocroot where analyzetool.h can be found.
-// Add all possible to this list so core version information can be read
-// from file.
-const string AT_CORE_INCLUDE_FILE_WITH_VERSION_NUMBER[] = {
-	"epoc32\\include\\domain\\osextensions\\analyzetool\\analyzetool.h",
-	"epoc32\\include\\oem\\analyzetool\\analyzetool.h",
-	"epoc32\\include\\platform\\analyzetool\\analyzetool.h"
-};
-const string AT_CORE_VERSION_NUMBER_TAG = "ANALYZETOOL_CORE_VERSION_FOR_CLE";
-
-// Temporary cpp name
-const char AT_TEMP_CPP_LOWER_START[] = "0a1b2c3d_atool_temp_";
-const char AT_TEMP_CPP_LOWER_END[] = ".cpp";
-
-const char TAB_CHAR_VALUE = 9;
-const char SPACE_CHAR_VALUE = 32;
-
-// Bldmake error msg
-#define AT_BLDMAKE_ERROR "AnalyzeTool : bldmake bldfiles error.\n"
-
-// File copy/move/etc... message definitions
-#define AT_MSG "AnalyzeTool : "
-#define AT_MSG_SYSTEM_CALL "AnalyzeTool : System call, "
-#define AT_FILE_TO " to "
-
-// -c messages
-#define AT_CLEANING_DONE "AnalyzeTool : Cleaning done."
-#define AT_CLEANING_NOTHING_FOUND "AnalyzeTool : Nothing found to clean."
-
-// Analyzing data without process start or dll load
-#define AT_ANALYZE_INSUFFICIENT_LOGGING_DATA "Insufficient logging data to locate code lines for memory addresses.\nLogging has been started after process start."
-#define AT_ANALYZE_NO_PROCESS_START "AnalyzeTool : No processes start information found in test run data."
-#define AT_ANALYZE_NO_DLL_LOAD "AnalyzeTool : No dll load information found in test run data."
-#define AT_ANALYZE_CANNOT_PINPOINT "AnalyzeTool : Memory addresses cannot be pinpointed."
-#define AT_ANALYZE_ABNORMAL_EXIT "Abnormal process end"
-
-// Analyzing without map / lst files
-#define AT_ANALYZE_MISSING_LST_MAP_FILES "AnalyzeTool : Missing lst or map files, memory addresses shown only to module level.\n"
-//#define AT_UNINSTRUMENT_FAILED_IN_ANALYZE_MESSAGE "AnalyzeTool: Error creating map/lst files, leaks shown only to module level.\nRun atool -u to try create lst/map files again after binaries build successfully.\n"
-
-// Mmp error msg
-#define INVALID_MMP_ERROR "AnalyzeTool : Error, Specified mmp is invalid.\n"
-
-// Make error msg
-#define MAKE_ERROR "AnalyzeTool : Error, Running make.\n"
-
-#define AT_NOT_BEEN_BUILD_ERROR "AnalyzeTool : Error, project has not been build using AnalyzeTool.\n"
-
-// Makefile errors
-#define LEVEL1_MAKEFILE_ERROR "AnalyzeTool : Error, reading level 1 makefile.\n"
-#define LEVEL2_MAKEFILE_ERROR "AnalyzeTool : Error, reading level 2 makefile.\n"
-#define MAKEFILE_ERROR_TIP "AnalyzeTool : Tip, your environment might require you to use -variant [target] argument.\n";
-
-//Variant messages
-#define INVALID_VARIANT_ERROR "AnalyzeTool : Error,Specified variant is invalid.\n"
-#define USING_DEFAULT_VARIANT_MESSAGE "AnalyzeTool : Note, Using DEFAULT variant.\n"
-#define NO_DEFAULT_VARIANT_ERROR "AnalyzeTool : Error, environment does not specify DEFAULT variant (No variant support?).\n"
-
-// Variant dir is the dir where all variants are defined
-#define VARIANT_DIR "\\epoc32\\tools\\variant\\"
-
-// Variants defined extension name of the variant must equal filename
-#define VARIANT_FILE_EXTENSION ".VAR"
-
-//Max file name length
-const int MAX_FILENAME_LENGTH = 1024;
-
-//Max line length when reading lines from text file.2048 should be enought.
-const int MAX_LINE_LENGTH = 2048*8;
-
-// ATs project file name to store project attributes
-#define AT_PROJECT_ATTRIBUTES_FILE_NAME "project.cfg"
-const string AT_PROJECT_ATTRIBUTES_SEPARATOR( ":$:" );
-
-// ATs level1 makefile name
-#define AT_LEVEL_1_MAKEFILE_NAME "main.at"
-
-// ATs level2 makefiles extension
-#define AT_LEVEL_2_MAKEFILE_EXT "atm"
-
-//Default logging level
-const int DEFAULT_LOGGING_LEVEL = 3;
-
-//Minimun value of logging level 
-const int MIN_LOGGING_LEVEL = 0;
-
-//Maximun value of logging level
-const int MAX_LOGGING_LEVEL = 3;
-
-//Const char represeting dash
-const char DASH = '\\';
-
-/**
- * Table of file extension not to delete
- * from atools temp directory when compiling
- * note define all in lowercase
- */
-const string TEMP_EXTENSION_NO_DELETE[] = {
-	"xml",
-	"dat",
-	"tmp",
-	"cpp",
-	"at",
-	"atm",
-	"cfg"
-};
-
-// Allowed characters/digits, other than these will be filtered out when using CATBase FilterString
-const char CFILTERSTRING[] = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
-
-/**
- * Table of unsupported target types
- * (i.e. mmp file syntax targettype in makefile)
- * List of target types which will not be hooked:
-*/
-const string UNSUPPORTED_TARGET_TYPES[] = {
-	"CTL",
-	"ECOMIIC",
-	"IMPLIB",
-	"KDLL",
-	"KEXT",
-	"KLIB",
-	"LDD",
-	/* "LIB",  currently have own vector in project.*/
-	"MDA",
-	"MDL",
-	"NONE",
-	"NOTIFIER",
-	"PDD",
-	"RDL",
-	"STDLIB",
-	"VAR"
-};
-
-/**
-* Kernel side target types
-*/
-const string KERNEL_SIDE_TARGET_TYPES[] = {
-	"VAR",
-	"LDD",
-	"PDD",
-	"KEXT"
-};
-
-// Kernel mode compile definition
-const string KERNEL_MODE_COMPILE_DEFINITION = "__KERNEL_MODE__";
-
-/**
-* MMP file changes for AT
-* Note "SOURCE            0a1b2c3d_atool_temp_TARGET.cpp" is added also.
-*/
-const string MMPFILECHANGES[] = {
-	"//*** AnalyzeTool changes start ***",
-	"SOURCEPATH        atool_temp",
-	"LIBRARY           AToolMemoryHook.lib",
-	"STATICLIBRARY     AToolStaticLib.lib",
-	"OPTION ARMCC --interleave",
-	"//*** AnalyzeTool changes end ***"
-};
-
-//MMP file changes for AT
-//For targettype Dll
-const string MMPFILECHANGES_DLL[] = {
-	"//*** AnalyzeTool changes start ***",
-	"OPTION ARMCC --interleave",
-	"//*** AnalyzeTool changes end ***"
-};
-
-// Trace file constants definitions
-#define LABEL_DATA_FILE_VERSION "DATA_FILE_VERSION"
-#define LABEL_PROCESS_START     "PROCESS_START"
-#define LABEL_DLL_LOAD          "DLL_LOAD"
-#define LABEL_DLL_UNLOAD		"DLL_UNLOAD"
-#define LABEL_MEM_LEAK          "MEM_LEAK"
-#define LABEL_PROCESS_END       "PROCESS_END"
-#define LABEL_ERROR_OCCURED     "ERROR_OCCURED"
-#define LABEL_HANDLE_LEAK       "HANDLE_LEAK"
-#define LABEL_TEST_START        "TEST_START"
-#define LABEL_TEST_END          "TEST_END"
-#define LABEL_LOGGING_CANCELLED "LOGGING_CANCELLED"
-
-// AddressToLine related constants
-
-#define LABEL_ABNORMAL "ABNORMAL"
-const int FUNCTIONS_OFFSET_IN_MAP_FILE_ARMV5 = 0x8000;
-const int FUNCTIONS_OFFSET_IN_GCCE = 0x8000;
-const int FUNCTIONS_OFFSET_IN_MAP_FILE_WINSCW = 0x400000;
-#define TEXT_NO_HANDLE_LEAKS "No handle leaks."
-
-// Make file constant labels
-#define MAKEFILE_TARGETTYPE_STRING "# TargetType "
-#define MAKEFILE_BASIC_TARGETTYPE_STRING "# BasicTargetType "
-#define MAKEFILE_TARGET_STRING "# Target "
-#define MAKEFILE_FEATURE_VARIANT_NAME "# FeatureVariantName "
-#define MAKEFILE_FEATURE_VARIANT_UREL_LABEL "# FeatureVariantURELLabel "
-#define MAKEFILE_FEATURE_VARIANT_UDEB_LABEL "# FeatureVariantUDEBLabel "
-#define UDEB_OPTIMIZATION_LEVEL 0
-
-// Listing file contant labels
-#define LST_FILE_SOURCE_FILE_LABEL "Source file:"
-
-/**
-* Struct for saving module info from .dat file and number of leaks in module.
-*/
-struct DLL_LOAD_INFO
-{
-	string sModuleName; /** name of the code segment/binary */
-	unsigned long iStartAddress; /** start address of code segment (in memory) */
-	unsigned long iEndAddress; /** end address of code segment (in memory) */
-	int iLeaks; /** leak count in this code segment */
-	unsigned long iPID; /** process id which loaded this code segment */
-	int iSubTestStartOpenHandles; /** open handle count when sub test started */
-	int iSubTestEndOpenHandles; /** open handle count when sub test ended */
-	// Load/Unload times, note these are micro seconds from 1970 so size is huge.
-	unsigned long long iLoadTime; /** code segment load time */
-	unsigned long long iUnloadTime; /** code segment unload time */
-	/**
-	* Default constructor to set default values
-	*/
-	DLL_LOAD_INFO() {
-		iStartAddress = 0;
-		iEndAddress = 0;
-		iLeaks = 0;
-		iPID = 0;
-		iSubTestStartOpenHandles = 0;
-		iSubTestEndOpenHandles = 0;
-		iLoadTime = 0;
-		iUnloadTime = 0;
-	};
-};
-
-/**
-* Struct for saving symbol information from listing file
-*/
-struct LINE_IN_FILE
-{
-	int iLine; /** line number */
-	string sFileName; /** filename */
-	string sFunction; /** function / symbol */
-	string sMangledName; /** function / symbol name in mangled / coded form */
-	string sLstName; /** listing filename */
-};
-
-/**
-* Struct for saving symbol information from map file
-*/
-struct MAP_FUNC_INFO
-{
-	int iAddress; /** memory address (start of symbol) */
-	int iFuncLength; /** symbol length */
-	string sMangledName;/** symbol name in mangled / coded form */
-	string sWholeLine; /** whole symbol line from map file */
-	string sFunctionName; /** symbol clear name */
-};
-
-/**
-* State that represents the outcome
-* of locating memory address code line from module
-*/
-enum ADDRESS_TO_LINE_STATE {
-	no_map_data = 0, /** Map data was missing */
-	out_of_function_range, /** Could not locate it to any function */
-	mangled_symbol_name, /** symbol name but mangled / coded form */
-	only_function_name, /** Only got function name not code line */
-	succesfull /** Have line number, function, etc...*/
-};
-
-/**
-* Struct to store detail data and state when
-* locating memory addresses code lines
-*/
-struct ADDRESS_TO_LINE_ITEM {
-	ADDRESS_TO_LINE_STATE eState; /** outcome */
-	string sFileName; /** Filename of address */
-	string sFunctionName; /** Function name of address */
-	string sMangledFunctionName; /** function/Symbol name */
-	int iFunctionLineNumber; /** Functions line number */
-	int iExactLineNumber; /** Exact line number of address */
-};
-
-/**
-* Struct to store  memory leaks
-* call stack entry data
-*/
-struct CALL_STACK_ITEM {
-	string sAddress; /** Address in string */
-	int iAddress; /** Address in number (converted)*/
-	int iLocation; /** Location. i.e. corresponds m_vDllLoadModList's index*/
-	int iCalculatedLeakAddress; /** calculated address from code segment start */
-	bool bBuildUdeb; /** Optimization level */
-	string sModuleName; /** Modules name were leak is*/
-	ADDRESS_TO_LINE_ITEM addressToLine; /** Data from locating code line for memory address */
-};
-
-/**
-* Enumerations used in argument structure.
-*/
-enum MAIN_SWITCH
-{
-	SWITCH_UNKNOWN = 0, /** not defined */
-	SWITCH_ANALYZE = 1, /** analyze */
-	SWITCH_HOOK = 2, /** compile/instrument */
-	SWITCH_UNHOOK = 3, /** uninstrument */
-	SWITCH_PARSE_TRACE = 5, /** parse raw data */
-	SWITCH_CLEAN = 6, /** clean AT changes */
-	SWITCH_VERSION = 9, /** display version infromation */
-	SWITCH_HELP = 10, /** show help with syntax examples */
-	SWITCH_DBGHELP_VERSION = 11
-};
-
-/**
-* Enumeration used when hooking project.
-*/
-enum HOOK_SWITCH
-{
-	HOOK_UNKNOWN = 0, /** not defined */
-	HOOK_INTERNAL, /** monitored internal data gathering */
-	HOOK_EXTERNAL, /** monitored external data gathering */
-	HOOK_EXTERNAL_FAST, /** external data gathering */
-	HOOK_EXTENSION_INTERNAL, /** Extension call, monitored internal data gathering */
-	HOOK_EXTENSION_EXTERNAL, /** Extension call, monitored external data gathering */
-	HOOK_EXTENSION_EXTERNAL_FAST, /** Extension call, external data gathering */
-	HOOK_EXTENSION_UNINSTRUMENT, /** Extension call, uninstrument (post-build)*/
-	HOOK_EXTENSION_FAILED, /** Extension call, build failed, cleanup */
-	HOOK_OLD_EXTENSION_INSTRUMENT, /** Old extension call, instrument project */
-	HOOK_OLD_EXTENSION_UNINSTRUMENT, /** Old extension call, uninstrument project */
-	HOOK_OLD_EXTENSION_FAILED /** Old extension call, cleanup */
-};
-
-/**
-* Represents hooking parameters, these are set
-* by the user arguments from command line.
-*/
-struct ARGUMENTS_HOOK
-{
-	bool bNoBuild; /** Only intrument project? (no build) */ 
-	bool bDataFileName; /** Is internal data gathering filename defined */
-	bool bAbldTest; /** Is build only for test modules (abld test build.. */
-	string sDataFileName; /** Internal data gathering filename */
-	int iBuildSystem; /** 1 = sbs, 2 = raptor */
-	int iLoggingMode; /** Just for old parameter parsing. 1=trace, 2=file, 0=? */
-	int iAllocCallStackSize; /** Call stack size when memory allocated */
-	int iFreeCallStackSize; /** Call stack size when memory freed */
-	string sBuildCmd; /** Original build command / user defined or given */
-	vector<string> vBuildCmd; /** Build command split in vector */
-	string sPlatform; /** Build platform */
-	string sBuildType; /** Build type (udeb/urel) */
-	string sFeatureVariant; /** Build variant defined */
-	vector<string> vTargetPrograms; /** User defined single or multiple modules from project? */
-	/**
-	* Default constructor to set default values.
-	*/
-	ARGUMENTS_HOOK()
-	{
-		bNoBuild = false;
-		bAbldTest = false;
-		bDataFileName = false;
-		sDataFileName = "";
-		iBuildSystem = 0;
-		iLoggingMode = 0;
-		iAllocCallStackSize = AT_ALLOC_CALL_STACK_SIZE_DEFAULT;
-		iFreeCallStackSize = AT_FREE_CALL_STACK_SIZE_DEFAULT;
-		sBuildCmd = "";
-		sPlatform = "";
-		sBuildType = "";
-		sFeatureVariant = "";
-		vTargetPrograms.clear();
-	};
-};
-
-/**
-* Represents analyze parameters, these are set
-* by the user arguments from command line.
-*/
-struct ARGUMENTS_ANALYZE
-{
-	string sDataFile; /** Data file to be analyzed */
-	string sOutputFile; /** Output file */
-	bool bSymbolFile; /** Is rom/rofs symbol file(s) defined? */
-	vector<string> vSymbolFiles; /** Collection of symbol files */
-	int iLoggingLevel; /** Logging level of report */
-	/**
-	* Default constructor to set default values.
-	*/
-	ARGUMENTS_ANALYZE()
-	{
-		sDataFile = "";
-		sOutputFile = "";
-		bSymbolFile = false;
-		iLoggingLevel = 3;
-	};
-};
-
-/**
-* Represents raw trace parsing parameters, these are set
-* by the user arguments from command line.
-*/
-struct ARGUMENTS_PARSE
-{
-	bool bDataFile; /** Is raw data file defined */
-	string sDataFile; /** Raw data file (input) */
-	bool bOutputFile; /** Is output file defined */
-	string sOutputFile; /** Output (AT specific data file)*/
-	/**
-	* Default constructor to set default values.
-	*/
-	ARGUMENTS_PARSE()
-	{
-		bDataFile = false;
-		sDataFile = "";
-		bOutputFile = false;
-		sOutputFile = "";
-	};
-};
-
-
-/**
-* Represents main parameters, these are set
-* by the user arguments from command line.
-*/
-struct ARGUMENTS
-{
-	// Base arguments.
-	MAIN_SWITCH eMainSwitch; /** mandatory/main parameter */
-	HOOK_SWITCH eHookSwitch; /** if compile/instrument its "mode" */
-	bool bHelp; /** show help? */
-	bool bDebugConsole; /** enable debug logging to console? */
-	bool bDebugDbgView; /** enable debug logging to win api? */
-	bool bDebugLowLevel; /** enable debug logging for also low level functions? */
-	bool bEnableSbs2; /** use raptor as build system? */
-	ARGUMENTS_HOOK HOOK; /** hooking/instrument/compiling attributes */
-	ARGUMENTS_ANALYZE ANALYZE; /** analyze related attributes */
-	ARGUMENTS_PARSE PARSE; /** parsing related attributes */
-	/**
-	* Default constructor to set default values.
-	*/
-	ARGUMENTS()
-	{
-		eMainSwitch = SWITCH_UNKNOWN;
-		eHookSwitch = HOOK_UNKNOWN;
-		bHelp = false;
-		bDebugConsole = false;
-		bDebugDbgView = false;
-		bEnableSbs2 = false;
-	};
-};
-
-// DEBUG MACROS
-// constant string for all beginning of all debug messages
-const char START_LOG_MESSAGE[] = "*** CLE ";
-// Log normal function entry (AAA = class::function )
-#define LOG_FUNC_ENTRY( AAA ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << "ENTRY: " << AAA << endl; OutputDebugString( strs.str().c_str() );  } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << "ENTRY: " << AAA << endl; cout << strs.str();  } }
-// Log normal function exit
-#define LOG_FUNC_EXIT( AAA ){ if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << "EXIT: " << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << "EXIT: " << AAA << endl; cout << strs.str(); } }
-// Log low level function entry
-#define LOG_LOW_FUNC_ENTRY( AAA ) { if ( g_bDebugLowLevel ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; cout << strs.str(); } } }
-// Log low level function exit
-#define LOG_LOW_FUNC_EXIT( AAA ) {  if ( g_bDebugLowLevel ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; cout << strs.str(); } } }
-// Log stringstream (string, int, etc..) i.e. string1 << int1 << "log this"
-#define LOG_STRING( AAA ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; cout << strs.str(); } }
-
-#endif
\ No newline at end of file
--- a/analyzetool/commandlineengine/inc/CATBase.h	Fri Aug 27 11:37:29 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:  Defines CATBase "utility" class.
-*
-*/
-
-#ifndef __CATBASE_H__
-#define __CATBASE_H__
-
-#include "../inc/ATCommonDefines.h"
-
-/**
-* This class implements lot of utility type of functions used all around atool project.
-* All functions are static so they can be used without inheritance of this class. But still
-* this is a base class of almost all others.
-*/
-class CATBase
-{
-public:
-	
-	/**
-	* Constructor
-	*/
-	CATBase();
-
-	/**
-	* Destructor
-	*/
-	virtual ~CATBase(void);
-
-public:
-	
-	/**
-	* FilterExtraSpaces
-	* Filters/replaces multiple continuous spaces with single. Won't leave
-	* spaces in start or end of string.
-	* @param sString to filter.
-	* @return void.
-	*/
-	static void FilterExtraSpaces( string& sString );
-
-	/**
-	* Convert hex value in string to signed decimal.
-	* @param sHex
-	* @param iDec
-	* @return true if successful
-	*/
-	static bool hexToDec( string& sHex, int& iDec );
-
-	/**
-	* Convert hex value in string to unsigned decimal
-	* @param sHex
-	* @param iDec
-	* @return true if successful
-	*/
-	static bool hexToDec( string& sHex, unsigned int& iDec );
-
-	/**
-	* Convert hex value in string to unsigned long.
-	* @param sHex
-	* @param ulDec
-	* @return true if successful
-	*/
-	static bool hexToDec( string& sHex, unsigned long& ulDec );
-
-	/**
-	* Convert hex value in string to unsigned long long.
-	* @param sHex
-	* @param ullDec
-	* @return true if successful
-	*/
-	static bool hexToDec( string& sHex, unsigned long long& ullDec );
-
-	/**
-	* Convert hex value to integer
-	* @param value
-	* @return unsigned long
-	*/
-	static unsigned long _httoi(const TCHAR *value);
-
-	/**
-	* Convert integer to hex string.
-	* @param i
-	* @return hex string
-	*/
-	static string NumberToHexString( unsigned int i );
-
-	/**
-	* Convert long to hex string.
-	* @param i
-	* @return hex string
-	*/
-	static string NumberToHexString( unsigned long i );
-
-	/**
-	* Helper function checks is given character hex.
-	* @param value value to check.
-	* @return true if value is hex char.
-	*/
-	static bool IsHexCharacter(const TCHAR *value);
-
-	/**
-	* Parse string to vector of strings using
-	* separator. (Tokenizer with delimeter).
-	* @param sInput string to split
-	* @char separator
-	* return vector<string>
-	*/
-	static vector<string> ParseStringToVector( const string& sInput, char separator );
-
-	/**
-	* Remove spaces and tabulatures from beginning and
-	* end of given string.
-	* @param sInput String to trim.
-	*/
-	static void TrimString( string& sInput );
-
-	/**
-	* Searches files with given extension from path.
-	* @param pPathAndExt path with extension
-	* @return string filename
-	*/
-	static string GetFileNameUsingExt( const char* pPathAndExt );
-
-	/**
-	* Changes all BackSlash characters to Slash character from string.
-	* @param sInput String including backslashes.
-	* @return String without backslashes.
-	*/
-	static string ChangeSlashToBackSlash( string sInput );
-
-	/**
-	* Changes given string to uppercase
-	* @param sInput
-	*/
-	static void ChangeToUpper( string& sInput );
-
-	/**
-	* Converts any uppercase letter to lowercase.
-	*
-	* @param sInput Reference to string.
-	*/
-	static void ChangeToLower( string& sInput );
-
-	/**
-	* Filter string out of unwanted characters. The list of allowed
-	* characters is defined in CFILTERSTRING.
-	* @param sString string to filter.
-	* @return filtered string.
-	*/
-	static string FilterString( const string& sString );
-
-	/**
-	* Removes path and extension from given filename string
-	* @param sFileName
-	* @param bReverseFindExt if true extension will be looked starting from end
-	* @return string
-	*/
-	static string RemovePathAndExt( string sFileName, bool bReverseFindExt = false );
-
-	/**
-	* Check if given file exists.
-	* @param pFilename Pointer to file name.
-	* @return False If file does not exists.
-	*/
-	static bool FileExists( const char* pFilename );
-
-	/**
-	* Check if given file is flagged read only.
-	* @param pFileName pointer to file name
-	* @return true if read only flag set.
-	*/
-	static bool IsFileReadOnly( const char* pFileName );
-
-	/**
-	* Set file read only.
-	* @param pFileName Pointer to file name
-	* @return true if successful.
-	*/
-	static bool SetFileReadOnly( const char* pFileName );
-
-	/**
-	* Set file writable (remove read only flag).
-	*
-	* @param pFilename Pointer to file name.
-	* @return true if successful.
-	*/
-	static bool SetFileWritable( const char* pFileName );
-
-	/**
-	* Copy file to given path
-	* @param sFile
-	* @param sToPath
-	* @return true if successful
-	*/
-	static bool FileCopyToPath(const string& sFile, const string& sToPath);
-
-	/**
-	* Move file to given path
-	* @param sFile File to be moved
-	* @param sToPath path where to move file
-	* @return true if successful
-	*/
-	static bool FileMoveToPath(const string& sFile, const string& sToPath);
-
-	/**
-	* Delete file
-	* Note! if file does not exists no error message is displayed
-	* but function returns false
-	* @param sFile File to be deleted
-	* @param bPrint display messages or not, default true
-	* @return true if successful
-	*/
-	static bool FileDelete(const string& sFile, bool bPrint = true );
-    
-	/**
-	* Delete dir
-	* Note! if dir does not exists no error message is displayed
-	* but function returns false.
-	* This function wont delete directory if string does not contain
-	* AT_TEMP...
-	* @param sDir Directory to be deleted
-	* @param bPrint display message or not, default true
-	* @return true if successful
-	*/
-	static bool DirDelete(const string& sDir, bool bPrint = true );
-
-	/**
-	* Create dir
-	* Note! if dir cannot be created no error message is displayed
-	* but function returns false.
-	* @param sDir Directory to be deleted
-	* @param pPrint display message or not, default true
-	* @return true if successful
-	*/
-	static bool DirCreate(const string& sDir, bool pPrint = true );
-
-	/**
-	* Create temp path string for given
-	* mmpfile (full path+mmpname)
-	* @param sMmpFileWithPath
-	* @return string containing full path to
-	* AnalyzeTool temporary directory
-	*/
-	static string CreateTempPath(const string& sMmpFileWithPath);
-
-	/**
-	* Search files with extensions from given path.
-	* @param pPathAndExt path with extension definition
-	* @param bPrintErrors do print errors?
-	* @param sErrorLog errors
-	* @return true if found.
-	*/
-	static bool SearchFileWithExtension( const char* pPathAndExt, bool bPrintErrors, string& sErrorLog );
-
-	/**
-	* Helper function to parse filename or path from given string
-	* @param bFileName if true returns filename otherwise the path
-	* @param sInput string where to get path or filename
-	* @return string filename or path
-	*/
-	static string GetPathOrFileName( bool bFileName, string sInput );
-
-	/**
-	* Function returns string from begin of given string until next space,
-	* characters until next space are removed from sInput string.
-	*
-	* @param sInput Line where data is separated with spaces.
-	* @param bEraseFromInput If true characters before space will be removed.
-	* @return string String until next space.
-	*/
-	static string GetStringUntilNextSpace( string& sInput, bool bEraseFromInput = true );
-
-	/**
-	* Convert unix path to windows
-	* @param sPath
-	*/
-	static void ConvertUnixPathToWin( string& sPath );
-
-	/**
-	* Create Temporary AT Cpp file
-	* @param sId unique id to add in file name
-	* @param sPath where to create
-	* @param sS60FileName of the logging file
-	* @param iLogOption logging mode
-	* @param iIsDebug build type
-	* @param iAllocCallStackSize
-	* @param iFreeCallStackSize
-	* @return true if successful
-	*/
-	static bool CreateTemporaryCpp( const string& sId
-								 ,const string& sPath
-								 ,const string& sS60FileName
-								 ,int iLogOption
-								 ,int iIsDebug
-								 ,int iAllocCallStackSize
-								 ,int iFreeCallStackSize );
-	/**
-	* Acquire a list of files in given directory
-	* @param sDirectory can end to \ or x but not to *
-	* @param bListDirs if true directories will be listed as well, default false
-	* @param bAddPathToFile if true given sDirectory path is added to file string, default false
-	* @return vector<string> list of files in folder
-	*/
-	static vector<string> DirList(const string& sDirectory, bool bListDirs = false, bool bAddPathToFile = false);
-
-	/**
-	* Get extension from given "file" string
-	* returns string after last . if any otherwise returns same
-	* what was given
-	* @param sString 
-	* @return string string after last '.' if no '.' returns given string
-	*/
-	static string GetExtension(const string& sString);
-
-	/**
-	* Convert TCHAR pointer to string
-	* @param charArray to convert
-	* @return string
-	*/
-	static string ConvertTCHARtoString(TCHAR* charArray);
-
-	/**
-	* if given string contains two dots '.' this will remove
-	* all characters after first '.'
-	*/
-	static void RemoveAllAfterDotIfTwoDots(string& sString);
-
-	/**
-	* checks given file is it data file
-	* @param sFile
-	* @return true if it is datafile
-	*/
-	static bool IsDataFile( string sFile );
-
-	/**
-	* Parses a path string containing ".." to a valid
-	* path without relations. If given string does
-	* not contain relations it will not be changed
-	* @param sPathString
-	* @return void
-	*/
-	static void ParseRelativePathString(string& sPathString);
-
-	/**
-	* Remove relative path ".." from string
-	* @param sString string to remove from
-	* @param iDots index of ".."
-	* @return void
-	*/
-	static void RemoveRelativePath(string& sString, size_t iDots);
-
-	/**
-	* Check if given directory exists.
-	*
-	* @param pDirname Pointer to directory name.
-	* @return False If directory does not exists.
-	*/	
-	static bool DirectoryExists( const char* pDirname );
-
-	/**
-	* Checks from constant array is this targettype
-	* unsupported by AT
-	* @param sTargetType type to check
-	* @return true if it is supported by atool
-	*/
-	static bool IsTargetTypeSupported(string sTargetType);
-
-	/**
-	* Checks from constant array is this targettype
-	* kernel side.
-	* @param sTargetType type to check
-	* @return true if it is kernel type
-	*/
-	static bool IsTargetTypeKernelSide(string sTargetType);
-
-	/**
-	* Check is given variant defined in environment.(SBS v.1)
-	* @param sEpocroot
-	* @param sVariantName
-	* @return true if it is.
-	*/
-	static bool CheckVariant( const string& sEpocroot, const string& sVariantName );
-
-	/**
-	* Check has the environment defined "DEFAULT" variant
-	* @param sEpocRoot
-	* @return true if it is
-	*/
-	static  bool IsDefaultVariant( const string& sEpocRoot );
-
-	/**
-	* Check is all character ascii
-	* @param pInput pointer to characters
-	* @param iLength length of the string
-	* @return true if all character are ascii
-	*/
-	static bool IsAscii( const char* pInput, const unsigned int iLength );
-
-	/**
-	* Get current environments epocroot.
-	* @param sEpocRoot value is stored in this if successful.
-	* @return true if successful.
-	*/
-	static bool GetEpocRoot( string& sEpocRoot );
-};
-#endif
--- a/analyzetool/commandlineengine/inc/CATDatParser.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,283 +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:  Defines CATDatParser class and its used enumerations.
-*
-*/
-
-
-#ifndef __CATDatParser_H__
-#define __CATDatParser_H__
-
-// Includes.
-#include "ATCommonDefines.h"
-#include "CATBase.h"
-#include "CATDataSaver.h"
-
-// Forward declarations.
-class CATModule2;
-class CATMemoryAddress;
-class CATRomSymbol;
-
-/**
-* Provides the analyze feature for AnalyzeTool specific data file.
-* Is used by CATProject. Uses CATModule2 and/or CATRomSymbol to locate symbols or
-* codelines of memory addressses. Uses CATDataSaver to create report.
-*/
-class CATDatParser : public CATBase
-{
-
-public:
-	/**
-	* enumeration representing the "mode" depending on build system
-	*/
-	enum ANALYZE_MODE
-	{
-		SBS_1 = 0,
-		SBS_2 = 1
-	};
-	/**
-	* Representing current process state
-	*/
-	enum PROCESS_STATE
-	{
-		not_started = 0,
-		ongoing = 1,
-		stopped = 2
-	};
-
-	/**
-	* Constructor.
-	*/
-	CATDatParser();
-
-#ifndef MODULE_TEST
-private:
-#endif
-	/**
-	* Real constructor.
-	*/
-	void Construct();
-	
-	/**
-	* Prevent copy
-	*/
-	CATDatParser& operator =( const CATDatParser& /*other*/ ) { }
-	CATDatParser( const CATDatParser& /*other*/ ) { }
-	
-public:
-	/**
-	* Constructor for SBS2
-	* @param pModules pointer to vector containing project modules
-	*/
-	CATDatParser( vector<CATModule2*>* pModules );
-
-	/**
-	* Destructor
-	*/
-	~CATDatParser();
-
-	/**
-	* Set offset to be used with mapfiles
-	* @param iOffSet
-	*/
-	void SetOffSet( int iOffSet );
-
-	/**
-	* Get offset value
-	* @return int
-	*/
-	int GetOffSet( ) const;
-	
-	/**
-	* Analyze data file set
-	* This method includes try/catch in parsing
-	* @return int error codes specified in CATProject (0=OK)
-	*/
-	int Analyze();
-
-	/**
-	* Set log level
-	* @param iLogLevel
-	*/
-	void SetLogLevel(int iLogLevel);
-	/**
-	* Get Log level
-	* @return int
-	*/
-	int GetLogLevel() const ;
-
-	/**
-	* Set data file to be analyzed
-	* @param sInputFile
-	*/
-	void SetInputFile(const string& sInputFile);
-
-	/**
-	* Set output file
-	* @param sOutputFile
-	*/
-	void SetOutputFile(const string& sOutputFile);
-
-	/**
-	* Set rom symbol file(s).
-	* @param sRomSymbolFile
-	*/
-	void SetRomSymbolFiles(const vector<string>& vRomSymbolFile);
-
-	/**
-	* Set print flag
-	* @param pPringFlag
-	*/
-	void SetPringFlag( bool bPrintFlag );
-
-	/**
-	* Set addr2line.exe pinpoint state
-	* @param bInput
-	*/
-	void SetAddr2lineExeState( bool bInput );
-
-	/**
-	* Set project platform.
-	* @param sPlatform platform.
-	*/
-	void SetProjectPlatform( const string& sPlatform );
-
-	/**
-	* Set projects build type. Use enumeration defined in CATProject.
-	* @param eBuildType.
-	*/
-	void SetProjectBuildType( int eBuildType );
-
-#ifndef MODULE_TEST
-private:
-#endif
-
-	/**
-	* Start parsing datafile
-	* @return error codes defined in CATProject
-	*/
-	int Parse();
-	
-	/**
-	* Helper functio to print header of report
-	*/
-	void Header();
-
-	/**
-	* Helper functio to print footer of report
-	*/
-	void Footer();
-
-	/**
-	* Helper function reseting/clearing all
-	* member variables related to parsing
-	*/
-	void ClearParsingVariables();
-
-	// Helpers for data file tags
-	bool ParseProcessStart( string& sLine );
-	bool ParseDllLoad( string& sLine );
-	bool ParseDllUnload( string& sLine );
-	bool ParseMemLeak( string& sLine );
-	bool ParseProcessEnd( string& sLine );
-	bool ParseHandleLeak( string& sLine );
-	bool ParseTestStart( string& sLine );
-	bool ParseTestEnd( string& sLine );
-	bool ParseLoggingCancelled( string& sLine );
-	bool ParseErrorOccured( string& sLine );
-
-	void PrintMemLeak(const string& sTime,
-					   const string& sLeakSize,
-					   const string& sLeakAddr,
-					   const string& sModuleName);
-
-	// Utilities
-	string ConvertTimeToLocalTime( string sInputTime );
-
-	/**
-	* Create a winscw module into pModules vector.
-	* Used when we have dll load of module not in project to create them
-	* after this they are used in locating code lines.
-	* @param sBinaryName name of the binary with extension.
-	* @return true if successful.
-	*/
-	bool CreateWinscwModule( const string& sBinaryName );
-
-#ifndef MODULE_TEST
-private:
-#endif
-
-	void CleanMemoryAddresses();
-
-	// Members
-	unsigned int m_iDataVersion; // Version of data file.
-	int m_eProcess_state; // is process started, etc..
-	bool m_bProcessStartFound;
-	bool m_bDllLoadFound;
-	int m_iLogLevel; // specified logging level
-	string m_sInputFile; // input file
-	vector<string> m_vRomSymbolFiles; // Rom symbol file.
-	string m_sOutputFile; // output file
-	string m_sInputFileTemp; // temporary input file (parsed from trace)
-	ifstream m_In; // Handle to input file
-	// Datasaver
-	CATDataSaver m_DataSaver;
-
-	// Modules to be used in pinpointing
-	vector<CATModule2*>* m_pModules;
-
-	// Rom symbol file.
-	CATRomSymbol* m_pRomSymbol;
-
-	// Build type from dat.
-	int m_eBuildType;
-	// Build type from project.
-	int m_eProjectBuildType;
-	// Offset of map file.
-	int m_iOffSet;
-	// Platform of project.
-	string m_sProjectPlatform;
-
-	// Process related
-	unsigned long m_iCurrentProcessId;
-	string m_sCurrentProcessName;
-	int m_iTotalRuns;
-	int m_iSuccesfullRuns;
-	
-	// Leak counting related
-	int m_iTotalNumberOfLeaks;
-	bool m_bSubtestOnGoing;
-	int m_iPinPointedLeaks;
-	int m_iPinPointedSubTestLeaks;
-	int m_iLeakNumber;
-	
-	// Handle count related
-	int m_iSubtestStartHandleCount;
-	vector<string> m_vHandleLeaks;
-
-	// Module related
-	vector<DLL_LOAD_INFO> m_vDllLoadModList;
-	vector<DLL_LOAD_INFO> m_vDllLoadModListSubTest;
-	
-	// Sbs 1 support functions
-	int FindModuleUsingAddress( unsigned long iAddress ) const;
-	//int FindModuleUsingPID( unsigned long iPID ) const;
-	int FindModuleUsingName( const char* pModName );
-
-	// Memory addresses
-	vector<CATMemoryAddress*> m_vMemoryAddress;
-
-};
-#endif
-//EOF
--- a/analyzetool/commandlineengine/inc/CATDataSaver.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +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:  Defines CATDataSaver class and element type enumeration.
-*
-*/
-
-
-#ifndef __CATDATASAVER_H__
-#define __CATDATASAVER_H__
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/framework/LocalFileFormatTarget.hpp>
-#include "ATCommonDefines.h"
-
-/**
-* Represents element types
-*/
-enum element_types
-{
-	RESULT = 0,
-	RUN,
-	LEAK,
-	CALLSTACK,
-	ITEM,
-	RUN_END,
-	ERROR_IN_RUN,
-	MEM_LEAKS,
-	MEM_LEAK_MODULE,
-	HANDLE_LEAKS,
-	HANDLE_LEAK_MODULE,
-	TEST_START,
-	TEST_END,
-	SUBTEST_MEM_LEAKS,
-	SUBTEST_MEM_LEAK_MODULE,
-	LOGGING_CANCELLED,
-	SUBTEST_HANDLE_LEAKS
-};
-
-//#define CARBIDE_DATA 0
-#define XML_DATA     1
-#define TEXT_DATA    2
-
-/**
-* TProvides features for creating the analyze report in
-* basic text or XML formats. Uses xerces library for XML output.
-*/
-class CATDataSaver
-{
-
-public:
-
-	/**
-	* Constructor.
-	*/
-	CATDataSaver( void );
-
-	/**
-	* Destructor.
-	*/
-	~CATDataSaver(void);
-
-	/**
-	* Save all lines to file with given format.
-	* @param pFileName Pointer to file name.
-	* @param iDataToSave Format of data.
-	*/
-	void SaveLinesToFile( const char* pFileName, int iDataToSave );
-
-	/**
-	* Prints all saved lines to screen.
-	*/
-	void PrintLinesToScreen( void );
-
-	/**
-	* Adds saved line to first in database.
-	*/
-	void AddLineToFirst( void );
-
-	/**
-	* Adds saved line to last in database.
-	*/
-	void AddLineToLast();
-
-	/**
-	* Adds string to current line.
-	* @param pData string to add
-	* @param bSaveCarbideData add string to xml?
-	*/
-	void AddString( const char* pData, bool bSaveCarbideData = false );
-
-	/**
-	* Converts integer to string and adds it to current line.
-	* @param iValue integer value to add
-	* @param bSaveCarbideData add string to xml?
-	*/
-	void AddInteger( int iValue, bool bSaveCarbideData = false );
-
-	/**
-	* Sets logging level.
-	* If value is invalid DEFAULT_LOGGING_LEVEL is used
-	* value must be between MIN_LOGGING_LEVEL and MAX_LOGGING_LEVEL
-	* @param iLoggingLevel Logging level.
-	*/
-	void SetLoggingLevel( int iLoggingLevel );
-
-	/**
-	* Gets logging level.
-	* @return Logging level.
-	*/
-	int GetLoggingLevel( void );
-
-	/**
-	* Sets print immediately flag.
-	* @param bPrintImmediately
-	*/
-	void SetPrintFlag( bool bPrintImmediately );
-
-	/**
-	* Sets data header for carbide data.
-	*/
-	void SaveCarbideDataHeader( void );
-
-	/**
-	* Initializes xercer xml parser.
-	*/
-	bool InitXML( void );
-
-	/**
-	* Writes data to xml tree.
-	* @param sInput data 
-	* @param iElementType element to write
-	*/
-	void SaveXML( string sInput, int iElementType );
-
-	/**
-	* Converts char* -> wchar_t*.
-	* @param str
-	* @return LPWSTR
-	*/
-	static LPWSTR CharToWChar( const char* str );
-
-	/**
-	* Converts wchar_t* -> char*.
-	* @param sInput
-	* @param Source
-	*/
-	static void WCharToChar( string& sInput, const WCHAR* Source );
-
-	/**
-	* Set is build type debug?
-	* @param bUdebBuild true if build type debug
-	*/
-	void SetBuild( bool bUdebBuild );
-
-	/**
-	* Add xml data for extension
-	* @param sInput data
-	*/
-	void AddCarbideData( const string& sInput );
-
-	/**
-	* Convert given integer to string
-	* @param iValueToConvert
-	* @return string
-	*/
-	static string IntegerToString( int iValueToConvert );
-
-#ifndef MODULE_TEST
-private:
-#endif
-	vector<string> m_vLines;
-	string m_sLine;
-	string m_sCarbideDataLine;
-
-	string m_sCarbideDataHeader;
-
-	int m_iLoggingLevel;
-	int m_iRunNumber;
-	bool m_bPrintImmediately;
-	bool m_bXMLInitOk;
-	bool m_bUdebBuild;
-
-	xercesc::DOMDocument* m_pDomDoc;
-	xercesc::DOMElement* m_pRootElem;
-	xercesc::DOMElement* m_pCurrentLeakElem;
-	xercesc::DOMWriter* m_Serializer;
-	xercesc::DOMElement* m_pRunElement;
-	xercesc::DOMElement* m_pMemoryLeaks;
-	xercesc::DOMElement* m_pHandleLeaks;
-	xercesc::DOMElement* m_pCurrentSubTestElem;
-	xercesc::DOMElement* m_pSubtestMemoryLeaks;
-
-	/**
-	* Utility to get sub string from string using char as separator
-	* @param sInput
-	* @param cCharacter
-	* @return string
-	*/
-	string GetStringUntilNextGivenChar( string& sInput, char cCharacter );
-
-};
-
-#endif
--- a/analyzetool/commandlineengine/inc/CATMemoryAddress.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +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:  Defines the CATMemoryAddress class.
-*
-*/
-
-
-#ifndef __CATMEMORYADDRESS_H__
-#define __CATMEMORYADDRESS_H__
-
-#include "../inc/ATCommonDefines.h"
-
-/**
-* Represents a single memory address / call stack item.
-* State tells the "success" of locating the symbol / code line.
-* Contains some utility functions used in this feature.
-*/
-class CATMemoryAddress
-{
-public:
-	/**
-	* Enumeration representing the state of locating code lines.
-	*/
-	enum ADDRESS_TO_LINE_STATE
-	{
-		OUT_OF_PROCESS = 0, /** Not located code line.*/
-		OUT_OF_RANGE, /** Outside functions range. */
-		SYMBOL, /** Symbol/ Function located (no codeline) */
-		FUNCTION, /** Function and line number.*/
-		EXACT /** Exact code line located with all information.*/
-	};
-	/**
-	* Constructor
-	* @param sAddress
-	* @param iOffSet value used if need to use offset value
-	*/
-	CATMemoryAddress( string& sAddress, unsigned long iOffSet );
-	/**
-	* Destructor
-	*/
-	virtual ~CATMemoryAddress();
-	/**
-	* Find which binary this address belongs to.
-	* Sets also the offsetfrommodulestart.
-	* @param vDlls container of binarys to find from.
-	* @return true if found
-	*/
-	bool FindSetModuleName(vector<DLL_LOAD_INFO>* vDlls);
-	/**
-	* Get vector index to which module we found this address to belong to.
-	* @return -1 if not set.
-	*/
-	int GetDllLoadInfoIndex();
-	/**
-	* Note return value includes the set offset.
-	* So this value is not binary start - address.
-	* Instead it is.
-	* memory address - binary start address + offset
-	* @return adress
-	*/
-	unsigned long GetOffSetFromModuleStart();
-	/**
-	* Get the binary start address
-	* @return binary start address
-	*/
-	unsigned long GetModuleStartAddress() const;
-	/**
-	* Set time
-	* @param ullTime
-	*/
-	void SetTime( unsigned long long& ullTime );
-	/**
-	* Get time
-	* @return unsigned long long
-	*/
-	unsigned long long GetTime();
-	/**
-	* Set address
-	* @param sAddess
-	*/
-	void SetAddress( string& sAddress );
-	/**
-	* Get address string
-	* @return string
-	*/
-	string GetAddressString();
-	/**
-	* Set address
-	* @param iAddress
-	*/
-	void SetAddress( unsigned long iAddress );
-	/**
-	* Get Address
-	* @return unsigned long
-	*/
-	unsigned long GetAddress();
-	/**
-	* Set module name
-	* @param sModuleName
-	*/
-	void SetModuleName( string& sModuleName );
-	/**
-	* Get module name
-	* @return string
-	*/
-	string GetModuleName();
-	/**
-	* Set state of locating code line
-	* @param eState
-	*/
-	void SetAddressToLineState( ADDRESS_TO_LINE_STATE eState );
-	/**
-	* Get current state of locating code line
-	* @return int
-	*/
-	int GetAddressToLineState();
-	/**
-	* Set filename
-	* @param sFileName
-	*/
-	void SetFileName(string& sFileName);
-	/**
-	* Get filename
-	* @return string
-	*/
-	string GetFileName();
-	/**
-	* Set function name
-	* @param sFunctionName
-	*/
-	void SetFunctionName(string& sFunctionName);
-	/**
-	* Get function name
-	* @return string
-	*/
-	string GetFunctionName();
-	/**
-	* Set function line number
-	* @param iFunctionLineNumber
-	*/
-	void SetFunctionLineNumber(int iFunctionLineNumber);
-	/**
-	* Get function line number
-	* @return int
-	*/
-	int GetFunctionLineNumber();
-	/**
-	* Set exact line number
-	* @param iExactLineNumber
-	*/
-	void SetExactLineNumber(int iExactLineNumber);
-	/**
-	* Get exact line number
-	* @return int
-	*/
-	int GetExactLineNumber();
-	/**
-	* Set module start address
-	* @param iAddress
-	*/
-	void SetModuleStartAddress(unsigned long iAddress);
-
-#ifndef MODULE_TEST
-private:
-#endif
-	// Used offset to add to addresses
-	unsigned long m_iOffSet;
-	// Address related members
-	string m_sAddress;
-	unsigned long m_iAddress;
-
-	// Time (microseconds from 1970)
-	unsigned long long m_iTime;
-
-	// Module related members(if FindSetModule is successful)
-	string m_sModuleName;
-	unsigned long m_iOffSetFromModuleStart;
-	unsigned long m_iModuleStartAddress;
-
-	// Module to which address belong.
-	int m_iDllLoadinfoIndex;
-
-	// Pin pointing related members
-	int m_ePinPointState;
-	string m_sFileName;
-	string m_sFunctionName;
-
-	int m_iFunctionLineNumber;
-	int m_iExactLineNumber;
-};
-#endif
\ No newline at end of file
--- a/analyzetool/commandlineengine/inc/CATMmp.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +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:  Class responsible of handling mmp files.
-*
-*/
-
-
-#ifndef __CATMMP_H__
-#define __CATMMP_H__
-
-// Includes
-#include "ATCommonDefines.h"
-#include "CATBase.h"
-
-/**
-* CATMmp represents mmp file of module.
-* All mmp file related actions are done using this class.
-* @author
-*/
-class CATMmp : public CATBase
-{
-
-public:
-
-	// Constructor
-	CATMmp();
-	
-	// Destructor
-	~CATMmp();
-	
-	string m_sMmpFile; /** The mmp file with path */
-
-	/**
-	* Makes AnalyzeTool changes to given mmp file.
-	* @param sTargetType target type of module i.e. exe / dll
-	* @param sId unique identification string added to source file name
-	* @return true if editing was successful.
-	*/
-	bool EditMmpFile(const string& sTargetType, const string& sId);
-
-	/**
-	* Backups mmp file to atool_temp/file
-	* to path/atool_temp/filename.mmp.tmp.
-	* Calling this function results always to 
-	* none edited mmp & none edited backup.
-	* @return true if successful.
-	*/
-	bool BackupMmpFile();
-
-	/**
-	* Restores backup from temporary directory (replacing current).
-	* @return true if successful.
-	*/
-	bool RestoreMmpFile();
-
-	/**
-	* VerifyAndRecover mmp file.
-	* Wont change mmp if it is not edited
-	* Replaces mmp file using backup if it exists and it is
-	* not edited otherwise removes changes from mmp file.
-	* @return true if successful
-	*/
-	bool VerifyAndRecover();
-
-#ifndef MODULE_TEST
-private:
-#endif
-		/**
-	* Checks if the given mmp file is modified by AT
-	* @param bBackup if true checks backup
-	* @return bool true if it is edited
-	*/
-	bool IsMmpEdited(bool bBackup = false );
-
-	/**
-	* CreateBackupPath creates string containinig
-	* full path to backup mmp file
-	*/
-	string CreateMmpBackupPath();
-
-	/**
-	* Removes AnalyzeTool changes from given file
-	* @param bBackup if true removes changes from backup
-	* @return true if successfully removed changes
-	*/
-	bool RemoveMmpFileChanges(bool bBackup = false);
-
-	/**
-	* Removes write protections from mmp file and its backup if exists.
-	* @return true if successful.
-	*/
-	bool RemoveWriteProtections();
-
-};
-#endif
\ No newline at end of file
--- a/analyzetool/commandlineengine/inc/CATModule2.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,545 +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:  Class representing a module in project (sbs2).
-*
-*/
-
-
-#ifndef __CATMODULE2_H__
-#define __CATMODULE2_H__
-
-// Includes.
-#include "ATCommonDefines.h"
-#include "CATBase.h"
-#include "CATMmp.h"
-
-// Forward declarations.
-class CATMemoryAddress;
-class IAddressToLine;
-
-/**
-* CATModule2 represents a module/component (single binary) in project.
-* CATProject contains a collection of these.
-*/
-class CATModule2 : public CATBase
-{
-
-public:
-	/**
-	* Constructor.
-	*/
-	CATModule2(void);
-	
-	/**
-	* Destructor.
-	*/
-	~CATModule2(void);
-	
-	/**
-	* Read modules attributes from SBS v.1 makefile.
-	* Also copies makefile to temporary directory if successful.
-	*/
-	bool ReadMakeFile();
-
-	/**
-	* Read modules attributes from SBS v.1 makefile.
-	* From make file which is in modules temporary directory.
-	*/
-	bool ReadMakeFileFromTemp();
-
-	/**
-	* Add sources using line where source files separated by spaces.
-	* @param sSourceLine.
-	*/
-	void AddSources(string& sSourceLine);
-
-	/**
-	* Add sources by giving source file and its corresponding listing file.
-	* @param sSourceFile
-	* @param sLstFile
-	*/
-	void AddSource(const string& sSourceFile, const string& sLstFile);
-
-	/**
-	* Create AT temporary cpp file for module.
-	* @param sS60FileName.
-	* @param eLoggingMode.
-	* @param eBuildType.
-	* @param iAllocCallStackSize.
-	* @param iFreeCallStackSize.
-	* @return true if successful.
-	*/
-	bool CreateTempCpp(const string& sS60FileName
-		, int eLoggingMode
-		, int eBuildType
-		, int iAllocCallStackSize
-		, int iFreeCallStackSize );
-
-	/**
-	* Add AT changes to modules mmp file.
-	* @return true if successful.
-	*/
-	bool ModifyMmp();
-
-	/**
-	* Restore any changes made to modules mmp file.
-	* @return true if successful.
-	*/
-	bool RestoreMmp();
-
-	/**
-	* Verify tha mmp does not contain AnalyzeTool made changes.
-	* If it does contain them will remove them manually or using backup.
-	* @return true if successful.
-	*/
-	bool VerifyAndRecoverMmp();
-
-	/**
-	* Copy modules releasables to its temporary dir.
-	* This includes map & lst files.
-	* @return true if successful.
-	*/
-	bool CopyReleasables();
-
-	/**
-	* Copy modules listing files to given directory.
-	* After copy they will be deleted.
-	* @param sDir target directory.
-	* @return true if successful.
-	*/
-	bool CopyLstFilesToDir( const string& sDir );
-
-	/**
-	* Delete modules lst files from their source
-	* directories.
-	* @return true if succesfful.
-	*/
-	bool DeleteLstFilesFromSrc();
-
-	/**
-	* Clean modules temporary directory of files,
-	* not defined in UNDELETE list.
-	* @return true if successful
-	*/
-	bool CleanTemporaryDir();
-
-	/**
-	* Delete modules temporary directory.
-	* @return true if successful.
-	*/
-	bool DeleteTemporaryDir();
-
-	/**
-	* Locate codeline of given memory address.
-	* Given address must be calculated to correspond map file addresses.
-	* @param pMemoryAddress object where to store results.
-	* @return true if successful.
-	*/
-	bool AddressToLine(CATMemoryAddress* pMemoryAddress);
-
-	/**
-	* Check does modules symbol file(s) exist.
-	* @return true if it exists.
-	*/
-	bool SymbolFileExist( void );
-
-	/**
-	* Check does modules map file(s) exists.
-	* @return true if it exists.
-	*/
-	bool MapFileExist( void );
-
-	/**
-	* Check does modules binary file(s) exist.
-	* @return true if it exists.
-	*/
-	bool BinaryFileExist( void );
-
-#ifndef MODULE_TEST
-private:
-#endif
-
-	/**
-	* Read modules attributes from make file.
-	*/
-	bool ReadMakeFilePrivate();
-
-	/**
-	* Locate codeline of given memory address (winscw platform).
-	* Given address must be calculated to correspond map file addresses.
-	* @param pMemoryAddress object where to store results.
-	* @return true if successful.
-	*/
-	bool AddressToLineWinscw(CATMemoryAddress* pMemoryAddress );
-
-	/**
-	* Locate codeline of given memory address (armv5 platform).
-	* Given address must be calculated to correspond map file addresses.
-	* @param pMemoryAddress object where to store results.
-	* @return true if successful.
-	*/
-	bool AddressToLineArmv5(CATMemoryAddress* pMemoryAddress );
-
-	/**
-	* Locate codeline of given memory address.
-	* Given address must be calculated to correspond map file addresses.
-	* @param pMemoryAddress object where to store results.
-	* @return true if successful.
-	*/
-	bool AddressToLineAddr2lineExe( CATMemoryAddress* pMemoryAddress );
-
-	/**
-	* Search map file data (symbols) using given address.
-	* @param iAddress memory address.
-	* @return index of the symbol or -1 if not found.
-	*/
-	int GetSymbolIndexUsingAddress(unsigned long iAddress) const;
-
-	/**
-	* Search listing  files data using the given symbol name.
-	* @param sSymbolName symbols name to find.
-	* @return index of the found lst data or -1 if not found.
-	*/
-	int GetLineInFileIndexUsingSymbolName(const string& sSymbolName) const;
-	
-	/**
-	* Search the exact code line from given file.
-	* @param sFileName listing file to search from.
-	* @param iLine functions line number.
-	* @param iFromFuncAddress how many bytes from functions start.
-	* @return line number or -1 if not found.
-	*/
-	int FindLeakCodeLine( string& sFileName, int iLine, unsigned long iFromFuncAddress ) const;
-
-public:
-
-	/**
-	* Set used build system (CATProject::BUILD_SYSTEM).
-	* @param eBuildSystem.
-	*/
-	void SetBuildSystem( int eBuildSystem );
-
-	/**
-	* Get defined build system.
-	* @return int CATProject::BUILD_SYSTEM
-	*/
-	int GetBuildSystem( void ) const ;
-
-	/**
-	* Set SBS v.1 makefile.
-	* @param sMakeFile
-	*/
-	void SetMakeFile( const string& sMakeFile );
-	
-	/**
-	* Get SBS v.1 makefile.
-	* @return string makefile.
-	*/
-	string GetMakeFile( void ) const;
-
-	/**
-	* Initialize module ready for locating code lines.
-	* with memory addresses (reads map and listing files).
-	* return true if successful.
-	*/
-	bool InitializeAddressToLine();
-	
-	/**
-	* Set modules mmp file.
-	* This also creates temporary dir if it is missing.
-	* @return true if successful.
-	*/
-	bool SetMmpFile(const string& sMmpFile);
-
-	/**
-	* Create modules own temporary directory.
-	* @return true if successful.
-	*/
-	bool CreateTemporaryDirectory();
-
-	/**
-	* Get modules mmp file.
-	* @return mmp file.
-	*/
-	string GetMmpFile() const;
-
-	/**
-	* Get modules atool_temp directory path.
-	* @return atool_temp directory path.
-	*/
-	string GetTempPath() const;
-
-	/**
-	* Get S60 logging file name.
-	* @return s60 logging file name.
-	*/
-	string GetS60FileName() const;
-
-	/**
-	* Set target binary name.
-	* @param sTarget binary file name.
-	*/
-	void SetTarget(const string& sTarget);
-
-	/**
-	* Get target binary name.
-	* @return modules binary file name.
-	*/
-	string GetTarget() const;
-
-	/**
-	* Set binary target type.
-	* @param sTargetType binary target type.
-	*/
-	void SetTargetType(const string& sTargetType);
-
-	/**
-	* Get binary target type.
-	* @return binary target type.
-	*/
-	string GetTargetType() const;
-
-	/**
-	* Set requested binary target file extension.
-	* @param sRequestedTargetExt binary target file extension.
-	*/
-	void SetRequestedTargetExt( const string& sRequestedTargetExt );
-
-	/**
-	* Get requested binary target file extension.
-	* @return binary target file extension.
-	*/
-	string GetRequestedTargetExt() const;
-
-	/**
-	* Get full name of modules binary.
-	* @return modules binary files full name.
-	*/
-	string GetBinaryName() const;
-
-	/**
-	* Set variant platform.
-	* @param sVariantPlatform variant platform.
-	*/
-	void SetVariantPlatform(const string& sVariantPlatform);
-
-	/**
-	* Get variant platform.
-	* @return variant platform.
-	*/
-	string GetVariantPlatform() const;
-
-	/**
-	* Set variant type.
-	* @param sVariantType variant type.
-	*/
-	void SetVariantType(const string& sVariantType);
-
-	/**
-	* Get variant type.
-	* @return variant type.
-	*/
-	string GetVariantType() const;
-
-	/**
-	* Set feature variant.
-	* @param sFeatureVariant feature variant.
-	*/
-	void SetFeatureVariant(const string& sFeatureVariant);
-
-	/**
-	* Get feature variant.
-	* @return feature variant.
-	*/
-	string GetFeatureVariant() const;
-
-	/**
-	* Set feature variant name.
-	* @param sFeatureVariantName feature variant name.
-	*/
-	void SetFeatureVariantName(const string& sFeatureVariantName);
-
-	/**
-	* Get feature variant name.
-	* @return feature variant name.
-	*/
-	string GetFeatureVariantName() const;
-
-	/**
-	* Set release path.
-	* @param sReleasePath release path.
-	*/
-	void SetReleasePath(const string& sReleasePath);
-
-	/**
-	* Get release path.
-	* @return release path.
-	*/
-	string GetReleasePath() const;
-
-	/**
-	* Set full variant path.
-	* @param sFullVariantPath full variant path.
-	*/
-	void SetFullVariantPath(const string& sFullVariantPath);
-
-	/**
-	* Get full variant path.
-	* @return full variant path.
-	*/
-	string GetFullVariantPath() const;
-
-	/**
-	* Set compile definition(s) of the module.
-	* @param sCompileDefinitions
-	*/
-	void SetCompileDefinitions( const string& sCompileDefinitions );
-
-	/**
-	* Get compile definition(s) of the module.
-	* @return compile definition(s).
-	*/
-	string GetCompileDefinitions() const;
-
-	/**
-	* Is modules target type udeb?
-	* @return true if modules target type is udeb.
-	*/
-	bool IsUDEB() const;
-
-	/**
-	* Is module build successfully?
-	* This includes check of listing and map files from temporary directory.
-	* @return true if module build successfully.
-	*/
-	bool IsMakeSuccessfull();
-
-	/**
-	* Get error string. This includes possible erros what are generated when
-	* IsMakeSuccesfull is called.
-	* @return error string.
-	*/
-	string GetErrors() const;
-
-	/**
-	* Create build complete file to modules temporary directory.
-	* @return true if build complete file created successfully.
-	*/
-	bool CreateBuildCompleteFile( void );
-
-	/**
-	* Read map file (armv5 platform).
-	* @return true if map file read successfully.
-	*/
-	bool ReadMapFileArmv5();
-
-	/**
-	* Set compile info text
-	* @param sCompileInfoText
-	*/
-	void SetCompileInfoText( string sCompileInfoText );
-
-	/**
-	* Get compile info text
-	* @return compile info text
-	*/
-	string GetCompileInfoText() const;
-
-#ifndef MODULE_TEST
-private:
-#endif
-
-	/**
-	* Struct for saving source information
-	* sCpp is source file.
-	* sLst sources corresponding lst file.
-	* bStatic true if source information from static library.
-	*/
-	struct SOURCE
-	{
-		bool bStatic;
-		string sCpp;
-		string sLst;
-		SOURCE() : bStatic(false), sCpp(""), sLst("") {}
-	};
-
-	// Build system
-	int m_eBuildSystem;
-	// Sbs v.1 makefile
-	string m_sMakeFile;
-	// Mmp file.
-	CATMmp m_Mmp;
-	// Temporary directory with path.
-	string m_sTempPath;
-	// Target.
-	string m_sTarget;
-	// Target type.
-	string m_sTargetType;
-	// True target extension.
-	string m_sRequestedTargetExt;
-	// Variant platform.
-	string m_sVariantPlatform;
-	// Variant type.
-	string m_sVariantType;
-	// Feature variant.
-	string m_sFeatureVariant;
-	// Feature variant name.
-	string m_sFeatureVariantName;
-	// Release path (releasables).
-	string m_sReleasePath;
-	// Full variant path (path to releasables).
-	string m_sFullVariantPath;
-	// String to store information of compile
-	string m_sCompileInfoText;
-	// String to store possible error messages.
-	string m_sErrors;
-	// Compile definition(s)
-	string m_sCompileDefinitions;
-	// Source files.
-	vector<SOURCE> m_vSources;
-	// Listing data.
-	vector<LINE_IN_FILE> m_vLineInFile;
-	// Modules map data (symbols).
-	vector<MAP_FUNC_INFO> m_vMapFileFuncList;
-	// File logging mode filename.
-	string m_sS60FileName;
-	// Is all data loaded for address to code line functions.
-	bool m_bAddressToLineInitialized;
-	// Read listing files (armv5 platform).
-	bool ReadListingFilesArmv5();
-	// Get listing file name of given source file.
-    string GetLstNameOfSource(string sSource) const;
-	// Copy listing files to temporary directory.
-	bool CopyLstFilesToTemp();
-	// Copy map file to temporary directory.
-	bool CopyMapFileToTemp();
-	// Get full map file name.
-	string GetMapFile() const;
-	// Get full symbol file name.
-	string GetSymbolFile() const;
-	// Get full binary file name.
-	string GetBinaryFile() const;
-	// Helper function to check is platform armv5.
-	bool IsPlatformArmv5() const;
-	// Get "unique" id of module
-	string GetUniqueId() const;
-	// Sbs v.1 variant urel label.
-	string m_sFeatureVariantURELLabel;
-	// Sbs v.1 variant udeb label.
-	string m_sFeatureVariantUDEBLabel;
-	// Object used to get codelines of memory addresses.
-	IAddressToLine* m_pAddressToLine;
-};
-#endif
-//EOF
--- a/analyzetool/commandlineengine/inc/CATParseTraceFile.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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:  Definitions for class CATParseTrace, CProcessData and
-*               CSubTestData.
-*
-*/
-
-
-#ifndef __CATPARSETRACEFILE_H__
-#define __CATPARSETRACEFILE_H__
-
-#include "../inc/ATCommonDefines.h"
-#include "../inc/CATDataSaver.h"
-#include "../inc/CATBase.h"
-#include "../inc/catallocs.h"
-
-/**
-* Parses raw trace data to AnalyzeTool specific data file.
-*/
-class CATParseTraceFile : public CATBase
-{
-public:
-	/**
-	* Constructor
-	*/
-	CATParseTraceFile();
-
-	/**
-	* Main function to start parse.
-	*
-	* @param pFileName A trace file name
-	* @param pOutputFileName Pointer to output file name
-	*/
-	bool StartParse( const char* pFileName, const char* pOutputFileName );
-
-	/**
-	* Get data saver
-	* @return CATDataSaver*
-	*/
-	CATDataSaver* GetDataSaver(void);	
-
-#ifndef MODULE_TEST
-private:
-#endif
-	CATDataSaver m_DataSaver; /** Data saver */
-};
-
-/**
-* Represents data of a single subtest.
-*/
-class CSubTestData : public CATAllocs
-{
-public:
-	// Members
-
-	bool bRunning; /** Is sub test running */
-	vector<string> vData; /** data */
-	string sSubTestName; /** test name */
-	string sStartTime; /** start time */
-	string sEndTime; /** end time */
-	string sSubTestStartHandleCount; /** handle count at start */
-	string sSubTestEndHandleCount; /** handle count at end */
-};
-
-/**
-* Represents data of a single run.
-*/
-class CProcessData : public CATAllocs
-{
-public:
-	// Members
-
-	bool bProcessOnGoing; /** is process on going */
-	int iProcessID; /** process id (pid)*/
-	vector<string> vData; /** data */
-	vector<string> vHandleLeaks; /** handle leak(s) */
-	vector<CSubTestData> vSubTests; /** process sub test(s) */
-};
-
-#endif
--- a/analyzetool/commandlineengine/inc/CATParseXML.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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:  Declarations for the class CATParseXML.
-*
-*/
-
-
-#ifndef __CATPARSEXML_H__
-#define __CATPARSEXML_H__
-
-#include "../inc/ATCommonDefines.h"
-
-/**
-* CATParseXML is used to parse xml data.
-*/
-class CATParseXML
-{
-public:
-	/**
-	* Constructor
-	*/
-	CATParseXML(void);
-	
-	/**
-    * Destructor
-    */
-	virtual ~CATParseXML(void);
-
-	/**
-	* Find epocroot path in xml file
-	* @param sourcePath Location of the xml file
-	*/
-	string GetEpocRootPathFromXML(const char* sourcePath);
-};
-#endif
--- a/analyzetool/commandlineengine/inc/CATProject.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,629 +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:  Class representing a project.
-*
-*/
-
-
-#ifndef __CATPROJECT_H__
-#define __CATPROJECT_H__
-
-#include "ATCommonDefines.h"
-#include "CATBase.h"
-
-class CATModule2;
-class CATDatParser;
-
-// Raptor cmd and makefile constants used
-#define RAPTOR_CMD_BASE "sbs -b bld.inf  --makefile=atool_temp/build/make_build --config="
-#define RAPTOR_MAKEFILE "atool_temp\\build\\make_build.default"
-#define RAPTOR_MAKEFILE_LOG " --logfile=atool_temp\\build\\makefile.xml"
-#define RAPTOR_BUILD_LOG " --logfile=atool_temp\\build\\build.xml"
-#define RAPTOR_REALLYCLEAN_LOG " --logfile=atool_temp\\build\\reallyclean.xml"
-#define RAPTOR_BUILD_LOG_NAME "atool_temp\\build\\build.xml"
-#define RAPTOR_LISTING_LOG " --logfile=atool_temp\\build\\listing.xml"
-
-#define RAPTOR_NOBUILD_SWITCH " --nobuild"
-#define RAPTOR_MAKEFILE_SWITCH "--makefile=atool_temp/build/make_build"
-
-
-// Raptor makefile constant variable names
-#define RAPTOR_PROJECT_META "PROJECT_META:="
-#define RAPTOR_SOURCE "SOURCE:="
-#define RAPTOR_TARGET "TARGET:="
-#define RAPTOR_TARGETYPE "TARGETTYPE:="
-#define RAPTOR_REQUESTEDTARGETEXT "REQUESTEDTARGETEXT:="
-#define RAPTOR_VARIANTPLATFORM "VARIANTPLATFORM:="
-#define RAPTOR_VARIANTTYPE "VARIANTTYPE:="
-#define RAPTOR_FEATUREVARIANT "FEATUREVARIANT:="
-#define RAPTOR_FEATUREVARIANTNAME "FEATUREVARIANTNAME:="
-#define RAPTOR_RELEASEPATH "RELEASEPATH:="
-#define RAPTOR_FULLVARIANTPATH "FULLVARIANTPATH:="
-#define RAPTOR_COMPILE_DEFINITIONS "CDEFS:="
-
-// Sbs v.1 makefile constants.
-#define MAKEFILE_SEARCH_STRING "@perl -S checksource.pl"
-#define MMPFILE_SEARCH_STRING "PRJ_MMPFILES MMP"
-#define MMPTESTFILE_SEARCH_STRING "PRJ_TESTMMPFILES MMP"
-#define SOURCE_PATH "SOURCEPATH"
-#define SOURCE_STRING "SOURCE"
-#define TARGET_STRING "TARGET"
-
-/**
-* CATProject represents a project (collection of modules).
-* It has to be set mode in which it operates like
-* compile / analyze and necessary parameters for that.
-* Then call Run method which also returs error codes
-* defined in AT_ERROR_CODES enumeration.
-* @author
-*/
-class CATProject : public CATBase
-{
-public:
-	
-	/**
-	* Enumeration representing used build systems
-	*/
-	enum BUILD_SYSTEM {
-		SBS_V1 = 1,
-		SBS_V2 = 2
-	};
-
-	/**
-	* Enumeration representing the mode project is run.
-	*/
-	enum PROJECT_MODE {
-		COMPILE = 0,
-		INSTRUMENT = 1,
-		UNINSTRUMENT = 2,
-		UNINSTRUMENT_FAILED =3,
-		FAILED = 4,
-		CLEAN = 5,
-		ANALYZE = 6,
-		INSTRUMENT_CONSOLE = 7,
-		UNINSTRUMENT_CONSOLE = 8,
-		FAILED_CONSOLE = 9,
-		NOT_DEFINED = 10
-	};
-
-	/**
-	* Enumeration repserenting the logging mode.
-	*/
-	enum LOGGING_MODE {
-		DEFAULT = 0,
-		FILE = 1,
-		TRACE = 2,
-		TRACE_FAST = 3
-	};
-
-	/**
-	* Enumeration representing build type.
-	*/
-	enum BUILD_TYPE {
-		UREL = 0,
-		UDEB = 1
-	};
-
-public:
-
-	/**
-	* Constructor
-	*/
-	CATProject();
-
-	/**
-	* Destructor
-	*/
-	~CATProject();
-
-	/**
-	* Set arguments.
-	* @param arguments.
-	* @return true if arguments ok.
-	*/
-	bool SetArguments( ARGUMENTS& arguments );
-
-	/**
-	* Set build system to be used with project.
-	* See BUILD_SYSTEM enumeration for available systems.
-	* @param eSystem system.
-	*/
-	void SetBuildSystem( BUILD_SYSTEM eSystem );
-
-	/**
-	* Set mode which to run.
-	* See PROJECT_MODE enumeration for available modes.
-	* @param eMode mode.
-	*/
-	void SetMode(PROJECT_MODE eMode);
-
-	/**
-	* Get project mode.
-	* @return mode of project.
-	*/
-	int GetMode() const;
-
-	/**
-	* Set epocroot.
-	* @param sEpocroot
-	*/
-	void SetEpocRoot( const string& sEpocRoot );
-
-	/**
-	* Set project platform.
-	* @param sPlatform platform.
-	*/
-	void SetPlatform( const string& sPlatform );
-
-	/**
-	* Set variant.
-	* @sVariant variant.
-	*/
-	void SetVariant( const string& sVariant );
-
-	/**
-	* Set logging mode. See LOGGING_MODE enumeration for available modes.
-	* @param eLogginMode logging mode.
-	*/
-	void SetLoggingMode( LOGGING_MODE eLoggingMode);
-
-	/**
-	* Set build type. See BUILD_TYPE enumeration for available types.
-	* @param eType build type.
-	*/
-	void SetBuildType( BUILD_TYPE eType );
-	
-	/**
-	* Set S60 logging filename.
-	* @param sFileName filename.
-	*/
-	void SetS60FileName( const string& sFileName);
-
-	/**
-	* Set target module.
-	* @param sTargetModule target module name.
-	*/
-	void SetTargetModule( const string& sTargetModule );
-
-	/**
-	* Set multiple target modules used in project.
-	* @param vTargetModules target module names.
-	*/
-	void SetTargetModules( const vector<string>& vTargetModules );
-
-	/**
-	* Set Binary target name to create analysis results to.
-	* @param sBinaryTarget binary target name.
-	*/
-	void SetBinaryTarget( const string& sBinaryTarget );
-
-	/**
-	* Set data file to analyze.
-	* @param sDataFile datafile.
-	*/
-	void SetDataFile( const string& sDataFile );
-
-	/**
-	* Set rom symbol file(s) used in analyze.
-	* @param sRomSymbolFile.
-	*/
-	void SetRomSymbolFiles(const vector<string>& vRomSymbolFiles);
-
-	/**
-	* Set the logging level of analysis report.
-	* @param iLogLevel log level.
-	*/
-	void SetLogLevel( int iLogLevel );
-
-	/**
-	* Set the size of allocation call stack to be written in temporary cpp.
-	* @param iAllocCallStackSize
-	*/
-	void SetAllocCallStackSize( int iAllocCallStackSize );
-
-	/**
-	* Set the size of free call stack to be written in temporary cpp.
-	* @param iFreeCallStackSize
-	*/
-	void SetFreeCallStackSize( int iFreeCallStackSize );
-
-	/**
-	* Set the output file name to store analyse report.
-	* @param sDataFileOutput data file name.
-	*/
-	void SetDataFileOutput( const string& sDataFileOutput );
-
-	/**
-	* Set build command used in compile phase.
-	* @param sBuildCommand build command.
-	*/
-	void SetBuildCommand( const string& sBuildCommand );
-
-	/**
-	* Run the set mode.
-	* @return error code.
-	*/
-	int Run();
-
-	/**
-	* Run recovery, used when "instatly" need to recover modules and exit.
-	*/
-	int RunRecoveryAndExit();
-
-	/**
-	* Get build type string.
-	* @param eType type from which to get correponding string.
-	* @return types corresponding string.
-	*/
-	static string GetBuildTypeString( int eType );
-
-	/**
-	* Reads projects configuration file if it exists.
-	* @return false in case the data contains information that project is uninstrumented. Otherwise returns always true.
-	*/
-	bool IsUninstrumented();
-
-#ifndef MODULE_TEST
-private:
-#endif
-	/**
-	* Run compiling in console.
-	* @return error code.
-	*/
-	int RunCompile( void );
-
-	/**
-	* Run cleaning project.
-	* @return error code.
-	*/
-	int RunClean( void );
-
-	/**
-	* Run running analyze.
-	* @return error code.
-	*/
-	int RunAnalyze( void );
-
-	/**
-    * Run instrumenting of project for Carbide extension (pre-build).
-	* @return error code.
-	*/
-	int RunInstrument( void );
-
-	/**
-	* Run uninstrumenting of project for Carbide extension (post-build).
-	* @return error code.
-	*/
-	int RunUninstrument( void );
-
-	/**
-	* Run uninstrumenting of project for Carbide extension(post-build), when build failed.
-	* @return error code.
-	*/
-	int RunUninstrumentFailed( void );
-
-	/**
-	* Run console instrumenting.
-	* @return error code.
-	*/
-	int RunInstrumentConsole( void );
-
-	/**
-	* Run Console uninstrumenting.
-	* @return error code.
-	*/
-	int RunUninstrumentConsole( void );
-
-	/**
-	* Run console uninstrumenting, when build failed.
-	* @return error code.
-	*/
-	int RunFailedConsole( void );
-
-	/**
-	* Show summary of compilation.
-	*/
-	void DisplayCompileSummary( void );
-
-	/**
-	* Show summary, build target, build type, logging mode...
-	*/
-	void DisplayBuildSummary( void );
-
-	/**
-	* Create make files.
-	* @return true if successful
-	*/
-	bool CreateMakeFile( void );
-	/**
-	* Create SBS v.1 make files.
-	* @return true if successful.
-	*/
-	bool CreateMakeFileSbs1( void );
-	/**
-	* Copy sbs1 makefile to temporary folder.
-	* @return true if successful.
-	*/
-	bool CopyMakeFileSbs1ToTemporaryFolder( void );
-	/**
-	* Run really clean in SBS v.1.
-	* @return true if successful.
-	*/
-	bool RunReallyCleanSbs1( void );
-	/**
-	* Run really clean in SBS v.2.
-	* @return true if successful.
-	*/
-	bool RunReallyCleanSbs2( void );
-	/**
-	* Run export in SBS v.1.
-	* @return true if successful.
-	*/
-	bool RunExportSbs1( void );
-	/**
-	* Create make files (level2) SBS v.1.
-	* @return true if successful.
-	*/
-	bool CreateMakeFileSbs1Level2( void );
-	/**
-	* Create makefile SBS v.2.
-	* @return true if successful.
-	*/
-	bool CreateMakeFileSbs2( void );
-	/**
-	* Read makefile.
-	* @return true if successful.
-	*/
-	bool ReadMakeFile( void );
-	/**
-	* Read SBS v.1 makefile.
-	* @return true if successful.
-	*/
-	bool ReadMakeFileSbs1( void );
-	/**
-	* Read SBS v.1 makefile (Level1).
-	* @return true if successful.
-	*/
-	bool ReadMakeFileSbs1Level1( void );
-	/**
-	* Read SBS v.2 makefiles.
-	* @return true if successful.
-	*/
-	bool ReadMakeFileSbs2( void );
-	/**
-	* Read specified SBS v.2 makefile.
-	* @param sMakeFile makefile to be read.
-	* @return true if succesful.
-	*/
-	bool ReadMakeFileSbs2( string& sMakeFile );
-
-	/**
-	* Filter unsupported and static libraries to their own vectors.
-	* Unsupported include kernel types, modules with kernel mode compile definition.
-	* @return true if successful.
-	*/
-	bool FilterModules();
-
-	/**
-	* Creates temporary directories for all modules
-	* in member vector.
-	* @return true if successful.
-	*/
-	bool CreateTemporaryDirectories();
-
-	/**
-	* Creates tempororary cpp files for all modules
-	* in member vector.
-	* @return true if successful.
-	*/
-	bool CreateTemporaryCpps();
-
-	/**
-	* Hooks all modules in member vector
-	* (modifies mmp files)
-	* @return true if successful
-	*/
-	bool ModifyModules( void );
-
-	/**
-	* Unhooks all modules in member vector
-	* (removes changes from mmp files)
-	* @return true if successful
-	*/
-	bool RestoreModules( void );
-
-	/**
-	* Verifys that member vectors modules
-	* mmp files unchanged. Restores if they are
-	* from backup or from original.
-	* @return true if successful
-	*/
-	bool VerifyAndRecoverModules( void );
-
-	/**
-	* Runs compilation.
-	* @return true if successful.
-	*/
-	bool Compile( void );
-	/**
-	* @return true if successful.
-	*/
-	bool CompileSbs1( void );
-	/**
-	* @return true if successful.
-	*/
-	bool CompileSbs2( void );
-
-	/**
-	* Runs listing creatation.
-	* @return true if successful
-	*/
-	bool CreateListings( void );
-	/**
-	* @return true if successful.
-	*/
-	bool CreateListingsSbs1( void );
-	/**
-	* @return true if successful.
-	*/
-	bool CreateListingsSbs2( void );
-	/**
-	* Copies releasables of modules including lst & map files
-	* for all modules in project to their temporary directories.
-	* @return true if successful.
-	*/
-	bool CopyReleasables( void );
-	/**
-	* Deletes all atool_temp directories
-	* of member vector modules.
-	* @return true if successful.
-	*/
-	bool DeleteTemporaryDirs( void );
-	/**
-	* Deletes files from atool_temp directory
-	* of member vector modules which extension not defined
-	* in TEMP_EXTENSION_NO_DELETE table.
-	* @return true if successful.
-	*/
-	bool CleanTemporaryDirs( void );
-	/**
-	* Writes class attributes to a file
-	* under atool_temp directory.
-	* @return true if successful.
-	*/
-	bool WriteAttributes( void ) const;
-	/**
-	* Read class attributes from a file
-	* under atool_temp directory.
-	* @return true if successful.
-	*/
-	bool ReadAttributes( void );
-
-	/**
-	* Creates atool_temp directory if it does not
-	* exist in current directory.
-	* @return true if successful.
-	*/
-	bool MakeTempDirIfNotExist( void );
-
-#ifndef MODULE_TEST
-private:
-#endif
-
-	/**
-	* Clean all module vectors.
-	*/
-	void CleanModuleVectors();
-
-	/**
-	* Get build type as string.
-	* @return buildtype string.
-	*/
-	string GetBuildTypeString();
-
-	/**
-	* Helper function to add target module(s)
-	* if any defined in class to given sbs command.
-	* @param sCmd command to add modules to.
-	*/
-	void AddTargetModuleIfDefined(string& sCmd);
-
-	/**
-	* Run given system/abld command to all defined target modules in vector.
-	* Space char (if its missing) will be added to given command + one target
-	* module at a time.
-	* @param sCommand sCommand to run.
-	* @return true if none system call sets error level other than 0.
-	*/
-	bool RunAbldCommandToAllTargets( const string& sCommand );
-
-	/**
-	* Check is target module in project.
-	* If no modules / targets defined return value is true.
-	* @return true if target module is in project.
-	*/
-	bool IsTargetModuleInProject( void ) const;
-
-	/**
-	* Initializes member make file variable with correct full path to point (epoc32/build)...
-	* @return true if successful.
-	*/
-	bool InitSbs1MakeFileWithPath();
-
-	/**
-	* Initializes member make file variable with correct full path to (atoo_temp...)
-	* @return true if successful.
-	*/
-	bool InitSbs1MakeFileWithPathToTemp();
-
-#ifndef MODULE_TEST
-private:
-#endif
-	// System current directory.
-	char m_cCurrentDir[ MAX_LINE_LENGTH ];
-	// Projects build system
-	int m_eBuildSystem;
-	// Project modules.
-	vector<CATModule2*> m_vModules;
-	// Static libraries.
-	vector<CATModule2*> m_vStaticLibraries;
-	// Unsupported project modules.
-	vector<CATModule2*> m_vUnsupportedModules;
-	// Run mode.
-	int m_eMode;
-	// Logging level (used in analyse).
-	int m_iLoggingLevel;
-	// Is project unsinstrumented.
-	bool m_bUninstrumented;
-	// Is build just for test modules
-	bool m_bAbldTest;
-	// Build command.
-	string m_sBuildCommand;
-	// Epocroot
-	string m_sEpocRoot;
-	// Platform i.e. armv5.
-	string m_sPlatform;
-	// SBS2 variant.
-	string m_sVariant;
-	// Logging mode (used in compile,instrumenting).
-	int m_eLoggingMode;
-	// Allocation call stack size
-	int m_iAllocCallStackSize;
-	// Free call stack size
-	int m_iFreeCallStackSize;
-	// Build type udeb / urel.
-	int m_eBuildType;
-	// Sbs v.1 level 1 make file
-	string m_sMakeFile;
-	// User given S60 log file name.
-	string m_sS60FileName;
-	// Target module.
-	string m_sTargetModule;
-	// Target modules (used in carbide instrumenting).
-	vector<string> m_vTargetModules;
-	// Binary target (used in analyse).
-	string m_sBinaryTarget;
-	// User given datafile to analyse.
-	string m_sDataFile;
-	//
-	vector<string> m_vRomSymbolFiles;
-	// Temporary data file name if user gave trace file.
-	string m_sDataFileTemp;
-	// User given output file to store analyse results.
-	string m_sDataFileOutput;
-	// Analyser object.
-	CATDatParser* m_pAnalyzer;
-};
-#endif
-// End of file
--- a/analyzetool/commandlineengine/inc/cataddr2line.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +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:  Windows debug api implementation for IAddressToLine interface.
-*
-*/
-
-#ifndef __CATADDR2LINE_H__
-#define __CATADDR2LINE_H__
-
-#include "iaddresstoline.h"
-#include "../inc/cataddr2lineserver.h"
-
-// Allowed characters in output.
-//const char ADDR2LINEALLOWEDCHARS[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :/\\_.-";
-
-/**
-* Implements addresstoline interface using one of the GNU binutils tool called addr2line.
-* This is used on gcce platform. In release build type also map files are used.
-*/
-class CATAddr2line : public IAddressToLine
-{
-
-public:
-	
-	/**
-	* Constructor
-	*/
-	CATAddr2line();
-
-	/**
-	* Open binary.
-	* @sString Full filename with path to binary.
-	* @iLong base address of binary.
-	* @return true if successful.
-	*/
-	bool Open( const string& sString, const unsigned long iLong);
-
-	/**
-	* Get error string. In case of any method failed use this to acquire details on error.
-	* @return error string.
-	*/
-	string GetError( void );
-
-	/**
-	* Close binary.
-	* @return true if succesful.
-	*/
-	bool Close( void );
-
-	/**
-	* Locate code line and file for given address.
-	* @result
-	* @return true if successful.
-	*/
-	bool AddressToLine( CATMemoryAddress* result );
-
-#ifndef MODULE_TEST
-private:
-#endif
-
-	// Modules map data (symbols).
-	vector<MAP_FUNC_INFO> m_vMapFileFuncList;
-
-	//Map file name
-	string m_sMapFileName;
-
-	//Addr2line server class
-	CATAddr2lineServer server;
-
-	/**
-	* Get function name for given address.
-	* @iAddress Memory address as unsigned long.
-	* @return Function name as string or empty string if not found.
-	*/
-	string GetFunctionNameUsingAddress( unsigned long iAddress );
-
-	/**
-	* Read map file (armv5 platform).
-	* @return true if map file read successfully.
-	*/
-	bool ReadMapFileArmv5();
-
-	//Note: New filtering functions commented out until they are taken into use.
-	//These were part of task which would filter unwanted characters, etc.. from results.
-
-	/**
-	* Filter any char not defined in constant
-	* ADDR2LINEALLOWEDCHARS from given string.
-	* @param sString string to be filtered.
-	*/
-	//void FilterString( string &sString );
-
-	/**
-	* Find first occurence of LF/CR from string.
-	* @param sString string to find LF/CR.
-	* @return position of first occurence.
-	*/
-	//size_t FindLineFeed( const string& sString );
-
-	/**
-	* Erase all LF/CR from start of the string until other
-	* characters are found.
-	* @param sString string to erase LF/CR.
-	*/
-	//void EraseUntilNoLineFeed( string& sString );
-
-	/**
-	* Split string containing multiple lines with mixed line feeds to
-	* vector of lines.
-	* @sMultiLineString string containing multiple lines.
-	* @return vector containing one line per cell.
-	*/
-	//vector<string> SplitToStrings( string& sMultiLineString );
-	
-	//Debugging for addr2line task.
-	//ofstream debug;
-};
-
-#endif
--- a/analyzetool/commandlineengine/inc/cataddr2lineserver.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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:  Defines CATAddr2lineServer class.
-*
-*/
-
-#ifndef __CATADDR2LINESERVER_H__
-#define __CATADDR2LINESERVER_H__
-
-// Includes.
-#include "ATCommonDefines.h"
-
-#define BUFSIZE 4096
- 
-/**
-* This class "runs" the addr2line binary as a server for CATAddr2Line.
-* It redirects the pipes from the tool.
-*/
-class CATAddr2lineServer
-{
-public:
-
-	//Creator
-	CATAddr2lineServer();
-	
-	//Destructor
-	~CATAddr2lineServer();
-
-	/**
-	* Get function name for given address.
-	* @sFullPathAndBinaryName
-	* @return True if initialization succesfull.
-	*/
-	bool Initialize( const string& sFullPathAndBinaryName );
-
-	/**
-	* Write data to a pipe.
-	* @sAddress
-	*/
-	VOID WriteToPipe( const string& sAddress );
-
-	/**
-	* Read data to a pipe.
-	* @return Data from pipe.
-	*/
-	string ReadFromPipe(VOID);
-
-	/**
-	* Gets process created state.
-	* @return True if process created successfully.
-	*/
-	bool GetProcessCreatedState( void );
-
-#ifndef MODULE_TEST
-private:
-#endif
-
-	HANDLE m_hChildStdinRd, m_hChildStdinWr, m_hChildStdinWrDup, 
-	       m_hChildStdoutRd, m_hChildStdoutWr, m_hChildStdoutRdDup, 
-	       m_hChildErroutRd, m_hChildErroutWr, m_hChildErroutRdDup, 
-           m_hSaveStdin, m_hSaveStdout, m_hSaveErrout; 
-
-    SECURITY_ATTRIBUTES m_saAttr;
-    string m_sFullPathAndBinaryName;
-	bool m_bProcessCreated;
-
-	/**
-	* Creates child process for addr2line.exe.
-	* @return True if process created successfully.
-	*/
-	BOOL CreateChildProcess(VOID); 
-
-	/**
-	* Prints error and returns false.
-	* @param sInput error string.
-	* @return false.
-	*/
-	bool PrintErrorAndExit( const string sInput );
-
-
-};
-#endif
--- a/analyzetool/commandlineengine/inc/catalloc.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +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: Defines CATAlloc class.
-*
-*/
-
-
-#ifndef __CATALLOC_H__
-#define __CATALLOC_H__
-
-#include "../inc/ATCommonDefines.h"
-
-/**
-* Class representing single memory allocation.
-*/
-class CATAlloc
-{
-public:
-	/**
-	* Constructor.
-	*/
-	CATAlloc() : m_iCSCount(0) {}
-
-	/**
-	* Destructor.
-	*/
-	~CATAlloc(){}
-
-	/**
-	* Get alloc string after address, it contains:
-	* time, size, call stack..
-	* @return string allocation string
-	*/
-	string GetAllocString();
-
-	// Members
-
-	string m_sTime; /** Allocation time */
-
-	string m_sSize; /** Allocation size */
-
-	unsigned long m_iCSCount; /** Call stack address count */
-
-	map<unsigned long,string> m_vCallStack; /** Call stack where packet number is key */
-	
-};
-#endif
-//EOF
--- a/analyzetool/commandlineengine/inc/catallocs.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +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: Defines CATAllocs "collection" class.
-*/
-
-#ifndef __CATALLOCS_H__
-#define __CATALLOCS_H__
-
-#include "../inc/ATCommonDefines.h"
-#include "../inc/CATBase.h"
-#include "../inc/catalloc.h"
-
-/**
-* Class representing a collection of memory allocations.
-* It is used to acquire the data of memory leaks by giving all
-* data on single allocations and frees.
-*/
-class CATAllocs : public CATBase
-{
-public:
-	
-	/**
-	* "old" alloc message (prior to 1.6).
-	* @param sAllocString allocation string
-	*/
-	void Alloc( const string& sAllocString );
-
-	/*
-	* Alloc header message (multimessage call stack).
-	* @param sAllocHString allocation string
-	*/
-	void AllocH( const string& sAllocHString );
-
-	/*
-	* Alloc fragment message (fragment of call stack in multimessage alloc).
-	* @param sAllocFString allocation string
-	*/
-	void AllocF( const string& sAllocFString );
-
-	/**
-	* Free message.
-	* @param sFreeString string
-	*/
-	void Free( const string& sFreeString );
-	
-	/**
-	* Free header message.
-	* (not implemented yeat.)
-	* @param sFreeHString string
-	*/
-	void FreeH( const string& sFreeHString );
-
-	/**
-	* Free fragment message.
-	* (not implemented yeat.)
-	* @param sFreeFString string
-	*/
-	void FreeF( const string& sFreeFString );
-
-	/**
-	* Get "leak" list ordered by allocation time.
-	* @param vLeakList container where leaks stored
-	*/
-	void GetLeakList( vector<string>& vLeakList);
-	
-	/**
-	* Clear leaks.
-	*/
-	void ClearAllocs();
-#ifndef MODULE_TEST
-private:
-#endif
-	map<string, CATAlloc> m_vAllocs; /** Collection of allocation(s) */
-};
-#endif
-//EOF
--- a/analyzetool/commandlineengine/inc/catdbghelper.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +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:  Defines the CATDbgHelper class.
-*
-*/
-
-
-#include "iaddresstoline.h"
-// Static variable to represent state of dbghelper api.
-static bool CDBGHELPER_OPEN = false;
-static unsigned int CDBGHELPER_CLIENTS = 0;
-
-// Used "virtual" offset for all loaded modules and addresses.
-// This is used so no module is loaded to the binary address range of atool.exe.
-const unsigned long AT_VIRTUAL_OFFSET_DBGHELPER = 0x1000000;
-
-/**
-* Provides feature to locate code lines using Windows Debug Api. This is done
-* by using dbghelper library. Implements the IAddressToLine interface.
-*/
-class CATDbgHelper : public IAddressToLine
-{
-
-public:
-	
-	/**
-	* Constructor
-	*/
-	CATDbgHelper();
-	
-	/**
-	* Destructor
-	*/
-	~CATDbgHelper();
-
-	/**
-	* Open binary.
-	* @sString Full filename with path to binary.
-	* @iLong base address of binary.
-	* @return true if successful.
-	*/
-	bool Open( const string& sString, const unsigned long iLong);
-	
-	/**
-	* Get error string. In case of any method failed use this to acquire details on error.
-	* @return error string.
-	*/
-	string GetError( void );
-
-	/**
-	* Close binary.
-	* @return true if succesful.
-	*/
-	bool Close( void );
-
-	/**
-	* Read map file for function's.
-	*/
-	void ReadMapFile( const string sMapFileName );
-
-	/**
-	* Locate code line and file for given address.
-	* @result
-	* @return true if successful.
-	*/
-	bool AddressToLine( CATMemoryAddress* result );
-
-	/**
-	* Try get function name for address (only when map is read).
-	* @result
-	* @return true if succesful.
-	*/
-	bool AddressToFunction( CATMemoryAddress* result );
-
-#ifndef MODULE_TEST
-private:
-#endif
-	// Base address used.
-	DWORD64 m_BaseAddress;
-	// Map file read?
-	bool m_bMap;
-	// Map file functions.
-	vector<MAP_FUNC_INFO> m_vMapFileFuncList;
-	// Binary in file system.
-	PSTR m_pBinaryFile;
-};
\ No newline at end of file
--- a/analyzetool/commandlineengine/inc/catfilereader.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +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:  Defines CATFileReader class.
-*
-*/
-
-
-#ifndef __CATFILEREADER_H__
-#define __CATFILEREADER_H__
-
-#include "ATCommonDefines.h"
-
-/**
-* Provides a feature to read a file as single block into memory and parse it
-* from there line by line (iterating). This can fail or be very slow if file
-* size is bigger than available physical memory for process.
-* But is faster when file fits in free physical memory.
-*/
-class CATFileReader
-{
-public:
-	/**
-	* Constructor.
-	*/
-	CATFileReader();
-	/**
-	* Destructor.
-	*/
-	~CATFileReader();
-#ifndef MODULE_TEST
-private:
-#endif
-	/**
-	* Prevent copy of this class.
-	*/
-	CATFileReader& operator =( const CATFileReader& /*other*/ ) { }
-	CATFileReader( const CATFileReader& /*other*/ ) { }
-public:
-	/**
-	* Open/Read file.
-	* @param cFile file to be read/opened.
-	* @return true if succesful.
-	*/
-	bool Open( const char* cFile );
-	/**
-	* Close file.
-	* @return true if succesful.
-	*/
-	bool Close( void );
-	/**
-	* Get line from file.
-	* @sLine where line content is stored.
-	* @return true if lines left.
-	*/
-	bool GetLine( string& sLine );
-	/**
-	* Set the line delimiter.
-	* @param cDelimiter char that ends the line.
-	*/
-	void SetDelimiter( char cDelimiter );
-	/**
-	* Get current line delimiter.
-	* @return char that ends the line.
-	*/
-	char GetDelimiter() const;
-#ifndef MODULE_TEST
-private:
-#endif
-	// Stream where file content is stored.
-	stringstream m_stream;
-	// Line delimiting character used.
-	char m_cDelimiter;
-};
-#endif
-// EOF
--- a/analyzetool/commandlineengine/inc/catromsymbol.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +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:  Defines CATRomSymbol, RofsBinary classes and Symbol
-*               structure.
-*
-*/
-
-
-#ifndef __CATROMSYMBOL_H__
-#define __CATROMSYMBOL_H__
-
-#include "ATCommonDefines.h"
-#include "iaddresstoline.h"
-
-const string ROM_SYMBOL_IDENTIFY_STRING = "80";
-const string ROFS_SYMBOL_IDENTIFY_STRING = "00";
-const int IDENTIFY_MAX_LINES_READ = 20;
-
-/**
-* Represents a single symbol in a binary.
-*/
-struct Symbol
-{
-	unsigned long iStartAddress; /** Start address */
-	unsigned long iEndAddress; /** End address */
-	string sFunction; /** Function/Symbol name */
-	/**
-	* Default constructor for structure to set default values
-	*/
-	Symbol() { iStartAddress=0; iEndAddress=0; sFunction = ""; }
-	/**
-	* Empty destructor
-	*/
-	~Symbol() {}
-};
-
-
-/**
-* Represents a single binary in ROM/ROFS which
-* contains a collection of Symbols.
-*/
-class RofsBinary {
-public:
-	/**
-	* Constructor
-	*/
-	RofsBinary();
-	/**
-	* Constructor
-	* @param sbinary
-	*/
-	RofsBinary( const string& sbinary );
-	/**
-	* Destructor
-	*/
-	~RofsBinary();
-
-	// Members
-
-	string m_sBinary; /** Binary / code segment */
-	vector<Symbol*> vSymbols; /** Collection of symbols */
-};
-
-/**
-* Implements IAddressToLine interface to acquire symbol information
-* using memory addresses from rom/rofs symbol files.
-*/
-class CATRomSymbol : public IAddressToLine
-{
-public:
-	/**
-	* Constructor.
-	*/
-	CATRomSymbol();
-	/**
-	* Destructor.
-	*/
-	virtual ~CATRomSymbol();
-	bool m_bShowProgressMessages; /** "Flag" will we show progress when reading files */
-	/**
-	* Empty functions does nothing returns false always.
-	* @param sString
-	* @param iLong
-	* @return true if successful.
-	*/
-	bool Open( const string& sString, const unsigned long iLong);
-	/**
-	* Set symbol files.
-	* This also checks that files exists and identifies them as rom/rofs.
-	* @param vSymbols
-	* @return bool
-	*/
-	bool SetSymbols( const vector<string>& vSymbols);
-	/**
-	* Get error string. In case of any method failed use this to acquire details on error.
-	* @return error string.
-	*/
-	string GetError( void );
-	/**
-	* Close rom symbol file.
-	* @return true if succesful.
-	*/
-	bool Close( void );
-	/**
-	* Locates symbol and binary name for given address if found in rom.
-	* @param result memory address object.
-	* @return true if successful.
-	*/
-	bool AddressToLine( CATMemoryAddress* result );
-#ifndef MODULE_TEST
-private:
-#endif
-	/**
-	* Represents the symbol files type
-	* (content is different / format )
-	*/
-	enum SYMBOL_FILE_TYPE {
-		SYMBOL_FILE_INVALID = 0, /** not valid */
-		SYMBOL_FILE_ROM, /** rom type */
-		SYMBOL_FILE_ROFS /** rofs type */
-	};
-	/**
-	* Identify symbol file
-	* @param sFile
-	* @return int
-	*/
-	int IdentifySymbolFile( const string& sFile );
-	/**
-	* Locate symbol and binary name for given address if found in rom.
-	* @param result
-	* @return bool
-	*/
-	bool AddressToLineRom( CATMemoryAddress* result );
-	/**
-	* Locate symbol and binary name for given address if found in rofs.
-	* @param result
-	* @return bool
-	*/
-	bool AddressToLineRofs( CATMemoryAddress* result );
-	/**
-	* Reads rom files.
-	* @return bool
-	*/
-	bool ReadRomFiles();
-	/**
-	* Read specified rom file
-	* @param sFile
-	* @return bool
-	*/
-	bool ReadRomFile( const string& sFile );
-	/**
-	* Read rofs files
-	* @return bool
-	*/
-	bool ReadRofsFiles();
-	/**
-	* Read specified rofs file
-	* @param sFile
-	* @return bool
-	*/
-	bool ReadRofsFile( const string& sFile );
-	/**
-	* Parse symbol from a line in rom/rofs file.
-	* @param sLine
-	* @param pSymbol
-	*/
-	void ParseSymbolFromLine( const string& sLine, Symbol* pSymbol );
-#ifndef MODULE_TEST
-private:
-#endif
-
-	// Members
-
-	bool m_bFilesIdentified; /**  Have we identified symbol file(s) */
-	bool m_bSymbolsRead; /** Have we read symbol file(s) */
-	vector<string> m_vRomFiles; /** Rom symbol file(s) */
-	vector<Symbol*> m_vRomCache; /** Cached rom symbols */
-	vector<Symbol*> m_vRomSymbols; /** All rom symbols */
-	unsigned long m_iRomStartAddress; /** Rom start address */
-	unsigned long m_iRomEndAddress; /** Rom end address */
-	vector<string> m_vRofsFiles; /** Rofs symbol file(s) */
-	vector<RofsBinary*> m_vRofsBinaries; /** Rofs binaries */
-	string m_sErrorMessage; /** Error message */
-};
-#endif
\ No newline at end of file
--- a/analyzetool/commandlineengine/inc/iaddresstoline.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +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:  Interface definition for locating code lines using memory addresses.
-*
-*/
-#ifndef __IADDRESSTOLINE_H__
-#define __IADDRESSTOLINE_H__
-
-#include "ATCommonDefines.h"
-
-class CATMemoryAddress;
-
-/**
-* Codeline locating interface. Thru this interface CATModule2 locates code lines
-* using different implementations depending on platform.
-*/
-class IAddressToLine
-{
-public:
-	IAddressToLine() {};
-	virtual ~IAddressToLine() {};
-	/**
-	* Open binary.
-	* @sString
-	* @iNumber
-	* @return true if successful.
-	*/
-	virtual bool Open( const string& sString, const unsigned long iLong) = 0;
-	
-	/**
-	* Get error string. In case of any method failed use this to acquire details on error.
-	* @return error string.
-	*/
-	virtual string GetError( void ) = 0;
-
-	/**
-	* Close binary.
-	* @return true if succesful.
-	*/
-	virtual bool Close( void ) = 0;
-
-	/**
-	* Locate code line and file for given address.
-	* @result
-	* @return true if successful.
-	*/
-	virtual bool AddressToLine( CATMemoryAddress* result ) = 0;
-};
-#endif
\ No newline at end of file
--- a/analyzetool/commandlineengine/inc/stdafx.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 2008 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 file for standard system include files,
-*                or project specific include files that are used frequently, but
-*                are changed infrequently.
-*  Version     : %version: 1 % 
-*
-*/
-
-
-#pragma once
-
-// MemoryLeak checking function.
-// Note! Do not comming in svn with this flag enabled.
-//#define MEM_LEAK_CHECK
-
-// Addr2line binary used.
-//#define ADDR2LINE
-
-#ifdef MEM_LEAK_CHECK
-#define _CRTDBG_MAP_ALLOC
-#include <stdlib.h>
-#include <crtdbg.h>
-#endif
-
-#include <tchar.h>
-#include <fstream>   //ifstream,ofstream
-#include <windows.h>
-#include <string>    //string
-#include <vector>    //string
-#include <sstream>   //stringstream
-#include <iostream>  // cout
-#include <map> // map
-#include <time.h>
\ No newline at end of file
Binary file analyzetool/commandlineengine/install/addr2line.exe has changed
Binary file analyzetool/commandlineengine/install/atool.exe has changed
Binary file analyzetool/commandlineengine/install/binutils-2.19.1-src.zip has changed
Binary file analyzetool/commandlineengine/install/xerces-c_2_7.dll has changed
Binary file analyzetool/commandlineengine/lib/xerces-c_2.lib has changed
--- a/analyzetool/commandlineengine/src/CATBase.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1299 +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:  Definitions for the class CATBase.
-*
-*/
-
-
-#include "../inc/CATBase.h"
-#include "../inc/CATParseXML.h"
-
-// -----------------------------------------------------------------------------
-// CATBase::CATBase
-// Constructor.
-// -----------------------------------------------------------------------------
-CATBase::CATBase(void)
-{
-	LOG_FUNC_ENTRY("CATBase::CATBase");
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::~CATBase
-// Destructor.
-// -----------------------------------------------------------------------------
-CATBase::~CATBase(void)
-{
-	LOG_FUNC_ENTRY("CATBase::~CATBase");
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::ChangeToLower
-// Converts any uppercase letter to lowercase.
-// -----------------------------------------------------------------------------
-void CATBase::ChangeToLower( string& sInput )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::ChangeToLower");
-	int iLength = (int)sInput.size();
-	for( int i = 0 ; i < iLength ; i++ )
-	{
-		sInput[i] = (char)tolower( sInput[i] );
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::ChangeToUpper
-// Converts any uppercase letter to lowercase.
-// -----------------------------------------------------------------------------
-void CATBase::ChangeToUpper( string& sInput )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::ChangeToUpper");
-	int iLength = (int)sInput.size();
-	for( int i = 0 ; i < iLength ; i++ )
-	{
-		sInput[i] = (char)toupper( sInput[i] );
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::TrimString
-// Remove spaces and tabulatures from beginning and
-// end of given string.
-// -----------------------------------------------------------------------------
-void CATBase::TrimString( string& sInput )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::TrimString");
-	if( sInput.empty() )
-		return;
-	//Remove spaces and tabulatures from beginning of string
-	while( !sInput.empty() && ( sInput[0] == SPACE_CHAR_VALUE || sInput[0] == TAB_CHAR_VALUE ) )
-	{
-		sInput.erase( 0, 1 );
-	}
-	//Remove spaces and tabulatures from end of string
-	while( !sInput.empty() && ( sInput[sInput.size()-1] == SPACE_CHAR_VALUE || sInput[sInput.size()-1] == TAB_CHAR_VALUE ) )
-	{
-		sInput.erase( sInput.size()-1, 1 );
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::SearchFileWithExtension
-// Searches files with given extension from path.
-// -----------------------------------------------------------------------------
-bool CATBase::SearchFileWithExtension( const char* pPathAndExt, bool bPrintErrors, string& sErrorLog )
-{
-	LOG_FUNC_ENTRY("CATBase::SearchFileWithExtension");
-	WIN32_FIND_DATA FindFileData;
-	HANDLE hFind;
-	string sTemp( pPathAndExt );
-
-	//Find file
-	hFind = FindFirstFile( sTemp.c_str(), &FindFileData );
-	if (hFind == INVALID_HANDLE_VALUE)
-	{
-		string sErrorString( "No " );
-		//Get extension
-		string sExt( pPathAndExt );
-		sExt.erase( 0, sExt.find_last_of( "." ) );
-
-		sErrorString.append( sExt );
-		sErrorString.append( " files in directory: " );
-
-		string sWithoutExt( pPathAndExt );
-		sWithoutExt.erase( sWithoutExt.find_last_of( "." )-1, string::npos );
-		sErrorString.append( sWithoutExt );
-
-		if( bPrintErrors )
-		{
-			//string sTemp( pPathAndExt );
-			//printf( "Can not find: %s.\n", pPathAndExt );
-			printf( sErrorString.c_str() );
-		}
-		else
-		{
-			//Add line change if sErrorString not empty
-			if( !sErrorLog.empty() )
-				sErrorString.insert( 0, "\n" );
-			sErrorLog.append( sErrorString );
-		}
-		return false;
-	} 
-	else 
-	{
-		FindClose(hFind);
-		return true;
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::GetPathOrFileName
-// Returns path to file or file name.
-// -----------------------------------------------------------------------------
-string CATBase::GetPathOrFileName( bool bFileName, string sInput )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::GetPathOrFileName");
-	string sRet;
-	size_t iPos = sInput.size();
-
-	sInput = ChangeSlashToBackSlash( sInput );
-
-	//Find character '\' starting from end of string
-	while( iPos > 0 && sInput[iPos] != '\\' )
-	{
-		iPos--;
-	}
-	if( iPos > 0 )
-	{
-		//Return file name
-		if( bFileName )
-		{
-			sInput.erase( 0, iPos+1 );
-			sRet = sInput;
-		}
-		else //Return file path
-		{
-			sInput.erase( iPos+1, string::npos );
-			sRet = sInput;
-		}
-	}
-	else
-	{
-		if( !bFileName )
-			return sRet;
-		sRet = sInput;
-	}
-	return sRet;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::GetFileNameUsingExt
-// Searches files with given extension from path.
-// -----------------------------------------------------------------------------
-string CATBase::GetFileNameUsingExt( const char* pPathAndExt )
-{
-	LOG_FUNC_ENTRY("CATBase::GetFileNameUsingExt");
-	WIN32_FIND_DATA FindFileData;
-	HANDLE hFind;
-	string sRet;
-
-	//Find file
-	hFind = FindFirstFile( pPathAndExt, &FindFileData );
-	if (hFind == INVALID_HANDLE_VALUE)
-	{
-		//if( bPrintErrors )
-		printf( "Can not find: %s.\n", pPathAndExt );
-		return sRet;
-	} 
-	else 
-	{
-		sRet.append( FindFileData.cFileName );
-		FindClose(hFind);
-		return sRet;
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::GetStringUntilNextSpace
-// Function returns string from begin of given string until next space,
-// characters until next space are removed from sInput string.
-// -----------------------------------------------------------------------------
-string CATBase::GetStringUntilNextSpace( string& sInput, bool bEraseFromInput )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::GetStringUntilNextSpace");
-	string sTemp( sInput );
-	size_t iSize = sTemp.find_first_of(' ');
-	if( iSize != string::npos )
-	{
-		sTemp.resize( iSize );
-		if( bEraseFromInput )
-			sInput.erase( 0, (iSize+1) );
-	}
-	else
-	{
-		if ( bEraseFromInput )
-			sInput.clear();
-	}
-	return sTemp;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::ChangeSlashToBackSlash
-// Function changes all BackSlash characters to Slash character from
-// given string.
-// -----------------------------------------------------------------------------
-string CATBase::ChangeSlashToBackSlash( string sInput )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::ChangeSlashToBackSlash");
-	for( unsigned int i = 0 ; i < sInput.length() ; i++ )
-	{
-		if( sInput[i] == '/' )
-		{
-			sInput[i] = '\\';
-		}
-	}
-	return sInput;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::FileExists
-// Check if given file exists.
-// -----------------------------------------------------------------------------
-bool CATBase::FileExists( const char * pFilename )
-{
-	LOG_FUNC_ENTRY("CATBase::FileExists");
-	DWORD dwRet = GetFileAttributes( pFilename );
-	if( dwRet == INVALID_FILE_ATTRIBUTES )
-	{
-		return false;
-	}
-	else
-	{
-		//Is file directory?
-		if( dwRet & FILE_ATTRIBUTE_DIRECTORY )
-		{
-			return false;
-		}
-	}
-	return true;
-}
-
-bool CATBase::IsFileReadOnly( const char* pFilename )
-{
-	LOG_FUNC_ENTRY("CATBase::IsFileReadOnly");
-	DWORD dwRet = GetFileAttributes( pFilename );
-	if( dwRet == INVALID_FILE_ATTRIBUTES )
-		return false;
-	if( dwRet & FILE_ATTRIBUTE_READONLY )
-		return true;
-	return false;
-}
-
-bool CATBase::SetFileReadOnly( const char* pFileName )
-{
-	LOG_FUNC_ENTRY("CATBase::SetFileReadOnly");
-	DWORD dw = GetFileAttributes( pFileName );
-	if( dw == INVALID_FILE_ATTRIBUTES )
-		return false;
-	if( dw & FILE_ATTRIBUTE_READONLY )
-		return true;
-	dw = dw | FILE_ATTRIBUTE_READONLY ;
-	if ( SetFileAttributes( pFileName, dw ) )
-		return true;
-	return false;
-}
-bool CATBase::SetFileWritable( const char* pFileName )
-{
-	LOG_FUNC_ENTRY("CATBase::SetFileWritable");
-	DWORD dw = GetFileAttributes( pFileName );
-	if( dw == INVALID_FILE_ATTRIBUTES )
-		return false;
-	if( ! dw & FILE_ATTRIBUTE_READONLY )
-		return true;
-	dw = dw ^ FILE_ATTRIBUTE_READONLY ;
-	if ( SetFileAttributes( pFileName, dw ) )
-		return true;
-	return false;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::FileCopyToPath
-// Copies file to given path
-// -----------------------------------------------------------------------------
-bool CATBase::FileCopyToPath(const string& sFile, const string& sToPath)
-{
-	LOG_FUNC_ENTRY("CATBase::FileCopyToPath");
-	// Display message
-	cout << AT_MSG << "Copy " << sFile << AT_FILE_TO << sToPath << endl;
-	if ( sFile.empty() || sToPath.empty() )
-	{
-		LOG_FUNC_EXIT("CATBase::FileCopyToPath Error, empty parameter");
-		return false;
-	}
-	// Copy using windows api (seems not to work when relavite path ..
-	/*
-	// Full path where to copy
-	string sDestination = sToPath;
-	// Append '\' to string if not exists
-	if ( sDestination.length() > 1 )
-	{
-		const char cLastChar = sDestination[ sDestination.length() -1 ];
-		if ( cLastChar != DASH )
-			sDestination.append("\\");
-	}
-	int iRet = 0;
-	iRet = CopyFile( sFile.c_str(), sDestination.c_str(), false );
-	if ( iRet != 0 )
-	{
-		return false;
-	}
-	*/
-	string sCommand;
-	sCommand.append( "copy /Y \"");
-	sCommand.append( sFile );
-	sCommand.append( "\" \"" );
-	sCommand.append( sToPath );
-	sCommand.append( "\" > nul 2>&1" );
-	LOG_STRING( sCommand );
-	int iRet = 0;
-	iRet = (int)system( sCommand.c_str() );
-	if ( iRet != 0 )
-		return false;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::FileMoveToPath
-// Copies file to given path
-// -----------------------------------------------------------------------------
-bool CATBase::FileMoveToPath(const string& sFile, const string& sToPath)
-{
-	LOG_FUNC_ENTRY("CATBase::FileMoveToPath");
-	// Display message
-	cout << AT_MSG << "Move " << sFile << AT_FILE_TO << sToPath << endl;
-	if ( sFile.empty() || sToPath.empty() )
-	{
-		LOG_FUNC_EXIT("CATBase::FileMoveToPath Error, empty parameter");
-		return false;
-	}
-	// Move (again windows api function does not support relative path .. in it
-	/*
-	// Get filename from sFile
-	string sFileName = GetPathOrFileName( true, sFile );
-	// Full path where to copy
-	string sDestination = sToPath;
-	// Append '\' to string if not exists
-	if ( sDestination.length() > 1 )
-	{
-		const char cLastChar = sDestination[ sDestination.length() -1 ];
-		if ( cLastChar != DASH )
-			sDestination.append("\\");
-	}
-	int iRet = 0;
-	iRet = MoveFile( sFile.c_str(), sDestination.c_str());
-	if ( iRet != 0 )
-	{
-		return false;
-	}
-	*/
-	string sCommand;
-	sCommand.append( "move /Y \"");
-	sCommand.append( sFile );
-	sCommand.append( "\" \"" );
-	sCommand.append( sToPath );
-	sCommand.append( "\" > nul 2>&1" );
-	LOG_STRING( sCommand );
-	int iRet = 0;
-	iRet = (int)system( sCommand.c_str() );
-	if ( iRet != 0 )
-		return false;
-	return true;
-}
-// -----------------------------------------------------------------------------
-// CATBase::CreateTempPath
-// Creates temporary directory path for given mmp file
-// -----------------------------------------------------------------------------
-string CATBase::CreateTempPath(const string& sMmpFileWithPath)
-{
-	LOG_FUNC_ENTRY("CATBase::CreateTempPath");
-	string sTempPath = GetPathOrFileName( false, sMmpFileWithPath );
-	sTempPath.append( AT_TEMP_DIR );
-	sTempPath.append( "\\" );
-	return sTempPath;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::RemovePathAndExt
-// Removes extension from file name and returns file name without extension.
-// -----------------------------------------------------------------------------
-string CATBase::RemovePathAndExt( string sFileName, bool bReverseFindExt)
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::RemovePathAndExt");
-	string sRet;
-	sFileName = GetPathOrFileName( true, sFileName );
-	if ( bReverseFindExt )
-	{
-		// Remove extension from reverse
-		size_t iPos = sFileName.find_last_of('.');
-		if( iPos != string::npos )
-		{
-			sFileName.resize( sFileName.find_last_of('.') );
-			sRet = sFileName;
-		}
-	}
-	else
-	{
-		// Remove extension finding first .
-		size_t iPos = sFileName.find_first_of('.');
-		if( iPos != string::npos )
-		{
-			sFileName.resize( sFileName.find_first_of('.') );
-			sRet = sFileName;
-		}
-	}
-	return sRet;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::IsTargetTypeSupported
-// Checks from constant array is this target unsupported
-// -----------------------------------------------------------------------------
-bool CATBase::IsTargetTypeSupported(string sTargetType)
-{
-	LOG_FUNC_ENTRY("CATBase::IsTargetTypeSupported");
-	// compare to list
-	int iArraySize = sizeof( UNSUPPORTED_TARGET_TYPES ) / sizeof( string );
-	for ( int i=0 ; i < iArraySize ; i++ )
-	{
-		string sUnsupported = UNSUPPORTED_TARGET_TYPES[i];
-		// lowercase both
-		ChangeToLower(sTargetType);
-		ChangeToLower(sUnsupported);
-		// compare
-		if ( sUnsupported.compare( sTargetType ) == 0 )
-		{
-			return false;
-		}
-	}
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::IsTargetTypeKernelSide
-// Checks from constant array is this target type kernel side
-// -----------------------------------------------------------------------------
-bool CATBase::IsTargetTypeKernelSide(string sTargetType)
-{
-	LOG_FUNC_ENTRY("CATBase::IsTargetTypeKernelSide");
-	// compare to list
-	int iArraySize = sizeof( KERNEL_SIDE_TARGET_TYPES ) / sizeof( string );
-	for ( int i=0 ; i < iArraySize ; i++ )
-	{
-		string sUnsupported = KERNEL_SIDE_TARGET_TYPES[i];
-		// lowercase both
-		ChangeToLower(sTargetType);
-		ChangeToLower(sUnsupported);
-		// compare
-		if ( sUnsupported.compare( sTargetType ) == 0 )
-		{
-			return true;
-		}
-	}
-	return false;
-}
-
-bool CATBase::CheckVariant( const string& sEpocRoot, const string& sVariant )
-{
-	LOG_FUNC_ENTRY("CATBase::CheckVariant");
-	string sFileToCheck;
-	// Add epoc root
-	if( sEpocRoot.size() > 1 )
-		sFileToCheck.append( sEpocRoot );
-	// Add path
-	sFileToCheck.append( VARIANT_DIR ) ;
-	// Add variant
-	sFileToCheck.append( sVariant );
-	// Add extension
-	sFileToCheck.append( VARIANT_FILE_EXTENSION );
-	// check does FileExists
-	return FileExists( sFileToCheck.c_str() );
-}
-bool CATBase::IsDefaultVariant( const string& sEpocRoot )
-{
-	LOG_FUNC_ENTRY("CATBase::IsDefaultVariant");
-	string sFileToCheck;
-	// Add epoc root
-	if( sEpocRoot.size() > 1 )
-		sFileToCheck.append( sEpocRoot );
-	// Add path
-	sFileToCheck.append( VARIANT_DIR ) ;
-	// Add variant
-	sFileToCheck.append( "DEFAULT" );
-	// Add extension
-	sFileToCheck.append( VARIANT_FILE_EXTENSION );
-	// check does FileExists
-	return FileExists( sFileToCheck.c_str() );
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::FileDelete
-// FileDelete
-// -----------------------------------------------------------------------------
-bool CATBase::FileDelete(const string& sFile, bool bPrint )
-{
-	LOG_FUNC_ENTRY("CATBase::FileDelete");
-	// does file even exists
-	if ( !FileExists( sFile.c_str() ) )
-		return false;
-	// delete file
-	int iRet = _unlink( sFile.c_str() );
-	// if print on display error
-	if ( iRet  && bPrint )
-	{
-		cout << AT_MSG << "Error, deleting file " << sFile
-			<< endl;
-	}
-	// if print on display message
-	else if ( !iRet && bPrint )
-	{
-		cout << AT_MSG << "Delete " << sFile << endl;
-	}
-	// return
-	if ( iRet )
-		return false;
-	return true;
-}
-// -----------------------------------------------------------------------------
-// CATBase::DirDelete
-// Delelete directory
-// -----------------------------------------------------------------------------
-bool CATBase::DirDelete(const string& sDir, bool bPrint )
-{
-	LOG_FUNC_ENTRY("CATBase::DirDelete");
-	if ( sDir.find( AT_TEMP_DIR) == string::npos )
-		return false;
-	
-	if ( sDir.length() < 2 )
-		return false;
-
-	string sDir2;
-	if ( sDir.at(1) != ':' )
-	{
-		char cDir[MAX_LINE_LENGTH];
-		GetCurrentDirectory( MAX_LINE_LENGTH , cDir );
-		sDir2.append( cDir );
-		sDir2.append( "\\" );
-		sDir2.append( sDir );
-	}
-	else
-		sDir2.append( sDir );
-
-	// does directory exists
-	DWORD dwRet = GetFileAttributes( sDir2.c_str() );
-	if ( dwRet == INVALID_FILE_ATTRIBUTES )
-		return false;
-	else if ( ! (dwRet & FILE_ATTRIBUTE_DIRECTORY) )
-	{
-		return false;
-	}
-	// Delete dir
-	string sCmd( "rmdir /S /Q " );
-	sCmd.append( sDir2 );
-	sCmd.append( " > nul 2>&1" );
-	int iRet = (int)system( sCmd.c_str() );
-	if ( iRet && bPrint)
-	{
-		cout << AT_MSG << "Error, deleting directory " << sDir2 << endl;
-	}
-	else if ( !iRet && bPrint )
-	{
-		cout << AT_MSG << "Delete directory " << sDir2 << endl;
-	}
-	if ( iRet )
-		return false;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::DirCreate
-// Create directory
-// -----------------------------------------------------------------------------
-bool CATBase::DirCreate(const string& sDir, bool bPrint )
-{
-	LOG_FUNC_ENTRY("CATBase::DirCreate");
-
-	if ( sDir.length() < 2 )
-		return false;
-
-	string sDir2;
-	if ( sDir.at(1) != ':' )
-	{
-		char cDir[MAX_LINE_LENGTH];
-		GetCurrentDirectory( MAX_LINE_LENGTH , cDir );
-		sDir2.append( cDir );
-		sDir2.append( "\\" );
-		sDir2.append( sDir );
-	}
-	else
-		sDir2.append( sDir );
-
-	// does directory exists
-	DWORD dwRet = GetFileAttributes( sDir2.c_str() );
-	if ( dwRet != INVALID_FILE_ATTRIBUTES )
-	{
-		if( dwRet & FILE_ATTRIBUTE_DIRECTORY )
-			return false;
-	}
-	// Create dir
-	string sCmd( "mkdir " );
-	sCmd.append( sDir2 );
-	sCmd.append( " > nul 2>&1" );
-	int iRet = (int)system( sCmd.c_str() );
-	if ( iRet && bPrint)
-	{
-		cout << AT_MSG << "Error, creating directory " << sDir2 << endl;
-	}
-	else if ( !iRet && bPrint )
-	{
-		cout << AT_MSG << "Directory " << sDir2 << " created" << endl;
-	}
-	if ( iRet )
-		return false;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::ConvertTCHARtoString
-// Convert TCHAR* to std::string
-// -----------------------------------------------------------------------------
-string CATBase::ConvertTCHARtoString(TCHAR* charArray)
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::ConvertTCHARtoString");
-	// Loop char array
-	stringstream ss;
-	int iIndex = 0;
-	char c = (char) charArray[iIndex];
-	// until null termination
-	while ( c != '\0' )
-	{
-		ss << c;
-		iIndex++;
-		c = (char) charArray[iIndex];
-	}
-	// return string
-	return ss.str();
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::ConvertTCHARtoString
-// Get list of files in directory
-// -----------------------------------------------------------------------------
-vector<string> CATBase::DirList(const string& sDirectory
-								, bool bListDirs, bool bAddPathToFile)
-{
-	LOG_FUNC_ENTRY("CATBase::DirList");
-	// Create string to modify it
-	string sDir = sDirectory;
-	// Add if missing '\' & '*' to the sDirectory
-	if ( sDir.at( sDir.size()-1 ) != '\\' )
-		sDir.append( "\\" );
-	// Path to add to file string if specified
-	string sPath = sDir;
-	// Add * to for windows api to find all files
-	sDir.append( "*" );
-	// convert directory string to LPCSTR
-	LPCSTR dir( sDir.c_str() );
-	// vector to store file list
-	vector<string> vFileList;
-	// Using win32 api to find list of files in directory
-	// file data "container"
-	WIN32_FIND_DATA fileData;
-	// handle to directory
-	HANDLE hFinder = FindFirstFile( dir, &fileData );
-	if ( hFinder == INVALID_HANDLE_VALUE )
-	{
-		// no files found
-		return vFileList;
-	}
-	// loop files add to vector and return
-	while( FindNextFile(hFinder, &fileData ) )
-	{
-		DWORD dw = fileData.dwFileAttributes;
-		// skip if its directory and bListDirs not specified
-		if ( dw & FILE_ATTRIBUTE_DIRECTORY && ! bListDirs)
-			continue;
-		// add files to vector
-		string sFile = ConvertTCHARtoString( fileData.cFileName );
-		// Add given path to file string if specified
-		if ( bAddPathToFile )
-			sFile.insert( 0, sPath );
-		vFileList.push_back( sFile );
-	}
-	// Close file find handler
-	FindClose( hFinder );
-	return vFileList;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::ParseRelativePathToString
-// ParseRelative
-// -----------------------------------------------------------------------------
-void CATBase::ParseRelativePathString(string& sPathString)
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::ParseRelativePathString");
-	string sParsed;
-	// find ..
-	size_t iDots = sPathString.find( ".." );
-	while ( iDots != string::npos )
-	{
-		RemoveRelativePath( sPathString, iDots );
-		iDots = sPathString.find( ".." );
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::RemoveRelativePath
-// Remove relative path from string (using given index)
-// -----------------------------------------------------------------------------
-void CATBase::RemoveRelativePath(string& sString, size_t iDots)
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::RemoveRelativePath");
-	// Chck if accidentally given wrong parameter
-	if ( iDots == string::npos 
-		|| iDots < 1 )
-		return;
-	// Parsed string
-	string sParsed;
-	// Find position of last backslash before dots
-	size_t i = sString.rfind("\\", iDots-2 );
-	// Pickup start part (depending is the backslash at last parts first char)
-	if ( sString.at(iDots+2) != '\\' )
-		sParsed = sString.substr( 0, i+1 ) ;
-	else
-		sParsed = sString.substr( 0, i );
-	// Pick up last part
-	sParsed.append( sString.substr( iDots+2, sString.size() ) );
-	sString = sParsed;
-}
-
-// -----------------------------------------------------------------------------
-// Get extension from given string
-// -----------------------------------------------------------------------------
-string CATBase::GetExtension(const string& sString)
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::GetExtension");
-	// find last .
-	size_t iDot = sString.find_last_of( "." );
-	// return string after . if found
-	if ( iDot != string::npos )
-		return sString.substr(iDot+1, sString.length()-(iDot+1) );
-	// otherwise return given string
-	return sString;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::DirectoryExists
-// Check if given directory exists.
-// -----------------------------------------------------------------------------
-bool CATBase::DirectoryExists( const char* pDirname )
-{
-	LOG_FUNC_ENTRY("CATBase::DirectoryExists");
-	size_t iLenght = strlen( pDirname );
-	
-	if ( iLenght < 2 )
-		return false;
-
-	string sDir;
-	if ( pDirname[1] != ':' )
-	{
-		char cDir[MAX_LINE_LENGTH];
-		GetCurrentDirectory( MAX_LINE_LENGTH , cDir );
-		sDir.append( cDir );
-		sDir.append( "\\" );
-		sDir.append( pDirname );
-	}
-	else
-		sDir.append( pDirname );
-
-	DWORD dwRet = GetFileAttributes( sDir.c_str() );
-	if( dwRet == INVALID_FILE_ATTRIBUTES )
-	{
-		return false;
-	}
-	else
-	{
-		//Is file directory?
-		if( dwRet & FILE_ATTRIBUTE_DIRECTORY )
-		{
-			return true;
-		}
-		else
-		{
-			return false;
-		}
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::ConvertUnixPathToWin
-// -----------------------------------------------------------------------------
-void CATBase::ConvertUnixPathToWin( string& sPath )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::ConvertUnixPathToWin");
-	size_t iSpot = 0;
-	// convert '/' to '\'
-	iSpot = sPath.find( "/" );
-	while( iSpot != string::npos )
-	{
-		sPath.replace(iSpot,1, "\\");
-		iSpot = sPath.find( "/", iSpot+1 );
-	}
-	// convert '\\' to '\'
-	iSpot = sPath.find( "\\\\" );
-	while( iSpot != string::npos )
-	{
-		sPath.replace(iSpot,2,"\\");
-		iSpot = sPath.find( "\\\\" );
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::RemoveAllAfterDotIfTwoDots
-// Removes all after first '.'
-// if given string contains 2 '.' or more
-// -----------------------------------------------------------------------------
-void CATBase::RemoveAllAfterDotIfTwoDots(string& sModName)
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::RemoveAllAfterDotIfTwoDots");
-	// did we find variable?
-	size_t found;
-	// Find first '.'
-	found = sModName.find(".");
-	if ( found != string::npos )
-	{
-		// Try find second '.'
-		found = sModName.find(".", found+1);
-		if ( found != string::npos )
-		{
-			// Remove all after first '.'
-			sModName = sModName.substr(0, sModName.find(".")+1 );
-		}
-	}
-}
-// -----------------------------------------------------------------------------
-// CATBase::CreateTemporaryCpp
-// -----------------------------------------------------------------------------
-bool CATBase::CreateTemporaryCpp( const string& sId,
-								 const string& sPath
-								 ,const string& sS60FileName
-								 ,int iLogOption
-								 ,int iIsDebug
-								 ,int iAllocCallStackSize
-								 ,int iFreeCallStackSize )
-{
-	LOG_FUNC_ENTRY("CATBase::CreateTemporaryCpp");
-	// Add slash to path if missing
-	string sTempCpp = sPath;
-	if( sTempCpp.at( sTempCpp.length() - 1 ) != '\\' )
-		sTempCpp.append("\\");
-
-	// append temporary cpp name with id in middle
-	sTempCpp.append( AT_TEMP_CPP_LOWER_START );
-	sTempCpp.append( sId );
-	sTempCpp.append( AT_TEMP_CPP_LOWER_END );
-
-	//Open and truncate temporary cpp
-	ofstream out( sTempCpp.c_str() , ios::trunc );
-	if ( ! out.good() )
-	{
-		out.close();
-		return false;
-	}
-	// Headers
-	out << "#include <e32base.h>";
-	// Is debug
-	out << "\nconst TInt ATTempDebug(" << iIsDebug << ");";
-	// Log option
-	out << "\nconst TInt ATTempLogOption(" << iLogOption << ");";
-	// Alloc call stack
-	out << "\nconst TInt ATTempAllocCallStackSize(" << iAllocCallStackSize << ");";
-	// Free call stack
-	out << "\nconst TInt ATTempFreeCallStackSize(" << iFreeCallStackSize << ");";
-	// Log file name
-	out << "\n_LIT( ATTempLogFileName, \"" << sS60FileName << "\" );";
-	// Version number
-	out << "\n_LIT( ATTempVersion, \"" << ATOOL_COMPATIBILITY_STRING << "\" );";
-	// Variable functions use enumeration values that are defined in memoryhook (customuser.h)
-	// We use constants here so that we don't need to include the header file, wich
-	// might cause problems.
-/* Enumeration copied to comment for notes
-        enum TATOptions
-            {
-            ELogFileName = 1,   
-            EVersion = 2 ,
-            ELogOption = 3,
-            EDebug = 4,
-            EAllocCallStackSize = 5,
-            EFreeCallStackSize = 6
-            };
-*/
-	out << "\nTInt GetInt( const TUint8 aType )";
-	out << "\n{";
-	out << "\nswitch( aType )";
-	out << "\n{";
-	out << "\ncase 4: return ATTempDebug; ";
-	out << "\ncase 3: return ATTempLogOption;";
-	out << "\ncase 5: return ATTempAllocCallStackSize;";
-	out << "\ncase 6: return ATTempFreeCallStackSize;";
-	out << "\ndefault: return KErrArgument;";
-	out << "\n}";
-	out << "\n}";
-	out << "\nTPtrC GetString( const TUint8 aType )";
-	out << "\n{";
-	out << "\nswitch( aType )";
-	out << "\n{";
-	out << "\ncase 1: return ATTempLogFileName();";
-	out << "\ncase 2: return ATTempVersion();";
-	out << "\ndefault: return KNullDesC();";
-	out << "\n}";
-	out << "\n}";
-
-	/** Todo: Old way of separate functions, these here for backup support and to ease testing. */
-	/** Unnessesary in the future, so can be removed then (1.8.2). */
-
-	out << "\n_LIT( KFileName, \"";
-	out << sS60FileName;
-	out << "\" );\n";
-
-	// Hardcoded version number for support.
-	out << "\n/* The AnalyzeTool version number used. */";
-	out << "\n_LIT( KAtoolVersion, \"1.7.5;1.9.1\" );\n";
-
-	out << "\nconst TFileName LogFileName()";
-	out << "\n    {";
-	out << "\n    return TFileName( KFileName() );";
-	out << "\n    }";
-
-	out << "\nTUint32 AllocCallStackSize()";
-	out << "\n    {";
-	out << "\n    return TUint32( ";
-	out << iAllocCallStackSize;
-	out << " );\n";
-	out << "\n    }";
-	
-	out << "\nTUint32 FreeCallStackSize()";
-	out << "\n    {";
-	out << "\n    return TUint32( ";
-	out << iFreeCallStackSize;
-	out << " );\n";
-	out << "\n    }";
-
-	out << "\nconst TFileName AtoolVersion()";
-	out << "\n    {";
-	out << "\n    return TFileName( KAtoolVersion() );";
-	out << "\n    }";
-
-	out << "\nTUint32 LogOption()";
-	out << "\n    {";
-	out << "\n    return TUint32( ";
-	out << iLogOption;
-	out << " );";
-	out << "\n    }";
-	
-	out << "\nTUint32 IsDebug()";
-	out << "\n    {";
-	out << "\n    return TUint32( ";
-	out << iIsDebug;
-	out << " );";
-	out << "\n    }";
-
-	// End of file and close
-	out << "\n\n// End of File\n";
-	out.close();
-	cout << AT_MSG << "Created " << sTempCpp << endl;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::IsDataFile
-// -----------------------------------------------------------------------------
-bool CATBase::IsDataFile( string sFile )
-{
-	LOG_FUNC_ENTRY("CATBase::IsDataFile");
-	// Check that sFile not empty
-	if ( sFile.empty() || sFile.length() < 1 )
-		return false;
-
-	// Temporary line char array.
-	char cLineFromFile[MAX_LINE_LENGTH];
-	//Open file
-	ifstream in( sFile.c_str() );
-
-	//File open ok?
-	if( !in.good() )
-		return false;
-
-	//Read all lines
-	in.getline( cLineFromFile, MAX_LINE_LENGTH );
-
-	string sLineFromFile( cLineFromFile );
-	in.close();
-	if( sLineFromFile.find( "DATA_FILE_VERSION" ) != string::npos )
-		return true;
-	else
-		return false;
-}
-
-
-// -----------------------------------------------------------------------------
-// CATBase::ParseStringToVector
-// -----------------------------------------------------------------------------
-vector<string> CATBase::ParseStringToVector( const string& sInput, char separator )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::ParseStringToVector");
-	string sString(sInput);
-	// Elements vector
-	vector<string> vStrings;
-	size_t iPos = sString.find( separator );
-	// If can not find it return vector with just one element
-	if ( iPos == string::npos )
-	{
-		// Don't add empty item into vector.
-		if ( sString.size() > 0 )
-			vStrings.push_back( sString );
-		return vStrings;
-	}
-	// Loop elements
-	while( iPos != string::npos )
-	{
-		string sElement = sString.substr(0, iPos);
-		vStrings.push_back( sElement );
-		sString.erase(0, iPos +1 );
-		iPos = sString.find( separator );
-	}
-	// Add last element if any
-	if ( sString.size() > 0 )
-		vStrings.push_back( sString );
-	// Return elements
-	return vStrings;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::FilterString
-// Filter string out of unwanted characters. The list of allowed
-// characters is defined in CFILTERSTRING.
-// -----------------------------------------------------------------------------
-string CATBase::FilterString( const string& sString )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::FilterString");
-	string sFiltered;
-	for( size_t i = 0 ; i < sString.length() ; i++ )
-	{
-		const char p = sString.at( i );
-		if ( strchr( CFILTERSTRING, p ) !=  0 )
-			sFiltered.push_back( p );
-	}
-	return sFiltered;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::FilterExtraSpaces
-// Replaces multiple continuous spaces with single. Won't leave
-// spaces in start or end of string.
-// -----------------------------------------------------------------------------
-void CATBase::FilterExtraSpaces( string& sString )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::FilterExtraSpaces");
-	string sFiltered;
-	// Loop thru char array.
-	for( size_t i = 0 ; i < sString.length(); i++ )
-	{
-		// Is char space?
-		if ( sString.at( i ) == ' ' )
-		{
-			// Pick up space if filtered does not contain char as last.
-			if ( sFiltered.rbegin() == sFiltered.rend() )
-				sFiltered.push_back( sString.at( i ) );
-			else if ( * ( sFiltered.rbegin() ) != ' ' )
-				sFiltered.push_back( sString.at( i ) );
-		}
-		else
-			sFiltered.push_back( sString.at( i ) );
-	}
-
-	// Remove first and/or last character if it is space.
-	if ( sFiltered.begin() != sFiltered.end() )
-	{
-		if( * ( sFiltered.begin() ) == ' ' )
-			sFiltered.erase( 0, 1 );
-	}
-	if ( sFiltered.rbegin() != sFiltered.rend() )
-	{
-		if( * ( sFiltered.rbegin() ) == ' ' )
-			sFiltered.resize( sFiltered.length()-1 );
-	}
-	sString = sFiltered;
-}
-
-
-bool CATBase::hexToDec( string& sHex, unsigned int& iDec )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::hexToDec");
-	istringstream ss( sHex );
-	ss.setf( ios::hex, ios::basefield );
-	if( ( ss >> iDec ) )
-		return true;
-	return false;
-}
-
-bool CATBase::hexToDec( string& sHex, int& iDec )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::hexToDec");
-	istringstream ss( sHex );
-	ss.setf( ios::hex, ios::basefield );
-	if( ( ss >> iDec ) )
-		return true;
-	return false;
-}
-
-bool CATBase::hexToDec( string& sHex, unsigned long& ulDec )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::hexToDec");
-	istringstream ss( sHex );
-	ss.setf( ios::hex, ios::basefield );
-	if( ( ss >> ulDec ) )
-		return true;
-	return false;
-}
-
-bool CATBase::hexToDec( string& sHex, unsigned long long& ullDec )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::hexToDec");
-	istringstream ss( sHex );
-	ss.setf( ios::hex, ios::basefield );
-	if( ( ss >> ullDec ) )
-		return true;
-	return false;
-}
-
-/**
-* Used to create array of integer & hex value pairs.
-*/
-struct CHexMap
-{
-	char chr;
-	int value;
-};
-
-// -----------------------------------------------------------------------------
-// CATBase::_httoi
-// -----------------------------------------------------------------------------
-unsigned long CATBase::_httoi(const char *value)
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::_httoi");
-	unsigned long l;
-	string s( value );
-	if ( CATBase::hexToDec( s, l ) )
-		return l;
-	return 0;
-}
-
-
-// -----------------------------------------------------------------------------
-// CATBase::NumberToHexString(int)
-// -----------------------------------------------------------------------------
-string CATBase::NumberToHexString( unsigned int i )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::IntToHexString");
-	stringstream ss;
-	ss << "0x" << hex << i;
-	string retval; retval = ss.str().c_str();
-	return retval;
-}
-// -----------------------------------------------------------------------------
-// CATBase::NumberToHexString(long)
-// -----------------------------------------------------------------------------
-string CATBase::NumberToHexString( unsigned long i )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::IntToHexString");
-	stringstream ss;
-	ss << "0x" << hex << i;
-	string retval; retval = ss.str().c_str();
-	return retval;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::IsHexCharacter
-// -----------------------------------------------------------------------------
-bool CATBase::IsHexCharacter(const TCHAR *value)
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::IsHexCharacter");
-	const int HexMapL = 22;
-	CHexMap HexMap[HexMapL] =
-	{
-	    {'0', 0}, {'1', 1},
-		{'2', 2}, {'3', 3},
-		{'4', 4}, {'5', 5},
-		{'6', 6}, {'7', 7},
-		{'8', 8}, {'9', 9},
-		{'A', 10}, {'B', 11},
-		{'C', 12}, {'D', 13},
-		{'E', 14}, {'F', 15},
-		{'a', 10}, {'b', 11},
-		{'c', 12}, {'d', 13},
-		{'e', 14}, {'f', 15}
-	};
-	bool found = false;
-	for (int i = 0; i < HexMapL; i++)
-	{
-		if(HexMap[i].chr == *value)
-		{
-			found = true;
-			break;
-		}
-	}
-	return found;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::IsAscii(const char*,const unsigned int)
-// -----------------------------------------------------------------------------
-bool CATBase::IsAscii( const char* pInput, const unsigned int iLength )
-{
-	LOG_LOW_FUNC_ENTRY("CATBase::IsAscii");
-	bool bRet = true;
-	const char* pPoint = pInput;
-	for( unsigned int i = 0 ; i < iLength ; i++)
-	{
-		if(	!__isascii(*pPoint) )
-		{
-			bRet = false;
-			break;
-		}
-		pPoint++;
-	}
-	return bRet;
-}
-
-// -----------------------------------------------------------------------------
-// CATBase::GetEpocRoot( string& sEpocRoot )
-// -----------------------------------------------------------------------------
-bool CATBase::GetEpocRoot( string& sEpocRoot )
-{
-	LOG_FUNC_ENTRY( "CATBase::GetEpocRoot" );
-	bool bRet = true;
-	//Find EPOCROOT from environment variable
-	char* pEpocRoot = getenv ("EPOCROOT");
-	if( pEpocRoot == NULL )
-	{
-		const char pDevicesPath[] = "C:\\Program Files\\Common Files\\Symbian\\devices.xml";
-		CATParseXML parser;
-		//Find EPOCROOT from devices
-		sEpocRoot = parser.GetEpocRootPathFromXML(pDevicesPath);
-		if( sEpocRoot.empty() )
-		{
-			printf("EPOCROOT not set to environment variables.\n");
-			bRet = false;
-		}
-	}
-	else
-	{
-		sEpocRoot.append( pEpocRoot );
-		LOG_STRING( "EpocRoot :" << sEpocRoot );
-	}
-	//Remove trailing slash
-	if ( sEpocRoot.size() > 1 && sEpocRoot[ sEpocRoot.length()-1 ] == '\\' )
-		sEpocRoot.resize( sEpocRoot.length()-1 );
-	return bRet;
-}
-//End of file
--- a/analyzetool/commandlineengine/src/CATDatParser.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1542 +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:  Class responsible to parse data files
-*
-*/
-
-
-#include "../inc/CATDatParser.h"
-#include "../inc/CATProject.h"
-#include "../inc/CATModule2.h"
-#include "../inc/CATMemoryAddress.h"
-#include "../inc/catromsymbol.h"
-
-// -----------------------------------------------------------------------------
-// CATDatParser::CATDatParser
-// Constructor only for testing!
-// (No module vector defined so no locating codelines / call stacks)
-// -----------------------------------------------------------------------------
-CATDatParser::CATDatParser()
-{
-	LOG_FUNC_ENTRY("CATDatParser::CATDatParser");
-	Construct();
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::CATDatParser
-// Constructor
-// -----------------------------------------------------------------------------
-CATDatParser::CATDatParser(vector<CATModule2*>* pModules )
-{
-	LOG_FUNC_ENTRY("CATDatParser::CATDatParser");
-	Construct();
-	m_pModules = pModules;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::Construct
-// "Real" constructor
-// -----------------------------------------------------------------------------
-void CATDatParser::Construct()
-{
-	LOG_FUNC_ENTRY("CATDatParser::Construct");
-
-	m_iDataVersion = 1; // Default version of data.
-	m_bDllLoadFound = false;
-	m_bProcessStartFound = false;
-	m_bSubtestOnGoing = false;
-
-	m_DataSaver.InitXML();
-	
-	m_eBuildType = -2;
-	m_eProcess_state = not_started;
-	m_eProjectBuildType = -1;
-
-	m_iCurrentProcessId = 0;
-	m_iLeakNumber = 0;
-	m_iLogLevel = 3;
-	m_iOffSet = 0;
-
-	m_iPinPointedLeaks = 0;
-	m_iPinPointedSubTestLeaks = 0;
-	m_iSubtestStartHandleCount = 0;
-	m_iSuccesfullRuns = 0;
-	m_iTotalNumberOfLeaks = 0;
-	m_iTotalRuns = 0;
-
-	m_pRomSymbol = 0;
-	m_pModules = 0;
-
-	m_sCurrentProcessName = "";
-	m_sInputFile = "";
-	m_sInputFileTemp = "";
-	m_sOutputFile = "";
-	m_sProjectPlatform = "";
-	m_vRomSymbolFiles.clear();
-	m_vDllLoadModList.clear();
-	m_vDllLoadModListSubTest.clear();
-	m_vHandleLeaks.clear();
-	m_vMemoryAddress.clear();
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::~CATDatParser
-// Destructor
-// -----------------------------------------------------------------------------
-CATDatParser::~CATDatParser()
-{
-	LOG_FUNC_ENTRY("CATDatParser::~CATDatParser");
-
-	if ( m_In.is_open() )
-		m_In.close();
-	// Delete temporary input file if any
-	if ( !m_sInputFileTemp.empty() )
-	{
-		if ( FileExists( m_sInputFileTemp.c_str() ) )
-			FileDelete( m_sInputFileTemp, false );
-	}
-	// Clean memory addresses if any
-	CleanMemoryAddresses();
-	// Delete rom symbol.
-	if ( m_pRomSymbol )
-	{
-        delete m_pRomSymbol;
-		m_pRomSymbol = NULL;
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::Analyze
-// Analyze given data file
-// -----------------------------------------------------------------------------
-int CATDatParser::Analyze()
-{
-	LOG_FUNC_ENTRY("CATDatParser::Analyze");
-	// Return if input file not set
-	if ( m_sInputFile.empty() )
-		return AT_RETURN_CODE::INVALID_DATA_FILE;
-	// If open close first
-	if ( m_In.is_open() )
-		m_In.close();
-	// Open file
-	m_In.open( m_sInputFile.c_str() );
-	if ( ! m_In.good() )
-		return AT_RETURN_CODE::INVALID_DATA_FILE;
-	try {
-		// If rom symbol file specified.
-		if ( ! m_vRomSymbolFiles.empty() )
-		{
-			// Create new rom symbol file "parser".
-			m_pRomSymbol = new CATRomSymbol();
-			m_pRomSymbol->m_bShowProgressMessages = true;
-			// Set symbol files.
-			if ( ! m_pRomSymbol->SetSymbols( m_vRomSymbolFiles ) )
-			{
-				cout << AT_MSG << "Rom/Rofs symbols error: " << m_pRomSymbol->GetError() << endl;
-				// If file open fails we delete it and will not use it.
-				delete m_pRomSymbol;
-				m_pRomSymbol = NULL;
-				cout << AT_MSG << "Analyze aborted." << endl;
-				return AT_RETURN_CODE::SYMBOL_FILE_ERROR;
-			}
-		}
-		// Return code
-		int iRet = 0;
-		// Clear variables
-		ClearParsingVariables();
-		// If output defined disable printing
-		if ( ! m_sOutputFile.empty() )
-			m_DataSaver.SetPrintFlag( false );
-		// Header
-		Header();
-		// Parsing
-		iRet = Parse();
-		// Footer
-		if ( iRet == AT_RETURN_CODE::OK )
-			Footer();
-		// If output defined save xml
-		if ( ! m_sOutputFile.empty() )
-			m_DataSaver.SaveLinesToFile( m_sOutputFile.c_str(), XML_DATA );
-		// Return
-		return iRet;
-	} catch ( int i )
-	{
-		cout << AT_MSG << "Error, Analyze failed. : " << i << endl;
-		return AT_RETURN_CODE::UNHANDLED_EXCEPTION;
-	}
-}
-// -----------------------------------------------------------------------------
-// CATDatParser::Header
-// Print header of report
-// -----------------------------------------------------------------------------
-void CATDatParser::Header()
-{
-	LOG_FUNC_ENTRY("CATDatParser::Header");
-	// Analyze report header
-	m_DataSaver.AddString( "Atool.exe v." );
-	m_DataSaver.AddString( ATOOL_VERSION );
-	m_DataSaver.AddString( "\n" );
-	m_DataSaver.AddString( "Analyzing memory leaks..." );
-	m_DataSaver.AddLineToLast();
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::Footer
-// Print footer of report
-// -----------------------------------------------------------------------------
-void CATDatParser::Footer()
-{
-	LOG_FUNC_ENTRY("CATDatParser::Footer");
-	m_DataSaver.AddString( "\nTotal Runs: " );
-	m_DataSaver.AddInteger( m_iTotalRuns );
-	m_DataSaver.AddLineToLast();
-
-	int iFailedRuns = m_iTotalRuns - m_iSuccesfullRuns;
-	m_DataSaver.AddString( "Failed Runs: " );
-	m_DataSaver.AddInteger( iFailedRuns );
-	m_DataSaver.AddLineToLast();
-
-	char cTemp[128];
-	string sResult( itoa( m_iTotalRuns, cTemp, 10 ) );
-	sResult.append( ";" );
-	sResult.append( itoa( iFailedRuns, cTemp, 10 ) );
-	sResult.append( ";" );
-
-	m_DataSaver.SaveXML( sResult, RESULT );
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ClearParsingVariables
-// Clear/Reset all member variables related to parsing data file
-// -----------------------------------------------------------------------------
-void CATDatParser::ClearParsingVariables()
-{
-	LOG_FUNC_ENTRY("CATDatParser::ClearParsingVariables");
-	// Clear variables related to analyze
-	m_eProcess_state = not_started;
-	m_bProcessStartFound = false;
-	m_bDllLoadFound = false;
-	m_iTotalNumberOfLeaks = 0;
-	m_iPinPointedLeaks = 0;
-	m_iLeakNumber = 0;
-	m_iTotalRuns = 0;
-	m_iSuccesfullRuns = 0;
-	m_bSubtestOnGoing = false;
-	m_iSubtestStartHandleCount = 0;
-	CleanMemoryAddresses();
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::Parse
-// Parses data file. Note! header and footer of the report are done in 
-// separate functions.
-// -----------------------------------------------------------------------------
-int CATDatParser::Parse()
-{
-	LOG_FUNC_ENTRY("CATDatParser::Parse");
-	// Read all lines
-	char cLine[MAX_LINE_LENGTH];
-	do
-	{
-		string sLine;
-		try {
-			m_In.getline( cLine, MAX_LINE_LENGTH );
-			sLine = cLine ;
-		} catch(...)
-		{
-			LOG_STRING( AT_MSG << "Unexpected error, reading data file." );
-			continue;
-		}
-		if( sLine.find( LABEL_DATA_FILE_VERSION ) != string::npos )
-		{
-			// Check data file version
-			if(  sLine.find( AT_DATA_FILE_VERSION ) == string::npos )
-			{
-				return AT_RETURN_CODE::WRONG_DATA_FILE_VERSION;
-			}
-		}
-		else if( sLine.find( LABEL_PROCESS_START ) != string::npos )
-		{
-			if ( ! ParseProcessStart( sLine ) )
-				return AT_RETURN_CODE::ANALYZE_ERROR;
-		}
-		else if( sLine.find( LABEL_DLL_LOAD ) != string::npos )
-		{
-			if ( ! ParseDllLoad( sLine ) )
-				return AT_RETURN_CODE::ANALYZE_ERROR;
-		}
-		else if( sLine.find( LABEL_DLL_UNLOAD ) != string::npos )
-		{
-			if ( ! ParseDllUnload( sLine ) )
-				return AT_RETURN_CODE::ANALYZE_ERROR;
-		}
-		else if( sLine.find( LABEL_MEM_LEAK ) != string::npos)
-		{
-			if ( ! ParseMemLeak( sLine ) )
-				return AT_RETURN_CODE::ANALYZE_ERROR;
-		}
-		else if( sLine.find( LABEL_PROCESS_END ) != string::npos )
-		{
-			if ( ! ParseProcessEnd( sLine ) )
-				return AT_RETURN_CODE::ANALYZE_ERROR;
-		}
-		else if( sLine.find( LABEL_ERROR_OCCURED ) != string::npos )
-		{
-			if ( ! ParseErrorOccured( sLine ) )
-				return AT_RETURN_CODE::ANALYZE_ERROR;
-		}
-		else if( sLine.find( LABEL_HANDLE_LEAK ) != string::npos )
-		{
-			if ( ! ParseHandleLeak( sLine ) )
-				return AT_RETURN_CODE::ANALYZE_ERROR;
-		}
-		else if( sLine.find( LABEL_TEST_START ) != string::npos )
-		{
-			if ( ! ParseTestStart( sLine ) )
-				return AT_RETURN_CODE::ANALYZE_ERROR;
-		}
-		else if( sLine.find( LABEL_TEST_END ) != string::npos )
-		{
-			if ( ! ParseTestEnd( sLine ) )
-				return AT_RETURN_CODE::ANALYZE_ERROR;
-		}
-		else if( sLine.find( LABEL_LOGGING_CANCELLED ) != string::npos )
-		{
-			if ( ! ParseLoggingCancelled( sLine ) )
-				return AT_RETURN_CODE::ANALYZE_ERROR;
-		}
-	}
-	while( m_In.good() );
-	// Message of failed run if process start was last line in data.
-	if ( m_eProcess_state == ongoing )
-	{
-		m_DataSaver.AddString( "Test run failed.\n" );
-		m_DataSaver.AddLineToLast();
-	}
-	return AT_RETURN_CODE::OK;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ParseProcessStart
-// -----------------------------------------------------------------------------
-bool CATDatParser::ParseProcessStart( string& sLine)
-{
-	LOG_FUNC_ENTRY("CATDatParser::ParseProcessStart");
-	if ( m_eProcess_state == ongoing )
-	{
-		m_DataSaver.AddString( "Test run failed.\n" );
-		m_DataSaver.AddLineToLast();
-	}
-	m_eProcess_state = ongoing;
-	m_bProcessStartFound = true;
-
-	// Clear handle leaks
-	m_vHandleLeaks.clear();
-	// Increment runs
-	m_iTotalRuns++;
-	// Clean leak count
-	m_iTotalNumberOfLeaks = 0;
-	// Clean pin pointed leaks count.
-	m_iPinPointedLeaks = 0;
-	// Clean leak number
-	m_iLeakNumber = 0;
-
-	// Clean loaded mods
-	m_vDllLoadModList.clear();
-	m_vDllLoadModListSubTest.clear();
-
-	// Skip text PROCESS_START
-	GetStringUntilNextSpace( sLine );
-	// Get process name
-	m_sCurrentProcessName = GetStringUntilNextSpace( sLine );
-	// Get Pid
-	string sPid = GetStringUntilNextSpace( sLine );
-	m_iCurrentProcessId = _httoi( sPid.c_str() );
-
-	// Header for process tart
-	m_DataSaver.AddString( "\n--------------------------------\n" );
-	m_DataSaver.AddString( "Test Run start (" );
-	m_DataSaver.AddString( m_sCurrentProcessName.c_str() );
-	m_DataSaver.AddString( "): " );
-
-	// Get start time
-	string sTime = GetStringUntilNextSpace( sLine );
-	sTime = ConvertTimeToLocalTime( sTime );
-	m_DataSaver.AddString( sTime.c_str() );
-
-	// Create data for xml
-	string sData( sTime );
-	sData.append( ";" );
-	
-	// Build mode UDEB/UREL.
-	string sBuildType = GetStringUntilNextSpace( sLine );
-
-	m_DataSaver.AddString( " Build target: " );
-	if( sBuildType.compare( "0" ) == 0 )
-	{
-		m_eBuildType = CATProject::UREL;
-	}
-	else if( sBuildType.compare( "1" ) == 0 )
-	{
-		m_eBuildType = CATProject::UDEB;
-	}
-	m_DataSaver.AddString( CATProject::GetBuildTypeString( m_eBuildType ).c_str() );
-
-	// Version.
-	string sVersion = GetStringUntilNextSpace( sLine );
-	unsigned int iVer = 0;
-	if ( hexToDec( sVersion, iVer ) && iVer != 0 )
-		m_iDataVersion = iVer;
-
-	// End line in data.
-	m_DataSaver.AddLineToLast();
-	
-	// xml
-	sData.append( CATProject::GetBuildTypeString( m_eBuildType ) );
-	sData.append( ";" );
-	sData.append( m_sCurrentProcessName );
-	m_DataSaver.SaveXML( sData, RUN );
-
-	// If projects platform defined check that it is same in data. (future feature).
-	if ( ! m_sProjectPlatform.empty() )
-	{
-		// If platform info is added to data file do check here.
-	}
-	// If projects build type defined check that it is same in data.
-	if ( m_eProjectBuildType != -1 )
-	{
-		if ( m_eBuildType != m_eProjectBuildType )
-		{
-			string sError(AT_MSG);
-			sError.append( "Error, analyzed data has build type of " );
-			sError.append( CATProject::GetBuildTypeString( m_eBuildType ) );
-			sError.append( " and project has build type " );
-			sError.append( CATProject::GetBuildTypeString( m_eProjectBuildType ) );
-			sError.append( ". Pinpointed code lines are not valid." );
-			m_DataSaver.AddString( sError.c_str(), false );
-			m_DataSaver.AddLineToLast();
-		}
-	}
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ParseProcessEnd
-// -----------------------------------------------------------------------------
-bool CATDatParser::ParseProcessEnd( string& sLine )
-{
-	LOG_FUNC_ENTRY("CATDatParser::ParseProcessEnd");
-	GetStringUntilNextSpace( sLine );
-
-	// Get process id
-	string sProcessID = GetStringUntilNextSpace( sLine );
-	unsigned long iProcessID = _httoi( sProcessID.c_str() );
-
-	// Get time
-	string sTime = GetStringUntilNextSpace( sLine );
-
-	// Convert leak time
-	sTime = ConvertTimeToLocalTime( sTime );
-
-	// Process started?
-	if( iProcessID == m_iCurrentProcessId )
-	{
-		m_iSuccesfullRuns++;
-		m_DataSaver.AddLineToLast();
-		m_DataSaver.AddString( "Test Run end (" );
-		m_DataSaver.AddString( m_sCurrentProcessName.c_str() );
-		m_DataSaver.AddString( "): " );
-		m_DataSaver.AddString( sTime.c_str() );
-		m_DataSaver.AddLineToLast();
-		m_DataSaver.AddString( "Build target: " );
-		m_DataSaver.AddString( CATProject::GetBuildTypeString( m_eBuildType ).c_str() );
-		m_DataSaver.AddLineToLast();
-
-		m_eProcess_state = stopped;
-		// Number of leaks
-		if ( m_iLogLevel == 1 || m_iLogLevel == 2 )
-		{
-			if ( m_iPinPointedLeaks > 0 )
-			{
-				m_DataSaver.AddInteger( m_iPinPointedLeaks );
-				m_DataSaver.AddString( " number of pinpointed memory leak(s)." );
-				m_DataSaver.AddLineToLast();
-			}
-			m_DataSaver.AddInteger( m_iLeakNumber );
-			m_DataSaver.AddString( " total number of memory leak(s)." );
-			m_DataSaver.AddLineToLast();
-		}
-		else
-		{
-			m_DataSaver.AddInteger( m_iTotalNumberOfLeaks );
-			m_DataSaver.AddString( " memory leak(s) found." );
-			m_DataSaver.AddLineToLast();
-		}
-		
-		// xml
-		char cTemp[128];
-		m_DataSaver.SaveXML( itoa( m_iTotalNumberOfLeaks, cTemp, 10 ) , MEM_LEAKS );
-
-		// Print all modules which have leaks
-		for( size_t i = 0 ; i < m_vDllLoadModList.size() ; i++ )
-		{
-			if( m_vDllLoadModList.at(i).iLeaks > 0 )
-			{
-				m_DataSaver.AddInteger( m_vDllLoadModList.at(i).iLeaks );
-				m_DataSaver.AddString( " memory leak(s) in module: " );
-				m_DataSaver.AddString( m_vDllLoadModList.at(i).sModuleName.c_str() );
-				m_DataSaver.AddLineToLast();
-
-				// xml
-				string sModuleNameAndLeaks( m_vDllLoadModList[i].sModuleName );
-				sModuleNameAndLeaks.append(";");
-				sModuleNameAndLeaks.append( itoa( m_vDllLoadModList[i].iLeaks, cTemp, 10 ) );
-				m_DataSaver.SaveXML( sModuleNameAndLeaks , MEM_LEAK_MODULE );
-			}
-		}
-		
-		if ( m_vHandleLeaks.size() > 0 )
-		{
-			// We have handle leaks
-			bool bHandLeaksFound = false;
-			int iTotalNrOfLeaks = 0;
-			// Print handle leaks
-			for( size_t i = 0 ; i < m_vHandleLeaks.size() ; i++ )
-			{
-				string sTempHandleLeak( m_vHandleLeaks[i] );
-				// Name.
-				string sHandleLeakModule( GetStringUntilNextSpace( sTempHandleLeak ) );
-				// Count.
-				string sNrOfLeaks( GetStringUntilNextSpace(sTempHandleLeak) );
-				unsigned long iNrOfLeaks = _httoi( sNrOfLeaks.c_str() );
-				iTotalNrOfLeaks += iNrOfLeaks;
-				if( iNrOfLeaks )
-				{
-					if( !bHandLeaksFound )
-					{
-						m_DataSaver.SaveXML( sNrOfLeaks , HANDLE_LEAKS );
-					}
-					bHandLeaksFound = true;
-					m_DataSaver.AddInteger( iNrOfLeaks );
-					// Just print out how many leaks found.
-					// Because its always unknown.
-					m_DataSaver.AddString( " handle leak(s) found." );
-					m_DataSaver.AddLineToLast();
-
-					// xml
-					string sXMLInfo( sHandleLeakModule );
-					sXMLInfo.append( ";" ); sXMLInfo.append( sNrOfLeaks );
-					m_DataSaver.SaveXML( sXMLInfo , HANDLE_LEAK_MODULE );
-				}
-			}
-			// Update number if handle leaks
-			m_DataSaver.SaveXML( itoa( iTotalNrOfLeaks, cTemp, 10 ) , HANDLE_LEAKS );
-			if( !bHandLeaksFound )
-			{
-				//m_DataSaver.AddLineToLast();
-				m_DataSaver.AddString( TEXT_NO_HANDLE_LEAKS );
-				m_DataSaver.AddLineToLast();
-			}
-		}
-		else
-		{
-			// No handle leaks
-			m_DataSaver.AddLineToLast();
-			m_DataSaver.AddString( TEXT_NO_HANDLE_LEAKS );
-			m_DataSaver.AddLineToLast();
-		}
-
-		// Process end to xml
-		m_DataSaver.SaveXML( sTime, RUN_END );
-		// Reset current process
-		m_iCurrentProcessId = 0;
-	}
-	
-	// If no dll load or process start found
-	if ( ! m_bProcessStartFound || !m_bDllLoadFound )
-	{
-		m_DataSaver.AddLineToLast();
-		m_DataSaver.AddString( AT_ANALYZE_INSUFFICIENT_LOGGING_DATA );
-		m_DataSaver.AddLineToLast();
-	}
-	
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ParseDllLoad
-// -----------------------------------------------------------------------------
-bool CATDatParser::ParseDllLoad( string& sLine )
-{
-	LOG_FUNC_ENTRY("CATDatParser::ParseDllLoad");
-	//DLL_LOAD <DLL name> <Time stamp> <Memory start address> <Memory end address>
-	m_bDllLoadFound = true;
-	DLL_LOAD_INFO structDllInfo;
-	structDllInfo.iStartAddress = 0;
-	structDllInfo.iEndAddress = 0;
-	structDllInfo.iLeaks = 0;
-
-	// Skip "DLL_LOAD "
-	GetStringUntilNextSpace( sLine );
-
-	// Get module name
-	structDllInfo.sModuleName = GetStringUntilNextSpace( sLine );
-	ChangeToLower( structDllInfo.sModuleName );
-
-	// Create module from this if project platform emulator
-	if ( _stricmp( "winscw", m_sProjectPlatform.c_str() ) == 0 )
-		CreateWinscwModule( structDllInfo.sModuleName );
-
-	if ( m_iDataVersion >= AT_DLL_TIMESTAMP_DATA_VERSION )
-	{
-		// Pickup module loading time.
-		string sLoadTime = GetStringUntilNextSpace( sLine );
-		unsigned long long ull;
-		if ( hexToDec( sLoadTime, ull ) )
-			structDllInfo.iLoadTime = ull;
-	}
-
-	// Get dll start memory string address from line
-	// Convert string address to real memory address
-	structDllInfo.iStartAddress = 
-		_httoi( GetStringUntilNextSpace( sLine ).c_str() );
-
-	// Get dll end memory string address from line
-	// Convert string address to real memory address
-	structDllInfo.iEndAddress = 
-		_httoi( 
-		GetStringUntilNextSpace( sLine ).c_str() );
-
-	// Is module already loaded, if not add it to list.
-	bool bFound = false;
-	for( vector<DLL_LOAD_INFO>::iterator it = m_vDllLoadModList.begin();
-		it != m_vDllLoadModList.end() ; it++ )
-	{
-		if( (*it).sModuleName.compare( structDllInfo.sModuleName ) == 0 )
-		{
-			bFound = true;
-			break;
-		}
-	}
-	if( ! bFound )
-		m_vDllLoadModList.push_back( structDllInfo );
-
-	// Sub test module list.
-	bFound = false;
-	for( vector<DLL_LOAD_INFO>::iterator it = m_vDllLoadModListSubTest.begin();
-		it != m_vDllLoadModListSubTest.end() ; it++ )
-	{
-		if( (*it).sModuleName.compare( structDllInfo.sModuleName ) == 0 )
-		{
-			bFound = true;
-			break;
-		}
-	}
-	if( ! bFound )
-		m_vDllLoadModListSubTest.push_back( structDllInfo );
-
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ParseDllUnload
-// -----------------------------------------------------------------------------
-bool CATDatParser::ParseDllUnload( string& sLine )
-{
-	LOG_FUNC_ENTRY("CATDatParser::ParseDllUnload");
-
-	// Ignore unloads on older version because no timestamps.
-	if ( m_iDataVersion < AT_DLL_TIMESTAMP_DATA_VERSION )
-	{
-		return true;
-	}
-
-	// Skip "DLL_UNLOAD "
-	GetStringUntilNextSpace( sLine );
-
-	// Get module name
-	string sModuleName = GetStringUntilNextSpace( sLine );
-	ChangeToLower( sModuleName );
-
-	// Unload time
-	unsigned long long ull;
-	string sUnload = GetStringUntilNextSpace( sLine );
-	if ( ! hexToDec( sUnload, ull ) )
-		return true;
-
-	// Set module unload time.
-	vector<DLL_LOAD_INFO>::iterator it;
-	for( it = m_vDllLoadModList.begin() ; it != m_vDllLoadModList.end() ; it++ )
-	{
-		if ( sModuleName.compare( it->sModuleName ) == 0 )
-		{
-			(*it).iUnloadTime = ull;
-			break;
-		}
-	}
-	for( it = m_vDllLoadModListSubTest.begin() ; it != m_vDllLoadModListSubTest.end() ; it++ )
-	{
-		if ( sModuleName.compare( it->sModuleName ) == 0 )
-		{
-			(*it).iUnloadTime = ull;
-			break;
-		}
-	}
-	return true;
-}
-// -----------------------------------------------------------------------------
-// CATDatParser::ParseLoggingCancelled
-// -----------------------------------------------------------------------------
-bool CATDatParser::ParseLoggingCancelled( string& sLine )
-{
-	LOG_FUNC_ENTRY("CATDatParser::ParseLoggingCancelled");
-	// Skip text "LOGGING_CANCELLED"
-	GetStringUntilNextSpace( sLine );
-
-	// Get time
-	string sTime( GetStringUntilNextSpace( sLine ) );
-	sTime = ConvertTimeToLocalTime( sTime );
-	m_DataSaver.AddString( "Logging Cancelled." );
-	m_DataSaver.AddLineToLast();
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ParseHandleLeak
-// -----------------------------------------------------------------------------
-bool CATDatParser::ParseHandleLeak( string& sLine )
-{
-	LOG_FUNC_ENTRY("CATDatParser::ParseHandleLeak");
-	// Skip text "HANDLE_LEAK"
-	GetStringUntilNextSpace( sLine );
-	m_vHandleLeaks.push_back( sLine );
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ParseTestStart
-// -----------------------------------------------------------------------------
-bool CATDatParser::ParseTestStart( string& sLine )
-{
-	LOG_FUNC_ENTRY("CATDatParser::ParseTestStart");
-	m_bSubtestOnGoing = true;
-	m_iLeakNumber = 0;
-	m_iPinPointedSubTestLeaks = 0;
-
-	// Reset subtest leaked modules list
-	for( size_t i = 0 ; i < m_vDllLoadModListSubTest.size() ; i++ )
-	{
-		m_vDllLoadModListSubTest.at(i).iLeaks = 0;
-	}
-
-	// Skip text "TEST_START"
-	GetStringUntilNextSpace( sLine );
-	// Time
-	string sTime( GetStringUntilNextSpace( sLine ) );
-	sTime = ConvertTimeToLocalTime( sTime );
-	// Name
-	string sSubTestName( GetStringUntilNextSpace( sLine ) );				
-	m_DataSaver.AddLineToLast();
-
-	// Get handle count in subtest start
-	string sSubTestStartHandleCount( GetStringUntilNextSpace( sLine ) );
-	m_iSubtestStartHandleCount = atoi( sSubTestStartHandleCount.c_str() );
-
-	// Add start to report
-	m_DataSaver.AddString( "\nSub test (" );
-	m_DataSaver.AddString( sSubTestName.c_str() );
-	m_DataSaver.AddString( ") start: " );
-	m_DataSaver.AddString( sTime.c_str() );
-
-	// m_DataSaver.AddLineToLast();
-
-	// Add start to xml
-	string sResult( sSubTestName );
-	sResult.append( ";" );
-	sResult.append( sTime );
-	sResult.append( ";" );
-	m_DataSaver.SaveXML( sResult, TEST_START );
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ParseTestEnd
-// -----------------------------------------------------------------------------
-bool CATDatParser::ParseTestEnd( string& sLine )
-{
-	LOG_FUNC_ENTRY("CATDatParser::ParseTestEnd");
-	// Skip text "TEST_END"
-	GetStringUntilNextSpace( sLine );
-
-	// Time
-	string sTime( GetStringUntilNextSpace( sLine ) );
-	sTime = ConvertTimeToLocalTime( sTime );
-
-	// Name
-	string sSubTestName( GetStringUntilNextSpace( sLine ) );
-	m_DataSaver.AddLineToLast();
-
-	// Add test end info to report
-	m_DataSaver.AddString( "Sub test (" );
-	m_DataSaver.AddString( sSubTestName.c_str() );
-	m_DataSaver.AddString( ") end: " );
-	m_DataSaver.AddString( sTime.c_str() );
-	m_DataSaver.AddLineToLast();
-
-	// Leak count to report in subtest
-	if( m_iLeakNumber > 0 )
-	{
-		if ( m_iLogLevel == 1 || m_iLogLevel == 2 )
-		{
-			m_DataSaver.AddInteger( m_iPinPointedSubTestLeaks );
-			m_DataSaver.AddString( " number of pinpointed memory leaks." );
-			m_DataSaver.AddLineToLast();
-			m_DataSaver.AddInteger( m_iLeakNumber );
-			m_DataSaver.AddString( " memory leaks found." );
-		}
-		else
-		{
-			m_DataSaver.AddInteger( m_iLeakNumber );
-			m_DataSaver.AddString( " memory leaks found." );
-		}
-	}
-	else
-	{
-		m_DataSaver.AddString( "No memory leaks found." );
-	}
-	m_DataSaver.AddLineToLast();
-
-	// Use sTime to store info to xml
-	sTime.append(";");
-	char cTemp[128];
-	// Print all modules whitch have leaks
-	for( unsigned int i = 0 ; i < m_vDllLoadModListSubTest.size() ; i++ )
-	{
-		if( m_vDllLoadModListSubTest.at(i).iLeaks > 0 )
-		{
-			// Normal report
-			m_DataSaver.AddInteger( m_vDllLoadModListSubTest[i].iLeaks );
-			m_DataSaver.AddString( " memory leaks in module: " );
-			m_DataSaver.AddString( m_vDllLoadModListSubTest.at(i).sModuleName.c_str() );
-			m_DataSaver.AddLineToLast();
-			// xml
-			string sModuleNameAndLeaks( m_vDllLoadModListSubTest.at(i).sModuleName );
-			sModuleNameAndLeaks.append(";");
-			sModuleNameAndLeaks.append( itoa( m_vDllLoadModListSubTest.at(i).iLeaks, cTemp, 10 ) );
-			m_DataSaver.SaveXML( sModuleNameAndLeaks , SUBTEST_MEM_LEAK_MODULE );
-		}
-	}
-	// Handle count
-	int iEndHandleCount = atoi( GetStringUntilNextSpace( sLine ).c_str() );
-	// Is there handle leaks in subtest?
-	if( iEndHandleCount > m_iSubtestStartHandleCount )
-	{
-		// Print normal report
-		m_DataSaver.AddInteger( iEndHandleCount - m_iSubtestStartHandleCount );
-		m_DataSaver.AddString( " handle leaks in subtest: " );
-		m_DataSaver.AddString( sSubTestName.c_str() );
-		m_DataSaver.AddString( "." );
-		m_DataSaver.AddLineToLast();
-
-		// Print handle leaks to XML
-		string sNrOfHandleLeaks( itoa( iEndHandleCount - m_iSubtestStartHandleCount, cTemp, 10 ) );
-		sNrOfHandleLeaks.append( ";" );
-		m_DataSaver.SaveXML( sNrOfHandleLeaks, SUBTEST_HANDLE_LEAKS );
-	}
-	else
-	{
-		// No handle leaks
-		m_DataSaver.AddString( TEXT_NO_HANDLE_LEAKS );
-		m_DataSaver.AddLineToLast();
-	}
-	// Save xml
-	m_DataSaver.SaveXML( sTime, TEST_END );
-	// Back to normal leaks
-	m_bSubtestOnGoing = false;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ParseErrorOccured
-// -----------------------------------------------------------------------------
-bool CATDatParser::ParseErrorOccured( string& sLine )
-{
-	LOG_FUNC_ENTRY("CATDatParser::ParseErrorOccured");
-	string sTime,sError;
-
-	// Skip text "ERROR_OCCURED:"
-	GetStringUntilNextSpace( sLine );
-
-	// Get error
-	sError = GetStringUntilNextSpace( sLine );
-	// Get and convert error time
-	sTime = GetStringUntilNextSpace( sLine );
-	sTime = ConvertTimeToLocalTime( sTime );
-
-	// Print error line
-	m_DataSaver.AddLineToLast();
-	m_DataSaver.AddString( "Error occured on: " );
-	m_DataSaver.AddString( sTime.c_str() );
-	m_DataSaver.AddString( ". " );
-	m_DataSaver.AddString( "Symbian error code: " );
-	m_DataSaver.AddString( sError.c_str() );
-	m_DataSaver.AddString( "." );
-	m_DataSaver.AddLineToLast();
-
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ParseMemLeak
-// -----------------------------------------------------------------------------
-bool CATDatParser::ParseMemLeak( string& sLine )
-{
-	LOG_FUNC_ENTRY("CATDatParser::ParseMemLeak");
-	// Increment leak count
-	if ( ! m_bSubtestOnGoing )
-		m_iTotalNumberOfLeaks++;
-
-	// Increase leak number
-	m_iLeakNumber++;
-
-	// Leak data variables
-	string sModuleName;
-	string sLeakSize;
-	string sTime;
-	unsigned long long iTime = 0;
-	string sLeakAddress;
-	
-	// Skip text "MEM_LEAK"
-	GetStringUntilNextSpace( sLine );
-	// Get leak address
-	sLeakAddress = GetStringUntilNextSpace( sLine );
-	// Get time
-	sTime = GetStringUntilNextSpace( sLine );
-	// Convert time to decimal
-	hexToDec( sTime, iTime );
-	// Get memory reserve size
-	sLeakSize = GetStringUntilNextSpace( sLine );
-	// Convert leak time
-	sTime = ConvertTimeToLocalTime( sTime );
-
-	// Loop thru call stack and put memory addresses in vector
-	CleanMemoryAddresses(); // Clean memory address vector
-	CATMemoryAddress* pMemAddr = 0;
-	vector<string> vStrings = ParseStringToVector( sLine, ' ' );
-	for( size_t i = 0; i < vStrings.size() ; i++ )
-	{
-		pMemAddr = new CATMemoryAddress( vStrings.at(i), m_iOffSet );
-		// Set address time
-		pMemAddr->SetTime( iTime );
-		// Set address module name
-		if ( pMemAddr->FindSetModuleName( &m_vDllLoadModList ) )
-		{
-			// Increment leaks in module once
-			if ( sModuleName.empty() )
-			{
-				if ( m_bSubtestOnGoing )
-					m_vDllLoadModListSubTest.at( pMemAddr->GetDllLoadInfoIndex() ).iLeaks++;
-				else
-					m_vDllLoadModList.at( pMemAddr->GetDllLoadInfoIndex() ).iLeaks++;
-				// Set leak's module where it was located.
-				sModuleName = pMemAddr->GetModuleName();
-			}
-		}
-		// Add it to vector
-		m_vMemoryAddress.push_back( pMemAddr );
-	}
-	// If logging level is 0 Skip printing / locating code lines for call stack items.
-	if ( m_iLogLevel == 0 )
-		return true;
-	if ( m_pModules && vStrings.size() > 0 )
-	{
-		// Have we successfully located code line for memory address
-		bool bSuccesfullAddressToLine = false;
-		for( size_t x = 0; x < m_vMemoryAddress.size(); x++ )
-		{
-			int iIndexInDll = m_vMemoryAddress.at( x )->GetDllLoadInfoIndex();
-			if ( iIndexInDll != -1 )
-			{
-				// Dll module name from data file
-				string sDllName = m_vDllLoadModList.at( iIndexInDll ).sModuleName;
-				// Find module from project. These are read from makefiles.
-				for ( size_t y = 0; y < m_pModules->size() ; y++ )
-				{
-					// Module name from project data (makefiles)
-					string sModuleName = m_pModules->at( y )->GetBinaryName();
-					// If we find module from project ones, use it to located code line for memory address
-					// Note! dll names can be pretty messy i.e. DLL_LOAD 10281fc6.dll{000a0000}[10281fc6] 81d57b88 81e60a90
-					if ( sDllName.find( sModuleName ) != string::npos )
-					{
-						m_pModules->at( y )->AddressToLine( m_vMemoryAddress.at( x ) );
-						if ( ! bSuccesfullAddressToLine )
-						{
-							int iPPState = m_vMemoryAddress.at( x )->GetAddressToLineState();
-							if ( iPPState == CATMemoryAddress::EXACT || iPPState == CATMemoryAddress::FUNCTION )
-							{
-								bSuccesfullAddressToLine = true;
-								if ( m_bSubtestOnGoing )
-									m_iPinPointedSubTestLeaks++;
-								else
-									m_iPinPointedLeaks++;
-							}
-						}
-					}
-				}
-			}
-		}
-		// If rom/rofs specified we use it to try get binary and function names
-		// for addresses currently out of process range.
-		if ( m_pRomSymbol )
-		{
-			for( size_t x = 0; x < m_vMemoryAddress.size(); x++ )
-			{
-				if ( m_vMemoryAddress.at(x)->GetAddressToLineState() == CATMemoryAddress::OUT_OF_PROCESS
-					|| m_vMemoryAddress.at(x)->GetAddressToLineState() == CATMemoryAddress::OUT_OF_RANGE )
-				{
-					m_pRomSymbol->AddressToLine( m_vMemoryAddress.at(x) );
-				}
-			}
-		}
-	}
-	// Print leak
-	PrintMemLeak( sTime, sLeakSize, sLeakAddress, sModuleName);
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::PrintMemLeak
-// -----------------------------------------------------------------------------
-void CATDatParser::PrintMemLeak(const string& sTime,
-							   const string& sLeakSize,
-							   const string& sLeakAddr,
-							   const string& sModuleName)
-{
-	LOG_FUNC_ENTRY("CATDatParser::PrintMemLeak");
-	// Print header data of leak
-	m_DataSaver.AddString("\nMemory leak ");
-	m_DataSaver.AddInteger( m_iLeakNumber, true);
-
-	// Leak size
-	m_DataSaver.AddString( " (" );
-	m_DataSaver.AddInteger( _httoi( sLeakSize.c_str() ), true );
-	m_DataSaver.AddString( " bytes) " );
-
-	// Leak address
-	m_DataSaver.AddString("(0x");
-	m_DataSaver.AddString( sLeakAddr.c_str(), true );
-	m_DataSaver.AddString( ") " );
-
-	// Time
-	m_DataSaver.AddString( sTime.c_str(), true );
-	m_DataSaver.AddString( " " );
-	
-	// Module name
-	m_DataSaver.AddString( sModuleName.c_str(), true );
-	m_DataSaver.SaveCarbideDataHeader();
-	
-	// Add header line
-	m_DataSaver.AddLineToLast();
-
-	// Print the call stack items
-	for( size_t i = 0 ; i < m_vMemoryAddress.size() ; i++ )
-	{
-		// On log levels 1 & 2 we only print located code lines.
-		#ifndef ADDR2LINE
-		if( 
-			( m_iLogLevel == 1 || m_iLogLevel == 2 )
-			&&
-			( m_vMemoryAddress.at(i)->GetAddressToLineState() != CATMemoryAddress::EXACT
-			&& m_vMemoryAddress.at(i)->GetAddressToLineState() != CATMemoryAddress::FUNCTION )
-			)
-		{
-			// Skips to next
-			continue;
-		}
-		#endif
-		#ifdef ADDR2LINE
-		if( ( m_iLogLevel == 1 || m_iLogLevel == 2 )
-			&& m_vMemoryAddress.at(i)->GetAddressToLineState() != CATMemoryAddress::EXACT )
-		{
-			// Skips to next
-			continue;
-		}
-		#endif
-		else if ( m_vMemoryAddress.at(i)->GetAddressToLineState() == CATMemoryAddress::OUT_OF_PROCESS )
-		{
-			// Is memory address out of modules range
-			string sTemp;
-			sTemp.append( m_vMemoryAddress.at(i)->GetAddressString() );
-			sTemp.append( " Address out of process memory.");
-			m_DataSaver.AddString( sTemp.c_str(), true );
-			m_DataSaver.AddLineToLast();
-			continue;
-		}
-		
-		// Print memory address
-		m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetAddressString().c_str(), true );
-
-		// Space (only for console output)
-		m_DataSaver.AddString( " " );
-
-		m_DataSaver.AddCarbideData( 
-			NumberToHexString( m_vMemoryAddress.at(i)->GetOffSetFromModuleStart() ) );
-
-		// Module name
-		m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetModuleName().c_str(), true );
-
-		// Print call stack memory address details depending on state of memory address
-		switch( m_vMemoryAddress.at(i)->GetAddressToLineState() )
-		{
-			// Address outside of known processes
-		case CATMemoryAddress::OUT_OF_PROCESS:
-			m_DataSaver.AddLineToLast();
-			break;
-			// Address located outside of known modules symbols
-		case CATMemoryAddress::OUT_OF_RANGE:
-			m_DataSaver.AddString( " " );
-			m_DataSaver.AddString( "???", true );
-			m_DataSaver.AddLineToLast();
-			break;
-		// Symbol state is currently used when using rom symbol file.
-		// From it we get module name & function name.
-		case CATMemoryAddress::SYMBOL:
-			m_DataSaver.AddString( " " );
-			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFunctionName().c_str(), true );
-			if ( ! m_vMemoryAddress.at( i )->GetFileName().empty() )
-			{
-				m_DataSaver.AddString( " (" );
-				m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFileName().c_str(), true );
-				m_DataSaver.AddString( ")" );
-			}
-			m_DataSaver.AddLineToLast();
-			break;
-		// Lst & Map implementation
-		#ifndef ADDR2LINE
-		case CATMemoryAddress::FUNCTION:
-		case CATMemoryAddress::EXACT:
-			m_DataSaver.AddString( " " );
-			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFunctionName().c_str(), true );
-			// Small difference displaying details depending on build urel/udeb
-			if ( m_eBuildType == CATProject::UREL )
-			{
-				// UREL
-				// Set build info to data saver
-				m_DataSaver.SetBuild( false );
-				// urel = functionname: linenumber (filename)
-				m_DataSaver.AddString( ": " );
-				if (  m_vMemoryAddress.at(i)->GetFunctionLineNumber() != -1 )
-					m_DataSaver.AddInteger( m_vMemoryAddress.at(i)->GetFunctionLineNumber(), true );
-				else if (  m_vMemoryAddress.at(i)->GetExactLineNumber() != -1 )
-					m_DataSaver.AddInteger( m_vMemoryAddress.at(i)->GetExactLineNumber(), true );
-				m_DataSaver.AddString( " (" );
-				m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFileName().c_str(), true );
-				m_DataSaver.AddString( ")" );
-				m_DataSaver.AddLineToLast();
-			}
-			else
-			{
-				// UDEB
-				// udeb = functionname: (filename:linenumber)
-				m_DataSaver.AddString( " (" );
-				m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFileName().c_str(), true );
-				m_DataSaver.AddString( ":" );
-				if(  m_vMemoryAddress.at(i)->GetExactLineNumber() != -1 )
-					m_DataSaver.AddInteger( m_vMemoryAddress.at(i)->GetExactLineNumber(), true );
-				else
-					m_DataSaver.AddString( "???", true );
-				m_DataSaver.AddString( ")" );
-				m_DataSaver.AddLineToLast();
-			}
-			break;
-		#endif
-		// addr2line implementation (new).
-		#ifdef ADDR2LINE
-		case CATMemoryAddress::FUNCTION:
-			m_DataSaver.AddString( " " );
-			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFunctionName().c_str(), true );
-			m_DataSaver.AddString( " (" );
-			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFileName().c_str(), true );
-			m_DataSaver.AddString( ":" );
-			if(  m_vMemoryAddress.at(i)->GetExactLineNumber() != -1 )
-				m_DataSaver.AddInteger( m_vMemoryAddress.at(i)->GetFunctionLineNumber(), true );
-			else
-				m_DataSaver.AddString( "???", true );
-			m_DataSaver.AddString( ")" );
-			m_DataSaver.AddLineToLast();
-			break;
-		case CATMemoryAddress::EXACT:
-			m_DataSaver.AddString( " " );
-			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFunctionName().c_str(), true );
-			m_DataSaver.AddString( " (" );
-			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFileName().c_str(), true );
-			m_DataSaver.AddString( ":" );
-			if(  m_vMemoryAddress.at(i)->GetExactLineNumber() != -1 )
-				m_DataSaver.AddInteger( m_vMemoryAddress.at(i)->GetExactLineNumber(), true );
-			else
-				m_DataSaver.AddString( "???", true );
-			m_DataSaver.AddString( ")" );
-			m_DataSaver.AddLineToLast();
-			break;
-		#endif
-		} // End switch
-		// On logging level 1 we only print one located code line
-		#ifndef ADDR2LINE
-		if ( m_iLogLevel == 1 && ( m_vMemoryAddress.at(i)->GetAddressToLineState() == CATMemoryAddress::EXACT ||
-			m_vMemoryAddress.at(i)->GetAddressToLineState() == CATMemoryAddress::FUNCTION ) )
-			break;
-		#endif
-		#ifdef ADDR2LINE
-		if ( m_iLogLevel == 1 && m_vMemoryAddress.at(i)->GetAddressToLineState() == CATMemoryAddress::EXACT )
-			break;
-		#endif
-	} // End call stack items loop
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::SetInputFile
-// -----------------------------------------------------------------------------
-void CATDatParser::SetInputFile(const string& sInputFile)
-{
-	LOG_FUNC_ENTRY("CATDatParser::SetInputFile");
-	m_sInputFile = sInputFile;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::SetOutputFile
-// -----------------------------------------------------------------------------
-void CATDatParser::SetOutputFile(const string& sOutpuFile)
-{
-	LOG_FUNC_ENTRY("CATDatParser::SetOutputFile");
-	m_sOutputFile = sOutpuFile;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::SetRomSymbolFiles
-// -----------------------------------------------------------------------------
-void CATDatParser::SetRomSymbolFiles(const vector<string>& vRomSymbolFiles)
-{
-	LOG_FUNC_ENTRY("CATDatParser::SetRomSymbolFiles");
-	m_vRomSymbolFiles = vRomSymbolFiles;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::SetLogLevel
-// -----------------------------------------------------------------------------
-void CATDatParser::SetLogLevel(int iLogLevel)
-{
-	LOG_FUNC_ENTRY("CATDatParser::SetLogLevel");
-	m_iLogLevel = iLogLevel;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::GetLogLevel
-// -----------------------------------------------------------------------------
-int CATDatParser::GetLogLevel() const
-{
-	LOG_LOW_FUNC_ENTRY("CATDatParser::GetLogLevel");
-	return m_iLogLevel;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::CleanMemoryAddresses
-// -----------------------------------------------------------------------------
-void CATDatParser::CleanMemoryAddresses()
-{
-	LOG_LOW_FUNC_ENTRY("CATDatParser::CleanMemoryAddresses");
-	// Cleanup memory addressses.
-	for( vector<CATMemoryAddress*>::iterator it = m_vMemoryAddress.begin(); it != m_vMemoryAddress.end(); it++ )
-	{
-		delete *it;
-	}
-	m_vMemoryAddress.clear();
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::ConvertTimeToLocalTime
-// -----------------------------------------------------------------------------
-string CATDatParser::ConvertTimeToLocalTime( string sInputTime )
-{
-	LOG_LOW_FUNC_ENTRY("CATDatParser::ConvertTimeToLocalTime");
-	//Is process end abnormal?
-	if( sInputTime.compare( LABEL_ABNORMAL ) == 0 )
-	{
-		return string( AT_ANALYZE_ABNORMAL_EXIT );
-	}
-	else
-	// Check that input time is at least 32-bit
-	if( sInputTime.length() <= 8 )
-	{
-		sInputTime.clear();
-		return sInputTime;
-	}
-
-	string sTemp = sInputTime;
-	const char* pTemp = sTemp.c_str();
-
-	// Are all characters hex
-	for( unsigned int i = 0 ; i < sTemp.size() ; i++ )
-	{
-		if( !IsHexCharacter( (pTemp + i) ) )
-		{
-			return sInputTime;
-		}
-	}
-	
-	// Get LSB bits
-	string sLsb;
-	sLsb.append( sInputTime.substr( sInputTime.length()-8, sInputTime.length() ) );
-	unsigned int iLsbTime = (unsigned int)_httoi( sLsb.c_str() );
-
-	// Get MSB bits
-    string sMsb;
-	sMsb.append( sInputTime.substr( 0, sInputTime.length()-8 ) );
-	unsigned int iMsbTime = (unsigned int)_httoi( sMsb.c_str() );
-
-	// Get time in microsecods
-	long long sdf = iMsbTime * 0x100000000 + iLsbTime;
-
-	// Get original time (starting at year 1970 )
-	long long llOrigTime = sdf;
-
-	// Get seconds
-	sdf = ( sdf )/1000000;
-		
-	// Check that sdf contains some time value
-	if( sdf <= 0)
-	{
-		// Error in time calculation
-		// Return empty string
-		sInputTime.clear();
-		return sInputTime;
-	}
-
-	// Original time after year 1970 in seconds
-	long long llOrignTimeInSeconds = sdf;
-	
-	// Calculate new time which does not include millisecods
-	long long llDiffTime = (llOrignTimeInSeconds * 1000000);
-
-	// Calculate time difference in milliseconds
-	int llDiffTimeInMilliSecods = (int)( llOrigTime - llDiffTime )/1000;
-	
-	// Convert difference time to char
-	char cDiffInMilliSeconds[20];
-    _itoa( llDiffTimeInMilliSecods, cDiffInMilliSeconds, 10 );
-
-	// Time info structure
-	struct tm *timeinfo;
-
-	// Get local time
-	timeinfo = localtime ( (time_t*) &sdf );
-
-	// Create string and append memory leak time to it
-	string sTime;
-	sTime.append( asctime( timeinfo ) );
-
-	// Remove last char of locale time string which is \n
-	sTime.resize( (int)sTime.length()-1 );
-	
-	// Get last space index
-	int iLastSpace = (int)sTime.find_last_of(" ");
-
-	// If last space index is valid
-	if( iLastSpace <= (int)sTime.length() && iLastSpace > 0)
-	{
-		string sTempTime;
-		// Append first part of original time string
-		sTempTime.append( sTime.substr( 0, iLastSpace ) );
-		
-		// Append millisecods
-		sTempTime.append( "." );
-		sTempTime.append( cDiffInMilliSeconds );
-
-		// Append the rest of the original time string part
-		sTempTime.append( sTime.substr( iLastSpace, sTime.length()));
-
-		// Clear original and append new time string which includes millisecods
-		sTime.clear();
-		sTime.append( sTempTime );
-	}
-
-	// Return memory leak time
-	return sTime.c_str();
-}
-
-bool CATDatParser::CreateWinscwModule( const string& sBinaryName )
-{
-	LOG_FUNC_ENTRY( "CATDatParser::CreateWinscwModule" );
-	// Is module already created?
-	for( vector<CATModule2*>::iterator it = m_pModules->begin(); it != m_pModules->end(); it++ )
-	{
-		if ( _stricmp( sBinaryName.c_str(), (*it)->GetBinaryName().c_str() ) == 0 )
-			return true;
-	}
-	// No create new one and set its values.
-	CATModule2* mod = new CATModule2();
-	mod->SetTarget( RemovePathAndExt( sBinaryName, true ) );
-	mod->SetRequestedTargetExt( GetExtension( sBinaryName ) );
-	mod->SetReleasePath( string( "\\epoc32\\release" ) );
-	if ( m_eBuildType == CATProject::UDEB )
-		mod->SetFullVariantPath( string( "winscw\\udeb" ) );
-	else
-		mod->SetFullVariantPath( string( "winscw\\urel" ) );
-	mod->SetVariantPlatform( string( "winscw" ) );
-	m_pModules->push_back( mod );
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::FindModuleUsingAddress
-// Function finds module using given address.
-// -----------------------------------------------------------------------------
-int CATDatParser::FindModuleUsingAddress( unsigned long iAddress ) const
-{
-	LOG_LOW_FUNC_ENTRY("CATDatParser::FindModuleUsingAddress");
-	int iRet = -1;
-	for( unsigned int i = 0 ; i < m_vDllLoadModList.size() ; i++ )
-	{
-		// Is address between start and end address?
-		if( iAddress > m_vDllLoadModList[i].iStartAddress && iAddress < m_vDllLoadModList[i].iEndAddress )
-		{
-			iRet = i;
-			break;
-		}	
-	}
-	return iRet;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::FindModuleUsingPID
-// Function finds module using module id.
-// -----------------------------------------------------------------------------
-/*
-int CATDatParser::FindModuleUsingPID( unsigned long iPID ) const
-{
-	LOG_FUNC_ENTRY("CATDatParser::FindModuleUsingPID");
-
-	int iRet = -1;
-
-	// Change module name characters to lowercase
-	for( unsigned int i = 0 ; i < m_vDllLoadModList.size() ; i++ )
-	{
-		if( m_vDllLoadModList[i].iPID == iPID )
-		{
-			iRet = i;
-			break;
-		}	
-	}
-	return iRet;
-}
-*/
-// -----------------------------------------------------------------------------
-// CATDatParser::FindModuleUsingName
-// Function finds module using module name.
-// -----------------------------------------------------------------------------
-int CATDatParser::FindModuleUsingName( const char* pModName )
-{
-	LOG_LOW_FUNC_ENTRY("CATDatParser::FindModuleUsingName");
-
-	// Mod name empty?
-	if( pModName == NULL || *pModName == 0 )
-		return -1;
-
-	int iRet = -1;
-	string sModName( pModName );
-	// Change module name characters to lowercase
-	ChangeToLower( sModName );
-	// Remove variant marks (dots)
-	RemoveAllAfterDotIfTwoDots( sModName);
-	for( unsigned int i = 0 ; i < m_vDllLoadModList.size() ; i++ )
-	{
-		string sTemp( m_vDllLoadModList[i].sModuleName );
-		ChangeToLower( sTemp );
-		// Remove variant marks (dots)
-		RemoveAllAfterDotIfTwoDots( sTemp );
-		if( sTemp.find( sModName ) != string::npos )
-		{
-			iRet = i;
-			break;
-		}	
-	}
-	return iRet;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::SetPrintFlag
-// -----------------------------------------------------------------------------
-void CATDatParser::SetPringFlag( bool bPrintFlag )
-{
-	LOG_FUNC_ENTRY("CATDatParser::SetPringFlag");
-	m_DataSaver.SetPrintFlag( bPrintFlag );
-}
-// -----------------------------------------------------------------------------
-// CATDatParser::SetOffSet
-// -----------------------------------------------------------------------------
-void CATDatParser::SetOffSet( int iOffSet )
-{
-	LOG_FUNC_ENTRY("CATDatParser::SetOffSet");
-	m_iOffSet = iOffSet;
-}
-
-// -----------------------------------------------------------------------------
-// CATDatParser::GetOffSet
-// -----------------------------------------------------------------------------
-int CATDatParser::GetOffSet( ) const
-{
-	LOG_LOW_FUNC_ENTRY("CATDatParser::GetOffSet");
-	return m_iOffSet;
-}
-
-// -----------------------------------------------------------------------------
-// Set project platform.
-// -----------------------------------------------------------------------------
-void CATDatParser::SetProjectPlatform( const string& sPlatform )
-{
-	LOG_FUNC_ENTRY("CATDatParser::SetProjectPlatform");
-	m_sProjectPlatform = sPlatform;
-
-	// Check that platform not empty before determing platform from it.
-	if ( sPlatform.empty() )
-		return;
-
-	// Set functions offset in mapfiles correct (depending on platform).
-	if ( _stricmp( sPlatform.c_str(), "armv5" ) == 0 )
-	{
-		m_iOffSet = FUNCTIONS_OFFSET_IN_MAP_FILE_ARMV5;
-	}
-	else if ( _stricmp( sPlatform.c_str(), "winscw" ) == 0 )
-	{
-		m_iOffSet = FUNCTIONS_OFFSET_IN_MAP_FILE_WINSCW;
-	}
-	else if ( _stricmp( sPlatform.c_str(), "gcce" ) == 0 )
-	{
-		m_iOffSet = FUNCTIONS_OFFSET_IN_GCCE;
-	}
-	else
-	{
-		LOG_STRING( AT_MSG << "Error, cannot set function's offset in map file, invalid platform: " << sPlatform );
-	}
-}
-
-// -----------------------------------------------------------------------------
-// Set projects build type. Use enumeration defined in CATProject.
-// -----------------------------------------------------------------------------
-void CATDatParser::SetProjectBuildType( int eBuildType )
-{
-	LOG_FUNC_ENTRY("CATDatParser::SetProjectBuildType");
-	m_eProjectBuildType = eBuildType;
-}
-
-//EOF
--- a/analyzetool/commandlineengine/src/CATDataSaver.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,873 +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:  Definitions for the class CATDataSaver.
-*
-*/
-
-
-#include "../inc/catdatasaver.h"
-
-#include <xercesc/util/OutOfMemoryException.hpp>
-
-#if defined(XERCES_NEW_IOSTREAMS)
-#include <iostream>
-#else
-#include <iostream.h>
-#endif
-
-// Line feed char sequence used in XML report
-wchar_t AT_XML_LINEFEEDS[3] = L"\r\n";
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::CATDataSaver
-// Constructor.
-// -----------------------------------------------------------------------------
-CATDataSaver::CATDataSaver( void )
-{
-	LOG_FUNC_ENTRY("CATDataSaver::CATDataSaver");
-	m_iLoggingLevel = DEFAULT_LOGGING_LEVEL;
-	m_bPrintImmediately = true;
-	m_bXMLInitOk = false;
-	m_bUdebBuild = true;
-
-	m_iRunNumber = 1;
-
-	m_pDomDoc = NULL;
-	m_pRootElem = NULL;
-	m_Serializer = NULL;
-	m_pCurrentLeakElem = NULL;
-	m_pRunElement = NULL;
-	m_pMemoryLeaks = NULL;
-	m_pHandleLeaks = NULL;
-	m_pCurrentSubTestElem = NULL;
-	m_pSubtestMemoryLeaks = NULL;
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::~CATDataSaver
-// Destructor.
-// -----------------------------------------------------------------------------
-CATDataSaver::~CATDataSaver(void)
-{
-	LOG_FUNC_ENTRY("CATDataSaver::~CATDataSaver");
-	if( m_bXMLInitOk )
-	{
-		if( m_Serializer )
-			delete m_Serializer;
-
-		m_pDomDoc->release();
-		xercesc::XMLPlatformUtils::Terminate();
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::SaveLinesToFile
-// Gets logging level.
-// -----------------------------------------------------------------------------
-void CATDataSaver::SaveLinesToFile( const char* pFileName, int iDataToSave )
-{
-	LOG_FUNC_ENTRY("CATDataSaver::SaveLinesToFile");
-
-	// Nothing to print?
-	if( m_vLines.empty() )
-	{
-		printf( "No output data." );
-		return;
-	}
-	if( iDataToSave != XML_DATA )
-	{
-		ofstream out( pFileName );
-
-		if( !out.good() )
-		{
-			printf( "Can not open file: %s\n", pFileName );
-			return;
-		}
-		switch( iDataToSave )
-		{
-			case TEXT_DATA:
-				for( int i = 0 ; i < (int)m_vLines.size() ; i++ )
-				{
-					out << m_vLines[i].c_str();
-				}
-			break;
-		}
-		out.close();
-	}
-	else
-	{
-		if( m_bXMLInitOk )
-		{
-			xercesc::XMLFormatTarget* myFormTarget = NULL;
-			try
-			{
-				// Create format
-				myFormTarget = new xercesc::LocalFileFormatTarget( pFileName );
-				
-				// Set line-feeds to dom writer
-				m_Serializer->setNewLine( AT_XML_LINEFEEDS );
-				
-				// Set human-readable property. Note! Api already changed in >2.7
-				// so this will cause error/problems if linked to newer library.
-				m_Serializer->setFeature( xercesc::XMLUni::fgDOMWRTFormatPrettyPrint, true );
-				
-				// Write document
-				m_Serializer->writeNode(myFormTarget, *m_pDomDoc);
-			}
-			catch(...)
-			{
-				printf( "Can not save output file: %s.", pFileName );
-			}
-			if( myFormTarget )
-				delete myFormTarget; //lint !e118
-		}
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::PrintLinesToScreen
-// Prints all saved lines to screen.
-// -----------------------------------------------------------------------------
-void CATDataSaver::PrintLinesToScreen( void )
-{
-	LOG_FUNC_ENTRY("CATDataSaver::PrintLinesToScreen");
-	// Nothing to print?
-	if( m_vLines.empty() )
-	{
-		printf( "No output data." );
-		return;
-	}
-	for( int i = 0 ; i < (int)m_vLines.size() ; i++ )
-	{
-		printf( m_vLines[i].c_str() );	
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::AddLineToFirst
-// Adds saved line to first in database.
-// -----------------------------------------------------------------------------
-void CATDataSaver::AddLineToFirst( void )
-{
-	LOG_LOW_FUNC_ENTRY("CATDataSaver::AddLineToFirst");
-	m_sLine.append( "\n" );
-	m_vLines.insert( m_vLines.begin(), m_sLine );
-	m_sLine.clear();
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::AddLineToLast
-// Adds saved line to last in database.
-// -----------------------------------------------------------------------------
-void CATDataSaver::AddLineToLast()
-{
-	LOG_LOW_FUNC_ENTRY("CATDataSaver::AddLineToLast");
-	m_sLine.append( "\n" );
-	
-	string sTempDataLine;
-
-	m_vLines.push_back( m_sLine );
-
-	SaveXML( m_sCarbideDataLine, ITEM );
-
-	if( m_bPrintImmediately )
-	{
-		printf( m_sLine.c_str() );
-	}
-
-	m_sCarbideDataLine.clear();
-	m_sLine.clear();
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::AddString
-// Adds string to current line.
-// -----------------------------------------------------------------------------
-void CATDataSaver::AddString( const char* pData, bool bSaveCarbideData )
-{
-	LOG_LOW_FUNC_ENTRY("CATDataSaver::AddString");
-	m_sLine.append( pData );
-
-	if( bSaveCarbideData )
-	{
-		m_sCarbideDataLine.append( pData );
-		m_sCarbideDataLine.append(";");
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::AddInteger
-// Converts integer to string and adds it to current line.
-// -----------------------------------------------------------------------------
-void CATDataSaver::AddInteger( int iValue, bool bSaveCarbideData )
-{
-	LOG_LOW_FUNC_ENTRY("CATDataSaver::AddInteger");
-	char cTemp[128];
-	string sValue( itoa( iValue, cTemp, 10 ) );
-	m_sLine.append( sValue );
-
-	if( bSaveCarbideData )
-	{
-		m_sCarbideDataLine.append( sValue );
-		m_sCarbideDataLine.append(";");
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::SetLoggingLevel
-// Sets logging level.
-// -----------------------------------------------------------------------------
-void CATDataSaver::SetLoggingLevel( int iLoggingLevel )
-{
-	LOG_FUNC_ENTRY("CATDataSaver::SetLoggingLevel");
-	// Check that new logging level is valid 
-	// Acceptable values are between MIN_LOGGING_LEVEL and 
-    // MAX_LOGGING_LEVEL including them
-	if( iLoggingLevel >= MIN_LOGGING_LEVEL && iLoggingLevel <= MAX_LOGGING_LEVEL )
-	{
-		m_iLoggingLevel = iLoggingLevel;
-	}
-	else
-	{
-		// New logging level value is invalid => set default logging level
-		m_iLoggingLevel = DEFAULT_LOGGING_LEVEL;
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::GetLoggingLevel
-// Gets logging level.
-// -----------------------------------------------------------------------------
-int CATDataSaver::GetLoggingLevel( void )
-{
-	LOG_LOW_FUNC_ENTRY("CATDataSaver::GetLoggingLevel");
-	return m_iLoggingLevel;
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::SetPrintFlag
-// Sets print immediately flag.
-// -----------------------------------------------------------------------------
-void CATDataSaver::SetPrintFlag( bool bPrintImmediately )
-{
-	LOG_FUNC_ENTRY("CATDataSaver::SetPrintFlag");
-	m_bPrintImmediately = bPrintImmediately;
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::SaveCarbideDataHeader
-// Sets data header for Carbide data.
-// -----------------------------------------------------------------------------
-void CATDataSaver::SaveCarbideDataHeader( void )
-{
-	LOG_FUNC_ENTRY("CATDataSaver::SaveCarbideDataHeader");
-	SaveXML( m_sCarbideDataLine, LEAK );
-	m_sCarbideDataLine.clear();
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::InitXML
-// Initializes xerces xml parser.
-// -----------------------------------------------------------------------------
-bool CATDataSaver::InitXML( void )
-{
-	LOG_FUNC_ENTRY("CATDataSaver::InitXML");
-	try 
-	{
-		xercesc::XMLPlatformUtils::Initialize();
-	}
-	catch ( ... )//(const XMLException& toCatch) 
-	{
-		// Do your failure processing here
-		printf("XML initialization failed.\n");
-		return false;
-	}
-	// Error code.
-	int errorCode = 0;
-	// getDomIMplementation returns null if source has none.
-	xercesc::DOMImplementation* impl = xercesc::DOMImplementationRegistry::getDOMImplementation(L"Core");
-	if (impl != NULL)
-    {
-		// Create new DOMWriter.
-		m_Serializer = ((xercesc::DOMImplementationLS*)impl)->createDOMWriter();
-		// New document.
-        try
-        {
-			m_pDomDoc = impl->createDocument(
-                        0,                    // Root element namespace URI.
-                        L"results",         // Root element name
-                        0);                   // Document type object (DTD).
-
-            m_pRootElem = m_pDomDoc->getDocumentElement();
-        }
-        catch (const xercesc::OutOfMemoryException&)
-        {
-            XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl;
-            errorCode = 5;
-        }
-        catch (const xercesc::DOMException& e)
-        {
-            XERCES_STD_QUALIFIER cerr << "DOMException code is:  " << e.code << XERCES_STD_QUALIFIER endl;
-            errorCode = 2;
-        }
-        catch (...)
-        {
-            XERCES_STD_QUALIFIER cerr << "An error occurred creating the document" << XERCES_STD_QUALIFIER endl;
-            errorCode = 3;
-        }
-    }  // (inpl != NULL)
-    else
-    {
-        XERCES_STD_QUALIFIER cerr << "Requested implementation is not supported" << XERCES_STD_QUALIFIER endl;
-        errorCode = 4;
-    }
-	if( !errorCode )
-	{
-		m_bXMLInitOk = true;
-		return true;
-	}
-	else
-	{
-		return false;
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::WCharToChar
-// Converts wchar_t* -> char*.
-// -----------------------------------------------------------------------------
-void CATDataSaver::WCharToChar( string& sInput, const WCHAR* Source )
-{
-	LOG_LOW_FUNC_ENTRY("CATDataSaver::WCharToChar");
-	if( !Source )
-		return;
-    int i = 0;
-
-    while( Source[i] != '\0' )
-    {
-		char c = (CHAR)Source[i];
-		sInput.append( &c, 1 );
-        ++i;
-    }
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::CharToWChar
-// Converts char* -> wchar_t*.
-// -----------------------------------------------------------------------------
-LPWSTR CATDataSaver::CharToWChar( const char* str )
-{
-	LOG_LOW_FUNC_ENTRY("CATDataSaver::CharToWChar");
-    LPWSTR out = NULL;
-    if( str != NULL )
-    {
-        int in_len = (int)strlen( str );
-        int out_len = MultiByteToWideChar(CP_ACP, 0, str, in_len, NULL, 0) + 2;
-        out = new WCHAR[out_len];
-
-        if (out)
-        {
-            memset(out, 0x00, sizeof(WCHAR)*out_len);
-            MultiByteToWideChar(CP_ACP, 0, str, in_len, out, in_len);
-        }
-    }
-    return out;
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::SaveXML
-// Writes data to xml tree.
-// -----------------------------------------------------------------------------
-void CATDataSaver::SaveXML( string sInput, int iElementType )
-{
-	LOG_FUNC_ENTRY("CATDataSaver::SaveXML");
-	// Variables ok?
-	if( sInput.empty() || m_pDomDoc == NULL )
-	{
-		return;
-	}
-	try
-	{
-		switch( iElementType )
-		{
-			case RESULT:
-			{
-				// Print number of runs
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-				m_pRootElem->setAttribute( L"runs", (const LPWSTR)wTemp );
-
-				// Print failed runs
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( sTemp.c_str() );
-				m_pRootElem->setAttribute( L"failed", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-			}
-			break;
-			case RUN:
-			{
-				if( m_pRootElem == NULL )
-					return;
-				xercesc::DOMElement* runElem = m_pDomDoc->createElement( L"run" );
-				m_pRootElem->appendChild( runElem );
-
-				// Reset handle leaks.
-				m_pHandleLeaks = NULL;
-
-				// Print start time
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-				runElem->setAttribute( L"start_time", (const LPWSTR)wTemp );
-				runElem->setAttribute( L"end_time", NULL );
-				if( wTemp )
-					delete[] wTemp;
-
-				// Print build target
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				wTemp = CharToWChar( sTemp.c_str() );
-				runElem->setAttribute( L"build_target", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-
-				// Print process name
-				wTemp = CharToWChar( sInput.c_str() );
-				runElem->setAttribute( L"process_name", (const LPWSTR)wTemp );
-
-				m_pRunElement = runElem;
-
-				char cTemp[128];
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( itoa( m_iRunNumber, cTemp, 10 ) );
-				runElem->setAttribute( L"id", (const LPWSTR)wTemp );
-				m_iRunNumber++;
-				if( wTemp )
-					delete[] wTemp;
-			}
-			break;
-			case LEAK:
-			{
-				m_pCurrentLeakElem = m_pDomDoc->createElement( L"leak" );
-
-
-				if( m_pCurrentLeakElem == NULL || m_pRunElement == NULL )
-					return;
-
-				// Sub test?
-				if( m_pCurrentSubTestElem )
-					m_pCurrentSubTestElem->appendChild( m_pCurrentLeakElem );
-				else
-					m_pRunElement->appendChild( m_pCurrentLeakElem );
-
-				// Print leak ID
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-				m_pCurrentLeakElem->setAttribute( L"id", (const LPWSTR)wTemp );
-
-				// Print leak size
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( sTemp.c_str() );
-				m_pCurrentLeakElem->setAttribute( L"size", (const LPWSTR)wTemp );
-
-				// Print leak address
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( sTemp.c_str() );
-				m_pCurrentLeakElem->setAttribute( L"memaddress", (const LPWSTR)wTemp );
-
-				// Print leak time
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( sTemp.c_str() );
-				m_pCurrentLeakElem->setAttribute( L"time", (const LPWSTR)wTemp );
-
-				// Print leak module
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( sTemp.c_str() );
-				m_pCurrentLeakElem->setAttribute( L"module", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-			}
-			break;
-			case ITEM:
-			{
-				xercesc::DOMNode* callstackNode = NULL;
-
-				xercesc::DOMElement* callstackElem = NULL;
-
-				if( m_pCurrentLeakElem  == NULL )
-					return;
-
-				// Print module name
-				if( !m_pCurrentLeakElem->hasChildNodes() )
-				{
-					callstackElem = m_pDomDoc->createElement( L"callstack" );
-					m_pCurrentLeakElem->appendChild( callstackElem );
-					callstackNode = callstackElem;
-				}
-				else
-				{
-					callstackNode = m_pCurrentLeakElem->getFirstChild();
-				}
-
-				// Add callstack item
-				xercesc::DOMElement* itemElem = m_pDomDoc->createElement( L"item" );
-				callstackNode->appendChild( itemElem );
-
-				// Print memory address name
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-
-				itemElem->setAttribute( L"memaddress", (const LPWSTR)wTemp );
-
-				// Print calculated memory address
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( sTemp.c_str() );
-
-				itemElem->setAttribute( L"calc_addr", (const LPWSTR)wTemp );
-
-				// Print module name
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( sTemp.c_str() );
-
-				itemElem->setAttribute( L"module", (const LPWSTR)wTemp );
-
-				// Print function name
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( sTemp.c_str() );
-
-				itemElem->setAttribute( L"function", (const LPWSTR)wTemp );
-
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-
-				// Print function line from urel build
-				if( !m_bUdebBuild )
-				{
-					if( wTemp )
-						delete[] wTemp;
-					wTemp = CharToWChar( sTemp.c_str() );
-					itemElem->setAttribute( L"function_line", (const LPWSTR)wTemp );
-					sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				}
-
-				// Print file name
-				if( wTemp )
-					delete[] wTemp;
-				// Erase if path found from sTemp.
-				if ( sTemp.rfind( "/" ) != string::npos )
-				{
-					sTemp.erase(0, sTemp.rfind( "/" )+1 );
-				}
-				if ( sTemp.rfind( "\\" ) != string::npos )
-				{
-					sTemp.erase(0, sTemp.rfind( "\\" )+1 );
-				}
-				wTemp = CharToWChar( sTemp.c_str() );
-
-				itemElem->setAttribute( L"file", (const LPWSTR)wTemp );
-
-				// Print line of file
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( sTemp.c_str() );
-
-				if( m_bUdebBuild )
-					itemElem->setAttribute( L"line", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-			}
-			break;
-			case RUN_END:
-			{
-				if( m_pRunElement == NULL )
-					return;
-				const LPWSTR wTemp = CharToWChar( sInput.c_str() );
-				m_pRunElement->setAttribute( L"end_time", wTemp );
-				if( wTemp )
-					delete[] wTemp;
-			}
-			break;
-			case ERROR_IN_RUN:
-			{
-				if( m_pRunElement == NULL )
-					return;
-				// Add error item
-				xercesc::DOMElement* errorElem = m_pDomDoc->createElement( L"error" );
-				m_pRunElement->appendChild( errorElem );
-
-				// Print error code
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-				errorElem->setAttribute( L"code", (const LPWSTR)wTemp );
-
-				// Print error time
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				if( wTemp )
-					delete[] wTemp;
-				wTemp = CharToWChar( sTemp.c_str() );
-				errorElem->setAttribute( L"time", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-			}
-			break;
-			case MEM_LEAKS:
-			{
-				if( m_pRunElement == NULL )
-					return;
-				xercesc::DOMElement* memoryLeaksElement = m_pDomDoc->createElement( L"mem_leaks" );
-				m_pRunElement->appendChild( memoryLeaksElement );
-				m_pMemoryLeaks = memoryLeaksElement;
-
-				// Print number of leaks
-				LPWSTR wTemp = CharToWChar( sInput.c_str() );
-				memoryLeaksElement->setAttribute( L"count", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-			}
-			break;
-			case MEM_LEAK_MODULE:
-			{
-				if( m_pMemoryLeaks == NULL )
-					return;
-				xercesc::DOMElement* moduleElement = m_pDomDoc->createElement( L"module" );
-				m_pMemoryLeaks->appendChild( moduleElement );
-
-				// Print module name
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-				moduleElement->setAttribute( L"name", (const LPWSTR)wTemp );
-
-				if( wTemp )
-					delete[] wTemp;
-				// Print number of memory leaks
-				wTemp = CharToWChar( sInput.c_str() );
-				moduleElement->setAttribute( L"leaks", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-			}
-			break;
-			case HANDLE_LEAKS:
-			{
-				if( m_pRunElement == NULL )
-					return;
-				if( m_pHandleLeaks )
-				{
-					// Update number of leaks
-					LPWSTR wTemp = CharToWChar( sInput.c_str() );
-					m_pHandleLeaks->setAttribute( L"count", (const LPWSTR)wTemp );
-					if( wTemp )
-						delete[] wTemp;
-				}
-				else
-				{
-					xercesc::DOMElement* handleLeaksElement = m_pDomDoc->createElement( L"handle_leaks" );
-					m_pRunElement->appendChild( handleLeaksElement );
-					m_pHandleLeaks = handleLeaksElement;
-
-					// Print number of leaks
-					LPWSTR wTemp = CharToWChar( sInput.c_str() );
-					handleLeaksElement->setAttribute( L"count", (const LPWSTR)wTemp );
-					if( wTemp )
-						delete[] wTemp;
-				}
-			}
-			break;
-			case HANDLE_LEAK_MODULE:
-			{
-				if( m_pHandleLeaks == NULL )
-					return;
-				xercesc::DOMElement* moduleElement = m_pDomDoc->createElement( L"module" );
-				m_pHandleLeaks->appendChild( moduleElement );
-
-				// Print module name
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-				moduleElement->setAttribute( L"name", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-
-				// Print number of memory leaks
-				wTemp = CharToWChar( sInput.c_str() );
-				moduleElement->setAttribute( L"leaks", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-			}
-			break;
-			case TEST_START:
-			{
-				m_pCurrentSubTestElem = m_pDomDoc->createElement( L"subtest" );
-
-				if( m_pCurrentSubTestElem == NULL || m_pRunElement == NULL )
-					return;
-
-				m_pRunElement->appendChild( m_pCurrentSubTestElem );
-
-				// Print sub test name
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-				m_pCurrentSubTestElem->setAttribute( L"name", (const LPWSTR)wTemp );
-				if( wTemp )
-				{
-					delete[] wTemp;
-					wTemp = NULL;
-				}
-
-				// Print sub test time
-				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				wTemp = CharToWChar( sTemp.c_str() );
-				m_pCurrentSubTestElem->setAttribute( L"start_time", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-				break;
-			}
-			case TEST_END:
-			{
-				if( m_pCurrentSubTestElem == NULL )
-					return;
-				// Print end time
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-				m_pCurrentSubTestElem->setAttribute( L"end_time", (const LPWSTR)wTemp );
-				m_pCurrentSubTestElem = NULL;
-				if( wTemp )
-					delete[] wTemp;
-				break;
-			}
-			case SUBTEST_MEM_LEAKS:
-			{
-				if( m_pCurrentSubTestElem == NULL )
-					return;
-				xercesc::DOMElement* memoryLeaksElement = m_pDomDoc->createElement( L"mem_leaks" );
-				m_pCurrentSubTestElem->appendChild( memoryLeaksElement );
-				m_pSubtestMemoryLeaks = memoryLeaksElement;
-
-				// Print number of leaks
-				LPWSTR wTemp = CharToWChar( sInput.c_str() );
-				memoryLeaksElement->setAttribute( L"count", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-				break;
-			}
-			case SUBTEST_MEM_LEAK_MODULE:
-			{
-				if( m_pSubtestMemoryLeaks == NULL )
-					return;
-				xercesc::DOMElement* moduleElement = m_pDomDoc->createElement( L"module" );
-				m_pSubtestMemoryLeaks->appendChild( moduleElement );
-
-				// Print module name
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-				moduleElement->setAttribute( L"name", (const LPWSTR)wTemp );
-
-				if( wTemp )
-					delete[] wTemp;
-				// Print number of memory leaks
-				wTemp = CharToWChar( sInput.c_str() );
-				moduleElement->setAttribute( L"leaks", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-				break;
-			}
-			case SUBTEST_HANDLE_LEAKS:
-			{
-				if( m_pCurrentSubTestElem == NULL )
-					return;
-				xercesc::DOMElement* handleLeaksElement = m_pDomDoc->createElement( L"handle_leaks" );
-				m_pCurrentSubTestElem->appendChild( handleLeaksElement );
-
-				//Print number of handle leaks
-				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
-				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
-				handleLeaksElement->setAttribute( L"count", (const LPWSTR)wTemp );
-				if( wTemp )
-					delete[] wTemp;
-				break;
-			}
-			default:
-			break;
-		}
-	}
-	catch( ... )
-	{
-		printf( "Error when writing data to XML file." );
-	}
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::GetStringUntilNextGivenChar
-// Function returns string from begin of given string until next given char,
-// characters until given char are removed from sInput string.
-// -----------------------------------------------------------------------------
-string CATDataSaver::GetStringUntilNextGivenChar( string& sInput, char cCharacter )
-{
-	LOG_LOW_FUNC_ENTRY("CATDataSaver::GetStringUntilNextGivenChar");
-	string sRet;
-	size_t iPos = sInput.find( cCharacter );
-	if( sInput.size() > 1 && iPos != string::npos )
-	{
-		sRet = sInput.substr( 0, iPos );
-		sInput.erase( 0, (iPos + 1) );
-	}
-	return sRet;
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::SetBuild
-// Function sets build target info.
-// -----------------------------------------------------------------------------
-void CATDataSaver::SetBuild( bool bUdebBuild )
-{
-	LOG_FUNC_ENTRY("CATDataSaver::SetBuild");
-	m_bUdebBuild = bUdebBuild;
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::AddCarbideData
-// Function adds string to Carbide data.
-// -----------------------------------------------------------------------------
-void CATDataSaver::AddCarbideData( const string& sInput )
-{
-	LOG_LOW_FUNC_ENTRY("CATDataSaver::AddCarbideData");
-	m_sCarbideDataLine.append( sInput );
-	m_sCarbideDataLine.append(";");
-}
-
-// -----------------------------------------------------------------------------
-// CATDataSaver::IntegerToString
-// Converts integer to string.
-// -----------------------------------------------------------------------------
-string CATDataSaver::IntegerToString( int iValueToConvert )
-{
-	LOG_LOW_FUNC_ENTRY("CATDataSaver::IntegerToString");
-	char cTemp[128];
-	string sValue( itoa( iValueToConvert, cTemp, 10 ) );
-	return sValue;
-}
--- a/analyzetool/commandlineengine/src/CATMemoryAddress.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,307 +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:  Class representing a memory address and its details.
-*
-*/
-
-
-#include "../inc/CATMemoryAddress.h"
-#include "../inc/CATBase.h"
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::CATMemoryAddress
-// Constructor
-// -----------------------------------------------------------------------------
-CATMemoryAddress::CATMemoryAddress(string& sAddress, unsigned long iOffSet)
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::CATMemoryAddress");
-	m_sAddress = sAddress;
-	m_sFileName = "";
-	m_sFunctionName = "";
-	m_sModuleName = "";
-	m_iAddress = CATBase::_httoi( sAddress.c_str() );
-	m_iDllLoadinfoIndex = -1;
-	m_iModuleStartAddress = 0;
-	m_iOffSetFromModuleStart = 0;
-	m_iExactLineNumber = -1;
-	m_iFunctionLineNumber = -1;
-	m_ePinPointState = OUT_OF_PROCESS;
-	m_iOffSet = iOffSet;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::~CATMemoryAddress
-// Destructor.
-// -----------------------------------------------------------------------------
-CATMemoryAddress::~CATMemoryAddress()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::~CATMemoryAddress");
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::FindSetModuleName
-// Find which binary this address belongs to.
-// Sets also the offsetfrommodulestart.
-// -----------------------------------------------------------------------------
-bool CATMemoryAddress::FindSetModuleName(vector<DLL_LOAD_INFO>* vDlls)
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::FindSetModuleName");
-	vector<DLL_LOAD_INFO>::iterator it;
-	for (  it = vDlls->begin() ;
-		it != vDlls->end(); it++ )
-	{
-		// Is modules load time defined?
-		if ( (*it).iLoadTime > 0 )
-		{
-			// Check that load time is earlier or same as allocation
-			if ( m_iTime >= (*it).iLoadTime
-				&& m_iAddress >= (*it).iStartAddress 
-				&& m_iAddress < (*it).iEndAddress )
-			{
-				// Module is loaded until process end.
-				if ( (*it).iUnloadTime == 0 )
-					break;
-				// Check is allocation done before module was unloaded.
-				else if ( (*it).iUnloadTime >= m_iTime )
-					break;
-			}
-		}
-		// Module has no time defined use only code segments.
-		else
-		{
-			if ( m_iAddress >= (*it).iStartAddress 
-				&& m_iAddress < (*it).iEndAddress )
-				break;
-		}
-	}
-
-	// Did we not find module where address is?
-	if ( it == vDlls->end() )
-		return false;
-
-	m_ePinPointState = OUT_OF_RANGE;
-	m_sModuleName = (*it).sModuleName;
-	m_iModuleStartAddress = (*it).iStartAddress;
-	m_iOffSetFromModuleStart = m_iAddress - m_iModuleStartAddress;
-	m_iOffSetFromModuleStart += m_iOffSet;
-	m_iDllLoadinfoIndex = distance( vDlls->begin(), it ) ;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::SetModuleStartAddress
-// Set start address of the binary in which address resides.
-// Note, this also sets the offset from start value.
-// -----------------------------------------------------------------------------
-void CATMemoryAddress::SetModuleStartAddress(unsigned long iAddress)
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetModuleStartAddress");
-	m_iModuleStartAddress = iAddress;
-	m_iOffSetFromModuleStart = m_iAddress - m_iModuleStartAddress;
-	m_iOffSetFromModuleStart += m_iOffSet;
-}
-
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetOffSetFromModuleStart
-// Note return value includes the set offset.
-// So this value is not binary start - address.
-// Instead it is.
-// memory address - binary start address + offset
-// -----------------------------------------------------------------------------
-unsigned long CATMemoryAddress::GetOffSetFromModuleStart()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetOffSetFromModuleStart");
-	return m_iOffSetFromModuleStart;
-}
-
-int CATMemoryAddress::GetDllLoadInfoIndex()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetDllLoadInfo");
-	return m_iDllLoadinfoIndex;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::SetTime
-// -----------------------------------------------------------------------------
-void CATMemoryAddress::SetTime( unsigned long long& ullTime )
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetTime");
-	m_iTime = ullTime;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetTIme
-// -----------------------------------------------------------------------------
-unsigned long long CATMemoryAddress::GetTime()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetTime");
-	return m_iTime;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::SetAddress
-// -----------------------------------------------------------------------------
-void CATMemoryAddress::SetAddress(string& sAddress)
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetAddress");
-	m_sAddress = sAddress;
-	m_iAddress = CATBase::_httoi( sAddress.c_str() );
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetAddressString
-// -----------------------------------------------------------------------------
-string CATMemoryAddress::GetAddressString()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetAddressString");
-	return m_sAddress;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::SetAddress
-// -----------------------------------------------------------------------------
-void CATMemoryAddress::SetAddress(unsigned long iAddress)
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetAddress");
-	m_iAddress = iAddress;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetAddress
-// -----------------------------------------------------------------------------
-unsigned long CATMemoryAddress::GetAddress()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetAddress");
-	return m_iAddress;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::SetModuleName
-// -----------------------------------------------------------------------------
-void CATMemoryAddress::SetModuleName(string& sModuleName)
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetModuleName");
-	m_sModuleName = sModuleName;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetModuleName
-// -----------------------------------------------------------------------------
-string CATMemoryAddress::GetModuleName()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetModuleName");
-	return m_sModuleName;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::SetAddressToLineState
-// -----------------------------------------------------------------------------
-void CATMemoryAddress::SetAddressToLineState( ADDRESS_TO_LINE_STATE eState )
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetAddressToLineState");
-	m_ePinPointState = eState;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetAddressToLineState
-// -----------------------------------------------------------------------------
-int CATMemoryAddress::GetAddressToLineState()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetAddressToLineState");
-	return m_ePinPointState;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::SetFileName
-// -----------------------------------------------------------------------------
-void CATMemoryAddress::SetFileName(string& sFileName)
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetFileName");
-	m_sFileName = sFileName;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetFileName
-// -----------------------------------------------------------------------------
-string CATMemoryAddress::GetFileName()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetFileName");
-	return m_sFileName;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::SetFunctionName
-// -----------------------------------------------------------------------------
-void CATMemoryAddress::SetFunctionName(string& sFunctionName)
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetFunctionName");
-	m_sFunctionName = sFunctionName;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetFunctionName
-// -----------------------------------------------------------------------------
-string CATMemoryAddress::GetFunctionName()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetFunctionName");
-	return m_sFunctionName;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::SetFunctionLineNumber
-// -----------------------------------------------------------------------------
-void CATMemoryAddress::SetFunctionLineNumber(int iFunctionLineNumber)
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetFunctionLineNumber");
-	m_iFunctionLineNumber = iFunctionLineNumber;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetFunctionLineNumber
-// -----------------------------------------------------------------------------
-int CATMemoryAddress::GetFunctionLineNumber()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetFunctionLineNumber");
-	return m_iFunctionLineNumber;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::SetExactLineNumber
-// -----------------------------------------------------------------------------
-void CATMemoryAddress::SetExactLineNumber(int iExactLineNumber)
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetExactLineNumber");
-	m_iExactLineNumber = iExactLineNumber;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetExactLineNumber
-// -----------------------------------------------------------------------------
-int CATMemoryAddress::GetExactLineNumber()
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetExactLineNumber");
-	return m_iExactLineNumber;
-}
-
-// -----------------------------------------------------------------------------
-// CATMemoryAddress::GetModuleStartAddress
-// -----------------------------------------------------------------------------
-unsigned long CATMemoryAddress::GetModuleStartAddress() const
-{
-	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetModuleStartAddress");
-	return m_iModuleStartAddress;
-}
-
-//EOF
--- a/analyzetool/commandlineengine/src/CATMmp.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,396 +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:  Class responsible of handling mmp files.
-*
-*/
-
-
-#include "../inc/CATMmp.h"
-
-CATMmp::CATMmp()
-{
-	LOG_FUNC_ENTRY("CATMmp::CATMmp");
-}
-
-CATMmp::~CATMmp()
-{
-	LOG_FUNC_ENTRY("CATMmp::~CATMmp");
-}
-
-// -----------------------------------------------------------------------------
-// CATMmp::IsMmpEdited
-// Checks is the file edited by AT
-// -----------------------------------------------------------------------------
-bool CATMmp::IsMmpEdited( bool bBackup)
-{
-	LOG_FUNC_ENTRY("CATMmp::IsMmpEdited");
-	// Stream to read file
-	ifstream in;
-	// Temp char array to read line
-	char cTemp[MAX_LINE_LENGTH];
-	// Open file
-	if ( bBackup )
-		in.open( CreateMmpBackupPath().c_str() );
-	else
-		in.open( m_sMmpFile.c_str() );
-	// Is file open ok
-	if( ! in.good() )
-	{
-		cout << AT_MSG << "Error, can not open file "
-			<< m_sMmpFile << endl;
-		in.close();
-		return false;
-	}
-	// Search edit start line
-	bool bEdited=false;
-	const char* cFind = MMPFILECHANGES[0].c_str();
-	while( ! bEdited && in.good() )
-	{
-		// Get line
-		in.getline( cTemp, MAX_LINE_LENGTH );
-		// Compare to first line in changes
-		if ( strstr( cTemp, cFind) )
-		{
-			bEdited = true;
-			// Stop looking any further
-			break;
-		}
-	}
-	// Close file and return result
-	in.close();
-	return bEdited;
-}
-
-// -----------------------------------------------------------------------------
-// CATMmp::EditMmpFile
-// Makes AnalyzeTool changes to given mmp file
-// -----------------------------------------------------------------------------
-bool CATMmp::EditMmpFile(const string& sTargetType, const string& sId)
-{
-	LOG_FUNC_ENTRY("CATMmp::EditMmpFile");
-
-	if ( ! RemoveWriteProtections() )
-		return false;
-
-	// Stream where to add changes
-	ofstream out;
-
-	// Open mmp file for editing (append changes to the end)
-	out.open( m_sMmpFile.c_str(), ios::out | ios::app );
-
-	// File open ok?
-	if( !out.good() )
-	{
-		cout << AT_MSG << "Error, can not open file "
-			<< m_sMmpFile;
-		out.close();
-		return false;
-	}
-	
-	// Write lines to mmp file
-	if ( sTargetType.compare( "dll" ) == 0 || sTargetType.compare( "lib" ) == 0 )
-	{
-		// DLL changes
-		int size = sizeof( MMPFILECHANGES_DLL ) / sizeof( string );
-		for( int i = 0; i < size; i++ )
-		{
-			out << endl << MMPFILECHANGES_DLL[i];
-		}
-		out << endl;
-	}
-	else
-	{
-		// Other than DLL changes
-		int size = sizeof( MMPFILECHANGES ) / sizeof( string );
-		for( int i = 0; i < size; i++ )
-		{
-			// After second line of changes add also source statement
-			out << endl << MMPFILECHANGES[i];
-			if ( i == 1 )
-			{
-				out << endl
-					<< "SOURCE            "
-					<< AT_TEMP_CPP_LOWER_START
-					<< sId
-					<< AT_TEMP_CPP_LOWER_END;
-			}
-		}
-		out << endl;
-	}
-	// Close stream
-	out.close();
-
-	cout << AT_MSG << "Mmp file : " << m_sMmpFile << " edited." << endl;
-
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATMmp::BackupMmpFile
-// Backups the mmp file to path/atool_temp/filename.mmp.tmp
-// Calling this function results always to 
-// - none edited mmp
-// - none edited backup
-// - If mmp is write protected. Create writable copy from it. Backup the write
-// procted one.
-// -----------------------------------------------------------------------------
-bool CATMmp::BackupMmpFile( )
-{
-	LOG_FUNC_ENTRY("CATMmp::BackupMmpFile");
-
-	if ( ! RemoveWriteProtections() )
-		return false;
-
-	// Backup path+filename
-	string sBackup = CreateMmpBackupPath();
-
-	// Backup mmp.
-	if ( CopyFile( m_sMmpFile.c_str() , sBackup.c_str(), false ) == 0 )
-	{
-		// Log and return false if failed to copy file
-		LOG_STRING( "error copyfile " << m_sMmpFile << " to " << sBackup );
-		return false;
-	}
-
-	// If backup now edited remove changes from it.
-	if ( IsMmpEdited( true ) )
-	{
-		if ( ! RemoveMmpFileChanges( true ) )
-			return false;
-	}
-
-	return true;
-}
-// -----------------------------------------------------------------------------
-// CATMmp::RestoreMmpFile
-// Restores the mmp file from backup
-// -----------------------------------------------------------------------------
-bool CATMmp::RestoreMmpFile()
-{
-	LOG_FUNC_ENTRY("CATMmp::RestoreMmpFile");
-	
-	if ( ! RemoveWriteProtections() )
-		return false;
-
-	if ( CopyFile( CreateMmpBackupPath().c_str() , m_sMmpFile.c_str(), false ) == 0 )
-	{
-		// Log and return false if failed to copy file
-		LOG_STRING("error copyfile " << CreateMmpBackupPath() << " to " << m_sMmpFile );
-		return false;
-	}
-	else
-		cout << AT_MSG << "Mmp file : " << m_sMmpFile << " restored." << endl;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATMmp::RemoveMmpFileChanges
-// Removes AT changes from given mmp file
-// -----------------------------------------------------------------------------
-bool CATMmp::RemoveMmpFileChanges(bool bBackup)
-{
-	LOG_FUNC_ENTRY("CATMmp::RemoveMmpFileChanges");
-	
-	if ( ! RemoveWriteProtections() )
-		return false;
-
-	// File reading stream
-	ifstream in;
-	// Vector to hold file data
-	vector<string> vLines;
-	// Open file
-	if ( bBackup )
-		in.open( CreateMmpBackupPath().c_str(), ios::in );
-	else
-		in.open( m_sMmpFile.c_str(), ios::in );
-	// Check file open ok
-	if ( ! in.good() )
-	{
-		cout << AT_MSG << "Error, opening file";
-		if ( bBackup )
-			cout << CreateMmpBackupPath();
-		else
-			cout << m_sMmpFile;
-		cout << endl;
-		return false;
-	}
-	// Read file to temporary stream except AT changes
-	char cLine[MAX_LINE_LENGTH];
-	// Boolean to know read or not
-	bool bRead = true;
-	// Integer to confirm that AT changes were succefully found and
-	// not read even if they are found multiple times
-	int iSuccessfull = 0;
-	// Number of 'lines' in mmp changes
-	int iChangesSize = sizeof( MMPFILECHANGES ) / sizeof( string );
-	// First mmp changes line
-	string sFirstLine = MMPFILECHANGES[0];
-	// Last mmp changes line
-	string sLastLine = MMPFILECHANGES[iChangesSize-1];
-	while( in.good() )
-	{
-		in.getline( cLine, MAX_LINE_LENGTH );
-		// Check start of AT changes
-		if( strstr( cLine, sFirstLine.c_str() ) != 0 )
-		{
-			// Remove last linefeed
-			vector<string>::iterator it = vLines.end();
-			it--;
-			if ( it->size() == 0 ) 
-				vLines.erase( vLines.end()-1, vLines.end() );
-			// Stop reading
-			bRead = false;
-			iSuccessfull+=3;
-		}
-		// Read lines outside AT changes
-		if ( bRead )
-		{
-			// Gather all other lines except the AT edits
-			vLines.push_back( string(cLine) );
-		}
-		// Check end of AT changes
-		if( strstr( cLine, sLastLine.c_str() ) != 0 )
-		{
-			// Get empty line
-			in.getline( cLine, MAX_LINE_LENGTH );
-			// Continue reading
-			bRead = true;
-			iSuccessfull-=1;
-		}
-	}
-	// Close reading file stream
-	in.close();
-	// To check all went ok iSuccesfull%2 = 0
-	if ( iSuccessfull%2 != 0 && iSuccessfull >= 2 )
-	{
-		cout << AT_MSG << "Error, removing mmp changes from ";
-		if ( bBackup )
-			cout << CreateMmpBackupPath();
-		else
-			cout << m_sMmpFile;
-		cout << endl;
-		return false;
-	}
-	// Overwrite current mmp file
-	ofstream out;
-	// Open file (truncates old data)
-	if ( bBackup )
-		out.open( CreateMmpBackupPath().c_str(), ios::trunc );
-	else
-		out.open( m_sMmpFile.c_str(), ios::trunc );
-	// Is open ok
-	if( ! out.good() )
-	{
-		cout << AT_MSG << "Error, opening file ";
-		if ( bBackup )
-			cout << CreateMmpBackupPath();
-		else
-			cout << m_sMmpFile;
-		cout << endl;
-	}
-	// Write lines to file
-	for( vector<string>::iterator it = vLines.begin() ; it != vLines.end() ; it++ )
-	{
-		out << *it << endl;
-	}
-	// Close
-	out.close();
-	// Return true
-	return true;
-}
-// -----------------------------------------------------------------------------
-// CATMmp::VerifyAndRecover
-// Wont change mmp if it is not edited
-// Replaces mmp file using backup if it exists and it is
-// not edited otherwise removes changes from mmp file.
-// -----------------------------------------------------------------------------
-bool CATMmp::VerifyAndRecover()
-{
-	LOG_FUNC_ENTRY("CATMmp::VerifyAndRecover");
-	// Is it edited
-	if ( IsMmpEdited() )
-	{
-		string sBackup = CreateMmpBackupPath();
-		if ( FileExists( sBackup.c_str() ) )
-		{
-			// Is backup edited
-			if ( ! IsMmpEdited( true ) )
-			{
-				// Replace original with backup
-				return RestoreMmpFile();
-			}
-		}
-		// Remove changes from original
-		return RemoveMmpFileChanges();
-	}
-	// Non edited original
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATMmp::CreateMmpBackupPath
-// Creates string containing full path to backup mmp file
-// -----------------------------------------------------------------------------
-string CATMmp::CreateMmpBackupPath()
-{
-	LOG_FUNC_ENTRY("CATMmp::CreateMmpBackupPath");
-	// backup path+filename
-	string sBackup;
-	sBackup.append( GetPathOrFileName( false, m_sMmpFile ) );
-	sBackup.append( AT_TEMP_DIR );
-	sBackup.append( "\\" );
-	// Add mmp file name to it and .tmp
-	sBackup.append( GetPathOrFileName( true, m_sMmpFile ) );
-	// Add .tmp
-	sBackup.append( ".tmp" );
-	// Return it
-	return sBackup;
-}
-
-// -----------------------------------------------------------------------------
-// CATMmp::RemoveWriteProtections
-// Removes write protection of mmp file and backup if exists.
-// -----------------------------------------------------------------------------
-bool CATMmp::RemoveWriteProtections()
-{
-	LOG_LOW_FUNC_ENTRY("CATMmp::RemoveWriteProtections");
-
-	// Backup path+filename
-	string sBackup = CreateMmpBackupPath();
-
-	// Check is mmp read-only
-	if ( IsFileReadOnly( m_sMmpFile.c_str() ) )
-	{
-		if( ! SetFileWritable( m_sMmpFile.c_str() ) )
-		{
-			LOG_STRING( "error setting mmp file writable" << m_sMmpFile );
-			return false;
-		}
-	}
-
-	// Check is there a backup if is remove any write protection from it.
-	if ( FileExists( sBackup.c_str() ) )
-	{
-		if ( IsFileReadOnly( sBackup.c_str() ) )
-		{
-			if( ! SetFileWritable( sBackup.c_str() ) )
-			{
-				LOG_STRING( "error setting mmp file writable" << sBackup );
-				return false;
-			}
-		}
-	}
-	return true;
-}
-// End of file
--- a/analyzetool/commandlineengine/src/CATModule2.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1634 +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:  Class representing a module in project (sbs2)
-*
-*/
-
-
-#include "../inc/CATModule2.h"
-#include "../inc/CATProject.h"
-#include "../inc/CATDatParser.h"
-#include "../inc/CATMemoryAddress.h"
-#include "../inc/catdbghelper.h"
-#include "../inc/cataddr2line.h"
-
-CATModule2::CATModule2(void)
-{
-	LOG_FUNC_ENTRY("CATModule2::CATModule2");
-	m_bAddressToLineInitialized = false;
-	m_pAddressToLine = 0;
-	m_sErrors = "";
-	m_sMakeFile = "";
-	m_eBuildSystem = CATProject::SBS_V1;
-	m_sCompileInfoText = "";
-}
-
-CATModule2::~CATModule2(void)
-{
-	LOG_FUNC_ENTRY("CATModule2::~CATModule2");
-	if ( m_pAddressToLine )
-		m_pAddressToLine->Close();
-	delete m_pAddressToLine;
-}
-
-bool CATModule2::AddressToLine( CATMemoryAddress* pMemoryAddress )
-{
-	LOG_FUNC_ENTRY("CATModule2::AddressToLine");
-	if ( _stricmp( m_sVariantPlatform.c_str(), "winscw" ) == 0 )
-	{
-		return AddressToLineWinscw( pMemoryAddress );
-	}
-	else if ( _stricmp( m_sVariantPlatform.c_str(), "armv5" ) == 0 )
-	{
-		// addr2line exe.
-		#ifdef ADDR2LINE
-		return AddressToLineAddr2lineExe( pMemoryAddress );
-		#endif
-		// lst and map files.
-		#ifndef ADDR2LINE
-		return AddressToLineArmv5( pMemoryAddress );
-		#endif
-	}
-	else if ( _stricmp( m_sVariantPlatform.c_str(), "gcce" ) == 0 )
-	{
-		return AddressToLineAddr2lineExe( pMemoryAddress );
-	}
-	return false;
-}
-
-bool CATModule2::AddressToLineWinscw( CATMemoryAddress* pMemoryAddress )
-{
-	LOG_FUNC_ENTRY("CATModule2::AddressToLineWinscw( CATMemoryAddress* pMemoryAddress )");
-	if ( m_pAddressToLine == 0 && ! m_bAddressToLineInitialized )
-	{
-		// Use debug helper to locate codelines on winscw platform.
-		m_pAddressToLine = new CATDbgHelper();
-
-		// Create full path to binary which we open using CATDbgHelper.
-		string sFullPathToBinary = GetBinaryFile();
-
-		// If opening of binary not succesfull set return value to false.
-		if ( ! m_pAddressToLine->Open( sFullPathToBinary, pMemoryAddress->GetModuleStartAddress() ) )
-		{
-			LOG_STRING("Error, m_pAddressToLine->Open()");
-			return false;
-		}
-		m_bAddressToLineInitialized = true;
-	}
-	// Check pointer before calling.
-	if ( m_pAddressToLine == 0 )
-		return false;
-	m_pAddressToLine->AddressToLine( pMemoryAddress );
-	return true;
-}
-
-bool CATModule2::AddressToLineArmv5( CATMemoryAddress* pMemoryAddress )
-{
-	LOG_FUNC_ENTRY("CATModule2::AddressToLine( CATMemoryAddress* pMemoryAddress )");
-	if ( ! m_bAddressToLineInitialized )
-		return false;
-	// Find from map file
-	int iMapIndex = GetSymbolIndexUsingAddress( pMemoryAddress->GetOffSetFromModuleStart() );
-	if ( iMapIndex == -1 )
-	{
-		pMemoryAddress->SetAddressToLineState( CATMemoryAddress::OUT_OF_RANGE );
-		return true;
-	}
-	// Set symbol name
-	string sSymbolName = m_vMapFileFuncList.at( iMapIndex ).sFunctionName;
-
-	// Remove (... from symbol name
-	string sSymbolNameRefined( sSymbolName );
-	size_t iPos = sSymbolNameRefined.find( "(" );
-	if ( iPos != string::npos )
-		sSymbolNameRefined.resize( iPos );
-
-	// Set symbol name as function name for memory address
-	pMemoryAddress->SetFunctionName( sSymbolNameRefined );
-
-	// Set state to symbol
-	pMemoryAddress->SetAddressToLineState( CATMemoryAddress::SYMBOL );
-	
-	// Offset from function start addr
-	int iOffSetFromFuncStart = pMemoryAddress->GetOffSetFromModuleStart()
-		- m_vMapFileFuncList.at( iMapIndex ).iAddress;
-
-	// Find from lst list
-	int iLstIndex = GetLineInFileIndexUsingSymbolName( sSymbolName );
-	if ( iLstIndex == -1 )
-		return true;
-
-	// Set pinpointing
-	int iFuncLineNumber = m_vLineInFile.at( iLstIndex ).iLine;
-	string sFileName = m_vLineInFile.at( iLstIndex ).sFileName;
-	string sLstFileName = m_vLineInFile.at( iLstIndex ).sLstName;
-
-	pMemoryAddress->SetFunctionLineNumber( iFuncLineNumber );
-	pMemoryAddress->SetFileName( sFileName );
-	
-	pMemoryAddress->SetAddressToLineState( CATMemoryAddress::FUNCTION );
-
-	// In urel mode don't get exact code line
-	if ( ! IsUDEB() )
-		return true;
-
-	// Next calculate the code line inside function
-	int iExactLineNumber = FindLeakCodeLine( sLstFileName, iFuncLineNumber, iOffSetFromFuncStart );
-	pMemoryAddress->SetExactLineNumber( iExactLineNumber );
-
-	// State is now exact
-	pMemoryAddress->SetAddressToLineState( CATMemoryAddress::EXACT );
-	return true;
-}
-
-bool CATModule2::AddressToLineAddr2lineExe( CATMemoryAddress* pMemoryAddress )
-{
-	LOG_FUNC_ENTRY("CATModule2::AddressToLineAddr2lineExe( CATMemoryAddress* pMemoryAddress )");
-	if ( m_pAddressToLine == 0 && ! m_bAddressToLineInitialized )
-	{
-		// Use addr2line.exe to locate codelines on armv5 and gcce platform.
-		m_pAddressToLine = new CATAddr2line();
-
-		// Create full path to binary .sym file which we open using addr2line.exe.
-		string sFullPathToBinary = GetBinaryFile();
-
-		// If opening of binary not succesfull set return value to false.
-		if ( ! m_pAddressToLine->Open( sFullPathToBinary, pMemoryAddress->GetModuleStartAddress() ) )
-		{
-			LOG_STRING("Error, m_pAddressToLine->Open()");
-			return false;
-		}
-		m_bAddressToLineInitialized = true;
-	}
-	// Check pointer before calling.
-	if ( m_pAddressToLine == 0 )
-		return false;
-
-	m_pAddressToLine->AddressToLine( pMemoryAddress );
-	return true;
-}
-
-// Find symbol of given address
-int CATModule2::GetSymbolIndexUsingAddress( unsigned long iAddress ) const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetSymbolIndexUsingAddress");
-	for( size_t i = 0; i < m_vMapFileFuncList.size(); i++ )
-	{
-		unsigned long iStart = m_vMapFileFuncList.at( i ).iAddress;
-		unsigned long iEnd = ( m_vMapFileFuncList.at( i ).iAddress
-			+ m_vMapFileFuncList.at( i ).iFuncLength );
-
-		if ( iAddress >= iStart && iAddress < iEnd )
-			return (int) i;
-	}
-	return -1;
-}
-
-// Find index of function line in file vector of given symbolname
-int CATModule2::GetLineInFileIndexUsingSymbolName( const string& sSymbolName ) const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetLineInFileIndexUsingSymbolName");
-	for( size_t i = 0; i < m_vLineInFile.size(); i++ )
-	{
-		string sLineInFileName = m_vLineInFile.at( i ).sFunction;
-		if( sLineInFileName.find( sSymbolName ) != string::npos )
-		{
-			return (int) i;
-		}
-	}
-	return -1;
-}
-
-
-// Check does modules symbol file(s) exist.
-bool CATModule2::SymbolFileExist( void )
-{
-	LOG_FUNC_ENTRY("CATModule2::SymbolFileExist");
-	string sFullPathToSym = GetSymbolFile();
-	if ( !FileExists( sFullPathToSym.c_str() ) )
-	{
-		// Add missing symbol file to error string.
-		m_sErrors.append( "Missing symbol file: " );
-		m_sErrors.append( sFullPathToSym );
-		m_sErrors.append( "\n" );
-		return false;
-	}
-	return true;
-}
-
-// Check does modules map file(s) exists.
-bool CATModule2::MapFileExist( void )
-{
-	LOG_FUNC_ENTRY("CATModule2::MapFileExist");
-	string sFullPathToMap = GetMapFile();
-	if ( !FileExists( sFullPathToMap.c_str() ) )
-	{
-		// Add missing symbol file to error string.
-		m_sErrors.append( "Missing map file: " );
-		m_sErrors.append( sFullPathToMap );
-		m_sErrors.append( "\n" );
-		return false;
-	}
-	return true;
-}
-
-//Check does modules binary file(s) exist.
-bool CATModule2::BinaryFileExist( void )
-{
-	LOG_FUNC_ENTRY("CATModule2::BinaryFileExist");
-	string sFullPathToBinary = GetBinaryFile();
-	if ( ! FileExists( sFullPathToBinary.c_str() ) )
-	{
-		// Add missing binary to error string.
-		m_sErrors.append( "Missing binary file: " );
-		m_sErrors.append( sFullPathToBinary );
-		m_sErrors.append( "\n" );
-		return false;
-	}
-	return true;
-}
-
-void CATModule2::AddSource(const string &sSourceFile, const string& sLstFile)
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::AddSource");
-	// Parse sources which are separated by spaces
-	if( sSourceFile.length() < 1  || sLstFile.length() < 1 )
-		return;
-
-	// Skip if its temporary cpp.
-	if ( sSourceFile.find( AT_TEMP_CPP_LOWER_START) != string::npos )
-		return;
-
-	// Source structure
-	SOURCE sNew;
-	sNew.sCpp =  sSourceFile;
-	sNew.sLst = sLstFile;
-
-	// Verify paths.
-	ConvertUnixPathToWin( sNew.sCpp );
-	ConvertUnixPathToWin( sNew.sLst );
-
-	// Lower case them.
-	ChangeToLower( sNew.sCpp );
-	ChangeToLower( sNew.sLst );
-
-	// Add it
-	m_vSources.push_back( sNew );
-}
-
-void CATModule2::AddSources(string& sSource)
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::AddSources");
-	// Parse sources which are separated by spaces
-	if( sSource.length() < 1 )
-		return;
-	// Source structure
-	SOURCE sNew;
-	size_t iSpot = string::npos;
-	iSpot = sSource.find( " " );
-	while( iSpot != string::npos )
-	{
-		// Pickup source
-		sNew.sCpp = sSource.substr(0, iSpot);
-		// Convert path from Unix to Win
-		ConvertUnixPathToWin( sNew.sCpp );
-		// Lowercase it
-		ChangeToLower( sNew.sCpp );
-		// If its temp skip this
-		if ( sNew.sCpp.find( AT_TEMP_CPP_LOWER_START ) == string::npos )
-		{
-			// Get corresponding lst file for source
-			sNew.sLst = GetLstNameOfSource( sNew.sCpp );
-			m_vSources.push_back( sNew );
-			// Remove it from sSource
-			sSource.erase(0,iSpot+1);
-			// Find new one
-		}
-		iSpot = sSource.find( " " );
-	}
-	// Pickup last or only one source
-	sNew.sCpp = sSource;
-	// Convert path from unix to win
-	ConvertUnixPathToWin( sNew.sCpp );
-	// Lowercase it
-	ChangeToLower( sNew.sCpp );
-	// Lst name
-	sNew.sLst = GetLstNameOfSource( sNew.sCpp );
-	if ( sNew.sCpp.find( AT_TEMP_CPP_LOWER_START ) == string::npos )
-	{
-		// Get corresponding lst file for source
-		sNew.sLst = GetLstNameOfSource( sNew.sCpp );
-		m_vSources.push_back( sNew );
-	}
-}
-bool CATModule2::CreateTempCpp(const string& sS60FileName
-									, int eLoggingMode
-									, int eBuildType
-									, int iAllocCallStackSize
-									, int iFreeCallStackSize )
-{
-	LOG_FUNC_ENTRY("CATModule2::CreateTemporaryCpp");
-	// S60 filename
-	m_sS60FileName = sS60FileName;
-	// Make s60 filename target.type.dat if its empty and logging mode is file
-	if ( eLoggingMode == CATProject::FILE
-		&& m_sS60FileName.empty() )
-	{
-		m_sS60FileName = m_sTarget;
-		m_sS60FileName.append(".");
-		m_sS60FileName.append( m_sTargetType );
-		m_sS60FileName.append(".dat");
-	}
-	return CreateTemporaryCpp( GetUniqueId(), m_sTempPath,
-		m_sS60FileName, eLoggingMode, eBuildType, iAllocCallStackSize, iFreeCallStackSize );
-}
-
-bool CATModule2::ModifyMmp()
-{
-	LOG_FUNC_ENTRY("CATModule2::ModifyMmp");
-	// Create backup
-	if ( ! m_Mmp.BackupMmpFile() )
-		return false;
-	// Hook
-	return m_Mmp.EditMmpFile( m_sTargetType, GetUniqueId() );
-}
-
-bool CATModule2::RestoreMmp()
-{
-	LOG_FUNC_ENTRY("CATModule2::RestoreMmp");
-	// Restore mmp from backup
-	return m_Mmp.RestoreMmpFile();
-}
-
-bool CATModule2::VerifyAndRecoverMmp()
-{
-	LOG_FUNC_ENTRY("CATModule2::VerifyAndRecoverMmp");
-	// Verify mmp
-	return m_Mmp.VerifyAndRecover();
-}
-
-// ----------------------------------------------------------------------------
-// Releasables Handling methos
-// ----------------------------------------------------------------------------
-bool CATModule2::CopyReleasables()
-{
-	LOG_FUNC_ENTRY("CATModule2::CopyReleasables");
-	bool bRet = true;
-	if ( ! CopyLstFilesToTemp() )
-		bRet = false;
-	if ( ! CopyMapFileToTemp() )
-		bRet = false;
-	return bRet;
-}
-
-bool CATModule2::CopyLstFilesToDir( const string& sDir )
-{
-	LOG_FUNC_ENTRY("CATModule2::CopyLstFilesToDir");
-	bool bRet = true;
-	// Copy lst files to given directory.
-	vector<SOURCE>::const_iterator source;
-	for( source = m_vSources.begin(); source != m_vSources.end() ; source++ )
-	{
-		if ( ! FileCopyToPath( source->sLst, sDir ) )
-		{
-			if ( !FileExists( source->sLst.c_str() ) )
-			{
-				m_sErrors.append( "Missing listing file: " );
-				m_sErrors.append( source->sLst );
-				m_sErrors.append( "\n" );
-			}
-			if ( !DirectoryExists( sDir.c_str() ) )
-			{
-				m_sErrors.append( "Missing folder: " );
-				m_sErrors.append( sDir );
-				m_sErrors.append( "\n" );
-			}
-			bRet = false;
-		}
-	}
-	// Return.
-	return bRet;
-}
-
-bool CATModule2::CopyLstFilesToTemp()
-{
-	LOG_FUNC_ENTRY("CATModule2::CopyLstFilesToTemp");
-	// Return boolean
-	bool bRet = true;
-	// Move all lst files except tmp cpp
-	vector<SOURCE>::iterator it = m_vSources.begin();
-	while ( it != m_vSources.end() )
-	{
-		if ( !FileCopyToPath( it->sLst, m_sTempPath ) )
-		{
-			if ( !FileExists( it->sLst.c_str() ) )
-			{
-				m_sErrors.append( "Missing listing file: " );
-				m_sErrors.append( it->sLst );
-				m_sErrors.append( "\n" );
-			}
-			if ( !DirectoryExists( m_sTempPath.c_str() ) )
-			{
-				m_sErrors.append( "Missing folder: " );
-				m_sErrors.append( m_sTempPath );
-				m_sErrors.append( "\n" );
-			}
-			bRet = false;
-		}
-		it++;
-	}
-	return bRet;
-}
-
-bool CATModule2::DeleteLstFilesFromSrc( void )
-{
-	LOG_FUNC_ENTRY("CATModule2::DeleteLstFilesFromSrc");
-	vector<SOURCE>::iterator it = m_vSources.begin();
-	bool bRet = true;
-	// Delete lst files
-	while ( it != m_vSources.end() )
-	{
-		if ( ! FileDelete( it->sLst, true ) )
-			bRet = false;
-		it++;
-	}
-	return bRet;
-}
-
-bool CATModule2::CopyMapFileToTemp()
-{
-	LOG_FUNC_ENTRY("CATModule2::CopyMapFileToTemp");
-	// Return boolean
-	bool bRet = true;
-	// Map File to copy
-	string sMapFile = GetMapFile();
-	if ( !FileCopyToPath( sMapFile, m_sTempPath ) )
-	{
-		bRet = false;
-		if ( !FileExists( sMapFile.c_str() ) )
-		{
-			// Add missing map file to error string.
-			m_sErrors.append( "Missing map file: " );
-			m_sErrors.append( sMapFile );
-			m_sErrors.append( "\n" );
-		}
-		if ( !DirectoryExists( m_sTempPath.c_str() ) )
-		{
-			// Add missing temporary folder
-			m_sErrors.append( "Missing folder: " );
-			m_sErrors.append( m_sTempPath );
-			m_sErrors.append( "\n" );
-		}
-	}
-	return bRet;
-}
-
-bool CATModule2::CleanTemporaryDir()
-{
-	LOG_FUNC_ENTRY("CATModule2::CleanTemporaryDir");
-	bool bRet = true;
-	// Verify mmp
-	if ( ! m_Mmp.VerifyAndRecover() )
-		bRet = false;
-	// Clean temporary dir
-	vector<string> vFileList = DirList( m_sTempPath, false , true );
-	vector<string>::iterator it = vFileList.begin();
-	// Size of constant table
-	int iCount = sizeof( TEMP_EXTENSION_NO_DELETE ) / sizeof( string );
-	while ( it != vFileList.end() )
-	{
-		// Get extension and compare it to list
-		bool bDelete = true;
-		string sExtension = GetExtension( *it );
-		ChangeToLower( sExtension );
-		for ( int i = 0 ; i < iCount ; i++ )
-		{
-			if( sExtension.compare( TEMP_EXTENSION_NO_DELETE[i] ) == 0 )
-			{
-				bDelete = false;
-				break;
-			}
-		}
-		if ( bDelete )
-		{
-			// Delete file
-			if ( ! FileDelete( *it, true ) )
-				bRet = false;
-		}
-		// Increment
-		it++;
-	}
-	return bRet;
-}
-
-bool CATModule2::DeleteTemporaryDir()
-{
-	LOG_FUNC_ENTRY("CATModule2::DeleteTemporaryDir");
-	bool bRet = true;
-	// Verify mmp
-	if ( ! m_Mmp.VerifyAndRecover() )
-		bRet = false;
-	// Delete temp dir
-	if ( !DirDelete( m_sTempPath, true ) )
-		bRet = false;
-	return bRet;
-}
-
-bool CATModule2::IsUDEB() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::IsUDEB");
-	// Determine from variant is this udeb
-	if ( m_sVariantType.find( "udeb" ) != string::npos )
-		return true;
-	return false;
-}
-// ----------------------------------------------------------------------------
-// Private AddressToLine related methods
-// ----------------------------------------------------------------------------
-bool CATModule2::InitializeAddressToLine()
-{
-	LOG_FUNC_ENTRY("CATModule2::InitializeAddressToLine");
-	bool bRet = true;
-	// Read in different way depending on platform
-	if ( m_sVariantPlatform.compare("armv5") == 0 )
-	{
-		// Add static library lst files to source vector,
-		// before reading them.
-		vector<string> vFiles = DirList( AT_TEMP_LST_DIR, false, true );
-		for(vector<string>::iterator it = vFiles.begin() ; it != vFiles.end() ; it ++ )
-		{
-			SOURCE source;
-			source.bStatic = true;
-			source.sLst = *it;
-			source.sCpp = *it;
-			source.sCpp = CATBase::RemovePathAndExt( source.sCpp, false );
-			source.sCpp.append( ".cpp" );
-			m_vSources.push_back( source );
-		}
-
-		if ( ! ReadListingFilesArmv5() )
-			bRet = false;
-		if ( ! ReadMapFileArmv5() )
-			bRet = false;
-
-		if ( bRet )
-			m_bAddressToLineInitialized = true;
-	}
-	return bRet;
-}
-
-
-bool CATModule2::ReadListingFilesArmv5()
-{
-	LOG_FUNC_ENTRY("CATModule2::ReadListingFilesArmv5");
-	char cTemp[MAX_LINE_LENGTH];
-	vector<SOURCE>::iterator viFileIter = m_vSources.begin();
-	int iNumberOfLstFiles = (int)m_vSources.size();
-	vector<string> vTempLines;
-	string sFileName;
-
-	// Open all .lst files
-	while( iNumberOfLstFiles > 0 )
-	{
-		// Make .lst file name
-		sFileName.clear();
-	
-		// If lst file is not from static library make path to modules temporary directory.
-		if ( viFileIter->bStatic != true )
-		{
-			// Remove path
-			if( viFileIter->sLst.find("\\") != string::npos )
-				sFileName.append(
-				viFileIter->sLst.substr( viFileIter->sLst.find_last_of( "\\" ) + 1
-				, viFileIter->sLst.size() ) );
-			else
-				sFileName.append( viFileIter->sLst );
-
-			// Add temporary dir
-			sFileName.insert( 0, m_sTempPath );
-		}
-		else
-		{
-			// Lst from static library don't change path.
-			sFileName = viFileIter->sLst;
-		}
-		// Open lst file
-		ifstream in( sFileName.c_str() );
-
-		// If file can not be opened, try to open next file
-		if( !in.good() )
-		{
-			viFileIter++;
-			iNumberOfLstFiles--;
-			continue;
-		}
-
-		string sTemp;
-		// Clear temporary lines
-		vTempLines.clear();
-		// Add all lines to temp list
-		do
-		{
-			in.getline( cTemp, MAX_LINE_LENGTH );
-			sTemp.clear();
-			sTemp.append( cTemp );
-			vTempLines.push_back( sTemp );
-		}
-		while( in.good() );
-
-		LINE_IN_FILE structLineInFile;
-		
-		bool bFindENDP = false;
-		vector<string>::iterator viLinesIter = vTempLines.begin();
-
-		// Loop throw all lines in .lst file
-		while( viLinesIter != vTempLines.end() )
-		{
-			// Find ";;;"
-			if( !bFindENDP && strstr(viLinesIter->c_str(), ";;;") != NULL )
-			{
-				bFindENDP = true;
-
-				vector<string>::iterator viLineTempIter = viLinesIter;
-
-				// Find top line of function definition
-				while( viLineTempIter->size() > 0 )
-				{
-					viLineTempIter--;
-				}
-				viLineTempIter++;
-				structLineInFile.sFunction.clear();
-				structLineInFile.sFunction.append( viLineTempIter->c_str() );
-
-				viLinesIter++;
-				// Get Line
-				sTemp.clear();
-				sTemp.append( viLinesIter->c_str() );
-				sTemp.erase(0,3);
-				size_t iSize = sTemp.find_first_of(' ');
-				if( iSize != string::npos )
-					sTemp.resize(iSize);
-				structLineInFile.iLine = atoi( sTemp.c_str() );
-
-				structLineInFile.sFileName.clear();
-				structLineInFile.sFileName.append( viFileIter->sCpp.c_str() );
-				structLineInFile.sLstName = sFileName;
-				m_vLineInFile.push_back( structLineInFile );
-			}
-			else if( strstr(viLinesIter->c_str(), "ENDP") != NULL )
-				bFindENDP = false;
-			viLinesIter++;
-		}
-		viFileIter++;
-		iNumberOfLstFiles--;
-	}
-	if( m_vLineInFile.size() > 0 )
-		return true;
-	return false;
-}
-
-bool CATModule2::ReadMapFileArmv5()
-{
-	LOG_FUNC_ENTRY("CATModule2::ReadMapFileArmv5");
-	// Map file name
-	string sMapFileName	= GetMapFile();
-	// Remove path
-	if ( sMapFileName.find("\\") != string::npos )
-		sMapFileName.erase(0, sMapFileName.find_last_of('\\')+1 );
-	// Add temp path
-	sMapFileName.insert(0, m_sTempPath );
-
-	// Open .map file
-	ifstream in( sMapFileName.c_str() );
-	
-	// File open ok?
-	if( ! in.good() )
-	{
-		in.close();
-		return false;
-	}
-	char cTemp[MAX_LINE_LENGTH];
-	bool bFirstFuncFound = false;
-	// Get all lines where is "Thumb"
-	do
-	{
-		// Load one line from .map file
-		in.getline( cTemp, MAX_LINE_LENGTH );
-		// Find _E32Startup
-		if( !bFirstFuncFound && ( strstr( cTemp, "_E32Startup" ) != NULL) )
-		{
-			bFirstFuncFound = true;
-		}
-		else if( !bFirstFuncFound && ( strstr( cTemp, "_E32Dll" ) != NULL) )
-		{
-			bFirstFuncFound = true;
-		}
-		else if( !bFirstFuncFound )
-			// Skip if _E32Startup not found
-			continue;
-
-		if( strstr( cTemp, "Thumb Code" ) != NULL || strstr( cTemp, "ARM Code" ) != NULL)
-		{
-			MAP_FUNC_INFO structMapFileLineInfo;
-			structMapFileLineInfo.sWholeLine.append( cTemp );
-
-			// Get memory string address from line
-			char* pStart = strstr( cTemp, "0x" );
-			// Check did strstr return null.
-			if( pStart == NULL )
-				continue;
-			char* pTemp = pStart;
-			char TempString[MAX_LINE_LENGTH];
-			TempString[0] = 0;
-			size_t iLength = 0;
-			while( *pTemp != ' ' )
-			{
-				TempString[iLength] = *pTemp;
-				pTemp++;
-				iLength++;
-			}
-			TempString[iLength] = 0;
-
-			structMapFileLineInfo.iAddress = CATDatParser::_httoi( TempString );
-
-			pTemp = cTemp;
-			TempString[0] = 0;
-			
-			// Get function name
-
-			// Skip spaces
-			while( *pTemp == ' ' )
-			{
-				pTemp++;
-			}
-			iLength = 0;
-			// Find end of function name
-			string sTemp( pTemp );
-
-			// Location of character ')'
-			iLength = sTemp.find_first_of(')');
-
-			// Location of character ' '
-			size_t iLength2 = sTemp.find_first_of(' ');
-			
-			// If ')' character is the last char and
-			// character ' ' is closer than ')' use location of ' '
-			if( ( iLength + 1 ) == sTemp.length() && iLength2 < iLength )
-				iLength = iLength2 - 1;
-			
-			if( iLength != string::npos )
-				sTemp.resize( (iLength + 1) );
-
-			structMapFileLineInfo.sFunctionName.append( sTemp.c_str() );
-
-			bool bARM = false;
-			// Find function length
-			pStart = strstr( cTemp, "Thumb Code" );
-			if( pStart == NULL )
-			{
-				pStart = strstr( cTemp, "ARM Code" );
-				bARM = true;
-			}
-			if( pStart != NULL )
-			{
-				if( bARM )
-					pStart += 8;
-				else
-					pStart += 10;
-				while(*pStart == ' ')
-				{
-					pStart++;
-				}
-				sTemp.clear();
-				sTemp.append( pStart );
-				size_t iSize = sTemp.find_first_of(' ');
-				if( iSize != string::npos )
-					sTemp.resize( iSize );
-			}
-
-			structMapFileLineInfo.iFuncLength = atoi( sTemp.c_str() );
-			if( bFirstFuncFound && structMapFileLineInfo.iFuncLength > 0 )
-				// Save to list
-				m_vMapFileFuncList.push_back( structMapFileLineInfo );
-		}
-	}
-	while( in.good() );
-	in.close();
-	return true;
-}
-
-int CATModule2::FindLeakCodeLine( string& sFileName, int iLine, unsigned long iFromFuncAddress ) const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::FindLeakCodeLine");
-	if ( sFileName.empty() )
-		return -1;
-	char cLineFromFile[MAX_LINE_LENGTH];
-	vector<string> vTempLines;
-	string sTemp;
-	char* pTemp = NULL;
-	char* pTempEnd = NULL;
-	int iFoundLine = -1;
-	int iRet = -1;
-	
-	// Open lst file
-	ifstream in( sFileName.c_str() );
-
-	bool bLineFound = false;
-	bool bFirstAddressInFuncFound = false;
-	unsigned long iFirstAddressInFunc = 0;
-	while( in.good() )
-	{
-		in.getline( cLineFromFile, MAX_LINE_LENGTH );
-
-		if( bLineFound )
-		{
-			vTempLines.push_back( cLineFromFile );
-			// Is first character digit
-			if( isdigit( cLineFromFile[0] ) )
-			{
-				if( !bFirstAddressInFuncFound )
-				{
-					bFirstAddressInFuncFound = true;
-					sTemp.clear();
-					sTemp.append( cLineFromFile );
-					// Get value until next space
-					sTemp.resize( sTemp.find_first_of(' ') );
-
-					iFirstAddressInFunc = CATDatParser::_httoi( sTemp.c_str() );
-
-					// Return function start line if margin 0
-					if( iFromFuncAddress == 0 )
-					{
-						iRet = iLine;
-						return iRet;
-					}
-				}
-				else
-				{
-					// Find correct line using iFromFuncAddress variable
-					sTemp.clear();
-					sTemp.append( cLineFromFile );
-					// Get value until next space
-					sTemp.resize( sTemp.find_first_of(' ') );
-
-					unsigned long iValue = CATDatParser::_httoi( sTemp.c_str() );
-
-					if( ( iValue - iFirstAddressInFunc ) >= iFromFuncAddress )
-					{
-						// If there is data in function, code line can not be found
-						if( strstr( cLineFromFile , "DCB" ) != NULL )
-						{
-							iRet = -1;
-							return iRet;
-						}
-						pTemp = strstr( cLineFromFile, ";" );
-						// Get line number
-						bool bStringNumber = true;
-						if( pTemp != NULL )
-						{
-							string sTempLine( pTemp + 1 );
-							// Are all characters numbers?
-							for( unsigned int i = 0 ; i < sTempLine .size() ; i++ )
-							{
-								if( !isdigit(sTempLine[i]) )
-								{
-									bStringNumber = false;
-									break;
-								}
-							}
-						}
-						else
-							bStringNumber = false;
-						if( bStringNumber )
-						{
-							pTemp++;
-							// Get line number
-							iRet = atoi( pTemp );
-						}
-						else
-						{
-							vector<string>::iterator sTempIter = vTempLines.end();
-
-							sTempIter--;
-
-							// Find last code line
-							while( sTempIter != vTempLines.begin() )
-							{
-								if( strstr( sTempIter->c_str() , "DCB" ) != NULL )
-								{
-									iRet = -1;
-									return iRet;
-								}
-								if( strstr( sTempIter->c_str() , ";;;" ) == NULL )
-									sTempIter--;
-								else
-									break;
-							}
-							if(sTempIter == vTempLines.begin() && strstr( sTempIter->c_str() , ";;;" ) == NULL)
-							{
-								iRet = -1;
-								return iRet;
-							}
-							sTempIter->erase( 0, 3 );
-							sTempIter->resize( sTempIter->find(' ') );
-
-							// Leak line
-							iRet = atoi( sTempIter->c_str() );
-						}
-						return iRet;
-					}
-				}
-			}
-		}
-		else // Line in file not found
-		{
-			// Find line of function
-			if( strstr( cLineFromFile, ";;;" ) != NULL )
-			{
-				pTemp = &cLineFromFile[0];
-				// Skip characters ";;;"
-				pTemp += 3;
-				pTempEnd = pTemp;
-				// Find end of line number
-				while( *pTempEnd != ' ' )
-				{
-					pTempEnd++;
-				}
-				*pTempEnd = 0;
-				iFoundLine = atoi( pTemp );
-				*pTempEnd = ' ';
-				if( iLine == iFoundLine )
-				{
-					bLineFound = true;
-				}
-			}
-		}
-	}
-	return iRet;
-}
-
-bool CATModule2::IsMakeSuccessfull()
-{
-	LOG_FUNC_ENTRY("CATModule2::IsMakeSuccessfull");
-	m_sErrors.clear();
-
-	string sSearch;
-	bool bMakeSuccess = true;
-	
-	// Lst files checked only with armv5 platform.
-	if ( IsPlatformArmv5() )
-	{
-		sSearch.append( m_sTempPath );
-		sSearch.append( "*.lst" );
-		if( !SearchFileWithExtension( sSearch.c_str(), false, m_sErrors ) )
-			bMakeSuccess = false;
-		
-		// Map
-		sSearch.clear();
-		sSearch.append( m_sTempPath );
-		sSearch.append( "*.map" );
-		if( !SearchFileWithExtension( sSearch.c_str(), false, m_sErrors ) )
-			bMakeSuccess = false;
-	}
-
-	// .tmp
-	sSearch.clear();
-	sSearch.append( m_sTempPath );
-	sSearch.append( "*.tmp" );
-	if( !SearchFileWithExtension( sSearch.c_str(), false, m_sErrors ) )
-		bMakeSuccess = false;
-
-	return bMakeSuccess;
-}
-
-bool CATModule2::CreateBuildCompleteFile()
-{
-	LOG_FUNC_ENTRY("CATModule2::CreateBuildCompleteFile");
-	// Don't create file if temp path not set cause might be anywhere
-	if ( m_sTempPath.empty() )
-		return false;
-	// Create empty file indicating this module is build
-	string sFile = m_sTempPath;
-	if( sFile.at( sFile.length() - 1 ) != '\\' )
-		sFile.append("\\");
-	sFile.append( "BuildComplete" );
-	ofstream out( sFile.c_str() );
-	out << m_sVariantPlatform << endl;
-	out << m_sVariantType << endl;
-	out.close();
-	return true;
-}
-
-bool CATModule2::ReadMakeFileFromTemp()
-{
-	LOG_FUNC_ENTRY("CATModule2::ReadMakeFileFromTemp");
-	// Set makefile to point to temporary directory.
-	string sMakeFile = m_sTempPath;
-	sMakeFile.append( RemovePathAndExt( m_Mmp.m_sMmpFile, true ) );
-	sMakeFile.append( "." );
-	sMakeFile.append( AT_LEVEL_2_MAKEFILE_EXT );
-	m_sMakeFile = sMakeFile;
-	return ReadMakeFilePrivate();
-}
-
-bool CATModule2::ReadMakeFile()
-{
-	LOG_FUNC_ENTRY("CATModule2::ReadMakeFile");
-	// Read makefile
-	if ( ReadMakeFilePrivate() )
-	{
-		// Copy makefile to temporary directory.
-		string sMakeFile = m_sTempPath;
-		sMakeFile.append( RemovePathAndExt( m_Mmp.m_sMmpFile, true ) );
-		sMakeFile.append( "." );
-		sMakeFile.append( AT_LEVEL_2_MAKEFILE_EXT );
-		FileCopyToPath( m_sMakeFile, sMakeFile );
-		return true;
-	}
-	return false;
-}
-
-bool CATModule2::ReadMakeFilePrivate()
-{
-	LOG_FUNC_ENTRY("CATModule2::ReadMakeFilePrivate");
-
-	if ( m_sMakeFile.empty() )
-		return false;
-
-	LOG_STRING( "using makefile :" << m_sMakeFile );
-
-	// Stream object to read files
-	ifstream in;
-	// Char array to read line from file
-	char cLine[MAX_LINE_LENGTH];
-	// String to use as buffer from file
-	string sLine;
-	// Open file
-	in.open( m_sMakeFile.c_str(), ios_base::in );
-	// Check that its open
-	if ( ! in.good() )
-	{
-		// Cannot open file
-		cout << AT_MSG << "Error, can not open file: " << m_sMakeFile << endl;
-		return false;
-	}
-	// Check is it wrapper makefile (starts with "%:")
-	in.getline( cLine, MAX_LINE_LENGTH );
-	if ( cLine[0] == '%' && cLine[1] == ':' )
-	{
-		LOG_STRING("Found wrapper makefile");
-		in.close();
-		// Use ".default" makefile
-		string sDefaultMakeFile = m_sMakeFile.substr( 0, m_sMakeFile.find_last_of( "." ) );
-		sDefaultMakeFile.append( ".DEFAULT" );
-		LOG_STRING( "using makefile :" << m_sMakeFile );
-		// Does default exists. If not we need to run "wrapper make"
-		if ( ! FileExists( sDefaultMakeFile.c_str() ) )
-		{
-			// Run the wrapper make to create "real" makefile
-			string sMakeFileCmd;
-			sMakeFileCmd.append("make -f \"");
-			sMakeFileCmd.append( m_sMakeFile );
-			sMakeFileCmd.append( "\"" );
-			LOG_STRING( "using makefile :" << m_sMakeFile );
-			cout << AT_MSG_SYSTEM_CALL << sMakeFileCmd << endl;
-			int iRet = (int)system( sMakeFileCmd.c_str() );
-			if ( iRet )
-			{
-				cout << MAKE_ERROR;
-				return false;
-			}
-		}
-		m_sMakeFile = sDefaultMakeFile;
-		// Open new file
-		in.open( m_sMakeFile.c_str(), ios_base::in );
-		// Check that it's open
-		if ( ! in.good() )
-		{
-			// Cannot open file
-			cout << AT_MSG << "Error, can not open makefile: " << m_sMakeFile << endl;
-			return false;
-		}
-	}
-	in.seekg( ios_base::beg );
-
-	// Number of lines to read at max for basic module information.
-	int iReadLineCount = 20;
-	// Extension from target line. to be compared with targettype.
-	string sTargetExtension;
-	// Read line at a time. Loop until we find it or eof
-	do {
-		// Read line from file to array
-		in.getline( cLine, MAX_LINE_LENGTH );
-		iReadLineCount--;
-
-		sLine.clear();
-		// Put that to string
-		sLine.append( cLine );
-		// Search target
-		if ( sLine.find( MAKEFILE_TARGET_STRING ) != string::npos )
-		{
-			// Found it. Now remove other than type from line
-			sLine.erase( 0, strlen( MAKEFILE_TARGET_STRING ) );
-			ChangeToLower( sLine );
-			sTargetExtension.clear();
-			sTargetExtension = GetExtension( sLine );
-			m_sTarget = RemovePathAndExt( sLine, true);
-			LOG_STRING("found target: " << sLine );
-		}
-		// Search targettype
-		else if ( sLine.find( MAKEFILE_TARGETTYPE_STRING ) != string::npos )
-		{
-			// Found it. Now remove other than type from line
-			sLine.erase( 0, strlen( MAKEFILE_TARGETTYPE_STRING ) );
-			ChangeToLower( sLine );
-			m_sTargetType = sLine;
-			LOG_STRING("found target type: " << m_sTargetType );
-		}
-		else if ( sLine.find( MAKEFILE_BASIC_TARGETTYPE_STRING ) != string::npos )
-		{
-			sLine.erase( 0, strlen( MAKEFILE_BASIC_TARGETTYPE_STRING ) );
-			ChangeToLower( sLine );
-			m_sRequestedTargetExt = sLine;
-			// Compare with the extension in target line if not same use target lines if its "valid".
-			if ( m_sRequestedTargetExt.compare( sTargetExtension ) != 0  && sTargetExtension.size() > 0 )
-				m_sRequestedTargetExt = sTargetExtension;
-			LOG_STRING("found requested target extension: " << m_sTargetType );		
-		}
-		// Feature variant details
-		else if ( sLine.find( MAKEFILE_FEATURE_VARIANT_NAME ) != string::npos )
-		{
-			sLine.erase( 0, strlen( MAKEFILE_FEATURE_VARIANT_NAME ) );
-			m_sFeatureVariantName = sLine;
-			LOG_STRING("found feature variant name: " << sLine );
-		}
-		else if ( sLine.find( MAKEFILE_FEATURE_VARIANT_UREL_LABEL ) != string::npos )
-		{
-			sLine.erase( 0, strlen( MAKEFILE_FEATURE_VARIANT_UREL_LABEL ) );
-			LOG_STRING("found feature variant urel label: " << sLine );
-			if ( sLine.compare("INVARIANT") != 0 )
-				m_sFeatureVariantURELLabel = sLine;
-		}
-		else if ( sLine.find( MAKEFILE_FEATURE_VARIANT_UDEB_LABEL ) != string::npos )
-		{
-			sLine.erase( 0, strlen( MAKEFILE_FEATURE_VARIANT_UDEB_LABEL ) );
-			LOG_STRING("found feature variant udeb label: " << sLine );
-			if ( sLine.compare("INVARIANT") != 0 )
-				m_sFeatureVariantUDEBLabel = sLine;
-		}
-	} while( in.good() && iReadLineCount > 0 );
-
-	// Search compile definitions
-	// CWDEFS CCDEFS ARMCCDEFS
-	do
-	{
-		in.getline( cLine, MAX_LINE_LENGTH );
-		sLine.clear();
-		sLine.append( cLine );
-		if ( sLine.substr( 0 , 6 ).compare( string("CWDEFS") ) == 0 
-			|| sLine.substr( 0 , 6 ).compare( string("CCDEFS") ) == 0 )
-		{
-			sLine.erase( 0, 8 );
-			m_sCompileDefinitions = sLine;
-			break;
-		}
-		else if( sLine.substr( 0 , 9 ).compare( string("ARMCCDEFS") ) == 0  )
-		{
-			sLine.erase( 0, 11 );
-			m_sCompileDefinitions = sLine;
-			break;
-		}
-	} while( in.good() );
-	// Move reading back to start if we could not find compile flags.
-	in.seekg( ios_base::beg );
-
-	// Search listing information (modules source files).
-	int iFindItem = 1; //1 = Source, 2 = LISTINGUDEB/UREL, 3 = lst file
-	string sCdefs;
-	string sSource;
-	string sLst;
-	do
-	{
-		in.getline( cLine, MAX_LINE_LENGTH );
-		sLine.clear();
-		sLine.append( cLine );
-
-		switch( iFindItem )
-		{
-			case 1:
-				if( sLine.find( "# Source " ) != string::npos )
-				{
-					iFindItem = 2;
-					// Remove text "# Source "
-					sLine.erase( 0, 9 );
-					sSource = sLine;
-				}
-			break;
-			case 2:
-				if( IsUDEB() )
-				{
-					if( sLine.find( "LISTINGUDEB" ) != string::npos )
-					{
-						iFindItem = 3;
-					}
-				}
-				else
-				{
-					if( sLine.find( "LISTINGUREL" ) != string::npos )
-					{
-						iFindItem = 3;
-					}
-				}
-			break;
-			case 3:
-				if( sLine.find( "perl -S ecopyfile.pl" ) != string::npos )
-				{
-					// Save lst file to list
-					sLine.erase( 0, ( sLine.find_first_of( "\\" ) ) );
-					// remove last char if '"'
-					if ( sLine.at( sLine.size()-1 ) == '"' )
-						sLine.erase( sLine.size()-1, sLine.size() );
-					sLst = sLine;
-					AddSource( sSource, sLst );
-					iFindItem = 1;
-					sSource.clear(); sLst.clear();
-					
-				}
-			break;
-		}
-	}
-	while( in.good() );
-	// close and return
-	in.close();
-	return true;
-}
-
-// ----------------------------------------------------------------------------
-// Get & Sets
-// ----------------------------------------------------------------------------
-string CATModule2::GetErrors() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetErrors");
-	return m_sErrors;
-}
-
-string CATModule2::GetS60FileName() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetS60FileName");
-	if ( m_sS60FileName.empty() )
-	{
-		string sGeneratedDatName = m_sTarget;
-		sGeneratedDatName.append(".");
-		sGeneratedDatName.append( m_sTargetType );
-		sGeneratedDatName.append(".dat");
-		return sGeneratedDatName;
-	}
-	return m_sS60FileName;
-}
-
-string CATModule2::GetLstNameOfSource(string sSource) const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetLstNameOfSource");
-	// Find . before xtension
-	size_t iSpot = sSource.find_last_of( "." );
-	// Get sub string to there
-	string sLst = sSource.substr(0, iSpot+1);
-	if ( m_sVariantPlatform.compare( "winscw" ) != 0 )
-	{
-		// Add variant platform (i.e. armv5)
-		sLst.append( m_sVariantPlatform );
-		sLst.append( "." );
-		// Add variant type (i.e. build type liek urel)
-		sLst.append( m_sVariantType );
-		sLst.append( "." );
-		// Add target binary name
-		sLst.append( m_sTarget );
-		sLst.append( "." );
-		// Add target requested binary extension
-		sLst.append( m_sRequestedTargetExt );
-		sLst.append( "." );
-		// Add lst extension
-		sLst.append( "lst" );
-	}
-	else
-	{
-		sLst.append( "WINSCW.lst" );
-	}
-	return sLst;
-}
-
-bool CATModule2::IsPlatformArmv5() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::IsPlatformArmv5");
-	if ( _stricmp( m_sVariantPlatform.c_str(), "armv5" ) == 0 )
-		return true;
-	return false;
-}
-
-string CATModule2::GetMapFile() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetMapFile");
-	// Map file with path using variables
-	string sMapFile( m_sReleasePath );
-	if ( ! sMapFile.empty() )
-		sMapFile.append( "\\" );
-	sMapFile.append( m_sFullVariantPath );
-	if ( ! m_sFullVariantPath.empty() )
-		sMapFile.append( "\\" );
-	sMapFile.append( m_sTarget );
-	sMapFile.append( "." );
-	// Possible feature variant. Note debug might not be defined
-	// when release has got one.
-	if ( IsUDEB() && !m_sFeatureVariantUDEBLabel.empty() )
-	{
-		sMapFile.append( m_sFeatureVariantUDEBLabel );
-		sMapFile.append( "." );
-	}
-
-	if ( !IsUDEB() && !m_sFeatureVariantURELLabel.empty() )
-	{
-		sMapFile.append( m_sFeatureVariantURELLabel );
-		sMapFile.append( "." );
-	}
-	sMapFile.append( m_sRequestedTargetExt );
-	sMapFile.append( ".map" );
-	return sMapFile;
-}
-
-string CATModule2::GetSymbolFile() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetSymbolFile");
-	// Symbol file with path using variables
-	string sSymbolFile( m_sReleasePath );
-	sSymbolFile.append( "\\" );
-	sSymbolFile.append( m_sFullVariantPath );
-	sSymbolFile.append( "\\" );
-	sSymbolFile.append( m_sTarget );
-	sSymbolFile.append( "." );
-	// Possible feature variant.
-	if ( ! m_sFeatureVariantUDEBLabel.empty() || ! m_sFeatureVariantURELLabel.empty() )
-	{
-		if ( IsUDEB() )
-			sSymbolFile.append( m_sFeatureVariantUDEBLabel );
-		else
-			sSymbolFile.append( m_sFeatureVariantURELLabel );
-		sSymbolFile.append( "." );
-	}
-	
-	if ( m_eBuildSystem == CATProject::SBS_V1 )
-	{
-		sSymbolFile.append( "sym" );
-		return sSymbolFile;
-	}
-	sSymbolFile.append( m_sRequestedTargetExt );
-	sSymbolFile.append( ".sym" );
-	return sSymbolFile;
-}
-
-string CATModule2::GetBinaryFile() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetBinaryFile");
-	// Binary file with path using variables
-	string sBinaryFile( m_sReleasePath );
-	if ( ! sBinaryFile.empty() )
-		sBinaryFile.append( "\\" );
-	sBinaryFile.append( m_sFullVariantPath );
-	if ( ! m_sFullVariantPath.empty() )
-		sBinaryFile.append( "\\" );
-	sBinaryFile.append( m_sTarget );
-	sBinaryFile.append( "." );
-	// Possible feature variant.
-	if ( ! m_sFeatureVariantUDEBLabel.empty() || ! m_sFeatureVariantURELLabel.empty() )
-	{
-		if ( IsUDEB() )
-			sBinaryFile.append( m_sFeatureVariantUDEBLabel );
-		else
-			sBinaryFile.append( m_sFeatureVariantURELLabel );
-		sBinaryFile.append( "." );
-	}
-	sBinaryFile.append( m_sRequestedTargetExt );
-	return sBinaryFile;
-}
-
-bool CATModule2::SetMmpFile(const string& sMmpFile)
-{
-	LOG_FUNC_ENTRY("CATModule2::SetMmpFile");
-	// Set mmp file
-	m_Mmp.m_sMmpFile = sMmpFile;
-	// Change to lower
-	ChangeToLower( m_Mmp.m_sMmpFile );
-	// Convert
-	ConvertUnixPathToWin( m_Mmp.m_sMmpFile );
-	// Set the temporary path.
-	m_sTempPath.clear();
-	m_sTempPath = CreateTempPath( m_Mmp.m_sMmpFile );
-	return true;
-}
-
-bool CATModule2::CreateTemporaryDirectory()
-{
-	LOG_FUNC_ENTRY("CATModule2::CreateTemporaryDirectory");
-	if ( m_sTempPath.empty() )
-	{
-		LOG_STRING("Temporary path is not set.");
-		return false;
-	}
-	// Create temp dir if not exists
-	if ( ! DirectoryExists( m_sTempPath.c_str() ) )
-	{
-		if ( !CreateDirectory( m_sTempPath.c_str(), NULL ) )
-		{
-			cout << AT_MSG << "Error, can not create directory: "
-				<< m_sTempPath << endl;
-			return false;
-		}
-		cout << AT_MSG << "Directory created: " << m_sTempPath << endl;
-	}
-	return true;
-}
-
-void CATModule2::SetMakeFile( const string& sMakeFile )
-{
-	LOG_FUNC_ENTRY("CATModule2::SetMakeFile");
-	m_sMakeFile = sMakeFile;
-}
-string CATModule2::GetMakeFile() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetMakeFile");
-	return m_sMakeFile;
-}
-string CATModule2::GetMmpFile() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetMmpFile");
-	return m_Mmp.m_sMmpFile;
-}
-string CATModule2::GetTempPath() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetTempPath");
-	return m_sTempPath;
-}
-void CATModule2::SetTarget(const string& sTarget)
-{
-	LOG_FUNC_ENTRY("CATModule2::SetTarget");
-	m_sTarget = sTarget;
-	ChangeToLower( m_sTarget );
-}
-string CATModule2::GetTarget() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetTarget");
-	return m_sTarget;
-}
-string CATModule2::GetBinaryName() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetBinaryName");
-	string sBinaryName;
-	sBinaryName.append( m_sTarget );
-	sBinaryName.append( "." );
-	sBinaryName.append( m_sRequestedTargetExt );
-	return sBinaryName;
-}
-
-void CATModule2::SetTargetType(const string& sTargetType)
-{
-	LOG_FUNC_ENTRY("CATModule2::SetTargetType");
-	m_sTargetType = sTargetType;
-	ChangeToLower( m_sTargetType );
-}
-string CATModule2::GetTargetType() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetTargetType");
-	return m_sTargetType;
-}
-void CATModule2::SetRequestedTargetExt( const string& sRequestedTargetExt )
-{
-	LOG_FUNC_ENTRY("CATModule2::SetRequestedTargetExt");
-	m_sRequestedTargetExt = sRequestedTargetExt;
-	ChangeToLower( m_sRequestedTargetExt );
-}
-
-string CATModule2::GetRequestedTargetExt() const
-{
-	LOG_LOW_FUNC_ENTRY("CATmodule2::GetRequestedTargetExt");
-	return m_sRequestedTargetExt;
-}
-
-void CATModule2::SetVariantPlatform(const string& sVariantPlatform)
-{
-	LOG_FUNC_ENTRY("CATModule2::SetVariantPlatform");
-	m_sVariantPlatform = sVariantPlatform;
-	ChangeToLower( m_sVariantPlatform );
-}
-string CATModule2::GetVariantPlatform() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetVariantPlatform");
-	return m_sVariantPlatform;
-}
-void CATModule2::SetVariantType(const string& sVariantType)
-{
-	LOG_FUNC_ENTRY("CATModule2::SetVariantType");
-	m_sVariantType = sVariantType;
-	ChangeToLower( m_sVariantType );
-}
-string CATModule2::GetVariantType() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetVariantType");
-	return m_sVariantType;
-}
-void CATModule2::SetFeatureVariant(const string& sFeatureVariant)
-{
-	LOG_FUNC_ENTRY("CATModule2::SetFeatureVariant");
-	m_sFeatureVariant = sFeatureVariant;
-	ChangeToLower( m_sFeatureVariant );
-}
-string CATModule2::GetFeatureVariant() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetFeatureVariant");
-	return m_sFeatureVariant;
-}
-void CATModule2::SetFeatureVariantName(const string& sFeatureVariantName)
-{
-	LOG_FUNC_ENTRY("CATModule2::SetFeatureVariantName");
-	m_sFeatureVariantName = sFeatureVariantName;
-	ChangeToLower( m_sFeatureVariantName );
-}
-string CATModule2::GetFeatureVariantName() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetFeatureVariantName");
-	return m_sFeatureVariantName;
-}
-void CATModule2::SetReleasePath(const string& sReleasePath)
-{
-	LOG_FUNC_ENTRY("CATModule2::SetReleasePath");
-	m_sReleasePath = sReleasePath;
-	ChangeToLower( m_sReleasePath );
-	ConvertUnixPathToWin( m_sReleasePath );
-
-}
-string CATModule2::GetReleasePath() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetReleasePath");
-	return m_sReleasePath;
-}
-void CATModule2::SetFullVariantPath(const string& sFullVariantPath)
-{
-	LOG_FUNC_ENTRY("CATModule2::SetFullVariantPath");
-	m_sFullVariantPath = sFullVariantPath;
-	ChangeToLower( m_sFullVariantPath );
-	ConvertUnixPathToWin( m_sFullVariantPath );
-}
-string CATModule2::GetFullVariantPath() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetFullVariantPath");
-	return m_sFullVariantPath;
-}
-string CATModule2::GetUniqueId() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetUniqueId");
-	return FilterString( m_sTarget );
-}
-void CATModule2::SetBuildSystem( int eBuildSystem )
-{
-	LOG_FUNC_ENTRY("CATModule2::SetBuildSystem");
-	m_eBuildSystem = eBuildSystem;
-}
-
-int CATModule2::GetBuildSystem() const
-{
-	LOG_LOW_FUNC_ENTRY("CATModule2::GetBuildSystem");
-	return m_eBuildSystem;
-}
-
-void CATModule2::SetCompileDefinitions( const string& sCompileDefinitions )
-{
-	LOG_LOW_FUNC_ENTRY( "CATModule2::SetCompileDefinitions" );
-	m_sCompileDefinitions = sCompileDefinitions;
-}
-
-string CATModule2::GetCompileDefinitions() const
-{
-	LOG_LOW_FUNC_ENTRY( "CATModule2::GetCompileDefinitions" );
-	return m_sCompileDefinitions;
-}
-
-void CATModule2::SetCompileInfoText( string sCompileInfoText )
-{
-	LOG_LOW_FUNC_ENTRY( "CATModule2::SetCompileInfoText" );
-	m_sCompileInfoText = sCompileInfoText;
-}
-string CATModule2::GetCompileInfoText() const
-{
-	LOG_LOW_FUNC_ENTRY( "CATModule2::GetCompileInfoText" );
-	return m_sCompileInfoText;
-}
-//EOF
--- a/analyzetool/commandlineengine/src/CATParseTraceFile.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,585 +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:  Definitions for the class CATParseTraceFile.
-*
-*/
-
-
-#include "../inc/ATCommonDefines.h"
-#include "../inc/CATParseTraceFile.h"
-#include "../inc/catdatasaver.h"
-#include "../inc/CATDatParser.h"
-
-#include <time.h>
-
-#define MAIN_ID "PCSS"
-#define ALLOC_ID "ALLOC" // < V.1.6 allocation.
-#define ALLOCH_ID "ALLOCH" // Header of multi message allocation.
-#define ALLOCF_ID "ALLOCF" // Fragment of multi message allocation.
-#define FREE_ID "FREE"
-#define FREEH_ID "FREEH" // Header of multi message free.
-#define FREEF_ID "FREEF" // Fragment of multi message free.
-#define HANDLE_LEAK_ID "HANDLE_LEAK"
-
-const string ERROR_OCCURED = "ERROR_OCCURED"; // Error messages.
-const string INCORRECT_ATOOL_VERSION = "INCORRECT_ATOOL_VERSION";
-/**
-* Invalid characters in trace file line content.
-* These will be filtered out before actuall parsing of line.
-10 = LF
-13 = CR
-124 = |
-*/
-const char cINVALID_TRACE_FILE_CHARS[] = { 10, 13, 124 };
-
-// -----------------------------------------------------------------------------
-// CATParseTraceFile::CATParseTraceFile
-// Constructor.
-// -----------------------------------------------------------------------------
-CATParseTraceFile::CATParseTraceFile()
-{
-	LOG_FUNC_ENTRY("CATParseTraceFile::CATParseTraceFile");
-	m_DataSaver.SetPrintFlag( false );
-}
-
-// -----------------------------------------------------------------------------
-// CATParseTraceFile::StartParse
-// Main function to start trace parsing.
-// -----------------------------------------------------------------------------
-bool CATParseTraceFile::StartParse( const char* pFileName, const char* pOutputFileName )
-{
-	LOG_FUNC_ENTRY("CATParseTraceFile::StartParse");
-
-	// Return value, will be changed to true if process start found.
-	bool bRet = false;
-
-	// Check pointers
-	if ( pFileName == NULL  )
-		return bRet;
-
-	if( pOutputFileName == NULL )
-		return bRet;
-
-	if ( ! FileExists( pFileName ) )
-	{
-		cout << AT_MSG << "Error, input file \""
-			<< pFileName
-			<< "\" does not exist." << endl;
-		return bRet;
-	}
-
-	// Open data file
-	ifstream in( pFileName );
-
-	// Check file opened ok
-	if ( !in.good() )
-		return false;
-
-	// Get stream size
-	size_t streamPos = in.tellg();
-	in.seekg( 0, ios::end);
-	size_t streamEnd = in.tellg();
-	in.seekg( 0, ios::beg);
-
-	//Origianl characters (not filtered).
-	char cOriginalLineFromFile[MAX_LINE_LENGTH];
-
-	vector<CProcessData> vProcessList;
-	int iProcessIDinList = -1;
-
-	bool bFileVersionSaved = false;
-	// Read lines
-	while( streamPos < streamEnd )
-	{
-		// Get one line. Don't use stream flags to determinate end of file
-		// it can be found too early because trace can contain "anything".
-		in.getline( cOriginalLineFromFile, MAX_LINE_LENGTH );
-		
-		// Refresh position
-		streamPos = in.tellg();
-
-		// Check has bad bit flag raised. (i.e. device problems reading data)
-		if( in.bad() )
-		{
-			cout << AT_MSG << "Integrity error reading the trace file, reading aborted." << endl;
-			return false;
-		}
-		//Filtered characters.
-		char cLineFromFile[MAX_LINE_LENGTH];
-		char* pFiltered = cLineFromFile;
-
-		//Loop thru all characters in original line.
-		for( size_t i = 0 ; cOriginalLineFromFile[i] != 0 ; i++ )
-		{
-			//If character in line is not in invalid character array append it
-			//to filtered line.
-			if ( strchr( cINVALID_TRACE_FILE_CHARS, cOriginalLineFromFile[i] ) == 0 )
-					*pFiltered++ =  cOriginalLineFromFile[i];
-		}
-		*pFiltered++ = 0; //Add null termination to filtered line.
-
-		if( !bFileVersionSaved && *cLineFromFile != 0 )
-		{
-			bFileVersionSaved = true;
-			m_DataSaver.AddString( AT_DATA_FILE_VERSION );
-			m_DataSaver.AddLineToLast();
-		}
-
-		// Is there main ID?
-		if( strstr( cLineFromFile, MAIN_ID ) != NULL )
-		{
-			string sRestOfLine( cLineFromFile );
-			string sTemp;
-
-			// Delete all characters before main ID
-			sRestOfLine.erase( 0, sRestOfLine.find( MAIN_ID ) );
-
-			// Get main ID
-			sTemp = GetStringUntilNextSpace( sRestOfLine );
-
-			// Is there more data in line?
-			if( sRestOfLine.empty() )
-			{
-				continue;
-			}
-
-			// Get next argument
-			sTemp = GetStringUntilNextSpace( sRestOfLine );
-			// This might be process id or error message
-			if ( sTemp.compare( ERROR_OCCURED ) == 0 )
-			{
-				// Api mismatch between s60 side and atool.exe
-				if ( sRestOfLine.find( INCORRECT_ATOOL_VERSION ) != string::npos )
-				{
-					cout << "Test run failed because version conflict between device binaries\nand the atool.exe version used to build the application." << endl;
-					size_t pS = sRestOfLine.find_first_of('[');
-					size_t pE =  sRestOfLine.find_first_of(']');
-					size_t pSL = sRestOfLine.find_last_of('[');
-					size_t pEL = sRestOfLine.find_last_of(']');
-					if ( pS != string::npos && pE != string::npos && pSL != string::npos && pEL != string::npos )
-					{
-						string deviceVer = sRestOfLine.substr( pS+1, pE-pS-1 );
-						string atoolVer = sRestOfLine.substr( pSL+1, pEL-pSL-1 );
-						cout << "\tdevice: " << deviceVer << endl 
-							<<  "\tatool.exe: " << atoolVer << endl;
-					}
-				}
-				else
-					cout << sRestOfLine << endl;
-				continue;
-			}
-			unsigned long iProcessID = _httoi( sTemp.c_str() );
-
-			iProcessIDinList = -1;
-			// Find process from list
-			for( unsigned int i = 0 ; i < vProcessList.size() ; i++ )
-			{
-				if( vProcessList[i].iProcessID == iProcessID )
-				{
-					iProcessIDinList = i;
-					break;
-				}
-			}
-			// Is Process ID found from list?
-			if( iProcessIDinList == -1 )
-			{
-				CProcessData ProcessData;
-				ProcessData.bProcessOnGoing = false;
-				ProcessData.iProcessID = iProcessID;
-				vProcessList.push_back( ProcessData );
-				iProcessIDinList = (int)vProcessList.size() - 1;
-			}
-
-			// Remove spaces from end of line
-			while( sRestOfLine[sRestOfLine.size()-1] == ' ' )
-			{
-				sRestOfLine.resize( sRestOfLine.size()-1 );
-			}
-
-			string sWholeTempLine( sRestOfLine );
-
-			// Get command
-			sTemp = GetStringUntilNextSpace( sRestOfLine );
-
-			// Use c style string for easy comparisong of command.
-			const char* pCommand = sTemp.c_str();		
-
-			// Process start.
-			if( ! _stricmp( pCommand, LABEL_PROCESS_START ) )
-			{
-				bRet = true; // Set return value true we found start.
-				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
-				vProcessList[iProcessIDinList].bProcessOnGoing = true;
-				continue;
-			}
-
-			// Check is process ongoing if not skip other tags.
-			if( vProcessList[iProcessIDinList].bProcessOnGoing == false )
-				continue;
-
-			// "Old style" allocation (< v.1.6)
-			if( ! _stricmp( pCommand, ALLOC_ID ) )
-			{
-				// Add alloc
-				vProcessList[iProcessIDinList].Alloc( sRestOfLine );
-
-				// 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 ) )
-			{
-				// Add alloc
-				vProcessList[iProcessIDinList].AllocH( sRestOfLine );
-
-				// 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->AllocH( sRestOfLine );
-					}
-					viSubTestIter++;
-				}
-			}
-			// Allocation fragment (call stack).
-			else if ( ! _stricmp( pCommand, ALLOCF_ID ) )
-			{
-				// Add alloc fragment
-				vProcessList[iProcessIDinList].AllocF( sRestOfLine );
-				
-				// Subtests running?
-				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
-				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
-				{
-					if( viSubTestIter->bRunning )
-					{
-						// Save alloc fragment also to sub test
-						viSubTestIter->AllocF( sRestOfLine );
-					}
-					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.
-			else if( ! _stricmp( pCommand, FREEH_ID ) )
-			{
-				// Send free
-				vProcessList[iProcessIDinList].FreeH( 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->FreeH( sRestOfLine );
-					}
-					viSubTestIter++;
-				}
-			
-			}
-			else if( ! _stricmp( pCommand, FREEF_ID ) )
-			{
-				// Not used currently.
-			}
-			// Command process end
-			else if( ! _stricmp( pCommand, LABEL_PROCESS_END ) )
-			{
-				// Set process has ended.
-				vProcessList[iProcessIDinList].bProcessOnGoing = false;
-
-				// Save leaks
-				vector<string> vLeaks;
-				vector<string>::iterator viLeaks;
-				vProcessList[iProcessIDinList].GetLeakList( vLeaks );
-				for ( viLeaks = vLeaks.begin(); viLeaks != vLeaks.end(); viLeaks++ )
-				{
-					sTemp.clear();
-					sTemp.append( LABEL_MEM_LEAK );
-					sTemp.append( " " );
-					sTemp.append( *viLeaks );
-					vProcessList[iProcessIDinList].vData.push_back( sTemp );
-				}
-				vProcessList[iProcessIDinList].ClearAllocs();
-
-				vector<string>::iterator viHandleIter = vProcessList[iProcessIDinList].vHandleLeaks.begin();
-				// Print handle leaks
-				while( viHandleIter != vProcessList[iProcessIDinList].vHandleLeaks.end() )
-				{
-					sTemp.clear();
-					sTemp.append( viHandleIter->c_str() );
-					vProcessList[iProcessIDinList].vData.push_back( sTemp );
-					viHandleIter++;
-				}
-				// Clear handle leaks from list
-				vProcessList[iProcessIDinList].vHandleLeaks.clear();
-
-				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
-				// Print sub test leaks
-				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
-				{
-					// Print sub test start
-					string sLine( LABEL_TEST_START ); sLine.append( " " );
-					sLine.append( viSubTestIter->sStartTime ); sLine.append( " " );
-					sLine.append( viSubTestIter->sSubTestName ); sLine.append( " " );
-					sLine.append( viSubTestIter->sSubTestStartHandleCount );
-					vProcessList[iProcessIDinList].vData.push_back( sLine );
-					sLine.clear();
-
-					// DLL Loads.
-					for( vector<string>::iterator it = viSubTestIter->vData.begin();
-						it != viSubTestIter->vData.end(); it++ )
-					{
-						vProcessList[iProcessIDinList].vData.push_back( (*it) );
-					}
-
-					// Subtest leaks.
-					vector<string> vSubLeaks;
-					vector<string>::iterator viSubLeaks;
-					viSubTestIter->GetLeakList( vSubLeaks );
-					for ( viSubLeaks = vSubLeaks.begin(); viSubLeaks != vSubLeaks.end(); viSubLeaks++ )
-					{
-						sLine.append( LABEL_MEM_LEAK );
-						sLine.append( " " );
-						sLine.append( *viSubLeaks );
-						vProcessList[iProcessIDinList].vData.push_back( sLine );
-						sLine.clear();
-					}
-					viSubTestIter->ClearAllocs();
-
-					if( !viSubTestIter->sEndTime.empty() )
-					{
-						// Print sub test end
-						sLine.append( LABEL_TEST_END ); sLine.append( " " );
-						sLine.append( viSubTestIter->sEndTime ); sLine.append( " " );
-						sLine.append( viSubTestIter->sSubTestName ); sLine.append( " " );
-						sLine.append( viSubTestIter->sSubTestEndHandleCount );
-						vProcessList[iProcessIDinList].vData.push_back( sLine );
-					}
-					viSubTestIter++;
-				}
-
-				// Clear sub tests from list
-				vProcessList[iProcessIDinList].vSubTests.clear();
-				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
-			}
-			else if( ! _stricmp( pCommand, LABEL_HANDLE_LEAK ) )
-			{
-				// Make whole line
-				sTemp.append( " " );
-				sTemp.append( sRestOfLine );
-				vProcessList[iProcessIDinList].vHandleLeaks.push_back( sTemp );
-			}
-			else if( ! _stricmp( pCommand, LABEL_DLL_LOAD ) )
-			{
-				// Add module load to process data.
-				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
-				// Add module load to subtest data if test running.
-				for( vector<CSubTestData>::iterator it = vProcessList[iProcessIDinList].vSubTests.begin();
-					it != vProcessList[iProcessIDinList].vSubTests.end(); it++ )
-				{
-					if( it->bRunning )
-						it->vData.push_back( sWholeTempLine );
-				}
-
-			}
-			else if( ! _stricmp( pCommand, LABEL_DLL_UNLOAD ) )
-			{
-				// Add module load to process data.
-				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
-				// Add module unload to subtest data if test running.
-				for( vector<CSubTestData>::iterator it = vProcessList[iProcessIDinList].vSubTests.begin();
-					it != vProcessList[iProcessIDinList].vSubTests.end(); it++ )
-				{
-					if( it->bRunning )
-						it->vData.push_back( sWholeTempLine );
-				}
-			}
-			else if( sTemp.find( LABEL_LOGGING_CANCELLED ) != string::npos ||
-				     sTemp.find( LABEL_PROCESS_END ) != string::npos || sTemp.find( LABEL_ERROR_OCCURED ) != string::npos ||
-					 sTemp.find( LABEL_HANDLE_LEAK ) != string::npos )
-			{
-				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
-			}
-			else if( ! _stricmp( pCommand, LABEL_TEST_START ) )
-			{
-				bRet = true; // Set return value true we found start.
-				// Get sub test time
-				string sSubTestTime = GetStringUntilNextSpace( sRestOfLine );
-				// Get sub test name
-				string sSubTestName = GetStringUntilNextSpace( sRestOfLine );
-				// Get sub test start handle count
-				string sSubTestStartHandleCount = GetStringUntilNextSpace( sRestOfLine );
-
-				CSubTestData SubTestData;
-				SubTestData.bRunning = true;
-				SubTestData.sStartTime = sSubTestTime;
-				SubTestData.sSubTestName = sSubTestName;
-				SubTestData.sSubTestStartHandleCount = sSubTestStartHandleCount.c_str();
-
-				vProcessList[iProcessIDinList].vSubTests.push_back( SubTestData );
-			}
-			else if( ! _stricmp( pCommand, LABEL_TEST_END ) )
-			{
-				// Get sub test time
-				string sSubTestEnd = GetStringUntilNextSpace( sRestOfLine );
-				// Get sub test name
-				string sSubTestName = GetStringUntilNextSpace( sRestOfLine );
-				// Get sub test end handle count
-				string sSubTestEndHandleCount = GetStringUntilNextSpace( sRestOfLine );
-
-				// Find subtest
-				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
-				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
-				{
-					if( viSubTestIter->sSubTestName == sSubTestName && viSubTestIter->sEndTime.empty() )
-					{
-						viSubTestIter->sEndTime = sSubTestEnd;
-						viSubTestIter->bRunning = false;
-						viSubTestIter->sSubTestEndHandleCount = sSubTestEndHandleCount.c_str();
-					}
-					viSubTestIter++;
-				}
-			}
-		}
-	}
-
-	// Print all saved data from processes
-	for( unsigned int i = 0 ; i < vProcessList.size() ; i++ )
-	{
-		// Print saved lines
-		for( unsigned int iDataCounter = 0 ; iDataCounter < vProcessList[i].vData.size() ; iDataCounter++ )
-		{
-			m_DataSaver.AddString( vProcessList[i].vData[iDataCounter].c_str() );
-			m_DataSaver.AddLineToLast();
-		}
-
-		string sTemp;
-
-		// Save leaks
-		vector<string> vLeaks;
-		vector<string>::iterator viLeaks;
-		vProcessList[i].GetLeakList( vLeaks );
-		for ( viLeaks = vLeaks.begin(); viLeaks != vLeaks.end(); viLeaks++ )
-		{
-			sTemp.clear();
-			sTemp.append( LABEL_MEM_LEAK );
-			sTemp.append( " " );
-			sTemp.append( *viLeaks );
-			m_DataSaver.AddString( sTemp.c_str() );
-			m_DataSaver.AddLineToLast();
-		}
-
-		vector<string>::iterator viHandleIter = vProcessList[i].vHandleLeaks.begin();
-		// Print handle leaks, if there is data left, there was no process end.
-		while( viHandleIter != vProcessList[i].vHandleLeaks.end() )
-		{
-			sTemp.clear();
-			sTemp.append( viHandleIter->c_str() );
-			m_DataSaver.AddString( sTemp.c_str() );
-			m_DataSaver.AddLineToLast();
-			viHandleIter++;
-		}
-		vector<CSubTestData>::iterator viSubTestIter = vProcessList[i].vSubTests.begin();
-		// Print sub test data, if there is data left, there was no process end.
-		while( viSubTestIter != vProcessList[i].vSubTests.end() )
-		{
-			// Print sub test start
-			string sLine( LABEL_TEST_START ); sLine.append( " " );
-			sLine.append( viSubTestIter->sStartTime ); sLine.append( " " );
-			sLine.append( viSubTestIter->sSubTestName ); sLine.append( " " );
-			sLine.append( viSubTestIter->sSubTestStartHandleCount );
-			m_DataSaver.AddString( sLine.c_str() );
-			m_DataSaver.AddLineToLast();
-			sLine.clear();
-
-			// DLL Loads.
-			for( vector<string>::iterator it = viSubTestIter->vData.begin();
-				it != viSubTestIter->vData.end(); it++ )
-			{
-				m_DataSaver.AddString( (*it).c_str() );
-				m_DataSaver.AddLineToLast();
-			}
-
-			// Subtest leaks.
-			vector<string> vSubLeaks;
-			vector<string>::iterator viSubLeaks;
-			viSubTestIter->GetLeakList( vSubLeaks );
-			for ( viSubLeaks = vSubLeaks.begin(); viSubLeaks != vSubLeaks.end(); viSubLeaks++ )
-			{
-				sLine.append( LABEL_MEM_LEAK );
-				sLine.append( " " );
-				sLine.append( *viSubLeaks );
-				m_DataSaver.AddString( sLine.c_str() );
-				m_DataSaver.AddLineToLast();
-				sLine.clear();
-			}
-
-			// Print sub test end
-			sLine.append( LABEL_TEST_END ); sLine.append( " " );
-			sLine.append( viSubTestIter->sEndTime ); sLine.append( " " );
-			sLine.append( viSubTestIter->sSubTestName ); sLine.append( " " );
-			sLine.append( viSubTestIter->sSubTestEndHandleCount );
-			m_DataSaver.AddString( sLine.c_str() );
-			m_DataSaver.AddLineToLast();
-
-			viSubTestIter++;
-		}
-	}
-	// Save lines to file.
-	m_DataSaver.SaveLinesToFile( pOutputFileName, TEXT_DATA );
-	// Close file.
-	in.close();
-	return bRet;
-}
-
-// -----------------------------------------------------------------------------
-// CATParseTraceFile::GetDataSaver
-// Gets data saver object.
-// -----------------------------------------------------------------------------
-CATDataSaver* CATParseTraceFile::GetDataSaver(void)	
-{
-	LOG_LOW_FUNC_ENTRY("CATParseTraceFile::GetDataSaver");
-	return &m_DataSaver;
-}
-//EOF
--- a/analyzetool/commandlineengine/src/CATParseXML.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +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:  Definitions for the class CATParseXML.
-*
-*/
-
-
-#include "../inc/CATParseXML.h"
-#include "../inc/catdatasaver.h"
-#include "../inc/CATBase.h"
-
-#include <xercesc/parsers/XercesDOMParser.hpp>
-
-const char cCanNotFindEpocroot[] = "Can not find EPOCROOT from devices.xml.\n";
-const char cErrorInDeviceXml[] = "Error in devices.xml!\n";
-const char cCanNotFind[] = "Can not find file: %s.\n";
-
-CATParseXML::CATParseXML(void)
-{
-	LOG_FUNC_ENTRY("CATParseXML::CATParseXML");
-	try 
-	{
-		xercesc::XMLPlatformUtils::Initialize();
-	}
-	catch ( ... )
-	{
-		//Print error
-		printf("XML initialization failed.\n");
-	}
-}
-
-CATParseXML::~CATParseXML(void)
-{
-	LOG_FUNC_ENTRY("CATParseXML::~CATParseXML");
-}
-
-// -----------------------------------------------------------------------------
-// CATParseXML::GetEpocRootPathFromXML
-// Find epocroot path in xml file
-// -----------------------------------------------------------------------------
-string CATParseXML::GetEpocRootPathFromXML(const char* pSourcePath)
-{
-	LOG_FUNC_ENTRY("CATParseXML::GetEpocRootPathFromXML");
-	string sEpocRootPath;
-	// Check that source exists
-	if ( ! CATBase::FileExists( pSourcePath ) )
-	{
-		LOG_STRING( "Source xml not found." );
-		return sEpocRootPath;
-	}
-	try 
-	{
-		xercesc::XercesDOMParser* parser = new xercesc::XercesDOMParser();
-		xercesc::DOMDocument* pDomDoc;
-
-		// Get devices.xml document
-		parser->parse( pSourcePath );
-		pDomDoc = parser->getDocument();
-
-		// Get root element
-		xercesc::DOMElement* pRootElem = pDomDoc->getDocumentElement();
-
-		if( pRootElem )
-		{
-			// Get all "device" elements
-			LPWSTR wTemp = CATDataSaver::CharToWChar( "device" );
-			xercesc::DOMNodeList* pDeviceNodeList = pRootElem->getElementsByTagName( wTemp );
-			if( wTemp )
-				delete[] wTemp;
-
-			// Find default SDK
-
-			bool bEpocRootFound = false;
-			int iLength = pDeviceNodeList->getLength();
-			for( int i = 0 ; i < iLength ; i++ )
-			{
-				xercesc::DOMNode* pDeviceNode = pDeviceNodeList->item(i);
-
-				xercesc::DOMNamedNodeMap* pAttributeList = pDeviceNode->getAttributes();
-
-				// Find attribute "default"
-
-				int iAttribListLength = pAttributeList->getLength();
-				for( int x = 0 ; x < iAttribListLength ; x++ )
-				{
-					xercesc::DOMNode* pAttribNode = pAttributeList->item(x);
-					const LPWSTR pNodeName = (const LPWSTR)pAttribNode->getNodeName();
-
-					if( wcscmp( pNodeName, L"default" ) == 0 )
-					{
-						const LPWSTR pNodeValue = (const LPWSTR)pAttribNode->getNodeValue();
-						
-						// Find node value 'yes'
-						if( wcscmp( pNodeValue, L"yes" ) == 0 )
-						{
-							// Find <epocroot> node
-							xercesc::DOMNode* pChildNode = pDeviceNode->getFirstChild();
-							if( !pChildNode )
-								break;
-							while( !bEpocRootFound )
-							{
-								if( wcscmp( pChildNode->getNodeName() , L"epocroot" ) == 0 )
-								{
-									bEpocRootFound = true;
-
-									// Node value is child text node
-									xercesc::DOMNode* pTempTextNode = pChildNode->getFirstChild();
-									const LPWSTR pPathNodeValue = (const LPWSTR)pTempTextNode->getNodeValue();
-
-									CATDataSaver::WCharToChar( sEpocRootPath, pPathNodeValue );
-
-									break;
-								}
-								pChildNode = pChildNode->getNextSibling();
-								if( !pChildNode )
-									break;
-							}
-						} // If node value yes
-					} // If node name default
-					if( bEpocRootFound )
-						break;
-				} // for x
-				if( bEpocRootFound )
-					break;
-			} // for i
-		}
-		if(parser)
-			delete parser; //lint !e118
- 		xercesc::XMLPlatformUtils::Terminate();
-	}
-    catch (...)
-	{
-        printf("XML parsing failed.");
-    }
-	return sEpocRootPath;
-}
-// End of file
--- a/analyzetool/commandlineengine/src/CATProject.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2413 +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:  Class representing a project.
-*
-*/
-
-
-#include "../inc/CATProject.h"
-#include "../inc/CATModule2.h"
-#include "../inc/CATParseTraceFile.h"
-#include "../inc/CATDatParser.h"
-
-//dbghelp.dll version function.
-extern int showDbgHelpVersionInfo( bool showVersion );
-
-// ----------------------------------------------------------------------------
-// CATProject::CATProject()
-// ----------------------------------------------------------------------------
-CATProject::CATProject()
-{
-	LOG_FUNC_ENTRY("CATProject::CATProject");
-
-	m_bUninstrumented = true;
-	m_bAbldTest = false;
-
-	// Use windows api to acquire current directory info.
-	GetCurrentDirectory( MAX_LINE_LENGTH, m_cCurrentDir );
-
-	m_eBuildSystem = SBS_V1;
-	m_eBuildType = UDEB;
-	m_eLoggingMode = TRACE;
-	m_eMode = NOT_DEFINED;
-	
-	m_iLoggingLevel = 3;
-	
-	m_pAnalyzer = 0;
-
-	m_sBinaryTarget = "";
-	m_sBuildCommand = "";
-	m_sDataFile = "";
-	m_sDataFileOutput = "";
-	m_sDataFileTemp = "";
-	m_sEpocRoot = "\\";
-	m_sMakeFile = "";
-	m_sPlatform = "";
-	m_sS60FileName = "";
-	m_sTargetModule = "";
-	m_sVariant = "";
-
-	m_vRomSymbolFiles.clear();
-	m_vModules.clear();
-	m_vStaticLibraries.clear();
-	m_vTargetModules.clear();
-	m_vUnsupportedModules.clear();
-}
-
-// ----------------------------------------------------------------------------
-// CATProject::~CATProject()
-// ----------------------------------------------------------------------------
-CATProject::~CATProject()
-{
-	LOG_FUNC_ENTRY("CATProject::~CATProject");
-
-	CleanModuleVectors();
-
-	// Delete analyzer
-	if ( m_pAnalyzer )
-		delete m_pAnalyzer;
-
-	// Temporary datafile
-	if ( !m_sDataFileTemp.empty() )
-	{
-		if ( FileExists( m_sDataFileTemp.c_str() ) )
-			FileDelete( m_sDataFileTemp, false );
-	}
-}
-
-bool CATProject::SetArguments( ARGUMENTS& arguments )
-{
-	LOG_FUNC_ENTRY("CATProject::SetArguments");
-	bool bRet = true;
-
-	//Project mode.
-	if( arguments.eHookSwitch == HOOK_INTERNAL )
-	{
-		SetMode( CATProject::COMPILE );
-		SetLoggingMode( CATProject::FILE );
-	}
-	else if ( arguments.eHookSwitch == HOOK_EXTERNAL )
-	{
-		SetMode( CATProject::COMPILE );
-		SetLoggingMode( CATProject::TRACE );
-	}
-	else if ( arguments.eHookSwitch == HOOK_EXTERNAL_FAST )
-	{
-		SetMode( CATProject::COMPILE );
-		SetLoggingMode( CATProject::TRACE_FAST );
-	}
-	/* Extension*/
-	else if ( arguments.eHookSwitch == HOOK_EXTENSION_INTERNAL )
-	{
-		SetMode( CATProject::INSTRUMENT );
-		SetLoggingMode( CATProject::FILE );
-	}
-	else if ( arguments.eHookSwitch == HOOK_EXTENSION_EXTERNAL )
-	{
-		SetMode( CATProject::INSTRUMENT );
-		SetLoggingMode( CATProject::TRACE );
-	}
-	else if ( arguments.eHookSwitch == HOOK_EXTENSION_EXTERNAL_FAST )
-	{
-		SetMode( CATProject::INSTRUMENT );
-		SetLoggingMode( CATProject::TRACE_FAST );
-	}
-	else if ( arguments.eHookSwitch == HOOK_EXTENSION_UNINSTRUMENT )
-	{
-		SetMode( CATProject::UNINSTRUMENT );
-	}
-	else if ( arguments.eHookSwitch == HOOK_EXTENSION_FAILED )
-	{
-		SetMode( CATProject::UNINSTRUMENT_FAILED );
-	}
-	//Return if uninstrumenting because no other arguments are set.
-    if ( GetMode() == CATProject::UNINSTRUMENT
-		|| GetMode() == CATProject::UNINSTRUMENT_FAILED )
-	{
-		return bRet;
-	}
-
-	// No build / instrument.
-	if ( arguments.HOOK.bNoBuild )
-		SetMode( CATProject::INSTRUMENT_CONSOLE );
-
-	// Call stack sizes
-	SetAllocCallStackSize( arguments.HOOK.iAllocCallStackSize );
-	SetFreeCallStackSize( arguments.HOOK.iFreeCallStackSize );
-
-	//Build system.
-	if ( arguments.HOOK.iBuildSystem == 1 )
-		SetBuildSystem( CATProject::SBS_V1 );
-	else if ( arguments.HOOK.iBuildSystem == 2 )
-		SetBuildSystem( CATProject::SBS_V2 );
-
-	//Test module build only
-	if ( arguments.HOOK.bAbldTest == true )
-		m_bAbldTest = true;
-
-	//Platform.
-	if ( !_stricmp( arguments.HOOK.sPlatform.c_str(), "armv5" ) )
-		SetPlatform( arguments.HOOK.sPlatform );
-	else if ( !_stricmp( arguments.HOOK.sPlatform.c_str(), "gcce" ) )
-		SetPlatform( arguments.HOOK.sPlatform );
-	else if ( !_stricmp( arguments.HOOK.sPlatform.c_str(), "winscw" ) )
-		SetPlatform( arguments.HOOK.sPlatform );
-	else
-	{
-		LOG_STRING( "Error, no supported platform specified (armv5/gcce/winscw).");
-		bRet = false;
-	}
-
-	//BuildType.
-	if ( !_stricmp( arguments.HOOK.sBuildType.c_str(), "urel" ) )
-		SetBuildType( CATProject::UREL );
-	else if ( !_stricmp( arguments.HOOK.sBuildType.c_str(), "udeb" ) )
-		SetBuildType( CATProject::UDEB );
-	else
-	{
-		LOG_STRING( "Error, no build type specified.");
-		bRet = false;
-	}
-
-	//Internal data file.
-	if ( arguments.HOOK.bDataFileName )
-		SetS60FileName( arguments.HOOK.sDataFileName );
-
-	//Build command.
-	if ( arguments.HOOK.sBuildCmd.empty() && ( 
-		GetMode() == CATProject::COMPILE ||
-		GetMode() == CATProject::INSTRUMENT ||
-		GetMode() == CATProject::INSTRUMENT_CONSOLE
-		))
-	{
-		cout << AT_MSG << "Error, no build command specified." << endl;
-		bRet = false;
-	}
-
-	SetBuildCommand( arguments.HOOK.sBuildCmd );
-
-	//Variant.
-	SetVariant( arguments.HOOK.sFeatureVariant );
-
-	//Target programs.
-	SetTargetModules( arguments.HOOK.vTargetPrograms );
-
-	return bRet;
-}
-
-void CATProject::CleanModuleVectors()
-{
-	LOG_FUNC_ENTRY("CATProject::CleanModuleVectors");
-	// delete modules from vector.
-	for( size_t i = 0; i < m_vModules.size()  ; i++ )
-		delete m_vModules[i];
-	m_vModules.clear();
-	
-	// Delete modules from vector (unsupported).
-	for( size_t i = 0; i < m_vUnsupportedModules.size()  ; i++ )
-		delete m_vUnsupportedModules[i];
-	m_vUnsupportedModules.clear();
-
-	// Delete modules from static library vector.
-	for( size_t i = 0; i < m_vStaticLibraries.size() ; i++ )
-		delete m_vStaticLibraries[i];
-	m_vStaticLibraries.clear();
-}
-// ----------------------------------------------------------------------------
-// CATProject::Run
-// ----------------------------------------------------------------------------
-int CATProject::Run()
-{
-	LOG_FUNC_ENTRY("CATProject::Run");
-	int iReturnCode = 0;
-	switch( m_eMode )
-	{
-	case COMPILE:
-		// Run compile
-		iReturnCode = RunCompile();
-		if ( iReturnCode == AT_RETURN_CODE::READ_MAKEFILE_ERROR
-			|| iReturnCode == AT_RETURN_CODE::KERNEL_SIDE_MODULE_ERROR
-			|| iReturnCode == AT_RETURN_CODE::INVALID_MMP_DEFINED )
-		{
-			DeleteTemporaryDirs();
-			DirDelete( AT_TEMP_DIR, true );
-		}
-		else
-		{
-			DisplayCompileSummary();
-			DisplayBuildSummary();
-		}
-		break;
-	case CLEAN:
-		iReturnCode = RunClean();
-		break;
-	case ANALYZE:
-		iReturnCode = RunAnalyze();
-		break;
-	case INSTRUMENT:
-		iReturnCode = RunInstrument();
-		break;
-	case INSTRUMENT_CONSOLE:
-		iReturnCode = RunInstrumentConsole();
-		if ( iReturnCode == AT_RETURN_CODE::READ_MAKEFILE_ERROR
-			|| iReturnCode == AT_RETURN_CODE::KERNEL_SIDE_MODULE_ERROR )
-		{
-			DeleteTemporaryDirs();
-			DirDelete( AT_TEMP_DIR, true );
-		}
-		else
-		{
-			DisplayBuildSummary();
-		}
-		break;
-	case UNINSTRUMENT:
-		iReturnCode = RunUninstrument();
-		// Show summary
-		DisplayCompileSummary();
-		DisplayBuildSummary();
-		break;
-	case UNINSTRUMENT_CONSOLE:
-		iReturnCode = RunUninstrumentConsole();
-		// Show summary
-		DisplayCompileSummary();
-		DisplayBuildSummary();
-		break;
-	case UNINSTRUMENT_FAILED:
-		iReturnCode = RunUninstrumentFailed();
-		// Display message
-		cout << AT_MSG << "Build aborted, because project contains compile error(s)."
-			<< endl;
-		break;
-	default:
-		cout << AT_MSG << "Error, mode not supported / implemented." << endl;
-		break;
-	}
-	// Error messages
-	switch( iReturnCode )
-	{
-		case AT_RETURN_CODE::MAKEFILE_ERROR:
-			cout << AT_MSG << "Error, creating/reading makefiles." << endl;
-			break;
-		case AT_RETURN_CODE::COMPILE_ERROR:
-			cout << AT_MSG << "Error, compiling project." << endl;
-			break;
-		case AT_RETURN_CODE::UNKNOWN:
-			cout << AT_MSG << "Error, unknown." << endl;
-			break;
-		case AT_RETURN_CODE::WRONG_DATA_FILE_VERSION:
-			cout << AT_MSG << "unable to analyze the data file.\n";
-			cout << AT_MSG << "wrong data file version.\n";
-			break;
-		case AT_RETURN_CODE::INVALID_DATA_FILE:
-			cout << AT_MSG << "Error, invalid datafile." << endl;
-			break;
-		case AT_RETURN_CODE::RELEASABLES_ERROR:
-			cout << AT_MSG << "Error, copying releasable(s)." << endl;
-			break;
-		case AT_RETURN_CODE::RESTORE_MODULES_ERROR:
-			cout << AT_MSG << "Error, restoring mmp file(s)." << endl;
-			break;
-		case AT_RETURN_CODE::CREATING_TEMP_CPP_ERROR:
-			cout << AT_MSG << "Error, creating temporary cpp file(s)." << endl;
-			break;
-		case AT_RETURN_CODE::CLEANING_TEMP_ERROR:
-			cout << AT_MSG << "Error, cleaning temporary dir(s)." << endl;
-			break;
-		case AT_RETURN_CODE::READ_MAKEFILE_ERROR:
-			cout << AT_MSG << "Error, reading makefile." << endl;
-			break;
-		case AT_RETURN_CODE::MODIFY_MODULES_ERROR:
-			cout << AT_MSG << "Error, modifying mmp file(s)." << endl;
-			break;
-		case AT_RETURN_CODE::INVALID_MMP_DEFINED:
-			break;
-		case AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR:
-			cout << AT_MSG << "Error, writing attributes." << endl;
-			break;
-		case AT_RETURN_CODE::READ_ATTRIBUTES_ERROR:
-			cout << AT_MSG << "Error, reading project configuration. Instrument project again." << endl;
-			break;
-		case AT_RETURN_CODE::EMPTY_DATA_FILE:
-			cout << AT_MSG << "Error, no data to be analyzed." << endl;
-			break;
-		case AT_RETURN_CODE::NO_SUPPORTED_MODULES_ERROR:
-			cout << AT_MSG << "Error, no modules found with supported target type." << endl;
-			break;
-		case AT_RETURN_CODE::KERNEL_SIDE_MODULE_ERROR:
-			cout << AT_MSG << "Error, kernel side component found component. Build/instrument aborted." << endl;
-			break;
-	}	
-	return iReturnCode;
-}
-// ----------------------------------------------------------------------------
-// CATProject::RunRecoveryAndExit()
-// Restore modules quick and exit. Used when user wants to kill/end process.
-// ----------------------------------------------------------------------------
-int CATProject::RunRecoveryAndExit()
-{
-	LOG_FUNC_ENTRY("CATProject::RunRecoveryAndExit");
-	cout << AT_MSG << "Error, user requested exit." << endl;
-	VerifyAndRecoverModules();
-	DeleteTemporaryDirs();
-	DirDelete( AT_TEMP_DIR, true );
-	cout << AT_MSG << "Exit." << endl;
-	return AT_RETURN_CODE::USER_ISSUED_EXIT;
-}
-
-// ----------------------------------------------------------------------------
-// CATProject::IsUninstrumented()
-// Reads projects configuration file if it exists. 
-// Return false in case the data contains information that project is
-// uninstrumented. Otherwise returns always true.
-// ----------------------------------------------------------------------------
-bool CATProject::IsUninstrumented()
-{
-	LOG_FUNC_ENTRY("CATProject::IsUninstrumented");
-	string sCfgFile( AT_TEMP_DIR );
-	sCfgFile.append( "\\" );
-	sCfgFile.append( AT_PROJECT_ATTRIBUTES_FILE_NAME );
-	if ( ! FileExists( sCfgFile.c_str() ) )
-		return true;
-	if( !ReadAttributes() )
-	{
-		LOG_STRING( "Error, reading project.cfg file." );
-		return false;
-	}
-	return m_bUninstrumented;
-}
-
-// ----------------------------------------------------------------------------
-// CATProject::RunCompile()
-// Helper functions to run different modes.
-// ----------------------------------------------------------------------------
-int CATProject::RunCompile()
-{
-	LOG_FUNC_ENTRY("CATProject::RunCompile");
-	// Store attributes
-	if( ! MakeTempDirIfNotExist() )
-		return AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
-	if ( ! WriteAttributes() )
-		return AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
-	// Create makefile
-	if ( ! CreateMakeFile() )
-		return AT_RETURN_CODE::MAKEFILE_ERROR;
-	// Read makefile to get project attributes
-	if ( ! ReadMakeFile() )
-		return AT_RETURN_CODE::READ_MAKEFILE_ERROR;
-	// Filter unsupported
-	FilterModules();
-	// Check that we have some "valid" modules to hook
-	if ( m_vModules.size() == 0 &&(  m_vUnsupportedModules.size() > 0 || m_vStaticLibraries.size() > 0 ) )
-		return AT_RETURN_CODE::NO_SUPPORTED_MODULES_ERROR;
-	// Check is possible target module defined in project
-	if ( ! IsTargetModuleInProject() )
-		return AT_RETURN_CODE::INVALID_MMP_DEFINED;
-	// Clean temporary dirs of modules
-	if ( ! CleanTemporaryDirs() )
-		return AT_RETURN_CODE::CLEANING_TEMP_ERROR;
-	// Create temporary cpps for modulse
-	if (! CreateTemporaryCpps() )
-		return AT_RETURN_CODE::CREATING_TEMP_CPP_ERROR;
-	// Hook modules
-	if (! ModifyModules() )
-		return AT_RETURN_CODE::MODIFY_MODULES_ERROR;
-	// Compile all
-	// Return code
-	int iRetCode = AT_RETURN_CODE::OK;
-	// Compile
-	if ( ! Compile() )
-		iRetCode = AT_RETURN_CODE::COMPILE_ERROR;
-	// Listings
-	if (! CreateListings() )
-		iRetCode = AT_RETURN_CODE::COMPILE_ERROR;
-	// Releasables
-	if (! CopyReleasables() )
-		iRetCode = AT_RETURN_CODE::RELEASABLES_ERROR;
-	// Restore "unhook" modules
-	if (! RestoreModules() )
-		iRetCode = AT_RETURN_CODE::RESTORE_MODULES_ERROR;
-	// Return error code OK
-	return iRetCode;
-}
-
-int CATProject::RunClean()
-{
-	LOG_FUNC_ENTRY("CATProject::RunClean");
-	int iRetCode = AT_RETURN_CODE::OK;
-	bool bNothingFound = true;
-	// Read attributes.
-	if (  ReadAttributes() )
-	{
-		bNothingFound = false;
-		if ( m_eBuildSystem == SBS_V1 )
-			InitSbs1MakeFileWithPathToTemp();
-		// Read makefile to get project attributes
-		if( ReadMakeFile() )
-		{
-			// Filter unsupported
-			FilterModules();
-			// Restore modules to make sure no changes left
-			if( VerifyAndRecoverModules() )
-			{
-				// Run reallyclean
-				switch ( m_eBuildSystem )
-				{
-				case SBS_V1:
-					RunReallyCleanSbs1();
-					break;
-				case SBS_V2:
-					RunReallyCleanSbs2();
-					break;
-				default:
-					break;
-				}
-				// Delete temporary dirs of modules
-				if(! DeleteTemporaryDirs() )
-				{
-					
-				}
-			}
-			else
-			{
-				
-			}
-		}
-	}
-	// Projects
-	if ( ! DirDelete( AT_TEMP_DIR, true ) )
-	{
-
-	}
-	else
-		bNothingFound = false;
-
-	if ( bNothingFound )
-		cout << AT_MSG << "Nothing found to clean." << endl;
-	else
-		cout << AT_MSG << "Cleaning done." << endl;
-	return iRetCode;
-}
-
-int CATProject::RunAnalyze()
-{
-	LOG_FUNC_ENTRY("CATProject::RunAnalyze");
-
-	// Parse data file if it is trace.
-	if ( !IsDataFile( m_sDataFile ) )
-	{
-		m_sDataFileTemp.clear();
-		m_sDataFileTemp.append( m_sDataFile );
-		m_sDataFileTemp.append( ".atool" );
-		cout << AT_MSG << "Parsing trace file..." << endl;
-		CATParseTraceFile Parser;
-		if ( ! Parser.StartParse( m_sDataFile.c_str(), m_sDataFileTemp.c_str() ) )
-		{
-			return AT_RETURN_CODE::EMPTY_DATA_FILE;
-		}
-		m_sDataFile = m_sDataFileTemp;
-	}
-
-	// Init makefile member for this run mode.
-	if ( m_eBuildSystem == SBS_V1 )
-		InitSbs1MakeFileWithPathToTemp();
-	// Read makefile to get project attributes
-    if( ! ReadMakeFile() )
-	{
-		cout << AT_MSG << "Error, cannot find project build with AnalyzeTool." << endl;
-	}
-	else
-		FilterModules();
-
-	#ifndef ADDR2LINE
-	// Initialize modules locating code lines.
-	for( size_t i = 0 ; i < m_vModules.size() ; i++ )
-	{
-		m_vModules.at(i)->InitializeAddressToLine();
-	}
-	#endif
-
-	// Create analyzer
-	m_pAnalyzer = new CATDatParser( &m_vModules );
-
-	// Pass some info from project if it "exists" to analyzer.
-	if ( m_vModules.size() > 0 )
-	{
-		// Pass platform.
-		m_pAnalyzer->SetProjectPlatform( m_sPlatform );
-		// Pass build type.
-		m_pAnalyzer->SetProjectBuildType( m_eBuildType );
-	}
-	
-	// Set file.
-	m_pAnalyzer->SetInputFile( m_sDataFile );
-
-	// Set rom symbol file.
-	m_pAnalyzer->SetRomSymbolFiles( m_vRomSymbolFiles );
-
-	// Set output file if specified
-	if ( ! m_sDataFileOutput.empty() )
-	{
-		m_pAnalyzer->SetOutputFile( m_sDataFileOutput );
-	}
-	// Set log level
-	m_pAnalyzer->SetLogLevel( m_iLoggingLevel );
-
-	// Analyze
-	return m_pAnalyzer->Analyze();
-}
-
-int CATProject::RunInstrument()
-{
-	LOG_FUNC_ENTRY("CATProject::RunInstrument");
-	// Store attributes
-	if( ! MakeTempDirIfNotExist() )
-		return AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
-	if ( ! WriteAttributes() )
-		return AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
-	if ( m_eBuildSystem == SBS_V1 )
-	{
-		// Initialize level 1 make file member.
-		if ( ! InitSbs1MakeFileWithPath() )
-			return AT_RETURN_CODE::MAKEFILE_ERROR;
-		// Copy it to temporary folder.
-		CopyMakeFileSbs1ToTemporaryFolder();
-		// Run export.
-		if( ! RunExportSbs1() )
-			return AT_RETURN_CODE::MAKEFILE_ERROR;
-		// Create level 2 makefiles.
-		if ( ! CreateMakeFileSbs1Level2() )
-			return AT_RETURN_CODE::MAKEFILE_ERROR;
-	}
-	else if ( m_eBuildSystem == SBS_V2 )
-	{
-		// Create makefile only when using SBS v.2
-		if ( ! CreateMakeFile() )
-			return AT_RETURN_CODE::MAKEFILE_ERROR;
-	}
-	else
-	{
-		return AT_RETURN_CODE::UNKNOWN;
-	}
-	// Read makefile to get project attributes
-	if ( ! ReadMakeFile() )
-		return AT_RETURN_CODE::READ_MAKEFILE_ERROR;
-	// Filter unsupported
-	FilterModules();
-	// Check that we have some "valid" modules to hook
-	if ( m_vModules.size() == 0 &&(  m_vUnsupportedModules.size() > 0 || m_vStaticLibraries.size() > 0 ) )
-		return AT_RETURN_CODE::NO_SUPPORTED_MODULES_ERROR;
-
-	// Clean temporary dirs of modules
-	if ( ! CleanTemporaryDirs() )
-		return AT_RETURN_CODE::CLEANING_TEMP_ERROR;
-	// Create temporary cpps for modulse
-	if (! CreateTemporaryCpps() )
-		return AT_RETURN_CODE::CREATING_TEMP_CPP_ERROR;
-	// Hook modules
-	if (! ModifyModules() )
-		return AT_RETURN_CODE::MODIFY_MODULES_ERROR;
-	return AT_RETURN_CODE::OK;
-}
-
-int CATProject::RunInstrumentConsole()
-{
-	LOG_FUNC_ENTRY("CATProject::RunInstrumentConsole");
-	if( ! MakeTempDirIfNotExist() )
-		return AT_RETURN_CODE::UNKNOWN;
-	// Store attributes
-	m_bUninstrumented = false;
-	if ( ! WriteAttributes() )
-		return AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
-	// Create makefile
-	if ( ! CreateMakeFile() )
-		return AT_RETURN_CODE::MAKEFILE_ERROR;
-	// Read makefile to get project attributes
-	if ( ! ReadMakeFile() )
-		return AT_RETURN_CODE::READ_MAKEFILE_ERROR;
-	// Filter unsupported
-	FilterModules();
-	// Check that we have some "valid" modules to hook
-	if ( m_vModules.size() == 0 &&(  m_vUnsupportedModules.size() > 0 || m_vStaticLibraries.size() > 0 ) )
-		return AT_RETURN_CODE::NO_SUPPORTED_MODULES_ERROR;
-
-	// Clean temporary dirs of modules
-	if ( ! CleanTemporaryDirs() )
-		return AT_RETURN_CODE::CLEANING_TEMP_ERROR;
-	// Create temporary cpps for modulse
-	if (! CreateTemporaryCpps() )
-		return AT_RETURN_CODE::CREATING_TEMP_CPP_ERROR;
-	// Hook modules
-	if (! ModifyModules() )
-		return AT_RETURN_CODE::MODIFY_MODULES_ERROR;
-	// Run Reallyclean when using abld.
-	if ( m_eBuildSystem == SBS_V1 )
-		RunReallyCleanSbs1();
-	return AT_RETURN_CODE::OK;
-}
-
-int CATProject::RunUninstrument()
-{
-	LOG_FUNC_ENTRY("CATProject::RunUninstrument");
-	// Read attributes.
-	if ( ! ReadAttributes() )
-		return AT_RETURN_CODE::READ_ATTRIBUTES_ERROR;
-	// Init makefile member for this run mode.
-	if ( m_eBuildSystem == SBS_V1 )
-		InitSbs1MakeFileWithPathToTemp();
-	// Read makefile to get project attributes
-	if ( ! ReadMakeFile() )
-		return AT_RETURN_CODE::READ_MAKEFILE_ERROR;
-	// Filter unsupported
-	FilterModules();
-	// Check that we have some "valid" modules to hook
-	if ( m_vModules.size() == 0 &&(  m_vUnsupportedModules.size() > 0 || m_vStaticLibraries.size() > 0 ) )
-		return AT_RETURN_CODE::NO_SUPPORTED_MODULES_ERROR;
-	// Create lst files
-    if (! CreateListings() )
-		return AT_RETURN_CODE::COMPILE_ERROR;
-	// Copy releasables of modules
-	if (! CopyReleasables() )
-		return AT_RETURN_CODE::RELEASABLES_ERROR;
-	// Restore "unhook" modules
-	if (! RestoreModules() )
-		return AT_RETURN_CODE::RESTORE_MODULES_ERROR;
-	// Return error code OK
-	return AT_RETURN_CODE::OK;
-}
-
-int CATProject::RunUninstrumentConsole()
-{
-	LOG_FUNC_ENTRY("CATProject::RunUninstrumentConsole");
-	int iErrorCode = AT_RETURN_CODE::OK;
-	// Read attributes
-	if ( ReadAttributes() )
-	{
-		// Init makefile member for this run mode.
-		if ( m_eBuildSystem == SBS_V1 )
-			InitSbs1MakeFileWithPathToTemp();
-		// Read makefile to get project attributes
-		if( ReadMakeFile() )
-		{
-			// Filter unsupported
-			FilterModules();
-			// Create lst files
-			CreateListings();
-			if (! CopyReleasables() )
-				iErrorCode = AT_RETURN_CODE::RELEASABLES_ERROR;
-		}
-		else
-			iErrorCode = AT_RETURN_CODE::READ_MAKEFILE_ERROR;
-		// Change state to uninstrumented and write status
-		m_bUninstrumented = true;
-		if ( ! WriteAttributes() )
-			iErrorCode = AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
-	}
-	else
-	{
-		iErrorCode = AT_RETURN_CODE::READ_ATTRIBUTES_ERROR;
-	}
-	return iErrorCode;
-}
-
-int CATProject::RunUninstrumentFailed()
-{
-	LOG_FUNC_ENTRY("CATProject::RunUninstrumentFailed");
-	// Read attributes.
-	if ( ! ReadAttributes() )
-		return AT_RETURN_CODE::READ_ATTRIBUTES_ERROR;
-	// Init makefile member for this run mode.
-	if ( m_eBuildSystem == SBS_V1 )
-		InitSbs1MakeFileWithPathToTemp();
-	// Read makefile to get project attributes
-	if( ReadMakeFile() )
-	{
-		// Filter modules
-		FilterModules();
-		// Restore modules to make sure no changes left
-		if( RestoreModules() )
-		{
-			// Delete temporary dirs of modules
-			if(! DeleteTemporaryDirs() )
-			{
-
-			}
-
-		}
-		else
-		{
-
-		}
-	}
-	else
-	{
-
-	}
-	// Projects
-	if ( ! DirDelete( AT_TEMP_DIR, true ) )
-	{
-
-	}
-	return AT_RETURN_CODE::OK;
-}
-
-// ----------------------------------------------------------------------------
-// Main Functions
-// ----------------------------------------------------------------------------
-void CATProject::DisplayCompileSummary()
-{
-	LOG_FUNC_ENTRY("CATProject::DisplayCompileSummary");
-	cout << AT_BUILD_SUMMARY_HEADER;
-	// Supported modules
-	for( size_t i = 0; i < m_vModules.size(); i++ )
-	{
-		// Successful
-		if ( m_vModules.at(i)->GetErrors().empty() )
-		{
-			// Create build complete file for Carbide xtension
-			m_vModules.at(i)->CreateBuildCompleteFile();
-			cout << AT_BUILD_SUMMARY_INSTRUMENTED_BUILD_COMPLETE
-				<< GetPathOrFileName( true, m_vModules.at(i)->GetMmpFile() )
-				<< endl
-				<< AT_BUILD_SUMMARY_TARGET
-				<< m_vModules.at(i)->GetBinaryName()
-				<< endl;
-			// Datafiles
-			// Use module data file name if project's data file not defined.
-			if ( m_eLoggingMode == CATProject::FILE 
-				&& m_vModules.at(i)->GetTargetType().compare("exe") == 0 )
-			{
-				if ( m_sS60FileName.empty() )
-					cout << AT_BUILD_SUMMARY_DATA_FILE_NAME
-						<< m_vModules.at(i)->GetS60FileName()
-						<< endl;
-				else
-					cout << AT_BUILD_SUMMARY_DATA_FILE_NAME
-					<< m_sS60FileName
-					<< endl;
-			}
-		}
-		else
-		{
-			// Failed
-			cout << AT_BUILD_SUMMARY_FAILED
-				<< GetPathOrFileName( true, m_vModules.at(i)->GetMmpFile() )
-				<< endl
-				<< AT_BUILD_SUMMARY_TARGET
-				<< m_vModules.at(i)->GetBinaryName()
-				<< endl;
-			// Print errors.
-			cout << AT_BUILD_SUMMARY_ERRORS
-				<< m_vModules.at(i)->GetErrors()
-				<< endl;
-		}
-	}
-
-	// Static libraries
-	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
-	{
-		if ( m_vStaticLibraries.at(i)->GetErrors().empty() )
-		{
-			cout << AT_BUILD_SUMMARY_NORMAL_BUILD_COMPLETE
-				<< GetPathOrFileName( true, m_vStaticLibraries.at(i)->GetMmpFile())
-				<< endl
-				<< AT_BUILD_SUMMARY_TARGET
-				<< m_vStaticLibraries.at(i)->GetBinaryName()
-				<< endl
-				<< AT_BUILD_SUMMARY_STATIC_LIBRARY
-				<< endl;
-				
-		}
-		else
-		{
-			// Failed
-			cout << AT_BUILD_SUMMARY_FAILED
-				<< GetPathOrFileName( true, m_vStaticLibraries.at(i)->GetMmpFile() )
-				<< endl
-				<< AT_BUILD_SUMMARY_TARGET
-				<< m_vStaticLibraries.at(i)->GetBinaryName()
-				<< endl;
-			// Print errors.
-			cout << AT_BUILD_SUMMARY_ERRORS
-				<< m_vStaticLibraries.at(i)->GetErrors()
-				<< endl;
-		}
-	}
-
-	// Unsupported modules
-	for( size_t i = 0; i < m_vUnsupportedModules.size(); i++ )
-	{
-		cout << AT_BUILD_SUMMARY_NORMAL_BUILD_COMPLETE
-			<< GetPathOrFileName( true, m_vUnsupportedModules.at(i)->GetMmpFile() )
-			<< endl
-			<< AT_BUILD_SUMMARY_TARGET
-			<< m_vUnsupportedModules.at(i)->GetBinaryName()
-			<< endl;
-		cout << m_vUnsupportedModules.at(i)->GetCompileInfoText() << endl;
-	}
-}
-
-void CATProject::DisplayBuildSummary( void )
-{
-	LOG_FUNC_ENTRY("CATProject::DisplayBuildSummary");
-	cout << endl;
-	// Build information
-	cout << AT_BUILD_SUMMARY_BUILD_TYPE << GetBuildTypeString() << endl;
-	// Platform
-	cout << AT_BUILD_SUMMARY_BUILD_PLATFORM << m_sPlatform << endl;
-	// Possible variant
-	if ( ! m_sVariant.empty() )
-		cout << AT_BUILD_SUMMARY_BUILD_VARIANT << m_sVariant << endl;
-	// Logging mode
-	cout << AT_BUILD_SUMMARY_LOGGING_MODE;
-	if ( m_eLoggingMode == FILE )
-		cout  << AT_BUILD_SUMMARY_FILE;
-	else if ( m_eLoggingMode == TRACE )
-		cout << AT_BUILD_SUMMARY_TRACE;
-	else if ( m_eLoggingMode == TRACE_FAST )
-		cout << AT_BUILD_SUMMARY_TRACE_FAST;
-	cout << endl;
-	// Call stack sizes
-	cout << AT_BUILD_SUMMARY_ALLOC_CALL_STACK_SIZE
-		<< m_iAllocCallStackSize
-		<< endl;
-	cout << AT_BUILD_SUMMARY_FREE_CALL_STACK_SIZE
-		<< m_iFreeCallStackSize
-		<< endl;
-
-	if(!_stricmp(m_sPlatform.c_str(), ("winscw")))
-	{
-		//print version info only when version is not up-to-date
-		cout << endl;
-		showDbgHelpVersionInfo( false );
-	}
-}
-
-bool CATProject::CreateMakeFile()
-{
-	switch ( m_eBuildSystem )
-	{
-	case SBS_V1:
-		if( ! CreateMakeFileSbs1() )
-			return false;
-		// Copy main make file.
-		if( ! CopyMakeFileSbs1ToTemporaryFolder() )
-			return false;
-		// Run export.
-		if( ! RunExportSbs1() )
-			return false;
-		// Create level 2 makefiles.
-		if( ! CreateMakeFileSbs1Level2() )
-			return false;
-		return true;
-	case SBS_V2:
-		return CreateMakeFileSbs2();
-	default:
-		return false;
-	}
-}
-
-bool CATProject::CreateMakeFileSbs1()
-{
-	LOG_FUNC_ENTRY("CATProject::CreateMakeFileSbs1");
-
-	// If variant defined check does it exist.
-	if( ! m_sVariant.empty() )
-	{
-		if ( ! CheckVariant( m_sEpocRoot, m_sVariant ) )
-		{
-			cout << INVALID_VARIANT_ERROR;
-			if ( IsDefaultVariant( m_sEpocRoot ) )
-			{
-				m_sVariant = "default";
-				cout << USING_DEFAULT_VARIANT_MESSAGE;
-				if ( ! WriteAttributes() )
-					return false;
-			}
-			else
-			{
-				cout << NO_DEFAULT_VARIANT_ERROR;
-				return false;
-			}
-		}
-	}
-
-	// Create level 1 make file.
-	string sCmd( "bldmake bldfiles " );
-	sCmd.append( m_sPlatform );
-	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
-	(void)system( sCmd.c_str() );
-	return InitSbs1MakeFileWithPath();
-}
-
-bool CATProject::CopyMakeFileSbs1ToTemporaryFolder()
-{
-	LOG_FUNC_ENTRY("CATProject::CopyMakeFileSbs1ToTemporaryFolder");
-	// Check that temporary dir exists if not create it.
-	if ( ! MakeTempDirIfNotExist() )
-		return false;
-	// Copy makefile to temporary directory
-	string sMakeFileInTemp( AT_TEMP_DIR );
-	sMakeFileInTemp.append( "\\" );
-	sMakeFileInTemp.append( AT_LEVEL_1_MAKEFILE_NAME );
-	if ( ! FileCopyToPath( m_sMakeFile, sMakeFileInTemp ) )
-		return false;
-	return true;
-
-}
-
-bool CATProject::RunReallyCleanSbs1()
-{
-	LOG_FUNC_ENTRY("CATProject::RunReallyCleanSbs1");
-	// Check that abld.bat has been made.
-	if ( ! FileExists( "abld.bat" ) )
-		return false;
-	// Run reallyclean.
-	string sCmd;
-	if ( m_bAbldTest )
-		sCmd = "abld test reallyclean ";
-	else
-		sCmd = "abld reallyclean ";
-	sCmd.append( m_sPlatform );
-	if ( ! m_sVariant.empty() )
-	{
-		sCmd.append( "." );
-		sCmd.append( m_sVariant );
-	}
-	sCmd.append( " " );
-	sCmd.append( GetBuildTypeString() );
-	if ( m_vTargetModules.size() > 1 )
-	{
-		RunAbldCommandToAllTargets( sCmd );
-	}
-	else
-	{
-		AddTargetModuleIfDefined( sCmd );
-		cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
-		(void) system( sCmd.c_str() );
-	}
-	return true;
-}
-
-bool CATProject::RunReallyCleanSbs2()
-{
-	LOG_FUNC_ENTRY("CATProject::RunReallyCleanSbs2");
-	string sCmd("");
-	if ( m_sBuildCommand.empty() )
-	{
-		// If no build command defined (not found in project.cfg).
-		sCmd.append( RAPTOR_CMD_BASE );;
-		sCmd.append( m_sPlatform );
-		sCmd.append( "_" );
-		sCmd.append( GetBuildTypeString() );
-		if ( ! m_sVariant.empty() )
-		{
-			sCmd.append( "." );
-			sCmd.append( m_sVariant );
-		}
-		sCmd.append( RAPTOR_REALLYCLEAN_LOG );
-		AddTargetModuleIfDefined( sCmd );
-		sCmd.append( " REALLYCLEAN" );
-	}
-	else
-	{
-		// When build command set use it.
-		sCmd.append( m_sBuildCommand );
-		sCmd.append( RAPTOR_REALLYCLEAN_LOG );
-		sCmd.append( " REALLYCLEAN" );
-	}
-	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
-	int iRet = (int)system( sCmd.c_str() );
-	if ( iRet == 0 )
-		return true;
-	return false;
-}
-
-bool CATProject::RunExportSbs1()
-{
-	LOG_FUNC_ENTRY("CATProject::RunExportSbs1");
-	// Run export.
-	string sCmd;
-	if ( m_bAbldTest )
-		sCmd = "abld test export";
-	else
-		sCmd = "abld export";
-	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
-	(void) system( sCmd.c_str() );
-	return true;
-}
-
-bool CATProject::CreateMakeFileSbs1Level2()
-{
-	LOG_FUNC_ENTRY("CATProject::CreateMakeFileSbs1Level2");
-	// Create level 2 makefiles.
-	
-	string sCmd;
-	
-	if ( m_bAbldTest )
-		sCmd ="abld test makefile ";
-	else
-		sCmd ="abld makefile ";
-
-	sCmd.append( m_sPlatform );
-	if ( ! m_sVariant.empty() )
-	{
-		sCmd.append( "." );
-		sCmd.append( m_sVariant );
-	}
-	
-	// Check if multiple targets defined and sbs 1.
-	if ( m_vTargetModules.size() > 1 )
-	{
-		RunAbldCommandToAllTargets( sCmd );
-	}
-	else
-	{
-		AddTargetModuleIfDefined( sCmd );
-		cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
-		(void) system( sCmd.c_str() );
-	}
-	return true;
-}
-
-bool CATProject::CreateMakeFileSbs2()
-{
-	LOG_FUNC_ENTRY("CATProject::CreateMakeFileSbs2");
-	// Delete build directory if it exists before creating new makefiles.
-	if ( DirectoryExists( "atool_temp\\build" ) )
-		DirDelete( "atool_temp\\build", true );
-	// Create command to create makefiles.
-	string sCmd( m_sBuildCommand );
-	sCmd.append( " " );
-	sCmd.append( RAPTOR_MAKEFILE_SWITCH );
-	sCmd.append( " " );
-	sCmd.append( RAPTOR_NOBUILD_SWITCH );
-	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
-	int iRet = (int)system( sCmd.c_str() );
-	if ( iRet == 0 )
-		return true;
-	return false;
-}
-
-bool CATProject::ReadMakeFile()
-{
-	// Clean modules before reading.
-	CleanModuleVectors();
-	if ( m_eBuildSystem == SBS_V1 )
-	{
-		// Read level 1 makefile which contains module name and makefiles.
-		if( ! ReadMakeFileSbs1Level1() )
-			return false;
-		// Read level 2 makefiles.
-		vector<CATModule2*>::iterator it;
-		// If we are compiling or etc... we need to create temporary directories.
-		if ( m_eMode == COMPILE || m_eMode == INSTRUMENT || m_eMode == INSTRUMENT_CONSOLE )
-		{
-			// Read make makefiles from /epoc32/build... and create temporary directory.
-			bool bLevel2 = true;
-			for( it = m_vModules.begin(); it != m_vModules.end() ; it ++ )
-			{
-				if( ! (*it)->CreateTemporaryDirectory() )
-					return false;
-				if( ! (*it)->ReadMakeFile() )
-				{
-					bLevel2 = false;
-					break;
-				}
-			}
-			// If failed reading modules from level 2 makefiles.
-			if ( ! bLevel2 )
-			{
-				// Clean modules.
-				CleanModuleVectors();
-				// Try use default variant if it exists.
-				if ( CheckVariant( m_sEpocRoot, "default" ) )
-				{
-					m_sVariant = "default";
-					cout << USING_DEFAULT_VARIANT_MESSAGE;
-					if ( ! WriteAttributes() )
-						return false;
-					if ( ! InitSbs1MakeFileWithPath() )
-						return false;
-					if ( ! ReadMakeFileSbs1Level1() )
-						return false;
-					for( it = m_vModules.begin(); it != m_vModules.end() ; it ++ )
-					{
-						if( ! (*it)->CreateTemporaryDirectory() )
-							return false;
-						if( ! (*it)->ReadMakeFile() )
-							return false;
-					}
-
-				}
-			}
-		}
-		else
-		{
-			// Read make files from temporary directories.
-			for( it = m_vModules.begin(); it != m_vModules.end() ; it ++ )
-			{
-				if ( ! (*it)->ReadMakeFileFromTemp() )
-					return false;
-			}
-		}
-		return true;
-	}
-	else if ( m_eBuildSystem == SBS_V2 )
-	{
-		// Read make file.
-		if( ! ReadMakeFileSbs2() )
-			return false;
-		// Create module temporary directories if we are compiling or etc...
-		if ( m_eMode == COMPILE || m_eMode == INSTRUMENT || m_eMode == INSTRUMENT_CONSOLE )
-			{
-			for( vector<CATModule2*>::iterator it = m_vModules.begin(); it < m_vModules.end(); it++ )
-				(*it)->CreateTemporaryDirectory();
-			for( vector<CATModule2*>::iterator it = m_vStaticLibraries.begin(); it < m_vStaticLibraries.end(); it++ )
-				(*it)->CreateTemporaryDirectory();
-			}
-	}
-	return true;
-}
-
-bool CATProject::ReadMakeFileSbs1Level1()
-{
-	LOG_FUNC_ENTRY("CATProject::ReadMakeFileSbs1Level1");
-
-	bool bRet = false;
-
-	//Try to open makefile
-	ifstream in;
-	in.open( m_sMakeFile.c_str() );
-
-	//File open ok?
-	if( !in.good() )
-	{
-		printf( "Can not open file: %s\n", m_sMakeFile.c_str() );
-		in.close();
-		return bRet;
-	}
-
-	// Add also these so "compatible with sbs2".
-	// Releasables path (binaries).
-	string sReleasePath( m_sEpocRoot );
-	// add trailing '\' if root path is missing it
-	if ( sReleasePath.size() < 1 )
-		sReleasePath.append( "\\" );
-	else if ( sReleasePath.at( sReleasePath.length() -1 ) != '\\' )
-		sReleasePath.append( "\\" );
-	sReleasePath.append( "epoc32\\release" );
-	string sFullVariantPath( m_sPlatform );
-	sFullVariantPath.append( "\\" );
-	sFullVariantPath.append( GetBuildTypeString() );
-
-	char cTemp[MAX_LINE_LENGTH];
-	bool bContinueSearch = true;
-	bool bMmpInfoFound = false;
-	CATModule2* pModule = 0;
-	string sTempLineFromFile;
-	string sMmpFileSearchString;
-	if ( m_bAbldTest )
-		sMmpFileSearchString = MMPTESTFILE_SEARCH_STRING;
-	else
-		sMmpFileSearchString = MMPFILE_SEARCH_STRING;
-	do
-	{
-		// get line from file
-		in.getline( cTemp, MAX_LINE_LENGTH );
-		sTempLineFromFile.clear();
-		sTempLineFromFile.append( cTemp );
-
-		//Search makefile string
-		if( sTempLineFromFile.find( MAKEFILE_SEARCH_STRING ) != string::npos )
-		{
-			bMmpInfoFound = true;
-			if( sTempLineFromFile.find( sMmpFileSearchString ) != string::npos )
-			{
-				bRet = true;
-				//Parse mmp path + mmp filename
-				sTempLineFromFile.erase( 0, sTempLineFromFile.find_first_of("\"") );
-				sTempLineFromFile.erase( 0, 1 );
-
-				string sPath = sTempLineFromFile.substr(0, sTempLineFromFile.find_first_of("\"") );
-
-				sPath = ChangeSlashToBackSlash( sPath );
-				//Remove text "bld.inf"
-				sPath.erase( (sPath.find_last_of( "\\" ) + 1) , string::npos );
-
-				string sFileName = sTempLineFromFile.substr( (sTempLineFromFile.find( sMmpFileSearchString ) + sMmpFileSearchString.length() + 3), string::npos );
-				sFileName = ChangeSlashToBackSlash( sFileName );
-				sFileName = sFileName.substr( 0, sFileName.find_first_of("\"") );
-
-				// Append .mmp to filename if it does not exist
-				if ( sFileName.find(".mmp") == string::npos )
-					sFileName.append(".mmp");
-
-				//Insert drive letter
-				sPath.insert(0, string( m_cCurrentDir).substr(0,2) );
-		
-				//Insert mmp file to the end
-				sPath.append( sFileName );
-
-				ChangeToLower( sPath );
-				
-				// If target programs defined find from those or do not
-				// add module to vector.
-				bool bAddToVector = true;
-				if ( m_vTargetModules.size() > 0 )
-				{
-					bAddToVector = false;
-					vector<string>::iterator it;
-					for( it = m_vTargetModules.begin() ; it != m_vTargetModules.end() ; it++ )
-					{
-						string sFind( *it );
-						sFind.insert( 0, "\\" );
-						if ( sPath.find( sFind ) != string::npos )
-						{
-							bAddToVector = true;
-							break;
-						}
-					}	
-				}
-
-				if ( bAddToVector )
-				{
-					pModule = new CATModule2();
-					pModule->SetMmpFile( sPath );
-					pModule->SetVariantType( GetBuildTypeString() );
-					pModule->SetVariantPlatform( m_sPlatform );
-					pModule->SetReleasePath( sReleasePath );
-					pModule->SetFullVariantPath( sFullVariantPath );
-					pModule->SetBuildSystem( SBS_V1 );
-					m_vModules.push_back( pModule );
-				}
-			}
-		}
-		else if( bMmpInfoFound )
-			//Do not continue search if mmp info lines are all handled
-			bContinueSearch = false;
-		if( !in.good() )
-			bContinueSearch = false;
-	}
-	while( bContinueSearch );
-
-	bContinueSearch = true;
-
-	//Search MAKEFILES for invidual modules
-	do
-	{
-		in.getline( cTemp, MAX_LINE_LENGTH );
-		sTempLineFromFile.clear();
-		sTempLineFromFile.append( cTemp );
-		// find the lines 'MAKEFILE[modulename]_FILES'
-		if( (sTempLineFromFile.find( "MAKEFILE" ) == 0) && (sTempLineFromFile.find( "_FILES" ) != string::npos) )
-		{
-			//Math the makefile line with one of our modules
-			for( size_t i = 0 ; i < m_vModules.size() ; i++ )
-			{
-				//Create name
-				string sMakeFile( "MAKEFILE" );
-				string sTempMmpFile( RemovePathAndExt( m_vModules.at(i)->GetMmpFile(), true ) );
-				ChangeToUpper( sTempMmpFile );
-				sMakeFile.append( sTempMmpFile );
-				sMakeFile.append( "_FILES" );
-				// matched
-				if( sTempLineFromFile.find( sMakeFile ) != string::npos )
-				{
-					//parse the makefile name from line
-					in.getline( cTemp, MAX_LINE_LENGTH );
-					sTempLineFromFile.clear();
-					sTempLineFromFile.append( cTemp );
-					//Remove character "\""
-					sTempLineFromFile.erase( 0, ( sTempLineFromFile.find_first_of("\"") + 1 ) );
-					// in winscw last part is '" \' and on armd '"' so remove all after last '"'
-					sTempLineFromFile.erase( sTempLineFromFile.find_last_of("\""), sTempLineFromFile.size() );
-					// Set correct makefile for module
-					m_vModules.at( i )->SetMakeFile( sTempLineFromFile );
-					// break 
-					break;
-				} // If mathed to mmp
-			} // End of mmp file loop
-		} // found lines 'MAKEFILE[modulename]_FILES'
-		if( !in.good() )
-			bContinueSearch = false;
-	}
-	while( bContinueSearch );
-	in.close();
-	return bRet;
-}
-
-bool CATProject::ReadMakeFileSbs2( void )
-{
-	LOG_FUNC_ENTRY("CATProject::ReadMakeFileSbs2(void)");
-	// File is by default named make_build.default but when building specific layer
-	// make_build_LAYERNAME.default is produced by Raptor.
-	// So find makefile(s) and read them.
-	vector<string> vMakeFiles = DirList( "atool_temp\\build\\", false, true );
-	bool bRet = true;
-	for( vector<string>::iterator it = vMakeFiles.begin(); it != vMakeFiles.end() ; it++ )
-	{
-		// Recognize multiple makefiles.
-		if ( it->find("make_build_") != string::npos && it->find(".default") != string::npos )
-		{
-			if ( ! ReadMakeFileSbs2( *it ) )
-				bRet = false;
-		}
-		// Single makefile.
-		else if ( it->find( "make_build.default" ) != string::npos )
-		{
-			if ( ! ReadMakeFileSbs2( *it ) )
-				bRet = false;
-		}
-	}
-	// We got some modules?
-	if ( m_vModules.size() == 0 )
-		bRet = false;
-	return bRet;
-}
-
-bool CATProject::ReadMakeFileSbs2( string& sMakeFile )
-{
-	LOG_FUNC_ENTRY("CATProject::ReadMakeFileSbs2(string)");
-	try {
-		// Open file
-		ifstream in;
-		in.open( sMakeFile.c_str() , ios_base::in );
-		// Check that open ok
-		if ( ! in.good() )
-		{
-			cout << AT_MSG << "Error, opening file "
-				<< RAPTOR_MAKEFILE << endl;
-			in.close();
-			return false;
-		}
-		// Source line from file
-		string sSourceLine;
-		// Module pointer
-		CATModule2* pModule = 0;
-		// Are we looking for module attributes
-		bool bFindAttributes = false;
-		// Until end of file
-		while( in.good() )
-		{
-			// Get new line from file
-			string sLine;
-			getline(in, sLine);
-			// New module
-			if ( sLine.find( RAPTOR_PROJECT_META ) == 0 )
-			{
-				// Remove project_meta from line
-				sLine.erase(0, strlen( RAPTOR_PROJECT_META ) );
-				LOG_STRING("Found module: " << sLine );
-				// Check is name empty
-				// This seems to happen when sbs2 "wraps" i.e. mifconv to a module type item
-				if ( sLine.empty() )
-				{
-					LOG_STRING("skipping empty module");
-					// Skip it
-					continue;
-				}
-				// If module add it to vector
-				if ( pModule )
-				{
-					// Add sources,
-					pModule->AddSources( sSourceLine );
-					// Build system.
-					pModule->SetBuildSystem( SBS_V1 );
-					// Push to vector.
-					m_vModules.push_back( pModule );
-				}
-				// New module
-				pModule = new CATModule2();
-				// Clear sourceline
-				sSourceLine.clear();
-				// Set modules mmp with path
-
-				if ( ! pModule->SetMmpFile( sLine ) )
-				{
-					// Fatal error setting mmp file
-					in.close();
-					return false;
-				}
-				// Find attributes on
-				bFindAttributes = true;
-				// Get new line from file
-				getline(in, sLine);
-			}
-			// If attribute finding on
-			if ( bFindAttributes )
-			{
-				// Pickup modules attributes
-				if ( sLine.find ( RAPTOR_SOURCE ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_SOURCE ) );
-					sSourceLine = sLine;
-				}
-				else if ( sLine.find ( RAPTOR_TARGET ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_TARGET ) );
-					pModule->SetTarget( sLine );
-				}
-				else if ( sLine.find ( RAPTOR_TARGETYPE ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_TARGETYPE ));
-					pModule->SetTargetType( sLine );
-				}
-				else if ( sLine.find( RAPTOR_REQUESTEDTARGETEXT ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_REQUESTEDTARGETEXT ) );
-					pModule->SetRequestedTargetExt( sLine );
-				}
-				else if ( sLine.find ( RAPTOR_VARIANTPLATFORM ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_VARIANTPLATFORM ));
-					pModule->SetVariantPlatform( sLine );
-				}
-				else if ( sLine.find ( RAPTOR_VARIANTTYPE ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_VARIANTTYPE ));
-					pModule->SetVariantType( sLine );
-				}
-				else if ( sLine.find ( RAPTOR_FEATUREVARIANT ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_FEATUREVARIANT ));
-					pModule->SetFeatureVariant( sLine );
-				}
-				else if ( sLine.find ( RAPTOR_FEATUREVARIANTNAME ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_FEATUREVARIANTNAME ));
-					pModule->SetFeatureVariantName( sLine );
-				}
-				else if ( sLine.find ( RAPTOR_RELEASEPATH ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_RELEASEPATH ));
-					pModule->SetReleasePath( sLine );
-				}
-				else if ( sLine.find ( RAPTOR_FULLVARIANTPATH ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_FULLVARIANTPATH ));
-					pModule->SetFullVariantPath( sLine );
-				}
-				else if ( sLine.find ( RAPTOR_COMPILE_DEFINITIONS ) == 0 )
-				{
-					sLine.erase(0, strlen( RAPTOR_COMPILE_DEFINITIONS ) );
-					pModule->SetCompileDefinitions( sLine );
-				}
-			}
-		} // while in.good()
-		// Add last module if n number of modules found
-		if ( pModule )
-		{
-			if ( ! pModule->GetTarget().empty() )
-			{
-				// Add sources
-				pModule->AddSources( sSourceLine );
-				// Build system.
-				pModule->SetBuildSystem( SBS_V1 );
-				// Push back to vector
-				m_vModules.push_back( pModule );
-			}
-		}
-		// Close file
-		in.close();
-		return true;
-	} // try.
-	catch(...)
-	{
-		LOG_STRING("Unexpected exception reading sbs 2 makefile");
-		return false;
-	}
-}
-bool CATProject::CreateTemporaryDirectories()
-{
-	LOG_FUNC_ENTRY("CATProject::CreateTemporaryDirectories");
-	bool bRet = true;
-	for( size_t i = 0 ; i < m_vModules.size(); i++)
-	{
-		if( ! m_vModules.at(i)->CreateTemporaryDirectory() )
-			bRet = false;
-	}
-	for( size_t i = 0 ; i < m_vStaticLibraries.size(); i++)
-	{
-		if( ! m_vStaticLibraries.at(i)->CreateTemporaryDirectory() )
-			bRet = false;
-	}
-	return bRet;
-
-}
-
-bool CATProject::CreateTemporaryCpps()
-{
-	LOG_FUNC_ENTRY("CATProject::CreateTemporaryCpps");
-	bool bRet = true;
-	for( size_t i = 0 ; i < m_vModules.size(); i++)
-	{
-		if( ! m_vModules.at(i)->CreateTempCpp(
-			m_sS60FileName, m_eLoggingMode, m_eBuildType, m_iAllocCallStackSize, m_iFreeCallStackSize ) )
-			bRet = false;
-	}
-	return bRet;
-}
-
-bool CATProject::FilterModules()
-{
-	LOG_FUNC_ENTRY("CATProject::FilterModules");
-	vector<CATModule2*>::iterator it;
-	// Loop thru modules.
-	it = m_vModules.begin();
-	while( it != m_vModules.end() )
-	{
-		// Get target type of module to separate string (will be modified).
-		string sTargetType = (*it)->GetTargetType();
-		// Modules compile definitions.
-		string sCompileDefinition = (*it)->GetCompileDefinitions();
-		// Check is it supported.
-		if ( !IsTargetTypeSupported( sTargetType) )
-		{
-			(*it)->SetCompileInfoText( AT_UNSUPPORTED_TARGET_TYPE );
-			// Not supported add to not supported vector.
-			m_vUnsupportedModules.push_back( *it );
-			// Erase cell.
-			it = m_vModules.erase( it );
-		}
-		// Check if its static library
-		else if ( _stricmp( sTargetType.c_str(), "lib" ) == 0 )
-		{
-			// Static librarie move to their vector.
-			m_vStaticLibraries.push_back( *it );
-			// Erase cell.
-			it = m_vModules.erase( it );
-		
-		}
-		else if ( sCompileDefinition.find( KERNEL_MODE_COMPILE_DEFINITION ) != string::npos )
-		{
-			(*it)->SetCompileInfoText( AT_UNSUPPORTED_COMPILE_DEFINITION );
-			// Not supported add to not supported vector.
-			m_vUnsupportedModules.push_back( *it );
-			// Erase cell.
-			it = m_vModules.erase( it );
-		}
-		else
-			it++;
-	}
-	return true;
-}
-
-bool CATProject::ModifyModules()
-{
-	LOG_FUNC_ENTRY("CATProject::ModifyModules");
-	bool bRet = true;
-	for( size_t i = 0; i < m_vModules.size(); i++ )
-	{
-		if (! m_vModules.at(i)->ModifyMmp() )
-			bRet = false;
-	}
-	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
-	{
-		if (! m_vStaticLibraries.at(i)->ModifyMmp() )
-			bRet = false;
-	}
-	return bRet;
-}
-
-bool CATProject::RestoreModules()
-{
-	LOG_FUNC_ENTRY("CATProject::RestoreModules");
-	bool bRet = true;
-	for( size_t i = 0; i < m_vModules.size(); i++ )
-	{
-		if (! m_vModules.at(i)->RestoreMmp() )
-			bRet = false;
-	}
-	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
-	{
-		if (! m_vStaticLibraries.at(i)->RestoreMmp() )
-			bRet = false;
-	}
-	return bRet;
-}
-
-bool CATProject::VerifyAndRecoverModules()
-{
-	LOG_FUNC_ENTRY("CATProject::VerifyAndRecoverModules");
-	bool bRet = true;
-	for( size_t i = 0; i < m_vModules.size(); i++ )
-	{
-		if (! m_vModules.at(i)->VerifyAndRecoverMmp() )
-			bRet = false;
-	}
-	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
-	{
-		if (! m_vStaticLibraries.at(i)->VerifyAndRecoverMmp() )
-			bRet = false;
-	}
-	return bRet;
-}
-bool CATProject::Compile()
-{
-	switch ( m_eBuildSystem )
-	{
-	case SBS_V1:
-		// Run Reallyclean.
-		if( ! RunReallyCleanSbs1() )
-			return false;
-		return CompileSbs1();
-	case SBS_V2:
-		return CompileSbs2();
-	default:
-		return false;
-	}
-}
-
-bool CATProject::CompileSbs1()
-{
-	LOG_FUNC_ENTRY("CATProject::CompileSbs1");
-	string sCommand("");
-	if ( m_sBuildCommand.empty() )
-	{
-		sCommand = "abld build";
-		// -debug if urel
-		if ( m_eBuildType == UREL )
-			sCommand.append( " -debug" );
-
-		// No variant
-		if ( m_sVariant.empty() )
-		{
-			sCommand.append( " " );
-			sCommand.append( m_sPlatform );
-		}
-		else
-		{
-			// Add variant
-			sCommand.append( " " );
-			sCommand.append( m_sPlatform );
-			sCommand.append( "." );
-			sCommand.append( m_sVariant );
-		}
-
-		// urel vs udeb
-		sCommand.append( " " );
-		sCommand.append( GetBuildTypeString() );
-
-		// Possible target module
-		AddTargetModuleIfDefined( sCommand );
-	}
-	// Check that build command contains -debug switch if sbs v.1 used
-	else if ( ! m_sBuildCommand.empty() 
-		&& m_eBuildType == UREL 
-		&& m_eBuildSystem == SBS_V1 
-		&& m_sBuildCommand.find( "-debug" ) == string::npos )
-	{
-		// Find correct index to insert -debug switch
-		size_t iPos = m_sBuildCommand.find( "build" );
-		if ( iPos != string::npos )
-		{
-			sCommand = m_sBuildCommand;
-			sCommand.insert( iPos+5, " -debug" );
-		}
-		else
-		{
-			LOG_STRING("Overwriting given build command to add -debug switch. Original command is: " << m_sBuildCommand );
-			if ( m_bAbldTest )
-				sCommand = "abld test build -debug ";
-			else
-				sCommand = "abld build -debug ";
-			// No variant
-			if ( m_sVariant.empty() )
-			{
-				sCommand.append( m_sPlatform );
-			}
-			else
-			{
-				// Add variant
-				sCommand.append( m_sPlatform );
-				sCommand.append( "." );
-				sCommand.append( m_sVariant );
-			}
-
-			// urel vs udeb
-			sCommand.append( " " );
-			sCommand.append( GetBuildTypeString() );
-			// Possible target module
-			AddTargetModuleIfDefined( sCommand );
-		}
-	}
-	else
-		sCommand = m_sBuildCommand;
-	// Run command
-	cout << AT_MSG_SYSTEM_CALL << sCommand << endl;
-	(void)system( sCommand.c_str() );
-	return true;
-}
-
-bool CATProject::CompileSbs2()
-{
-	LOG_FUNC_ENTRY("CATProject::CompileSbs2");
-	// Create command to compile with raptor
-	string sCmd( m_sBuildCommand );
-	sCmd.append( RAPTOR_BUILD_LOG );
-	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
-	int iRet = (int)system( sCmd.c_str() );
-	if ( iRet == 0 )
-		return true;
-	return false;
-}
-
-bool CATProject::CreateListings()
-{
-	// Create listings if no addr2line defined
-	#ifndef ADDR2LINE
-	if ( _stricmp( m_sPlatform.c_str(), "armv5" ) == 0 )
-	{
-		switch ( m_eBuildSystem )
-		{
-		case SBS_V1:
-			return CreateListingsSbs1();
-		case SBS_V2:
-			return CreateListingsSbs2();
-		default:
-			return false;
-		}
-	}
-	#endif
-	return true;
-}
-
-bool CATProject::CreateListingsSbs1()
-{
-	LOG_FUNC_ENTRY("CATProject::CreateListingsSbs1");
-	string sCommand;
-	if ( m_bAbldTest )
-		sCommand = "abld test listing ";
-	else
-		sCommand = "abld listing ";
-
-	// Listing
-	if ( m_sVariant.empty() )
-	{
-		// No variant
-		sCommand.append( m_sPlatform );
-	}
-	else
-	{
-		// Use specified variant
-		sCommand.append( m_sPlatform );
-		sCommand.append( "." );
-		sCommand.append( m_sVariant );
-	}
-	// udeb vs urel
-	sCommand.append( " " );
-	sCommand.append( GetBuildTypeString() );
-
-	if ( m_vTargetModules.size() > 1 )
-	{
-		RunAbldCommandToAllTargets( sCommand );
-	}
-	else
-	{
-		AddTargetModuleIfDefined( sCommand ); 
-		cout << AT_MSG_SYSTEM_CALL << sCommand << endl;
-		(void)system( sCommand.c_str() );
-	}
-	return true;
-}
-
-bool CATProject::CreateListingsSbs2()
-{
-	LOG_FUNC_ENTRY("CATProject::CreateListingsSbs2");
-	string sCmd( m_sBuildCommand );
-	sCmd.append( RAPTOR_LISTING_LOG );
-	sCmd.append( " LISTING");
-	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
-	int iRet = (int)system( sCmd.c_str() );
-	if ( iRet == 0 )
-		return true;
-	return false;
-}
-
-bool CATProject::CopyReleasables()
-{
-	bool bRet = true;
-	LOG_FUNC_ENTRY("CATProject::CopyReleasables");
-	// Only copy releasables on armv5 platform and no addr2line defined.
-	#ifndef ADDR2LINE
-	if ( _stricmp( m_sPlatform.c_str(), "armv5" ) == 0 ) 
-	{
-		for( size_t i = 0; i < m_vModules.size(); i++ )
-		{
-			if ( ! m_vModules.at(i)->CopyReleasables() )
-				bRet = false;
-		}
-		// Static libraries lst files.
-		// First create directory for them (delete old one if exists).
-		if ( ! DirectoryExists( AT_TEMP_LST_DIR ) )
-		{
-			DirCreate( AT_TEMP_LST_DIR, true );
-		}
-		else
-		{
-			DirDelete( AT_TEMP_LST_DIR, true );
-			DirCreate( AT_TEMP_LST_DIR, true );
-		}
-		for ( size_t i = 0 ; i < m_vStaticLibraries.size(); i ++ )
-		{
-			if( ! m_vStaticLibraries.at(i)->CopyLstFilesToDir( AT_TEMP_LST_DIR ) )
-				bRet = false;
-		}
-
-		// Delete lst files from all type of modules in project.
-		// Ignoring errors because different modules might use same source/lst files.
-		for( size_t i = 0; i < m_vModules.size(); i++ )
-			m_vModules.at(i)->DeleteLstFilesFromSrc();
-		for ( size_t i = 0 ; i < m_vUnsupportedModules.size(); i ++ )
-			m_vUnsupportedModules.at(i)->DeleteLstFilesFromSrc();
-		for ( size_t i = 0 ; i < m_vStaticLibraries.size(); i ++ )
-			m_vStaticLibraries.at(i)->DeleteLstFilesFromSrc();
-		
-		return bRet;
-	}
-	#endif
-	// When addr2line defined and used we use symbol and map file(s).
-	#ifdef ADDR2LINE
-	if ( _stricmp( m_sPlatform.c_str(), "armv5" ) == 0 )
-	{
-		// Verify that module(s) symbol file(s) exist
-		for( size_t i = 0; i < m_vModules.size(); i++ )
-		{
-			// Check symbol file.
-			if ( ! m_vModules.at(i)->SymbolFileExist() )
-				bRet = false;
-			// Check map  file.
-			if ( ! m_vModules.at(i)->MapFileExist() )
-				bRet = false;
-		}
-	}
-	#endif
-	// Platform winscw.
-	else if ( _stricmp( m_sPlatform.c_str(), "winscw" ) == 0 )
-	{
-		// Verify that module(s) binaries exist
-		for( size_t i = 0; i < m_vModules.size(); i++ )
-		{
-			if ( ! m_vModules.at(i)->BinaryFileExist() )
-				bRet = false;
-		}
-		// For static libraries binary/target is same as their library.
-		for ( size_t i = 0 ; i < m_vStaticLibraries.size(); i ++ )
-			if ( ! m_vStaticLibraries.at(i)->BinaryFileExist() )
-				bRet = false;
-	}
-	// Platform gcce.
-	else if ( _stricmp( m_sPlatform.c_str(), "gcce" ) == 0 )
-	{
-		// Verify that module(s) symbol file(s) exist
-		for( size_t i = 0; i < m_vModules.size(); i++ )
-		{
-			// Check symbol file.
-			if ( ! m_vModules.at(i)->SymbolFileExist() )
-				bRet = false;
-		}
-	}
-	return bRet;
-}
-
-// ----------------------------------------------------------------------------
-// Write project's (user) attributes to a file under temp folder
-// ----------------------------------------------------------------------------
-bool CATProject::WriteAttributes() const
-{
-	LOG_FUNC_ENTRY("CATProject::WriteAttributes");
-	// File to write to
-	string sOutFile( AT_TEMP_DIR );
-	sOutFile.append( "\\" );
-	sOutFile.append( AT_PROJECT_ATTRIBUTES_FILE_NAME );
-	// Open file truncate if exists
-	ofstream out( sOutFile.c_str(), ios_base::trunc );
-	// Check file opened successfully
-	if ( ! out.good() )
-		return false;
-	// Write attributes line by line
-	out << m_bUninstrumented << endl; // Is project instrumented
-	// Sbs version
-	if ( m_eBuildSystem == CATProject::SBS_V2 )
-		out << "SBS_2" << endl; 
-	else
-		out << "SBS_1" << endl;
-	out << endl; // Reserved for possible binary data
-	out << m_sPlatform << endl;
-	out << m_sVariant << endl;
-	out << m_eLoggingMode << endl;
-	out << m_eBuildType << endl;
-	out << m_sS60FileName << endl;
-	out << m_iAllocCallStackSize << endl;
-	out << m_iFreeCallStackSize << endl;
-	for ( size_t i = 0 ; i < m_vTargetModules.size() ; i++ )
-		out << m_vTargetModules.at(i) << AT_PROJECT_ATTRIBUTES_SEPARATOR;
-	out << endl;
-	out << m_sBuildCommand << endl;
-	out.close();
-	return true;
-}
-// ----------------------------------------------------------------------------
-// Reads project's (user) attributes to a file under temp folder
-// ----------------------------------------------------------------------------
-bool CATProject::ReadAttributes()
-{
-	LOG_FUNC_ENTRY("CATProject::ReadAttributes");
-	// File to read on
-	string sInFile( AT_TEMP_DIR );
-	sInFile.append( "\\" );
-	sInFile.append( AT_PROJECT_ATTRIBUTES_FILE_NAME );
-	// Open file
-	ifstream in( sInFile.c_str() );
-	// Check file opened successfully
-	if ( ! in.good() )
-		return false;
-	// Read attributes
-	char cLine[ MAX_LINE_LENGTH ];
-	string sLine;
-	in.getline( cLine, MAX_LINE_LENGTH );
-	int iValue = atoi( cLine );
-	if ( iValue == 1 )
-		m_bUninstrumented = true;
-	else
-		m_bUninstrumented = false;
-	// Sbs version
-	in.getline( cLine, MAX_LINE_LENGTH ); string sBuildSystem = string( cLine );
-	if ( sBuildSystem.compare( "SBS_1" ) == 0 )
-		m_eBuildSystem = CATProject::SBS_V1;
-	else if ( sBuildSystem.compare( "SBS_2" ) == 0 )
-		m_eBuildSystem = CATProject::SBS_V2;
-	else {
-		LOG_STRING("Error invalid build system defined in project.cfg");
-		m_eBuildSystem = CATProject::SBS_V1;
-	}
-	in.getline( cLine, MAX_LINE_LENGTH ); // reserverd for possible binary timestamp or similar
-	in.getline( cLine, MAX_LINE_LENGTH ); m_sPlatform = string( cLine );
-	in.getline( cLine, MAX_LINE_LENGTH ); m_sVariant = string( cLine );
-	in.getline( cLine, MAX_LINE_LENGTH ); m_eLoggingMode = atoi( cLine );
-	in.getline( cLine, MAX_LINE_LENGTH ); m_eBuildType = atoi( cLine );
-	in.getline( cLine, MAX_LINE_LENGTH ); m_sS60FileName = string( cLine );
-	in.getline( cLine, MAX_LINE_LENGTH ); m_iAllocCallStackSize = atoi( cLine );
-	in.getline( cLine, MAX_LINE_LENGTH ); m_iFreeCallStackSize = atoi( cLine );
-	in.getline( cLine, MAX_LINE_LENGTH ); sLine = cLine;
-	size_t iSpot = sLine.find( AT_PROJECT_ATTRIBUTES_SEPARATOR );
-	while ( iSpot != string::npos )
-	{
-		string sTarget = sLine.substr(0, iSpot );
-		m_vTargetModules.push_back( sTarget );
-		sLine.erase(0, iSpot + AT_PROJECT_ATTRIBUTES_SEPARATOR.size() );
-		iSpot = sLine.find( AT_PROJECT_ATTRIBUTES_SEPARATOR );
-	}
-	in.getline( cLine, MAX_LINE_LENGTH ); m_sBuildCommand = cLine;
-	in.close();
-	return true;
-}
-
-// ----------------------------------------------------------------------------
-// Creates atool_temp directory to current folder if does not exist
-// ----------------------------------------------------------------------------
-bool CATProject::MakeTempDirIfNotExist()
-{
-	LOG_FUNC_ENTRY("CATProject::MakeTempDirIfNotExist");
-	if ( ! DirectoryExists( AT_TEMP_DIR ) )
-	{
-		if( !CreateDirectory( AT_TEMP_DIR , NULL ) )
-		{
-			return false;
-		}
-	}
-	return true;
-}
-// ----------------------------------------------------------------------------
-// Utilities
-// ----------------------------------------------------------------------------
-
-bool CATProject::RunAbldCommandToAllTargets( const string& sCommand )
-{
-	LOG_FUNC_ENTRY("CATProject::RunAbldCommandToAllTargets");
-
-	// Check for space at the commands end.
-	string sSystemCall( sCommand );
-	if ( *(sSystemCall.rbegin()) != ' ' )
-		sSystemCall.append( " " );
-
-	// Loop calls.
-	bool bRet = true;
-	for ( vector<string>::iterator it = m_vTargetModules.begin(); it < m_vTargetModules.end(); it++ )
-	{
-		string sCall( sSystemCall );
-		sCall.append( RemovePathAndExt( *it, true ) );
-		cout << AT_MSG_SYSTEM_CALL << sCall << endl;
-		if ( (int) system( sCall.c_str() ) != 0 )
-			bRet = false;
-	}
-	return bRet;
-}
-
-void CATProject::AddTargetModuleIfDefined( string& sCmd )
-{
-	LOG_FUNC_ENTRY("CATProject::AddTargetModuleIfDefined");
-	// Do we have target modules defined
-	if ( m_vTargetModules.size() > 0 )
-	{
-		switch( m_eBuildSystem )
-		{
-		case SBS_V1:
-			// Add first target modules name without extension to build cmd.
-			sCmd.append( " " );
-			sCmd.append( RemovePathAndExt( m_vTargetModules.at( 0 ), true ) );
-			break;
-		case SBS_V2:
-			// Add all target modules to build command using raptor switch '-p'.
-			for( size_t i = 0 ; i < m_vTargetModules.size() ; i++ )
-			{
-				LOG_STRING("Adding :" << m_vTargetModules.at( i ) );
-				sCmd.append( " -p " );
-				sCmd.append( m_vTargetModules.at( i ) );
-			}
-			break;
-		}
-	}
-}
-
-bool CATProject::IsTargetModuleInProject() const
-{
-	LOG_FUNC_ENTRY("CATProject::IsTargetModuleInProject");
-	vector<CATModule2*>::const_iterator modules;
-	vector<CATModule2*>::const_iterator staticModules;
-	vector<string>::const_iterator targets;
-	bool bRet = true;
-	// Do we have target modules defined
-	if ( m_vTargetModules.size() > 0 )
-	{
-		// Sbs version 1 support only single target module.
-		if ( m_eBuildSystem == SBS_V1 )
-		{
-			// Try to find module from project.
-			bRet = false;
-			string sTarget = m_vTargetModules.at(0);
-			for( modules = m_vModules.begin() ; modules != m_vModules.end() ; modules++ )
-			{
-				if( (*modules)->GetMmpFile().find( sTarget ) != string::npos )
-				{
-					// Found it return true.
-					bRet = true;
-					break;
-				}
-			}
-			for( staticModules = m_vStaticLibraries.begin(); staticModules != m_vStaticLibraries.end(); staticModules++ )
-			{
-				if( (*staticModules)->GetMmpFile().find( sTarget ) != string::npos )
-				{
-					bRet = true;
-					break;
-				}
-			}
-			if ( ! bRet )
-			{
-				// Not found display error message.
-				cout << AT_MSG << "Error, " << sTarget << " not defined in project." << endl;
-			}
-		}
-		// Sbs version 2 supports multiple target modules.
-		else if ( m_eBuildSystem == SBS_V2 )
-		{
-			// Check that all targets are defined in project.
-			for( targets = m_vTargetModules.begin(); targets != m_vTargetModules.end() ; targets++ )
-			{
-				// Found iterated target?
-				bool bFound = false;
-				for ( modules = m_vModules.begin() ; modules != m_vModules.end() ; modules++ )
-				{
-					if( (*modules)->GetMmpFile().find( *targets ) != string::npos )
-					{
-						// yes.
-						bFound = true;
-						break;
-					}
-				}
-				for( staticModules = m_vStaticLibraries.begin(); staticModules != m_vStaticLibraries.end(); staticModules++ )
-				{
-					if( (*staticModules)->GetMmpFile().find( *targets ) != string::npos )
-					{
-						bFound = true;
-						break;
-					}
-				}
-				if ( ! bFound )
-				{
-					// Display error when not found and set return value false.
-					bRet = false;
-					cout << AT_MSG << "Error, " << targets->c_str() << " not defined in project." << endl;
-				}
-			}
-		}
-	}
-	return bRet;
-}
-
-string CATProject::GetBuildTypeString()
-{
-	LOG_LOW_FUNC_ENTRY("CATProject::GetBuildTypeString");
-	// Return build type as lowercase string
-	switch( m_eBuildType )
-	{
-	case UDEB:
-		return string("udeb");
-	case UREL:
-		return string("urel");
-	default:
-		return "";
-	}
-}
-
-string CATProject::GetBuildTypeString( int eType )
-{
-	LOG_LOW_FUNC_ENTRY("CATProject::GetBuildTypeString( int eType )");
-	// Return build type as lowercase string
-	switch( eType )
-	{
-	case UDEB:
-		return string("udeb");
-	case UREL:
-		return string("urel");
-	default:
-		return string("unknown");
-	}
-}
-
-bool CATProject::CleanTemporaryDirs()
-{
-	LOG_FUNC_ENTRY("CATProject::CleanTemporaryDirs");
-	bool bRet = true;
-	// Modules
-	for( size_t i = 0; i < m_vModules.size(); i++ )
-	{
-		if ( ! m_vModules.at(i)->CleanTemporaryDir() )
-			bRet = false;
-	}
-	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
-	{
-		if ( ! m_vStaticLibraries.at(i)->CleanTemporaryDir() )
-			bRet = false;
-	}
-	// Projects
-	vector<string> vFileList = DirList( AT_TEMP_DIR, false , true );
-	vector<string>::iterator it2 = vFileList.begin();
-	// Size of constant table
-	int iCount = sizeof( TEMP_EXTENSION_NO_DELETE ) / sizeof( string );
-	while ( it2 != vFileList.end() )
-	{
-		// Get extension and compare it to list
-		bool bDelete = true;
-		string sExtension = GetExtension( *it2 );
-		ChangeToLower( sExtension );
-		for ( int i = 0 ; i < iCount ; i++ )
-		{
-			if( sExtension.compare( TEMP_EXTENSION_NO_DELETE[i] ) == 0 )
-			{
-				bDelete = false;
-				break;
-			}
-		}
-		if ( bDelete )
-		{
-			// Delete file
-			if ( ! FileDelete( *it2, true ) )
-				bRet = false;
-		}
-		// Increment
-		it2++;
-	}
-	return bRet;
-}
-
-bool CATProject::DeleteTemporaryDirs()
-{
-	LOG_FUNC_ENTRY("CATProject::DeleteTemporaryDirs");
-	bool bRet = true;
-	// Modules
-	for( size_t i = 0; i < m_vModules.size(); i++ )
-	{
-		if (! m_vModules.at(i)->DeleteTemporaryDir() )
-			bRet = false;
-	}
-	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
-	{
-		if (! m_vStaticLibraries.at(i)->DeleteTemporaryDir() )
-			bRet = false;
-	}
-	return bRet;
-}
-
-bool CATProject::InitSbs1MakeFileWithPathToTemp()
-{
-	LOG_FUNC_ENTRY("CATProject::InitSbs1MakeFileWithPathToTemp");
-	// Use temporary folder
-	m_sMakeFile.clear();
-	m_sMakeFile.append( AT_TEMP_DIR );
-	m_sMakeFile.append( "\\" );
-	m_sMakeFile.append( AT_LEVEL_1_MAKEFILE_NAME );
-	// At end check does it exist, return the result.
-	return FileExists( m_sMakeFile.c_str() );
-}
-
-bool CATProject::InitSbs1MakeFileWithPath()
-{
-	LOG_FUNC_ENTRY("CATProject::InitMakeFileWithPath");
-	if ( m_sEpocRoot.empty() )
-	{
-		LOG_STRING("Error, epocroot is not set.");
-		return false;
-	}
-	m_sMakeFile.clear();
-	m_sMakeFile.append( m_sEpocRoot );
-	if( *m_sMakeFile.rbegin() != '\\' )
-		m_sMakeFile.append( "\\" );
-	m_sMakeFile.append( "epoc32\\build\\" );
-	// Add current directory to path (first remove driveletter).
-	string sCurrentDir( m_cCurrentDir );
-	if ( sCurrentDir.length() < 3 )
-	{
-		LOG_STRING("Error, current dir invalid.");
-		return false;
-	}
-	sCurrentDir.erase(0,3);
-	m_sMakeFile.append( sCurrentDir );
-	m_sMakeFile.append( "\\" );
-	// Platform
-	string sPlatInUpper( m_sPlatform);
-	ChangeToUpper( sPlatInUpper );
-	m_sMakeFile.append( sPlatInUpper );
-	// Possible variant
-	if ( m_sVariant.empty() )
-	{
-		// Test modules only?
-		if ( m_bAbldTest )
-			m_sMakeFile.append( "TEST" );
-		m_sMakeFile.append( "." );
-		m_sMakeFile.append( "MAKE" );
-	}
-	else
-	{
-		m_sMakeFile.append( "." );
-		m_sMakeFile.append( m_sVariant );
-		// Test modules only?
-		if ( m_bAbldTest )
-			m_sMakeFile.append( "TEST" );
-		m_sMakeFile.append( ".MAKE" );
-	}
-	// At end check does it exist, return the result.
-	return FileExists( m_sMakeFile.c_str() );
-}
-
-// ----------------------------------------------------------------------------
-// Get & Sets
-// ----------------------------------------------------------------------------
-void CATProject::SetBuildSystem( BUILD_SYSTEM eSystem )
-{
-	LOG_FUNC_ENTRY("CATProject::SetBuildSystem");
-	m_eBuildSystem = eSystem;
-}
-void CATProject::SetMode( PROJECT_MODE eMode )
-{
-	LOG_FUNC_ENTRY("CATProject::SetMode");
-	m_eMode = eMode;
-}
-int CATProject::GetMode() const
-{
-	LOG_LOW_FUNC_ENTRY("CATProject::GetMode");
-	return m_eMode;
-}
-void CATProject::SetEpocRoot( const string& sEpocRoot )
-{
-	LOG_FUNC_ENTRY("CATProject::SetEpocRoot");
-	m_sEpocRoot = sEpocRoot;
-}
-void CATProject::SetPlatform( const string& sPlatform )
-{
-	LOG_FUNC_ENTRY("CATProject::SetPlatform");
-	m_sPlatform = sPlatform;
-}
-void CATProject::SetVariant( const string& sVariant )
-{
-	LOG_FUNC_ENTRY("CATProject::SetVariant");
-	m_sVariant = sVariant;
-}
-void CATProject::SetLoggingMode( LOGGING_MODE eLoggingMode)
-{
-	LOG_FUNC_ENTRY("CATProject::SetLoggingMode");
-	m_eLoggingMode = eLoggingMode;
-}
-void CATProject::SetAllocCallStackSize( int iAllocCallStackSize )
-{
-	m_iAllocCallStackSize = iAllocCallStackSize;
-}
-void CATProject::SetFreeCallStackSize( int iFreeCallStackSize )
-{
-	m_iFreeCallStackSize = iFreeCallStackSize;
-}
-void CATProject::SetBuildType( BUILD_TYPE eType )
-{
-	LOG_FUNC_ENTRY("CATProject::SetBuildType");
-	m_eBuildType = eType;
-}
-void CATProject::SetS60FileName( const string& sFileName)
-{
-	LOG_FUNC_ENTRY("CATProject::SetS60FileName");
-	m_sS60FileName = sFileName;
-}
-void CATProject::SetRomSymbolFiles(const vector<string>& vRomSymbolFiles)
-{
-	LOG_FUNC_ENTRY("CATProject::SetRomSymbolFiles");
-	m_vRomSymbolFiles = vRomSymbolFiles;
-}
-void CATProject::SetTargetModule(const string& sTargetModule)
-{
-	LOG_FUNC_ENTRY("CATProject::SetTargetModule");
-	m_sTargetModule = sTargetModule;
-	ChangeToLower( m_sTargetModule);
-}
-void CATProject::SetBinaryTarget(const string& sBinaryTarget)
-{
-	LOG_FUNC_ENTRY("CATProject::SetBinaryTarget");
-	m_sBinaryTarget = sBinaryTarget;
-	ChangeToLower( m_sBinaryTarget );
-}
-void CATProject::SetDataFile( const string& sDataFile )
-{
-	LOG_FUNC_ENTRY("CATProject::SetDataFile");
-	m_sDataFile = sDataFile;
-}
-void CATProject::SetLogLevel( int iLogLevel )
-{
-	LOG_FUNC_ENTRY("CATProject::SetLogLevel");
-	m_iLoggingLevel = iLogLevel;
-}
-void CATProject::SetDataFileOutput( const string& sDataFileOutput )
-{
-	LOG_FUNC_ENTRY("CATProject::SetDataFileOutput");
-	m_sDataFileOutput = sDataFileOutput;
-}
-void CATProject::SetTargetModules( const vector<string>& vTargetModules )
-{
-	LOG_FUNC_ENTRY("CATProject::SetTargetModules");
-	m_vTargetModules = vTargetModules;
-}
-void CATProject::SetBuildCommand( const string& sBuildCommand )
-{
-	LOG_FUNC_ENTRY("CATProject::SetBuildCommand");
-	m_sBuildCommand = sBuildCommand;
-}
-// End of file
--- a/analyzetool/commandlineengine/src/arguments.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,798 +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:  Argument parsing functions.
-*/
-#include "../inc/ATCommonDefines.h"
-#include "../inc/CATBase.h"
-
-//Forward declarations.
-bool parseBaseArguments( vector<string>& vArgs, ARGUMENTS& args );
-bool parseHookArguments( vector<string>& vArgs, ARGUMENTS& args );
-bool parseAnalyzeArguments( vector<string>& vArgs, ARGUMENTS& args );
-bool parseParseArguments( vector<string>& vArgs, ARGUMENTS& args );
-bool checkDataFileName( string& sFileName );
-bool parseSbsConfiguration( string& sConfiguration, ARGUMENTS& args );
-
-// Constants for old "hooking" parameter parsing.
-#define INVALID_PARAMETER "AnalyzeTool : Error, invalid parameter: "
-const char DATAFILENAME_INVALID_CHARS[] = " &^+-@$%*()|\\/[]{}<>?;:,\"'";
-
-/**
-* Check datafile name for invalid characters.
-* @return true if file name ok.
-*/
-bool checkDataFileName( string& sFileName )
-{
-	for ( size_t i = 0; i < sFileName.length(); i++ )
-	{
-		const char c = sFileName.at( i );
-		if( strchr( DATAFILENAME_INVALID_CHARS, c ) != 0 )
-			return false;
-	}
-	return true;
-}
-
-/**
-* Parse base arguments from given vector of strings.
-* Removes debug / help arguments from vector.
-*/
-bool parseBaseArguments( vector<string>& vArgs, ARGUMENTS& args )
-{
-	// Iterator used in this function.
-	vector<string>::iterator it;
-	// If no arguments set show help true.
- 	if ( vArgs.size() == 0 )
-	{
-		args.eMainSwitch = SWITCH_UNKNOWN;
-		args.bHelp = true;
-	}
-	//Try find help and debug switches.
-	//Note: -help is main switch what shows syntax examples.
-	for(it = vArgs.begin(); it != vArgs.end(); it++ )
-	{
-		//Help switches.
-		if ( ! _stricmp( (*it).c_str(), "-?" ) )
-		{
-			args.bHelp = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "--?" ) )
-		{
-			args.bHelp = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "--help" ) )
-		{
-			args.bHelp = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "/?" ) )
-		{
-			args.bHelp = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		//Debug switches.
-		else if ( ! _stricmp( (*it).c_str(), "-show_debug" ) )
-		{
-			args.bDebugConsole = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "--show_debug" ) )
-		{
-			args.bDebugConsole = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "-show_debug_all" ) )
-		{
-			args.bDebugConsole = true;
-			args.bDebugLowLevel = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "--show_debug_all" ) )
-		{
-			args.bDebugConsole = true;
-			args.bDebugLowLevel = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "-show_dbgview" ) )
-		{
-			args.bDebugDbgView = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "--show_dbgview" ) )
-		{
-			args.bDebugDbgView = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "-show_dbgview_all" ) )
-		{
-			args.bDebugDbgView = true;
-			args.bDebugLowLevel = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "--show_dbgview_all" ) )
-		{
-			args.bDebugDbgView = true;
-			args.bDebugLowLevel = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-		//Raptor switch.
-		else if ( ! _stricmp( (*it).c_str(), "-sbs2" ) )
-		{
-			args.bEnableSbs2 = true;
-			it = vArgs.erase( it );
-			if ( it == vArgs.end() )
-				break;
-		}
-	}
-	if ( vArgs.size() > 0 )
-	{
-		//Pick up main switch.
-		it = vArgs.begin();
-		if ( ! _stricmp( (*it).c_str(), "-a" ) )
-			args.eMainSwitch = SWITCH_ANALYZE;
-		else if ( ! _stricmp( (*it).c_str(), "-p" ) )
-			args.eMainSwitch = SWITCH_PARSE_TRACE;
-		else if ( ! _stricmp( (*it).c_str(), "-c" ) )
-			args.eMainSwitch = SWITCH_CLEAN;
-		else if ( ! _stricmp( (*it).c_str(), "-v" ) )
-			args.eMainSwitch = SWITCH_VERSION;
-		else if ( ! _stricmp( (*it).c_str(), "-vdbghelp" ) )
-			args.eMainSwitch = SWITCH_DBGHELP_VERSION;
-		else if ( ! _stricmp( (*it).c_str(), "-help" ) )
-			args.eMainSwitch = SWITCH_HELP;
-		else if ( ! _stricmp( (*it).c_str(), "-me" ) )
-		{
-			args.eMainSwitch = SWITCH_HOOK;
-			args.eHookSwitch = HOOK_EXTERNAL;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "-e" ) )
-		{
-			args.eMainSwitch = SWITCH_HOOK;
-			args.eHookSwitch = HOOK_EXTERNAL_FAST;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "-mi" ) )
-		{
-			args.eMainSwitch = SWITCH_HOOK;
-			args.eHookSwitch = HOOK_INTERNAL;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "-instrument_i" ) )
-		{
-			args.eMainSwitch = SWITCH_HOOK;
-			args.eHookSwitch = HOOK_EXTENSION_INTERNAL;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "-instrument_e" ) )
-		{
-			args.eMainSwitch = SWITCH_HOOK;
-			args.eHookSwitch = HOOK_EXTENSION_EXTERNAL;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "-instrument_ef" ) )
-		{
-			args.eMainSwitch = SWITCH_HOOK;
-			args.eHookSwitch = HOOK_EXTENSION_EXTERNAL_FAST;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "-uninstrument" ) )
-		{
-			args.eMainSwitch = SWITCH_UNHOOK;
-			args.eHookSwitch = HOOK_EXTENSION_UNINSTRUMENT;
-		}
-		else if ( ! _stricmp( (*it).c_str(), "-uninstrument_failed" ) )
-		{
-			args.eMainSwitch = SWITCH_UNHOOK;
-			args.eHookSwitch = HOOK_EXTENSION_FAILED;
-		}
-	}
-	return true;
-}
-
-/**
-* Parse analyze related arguments from given vector of strings.
-*/
-bool parseAnalyzeArguments( vector<string>& vArgs, ARGUMENTS& args )
-{
-	bool bRet = true;
-	if ( vArgs.size() < 2 )
-	{
-		cout << AT_MSG << "Error, missing datafile." << endl;
-		return false;
-	}
-	// Iterator used in this function.
-	vector<string>::const_iterator it;
-	for(it = vArgs.begin()+1; it != vArgs.end(); it++ )
-	{
-		if ( it->find("-l") != string::npos )
-		{
-			if ( it->length() == 3 )
-			{
-				// Create char array for atoi function
-				char level[2];
-				level[0] = it->at(2);
-				level[1] = 0; // null terminate
-				// check that its digit first
-				if ( isdigit(level[0]) )
-				{
-					// pass array to atoi
-					int iLoggingLevel = atoi( level );
-					if ( iLoggingLevel >= 0 && iLoggingLevel <= 3 )
-					{
-						// log level ok
-						args.ANALYZE.iLoggingLevel = iLoggingLevel;
-						continue;
-					}
-				}
-				bRet = false;
-				cout << AT_MSG << "Invalid logging level specified (0-3)." << endl;
-				args.ANALYZE.iLoggingLevel = -1;
-			}
-		}
-		// No else here because logging level check is done to all args in list.
-		// Rom symbol file
-		if( _stricmp( it->c_str(), "-s" ) == 0 )
-		{
-			it++;
-			if ( it == vArgs.end() )
-			{
-				bRet = false;
-				cout << AT_MSG << "Missing symbol file." << endl;
-				break; // Leave for loop.
-			}
-			else
-			{
-				args.ANALYZE.bSymbolFile = true;
-				args.ANALYZE.vSymbolFiles.push_back( *it );
-				continue;
-			}
-		}
-		else 
-		{
-			// If we got datafile we must assume this is output
-			if( ! args.ANALYZE.sDataFile.empty() )
-			{
-				if ( args.ANALYZE.sOutputFile.empty() )
-					args.ANALYZE.sOutputFile = *it;
-				else
-				{
-					bRet = false;
-					cout << AT_MSG << "Invalid parameter: " << *it << endl;
-				}
-			}
-			// If this is file we assume datafile
-			else if( CATBase::FileExists( it->c_str() ) )
-			{
-				args.ANALYZE.sDataFile = *it;
-			}
-			else
-			{
-				bRet = false;
-				cout << AT_MSG << "Specified datafile does not exist." << endl;
-			}
-		}
-	}
-	if ( args.ANALYZE.sDataFile.empty() )
-		bRet = false;
-	return bRet;
-}
-
-
-/**
-* Parse hooking related arguments from given vector of strings.
-*/
-bool parseHookArguments( vector<string>& vArgs, ARGUMENTS& args )
-{
-	bool bRet = true;
-	try {
-		// Iterator used in this function.
-		vector<string>::const_iterator it;
-
-		// Check that we have some arguments except main switch.
-		if ( vArgs.size() < 2 )
-		{
-			if ( args.eHookSwitch == HOOK_EXTENSION_UNINSTRUMENT
-				|| args.eHookSwitch == HOOK_EXTENSION_FAILED
-				)
-				return bRet;
-			cout << AT_MSG << "Error, Missing build command." << endl;
-			bRet = false;
-		}
-		bool bBuildFound = false;
-		for(it = vArgs.begin()+1; it != vArgs.end(); it++ )
-		{
-			// If's to pickup atool options
-			// no build switch
-			if ( _stricmp( it->c_str(), "-nobuild" ) == 0 )
-			{
-				args.HOOK.bNoBuild = true;
-			}
-			// call stack size(s)
-			else if ( _stricmp( it->c_str(), "-acs" ) == 0 || _stricmp( it->c_str(), "-fcs" ) == 0 )
-			{
-				// Free vs Alloc
-				bool bAlloc = true;
-				if ( _stricmp( it->c_str(), "-fcs" ) == 0 )
-					bAlloc = false;
-				// Value
-				it++;
-				if ( it== vArgs.end() )
-				{
-					bRet = false;
-					cout << AT_MSG << "Error, missing call stack size parameter." << endl;
-					break;
-				}
-				else if ( ! _stricmp( it->c_str(), "sbs" ) 
-					|| ! _stricmp( it->c_str(), "abld" )
-					|| ! _stricmp( it->c_str(), "-f" ) )
-				{
-					bRet = false;
-					cout << AT_MSG << "Error, missing call stack size parameter." << endl;
-					break;
-				}
-				else
-				{
-					int i;
-					// Try to parse integer value using stream.
-					istringstream ss( *it );
-					if ( ss>>i )
-					{
-						// Value parsed ok now check bounds.
-						if ( i < AT_CALL_STACK_SIZE_MIN  )
-						{
-							bRet = false;
-							cout << AT_MSG << "Error, specified call stack size value too small." << endl;
-							break;
-						}
-						else if ( i > AT_CALL_STACK_SIZE_MAX )
-						{
-							bRet = false;
-							cout << AT_MSG << "Error, specified call stack size value too big." << endl;
-							break;
-						}
-						else
-						{
-							// Value valid.
-							if ( bAlloc )
-								args.HOOK.iAllocCallStackSize = i;
-							else
-								args.HOOK.iFreeCallStackSize = i;
-						}
-					}
-					else
-					{
-						// Error parsing value using stream.
-						bRet = false;
-						cout << AT_MSG << "Error, specified call stack size value invalid." << endl;
-						break;
-					}
-
-				}
-			}
-			// Data file name.
-			else if ( _stricmp( it->c_str(), "-f" ) == 0 )
-			{
-				it++;
-				if ( it == vArgs.end() )
-				{
-					bRet = false;
-					cout << AT_MSG << "Error, missing internal data gathering file name." << endl;
-					break;
-				}
-				else if ( ! _stricmp( it->c_str(), "sbs" ) || ! _stricmp( it->c_str(), "abld" ) )
-				{
-					bRet = false;
-					cout << AT_MSG << "Error, missing internal data gathering file name." << endl;
-					break;
-				}
-				else
-				{
-					if ( checkDataFileName( string( *it ) ) )
-					{
-						// Pickup filename.
-						args.HOOK.bDataFileName = true;
-						args.HOOK.sDataFileName = *it;
-					}
-					else
-					{
-						bRet = false;
-						cout << AT_MSG << "Error, specified internal data gathering file name contains invalid character(s)." << endl;
-						break;
-					}
-				}
-			}
-			// Build command parsing.
-			else if ( _stricmp( it->c_str(), "sbs" ) == 0 )
-			{
-				// By default sbs command is not valid.
-				bRet = false;
-				// By default build found
-				bBuildFound = true;
-				// Use raptor build system, pickup all rest arguments to sbs commmand.
-				bool bFoundConfig = false; // Is configuration defined.
-				args.HOOK.iBuildSystem = 2;
-				vector<string>::const_iterator itC = it;
-				args.HOOK.sBuildCmd.clear();
-				for ( ; itC != vArgs.end() ; itC++ )
-				{
-					args.HOOK.sBuildCmd.append( *itC );
-					args.HOOK.sBuildCmd.append( " " );
-					args.HOOK.vBuildCmd.push_back( *itC );
-				}
-				// Remove last space
-				if ( args.HOOK.vBuildCmd.size() > 1 )
-					args.HOOK.sBuildCmd.erase( args.HOOK.sBuildCmd.size()-1 );
-
-				// Parse needed variables from sbs command.
-				vector<string>::iterator itSbs;
-				for( itSbs = args.HOOK.vBuildCmd.begin(); itSbs != args.HOOK.vBuildCmd.end() ; itSbs++ )
-				{
-					// Program(s).
-					if ( _stricmp( itSbs->c_str(), "-p" ) == 0 )
-					{
-						// Next is program.
-						itSbs++;
-						args.HOOK.vTargetPrograms.push_back( *itSbs );
-					}
-					else if ( itSbs->find( "--project=" ) != string::npos )
-					{
-						itSbs->erase(0, 10 );
-						args.HOOK.vTargetPrograms.push_back( *itSbs );
-					}
-					// platform & build type ( configuration )
-					else if ( _stricmp( itSbs->c_str(), "-c" ) == 0 || itSbs->find( "--config=" ) != string::npos )
-					{
-						// Error message if config found more than once.
-						if ( bFoundConfig )
-						{
-							cout << AT_MSG << "Error, no support defining more than one configuration." << endl;
-							bRet = false;
-							continue;
-						}
-
-						if (_stricmp( itSbs->c_str(), "-c" ) == 0 )
-						{
-							// Next is the configuration
-							itSbs++;
-							// Check that iterator is valid.
-							if ( itSbs == args.HOOK.vBuildCmd.end() )
-								break;
-						}
-						else
-						{
-							// Remove the "--config=".
-							itSbs->erase( 0, 9 );
-							// Check its not empty.
-							if ( itSbs->size() == 0 )
-								break;
-						}
-						
-						// Identify configuration, if successful set sbs command as valid.
-						if ( parseSbsConfiguration( *itSbs, args ) )
-							bRet = true;
-						// Set we encountered one configuration.
-						bFoundConfig = true;
-					}
-				}
-				// Error message if command is missing configuration.
-				if ( !bFoundConfig )
-					cout << AT_MSG << "Error, missing configuration definition from sbs cmd." << endl;
-			}
-			else if ( _stricmp( it->c_str(), "abld" ) == 0 )
-			{
-				bBuildFound = true;
-				// Use abld build system, pickup all rest argumenst as abld options.
-				args.HOOK.iBuildSystem = 1;
-				
-				vector<string>::const_iterator itC = it;
-				args.HOOK.sBuildCmd.clear();
-				for ( ; itC != vArgs.end() ; itC++ )
-				{
-					args.HOOK.sBuildCmd.append( *itC );
-					args.HOOK.sBuildCmd.append( " " );
-					args.HOOK.vBuildCmd.push_back( *itC );
-				}
-				
-				string sCmd( args.HOOK.sBuildCmd ); // build command to lower case here.
-				for( size_t i = 0 ; i < sCmd.size(); i++ )
-					sCmd.at(i) = tolower( sCmd.at(i) );
-
-				// Remove all until platform
-				if ( sCmd.find("build ") != string::npos )
-				{
-					// Check is test defined
-					if ( sCmd.substr(0, sCmd.find("build ")).find("test") != string::npos )
-						args.HOOK.bAbldTest = true;
-					sCmd.erase( 0, sCmd.find("build")+6 );
-				}
-				else
-					return false;
-				
-				//Is -debug switch in command?
-				if( sCmd.find( "-debug " ) != string::npos )
-				{
-					sCmd.erase( sCmd.find( "-debug " ), 7 );
-				}
-
-				// Parse needed "variables" from command.
-				bool bOk = false;
-
-				// Find platform
-				if ( sCmd.find( "armv5" ) != string::npos )
-				{
-					bOk = true;
-					args.HOOK.sPlatform = "armv5";
-					sCmd.erase( sCmd.find( "armv5" ), 5 );
-				}
-				else if ( sCmd.find( "winscw" ) != string::npos )
-				{
-					bOk = true;
-					args.HOOK.sPlatform = "winscw";
-					sCmd.erase( sCmd.find( "winscw" ), 6 );
-				}
-				else if ( sCmd.find( "gcce" ) != string::npos )
-				{
-					bOk = true;
-					args.HOOK.sPlatform = "gcce";
-					sCmd.erase( sCmd.find( "gcce" ), 4 );
-				}
-				if ( bOk )
-				{
-					// Feature variant.
-					if ( sCmd.at(0 ) == '.' )
-					{
-						sCmd.erase(0,1);
-						args.HOOK.sFeatureVariant = sCmd.substr( 0, sCmd.find_first_of(' ') );
-						sCmd.erase(0, sCmd.find_first_of(' ')+1 );
-					}
-				}
-				else
-				{
-					// not platform specified.
-					cout << AT_MSG << "Error, no supported platform found in abld parameters (armv5/winscw/gcce)." << endl;
-					bRet = false;
-				}
-				
-				// find build type
-				bOk = false;
-				if (  sCmd.find( "urel" ) != string::npos )
-				{
-					bOk = true;
-					args.HOOK.sBuildType = "urel";
-					sCmd.erase( sCmd.find( "urel" ), 4 );
-				}
-
-				else if ( sCmd.find( "udeb" ) != string::npos )
-				{
-					bOk = true;
-					args.HOOK.sBuildType = "udeb";
-					sCmd.erase( sCmd.find( "udeb" ), 4 );
-				}
-				if( !bOk )
-				{
-					// no build type specified.
-					cout << AT_MSG << "Error, no build type specified in abld parameters (udeb/urel)." << endl;
-					bRet = false;
-				}
-		
-				// Is there multiple programs (only should be used from extension).
-				if ( sCmd.find(" -p") != string::npos )
-				{
-					sCmd.erase( sCmd.find(" -p" ), sCmd.size() - sCmd.find(" -p" ) );
-					// Loop thru all parameters and pick up programs.
-					vector<string>::iterator it;
-					for( it = args.HOOK.vBuildCmd.begin(); it != args.HOOK.vBuildCmd.end(); it++ )
-					{
-						if ( _stricmp( it->c_str(), "-p" ) == 0 )
-						{
-							// Next is program.
-							it++;
-							string sProgram = *it;
-							// Make sure program name ends with ".mmp".
-							CATBase::ChangeToLower( sProgram );
-							if ( sProgram.length() >= 4 )
-							{
-                                string sEnd = sProgram.substr( sProgram.length()-4, 4 );
-								if ( sEnd.compare( ".mmp" ) != 0 )
-									sProgram.append( ".mmp" );
-							}
-							else
-								sProgram.append( ".mmp" );
-							args.HOOK.vTargetPrograms.push_back( sProgram );
-						}
-					}
-				}
-				else {
-					// find single defined program.
-					if ( sCmd.find_first_not_of(' ') != string::npos )
-					{
-						size_t iS = sCmd.find_first_not_of(' ');
-						size_t iE = sCmd.find_first_of(' ', iS );
-						string sProgram;
-						if ( iE == string::npos )
-							sProgram = sCmd.substr( iS, sCmd.size()-iS );
-						else
-							sProgram =  sCmd.substr( iS, iE-iS);
-						// Make sure program name ends with ".mmp".
-						CATBase::ChangeToLower( sProgram );
-						if ( sProgram.length() >= 4 )
-						{
-                            string sEnd = sProgram.substr( sProgram.length()-4, 4 );
-							if ( sEnd.compare( ".mmp" ) != 0 )
-								sProgram.append( ".mmp" );
-						}
-						else
-							sProgram.append( ".mmp" );
-						args.HOOK.vTargetPrograms.push_back( sProgram );
-					}
-				}
-			}
-			else
-			{
-				if ( ! bBuildFound )
-				{
-					bRet = false;
-					cout << AT_MSG << "Error, invalid parameter :" << *it << endl;
-					break;
-				}
-			}
-		}
-	}
-	catch(...)
-	{
-		bRet = false;
-		cout << AT_MSG << "Error parsing arguments." << endl;
-	}
-	return bRet;
-}
-
-
-/**
-* Parse trace parsing related arguments from given vector of strings.
-*/
-bool parseParseArguments( vector<string>& vArgs, ARGUMENTS& args )
-{
-	// Iterator used in this function.
-	vector<string>::const_iterator it = vArgs.begin();
-
-	if ( it == vArgs.end() )
-		return false;
-
-	it++;
-
-	if ( it == vArgs.end() )
-	{
-		cout << AT_MSG << "Error, input file not defined (raw data file)." << endl;
-		return false;
-	}
-
-	//Input.
-	args.PARSE.bDataFile = true;
-	args.PARSE.sDataFile = *it;
-	
-	it++;
-	if ( it == vArgs.end() )
-	{
-	
-		cout << AT_MSG << "Error, output file not defined (device data file)." << endl;
-		return false;
-	}
-
-	//Output.
-	args.PARSE.bOutputFile = true;
-	args.PARSE.sOutputFile = *it;
-	return true;
-}
-
-/**
-* Identifies/parses the configuration string when raptor used (-c / --config= ).
-*/
-bool parseSbsConfiguration( string& sConfiguration, ARGUMENTS& args )
-{
-	CATBase::ChangeToLower( sConfiguration );
-	vector<string> tokens = CATBase::ParseStringToVector( sConfiguration, '.' );
-	
-	//we check if winscw/armv5 and udeb/urel is used
-	//rest of the "." are variants which we all support by default.
-
-	//first we check if some of aliases is used
-	if ( tokens.at(0).compare("armv5_urel") == 0 )
-	{
-		args.HOOK.sPlatform = "armv5";
-		args.HOOK.sBuildType = "urel";
-		return true;
-	}
-	else if ( tokens.at(0).compare("armv5_udeb") == 0 )
-	{
-		args.HOOK.sPlatform = "armv5";
-		args.HOOK.sBuildType = "udeb";
-		return true;
-	}
-	else if ( tokens.at(0).compare("winscw_udeb") == 0)
-	{
-		args.HOOK.sPlatform = "winscw";
-		args.HOOK.sBuildType = "udeb";
-		return true;
-	}
-	else if ( tokens.at(0).compare("winscw_urel") == 0 )
-	{
-		args.HOOK.sPlatform = "winscw";
-		args.HOOK.sBuildType = "urel";
-		return true;
-	}
-	//if 1st token is not an alias, lets try dot configurations
-	else if ( tokens.at(0).compare("arm") == 0 )
-	{
-		// check we have atleast 3 tokens. i.e arm v5 debug x ...
-		if ( tokens.size() >= 3 )
-		{
-			// Next configuration is arm version, we only support v5.
-			if ( tokens.at(1).compare( "v5" ) == 0)
-			{
-				args.HOOK.sPlatform = "armv5";
-
-				// Check next configuration part is debug or release
-				if ( tokens.at(2).compare( "udeb" ) == 0)
-				{
-					args.HOOK.sBuildType = "udeb";
-					return true;
-				}
-				else if ( tokens.at(2).compare( "urel" ) == 0 )
-				{
-					args.HOOK.sBuildType = "urel";
-					return true;
-				}
-				else
-				{
-					cout << AT_MSG << "Error in sbs configuration part: " << tokens.at(2) << endl;
-				    cout << AT_MSG << "Supported are: udeb,urel." << endl;
-				    return false;
-				}
-			}
-			else
-			{
-				cout << AT_MSG << "Error in sbs configuration part: " << tokens.at(1) << endl;
-				cout << AT_MSG << "Supported are: v5." << endl;
-				return false;
-			}
-		}
-	}
-	
-	cout << AT_MSG << "Error in sbs configuration part: " << tokens.at(0) << endl;
-	cout << AT_MSG << "Supported are: arm, armv5_urel, armv5_udeb, winscw_udeb, winscw_urel." << endl;
-	return false;
-
-}
-
-//EOF
--- a/analyzetool/commandlineengine/src/atool.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +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:  Defines the entry point for the console application.
-*
-*/
-
-// Includes.
-#include "../inc/ATCommonDefines.h"
-#include "../inc/CATDatParser.h"
-#include "../inc/CATParseTraceFile.h"
-#include "../inc/CATProject.h"
-
-//Debug logging parameters
-//To enable debugging as argument to atool.exe use:
-//--show_debug / -show_debug : Normal logging in console.
-//--show_debug_all / -show_debug_all : Log all (low level functions also) to console.
-//--show_dbgview / -show_dbgview : Normal logging to windows debug messages.
-//--show_dbgview_all / -show_dbgview_all : Log all (low level functions also) to windows debug messages.
-
-//Return codes (errorlevel) defined in AT_RETURN_CODE structure see ATCommonDefines.h.
-
-extern bool g_bDebugConsole = false;
-extern bool g_bDebugDbgView = false;
-extern bool g_bDebugLowLevel = false;
-
-//Argument parsing.
-extern bool parseBaseArguments( vector<string>& vArgs, ARGUMENTS& args );
-extern bool parseHookArguments( vector<string>& vArgs, ARGUMENTS& args );
-extern bool parseAnalyzeArguments( vector<string>& vArgs, ARGUMENTS& args );
-extern bool parseParseArguments( vector<string>& vArgs, ARGUMENTS& args );
-
-//Helps.
-extern void print_help( void );
-extern void print_syntax_examples( void );
-
-//AT Library check functions
-extern bool CheckATLibrariesArmv5( string sEpocRoot );
-extern bool CheckATLibrariesArmv5Abiv2( string sEpocRoot );
-extern bool CheckATLibrariesWinscw( string sEpocRoot );
-
-//CLE version functions.
-extern int showVersionInfo( void );
-
-//dbghelp.dll version function.
-extern int showDbgHelpVersionInfo( bool showVersion );
-
-//Miscelllanaeous functions.
-extern bool CheckSBS2Folder( void );
-
-const char DEBUG_PARAMETER_CONSOLE[] = "-debug";
-const char DEBUG_PARAMETER_DBGVIEW[] = "-dbgview";
-const char SBS2_PARAMETER[] = "-sbs2";
-char g_cCurrentDir[MAX_LINE_LENGTH];
-
-//Global compile class objects are neededif ctrl+c is pressed mmp file must be restored.
-CATProject project_module;
-
-//Parse object.
-CATParseTraceFile Parser;
-
-/**
-* Handle process control signals.
-*/
-BOOL WINAPI HandlerRoutine( DWORD dwCtrlType )
-{
-	//Run recovery and exit for project if user presses ctrl+c
-	//or close signal is received.
-	if( dwCtrlType == CTRL_C_EVENT || dwCtrlType == CTRL_CLOSE_EVENT )
-	{
-		int iMode = project_module.GetMode();
-		if ( iMode == CATProject::COMPILE
-			|| iMode == CATProject::INSTRUMENT
-			|| iMode == CATProject::INSTRUMENT_CONSOLE )
-			project_module.RunRecoveryAndExit();
-	}
-	//Return false so program execution is stopped.
-	return false;
-}
-// TESTING
-int _tmain( int argc, _TCHAR* argv[] )
-{
-	#ifdef MEM_LEAK_CHECK
-	_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
-	#endif
-	try {
-		//Set function to handle process control signals.
-		SetConsoleCtrlHandler( HandlerRoutine, true );
-		vector<string> vArguments;
-		for( int i = 1 ; i < argc ; i++ )
-		{
-			vArguments.push_back( argv[i] );
-		}
-		//Help variables.
-		string sEpocRoot("");
-		//Parse base arguments.
-		ARGUMENTS args;
-		parseBaseArguments( vArguments, args );
-
-		// Debugging messages.
-		if ( args.bDebugConsole == true )
-			g_bDebugConsole = true;
-		if ( args.bDebugDbgView == true )
-			g_bDebugDbgView = true;
-		if ( args.bDebugLowLevel == true )
-			g_bDebugLowLevel = true;
-
-		//According to main switch parse rest arguments.
-		switch( args.eMainSwitch )
-		{
-		case SWITCH_UNKNOWN:
-			print_help();
-			return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
-		case SWITCH_ANALYZE:
-			if ( ! parseAnalyzeArguments( vArguments, args ) )
-				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
-			// Get epocroot
-			if( ! CATBase::GetEpocRoot( sEpocRoot ) )
-				return AT_RETURN_CODE::CANNOT_FIND_EPOCROOT;
-			project_module.SetEpocRoot( sEpocRoot );
-			// project not uninstrumented run it first.
-			if ( ! project_module.IsUninstrumented() )
-			{
-				project_module.SetMode( CATProject::UNINSTRUMENT_CONSOLE );
-				project_module.Run();
-			}
-			// Set mode.
-			project_module.SetMode( CATProject::ANALYZE );
-			project_module.SetLogLevel( args.ANALYZE.iLoggingLevel );
-			project_module.SetDataFile( args.ANALYZE.sDataFile );
-			if ( args.ANALYZE.bSymbolFile )
-				project_module.SetRomSymbolFiles( args.ANALYZE.vSymbolFiles );
-			project_module.SetDataFileOutput( args.ANALYZE.sOutputFile);
-			return project_module.Run();
-		case SWITCH_HOOK:
-			// Parse arguments related to hooking.
-			if ( ! parseHookArguments( vArguments, args ) )
-				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
-			// Set variables for project.
-			if ( ! project_module.SetArguments( args ) )
-				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
-			// Get epocroot
-			if( ! CATBase::GetEpocRoot( sEpocRoot ) )
-				return AT_RETURN_CODE::CANNOT_FIND_EPOCROOT;
-			project_module.SetEpocRoot( sEpocRoot );
-			// Check AnalyzeTool libraries
-			if ( _stricmp( args.HOOK.sPlatform.c_str(), "winscw") == 0 )
-			{
-				// Emulator winscw platform
-				if ( ! CheckATLibrariesWinscw(sEpocRoot) )
-					return AT_RETURN_CODE::AT_LIBS_MISSING;
-			}
-			else
-			{
-				// Armv5
-				if ( args.HOOK.iBuildSystem == 2 )
-				{
-					// Abiv2
-					if ( ! CheckATLibrariesArmv5Abiv2(sEpocRoot) )
-						return AT_RETURN_CODE::AT_LIBS_MISSING;
-				}
-				else
-				{
-					// Abiv1
-					if( ! CheckATLibrariesArmv5(sEpocRoot) )
-						return AT_RETURN_CODE::AT_LIBS_MISSING;
-				}
-			}
-			// Run hooking.
-			return project_module.Run();
-			//Uninstrument
-		case SWITCH_UNHOOK:
-			// Set variables for project.
-			if ( ! project_module.SetArguments( args ) )
-				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
-			// Get epocroot
-			if( ! CATBase::GetEpocRoot( sEpocRoot ) )
-				return AT_RETURN_CODE::CANNOT_FIND_EPOCROOT;
-			project_module.SetEpocRoot( sEpocRoot );
-			return project_module.Run();
-		case SWITCH_VERSION:
-			return showVersionInfo();
-		case SWITCH_DBGHELP_VERSION:
-			return showDbgHelpVersionInfo( true );
-		case SWITCH_CLEAN:
-			project_module.SetMode( CATProject::CLEAN );
-			if ( CheckSBS2Folder() )
-				project_module.SetBuildSystem( CATProject::SBS_V2 );
-			else
-				project_module.SetBuildSystem( CATProject::SBS_V1 );
-			return project_module.Run();
-		case SWITCH_PARSE_TRACE:
-			if ( ! parseParseArguments( vArguments, args ) )
-				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
-			if (  CATBase::IsDataFile( args.PARSE.sDataFile ) )
-			{
-				cout << AT_MSG << "Error, " << args.PARSE.sDataFile << " is already parsed." << endl;
-				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
-			}
-			if ( args.PARSE.bOutputFile )
-			{
-				//Save data with name in arguments[3]
-				Parser.StartParse( args.PARSE.sDataFile.c_str(), args.PARSE.sOutputFile.c_str() );
-			}
-			else
-			{
-				Parser.StartParse( args.PARSE.sDataFile.c_str(), NULL );
-			}
-			return AT_RETURN_CODE::OK;
-		case SWITCH_HELP:
-			print_help();
-			print_syntax_examples();
-			return AT_RETURN_CODE::OK;
-		default:
-			cout << AT_MSG << "Invalid parameters." << endl;
-			return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
-		}
-
-	} catch(...)
-	{
-		cout << AT_MSG << "Error, unhandled exception." << endl;
-		return AT_RETURN_CODE::UNHANDLED_EXCEPTION;
-	}
-}
-
-//EOF
--- a/analyzetool/commandlineengine/src/cataddr2line.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,388 +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:  Main module for addr2line pinpointing.
-*
-*/
-
-#include "../inc/cataddr2line.h"
-#include "../inc/CATMemoryAddress.h"
-#include "../inc/CATBase.h"
-#include "../inc/CATDatParser.h"
-
-#define ASCII_CHAR_CARRIAGE_RETURN 0x0D
-
-CATAddr2line::CATAddr2line()
-{
-	LOG_FUNC_ENTRY("CATAddr2line::CATAddr2line");
-}
-
-bool CATAddr2line::Open( const string& sParameter, const unsigned long /* iLong */ )
-{
-	LOG_FUNC_ENTRY("CATAddr2line::Open");
-	//Debugging for addr2line task.
-	//debug.open( "addr2line-lines.txt", ios_base::trunc );
-
-	m_sMapFileName.clear();
-	// Add .map extendsion
-	m_sMapFileName.append( sParameter );
-	m_sMapFileName.append( ".map" );
-
-	ReadMapFileArmv5();
-
-	//Make symfile path+name
-	string sFullPathToSymFile(sParameter);
-	sFullPathToSymFile.erase( sFullPathToSymFile.find_last_of( "." ), string::npos );
-	sFullPathToSymFile.append( ".sym" );
-
-	// Check with extension + .sym also.
-	if ( ! CATBase::FileExists( sFullPathToSymFile.c_str() ) )
-	{
-		sFullPathToSymFile.clear();
-		sFullPathToSymFile.append( sParameter );
-		sFullPathToSymFile.append( ".sym" );
-	}
-
-	return server.Initialize( sFullPathToSymFile );
-}
-
-string CATAddr2line::GetError( void )
-{
-	LOG_FUNC_ENTRY("CATAddr2line::GetError");
-	string s;
-	return s;
-}
-
-bool CATAddr2line::Close( void )
-{
-	LOG_FUNC_ENTRY("CATAddr2line::Close");
-	//Debugging for addr2line task.
-	//debug.close();
-	return true;
-}
-
-bool CATAddr2line::AddressToLine( CATMemoryAddress* result )
-{
-	LOG_FUNC_ENTRY("CATAddr2line::AddressToLine");
-	
-	result->SetAddressToLineState( CATMemoryAddress::OUT_OF_RANGE);
-
-	if( !server.GetProcessCreatedState() )
-		return false;
-	//Count address
-	ULONG uStartA = result->GetModuleStartAddress();
-	ULONG uMemoryA = result->GetAddress();
-	ULONG uCountedA = uMemoryA - uStartA;
-	uCountedA += FUNCTIONS_OFFSET_IN_GCCE;
-
-	string sTemp = CATBase::NumberToHexString( uCountedA );
-    //Remove "0x"
-    size_t iCounter = sTemp.find_first_of('x');
-    if( iCounter != string::npos )
-    {
-		sTemp.erase( 0, (int)iCounter+1 );
-    }
-	// Write to pipe that is the standard input for a child process.
-	server.WriteToPipe( sTemp ); 
- 
-	// Read from pipe that is the standard output for child process.
-    string s = server.ReadFromPipe();
-
-	//If output not empty, parse output
-	if( !s.empty() )
-	{
-		//Debugging code for addr2line task.
-		//debug.write( "##########\n", 12 );
-		//debug.write( s.c_str(), s.size() );
-		result->SetAddressToLineState( CATMemoryAddress::EXACT );
-
-		string s2;
-		size_t iLocation = s.find_first_of( ASCII_CHAR_CARRIAGE_RETURN );
-
-		bool bFunctionNameFoundUsingAddr2line = false;
-
-		//Function name
-		
-		if(iLocation != string::npos )
-		{
-			s2 = s.substr( 0, iLocation );
-			//All characters ascii?
-			if( CATBase::IsAscii( s2.c_str(), (int)s2.length() ) )
-			{
-				//addr2line returns $x if function name not found
-				//length must over 2 to be real function name
-				if( s2.length() > 2 )
-				{
-					bFunctionNameFoundUsingAddr2line = true;
-					result->SetFunctionName( s2 );
-					s.erase( 0, iLocation+2 );
-				}
-			}
-		}
-		//If function name not found using addr2line find it from map file
-		if( !bFunctionNameFoundUsingAddr2line )
-		{
-			string sFuncName( GetFunctionNameUsingAddress( uCountedA ) );
-			//If function name empty, print "???"
-			if( sFuncName.empty() )
-			{
-				s2 = "???";
-				result->SetFunctionName( s2 );
-				if(iLocation != string::npos )
-				{
-					s.erase( 0, iLocation+2 );
-				}
-			}
-			else
-				result->SetFunctionName( sFuncName );
-		}
-		iLocation = s.find_first_of( ':' );
-
-		//Filename and location
-
-		if(iLocation != string::npos )
-		{
-			s2 = s.substr( 0, iLocation );
-			result->SetFileName( s2 );
-			s.erase( 0, iLocation+1 );
-		}
-
-		//Exact line number
-
-		s2 = s.substr( 0, s.find_first_of( ASCII_CHAR_CARRIAGE_RETURN ) );
-		result->SetExactLineNumber( atoi( s2.c_str() ) );
-	}
-	return true;
-}
-
-bool CATAddr2line::ReadMapFileArmv5()
-{
-	LOG_FUNC_ENTRY("CATModule2::ReadMapFileArmv5");
-	// Open .map file
-	ifstream in( m_sMapFileName.c_str() );
-	// File open ok?
-	if( ! in.good() )
-	{
-		in.close();
-		return false;
-	}
-	char cTemp[MAX_LINE_LENGTH];
-	bool bFirstFuncFound = false;
-	bool bFirstLine = true;
-	// Get all lines where is "Thumb"
-	do
-	{
-		// Load one line from .map file
-		in.getline( cTemp, MAX_LINE_LENGTH );
-		if( bFirstLine )
-		{
-			bFirstLine = false;
-			if( strstr( cTemp, "ARM Linker" ) == NULL )
-				return false;
-		}
-		// Find _E32Startup
-		if( !bFirstFuncFound && ( strstr( cTemp, "_E32Startup" ) != NULL) )
-		{
-			bFirstFuncFound = true;
-		}
-		else if( !bFirstFuncFound && ( strstr( cTemp, "_E32Dll" ) != NULL) )
-		{
-			bFirstFuncFound = true;
-		}
-		else if( !bFirstFuncFound )
-			// Skip if _E32Startup not found
-			continue;
-
-		if( strstr( cTemp, "Thumb Code" ) != NULL || strstr( cTemp, "ARM Code" ) != NULL)
-		{
-			MAP_FUNC_INFO structMapFileLineInfo;
-			structMapFileLineInfo.sWholeLine.append( cTemp );
-
-			// Get memory string address from line
-			char* pStart = strstr( cTemp, "0x" );
-			// Check did strstr return null.
-			if ( pStart == NULL )
-				continue;
-			char* pTemp = pStart;
-			char TempString[MAX_LINE_LENGTH];
-			TempString[0] = 0;
-			size_t iLength = 0;
-			while( *pTemp != ' ' )
-			{
-				TempString[iLength] = *pTemp;
-				pTemp++;
-				iLength++;
-			}
-			TempString[iLength] = 0;
-
-			structMapFileLineInfo.iAddress = CATDatParser::_httoi( TempString );
-
-			pTemp = cTemp;
-			TempString[0] = 0;
-			
-			// Get function name
-
-			// Skip spaces
-			while( *pTemp == ' ' )
-			{
-				pTemp++;
-			}
-			iLength = 0;
-			// Find end of function name
-			string sTemp( pTemp );
-
-			// Location of character ')'
-			iLength = sTemp.find_first_of(')');
-
-			// Location of character ' '
-			size_t iLength2 = sTemp.find_first_of(' ');
-			
-			// If ')' character is the last char and
-			// character ' ' is closer than ')' use location of ' '
-			if( ( iLength + 1 ) == sTemp.length() && iLength2 < iLength )
-				iLength = iLength2 - 1;
-			
-			if( iLength != string::npos )
-				sTemp.resize( (iLength + 1) );
-
-			structMapFileLineInfo.sFunctionName.append( sTemp.c_str() );
-
-			bool bARM = false;
-			// Find function length
-			pStart = strstr( cTemp, "Thumb Code" );
-			if( pStart == NULL )
-			{
-				pStart = strstr( cTemp, "ARM Code" );
-				bARM = true;
-			}
-			if( pStart != NULL )
-			{
-				if( bARM )
-					pStart += 8;
-				else
-					pStart += 10;
-				while(*pStart == ' ')
-				{
-					pStart++;
-				}
-				sTemp.clear();
-				sTemp.append( pStart );
-				size_t iSize = sTemp.find_first_of(' ');
-				if( iSize != string::npos )
-					sTemp.resize( iSize );
-			}
-
-			structMapFileLineInfo.iFuncLength = atoi( sTemp.c_str() );
-			if( bFirstFuncFound && structMapFileLineInfo.iFuncLength > 0 )
-				// Save to list
-				m_vMapFileFuncList.push_back( structMapFileLineInfo );
-		}
-	}
-	while( in.good() );
-	in.close();
-	return true;
-}
-
-// Find function name of given address
-string CATAddr2line::GetFunctionNameUsingAddress( unsigned long iAddress )
-{
-	LOG_LOW_FUNC_ENTRY("CATAddr2line::GetSymbolIndexUsingAddress");
-	string sRet;
-	for( size_t i = 0; i < m_vMapFileFuncList.size(); i++ )
-	{
-		unsigned long iStart = m_vMapFileFuncList.at( i ).iAddress;
-		unsigned long iEnd = ( m_vMapFileFuncList.at( i ).iAddress
-			+ m_vMapFileFuncList.at( i ).iFuncLength );
-
-		if ( iAddress >= iStart && iAddress < iEnd )
-			return m_vMapFileFuncList.at( i ).sFunctionName;
-	}
-	return sRet;
-}
-
-//Note: New filtering functions commented out until they are taken into use.
-/**
-* Filter string out of unwanted characters.
-*/
-/*
-void CATAddr2line::FilterString( string &sString )
-{
-	LOG_LOW_FUNC_ENTRY("CATAddr2line::FilterString");
-	string sFiltered("");
-	for( size_t i = 0 ; i < sString.length() ; i++ )
-	{
-		const char p = sString.at( i );
-		if ( p != 0 && strchr( ADDR2LINEALLOWEDCHARS, p ) != 0 )
-			sFiltered.push_back( p );
-	}
-	sString = sFiltered;
-}
-*/
-/**
-* Find line feed position from string.
-*/
-/*
-size_t CATAddr2line::FindLineFeed( const string& sString )
-{
-	LOG_LOW_FUNC_ENTRY("CATAddr2line::FindLineFeed");
-	size_t iLineFeed1 = sString.find( 12 );
-	size_t iLineFeed2 = sString.find( 15 );
-	if ( iLineFeed1 < iLineFeed2 && iLineFeed1 != string::npos )
-		return iLineFeed1;
-	else if ( iLineFeed2 != string::npos )
-		return iLineFeed2;
-	else
-		return string::npos;
-}
-*/
-/**
-* Erase characters from start of the string until other char than linefeed found.
-*/
-/*
-void CATAddr2line::EraseUntilNoLineFeed( string& sString )
-{
-	LOG_LOW_FUNC_ENTRY("CATAddr2line::EraseUntilNoLineFeed");
-	for ( size_t i = 0 ; i < sString.length() ; i++ )
-	{
-		if ( sString.at( i ) != 15 && sString.at( i ) != 12 )
-			break;
-	}
-	sString.erase( 0, i );
-}
-*/
-/**
-* Split multiple line string with unexpected line feeds to vector of strings.
-*/
-/*
-vector<string> CATAddr2line::SplitToStrings( string& sMultiLineString )
-{
-	LOG_LOW_FUNC_ENTRY("CATAddr2line::SplitToStrings");
-    vector<string> vLines;
-	while ( 1 )
-	{
-		size_t iLineFeed = FindLineFeed( sMultiLineString );
-		if ( iLineFeed == string::npos )
-			break;
-		string sCell = sMultiLineString.substr(0, iLineFeed );
-		sMultiLineString.erase(0, iLineFeed );
-		EraseUntilNoLineFeed( sMultiLineString );
-		FilterString( sCell );
-		vLines.push_back( sCell );
-	}
-	// If no lines were found set single one.
-	if ( vLines.size() == 0 )
-		vLines.push_back( sMultiLineString );
-	return vLines;
-}
-*/
-//EOF
--- a/analyzetool/commandlineengine/src/cataddr2lineserver.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +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:  Class representing a server that uses addr2line.exe.
-*
-*/
-
-#include "../inc/cataddr2lineserver.h"
-#include "../inc/CATBase.h"
-
-// ----------------------------------------------------------------------------
-// Constructor
-// ----------------------------------------------------------------------------
-CATAddr2lineServer::CATAddr2lineServer()
-{
-	LOG_FUNC_ENTRY("CATAddr2lineServer::CATAddr2lineServer");
-	m_bProcessCreated = false;
-
-	// Pipe handles.
-	m_hChildErroutRd = 0;
-	m_hChildErroutRdDup = 0;
-	m_hChildErroutWr = 0;
-	m_hChildStdinRd = 0;
-	m_hChildStdinWr = 0;
-	m_hChildStdinWrDup = 0;
-	m_hChildStdoutRd = 0;
-	m_hChildStdoutWr = 0;
-	m_hChildStdoutRdDup = 0;
-	
-	m_hSaveErrout = 0;
-	m_hSaveStdin = 0;
-	m_hSaveStdout = 0;
-
-    // Set the bInheritHandle flag so pipe handles are inherited.
-    m_saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
-    m_saAttr.bInheritHandle = TRUE;
-    m_saAttr.lpSecurityDescriptor = NULL;
-
-	// Symbol file.
-	m_sFullPathAndBinaryName = "";
-}
-// ----------------------------------------------------------------------------
-// Destructor
-// ----------------------------------------------------------------------------
-CATAddr2lineServer::~CATAddr2lineServer()
-{
-	LOG_FUNC_ENTRY("CATAddr2lineServer::~CATAddr2lineServer");
-	// Close the pipe handle so the child process stops reading.
-    CloseHandle(m_hChildStdinWrDup);
-    // Close the write end of the pipe
-    CloseHandle(m_hChildStdoutWr);
-    // Close the write end of the error pipe
-	CloseHandle(m_hChildErroutWr);
-}
-bool CATAddr2lineServer::Initialize( const string& sFullPathAndBinaryName )
-{
-    LOG_FUNC_ENTRY("CATAddr2lineServer::Initialize");
-	BOOL fSuccess;
-	m_sFullPathAndBinaryName = sFullPathAndBinaryName;
-
-    // The steps for redirecting child process's STDOUT:
-    //     1. Save current STDOUT, to be restored later.
-    //     2. Create anonymous pipe to be STDOUT for child process.
-    //     3. Set STDOUT of the parent process to be write handle to
-    //        the pipe, so it is inherited by the child process.
-    //     4. Create a noninheritable duplicate of the read handle and
-    //        close the inheritable read handle.
- 
-    // Save the handle to the current STDOUT. 
-    m_hSaveStdout = GetStdHandle(STD_OUTPUT_HANDLE); 
-
-    // Create a pipe for the child process's STDOUT.
-    if (! CreatePipe(&m_hChildStdoutRd, &m_hChildStdoutWr, &m_saAttr, 0))
-		return PrintErrorAndExit( "Stdout pipe creation failed\n" );
-
-    // Set a write handle to the pipe to be STDOUT.
-   if (! SetStdHandle(STD_OUTPUT_HANDLE, m_hChildStdoutWr))
-		return PrintErrorAndExit( "Redirecting STDOUT failed\n" );
-
-    // Create noninheritable read handle and close the inheritable read
-    // handle.
-    fSuccess = DuplicateHandle(GetCurrentProcess(), m_hChildStdoutRd,
-        GetCurrentProcess(), &m_hChildStdoutRdDup , 0,
-        FALSE,
-        DUPLICATE_SAME_ACCESS);
-    if( !fSuccess )
-		return PrintErrorAndExit( "DuplicateHandle failed" );
-    CloseHandle(m_hChildStdoutRd);
-
-    // The steps for redirecting child process's STDIN:
-    //     1.  Save current STDIN, to be restored later.
-    //     2.  Create anonymous pipe to be STDIN for child process.
-    //     3.  Set STDIN of the parent to be the read handle to the
-    //         pipe, so it is inherited by the child process.
-    //     4.  Create a noninheritable duplicate of the write handle,
-    //         and close the inheritable write handle.
- 
-    // Save the handle to the current STDIN.
-    m_hSaveStdin = GetStdHandle(STD_INPUT_HANDLE);
-
-    // Create a pipe for the child process's STDIN.
-    if (! CreatePipe(&m_hChildStdinRd, &m_hChildStdinWr, &m_saAttr, 0))
-		return PrintErrorAndExit( "Stdin pipe creation failed\n" );
- 
-    // Set a read handle to the pipe to be STDIN. 
-    if (! SetStdHandle(STD_INPUT_HANDLE, m_hChildStdinRd)) 
-		return PrintErrorAndExit( "Redirecting Stdin failed\n" ); 
- 
-    // Duplicate the write handle to the pipe so it is not inherited. 
-	
-    fSuccess = DuplicateHandle(GetCurrentProcess(), m_hChildStdinWr, 
-        GetCurrentProcess(), &m_hChildStdinWrDup, 0, 
-        FALSE,                  // not inherited 
-        DUPLICATE_SAME_ACCESS); 
-    if (! fSuccess) 
-		return PrintErrorAndExit( "DuplicateHandle failed\n" );
-
-    CloseHandle(m_hChildStdinWr);
- 
-    // The steps for redirecting child process's ERROUT:
-    //     1. Save current STDOUT, to be restored later.
-    //     2. Create anonymous pipe to be STDOUT for child process.
-    //     3. Set STDOUT of the parent process to be write handle to
-    //        the pipe, so it is inherited by the child process.
-    //     4. Create a noninheritable duplicate of the read handle and
-    //        close the inheritable read handle.
- 
-    // Save the handle to the current STDOUT. 
-    m_hSaveErrout = GetStdHandle( STD_ERROR_HANDLE ); 
-
-    // Create a pipe for the child process's ERROUT.
-    if (! CreatePipe(&m_hChildErroutRd, &m_hChildErroutWr, &m_saAttr, 0))
-		return PrintErrorAndExit( "Errout pipe creation failed\n" );
-
-    // Set a write handle to the pipe to be ERROUT.
-   if (! SetStdHandle(STD_ERROR_HANDLE, m_hChildErroutWr))
-		return PrintErrorAndExit( "Redirecting ERROUT failed\n" );
-
-    // Create noninheritable read handle and close the inheritable read
-    // handle.
-   
-    fSuccess = DuplicateHandle(GetCurrentProcess(), m_hChildErroutRd,
-        GetCurrentProcess(), &m_hChildErroutRdDup , 0,
-        FALSE,
-        DUPLICATE_SAME_ACCESS);
-    if( !fSuccess )
-		return PrintErrorAndExit( "DuplicateHandle failed" );
-    
-	CloseHandle(m_hChildErroutRd);
-	CloseHandle(m_hChildErroutRdDup);
-	
-	// Now create the child process. 
-    fSuccess = CreateChildProcess();
-    if (!fSuccess )
-		return PrintErrorAndExit( "Create process failed\n" );
- 
-    // After process creation, restore the saved STDIN and STDOUT.
-	if (! SetStdHandle(STD_INPUT_HANDLE, m_hSaveStdin))
-        return PrintErrorAndExit( "Re-redirecting Stdin failed\n" );
-
-	if (! SetStdHandle(STD_OUTPUT_HANDLE, m_hSaveStdout))
-       return PrintErrorAndExit( "Re-redirecting Stdout failed\n" );
-
-	if (! SetStdHandle(STD_ERROR_HANDLE, m_hSaveErrout))
-       return PrintErrorAndExit( "Re-redirecting Stderrout failed\n" );
-
-	m_bProcessCreated = true;
-    return true;
-}
-BOOL CATAddr2lineServer::CreateChildProcess() 
-{ 
-    LOG_FUNC_ENTRY("CATAddr2lineServer::CreateChildProcess");
-    PROCESS_INFORMATION piProcInfo; 
-    STARTUPINFO siStartInfo;
-    BOOL bFuncRetn = FALSE; 
- 
-    // Set up members of the PROCESS_INFORMATION structure.
-    ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) );
- 
-	// Set up members of the STARTUPINFO structure.
-    ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) );
-    siStartInfo.cb = sizeof(STARTUPINFO); 
- 
-	//atool.exe:s path + filename
-	char buffer[MAX_PATH];
-
-	GetModuleFileName( NULL, buffer, MAX_PATH );
-
-	string sCommand( buffer );
-
-	//Remove 'atool.exe'
-	size_t tPos = sCommand.rfind( "\\" );
-	if ( tPos != string::npos )
-		sCommand.resize( sCommand.rfind( "\\" )+1 );
-	else
-		sCommand.clear();
-
-	sCommand.append( "addr2line.exe" );
-
-	//addr2line file exists
-	if( !CATBase::FileExists( sCommand.c_str() ) )
-		return PrintErrorAndExit( "File not found addr2line.exe\n" );
-
-	//Sym file exists
-	if( !CATBase::FileExists( m_sFullPathAndBinaryName.c_str() ) )
-	{
-		string sTemp( "File not found " );
-		sTemp.append( m_sFullPathAndBinaryName );
-		sTemp.append( "\n" );
-		return PrintErrorAndExit( sTemp );
-	}
-
-	sCommand.append(" -f -C -e ");
-	sCommand.append( m_sFullPathAndBinaryName );
-
-	// Create the child process. 
-    bFuncRetn = CreateProcess(NULL,
-		(LPSTR)sCommand.c_str(), // command line
-        NULL,          // process security attributes
-        NULL,          // primary thread security attributes
-        TRUE,          // handles are inherited
-        0,             // creation flags
-        NULL,          // use parent's environment
-        NULL,          // use parent's current directory
-        &siStartInfo,  // STARTUPINFO pointer
-        &piProcInfo);  // receives PROCESS_INFORMATION
-
-    if (bFuncRetn == 0)
-    {
-       //CreateProcess failed
-       return false;
-    }
-    else
-    {
-       CloseHandle(piProcInfo.hProcess);
-       CloseHandle(piProcInfo.hThread);
-       return bFuncRetn;
-    }
-}
-VOID CATAddr2lineServer::WriteToPipe( const string& sAddress ) 
-{ 
-	LOG_LOW_FUNC_ENTRY("CATAddr2lineServer::WriteToPipe");
-    DWORD dwRead, dwWritten;
-    CHAR chBuf[2]; //This is for enter key
-
-    //Write data to a pipe. 
-    dwRead = (DWORD)sAddress.length();
-	WriteFile(m_hChildStdinWrDup, sAddress.c_str(), dwRead, &dwWritten, NULL);
-
-	chBuf[0] = 0x0A; //Enter
-	chBuf[1] = 0; //NULL
-	//Write enter key to a pipe
-	WriteFile(m_hChildStdinWrDup, chBuf, 1, &dwWritten, NULL);
-} 
-string CATAddr2lineServer::ReadFromPipe(VOID) 
-{
-	LOG_LOW_FUNC_ENTRY("CATAddr2lineServer::ReadFromPipe");
-	string s;
-	DWORD dwRead;
-    CHAR chBuf[BUFSIZE];
-    // Read output from the child process, and save data to string.
-    ReadFile( m_hChildStdoutRdDup, chBuf, BUFSIZE, &dwRead, NULL);
-	s.append( chBuf );
-    return s;
-}
-bool CATAddr2lineServer::GetProcessCreatedState( void )
-{
-	LOG_LOW_FUNC_ENTRY("CATAddr2lineServer::GetProcessCreatedState");
-	return m_bProcessCreated;
-}
-bool CATAddr2lineServer::PrintErrorAndExit( const string sInput )
-{
-	LOG_FUNC_ENTRY("CATAddr2lineServer::PrintErrorAndExit");
-	cout << AT_MSG << sInput;
-	return false;
-}
--- a/analyzetool/commandlineengine/src/catalloc.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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 "../inc/ATCommonDefines.h"
-#include "../inc/catalloc.h"
-
-string CATAlloc::GetAllocString( void )
-{
-	LOG_LOW_FUNC_ENTRY("CATAlloc::GetAllocString");
-	// Create alloc string
-	string sLine("");
-	sLine.append( m_sTime ); sLine.append(" " );
-	sLine.append( m_sSize );
-
-	// Add all call stack fragments to line.
-	string sCallStack;
-	map<unsigned long, string>::iterator it;
-	for( it = m_vCallStack.begin() ; it != m_vCallStack.end() ; it++ )
-	{
-		sCallStack.append( (*it).second );
-		sCallStack.append( " " );
-	}
-	// Remove the last space
-	if ( sCallStack.size() > 0 )
-		sCallStack.erase( sCallStack.size()-1, 1 );
-	
-	if ( m_iCSCount != 0 )
-	{
-		// Check integrity (calculate number of spaces in call stack)
-		unsigned long iCount = 0;
-		size_t pos = 0;
-		while ( pos != string::npos )
-		{
-			iCount++;
-			pos = sCallStack.find_first_of( ' ', pos+1 );
-		}
-		if ( iCount != m_iCSCount )
-			cout << AT_MSG << "Error, integrity check failed in alloc." << endl;
-	}
-
-	// Add call stack to line.
-	if ( sCallStack.size() > 0 )
-	{
-		sLine.append(" " );
-		sLine.append( sCallStack );
-	}
-
-	// return alloc line.
-	return sLine;
-}
-
--- a/analyzetool/commandlineengine/src/catallocs.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +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 "../inc/ATCommonDefines.h"
-#include "../inc/catallocs.h"
-
-void CATAllocs::Alloc( const string& sAllocString )
-{
-	LOG_LOW_FUNC_ENTRY("CATAllocs::Alloc");
-	string sAlloc( sAllocString );
-	CATAlloc alloc;
-	string sAddress = GetStringUntilNextSpace( sAlloc, true );
-	alloc.m_sTime = GetStringUntilNextSpace( sAlloc, true );
-	alloc.m_sSize = GetStringUntilNextSpace( sAlloc, true );
-	alloc.m_vCallStack.insert( pair<unsigned long,string>(1, sAlloc) );
-	// Add allocation
-	pair< map<string,CATAlloc>::iterator, bool> ret;
-	ret = m_vAllocs.insert( pair<string, CATAlloc>( sAddress, alloc ) );
-	if( ret.second == false )
-	{
-		// Allocation to this memory address was already added.
-		LOG_STRING( "CATAllocs: Allocating same address again, address: " << sAddress );
-	}
-}
-
-void CATAllocs::AllocH( const string& sAllocHString )
-{
-	LOG_LOW_FUNC_ENTRY("CATAllocs::AllocH");
-	string sAllocH( sAllocHString );
-	// Parse alloc & create new allocation.
-	CATAlloc alloc;
-	string sAddress = GetStringUntilNextSpace( sAllocH, true );
-	alloc.m_sTime = GetStringUntilNextSpace( sAllocH, true );
-	alloc.m_sSize = GetStringUntilNextSpace( sAllocH, true );
-	alloc.m_iCSCount = _httoi( string( GetStringUntilNextSpace( sAllocH, true ) ).c_str() );
-	// Insert call stack fragment as "first" 1 because we are header.
-	if ( alloc.m_iCSCount > 0 )
-		alloc.m_vCallStack.insert( pair<unsigned long,string>( 0, sAllocH ) );
-	// Add allocation
-	pair< map<string,CATAlloc>::iterator, bool> ret;
-	ret = m_vAllocs.insert( pair<string, CATAlloc>( sAddress, alloc ) );
-	if( ret.second == false )
-	{
-		// Allocation to this memory address was already added.
-		LOG_STRING( "CATAllocs: Allocating same address again, address: " << sAddress );
-	}
-}
-
-void CATAllocs::AllocF( const string& sAllocFString )
-{
-	LOG_LOW_FUNC_ENTRY("CATAllocs::AllocF");
-	string sAllocF( sAllocFString );
-	string sAddress = GetStringUntilNextSpace( sAllocF, true );
-	string sTime = GetStringUntilNextSpace( sAllocF, true );
-	unsigned long iNumber = _httoi( string( GetStringUntilNextSpace( sAllocF, true ) ).c_str() );
-	string sCallSstack = sAllocF;
-	// Find correct allocation into which add call stack fragment.
-	map<string, CATAlloc>::iterator it;
-	it = m_vAllocs.find( sAddress );
-	// TODO: If cannot find, create new in cache.
-	if ( it == m_vAllocs.end() )
-	{
-		LOG_STRING( "CATAllocs: Allocate fragment without header: " << sAddress );
-		return;
-	}
-	pair< map<unsigned long,string>::iterator, bool> ret;
-	// Add call stack to it.
-	ret = it->second.m_vCallStack.insert( pair<unsigned long,string>( iNumber, sCallSstack ) );
-	if( ret.second == false )
-	{
-		LOG_STRING( "CATAllocs: Same allocation fragment again: " << sAddress );
-	}
-}
-
-// Free message.
-void CATAllocs::Free( const string& sFreeString )
-{
-	LOG_LOW_FUNC_ENTRY("CATAllocs::Free");
-	string sFree( sFreeString );
-	string sKey = GetStringUntilNextSpace( sFree );
-	// Find related allocation.
-	map<string, CATAlloc>::iterator it;
-	it = m_vAllocs.find( sKey );
-	if ( it == m_vAllocs.end() )
-	{
-		LOG_STRING( "CATAllocs: Free message which has no alloc pair: " << sKey );
-		return;
-	}
-	// Delete it.
-	m_vAllocs.erase( it );
-}
-
-// FreeH.
-void CATAllocs::FreeH( const string& sFreeH )
-{
-	LOG_LOW_FUNC_ENTRY("CATAllocs::FreeH");
-	// Current implementation does not use call stack of
-	// free message to anything.
-	string sFree( sFreeH );
-	string sKey = GetStringUntilNextSpace( sFree );
-	// Time stamp. (not used currently)
-	// Call stack count. (not used currently)
-	// Call stack data. (not used currently)
-
-	// Find related allocation.
-	map<string, CATAlloc>::iterator it;
-	it = m_vAllocs.find( sKey );
-	if ( it == m_vAllocs.end() )
-	{
-		LOG_STRING( "CATAllocs: FreeH message which has no alloc pair: " << sKey );
-		return;
-	}
-	// Delete it.
-	m_vAllocs.erase( it );
-}
-
-// FreeF.
-void CATAllocs::FreeF( const string& /* sFreeF */ )
-{
-	LOG_LOW_FUNC_ENTRY("CATAllocs::FreeF");
-	// Fragments are currently ignored.
-	// Memory address. (not used currently)
-	// Time stamp. (not used currently)
-	// Packet number. (not used currently)
-	// Call stack data. (not used currently)
-}
-
-// Get "leak" list ordered by allocation time.
-void CATAllocs::GetLeakList( vector<string>& vLeakList )
-{
-	LOG_LOW_FUNC_ENTRY("CATAllocs::GetLeakList");
-
-	// Create multimap where key is timestamp.
-	// Add allocations there so they will go ascending order.
-	multimap<string,string> mmap;
-	multimap<string,string>::iterator itMmap;
-	
-	map<string, CATAlloc>::iterator it;
-	for( it = m_vAllocs.begin(); it != m_vAllocs.end() ; it++ )
-	{
-		string sTime = it->second.m_sTime;
-		
-		string sLine = it->first;
-		sLine.append(" ");
-		sLine.append( it->second.GetAllocString() );
-
-		mmap.insert( pair<string,string>( sTime, sLine ) );
-	}
-	
-	// Iterate list to parameter vector.
-	vLeakList.clear();
-	for ( itMmap = mmap.begin(); itMmap != mmap.end(); itMmap++ )
-		vLeakList.push_back( itMmap->second );
-}
-
-// Clear alloc data.
-void CATAllocs::ClearAllocs( void )
-{
-	LOG_LOW_FUNC_ENTRY("CATAllocs::ClearAllocs");
-	m_vAllocs.clear();
-}
-
-//EOF
--- a/analyzetool/commandlineengine/src/catdbghelper.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,314 +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:  Windows debug api implementation for IAddressToLine interface.
-*
-*/
-
-#include "../inc/catdbghelper.h"
-#include "../inc/CATBase.h"
-#include "../inc/CATMemoryAddress.h"
-#include <dbghelp.h>
-
-/**
-* Notes on version number of api functions.
-* 5.1	Windows XP
-* 5.2	Windows Server 2003
-* 6.8	Debugging Tools for Windows 6.8
-* SymSetOptions			DbgHelp.dll 5.1 or later
-* SymSetSearchPath		DbgHelp.dll 5.1 or later
-* SymLoadModuleEx			Versions 5.2 and 6.0
-* SymLoadModule64			DbgHelp.dll 5.1 or later
-* SymFromAddr				Versions 4.0 and 5.1
-* SymGetLineFromAddr64	DbgHelp.dll 5.1 or later
-*/
-
-// Wrapper class for symbol information package.
-struct CSymbolInfo : public SYMBOL_INFO_PACKAGE
-{
-	CSymbolInfo()
-	{
-		si.SizeOfStruct = sizeof( SYMBOL_INFO );
-		si.MaxNameLen = sizeof( name );
-	}
-};
-
-// Wrapper class for line information container.
-struct CLineInfo : public IMAGEHLP_LINE64
-{
-	CLineInfo()
-	{
-		SizeOfStruct = sizeof( IMAGEHLP_LINE64 );
-	}
-};
-
-CATDbgHelper::CATDbgHelper()
-{
-	LOG_FUNC_ENTRY("CATDbgHelper::CDbgHelper");
-	// Set the some "default" base address.
-	m_BaseAddress = 0x2;
-	m_bMap = false;
-	m_pBinaryFile = NULL;
-}
-
-CATDbgHelper::~CATDbgHelper()
-{
-	LOG_FUNC_ENTRY("CATDbgHelper::~CDbgHelper");
-	// Close dbghelper only once.
-	if ( CDBGHELPER_OPEN )
-	{
-		Close();
-	}
-	if ( m_pBinaryFile )
-	{
-		delete[] m_pBinaryFile;
-		m_pBinaryFile = NULL;
-	}
-}
-
-bool CATDbgHelper::Open( const string& sParameter, const unsigned long iLong )
-{
-	LOG_FUNC_ENTRY("CATDbgHelper::Open");
-	// Verify that file exits. Version 5.1.2600.5512 of dbghelp.dll does not correctly
-	// return error code if missing image file. This can lead upto applicaton crash.
-	if ( ! CATBase::FileExists( sParameter.c_str() ) )
-	{
-		LOG_STRING( "Missing image file: " << sParameter );
-		return false;
-	}
-
-	// Is it urel try read map?
-	if ( sParameter.find( "\\urel\\" ) != string::npos )
-	{
-		string sMapFile = sParameter;
-		sMapFile.append( ".map" );
-		ReadMapFile( sMapFile );
-	}
-
-	// Set base address used
-	m_BaseAddress = iLong + AT_VIRTUAL_OFFSET_DBGHELPER;
-	// Binary file (also referred as symbol).
-	size_t length = sParameter.length();
-	if ( length == 0 )
-	{
-		LOG_STRING("DbgHelp:Invalid binary parameter.");
-		return false;
-	}
-
-	char* pChar = new char[ sParameter.length()+1 ];
-	strcpy( pChar, sParameter.c_str() );
-	// Have to be casted to PSTR before using dbg api. Even tho its typedef same.
-	// This will avoid access violations bug.
-	// Note pChar is not deleted because its the member pointer just casted its
-	// memory allocation freed in destructor.
-	if ( m_pBinaryFile )
-		delete[] m_pBinaryFile;
-
-	m_pBinaryFile = (PSTR) pChar;
-
-	// Initialize dbghelper if not done only once.
-	if ( ! CDBGHELPER_OPEN )
-	{
-		// Set symbol options
-		SymSetOptions( SYMOPT_LOAD_LINES | SYMOPT_DEBUG | SYMOPT_UNDNAME | SYMOPT_LOAD_ANYTHING );
-		if ( !SymInitialize( GetCurrentProcess(), NULL, TRUE ) )
-		{
-			LOG_STRING("DbgHelp:Error initializing dbghelper " << (int) GetLastError());
-			return false;
-		}
-		LOG_STRING("DbgHelp:dbghelper opened.");
-		CDBGHELPER_OPEN = true;
-	}
-
-	// Set symbol search path.
-	if ( !SymSetSearchPath( GetCurrentProcess(), NULL ) )
-	{
-		LOG_STRING("DbgHelp:Error setting symbol search path " << (int) GetLastError());
-		return false;
-	}
-
-	// Load module.
-	DWORD64 ret;
-	ret = SymLoadModule64( GetCurrentProcess(), NULL, m_pBinaryFile, NULL, m_BaseAddress, NULL ); // 5.1 api version.
-	if ( ret != m_BaseAddress  && ret != 0)
-	{
-		LOG_STRING("Dbghelp:Module load failed " << (int) GetLastError());
-		return false;
-	}
-	CDBGHELPER_CLIENTS++;
-	return true;
-}
-
-string CATDbgHelper::GetError( void )
-{
-	LOG_FUNC_ENTRY("CATDbgHelper::GetError");
-	return string("not implemented.");
-}
-
-bool CATDbgHelper::Close( void )
-{
-	LOG_FUNC_ENTRY("CATDbgHelper::Close");
-	if ( ! SymUnloadModule64( GetCurrentProcess(), m_BaseAddress ) )
-	{
-		LOG_STRING("Dbghelp:Module unload failed.");
-	}
-	CDBGHELPER_CLIENTS--;
-	if ( CDBGHELPER_OPEN && CDBGHELPER_CLIENTS == 0)
-	{
-		// Cleanup dbghelper.
-		if ( ! SymCleanup( GetCurrentProcess() ) )
-		{
-			LOG_STRING("dbghelper cleanup failed.");
-			return false;
-		}
-		LOG_STRING("dbghelper closed.");
-		// Set state not opened.
-		CDBGHELPER_OPEN = false;
-	}
-	return true;
-}
-
-bool CATDbgHelper::AddressToLine( CATMemoryAddress* result )
-{
-	LOG_FUNC_ENTRY("CATDbgHelper::AddressToLine");
-	
-	// Set state out of range
-	result->SetAddressToLineState( CATMemoryAddress::OUT_OF_RANGE );
-
-	// check that dbghelper has been initialized successfully.
-	if ( ! CDBGHELPER_OPEN )
-		return false;
-
-	// Check has binary been moved, if so unload and load to new base address.
-	if ( result->GetModuleStartAddress() + AT_VIRTUAL_OFFSET_DBGHELPER != m_BaseAddress )
-	{
-		// Unload.
-		if ( SymUnloadModule64( GetCurrentProcess(), m_BaseAddress ) )
-		{
-			// Set new base address.
-			m_BaseAddress = result->GetModuleStartAddress() + AT_VIRTUAL_OFFSET_DBGHELPER;
-			// (Re)load.
-			DWORD64 loading = SymLoadModule64( GetCurrentProcess(), NULL, m_pBinaryFile, NULL, m_BaseAddress, NULL );
-			if ( loading != m_BaseAddress  && loading != 0)	
-			{
-				LOG_STRING("Dbghelp:Module load failed " << (int) GetLastError());
-				return false;
-			}
-		}
-		else
-			LOG_STRING("Dbghelp:Module unload failed " << (int) GetLastError() );
-	}
-	// Address to find (offset+given address).
-	unsigned long iAddressToFind = result->GetAddress() + AT_VIRTUAL_OFFSET_DBGHELPER;
-	// Displacements of line/symbol information.
-	DWORD64 displacementSymbol;
-	DWORD displacementLine;
-	// Structure to get symbol information.
-	CSymbolInfo symbol;
-	// Structure to get line information.
-	CLineInfo line;
-	// Find Symbol for given address 
-	if( ! SymFromAddr( GetCurrentProcess(), iAddressToFind , &displacementSymbol, &symbol.si ) )
-	{
-		LOG_STRING("Failed to find symbol information for given line.");
-		return AddressToFunction( result );
-	}
-	// Find line information
-	if( ! SymGetLineFromAddr64( GetCurrentProcess(), iAddressToFind, &displacementLine, &line ) )
-	{
-		// If it fails get symbol line information
-		LOG_STRING("Dbghelp:Failed to find line information for address, trying for symbol of address.");
-		if( ! SymGetLineFromAddr64( GetCurrentProcess(), symbol.si.Address, &displacementLine, &line ) )
-		{
-			LOG_STRING("Dbghelp:Failed to find line information for symbol address.");
-			return AddressToFunction( result );
-		}
-	}
-	// Set the results.
-	result->SetFileName( string( line.FileName ) );
-	result->SetFunctionName( string( symbol.si.Name ) );
-	result->SetExactLineNumber( (int) line.LineNumber );
-	result->SetAddressToLineState( CATMemoryAddress::EXACT );
-	// Return.
-	return true;
-}
-
-bool CATDbgHelper::AddressToFunction( CATMemoryAddress* result )
-{
-	LOG_FUNC_ENTRY("CATDbgHelper::AddressToFunction");
-	bool bFound = false;
-	// If map file read use it and return.
-	if ( m_bMap )
-	{
-		ULONG uCountedA = result->GetOffSetFromModuleStart();
-		for ( vector<MAP_FUNC_INFO>::iterator it = m_vMapFileFuncList.begin() ; it != m_vMapFileFuncList.end() ; it++ )
-		{
-			// Check is this the symbol where address is.
-			unsigned long iStart = it->iAddress;
-			unsigned long iEnd = it->iAddress + it->iFuncLength;
-			if ( uCountedA >= iStart 
-				&& uCountedA < iEnd )
-			{
-				result->SetAddressToLineState( CATMemoryAddress::SYMBOL );
-				result->SetFunctionName( it->sMangledName );
-				bFound = true;
-				break;
-			}
-		}
-	}
-	return bFound;
-}
-
-void CATDbgHelper::ReadMapFile( const string sMapFileName )
-{
-	LOG_FUNC_ENTRY("CATDbgHelper::ReadMapFile");
-	try {
-		ifstream in( sMapFileName.c_str() );
-		if ( ! in.good() )
-		{
-			in.close();
-			return;
-		}
-		char cLine[MAX_LINE_LENGTH];
-		do {
-			in.getline( cLine, MAX_LINE_LENGTH );
-			// Search pattern for 'image ro' symbols is ".text"
-			string sLine( cLine );
-			if ( sLine.find( ".text" ) != string::npos )
-			{
-				MAP_FUNC_INFO symbol;
-				// Pickup symbol attributes
-				// Address
-				string sAddress = CATBase::GetStringUntilNextSpace( sLine, true );
-				symbol.iAddress = CATBase::_httoi( sAddress.c_str() );
-				// Lenght
-				string sLength = CATBase::GetStringUntilNextSpace( sLine, true );
-				symbol.iFuncLength = CATBase::_httoi( sLength.c_str() );
-				// Name
-				size_t iStart = sLine.find_first_of( '(' );
-				size_t iEnd = sLine.find_last_of( ')' );
-				if ( iStart != string::npos && iEnd != string::npos )
-				{
-					symbol.sMangledName = sLine.substr( iStart+1, iEnd-iStart-1 );
-					// Add symbol to vector
-					m_vMapFileFuncList.push_back( symbol );
-				}
-			}
-		} while ( in.good() );
-		in.close();
-		m_bMap = true;
-	} catch (...) {
-		m_bMap = false;
-		LOG_STRING("DbgHelp: Error reading map file.");
-	}
-}
\ No newline at end of file
--- a/analyzetool/commandlineengine/src/catfilereader.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +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:  Class for reading ascii files in AnalyzeTool.
-*
-*/
-
-#include "../inc/ATCommonDefines.h"
-#include "../inc/catfilereader.h"
-
-// -----------------------------------------------------------------------------
-// CATFileReader::CATFileReader
-// Constructor.
-// -----------------------------------------------------------------------------
-CATFileReader::CATFileReader()
-{
-	LOG_FUNC_ENTRY("CATFileReader::CATFileReader");
-	m_cDelimiter = '\r'; // default line delimeter
-}
-
-// -----------------------------------------------------------------------------
-// CATFileReader::~CATFileReader
-// Destructor.
-// -----------------------------------------------------------------------------
-CATFileReader::~CATFileReader()
-{
-	LOG_FUNC_ENTRY("CATFileReader::~CATFileReader");
-}
-
-// -----------------------------------------------------------------------------
-// CATFileReader::Open
-// Open / Read file.
-// -----------------------------------------------------------------------------
-bool CATFileReader::Open( const char* cFile )
-{
-	LOG_FUNC_ENTRY("CATFileReader::Open");
-	if ( strlen( cFile ) < 1 )
-	{
-		LOG_STRING("CATFileReader::Open empty file argument.");
-		return false;
-	}
-	try {
-		ifstream in;
-		in.open( cFile, ios::binary );
-		if ( ! in.good() )
-			return false;
-		m_stream << in.rdbuf();
-		in.close();
-	}
-	catch(...)
-	{
-		LOG_STRING("CATFileReader::Open unhandled exception.");
-		return false;
-	}
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATFileReader::Close
-// Close file.
-// -----------------------------------------------------------------------------
-bool CATFileReader::Close( void )
-{
-	LOG_FUNC_ENTRY("CATFileReader::Close");
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATFileReader::GetLine
-// Get line from file.
-// -----------------------------------------------------------------------------
-bool CATFileReader::GetLine( string& sLine )
-{
-	//LOG_FUNC_ENTRY("CATFileReader::GetLine");
-	char cLine[MAX_LINE_LENGTH];
-	if ( !m_stream.good() )
-		return false;
-	m_stream.getline( cLine, MAX_LINE_LENGTH, m_cDelimiter ); m_stream.get();
-	sLine = cLine;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATFileReader::SetDelimiter
-// Set line delimiting character.
-// -----------------------------------------------------------------------------
-void CATFileReader::SetDelimiter( char cDelimiter )
-{
-	LOG_FUNC_ENTRY("CATFileReader::SetDelimiter");
-	m_cDelimiter = cDelimiter;
-}
-
-// -----------------------------------------------------------------------------
-// CATFileReader::GetDelimiter
-// Get current line delimiting character.
-// -----------------------------------------------------------------------------
-char CATFileReader::GetDelimiter() const
-{
-	LOG_FUNC_ENTRY("CATFileReader::GetDelimiter()");
-	return m_cDelimiter;
-}
\ No newline at end of file
--- a/analyzetool/commandlineengine/src/catromsymbol.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,656 +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:  Reads rom symbol file and provides interface to acquire
-*               binary and function information using memory addresss.
-*
-*/
-
-#include "../inc/ATCommonDefines.h"
-#include "../inc/catromsymbol.h"
-#include "../inc/catfilereader.h"
-#include "../inc/CATBase.h"
-#include "../inc/CATMemoryAddress.h"
-
-// -----------------------------------------------------------------------------
-// RofsBinary::RofsBinary
-// Default construcor
-// -----------------------------------------------------------------------------
-RofsBinary::RofsBinary()
-{
-	LOG_LOW_FUNC_ENTRY("RofsBinary::RofsBinary");
-	m_sBinary = "";
-	vSymbols.clear();
-}
-
-// -----------------------------------------------------------------------------
-// RofsBinary::RofsBinary
-// Construcor
-// -----------------------------------------------------------------------------
-RofsBinary::RofsBinary( const string& sBinary )
-{
-	LOG_LOW_FUNC_ENTRY("RofsBinary::RofsBinary");
-	m_sBinary = sBinary;
-	vSymbols.clear();
-}
-
-// -----------------------------------------------------------------------------
-// RofsBinary::~RofsBinary
-// Destructor
-// -----------------------------------------------------------------------------
-RofsBinary::~RofsBinary()
-{
-	LOG_LOW_FUNC_ENTRY("RofsBinary::~RofsBinary");
-	for ( vector<Symbol*>::iterator it = vSymbols.begin() ; it != vSymbols.end() ; it++ )
-		delete *it;
-	vSymbols.clear();
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::CATRomSymbol
-// Constructor.
-// -----------------------------------------------------------------------------
-CATRomSymbol::CATRomSymbol()
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::CATRomSymbol");
-	m_bSymbolsRead = false;
-	m_iRomEndAddress = 0;
-	m_iRomStartAddress = 0;
-	m_vRomFiles.clear();
-	m_sErrorMessage = "";
-	m_vRomCache.clear();
-	m_vRomSymbols.clear();
-	m_bShowProgressMessages = false;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::~CATRomSymbol
-// Destructor.
-// -----------------------------------------------------------------------------
-CATRomSymbol::~CATRomSymbol()
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::~CATRomSymbol");
-	// Rom
-	for ( vector<Symbol*>::iterator it = m_vRomSymbols.begin() ; it != m_vRomSymbols.end() ; it++ )
-	{
-		delete *it;
-	}
-	m_vRomSymbols.clear();
-	// Rofs
-	for ( vector<RofsBinary*>::iterator it = m_vRofsBinaries.begin() ; it != m_vRofsBinaries.end() ; it++ )
-	{
-		delete *it;
-	}
-	m_vRofsBinaries.clear();
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::Open
-// This funtion should not be used anymore since
-// we support multiple rom/rofs files.
-// -----------------------------------------------------------------------------
-bool CATRomSymbol::Open( const string& /*sString*/, const unsigned long /*iLong*/)
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::Open");
-	return false;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::SetSymbols
-// Set symbol file(s) to be used.
-// This also checks that files exists and identifies them as rom/rofs.
-// -----------------------------------------------------------------------------
-bool CATRomSymbol::SetSymbols( const vector<string>& vSymbols )
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::SetSymbols");
-	bool ok = true;
-	// Check no same symbol defined twice.
-	for( vector<string>::const_iterator it = vSymbols.begin() ;
-		it != vSymbols.end(); it++ )
-	{
-		for( vector<string>::const_iterator it2 = vSymbols.begin() ;
-			it2 != vSymbols.end(); it2++ )
-		{
-			if ( it == it2 )
-				continue;
-			if ( _stricmp( (*it).c_str(), (*it2).c_str() ) == 0 )
-			{
-				m_sErrorMessage.append( "Same symbol file defined twice (" );
-				m_sErrorMessage.append( (*it) );
-				m_sErrorMessage.append( ")\n" );
-				return false;
-			}
-		}
-	}
-	// Loop given symbol files.
-	for( vector<string>::const_iterator it = vSymbols.begin() ;
-		it != vSymbols.end(); it++ )
-	{
-		// Symbol file exists?
-		if ( ! CATBase::FileExists( (*it).c_str() ) )
-		{
-			ok = false;
-			m_sErrorMessage.append( "Symbol file does not exists (" );
-			m_sErrorMessage.append( *it );
-			m_sErrorMessage.append( ").\n");
-			continue;
-		}
-		// Identify symbol file.
-		int type = IdentifySymbolFile( *it );
-		// Depending on type move it correct vector.
-		switch( type )
-		{
-		case SYMBOL_FILE_INVALID:
-			ok = false;
-			m_sErrorMessage.append( "Symbol file with invalid content (" );
-			m_sErrorMessage.append( *it );
-			m_sErrorMessage.append( ").\n");
-			break;
-		case SYMBOL_FILE_ROM:
-			m_vRomFiles.push_back( *it );
-			break;
-		case SYMBOL_FILE_ROFS:
-			m_vRofsFiles.push_back( *it );
-			break;
-		default:
-			ok = false;
-			LOG_STRING("IdentifySymbolFile returned unknown type.");
-			break;
-		}
-	}
-	if ( ok )
-	{
-		// Read symbols.
-		if ( m_vRomFiles.size() > 0 )
-		{
-			if ( ! ReadRomFiles() )
-				ok = false;
-			else
-				m_bSymbolsRead = true;
-		}
-		if ( m_vRofsFiles.size() > 0 )
-		{
-			if ( ! ReadRofsFiles() )
-				ok = false;
-			else
-				m_bSymbolsRead = true;
-		}
-	}
-	return ok;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::IdentifySymbolFile
-// Identify given file is it rom / rofs.
-// -----------------------------------------------------------------------------
-int CATRomSymbol::IdentifySymbolFile( const string& sFile )
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::IdentifySymbolFile");
-	// Set type as invalid.
-	int iType = SYMBOL_FILE_INVALID;
-	// Line counter.
-	int iLineCount = 0;
-	// Minimun line length to identify it.
-	size_t iLineMinLength = MAX_LINE_LENGTH;
-	if ( ROFS_SYMBOL_IDENTIFY_STRING.length() > ROM_SYMBOL_IDENTIFY_STRING.length() )
-		iLineMinLength = ROFS_SYMBOL_IDENTIFY_STRING.length();
-	else
-		iLineMinLength = ROM_SYMBOL_IDENTIFY_STRING.length();
-	try {
-		ifstream in;
-		in.open( sFile.c_str(), ios::in );
-		if ( ! in.good() )
-			return SYMBOL_FILE_INVALID;
-		char cLine[MAX_LINE_LENGTH];
-		do {
-			// Dont read too many lines. (File might be contain invalid data).
-			iLineCount++;
-			if ( iLineCount > IDENTIFY_MAX_LINES_READ )
-				break;
-
-			// Get line -> string.
-			in.getline( cLine, MAX_LINE_LENGTH );
-			string sLine(cLine);
-			
-			// Check its not too short.
-			if( sLine.length() < iLineMinLength )
-				continue;
-
-			// Take substring from start of line to identify it to rofs/rom.
-			if ( ! sLine.substr( 0, ROFS_SYMBOL_IDENTIFY_STRING.length() ).compare( ROFS_SYMBOL_IDENTIFY_STRING ) )
-			{
-				iType = SYMBOL_FILE_ROFS;
-				break;
-			}
-			else if ( ! sLine.substr( 0, ROM_SYMBOL_IDENTIFY_STRING.length() ).compare( ROM_SYMBOL_IDENTIFY_STRING ) )
-			{
-				iType = SYMBOL_FILE_ROM;
-				break;
-			}
-		} while ( in.good() );
-		in.close();
-	}
-	catch(...)
-	{
-		LOG_STRING("CATRomSymbol::IdentifySymbolFile unhandled exception.");
-	}
-	return iType;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::ReadRomFiles
-// Reads rom file(s) and creates symbols to vector.
-// -----------------------------------------------------------------------------
-bool CATRomSymbol::ReadRomFiles()
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::ReadRomFile");
-
-	// Clear symbols.
-	for ( vector<Symbol*>::iterator it = m_vRomSymbols.begin() ; it != m_vRomSymbols.end() ; it++ )
-	{
-		delete *it;
-	}
-	m_vRomSymbols.clear();
-	
-	// Clear cache. note cache is just pointers dont delete them.
-	m_vRomCache.clear();
-
-	// Any errors?
-	bool ok = true;
-
-	for( vector<string>::iterator it = m_vRomFiles.begin();
-		it != m_vRomFiles.end() ; it++ )
-		ok = ReadRomFile( *it );
-	
-	// If size smaller than 1 it is not good rom file(s).
-	if ( m_vRomSymbols.size() < 1  || ok != true)
-		return false;
-
-	// Rom start and end addresses.
-	m_iRomStartAddress = (*m_vRomSymbols.begin())->iStartAddress;
-	m_iRomEndAddress = (*m_vRomSymbols.rbegin())->iEndAddress;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::ReadRofsFiles
-// Read rofs files.
-// -----------------------------------------------------------------------------
-bool CATRomSymbol::ReadRofsFiles()
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::ReadRofsFiles");
-	// Clear.
-	for ( vector<RofsBinary*>::iterator it = m_vRofsBinaries.begin() ; it != m_vRofsBinaries.end() ; it++ )
-	{
-		delete *it;
-	}
-	m_vRofsBinaries.clear();
-	
-	// Any errors?
-	bool ok = true;
-
-	for( vector<string>::iterator it = m_vRofsFiles.begin();
-		it != m_vRofsFiles.end() ; it++ )
-		ok = ReadRofsFile( *it );
-	
-	// If size smaller than 1 it is not good rofs file(s).
-	if ( m_vRofsBinaries.size() < 1  || ok != true)
-		return false;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::ReadRomFile
-// Read given rom file
-// -----------------------------------------------------------------------------
-bool CATRomSymbol::ReadRomFile( const string& sFile )
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::ReadRomfile");
-	// Open rom file.
-	CATFileReader* reader = new CATFileReader();
-	// Show progress message if flag set.
-	if ( m_bShowProgressMessages )
-		cout << AT_MSG << "Reading rom symbol file: " << sFile << "..." << endl;
-	if ( ! reader->Open( sFile.c_str() ) )
-	{
-		reader->Close();
-		delete reader;
-		return false;
-	}
-
-	// Show progress message if flag set.
-	if ( m_bShowProgressMessages )
-		cout << AT_MSG << "Parsing rom symbol file: " << sFile << "..." << endl;
-
-	// Loop thrue lines.
-	string sLine("");
-	string sBinary("");
-	while( reader->GetLine( sLine ) )
-	{
-		// From rom we just read symbols that have lenght, no need to separate them into diff binaries.
-		try {
-			if ( sLine.size() < 2 )
-			{
-				continue;
-			}
-			else if ( sLine.at(0) == '8' )
-			{
-				// Create new item.
-				Symbol* symbol = new Symbol();
-				ParseSymbolFromLine( sLine, symbol);
-				// Ignore symbols which have same start & end address (zero length).
-				if ( symbol->iStartAddress != symbol->iEndAddress )
-					m_vRomSymbols.push_back( symbol );
-				else
-					delete symbol;
-			}
-		} catch(...)
-		{
-			// Catch all possible exception here so analyze will succeed even rom file invalid.
-			m_sErrorMessage.append( "Unhandled exception parsing rom symbol file.\n" );
-			// Close and delete reader.
-			reader->Close();
-			delete reader;
-			return false;
-		}
-	}
-	// Close and delete reader.
-	reader->Close();
-	delete reader;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::ReadRofsFile
-// Read given rofs file
-// -----------------------------------------------------------------------------
-bool CATRomSymbol::ReadRofsFile( const string& sFile )
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::ReadRofsFile");
-	// open/read rofs file.
-	CATFileReader* reader = new CATFileReader();
-	// Show progress message if flag set.
-	if ( m_bShowProgressMessages )
-		cout << AT_MSG << "Reading rofs symbol file: " << sFile << "..." << endl;
-	if ( ! reader->Open( sFile.c_str() ) )
-	{
-		reader->Close();
-		delete reader;
-		return false;
-	}
-
-	// Show progress message if flag set.
-	if ( m_bShowProgressMessages )
-		cout << AT_MSG << "Parsing rofs symbol file: " << sFile << "..." << endl;
-
-	// Loop thrue lines.
-	string sLine("");
-	string sBinary("");
-	RofsBinary* rb = NULL;
-	while( reader->GetLine( sLine ) )
-	{
-		try {
-			if ( sLine.size() < 2 )
-			{
-				continue;
-			}
-			else if ( sLine.at(0) == 'F' )
-			{
-				if ( rb != NULL )
-				{
-					// Check last binary if no symbols in it dont add it.
-					if ( rb->vSymbols.size() == 0 )
-					{
-						delete rb;
-						rb = NULL;
-					}
-					else
-						m_vRofsBinaries.push_back( rb );
-				}
-				// new binary name.
-				size_t i = sLine.rfind("\\");
-				sLine.erase(0, i+1);
-				rb = new RofsBinary( sLine );
-
-			}
-			else if ( sLine.at(0) == '0' )
-			{
-				// Cannot pickup symbols if no binary defined.
-				if ( rb == NULL )
-					continue;
-				// Create new item.
-				Symbol* symbol = new Symbol();
-				ParseSymbolFromLine( sLine, symbol);
-				// Ignore symbols which have same start & end address (zero length).
-				if ( symbol->iStartAddress != symbol->iEndAddress )
-					rb->vSymbols.push_back( symbol );
-				else
-					delete symbol;
-			}
-		} catch(...)
-		{
-			// Catch all possible exception here so analyze will succeed even rofs file invalid.
-			m_sErrorMessage.append( "Unhandled exception parsing rofs symbol file.\n" );
-			// Close and delete reader.
-			reader->Close();
-			delete reader;
-			return false;
-		}
-	}
-	// Last added binary.
-	if ( rb != NULL )
-	{
-		if ( rb->vSymbols.size() == 0 )
-		{
-			delete rb;
-			rb = NULL;
-		}
-		else
-			m_vRofsBinaries.push_back( rb );
-	}
-	// Close and delete reader.
-	reader->Close();
-	delete reader;
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::ParseSymbolFromLine
-// Parses given line into given symbol.
-// -----------------------------------------------------------------------------
-void CATRomSymbol::ParseSymbolFromLine( const string& sLine, Symbol* pSymbol )
-{
-	LOG_LOW_FUNC_ENTRY("CATRomSymbol::ParseSymbolFromLine");
-	if ( pSymbol == NULL )
-		return;
-	size_t s,x;
-	string temp;
-	// address.
-	x = sLine.find( ' ' );
-	temp = sLine.substr( 0, x );
-	pSymbol->iStartAddress = CATBase::_httoi( temp.c_str() );
-	// "Erase spaces" move starting point.
-	s = x;
-	s = sLine.find_first_not_of( ' ', s );
-	// length.
-	x = sLine.find( ' ', s );
-	temp = sLine.substr(s,x-s);
-	unsigned long length = CATBase::_httoi( temp.c_str() );
-	pSymbol->iEndAddress = pSymbol->iStartAddress + length;
-	// "Erase spaces" move starting point.
-	s = x;
-	s = sLine.find_first_not_of( ' ', s);
-	// function. Function might have spaces so we find 2 spaces which indicates end of it.
-	x = sLine.find( "  ", s );
-	temp = sLine.substr( s, x-s );
-	pSymbol->sFunction = temp;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::GetError
-// Get error string if error occured in other methods.
-// -----------------------------------------------------------------------------
-string CATRomSymbol::GetError( void )
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::GetError");
-	return m_sErrorMessage;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::Close
-// Close (stop using).
-// -----------------------------------------------------------------------------
-bool CATRomSymbol::Close( void )
-{
-	LOG_FUNC_ENTRY("CATRomSymbol::Close");
-	return true;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::AddressToLine
-// Try locate binary and function name for given memory address.
-// -----------------------------------------------------------------------------
-bool CATRomSymbol::AddressToLine( CATMemoryAddress* result )
-{
-	LOG_LOW_FUNC_ENTRY("CATRomSymbol::AddressToLine");
-	// Have symbols been read.
-	if ( ! m_bSymbolsRead )
-		return false;
-	// check that its lenght > 2
-	if ( result->GetAddressString().size() < 2 )
-		return false;
-	/* Check first is address in range of rom */
-	if ( result->GetAddress() < m_iRomStartAddress
-		|| result->GetAddress() > m_iRomEndAddress )
-	{
-		return AddressToLineRofs( result );		
-	}
-	return AddressToLineRom( result );
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::AddressToLineRom
-// Locate function from rom address range.
-// -----------------------------------------------------------------------------
-bool CATRomSymbol::AddressToLineRom( CATMemoryAddress* result )
-{
-	LOG_LOW_FUNC_ENTRY( "CATRomSymbol::AddressToLineRom" );
-	// Address to find in integer & string.
-	unsigned long iAddressToFind = result->GetAddress();
-	string sAddressToFind = result->GetAddressString();
-	
-	// Find symbol.
-	Symbol* pFound = NULL;
-
-	// Check from cache first.
-	vector<Symbol*>::iterator it;
-	for ( it = m_vRomCache.begin(); it != m_vRomCache.end(); it++ )
-	{
-		if ( iAddressToFind >= (*it)->iStartAddress
-			&& (*it)->iEndAddress > iAddressToFind )
-		{
-			pFound = *it;
-			break;
-		}
-	}
-	
-	if ( pFound == NULL )
-	{
-		// From all symbols.
-		bool reverse = false;
-		int offSetFromStart = iAddressToFind - m_iRomStartAddress;
-		int offSetFromEnd = m_iRomEndAddress - iAddressToFind;
-		if ( offSetFromEnd < offSetFromStart ) 
-			reverse = true;
-		
-		if ( reverse )
-		{
-			// Iterate vector in reverse.
-			vector<Symbol*>::reverse_iterator it;
-			for ( it = m_vRomSymbols.rbegin(); it != m_vRomSymbols.rend(); ++it )
-			{
-				if ( iAddressToFind >= (*it)->iStartAddress
-					&& (*it)->iEndAddress > iAddressToFind )
-				{
-					pFound = *it;
-					break;
-				}
-			}
-		}
-		else
-		{
-			// Iterate vector normal direction.
-			vector<Symbol*>::iterator it;
-			for ( it = m_vRomSymbols.begin(); it != m_vRomSymbols.end(); it++ )
-			{
-				if ( iAddressToFind >= (*it)->iStartAddress
-					&& (*it)->iEndAddress > iAddressToFind )
-				{
-					pFound = *it;
-					break;
-				}
-			}
-		}
-	}
-
-	// Set result if found.
-	if ( pFound != NULL )
-	{
-		result->SetFunctionName( pFound->sFunction );
-		result->SetAddressToLineState( CATMemoryAddress::SYMBOL );
-		// Add found symbols pointer to cache.
-		m_vRomCache.push_back( pFound );
-		return true;
-	}
-	return false;
-}
-
-// -----------------------------------------------------------------------------
-// CATRomSymbol::AddressToLineRofs
-// Locate function from rofs address range.
-// -----------------------------------------------------------------------------
-bool CATRomSymbol::AddressToLineRofs( CATMemoryAddress* result)
-{
-	LOG_LOW_FUNC_ENTRY("CATRomSymbol::AddressToLineRofs");
-	// Check that binary name is defined in memory address.
-	string sBinary = result->GetModuleName();
-	if ( sBinary.empty() )
-		return false;
-	// Try find that named module.
-	vector<RofsBinary*>::iterator rofs = m_vRofsBinaries.begin();
-	while( rofs != m_vRofsBinaries.end() )
-	{
-		if ( (*rofs)->m_sBinary.compare( sBinary ) == 0 )
-			break;
-		rofs++;
-	}
-	if ( rofs == m_vRofsBinaries.end() )
-		return false;
-
-	// Offset what we are looking from binary
-	unsigned long offSet = result->GetAddress();
-	offSet -= result->GetModuleStartAddress();
-	for( vector<Symbol*>::iterator it = (*rofs)->vSymbols.begin() ;
-		it != (*rofs)->vSymbols.end(); it++ )
-	{
-		if ( (*it)->iStartAddress <= offSet && offSet < (*it)->iEndAddress )
-		{
-			result->SetFunctionName( (*it)->sFunction );
-			result->SetAddressToLineState( CATMemoryAddress::SYMBOL );
-			return true;
-		}
-	}
-	return false;
-}
-
-//EOF
--- a/analyzetool/commandlineengine/src/helps.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +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:  Contains help texts for CLE.
-*
-*/
-#include "../inc/ATCommonDefines.h"
-
-//Function declarations
-void print_help( void );
-void print_syntax_examples( void );
-
-/**
-* Print help info.
-*/
-void print_help( void )
-{
-	cout<< "AnalyzeTool v";
-	cout<< ATOOL_VERSION;
-	cout<< " - ";
-	cout<< ATOOL_DATE;
-	cout<< "\n";
-	cout<< "Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).\nAll rights reserved.\n\n";
-	cout<< "Usage:\n";
-	cout<< "atool -e [optional parameters] abld [abld parameters]\n";
-	cout<< "      -me [optional parameters] abld [abld parameters]\n";
-	cout<< "      -mi [optional parameters] [-f data-file] sbs [sbs parameters]\n";
-	cout<< "      -a data-file [output-file] [-s symbol-file] [-l#]\n";
-	cout<< "      -p data-file output-file\n";
-	cout<< "      -c\n";
-	cout<< "      -v\n";
-	cout<< "      -help\n";
-	cout<< "\n";
-	cout<< "Mandatory parameter to choose:\n";
-	cout<< " -e              Build project for analysis using external data gathering.\n";
-	cout<< " -me             Build project for analysis using monitored external\n";
-	cout<< "                 data gathering.\n";
-	cout<< " -mi             Build project for analysis using monitored internal\n";
-	cout<< "                 data gathering.\n";
-	cout<< " abld...         Use SBS v.1 build system with defined build command,\n";
-	cout<< "                 which includes supported platform and build type.\n";
-	cout<< " sbs...          Use SBS v.2 (Raptor) build system with defined sbs build\n";
-	cout<< "                 command, which includes supported platform and build type.\n";
-	cout<< " -a              Analyze report file.\n";
-	cout<< " -c              Clear AnalyzeTool changes, temporary files and releasable(s).\n";
-	cout<< " -p              Parse trace file to data file.\n";
-	cout<< " -help           Show full help including syntax examples.\n";
-	cout<< " -v              Print version info.\n";
-	cout<< "\n";
-
-	cout<< "Optional parameters:\n";
-	cout<< " -acs size       Specifies the call stack size gathered when memory\n";
-	cout<< "                 is allocated. Size can be between 0-256.\n";
-	cout<< " -fcs size       Specifies the call stack size gathered when memory is freed.\n";
-	cout<< "                 Size can be between 0-256.\n";
-	cout<< " -f data file    Specifies the filename for monitored internal data gathering\n";
-	cout<< "                 (50 chars max). Cannot contain path.\n";
-	cout<< " output-file     Specifies the results data file name.\n";
-	cout<< " -l              Logging level of analyze report(0,1,2,3), default 3.\n";
-	cout<< " -s symbol-file  Specifies rom/rofs symbol file(s) to be used in analyze.\n";
-	cout<< "                 Multiple -s options can be given.\n";
-	cout<< " -nobuild        Instruments the project.\n";
-	//cout<< "  -show_debug       Print debug messages to console.\n";
-	//cout<< "  -show_debug_all	  Print debug messages to console (all).\n";
-	//cout<< "  -show_dbgview     Print debug messages to windows debug api.\n";
-	//cout<< "  -show_dbgview_all Print debug messages to windows debug api (all).\n";
-
-	/*
-	* Old style parameters, just for notes.
-	printf("Usage:\n");
-	printf("atool -m [mmp-file] [mode] [data-file] [-variant variant-name] [build] [-sbs2] [-e]\n");
-	printf("      -i [mmp-file] [mode] [data-file] [-variant variant-name] [build] [-sbs2] [-e]\n");
-	printf("      -a [mmp-file | target-name] data-file [-s symbol-file]\n");
-	printf("         [output-file] [-l#]\n");
-	printf("      -p data-file [output-file]\n");
-	printf("      -c\n");
-	//printf("      -u\n");
-	printf("      -v\n");
-	printf("      -help\n");
-	printf("\n");
-	printf("Mandatory option to choose:\n");
-	printf("  -m           Build project for analysis.\n");
-	printf("  -i           Instrument project.\n");
-	printf("  -a           Analyze report file.\n");
-	//printf("  -u           Create listing & map files.\n");
-	printf("  -c           Clear AnalyzeTool changes and temporary files.\n");
-	printf("  -p           Parse trace file.\n");
-	printf("  -help        Show full help including syntax examples.\n");
-	printf("\n");
-
-	printf("Optional options:\n");
-	printf("  mmp-file     Specifies one of the component from bld.inf which is used.\n");
-	printf("  target-name  Specifies the target name of binary to which create\n");
-	printf("               analyze report.\n");
-	printf("  mode         Logging mode (trace or S60), default trace.\n");
-	printf("  data-file    Specifies the user defined data file name (50 chars max).\n");
-	printf("  build        Build target (udeb or urel), default udeb.\n");
-	printf("  output-file  Specifies the results data file name.\n");
-	printf("  -l           Logging level of analyze report(0,1,2,3), default 3.\n");
-	printf("  -variant     Specifies Symbian binary variant to be used.\n");
-	printf("  variant-name Specifies the variant name to be used.\n");
-	printf("  -s           Specifies rom symbol file be used in analyze.\n");
-	printf("  symbol-file  Full path to rom symbol file used in analyze.\n");
-	printf("  -sbs2        Use Symbian Build System v.2.\n");
-	printf("  -winscw      Build project for emulator (winscw platform).\n");
-	printf("  -v           Print version info.\n");
-	*/
-}
-
-void print_syntax_examples( void )
-{
-//Helper line showing width of 80 chars.
-//80cout<< "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
-	cout<< endl;
-	cout<< "Building syntax examples:" << endl;
-	cout<< "Cmd   Description" << endl;
-	
-	cout<< "atool -e abld build armv5 udeb" << endl;
-	cout<< "      Hooks every component from bld.inf. Using external data gathering," << endl;
-	cout<< "      udeb build type and armv5 platform." << endl;
-
-	cout<< "atool -mi -acs 5 sbs -c winscw_udeb" << endl;
-	cout<< "      Hooks every component from bld.inf. Using Symbian Build System v.2" << endl;
-	cout<< "      Using monitored internal data gathering, call stack size of 5" << endl;
-	cout<< "      in allocations, udeb build type and winscw platform." << endl;
-	
-	cout<< "atool -me abld build armv5 udeb foobar" << endl;
-	cout<< "      Hooks only foobar.mmp component from bld.inf. Using monitored" << endl;
-	cout<< "      external data gathering, udeb build type and armv5 platform." << endl;
-	
-	cout<< "atool -e -acs 0 -fcs 0 abld build armv5.default udeb" << endl;
-	cout<< "      Hooks every component from bld.inf. Using default binary variant," << endl;
-	cout<< "      external data gathering, 0 sized callstacks in allocation(s)/free(s)," << endl;
-	cout<< "      udeb build type and armv5 platform." << endl;
-	
-	cout<< "atool -e sbs -b bld.inf -c armv5_udeb" << endl;
-	cout<< "      Hooks every component from bld.inf. Using Symbian Build System v.2" << endl;
-	cout<< "      , external data gathering, udeb build type and armv5 platform." << endl;
-	
-	cout<< "atool -me sbs -s system.xml --config=winscw_udeb" << endl;
-	cout<< "      Hooks every layer defined in system.xml system model. Using Symbian Build" << endl;
-	cout<< "      System v.2, external data gathering, udeb build type and winscw platform." << endl;
-
-	cout<< endl;
-	cout<< "Instrumenting syntax examples:" << endl;
-	cout<< "Cmd   Description" << endl;
-	cout<< "atool -e -nobuild abld build winscw udeb" << endl;
-	cout<< "      Instruments every component from bld.inf. Using external data gathering,"<<endl;
-	cout<< "      udeb build target and winscw platform." << endl;
-    cout<< "   After project is instrumented, it needs to compiled using same platform and" << endl;
-	cout<< "   build type as given to instrumenting. Use -c parameter to remove changes." << endl;
-
-	cout<< endl;
-	cout<< "Analyzing syntax examples:" << endl;
-	cout<< "Cmd   Description" << endl;
-	cout<< "atool -a foo.dat" << endl;
-	cout<< "      Create analyze report from foo.dat device data file." << endl;
-	cout<< "atool -a foo.trace" << endl;
-	cout<< "      Create analyze report from foo.trace raw data file." << endl;
-	cout<< "atool -a foo.dat -s my_rom.symbol -s my_rofs1.symbol" << endl;
-	cout<< "      Create analyze report from foo.dat using also rom and rofs symbol files." << endl;
-	
-	cout<< endl;
-	cout<< "Parsing syntax examples:" << endl;
-	cout<< "Cmd   Description" << endl;
-	cout<< "atool -p foo.trace foo.dat" << endl;
-	cout<< "      Parse foo.trace raw data file to foo.dat device data file." << endl;
-	}
-
-//EOF
--- a/analyzetool/commandlineengine/src/librarychecks.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +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:  Contains functions to check AT libraries.
-*
-*/
-#include "../inc/ATCommonDefines.h"
-#include "../inc/CATBase.h"
-
-// Function declarations
-bool CheckATLibrariesArmv5( string sEpocRoot );
-bool CheckATLibrariesArmv5Abiv2( string sEpocRoot );
-bool CheckATLibrariesWinscw( string sEpocRoot );
-
-// Error msg to user if missing lib
-const char cMissingAToolLibs[] = "\nCan not find AnalyzeTool libraries from current SDK\n\nInstall libraries first\n";
-
-// List of libraries what AnalyzeTool needs when compiled applications on armv5 platform
-const string cAToolLibsArmv5[] = {
-	"epoc32\\RELEASE\\armv5\\LIB\\AToolMemoryHook.lib",
-	"epoc32\\RELEASE\\armv5\\udeb\\AtoolStaticLib.lib",
-	"epoc32\\RELEASE\\armv5\\urel\\AtoolStaticLib.lib"
-};
-
-// List of libraries what AnalyzeTool needs when compiled applications on armv5 platform (using sbs2 / ABIV2 binaries)
-const string cAToolLibsArmv5Abiv2[] = {
-	"epoc32\\RELEASE\\armv5\\LIB\\AToolMemoryHook.dso",
-	"epoc32\\RELEASE\\armv5\\udeb\\AtoolStaticLib.lib",
-	"epoc32\\RELEASE\\armv5\\urel\\AtoolStaticLib.lib"
-};
-
-// List of libraries what AnalyzeTool needs when compiled applications on winscw platform
-const string cAToolLibsWinscw[] = {
-	"epoc32\\RELEASE\\winscw\\udeb\\AToolMemoryHook.lib",
-	"epoc32\\RELEASE\\winscw\\udeb\\AtoolStaticLib.lib",
-	"epoc32\\RELEASE\\winscw\\urel\\AtoolStaticLib.lib"
-};
-
-/**
-* CheckATLibrariesArmv5
-* Checks that armv5 libraries are in sEpocRoot
-* @param sEpocRoot, epoc root where to search libs
-* @return bool true if they are found otherwise false
-*/
-bool CheckATLibrariesArmv5(string sEpocRoot )
-{
-	LOG_FUNC_ENTRY("CheckATLibrariesArmv5");
-
-	// check that epocroot is set
-	if ( sEpocRoot.length() <= 0 )
-	{
-		LOG_FUNC_EXIT("CheckATLibrariesArmv5 Error, EpocRoot not set");
-		return false;
-	}
-
-	// add trailing '\' if root path is missing it
-	if ( sEpocRoot.at( sEpocRoot.length() -1 ) != '\\' )
-		sEpocRoot.append( "\\" );
-
-	// return boolean value
-	bool bReturn = true;
-
-	int arraySize = sizeof( cAToolLibsArmv5 ) / sizeof( string );
-	for ( int i=0 ; i < arraySize ; i++ )
-	{
-		// append epocroot to file
-		string sFileToCheck = sEpocRoot;
-		sFileToCheck.append( cAToolLibsArmv5[i] );
-		// check does it exists
-		if ( ! CATBase::FileExists( sFileToCheck.c_str() ) )
-		{
-			bReturn = false;
-			cout << AT_MSG << "Missing library file: " << sFileToCheck << endl;
-			LOG_STRING("Missing library file: " << sFileToCheck);
-		}
-	}
-
-	if ( ! bReturn )
-	{
-		// print error msg to user
-		cout << cMissingAToolLibs;
-
-	}
-	return bReturn;
-}
-
-/**
-* CheckATLibrariesArmv5Abiv2
-* Checks that armv5 abiv2 libraries are in sEpocRoot
-* @param sEpocRoot, epoc root where to search libs
-* @return bool true if they are found otherwise false
-*/
-bool CheckATLibrariesArmv5Abiv2(string sEpocRoot )
-{
-	LOG_FUNC_ENTRY("CheckATLibrariesArmv5Abiv2");
-
-	// check that epocroot is set
-	if ( sEpocRoot.length() <= 0 )
-	{
-		LOG_FUNC_EXIT("CheckATLibrariesArmv5Abiv2 Error, EpocRoot not set");
-		return false;
-	}
-
-	// add trailing '\' if root path is missing it
-	if ( sEpocRoot.at( sEpocRoot.length() -1 ) != '\\' )
-		sEpocRoot.append( "\\" );
-
-	// return boolean value
-	bool bReturn = true;
-
-	int arraySize = sizeof( cAToolLibsArmv5Abiv2 ) / sizeof( string );
-	for ( int i=0 ; i < arraySize ; i++ )
-	{
-		// append epocroot to file
-		string sFileToCheck = sEpocRoot;
-		sFileToCheck.append( cAToolLibsArmv5Abiv2[i] );
-		// check does it exists
-		if ( ! CATBase::FileExists( sFileToCheck.c_str() ) )
-		{
-			bReturn = false;
-			cout << AT_MSG << "Missing library file: " << sFileToCheck << endl;
-			LOG_STRING("Missing library file: " << sFileToCheck);
-		}
-	}
-
-	if ( ! bReturn )
-	{
-		// print error msg to user
-		cout << cMissingAToolLibs;
-
-	}
-	return bReturn;
-}
-
-/**
-* CheckATLibrariesWinscw
-* Checks that winscw libraries are in sEpocRoot
-* @param sEpocRoot, epoc root where to search libs
-* @return bool true if they are found otherwise false
-*/
-bool CheckATLibrariesWinscw(string sEpocRoot )
-{
-	LOG_FUNC_ENTRY("CheckATLibrariesWinscw");
-
-	// check that epocroot is set
-	if ( sEpocRoot.length() <= 0 )
-	{
-		LOG_FUNC_EXIT("CheckATLibrariesArmv5Abiv2 Error, EpocRoot not set");
-		return false;
-	}
-
-	// add trailing '\' if root path is missing it
-	if ( sEpocRoot.at( sEpocRoot.length() -1 ) != '\\' )
-		sEpocRoot.append( "\\" );
-
-	// return boolean value
-	bool bReturn = true;
-
-	int arraySize = sizeof( cAToolLibsWinscw ) / sizeof( string );
-	for ( int i=0 ; i < arraySize ; i++ )
-	{
-		// append epocroot to file
-		string sFileToCheck = sEpocRoot;
-		sFileToCheck.append( cAToolLibsWinscw[i] );
-		// check does it exists
-		if ( ! CATBase::FileExists( sFileToCheck.c_str() ) )
-		{
-			bReturn = false;
-			cout << AT_MSG << "Missing library file: " << sFileToCheck << endl;
-			LOG_STRING("Missing library file: " << sFileToCheck);
-		}
-	}
-
-	if ( ! bReturn )
-	{
-		// print error msg to user
-		cout << cMissingAToolLibs;
-
-	}
-	return bReturn;
-}
-
-//EOF
--- a/analyzetool/commandlineengine/src/stdafx.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +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 "../inc/stdafx.h"
-
--- a/analyzetool/commandlineengine/src/utility.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +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:  Miscellaneous utility functions.
-*
-*/
-#include "../inc/ATCommonDefines.h"
-#include "../inc/CATBase.h"
-#include "../inc/CATProject.h"
-
-//Analyze report logging level.
-#define MAX_LOG_LEVEL 3
-
-//Function declarations.
-bool CheckSBS2Folder( void );
-
-/**
-* Helper function which checks does current dir contain atool_temp\build folder which
-* is used in sbs2 support
-*/
-bool CheckSBS2Folder( void )
-{
-	LOG_FUNC_ENTRY("CheckSBS2Folder");
-	if ( CATBase::DirectoryExists( RAPTOR_MAKEFILE_DIR ) )
-		return true;
-	return false;
-}
-//EOF
--- a/analyzetool/commandlineengine/src/version.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +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:  Show / Check atool version.
-*
-*/
-#include "../inc/ATCommonDefines.h"
-#include "../inc/CATBase.h"
-
-//Function declarations.
-int showVersionInfo( void );
-int showCoreVersionInfo( void );
-bool readCoreVersionInfo( const string& sFile, string& sVersion );
-string findAnalyzeToolHeader( void );
-int showDbgHelpVersionInfo( bool showVersion );
-int getDllVersion( LPCTSTR libName, WORD *majorVersion, WORD *minorVersion, WORD *buildNumber, WORD *revisionNumber );
-
-//External GetEpocRoot function
-extern bool GetEpocRoot( string &sEpocRoot );
-
-void convertWriteTimeToLocalTime( FILETIME ftWrite, LPSTR lpszString );
-
-int showCoreVersionInfo( void )
-{
-	LOG_FUNC_ENTRY( "version.cpp::showCoreVersionInfo" );
-	// Try find header from environment where to locate version info.
-	string sHeaderFile = findAnalyzeToolHeader();
-	if ( sHeaderFile.empty() )
-		return 0;
-	string sVersion("");
-	if ( readCoreVersionInfo( sHeaderFile, sVersion ) )
-	{
-		cout << "AnalyzeTool SDK binaries version: " 
-			<< sVersion
-			<< endl;
-	}
-	return 0;
-}
-
-
-/**
-* Find analyzetool.h header file
-* @return string containing full path to file or empty string if not found.
-*/
-string findAnalyzeToolHeader( void )
-{
-	LOG_FUNC_ENTRY( "version.cpp::findAnalyzeToolHeader" );
-	string sEpocRoot;
-	if ( ! CATBase::GetEpocRoot( sEpocRoot ) )
-		return string("");
-	int iC = sizeof( AT_CORE_INCLUDE_FILE_WITH_VERSION_NUMBER ) / sizeof ( string );
-	for( int i = 0 ; i < iC ; i++ )
-	{
-		string sCheck( sEpocRoot );
-		sCheck.append( AT_CORE_INCLUDE_FILE_WITH_VERSION_NUMBER[i] );
-		if ( CATBase::FileExists( sCheck.c_str() ) )
-			return sCheck;
-	}
-	return string("");
-}
-/**
-* Read core version string.
-* @param sVersion string will contain version info if funtion returns true.
-* @return true if successful.
-*/
-bool readCoreVersionInfo( const string& sFile, string& sVersion )
-{
-	LOG_FUNC_ENTRY( "version.cpp::readCoreVersionInfo" );
-	try {
-		ifstream in;
-		in.open( sFile.c_str() );
-		if ( ! in.good() )
-			return false;
-		char cBuff[MAX_LINE_LENGTH];
-		while ( in.good() )
-		{
-			in.getline( cBuff, MAX_LINE_LENGTH );
-			string s( cBuff );
-			if ( s.find( AT_CORE_VERSION_NUMBER_TAG ) != string::npos )
-			{
-				// Find spot after first space (ignore first 3 chars).
-				size_t t =  s.find_first_of( ' ', 3 )+1;
-				sVersion = s.substr( t, s.size()-t );
-				return true;
-			}
-		}
-	}
-	catch(...)
-	{
-		LOG_STRING(AT_MSG << "Exception reading core version info.");
-	}
-	return false;
-}
-
-/**
-* Print version information of atool.exe binary.
-*/
-int showVersionInfo( void )
-{
-	LOG_FUNC_ENTRY( "version.cpp::showVersionInfo" );
-	string sTemp( "Version: " );
-	sTemp.append( ATOOL_VERSION );
-	sTemp.append( "\n" );
-	//Print atool version
-	printf( sTemp.c_str() );
-
-	//atool.exe:s path + filename
-	char buffer[MAX_PATH];
-
-	GetModuleFileName( NULL, buffer, MAX_PATH );
-
-	printf( "Path: %s\n", buffer );
-
-	WIN32_FIND_DATA FindFileData;
-	HANDLE hFind;
-	//Get file handle
-	hFind = FindFirstFile( buffer, &FindFileData );
-
-	if( hFind == INVALID_HANDLE_VALUE )
-	{
-		printf( "Can not find file:%s", buffer );
-		return 0;
-	}
-
-	convertWriteTimeToLocalTime( FindFileData.ftLastWriteTime , buffer );
-	printf( "Modified: %s\n", buffer );
-
-	// Show core version information.
-	showCoreVersionInfo();
-	return 0;
-}
-
-// Convert the last-write time to local time.
-void convertWriteTimeToLocalTime( FILETIME ftWrite, LPSTR lpszString )
-{
-	LOG_FUNC_ENTRY( "version.cpp::convertWriteTimeToLocalTime" );
-	SYSTEMTIME stUTC, stLocal;
-    // Convert the last-write time to local time.
-    FileTimeToSystemTime(&ftWrite, &stUTC);
-    SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
-
-    // Build a string showing the date and time.
-    wsprintf(lpszString, "%02d/%02d/%d %02d:%02d:%02d",
-        stLocal.wDay, stLocal.wMonth, stLocal.wYear,
-        stLocal.wHour, stLocal.wMinute, stLocal.wSecond);
-}
-
-/**
-* Print version information of dbghelp.dll.
-*/
-int showDbgHelpVersionInfo( bool showVersion )
-{
-	LOG_FUNC_ENTRY( "version.cpp::showDbgHelpVersionInfo" );
-
-	WORD majorVersion;
-	WORD minorVersion;
-	WORD buildNumber;
-	WORD revisionNumber;
-
-	if(getDllVersion( _T(DBGHELP_DLL_NAME), &majorVersion, &minorVersion, &buildNumber, &revisionNumber))
-	{
-		//Check if current dll version is lower than latest version
-		if((majorVersion < DBGHELP_VERSION_MAJ) ||
-			(majorVersion == DBGHELP_VERSION_MAJ && minorVersion < DBGHELP_VERSION_MIN) ||
-			(majorVersion == DBGHELP_VERSION_MAJ && minorVersion == DBGHELP_VERSION_MIN && buildNumber < DBGHELP_VERSION_BUILD) ||
-			(majorVersion == DBGHELP_VERSION_MAJ && minorVersion == DBGHELP_VERSION_MIN && buildNumber == DBGHELP_VERSION_BUILD && revisionNumber < DBGHELP_VERSION_REVIS))
-		{
-			cout << "WARNING: Version of your dbghelp.dll is "
-					<< majorVersion << "."
-					<< minorVersion << "."
-					<< buildNumber << "."
-					<< revisionNumber << ".\n";
-
-			cout << "Source code pinpointing for winscw may not work properly with this version."
-				<< endl
-				<< "Please, update it to at least version "
-				<< DBGHELP_VERSION_MAJ << "." 
-				<< DBGHELP_VERSION_MIN << "." 
-				<< DBGHELP_VERSION_BUILD << "." 
-				<< DBGHELP_VERSION_REVIS << ".\n"
-				<< "dbghelp.dll file is included in Debugging Tools from Microsoft. "
-				<< "You can download and install it from\n"
-				<< "http://www.microsoft.com/whdc/devtools/debugging/\n";
-
-			return 1;
-		}
-		else
-		{
-			if( showVersion )
-			{
-				cout << "Version of your dbghelp.dll is "
-					<< majorVersion << "."
-				    << minorVersion << "."
-				    << buildNumber << "."
-				    << revisionNumber << "."
-				    << endl;
-				cout << "No need for update.\n";
-			}
-		}
-	}
-
-	return 0;
-}
-
-/**
-* Get dll version.
-* @param libName library name.
-* @param majorVersion will contain major version if funtion returns true.
-* @param minorVersion will contain minor version if funtion returns true.
-* @param buildNumber will contain build number if funtion returns true.
-* @param revisionNumber will contain revision number if funtion returns true.
-* @return true if successful.
-*/
-int getDllVersion( LPCTSTR  libName, WORD *majorVersion, WORD *minorVersion, WORD *buildNumber, WORD *revisionNumber ) 
-{
-	LOG_FUNC_ENTRY( "version.cpp::getDllVersion" );
-
-	DWORD dwHandle, dwLen;
-	UINT BufLen;
-	LPTSTR lpData;
-	VS_FIXEDFILEINFO *pFileInfo;
-	dwLen = GetFileVersionInfoSize( libName, &dwHandle );
-	if (!dwLen)
-		return 0;
-	
-	lpData = (LPTSTR) malloc (dwLen);
-	if (!lpData)
-		return 0;
-	
-	if( !GetFileVersionInfo( libName, dwHandle, dwLen, lpData ) )
-	{
-		free (lpData);
-		return 0;
-	}
-	
-	if( VerQueryValue( lpData, _T("\\"), (LPVOID *) &pFileInfo, (PUINT)&BufLen ) )
-	{
-		*majorVersion = HIWORD(pFileInfo->dwFileVersionMS);
-		*minorVersion = LOWORD(pFileInfo->dwFileVersionMS);
-		*buildNumber = HIWORD(pFileInfo->dwFileVersionLS);
-		*revisionNumber = LOWORD(pFileInfo->dwFileVersionLS);
-		return 1;
-	 }
-	free (lpData);
-	return 0;
-}
-
-//EOF
--- a/analyzetool/dynamicmemoryhook/bwins/atoolmemoryhooku.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-EXPORTS
-	?Alloc@RAnalyzeToolAllocator@@UAEPAXH@Z @ 1 NONAME ; void * RAnalyzeToolAllocator::Alloc(int)
-	?Alloc@RAnalyzeToolMainAllocator@@UAEPAXH@Z @ 2 NONAME ; void * RAnalyzeToolMainAllocator::Alloc(int)
-	?Exit@CustomUser@@SAXH@Z @ 3 NONAME ; void CustomUser::Exit(int)
-	?InstallAllocator@CustomUser@@CAAAVRAllocator@@HABV?$TBuf@$0BAA@@@KKKK@Z @ 4 NONAME ; class RAllocator & CustomUser::InstallAllocator(int, class TBuf<256> const &, unsigned long, unsigned long, unsigned long, unsigned long)
-	?Panic@CustomUser@@SAXABVTDesC16@@H@Z @ 5 NONAME ; void CustomUser::Panic(class TDesC16 const &, int)
-	?SetCritical@CustomUser@@SAHW4TCritical@User@@@Z @ 6 NONAME ; int CustomUser::SetCritical(enum User::TCritical)
-	?SetProcessCritical@CustomUser@@SAHW4TCritical@User@@@Z @ 7 NONAME ; int CustomUser::SetProcessCritical(enum User::TCritical)
-	?SetupThreadHeap@CustomUser@@SAHHAAUSStdEpocThreadCreateInfo@@ABV?$TBuf@$0BAA@@@KKABV?$TBuf@$0BE@@@KKV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 8 NONAME ; int CustomUser::SetupThreadHeap(int, struct SStdEpocThreadCreateInfo &, class TBuf<256> const &, unsigned long, unsigned long, class TBuf<20> const &, unsigned long, unsigned long, class TRefByValue<class TDesC16 const >, ...)
-
--- a/analyzetool/dynamicmemoryhook/eabi/atoolmemoryhooku.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-EXPORTS
-	_ZN10CustomUser11SetCriticalEN4User9TCriticalE @ 1 NONAME
-	_ZN10CustomUser15SetupThreadHeapEiR24SStdEpocThreadCreateInfoRK4TBufILi256EEmmRKS2_ILi20EEmm11TRefByValueIK7TDesC16Ez @ 2 NONAME
-	_ZN10CustomUser16InstallAllocatorEiRK4TBufILi256EEmmmm @ 3 NONAME
-	_ZN10CustomUser18SetProcessCriticalEN4User9TCriticalE @ 4 NONAME
-	_ZN10CustomUser4ExitEi @ 5 NONAME
-	_ZN10CustomUser5PanicERK7TDesC16i @ 6 NONAME
-	_ZTI20CLibraryEventHandler @ 7 NONAME ; #<TI>#
-	_ZTI21RAnalyzeToolAllocator @ 8 NONAME ; #<TI>#
-	_ZTI25RAnalyzeToolMainAllocator @ 9 NONAME ; #<TI>#
-	_ZTI27RAnalyzeToolMemoryAllocator @ 10 NONAME ; #<TI>#
-	_ZTV20CLibraryEventHandler @ 11 NONAME ; #<VT>#
-	_ZTV21RAnalyzeToolAllocator @ 12 NONAME ; #<VT>#
-	_ZTV25RAnalyzeToolMainAllocator @ 13 NONAME ; #<VT>#
-	_ZTV27RAnalyzeToolMemoryAllocator @ 14 NONAME ; #<VT>#
-
--- a/analyzetool/dynamicmemoryhook/group/atoolmemoryhook.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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:  The .mmp file for AToolMemoryHook.
-*
-*/
-
-#include <platform_paths.hrh>
-#include "../../symbian_version.hrh"
-
-TARGET        atoolmemoryhook.dll
-TARGETTYPE    dll
-UID           0x1000008d 0x2001242F
-CAPABILITY    ALL -TCB
-
-#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
-EPOCALLOWDLLDATA
-#endif
-
-SMPSAFE
-
-SOURCEPATH    ../src
-
-SOURCE        analyzetooleventhandler.cpp
-SOURCE        codeblock.cpp
-SOURCE        threadstack.cpp
-SOURCE        customuser.cpp
-SOURCE        analyzetoolmemoryallocator.cpp
-SOURCE        analyzetoolmainallocator.cpp
-SOURCE        analyzetoolallocator.cpp
-SOURCE        analyzetoolfastlog.cpp
-
-SOURCEPATH    ../../storageserver/server/src
-SOURCE        atdriveinfo.cpp
-
-USERINCLUDE   ../inc
-USERINCLUDE   ../../inc
-USERINCLUDE   ../../storageserver/inc
-USERINCLUDE   ../../storageserver/server/inc
-
-#ifdef WINSCW
-APP_LAYER_SYSTEMINCLUDE
-#endif
-
-OS_LAYER_SYSTEMINCLUDE
-
-LIBRARY       efsrv.lib 
-LIBRARY       euser.lib
-LIBRARY       atoolstorageserverclnt.lib
-LIBRARY       flogger.lib
-LIBRARY       charconv.lib 
-LIBRARY       platformenv.lib 
-
-#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
-MACRO	USE_CLEANER_DLL
-#endif
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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:  
-*
-*/
-
-PRJ_PLATFORMS
-ARMV5 WINSCW
-
-PRJ_MMPFILES
-atoolmemoryhook.mmp
-
-PRJ_TESTMMPFILES
-../internal/tsrc/group/analyzetoolmemoryhooktest.mmp
-
--- a/analyzetool/dynamicmemoryhook/inc/analyzetoolallocator.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +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:  Declaration of the class RAnalyzeToolAllocator.
-*
-*/
-
-
-#ifndef ANALYZETOOLALLOCATOR_H
-#define ANALYZETOOLALLOCATOR_H
-
-// INCLUDES
-#include <u32std.h>
-#include "codeblock.h"
-#include "threadstack.h"
-#include "analyzetoolmemoryallocator.h"
-#include <analyzetool/atstorageserverclnt.h>
-#include <analyzetool/analyzetool.h>
-#include <analyzetool/atcommon.h>
-
-// CLASS DECLARATION
-
-/**
-*  Class which overloads the RAlloctor functions and provides access to 
-*  the overloaded functions  
-*/
-class RAnalyzeToolAllocator : public RAnalyzeToolMemoryAllocator
-    {
-
-    public:
-
-        /**
-        * C++ default constructor.
-        * @param aNotFirst Is this first thread using this heap
-        * @param aStorageServer A reference to the 
-        *                       <code>RATStorageServer</code> which is 
-        *                       used to store kernel events
-        * @param aCodeblocks A reference to array of code segments
-        * @param aMutex A reference to mutex for schedule access to the 
-        *                   shared resources
-        * @param aProcessId A reference to the observed process id
-        * @param aAnalyzeTool Reference to device driver
-        * @param aStorageServerOpen Variable to check if Storage server is connected
-        * @param aLogOption The logging option for storage server
-        * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
-        * @param aFreeCallStackSize Max number of stored callstack items when memory freed
-        */
-        RAnalyzeToolAllocator( TBool aNotFirst,
-                               RATStorageServer& aStorageServer, 
-                               RArray<TCodeblock>& aCodeblocks, 
-                               RMutex& aMutex, 
-                               TUint aProcessId,
-                               RAnalyzeTool& aAnalyzeTool,
-                               TBool aStorageServerOpen,
-                               TUint32 aLogOption,
-                               TUint32 aAllocCallStackSize,
-                               TUint32 aFreeCallStackSize );
-        /**
-        * Destructor.
-        */                     
-        ~RAnalyzeToolAllocator();
-
-        /**
-        * Allocates a cell of specified size from the heap.
-        * @param aSize The size of the cell to be allocated from the heap. 
-        * @return TAny* A pointer to the allocated cell.
-        */
-        TAny* Alloc( TInt aSize );
-
-        /**
-        * Frees the specified cell and returns it to the heap.
-        * @param aPtr A pointer to a cell to be freed.
-        */
-        void Free( TAny* aPtr );
-
-        /**
-        * Increases or decreases the size of an existing cell.
-        * @param aPtr A pointer to the cell to be reallocated.
-        * @param aSize The new size of the cell. This may be bigger 
-        *              or smaller than the size of the original cell.
-        * @param aMode Flags controlling the reallocation.
-        * @return TAny* A pointer to the reallocated cell. This may be the 
-        *               same as the original pointer supplied through aCell.
-        */
-        //lint --e{1735} suppress "Virtual function has default parameter"
-        TAny* ReAlloc( TAny* aPtr, TInt aSize, TInt aMode = 0 );
-        
-        /**
-        * Gets the length of the available space in the specified 
-        * allocated cell.
-        * @param aCell A pointer to the allocated cell.
-        * @return TInt The length of the available space in the allocated cell.
-        */
-        TInt AllocLen( const TAny* aCell ) const;
-
-    #ifndef __KERNEL_MODE__
-
-        /**
-        * Opens this heap for shared access. Opening the heap increases 
-        * the heap's access count by one.
-        */
-        TInt Open();
-        
-        /**
-        * Closes this shared heap. Closing the heap decreases the heap's 
-        * access count by one.
-        */
-        void Close();
-
-        /**
-        * The function frees excess committed space from the top of the heap.
-        * The size of the heap is never reduced below the minimum size 
-        * specified during creation of the heap.
-        * @return TInt The space reclaimed. If no space can be reclaimed, 
-                       then this value is zero.
-        */
-        TInt Compress();
-
-        /**
-        * Frees all allocated cells on this heap. 
-        */
-        void Reset();
-
-        /**
-        * Gets the number of cells allocated on this heap, and 
-        * the total space allocated to them.
-        * @param aTotalAllocSize On return, contains the total 
-        *                        space allocated to the cells.
-        * @return TInt The number of cells allocated on this heap.
-        */
-        TInt AllocSize( TInt& aTotalAllocSize ) const;
-        
-        /**
-        * Gets the total free space currently available on the heap and the 
-        * space available in the largest free block. The space available 
-        * represents the total space which can be allocated. Note that 
-        * compressing the heap may reduce the total free space available 
-        * and the space available in the largest free block.
-        * @param aBiggestBlock On return, contains the space available 
-        *                      in the largest free block on the heap.
- 
-        * @return TInt The total free space currently available on the heap.
-
-        */
-        TInt Available( TInt& aBiggestBlock ) const;
-        
-    #endif
-
-        /**
-        * Invocates specified debug funtionality.
-        * @param aFunc The debug function
-        * @param a1 Debug function specific paramenter.
-        * @param a2 Debug function specific paramenter.
-        * @return TInt Returns KErrNone, if successful otherwise one 
-        *              of the other system-wide error codes.
-        */
-        //lint --e{1735} suppress "Virtual function has default parameter"
-        TInt DebugFunction( TInt aFunc, TAny* a1 = NULL, TAny* a2 = NULL );
-
-    protected:
-
-        /**
-        * Extension function
-        * @param aExtensionId The extension id
-        * @param a0 Extension specific paramenter.
-        * @param a1 Extension specific paramenter.
-        * @return TInt Returns KErrNone, if successful otherwise one 
-        *              of the other system-wide error codes. 
-        */
-        TInt Extension_( TUint aExtensionId, TAny*& a0, TAny* a1 );
-
-    public: // from RAnalyzeToolMemoryAllocator
-        
-        /**
-        * Installs the RTraceAllocator allocator
-        */
-        void Uninstall();
-        
-        /**
-        * Shares the heap
-        */
-        void ShareHeap();
-
-    private:
-    
-        /**
-        * Find the current thread which is using the heap
-        * @param aStackStart A reference where the stack start is stored
-        * @return TBool ETrue if a thread can be found, EFalse otherwise
-        */
-        TBool FindCurrentThreadStack( TUint32& aStackStart );
-
-    private: 
-    
-        /* Handle to the storage server*/
-        RATStorageServer& iStorageServer;
-
-        /* A reference to codeblocks of the observed process */            
-        RArray<TCodeblock>& iCodeblocks;
-
-        /* The mutex for serializing access to the shared resources */
-        RMutex& iMutex;
-
-        /* The process id */
-        TUint iProcessId;
-
-        /* Array for storing the callstack */
-        TFixedArray<TUint32, KATMaxCallstackLength> iCallStack;
-
-        /* Array for storing the reallocation callstack */
-        TFixedArray <TUint32, KATMaxCallstackLength> iReCallStack;
-
-        /* Array for storing the reallocation callstack */	
-        TFixedArray<TUint32, KATMaxFreeCallstackLength> iFreeCallStack;
-                
-        /* Array of threads using this heap */
-        RArray<TThreadStack> iThreadArray;
-
-        RAnalyzeTool& iAnalyzeTool;
-
-        /* A flag for indicating that the RATStorageServer is open */
-        TBool iStorageServerOpen;
-
-        /* Log option */
-        TUint32 iLogOption;
-        
-        /* Max items on stored call stack when memory allocated */
-        TUint32 iAllocMaxCallStack;
-        
-        /* Max items on stored call stack when memory freed */
-        TUint32 iFreeMaxCallStack;
-        
-    };
-
-#endif // ANALYZETOOLALLOCATOR_H
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/inc/analyzetooleventhandler.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +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:  Declaration of the class CLibraryEventHandler.
-*
-*/
-
-
-#ifndef ANALYZETOOLEVENTHANDLER_H
-#define ANALYZETOOLEVENTHANDLER_H
-
-// INCLUDES
-#include <e32cmn.h>
-#include "codeblock.h"
-#include <analyzetool/atstorageserverclnt.h>
-#include <analyzetool/analyzetool.h>
-
-// FORWARD DECLARATIONS
-class MAnalyzeToolEventhandlerNotifier;
-
-// CLASS DECLARATION
-
-/**
-*  Class for receiving library load/unlaod events from the kernel   
-*/
-class CLibraryEventHandler : public CActive
-    {
-    
-    public: 
-
-        /**
-        * C++ default constructor.
-        * @param aAnalyzeTool A reference to the <code>RAnalyzeTool</code> 
-                 which is used to observe kernel events 
-        * @param aCodeblocks A reference to array of code segments
-        * @param aStorageServer A reference to the 
-        *                       <code>RATStorageServer</code> which is 
-        *                       used to store kernel events
-        * @param aProcessId A reference to the observed process id
-        * @param aMutex A reference to mutex to schedule access to the 
-        *                   shared resources
-        * @param aNotifier A reference to notifier object which is used to 
-        * 					inform killed threads
-        * @param aLogOption Current used log option on allocator.
-        */
-        CLibraryEventHandler( RAnalyzeTool& aAnalyzeTool, 
-                RArray<TCodeblock>& aCodeblocks, 
-                RATStorageServer& aStorageServer, 
-                TUint aProcessId,
-                RMutex& aMutex,
-                MAnalyzeToolEventhandlerNotifier& aNotifier,
-                TUint32 aLogOption );
-
-        /**
-        * Destructor.
-        */
-        ~CLibraryEventHandler();
-
-        /* Start receiving events from the kernel */
-        void Start();
-        
-        /**
-        * Returns eventhandler's state.
-        * @return TBool ETrue if eventhandler is started, EFalse otherwise
-        */
-        TBool IsStarted();
-
-    protected: // Functions from base classes
-        
-        /**
-        * Process active object's task
-        */
-        void RunL();
-
-        /**
-        * Cancels active object's task
-        */
-        void DoCancel();
- 
-    private: // Member variables
-
-        /* Handle to the analyze tool device driver*/
-        RAnalyzeTool& iAnalyzeTool; 
-
-        /* A reference to codeblocks of the observed process */
-        RArray<TCodeblock>& iCodeblocks;
-
-        /* Handle to the storage server*/
-        RATStorageServer& iStorageServer;
-
-        /* The observered process id */ 
-        TUint iProcessId;
-
-        /* The library info */
-        TLibraryEventInfo iLibraryInfo;
-
-        /* The mutex for serializing access to the shared resources */
-        RMutex& iMutex;
-        
-        /* Inform if handler is started */
-        TBool iStarted;
-        
-        /* A reference to event handler notifier */
-        MAnalyzeToolEventhandlerNotifier& iNotifier;
-
-        /* Current used log option */
-        TUint32 iLogOption;
-    };
-
-#endif // ANALYZETOOLEVENTHANDLER_H
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/inc/analyzetooleventhandlernotifier.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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:  Declaration of the class MAnalyzeToolEventhandlerNotifier
-*
-*/
-
-
-#ifndef ANALYZETOOLEVENTHANDLERNOTIFIER_H
-#define ANALYZETOOLEVENTHANDLERNOTIFIER_H
-
-//  INCLUDES
-#include <e32base.h>
-
-// CLASS DECLARATION
-
-/**
-*  MAnalyzeToolEventhandlerNotifier class
-*  An interface class for informing killed thread.
-*/
-class MAnalyzeToolEventhandlerNotifier
-    {
-    public: // New functions
-           
-        /**
-        * Inform when thread killed.
-        * @param aThreadId - Killed thread Id.
-        */
-        virtual void RemoveKilledThread( const TUint aThreadId ) = 0;
-
-    };
-
-#endif // ANALYZETOOLEVENTHANDLERNOTIFIER_H
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/inc/analyzetoolfastlog.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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 __ANALYZETOOLFASTLOG_H__
-#define __ANALYZETOOLFASTLOG_H__
-
-// INCLUDES
-#include    <e32base.h>
-#include    <analyzetool/atcommon.h>
-#include    <analyzetool/analyzetooltraceconstants.h>
-
-// Function prototypes.
-
-/**
- * TBD
- * @param aProcessName The name of the new process started. The length of this
- *   descriptor must not be greater than KMaxProcessName.
- * @param aProcessId The ID of the process started.
- * @param aIsDebug Determines whether a binary is UDEB or UREL
- * @return KErrNone.
-*/
-GLREF_C TInt ATFastLogProcessStarted( const TDesC8& aProcessName,
-                                 TUint aProcessId,
-                                 TUint32 aIsDebug );
-
-/**
- * TBD 
- * @param aProcessId The ID number of the process ended.
- * @param aHandleLeakCount Number of handles open.
- * @return KErrNone, if successful; otherwise one of the other
- *   system-wide error codes.
- */
-GLREF_C TInt ATFastLogProcessEnded( TUint aProcessId, 
-                                TUint aHandleLeakCount );
-
-/**
- * TBD
- * @param aProcessId The ID number of the process ended.
- * @param aDllName The name of the new DLL loaded. The length of this descriptor
- *   must not be greater than KMaxLibraryName.
- * @param aStartAddress The start address of the DLL loaded.
- * @param aEndAddress The end address of the DLL loaded.
- * @return KErrNone.
-*/
-GLREF_C TInt ATFastLogDllLoaded( TUint aProcessId, const TDesC8& aDllName, TUint32 aStartAddress,
-                                TUint32 aEndAddress );
-
-/**
- * TBD
- * @param aProcessId The ID number of the process ended.
- * @param aDllName The name of the DLL to be unloaded. The length of this
- *   descriptor must not be greater than KMaxLibraryName.
- * @param aStartAddress The start address of the DLL to be unloaded.
- * @param aEndAddress The end address of the DLL to be unloaded.
- * @return KErrNone.
-*/
-GLREF_C TInt ATFastLogDllUnloaded( TUint aProcessId, const TDesC8& aDllName, TUint32 aStartAddress,
-                                       TUint32 aEndAddress );
-
-/**
- * TBD
- * @param aProcessId The ID number of the process ended.
- * @param aMemAddress The memory location where memory has been allocated.
- * @param aCallstack An array including the current call stack.
- * @param aSize The size of the newly allocated memory chunk.
- * @return KErrNone.
-*/
-GLREF_C TInt ATFastLogMemoryAllocated( TUint aProcessId, TUint32 aMemAddress,
-                                  TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
-                                  TInt aSize );
-        
-/**
- * TBD
- * @param aProcessId The ID number of the process ended.
- * @param aMemAddress The memory location where memory has been deallocated.
- * @param aFreeCallstack An array including the current call stack.
- * @return KErrNone.
-*/
-GLREF_C TInt ATFastLogMemoryFreed( TUint aProcessId, TUint32 aMemAddress, 
-                              TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack );
-#endif
--- a/analyzetool/dynamicmemoryhook/inc/analyzetoolmainallocator.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,329 +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:  Declaration of the class RAnalyzeToolMainAllocator.
-*
-*/
-
-
-#ifndef ANALYZETOOLMAINALLOCATOR_H
-#define ANALYZETOOLMAINALLOCATOR_H
-
-// INCLUDES
-#include <u32std.h>
-#include "codeblock.h"
-#include <analyzetool/atstorageserverclnt.h>
-#include <analyzetool/analyzetool.h>
-#include <analyzetool/atcommon.h>
-#include "analyzetoolmemoryallocator.h"
-#include "analyzetooleventhandlernotifier.h"
-
-// FORWARD DECLARATIONS
-class CLibraryEventHandler;
-
-// CLASS DECLARATION
-
-/**
-*  Class which overloads the RAlloctor functions and provides access to 
-*  the overloaded functions  
-*/
-class RAnalyzeToolMainAllocator : public RAnalyzeToolMemoryAllocator, 
-								  public MAnalyzeToolEventhandlerNotifier
-    {
-
-    public:
-
-        /**
-        * C++ default constructor.
-        * @param aNotFirst Is this first thread using this heap
-        * @param aFileName The name of the log file
-        * @param aLogOption The logging option for storage server
-        * @param aIsDebug Determines whether a binary is UDEB or UREL
-        * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
-        * @param aFreeCallStackSize Max number of stored callstack items when memory freed
-        */
-        RAnalyzeToolMainAllocator( TBool aNotFirst,
-                const TFileName aFileName,
-                TUint32 aLogOption, TUint32 aIsDebug,
-                TUint32 aAllocCallStackSize,
-                TUint32 aFreeCallStackSize );
-
-        /**
-        * Destructor.
-        */
-        ~RAnalyzeToolMainAllocator();
-
-        /**
-        * Allocates a cell of specified size from the heap.
-        * @param aSize The size of the cell to be allocated from the heap. 
-        * @return TAny* A pointer to the allocated cell.
-        */
-        TAny* Alloc( TInt aSize );
-
-        /**
-        * Frees the specified cell and returns it to the heap.
-        * @param aPtr A pointer to a cell to be freed.
-        */
-        void Free( TAny* aPtr );
-
-        /**
-        * Increases or decreases the size of an existing cell.
-        * @param aPtr A pointer to the cell to be reallocated.
-        * @param aSize The new size of the cell. This may be bigger 
-        *              or smaller than the size of the original cell.
-        * @param aMode Flags controlling the reallocation.
-        * @return TAny* A pointer to the reallocated cell. This may be the 
-        *               same as the original pointer supplied through aCell.
-        */
-        TAny* ReAlloc( TAny* aPtr, TInt aSize, TInt aMode = 0 );
-        
-        /**
-        * Gets the length of the available space in the specified 
-        * allocated cell.
-        * @param aCell A pointer to the allocated cell.
-        * @return TInt The length of the available space in the allocated cell.
-        */
-        TInt AllocLen(const TAny* aCell) const;
-
-    #ifndef __KERNEL_MODE__
-
-        /**	
-        * Opens this heap for shared access. Opening the heap increases 
-        * the heap's access count by one.
-        */
-        TInt Open();
-        
-        /**
-        * Closes this shared heap. Closing the heap decreases the heap's 
-        * access count by one.
-        */  	
-        void Close();
-
-        /**
-        * The function frees excess committed space from the top of the heap.
-        * The size of the heap is never reduced below the minimum size 
-        * specified during creation of the heap.
-        * @return TInt The space reclaimed. If no space can be reclaimed, 
-                       then this value is zero.
-        */
-        TInt Compress();
-
-        /**
-        * Frees all allocated cells on this heap. 
-        */
-        void Reset();
-
-        /**
-        * Gets the number of cells allocated on this heap, and 
-        * the total space allocated to them.
-        * @param aTotalAllocSize On return, contains the total 
-        *						 space allocated to the cells.
-        * @return TInt The number of cells allocated on this heap.
-        */
-        TInt AllocSize( TInt& aTotalAllocSize ) const;
-        
-        /**
-        * Gets the total free space currently available on the heap and the 
-        * space available in the largest free block. The space available 
-        * represents the total space which can be allocated. Note that 
-        * compressing the heap may reduce the total free space available 
-        * and the space available in the largest free block.
-        * @param aBiggestBlock On return, contains the space available 
-        *                      in the largest free block on the heap.
- 
-        * @return TInt The total free space currently available on the heap.
-
-        */
-        TInt Available( TInt& aBiggestBlock ) const;
-
-	#endif
-        
-        /**
-        * Invocates specified debug funtionality.
-        * @param aFunc The debug function
-        * @param a1 Debug function specific paramenter.
-        * @param a2 Debug function specific paramenter.
-        * @return TInt Returns KErrNone, if successful otherwise one 
-        *              of the other system-wide error codes.
-        */
-        TInt DebugFunction( TInt aFunc, TAny* a1 = NULL, TAny* a2 = NULL );
-        
-        // From MAnalyzeToolEventhandlerNotifier
-        
-        /**
-		* Remove killed thread from threads array.
-		* @param aThreadId - Thread Id
-		*/
-		void RemoveKilledThread( const TUint aThreadId );
-		
-    protected:
-
-        /**
-        * Extension function
-        * @param aExtensionId The extension id
-        * @param a0 Extension specific paramenter.
-        * @param a1 Extension specific paramenter.
-        * @return TInt Returns KErrNone, if successful otherwise one 
-        *              of the other system-wide error codes. 
-        */
-        TInt Extension_( TUint aExtensionId, TAny*& a0, TAny* a1 );
-
-    public: // from RAnalyzeToolMemoryAllocator
-        
-        /**
-        * Installs the RTraceAllocator allocator
-        */
-        void Uninstall();
-        
-        /**
-        * Shares the heap
-        */
-        void ShareHeap();
-
-    public: // inlines
-    
-        /**
-        * Acquires the open RATStorageServer handle
-        * @return RATStorageServer& The open RATStorageServer handle
-        */
-        inline RATStorageServer& StorageServer();
-        
-        /**
-        * Acquires the codeblocks of the process
-        * @return RArray<TCodeblock>& The process codeblocks
-        */
-        inline RArray<TCodeblock>& Codeblocks();
-        
-        /**
-        * Acquires the mutex used to access shared objects
-        * @return RMutex& A reference to open mutex
-        */
-        inline RMutex& Mutex();
-        
-        /**
-        * Acquires the current process id
-        * @return TInt The process id
-        */
-        inline TInt ProcessId();
-
-        /**
-		* Acquires the logical channel handle
-		* @return RAnalyzeTool A reference to logical channel
-		*/
-        inline RAnalyzeTool& AnalyzeTool();
- 
-         /**
-        * Acquires information if storage server is open
-        * @return TBool iStorageServerOpen
-        */
-        inline TBool StorageServerOpen();
-                
-        /**
-        * Acquires the log option type 
-        * @return TUint32 iLogOption
-        */        
-        inline TUint32 LogOption();
-        
-        /**
-        * Acquires the max size of call stack when memory allocated
-        * @return TUint32 iAllocMaxCallStack
-        */        
-        inline TUint32 AllocMaxCallStack();
-        
-        /**
-         * Acquires the max size of call stack when memory freed
-         * @return TUint32 iFreeMaxCallStack
-         */
-        inline TUint32 FreeMaxCallStack();
-
-    private: // private functions
-
-        /**
-        * Log the process initial information
-        * @param aFileName The name of the log file
-        * @param aLogOption The logging option for storage serve
-        * @param aIsDebug Determines whether a binary is UDEB or UREL
-        */
-        void LogProcessInformation( const TFileName aFileName, TUint32 aLogOption,
-                                                                TUint32 aIsDebug );
-
-        /**
-        * Find the current thread which is using the heap
-        * @param aStackStart A reference where the stack start is stored
-        * @return TBool ETrue if a thread can be found, EFalse otherwise
-        */
-        TBool FindCurrentThreadStack( TUint32& aStackStart );
-        
-        /**
-        * Installs the eventhandler, if possible
-        */
-        void InstallEventHandler();
-
-    private: // member variables
-            
-        /* Handle to the RATStorageServer */
-        RATStorageServer iStorageServer;
-
-        /* Handle to the RAnalyzeTool */		
-        RAnalyzeTool iAnalyzeTool;           
-        
-        /* A flag for indicating that the RAnalyzeTool is open */
-        TBool iAnalyzeToolOpen;
-
-        /* A flag for indicating that the device driver is loaded */
-        TBool iDeviceDriverLoaded;
-        
-        /* The codeblocks of the process */
-        RArray<TCodeblock> iCodeblocks;
-
-        /* The handler for kerner events */
-        CLibraryEventHandler* iEventHandler;
-
-        /* The mutex for serializing access to the shared resources */
-        mutable RMutex iMutex;	
-        	
-        /* Array for storing the callstack */	
-        TFixedArray <TUint32, KATMaxCallstackLength> iCallStack;
-
-        /* Array for storing the reallocation callstack */	
-        TFixedArray <TUint32, KATMaxCallstackLength> iReCallStack;
-
-        /* Array for storing the reallocation callstack */	
-        TFixedArray<TUint32, KATMaxFreeCallstackLength> iFreeCallStack;
-                
-        /* Array of threads using this heap */
-        RArray<TThreadStack> iThreadArray;
-
-        /* A flag for indicating that the RATStorageServer is open */
-        TBool iStorageServerOpen;
-        
-        /* Log option */
-        TUint32 iLogOption;
-
-        /* The process id */
-        TUint iProcessId;	
-        
-        /* Max items on stored call stack when memory allocated */
-        TUint32 iAllocMaxCallStack;
-        
-        /* Max items on stored call stack when memory freed */
-        TUint32 iFreeMaxCallStack;
-        
-    };
-
-// INLINES
-#include "analyzetoolmainallocator.inl"
-
-#endif // ANALYZETOOLMAINALLOCATOR_H
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/inc/analyzetoolmainallocator.inl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +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:  Definition for the inline functions of RAnalyzeToolMainAllocator.
-*
-*/
-
-
-#include "analyzetoolmemoryallocator.h"
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::StorageServer()
-// Acquires reference to open RATStorageServer
-// -----------------------------------------------------------------------------
-//
-inline RATStorageServer& RAnalyzeToolMainAllocator::StorageServer()
-    {
-    return iStorageServer;
-    }
-  
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Codeblocks()
-// Acquires reference to process used codeblocks
-// -----------------------------------------------------------------------------
-//  
-inline RArray<TCodeblock>& RAnalyzeToolMainAllocator::Codeblocks()
-    {
-    return iCodeblocks;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Mutex()
-// Acquires reference to mutex which is used to share resources
-// -----------------------------------------------------------------------------
-//  
-inline RMutex& RAnalyzeToolMainAllocator::Mutex()
-    {
-    return iMutex;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::ProcessId()
-// Acquires the process id
-// -----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeToolMainAllocator::ProcessId()
-    {
-    return iProcessId;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::AnalyzeTool()
-// Acquires the logical channel handle
-// -----------------------------------------------------------------------------
-//
-inline RAnalyzeTool& RAnalyzeToolMainAllocator::AnalyzeTool()
-    {
-    return iAnalyzeTool;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::StorageServerOpen()
-// Acquires the iStorageServerOpen variable
-// -----------------------------------------------------------------------------
-//
-inline TBool RAnalyzeToolMainAllocator::StorageServerOpen()
-    {
-    return iStorageServerOpen;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::LogOption()
-// Acquires the iLogOption variable
-// -----------------------------------------------------------------------------
-//
-inline TUint32 RAnalyzeToolMainAllocator::LogOption()
-    {
-    return iLogOption;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::AllocMaxCallStack()
-// Acquires the iAllocMaxCallStack variable
-// -----------------------------------------------------------------------------
-//
-inline TUint32 RAnalyzeToolMainAllocator::AllocMaxCallStack()
-    {
-    return iAllocMaxCallStack;
-    }
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::FreeMaxCallStack()
-// Acquires the iFreeMaxCallStack variable
-// -----------------------------------------------------------------------------
-//
-inline TUint32 RAnalyzeToolMainAllocator::FreeMaxCallStack()
-    {
-    return iFreeMaxCallStack;
-    }
-// End of File
--- a/analyzetool/dynamicmemoryhook/inc/analyzetoolmemoryallocator.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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:  Declaration of the class RAnalyzeToolMemoryAllocator.
-*
-*/
-
-
-#ifndef ANALYZETOOLMEMORYALLOCATOR_H
-#define ANALYZETOOLMEMORYALLOCATOR_H
-
-// INCLUDES
-#include <u32std.h>
-#include "threadstack.h"
-#include "../../symbian_version.hrh"
-
-// CONSTANTS
-#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
-    #ifndef __WINS__
-    const TInt KDummyHandle = -1000;
-    #endif
-#endif
-
-// CLASS DECLARATION
-
-/**
-*  Abstract class for basic RAnalyzeToolMemoryAllocator funtions
-*/
-class RAnalyzeToolMemoryAllocator : public RAllocator
-    {
-    public:
-    
-        /**
-        * C++ default constructor.
-        * @param aNotFirst Is this first thread using this heap
-        */   
-        RAnalyzeToolMemoryAllocator( TBool aNotFirst );
-        
-        /**
-        * Destructor.
-        */  
-        //lint -e{1510} suppress "base class 'RAllocator' has no destructor"    
-        virtual ~RAnalyzeToolMemoryAllocator();
-        
-        /**
-        * Uninstall the RAnalyzeToolMemoryAllocator
-        */
-        virtual void Uninstall() = 0;
-        
-        /**
-        * Shares the heap for another thread
-        */
-        virtual void ShareHeap() = 0;
-
-    protected:
-
-        /**
-         * Switch original allocator in use.
-         * Switches original allocator in use if not already.
-         */
-        void SwitchOriginalAllocator();
-        
-        /**
-         * Checks is the given address in loaded code memory area.
-         */
-        inline bool IsAddressLoadedCode( TUint32& aAddress );
-        
-        /* The original thread RAllocator */
-        RAllocator* iAllocator;
-        
-        /* Is this the first thread using this heap */
-        TBool iNotFirst;   
-
-        /* Memorymodel */
-        TUint32 iMemoryModel;
-        
-    };
-
-// INLINES
-#include "analyzetoolmemoryallocator.inl"
-
-#endif // ANALYZETOOLMEMORYALLOCATOR_H
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/inc/analyzetoolmemoryallocator.inl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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:  Definition for the inline functions of RAnalyzeToolMemoryAllocator.
-*
-*/
-
-
-
-#include <analyzetool/atcommon.h>
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMemoryAllocator::IsAddressLoadedCode()
-// Checks is the given address in loaded code memory area.
-// -----------------------------------------------------------------------------
-//
-inline bool RAnalyzeToolMemoryAllocator::IsAddressLoadedCode( TUint32& aAddress )
-    {
-    // Debug log strings in this function are not used because
-    // this is called so many times.
-    /*
-     * TMemModelAttributes models.
-     * EMemModelTypeDirect      // direct memory model on hardware
-     * EMemModelTypeMoving=1    // moving memory model on hardware
-     * EMemModelTypeMultiple=2  // multiple memory model on hardware
-     * EMemModelTypeEmul=3      // emulation using single host process
-     * Flexible ?
-     */
-    switch( iMemoryModel )
-        {
-        case EMemModelTypeMultiple:
-            // Use low & high limits which define rofs loading->rom area
-            // in multiple memory model.
-            if ( aAddress < KATMultipleMemoryModelLowLimit 
-              || aAddress > KATMultipleMemoryModelHighLimit )
-                return false;
-            return true;
-        default:
-            return true;
-        }
-    }
-
-// End of File
-
--- a/analyzetool/dynamicmemoryhook/inc/analyzetoolpanics.pan	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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:  Panic codes and definition of a panic function for the Memory Hook
-*
-*/
-
-
-#ifndef ANALYZETOOLPANICS_PAN_H
-#define ANALYZETOOLPANICS_PAN_H
-
-_LIT( KAnalyzeToolName, "AnalyzeTool" );
-
-/** AnalyzeTool application panic codes */
-enum TAnalyzeToolPanics
-    {
-    ENoMemory = 1,
-    EFailedToCreateHeap,
-    ECantOpenHandle,
-    ECantLoadDevice,
-    ECantAppendToTheArray,
-    ECantFindRightThread,
-    ECantConnectStorageServer,
-    ECantShareStorageServer,
-    ECantCreateMutex,
-    ECantLoadDeviceDriver,
-    ECantConnectDeviceDriver
-    // add further panics here
-    };
-
-inline void AssertPanic(TAnalyzeToolPanics aReason)
-    {
-    User::Panic( KAnalyzeToolName, aReason );
-    }
-
-#endif // ANALYZETOOLPANICS_PAN_H
--- a/analyzetool/dynamicmemoryhook/inc/codeblock.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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:  Declaration of the class TCodeblock.
-*
-*/
-
-
-#ifndef CODEBLOCK_H
-#define CODEBLOCK_H
-
-// INCLUDES
-#include <u32std.h>
-
-/**
-*  Stores information of process loaded code segments
-*/
-class TCodeblock
-    {
-    
-    public: // Constructors
-        
-        /**
-        * C++ default constructor.
-        * @param aRunAddress Start address of the memory block. 
-        * @param aSize The size of the memory block.
-        * @param aName The name of the library
-        */
-        TCodeblock( TLinAddr aRunAddress, TUint32 aSize, TBuf8<KMaxLibraryName>& aName );
-
-    public: // New functions
-
-        /**
-        * Checks if the given address is in this memory block area
-        * @param aAddress A address to be checked. 
-        * @return TBool Returns ETrue if the given address is in this
-        *               memory block area, EFalse otherwise
-        */
-        TBool CheckAddress( TUint32 aAddress );
-
-        /**
-        * Matches if the given parameters represents this memory block 
-        * @param aName The name of the library
-        * @return TBool Returns ETrue if the given parameters represents
-        *               this memory block, EFalse otherwise
-        */
-        TBool Match( TBuf8<KMaxLibraryName>& aName );
-        
-    private: // Member variables
-
-        /* Start address of the memory block */
-        TLinAddr iStartAddress;
-
-        /* End address of the memory block */
-        TLinAddr iEndAddress;
-
-        /* End address of the memory block */
-        TBuf8<KMaxLibraryName> iName;
-    };
-
-#endif // CODEBLOCK_H
-
-// End of File
-
--- a/analyzetool/dynamicmemoryhook/inc/customuser.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +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:  Declaration of the class CustomUser containing overloaded User static functions.
-*
-*/
-
-
-#ifndef CUSTOMUSER_H
-#define CUSTOMUSER_H
-
-// INCLUDES
-#include <u32std.h>
-#include <e32svr.h>
-// CONSTANTS
-const TInt KATVersionLength = 20;
-const TInt KATDefaultLogOption = 0;
-const TInt KATDefaultDebug = 1;
-const TInt KATDefaultAllocCallStackSize = 40;
-const TInt KATDefaultFreeCallStackSize = 0;
-    
-// TYPEDEFS
-typedef TBuf<KATVersionLength> TATVersion;
-
-// Argument list for SetupThreadHeap function parameters. (currently not used)
-// When needed, update the argument type directly inside _LIT macro.
-_LIT( KATArgumentList, "%i%i" ); //etc. 
-
-// CLASS DECLARATION
-
-/**
-*  Class which overloads the User functions and provides access to 
-*  the overloaded functions  
-*/
-class CustomUser
-    {
-    public: // Enumerations
-        enum TATOptions
-            {
-            /** Acquiring the log filename */
-            ELogFileName = 1,   
-            /** Acquiring the version number */
-            EVersion,
-            /** Acquiring logging option */
-            ELogOption,
-            /** Acquiring UDEB/UREL information */  
-            EDebug,
-            /** Acquiring max allocation call stack size */
-            EAllocCallStackSize,
-            /** Acquiring max free call stack size */
-            EFreeCallStackSize
-            };
-        
-    public:
-
-        /**
-        * Overloaded version of User::Exit()
-        * Terminates the current thread, specifying a reason. All child 
-        * threads are terminated and all resources are cleaned up.If the 
-        * current thread is the main thread in a process, the process is
-        * also terminated.
-        * @param aReason The reason code.
-        */
-        IMPORT_C static void Exit( TInt aReason );
-
-        /**
-        * Overloaded version of User::Panic()
-        * Panics the current thread, specifying a category name and panic
-        * number. Keep the length of the category name small;
-        * a length of 16 is ideal.
-        * @param aCategory A reference to the descriptor containing the text 
-        * that defines the category for this panic.
-        * @param aReason The panic number. 
-        */   
-        IMPORT_C static void Panic( const TDesC& aCategory, TInt aReason );
-
-        /**
-        * Overloaded version of UserHeap::SetupThreadHeap()
-        * Setups the threads heap.
-        * @param aNotFirst Is this first thread using specified heap
-        * @param aInfo Specifies the thread heap properties
-        * @param aFileName The name of the log file
-        * @param aLogOption The logging option for storage server
-        * @param aIsDebug Determines whether a binary is UDEB or UREL
-        * @param aVersion Atool version number
-        * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
-        * @param aFreeCallStackSize Max number of stored callstack items when memory freed
-        * @param aFmt A descriptor containing the format string
-        * @return TInt KErrNone, if the insertion is successful, otherwise 
-        * one of the system wide error codes.
-        */   
-        IMPORT_C static TInt SetupThreadHeap( 
-                             TBool aNotFirst, 
-                             SStdEpocThreadCreateInfo& aInfo,
-                             const TFileName& aFileName,
-                             TUint32 aLogOption, TUint32 aIsDebug,
-                             const TATVersion& aVersion,
-                             TUint32 aAllocCallStackSize,
-                             TUint32 aFreeCallStackSize,
-                             TRefByValue<const TDesC> aFmt, ... );
-                             
-        /**
-        * Overloaded version of UserHeap::SetCritical()
-        * Sets up or changes the effect that termination of the current 
-        * thread has, either on its owning process, or on the whole system.
-        * The precise effect of thread termination is defined by the following
-        *  specific values of the TCritical enum:
-        * ENotCritical
-        * EProcessCritical
-        * EProcessPermanent
-        * ESystemCritical
-        * ESystemPermanent
-        * Notes: The enum value EAllThreadsCritical cannot be set using this
-        * function. It is associated with a process, not a thread, and, if 
-        * appropriate, should be set using User::SetProcessCritical().
-        * The states associated with ENotCritical, EProcessCritical, 
-        * EProcessPermanent, ESystemCritical and ESystemPermanent are all 
-        * mutually exclusive, i.e. the thread can only be in one of these 
-        * states at any one time.
-        * @param aCritical The state to be set.
-        * @return TInt KErrNone, if successful; KErrArgument, if 
-        * EAllThreadsCritical is passed - this is a state associated with a 
-        * process, and you use User::SetProcessCritical() to set it.
-        */ 
-        IMPORT_C static TInt SetCritical( User::TCritical aCritical );
-        
-        /**
-        * Overloaded version of UserHeap::SetCritical()
-        * Sets up or changes the effect that termination of subsequently 
-        * created threads will have, either on the owning process, 
-        * or on the whole system. It is important to note that we are not
-        * referring to threads that have already been created, but threads
-        * that will be created subsequent to a call to this function.
-        * The precise effect of thread termination is defined by the following
-        * specific values of the TCritical enum:
-        * ENotCritical
-        * EAllThreadsCritical
-        * ESystemCritical
-        * ESystemPermanent
-        * Notes:
-        * The enum values EProcessCritical and EProcessPermanent cannot be set
-        * using this function. They are states associated with a thread, not a
-        * process, and, if appropriate, should be set using 
-        * User::SetCritical(). The states associated with ENotCritical, 
-        * EAllThreadsCritical, ESystemCritical and ESystemPermanent are all 
-        * mutually exclusive, i.e. the process can only be in one of these 
-        * states at any one time.
-        * @param aCritical The state to be set.
-        * @return TInt KErrNone, if successful; KErrArgument, if either 
-        * EProcessCritical or EProcessPermanent is passed - these are states
-        * associated with a thread, and you use User::SetCritical() 
-        * to set them.
-        */ 
-        IMPORT_C static TInt SetProcessCritical( User::TCritical aCritical );
-                
-    private: // Private functions
-        
-        /**
-        * Factory function for creating RAllocator instances.
-        * @param aNotFirst Is this first thread using specified heap
-        * @param aLogOption The logging option for storage server
-        * @param aFileName The name of the logging file
-        * @param aIsDebug Determines whether a binary is UDEB or UREL
-        * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
-        * @param aFreecallStackSize Max number of stored callstack items when memory freed
-        * @return RAllocator& A reference to created allocator
-        */  
-        static RAllocator& InstallAllocator( TBool aNotFirst,
-                                             const TFileName& aFileName,
-                                             TUint32 aLogOption, TUint32 aIsDebug,
-                                             TUint32 aAllocCallStackSize,
-                                             TUint32 aFreeCallStackSize );
-        
-		/**
-		* Check atool version
-		* @param aVersion - Atool version number.
-		* @param aToolVersion The atool version number
-		* @return KErrNone if correct version found, otherwise one of the system wide 
-		* error codes.
-		*/
-        static TInt CheckVersion( const TATVersion& aVersion, TDes& aToolVersion ); 
-        
-		/**
-		* Function for showing incorrect version information (file or debug channel).
-		* @param aLogOption The logging option
-		* @param aFileName The name of the log file
-		* @param aToolVersion The atool version number
-		*/
-        static void ReportIncorrectVersion( const TUint32 aLogOption, 
-											const TFileName& aFileName,
-											const TDes& aToolVersion );
-        
-    };
-
-#endif // CUSTOMUSER_H
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/inc/threadstack.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +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:  Declaration of the class TThreadStack.
-*
-*/
-
-
-#ifndef THREADSTACK_H
-#define THREADSTACK_H
-
-// INCLUDES
-#include <u32std.h>
-
-// CLASS DECLARATION
-
-/**
-*  Stores thread id and the start of the thread's callstack
-*/
-class TThreadStack
-    {
-    public:
-    
-        /**
-        * C++ default constructor.
-        * @param aId The thread id
-        * @param aStackStart The start of thread's stack
-        */
-        TThreadStack( TThreadId aId, TUint32 aStackStart );
-        
-        /**
-        * Checks if this is the current thread and if this is the current
-        * thread assings value to the given parameter
-        * @param aStackStart& A reference to stack start
-        * @return TBool The start of thread's stack
-        */
-        TBool ThreadStackStart( TUint32& aStackStart );
-       
-        /**
-        * Checks if this the the current thread
-        * @param aThreadId A thread id
-        * @return TBool ETrue it this is the current thread, EFalse otherwise
-        */ 
-        TBool Match( const TUint aThreadId = 0 );
-        
-    private: // Member variables
-    
-        /* The id of the thread */
-        TThreadId iId;
-        
-        /* The start addess of this thread */
-        TUint32 iStackStart;
-    };
-
-
-#endif // THREADSTACK_H
-
-// End of File
-
-
--- a/analyzetool/dynamicmemoryhook/sis/analyzetoolmemoryhook.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +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:
-;
-
-;Language - standard language definitions
-&EN
-
-; standard SIS file header
-#{"AnalyzeToolMemoryHook"},(0xEDF5A8B1),1,8,1
-
-;Localised Vendor name
-%{"Vendor-EN"}
-
-;Unique Vendor name
-:"Vendor"
-
-;Supports Series 60 v 3.0
-[0x101F7961], 0, 0, 0, {"Series60ProductID"}
-
-; 1 File to install
-"\epoc32\release\armv5\urel\atoolmemoryhook.dll"-"!:\sys\bin\atoolmemoryhook.dll"
-"\epoc32\release\armv5\urel\atoolcleaner.dll"   -"!:\sys\bin\atoolcleaner.dll"
\ No newline at end of file
--- a/analyzetool/dynamicmemoryhook/src/analyzetoolallocator.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1014 +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:  Definitions for the class RAnalyzeToolAllocator.
-*
-*/
-
-
-#include "analyzetoolallocator.h"
-#include "analyzetoolmemoryallocator.h"
-#include "atlog.h"
-#include "analyzetoolpanics.pan"
-#include "analyzetoolfastlog.h"
-#include <e32svr.h>
-
-// CONSTANTS
-
-// Length of the callstack address
-const TUint32 KAddressLength = 4;
-
-// Thread count
-const TInt KThreadCount = 1;
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::RAnalyzeToolAllocator()
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-RAnalyzeToolAllocator::RAnalyzeToolAllocator( TBool aNotFirst, 
-                                              RATStorageServer& aStorageServer, 
-                                              RArray<TCodeblock>& aCodeblocks, 
-                                              RMutex& aMutex,
-                                              TUint aProcessId,
-                                              RAnalyzeTool& aAnalyzeTool,
-                                              TBool aStorageServerOpen,
-                                              TUint32 aLogOption,
-                                              TUint32 aAllocCallStackSize,
-                                              TUint32 aFreeCallStackSize ) :
-    RAnalyzeToolMemoryAllocator( aNotFirst ),
-    iStorageServer( aStorageServer ), 
-    iCodeblocks( aCodeblocks ), 
-    iMutex( aMutex ),
-    iProcessId( aProcessId ),
-    iThreadArray( KATMaxCallstackLength ),
-    iAnalyzeTool( aAnalyzeTool ),
-    iStorageServerOpen( aStorageServerOpen ),
-    iLogOption( aLogOption ),
-    iAllocMaxCallStack( aAllocCallStackSize ),
-    iFreeMaxCallStack( aFreeCallStackSize )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::RAnalyzeToolAllocator()" );
-    
-    // Append thread to array of the users of this allocator
-    TThreadParamsBuf params;
-    params().iThreadId = RThread().Id().operator TUint();
-    TInt error = iAnalyzeTool.ThreadStack( params );
-    if ( KErrNone == error )
-        {
-        LOGSTR2( "ATMH Thread stack address: %x", params().iStackAddress );
-        LOGSTR2( "ATMH Thread stack size:    %x", params().iStackSize );
-        error = iThreadArray.Append( TThreadStack( RThread().Id(), 
-                             params().iStackAddress + params().iStackSize ) );
-        }
-    
-    __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantAppendToTheArray ) ); 
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::~RAnalyzeToolAllocator()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-RAnalyzeToolAllocator::~RAnalyzeToolAllocator()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::~RAnalyzeToolAllocator()" );
-    
-    // Close the thread array 
-    iThreadArray.Close();
-    }
-    
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::Uninstall()
-// Uninstalls the current allocator
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolAllocator::Uninstall()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::Uninstall()" );
-
-    // Switch back to the original allocator
-    SwitchOriginalAllocator();
-    
-    // Check if this is shared allocator between threads
-    if ( iThreadArray.Count() > KThreadCount )
-        {
-        // Close the shared allocator
-        Close();
-        return;
-        }
-
-#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
-    #ifndef __WINS__ 
-    // Remove dummy Tls handle
-    UserSvr::DllFreeTls( KDummyHandle );
-    #endif
-#endif
-    
-    // Since this is the last thread using this allocator it can be deleted
-    delete this;
-    }
-
-#ifdef __WINS__
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::Alloc() WINS version
-// Allocates a cell of specified size from the heap.
-// -----------------------------------------------------------------------------
-//
-UEXPORT_C TAny* RAnalyzeToolAllocator::Alloc( TInt aSize )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::Alloc()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Alloc memory from the original allocator
-    TAny* p = iAllocator->Alloc( aSize );
-    
-    LOGSTR3( "ATMH RAnalyzeToolAllocator::Alloc() - aSize: %i, address: %x", 
-             aSize,  (TUint32) p );
-    
-    // Don't collect call stack and log data
-    // if storage server not open or logging mode not fast.
-    if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-        {
-        // Reset the callstack
-        iCallStack.Reset();
-    
-        // Find the current thread callstack start address
-        TUint32 stackstart( 0 );
-        TBool found( FindCurrentThreadStack( stackstart ) );
-        LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
-        
-        TUint32 _sp;
-        __asm
-            {
-            mov [_sp], esp
-            }
-        
-        // Get codeblocks count
-        TInt blocksCount( iCodeblocks.Count() );
-        TInt error( KErrNone );
-        TUint arrayCounter = 0;
-        
-        for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
-            {
-            TUint32 addr = (TUint32) *( (TUint32*) i );
-            if ( ! IsAddressLoadedCode( addr ) )
-                continue;
-            for ( TInt j = 0; j < blocksCount; j++ )
-                {
-                if ( iCodeblocks[j].CheckAddress( addr ) )
-                    {
-                    // To avoid recursive call to ReAlloc specifying granularity
-                    // Add address to the callstack
-                    iCallStack[arrayCounter] = ( addr );
-                    arrayCounter++;
-                    break;
-                    }
-                }
-            if ( arrayCounter == KATMaxCallstackLength ||
-                 arrayCounter == iAllocMaxCallStack )
-                {
-                LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
-                break;
-                }
-            }
-        // Log the memory allocation information
-        if ( iLogOption == EATLogToTraceFast )
-            {
-            // Using fast mode.
-            ATFastLogMemoryAllocated( iProcessId, (TUint32) p, iCallStack, aSize );
-            }
-        else
-            {
-            // Using storage server.
-            error = iStorageServer.LogMemoryAllocated( (TUint32) p,
-                                                       iCallStack,
-                                                       aSize );
-            if ( KErrNone != error )
-                {
-                LOGSTR2( "ATMH LogMemoryAllocated error %i", error );
-                switch ( error )
-                    {
-                    case KErrNoMemory:
-                    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Alloc() - KErrNoMemory case"  );
-                    if ( iStorageServerOpen )
-                        {
-                        iStorageServerOpen = EFalse;
-                        LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Alloc() - close iStorageServer"  );
-                        iStorageServer.Close();
-                        }
-                    break;
-                    }
-                }
-            }
-        }
-    // Release the mutex
-    iMutex.Signal();
-    
-    return p;
-    }
-#else
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::Alloc() ARMV5 version
-// Allocates a cell of specified size from the heap.
-// -----------------------------------------------------------------------------
-//
-TAny* RAnalyzeToolAllocator::Alloc( TInt aSize )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::Alloc()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Alloc memory from the original allocator
-    TAny* p = iAllocator->Alloc( aSize );
-    
-    // Don't collect call stack and log data
-    // if storage server not open or logging mode not fast.
-    if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-        {
-        // Reset the callstack
-        iCallStack.Reset(); 
-        
-        // Find the current thread callstack start address
-        TUint32 stackstart( 0 );
-        TBool found( FindCurrentThreadStack( stackstart ) );
-        LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
-        
-        // Get codeblocks count
-        TInt blocksCount( iCodeblocks.Count() );
-        TInt error( KErrNone );
-        TUint arrayCounter = 0;
-        
-        for ( TUint32 i = __current_sp(); i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
-            {
-            TUint32 addr = (TUint32) *( (TUint32*) i );
-            if ( ! IsAddressLoadedCode( addr ) )
-                continue;
-            for ( TInt j = 0; j < blocksCount; j++ )
-                {
-                if ( iCodeblocks[j].CheckAddress( addr ) )
-                    {
-                    // To avoid recursive call to ReAlloc specifying granularity
-                    // Add address to the callstack
-                    iCallStack[arrayCounter] = ( addr );
-                    arrayCounter++;
-                    break;
-                    }
-                }
-            if ( arrayCounter == KATMaxCallstackLength ||
-                 arrayCounter == iAllocMaxCallStack )
-                {
-                LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
-                break;
-                }
-            }
-        // Log the memory allocation information
-        if ( iLogOption == EATLogToTraceFast )
-            {
-            // Fast mode.
-            ATFastLogMemoryAllocated( iProcessId, (TUint32) p, iCallStack, aSize );
-            }
-        else
-            {
-            // Using storage server.
-            error = iStorageServer.LogMemoryAllocated( (TUint32) p, 
-                                                        iCallStack, 
-                                                        aSize );
-            if ( KErrNone != error )
-                {
-                LOGSTR2( "ATMH LogMemoryAllocated error %i", error );
-                switch ( error )
-                    {
-                    case KErrNoMemory:
-                    LOGSTR1( "ATMH RAnalyzeToolAllocator::Alloc() - KErrNoMemory case"  );
-                    if ( iStorageServerOpen )
-                        {
-                        iStorageServerOpen = EFalse;
-                        LOGSTR1( "ATMH RAnalyzeToolAllocator::Alloc() - close iStorageServer"  );
-                        iStorageServer.Close();
-                        }
-                    break;
-                    }
-                }
-            }
-        }
- 
-    // Release the mutex
-    iMutex.Signal(); 
-    
-    // Return the allocatated memory
-    return p;
-    }
-#endif // __WINS__
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::Free()
-// Frees the allocated memory
-// -----------------------------------------------------------------------------
-//
-TAny RAnalyzeToolAllocator::Free( TAny* aPtr )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::Free()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Don't collect or log data if storage server not open or logging mode not fast.
-    if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-        {
-        // Reset the callstack
-        iFreeCallStack.Reset();
-        
-        // Check if trace logging mode because free call stack is not used in other log options.
-        if ( (iLogOption == EATUseDefault || iLogOption == EATLogToTrace || iLogOption == EATLogToTraceFast )
-                && iFreeMaxCallStack > 0 )
-            {
-            // Find the current thread callstack start address
-            TUint32 stackstart( 0 );
-            TBool found( FindCurrentThreadStack( stackstart ) );
-            LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
-            TUint32 _sp;
-            
-            #ifdef __WINS__
-                __asm
-                    {
-                    mov [_sp], esp
-                    }
-            #else
-                _sp = __current_sp();
-            #endif
-            
-            // Get codeblocks count
-            TInt blocksCount( iCodeblocks.Count() );
-            TUint arrayCounter = 0;
-        
-            for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
-                {
-                TUint32 addr = (TUint32) *( (TUint32*) i );
-                if ( ! IsAddressLoadedCode( addr ) )
-                    continue;
-                for ( TInt j = 0; j < blocksCount; j++ )
-                    {
-                    if ( iCodeblocks[j].CheckAddress( addr ) )
-                        {
-                        // To avoid recursive call to ReAlloc specifying granularity
-                        // Add address to the callstack
-                        iFreeCallStack[arrayCounter] = addr;
-                        arrayCounter++;
-                        break;
-                        }
-                    }
-                if ( arrayCounter == KATMaxFreeCallstackLength ||
-                     arrayCounter == iFreeMaxCallStack )
-                    {
-                    break;
-                    }
-                }
-            LOGSTR2( "ATMH > iFreeCallStack count ( %i )", arrayCounter );
-            }
-        
-        // Log freed memory.
-        if ( iLogOption == EATLogToTraceFast )
-            {
-            // Using fast mode.
-            ATFastLogMemoryFreed( iProcessId, (TUint32) aPtr, iFreeCallStack );
-            }
-        else
-            {
-            // Using storage server.
-            TInt err( iStorageServer.LogMemoryFreed( (TUint32) aPtr, iFreeCallStack ) );
-            if ( err != KErrNone )
-                {
-                LOGSTR2( "ATMH > LogMemoryFreed err( %i )", err );
-                }
-            }
-        }
-    
-    // Free the memory using original allocator
-    iAllocator->Free( aPtr ); 
-    
-    LOGSTR2( "ATMH RAnalyzeToolAllocator::Free() - aPtr: %x", (TUint32)aPtr );
-    
-    // Release the mutex
-    iMutex.Signal();
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::Open()
-// Opens this heap for shared access. Opening the heap increases 
-// the heap's access count by one.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolAllocator::Open()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::Open()");
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Share the memory using original allocator
-    TInt error = iAllocator->Open();
-    
-    // If everything is OK add thread to the array which use this allocator
-    if ( KErrNone == error )
-        {
-        TThreadParamsBuf params;
-        params().iThreadId = RThread().Id().operator TUint();
-        error = iAnalyzeTool.ThreadStack( params );
-
-        __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantAppendToTheArray ) );
-
-        if ( KErrNone == error )
-            {
-            LOGSTR2( "ATMH Thread stack address: %x", params().iStackAddress );
-            LOGSTR2( "ATMH Thread stack size:    %x", params().iStackSize );
-            iThreadArray.Append( TThreadStack( RThread().Id(), 
-                    params().iStackAddress + params().iStackSize ) );
-            }
-        }
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return the error code
-    return error;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::Close()
-// Closes this shared heap. Closing the heap decreases the heap's 
-// access count by one.
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolAllocator::Close()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::Close()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Close the memory using original allocator
-    iAllocator->Close();
-    
-    TInt count = iThreadArray.Count();
-    
-    // Iterate through array of threads to remove current thread
-    for ( TInt i = 0; i < count; i++ )
-        {
-        // Check if this is current thread
-        if ( iThreadArray[ i ].Match() )
-            {
-            // Remove the thread
-            iThreadArray.Remove( i );
-            break;
-            }
-        }
-    
-    // Release the mutex
-    iMutex.Signal();
-    }
-
-#ifdef __WINS__
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::ReAlloc()
-// Increases or decreases the size of an existing cell.
-// -----------------------------------------------------------------------------
-//
-TAny* RAnalyzeToolAllocator::ReAlloc( TAny* aPtr, TInt aSize, TInt aMode )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::ReAlloc()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Realloc the memory using original allocator
-    TAny* ptr = iAllocator->ReAlloc( aPtr, aSize, aMode );
-    
-    // NULL addresses are not in a process under test
-    if ( ptr && !( aMode & ENeverMove ) )
-        {
-        LOGSTR3( "ATMH RAnalyzeToolAllocator::ReAlloc() - aPtr: %x, ptr: %x", 
-                (TUint32)aPtr, (TUint32)ptr );
-        LOGSTR3( "ATMH RAnalyzeToolAllocator::ReAlloc() - aSize: %i, aMode: %i", 
-                aSize, aMode );
-
-        // Don't collect or log data if storage server not open or logging mode fast.
-        if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-            {
-            // Reset the callstack
-            iReCallStack.Reset(); 
-
-            // Find the current thread callstack start address
-            TUint32 stackstart( 0 ); 
-            TBool found( FindCurrentThreadStack( stackstart ) );
-            LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
-            
-            // Get current sp
-            TUint32 _sp( 0 );
-            __asm
-                {
-                mov [_sp], esp
-                }
-            
-            // Get codeblocks count
-            TInt blocksCount( iCodeblocks.Count() );
-            TInt error( KErrNone );
-            TUint arrayCounter = 0;
-            
-            for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
-                {
-                TUint32 addr = (TUint32) *( (TUint32*) i );
-                if ( ! IsAddressLoadedCode( addr ) )
-                    continue;
-                for ( TInt j = 0; j < blocksCount; j++ )
-                    {
-                    if ( iCodeblocks[j].CheckAddress( addr ) )
-                        {
-                        // To avoid recursive call to ReAlloc specifying granularity
-                        // Add address to the callstack
-                        iReCallStack[arrayCounter] = addr;
-                        arrayCounter++;
-                        break;
-                        }
-                    }
-                if ( arrayCounter == KATMaxCallstackLength || 
-                     arrayCounter == iAllocMaxCallStack )
-                    {
-                    LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
-                    break;
-                    }
-                }
-            
-            // No need to report free if the aPtr was NULL
-            if ( aPtr != NULL )
-                {
-                // Reset the free callstack
-                iFreeCallStack.Reset();
-                
-                // if trace logging mode(s) we also log call stack in free.
-                if ( ( iLogOption == EATUseDefault || iLogOption == EATLogToTrace || iLogOption == EATLogToTraceFast )
-                        && iFreeMaxCallStack > 0 )
-                    {
-                    for ( TInt i = 0; i < arrayCounter; i++ )
-                        {
-                        if ( i == KATMaxFreeCallstackLength || i == iFreeMaxCallStack )
-                            {
-                            break;
-                            }
-                        iFreeCallStack[i] = iReCallStack[i];
-                        }
-                    }
-                
-                // Try to remove old address from the storage server's
-                // leak array. If found it's removed from the array because system frees
-                // old address directly in the RHeap in ReAlloc case.
-                if ( iLogOption == EATLogToTraceFast )
-                    {
-                    ATFastLogMemoryFreed( iProcessId, (TUint32) aPtr, iFreeCallStack );
-                    }
-                else
-                    {
-                    iStorageServer.LogMemoryFreed( (TUint32) aPtr, iFreeCallStack );
-                    }
-                }
-            
-            // Log the memory allocation information
-            if ( iLogOption == EATLogToTraceFast )
-                {
-                // Using fast mode.
-                ATFastLogMemoryAllocated( iProcessId, (TUint32) ptr, iFreeCallStack, aSize);
-                }
-            else
-                {
-                // Using storage server.
-                error = iStorageServer.LogMemoryAllocated( (TUint32) ptr, 
-                                                            iReCallStack, 
-                                                            aSize );
-                if ( KErrNone != error )
-                    {
-                    LOGSTR2( "ATMH LogMemoryAllocated ReAlloc error %i", error );
-                    switch ( error )
-                        {
-                        case KErrNoMemory:
-                        LOGSTR1( "ATMH RAnalyzeToolAllocator::ReAlloc() - KErrNoMemory case"  );
-                        if ( iStorageServerOpen )
-                            {
-                            iStorageServerOpen = EFalse;
-                            LOGSTR1( "ATMH RAnalyzeToolAllocator::ReAlloc() - close iStorageServer"  );
-                            iStorageServer.Close();
-                            }
-                        break;
-                        }
-                    }
-                }
-            }
-        }
-    
-    // Release the mutex
-    iMutex.Signal();
-
-    // Return pointer to the reallocated cell
-    return ptr; 
-    }
-
-#else
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::ReAlloc()
-// Increases or decreases the size of an existing cell.
-// -----------------------------------------------------------------------------
-//
-TAny* RAnalyzeToolAllocator::ReAlloc( TAny* aPtr, TInt aSize, TInt aMode )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::ReAlloc()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Realloc the memory using original allocator
-    TAny* ptr = iAllocator->ReAlloc( aPtr, aSize, aMode );
-
-    // NULL addresses are not in a process under test
-    if ( ptr && !( aMode & ENeverMove ) )
-        {
-        LOGSTR3( "ATMH RAnalyzeToolAllocator::ReAlloc() - aPtr: %x, ptr: %x", 
-                (TUint32)aPtr, (TUint32)ptr );
-        LOGSTR3( "ATMH RAnalyzeToolAllocator::ReAlloc() - aSize: %i, aMode: %i", 
-                aSize, aMode );
-
-        // Don't collect or log data if storage server not open or logging mode fast.
-        if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-            {
-            // Reset the callstack
-            iReCallStack.Reset(); 
-
-            // Find the current thread callstack start address
-            TUint32 stackstart( 0 ); 
-            TBool found( FindCurrentThreadStack( stackstart ) );
-            LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
-            
-            // Get codeblocks count
-            TInt blocksCount( iCodeblocks.Count() );
-            TInt error( KErrNone );
-            TUint arrayCounter = 0;
-            
-            for ( TUint32 i = __current_sp(); i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
-                {
-                TUint32 addr = (TUint32) *( (TUint32*) i );
-                if ( ! IsAddressLoadedCode( addr ) )
-                    continue;
-                for ( TInt j = 0; j < blocksCount; j++ )
-                    {
-                    if ( iCodeblocks[j].CheckAddress( addr ) )
-                        {
-                        // To avoid recursive call to ReAlloc specifying granularity
-                        // Add address to the callstack
-                        iReCallStack[arrayCounter] = ( addr );
-                        arrayCounter++;
-                        break;
-                        }
-                    }
-                if ( arrayCounter == KATMaxCallstackLength || 
-                     arrayCounter == iAllocMaxCallStack )
-                    {
-                    LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
-                    break;
-                    }
-                }
-            
-            // No need to report free if the aPtr was NULL
-            if ( aPtr != NULL )
-                {
-                // Reset the free callstack
-                iFreeCallStack.Reset();
-                
-                // if trace logging mode(s) we also log call stack with free.
-                if ( ( iLogOption == EATUseDefault || iLogOption == EATLogToTrace || iLogOption == EATLogToTraceFast )
-                        && iFreeMaxCallStack > 0 )
-                    {
-                    for ( TInt i = 0; i < arrayCounter; i++ )
-                        {
-                        if ( i == iFreeCallStack.Count() )
-                            {
-                            break;
-                            }
-                        iFreeCallStack[i] = iReCallStack[i];
-                        }
-                    }
-                
-                // Try to remove old address from the storage server's
-                // leak array. If found it's removed from the array because system frees
-                // old address directly in the RHeap in ReAlloc case.
-                if ( iLogOption == EATLogToTraceFast )
-                    {
-                    ATFastLogMemoryFreed( iProcessId, (TUint32) aPtr, iFreeCallStack );
-                    }
-                else
-                    {
-                    iStorageServer.LogMemoryFreed( (TUint32) aPtr, iFreeCallStack );
-                    }
-                }
-        
-            // Log the memory allocation information
-            if ( iLogOption == EATLogToTraceFast )
-                {
-                // Using fast mode.
-                ATFastLogMemoryAllocated( iProcessId, (TUint32) ptr, iReCallStack, aSize );
-                }
-            else
-                {
-                // Using storage server.
-                error = iStorageServer.LogMemoryAllocated( (TUint32) ptr, 
-                                                            iReCallStack, 
-                                                            aSize );
-                if ( KErrNone != error )
-                    {
-                    LOGSTR2( "ATMH LogMemoryAllocated ReAlloc error %i", error );
-                    switch ( error )
-                        {
-                        case KErrNoMemory:
-                        LOGSTR1( "ATMH RAnalyzeToolAllocator::ReAlloc() - KErrNoMemory case"  );
-                        if ( iStorageServerOpen )
-                            {
-                            iStorageServerOpen = EFalse;
-                            LOGSTR1( "ATMH RAnalyzeToolAllocator::ReAlloc() - close iStorageServer"  );
-                            iStorageServer.Close();
-                            }
-                        break;
-                        }
-                    }
-                }
-            }
-        }
-
-    // Release the mutex
-    iMutex.Signal();
-
-    // Return pointer to the reallocated cell
-    return ptr; 
-    }
-
-#endif // __WINS__
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::Compress()
-// The function frees excess committed space from the top of the heap.
-// The size of the heap is never reduced below the minimum size 
-// specified during creation of the heap.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolAllocator::Compress()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::Compress()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Compress the memory using original allocator
-    TInt compress = iAllocator->Compress();
-
-    // Release the mutex
-    iMutex.Signal();
-
-    // Return the space reclaimed
-    return compress;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::Reset()
-// Frees all allocated cells on this heap. 
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolAllocator::Reset()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::Reset()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Reset the memory using original allocator
-    iAllocator->Reset();
-
-    // Release the mutex
-    iMutex.Signal();
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::AllocSize()
-// Gets the number of cells allocated on this heap, and 
-// the total space allocated to them.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolAllocator::AllocSize( TInt& aTotalAllocSize ) const
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::AllocSize()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Acquire the memory information using original allocator
-    TInt size = iAllocator->AllocSize( aTotalAllocSize );
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return the number of cells allocated on this heap.
-    return size;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::Available()
-// Gets the total free space currently available on the heap and the 
-// space available in the largest free block. The space available 
-// represents the total space which can be allocated. Note that 
-// compressing the heap may reduce the total free space available 
-// and the space available in the largest free block.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolAllocator::Available( TInt& aBiggestBlock ) const
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::Available()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Acquire the memory information using original allocator
-    TInt available = iAllocator->Available( aBiggestBlock );
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return the total free space currently available on the heap
-    return available;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::AllocLen()
-// Gets the length of the available space in the specified 
-// allocated cell.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolAllocator::AllocLen( const TAny* aCell ) const
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::AllocLen()" ); 
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Acquire the memory information using original allocator
-    TInt len = iAllocator->AllocLen( aCell );
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return the length of the available space in the allocated cell.
-    return len;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::DebugFunction()
-// Invocates specified debug funtionality.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolAllocator::DebugFunction( TInt aFunc, TAny* a1, TAny* a2 )
-    {
-    LOGSTR2( "ATMH RAnalyzeToolAllocator::DebugFunction() %i", aFunc );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Invocate debug funtion using original allocator
-    TInt debug = iAllocator->DebugFunction( aFunc, a1, a2 );
-    
-    switch( aFunc )
-		{  
-		case EMarkEnd:
-			{
-			// Disables the __UHEAP_MARKEND macro
-			LOGSTR1( "ATMH __UHEAP_MARKEND macro called" );
-			if ( debug > 0 )
-				{
-				LOGSTR2( "ATMH __UHEAP_MARKEND detects leaks: %d", debug );
-				// Because there is leaks the alloc panic will occur but
-				// lets return a zero to pretend that everything is OK
-				debug = 0;
-				}
-			}
-		break;
-		
-		default:
-			{
-			}
-		break;
-		}
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return information of the debug function success
-    return debug;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::Extension_()
-// Extension function
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolAllocator::Extension_( TUint aExtensionId, TAny*& a0, 
-    TAny* a1 ) 
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::Extension_()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Invocate extension funtion using original allocator
-    TInt ext = RAllocator::Extension_( aExtensionId, a0, a1 );
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return information of the extension function success
-    return ext;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::ShareHeap()
-// Share heap with other thread
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolAllocator::ShareHeap()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolAllocator::ShareHeap()" );
-    
-    // Call the overwrited Open function
-    Open();
-    }
-    
-// -----------------------------------------------------------------------------
-// RAnalyzeToolAllocator::FindCurrentThreadStack()
-// Find the current thread which is using the heap
-// -----------------------------------------------------------------------------
-//
-TBool RAnalyzeToolAllocator::FindCurrentThreadStack( TUint32& aStackStart )
-    {
-    LOGSTR2( "ATMH RAnalyzeToolAllocator::FindCurrentThreadStack(), count( %i )", 
-            iThreadArray.Count() );
-    
-    // Flag for indicating that right thread has been found
-    TBool found( EFalse );
-    // If threre is only one thread it must be the right thread
-    if ( iThreadArray.Count() == KThreadCount )
-        {
-        if ( !iThreadArray[ 0 ].ThreadStackStart( aStackStart ) )
-            {
-            // This MUST BE the right thread
-            //__ASSERT_ALWAYS( EFalse, AssertPanic( ECantFindRightThread ) );
-            }
-        else if ( iThreadArray[ 0 ].ThreadStackStart( aStackStart ) )
-            {
-            found = ETrue;
-            }
-        }
-    else
-        {
-        // Iterate through array to find right thread
-        TInt count( iThreadArray.Count() );
-        
-        for ( TInt i = 0; i < count; i++ )
-            {
-            // Check if this is the right thread
-            if ( iThreadArray[ i ].ThreadStackStart( aStackStart ) )
-                {
-                // Right thread found. Mark the flag
-                found = ETrue;
-                break;
-                }
-            }
-        // If right thread was not found the panic must be raised
-        if ( !found )
-            {
-            //__ASSERT_ALWAYS( EFalse, AssertPanic( ECantFindRightThread ) );
-            }
-        }
-    return found;
-    }
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/src/analyzetooleventhandler.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +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:  Definitions for the class CLibraryEventHandler.
-*
-*/
-
-
-// INCLUDE FILES
-#include "atlog.h"
-#include "analyzetooleventhandler.h"
-#include "analyzetooleventhandlernotifier.h"
-#include "analyzetoolmemoryallocator.h"
-#include "analyzetoolfastlog.h"
-
-// -----------------------------------------------------------------------------
-// CLibraryEventHandler::~CLibraryEventHandler()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-CLibraryEventHandler::~CLibraryEventHandler()
-    {
-    LOGSTR1( "ATMH CLibraryEventHandler::~CLibraryEventHandler()" );
-    Cancel();
-    }
-
-// -----------------------------------------------------------------------------
-// CLibraryEventHandler::RunL()
-// Process active object's task
-// -----------------------------------------------------------------------------
-//
-void CLibraryEventHandler::RunL()
-    {
-    LOGSTR1( "ATMH CLibraryEventHandler::RunL()" );
-
-    if ( KErrNone != iStatus.Int() )
-        {
-        LOGSTR2( "ATMH RunL error: %i",  iStatus.Int() );
-        return;
-        }
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Check that this is observed process 
-    if ( iLibraryInfo.iEventType == TLibraryEventInfo::ELibraryAdded )
-        {
-        LOGSTR1( "ATMH CLibraryEventHandler::RunL() - TLibraryEventInfo::ELibraryAdded" );
-        if ( iLibraryInfo.iProcessId == iProcessId )
-            {
-            TInt error( KErrNone );
-
-            // Log library load event.
-            if ( iLogOption == EATLogToTraceFast )
-                {
-                LOGSTR1( "ATMH CLibraryEventHandler::RunL() - ATFastLog.LogDllLoaded() " );
-                ATFastLogDllLoaded( iProcessId,
-                        iLibraryInfo.iLibraryName, 
-                        iLibraryInfo.iRunAddress,
-                        iLibraryInfo.iRunAddress + iLibraryInfo.iSize );
-                }
-            else
-                {
-                LOGSTR1( "ATMH CLibraryEventHandler::RunL() - iStorageServer.LogDllLoaded() " );
-                error = iStorageServer.LogDllLoaded( 
-                        iLibraryInfo.iLibraryName, 
-                        iLibraryInfo.iRunAddress,
-                        iLibraryInfo.iRunAddress + iLibraryInfo.iSize );
-                LOGSTR2( "ATMH StorageServer error: %i",  error );
-                }
-            if ( KErrNone == error )
-                {
-                iCodeblocks.Append( TCodeblock( iLibraryInfo.iRunAddress, 
-                        iLibraryInfo.iSize, 
-                        iLibraryInfo.iLibraryName ) );
-                }
-            }
-        }
-    else if ( iLibraryInfo.iEventType == TLibraryEventInfo::ELibraryRemoved )
-        {
-        LOGSTR1( "ATMH CLibraryEventHandler::RunL() - TLibraryEventInfo::ELibraryRemoved " );
-        TInt count = iCodeblocks.Count();
-        LOGSTR2( "ATMH count of code blocks: %i",  count );
-        for ( TInt i = 0; i < count; i++ )
-            {
-            if ( iCodeblocks[ i ].Match( iLibraryInfo.iLibraryName ) )
-                {
-                TBuf8<KMaxLibraryName> libraryName;
-                libraryName.Copy( iLibraryInfo.iLibraryName );
-                
-                // Log library unloaded event
-                if ( iLogOption == EATLogToTraceFast )
-                    {
-                    LOGSTR1( "ATMH CLibraryEventHandler::RunL() - ATFastLogDllUnloaded() " );
-                    ATFastLogDllUnloaded( iProcessId,
-                            libraryName,
-                            iLibraryInfo.iRunAddress, 
-                            iLibraryInfo.iRunAddress + iLibraryInfo.iSize );
-                    }
-                else
-                    {
-                    LOGSTR1( "ATMH CLibraryEventHandler::RunL() - iStorageServer.LogDllUnloaded() " );
-                    #ifdef LOGGING_ENABLED
-                    TInt error = iStorageServer.LogDllUnloaded( 
-                            libraryName/*iLibraryInfo.iLibraryName*/, 
-                            iLibraryInfo.iRunAddress, 
-                            iLibraryInfo.iRunAddress + iLibraryInfo.iSize );
-    
-                    LOGSTR2( "ATMH StorageServer error: %i",  error );
-                    #else
-                    iStorageServer.LogDllUnloaded( 
-                                                libraryName/*iLibraryInfo.iLibraryName*/, 
-                                                iLibraryInfo.iRunAddress, 
-                                                iLibraryInfo.iRunAddress + iLibraryInfo.iSize );
-                    #endif
-                    }
-                iCodeblocks.Remove( i );
-                break;
-                }
-            }
-        }
-    else if ( iLibraryInfo.iEventType == TLibraryEventInfo::EKillThread )
-		{
-		LOGSTR1( "ATMH CLibraryEventHandler::RunL() - TLibraryEventInfo::EKillThread" );
-	  
-		iNotifier.RemoveKilledThread( iLibraryInfo.iThreadId );
-    	}
-    
-    Start();
-    
-    // Release the mutex
-    iMutex.Signal();
-    }
-
-// -----------------------------------------------------------------------------
-// CLibraryEventHandler::DoCancel()
-// Cancels active object's task
-// -----------------------------------------------------------------------------
-//
-void CLibraryEventHandler::DoCancel()
-    {
-    LOGSTR1( "ATMH CLibraryEventHandler::DoCancel()" );
-    // Cancel the subscription of the library events
-    if ( IsActive() )
-        {
-        iStarted = EFalse;
-        
-        iAnalyzeTool.CancelLibraryEvent();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CLibraryEventHandler::Start()
-// Creates CActiveScheduler and variables for the child thread
-// -----------------------------------------------------------------------------
-//
-void CLibraryEventHandler::Start()
-    {
-    LOGSTR1( "ATMH CLibraryEventHandler::Start()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-
-    if ( !IsAdded() )
-        {
-        CActiveScheduler::Add( this );
-        }
-
-    // Cancel current subscribetion
-    if ( IsActive() )
-        {
-        iStarted = EFalse;
-        Cancel();
-        }
-
-    iStatus = KErrNone;
-    iAnalyzeTool.LibraryEvent( iStatus, iLibraryInfo );
-    SetActive();
-    
-    iStarted = ETrue;
-    // Release the mutex
-    iMutex.Signal();
-    }
-
-// -----------------------------------------------------------------------------
-// CLibraryEventHandler::CLibraryEventHandler()
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CLibraryEventHandler::CLibraryEventHandler( RAnalyzeTool& aAnalyzeTool, 
-	RArray<TCodeblock>& aCodeblocks, RATStorageServer& aStorageServer, 
-	TUint aProcessId, RMutex& aMutex, 
-	MAnalyzeToolEventhandlerNotifier& aNotifier,
-	TUint32 aLogOption ) 
- :	CActive( EPriorityNormal ),
-    iAnalyzeTool( aAnalyzeTool ),
-    iCodeblocks( aCodeblocks ),
-    iStorageServer( aStorageServer ),
-    iProcessId( aProcessId ),
-    iMutex( aMutex ),
-    iStarted( EFalse ),
-    iNotifier( aNotifier ),
-    iLogOption( aLogOption )
-    {
-    LOGSTR1( "ATMH CLibraryEventHandler::CLibraryEventHandler()" );
-    }
-
-// -----------------------------------------------------------------------------
-// CLibraryEventHandler::IsStarted()
-// Returns eventhandler's state.
-// -----------------------------------------------------------------------------
-//
-TBool CLibraryEventHandler::IsStarted()
-    {
-    LOGSTR2( "ATMH CLibraryEventHandler::IsStarted(%i)", iStarted );
-    
-    return iStarted;
-    }
-    
-// End of File
--- a/analyzetool/dynamicmemoryhook/src/analyzetoolfastlog.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +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 <e32debug.h> // RDebug
-#include <analyzetool/analyzetooltraceconstants.h>
-#include "analyzetoolfastlog.h"
-#include "atlog.h"
-
-// Local time function.
-TInt64 CurrentTime()
-    {
-    LOGSTR1( "ATFL CurrentTime()" );
-    TTime time;
-    time.UniversalTime();
-    return time.Int64() - KMicroSecondsAt1970;
-    }
-
-TInt ATFastLogProcessStarted( const TDesC8& aProcessName,
-                                 TUint aProcessId,
-                                 TUint32 aIsDebug )
-    {
-    LOGSTR1( "ATFL ATFastLogProcessStarted()" );
-    // Convert process name to 16-bit descriptor.
-    TBuf<KMaxProcessName> processName;
-    processName.Copy( aProcessName );
-    // Buffer to trace.
-    TBuf<KProcessStartBufLength> buffer;
-    // Format process name and id.
-    buffer.Format( KProcessStart16, &processName, aProcessId );
-    // Timestamp.
-    buffer.AppendNum( CurrentTime(), EHex ) ;
-    // Append udeb/urel information to the process start.
-    buffer.Append( KSpaceTrace );  
-    buffer.AppendNum( aIsDebug, EHex );
-    // Append version number.
-    buffer.Append( KSpaceTrace );  
-    buffer.AppendNum( KATTraceVersion, EHex );
-    // Log to trace.
-    RDebug::Print( KTraceMessage, aProcessId ,&buffer );
-    return KErrNone;
-    }
-
-TInt ATFastLogProcessEnded( TUint aProcessId, 
-                            TUint aHandleLeakCount )
-    {
-    LOGSTR1( "ATFL ATFastLogProcessEnded()" );
-    // Handle leaks.
-    if ( aHandleLeakCount > 0 )
-        {
-        // Buffer to trace.
-        TBuf<KHandleLeakBufLength> buffer2;
-        buffer2.Format( KHandleLeak16, &KUnknownModule16, aHandleLeakCount );
-        // Trace it.
-        RDebug::Print( KTraceMessage, aProcessId, &buffer2 );
-        }
-    // Process end trace.
-    TBuf<KProcessEndBufLength> buffer;
-    buffer.Format( KProcessEnd16, aProcessId );
-    buffer.AppendNum( CurrentTime(), EHex);
-    buffer.Append( KNewLineTrace );
-    RDebug::Print( KTraceMessage, aProcessId, &buffer );
-    return KErrNone;
-    }
-
-TInt ATFastLogDllLoaded( TUint aProcessId, 
-                                        const TDesC8& aDllName,
-                                        TUint32 aStartAddress,
-                                        TUint32 aEndAddress )
-    {
-    LOGSTR1( "ATFL ATFastLogDllLoaded()" );
-    // Timestamp.
-    TInt64 time = CurrentTime();
-    // Convert dll name to 16-bit descriptor.
-    TBuf<KMaxLibraryName> dll;
-    dll.Copy( aDllName );
-    // Buffer to trace.
-    TBuf<KDllLoadBufLength> buffer;
-    buffer.Format( KDllLoad16, &dll, time, aStartAddress, aEndAddress );
-    RDebug::Print( KTraceMessage, aProcessId, &buffer );
-    return KErrNone;
-    }
-
-TInt ATFastLogDllUnloaded( TUint aProcessId, const TDesC8& aDllName, TUint32 aStartAddress,
-                                       TUint32 aEndAddress )
-    {
-    LOGSTR1( "ATFL ATFastLogDllUnloaded()" );
-    // Timestamp.
-    TInt64 time = CurrentTime();
-    // Convert dll name to 16-bit descriptor.
-    TBuf<KMaxLibraryName> dll;
-    dll.Copy( aDllName );
-    // Buffer to trace.
-    TBuf<KDllLoadBufLength> buffer;
-    buffer.Format( KDllUnload16, &dll, time, aStartAddress, aEndAddress );
-    RDebug::Print( KTraceMessage, aProcessId, &buffer );   
-    return KErrNone;
-    }
-
-TInt ATFastLogMemoryAllocated( TUint aProcessId, TUint32 aMemAddress,
-                                  TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
-                                  TInt aSize )
-    {
-    LOGSTR1( "ATFL ATFastLogMemoryAllocated()" );
-    // ALLOCH <Memory address> <Time stamp> <Allocation size> <Call stack address count> 
-    // <Call stack address> <Call stack address> ...
-    
-    // Timestamp.
-    TInt64 time = CurrentTime();
-    
-    // Trace buffer and pointer to it.
-    TBufC<KMemAllocBufLength> buffer;
-    TPtr ptr( buffer.Des() );
-    // Append the tag implying a memory allocation line in the data file
-    ptr.Append( KMemoryAllocHeader );
-    
-    // Append the start address of this allocation in the 32-bit (max 8 characters)
-    // hexadecimal text format.
-    ptr.AppendNum( aMemAddress, EHex );
-    
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    ptr.Append( KSpaceTrace );
-    ptr.AppendNum( time, EHex );
-    
-    // Append the size of the allocation in the 32-bit (max 8 characters) hexadecimal
-    // text format.
-    ptr.Append( KSpaceTrace );
-    ptr.AppendNum( aSize, EHex );
-    
-    // Search call stack for address count.
-    TInt addrCount(0);
-    for ( TInt j = 0; j < aCallstack.Count() ; j++ )
-        {
-        if ( aCallstack.At(j) == 0 )
-            break;
-        addrCount++;
-        }
-    // Current position in call stack.
-    TInt addrPos( 0 );
-    
-    // Append address count.
-    ptr.Append( KSpaceTrace );
-    ptr.AppendNum( addrCount, EHex );
-            
-    // Calculate last item length
-    TInt lastItemLength( KTraceMessage().Length() + KHexa32Length + 
-            KSpaceLength + KNewlineLength );
-    
-    TUint packetNumber( 1 );
-    
-    // Go through all call stack's memory addresses associated with
-    // this memory allocation 
-    for ( TInt j = 0; j < addrCount; j++ )
-        {
-        // ALLOCF <Memory address> <Time stamp> <Packet number> 
-        // <Call stack address> <Call stack address> ...
-        if ( ptr.Length() <= 0 )
-            {               
-            // Create alloc fragment message header
-            ptr.Append( KMemoryAllocFragment );
-            ptr.AppendNum( aMemAddress, EHex );
-            ptr.Append( KSpaceTrace );
-            ptr.AppendNum( time, EHex );
-            ptr.Append( KSpaceTrace );        
-            ptr.AppendNum( packetNumber, EHex );
-            // Increase packet number
-            packetNumber++;
-            }
-      
-        // Append call stack address.
-        ptr.AppendFormat( KHexaNumberTrace, aCallstack.At( addrPos ) );
-        
-        // Move the call stack position.
-        addrPos++;
-        
-        // Check if buffer max length exceed
-        if ( lastItemLength + ptr.Length() >= KMemAllocBufLength )
-            {
-            ptr.Append( KNewLineTrace );
-            // Log through debug channel 
-            RDebug::Print( KTraceMessage, aProcessId, &buffer );
-            // Empty trace buffer
-            ptr.Delete( 0, ptr.MaxLength() );
-            }
-        }
-    // Send last message if exists.
-    if ( ptr.Length() > 0 )
-        {
-        ptr.Append( KNewLineTrace );
-        RDebug::Print( KTraceMessage, aProcessId, &buffer);
-        }
-    return KErrNone;
-    }
-
-
-TInt ATFastLogMemoryFreed( TUint aProcessId, TUint32 aMemAddress, 
-                              TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack )
-    {
-    LOGSTR1( "ATFL ATFastLogMemoryFreed()" );
-    // FREEH <Memory address> <Time tamp> <Call stack address count> <Call stack address>
-    // <Call stack address> ...
-    
-    // Timestamp.
-    TInt64 time = CurrentTime();
-    
-    // Trace buffer and pointer to it.
-    TBufC<KMemFreedBufLength> buffer;
-    TPtr ptr( buffer.Des() );
- 
-    // Append the tag implying a memory allocation line in the data file
-    ptr.Append( KMemoryFreedHeader );
-    
-    // Append the start address of this allocation in the 32-bit (max 8 characters)
-    // hexadecimal text format.
-    ptr.AppendNum( aMemAddress, EHex );
-    
-    // Append timestamp;
-    ptr.Append( KSpaceTrace );
-    ptr.AppendNum( time, EHex);
-    
-    // Search call stack for address count.
-    TInt addrCount(0);
-    for ( TInt j = 0; j < aFreeCallstack.Count() ; j++ )
-        {
-        if ( aFreeCallstack.At(j) == 0 )
-            break;
-        addrCount++;
-        }
-    // Current position in call stack.
-    TInt addrPos( 0 );
-    
-    // Append address count.
-    ptr.Append( KSpaceTrace );
-    ptr.AppendNum( addrCount, EHex );
-            
-    // Calculate last item length
-    TInt lastItemLength( KTraceMessage().Length() + KHexa32Length + 
-            KSpaceLength + KNewlineLength );
-    
-    TUint packetNumber( 1 );
-    
-    // Go through all call stack's memory addresses associated with
-    // this memory allocation 
-    for ( TInt j = 0; j < addrCount; j++ )
-        {
-        // ALLOCF <Memory address> <Time stamp> <Packet number> 
-        // <Call stack address> <Call stack address> ...
-        if ( ptr.Length() <= 0 )
-            {               
-            // Create alloc fragment message header
-            ptr.Append( KMemoryFreedFragment );
-            ptr.AppendNum( aMemAddress, EHex );
-            ptr.Append( KSpaceTrace );
-            ptr.AppendNum( packetNumber, EHex );
-            // Increase packet number
-            packetNumber++;
-            }
-      
-        // Append call stack address.
-        ptr.AppendFormat( KHexaNumberTrace, aFreeCallstack.At( addrPos ) );
-        
-        // Move the call stack position.
-        addrPos++;
-        
-        // Check if buffer max length exceed
-        if ( lastItemLength + ptr.Length() >= KMemFreedBufLength )
-            {
-            ptr.Append( KNewLineTrace );
-            // Log through debug channel 
-            RDebug::Print( KTraceMessage, aProcessId, &buffer );
-            // Empty trace buffer
-            ptr.Delete( 0, ptr.MaxLength() );
-            }
-        }
-    // Send last message if exists.
-    if ( ptr.Length() > 0 )
-        {
-        ptr.Append( KNewLineTrace );
-        RDebug::Print( KTraceMessage, aProcessId, &buffer);
-        }
-    return KErrNone;   
-    }
-
--- a/analyzetool/dynamicmemoryhook/src/analyzetoolmainallocator.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1509 +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:  Definitions for the class RAnalyzeToolMainAllocator.
-*
-*/
-
-
-#include "analyzetoolmainallocator.h"
-#include "atlog.h"
-#include "analyzetooleventhandler.h"
-#include "analyzetoolmemoryallocator.h"
-#include "analyzetoolpanics.pan"
-#include "analyzetoolfastlog.h"
-#include <e32svr.h>
-
-
-// CONSTANTS
-
-// The name of the memoryhook dll
-_LIT8( KMemoryHook, "AToolMemoryHook.dll" );
-
-// The name of the storage server dll
-_LIT8( KStorageServer, "AToolStorageServerClnt.dll" );
-
-// Length of the callstack address
-const TUint32 KAddressLength = 4;
-
-// Thread count
-const TInt KThreadCount = 1;
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::RAnalyzeToolMainAllocator()
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-RAnalyzeToolMainAllocator::RAnalyzeToolMainAllocator( TBool aNotFirst, 
-    const TFileName aFileName, TUint32 aLogOption, TUint32 aIsDebug,
-    TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize ) :
-    RAnalyzeToolMemoryAllocator( aNotFirst ),
-    iAnalyzeToolOpen( EFalse ),
-    iDeviceDriverLoaded( EFalse ),
-    iCodeblocks( KATMaxCallstackLength ),
-    iThreadArray( KATMaxCallstackLength ),
-    iLogOption( aLogOption ),
-    iProcessId( RProcess().Id().operator TUint() ),
-    iAllocMaxCallStack( aAllocCallStackSize ),
-    iFreeMaxCallStack( aFreeCallStackSize )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::RAnalyzeToolMainAllocator()" );
-
-    // Basic error variable used in method.
-    TInt error( KErrNone );
-    
-    // Connect to the storage server if logging mode not fast trace.
-    if ( iLogOption != EATLogToTraceFast )
-        {
-        error = iStorageServer.Connect();
-
-        LOGSTR2( "ATMH Opening RATStorageServer error %i", error );
-    
-        if ( KErrNone == error )
-            {
-            iStorageServerOpen = ETrue;
-            }
-        else
-            {
-            iStorageServerOpen = EFalse;
-            }
-    
-        if ( KErrNone == error )
-            {
-            // Make the storage server handle shared between threads
-            error = iStorageServer.ShareAuto();
-            }
-    
-        LOGSTR2( "ATMH Sharing RATStorageServer error %i", error );
-        }
-    
-    // Create mutex for schedule access to shared resources
-    error = iMutex.CreateLocal();
-
-    __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantCreateMutex ) );
-
-    LOGSTR2( "ATMH Creating mutex error %i", error );
-
-    // Load the kernel side device driver
-    error = User::LoadLogicalDevice( KAnalyzeToolLddName );
-
-    if ( error != KErrNone && error != KErrAlreadyExists )
-        {
-        __ASSERT_ALWAYS( EFalse, AssertPanic( ECantLoadDeviceDriver ) );
-        }
-    else
-        {
-        iDeviceDriverLoaded = ETrue;
-        }
-
-    LOGSTR2( "ATMH Loading device driver error %i", error );
-
-    // Open handle to the kernel sidedevice driver
-    error = iAnalyzeTool.Open();
-
-    __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantConnectDeviceDriver ) );
-
-    if ( KErrNone == error )
-        {
-        iAnalyzeToolOpen = ETrue;
-        }
-
-    LOGSTR2( "ATMH Opening RAnalyzeTool handle %i error", error );
-
-    // Set memory model by asking kernel side device driver
-    if ( iAnalyzeToolOpen )
-        {
-        TATMemoryModelBuf model;
-        if ( KErrNone == iAnalyzeTool.GetMemoryModel( model ) )
-            {
-            iMemoryModel = model().iMemoryModel;
-            LOGSTR2( "ATMH AnalyzeTool MemoryModel: %i", iMemoryModel );
-            }
-        else
-            LOGSTR2( "ATMH AnalyzeTool GetMemoryModel error: %i", error );
-        }
-    
-    // Retrieve the initial process information
-    LogProcessInformation( aFileName, aLogOption, aIsDebug );
-
-    // Create handler for receiving kernel events
-    iEventHandler = new CLibraryEventHandler( iAnalyzeTool,
-                                              iCodeblocks,
-                                              iStorageServer,
-                                              iProcessId,
-                                              iMutex, 
-                                              *this,
-                                              aLogOption);
-
-    __ASSERT_ALWAYS( iEventHandler != NULL, AssertPanic( ENoMemory ) );
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::~RAnalyzeToolMainAllocator()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-RAnalyzeToolMainAllocator::~RAnalyzeToolMainAllocator()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::~RAnalyzeToolMainAllocator()" );
-
-    TUint handleLeakCount( 0 );
-    if ( iAnalyzeToolOpen && iThreadArray.Count() > 0 )
-        {
-        TProcessHandleInfoBuf params;
-        params().iProcessId = iProcessId;
-        TInt error( iAnalyzeTool.GetProcessHandleInfo( params ) );
-        handleLeakCount = params().iThreadHandleCount;
-        }
-
-    // Close handle for process memory blocks
-    iCodeblocks.Close();
-
-    // Delete the eventhandler
-    delete iEventHandler;
-
-    // The count of device driver users
-    TClientCountBuf count;
-
-    // Check the flag
-    if ( iAnalyzeToolOpen )
-        {
-        TInt error  = iAnalyzeTool.ClientCount( count );
-        LOGSTR2( "ATMH closing analyze tool handle error: %i", error );
-        iAnalyzeTool.Close();
-        }
-
-    // Check the flag
-    if ( iDeviceDriverLoaded )
-        {
-        LOGSTR2( "ATMH device driver client count: %i", count().iClientCount );
-
-        // Check if there is another user for device driver
-        if ( count().iClientCount <= 1 )
-            {
-            // There was no other users -> unload the device driver
-            TInt error = User::FreeLogicalDevice( KAnalyzeToolLddName );
-            LOGSTR2( "ATMH Unloading ldd error: %i", error );
-            }
-        }
-    
-    // Close the thread array
-    iThreadArray.Close();
-
-    if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-        {
-        if ( iLogOption == EATLogToTraceFast )
-            {
-            LOGSTR1( "ATMH ATFastLogProcessEnded()" );
-            ATFastLogProcessEnded( iProcessId, handleLeakCount );
-            }
-        else
-            {
-            iStorageServerOpen = EFalse;
-            // Inform that process has ended and close the handle
-            LOGSTR1( "ATMH iStorageServer.LogProcessEnded()" );
-            iStorageServer.LogProcessEnded( iProcessId, handleLeakCount );
-            // Close the handle
-            iStorageServer.Close();
-            }
-        }
-    
-    // Close the mutex
-    iMutex.Close();
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::ShareHeap()
-// Share heap with other thread
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolMainAllocator::ShareHeap()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::ShareHeap()" );
-
-    // Call the overwrited Open function
-    Open();
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Uninstall()
-// Uninstalls the current allocator
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolMainAllocator::Uninstall()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Uninstall()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    TMainThreadParamsBuf params;
-    params().iProcessId = iProcessId;
-    iAnalyzeTool.MainThreadAlloctor( params );
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Check if this is shared allocator between threads
-    if ( iThreadArray.Count() > KThreadCount && !params().iAlone )
-        {
-        // Close the shared allocator
-        Close();
-        LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Uninstall() - Close called" );
-        return;
-        }
-
-#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
-    #ifndef __WINS__ 
-    // Remove dummy Tls handle
-    UserSvr::DllFreeTls( KDummyHandle );
-    #endif
-#endif
-    
-    // Since this is the last thread using this allocator it can be deleted
-    delete this;
-    }
-
-#ifdef __WINS__
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Alloc() WINS version
-// Allocates a cell of specified size from the heap.
-// -----------------------------------------------------------------------------
-//
-UEXPORT_C TAny* RAnalyzeToolMainAllocator::Alloc( TInt aSize )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Alloc()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Alloc memory from the original allocator
-    TAny* p = iAllocator->Alloc( aSize );
-
-    LOGSTR3( "ATMH RAnalyzeToolMainAllocator::Alloc() - aSize: %i, address: %x", 
-            aSize,  (TUint32) p );
-
-    // Don't collect or log data if storage server not open or logging mode fast.
-    if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-        {
-        TInt error( KErrNone );
-        
-        // Check if eventhandler is started already
-        if ( !iEventHandler->IsStarted() )
-            {
-            // Install the eventhandler if needed
-            InstallEventHandler();
-            }
-        
-        // Reset the callstack
-        iCallStack.Reset();
-
-        // If we don't want any call stack to be saved skip the next part
-        if( iAllocMaxCallStack > 0 )
-            {
-            // Find the current thread callstack start address
-            TUint32 stackstart( 0 );
-            TBool found( FindCurrentThreadStack( stackstart ) );
-            LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
-            
-            // Returns the value of the stack pointer at the 
-            // current point in your program.
-            TUint32 _sp;
-            __asm
-                {
-                mov [_sp], esp
-                }
-            
-            // Get process loaded code segments count
-            TInt blocksCount( iCodeblocks.Count() );
-            TUint arrayCounter = 0;
-            
-            // Iterate through callstack to find wanted callstack addresses
-            // - Start: current stack address
-            // - Stop: stack start address(Run-address of user stack)
-            // - Add: address length(The word size in the current system is 32 bits, which is 4 bytes)
-            for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
-                {
-                TUint32 addr = (TUint32) *( (TUint32*) i );
-                
-                // Checks is the given address in loaded code memory area.
-                if ( !IsAddressLoadedCode( addr ) )
-                    continue;
-                
-                // Iterate through array of code blocks to check if address is in code segment area 
-                for ( TInt j = 0; j < blocksCount; j++ )
-                    {
-                    // Checks if the given address is in this memory block area
-                    if ( iCodeblocks[j].CheckAddress( addr ) )
-                        {
-                        // To avoid recursive call to ReAlloc specifying granularity
-                        // Add address to the callstack
-                        iCallStack[arrayCounter] = ( addr );
-                        arrayCounter++;
-                        break;
-                        }
-                    }
-                
-                // Checks if the wanted callstack items are gathered
-                if ( arrayCounter == KATMaxCallstackLength ||
-                     arrayCounter == iAllocMaxCallStack )
-                    {
-                    LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
-                    break;
-                    }
-                } 
-            }
-
-        // Log the memory allocation information
-        if ( iLogOption == EATLogToTraceFast )
-            {
-            // Using fast mode.
-            ATFastLogMemoryAllocated( iProcessId, (TUint32) p , iCallStack, aSize );
-            }
-        else
-            {
-            // Using storage server.
-            error = iStorageServer.LogMemoryAllocated( (TUint32) p,
-                                                       iCallStack,
-                                                       aSize );
-            if ( KErrNone != error )
-                {
-                switch ( error )
-                    {
-                    case KErrNoMemory:
-                        {
-                        LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Alloc() - KErrNoMemory case"  );
-                        // Check if eventhandler is active
-                        if ( iEventHandler->IsActive() )
-                            {
-                            // Cancel iEventHandler because not needed anymore
-                            iEventHandler->Cancel();
-                            }
-                        if ( iStorageServerOpen )
-                            {
-                            // Close storage server
-                            iStorageServerOpen = EFalse;
-                            LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Alloc() - close iStorageServer"  );
-                            iStorageServer.Close();
-                            }
-                        break;
-                        }
-                    default:
-                        {
-                        LOGSTR2( "ATMH LogMemoryAllocated error %i", error );
-                        break;
-                        }
-                    }
-                }
-            }
-        }
-    // Release the mutex
-    iMutex.Signal();
-
-    return p;
-    }
-#else
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Alloc() ARMV5 version
-// Allocates a cell of specified size from the heap.
-// -----------------------------------------------------------------------------
-//
-TAny* RAnalyzeToolMainAllocator::Alloc( TInt aSize )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Alloc()"  );
-
-    // acquire the mutex
-    iMutex.Wait();
-
-    // Alloc memory from the original allocator
-    TAny* p = iAllocator->Alloc( aSize );
-
-    LOGSTR3( "ATMH RAnalyzeToolMainAllocator::Alloc() - aSize: %i, address: %x", 
-            aSize,  (TUint32) p );
-
-    TInt error( KErrNone );
-    
-    if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-        {
-        // Check if eventhandler is active already
-        // IsActive might return false value if a tested software has created many
-        // threads which install own CActiveScheduler.
-        if ( !iEventHandler->IsStarted() )
-            {
-            // Install the eventhandler if needed
-            InstallEventHandler();
-            }
-        
-        // Reset the callstack
-        iCallStack.Reset();
-        
-        // If we don't want any call stack to be saved skip the next part
-        if( iAllocMaxCallStack > 0 )
-            {
-            // Find the current thread callstack start address
-            TUint32 stackstart( 0 );
-            TBool found( FindCurrentThreadStack( stackstart ) );
-            LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
-            
-            // Get process loaded code segments count
-            TInt blocksCount( iCodeblocks.Count() );            
-            TUint arrayCounter = 0;
-            
-            // Iterate through callstack to find wanted callstack addresses
-            // - Start: current stack address(__current_sp(): Returns the value of the 
-            //      stack pointer at the current point in your program.)
-            // - Stop: stack start address(Run-address of user stack)
-            // - Add: address length(The word size in the current system is 32 bits, which is 4 bytes)
-            for ( TUint32 i = __current_sp(); i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
-                {
-                TUint32 addr = (TUint32) *( (TUint32*) i );
-                
-                // Checks is the given address in loaded code memory area.
-                if ( !IsAddressLoadedCode( addr ) )
-                    continue;
-                
-                // Iterate through array of code blocks to check if address is in code segment area 
-                for ( TInt j = 0; j < blocksCount; j++ )
-                    {
-                    // Checks if the given address is in this memory block area
-                    if ( iCodeblocks[j].CheckAddress( addr ) )
-                        {
-                        // To avoid recursive call to ReAlloc specifying granularity
-                        // Add address to the callstack
-                        iCallStack[arrayCounter] = ( addr );
-                        arrayCounter++;
-                        break;
-                        }
-                    }
-                
-                // Checks if the wanted callstack items are gathered
-                if ( arrayCounter == KATMaxCallstackLength ||
-                     arrayCounter == iAllocMaxCallStack )
-                    {
-                    LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
-                    break;
-                    }
-                }
-            }
-        // Log the memory allocation information
-        if ( iLogOption == EATLogToTraceFast )
-            {
-            // Using fast mode.
-            ATFastLogMemoryAllocated( iProcessId, (TUint32) p, iCallStack, aSize );
-            }
-        else
-            {
-            // Using storage server.
-            error = iStorageServer.LogMemoryAllocated( (TUint32) p,
-                                                       iCallStack,
-                                                       aSize );
-            if ( KErrNone != error )
-                {
-                switch ( error )
-                    {
-                    case KErrNoMemory:
-                        {
-                        LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Alloc() - KErrNoMemory case"  );
-                        // Check if eventhandler is active
-                        if ( iEventHandler->IsActive() )
-                            {
-                            // Cancel ieventhandler because not needed anymore
-                            iEventHandler->Cancel();
-                            }
-                        if ( iStorageServerOpen )
-                            {
-                            // Close storage server
-                            iStorageServerOpen = EFalse;
-                            LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Alloc() - close iStorageServer"  );
-                            iStorageServer.Close();
-                            }
-                        break;
-                        }
-                    default:
-                        {
-                        LOGSTR2( "ATMH LogMemoryAllocated error %i", error );
-                        break;
-                        }
-                    }
-                }
-            }
-        }
-    
-    // Release the mutex
-    iMutex.Signal();
-
-    // Return the allocatated memory
-    return p;
-    }
-#endif // __WINS__
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Free()
-// Frees the allocated memory
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolMainAllocator::Free( TAny* aPtr )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Free()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-        {
-        // Reset the callstack
-        iFreeCallStack.Reset();
-        
-        // Check if trace logging mode
-        // Also if we don't want any call stack to be stored skip the next part
-        if ( (iLogOption == EATUseDefault || iLogOption == EATLogToTrace || iLogOption == EATLogToTraceFast )
-                && iFreeMaxCallStack > 0 )
-            {
-            // Find the current thread callstack start address
-            TUint32 stackstart( 0 );
-            TBool found( FindCurrentThreadStack( stackstart ) );
-            LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
-            TUint32 _sp;
-            
-            // Returns the value of the stack pointer at the 
-            // current point in your program.
-            #ifdef __WINS__
-                __asm
-                    {
-                    mov [_sp], esp
-                    }
-            #else
-                _sp = __current_sp();
-            #endif
-            
-            // Get process loaded code segments count
-            TInt blocksCount( iCodeblocks.Count() );
-            TUint arrayCounter = 0;
-            
-            // Iterate through callstack to find wanted callstack addresses
-            // - Start: current stack address
-            // - Stop: stack start address(Run-address of user stack)
-            // - Add: address length(The word size in the current system is 32 bits, which is 4 bytes)            
-            for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
-                {
-                TUint32 addr = (TUint32) *( (TUint32*) i );
-                // Checks is the given address in loaded code memory area.
-                if ( ! IsAddressLoadedCode( addr ) )
-                    continue;
-                
-                // Iterate through array of code blocks to check if address is in code segment area 
-                for ( TInt j = 0; j < blocksCount; j++ )
-                    {
-                    // Checks if the given address is in this memory block area
-                    if ( iCodeblocks[j].CheckAddress( addr ) )
-                        {
-                        // To avoid recursive call to ReAlloc specifying granularity
-                        // Add address to the callstack
-                        iFreeCallStack[arrayCounter] = addr;
-                        arrayCounter++;
-                        break;
-                        }
-                    }
-                // Checks if the wanted callstack items are gathered
-                if ( arrayCounter == KATMaxFreeCallstackLength ||
-                     arrayCounter == iFreeMaxCallStack )
-                    {
-                    break;
-                    }
-                }
-            LOGSTR2( "ATMH > iFreeCallStack count ( %i )", arrayCounter );
-            }
-        // Log the memory free information.
-        if ( iLogOption == EATLogToTraceFast )
-            {
-            // Using fast mode.
-            ATFastLogMemoryFreed( iProcessId, (TUint32) aPtr, iFreeCallStack );
-            }
-        else
-            {
-            // Using storage server.
-            TInt err( iStorageServer.LogMemoryFreed( (TUint32) aPtr, iFreeCallStack ) );
-            if ( err != KErrNone )
-                {
-                LOGSTR2( "ATMH > LogMemoryFreed err( %i )", err );
-                }
-            }
-        }
-    
-    // Free the memory using original allocator
-    iAllocator->Free( aPtr );
-
-    LOGSTR2( "ATMH RAnalyzeToolMainAllocator::Free() - aPtr: %x", (TUint32)aPtr );
-
-    // Release the mutex
-    iMutex.Signal();
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Open()
-// Opens this heap for shared access. Opening the heap increases
-// the heap's access count by one.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolMainAllocator::Open()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Open() " );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Share the memory using original allocator
-    TInt error = iAllocator->Open();
-
-    // If everything is OK add thread to the array which use this allocator
-    if ( KErrNone == error )
-        {
-        TThreadParamsBuf params;
-        params().iThreadId = RThread().Id().operator TUint();
-        error = iAnalyzeTool.ThreadStack( params );
-
-        __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantAppendToTheArray ) );
-
-        if ( KErrNone == error )
-            {
-            LOGSTR2( "ATMH Thread stack address: %x", params().iStackAddress );
-            LOGSTR2( "ATMH Thread stack size:    %x", params().iStackSize );
-            iThreadArray.Append( TThreadStack( RThread().Id(),
-                    params().iStackAddress + params().iStackSize ) );
-            }
-        }
-
-    // Release the mutex
-    iMutex.Signal();
-
-    // Return the error code
-    return error;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Close()
-// Closes this shared heap. Closing the heap decreases the heap's
-// access count by one.
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolMainAllocator::Close()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Close()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Close the memory using original allocator
-    iAllocator->Close();
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Close() - allocator closed" );
-    TInt count = iThreadArray.Count();
-
-    // Iterate through array of threads to remove current thread
-    for ( TInt i = 0; i < count; i++ )
-        {
-        // Check if this is current thread
-        if ( iThreadArray[ i ].Match() )
-            {
-            // Remove the thread
-            iThreadArray.Remove( i );
-            LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Close() - thread removed" );
-            break;
-            }
-        }
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Close() - about to mutex signal" );
-    // Release the mutex
-    iMutex.Signal();
-    }
-
-#ifdef __WINS__
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::ReAlloc()
-// Increases or decreases the size of an existing cell.
-// -----------------------------------------------------------------------------
-//
-TAny* RAnalyzeToolMainAllocator::ReAlloc( TAny* aPtr, TInt aSize, TInt aMode )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::ReAlloc()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Realloc the memory using original allocator
-    TAny* ptr = iAllocator->ReAlloc( aPtr, aSize, aMode );
-    
-    // NULL addresses are not in a process under test
-    if ( ptr && !( aMode & ENeverMove ) )
-        {
-        LOGSTR3( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - aPtr: %x, ptr: %x", 
-                (TUint32)aPtr, (TUint32)ptr );
-        LOGSTR3( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - aSize: %i, aMode: %i", 
-                aSize, aMode );
-      
-        // Don't collect or log data if storage server not open or logging mode is not fast.
-        if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-            {
-            TInt error( KErrNone );
-            TUint arrayCounter = 0;
-            
-            // Reset the callstack
-            iReCallStack.Reset();
-            
-            // If we don't want any call stack to be saved skip the next part
-            if( iAllocMaxCallStack > 0 )
-                {
-                // Find the current thread callstack start address
-                TUint32 stackstart( 0 );
-                TBool found( FindCurrentThreadStack( stackstart ) );
-                LOGSTR3( "ATMH > stackstart: %x , find = %i", stackstart, found );
-    
-                // Returns the value of the stack pointer at the 
-                // current point in your program.
-                TUint32 _sp( 0 );
-                __asm
-                    {
-                    mov [_sp], esp
-                    }
-                
-                // Get process loaded code segments count
-                TInt blocksCount( iCodeblocks.Count() );
-                
-                // Iterate through callstack to find wanted callstack addresses
-                // - Start: current stack address
-                // - Stop: stack start address(Run-address of user stack)
-                // - Add: address length(The word size in the current system is 32 bits, which is 4 bytes)                
-                for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
-                    {
-                    TUint32 addr = (TUint32) *( (TUint32*) i );
-                    // Checks is the given address in loaded code memory area.
-                    if ( ! IsAddressLoadedCode( addr ) )
-                        continue;
-                    
-                    // Iterate through array of code blocks to check if address is in code segment area 
-                    for ( TInt j = 0; j < blocksCount; j++ )
-                        {
-                        // Checks if the given address is in this memory block area
-                        if ( iCodeblocks[j].CheckAddress( addr ) )
-                            {
-                            // To avoid recursive call to ReAlloc specifying granularity
-                            // Add address to the callstack
-                            iReCallStack[arrayCounter] = addr;
-                            arrayCounter++;
-                            break;
-                            }
-                        }
-                    // Checks if the wanted callstack items are gathered
-                    if ( arrayCounter == KATMaxCallstackLength || 
-                         arrayCounter == iAllocMaxCallStack )
-                        {
-                        LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
-                        break;
-                        }
-                    }
-                }
-            
-            // No need to report free if the aPtr was NULL
-            if ( aPtr != NULL )
-                {
-                // Reset the free callstack
-                iFreeCallStack.Reset();
-                
-                // Check that logging mode is trace/trace fast so we use free call stack 
-                // and call stack size bigger than zero
-                if ( ( iLogOption == EATUseDefault || iLogOption == EATLogToTrace || iLogOption == EATLogToTraceFast ) && iFreeMaxCallStack > 0 )
-                    {
-                    for ( TInt i = 0; i < arrayCounter; i++ )
-                        {
-                        if ( i == KATMaxFreeCallstackLength || i == iFreeMaxCallStack )
-                            {
-                            break;
-                            }
-                        iFreeCallStack[i] = iReCallStack[i];
-                        }
-                    }
-                // Try to remove old address from the storage server's
-                // leak array. If found. it's removed from the array because system frees
-                // old address directly in the RHeap in ReAlloc case.
-                if ( iLogOption == EATLogToTraceFast )
-                    {
-                    ATFastLogMemoryFreed( iProcessId, (TUint32) aPtr, iFreeCallStack );
-                    }
-                else
-                    {
-                    iStorageServer.LogMemoryFreed( (TUint32) aPtr, iFreeCallStack );
-                    }
-                }
-            // Log the memory allocation information
-            if ( iLogOption == EATLogToTraceFast )
-                {
-                // Using fast logging mode.
-                ATFastLogMemoryAllocated( iProcessId, (TUint32) ptr, iReCallStack, aSize );
-                }
-            else
-                {
-                // Using storage server.
-                error = iStorageServer.LogMemoryAllocated( (TUint32) ptr,
-                                                           iReCallStack,
-                                                           aSize );
-                if ( KErrNone != error )
-                    {
-                    switch ( error )
-                        {
-                        case KErrNoMemory:
-                            {
-                            LOGSTR1( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - KErrNoMemory case"  );
-                            // Check if eventhandler is active
-                            if ( iEventHandler->IsActive() )
-                                {
-                                // Cancel iEventHandler because not needed anymore
-                                iEventHandler->Cancel();
-                                }
-                            if ( iStorageServerOpen )
-                                {
-                                // Close storage server
-                                iStorageServerOpen = EFalse;
-                                LOGSTR1( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - close iStorageServer"  );
-                                iStorageServer.Close();
-                                }
-                            break;
-                            }
-                        default:
-                            {
-                            LOGSTR2( "ATMH LogMemoryAllocated error %i", error );
-                            break;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    
-    // Release the mutex
-    iMutex.Signal();
-
-    // Return pointer to the reallocated cell
-    return ptr;
-    }
-
-#else
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::ReAlloc()
-// Increases or decreases the size of an existing cell.
-// -----------------------------------------------------------------------------
-//
-TAny* RAnalyzeToolMainAllocator::ReAlloc( TAny* aPtr, TInt aSize, TInt aMode )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::ReAlloc()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Realloc the memory using original allocator
-    TAny* ptr = iAllocator->ReAlloc( aPtr, aSize, aMode );
-    
-    TInt error( KErrNone );
-    TUint arrayCounter = 0;
-    
-    // NULL addresses are not in a process under test
-    if ( ptr && !( aMode & ENeverMove ) )
-        {
-        LOGSTR3( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - aPtr: %x, ptr: %x", 
-                (TUint32)aPtr, (TUint32)ptr );
-        LOGSTR3( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - aSize: %i, aMode: %i", 
-                aSize, aMode );
- 
-        // Don't collect or log data if storage server not open or logging mode is not fast.
-        if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-            {
-            // Reset the callstack
-            iReCallStack.Reset();
-            
-            // If we don't want any call stack to be saved skip the next part
-            if( iAllocMaxCallStack > 0 )
-                {
-                // Find the current thread callstack start address
-                TUint32 stackstart( 0 );
-                TBool found( FindCurrentThreadStack( stackstart ) );
-                LOGSTR3( "ATMH > stackstart: %x , find = %i", stackstart, found );
-                
-                // Get process loaded code segments count
-                TInt blocksCount( iCodeblocks.Count() );
-                
-                // Iterate through callstack to find wanted callstack addresses
-                // - Start: current stack address(__current_sp(): Returns the value of the 
-                //      stack pointer at the current point in your program.)
-                // - Stop: stack start address(Run-address of user stack)
-                // - Add: address length(The word size in the current system is 32 bits, which is 4 bytes)
-                for ( TUint32 i = __current_sp(); i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
-                    {
-                    TUint32 addr = (TUint32) *( (TUint32*) i );
-                    
-                    // Checks is the given address in loaded code memory area.
-                    if ( !IsAddressLoadedCode( addr ) )
-                        continue;
-                                
-                    // Iterate through array of code blocks to check if address is in code segment area 
-                    for ( TInt j = 0; j < blocksCount; j++ )
-                        {
-                        // Checks if the given address is in this memory block area
-                        if ( iCodeblocks[j].CheckAddress( addr ) )
-                            {
-                            // To avoid recursive call to ReAlloc specifying granularity
-                            // Add address to the callstack
-                            iReCallStack[arrayCounter] = ( addr );
-                            arrayCounter++;
-                            break;
-                            }
-                        }
-                    // Checks if the wanted callstack items are gathered
-                    if ( arrayCounter == KATMaxCallstackLength || 
-                         arrayCounter == iAllocMaxCallStack )
-                        {
-                        LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
-                        break;
-                        }
-                    }
-                }
-            
-            // No need to report free if the aPtr was NULL
-            if ( aPtr != NULL )
-                {
-                // Reset the free callstack
-                iFreeCallStack.Reset();
-                
-                // Check that logging mode is trace/trace fast so we use free call stack 
-                // and call stack size bigger than zero
-                if ( (iLogOption == EATUseDefault || iLogOption == EATLogToTrace || iLogOption == EATLogToTraceFast )
-                        && iFreeMaxCallStack > 0 )
-                    {
-                    for ( TInt i = 0; i < arrayCounter; i++ )
-                        {
-                        if ( i == KATMaxFreeCallstackLength || i == iFreeMaxCallStack )
-                            {
-                            break;
-                            }
-                        iFreeCallStack[i] = ( iReCallStack[i] );
-                        }
-                    }
-                
-                // Try to remove old address from the storage server's
-                // leak array. If found. it's removed from the array because system frees
-                // old address directly in the RHeap in ReAlloc case.
-                if ( iLogOption == EATLogToTraceFast )
-                    {
-                    ATFastLogMemoryFreed( iProcessId, (TUint32) aPtr, iFreeCallStack );
-                    }
-                else
-                    {
-                    iStorageServer.LogMemoryFreed( (TUint32) aPtr, iFreeCallStack );
-                    }
-                }
-            
-            // Log the memory allocation information
-            if ( iLogOption == EATLogToTraceFast )
-                {
-                // Using fast logging mode.
-                ATFastLogMemoryAllocated( iProcessId, (TUint32) ptr, iReCallStack, aSize );
-                }
-            else
-                {
-                // Using storage server.
-                error = iStorageServer.LogMemoryAllocated( (TUint32) ptr,
-                                                        iReCallStack,
-                                                        aSize );
-                if ( KErrNone != error )
-                    {
-                    switch ( error )
-                        {
-                        case KErrNoMemory:
-                            {
-                            LOGSTR1( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - KErrNoMemory case"  );
-                            // Check if eventhandler is active
-                            if ( iEventHandler->IsActive() )
-                                {
-                                // Cancel iEventHandler because not needed anymore
-                                iEventHandler->Cancel();
-                                }
-                            if ( iStorageServerOpen )
-                                {
-                                // Close storage server
-                                iStorageServerOpen = EFalse;
-                                LOGSTR1( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - close iStorageServer"  );
-                                iStorageServer.Close();
-                                }
-                            break;
-                            }
-                        default:
-                            {
-                            LOGSTR2( "ATMH LogMemoryAllocated error %i", error );
-                            break;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-    // Release the mutex
-    iMutex.Signal();
-
-    // Return pointer to the reallocated cell
-    return ptr;
-    }
-
-#endif // __WINS__
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Compress()
-// The function frees excess committed space from the top of the heap.
-// The size of the heap is never reduced below the minimum size
-// specified during creation of the heap.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolMainAllocator::Compress()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Compress()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Compress the memory using original allocator
-    TInt compress = iAllocator->Compress();
-
-    // Release the mutex
-    iMutex.Signal();
-
-    // Return the space reclaimed
-    return compress;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Reset()
-// Frees all allocated cells on this heap.
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolMainAllocator::Reset()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Reset()" );
-
-    // Acquire the mutex
-    iMutex.Wait();
-
-    // Reset the memory using original allocator
-    iAllocator->Reset();
-
-    // Release the mutex
-    iMutex.Signal();
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::AllocSize()
-// Gets the number of cells allocated on this heap, and
-// the total space allocated to them.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolMainAllocator::AllocSize( TInt& aTotalAllocSize ) const
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::AllocSize()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Acquire the memory information using original allocator
-    TInt size = iAllocator->AllocSize( aTotalAllocSize );
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return the number of cells allocated on this heap.
-    return size;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Available()
-// Gets the total free space currently available on the heap and the
-// space available in the largest free block. The space available
-// represents the total space which can be allocated. Note that
-// compressing the heap may reduce the total free space available
-// and the space available in the largest free block.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolMainAllocator::Available( TInt& aBiggestBlock ) const
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Available()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Acquire the memory information using original allocator
-    TInt available = iAllocator->Available( aBiggestBlock );
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return the total free space currently available on the heap
-    return available;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::AllocLen()
-// Gets the length of the available space in the specified
-// allocated cell.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolMainAllocator::AllocLen( const TAny* aCell ) const
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::AllocLen()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Acquire the memory information using original allocator
-    TInt len = iAllocator->AllocLen( aCell );
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return the length of the available space in the allocated cell.
-    return len;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::DebugFunction()
-// Invocates specified debug funtionality.
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolMainAllocator::DebugFunction( TInt aFunc, TAny* a1, TAny* a2 )
-    {
-    LOGSTR2( "ATMH RAnalyzeToolMainAllocator::DebugFunction() %i", aFunc );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Invocate debug funtion using original allocator
-    TInt debug = iAllocator->DebugFunction( aFunc, a1, a2 );
-    
-    switch( aFunc )
-        {  
-        case EMarkEnd:
-            {
-            // Disables the __UHEAP_MARKEND macro
-            LOGSTR1( "ATMH __UHEAP_MARKEND macro called" );
-            if ( debug > 0 )
-                {
-                LOGSTR2( "ATMH __UHEAP_MARKEND detects leaks: %d", debug );
-                // Because there is leaks the alloc panic will occur but
-                // lets return a zero to pretend that everything is OK
-                debug = 0;
-                }
-            }
-        break;
-        
-        default:
-            {
-            }
-        break;
-        }
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return information of the debug function success
-    return debug;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::RemoveKilledThread()
-// Remove killed thread from threads array.
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolMainAllocator::RemoveKilledThread( const TUint aThreadId  )
-    {
-    LOGSTR2( "ATMH RAnalyzeToolMainAllocator::RemoveKilledThread(%i)", 
-            aThreadId );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Iterate through array of threads to remove current thread
-    TInt count( iThreadArray.Count() );
-    LOGSTR2( "ATMH > iThreadArray.Count() %i", count );
-    
-    for ( TInt i = 0; i < count; i++ )
-        {
-        // Check if this is current thread
-        if ( iThreadArray[ i ].Match( aThreadId ) )
-            {
-            // Remove the thread
-            iThreadArray.Remove( i );
-            LOGSTR1( "ATMH > thread removed" );
-            break;
-            }
-        }
-
-    // Release the mutex
-    iMutex.Signal();
-    }
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::Extension_()
-// Extension function
-// -----------------------------------------------------------------------------
-//
-TInt RAnalyzeToolMainAllocator::Extension_( TUint aExtensionId, TAny*& a0,
-    TAny* a1)
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Extension_()" );
-    
-    // Acquire the mutex
-    iMutex.Wait();
-    
-    // Invocate extension funtion using original allocator
-    TInt ext = RAllocator::Extension_( aExtensionId, a0, a1 );
-    
-    // Release the mutex
-    iMutex.Signal();
-    
-    // Return information of the extension function success
-    return ext;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::LogProcessInformation()
-// Retrieve and log the process initial information
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolMainAllocator::LogProcessInformation( const TFileName aFileName,
-    TUint32 aLogOption, TUint32 aIsDebug )
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation()" );
-    
-    // Create local variable and retrieve the process information
-    TProcessIdentityParamsBuf params;
-    params().iProcessId = iProcessId;
-    params().iThreadId = RThread().Id().operator TUint();
-    TInt error = iAnalyzeTool.GetProcessInfo( params );
-    
-    LOGSTR2( "ATMH GetProcessInfo %i error", error );
-    
-    if ( KErrNone == error )
-        {
-        LOGSTR2( "ATMH Process %i", iProcessId );
-
-        // Store stack start address
-        LOGSTR2( "ATMH Thread stack address: %x", params().iStackAddress );
-        LOGSTR2( "ATMH Thread stack size:    %x", params().iStackSize );
-
-        // Append thread to array of the users of this allocator
-        error = iThreadArray.Append(
-        TThreadStack( RThread().Id(), params().iStackAddress + params().iStackSize) );
-
-        __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantAppendToTheArray ) );
-
-        // Log process information
-        if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-            {
-            if ( iLogOption == EATLogToTraceFast )
-                {
-                // Using fast logging mode.
-                LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation() - ATFastLogProcessStarted() #1" );
-                ATFastLogProcessStarted( params().iProcessName, iProcessId, aIsDebug );                
-                }
-            else
-                {
-                // Using storage server.
-                LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation() - iStorageServerOpen #1" );
-                error = iStorageServer.LogProcessStarted(
-                        aFileName,
-                        params().iProcessName,
-                        iProcessId, 
-                        aLogOption, 
-                        aIsDebug );
-                }
-            }
-
-        LOGSTR2( "ATMH LogProcessStarted error %i", error );
-
-        // Iterate through process codesegments
-        for( TInt i = 0; i < params().iCodesegCount; i++ )
-            {
-            // Create local variable and retrieve codesegment info
-            TCodesegInfoBuf codeinfo;
-            codeinfo().iProcessId = iProcessId;
-            codeinfo().iIndex = i;
-            error = iAnalyzeTool.GetCodesegInfo( codeinfo );
-
-            LOGSTR2( "ATMH GetCodesegInfo error %i", error );
-            if ( KErrNone == error )
-                {
-                // Don't log AnalyzeTool libraries
-                if ( 0 != codeinfo().iFullName.CompareC( KMemoryHook ) &&
-                     0 != codeinfo().iFullName.CompareC( KStorageServer ) )
-                    {
-                    // Log the loaded codesegment(s)
-                    if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-                        {
-                        if ( iLogOption == EATLogToTraceFast )
-                            {
-                            // Using fast logging mode.
-                            LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation() - ATFastLogDllLoaded() #2" );
-                            ATFastLogDllLoaded( iProcessId,
-                                    codeinfo().iFullName,
-                                    codeinfo().iRunAddress,
-                                    codeinfo().iRunAddress + codeinfo().iSize );
-                            }
-                        else
-                            {
-                            // Using storage server.
-                            LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation() - iStorageServerOpen #2" );
-                            error = iStorageServer.LogDllLoaded(
-                                    codeinfo().iFullName,
-                                    codeinfo().iRunAddress,
-                                    codeinfo().iRunAddress + codeinfo().iSize );
-                            }
-                        }
-
-                    LOGSTR2( "ATMH LogDllLoaded error %i", error );
-
-                    // Check that everything is OK
-                    if ( KErrNone == error )
-                        {
-                        // Append the codesegment to the array
-                        error = iCodeblocks.Append(
-                                        TCodeblock( codeinfo().iRunAddress,
-                                        codeinfo().iSize,
-                                        codeinfo().iFullName ) );
-                        LOGSTR2( "ATMH Append error %i", error );
-                        }
-                    }
-                }
-            }
-
-        // Iterate through process dynamic codesegments
-        for ( TInt i = 0; i < params().iDynamicCount; i++ )
-            {
-            // Create local variable and retrieve codesegment info
-            TLibraryInfoBuf info;
-            info().iProcessId = iProcessId;
-            info().iIndex = i;
-            error = iAnalyzeTool.GetLibraryInfo( info );
-            LOGSTR2( "ATMH GetLibraryInfo error %i", error );
-            if ( KErrNone == error )
-                {
-                // Log the loaded dynamic codesegment(s)
-                if ( iStorageServerOpen || iLogOption == EATLogToTraceFast )
-                    {
-                    if ( iLogOption == EATLogToTraceFast )
-                        {
-                        // Using fast logging mode.
-                        LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation() - - ATFastLogDllLoaded()#3" );
-                        ATFastLogDllLoaded( iProcessId,
-                                info().iLibraryName,
-                                info().iRunAddress,
-                                info().iRunAddress + info().iSize );
-                        }
-                    else
-                        {
-                        // Using storage server.
-                        LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation() - iStorageServerOpen #3" );
-                        error = iStorageServer.LogDllLoaded(
-                                info().iLibraryName,
-                                info().iRunAddress,
-                                info().iRunAddress + info().iSize );
-                        }
-                    }
-
-
-                LOGSTR2( "ATMH LogDllLoaded error %i", error );
-
-                if ( KErrNone == error )
-                    {
-                    // Append the codesegment to the array
-                    error = iCodeblocks.Append(
-                            TCodeblock( info().iRunAddress, 
-                                        info().iSize, info().iLibraryName ) );
-                    LOGSTR2( "ATMH Append error %i", error );
-                    }
-                }
-            }
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::FindCurrentThreadStack()
-// Find the current thread which is using the heap
-// -----------------------------------------------------------------------------
-//
-TBool RAnalyzeToolMainAllocator::FindCurrentThreadStack( TUint32& aStackStart )
-    {
-    LOGSTR2( "ATMH RAnalyzeToolMainAllocator::FindCurrentThreadStack(), count( %i )",
-            iThreadArray.Count() );
-    
-    // Flag for indicating that right thread has been found
-    TBool found( EFalse );
-    // If threre is only one thread it must be the right thread
-    if ( iThreadArray.Count() == KThreadCount )
-        {
-        if ( !iThreadArray[ 0 ].ThreadStackStart( aStackStart ) )
-            {
-            // This MUST BE the right thread
-            //__ASSERT_ALWAYS( EFalse, AssertPanic( ECantFindRightThread ) );
-            }
-        else if ( iThreadArray[ 0 ].ThreadStackStart( aStackStart ) )
-            {
-            found = ETrue;
-            }
-        }
-    else
-        {
-        // Iterate through array to find right thread
-        TInt count = iThreadArray.Count();
-
-        for ( TInt i = 0; i < count; i++ )
-            {
-            // Check if this is the right thread
-            if ( iThreadArray[ i ].ThreadStackStart( aStackStart ) )
-                {
-                // Right thread found. Mark the flag
-                found = ETrue;
-                break;
-                }
-            }
-        // If right thread was not found the panic must be raised
-        if ( !found )
-            {
-            //__ASSERT_ALWAYS( EFalse, AssertPanic( ECantFindRightThread ) );
-            }
-        }
-    return found;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMainAllocator::InstallEventHandler()
-// Installs the eventhandler, if possible
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolMainAllocator::InstallEventHandler()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::InstallEventHandler()" );
-    
-    // Active eventhalder is not active, trying to start it
-    if ( NULL != CActiveScheduler::Current() )
-        {
-        iEventHandler->Start();
-        }
-    }
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/src/analyzetoolmemoryallocator.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +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:  Definitions for the class RAnalyzeToolMemoryAllocator.
-*
-*/
-
-
-#include "analyzetoolmemoryallocator.h"
-#include "analyzetoolpanics.pan"
-#include "atlog.h"
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMemoryAllocator::RAnalyzeToolMemoryAllocator()
-// C++ default constructor.
-// -----------------------------------------------------------------------------
-//
-RAnalyzeToolMemoryAllocator::RAnalyzeToolMemoryAllocator( TBool aNotFirst ) :
-    RAllocator(),
-    iNotFirst( aNotFirst )/*,
-    iStorageServerOpen( EFalse )*/
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMemoryAllocator::RAnalyzeToolMemoryAllocator()" );
-    
-    // Acquire the original allocator
-    iAllocator = &User::Allocator(); 
-    
-    // Set memory model zero
-    iMemoryModel = 0;
-    }
-
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMemoryAllocator::~RAnalyzeToolMemoryAllocator()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-RAnalyzeToolMemoryAllocator::~RAnalyzeToolMemoryAllocator()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMemoryAllocator::~RAnalyzeToolMemoryAllocator()" );
-    
-    // Call switching orinigal allocator back.
-    // Just in case, if uninstall was not called.
-    SwitchOriginalAllocator();
-    }
-    
-// -----------------------------------------------------------------------------
-// RAnalyzeToolMemoryAllocator::SwitchOriginalAllocator()
-// Switches original allocator in use if not already.
-// -----------------------------------------------------------------------------
-//
-void RAnalyzeToolMemoryAllocator::SwitchOriginalAllocator()
-    {
-    LOGSTR1( "ATMH RAnalyzeToolMemoryAllocator::SwitchOriginalAllocator()" );
-    
-    if ( iAllocator != &User::Allocator() )
-        {
-        User::SwitchAllocator( iAllocator );
-        }
-    }
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/src/codeblock.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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:  Definitions for the class TCodeblock.
-*
-*/
-
-
-#include "codeblock.h"
-#include "atlog.h"
-
-// -----------------------------------------------------------------------------
-// TCodeblock::TCodeblock
-// C++ default constructor.
-// -----------------------------------------------------------------------------
-//
-TCodeblock::TCodeblock( TLinAddr aRunAddress, 
-                        TUint32 aSize, 
-                        TBuf8<KMaxLibraryName>& aName ) :
-                        iStartAddress( aRunAddress ),
-                        iEndAddress( aRunAddress + aSize )
-    {
-    LOGSTR3( "ATMH TCodeblock::TCodeblock() %x - %x", iStartAddress, iEndAddress );
-    iName.Copy( aName );
-    }
-
-// -----------------------------------------------------------------------------
-// TCodeblock::CheckAddress
-// Checks if the given address is in this memory block area
-// -----------------------------------------------------------------------------
-//
-TBool TCodeblock::CheckAddress( TUint32 aAddress )
-    {
-    if ( iStartAddress <= aAddress && aAddress <= iEndAddress )
-        {
-        return ETrue;
-        }
-    return EFalse;
-    }
-
-// -----------------------------------------------------------------------------
-// TCodeblock::Match
-// Matches if the given parameters represents this memory block 
-// -----------------------------------------------------------------------------
-//
-TBool TCodeblock::Match( TBuf8<KMaxLibraryName>& aName )
-    {
-    LOGSTR1( "ATMH TCodeblock::Match()" );
-    return ( 0 == iName.CompareF( aName ) ) ? ETrue : EFalse;
-    }
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/src/customuser.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,518 +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:  Definitions for the class CustomUser.
-*
-*/
-
-#include <f32file.h>
-#include <utf.h>
-#include "customuser.h"
-#include "analyzetoolmainallocator.h"
-#include "analyzetoolallocator.h"
-#include "atlog.h"
-#include "analyzetoolmemoryallocator.h"
-#include "analyzetoolpanics.pan"
-#include "atstorageservercommon.h"
-#include "atdriveinfo.h"
-#include <analyzetool/analyzetooltraceconstants.h>
-
-#ifdef USE_CLEANER_DLL
-// Global variable to detect dll attach & detach in process.
-// Note! This is initialized after SetupThreadHeap so its not usable there.
-// This is used to store the main thread id and track when the process ends
-// to load the cleaner dll with call back feature to cleanup allocator at the
-// last possible phase.
-#include <analyzetool/analyzetoolcleaner.h>
-
-// CONSTANTS
-const TInt KAToolCleanerOrdinal = 1;
-
-class TAnalyzeToolGlobalTracker : public TAnalyzeToolCleanerBase
-    {
-public:
-    /* Main thread id */
-    TThreadId iMainId;
-    
-    /* Inform if panic occured */
-    TBool iPanic;
-    
-    // -----------------------------------------------------------------------------
-    // TAnalyzeToolGlobalTracker::TAnalyzeToolGlobalTracker()
-    // C++ default constructor 
-    // -----------------------------------------------------------------------------
-    //
-    TAnalyzeToolGlobalTracker()
-        {
-        LOGSTR1( "ATMH TAnalyzeToolGlobalTracker::TAnalyzeToolGlobalTracker()" );
-        
-        iPanic = EFalse; // no panic occured
-        iMainId = RThread().Id(); // set main thread id
-        LOGSTR2( "ATMH TAnalyzeToolGlobalTracker() > Main id set: %d", 
-                iMainId.operator TUint() );
-        }
-    
-    // -----------------------------------------------------------------------------
-    // TAnalyzeToolGlobalTracker::~TAnalyzeToolGlobalTracker()
-    // Destructor.
-    // -----------------------------------------------------------------------------
-    //
-    ~TAnalyzeToolGlobalTracker()
-        {
-        LOGSTR1( "ATMH TAnalyzeToolGlobalTracker::~TAnalyzeToolGlobalTracker()" );
-        
-        // We dont load dll if panic has happened (uninstallation has been done).
-        if ( iPanic )
-            {
-            LOGSTR1( "ATMH ~TAnalyzeToolGlobalTracker > Panic set not loading cleaner dll." );
-            return;
-            }
-        
-        LOGSTR1( "ATMH ~TAnalyzeToolGlobalTracker > about to load cleaner dll" );
-        // Load cleaner library and set a call back to our cleanup
-        RLibrary lib;
-        TInt error( lib.Load( KATCleanerDllName ) );
-        if ( error == KErrNone )
-            {
-            // Set address to point to ourself
-            TLibraryFunction func = lib.Lookup( KAToolCleanerOrdinal ); // Ordinal 1 of the dll
-            ATCLEANERTABLE* cleaner = (ATCLEANERTABLE*) func(); // Use function to get address
-            cleaner->At( 0 ) = (TUint32) this; // Set address
-            LOGSTR1( "ATMH ~TAnalyzeToolGlobalTracker() > cleaner dll loaded and call back set" );
-            }
-        else
-            {
-            // Error loading cleanup dll
-            LOGSTR2( "ATMH ~TAnalyzeToolGlobalTracker() > cleaner dll load error(%i) uninstalling allocator now!", 
-                    error );
-            Cleanup();
-            }
-        }
-    
-    // -----------------------------------------------------------------------------
-    // TAnalyzeToolGlobalTracker::Cleanup()
-    // 
-    // -----------------------------------------------------------------------------
-    //
-    void Cleanup()
-        {
-        LOGSTR1( "ATMH TAnalyzeToolGlobalTracker::Cleanup() - allocator uninstall" );
-        
-        // Uninstall allocator
-        ( (RAnalyzeToolMemoryAllocator&) User::Allocator() ).Uninstall();
-        }
-    
-    };
-
-// Global variable definition.
-TAnalyzeToolGlobalTracker gGlobalTracker;
-#endif
-
-// CONSTANTS
-// When needed, update the version number directly inside _LIT macro.
-// Constant for the atool API(staticlib) version.
-_LIT( KAtoolApiVersion, "1.7.5" );
-
-// Version number buffer length
-const TInt KAtoolVersionNumberLength = 10;
-
-// Wrong version error code
-const TInt KAtoolVersionError = -1999;
-
-// Version number separator
-_LIT( KVersionSeparator, ";" );
-
-// Incorrect version error strings 
-_LIT( KIncorrectText, "ERROR_OCCURED INCORRECT_ATOOL_VERSION [API v.%S][ATOOL v.%S]" );
-_LIT( KIncorrectTextTrace, "PCSS " );
-
-// -----------------------------------------------------------------------------
-// CustomUser::Panic()
-// Overloaded User::Panic() function
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CustomUser::Panic( const TDesC& aCategory, TInt aReason )
-    {
-    LOGSTR3( "ATMH CustomUser::Panic() %S %i", &aCategory, aReason );
-    
-#ifdef USE_CLEANER_DLL
-    // Set global tracker that panic has happened.
-    gGlobalTracker.iPanic = ETrue;
-#endif
-    
-    // Uninstall thread's RAllocator
-    ( (RAnalyzeToolMemoryAllocator&) User::Allocator() ).Uninstall();
-       
-    // Call the "real" User::Panic()
-    User::Panic( aCategory, aReason );
-    }
-
-// -----------------------------------------------------------------------------
-// CustomUser::Exit()
-// Overloaded User::Exit() function
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CustomUser::Exit( TInt aReason )
-    {
-    LOGSTR3( "ATMH CustomUser::Exit() %i %i", aReason, RThread().Id().Id() );
-    
-    if ( aReason != KAtoolVersionError )
-    	{
-#ifdef USE_CLEANER_DLL
-        // Only uninstall allocator if its not the process main/first thread.
-        LOGSTR3( "ATMH CustomUser::Exit() - Thread id: %d - Main Id: %d",
-                RThread().Id().operator TUint(), gGlobalTracker.iMainId.operator TUint() );
-        
-        if ( RThread().Id() != gGlobalTracker.iMainId )
-            {
-            LOGSTR2("ATMH CustomUser::Exit() - Calling allocator uninstall in thread: %d" , RThread().Id().operator TUint() );
-            ( (RAnalyzeToolMemoryAllocator&) User::Allocator() ).Uninstall();
-            }
-#else
-    	// Uninstall thread's RAllocator
-    	( (RAnalyzeToolMemoryAllocator&) User::Allocator() ).Uninstall();
-    	LOGSTR1( "ATMH CustomUser::Exit() - about to User::Exit" );
-#endif
-    	}
-    
-    // Call the "real" User::Exit()
-    User::Exit( aReason );
-    }
-
-// -----------------------------------------------------------------------------
-// CustomUser::SetCritical()
-// Overloaded User::SetCritical() function which returns
-// KErrNone, if successful; KErrArgument, if EAllThreadsCritical is 
-// passed - this is a state associated with a process, and you use 
-// User::SetProcessCritical() to set it.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CustomUser::SetCritical( User::TCritical aCritical )
-    {
-    LOGSTR1( "ATMH CustomUser::SetCritical()" );
-    // Check the given User::TCritical type
-    if ( aCritical == User::EAllThreadsCritical )
-        {
-        return KErrArgument;
-        }
-    else
-        {
-        return KErrNone;
-        }
-    }
-  
-// -----------------------------------------------------------------------------
-// CustomUser::SetProcessCritical()
-// Overloaded User::SetProcessCritical() function
-// KErrNone, if successful; KErrArgument, if either EProcessCritical or 
-// EProcessPermanent is passed - these are states associated with a 
-// thread, and you use User::SetCritical() to set them.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CustomUser::SetProcessCritical( User::TCritical aCritical )
-    {
-    LOGSTR1( "ATMH CustomUser::SetProcessCritical()" );
-     // Check the given User::TCritical type 
-    if ( aCritical == User::EProcessCritical || 
-         User::EProcessPermanent == aCritical )
-        {
-        return KErrArgument;
-        }
-    else
-        {
-        return KErrNone;
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CustomUser::SetupThreadHeap()
-// Overloaded UserHeap::SetupThreadHeap function
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CustomUser::SetupThreadHeap( TBool aNotFirst, 
-    SStdEpocThreadCreateInfo& aInfo, const TFileName& aFileName,
-    TUint32 aLogOption, TUint32 aIsDebug, const TATVersion& aVersion,
-    TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize,
-    TRefByValue<const TDesC> aFmt, ... )
-    {
-    LOGSTR1( "ATMH CustomUser::SetupThreadHeap()" );
-    LOGSTR2( "ATMH > Thread id(%d)", RThread().Id().operator TUint() );
-    
-    // Add handling of the argument list here.
-        
-    TInt ret( KErrNone );    
-    // Check version number
-    TBuf<KAtoolVersionNumberLength> atoolVer;
-    if ( CheckVersion( aVersion, atoolVer ) != KErrNone )
-    	{
-    	LOGSTR1( "ATMH > Wrong API version > Inform user and Exit." );
-    	ReportIncorrectVersion( aLogOption, aFileName, atoolVer );
-    	return KAtoolVersionError;
-    	}
-    
-    // Check is this shared heap
-    if ( aInfo.iAllocator == NULL )
-        {
-        LOGSTR1( "ATMH creating a new heap" );
-        // RAllocator is NULL so heap is not shared, creating a new heap
-        ret = UserHeap::SetupThreadHeap( aNotFirst, aInfo );
-        __ASSERT_ALWAYS( KErrNone == ret, AssertPanic( EFailedToCreateHeap ) );
-        
-#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
-    #ifndef __WINS__
-        // Set dummy Tls value
-        TAny* dummyPtr( NULL );
-        TInt setErr( UserSvr::DllSetTls( KDummyHandle, dummyPtr ) );
-        LOGSTR2( "ATMH > Set Tls err(%i)", setErr );
-    #endif
-#endif
-        // Install the RAllocator
-        aInfo.iAllocator = &InstallAllocator( aNotFirst, aFileName, aLogOption, aIsDebug,
-                aAllocCallStackSize, aFreeCallStackSize );
-        }
-    else
-        {
-        LOGSTR1( "ATMH sharing the heap" );
-        // The heap is shared. Acquire pointer to the original heap
-        RAnalyzeToolMemoryAllocator* allocator = 
-			(RAnalyzeToolMemoryAllocator*) aInfo.iAllocator;
-        // Share the heap
-        allocator->ShareHeap();
-        // Switch thread heap 
-        User::SwitchAllocator( allocator );
-        }
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// CustomUser::InstallAllocator
-// Installs the RAllocator
-// -----------------------------------------------------------------------------
-//
-//lint -e{429} suppress "Custodial pointer 'allocator' has not been freed or returned"
-EXPORT_C RAllocator& CustomUser::InstallAllocator( TBool aNotFirst, 
-	const TFileName& aFileName, TUint32 aLogOption, TUint32 aIsDebug,
-	TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize )
-    {
-    LOGSTR1( "ATMH CustomUser::InstallAllocator()" );
-    
-    // Open handle to the device driver
-    RAnalyzeTool analyzetool;
-    TInt error = analyzetool.Open();
-    
-    // Check if the device driver has already loaded
-    if ( KErrNone == error )
-        {
-        LOGSTR1( "ATMH CustomUser::InstallAllocator() - analyzetool.Open() returned KErrNone" );
-        // The device driver has already loaded
-        // Get pointer to the main thread allocator
-        TMainThreadParamsBuf params;
-        params().iProcessId = RProcess().Id().operator TUint();
-        error = analyzetool.MainThreadAlloctor( params );
-
-        __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantOpenHandle ) );
-        
-        // Close handle to the device driver
-        analyzetool.Close();
-        
-        // Is this the first thread of the program
-        if ( params().iAlone )
-            {
-            LOGSTR1( "ATMH CustomUser::InstallAllocator() - first thread of the program" );
-            // Only one thread in the program. Must be main thread
-            RAnalyzeToolMainAllocator* allocator = 
-				new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aLogOption,
-				                               aIsDebug, aAllocCallStackSize, aFreeCallStackSize );
-            
-            __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) );
-            
-            // Change threads allocator
-            User::SwitchAllocator( allocator );
-            
-            // Return reference to the RAllocator
-            return *allocator;
-            }
-        // This is not the first thread. A new thread with a new heap created
-        else
-            {
-            LOGSTR1( "ATMH CustomUser::InstallAllocator() - create a new allocator for the new thread" );
-            // Create new RAllocator with handles from the main thread
-            RAnalyzeToolAllocator* allocator = new RAnalyzeToolAllocator( 
-                    aNotFirst,
-                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->StorageServer(), 
-                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->Codeblocks(), 
-                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->Mutex(), 
-                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->ProcessId(), 
-                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->AnalyzeTool(),
-                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->StorageServerOpen(),
-                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->LogOption(),
-                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->AllocMaxCallStack(),
-                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->FreeMaxCallStack() );
-
-            __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) );
-            
-            // Change threads allocator
-            User::SwitchAllocator( allocator );
-            
-            // Return reference to the RAllocator
-            return *allocator;
-            }
-        }
-    // The device driver does not exists so this must be the first thread
-    else
-        {
-        LOGSTR1( "ATMH CustomUser::InstallAllocator() - analyzetool.Open() returned error, creating DD" );
-        RAnalyzeToolMainAllocator* allocator = 
-			new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aLogOption, aIsDebug,
-			        aAllocCallStackSize, aFreeCallStackSize );
-        
-        __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) );
-        
-        // Change threads allocator
-        User::SwitchAllocator( allocator );
-
-        // Return reference to the RAllocator
-        return *allocator;
-        }
-    } 
-    
-// -----------------------------------------------------------------------------
-// CustomUser::CheckVersion
-// Check atool version
-// -----------------------------------------------------------------------------
-//
-TInt CustomUser::CheckVersion( const TATVersion& aVersion, TDes& aToolVersion )
-    { 
-    LOGSTR2( "ATMH CustomUser::CheckVersion(), aVersion( %S )", &aVersion );
-    
-    TFileName version;
-    version.Copy( aVersion );
-    TBuf<KAtoolVersionNumberLength> apiVer;
-    	
-    // Find separator place
-    TInt findplace( version.Find( KVersionSeparator() ) );
-    // Parse API version first [x.x.x;x.x.x]
-    if ( findplace >= 0 && findplace <= apiVer.MaxLength() )
-		{
-		apiVer.Copy( version.Mid( 0, findplace ) ); 
-		version.Delete( 0, findplace + KVersionSeparator().Length() );
-		}
- 
-    if ( version.Length() <= aToolVersion.MaxLength() )
-    	{
-    	aToolVersion.Copy( version );
-    	if ( aToolVersion.Compare( KAtoolApiVersion ) == KErrNone &&
-    		 apiVer.Length() == 0 )
-    		{
-    		// Support 1.5.0 version (Version info: [1.5.0])
-    		apiVer.Copy( version );
-    		}
-    	}
-    
-    LOGSTR3( "ATMH > API version( %S ), ATOOL version( %S )", 
-    		&apiVer, &aToolVersion );
-        
-    // Check version numbers 
-    if ( apiVer.Compare( KAtoolApiVersion ) == KErrNone )
-    	{
-    	return KErrNone;
-    	}
-    return KErrCancel;    
-    }
-
-// -----------------------------------------------------------------------------
-// CustomUser::ReportIncorrectVersion
-// Function for showing incorrect version information
-// -----------------------------------------------------------------------------
-//
-void CustomUser::ReportIncorrectVersion( const TUint32 aLogOption,
-	const TFileName& aFileName, const TDes& aToolVersion )
-	{
-	LOGSTR2( "ATMH CustomUser::ReportIncorrectVersion(), aFileName( %S )", 
-			&aFileName );
-	
-	switch ( aLogOption )
-		{
-		case EATLogToFile:
-			{
-			LOGSTR1( "ATMH ReportIncorrectVersion > EATLogToFile" );			
-			
-			// A handle to a file server session.
-			RFs fs;
-			// Creates and opens a file, 
-			// and performs all operations on a single open file.
-			RFile file;	
-			// Create full path buffer
-			TBuf<KMaxFileName> logFileBuf;
-			// Connects a client to the file server.
-			TInt err( fs.Connect() );
-			
-			if ( !err )
-				{				
-                err = TATDriveInfo::CreatePath( logFileBuf, aFileName, fs );
-			    
-				// Replace file if exists
-				if ( err && err != KErrAlreadyExists )
-					{
-					LOGSTR2( "ATMH > TATDriveInfo::CreatePath() err( %i )", err );
-					return;
-					}
-				
-				// Replace file if exists (drive C)
-				err = file.Replace( fs, logFileBuf, EFileWrite );
-										
-				// Write to file
-				if ( !err )
-					{
-					err = file.Write( KDataFileVersion );
-					// Error msg buffer
-					TBuf8<KMaxFileName> msg;				     
-					// Write the error code to the buffer  
-					logFileBuf.Format( KIncorrectText, &KAtoolApiVersion, &aToolVersion );	
-					CnvUtfConverter::ConvertFromUnicodeToUtf8( msg, logFileBuf );
-					err = file.Write( msg );
-					}
-				// Closes the file.
-				file.Close();
-				}
-			
-			LOGSTR2( "ATMH > File err( %i )", err );			
-			// Closes the handle.
-			fs.Close();
-			}
-			break;
-			
-		case EATUseDefault:
-		case EATLogToTrace:
-			{
-			LOGSTR1( "ATMH > ReportIncorrectVersion > EATLogToTrace" );
-			// Error msg buffer
-			TBuf<KMaxFileName> msg;	
-			msg.Copy( KIncorrectTextTrace );
-			msg.Append( KIncorrectText );
-			TBuf<KMaxFileName> traceMsg;	
-			// Write the error code to the buffer  
-			traceMsg.Format( msg, &KAtoolApiVersion, &aToolVersion );
-			RDebug::Print( traceMsg );
-			}
-			break;
-		
-		default:
-			{
-			LOGSTR1( "ATMH > ReportIncorrectVersion > default" );
-			}
-			break;
-		}	
-	}
-
-// End of File
--- a/analyzetool/dynamicmemoryhook/src/threadstack.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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:  Definitions for the class TThreadStack.
-*
-*/
-
-
-#include "threadstack.h"
-#include "atlog.h"
-
-// -----------------------------------------------------------------------------
-// TThreadStack::TThreadStack()
-// C++ default constructor.
-// -----------------------------------------------------------------------------
-//
-TThreadStack::TThreadStack( TThreadId aId, TUint32 aStackStart ) :
-    iId( aId ),
-    iStackStart( aStackStart )
-    {
-    LOGSTR2( "ATMH TThreadStack::TThreadStack() aStackStart: %i", aStackStart );
-    }
-
-// -----------------------------------------------------------------------------
-// TThreadStack::ThreadStackStart()
-// Checks if this is the current thread and if this is the current
-// thread assings value to the given parameter
-// -----------------------------------------------------------------------------
-//
-TBool TThreadStack::ThreadStackStart( TUint32& aStackStart )
-    {
-    LOGSTR1( "ATMH TThreadStack::ThreadStackStart");
-    
-    if ( RThread().Id() == iId )
-        {
-        aStackStart = iStackStart;
-        return ETrue;
-        }
-    else
-        {
-        aStackStart = 0;
-        return EFalse;
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// TThreadStack::Match()
-// Checks if this is the the current thread.
-// -----------------------------------------------------------------------------
-//
-TBool TThreadStack::Match( const TUint aThreadId )
-    {
-    LOGSTR2( "ATMH TThreadStack::Match( %d )", aThreadId );
-    
-    if ( aThreadId != 0 )
-    	{
-    	LOGSTR2( "ATMH > iId.operator TUint() = %d", iId.operator TUint() );
-    	return ( aThreadId == iId.operator TUint() ) ? ETrue : EFalse;
-    	}
-    else
-    	{
-    	return ( RThread().Id() == iId ) ? ETrue : EFalse;
-    	}
-    }
-    
-// End of File
--- a/analyzetool/envpatcher/EnvPatcher.pl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,544 +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:
-# Environment Patcher - Patches older S60 SDKs for supporting
-# tricks in newer platforms
-#
-
-
-require v5.6.1;	
-
-use File::Copy;
-use strict;
-
-# check amount of commandline options is valid
-if (@ARGV != 1)
-{
-    print "Usage: EnvPatcher <EPOCROOT>\n";
-    exit 1;
-}
-
-
-# get epocroot and convert, convert \ -> /
-(my $epocroot = $ARGV[0]) =~ s{\\}{/}g;
-
-# remove any trailing forward slashes
-$epocroot =~ s/\/$//;
-
-
-# create variables for paths
-my $e32toolsdir = $epocroot."/epoc32/tools";
-my $e32includedir = $epocroot."/epoc32/include";
-my $e32includeoemdir = $e32includedir."/oem";
-my $platformpathspath = $e32includedir."/platform_paths.hrh";
-my $domainplatformpathspath = $e32includedir."/domain/osextensions/platform_paths.hrh";
-my $mmppmpath = $e32toolsdir."/mmp.pm";
-my $pathutlpmpath = $e32toolsdir."/pathutl.pm";
-my $prepfilepmpath = $e32toolsdir."/prepfile.pm";
-
-# variables for hacked content
-my $dependshack = "\t\t\tif (/^DEPENDS\$/o) {\r\n\t\t\t\tnext LINE;  # Ignore DEPENDS keyword, not needed by ABLD\r\n\t\t\t}\r\n";
-my $smpsafehack = "\t\tif (/^SMPSAFE\$/o) {\r\n\t\t\tnext LINE;  # Ignore SMPSAFE keyword, not needed by older environments\r\n\t\t}\r\n";
-my $forwardslashhack = "\t\t# EnvPatcher forwardslash hack begins\r\n\t\t\$_=~s{/}{\\\\}g;   # convert all forward slashes to backslashes\r\n\t\t# EnvPatcher forwardslash hack ends\r\n\r\n";
-my $coreibyexportsupport = "\r\n// Following definition is used for exporting tools and stubs IBY files to\r\n// Core image.\r\n#define CORE_IBY_EXPORT_PATH(path,exported)  /epoc32/rom/include/##exported\r\n";
-
-
-# check epoc32\tools exists
-unless (-d $e32toolsdir)
-{
-    print "$e32toolsdir not found, please check valid epocroot has been given!\n";
-    exit 1;
-}
-
-# check epoc32\include exists
-unless (-d $e32includedir)
-{
-    print "$e32includedir not found, please check valid epocroot has been given!\n";
-    exit 1;
-}
-
-
-# create epoc32\include\oem if it does not exist
-unless (-d $e32includeoemdir)
-{
-    mkdir $e32includeoemdir or die;
-    print "Missing directory $e32includeoemdir created succesfully.\n";
-}
-
-
-# check if epoc32\include\domain\osextensions\platform_paths.hrh exists
-if (-e $domainplatformpathspath)
-{
-    # show an error if the file does not have any platform macros
-    unless (string_exists_in_file($domainplatformpathspath, "OS_LAYER_SYSTEMINCLUDE"))
-    {
-        print "ERROR: $domainplatformpathspath does not have SF macros.\n";
-        print "Please check your environment, if you have S60 3.2 OEM or newer, please get the latest version!\n";
-        exit 2;
-    }
-}
-
-
-# check if epoc32\include\platform_paths.hrh exists
-if (-e $platformpathspath)
-{
-    print "$platformpathspath already exists, not checking it.\n";    
-}
-else
-{
-    # create the file missing file
-    create_default_platform_paths_hrh();
-    print "Missing file $platformpathspath created succesfully.\n";    
-}
-
-
-# check if CORE_IBY_EXPORT_PATH macro exist in the platform_paths.hrh
-unless (string_exists_in_file($platformpathspath, "CORE_IBY_EXPORT_PATH"))
-{
-    # read content of the platform_paths.hrh
-    my @filecontent = read_file_to_array($platformpathspath);  
-
-    my $match_found = 0;
-    my $i = 0;
-    my $match_found_pos = 0;
-    
-    # find the position where the include guards start (this should be a safe position)
-    foreach (@filecontent)
-    {
-        if ($_ =~ /#define PLATFORM_PATHS_HRH/)
-        {
-            $match_found = 1;
-            $match_found_pos = $i;
-            last;
-        } 
-
-        $i++;
-    }
-    
-    if ($match_found)
-    {
-        # insert the patched content to the file
-        splice(@filecontent, $match_found_pos+1, 0, $coreibyexportsupport);
-        
-        # write the modified array to the file
-        write_file_from_array($platformpathspath, @filecontent);
-    
-        print "Platform_paths.hrh updated to support CORE_IBY_EXPORT_PATH macro.\n";
-    }
-    else
-    {
-        print "WARNING: $platformpathspath is corrupted or not supported!\n";    
-    }
-}
- 
-    
-# check if epoc32\tools\mmp.pm exists
-if (-e $mmppmpath)
-{
-    # check if DEPENDS keyword already exists in the file
-    if (string_exists_in_file($mmppmpath, "DEPENDS"))
-    {
-        print "The SDK can already handle DEPENDS keyword in a MMP file.\n";        
-    }
-    else
-    {
-        # read content of the mmp.pm file
-        my @filecontent = read_file_to_array($mmppmpath);
-        
-        my $match_found = 0;
-        my $i = 0;
-        my $match_found_pos = 0;
-        
-        # loop through the array to find the correct place
-        foreach (@filecontent)
-        {
-            if ($_ =~ /Unrecognised Resource Keyword/)
-            {
-                $match_found = 1;
-                $match_found_pos = $i;
-                last;
-            } 
-
-            $i++;
-        }
-        
-        if ($match_found)
-        {
-            # insert the patched content to the file
-            splice(@filecontent, $match_found_pos-1, 0, $dependshack);
-            
-            # write the modified array to the file
-            write_file_from_array($mmppmpath, @filecontent);
-        
-            print "Mmp.pm patched with DEPENDS keyword hack.\n";
-        }
-        else
-        {
-            print "ERROR: Unable to find correct place from $mmppmpath for patching!\n";
-            print "Your SDK environment probably is not supported by this script!\n";
-            exit(2);    
-        }
-    }
-
-    # check if SMPSAFE keyword already exists in the file
-    if (string_exists_in_file($mmppmpath, "SMPSAFE"))
-    {
-        print "The SDK can already handle SMPSAFE keyword in a MMP file.\n";        
-    }
-    else
-    {
-        # read content of the mmp.pm file
-        my @filecontent = read_file_to_array($mmppmpath);
-        
-        my $match_found = 0;
-        my $i = 0;
-        my $match_found_pos = 0;
-        
-        # loop through the array to find the correct place
-        foreach (@filecontent)
-        {
-            if ($_ =~ /Unrecognised Keyword/)
-            {
-                $match_found = 1;
-                $match_found_pos = $i;
-                last;
-            } 
-
-            $i++;
-        }
-        
-        if ($match_found)
-        {
-            # insert the patched content to the file
-            splice(@filecontent, $match_found_pos, 0, $smpsafehack);
-            
-            # write the modified array to the file
-            write_file_from_array($mmppmpath, @filecontent);
-        
-            print "Mmp.pm patched with SMPSAFE keyword hack.\n";
-        }
-        else
-        {
-            print "ERROR: Unable to find correct place from $mmppmpath for patching!\n";
-            print "Your SDK environment probably is not supported by this script!\n";
-            exit(2);    
-        }
-    }
-}
-else
-{
-    print "WARNING: $mmppmpath not found, this environment is not supported!\n";
-}
-
-
-# check if epoc32\tools\pathutl.pm exists
-if (-e $pathutlpmpath)
-{
-    # check if "sub Path_Norm" already exists in the pathutil.pm file
-    # if it does not exists, then we need to patch prepfile.pm
-    if (string_exists_in_file($pathutlpmpath, "sub Path_Norm"))
-    {
-        print "The SDK is non Symbian OS 9.1, no need to add forward slash hack.\n";        
-    }
-    else
-    {
-        # check if prepfile.pm has already been patched
-        if (string_exists_in_file($prepfilepmpath, "EnvPatcher forwardslash hack"))
-        {        
-            print "The SDK has already been patched with forwardslash hack.\n";         
-        }
-        else
-        {    
-            # read content of the prepfile.pm file
-            my @filecontent = read_file_to_array($prepfilepmpath);  
-    
-            my $match_found = 0;
-            my $i = 0;
-            my $match_found_pos = 0;
-            
-            # loop through the array to find the correct place
-            foreach (@filecontent)
-            {
-                if ($_ =~ /# skip blank lines/)
-                {
-                    $match_found = 1;
-                    $match_found_pos = $i;
-                    last;
-                } 
-    
-                $i++;
-            }
-            
-            if ($match_found)
-            {
-                # insert the patched content to the file
-                splice(@filecontent, $match_found_pos+6, 0, $forwardslashhack);
-                
-                # write the modified array to the file
-                write_file_from_array($prepfilepmpath, @filecontent);
-            
-                print "Prepfile.pm patched with forward slash hack.\n";
-            }
-            else
-            {
-                print "ERROR: Unable to find correct place from $prepfilepmpath for patching!\n";
-                print "Your SDK environment probably is not supported by this script!\n";
-                exit(2);    
-            }
-        }
-    }    
-}
-else
-{
-    print "WARNING: $pathutlpmpath not found, this environment is not supported!\n";
-}
- 
- 
- 
-# checks if string exists in the file    
-sub string_exists_in_file
-{
-    my $filepath = $_[0];
-    my $findstring = $_[1];
-    my $match_found = 0;     
-
-    open(FILE, "<", $filepath) or die "Failed to open $filepath for reading!";
-
-    # loop through the file for occurances
-    while (<FILE>)
-    {
-        if ($_ =~ /$findstring/)
-        {
-            $match_found = 1;
-            last;
-        } 
-    }
-
-    close FILE;
-    
-    return $match_found;
-}
-
-
-# reads lines from a file to an array    
-sub read_file_to_array
-{
-    my $filepath = $_[0];
-
-    open(FILE, "<", $filepath) or die "Failed to open $filepath for reading!";
-    my @data = <FILE>;
-    close FILE;
-    
-    return(@data);
-}
-
-
-# writes lines from an array to a file
-sub write_file_from_array
-{
-    my ($filepath, @data) = @_;
-    
-    # take a backup of the file
-    copy ($filepath, $filepath."EnvPatcher") or die "Cannot take backup of $filepath to $filepath.EnvPatcher";
-        
-    open(FILE, ">", $filepath) or die "Failed to open $filepath for writing!";
-
-    # write the array to file
-    foreach my $line (@data)
-    {
-        print FILE "$line";
-    }
-
-    close FILE;
-}
-
-sub create_default_platform_paths_hrh
-{
-    # the file does not exist, so create the missing file
-    open(FILE, ">", $platformpathspath) or die "Failed to open $platformpathspath for writing!\n";
-    
-    print FILE <<ENDOFTHEFILE;
-#ifndef PLATFORM_PATHS_HRH
-#define PLATFORM_PATHS_HRH
-
-/**
-* ---------------------------------------
-* Location, where the applications layer specific public headers should be exported
-* See usage on top of this hrh-file.
-* ---------------------------------------
-*/
-#define APP_LAYER_SDK_EXPORT_PATH(exported) /epoc32/include/##exported
-#define APP_LAYER_PUBLIC_EXPORT_PATH(exported) /epoc32/include/##exported
-
-/**
-* ---------------------------------------
-* Location, where the applications layer specific platform headers should be exported
-* See usage on top of this hrh-file.
-* ---------------------------------------
-*/
-#define APP_LAYER_DOMAIN_EXPORT_PATH(exported) /epoc32/include/##exported
-#define APP_LAYER_PLATFORM_EXPORT_PATH(exported) /epoc32/include/##exported
-
-/**
-* ---------------------------------------
-* Location, where the middleware layer specific public headers should be exported
-* See usage on top of this hrh-file.
-* ---------------------------------------
-*/
-#define MW_LAYER_SDK_EXPORT_PATH(exported) /epoc32/include/##exported
-#define MW_LAYER_PUBLIC_EXPORT_PATH(exported) /epoc32/include/##exported
-
-/**
-* ---------------------------------------
-* Location, where the middleware layer specific platform headers should be exported
-* ---------------------------------------
-*/
-#define MW_LAYER_DOMAIN_EXPORT_PATH(exported) /epoc32/include/##exported
-#define MW_LAYER_PLATFORM_EXPORT_PATH(exported) /epoc32/include/##exported
-
-/**
-* ---------------------------------------
-* Location, where the os layer specific public headers should be exported
-* ---------------------------------------
-*/
-#define  OSEXT_LAYER_SDK_EXPORT_PATH(exported) /epoc32/include/##exported
-#define  OS_LAYER_PUBLIC_EXPORT_PATH(exported) /epoc32/include/##exported
-
-/**
-* ---------------------------------------
-* Location, where the os specific platform headers should be exported
-* ---------------------------------------
-*/
-#define OSEXT_LAYER_DOMAIN_EXPORT_PATH(exported) /epoc32/include/##exported
-#define OS_LAYER_PLATFORM_EXPORT_PATH(exported) /epoc32/include/##exported
-
-/**
-* ---------------------------------------
-* Location, where the  cenrep excel sheets should be exported
-* Deprecated: should no longer be used. Kept for compability.
-* ---------------------------------------
-*/
-#define CENREP_XLS_EXPORT_PATH(exported) /epoc32/tools/cenrep/data/src/##exported
-
-/**
-* This define statements defines the SYSTEMINCLUDE-line, which is intended to be 
-* used in the mmp-files that are part of the applications-layer. It includes all 
-* the needed directories from the /epoc32/include, that are valid ones for the 
-* application-layer components. 
-*
-* Applications layer is the last one in the list, since most likely the most of 
-* the headers come from middleware or os-layer  => thus they are first.
-*/
-#define APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem
- 
-/**
-* This define statements defines the SYSTEMINCLUDE-line, which is intended to be
-* used in the mmp-files that are part of the middleware-layer. It includes all 
-* the needed directories from the /epoc32/include, that are valid ones for the 
-* middleware-layer components. 
-*/
-#define MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem
-
-/**
-* This define statements defines the SYSTEMINCLUDE-line, which is intended to be
-* used in the mmp-files that are part of the  osextensions-layer. It includes all
-* the needed directories from the /epoc32/include, that are valid ones for the
-* os-layer components. 
-*/
-#define OS_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem
-
-
-// Below statement is Deprecated and the OS_LAYER_SYSTEMINCLUDE-macro has to be
-// used.
-#define OSEXT_LAYER_SYSTEMINCLUDE OS_LAYER_SYSTEMINCLUDE
-
-/**
-* This define statements defines the SYSTEMINCLUDE-line, which is intended to be
-* used in the mmp-files that are part of the os-layer. This is intended 
-* to be only used by those components which need to use in their mmp-file either
-* kern_ext.mmh or nkern_ext.mmh. Reason is that those
-* 2 files already contain the /epoc32/include  as system include path.
-* 
-*/
-#define OS_LAYER_KERNEL_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/oem
-
-
-// Below statement is Deprecated and the OS_LAYER_KERNEL_SYSTEMINCLUDE-macro 
-// has to be used.
-#define OSEXT_LAYER_KERNEL_SYSTEMINCLUDE OS_LAYER_KERNEL_SYSTEMINCLUDE
-
-/**
-****************************************************************************
-* Definitions that also define the paths to the layer specific source directories.
-****************************************************************************
-*/
-/**
-* The below 3 macros define the paths to the layer-specific source dirs.
-* See usage on top of this hrh-file, these are used the same way as 
-* for instance the OS_LAYER_DOMAIN_EXPORT_PATH
-* Deprecated: is not allowed to be using in Symbian Foundation
-*/
-#define APP_LAYER_SOURCE_PATH(rest)    /s60/app/##rest
-#define MW_LAYER_SOURCE_PATH(rest)     /s60/mw/##rest
-#define OSEXT_LAYER_SOURCE_PATH(rest)  /s60/osext/##rest
-
-/**
-****************************************************************************
-* Definitions to export IBY files to different folders where they will be taken 
-* to ROM image
-****************************************************************************
-*/
-// Following definition is used for exporting tools and stubs IBY files to 
-// Core image.
-#define CORE_IBY_EXPORT_PATH(path,exported)  /epoc32/rom/include/##exported
-
-/**
-* ---------------------------------------
-* Macros for Configuration tool migration. 
-* The below macros define the location under epoc32, where the confml 
-* (Configuration Markup Language) and crml (Central Repository Markup Language) 
-* files should be exported.
-* ---------------------------------------
-*/
-#define CONFML_EXPORT_PATH(file,category)           /epoc32/rom/config/confml_data/##category##/##file
-#define CRML_EXPORT_PATH(file,category)             /epoc32/rom/config/confml_data/##category##/##file
-#define GCFML_EXPORT_PATH(file,category)            /epoc32/rom/config/confml_data/##category##/##file
-#define CONFML_CONFIG_EXPORT_PATH(file,category)    /epoc32/rom/config/confml_data/##category##/config/##file
-
-#define APP_LAYER_CONFML(exported) 	                CONFML_EXPORT_PATH(exported,s60)
-#define APP_LAYER_CRML(exported)                    CRML_EXPORT_PATH(exported,s60)
-#define APP_LAYER_GCFML(exported)                   GCFML_EXPORT_PATH(exported,s60)
-#define APP_LAYER_CONFML_CONFIG(exported)           CONFML_CONFIG_EXPORT_PATH(exported,s60)
-                                                    
-#define MW_LAYER_CONFML(exported)                   CONFML_EXPORT_PATH(exported,s60)
-#define MW_LAYER_CRML(exported)                     CRML_EXPORT_PATH(exported,s60)
-#define MW_LAYER_GCFML(exported)                    GCFML_EXPORT_PATH(exported,s60)
-#define MW_LAYER_CONFML_CONFIG(exported)            CONFML_CONFIG_EXPORT_PATH(exported,s60)
-       
-// Deprecate: Use the OS_LAYER_* macros instead of OSEXT_LAYER_*                                             
-#define OSEXT_LAYER_CONFML(exported)                CONFML_EXPORT_PATH(exported,s60)
-#define OSEXT_LAYER_CRML(exported)                  CRML_EXPORT_PATH(exported,s60)
-#define OSEXT_LAYER_GCFML(exported)                 GCFML_EXPORT_PATH(exported,s60)
-#define OSEXT_LAYER_CONFML_CONFIG(exported)         CONFML_CONFIG_EXPORT_PATH(exported,s60)
-#define OS_LAYER_CONFML(exported)                   CONFML_EXPORT_PATH(exported,s60)
-#define OS_LAYER_CRML(exported)                     CRML_EXPORT_PATH(exported,s60)
-#define OS_LAYER_GCFML(exported)                    GCFML_EXPORT_PATH(exported,s60)
-#define OS_LAYER_CONFML_CONFIG(exported)            CONFML_CONFIG_EXPORT_PATH(exported,s60)
-
-#endif  // end of PLATFORM_PATHS_HRH
-
-ENDOFTHEFILE
-
-    close FILE;    
-}
--- a/analyzetool/envpatcher/ReadMe.txt	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-Environment Patcher v1.0.1
-==========================
-
-Updated: 12th November 2009
-
-
-Introduction:
--------------
-This tool can be used to patch your S60 SDK environment so that the tricks and
-macros introduced in the latest SDKs can be used in a public SDK and older
-OEM releases.
-
-This tool can perform the following tasks:
-- Adds support for forward slashes in paths in bld.inf/.mmp files in S60 3.0 
-- Removes an unncessary warning about DEPENDS and SMPSAFE resource keywords in
-  an .mmp file
-- Creates a missing epoc32\include\platform_paths.hrh file for supporting
-  platform macros introduced since S60 3.2 OEM and Symbian Foundation releases
-- Modifies epoc32\include\platform_paths.hrh for missing macros   
-- Creates a missing epoc32\include\oem directory to suppress a possible warning
-
-
-Usage:
-------
-EnvPatcher.pl <EPOCROOT>
-
-Where EPOCROOT is the path to the root of the SDK, for example:
-  EnvPatcher.pl c:\Symbian\9.1\S60_3rd_MR
-  EnvPatcher.pl z:\
-
-
-Requirements:
--------------
-- S60 SDK (public or OEM), version 3.0 or newer
-- Perl 5.6.1 or newer
-
-
-
-
-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".
--- a/analyzetool/group/ReleaseNotes_AnalyzeTool.txt	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-===============================================================================
-
-RELEASE NOTES - ANALYZETOOL v1.9.1
-RELEASED 29th April 2010
-
-SUPPORTS SYMBIAN^1+
-
-===============================================================================
-
-Product Description:
-====================
-AnalyzeTool is a dynamic test tool that is used for testing Symbian software
-for memory and resource leaks and pinpointing the leaks from the source code.
-
-Main Features:
-==============
-- Pinpoints memoryleaks from target hardware and emulator to source code lines
-- Discovers resource leaks from processes
-- Command line interface and Carbide.c++ Extension
-
-===============================================================================
-
-What's New in v1.9.1
-====================
-- Change: Removed Avkon and Console UI's to simplify the maintenance of the
-  tool
-- Change: Middleware layer dependencies removed so AnalyzeTool can be now used
-  also in OS layer builds
-- Fix: Move all binaries to ROM instead of ROFS to avoid ROM build
-  dependencies issues in hooked components
-
-===============================================================================
-
-Installation Notes:
-===================
-AnalyzeTool is typically preinstalled on ROM. If not, it can be added to the
-ROM with the .iby file. Alternatively, the .sis file can be found under the sis-
-directory, but the user need to sign it with their own developer certificate.
-In Nokia R&D environment, you can use directly the R&D-signed .sis file under the
-internal\sis directory.
-
-When signing with own developer certificate, the following capabilities are
-needed:
-  ReadDeviceData
-  WriteDeviceData
-  DiskAdmin
-  AllFiles
-  SwEvent
-  NetworkServices
-  LocalServices
-  ReadUserData
-  WriteUserData
-  Location
-  UserEnvironment
-  CommDD
-  PowerMgmt
-  MultimediaDD
-  DRM
-  TrustedUI
-  ProtServ
-  NetworkControl
-  SurroundingsDD
-  TCB
-
-When builing AnalyzeTool against S60 3.0 or 3.1, you may need to patch your SDK
-environment first with some fixes. For more information, please refer to the
-instructions under the "envpatcher" directory.
-
-===============================================================================
-
-System Requirements:
-====================
-Basic Requirements:
-- Any S60 3.x device or emulator environment
-
-===============================================================================
-
-Compatibility Issues:
-=====================
-N/A
-
-===============================================================================
-
-Known Issues:
-=============
-- Kernel analysis are not supported.
-
-- When using monitored internal data gathering mode (-mi) and hooked
-  application contains huge amounts of allocations AnalyzeTool? storageserver
-  might run out of memory to store the data. This message "Symbian error code
-  -4" is seen when analyzing the data file with atool.exe. Solution is to use
-  external / monitored external data gathering mode. 
-
-- Switch allocator. AnalyzeTool change the application memory allocator to
-  AnalyzeTool own memory allocator and using the User::SwitchAllocator function
-  can lead to situation where the tested application does not work properly.
-  
-- AnalyzeTool hooked QT applications becomes too slow to run. Use small size
-  call stack(s) and new logging mode (external -e). 
-
-- Stif test case with AnalyzeTool can inform wrong memory leak alert.
-
-- AnalyzeTool overwrites functions TInt User::ProcessCritical(TCritical
-  aCritical) and TInt User::SetProcessCritical(TCritical aCritical), but this
-  works only when the function is called from hooked exe application. So if
-  setting critical is done from DLL (even if it's hooked with AnalyzeTool) the
-  overwriting does not work and the process stays set critical during the
-  testing.
-
-- If hooked application is closed by calling User::Exit() from DLL instead of
-  .exe application AnalyzeTool reports "abnormal process end" and can't report
-  proper memory leaks.
- 
-===============================================================================
-
-Version History:
-================
-
-Version 1.9.0 - 8th April 2010
-==============================
-- Feature: Remove false positive memory leaks with better handling of global
-  variables
-- Feature: Automatic check of correct version of dbghelp.dll for better
-  emulator support
-- Change: HTI support removed
-- Fix: SBSVS variant compilation didn't work
-
-===============================================================================
-
-Copyright (c) 2010 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".
--- a/analyzetool/group/atool_stub_sis.mk	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +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:  Stub sis makefile for Configuration UI.
-#
-
-TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install
-
-SISNAME=analyzeTool_stub
-PKGNAME=analyzeTool_stub
-
-$(TARGETDIR) :
-	@perl -S emkdir.pl "$(TARGETDIR)"
-
-do_nothing :
-	rem do_nothing
-
-SISFILE=$(TARGETDIR)\$(SISNAME).sis
-
-$(SISFILE) : ..\sis\$(PKGNAME).pkg
-	makesis -s $? $@ 
-
-#
-# The targets invoked by bld...
-#
-
-MAKMAKE : do_nothing
-
-RESOURCE : do_nothing
-
-SAVESPACE : do_nothing
-
-BLD : do_nothing
-
-FREEZE : do_nothing
-
-LIB : do_nothing
-
-CLEANLIB : do_nothing
-
-FINAL : $(TARGETDIR) $(SISFILE)
-
-CLEAN : 
-	-erase $(SISFILE)
-
-RELEASABLES : 
-	@echo $(SISFILE)
\ No newline at end of file
--- a/analyzetool/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +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 <platform_paths.hrh>
-
-
-#include "../commandlineengine/group/bld.inf"
-#include "../staticlib/group/bld.inf"
-#include "../storageserver/group/bld.inf"
-#include "../kerneleventhandler/group/bld.inf"
-#include "../analyzetoolcleaner/group/bld.inf"
-#include "../dynamicmemoryhook/group/bld.inf"
-
-PRJ_EXPORTS
-//../rom/analyzetool.iby                          CORE_IBY_EXPORT_PATH(tools,analyzetool.iby)
-../rom/analyzetool_rom.iby                      CORE_IBY_EXPORT_PATH(tools/rom,analyzetool_rom.iby)
-
-/*
-PRJ_MMPFILES
-#ifndef SBSV2
-  #ifdef MARM
-    gnumakefile atool_stub_sis.mk
-  #endif
-#endif
-
-PRJ_EXTENSIONS
-#ifdef SBSV2
-  #ifdef MARM
-     START EXTENSION app-services/buildstubsis
-     OPTION SRCDIR ../sis
-     OPTION SISNAME analyzeTool_stub
-     END
-  #endif
-#endif
-*/  
\ No newline at end of file
--- a/analyzetool/inc/atlog.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +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:  Definitions of logging macros for Analyze Tool S60 modules.
-*
-*/
-
-#ifndef __ATLOG_H__
-#define __ATLOG_H__
-
-#ifdef _DEBUG
-//To enable/disable logging uncomment/comment the next line
-// #define LOGGING_ENABLED  //Enable logging
-//Uncomment next to enable logging only LOGSTR1 lines
-// #define LOGGING_ENABLED_FAST //Logging only function names
-
-//Disable next to use file logging
- #define USE_RDEBUG
-#endif
-
-//Do not alter the code below this
-
-#ifdef __KERNEL_MODE__
-
- #ifdef LOGGING_ENABLED
-  #include <kernel.h> 
-  #define LOGSTR1( AAA ) 			{ Kern::Printf( AAA ); }
-  #define LOGSTR2( AAA, BBB ) 			{ Kern::Printf( AAA, BBB ); }
- #else
-  #define LOGSTR1( AAA )
-  #define LOGSTR2( AAA, BBB )
- #endif
-
-#else // #ifdef __KERNEL_MODE__
-
- #ifdef LOGGING_ENABLED
-
-//  INCLUDES
-  #include <flogger.h>
-  #ifdef USE_RDEBUG
-   #include <e32svr.h>
-  #endif
-
-// CONSTANTS
-  _LIT( KAtLoggingFolder, "atlog" );
-  _LIT( KAtLoggingFile  , "LOG.TXT" );
-  #define ONE_SPACE_MARGIN	_S(" ")
-
-// ---------------------------------------------------------------------------------
-// Internal MACROS. Do not call these directly, use the External MACROS instead
-// ---------------------------------------------------------------------------------
-
-  #ifdef LOGGING_ENABLED_FAST
-
-   #ifdef USE_RDEBUG
-    #define INTERNAL_LOGSTR1( AAA )				{ _LIT( logdes, AAA ); RDebug::Print( logdes() ); }
-   #else  // RFileLogger is used
-    #define INTERNAL_LOGSTR1( AAA )				{ _LIT( logdes, AAA ); RFileLogger::Write( KAtLoggingFolder(), KAtLoggingFile(), EFileLoggingModeAppend, logdes() ); }
-   #endif // USE_RDEBUG
-   #define INTERNAL_LOGSTR2( AAA, BBB )
-   #define INTERNAL_LOGSTR3( AAA, BBB, CCC )
-   #define INTERNAL_LOGMEM
-   #define INTERNAL_LOG( AAA )
-
-  #else
-  
-   #ifdef USE_RDEBUG
-    #define INTERNAL_LOGDESC8( AAA )				{ TBuf<100> tmp; if( sizeof( AAA ) < 100 ) tmp.Copy( AAA ); RDebug::Print( tmp );}
-    #define INTERNAL_LOGSTR1( AAA )				{ _LIT( logdes, AAA ); RDebug::Print( logdes() ); }
-    #define INTERNAL_LOGSTR2( AAA, BBB )			{ _LIT( logdes, AAA ); RDebug::Print( TRefByValue<const TDesC>( logdes()), BBB ); }
-    #define INTERNAL_LOGSTR3( AAA, BBB, CCC )	{ _LIT( logdes, AAA ); RDebug::Print( TRefByValue<const TDesC>(logdes()), BBB, CCC ); }
-    #define INTERNAL_LOGMEM						{ _LIT( logdes, "Heap size: %i" );  TBuf<50> buf; TInt a; User::AllocSize( a ); buf.Format( logdes, a ); RDebug::Print( buf ); }
-    #define INTERNAL_LOG( AAA )					AAA
-   #else  // RFileLogger is used
-    #define INTERNAL_LOGSTR1( AAA )				{ _LIT( logdes, AAA ); RFileLogger::Write( KAtLoggingFolder(), KAtLoggingFile(), EFileLoggingModeAppend, logdes() ); }
-    #define INTERNAL_LOGSTR2( AAA, BBB ) 		{ _LIT( logdes, AAA ); RFileLogger::WriteFormat( KAtLoggingFolder(), KAtLoggingFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( logdes()), BBB ); }
-    #define INTERNAL_LOGSTR3( AAA, BBB, CCC) 	{ _LIT( logdes, AAA ); RFileLogger::WriteFormat( KAtLoggingFolder(), KAtLoggingFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>(logdes()), BBB, CCC ); }
-    #define INTERNAL_LOGMEM 					{ _LIT( logdes, "Heap size: %i" ); TMemoryInfoV1Buf info; UserHal::MemoryInfo(info); TInt freeMemory = info().iFreeRamInBytes; TBuf<50> buf; buf.Format( logdes, freeMemory ); RFileLogger::WriteFormat( KAtLoggingFolder(), KAtLoggingFile(), EFileLoggingModeAppend, buf ); }
-    #define INTERNAL_LOG( AAA )					AAA
-   #endif // USE_RDEBUG
-
-  #endif
-
- #else
-
-  #define INTERNAL_LOGSTR1( AAA )
-  #define INTERNAL_LOGSTR2( AAA, BBB )
-  #define INTERNAL_LOGSTR3( AAA, BBB, CCC )
-  #define INTERNAL_LOGMEM
-  #define INTERNAL_LOG( AAA )
-
- #endif
-
-// ---------------------------------------------------------------------------------
-// External MACROS. Use these in code
-// ---------------------------------------------------------------------------------
-// Logging of string
-// i.e.: LOGSTR1( "Whoo-haa!" );
- #define LOGSTR1( AAA ) { INTERNAL_LOGSTR1( AAA ); }
-
-// Logging of string + integer value
-// i.e.: LOGSTR2( "CHttpd status %i:", iStatus );
- #define LOGSTR2( AAA, BBB ) { INTERNAL_LOGSTR2( AAA, BBB ); }
-
-// Logging of descriptor + 2 integers
-// i.e.: LOGSTR3( "Jippii %i %i", val1, val2 );
- #define LOGSTR3( AAA, BBB, CCC ) { INTERNAL_LOGSTR3( AAA, BBB, CCC ); }
-
-// Log heap size
- #define LOGMEM         { INTERNAL_LOGMEM }
-
-// Logging variable operations  
- #define LOG( AAA )     INTERNAL_LOG( AAA )
-
-#endif // #ifdef __KERNEL_MODE__
-
-#endif // __ATLOG_H__
-// End of File
--- a/analyzetool/kerneleventhandler/group/atoolkerneleventhandler.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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:  The .mmp file for the AToolKernelEventHandler
-*
-*/
-
-#include <platform_paths.hrh>
-#include <kernel/kern_ext.mmh>
-#include "../../symbian_version.hrh"
-
-TARGET	     	atoolkerneleventhandler.ldd
-TARGETTYPE   	ldd
-CAPABILITY		ALL
-
-SMPSAFE
-
-USERINCLUDE   	../inc
-USERINCLUDE   	../../inc
-
-OS_LAYER_KERNEL_SYSTEMINCLUDE
-
-SOURCEPATH    ../src
-
-SOURCE        analyzetoolchannel.cpp
-SOURCE        analyzetooldevice.cpp
-SOURCE        analyzetooleventhandler.cpp
-
-LIBRARY       flogger.lib
-#ifdef WINSCW
-LIBRARY       emulator.lib
-	start wins
-	win32_headers
-	end
-#endif // WINSCW
-
-#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 ) || defined(BSW_FLEXIBLE_MEMORY_MODEL)
-MACRO	MCL_ROBJECTIX
-#endif
-
-// End of File
--- a/analyzetool/kerneleventhandler/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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 <platform_paths.hrh>
-
-PRJ_PLATFORMS
-ARMV5 WINSCW
-
-PRJ_EXPORTS
-../inc/analyzetool.h OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/analyzetool.h)
-../inc/atcommon.h OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/atcommon.h)
-../inc/analyzetool.inl OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/analyzetool.inl)
-../inc/analyzetooltraceconstants.h OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/analyzetooltraceconstants.h)
-
-PRJ_MMPFILES
-atoolkerneleventhandler.mmp
-
-PRJ_TESTMMPFILES
-../internal/tsrc/group/analyzetooldevicedrivertest.mmp
-
-
--- a/analyzetool/kerneleventhandler/inc/analyzetool.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,325 +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:  Declaration of the class RAnalyzeTool.
-*
-*/
-
-
-#ifndef __ANALYZETOOL_H__
-#define __ANALYZETOOL_H__
-
-// INCLUDES
-#include <e32cmn.h>
-
-//Version information for command line engine.
-//Tells the version of AT core componenets.
-//ANALYZETOOL_CORE_VERSION_FOR_CLE 1.9.1
-
-// CONSTANTS
-inline TVersion KAnalyzeToolLddVersion() { return TVersion(1, 0, 1); }
-
-/* The name of the analyze tool device driver*/
-_LIT( KAnalyzeToolLddName, "AToolKernelEventHandler" );
-
-/* The priority of AnalyzeTool Dfc */
-const TInt KAnalyzeToolThreadPriority = 27;
-
-/* The name of the AnalyzeTool DFC */
-_LIT8( KAnalyzeToolThreadName, "AnalyzeToolThreadDfc" );
-
-/* The panic literal */
-_LIT( KClientPanic, "AnalyzeTool" );
-
-//const TInt KATMaxCallstackLength = 20;
-
-/* The device handler panic codes */
-enum TPanic
-	{
-	EPanicRequestPending,
-	EPanicNoRequestPending,
-	EPanicUnsupportedRequest
-	};
-
-// Size of following must be multiple of 4 bytes.
-
-class TMainThreadParams
-	{
-	public:
-		RAllocator* iAllocator;
-		TBool       iAlone;
-		TUint       iProcessId;
-	};
-typedef TPckgBuf<TMainThreadParams> TMainThreadParamsBuf;
-
-class TLibraryInfo
-	{
-	public:
-		TBuf8<KMaxLibraryName> iLibraryName;
-		TLinAddr  iRunAddress;
-		TUint32   iSize;
-		TInt      iIndex;
-		TUint     iProcessId;
-	};
-
-typedef TPckgBuf<TLibraryInfo> TLibraryInfoBuf;
-
-class TCodesegInfo
-	{
-	public:
-		TBuf8<KMaxLibraryName> iFullName;
-		TLinAddr iRunAddress;
-		TUint32  iSize;
-		TInt  iIndex;
-		TUint iProcessId;
-		TInt  iCodesegIndex; 
-		TLinAddr iFileEntryPoint;
-		TInt     iFuntionCount;
-		TLibraryFunction iFirstFunction;
-		TModuleMemoryInfo iMemoryInfo;
-	};
-
-typedef TPckgBuf<TCodesegInfo> TCodesegInfoBuf;
-
-class TThreadParams
-	{		
-	public:
-	    TLinAddr iStackAddress;
-	    TInt iStackSize;
-	    TUint iThreadId;
-	};
-
-typedef TPckgBuf<TThreadParams> TThreadParamsBuf;
-
-class TProcessIdentityParams
-	{		
-	public:
-		TBuf8<KMaxProcessName> iProcessName;
-		TInt iDynamicCount;
-		TInt iCodesegCount;
-		TUint iProcessId;
-		TUint iThreadId;
-	    TLinAddr iStackAddress;
-	    TInt iStackSize;
-	};
-
-typedef TPckgBuf<TProcessIdentityParams> TProcessIdentityParamsBuf;
-
-class TLibraryEventInfo
-	{
-	public:
-		enum TLibraryEvent
-			{ 
-			ELibraryAdded = 0, 
-			ELibraryRemoved,
-			EKillThread 
-			};
-					
-	public:
-		TUint iProcessId;
-		TBuf8<KMaxLibraryName> iLibraryName;
-		TLinAddr iRunAddress;
-		TUint32 iSize;
-		TLibraryEvent iEventType;
-		TUint iThreadId;
-	};
-
-typedef TPckgBuf<TLibraryEventInfo> TLibraryEventInfoBuf;
-
-class TProcessHandleInfo
-	{
-	public:
-		TInt     iProcessHandleCount;
-		TInt     iThreadHandleCount;
-		TInt     iIndex;
-		TInt     iThreadCount;
-		TLinAddr iUserStackRunAddress;
-		TInt     iUserStackSize;
-		TUint    iProcessId;
-	};
-
-typedef TPckgBuf<TProcessHandleInfo> TProcessHandleInfoBuf;
-
-/**
-*  A class for particular process's current handle count
-*/
-class TATProcessHandles
-    {
-    public:
-    
-        /** The ID of the process. */
-        TUint iProcessId;
-        
-        /** The number of current handles in the library. */
-        TInt iCurrentHandleCount;
-    };
-
-typedef TPckgBuf<TATProcessHandles> TATProcessHandlesBuf;
-
-class TClientCount
-    {
-    public:
-    
-        /** The count of clients */
-        TInt iClientCount;     
-    };
-
-typedef TPckgBuf<TClientCount> TClientCountBuf;
-
-class TATMemoryModel
-    {
-    public :
-        /* Memory model*/
-        TUint32 iMemoryModel;
-    };
-typedef TPckgBuf<TATMemoryModel> TATMemoryModelBuf;
-
-// CLASS DECLARATION
-
-/**
-*  The user-side handle to a logical channel which provides functions to 
-*  open a channel and to make requests to a analyze tool device driver. 
-*/
-
-class RAnalyzeTool : public RBusLogicalChannel
-	{
-	
-	public:
-		
-	/** Enumeration of supported functions */
-	enum TBasicAnalyzerControl
-		{
-		EGetProcessInfo = 0, /* The process information */
-		EGetCodesegInfo,	 /* The codesegment information */
-		EGetLibraryInfo,     /* The library information */
-		EGetDynamicInfo,	 /* The count of dynamic code in the process */
-		ELibraryEvent,       /* Subscribe events from library events */
-		ECancelLibraryEvent, /* Cancel subscribetion of library events */
-		ECurrentClientCount,  /* The count of clients in device driver */
-		EMainThreadAlloctor,
-		EThreadStack,
-		EGetProcessHandle,	/* Gets process global handles info*/
-		EGetCurrentHandles, /* Get a process's current handle count */
-		EGetMemoryModel
-		};
-			
-#ifndef __KERNEL_MODE__
-
-        /**
-        * Opens a handle to a logical channel.
-        * @return TInt Returns KErrNone, if successful or otherwise 
-        		  one of the other system-wide error codes
-        */
-		inline TInt Open();
-
-        /**
-        * Acquires process information.
-        * @param aProcessIdentityParams The process information which 
-        								is filled by the device driver
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		inline TInt GetProcessInfo( 
-				TProcessIdentityParamsBuf& aProcessIdentityParams );
-
-        /**
-        * Acquires codeseg information.
-        * @param aCodesegInfo The codeseg information which 
-        					  is filled by the device driver
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		inline TInt GetCodesegInfo( TCodesegInfoBuf& aCodesegInfo );
-		
-        /**
-        * Acquires library information.
-        * @param aLibraryInfo The library information which 
-        					  is filled by the device driver
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		inline TInt GetLibraryInfo( TLibraryInfoBuf& aLibraryInfo );
-				
-        /**
-        * Subscribes library event.
-        * @param aStatus The request status object for this request. 
-        * @param aLibraryInfo The library information which 
-        					  is filled by the device driver
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		inline void LibraryEvent( TRequestStatus& aStatus, 
-		                          TLibraryEventInfo& aLibraryInfo );
-		
-        /**
-        * Cancels subscribetion of the library event.
-        */
-		inline void CancelLibraryEvent();
-
-        /**
-        * Acquires device driver current client count.
-        * @param aClientCount A reference to TInt which is 
-        				      updated by the device driver.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		inline TInt ClientCount( TClientCountBuf& aClientCount );
-		
-        /**
-        * Acquires process main thread RAllocator
-        * @param aMainThreadParams The main thread information which 
-        					        is filled by the device driver
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */	
-		inline TInt MainThreadAlloctor( TMainThreadParamsBuf& aMainThreadParams );
-		
-		/**
-		* Acquires main thread stack address.
-		* @param aThreadStack Pointer to the TThreadParams object.
-		* @return TInt Returns KErrNone, if successful
-					   otherwise one of the other system-wide error codes
-		*/
-		inline TInt ThreadStack( TThreadParamsBuf& aThreadStack );
-
-        /**
-        * Acquires information about process global handles.
-        * @param aProcessHandleInfo Pointer to the TProcessHandleInfo object.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		inline TInt GetProcessHandleInfo( TProcessHandleInfoBuf& aProcessHandleInfo );
-
-        /**
-        * Acquires a process's current handle count.
-        * @param aProcessHandles Pointer to the TATProcessHandles object.
-        * @return TInt Returns KErrNone, if successful
-                       otherwise one of the other system-wide error codes
-        */
-        inline TInt GetCurrentHandleCount( TATProcessHandlesBuf& aProcessHandles );
-
-        /**
-         * Acquires memory model system uses.
-         * @param aMemoryModel pointer to the TATMemoryModelBuf object.
-         */
-        inline TInt GetMemoryModel( TATMemoryModelBuf& aMemoryModel );
-        
-#endif // #ifndef __KERNEL_MODE__
-	};
-
-// INLINES
-#include <analyzetool/analyzetool.inl>
-
-#endif // #ifndef __ANALYZETOOL_H__
-
-// End of File
--- a/analyzetool/kerneleventhandler/inc/analyzetool.inl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +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:  Definitions for inline methods of the class RAnalyzeTool.
-*
-*/
-
-
-#ifndef __ANALYZETOOL_INL
-#define __ANALYZETOOL_INL
-
-#ifndef __KERNEL_MODE__
-
-// ----------------------------------------------------------------------------
-// RAnalyzeTool::Open()
-// Opens a handle to a analyze tool device driver
-// ----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeTool::Open()
-	{
-	return DoCreate( KAnalyzeToolLddName, 
-					 KAnalyzeToolLddVersion(), 
-					 KNullUnit, 
-					 NULL, 
-					 NULL, 
-					 EOwnerProcess );
-	}
-
-// ----------------------------------------------------------------------------
-// RAnalyzeTool::GetProcessInfo()
-// Acquires process information.
-// ----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeTool::GetProcessInfo( 
-		TProcessIdentityParamsBuf& aProcessIdentityParams )
-	{
-	return DoControl( EGetProcessInfo, &aProcessIdentityParams, NULL );
-	}
-
-// ----------------------------------------------------------------------------
-// RAnalyzeTool::GetCodesegInfo()
-// Acquires codeseg information.
-// ----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeTool::GetCodesegInfo( TCodesegInfoBuf& aCodesegInfo )
-	{
-	return DoControl( EGetCodesegInfo, &aCodesegInfo, NULL );
-	}
-
-// ----------------------------------------------------------------------------
-// RAnalyzeTool::GetLibraryInfo()
-// Symbian 2nd phase constructor can leave.
-// ----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeTool::GetLibraryInfo( TLibraryInfoBuf& aLibraryinfo )
-	{
-	return DoControl( EGetLibraryInfo, &aLibraryinfo, NULL );
-	}
-
-// ----------------------------------------------------------------------------
-// RAnalyzeTool::LibraryEvent()
-// Subscribes library event.
-// ----------------------------------------------------------------------------
-//
-inline void RAnalyzeTool::LibraryEvent( TRequestStatus& aStatus,
-	TLibraryEventInfo& aLibInfo )
-	{
-	return DoRequest( ELibraryEvent, aStatus, (TAny*)&aLibInfo );
-	}
-
-// ----------------------------------------------------------------------------
-// RAnalyzeTool::CancelLibraryEvent()
-// Cancels subscribetion of the library event.
-// ----------------------------------------------------------------------------
-//
-inline void RAnalyzeTool::CancelLibraryEvent()
-	{
-	DoControl( ECancelLibraryEvent, NULL, NULL);
-	}
-
-// ----------------------------------------------------------------------------
-// RAnalyzeTool::ClientCount()
-// Acquires the count of device driver current users
-// ----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeTool::ClientCount( TClientCountBuf& aClientCount )
-	{
-	return DoControl( ECurrentClientCount, &aClientCount, NULL );
-	}
-
-// ----------------------------------------------------------------------------
-// RAnalyzeTool::MainThreadAlloctor()
-// Acquires information about process main thread
-// ----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeTool::MainThreadAlloctor( 
-	        TMainThreadParamsBuf& aMainThreadParams )
-    {
-    return DoControl( EMainThreadAlloctor, &aMainThreadParams, NULL );
-    }
-
-// ----------------------------------------------------------------------------
-// RAnalyzeTool::ThreadStack()
-// Acquires main thread stack address.
-// ----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeTool::ThreadStack( TThreadParamsBuf& aThreadStack )
-    {
-    return DoControl( EThreadStack, &aThreadStack, NULL );
-    }
-
-// ----------------------------------------------------------------------------
-// RAnalyzeTool::GetProcessHandleInfo()
-// Acquires information about process handles
-// ----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeTool::GetProcessHandleInfo( 
-		    TProcessHandleInfoBuf& aProcessHandleInfo )
-    {
-    return DoControl( EGetProcessHandle, &aProcessHandleInfo, NULL );
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::GetCurrentHandleCount()
-// Acquires a process's current handle count
-// -----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeTool::GetCurrentHandleCount( 
-		    TATProcessHandlesBuf& aProcessHandles )
-    {
-    return DoControl( EGetCurrentHandles, &aProcessHandles, NULL );
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::GetMemoryModel()
-// Acquires memory model system uses.
-// -----------------------------------------------------------------------------
-//
-inline TInt RAnalyzeTool::GetMemoryModel( 
-            TATMemoryModelBuf& aMemoryModel )
-    {
-    return DoControl( EGetMemoryModel, &aMemoryModel, NULL );
-    }
-
-#endif // #ifndef __KERNEL_MODE__
-
-#endif // __ANALYZETOOL_INL
-
-// End of file
--- a/analyzetool/kerneleventhandler/inc/analyzetoolchannel.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +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:  Declaration of the class DAnalyzeToolChannel
-*
-*/
-
-
-#ifndef __ANALYZETOOLCHANNEL_H__
-#define __ANALYZETOOLCHANNEL_H__
-
-// INCLUDES
-#include <analyzetool/analyzetool.h>
-#include <kernel/kernel.h>
-#ifdef __WINSCW__
-#include <memmodel/emul/win32/memmodel.h>
-#endif // __WINSCW__
-
-// FORWARD DECLARATIONS
-class DAnalyzeToolEventHandler;
-
-// CLASS DECLARATION
-
-/**
-* The implementation of the abstract base class for a logical channel.
-*/
-class DAnalyzeToolChannel : public DLogicalChannel
-	{
-	public:
-		
-        /**
-        * C++ default constructor.
-        */
-		DAnalyzeToolChannel();
-		
-        /**
-        * Destructor.
-        */
-		~DAnalyzeToolChannel();
-		
-	protected: // from DLogicalChannel
-		
-        /**
-        * Creates the logical channel.
-        * @param aUnit A unit of the device.
-        * @param anInfo A pointer to an explicit 8-bit descriptor containing 
-        			    extra information for the physical device
-        * @param aVer The required version of the logical device
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		virtual TInt DoCreate( TInt aUnit, 
-							   const TDesC8* anInfo, 
-							   const TVersion &aVer );
-    
-        /**
-        * Handles a client request.
-        * @param aFunction The requested function.
-        * @param a1 A 32-bit value passed to the kernel-side. Its meaning 
-        			  depends on the device driver requirements
-        * @param a2 A 32-bit value passed to the kernel-side. Its meaning
-        			  depends on the device driver requirements
-        * @param aMessage Reference to received thread message.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		virtual TInt DoControl( TInt aFunction, TAny* a1, TAny* a2, TThreadMessage& aMessage );	
-		
-		/**
-		* Processes a message for this logical channel.
-		* This function is called in the context of a DFC thread.
-		* @param aMsg  The message to process.
-		*/
-		virtual void HandleMsg( TMessageBase* aMsg );
-		
-        /**
-        * Handles a client asynchronous request.
-        * @param aFunction The requested function.
-        * @param aStatus Pointer to client TRequestStatus.
-        * @param a1 A 32-bit value passed to the kernel-side. Its meaning 
-        			  depends on the device driver requirements
-        * @param a2 A 32-bit value passed to the kernel-side. Its meaning
-        			  depends on the device driver requirements
-        * @param aMessage Reference to received thread message.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		virtual TInt DoRequest( TInt aFunction, 
-								TRequestStatus* aStatus, 
-								TAny* a1, 
-								TAny* a2, 
-								TThreadMessage& aMessage );
-		
-        /**
-        * Cancels outstanding asynchronous request.
-        */
-		virtual void DoCancel();
-
-	private:
-		
-        /**
-        * Acquires current process information
-        * @param aProcessInfo Pointer to the TProcessIdentityParams object.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		TInt GetProcessInfo( TAny* aProcessInfo, TThreadMessage& aMessage );
-		
-        /**
-        * Acquires codeseg information.
-        * @param aCodesegInfo Pointer to the TCodesegInfo object.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		TInt GetCodesegInfo( TAny* aCodesegInfo, TThreadMessage& aMessage );
-		
-        /**
-        * Acquires library information.
-        * @param aLibraryInfo Pointer to the TLibraryInfo object.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		TInt GetLibraryInfo( TAny* aLibraryInfo, TThreadMessage& aMessage );
-	
-        /**
-        * Acquires information about process main thread RAllocator.
-        * @param aMainThreadParams Pointer to the TMainThreadParams object.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		TInt MainThreadAllocator( TAny* aMainThreadParams, 
-								  TThreadMessage& aMessage );
-		
-		/**
-		* Acquires main thread stack address.
-		* @param aThreadStack Pointer to the TThreadParams object.
-		* @return TInt Returns KErrNone, if successful
-					   otherwise one of the other system-wide error codes
-		*/
-		TInt ThreadStack( TAny* aThreadStack, 
-						  TThreadMessage& aMessage );
-
-        /**
-        * Acquires information about process global handles.
-        * @param aProcessHandleInfo Pointer to the TProcessHandleInfo object.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		TInt GetProcessHandleInfo( TAny* aProcessHandleInfo, 
-								   TThreadMessage& aMessage );
-
-        /**
-        * Acquires a process's current handle count.
-        * @param aProcessHandles Pointer to the TATProcessHandles object.
-        * @return TInt Returns KErrNone, if successful
-                       otherwise one of the other system-wide error codes
-        */
-        TInt GetCurrentHandleCount( TAny* aProcessHandles, 
-									TThreadMessage& aMessage );
-        
-        /**
-		* Acquires the count of current device driver users.
-		* @param aClientCount A reference to TInt variable
-		* @return TInt Returns KErrNone, if successful
-        *               otherwise one of the other system-wide error codes
-		*/			
-        TInt ClientCount( TAny* aClientCount, 
-						  TThreadMessage& aMessage );
-		
-        /**
-         * Acquires memory model system uses.
-         * @return TInt Returns KErrNone, if successful
-         *              otherwise one of the other system-wide error codes
-         */
-        TInt GetMemoryModel( TAny* aMemoryModel,
-                            TThreadMessage& aMessage );
-        
-        #ifdef __WINSCW__
-        /**
-		* Gets module dependencies
-		* @param aModule Module handle
-		*/
-        void GetModuleDependencies( HMODULE aModule );
-        #endif // __WINSCW__
-        
-	private: //Member variables
-		
-		/* Handler which receives kernel events */
-		DAnalyzeToolEventHandler* iEventHandler;
-		
-		#ifdef __WINSCW__
-		/* Code segment array */
-		RArray<TCodesegInfo> iCodeSeg;
-		#endif // __WINSCW__
-		
-		/* A DFC queue for communication */
-		TDynamicDfcQue* iOwnDfcQ;
-
-	};
-
-#endif // #ifndef __ANALYZETOOLCHANNEL_H__
-
-// End of File
--- a/analyzetool/kerneleventhandler/inc/analyzetooldevice.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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:  Declaration of the class DAnalyzeToolDevice.
-*
-*/
-
-
-#ifndef __ANALYZETOOLEVICE_H__
-#define __ANALYZETOOLEVICE_H__
-
-// INCLUDES
-#include <analyzetool/analyzetool.h>
-#include <kernel/kernel.h>
-
-// CLASS DECLARATION
-
-/**
-* The implementation of the abstract base class for an LDD factory object.
-*/
-
-class DAnalyzeToolDevice : public DLogicalDevice
-	{
-	public:
-	
-        /**
-        * C++ default constructor.
-        */
-		DAnalyzeToolDevice();
-		
-	public: // from DLogicalDevice
-	
-        /**
-        * Second stage constructor.
-        @return KErrNone or standard error code.
-        */
-		virtual TInt Install();
-	
-        /**
-        * Gets the driver's capabilities.
-        @param aDes A user-side descriptor into which capabilities 
-        			information is to be written.
-        */
-		virtual void GetCaps( TDes8& aDes ) const;
-		
-        /**
-        * Called by the kernel's device driver framework to 
-        * create a Logical Channel.
-        @param aChannel Set to point to the created Logical Channel
-        @return KErrNone or standard error code.
-        */
-		virtual TInt Create( DLogicalChannelBase*& aChannel );
-	};
-
-
-#endif // __ANALYZETOOLEVICE_H__
-
-// End of File
--- a/analyzetool/kerneleventhandler/inc/analyzetooleventhandler.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +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:  Declaration of the class DAnalyzeToolEventHandler.
-*
-*/
-
-
-#ifndef __ANALYZETOOLEVENTHANDLER_H__
-#define __ANALYZETOOLEVENTHANDLER_H__
-
-// INCLUDES
-#include <analyzetool/analyzetool.h>
-#include "atlog.h"
-#include <kernel/kernel.h>
-
-// CLASS DECLARATION
-
-/**
-* Callback class for kernel events
-*/
-
-class DAnalyzeToolEventHandler : public DKernelEventHandler
-	{
-	public:
-	
-        /**
-        * C++ default constructor.
-        */
-		inline DAnalyzeToolEventHandler( TDfcQue* aDfcQ );
-		
-        /**
-        * Destructor.
-        */ 
-		~DAnalyzeToolEventHandler();
-		
-        /**
-        * Second stage constructor.
-        * @param aDevice A pointer to device where the event handler belongs.
-        * @param aProcessId Owner process id.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		TInt Create( DLogicalDevice* aDevice, const TUint aProcessId );
-		
-        /**
-        * Subscribes library event.
-        * @param aStatus The request status object for this request. 
-        * @param aLibraryInfo The library information which 
-        					  is filled by the device driver
-        * @param aMessage Reference to received thread message.
-        * @return TInt Returns KErrNone, if successful
-        			   otherwise one of the other system-wide error codes
-        */
-		void InformLibraryEvent( TRequestStatus* aStatus, 
-								 TAny* aLibraryInfo,
-								 TThreadMessage& aMessage );
-        
-        /**
-        * Cancels subscribetion of the library event.
-        */
-		void CancelInformLibraryEvent();
-
-        /**
-        * Static function for DFC events.
-        * @param aPtr Pointer to DAnalyzeToolEventHandler object. 
-        */
-	    static void EventDfc( TAny* aPtr );
-		
-	private:
-	
-        /**
-        * Pointer to  callback function called when an event occurs.
-        * @param aEvent Designates what event is dispatched.
-        * @param a1 Event-specific paramenter.
-        * @param a2 Event-specific paramenter.
-        * @param aThis A pointer to the event handler
-        * @return TUint Bitmask returned by callback function.
-        */
-		static TUint EventHandler( TKernelEvent aEvent, 
-								   TAny* a1, 
-								   TAny* a2, 
-								   TAny* aThis );
-	
-	private:
-	
-        /**
-        * Handles the EEventAddLibrary and EEventRemoveLibrary events
-        * @param aLib* A pointer to added/removed library.
-        * @param aThread* A pointer to thread where the libary is.
-        * @param aInfo* A reference class to be written to the client
-        */	
-		void HandleLibraryEvent( DLibrary* aLib, 
-								 DThread* aThread, 
-								 TLibraryEventInfo& aInfo );
-		
-		/**
-		* Handles the EEventKillThread events
-		* @param aThread* A pointer to the thread being terminated. 
-		* @param aInfo* A reference class
-		*/	
-		void HandleKillThreadEvent( DThread* aThread, 
-									TLibraryEventInfo& aInfo );
-		
-		/**
-		* Informs client about the occured event
-		*/	
-	    void DoEventComplete();
-					
-	private:
-	
-		/* Mutex for serializing access to event handler */
-		DMutex* iHandlerMutex;
-		
-		/* Mutex fof serializing access to event handler variables */
-		DMutex* iDataMutex;		
-		
-		/* If the client is a RAM-loaded LDD (or PDD), it is possible for the DLL to
-		be unloaded while the handler is still in use.  This would result in an
-		exception.  To avoid this, the handler must open a reference to the
-		DLogicalDevice (or DPhysicalDevice) and close it in its d'tor. */
-		DLogicalDevice* iDevice;    
-				
-		/* Owner process ID */
-		TUint iProcessId;
-		
-		/* Event array */
-		RArray<TLibraryEventInfo> iEventArray;
-				
-		/* Pointer to client's TRequestStatus */ 
-		TRequestStatus* iClientRequestStatus;
-		
-		/* Pointer to client's thread */ 
-		DThread* iClientThread;
-
-		/* Pointer to client's TLibraryEventInfo */ 
-		TAny* iClientInfo;
-		
-		/* DFC for informing events to the client */ 
-		TDfc iEventDfc;
-	};
-	
-// ----------------------------------------------------------------------------
-// DAnalyzeToolEventHandler::DAnalyzeToolEventHandler()
-// C++ default constructor.
-// ----------------------------------------------------------------------------
-//
-inline DAnalyzeToolEventHandler::DAnalyzeToolEventHandler( TDfcQue* aDfcQ ) :	
-	DKernelEventHandler( EventHandler, this ),
-	iEventDfc( EventDfc, this, 1 )
-	{
-	LOGSTR1( "ATDD DAnalyzeToolEventHandler::DAnalyzeToolEventHandler()" );
-	iEventDfc.SetDfcQ( aDfcQ );
-	}
-
-#endif // __ANALYZETOOLEVENTHANDLER_H__
-
-// End of File
--- a/analyzetool/kerneleventhandler/inc/analyzetooltraceconstants.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +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:  Common declarations/definitions for Analyze Tool.
-*
-*/
-
-
-
-#ifndef __ANALYZETOOLTRACECONSTANTS_H__
-#define __ANALYZETOOLTRACECONSTANTS_H__
-
-#include <analyzetool/atcommon.h>
-
-// Trace version information.
-const TUint KATTraceVersion = 0x2;
-
-// The default logging mode 
-const TATLogOption KDefaultLoggingMode = EATLogToTrace;
-
-// When needed, update the storage data file's version number directly inside
-// the _LIT8 macro. Note, if you change this string, also remember to update
-// the constant "KVersionStringLength" below.
-
-_LIT8( KDataFileVersion, "DATA_FILE_VERSION 11\r\n" );
-_LIT8( KProcessStart, "PROCESS_START %S %x " );
-_LIT16( KProcessStart16, "PROCESS_START %S %x " );
-_LIT8( KDllLoad, "DLL_LOAD %S %Lx %x %x\r\n" );
-_LIT16( KDllLoad16, "DLL_LOAD %S %Lx %x %x\r\n" );
-_LIT8( KDllUnload, "DLL_UNLOAD %S %Lx %x %x\r\n" );
-_LIT16( KDllUnload16, "DLL_UNLOAD %S %Lx %x %x\r\n" );
-_LIT8( KProcessEnd, "PROCESS_END %x " );
-_LIT16( KProcessEnd16, "PROCESS_END %x " );
-_LIT8( KProcessEndAbnormal, "PROCESS_END %x ABNORMAL " );
-_LIT8( KMemoryLeak, "MEM_LEAK " ); // Remember to update value of KMemoryLeak when changing this.
-_LIT8( KHandleLeak, "HANDLE_LEAK %S %x\r\n" );
-_LIT16( KHandleLeak16, "HANDLE_LEAK %S %x\r\n" );
-_LIT8( KErrorOccured, "ERROR_OCCURED %d " );
-_LIT8( KLoggingCancelled, "LOGGING_CANCELLED %x\r\n" );
-_LIT8( KNewLine, "\r\n" );
-_LIT8( KHexaNumber, " %x" );
-_LIT8( KSpace, " " );
-_LIT8( KUdeb, "UDEB" );
-_LIT8( KUrel, "UREL" );
-    
-// Constants for logging through debug channel
-_LIT( KTraceMessage, "PCSS %x %S" );
-_LIT( KMemoryAllocHeader, "ALLOCH " );
-_LIT( KMemoryAllocFragment, "ALLOCF " );
-_LIT( KMemoryFreedHeader, "FREEH " );
-_LIT( KMemoryFreedFragment, "FREEF " );
-_LIT( KSpaceTrace, " " );
-_LIT( KNewLineTrace, "\r\n" );
-_LIT( KHexaNumberTrace, " %x" );
-_LIT( KProcessEndTrace, "PROCESS_END %x " );
-_LIT( KProcessEndAbnormalTrace, "PROCESS_END %x ABNORMAL " );
-_LIT( KErrorOccuredTrace, "ERROR_OCCURED %d " );
-_LIT( KSubtestStart, "TEST_START " );
-_LIT( KSubtestEnd, "TEST_END " );
-_LIT8( KEmpty, "" );
-_LIT( KOpenSquareBracket, "[" );
-_LIT( KCloseSquareBracket, "]" );
-_LIT( KUnderLine, "_" );
-// File name format
-_LIT( KFormat, "%S%S%02d%S");// pad char="0", field width=2
-
-// A string for setting time January 1st, 1970 AD nominal Gregorian
-_LIT( KJanuaryFirst1970, "19700000:000000.000000" );
-
-// Module name when it cannot be defined
-_LIT8( KUnknownModule, "Unknown" );
-_LIT16( KUnknownModule16, "Unknown" );
-
-// Constant time variable used to calculate timestamps for pc side.
-const TInt64  KMicroSecondsAt1970 = 62168256000000000;
-
-// The length of the string KDataFileVersion
-const TInt KVersionStringLength = 22;
-
-// The length of the string KMemoryLeak
-const TInt KMemleakLength = 9;
-
-// The maximum length of one word (32 bits) represented in the hexadecimal text format
-// without "0x" prefix
-const TInt KHexa32Length = 8;
-
-// The maximum length of one word (32 bits) represented in the decimal text format
-const TInt KDec32Length = 10;
-
-// The maximum length of a TInt64 represented in the hexadecimal text format without
-// "0x" prefix
-const TInt KHexa64Length = 16;
-
-// The length of one space character in text
-const TInt KSpaceLength = 1;
-
-// The length of the combination of carriage return and new line characters.
-const TInt KNewlineLength = 2;
-
-// The maximum length of the "PROCESS_START..." buffer. The first number is length of
-// the line tag and one space character (see the descriptor constants above).
-const TInt KProcessStartBufLength = 16 + KMaxProcessName + KSpaceLength + KHexa32Length +
-                                        KSpaceLength + KHexa64Length + KHexa32Length + KNewlineLength;
-
-// The maximum length of the "DLL_LOAD..." buffer. The first number is length of
-// the line tag and one space character (see the descriptor constants above).
-const TInt KDllLoadBufLength = 9 + KMaxLibraryName + KSpaceLength + KHexa64Length + KSpaceLength +
-                    KHexa32Length + KSpaceLength + KHexa32Length + KNewlineLength;
-
-// The maximum length of the "DLL_UNLOAD..." buffer. The first number is length of
-// the line tag and one space character (see the descriptor constants above).
-const TInt KDllUnloadBufLength = 11 + KMaxLibraryName + KHexa64Length + KSpaceLength + KSpaceLength + 
-                    KHexa32Length + KSpaceLength + KHexa32Length + KNewlineLength;
-
-// The maximum length of the "PROCESS_END..." buffer. The first number is length of
-// the line tag and one space character (see the descriptor constants above).
-const TInt KProcessEndBufLength = 12 + KHexa32Length + KSpaceLength +
-                                        KHexa64Length + KNewlineLength;
-                                        
-// The maximum length of the "ERROR_OCCURED..." buffer. The first number is length of
-// the line tag and one space character (see the descriptor constants above).
-const TInt KErrOccuredBufLength = 14 + KDec32Length + KSpaceLength +
-                                        KHexa64Length + KNewlineLength;
-                                        
-// The maximum length of the "ALLOCH / ALLOCF..." buffer. 
-const TInt KMemAllocBufLength = 255;
-
-// The maximum length of the "FREE..." buffer.
-const TInt KMemFreedBufLength = 255;
-
-// The maximum length of the "HANDLE_LEAK..." buffer. The first number is length of
-// the line tag and one space character (see the descriptor constants above).
-const TInt KHandleLeakBufLength = 12 + KMaxLibraryName + KSpaceLength +
-                                        KHexa32Length + KNewlineLength;
-                                        
-// The maximum length of the "TEST_START..." buffer. The first number is length of
-// the line tag and one space character (see the descriptor constants above).
-const TInt KTestStartBufLength = 11 + KHexa64Length + KSpaceLength +
-                                        KATMaxSubtestIdLength + KSpaceLength + KHexa64Length + KNewlineLength;
-
-// The maximum length of the "TEST_END..." buffer. The first number is length of
-// the line tag and one space character (see the descriptor constants above).
-const TInt KTestEndBufLength = 9 + KHexa64Length + KSpaceLength +
-                                        KATMaxSubtestIdLength + KSpaceLength + KHexa64Length + KNewlineLength;
-
-// The maximun length of the "LOGGING_CANCELLED..." buffer. The first number is the
-// length of the line tag and one space character (see the descriptor constants above).
-const TInt KCancelBufLength = 18 + KHexa64Length + KNewlineLength;
-
-// The maximun length of the "PROCESS_END %x ABNORMAL..." buffer. The first number is length of
-// the line tag and one space character (see the descriptor constants above).
-const TInt KEndAbnormalBufLength = 22 + KHexa32Length + KHexa64Length + 
-                                        KSpaceLength + KNewlineLength;
-
-// The maximun length of the file name extension buffer.
-const TInt KExtensionLength = 50;
-
-// The maximun length of the process UID3 buffer.
-const TInt KProcessUidLength = 20;
-
-#endif // __ANALYZETOOLTRACECONSTANTS_H__
--- a/analyzetool/kerneleventhandler/inc/atcommon.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +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:  Common declarations/definitions for Analyze Tool.
-*
-*/
-
-
-#ifndef ATCOMMON_H_
-#define ATCOMMON_H_
-
-// CONSTANTS
-const TInt KATMaxCallstackLength = 256;
-const TInt KATMaxFreeCallstackLength = 256;
-const TInt KATMaxSubtestIdLength = 256;
-
-// The following constants only limit the configuration UI.
-// The bigger the number is, the more space will be allocated run-time
-// by the client. So, change with care.
-const TInt KATMaxProcesses = 20;
-const TInt KATMaxDlls = 30;
-
-// Constants defining call stack address range in multiple memory model.
-const TInt32 KATMultipleMemoryModelLowLimit = 0x70000000;
-const TInt32 KATMultipleMemoryModelHighLimit = 0x90000000;
-
-
-// CLASS DECLARATIONS
-
-/**
-*  A class for storing process information
-*/
-class TATProcessInfo
-    {
-    public:
-    
-        /** The ID of the process. */
-        TUint iProcessId;
-        
-        /** The name of the process. */
-        TBuf8<KMaxProcessName> iProcessName;
-        
-        /** The starting time of the process. */
-        TInt64 iStartTime;
-    };
-
-
-// ENUMERATIONS
-
-/**
-*  Enumeration for different logging modes of Analyze Tool 
-*/
-enum TATLogOption
-    {
-    /** Using the default. */
-    EATUseDefault = 0,
-    
-    /** Logging to a file in S60. */
-    EATLogToFile,
-    
-    /** Logging to debug channel. */
-    EATLogToTrace,
-    
-    /** Logging to debug channel bypassing storage server. */
-    EATLogToTraceFast,
-    
-    /** Logging switched off. */
-    EATLoggingOff
-    };
-
-/**
-*  Class which supports interfacing with AnalyzeTool exported
-*  functions. Mainly meant for STIF integration.
-*/
-class AnalyzeToolInterface
-    {
-    public:
-
-        /**
-        * This function starts subtest with a given name.
-        * @param aSubtestId The name identifying this particular sub test. The length
-        *   of this descriptor must not be greater than KATMaxSubtestIdLength, or
-        *   otherwise the method raises a STSEClient: 2 panic.
-        */
-        IMPORT_C static void StartSubTest( const TDesC8& aSubtestId );
-
-        /**
-        * This function stops a subtest with a given name.
-        * @param aSubtestId The name identifying this particular sub test. The length
-        *   of this descriptor must not be greater than KATMaxSubtestIdLength, or
-        *   otherwise the method raises a STSEClient: 2 panic. 
-        */   
-        IMPORT_C static void StopSubTest( const TDesC8& aSubtestId );
-
-    };
-    
-
-#endif /*ATCOMMON_H_*/
--- a/analyzetool/kerneleventhandler/sis/analyzetooldevicedriver.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +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:
-;
-
-;Language - standard language definitions
-&EN
-
-; standard SIS file header
-#{"AnalyzeToolDeviceDriver"},(0xEDF5A8A1),1,8,1
-
-;Localised Vendor name
-%{"Vendor-EN"}
-
-;Unique Vendor name
-:"Vendor"
-
-;Supports Series 60 v 3.0
-[0x101F7961], 0, 0, 0, {"Series60ProductID"}
-
-; 1 File to install
-"\epoc32\release\armv5\urel\atoolkerneleventhandler.ldd"-"!:\sys\bin\atoolkerneleventhandler.ldd"
--- a/analyzetool/kerneleventhandler/src/analyzetoolchannel.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1019 +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:  Definitions for the class DAnalyzeToolChannel.
-*
-*/
-
-
-// INCLUDE FILES
-#include "analyzetoolchannel.h"
-#include "analyzetooldevice.h"
-#include "analyzetooleventhandler.h"
-
-#include <kernel/kern_priv.h>
-#ifdef __WINSCW__
-#include <emulator.h>
-#endif // __WINSCW__
-
-#include "atlog.h"
-
-// ================= MEMBER FUNCTIONS =========================================
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::DoCreate()
-// Creates the logical channel.
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::DoCreate( TInt /*aUnit*/, 
-    const TDesC8* /*aInfo*/, const TVersion &aVer )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::DoCreate()" );
-
-    // Check client version.
-    if ( !Kern::QueryVersionSupported( KAnalyzeToolLddVersion(), aVer ) )
-        {
-        return KErrNotSupported;
-        }
-     
-    TInt error = Kern::DynamicDfcQCreate( iOwnDfcQ, 
-                                          KAnalyzeToolThreadPriority, 
-                                          KAnalyzeToolThreadName );
-
-    if ( KErrNone != error )
-        {
-        return error;
-        }
-
-    SetDfcQ( iOwnDfcQ );
-    
-    iMsgQ.Receive();
-   
-    // Create the event handler
-    iEventHandler = new DAnalyzeToolEventHandler( iOwnDfcQ );
-
-    // Check that everything is OK
-    if ( !iEventHandler )
-        {
-        return KErrNoMemory;
-        }
-    
-    // 2nd stage constructor for event handler
-    return iEventHandler->Create( iDevice, Kern::CurrentProcess().iId );
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::DAnalyzeToolChannel()
-// Constructor.
-// -----------------------------------------------------------------------------
-//
-DAnalyzeToolChannel::DAnalyzeToolChannel()
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::DAnalyzeToolChannel()" );
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::~DAnalyzeToolChannel()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-DAnalyzeToolChannel::~DAnalyzeToolChannel()
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::~DAnalyzeToolChannel()" );
-    
-    if ( iEventHandler )
-        {
-        // Cancel all processing that we may be doing
-        DoCancel();
-        
-        // Client code should use Close() instead the operator delete 
-        // to destroy the event handler. 
-        TInt error( iEventHandler->Close() );
-        if ( KErrNone != error )
-            {
-            LOGSTR2( "ATDD iEventHandler->Close(%d)", error );
-            }
-        }
-    #ifdef __WINSCW__
-        iCodeSeg.Close();
-    #endif // __WINSCW__
-    
-    // Destroy the queqe
-    if ( iOwnDfcQ )
-        {
-        iOwnDfcQ->Destroy();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::DoControl()
-// Handles a client request.
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::DoControl( TInt aFunction, 
-                                     TAny* a1, 
-                                     TAny* /*a2*/, 
-                                     TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::Request()" );
-    
-    TInt ret( KErrNone );
-
-    // Check the requested function
-    switch (aFunction)
-        {
-        case RAnalyzeTool::EGetProcessInfo:
-            ret = GetProcessInfo( a1, aMessage );
-            break;
-            
-        case RAnalyzeTool::EGetCodesegInfo:
-            ret = GetCodesegInfo( a1, aMessage );
-            break;
-
-        case RAnalyzeTool::EGetLibraryInfo:
-            ret = GetLibraryInfo( a1, aMessage );
-            break;
-            
-        case RAnalyzeTool::ECancelLibraryEvent:
-            iEventHandler->CancelInformLibraryEvent();
-            break;
-            
-        case RAnalyzeTool::ECurrentClientCount:
-            ret = ClientCount( a1, aMessage );
-            break;
-
-        case RAnalyzeTool::EMainThreadAlloctor:
-            ret = MainThreadAllocator( a1, aMessage );
-            break;
-        
-        case RAnalyzeTool::EThreadStack:
-             ret = ThreadStack( a1, aMessage );
-             break;
-             
-        case RAnalyzeTool::EGetProcessHandle:
-            ret = GetProcessHandleInfo( a1, aMessage );
-            break;
-        
-        case RAnalyzeTool::EGetCurrentHandles:
-            ret = GetCurrentHandleCount( a1, aMessage );
-            break;
-        case RAnalyzeTool::EGetMemoryModel:
-            ret = GetMemoryModel( a1, aMessage );
-            break;
-            
-        // Unsupported function. Panic
-        default:
-            Kern::PanicCurrentThread( KClientPanic, EPanicUnsupportedRequest );
-            break;
-        }
-        
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::DoRequest()
-// Handles a client asynchronous request.
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::DoRequest( TInt aFunction, 
-                                     TRequestStatus* aStatus, 
-                                     TAny* a1, 
-                                     TAny* /*a2*/,
-                                     TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::DoRequest()" );
-    
-    // Check the requested function
-    switch (aFunction)
-        {
-        case RAnalyzeTool::ELibraryEvent:
-            iEventHandler->InformLibraryEvent( aStatus, a1, aMessage );
-            break;
-            
-        // Unsupported function. Panic
-        default:
-            aMessage.PanicClient( KClientPanic, EPanicUnsupportedRequest );
-            break;
-        }
-        
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::DoCancel()
-// Cancels outstanding asynchronous request.
-// -----------------------------------------------------------------------------
-//
-void DAnalyzeToolChannel::DoCancel()
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::DoCancel()" );
-    
-    iEventHandler->CancelInformLibraryEvent();
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::HandleMsg()
-// Processes a message for this logical channel.
-// -----------------------------------------------------------------------------
-//
-void DAnalyzeToolChannel::HandleMsg(TMessageBase* aMsg)
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::HandleMsg()" );
-
-    TThreadMessage& message = *(TThreadMessage*)aMsg;
-
-    // Get message type
-    TInt id = message.iValue;
-
-    // Decode the message type and dispatch it to the relevent handler function...
-    if ( id == (TInt) ECloseMsg )
-        {
-        // Channel Close
-        DoCancel();
-        message.Complete( KErrNone, EFalse );
-        }
-    else if ( id == KMaxTInt )
-        {
-        // DoCancel
-        DoCancel();
-        message.Complete( KErrNone, ETrue );
-        }
-    else if ( id < 0 )
-        {
-        // DoRequest
-        TRequestStatus* status = (TRequestStatus*) message.Ptr0();
-        TInt error = DoRequest( ~id, status, message.Ptr1(), message.Ptr2(), message );
-        if ( KErrNone != error )
-            {
-            Kern::RequestComplete( message.Client(), status, error);
-            }
-        message.Complete(KErrNone, ETrue );
-        }
-    else
-        {
-        // DoControl
-        TInt ret = DoControl( id, message.Ptr0(), message.Ptr1(), message );
-        message.Complete( ret, ETrue );
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::GetProcessInfo()
-// Acquires current process information
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::GetProcessInfo( TAny* aProcessInfo, 
-                                          TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::GetProcessInfo()" );
-
-    // Variable for reading parameters from user side
-    TProcessIdentityParamsBuf params;
-    
-    // Reads a descriptor from a thread's process.
-    TInt error = Kern::ThreadDesRead( aMessage.Client(), aProcessInfo, params, 0 );  
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesRead error %d", error );
-        return error;
-        } 
-
-    // Gets the current process
-    Kern::Containers()[ EProcess ]->Wait();
-    DProcess& process = *Kern::ProcessFromId( params().iProcessId );  
-    Kern::Containers()[ EProcess ]->Signal();
-    
-    if ( NULL == &process )
-        {        
-        return KErrNotFound;
-        }
-    
-    // Temporary variable for collecting information from the process
-    TProcessIdentityParamsBuf info;
-    
-    // Collect needed information from the process
-    process.AppendName( info().iProcessName );//lint !e64 !e1514
-    
-    // Gets the current thread
-    Kern::Containers()[ EThread ]->Wait(); 
-    DThread& thread = *Kern::ThreadFromId( params().iThreadId );
-    Kern::Containers()[ EThread ]->Signal();
-   
-    if ( NULL == &thread )
-        {
-        return KErrNotFound;
-        }     
-    
-    // Stack address of the main thread
-    info().iStackAddress = thread.iUserStackRunAddress;
-    info().iStackSize    = thread.iUserStackSize;  
-    
-    // Enters thread critical section and acquires code segment mutex.
-    Kern::AccessCode();
-        
-    // Collect needed information from the process
-    info().iDynamicCount = process.iDynamicCode.Count();
-
-    // Temporary queue for acquiring the count of codesegments
-    SDblQue queue;
-
-    // Acquire the count of codesegments
-    TInt codesegCount = process.TraverseCodeSegs( &queue, 
-                                                  NULL, 
-                                                  DCodeSeg::EMarkDebug, 
-                                                  DProcess::ETraverseFlagAdd );
-    
-    #ifndef __WINSCW__
-        info().iCodesegCount = codesegCount;    
-    #else
-    // Reset codesegment array
-    iCodeSeg.Reset();
-    
-    if ( codesegCount > 0 )
-        {
-        SDblQueLink* link = queue.iA.iNext;
-        TCodesegInfo codeinfo;
-        // Iterate through codesegments
-        for ( TInt i = 0; i < codesegCount; ++i, link = link->iNext )
-            {
-            DWin32CodeSeg* codeseg = 
-                (DWin32CodeSeg*)_LOFF( link, DCodeSeg, iTempLink );
-
-            // Aqcuire codeseg information
-            codeinfo.iFileEntryPoint = codeseg->iFileEntryPoint;
-            codeinfo.iSize = codeseg->iSize;
-            codeinfo.iFullName.Copy( codeseg->iRootName );
-            codeinfo.iRunAddress = codeseg->iRunAddress;
-            iCodeSeg.Append( codeinfo );
-            }
-        }
-    
-    // Add dependency codesegments
-    DWin32CodeSeg* pcodeSeg = (DWin32CodeSeg*)process.iCodeSeg;
-    
-    // Get dependency codesegments
-    GetModuleDependencies( pcodeSeg->iModuleHandle );
-    
-    // Set codesegment count
-    info().iCodesegCount = iCodeSeg.Count();
-    #endif
-    
-    // Removes all code segments from a queue and clear specified mark(s)
-    DCodeSeg::EmptyQueue( queue, DCodeSeg::EMarkDebug );
-
-    // Exits thread critical section and releases code segment mutex.
-    Kern::EndAccessCode();
-
-    // Writes a descriptor to a thread's process.
-    error = Kern::ThreadDesWrite( aMessage.Client(), aProcessInfo, info, 0 );  
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
-        return error;
-        } 
-   
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::GetCodesegInfo()
-// Acquires codeseg information.
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::GetCodesegInfo( TAny* aCodesegInfo, 
-                                          TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::GetCodesegInfo()" );
-
-    // Temporary variable for collecting information from the codeseg
-    TCodesegInfoBuf params;
-
-    TInt error( KErrArgument );
-    
-    // Reads a descriptor from a thread's process.
-    error = Kern::ThreadDesRead( aMessage.Client(), aCodesegInfo, params, 0 );  
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesRead error %d", error );
-        return error;
-        } 
-
-    if ( params().iIndex < 0 )
-        {
-        return KErrArgument;
-        }
-    
-    // Gets the current process
-    Kern::Containers()[ EProcess ]->Wait();
-    DProcess& process = *Kern::ProcessFromId( params().iProcessId );
-    Kern::Containers()[ EProcess ]->Signal();
-    
-    if ( NULL == &process )
-        {
-        return KErrNotFound;
-        }
-    
-    // Temporary variable for collecting information 
-    TCodesegInfoBuf output;
-
-    // Enters thread critical section and acquires code segment mutex.
-    Kern::AccessCode();
-
-    #ifndef __WINSCW__
-    // Temporary queue for acquiring the codesegments
-    SDblQue queue;
-    
-    // Acquire the codesegments
-    TInt actcount = process.TraverseCodeSegs( &queue, 
-                                              NULL, 
-                                              DCodeSeg::EMarkDebug, 
-                                              DProcess::ETraverseFlagAdd );
-    if ( actcount >= params().iIndex )
-        {
-        LOGSTR1( "ATDD DAnalyzeToolChannel::GetCodesegInfo() - actcount >= params.iIndex" );
-        SDblQueLink* link = queue.iA.iNext;
-        
-        // Iterate through codesegments
-        for (TInt i = 0; i < actcount; ++i, link = link->iNext)
-            {
-            DCodeSeg* codeseg = _LOFF( link, DCodeSeg, iTempLink );
-
-            // Is the codesegments which information client wants
-            if ( i == params().iIndex )
-                {
-                // Aqcuire codeseg information
-                output().iFileEntryPoint = codeseg->iFileEntryPoint;
-                output().iSize = codeseg->iSize;
-                output().iFullName.Copy( codeseg->iRootName );
-                output().iRunAddress = codeseg->iRunAddress;
-                error = codeseg->GetMemoryInfo( output().iMemoryInfo, &process );
-                
-                if ( KErrNone == error )
-                    {
-                    // Writes a descriptor to a thread's process.
-                    error = Kern::ThreadDesWrite( aMessage.Client(), 
-                                                  aCodesegInfo, 
-                                                  output, 
-                                                  0 );   
-                    if ( KErrNone != error )
-                        {
-                        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
-                        } 
-                    }
-                break;
-                }
-            }
-        }
-    // Removes all code segments from a queue and clear specified mark(s).
-    DCodeSeg::EmptyQueue( queue, DCodeSeg::EMarkDebug );
-    
-    // Exits thread critical section and releases code segment mutex.
-    Kern::EndAccessCode();
-    
-    return error;
-    #else // WINSCW
-    
-    if ( iCodeSeg.Count() > params().iIndex )
-        {
-        // Aqcuire codeseg information
-        output().iSize = iCodeSeg[params().iIndex].iSize;
-        output().iFullName.Copy( iCodeSeg[params().iIndex].iFullName );
-        output().iRunAddress = iCodeSeg[params().iIndex].iRunAddress;
-        
-        // Writes a descriptor to a thread's process.
-        error = Kern::ThreadDesWrite( aMessage.Client(), aCodesegInfo, output, 0 ); 
-        
-        if ( KErrNone != error )
-            {
-            LOGSTR2( "ATDD ThreadDesWrite error %d", error );
-            }
-        }
-    
-    // Exits thread critical section and releases code segment mutex.
-    Kern::EndAccessCode();
-    
-    return error;
-    #endif
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::GetLibraryInfo()
-// Acquires library information.
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::GetLibraryInfo( TAny* aLibraryInfo, 
-                                          TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::GetLibraryInfo()" );
-
-    // Temporary variable for reading informationfrom the user side
-    TLibraryInfoBuf params;
-
-    // Reads a descriptor from a thread's process.
-    TInt error = Kern::ThreadDesRead( aMessage.Client(), aLibraryInfo, params, 0 );  
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesRead error %d", error );
-        return error;
-        } 
-
-    if ( params().iIndex < 0 )
-        {
-        return KErrArgument;
-        }
-   
-    // Gets the current process
-    Kern::Containers()[ EProcess ]->Wait();
-    DProcess& process = *Kern::ProcessFromId( params().iProcessId );
-    Kern::Containers()[ EProcess ]->Signal();
-    
-    if ( NULL == &process )
-        {
-        return KErrNotFound;
-        }
-    
-    // Temporary variable for collecting information from the library
-    TLibraryInfoBuf output;
-        
-    // Enters thread critical section and acquires code segment mutex.
-    Kern::AccessCode();
-
-    // Iterate to find the right library
-    if ( params().iIndex < process.iDynamicCode.Count() )
-        {
-        // Acquire entry to the codeseg
-        SCodeSegEntry entry = process.iDynamicCode[ params().iIndex ];
-        
-        // Acquire library information
-        entry.iLib->AppendName( output().iLibraryName );//lint !e64 !e1514
-        output().iRunAddress = entry.iSeg->iRunAddress;
-        output().iSize = entry.iSeg->iSize;
-        
-        // Writes a descriptor to a thread's process.
-        error = Kern::ThreadDesWrite( aMessage.Client(), aLibraryInfo, output, 0 ); 
-        
-        if ( KErrNone != error )
-            {
-            LOGSTR2( "ATDD ThreadDesWrite error %d", error );
-            } 
-        
-        // Exits thread critical section and releases code segment mutex.
-        Kern::EndAccessCode();
-        
-        return error;
-        }
-    else
-        {
-        // Exits thread critical section and releases code segment mutex.
-        Kern::EndAccessCode();
-        
-        return KErrArgument;
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::MainThreadAllocator()
-// Acquires information about process main thread RAllocator
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::MainThreadAllocator( TAny* aMainThreadParams, 
-                                               TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::MainThreadAllocator()" );
-
-    // Temporary variable for reading client side parameters
-    TMainThreadParamsBuf params;
-
-    // Reads a descriptor from a thread's process.
-    TInt error = Kern::ThreadDesRead( aMessage.Client(), 
-                                      aMainThreadParams, 
-                                      params, 
-                                      0 );  
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesRead error %d", error );
-        return error;
-        } 
-    
-    // Gets the current process
-    Kern::Containers()[ EProcess ]->Wait();
-    DProcess& process = *Kern::ProcessFromId( params().iProcessId );
-    Kern::Containers()[ EProcess ]->Signal();
-    
-    if ( NULL == &process )
-        {
-        return KErrNotFound;
-        }
-
-    // Gets the current process
-    Kern::AccessCode();
-
-    // Temporary variable for collecting information from the RAllocator
-    TMainThreadParamsBuf output;
-
-    // Aqcuire a reference to the main thread RAllocator
-    output().iAllocator = process.FirstThread()->iAllocator;
-
-    // Is this only thread in the process
-    output().iAlone = process.iThreadQ.First()->Alone();
-
-    // Exits thread critical section and releases code segment mutex.
-    Kern::EndAccessCode();
-
-    // Writes a descriptor to a thread's process.
-    error = Kern::ThreadDesWrite( aMessage.Client(), 
-                                  aMainThreadParams, 
-                                  output, 
-                                  0 ); 
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
-        } 
-
-    return error;
-    }    
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::ThreadStack()
-// Acquires main thread stack address
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::ThreadStack( TAny* aThreadStack, 
-                                       TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::ThreadStack()" );
-
-    // Temporary variable for reading client side parameters
-    TThreadParamsBuf params;
-
-    // Reads a descriptor from a thread's process.
-    TInt error = Kern::ThreadDesRead( aMessage.Client(), 
-                                      aThreadStack, 
-                                      params, 
-                                      0 );  
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesRead error %d", error );
-        return error;
-        } 
-    
-    // Gets the current process
-    Kern::Containers()[ EThread ]->Wait();
-    DThread& thread = *Kern::ThreadFromId( params().iThreadId );
-    Kern::Containers()[ EThread ]->Signal();
-    
-    if ( NULL == &thread )
-        {
-        return KErrNotFound;
-        }
-    
-    // Gets the current process
-    Kern::AccessCode();
-
-    // Temporary variable for collecting information from the RAllocator
-    TThreadParamsBuf output;
-
-    // Stack address of the main thread
-    output().iStackAddress = thread.iUserStackRunAddress;
-    output().iStackSize    = thread.iUserStackSize;
-
-    // Exits thread critical section and releases code segment mutex.
-    Kern::EndAccessCode();
-
-    // Writes a descriptor to a thread's process.
-    error = Kern::ThreadDesWrite( aMessage.Client(), 
-                                  aThreadStack, 
-                                  output, 
-                                  0 ); 
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
-        } 
-    
-    return error;
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::GetProcessHandleInfo()
-// Acquires information about process global handles
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::GetProcessHandleInfo( TAny* aProcessHandleInfo,
-                                                TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::GetProcessHandleInfo()" );
-
-    // Temporary variable for collecting information from the codeseg
-    TProcessHandleInfoBuf params;
-
-    // Reads a descriptor from a thread's process.
-    TInt error = Kern::ThreadDesRead( aMessage.Client(), 
-                                      aProcessHandleInfo, 
-                                      params, 
-                                      0 );  
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesRead error %d", error );
-        return error;
-        } 
-
-    // Gets the current process
-    Kern::Containers()[ EProcess ]->Wait();
-    DProcess& process = *Kern::ProcessFromId( params().iProcessId );
-    Kern::Containers()[ EProcess ]->Signal();
-    
-    if ( NULL == &process )
-        {
-        return KErrNotFound;
-        }
-    
-    // Variable holding wanted information
-    TProcessHandleInfoBuf output;
-
-    // Enters thread critical section and acquires code segment mutex.
-    Kern::AccessCode();
-
-    // Get the process thread queue.
-    SDblQue queue = process.iThreadQ;
-    error = KErrNotFound;
-        
-    // Tests whether this doubly linked list is empty.
-    if ( !queue.IsEmpty() )
-        {
-        // Gets a pointer to the first item in this doubly linked list.
-        SDblQueLink* link = queue.First();
-        DThread* thread = _LOFF( link, DThread, iProcessLink );
-
-        if ( thread )
-            {
-            
-#ifdef MCL_ROBJECTIX
-            TInt threadHandles( thread->iHandles.ActiveCount() );
-#else
-            TInt threadHandles( thread->iHandles->ActiveCount() );
-#endif
-            
-            // Aqcuire thread information
-            //thread->AppendName( output.iThreadName );
-            output().iUserStackRunAddress = thread->iUserStackRunAddress;
-            output().iUserStackSize = thread->iUserStackSize;
-            output().iThreadHandleCount = threadHandles;
-            
-#ifdef MCL_ROBJECTIX
-            RObjectIx objectIx = process.iHandles;
-            output().iProcessHandleCount = objectIx.ActiveCount();
-#else
-            DObjectIx* objectIx = process.iHandles;
-            output().iProcessHandleCount = objectIx->ActiveCount();
-#endif
-                        
-            // Writes a descriptor to a thread's process.
-            error = Kern::ThreadDesWrite( aMessage.Client(), 
-                                          aProcessHandleInfo, 
-                                          output, 
-                                          0 ); 
-            
-            if ( KErrNone != error )
-                {
-                LOGSTR2( "ATDD ThreadDesWrite error %d", error );
-                } 
-            }
-        }
-
-    // Exits thread critical section and releases code segment mutex.
-    Kern::EndAccessCode();
-    
-    return error;
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::GetCurrentHandleCount()
-// Acquires a process's current handle count
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::GetCurrentHandleCount( TAny* aProcessHandles,
-                                                 TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::GetCurrentHandleCount()" );
-
-    // Temporary variable for collecting information from the codeseg
-    TATProcessHandlesBuf params;
-    
-    // Reads a descriptor from a thread's process.
-    TInt error = Kern::ThreadDesRead( aMessage.Client(), 
-                                      aProcessHandles, 
-                                      params, 
-                                      0 );
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesRead error %d", error );
-        return error;
-        } 
-    
-    // Gets the current process
-    Kern::Containers()[ EProcess ]->Wait();
-    DProcess* process = Kern::ProcessFromId( params().iProcessId );
-    Kern::Containers()[ EProcess ]->Signal();
-    
-    if ( NULL == process )
-        {
-        return KErrNotFound;
-        }
-
-    // Variable holding wanted information
-    TATProcessHandlesBuf output;
-    
-    // Enters thread critical section and acquires code segment mutex.
-    Kern::AccessCode();
-    
-    SDblQue queue = process->iThreadQ;
-    SDblQueLink* link = queue.First();
-    TInt threadHandles( 0 );
-    
-    // Iterate through current processes's threads
-    while ( link != queue.Last() )
-        {
-        DThread* thread = _LOFF( link, DThread, iProcessLink );
-        
-#ifdef MCL_ROBJECTIX
-        threadHandles += thread->iHandles.ActiveCount();
-#else
-        threadHandles += thread->iHandles->ActiveCount();
-#endif
-        
-        link = link->iNext;
-        }
-
-    if ( link == queue.Last() )
-        {
-        DThread* thread = _LOFF( link, DThread, iProcessLink );
-
-#ifdef MCL_ROBJECTIX
-        threadHandles += thread->iHandles.ActiveCount();
-#else
-        threadHandles += thread->iHandles->ActiveCount();
-#endif
-        }
-    
-    output().iCurrentHandleCount = threadHandles;
-    
-    // Writes a descriptor to a thread's process.
-    error = Kern::ThreadDesWrite( aMessage.Client(), 
-                                  aProcessHandles, 
-                                  output, 
-                                  0 ); 
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
-        } 
-    
-    // Exits thread critical section and releases code segment mutex.
-    Kern::EndAccessCode();
-    
-    return error;
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::ClientCount()
-// Acquires the count of current device driver users.
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::ClientCount( TAny* aClientCount,
-                                       TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::ClientCount()" );
-    
-    // Enters thread critical section and acquires code segment mutex.
-    Kern::AccessCode();
-    
-    // Variable holding wanted information
-    TClientCountBuf output;
-    
-    // Get the number of DLogicalChannelBase objects currently in existence which
-    // have been created from this LDD.
-    output().iClientCount = DLogicalChannelBase::iDevice->iOpenChannels;
-    LOGSTR2( "ATDD > iOpenChannels count: %d", output().iClientCount ); 
-    
-    // Writes a descriptor to a thread's process.
-    TInt error = Kern::ThreadDesWrite( aMessage.Client(), 
-                                       aClientCount, 
-                                       output, 
-                                       0 ); 
-    
-    if ( KErrNone != error )
-        {
-        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
-        } 
-    
-    // Exits thread critical section and releases code segment mutex.
-    Kern::EndAccessCode();
-    
-    return error;
-    }
-
-#ifdef __WINSCW__
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::GetModuleDependencies()
-// Get module dependencies
-// -----------------------------------------------------------------------------
-//
-void DAnalyzeToolChannel::GetModuleDependencies( HMODULE aModule )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::GetModuleDependencies()" );
-
-    Emulator::TModule etm( aModule );
-    TUint32 dllSize( 0 );
-    // Temporary variable for collecting information from the codeseg
-    TCodesegInfo info;
-    TBool found( EFalse );
-    
-    const IMAGE_IMPORT_DESCRIPTOR* imports = etm.Imports();
-    while( imports->Characteristics != 0 )
-        {
-        // Reset flag
-        found = EFalse;
-        
-        // Get dll name
-        const TUint8* nameAddr = ( const TUint8* )( imports->Name + ( TInt )etm.iBase );
-        TPtrC8 namePtr( nameAddr );     
-        
-        // Get dll run address
-        Emulator::TModule imp_etm( ( PCSTR )etm.Translate( imports->Name ) );        
-        const TUint8* runAddr = ( const TUint8* )imp_etm.iBase;
-        
-        // Get dll size
-        const IMAGE_NT_HEADERS32* ntHeader = imp_etm.NtHeader();
-        dllSize = ntHeader->OptionalHeader.SizeOfImage;       
-        
-        // Check if DLL already exists in codesegment list
-        for( TInt i = 0; i < iCodeSeg.Count(); i++ )
-            {
-            if ( iCodeSeg[i].iFullName.Compare( namePtr ) == KErrNone )
-                {
-                found = ETrue;
-                break;
-                }
-            }
-        
-        if ( !found )
-            {
-            info.iSize = dllSize;
-            info.iFullName.Copy( namePtr );
-            info.iRunAddress = (TUint32) runAddr;  
-            // Append codesegment to array
-            iCodeSeg.Append( info );
-            }
-        imports++;
-        }
-    }
-  
-#endif // __WINSCW__
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolChannel::GetMemoryModel()
-// Acquires memory model system uses.
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolChannel::GetMemoryModel(TAny* aMemoryModel,
-                                        TThreadMessage& aMessage)
-    {
-    LOGSTR1( "ATDD DAnalyzeToolChannel::GetMemoryModel()" );
-   
-    // Model buffer.
-    TATMemoryModelBuf model;
-    // Get current model.
-    model().iMemoryModel = (TUint32) Kern::HalFunction( EHalGroupKernel, EKernelHalMemModelInfo, NULL, NULL );
-    model().iMemoryModel &= EMemModelTypeMask; // Mask out other stuff.
-    // Write it to client side.
-    TInt error = Kern::ThreadDesWrite( aMessage.Client(),
-                                        aMemoryModel,
-                                        model,
-                                        0);
-    if ( error != KErrNone )
-        {
-        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
-        }
-    return error;
-    }
-// End of File
--- a/analyzetool/kerneleventhandler/src/analyzetooldevice.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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:  Definitions for the class DAnalyzeToolDevice.
-*
-*/
-
-
-// INCLUDE FILES
-#include "analyzetooldevice.h"
-#include "analyzetoolchannel.h"
-#include "atlog.h"
-
-// ================= MEMBER FUNCTIONS =========================================
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolDevice::DAnalyzeToolDevice()
-// C++ default constructor.
-// -----------------------------------------------------------------------------
-//
-DAnalyzeToolDevice::DAnalyzeToolDevice()
-    {
-    LOGSTR1( "ATDD DAnalyzeToolDevice::DAnalyzeToolDevice()" );
-    // Set version number
-    iVersion = KAnalyzeToolLddVersion();
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolDevice::Install()
-// Second stage constructor.
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolDevice::Install()
-    {
-    LOGSTR1( "ATDD DAnalyzeToolDevice::Install()" );
-    // Set device name
-    return SetName( &KAnalyzeToolLddName );
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolDevice::GetCaps()
-// Gets the driver's capabilities.
-// -----------------------------------------------------------------------------
-//
-void DAnalyzeToolDevice::GetCaps( TDes8& /*aDes*/ ) const
-    {
-    LOGSTR1( "ATDD DAnalyzeToolDevice::GetCaps()" );
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolDevice::Create()
-// Creates the logical channel.
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolDevice::Create( DLogicalChannelBase*& aChannel )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolDevice::Create()" );
-
-    // create new channel
-    aChannel = new DAnalyzeToolChannel;
-
-    // check that everything is OK
-    return ( aChannel != NULL ) ? KErrNone : KErrNoMemory;
-    }
-
-// -----------------------------------------------------------------------------
-// DECLARE_STANDARD_LDD
-// Defines the entry point for a standard logical device driver (LDD),
-// and declares the ordinal 1 export function for creating 
-// the LDD factory object
-// -----------------------------------------------------------------------------
-//
-DECLARE_STANDARD_LDD()
-    {
-    LOGSTR1( "ATDD DECLARE_STANDARD_LDD()" );
-    return new DAnalyzeToolDevice;
-    }
-    
-// ================= OTHER EXPORTED FUNCTIONS =================================
-
-// None
-
-// End of File
--- a/analyzetool/kerneleventhandler/src/analyzetooleventhandler.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,427 +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:  Definitions for the class DAnalyzeToolEventHandler.
-*
-*/
-
-
-// INCLUDE FILES
-#include "analyzetooleventhandler.h"
-#include <kernel/kern_priv.h>
-
-// CONSTANTS
-
-// The handler mutex literal
-_LIT( KHandlerMutexName, "AnalyzeToolHandlerMutex" );
-
-// The handle data mutex literal
-_LIT( KDataMutexName, "AnalyzeToolDataMutex" );
-
-
-// ================= MEMBER FUNCTIONS =========================================
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolEventHandler::Create()
-// C++ default constructor.
-// -----------------------------------------------------------------------------
-//
-TInt DAnalyzeToolEventHandler::Create( DLogicalDevice* aDevice,
-    const TUint aProcessId )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolEventHandler::Create()" );
-    TInt ret( KErrNone );
-    
-    // Store owner process ID
-    iProcessId = aProcessId;
-    LOGSTR2( "ATDD DAnalyzeToolEventHandler::Create > iProcessId %d", 
-            iProcessId );
-    
-    // Open the device
-    ret = aDevice->Open();
-    if ( ret != KErrNone )
-        return ret;
-    iDevice = aDevice;
-
-    // Create mutex for the handler
-    ret = Kern::MutexCreate( iHandlerMutex, KHandlerMutexName, KMutexOrdDebug );
-    if ( ret != KErrNone )
-        return ret;
-    // Create mutex for the data
-    ret = Kern::MutexCreate( iDataMutex, KDataMutexName, KMutexOrdDebug-1 );
-    if ( ret != KErrNone )
-        return ret;
-
-    // Add handler to the handler queue
-    return Add();
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolEventHandler::~DAnalyzeToolEventHandler()
-// C++ default constructor.
-// -----------------------------------------------------------------------------
-//
-DAnalyzeToolEventHandler::~DAnalyzeToolEventHandler()
-    {
-    LOGSTR1( "ATDD DAnalyzeToolEventHandler::~DAnalyzeToolEventHandler()" );
-    
-    CancelInformLibraryEvent();
-    
-    // Close the data mutex
-    if ( iDataMutex )
-        {
-        iDataMutex->Close( NULL );
-        }
-
-    // Close the handler mutex
-    if ( iHandlerMutex )
-        {
-        iHandlerMutex->Close( NULL );
-        }
-
-    // Close the device mutex
-    if ( iDevice )
-        {
-        iDevice->Close( NULL );
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolEventHandler::EventHandler()
-// Function for receiving kernel events
-// -----------------------------------------------------------------------------
-//
-TUint DAnalyzeToolEventHandler::EventHandler( TKernelEvent aEvent, 
-    TAny* a1, TAny* a2, TAny* aThis )
-    {
-    
-    // Clarify the event type
-    switch ( aEvent)
-        {
-        case EEventRemoveLibrary:
-            {
-            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventRemoveLibrary" );
-            // Cast the pointer to the handler
-            DAnalyzeToolEventHandler* handler = 
-            ( ( DAnalyzeToolEventHandler* ) aThis );
-            // Create variable for library information
-            TLibraryEventInfo info;
-            // Set as library remove event
-            info.iEventType = TLibraryEventInfo::ELibraryRemoved;
-            // Handle the event
-            handler->HandleLibraryEvent( ( DLibrary* ) a1, ( DThread* ) a2, info );
-            break;
-            }
-        case EEventAddLibrary:
-            {
-            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventAddLibrary" );
-            // Cast the pointer to the handler
-            DAnalyzeToolEventHandler* handler = 
-            ( ( DAnalyzeToolEventHandler* ) aThis );
-            // Create variable for library information
-            TLibraryEventInfo info;
-            // Set as library remove event
-            info.iEventType = TLibraryEventInfo::ELibraryAdded;
-            // Handle the event
-            handler->HandleLibraryEvent( ( DLibrary* ) a1, ( DThread* ) a2, info );
-            break;
-            }
-        case EEventHwExc:
-            {
-            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventHwExc" );
-            break;
-            }
-        case EEventSwExc:
-            {
-            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventSwExc" );
-            break;
-            }
-        case EEventRemoveThread:
-            {
-            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventRemoveThread" );
-            break;
-            }
-        case EEventKillThread:
-            {
-            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventKillThread" );
-            
-            // Cast the pointer to the handler
-            DAnalyzeToolEventHandler* handler = 
-                ( ( DAnalyzeToolEventHandler* ) aThis );
-            
-            // Create variable for library information
-            TLibraryEventInfo info;
-            
-            // Set as kill thread event
-            info.iEventType = TLibraryEventInfo::EKillThread;
-            // Handle the event
-            handler->HandleKillThreadEvent( ( DThread* ) a1, info );
-            break;
-            }
-        default:
-            {
-            }
-            break;
-        }  
-    return ERunNext;
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolEventHandler::HandleLibraryEvent()
-// Handles the EEventAddLibrary and EEventRemoveLibrary events.
-// -----------------------------------------------------------------------------
-//
-void DAnalyzeToolEventHandler::HandleLibraryEvent( DLibrary* aLib, 
-    DThread* aThread, TLibraryEventInfo& aInfo )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolEventHandler::HandleLibraryEvent()" );
-    
-    // Aqcuire the handler mutex
-    Kern::MutexWait( *iHandlerMutex );
-
-    // Aqcuire the data mutex
-    Kern::MutexWait( *iDataMutex );
-    
-    TBool addInfo( EFalse );
-    
-    // Check the library event type
-    if ( aInfo.iEventType == TLibraryEventInfo::ELibraryAdded )
-        {
-        if ( aThread != NULL )
-            {
-            if ( iProcessId == aThread->iOwningProcess->iId )
-                {
-                LOGSTR1( "ATDD > Process id match" );
-                aInfo.iProcessId = aThread->iOwningProcess->iId;
-                addInfo = ETrue;
-                }
-            }
-        }
-    else if ( aInfo.iEventType == TLibraryEventInfo::ELibraryRemoved )
-        {
-        if ( aThread != NULL )
-            {
-            aInfo.iProcessId = aThread->iOwningProcess->iId;
-            }
-        else
-            {
-            aInfo.iProcessId = 0;
-            }
-        addInfo = ETrue;
-        }
-    
-    if ( addInfo )
-        {
-        // Store lib info
-        aLib->AppendName( aInfo.iLibraryName );//lint !e64 !e1514
-        aInfo.iSize = aLib->iCodeSeg->iSize;
-        aInfo.iRunAddress = aLib->iCodeSeg->iRunAddress;
-        // Store library event info to the array
-        iEventArray.Append( aInfo );
-        LOGSTR2( "ATDD > iEventArray.Count() = %d", iEventArray.Count() );
-        
-        // if client has subscribed the event it is queued
-        if ( iClientThread != NULL )
-            {
-            iEventDfc.Enque();
-            }
-        }
-     
-    // Release the data mutex
-    Kern::MutexSignal( *iDataMutex );
-
-    // Release the handler mutex
-    Kern::MutexSignal( *iHandlerMutex );
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolEventHandler::InformLibraryEvent()
-// Subscribes library event.
-// -----------------------------------------------------------------------------
-//
-void DAnalyzeToolEventHandler::InformLibraryEvent( TRequestStatus* aStatus, 
-                                                   TAny* aLibraryInfo,
-                                                   TThreadMessage& aMessage )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolEventHandler::InformLibraryEvent()" );
-
-    // Aqcuire the data mutex
-    Kern::MutexWait( *iDataMutex );  
-    
-    // Check if request from client which is already pending
-    DThread* current = aMessage.Client();
-    
-    LOGSTR2( "ATDD > Current Thread ID = %d", current->iId );
- 
-    // Ensure that client doesn't subscribe service when there is a pending
-    // subscription
-    if ( NULL != iClientThread )
-        {
-        aMessage.PanicClient( KClientPanic, EPanicRequestPending );
-        }
-    else
-        {
-        // Store the client variable pointers
-        iClientThread         = current;
-        iClientRequestStatus  = aStatus;
-        iClientInfo           = aLibraryInfo;
-        }
-    
-    // Release the data mutex
-    Kern::MutexSignal( *iDataMutex );
-    
-    // Queue the event since now the client has subscribed it
-    iEventDfc.Enque();
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolEventHandler::CancelInformLibraryEvent
-// Cancels subscription of the library event.
-// -----------------------------------------------------------------------------
-//
-void DAnalyzeToolEventHandler::CancelInformLibraryEvent()
-    {
-    LOGSTR1( "ATDD DAnalyzeToolEventHandler::CancelInformLibraryEvent()" );
-    
-    iEventDfc.Cancel();
-    
-    // Aqcuire the data mutex
-    Kern::MutexWait( *iDataMutex );
-
-    if ( NULL != iClientThread && iEventArray.Count() > 0 )
-        {
-        // Signal the request as complete
-        Kern::RequestComplete( iClientThread, 
-                               iClientRequestStatus, 
-                               KErrCancel );
-        
-        iClientThread         = NULL;
-        iClientRequestStatus  = NULL;
-        iClientInfo           = NULL;
-
-        // Reset the event array
-        iEventArray.Reset();
-        }
-   
-    // Release the data mutex
-    Kern::MutexSignal( *iDataMutex );
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolEventHandler::HandleKillThreadEvent()
-// Handles the EEventKillThread events.
-// -----------------------------------------------------------------------------
-//
-void DAnalyzeToolEventHandler::HandleKillThreadEvent( DThread* aThread, 
-                                                      TLibraryEventInfo& aInfo )
-    {
-    LOGSTR1( "ATDD DAnalyzeToolEventHandler::HandleKillThreadEvent()" );
-    
-    // Aqcuire the handler mutex
-    Kern::MutexWait( *iHandlerMutex );
-
-    // 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 )
-            {
-            // Set current Thread id
-            LOGSTR2( "ATDD > Thread ID = %d", aThread->iId );
-            aInfo.iThreadId = aThread->iId;
-            // Append event to array (beginning of the array)
-            iEventArray.Insert( aInfo, 0 );
-            
-            // if client has subscribed the event it is queued
-            if ( iClientThread != NULL )
-                {
-                iEventDfc.Enque();
-                }
-            }
-        }
-    
-    // Release the data mutex
-    Kern::MutexSignal( *iDataMutex );
-
-    // Release the handler mutex
-    Kern::MutexSignal( *iHandlerMutex );
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolEventHandler::DoEventComplete()
-// Informs client about the occured event.
-// -----------------------------------------------------------------------------
-//
-void DAnalyzeToolEventHandler::DoEventComplete()
-    {
-    LOGSTR1( "ATDD DAnalyzeToolEventHandler::DoEventComplete()" );
-    
-    // Aqcuire the handler mutex
-    Kern::MutexWait( *iHandlerMutex );
-
-    // Aqcuire the data mutex
-    Kern::MutexWait( *iDataMutex );
-    
-    if ( NULL != iClientThread && iEventArray.Count() > 0 )
-        {
-        TInt ret = Kern::ThreadRawWrite( iClientThread, 
-                                         iClientInfo, 
-                                         &iEventArray[0],
-                                         sizeof( iEventArray[0] ) );
-        
-        LOGSTR2( "ATDD > ThreadRawWrite err = %d", ret );
-        
-        // Signal the request as complete
-        Kern::RequestComplete( iClientThread, 
-                               iClientRequestStatus, 
-                               ret );
-        
-        // Remove first item to array
-        iEventArray.Remove( 0 );
-        
-        // Compresses the array down to a minimum
-        iEventArray.Compress();
-        
-        // Ensure that pointers are set to NULL
-        iClientThread         = NULL;
-        iClientRequestStatus  = NULL;
-        iClientInfo           = NULL;
-        
-        LOGSTR2( "ATDD > iEventArray = %d", iEventArray.Count() );
-        }
-    
-    // Release the data mutex
-    Kern::MutexSignal( *iDataMutex );
-
-    // Release the handler mutex
-    Kern::MutexSignal( *iHandlerMutex );
-    }
-
-// -----------------------------------------------------------------------------
-// DAnalyzeToolEventHandler::EventDfc()
-// Static function for DFC events.
-// -----------------------------------------------------------------------------
-//
-void DAnalyzeToolEventHandler::EventDfc(TAny* aPtr)
-    {
-    LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventDfc()" ); 
-    ( (DAnalyzeToolEventHandler*) aPtr )->DoEventComplete();
-    }
-
-// End of File
--- a/analyzetool/rom/analyzetool.iby	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2008 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 __ANALYZETOOL_IBY__
-#define __ANALYZETOOL_IBY__
-
-// Stub
-data=ZSYSTEM\Install\analyzetool_stub.sis                   \system\install\analyzetool_stub.sis
-
-#endif // __ANALYZETOOL_IBY__
--- a/analyzetool/rom/analyzetool_rom.iby	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2008 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 __ANALYZETOOL_ROM_IBY__
-#define __ANALYZETOOL_ROM_IBY__
-
-
-// Kernel event handler
-device[VARID]=ABI_DIR\BUILD_DIR\atoolkerneleventhandler.ldd     SHARED_LIB_DIR\atoolkerneleventhandler.ldd
-
-// Memory hook
-file=ABI_DIR\BUILD_DIR\atoolmemoryhook.dll                      SHARED_LIB_DIR\atoolmemoryhook.dll
-
-// Cleaner
-file=ABI_DIR\BUILD_DIR\atoolcleaner.dll           	            SHARED_LIB_DIR\atoolcleaner.dll
-
-// Storage server
-file=ABI_DIR\BUILD_DIR\atoolstorageserver.exe                   PROGRAMS_DIR\atoolstorageserver.exe
-file=ABI_DIR\BUILD_DIR\atoolstorageserverclnt.dll               SHARED_LIB_DIR\atoolstorageserverclnt.dll
-
-
-#endif // __ANALYZETOOL_ROM_IBY__
--- a/analyzetool/sis/AnalyzeTool.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +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:
-;
-
-;Language - standard language definitions
-&EN
-
-; standard SIS file header
-#{"AnalyzeTool"},(0x20012432),1,9,1,TYPE=SA, RU
-
-;Localised Vendor name
-%{"Nokia Corporation"}
-
-;Unique Vendor name
-:"Nokia Corporation"
-
-;Supports Series 60 v 3.1
-[0x102032BE], 0, 0, 0, {"Series60ProductID"}
-
-;Supports S60 release 5.0
-[0x1028315F], 0, 0, 0, {"Series60ProductID"}
-
-"\epoc32\release\armv5\urel\atoolkerneleventhandler.ldd"            -"!:\sys\bin\atoolkerneleventhandler.ldd"
-"\epoc32\release\armv5\urel\atoolmemoryhook.dll"                    -"!:\sys\bin\atoolmemoryhook.dll"
-"\epoc32\release\armv5\urel\atoolstorageserver.exe"                 -"!:\sys\bin\atoolstorageserver.exe"
-"\epoc32\release\armv5\urel\atoolstorageserverclnt.dll"             -"!:\sys\bin\atoolstorageserverclnt.dll"
-"\epoc32\release\armv5\urel\atoolcleaner.dll"                 		-"!:\sys\bin\atoolcleaner.dll"
-
-; Install console application
-"\epoc32\release\armv5\urel\atool.exe"-"!:\sys\bin\atool.exe"
\ No newline at end of file
--- a/analyzetool/sis/AnalyzeTool_udeb.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +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:
-;
-
-;Language - standard language definitions
-&EN
-
-; standard SIS file header
-#{"AnalyzeTool"},(0x20012432),1,9,1,TYPE=SA, RU
-
-;Localised Vendor name
-%{"Nokia Corporation"}
-
-;Unique Vendor name
-:"Nokia Corporation"
-
-;Supports Series 60 v 3.1
-[0x102032BE], 0, 0, 0, {"Series60ProductID"}
-
-;Supports S60 release 5.0
-[0x1028315F], 0, 0, 0, {"Series60ProductID"}
-
-"\epoc32\release\armv5\udeb\atoolkerneleventhandler.ldd"            -"!:\sys\bin\atoolkerneleventhandler.ldd"
-"\epoc32\release\armv5\udeb\atoolmemoryhook.dll"                    -"!:\sys\bin\atoolmemoryhook.dll"
-"\epoc32\release\armv5\udeb\atoolstorageserver.exe"                 -"!:\sys\bin\atoolstorageserver.exe"
-"\epoc32\release\armv5\udeb\atoolstorageserverclnt.dll"             -"!:\sys\bin\atoolstorageserverclnt.dll"
-"\epoc32\release\armv5\urel\atoolcleaner.dll"                 		-"!:\sys\bin\atoolcleaner.dll"
-
-; Install console application
-"\epoc32\release\armv5\udeb\atool.exe"-"!:\sys\bin\atool.exe"
\ No newline at end of file
--- a/analyzetool/sis/analyzeTool_stub.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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:
-;
-
-;Languages
-&EN
-
-;Header
-#{"AnalyzeTool"}, (0x20012432), 1,9,1
-
-; Non-localised vendor name
-:"Nokia Corporation"
-
-; Localised vendor names
-%{"Nokia Corporation"}
-
-; AnalyzeTool binaries
-""-"z:\sys\bin\atoolkerneleventhandler.ldd"
-""-"z:\sys\bin\atoolmemoryhook.dll"
-""-"z:\sys\bin\atoolstorageserver.exe"
-""-"z:\sys\bin\atoolstorageserverclnt.dll"
-""-"z:\sys\bin\atoolcleaner.dll"
-
-""-"z:\sys\bin\atool.exe"
\ No newline at end of file
--- a/analyzetool/staticlib/group/atoolstaticlib.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +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:  The .mmp file for AToolStaticLib.
-*
-*/
-
-#include <platform_paths.hrh>
-
-TARGET        atoolstaticlib.lib
-TARGETTYPE    lib
-UID           0x1000008d 0x20018421//0x02DF7F96
-CAPABILITY    ALL -TCB
-
-SMPSAFE
-
-USERINCLUDE   ../../inc
-SOURCEPATH    ../src
-SOURCE        atoolstaticlib.cpp
-
-OS_LAYER_SYSTEMINCLUDE
-
-
-
--- a/analyzetool/staticlib/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +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 <platform_paths.hrh>
-
-PRJ_PLATFORMS
-ARMV5 WINSCW
-
-PRJ_EXPORTS
-../../dynamicmemoryhook/inc/customuser.h OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/customuser.h)
-
-PRJ_MMPFILES
-atoolstaticlib.mmp
--- a/analyzetool/staticlib/src/atoolstaticlib.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +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:  The file contains declarations of extern methods and definitions
-*                of overloaded User methods.
-*
-*/
-
-
-#include <analyzetool/customuser.h>
-#include "atlog.h"
-
-// -----------------------------------------------------------------------------
-// GetInt()
-// Extern function for acquiring all integer values
-// -----------------------------------------------------------------------------
-// 
-GLREF_C TInt GetInt( const TUint8 aType );
-
-// -----------------------------------------------------------------------------
-// GetString()
-// Extern function for acquiring all string values
-// -----------------------------------------------------------------------------
-//
-GLREF_C TPtrC GetString( const TUint8 aType );
-
-// -----------------------------------------------------------------------------
-// User::Exit()
-// Overloaded User::Exit() function
-// -----------------------------------------------------------------------------
-// 
-void User::Exit( TInt aReason )
-    {   
-    LOGSTR2( "ATMH User::Exit %i", aReason ); 
-    CustomUser::Exit( aReason );
-    }
-
-// -----------------------------------------------------------------------------
-// User::Panic()
-// Overloaded User::Panic() function
-// -----------------------------------------------------------------------------
-//
-void User::Panic( const TDesC& aCategory, TInt aReason )
-    {
-    LOGSTR3( "ATMH User::Panic() %S %i", &aCategory, aReason );
-    CustomUser::Panic( aCategory, aReason );
-    }
- 
-// -----------------------------------------------------------------------------
-// User::SetCritical()
-// Overloaded User::SetCritical() function which returns
-// KErrNone, if successful; KErrArgument, if EAllThreadsCritical is 
-// passed - this is a state associated with a process, and you use 
-// User::SetProcessCritical() to set it.
-// -----------------------------------------------------------------------------
-// 
-TInt User::SetCritical( TCritical aCritical )
-    {
-    LOGSTR2( "ATMH User::SetCritical() %i", aCritical );
-    return CustomUser::SetCritical( aCritical );
-    }
-
-// -----------------------------------------------------------------------------
-// User::SetProcessCritical()
-// Overloaded User::SetProcessCritical() function
-// KErrNone, if successful; KErrArgument, if either EProcessCritical or 
-// EProcessPermanent is passed - these are states associated with a 
-// thread, and you use User::SetCritical() to set them.
-// -----------------------------------------------------------------------------
-// 
-TInt User::SetProcessCritical( TCritical aCritical )
-    {
-    LOGSTR2( "ATMH User::SetProcessCritical() %i", aCritical );
-    return CustomUser::SetProcessCritical( aCritical );
-    }
-    
-// -----------------------------------------------------------------------------
-// UserHeap::SetupThreadHeap()
-// Overloaded UserHeap::SetupThreadHeap function
-// -----------------------------------------------------------------------------
-//  
-TInt UserHeap::SetupThreadHeap( TBool aNotFirst, 
-                                SStdEpocThreadCreateInfo& aInfo )
-    {
-    LOGSTR1( "ATMH UserHeap::SetupThreadHeap()" );
-        
-    // Check validity of parameters 
-    TInt logOption( GetInt( (TUint8) CustomUser::ELogOption ) );
-    if ( logOption < 0 )
-        logOption = KATDefaultLogOption;
-    
-    TInt debug( GetInt( (TUint8) CustomUser::EDebug ) );
-    if ( debug < 0 )
-        debug = KATDefaultDebug;
-    
-    TInt allocCallStack( GetInt( (TUint8) CustomUser::EAllocCallStackSize ) );
-    if ( allocCallStack < 0 )
-        allocCallStack = KATDefaultAllocCallStackSize;
-    
-    TInt freeCallStack( GetInt( (TUint8) CustomUser::EFreeCallStackSize ) );
-    if ( freeCallStack < 0 )
-        freeCallStack = KATDefaultFreeCallStackSize;
-        
-    return CustomUser::SetupThreadHeap( aNotFirst, aInfo, 
-            GetString( (TUint8) CustomUser::ELogFileName ),
-            (TUint32) logOption, (TUint32) debug,
-            GetString( (TUint8) CustomUser::EVersion ),
-            (TUint32) allocCallStack, (TUint32) freeCallStack,
-            KATArgumentList );
-    }
-  
-// End of File
--- a/analyzetool/storageserver/client/bwins/atoolstorageserverclntu.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-EXPORTS
-	??0RATStorageServer@@QAE@XZ @ 1 NONAME ; RATStorageServer::RATStorageServer(void)
-	?CancelLogging@RATStorageServer@@QAEHI@Z @ 2 NONAME ; int RATStorageServer::CancelLogging(unsigned int)
-	?CheckMemoryAddress@RATStorageServer@@QBEHK@Z @ 3 NONAME ; int RATStorageServer::CheckMemoryAddress(unsigned long) const
-	?Close@RATStorageServer@@QAEXXZ @ 4 NONAME ; void RATStorageServer::Close(void)
-	?Connect@RATStorageServer@@QAEHXZ @ 5 NONAME ; int RATStorageServer::Connect(void)
-	?GetCurrentAllocsL@RATStorageServer@@QAEHIAAK0@Z @ 6 NONAME ; int RATStorageServer::GetCurrentAllocsL(unsigned int, unsigned long &, unsigned long &)
-	?GetLoadedDllsL@RATStorageServer@@QAEHIAAV?$RArray@V?$TBuf8@$0DM@@@@@@Z @ 7 NONAME ; int RATStorageServer::GetLoadedDllsL(unsigned int, class RArray<class TBuf8<60> > &)
-	?GetLoggingFileL@RATStorageServer@@QAEHIAAVTDes8@@@Z @ 8 NONAME ; int RATStorageServer::GetLoggingFileL(unsigned int, class TDes8 &)
-	?GetLoggingModeL@RATStorageServer@@QAEHIAAW4TATLogOption@@@Z @ 9 NONAME ; int RATStorageServer::GetLoggingModeL(unsigned int, enum TATLogOption &)
-	?GetMaxAllocsL@RATStorageServer@@QAEHIAAK0@Z @ 10 NONAME ; int RATStorageServer::GetMaxAllocsL(unsigned int, unsigned long &, unsigned long &)
-	?GetProcessesL@RATStorageServer@@QAEHAAV?$RArray@VTATProcessInfo@@@@@Z @ 11 NONAME ; int RATStorageServer::GetProcessesL(class RArray<class TATProcessInfo> &)
-	?GetUdebL@RATStorageServer@@QAEHIAAK@Z @ 12 NONAME ; int RATStorageServer::GetUdebL(unsigned int, unsigned long &)
-	?IsMemoryAdded@RATStorageServer@@QAEHK@Z @ 13 NONAME ; int RATStorageServer::IsMemoryAdded(unsigned long)
-	?LogDllLoaded@RATStorageServer@@QAEHABVTDesC8@@KK@Z @ 14 NONAME ; int RATStorageServer::LogDllLoaded(class TDesC8 const &, unsigned long, unsigned long)
-	?LogDllUnloaded@RATStorageServer@@QAEHABVTDesC8@@KK@Z @ 15 NONAME ; int RATStorageServer::LogDllUnloaded(class TDesC8 const &, unsigned long, unsigned long)
-	?LogMemoryAllocated@RATStorageServer@@QAEHKAAV?$TFixedArray@K$0BAA@@@H@Z @ 16 NONAME ; int RATStorageServer::LogMemoryAllocated(unsigned long, class TFixedArray<unsigned long, 256> &, int)
-	?LogMemoryFreed@RATStorageServer@@QAEHKAAV?$TFixedArray@K$0BAA@@@@Z @ 17 NONAME ; int RATStorageServer::LogMemoryFreed(unsigned long, class TFixedArray<unsigned long, 256> &)
-	?LogProcessEnded@RATStorageServer@@QAEHII@Z @ 18 NONAME ; int RATStorageServer::LogProcessEnded(unsigned int, unsigned int)
-	?LogProcessStarted@RATStorageServer@@QAEHABVTDesC16@@ABVTDesC8@@IKK@Z @ 19 NONAME ; int RATStorageServer::LogProcessStarted(class TDesC16 const &, class TDesC8 const &, unsigned int, unsigned long, unsigned long)
-	?StartSubTest@RATStorageServer@@QAEHABVTDesC8@@@Z @ 20 NONAME ; int RATStorageServer::StartSubTest(class TDesC8 const &)
-	?StartSubTest@RATStorageServer@@QAEHIABVTDesC8@@H@Z @ 21 NONAME ; int RATStorageServer::StartSubTest(unsigned int, class TDesC8 const &, int)
-	?StopSubTest@RATStorageServer@@QAEHABVTDesC8@@@Z @ 22 NONAME ; int RATStorageServer::StopSubTest(class TDesC8 const &)
-	?StopSubTest@RATStorageServer@@QAEHIABVTDesC8@@H@Z @ 23 NONAME ; int RATStorageServer::StopSubTest(unsigned int, class TDesC8 const &, int)
-	?Version@RATStorageServer@@QBE?AVTVersion@@XZ @ 24 NONAME ; class TVersion RATStorageServer::Version(void) const
-
--- a/analyzetool/storageserver/client/eabi/atoolstorageserverclntu.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-EXPORTS
-	_ZN16RATStorageServer11StopSubTestERK6TDesC8 @ 1 NONAME
-	_ZN16RATStorageServer11StopSubTestEjRK6TDesC8i @ 2 NONAME
-	_ZN16RATStorageServer12LogDllLoadedERK6TDesC8mm @ 3 NONAME
-	_ZN16RATStorageServer12StartSubTestERK6TDesC8 @ 4 NONAME
-	_ZN16RATStorageServer12StartSubTestEjRK6TDesC8i @ 5 NONAME
-	_ZN16RATStorageServer13CancelLoggingEj @ 6 NONAME
-	_ZN16RATStorageServer13GetMaxAllocsLEjRmS0_ @ 7 NONAME
-	_ZN16RATStorageServer13GetProcessesLER6RArrayI14TATProcessInfoE @ 8 NONAME
-	_ZN16RATStorageServer13IsMemoryAddedEm @ 9 NONAME
-	_ZN16RATStorageServer14GetLoadedDllsLEjR6RArrayI5TBuf8ILi60EEE @ 10 NONAME
-	_ZN16RATStorageServer14LogDllUnloadedERK6TDesC8mm @ 11 NONAME
-	_ZN16RATStorageServer14LogMemoryFreedEmR11TFixedArrayImLi256EE @ 12 NONAME
-	_ZN16RATStorageServer15GetLoggingFileLEjR5TDes8 @ 13 NONAME
-	_ZN16RATStorageServer15GetLoggingModeLEjR12TATLogOption @ 14 NONAME
-	_ZN16RATStorageServer15LogProcessEndedEjj @ 15 NONAME
-	_ZN16RATStorageServer17GetCurrentAllocsLEjRmS0_ @ 16 NONAME
-	_ZN16RATStorageServer17LogProcessStartedERK7TDesC16RK6TDesC8jmm @ 17 NONAME
-	_ZN16RATStorageServer18LogMemoryAllocatedEmR11TFixedArrayImLi256EEi @ 18 NONAME
-	_ZN16RATStorageServer5CloseEv @ 19 NONAME
-	_ZN16RATStorageServer7ConnectEv @ 20 NONAME
-	_ZN16RATStorageServer8GetUdebLEjRm @ 21 NONAME
-	_ZN16RATStorageServerC1Ev @ 22 NONAME
-	_ZN16RATStorageServerC2Ev @ 23 NONAME
-	_ZNK16RATStorageServer18CheckMemoryAddressEm @ 24 NONAME
-	_ZNK16RATStorageServer7VersionEv @ 25 NONAME
-
--- a/analyzetool/storageserver/client/group/atoolstorageserverclnt.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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:  The .mmp file for the client side of AToolStorageServer
-*
-*/
-
-#include <platform_paths.hrh>
-
-TARGET            atoolstorageserverclnt.dll
-TARGETTYPE        dll
-UID               0x1000008d 0x20012431
-CAPABILITY        ALL -TCB
-
-SMPSAFE
-
-SOURCEPATH        ../src
-
-SOURCE            atstorageserverclnt.cpp
-
-USERINCLUDE       ../inc
-USERINCLUDE       ../../inc
-USERINCLUDE       ../../server/inc
-USERINCLUDE       ../../../inc
-
-OS_LAYER_SYSTEMINCLUDE
-
-LIBRARY           euser.lib
-LIBRARY           flogger.lib
-
-// End of File
--- a/analyzetool/storageserver/client/inc/atstorageserverclnt.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +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:  Declaration of the client side handle class RATStorageServer
-*
-*/
-
-
-
-#ifndef ATSTORAGESERVERCLNT_H
-#define ATSTORAGESERVERCLNT_H
-
-
-// INCLUDES
-#include    <e32base.h>
-#include    <analyzetool/atcommon.h>
-
-
-// CONSTANTS
-// Constants for the lowest version of the server with which the
-// client is compatible
-const TUint KLowestVersionNumberMaj = 0;
-const TUint KLowestVersionNumberMin = 1;
-const TUint KLowestVersionNumberBld = 1;
-
-
-// FORWARD DECLARATIONS
-class TATProcessInfo;
-
-
-// CLASS DECLARATION
-
-/**
-*  The main class of the Storage Server client. Objects of this class work as handles
-*  to the Storage Server's server side. Use Connect() to connect a client to the server,
-*  and Close() to end an opened session.
-*/
-class RATStorageServer: public RSessionBase
-    {
-    public:  // Constructor and destructor
-       
-        /**
-        * C++ default constructor.
-        */
-        IMPORT_C RATStorageServer();
-   
-    public: // New functions
-        
-        /**
-        * Creates a new process for the server, if that doesn't already exist, and
-        * connects a client to the server by creating a new session with it, and
-        * initializes the client for use. To end the server session, use Close().
-        * @return KErrNone, if successful; otherwise one of the other
-        *   system-wide error codes.
-        */
-        IMPORT_C TInt Connect();
-    
-        /**
-        * Closes a handle to a server session. This has also the effect of destroying
-        * the associated server side session object. Also, the server itself and the
-        * process where it is running are destroyed, if there are no other open sessions
-        * left.
-        */
-        IMPORT_C void Close();
-    
-        /**
-        * This method is called to initialize the server for logging and it is to be
-        * called as the first method after connecting to the server. The method informs
-        * the server that a new process has been started. The method cannot be called
-        * again without a call to the LogProcessEnded() first. Otherwise a STSEClient: 3
-        * panic is raised. A KERN-EXEC: 0 panic is raised if the client is not connected
-        * to the server.
-        * @param aFileName The name of the logging file used when the system is logging
-        *   to a file (the logging mode is EATLogToFile). The length of aFileName must not be
-        *   greater than KMaxFileName, otherwise the method raises a STSEClient: 2 panic.
-        * @param aProcessName The name of the new process started. The length of this
-        *   descriptor must not be greater than KMaxProcessName, otherwise the method
-        *   raises a STSEClient: 2 panic.
-        * @param aProcessId The ID of the process started.
-        * @param aLogOption An option telling the logging mode.
-        * @param aIsDebug Determines whether a binary is UDEB or UREL
-        * @return KErrNone, if successful; otherwise one of the other
-        *   system-wide error codes.
-        */
-        IMPORT_C TInt LogProcessStarted( const TDesC& aFileName,
-                                         const TDesC8& aProcessName,
-                                         TUint aProcessId,
-                                         TUint32 aLogOption, TUint32 aIsDebug );
-        
-        /**
-        * Asks the server to log that a new DLL has been loaded. Note, the method
-        * LogProcessStarted() has to be previously called. Otherwise a STSEClient: 3
-        * panic is raised. A KERN-EXEC: 0 panic is raised if the client is not connected
-        * to the server.
-        * @param aDllName The name of the new DLL loaded. The length of this descriptor
-        *   must not be greater than KMaxLibraryName, otherwise the method raises a
-        *   STSEClient: 2 panic.
-        * @param aStartAddress The start address of the DLL loaded.
-        * @param aEndAddress The end address of the DLL loaded.
-        * @return KErrNone, if successful; otherwise one of the other
-        *   system-wide error codes.
-        */
-        IMPORT_C TInt LogDllLoaded( const TDesC8& aDllName, TUint32 aStartAddress,
-                                              TUint32 aEndAddress );
-        
-        /**
-        * Asks the server to log that a new DLL has been unloaded. Note, the method
-        * LogProcessStarted() has to be previously called. Otherwise a STSEClient: 3
-        * panic is raised. A KERN-EXEC: 0 panic is raised if the client is not connected
-        * to the server. If the method is called with illegal parameter values, a
-        * STSEClient: 2 panic is raised.
-        * @param aDllName The name of the DLL to be unloaded. The length of this
-        *   descriptor must not be greater than KMaxLibraryName, otherwise the method
-        *   raises a STSEClient: 2 panic.
-        * @param aStartAddress The start address of the DLL to be unloaded.
-        * @param aEndAddress The end address of the DLL to be unloaded.
-        * @return KErrNone, if successful; otherwise one of the other
-        *   system-wide error codes.
-        */
-        IMPORT_C TInt LogDllUnloaded( const TDesC8& aDllName, TUint32 aStartAddress,
-                                               TUint32 aEndAddress );
-        
-        /**
-        * Informs the server that a memory allocation has occured at the specified
-        * address. Sends also the current call stack to the server. Note, the method
-        * LogProcessStarted() has to be previously called. Otherwise a STSEClient: 3 
-        * panic is raised. A KERN-EXEC: 0 panic is raised if the client is not connected
-        * to the server.
-        * @param aMemAddress The memory location where memory has been allocated.
-        * @param aCallstack An array including the current call stack.
-        * @param aSize The size of the newly allocated memory chunk.
-        * @return KErrNone, if successful; otherwise one of the other
-        *   system-wide error codes.
-        */
-        IMPORT_C TInt LogMemoryAllocated( TUint32 aMemAddress,
-                                          TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
-                                          TInt aSize );
-                
-        /**
-        * Informs the server that memory was released at the specified address. Note,
-        * the method LogProcessStarted() has to be previously called. Otherwise a 
-        * STSEClient: 3 panic is raised. A KERN-EXEC: 0 panic is raised if the client is
-        * not connected to the server.
-        * @param aMemAddress The memory location where memory has been deallocated.
-        * @param aFreeCallstack An array including the current call stack.
-        * @return KErrNone, if successful; otherwise one of the other
-        *   system-wide error codes.
-        */
-        IMPORT_C TInt LogMemoryFreed( TUint32 aMemAddress, 
-                                      TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack );
-        
-        /**
-        * Tells the server that the process under test has been ended. Prints information
-        * related to process ending, such as possibly occured memory leaks (when file
-        * logging mode used), and possibly occured handle leaks. Note, the method 
-        * LogProcessStarted() has to be previously called. Otherwise a STSEClient:
-        * 3 panic is raised. A call to this method also closes the file opened for
-        * the current process. So, no further logging is possible without a new call
-        * to the method LogProcessStarted(). A KERN-EXEC: 0 panic is raised if the client
-        * is not connected to the server.
-        * @param aProcessId The ID number of the process ended.
-        * @param aHandleLeaks Amount of handle leaks.
-        * @return KErrNone, if successful; otherwise one of the other
-        *   system-wide error codes.
-        */
-        IMPORT_C TInt LogProcessEnded( TUint aProcessId, 
-                                       TUint aHandleLeaks );
-           
-        /**
-        * Gives the lowest version number of the server needed for this client.
-        * @return The lowest version of the server needed for this client.
-        */
-        IMPORT_C TVersion Version() const;  
-
-        /**
-        * Checks if the current process has allocated, but not freed, the given memory
-        * address. Note, the method LogProcessStarted() has to be previously called.
-        * Otherwise a STSEClient: 3 panic is raised. A KERN-EXEC: 0 panic is raised if
-        * the client is not connected to the server.
-        * @param aMemAddress The memory location to check.
-        * @return When the system is logging into a file: the index of a found 
-        *   memory address or KErrNotFound, if a matching memory address cannot
-        *   be found. When the system is not logging into a file: always KErrNone.
-        */
-        IMPORT_C TInt CheckMemoryAddress( TUint32 aMemAddress ) const;
-        
-        /**
-        * Gets all the processes with currently open logging sessions.
-        * @param aProcesses A reference to a process array to be filled by the server.
-        * @return KErrNone, if successful; otherwise one of the other
-        *   system wide error codes.
-        */
-        IMPORT_C TInt GetProcessesL( RArray<TATProcessInfo>& aProcesses );
-        
-        /**
-        * Gets all the DLLs loaded by the given process.
-        * @param aProcessId The ID of the process whose DLLs will be fetched.
-        * @param aDlls An array that after this function call includes names of
-        *   the given process's dlls
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was
-        *   not found; otherwise one of the other system wide error codes.
-        */
-        IMPORT_C TInt GetLoadedDllsL( TUint aProcessId,
-                                      RArray< TBuf8<KMaxLibraryName> >& aDlls );
-                
-        /**
-        * Gets the logging mode of the given process.
-        * @param aProcessId The ID of the process whose logging mode is being asked.
-        * @param aLoggingMode An enumeration telling the logging mode after a call
-        *   to this function.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was
-        *   not found; otherwise one of the other system wide error codes.
-        */
-        IMPORT_C TInt GetLoggingModeL( TUint aProcessId, TATLogOption& aLoggingMode );
-        
-        /**
-        * Starts a sub test for the given process.
-        * @param aProcessId The ID of the process for which to start a sub test.
-        * @param aSubtestId The name identifying this particular sub test. The length
-        *   of this descriptor must not be greater than KATMaxSubtestIdLength, or
-        *   otherwise the method raises a STSEClient: 2 panic.
-        * @param aHandleCount The current handle count of a particular process.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was not
-        *   found; KErrNotSupported, if the requested process does not have a logging
-        *   session ongoing or its logging mode is not EATLogToTrace; Otherwise one of the
-        *   other system wide error codes.
-        */
-        IMPORT_C TInt StartSubTest( TUint aProcessId, const TDesC8& aSubtestId, TInt aHandleCount = 0 );
-
-        /**
-        * Stops a sub test for the given process.
-        * @param aProcessId The ID of the process for which to stop a sub test.
-        * @param aSubtestId The name identifying this particular sub test. The length
-        *   of this descriptor must not be greater than KATMaxSubtestIdLength, or
-        *   otherwise the method raises a STSEClient: 2 panic.
-        * @param aHandleCount The current handle count of a particular process.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was not
-        *   found; KErrNotSupported, if the requested process does not have a logging
-        *   session ongoing or its logging mode is not EATLogToTrace; Otherwise one of the
-        *   other system wide error codes.
-        */
-        IMPORT_C TInt StopSubTest( TUint aProcessId, const TDesC8& aSubtestId, TInt aHandleCount = 0 );
-        
-        /**
-        * Gets the number and total size of the memory chunks currently allocated by the
-        * requested process. 
-        * @param aProcessId The ID of the process whose information is requested.
-        * @param aNumber On return contains the number of memory chunks currenlty
-        *   allocated by the requested process.
-        * @param aSize On return contains the amount of memory currently allocated
-        *   by the requested process.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was not
-        *   found; Otherwise one of the other system wide error codes.
-        */
-        IMPORT_C TInt GetCurrentAllocsL( TUint aProcessId, TUint32& aNumber, TUint32& aSize );
-        
-        /**
-        * Gets the maximum number and total size of the memory chunks allocated by the
-        * requested process. 
-        * @param aProcessId The ID of the process whose information is requested.
-        * @param aNumber On return contains the maximum number of memory chunks
-        *   allocated by the requested process during the test run.
-        * @param aSize On return contains the maximum amount of memory allocated
-        *   by the requested process during the test run.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was not
-        *   found; Otherwise one of the other system wide error codes.
-        */
-        IMPORT_C TInt GetMaxAllocsL( TUint aProcessId, TUint32& aNumber, TUint32& aSize );
-        
-        /**
-        * Starts a sub test for the calling process.
-        * @param aSubtestId The name identifying this particular sub test. The length
-        *   of this descriptor must not be greater than KATMaxSubtestIdLength, or
-        *   otherwise the method raises a STSEClient: 2 panic.
-        * @return KErrNone, if successful; KErrNotSupported, if the calling process
-        *   does not have a logging session ongoing or its logging mode is not
-        *   EATLogToTrace; Otherwise one of the other system wide error codes.
-        */
-        IMPORT_C TInt StartSubTest( const TDesC8& aSubtestId );
-
-        /**
-        * Stops a sub test for the calling process
-        * @param aSubtestId The name identifying this particular sub test. The length
-        *   of this descriptor must not be greater than KATMaxSubtestIdLength, or
-        *   otherwise the method raises a STSEClient: 2 panic.
-        * @return KErrNone, if successful; KErrNotSupported, if the calling process
-        *   does not have a logging session ongoing or its logging mode is not
-        *   EATLogToTrace; Otherwise one of the other system wide error codes.
-        */
-        IMPORT_C TInt StopSubTest( const TDesC8& aSubtestId );
-        
-        /**
-        * Cancels logging for the requested process. After logging of a given process
-        * has been cancelled, the session associated with that process will not be
-        * usable anymore. If a process wants to start logging again, it needs to close
-        * the handle and open it again in order to create a new session. Until then, most
-        * of the client's methods will return KErrCancel.
-        * @param aProcessId The process ID of the process whose logging is requested to
-        *   be cancelled.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was
-        *   not found; otherwise one of the other system wide error codes.
-        */
-        IMPORT_C TInt CancelLogging( TUint aProcessId );
-
-        /**
-        * Gets the number and total size of the memory chunks currently allocated by the
-        * requested process. 
-        * @param aProcessId The ID of the process whose information is requested.
-        * @param aIsUdeb On return contains an value greater than KErrNone if
-        *   mode is UDEB. Else the mode is UREL
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was not
-        *   found; Otherwise one of the other system wide error codes.
-        */
-        IMPORT_C TInt GetUdebL( TUint aProcessId, TUint32& aIsUdeb );
-
-        /**
-        * Gets the number and total size of the memory chunks currently allocated by the
-        * requested process. 
-        * @param aProcessId The ID of the process whose information is requested.
-        * @param aFileName On return contains logging filename for the process.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was not
-        *   found; Otherwise one of the other system wide error codes.
-        */
-        IMPORT_C TInt GetLoggingFileL( TUint aProcessId, TDes8& aFileName );
-     
-        /**
-		* Check a memory allocation (memory address) from an internal array.
-		* @param aMemAddress The memory address to be check
-		* @return KErrNone, if memory address found in array; 
-		* 	KErrNotFound, if the requested memory address was not found.
-		*/
-        IMPORT_C TInt IsMemoryAdded( TUint32 aMemAddress );
-               
-    protected: // New functions
-    
-        /**
-        * Creates a new process for the server, if it does not already exist.
-        * @return KErrNone, if successful; otherwise one of the other
-        * system-wide error codes. 
-        */
-        TInt CreateProcess();
-        
-    private: // Internal functions
-    
-        /**
-        * Creates two buffers: one for storing call stack memory addresses and one for
-        * handle leaks. Internally used by this class. May leave, if there is 
-        * insufficient memory.
-        */
-        void ConstructBuffersL();
-        
-    private: // Data
-    
-        /** A pointer to a buffer of call stack's memory addresses */
-        CBufFlat* iStackBuf;
-    };
-
-#endif      // ATSTORAGESERVERCLNT_H   
-
-            
-// End of File
--- a/analyzetool/storageserver/client/src/atstorageserverclnt.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,930 +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:  Definitions for the client side handle class RATStorageServer
-*
-*/
-
-
-
-// INCLUDE FILES
-#include    "atstorageserverclnt.h"
-#include    "atstorageserver.h"
-#include    "atlog.h"
-#include    "atstorageservercommon.h"
-
-
-// CONSTANTS
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::RATStorageServer
-// C++ default constructor.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C RATStorageServer::RATStorageServer() :
-    RSessionBase(), iStackBuf( NULL )
-    {
-    LOGSTR1( "STSE RATStorageServer::RATStorageServer()" );
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::Connect
-// A function for connecting to the server
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RATStorageServer::Connect()
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::Connect()" );
- 
-    TInt errorCode( KErrNone );
-    errorCode = CreateProcess();
-    
-    // If process's creation failed, return the error code
-    if ( errorCode != KErrNone )
-        {
-        return errorCode;
-        }
-        
-    // Otherwise create a new session    
-    errorCode = CreateSession( KStorageServerName, Version() );
-    
-    // If creation of a new session failed, return the error code
-    if ( errorCode != KErrNone )
-        {
-        return errorCode;
-        }
-    
-    // Construct a buffer for call stack's memory addresses. If the function leaves,
-    // the leave code is put in "errorCode". 
-    TRAP( errorCode, ConstructBuffersL() ); 
-    
-    return errorCode;
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::Close
-// Destroys all memory reserved by this class, and calls RSessionBase::Close()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void RATStorageServer::Close()
-    {
-    LOGSTR1( "STSE void RATStorageServer::Close()" );
-    
-    // Delete iStackBuf
-    delete iStackBuf;
-    iStackBuf = NULL;
-    
-    // Call the base class' Close()
-    RSessionBase::Close(); 
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::LogProcessStarted
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RATStorageServer::LogProcessStarted( const TDesC& aFileName,
-                                                   const TDesC8& aProcessName,
-                                                   TUint aProcessId,
-                                                   TUint32 aLogOption, TUint32 aIsDebug )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::LogProcessStarted()" );
-    
-    // Panic always if aFileName or aProcessName are longer than allowed.
-    __ASSERT_ALWAYS( aFileName.Length() <= KMaxFileName &&
-                     aProcessName.Length() <= KMaxProcessName,
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    // Panic (in debug builds) if aProcessId is KNullProcessId
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-
-    // This information is optional -> ignoring error
-    // Must be before EProcessStarted in order to append udeb/urel
-    // information to LogProcessStarted
-    TIpcArgs ipcArgs2( aIsDebug );
-    SendReceive( CATStorageServer::EProcessUdeb, ipcArgs2 );
-    
-    TIpcArgs ipcArgs( &aFileName, &aProcessName, aProcessId, aLogOption );
-    TInt error( 0 );
-    
-    error = SendReceive( CATStorageServer::EProcessStarted, ipcArgs );
-
-    // Return, if error is not KErrNone.
-    if ( error != KErrNone )
-        {
-        return error;
-        }
-    
-    return KErrNone;
-    }
-       
-// -----------------------------------------------------------------------------
-// RATStorageServer::LogDllLoaded
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RATStorageServer::LogDllLoaded( const TDesC8& aDllName,
-                                              TUint32 aStartAddress,
-                                              TUint32 aEndAddress )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::LogDllLoaded()" );
-    
-    // Panic always if aDllName is longer than allowed.
-    __ASSERT_ALWAYS( aDllName.Length() <= KMaxLibraryName,
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    // Panic (in debug builds) if aStartAddress is greater than aEndAddress
-    __ASSERT_DEBUG( aStartAddress <= aEndAddress,
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    TIpcArgs ipcArgs( &aDllName, aStartAddress, aEndAddress );
-    
-    return SendReceive( CATStorageServer::EDllLoaded, ipcArgs );
-    }
-    
-// -----------------------------------------------------------------------------
-// RATStorageServer::LogDllUnloaded
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RATStorageServer::LogDllUnloaded( const TDesC8& aDllName,
-                                                TUint32 aStartAddress,
-                                                TUint32 aEndAddress )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::LogDllUnloaded()" );
-    
-    // Panic always if aDllName is longer than allowed.
-    __ASSERT_ALWAYS( aDllName.Length() <= KMaxLibraryName,
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    // Panic (in debug builds) if aStartAddress is greater than aEndAddress
-    __ASSERT_DEBUG( aStartAddress <= aEndAddress,
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-      
-    TIpcArgs ipcArgs( &aDllName, aStartAddress, aEndAddress );
-    
-    return SendReceive( CATStorageServer::EDllUnloaded, ipcArgs );
-    }    
-        
-// -----------------------------------------------------------------------------
-// RATStorageServer::LogMemoryAllocated
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RATStorageServer::LogMemoryAllocated( TUint32 aMemAddress,
-                                                    TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
-                                                    TInt aSize )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::LogMemoryAllocated()" );
-    
-    TInt count=0;
-    // The number of memory addresses in aCallstack
-    for ( TInt i = 0; i < KATMaxCallstackLength; i++ )
-        {
-        if( aCallstack[i] == 0 )
-            {
-            break;
-            }
-        count++;
-        }
-    
-    LOGSTR2( "STSE The number of memory addresses in the current call stack: %d", count );
-    
-    // The maximum number of call stack's memory addresses this server can handle
-    // is KMaxCallstackLength
-    if ( count > KATMaxCallstackLength )
-        {
-        count = KATMaxCallstackLength;
-        }
-        
-    // Panic (in debug builds) if the parameters are faulty
-    __ASSERT_DEBUG( aMemAddress != 0 && count >= 0 && aSize >= 0,
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-          
-    // Buffer position
-    TInt pos = 0;  
-    TUint32 callStackAddr;
-                 
-    // Write the number of memory addresses of aCallstack (one word) into
-    // the beginning of the call stack buffer
-    iStackBuf->Write( pos, &count, KWordSize );
-    
-    // Increase the position by one word
-    pos += KWordSize; 
-      
-    // Write all the memory addresses of aCallStack into the buffer 
-    for ( TInt i = 0; i < count; i++ )
-        {
-        callStackAddr = aCallstack[i];
-        
-        // Write the current memory address (the length of an address is one word)
-        iStackBuf->Write( pos, &callStackAddr, KWordSize ); 
-        
-        // Move the pos variable one word (4 bytes) onwards.
-        pos += KWordSize;        
-        }  
-    
-    TPtr8 bufPtr( iStackBuf->Ptr(0) );       
-     
-    TIpcArgs ipcArgs( aMemAddress, &bufPtr, aSize );
-     
-    return SendReceive( CATStorageServer::EMemoryAllocated, ipcArgs );  
-    }
-        
-// -----------------------------------------------------------------------------
-// RATStorageServer::LogMemoryFreed
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RATStorageServer::LogMemoryFreed( TUint32 aMemAddress,
-        TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::LogMemoryFreed()" );
-    
-    TInt count=0;
-    // The number of memory addresses in aFreeCallstack
-    for ( TInt i = 0; i < KATMaxCallstackLength; i++ )
-        {
-        if( aFreeCallstack[i] == 0 )
-            {
-            break;
-            }
-        count++;
-        }
-    LOGSTR3( "STSE > aFreeCallstack.Count() ( %i ), address( %x )", 
-    		count, aMemAddress );
-    
-    // The maximum number of call stack's memory addresses this server can handle
-	// is KMaxCallstackLength
-	if ( count > KATMaxFreeCallstackLength )
-		{
-		count = KATMaxFreeCallstackLength;
-		}
-		  
-	// Buffer position
-	TInt pos = 0;	
-	TUint32 callStackAddr;
-				 
-	// Write the number of memory addresses of aFreeCallstack (one word) into
-	// the beginning of the call stack buffer
-	iStackBuf->Write( pos, &count, KWordSize );
-	
-	// Increase the position by one word
-	pos += KWordSize; 
-	  
-	// Write all the memory addresses of aFreeCallstack into the buffer 
-	for ( TInt i = 0; i < count; i++ )
-		{
-		callStackAddr = aFreeCallstack[i];
-		
-		// Write the current memory address (the length of an address is one word)
-		iStackBuf->Write( pos, &callStackAddr, KWordSize ); 
-		
-		// Move the pos variable one word (4 bytes) onwards.
-		pos += KWordSize;        
-		}  
-	
-	TPtr8 bufPtr( iStackBuf->Ptr( 0 ) );	 
-	TIpcArgs ipcArgs( aMemAddress, &bufPtr );
-    	
-    return SendReceive( CATStorageServer::EMemoryFreed, ipcArgs );
-    }        
-        
-// -----------------------------------------------------------------------------
-// RATStorageServer::LogProcessEnded
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RATStorageServer::LogProcessEnded( TUint aProcessId,
-                                                 TUint aHandleLeaks )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::LogProcessEnded()" );
-    
-    // Panic (in debug builds) if the parameters are faulty
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    TIpcArgs ipcArgs( aProcessId, aHandleLeaks );
-    
-    return SendReceive( CATStorageServer::EProcessEnded, ipcArgs );
-    }
-
-//-----------------------------------------------------------------------------
-// RATStorageServer::Version()
-// Returns the version number.
-//-----------------------------------------------------------------------------
-//
-EXPORT_C TVersion RATStorageServer::Version() const
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::Version()" );
-    
-    return TVersion(KLowestVersionNumberMaj, KLowestVersionNumberMin,
-                                                KLowestVersionNumberBld);
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::CheckMemoryAddress
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RATStorageServer::CheckMemoryAddress( TUint32 aMemAddress ) const
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::CheckMemoryAddress()" );
-    
-    // Panic (in debug builds) if the parameters are faulty
-    __ASSERT_DEBUG( aMemAddress != 0, 
-            StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    TIpcArgs ipcArgs( aMemAddress );
-    
-    return SendReceive( CATStorageServer::EMemoryCheck, ipcArgs ); 
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::GetProcessesL
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::GetProcessesL( RArray<TATProcessInfo>& aProcesses )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::GetProcessesL()" );
-    
-    TInt error( KErrNone );
-    TInt sizeOfProcessInfo = sizeof( TATProcessInfo );
-    
-    // Reset the sent array
-    aProcesses.Reset();
-    
-    // Calculate the length of the buffer to be constructed for processes.
-    // One word will be reserved for the length of the array.
-    TInt bufferLength = KWordSize + KATMaxProcesses * sizeOfProcessInfo; 
-    
-    CBufFlat* processBuf;
-    // Construct processBuf and expand it before the beginning (index 0)
-    processBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( processBuf );
-    processBuf->ExpandL( 0, bufferLength );
-    
-    TPtr8 bufPtr( processBuf->Ptr(0) );
-    
-    // Send the buffer to the server, which will fill it.
-    TIpcArgs ipcArgs( &bufPtr );  
-    error = SendReceive( CATStorageServer::EGetProcesses, ipcArgs ); 
-    // Return with the error code if the operation failed
-    if ( error != KErrNone )
-        {
-        CleanupStack::PopAndDestroy( processBuf );
-        return error;
-        }
-    
-    // A variable for the number of TATProcessInfo objects
-    TInt count( 0 );
-     // A variable for the position
-    TInt pos( 0 );
-    
-    // Read the value for count 
-    processBuf->Read( pos, &count, KWordSize );
-    
-    // Return if we got an illegal value for count     
-    if ( count < 0 || count > KATMaxProcesses )
-        {
-        CleanupStack::PopAndDestroy( processBuf );
-        return KErrGeneral;
-        }    
-
-    // Move the position one word onwards.    
-    pos += KWordSize;
-
-    TATProcessInfo processInfo;
-
-    // Go through all TATProcessInfo objects sent to the server 
-    for ( TInt j = 0; j < count; j++ )
-        {
-        // Read one of the TATProcessInfo objects stored in the buffer.
-        processBuf->Read( pos, &processInfo, sizeOfProcessInfo );
-       
-        // Append this processInfo to the array
-        error = aProcesses.Append( processInfo );
-
-        if ( error != KErrNone )
-            {
-            CleanupStack::PopAndDestroy( processBuf );
-            return error;
-            }
-
-        // Move the pos variable one word onwards.
-        pos += sizeOfProcessInfo;
-        }  
-    
-    CleanupStack::PopAndDestroy( processBuf );
-    return error;
-    }
-        
-// -----------------------------------------------------------------------------
-// RATStorageServer::GetLoadedDllsL
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::GetLoadedDllsL( TUint aProcessId, 
-                                                RArray< TBuf8<KMaxLibraryName> >& aDlls )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::GetLoadedDllsL()" );
-    
-    // Panic (in debug builds) if aProcessId is faulty
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    TInt error( KErrNone );
-    
-    // Size of a DLL descriptor
-    TInt sizeOfDllDesc = sizeof( TBuf8<KMaxLibraryName> );
-    
-    // Reset the sent array
-    aDlls.Reset();
-    
-    // Calculate the length of the buffer to be constructed for DLL names.
-    // One word will be reserved for the length of the array.
-    TInt bufferLength = KWordSize + KATMaxDlls * sizeOfDllDesc; 
-    
-    CBufFlat* dllBuf;
-    // Construct dllBuf and expand it before the beginning (index 0)
-    dllBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( dllBuf );
-    dllBuf->ExpandL( 0, bufferLength );
-    
-    TPtr8 bufPtr( dllBuf->Ptr(0) );
-    
-    // Call the server with the given arguments
-    TIpcArgs ipcArgs( aProcessId, &bufPtr );  
-    error = SendReceive( CATStorageServer::EGetDlls, ipcArgs );
-    
-    // Return, if error is not KErrNone.
-    if ( error != KErrNone )
-        {
-        CleanupStack::PopAndDestroy( dllBuf );      
-        return error;
-        }
-    
-    // A variable for the number of objects in the buffer
-    TInt count( 0 );
-    
-     // A variable for the position
-    TInt pos( 0 );
-    
-    // Read the value for count 
-    dllBuf->Read( pos, &count, KWordSize );
-    
-    // Return if we got an illegal value for count
-    if ( count < 0 || count > KATMaxDlls )
-        {
-        CleanupStack::PopAndDestroy( dllBuf );
-        return KErrGeneral;
-        }
-
-    // Move the position one word onwards.    
-    pos += KWordSize;
-
-    TBuf8<KMaxLibraryName> dllName;
-
-    // Go through all DLL names objects sent to the server 
-    for ( TInt j = 0; j < count; j++ )
-        {
-        // Read one of the DLL names stored in the buffer.
-        dllBuf->Read( pos, &dllName, sizeOfDllDesc );
-       
-        // Append this DLL name to the array
-        error = aDlls.Append( dllName );
-
-        if ( error != KErrNone )
-            {
-            return error;
-            }
-
-        // Move the pos variable one word onwards.
-        pos += sizeOfDllDesc;
-        }  
-    
-    CleanupStack::PopAndDestroy( dllBuf );
-    return error;
-    }    
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::GetLoggingModeL
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::GetLoggingModeL( TUint aProcessId,
-                                                TATLogOption& aLoggingMode )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::GetLoggingModeL()" );
-    
-    // Panic (in debug builds) if aProcessId is illegal
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    TInt error(0);
-    
-    // The length of the buffer to be constructed for logging mode
-    TInt bufferLength = KWordSize; 
-    
-    CBufFlat* loggingModeBuf;
-    // Construct allocInfoBuf and expand it before the beginning (index 0)
-    loggingModeBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( loggingModeBuf );
-    loggingModeBuf->ExpandL( 0, bufferLength );
-    
-    TPtr8 bufPtr( loggingModeBuf->Ptr(0) );
-    
-    // Call the server
-    TIpcArgs ipcArgs( aProcessId, &bufPtr );  
-    error = SendReceive( CATStorageServer::EGetLoggingMode, ipcArgs );
-    
-    // Return if an error occured.
-    if ( error )
-        {
-        CleanupStack::PopAndDestroy( loggingModeBuf );
-        return error;
-        }
-      
-    // A variable for the position
-    TInt pos( 0 );
-    
-    // Read the value for aNumber
-    loggingModeBuf->Read( pos, &aLoggingMode, KWordSize );
-    
-    CleanupStack::PopAndDestroy( loggingModeBuf );
-    
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::StartSubTest
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::StartSubTest( TUint aProcessId, 
-                                              const TDesC8& aSubtestId, TInt aHandleCount )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::StartSubTest()" );
-    
-    // Panic if the parameters are faulty
-    __ASSERT_ALWAYS( aSubtestId.Length() <= KATMaxSubtestIdLength,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-        
-    // Panic (in debug builds) if the parameters are faulty
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-        
-    TIpcArgs ipcArgs( aProcessId, &aSubtestId, aHandleCount );
-    
-    return SendReceive( CATStorageServer::ESubtestStart, ipcArgs );
-    }
-    
-// -----------------------------------------------------------------------------
-// RATStorageServer::StopSubTest
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::StopSubTest( TUint aProcessId, 
-                                             const TDesC8& aSubtestId, TInt aHandleCount )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::StopSubTest()" );
-    
-    // Panic if the parameters are faulty
-    __ASSERT_ALWAYS( aSubtestId.Length() <= KATMaxSubtestIdLength,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-        
-    // Panic (in debug builds) if the parameters are faulty
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-        
-    TIpcArgs ipcArgs( aProcessId, &aSubtestId, aHandleCount );
-    
-    return SendReceive( CATStorageServer::ESubtestStop, ipcArgs );
-    }
-    
-// -----------------------------------------------------------------------------
-// RATStorageServer::GetCurrentAllocsL
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::GetCurrentAllocsL( TUint aProcessId, 
-                                                  TUint32& aNumber,
-                                                  TUint32& aSize   )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::GetCurrentAllocsL()" );
-    
-    // Panic (in debug builds) if aProcessId is illegal
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    TInt error(0);
-    
-    // The length of the buffer to be constructed for allocation number and size
-    TInt bufferLength = KWordSize + KWordSize; 
-    
-    CBufFlat* allocInfoBuf;
-    // Construct allocInfoBuf and expand it before the beginning (index 0)
-    allocInfoBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( allocInfoBuf );
-    allocInfoBuf->ExpandL( 0, bufferLength );
-    
-    TPtr8 bufPtr( allocInfoBuf->Ptr(0) );
-    
-    // Call the server
-    TIpcArgs ipcArgs( aProcessId, &bufPtr );  
-    error = SendReceive( CATStorageServer::EGetCurrentAllocs, ipcArgs );
-    
-    // Return if error is not KErrNone.
-    if ( error != KErrNone )
-        {
-        CleanupStack::PopAndDestroy( allocInfoBuf );
-        return error;
-        }
-      
-    // A variable for the position
-    TInt pos( 0 );
-    
-    // Read the value for aNumber
-    allocInfoBuf->Read( pos, &aNumber, KWordSize );
-    
-    pos += KWordSize;
-    
-    // Read the value for aSize
-    allocInfoBuf->Read( pos, &aSize, KWordSize );
-    
-    CleanupStack::PopAndDestroy( allocInfoBuf );
-    
-    return KErrNone;
-    }
-                                                  
-// -----------------------------------------------------------------------------
-// RATStorageServer::GetMaxAllocsL
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::GetMaxAllocsL( TUint aProcessId, 
-                                              TUint32& aNumber,
-                                              TUint32& aSize   )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::GetMaxAllocsL()" );
-    
-    // Panic (in debug builds) if aProcessId is illegal
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-        
-    TInt error(0);
-     
-    // The length of the buffer to be constructed for allocation number and size
-    TInt bufferLength = KWordSize + KWordSize; 
-
-    CBufFlat* allocInfoBuf;
-    // Construct allocInfoBuf and expand it before the beginning (index 0)
-    allocInfoBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( allocInfoBuf );
-    allocInfoBuf->ExpandL( 0, bufferLength );
-
-    TPtr8 bufPtr( allocInfoBuf->Ptr(0) );
-
-    // Call the server
-    TIpcArgs ipcArgs( aProcessId, &bufPtr );
-    error = SendReceive( CATStorageServer::EGetMaxAllocs, ipcArgs );
-
-    // Return, if error is not KErrNone.
-    if ( error != KErrNone )
-        {
-        CleanupStack::PopAndDestroy( allocInfoBuf );
-        return error;
-        }
-
-    // A variable for the position
-    TInt pos( 0 );
-
-    // Read the value for aNumber
-    allocInfoBuf->Read( pos, &aNumber, KWordSize );
-
-    pos += KWordSize;
-
-    // Read the value for aSize
-    allocInfoBuf->Read( pos, &aSize, KWordSize );
-
-    CleanupStack::PopAndDestroy( allocInfoBuf );
-
-    return KErrNone;
-    }
-    
-// -----------------------------------------------------------------------------
-// RATStorageServer::StartSubTest
-// An overloaded version without a PID parameter
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::StartSubTest( const TDesC8& aSubtestId )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::StartSubTest()" );
-    
-    // Panic if the parameters are faulty
-    __ASSERT_ALWAYS( aSubtestId.Length() <= KATMaxSubtestIdLength,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-        
-    TIpcArgs ipcArgs( &aSubtestId );
-    
-    return SendReceive( CATStorageServer::ESubtestStart2, ipcArgs );
-    }
-    
-// -----------------------------------------------------------------------------
-// RATStorageServer::StopSubTest
-// An overloaded version without a PID parameter
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::StopSubTest( const TDesC8& aSubtestId )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::StopSubTest()" );
-    
-    // Panic if the parameters are faulty
-    __ASSERT_ALWAYS( aSubtestId.Length() <= KATMaxSubtestIdLength,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-        
-    TIpcArgs ipcArgs( &aSubtestId );
-    
-    return SendReceive( CATStorageServer::ESubtestStop2, ipcArgs );
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::CancelLogging
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::CancelLogging( TUint aProcessId )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::CancelLogging()" );
-    
-    // Panic (in debug builds) if aProcessId is illegal
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    TIpcArgs ipcArgs( aProcessId );
-    
-    return SendReceive( CATStorageServer::ECancelLogging, ipcArgs );
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::CreateProcess
-// Checks if the server already exists. If it doesn't, creates a new process
-// for it.
-// -----------------------------------------------------------------------------
-//
-TInt RATStorageServer::CreateProcess()
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::CreateProcess()" );
-    
-    TInt errorCode( KErrNone );
- 
-    // Check if the server already exists
-    TFindServer findServer( KStorageServerName );
-    TFullName fullName;
-
-    errorCode = findServer.Next( fullName );
-    
-    // Return KErrNone if the server is already running
-    if ( errorCode == KErrNone )
-        {
-        return KErrNone;
-        }
-    
-    // Otherwise initiate starting the server by creating first a new process for it.
-    // The second argument of the Create() method call is an empty descriptor, because
-    // we don't need to pass any data to the thread function of the new process's main
-    // thread.
-    RProcess process;
-    errorCode = process.Create( KStorageServerFile, KNullDesC );
-    
-    // Return the error code if the creation of the process failed
-    if ( errorCode != KErrNone )
-        {
-        return errorCode;
-        }
-    
-    TRequestStatus status;
-    process.Rendezvous( status );
-    
-    // If the status is not KRequestPending, abort the project creation
-    // and return KErrGeneral
-    if ( status != KRequestPending )
-        {
-        process.RendezvousCancel( status );
-        process.Kill( KErrGeneral );
-        process.Close();
-        return KErrGeneral;
-        }
-    
-    // Otherwise make the first thread of the new process eligible for execution
-    process.Resume();
-    
-    // Wait for a signal from the server       
-    User::WaitForRequest( status );
-    
-    // Close the process handle    
-    process.Close();
-    
-    // Return the error code
-    return status.Int();
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::ConstructBuffersL
-// Allocates buffers from heap. Called when connecting to the server
-// -----------------------------------------------------------------------------
-//
-void RATStorageServer::ConstructBuffersL()
-    {
-    LOGSTR1( "STSE void RATStorageServer::ConstructBuffersL()" );
-    
-    // Calculate the length of the buffer to be constructed for call stack.
-    // One word will be reserved for the length of the array
-    TInt bufferLength = ( (1 + KATMaxCallstackLength) * KWordSize  );
-    
-    // Construct iStackBuf and expand it before the beginning (index 0)
-    iStackBuf = CBufFlat::NewL( bufferLength );
-    iStackBuf->ExpandL( 0, bufferLength );
-    }
-    
-// -----------------------------------------------------------------------------
-// RATStorageServer::GetLoggingFileL
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::GetLoggingFileL( TUint aProcessId,
-                                                    TDes8& aFileName )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::GetLoggingFileL()" );
-    
-    // Panic (in debug builds) if aProcessId is illegal
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    TInt error(0);
-
-    TBuf8<KMaxFileName> fileBuf;
-    // Call the server
-    TIpcArgs ipcArgs( aProcessId, &fileBuf );  
-    error = SendReceive( CATStorageServer::EGetLoggingFile, ipcArgs );
-    
-    // Return, if an error occured.
-    if ( error )
-        {
-        return error;
-        }
-      
-    aFileName.Copy( fileBuf );
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::GetUdebL
-// -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt RATStorageServer::GetUdebL( TUint aProcessId, TUint32& aIsUdeb )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::GetUdebL()" );
-    
-    // Panic (in debug builds) if aProcessId is illegal
-    __ASSERT_DEBUG( aProcessId != KNullProcessId,        
-        StorageServerPanic( KCategoryClient, EAToolBadArgument ) );
-    
-    TInt error(0);
-    TBuf8<KMaxVersionName> isUdeb;
-    _LIT8( KUdeb, "UDEB" );
-    // Call the server
-    TIpcArgs ipcArgs( aProcessId, &isUdeb );  
-    error = SendReceive( CATStorageServer::EGetUdeb, ipcArgs );
-    
-    // Return, if an error occured.
-    if ( error != KErrNone )
-        {
-        return error;
-        }
-    
-    if ( isUdeb.Compare( KUdeb() ) == 0 )
-        {
-        LOGSTR1( "STSE TInt RATStorageServer::GetUdebL() - Is UDEB" );    
-        aIsUdeb = 1;    
-        }
-    else
-        {
-        LOGSTR1( "STSE TInt RATStorageServer::GetUdebL() - Is UREL" );
-        aIsUdeb = 0;    
-        }
-
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// RATStorageServer::IsMemoryAdded
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RATStorageServer::IsMemoryAdded( TUint32 aMemAddress )
-    {
-    LOGSTR1( "STSE TInt RATStorageServer::IsMemoryAdded()" );
-        
-    TIpcArgs ipcArgs( aMemAddress );    
-    return SendReceive( CATStorageServer::EIsMemoryAdded, ipcArgs );
-    }
-
-//  End of File
--- a/analyzetool/storageserver/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +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 <platform_paths.hrh>
-
-PRJ_PLATFORMS
-ARMV5 WINSCW
-
-PRJ_EXPORTS
-../client/inc/atstorageserverclnt.h         OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/atstorageserverclnt.h)
-
-PRJ_MMPFILES
-../server/group/atoolstorageserver.mmp
-../client/group/atoolstorageserverclnt.mmp
-
-PRJ_TESTMMPFILES
-../internal/tsrc/group/storageservertest.mmp
--- a/analyzetool/storageserver/inc/atstorageservercommon.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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:  Includes common constants and enums for the AnalyzeTool 
-*                StorageServer client and server.
-*
-*/
-
-
-
-#ifndef ATSTORAGESERVERCOMMON_H
-#define ATSTORAGESERVERCOMMON_H
-
-
-//  INCLUDES
-
-#include <e32base.h>
-
-
-// CONSTANTS
-
-// Server's file name
-_LIT(KStorageServerFile, "AToolStorageServer.exe");
-
-// server name
-_LIT(KStorageServerName,"AToolStorageServer");
-
-
-// The path of the storage file
-#ifdef __WINS__
-_LIT( KATDataFilePath, ":\\logs\\analyzetool\\" );
-#else
-_LIT( KATDataFilePath, ":\\analyzetool\\" );
-_LIT( KATDataFilePath2, ":\\data\\analyzetool\\" );
-#endif
-
-// The word size in the current system is 32 bits, which is 4 bytes.
-const TInt KWordSize = 4;
-
-// Leak array granularity value
-const TInt KLeakArrayGranularity = 100;
-
-// DATA TYPES
-
-/** Storage Server panic codes */
-enum TStorageServerPanics
-    {
-    EAToolBadRequest = 1, // An undefined operation request from the client
-    EAToolBadArgument,    // Illegal arguments / function parameters   
-    EAToolNotAllowed,     // An operation is not allowed in the current program state
-    EAToolInternalError,   // An internal error has occured
-    EAToolIllegalLogOption // An undefined log option has been requested 
-    };
-
-
-/** Panic categories */
-_LIT(KCategoryServer,"STSEServer");
-_LIT(KCategoryClient,"STSEClient");
-
-inline void StorageServerPanic( const TDesC &aCategory, TStorageServerPanics aReason )
-    {
-    User::Panic(aCategory, aReason);
-    }
-  
-#endif      // ATSTORAGESERVERCOMMON_H   
-
-// End of File
--- a/analyzetool/storageserver/server/group/atoolstorageserver.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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:  The .mmp file for the server side of AToolStorageServer
-*
-*/
-
-#include <platform_paths.hrh>
-
-TARGET        atoolstorageserver.exe
-TARGETTYPE    exe
-UID           0x0 0x20012430   
-CAPABILITY    NONE
-
-SMPSAFE
-
-EPOCHEAPSIZE 0x10000 0x800000
-
-SOURCEPATH    ../src
-
-SOURCE        atstorageserver.cpp
-SOURCE        atstorageserversession.cpp
-SOURCE        atmemoryentry.cpp
-SOURCE        atdynprocessinfo.cpp
-SOURCE        atdriveinfo.cpp
-SOURCE        atdllinfo.cpp
-
-USERINCLUDE   ../inc
-USERINCLUDE   ../../inc
-USERINCLUDE   ../../../inc
-
-OS_LAYER_SYSTEMINCLUDE
-
-LIBRARY     euser.lib
-LIBRARY     efsrv.lib
-LIBRARY     flogger.lib
-LIBRARY     charconv.lib
-LIBRARY     platformenv.lib 
-
-// End of File
--- a/analyzetool/storageserver/server/inc/atdllinfo.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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:  Declaration of the class TATDllInfo.
-*
-*/
-
-
-#ifndef ATDLLINFO_H
-#define ATDLLINFO_H
-
-// INCLUDES
-#include <u32std.h>
-
-/**
-*  Stores information of process loaded library
-*/
-class TATDllInfo
-    {
-    
-    public: // Constructors
-        
-        /**
-        * C++ default constructor.
-        * @param aStartAddress Start address of the library 
-        * @param aEndAddress The end address of the library 
-        * @param aLoadTime The current time in a 64-bit form.
-        * @param aDllName The name of the library
-        */
-        TATDllInfo( const TUint32 aStartAddress, const TUint32 aEndAddress, 
-        		const TInt64& aLoadTime, const TDesC8& aDllName );
-
-    public: // New functions
-
-        /**
-        * Returs library start address
-        * @return TUint32 start address of the library
-        */
-        TUint32 StartAddress();
-        
-        /**
-		* Returns library end address
-		* @return TUint32 end address of the library
-		*/
-		TUint32 EndAddress();
-                
-        /**
-        * Gets specific library name
-        * return TDes8 Name of the library
-        */
-        TDes8& Name();
-        
-        /**
-		* Returns library load time
-		* @return TInt64 library load time
-		*/
-        TInt64 LibraryLoadTime();
-        		
-        /**
-		* Checks if two objects of this class match based on the objects's
-        * saved library name.
-		* @param aFirst Library object
-		* @param aSecond Library object
-		* return TBool ETrue, if the two objects match. EFalse otherwise.
-		*/
-        static TBool Match( const TATDllInfo& aFirst, const TATDllInfo& aSecond );
-                
-    public: // Member variables
-
-        /* Start address of the loaded dll */
-    	const TUint32 iStartAddress;
-
-        /* End address of the loaded dll */
-        const TUint32 iEndAddress;
-
-        /* Loaded dll name */
-        TBuf8<KMaxLibraryName> iName;
-        
-        /** For storing the time when DLL has loaded. */
-        const TInt64 iLoadTime;
-    };
-
-#endif // ATDLLINFO_H
-
-// End of File
-
--- a/analyzetool/storageserver/server/inc/atdriveinfo.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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:  Declaration of the class TATDriveInfo.
-*
-*/
-
-
-
-#ifndef ATDRIVEINFO_H
-#define ATDRIVEINFO_H
-
-#include <f32file.h>
-
-/**
-*  Check what drives exists and creates file full path.
-*/
-class TATDriveInfo
-    {    
-    public: // Constructors
-        
-        /**
-        * C++ default constructor.
-        */
-        TATDriveInfo();
-
-    public: // New functions
-
-        /**
-        * Create the file full path.
-        * @param aPath Full path.
-        * @param aFileName Filename.
-        * @param aFs A handle to a file server.
-        * @return KErrNone or KErrAlreadyExists, if successful; 
-        *   Otherwise one of the other system wide error codes.
-        */
-        static TInt CreatePath( TDes& aPath, const TDesC& aFileName, RFs& aFs );   
-    
-    private: // New functions
-    
-        /**
-        * Get the available drive character.
-        * @param aDrive The drive letter.
-        * @param aDriveNumber The drive number.
-        * @param aFs A handle to a file server.
-        * @param aDriveType Drive type.
-        * @return KErrNone, if successful; otherwise KErrNotFound
-        */
-        static TInt GetDrive( TChar& aDrive, TInt& aDriveNumber, 
-                RFs& aFs, const TUint aDriveType );  
-        
-    };
-
-#endif // ATDRIVEINFO_H
-
-// End of File
-
--- a/analyzetool/storageserver/server/inc/atdynprocessinfo.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +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:  Declaration of the class CATDynProcessInfo
-*
-*/
-
-
-#ifndef ATDYNPROCESSINFO_H
-#define ATDYNPROCESSINFO_H
-
-
-//  INCLUDES
-#include    <e32base.h>
-#include    <analyzetool/atcommon.h>
-#include	"atdllinfo.h"
-
-// FORWARD DECLARATIONS
-class CATStorageServerSession;
-
-// CLASS DECLARATION
-
-/**
-*  A class that can store different process related information. The information
-*  is associated to a particular process wiht a member telling a process ID.
-*  All the other information but the process ID and the pointer to this process's
-*  associated session object can be subject to change dynamically, run-time.
-*/
-class CATDynProcessInfo : public CBase
-    {
-    public: // Constructor
-
-        /**
-        * Constructor. 
-        */ 
-        CATDynProcessInfo();
-    
-        /**
-        * Constructor. 
-        * @param aProcessId A process ID.
-        * @param aSessionObject A pointer to this process's associated session object.
-        * @param aDlls The loaded DLLs of the associated process.
-        */
-        CATDynProcessInfo( TUint aProcessId,
-                           CATStorageServerSession* aSessionObject,
-                           const RArray<TATDllInfo>& aDlls );
-        
-        /**
-        * Constructor.
-        * @param aProcessId A process ID.
-        * @param aSessionObject A pointer to this process's associated session object.
-        */
-        CATDynProcessInfo( TUint aProcessId,
-                           CATStorageServerSession* aSessionObject );
-                           
-        /**
-        * Constructor.
-        * @param aProcessId A process ID.
-        */
-        CATDynProcessInfo( TUint aProcessId );
-
-        /**
-        * Destructor
-        */
-        virtual ~CATDynProcessInfo();
-        
-    public:
-        
-        /**
-        * Compares two objects of this class based on the process ID.
-        * @param aFirst The first object of this class to be compared.
-        * @param aSecond The second object of this class to be compared.
-        * @return  Zero, if the two objects are equal. A negative value,
-        *   if the first object is less than the second. A positive value,
-        *   if the first object is greater than the second.
-        */
-        static TInt Compare( const CATDynProcessInfo& aFirst,
-                             const CATDynProcessInfo& aSecond );
-        
-    public:
-
-        /** The ID of the process. */
-        const TUint iProcessId;
-        
-        /** A pointer to the session object associated with this process. */
-        CATStorageServerSession* const iSessionObject;
-        
-        /** The DLLs loaded by the associated process */
-        RArray<TATDllInfo> iDlls;
-    };
-  
-#endif      // ATDYNPROCESSINFO_H
--- a/analyzetool/storageserver/server/inc/atmemoryentry.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +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:  Declaration of the class CATMemoryEntry
-*
-*/
-
-
-#ifndef ATMEMORYENTRY_H
-#define ATMEMORYENTRY_H
-
-
-//  INCLUDES
-#include <e32base.h>
-
-
-// CLASS DECLARATION
-
-/**
-*  A class for storing memory entries when the server is informed that memory has been
-*  allocated. The class stores the memory address of a new allocation and a pointer to
-*  a buffer including the current call stack. It also stores a time stamp, and the size
-*  of the allocation. 
-*     The class has member methods for evaluating two different objects of this class
-*  with each other. In the construction the class takes a pointer to the call stack
-*  buffer, but it does not create the buffer itself. However, it is responsible for
-*  deleting the buffer in the destruction.
-*/
-class CATMemoryEntry : public CBase
-    {
-    public: // Constructor
-
-        /**
-        * Constructor.
-        * @param aMemAddress An address to allocated memory.
-        * @param aCallstackBuf A pointer to a buffer containing call stack's memory
-        *   addresses.
-        * @param aAllocTime The current time in a 64-bit form.
-        * @param aAllocSize The size of an allocated memory chunk.
-        */ 
-        CATMemoryEntry( TUint32 aMemAddress, const CBufFlat* aCallstackBuf,
-                        const TInt64& aAllocTime, TInt aAllocSize );
-
-        /**
-        * Destructor
-        */
-        virtual ~CATMemoryEntry();
-
-    public:
-        /**
-        * Compares two objects of this class based on the allocation time.
-        * @param aFirst The first object of this class to be compared.
-        * @param aSecond The second object of this class to be compared.
-        * @return  Zero, if the two objects are equal. A negative value,
-        *   if the first object is less than the second. A positive value,
-        *   if the first object is greater than the second.
-        */
-        static TInt Compare( const CATMemoryEntry& aFirst,
-                             const CATMemoryEntry& aSecond );
-
-        /**
-        * Checks if two objects of this class match based on the objects's
-        * saved memory allocation addresses.
-        * @param aFirst The first object of this class to be evaluated.
-        * @param aSecond The second object of this class to be evaluated.
-        * @return ETrue, if the two objects match. EFalse otherwise.
-        */
-        static TBool Match( const CATMemoryEntry& aFirst,
-                            const CATMemoryEntry& aSecond );
-
-    public:
-
-        /** For storing an address of a memory allocation. */
-        const TUint32 iMemAddress;
-
-        /** A pointer to an array for storing the current call stack. */
-        const CBufFlat* const iCallstackBuf;
-        
-        /** For storing the time when an allocation has occured. */
-        const TInt64 iAllocTime;
-        
-        /** For storing the size of an allocation. */
-        const TInt iAllocSize;
-        
-    };
-  
-  
-#endif      // ATMEMORYENTRY_H
--- a/analyzetool/storageserver/server/inc/atstorageserver.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +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:  Declaration of the server side main class CATStorageServer
-*
-*/
-
-
-#ifndef ATSTORAGESERVER_H
-#define ATSTORAGESERVER_H
-
-
-//  INCLUDES
-#include    <e32base.h>
-#include    <analyzetool/atcommon.h>
-#include 	"atdllinfo.h"
-
-// CONSTANTS
-// Constants for the server's version
-const TUint KVersionNumberMaj = 0;
-const TUint KVersionNumberMin = 1;
-const TUint KVersionNumberBld = 1;
-
-// DATA TYPES
-
-// FORWARD DECLARATIONS
-class TATProcessInfo;
-class CATDynProcessInfo;
-class CATStorageServerSession;
-
-// CLASS DECLARATION
-
-/**
-*  The main class of the Storage Server.
-*  When a client connects to the server, a new session object
-*  is created by an object of this class. If the server does not exist when
-*  connecting, a new process and an object of this class are created first.
-*/
-class CATStorageServer : public CPolicyServer
-    {
-    
-    public: // Enumerations
-    
-        // opcodes used in message passing between client and server
-        enum TStorageServerReq
-            {
-            EProcessStarted,
-            EDllLoaded,
-            EDllUnloaded,
-            EMemoryAllocated,
-            EMemoryFreed,
-            EProcessEnded,
-            EMemoryCheck,
-            EGetProcesses,
-            EGetDlls,
-            ESetLoggingMode,
-            EGetLoggingMode,
-            ESubtestStart,
-            ESubtestStop,
-            ESubtestStart2,
-            ESubtestStop2,
-            EGetCurrentAllocs,
-            EGetMaxAllocs,
-            ECancelLogging,
-            EGetUdeb,
-            EGetLoggingFile,
-            EProcessUdeb,
-            EIsMemoryAdded,
-            EOutOfBounds
-            };
-    
-    
-    public: // Constructors and destructor
-        
-        /**
-        * Two-phased constructor that can leave.
-        * @return A new instance of this class
-        */
-        static CATStorageServer* NewL();
-        
-        /**
-        * Two-phased constructor that can leave and leaves a pointer
-        * on the cleanup stack.
-        * @return A new instance of this class
-        */
-        static CATStorageServer* NewLC();
-        
-        /**
-        * Destructor
-        */
-        virtual ~CATStorageServer();
-
-    public: // New functions
-        
-  
-        /**
-        * Creates a new server object and starts the server.
-        */
-        static void RunServerL();
-        
-        /**
-        * Increments the count of active sessions for this server.
-        */
-        void IncSessionCount();
-
-        /**
-        * Decrements the count of active sessions for this server.
-        */
-        void DecSessionCount();
-        
-        /**
-        * Adds a new process into the server's arrays.
-        * @param aProcessName The name of the process to be added.
-        * @param aProcessId The ID of the process to be added.
-        * @param aSessionObject A pointer to the current process's associated session
-        *   object.
-        * @param aStartTime The starting time of the process to be added. It represents
-        *   time as a number of microseconds since midnight, January 1st, 0 AD nominal 
-        *   Gregorian. This is the representation used by, e.g., the TTime class.
-        * @return KErrNone, if the operation is successful; KErrAlreadyExists, if
-        *   an attempt is being made to insert a duplicate process; otherwise one of
-        *   the other system wide error codes.
-        */
-        TInt AddProcessL( const TDesC8& aProcessName, 
-                         TUint aProcessId,
-                         CATStorageServerSession* aSessionObject,
-                         const TInt64& aStartTime );
-        
-        /**
-        * Removes a process from the server's arrays.
-        * @param aProcessId The ID of the process to be removed.
-        * @return KErrNone, if successful; KErrNotFound, if a process with
-        *   the specified process ID could not be found in the array.
-        */
-        TInt RemoveProcessL( TUint aProcessId );
-        
-        /**
-        * Adds a DLL for a given process to the dynamic process info array of this class.
-        * @param aProcessId The ID of the process that has loaded the DLL to be added.
-        * @param aDllInfo Information of the DLL.
-        * @return KErrNone, if successful; KErrNotFound, if a process with the given
-        *   process ID could not be found; KErrAlreadyExists, if a DLL with the given
-        *   name was already stored; otherwise one of the other system wide error codes.
-        */
-        TInt AddDllL( TUint aProcessId, const TATDllInfo aDllInfo );
-        
-        /**
-        * Removes a DLL associated with the given process from the dynamic process
-        * info array of this class.
-        * @param aProcessId The ID of the process that has loaded the DLL to be removed.
-        * @param aDllName The name of the DLL to be removed.
-        * @return KErrNone, if successful; KErrNotFound, if a process with
-        *   the specified process ID could not be found, or if a DLL with the specified
-        *   name could not be found.
-        */
-        TInt RemoveDllL( TUint aProcessId, const TDesC8& aDllName );
-            
-        /**
-        * Gives a reference to the process info array of this class.
-        * @return A reference to iProcesses array
-        */
-        const RArray<TATProcessInfo>& ProcessInfoArray();
-        
-        /**
-        * Gives a reference to the dynamic process info array of this class.
-        * @return A reference to iProcessesDyn array
-        */
-        const RPointerArray<CATDynProcessInfo>& DynProcessInfoArray();
-                
-    public: // Functions from base classes
-        
-        /**
-        * From CPolicyServer.
-        * Creates a new server-side session object.
-        * @param aVersion The version of this server
-        * @param aMessage A message from the client
-        * @return A pointer to a new session object.
-        */
-        CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const;
-        
-    private:
-
-        /**
-        * C++ default constructor.
-        * @param aPriority A priority for this active object
-        */
-        CATStorageServer( TInt aPriority );
-
-        /**
-        *  Symbian 2nd phase constructor.
-        */
-        void ConstructL();
-   
-    private: // Data
-        
-        /** The number of active sessions */
-        TInt iSessionCount;
-        
-        /** An array for storing TATProcessInfo objects */
-        RArray<TATProcessInfo> iProcesses;
-        
-        /** An array for storing CATDynProcessInfo pointers */
-        RPointerArray<CATDynProcessInfo> iProcessesDyn;
-    };
-
-#endif      // ATSTORAGESERVER_H
-            
-// End of File
\ No newline at end of file
--- a/analyzetool/storageserver/server/inc/atstorageserversession.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,588 +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:  Declaration of the server side session class CATStorageServerSession
-*
-*/
-
-
-#ifndef ATSTORAGESERVERSESSION_H
-#define ATSTORAGESERVERSESSION_H
-
-
-//  INCLUDES
-#include    <e32base.h>
-#include    <f32file.h>
-#include    <analyzetool/atcommon.h>
-
-// FORWARD DECLARATIONS
-class CATStorageServer;
-class CATMemoryEntry;
-
-// CLASS DECLARATIONS
-
-/**
-*  A class for storing memory addresses and sizes of allocations.
-*  Needed for giving allocation information for the configuration UI.
-*/
-class TAllocInfo
-    {
-    public:
-    
-    // Constructor
-    TAllocInfo( TUint32 aMemAddress, TInt aAllocSize );
-    
-    /** Address of a memory allocation. */
-    const TUint32 iMemAddress;
-    
-    /** Size of the associated allocation. */
-    const TInt iAllocSize;
-    };
-
-
-/**
-*  The session class for Storage Server.
-*  When the Storage Server client connects to the server, a new object of this
-*  class is constructed. So, for every client there is an associated object
-*  of this class. CATStorageServer forwards all client messages to their associated
-*  session objects.
-*/
-class CATStorageServerSession : public CSession2
-    {
-    public: // Enumerations
-        
-    public:  // Constructors and destructor
-        
-        /**
-        * Two-phased constructor that can leave.
-        * @return A new instance of this class
-        */
-        static CATStorageServerSession* NewL( CATStorageServer& aStorageServer );
-        
-        /**
-        * Two-phased constructor that can leave and leaves a pointer
-        * on the cleanup stack.
-        * @return A new instance of this class
-        */
-        static CATStorageServerSession* NewLC( CATStorageServer& aStorageServer );
-        
-        /**
-        * Destructor
-        */
-        virtual ~CATStorageServerSession();
-        
-    public: // Functions from base classes 
-        
-        /**
-        * Receives messages sent by a client.
-        * @param aMessage A message from a client
-        */
-        virtual void ServiceL( const RMessage2& aMessage );
-        
-    protected: // new functions
-        
-        /**
-        * Initializes this session for logging. This includes opening a logging file
-        * with a requested name. The method is to be called as the first method after
-        * connecting to the server. The method logs information on process starting into
-        * the just opened logging file.
-        * If a logging session is already ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is already
-        * ongoing. Otherwise one of the other system wide error codes.
-        */
-        TInt LogProcessStartedL( const RMessage2& aMessage );
-        
-        /**
-        * Initializes this session for logging. The method is to be called as the first
-        * method after connecting to the server. The method logs information on process
-        * starting into debug channel.
-        * If a logging session is already ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is already
-        * ongoing. Otherwise one of the other system wide error codes.
-        */
-        TInt LogProcessStartTraceL( const RMessage2& aMessage );
-         
-        /**
-        * Logs information on a DLL load into the opened file.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is not
-        *   currently ongoing; Otherwise one of the other system wide error codes.
-        */
-        TInt LogDllLoadedL( const RMessage2& aMessage );
-        
-        /**
-        * Logs information on a DLL load into debug channel.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is not
-        *   currently ongoing; Otherwise one of the other system wide error codes.
-        */
-        TInt LogDllLoadTraceL( const RMessage2& aMessage );
-        
-        /**
-        * Logs information on a DLL unload into the opened file.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is not
-        *   currently ongoing; Otherwise one of the other system wide error codes.
-        */
-        TInt LogDllUnloadedL( const RMessage2& aMessage );
-        
-        /**
-        * Logs information on a DLL unload into debug channel.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is not
-        *   currently ongoing; Otherwise one of the other system wide error codes.
-        */
-        TInt LogDllUnloadTraceL( const RMessage2& aMessage );
-        
-        /**
-        * Stores a memory allocation (memory address, current call stack, allocation
-        * time and allocation size) in an internal array.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is not
-        *   currently ongoing; KErrAlreadyExists, if an attempt is being made to allocate
-        *   again an already allocated memory area; Otherwise one of the other system
-        *   wide error codes.
-        */
-        TInt LogMemoryAllocatedL( const RMessage2& aMessage );
-        
-        /**
-        * Logs information on a memory allocation into debug channel.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is not
-        *   currently ongoing; KErrAlreadyExists, if an attempt is being made to allocate
-        *   again an already allocated memory area; Otherwise one of the other system
-        *   wide error codes.
-        */
-        TInt LogMemoryAllocTraceL( const RMessage2& aMessage );
-                
-        /**
-        * Check a memory allocation (memory address) from an internal array.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @param aRemoveAlloc Boolean to enable removing the found address from allocations.
-        * @return KErrNone, if memory address found in array; 
-        *   KErrNotFound, if the requested memory address was not found.
-        */
-        TInt IsMemoryAdded( const RMessage2& aMessage, const TBool aRemoveAlloc = EFalse );
-        
-        /**
-        * Removes a memory allocation (memory address, current call stack, allocation
-        * time and allocation size) from an internal array.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is not
-        *   currently ongoing; KErrNotFound, if the requested memory address was not
-        *   found; Otherwise one of the other system wide error codes.
-        */
-        TInt LogMemoryFreedL( const RMessage2& aMessage );
-        
-        /**
-        * Logs information on freeing of a memory allocatin into debug channel.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is not
-        *   currently ongoing; KErrNotFound, if the requested memory address was not
-        *   found; Otherwise one of the other system wide error codes.
-        */
-        TInt LogMemoryFreedTraceL( const RMessage2& aMessage );
-        
-        /**
-        * Logs all non-released memory allocations into the opened file as memory leaks.
-        * Then the method logs a number of possibly occured handle leaks into the file.
-        * Next, the method logs information on process ending into the logging file.
-        * Finally, this method closes the logging file opened for the connected process,
-        * and ends the current logging session. However, this method does not end the 
-        * actual client-server session.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is not
-        *   currently ongoing; KErrNotSupported if this method is called with a wrong
-        *   process id from the client. Otherwise one of the other system wide error
-        *   codes.
-        */
-        TInt LogProcessEndedL( const RMessage2& aMessage );
-        
-        /**
-        * Logs a number of possibly occured handle leaks into debug channel. Then, the method
-        * logs information on process ending into debug channel. The method also
-        * ends the current logging session. However, this method does not end the actual
-        * client-server session.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrCancel, if a logging session is not
-        *   currently ongoing; KErrNotSupported if this method is called with a wrong
-        *   process id from the client. Otherwise one of the other system wide error
-        *   codes.
-        */
-        TInt LogProcessEndTraceL( const RMessage2& aMessage );
-        
-        /**
-        * Checks if a given memory address can be found.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return When the system is logging into a file: the index of a found 
-        *   memory address, or KErrNotFound, if a matching memory address cannot
-        *   be found. KErrNone, when the system is not logging into a file.
-        *   KErrCancel, if a logging session is not currently ongoing.
-        */
-        TInt CheckMemoryAddressL( const RMessage2& aMessage );
-        
-        /**
-        * Checks if a given memory address can be found.
-        * If a logging session is not ongoing, the method makes the client raise an
-        * STSEClient: 3 panic, and returns KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return When the system is logging into a file: the index of a found 
-        *   memory address, or KErrNotFound, if a matching memory address cannot
-        *   be found. KErrNone, when the system is not logging into a file.
-        *   KErrCancel, if a logging session is not currently ongoing.
-        */
-        TInt CheckMemoryAddressTrace( const RMessage2& aMessage );
-        
-        /**
-        * Gets all the processes currently logging with AnalyzeTool
-        * @param aMessage A message that includes parameters sent by the client.
-        *   On return a buffer including all the currently logging processes is written
-        *   into this message.
-        * @return KErrNone, if successful; otherwise one of the other system wide error
-        *   codes.
-        */
-        TInt GetProcessesL( const RMessage2& aMessage );
-        
-        /**
-        * Gets all the DLLs loaded by the process determined by the parameters.
-        * @param aMessage A message that includes parameters sent by the client.
-        *   A buffer including all the DLLs loaded by the requested process is
-        *   written into this message.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was
-        *   not found; otherwise one of the other system wide error codes.
-        */
-        TInt GetDllsL( const RMessage2& aMessage );
-        
-        /**
-        * Gets the logging mode of the process determined by the parameters.
-        * @param aMessage A message that includes parameters sent by the client.
-        *   On return, the logging mode is written into this message.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was
-        *   not found; otherwise one of the other system wide error codes.
-        */
-        TInt GetLoggingModeL( const RMessage2& aMessage );
-        
-        /**
-        * Starts a sub test for the given process.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process is not
-        *   found; KErrNotSupported, if the requested process does not have a logging
-        *   session ongoing or its logging mode is not EATLogToTrace; Otherwise one of the
-        *   other system wide error codes.
-        */
-        TInt StartSubtestL( const RMessage2& aMessage );
-        
-        /**
-        * Stops a sub test for the given process.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process is not
-        *   found; KErrNotSupported, if the requested process does not have a logging
-        *   session ongoing or its logging mode is not EATLogToTrace; Otherwise one of the
-        *   other system wide error codes.
-        */
-        TInt StopSubtestL( const RMessage2& aMessage );
-        
-        /**
-        * Starts a sub test for the calling process. Does not need a PID from the client.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrNotSupported, if the calling process
-        *   does not have a logging session ongoing or its logging mode is not
-        *   EATLogToTrace; Otherwise one of the other system wide error codes.
-        */
-        TInt StartSubtest2L( const RMessage2& aMessage );
-        
-        /**
-        * Stops a sub test for the calling process. Does not need a PID from the client.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrNotSupported, if the calling process
-        *   does not have a logging session ongoing or its logging mode is not
-        *   EATLogToTrace; Otherwise one of the other system wide error codes.
-        */
-        TInt StopSubtest2( const RMessage2& aMessage );
-        
-        /**
-        * Gets the number and total size of the current memory chunks allocated by the
-        * requested process.
-        * @param aMessage A message that includes parameters sent by the client. The
-        *   requested information is written into this message.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was
-        *   not found; otherwise one of the other system wide error codes.
-        */
-        TInt GetCurrentAllocsL( const RMessage2& aMessage );
-        
-        /**
-        * Gets the maximum number of memory chunks and the maximum amount of memory 
-        * allocated by the requested process during the test run.
-        * @param aMessage A message that includes parameters sent by the client. The
-        *   requested information is written into this message.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was
-        *   not found; otherwise one of the other system wide error codes.
-        */
-        TInt GetMaxAllocsL( const RMessage2& aMessage );
-        
-        /**
-        * Cancels logging for the requested process. After logging of a given process
-        * has been cancelled, the session associated with that process will not be
-        * usable anymore. If a process wants to start logging again, it needs to close
-        * the handle and open it again in order to create a new session. Until then, any
-        * of the server's methods that can be called by the client will return
-        * KErrCancel.
-        * @param aMessage A message that includes parameters sent by the client.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was
-        *   not found; otherwise one of the other system wide error codes.
-        */
-        TInt CancelLoggingL( const RMessage2& aMessage );
-        
-        /**
-        * Gets the logging file of the process determined by the parameters.
-        * @param aMessage A message that includes parameters sent by the client.
-        *   On return, the logging file is written into this message.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was
-        *   not found; otherwise one of the other system wide error codes.
-        */
-        TInt GetLoggingFileL( const RMessage2& aMessage );
-        
-        /**
-        * Gets the mode of the process determined by the parameters.
-        * @param aMessage A message that includes parameters sent by the client.
-        *   On return, the logging file is written into this message.
-        * @return KErrNone, if successful; KErrNotFound, if the requested process was
-        *   not found; otherwise one of the other system wide error codes.
-        */
-        TInt GetUdebL( const RMessage2& aMessage );
-        
-        /**
-        * Sets the mode of the process determined by the parameters.
-        * @param aMessage A message that includes parameters sent by the client.
-        */
-        void SetUdeb( const RMessage2& aMessage );
-        
-    private:  // New functions for internal use  
-    
-        /**
-        * Releases the resources reserved by this object, and before closing the logging
-        * file and file server session, the method logs information on the occured error
-        * into the logging file.
-        * @param aError The error code to be logged.
-        */
-        void HandleError( TInt aError );
-        
-        /**
-        * Releases the resources reserved by this object, and logs information on the
-        * occured error into debug channel.
-        * @param aError The error code to be logged.
-        */
-        void HandleErrorTrace( TInt aError );
-        
-        /**
-        * Opens a file server session and a file with the name specified.
-        * @param aFileName The name of the file into which to log.
-        * @param aProcessName Current process name.
-        * @return KErrNone, if successful; otherwise one of the other system wide
-        *   error codes.
-        */
-        TInt OpenFsAndFile( const TDesC& aFileName, const TDesC8& aProcessName );
-        
-        /**
-        * Method is used to parse file name extension.
-        * @param aFileName The name of the file into which to log.
-        * @param aExtension Parsed file extension. 
-        */
-        void ParseExtension( TDes& aFileName, TDes& aExtension );
-        
-        /**
-        * Called internally when need generate new file name.
-        * @param aFileName The name of the file into which to log.
-        * @param aProcessName Current process name.
-        */
-        void GenerateNewFileName( TDes& aFileName, const TDesC8& aProcessName );
-        
-        /**
-        * Method is used to check that file exists and is valid.
-        * @param aFileName The name of the file into which to log.
-        */
-        void CheckIfFileAlreadyExist( const TDes& aFileName );
-        
-        /**
-        * Method is used to check file version.
-        * @param aFileName The name of the file into which to log.
-        */
-        void CheckFileVersion( const TDes& aFileName );
-        
-        /**
-        * Closes the handles to the file server session and to the file (if currently open).
-        */
-        void CloseFsAndFile();
-        
-        /**
-        * Writes the memory leaks stored in the iLeakArray member array into the
-        * logging file opened for the current logging session. If the method is
-        * called in a wrong program state (logging session is not ongoing, or the
-        * logging mode is not EATLogToFile), STSEClient: 4, and STSEServer: 4
-        * panics are raised.
-        * @param aMessage The current message from the client.
-        * @return KErrNone, if successful; otherwise one of the other system wide
-        *   error codes.
-        */
-        TInt PrintLeaksL( const RMessage2& aMessage );
-        
-        /**
-        * Sets the server's mode of operation. The operation mode is determined with
-        * an enumeration value, which is received from the client. If the method is
-        * called in a wrong program state (logging session is ongoing), STSEClient: 4,
-        * and STSEServer: 4 panics are raised.
-        * @param aMessage The current message from the client.
-        */
-        void SetLogOption( const RMessage2& aMessage );
-        
-        /**
-        * Logs the given descriptor through debug channel.
-        * @param aLogString The descriptor to be logged.
-        * @return KErrNone, if successful; KErrNotSupported, if a logging session is not
-        *   ongoing, or the logging mode is not EATLogToTrace;
-        */
-        TInt LogThroughTrace( const TDesC& aLogString ) const;
-        
-        /**
-        * Gives a reference to the allocation info array of this class.
-        * @return A reference to iAllocInfoArray array
-        */
-        RArray<TAllocInfo>& AllocInfoArray();
-               
-        /**
-        * Creates a panic in the associated client's code.
-        * @param aPanic The panic code
-        * @param aMessage The message associated with this panic.
-        */
-        void PanicClient( TInt aPanic, const RMessage2& aMessage );
-        
-        /**
-        * Logs the abnormal end to the debug channel (If logging mode is EATLogToTrace) 
-        * and to the file(If logging mode is EATLogToFile).
-        */
-        void LogAbnormalEnd();
-        
-        /**
-        * Get the current universal time.
-        * @return Time
-        */
-        TInt64 GetTime();
-        
-    private: // Constructors 
-        
-        /**
-        * C++ default constructor.
-        */
-        CATStorageServerSession( CATStorageServer& aStorageServer );
-        
-        /**
-        *  Symbian 2nd phase constructor.
-        */
-        void ConstructL();   
-        
-    private: // Data
-        
-        /** A reference to the CATStorageServer object that has created this session */    
-        CATStorageServer& iStorageServer;
-               
-        /** A handle to a file server */
-        RFs iFileServer;
-        
-        /** A handle to a file */
-        RFile iFile;
-        
-        /** A member variable for storing results of server function calls. */ 
-        TInt iError;
-        
-        /** An object for getting time stamps */ 
-        TTime iTime;
-        
-        /** 
-        * An array for storing CATMemoryEntry pointers. Used when logging
-        * to an S60 file.
-        */
-        RPointerArray<CATMemoryEntry> iLeakArray;
-        
-        /** 
-        * An array for storing TAllocInfo objects. Used for keeping records on memory
-        * allocations and their sizes.
-        */
-        RArray<TAllocInfo> iAllocInfoArray;
-        
-        /** The ID of the process associated with this session. */
-        TUint iProcessId;
-        
-        /**
-        * A boolean telling whether this session has been initialized for logging
-        * ( whether the client's LogProcessStarted() method has been called ) or not.
-        */
-        TBool iLoggingOngoing;
-        
-        /**
-        * A variable telling the number of microseconds from January 1st, 0 AD
-        * nominal Gregorian to January 1st, 1970 AD nominal Gregorian. 
-        */
-        TInt64 iMicroSecondsAt1970;
-        
-        /**
-        * An enumeration that tells the current operation mode of the Storage Server.
-        */
-        TATLogOption iLogOption;
-        
-        /** The total size of all the current allocations of this process */
-        TUint32 iCurAllocSize;
-        
-        /** The maximum number of allocations of this process */
-        TUint32 iMaxAllocs;
-        
-        /** The maximum total size of allocations of this process */
-        TUint32 iMaxAllocSize;
-        
-        /** The logging file of this process */
-        TBuf8<KMaxFileName> iLogFile;
-
-        /** The mode of the session. Default is 1 = UDEB */
-        TUint32 iIsUdeb;
-    };
-
-#endif      // ATSTORAGESERVERSESSION_H
-
-// End of File
--- a/analyzetool/storageserver/server/src/atdllinfo.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +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:  Definitions for the class TATDllInfo.
-*
-*/
-
-// INCLUDE FILES
-#include "atdllinfo.h"
-#include "atlog.h"
-
-// -----------------------------------------------------------------------------
-// TATDllInfo::TATDllInfo
-// C++ default constructor.
-// -----------------------------------------------------------------------------
-//
-TATDllInfo::TATDllInfo( const TUint32 aStartAddress, const TUint32 aEndAddress,
-	const TInt64& aLoadTime, const TDesC8& aDllName  )
- :  iStartAddress( aStartAddress ), iEndAddress( aEndAddress ), 
-	iLoadTime( aLoadTime )
-    {
-    LOGSTR3( "STSE TATDllInfo::TATDllInfo() %x - %x", iStartAddress, iEndAddress );
-    
-    iName.Copy( aDllName );
-    }
-
-// -----------------------------------------------------------------------------
-// TATDllInfo::StartAddress
-// Returns library start address
-// -----------------------------------------------------------------------------
-//
-TUint32 TATDllInfo::StartAddress()
-    {
-    LOGSTR2( "STSE TATDllInfo::StartAddress( %x )", iStartAddress );
-    
-    return iStartAddress;
-    }
-
-// -----------------------------------------------------------------------------
-// TATDllInfo::EndAddress
-// Returns library end address
-// -----------------------------------------------------------------------------
-//
-TUint32 TATDllInfo::EndAddress()
-    {
-    LOGSTR2( "STSE TATDllInfo::EndAddress( %x )", iEndAddress );
-    
-    return iEndAddress;
-    }
-
-// -----------------------------------------------------------------------------
-// TATDllInfo::Name
-// Gets specific library name
-// -----------------------------------------------------------------------------
-//
-TDes8& TATDllInfo::Name()
-    {
-    LOGSTR1( "STSE TATDllInfo::Name()" );
-    
-    return iName;
-    }
-
-// -----------------------------------------------------------------------------
-// TATDllInfo::LibraryLoadTime
-// Returns library load time
-// -----------------------------------------------------------------------------
-//
-TInt64 TATDllInfo::LibraryLoadTime()
-    {
-    LOGSTR1( "STSE TATDllInfo::LibraryLoadTime()" );
-    
-    return iLoadTime;
-    }
-        
-// -----------------------------------------------------------------------------
-// TATDllInfo::Match
-// Checks if two objects of this class match based on the objects's
-// saved library name.
-// -----------------------------------------------------------------------------
-//
-TBool TATDllInfo::Match( const TATDllInfo& aFirst, const TATDllInfo& aSecond )
-    {
-    LOGSTR1( "STSE TATDllInfo::Match()" );
-    
-    if ( aFirst.iName.Compare( aSecond.iName ) == 0 )
-        {
-        return ETrue;
-        }
-    return EFalse;
-    }
-
-// End of File
--- a/analyzetool/storageserver/server/src/atdriveinfo.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +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:  Definitions for the class TATDriveInfo.
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <f32file.h>
-#include <driveinfo.h>
-#include "atdriveinfo.h"
-#include "atstorageservercommon.h"
-#include "atlog.h"
-
-// -----------------------------------------------------------------------------
-// TATDriveInfo::TATDriveInfo
-// C++ default constructor.
-// -----------------------------------------------------------------------------
-//
-TATDriveInfo::TATDriveInfo()
-    {
-    LOGSTR1( "TATD TATDriveInfo::TATDriveInfo()" );
-    }
-
-// -----------------------------------------------------------------------------
-// TATDriveInfo::CreatePath()
-// -----------------------------------------------------------------------------
-//    
-TInt TATDriveInfo::CreatePath( TDes& aPath, 
-    const TDesC& aFileName, RFs& aFs )
-    {
-    LOGSTR1( "TATD TInt TATDriveInfo::CreatePath()" );
-    
-    // Drive letter    
-    TChar driveLetter;
-    // Drive number
-    TInt dNumber( EDriveZ );     
-    TBool found( EFalse );
-    // Drive type
-    TUint driveType( KDriveAttRemovable );    
-    TInt err( KErrNotFound );
-    
-    while ( !found )
-        {
-        // Get drive letter
-        if ( GetDrive( driveLetter, dNumber, aFs, driveType ) == KErrNotFound )
-        	{
-        	if ( driveType == KDriveAttInternal )
-        		{
-                return KErrNotFound;
-        		}       	
-            driveType = KDriveAttInternal;
-        	dNumber = EDriveZ;
-        	}       
-        else
-        	{
-			// Create path
-			aPath.Delete( 0, aPath.MaxLength() );
-			aPath.Append( driveLetter );
-		  
-		            
-		#ifdef __WINS__
-            // For emulator the data file is stored to different location
-            aPath.Append( KATDataFilePath );       
-		#else
-		    TDriveInfo driveInfo;
-		    aFs.Drive( driveInfo, dNumber );      
-            // The drive is removable( memory card ) so we can log inside of root folder
-            if ( driveInfo.iDriveAtt & KDriveAttRemovable )
-                {
-                aPath.Append( KATDataFilePath );       
-                }
-            // The drive is internal user can only access data folder so log into that
-            else
-                {
-                aPath.Append( KATDataFilePath2 );       
-                }
-		#endif
-						
-			// Make a directory for AToolStorageServer's logging data file
-			err = aFs.MkDir( aPath );
-			LOGSTR2( "STSE > aFs.MkDir err = %i", err );
-			
-			if ( !err || err == KErrAlreadyExists )
-				{                
-                if ( aFileName.Length() != 0 && 
-                     ( ( aPath.MaxLength() - aPath.Length() ) > aFileName.Length() ) )
-                    {
-                    aPath.Append( aFileName );
-                    }
-				found = ETrue;
-				}
-        	}
-        }        
-    return err;        
-    }
-
-// -----------------------------------------------------------------------------
-// TATDriveInfo::GetDrive()
-// -----------------------------------------------------------------------------
-//    
-TInt TATDriveInfo::GetDrive( TChar& aDrive, TInt& aDriveNumber, RFs& aFs, 
-	const TUint aDriveType )
-    {
-    LOGSTR1( "TATD TInt TATDriveInfo::GetDrive()" );
-       
-    // Contains drive information.
-    TDriveInfo driveInfo; 
-    
-    for ( TInt i = aDriveNumber; i >= (TInt)EDriveA; i-- )
-        {
-        // Gets information about a drive and the medium mounted on it.
-        // If error occured then skip to next drive.
-        if ( aFs.Drive( driveInfo, i ) != KErrNone )
-            continue;
-                
-        // Test whether drive is available. If not, skip to next drive.
-        if ( driveInfo.iDriveAtt & KDriveAbsent || i == (TInt)EDriveD ||
-             driveInfo.iDriveAtt & KDriveAttRom || 
-             driveInfo.iMediaAtt & KMediaAttWriteProtected ||
-             driveInfo.iDriveAtt & KDriveFileSysROFS )
-            continue;
-        
-        // Maps a drive number to the corresponding character.
-        if ( aFs.DriveToChar( i, aDrive ) != KErrNone )
-            continue;                
-        
-        if ( driveInfo.iDriveAtt & aDriveType &&
-             driveInfo.iType != EMediaNotPresent &&
-             driveInfo.iType != EMediaCdRom )
-            {
-            TUint status( 0 );
-            
-            switch ( aDriveType )
-                {
-                case KDriveAttRemovable:
-                    {
-                    // Get the drive status of the default removable mass storage.                    
-                    if ( DriveInfo::GetDriveStatus( aFs, i, status ) == KErrNone )
-                        {
-                        // To indicate that the drive is physically removable.
-                        if ( status & DriveInfo::EDriveRemovable &&
-                             !( status & DriveInfo::EDriveCorrupt ) )
-                            {
-                            aDriveNumber = --i;
-                            return KErrNone;
-                            }
-                        }
-                    }
-                    break;
-                case KDriveAttInternal:
-                    {
-                    // Get the drive status of the default removable mass storage.
-                    if ( DriveInfo::GetDriveStatus( aFs, i, status ) == KErrNone )
-                        {
-                        // To indicate that the drive is internal and 
-                        // cannot be physically removed.
-                        if ( status & DriveInfo::EDriveInternal &&
-                             !( status & DriveInfo::EDriveExternallyMountable ) )
-                            {
-                            aDriveNumber = --i;
-                            return KErrNone;
-                            }
-                        }
-                    }
-                    break;
-                    
-                default:
-                    break;
-                }
-            }
-        }
-    return KErrNotFound;
-    }
- 
-// End of File
--- a/analyzetool/storageserver/server/src/atdynprocessinfo.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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:  Definitions for the class CATDynProcessInfo
-*
-*/
-
-
-// INCLUDE FILES
-#include    "atdynprocessinfo.h"
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-
-// -----------------------------------------------------------------------------
-// CATDynProcessInfo::CATDynProcessInfo
-// -----------------------------------------------------------------------------
-//  
-CATDynProcessInfo::CATDynProcessInfo() :
-    iProcessId( KNullProcessId ),
-    iSessionObject( NULL )
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// CATDynProcessInfo::CATDynProcessInfo
-// -----------------------------------------------------------------------------
-//  
-CATDynProcessInfo::CATDynProcessInfo( TUint aProcessId,
-                                      CATStorageServerSession* aSessionObject,
-                                      const RArray<TATDllInfo>& aDlls ) :
-    iProcessId( aProcessId ),
-    iSessionObject( aSessionObject ),
-    iDlls( aDlls )
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// CATDynProcessInfo::CATDynProcessInfo
-// -----------------------------------------------------------------------------
-//  
-CATDynProcessInfo::CATDynProcessInfo( TUint aProcessId,
-                                      CATStorageServerSession* aSessionObject ) :
-    iProcessId( aProcessId ), iSessionObject( aSessionObject )
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// CATDynProcessInfo::CATDynProcessInfo
-// -----------------------------------------------------------------------------
-//  
-CATDynProcessInfo::CATDynProcessInfo( TUint aProcessId ) :
-    iProcessId( aProcessId ), iSessionObject( NULL )
-    {
-    }
-
-// Destructor
-CATDynProcessInfo::~CATDynProcessInfo()
-    {
-    iDlls.Close();
-    }
-
-// -----------------------------------------------------------------------------
-// CATDynProcessInfo::Compare
-// -----------------------------------------------------------------------------
-//  
-TInt CATDynProcessInfo::Compare( const CATDynProcessInfo& aFirst, 
-	const CATDynProcessInfo& aSecond )
-    {
-    if ( aFirst.iProcessId < aSecond.iProcessId )
-        {
-        return -1;
-        }
-    
-    if ( aFirst.iProcessId > aSecond.iProcessId )
-        {
-        return 1;
-        }
-   
-    // else
-    return 0;
-    }
-
-// End of File
--- a/analyzetool/storageserver/server/src/atmemoryentry.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +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:  Definitions for the class CATMemoryEntry
-*
-*/
-
-
-
-// INCLUDE FILES
-#include    "atmemoryentry.h"
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-
-// -----------------------------------------------------------------------------
-// CATMemoryEntry::CATMemoryEntry
-// C++ default constructor.
-// -----------------------------------------------------------------------------
-//  
-CATMemoryEntry::CATMemoryEntry( TUint32 aMemAddress,
-                                const CBufFlat* aCallstackBuf,
-                                const TInt64& aAllocTime,
-                                TInt aAllocSize ) :
-    iMemAddress( aMemAddress ),
-    iCallstackBuf( aCallstackBuf ),
-    iAllocTime( aAllocTime ),
-    iAllocSize( aAllocSize )
-    {
-    }
-
-// Destructor
-CATMemoryEntry::~CATMemoryEntry()
-    {
-    delete const_cast<CBufFlat*>( iCallstackBuf );
-    }
-
-// -----------------------------------------------------------------------------
-// CATMemoryEntry::Compare
-// -----------------------------------------------------------------------------
-//  
-TInt CATMemoryEntry::Compare( const CATMemoryEntry& aFirst, const CATMemoryEntry& aSecond )
-    {
-    if ( aFirst.iAllocTime < aSecond.iAllocTime )
-        {
-        return -1;
-        }
-    
-    if ( aFirst.iAllocTime > aSecond.iAllocTime )
-        {
-        return 1;
-        }
-   
-    // else
-    return 0;
-    }
-
-// -----------------------------------------------------------------------------
-// CATMemoryEntry::Match
-// -----------------------------------------------------------------------------
-//
-TBool CATMemoryEntry::Match( const CATMemoryEntry& aFirst, const CATMemoryEntry& aSecond )
-    {
-    if ( aFirst.iMemAddress == aSecond.iMemAddress )
-        {
-        return ETrue;
-        }
-    
-    // else
-    return EFalse;
-    }
-
-
--- a/analyzetool/storageserver/server/src/atstorageserver.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,452 +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:  Definitions for the class CATStorageServer. Includes also the
-*                entry point of the atoolstorageserver.exe executable.
-*
-*/
-
-
-
-
-// INCLUDE FILES
-
-#include    "atstorageserver.h"
-#include    "atstorageserversession.h"
-#include    "atstorageservercommon.h"
-#include    "atlog.h"
-#include    "atdynprocessinfo.h"
-
-
-// CONSTANTS
-
-
-// The amount of different ranges of requests specified for this policy server.
-// In a policy server, different actions can be determined for different ranges
-// of requests.
-const TUint8 KAmountOfRanges = 2;
-
-
-const TInt ranges[KAmountOfRanges] =
-    {
-    CATStorageServer::EProcessStarted,
-    CATStorageServer::EOutOfBounds
-    };
-
-
-const TUint8 actionForRange[ KAmountOfRanges ] = 
-    { 0, CPolicyServer::ENotSupported };
-
-
-const CPolicyServer::TPolicyElement elements[] =
-    {
-    
-    { _INIT_SECURITY_POLICY_C1( ECapability_None ),
-          CPolicyServer::EFailClient }
-    
-    };
-
-
-const CPolicyServer::TPolicy policy =
-    {
-    CPolicyServer::EAlwaysPass, // On connect
-    KAmountOfRanges, // Range count
-    ranges,
-    actionForRange,
-    elements,
-    };
-
-
-
-// ENTRY POINT
-
-TInt E32Main()
-    { 
-    LOGSTR1( "STSE TInt E32Main() in ATStorageServer.cpp" );
-    
-    __UHEAP_MARK;
-    
-    // Create a cleanup stack 
-    CTrapCleanup* cleanup = CTrapCleanup::New();
-    
-    TInt errorCode( KErrNoMemory );
-    
-    // If there was enough memory to create a cleanup stack, 
-    // create and start the server.
-    if( cleanup )
-        {
-        // If RunServerL() doesn't leave, errorCode will be set to KErrNone
-        TRAP( errorCode, CATStorageServer::RunServerL() );
-        delete cleanup;
-        }
-
-    // Signal the client that server creation failed, if a leave occured during
-    // the call to 'RunServerL()' function
-    if( errorCode != KErrNone )
-        {
-        RProcess::Rendezvous( errorCode );
-        }
-    
-    __UHEAP_MARKEND;
-       
-    return errorCode;
-    
-    }
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CATStorageServer::CATStorageServer
-// C++ default constructor can NOT contain any code that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CATStorageServer::CATStorageServer( TInt aPriority ) :
-    CPolicyServer( aPriority, policy, ESharableSessions ),
-    iSessionCount( 0 )
-    {
-    LOGSTR1( "STSE CATStorageServer::CATStorageServer()" );
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServer::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CATStorageServer::ConstructL()
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServer::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CATStorageServer* CATStorageServer::NewL()
-    {
-    CATStorageServer* self = NewLC();
-    CleanupStack::Pop( self );
-    
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServer::NewLC
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CATStorageServer* CATStorageServer::NewLC()
-    {  
-    CATStorageServer* self = new ( ELeave ) CATStorageServer( EPriorityStandard );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    self->StartL( KStorageServerName );
-    return self;
-    }
-
-// Destructor
-CATStorageServer::~CATStorageServer()
-    {
-    LOGSTR1( "STSE CATStorageServer::~CATStorageServer()" );
-    
-    iProcesses.Close();
-    iProcessesDyn.ResetAndDestroy();
-    iProcessesDyn.Close();
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServer::NewSessionL
-// Create a new server session.
-// -----------------------------------------------------------------------------
-// 
-CSession2* CATStorageServer::NewSessionL(
-    const TVersion &aVersion,
-    const RMessage2& /*aMessage*/ ) const
-    {
-    LOGSTR1( "STSE CSession2* CATStorageServer::NewSessionL()" );
-    
-    // The server's version
-    TVersion version( KVersionNumberMaj, KVersionNumberMin,
-        KVersionNumberBld );
-
-    // Check this is a high enough version of the server
-    if ( !User::QueryVersionSupported(version, aVersion) )
-        {
-        User::Leave( KErrNotSupported );
-        }
-    
-    // Construct and return a new session object
-    return CATStorageServerSession::NewL( const_cast<CATStorageServer&>(*this) );
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServer::RunServerL
-// Create active scheduler and a server object
-// -----------------------------------------------------------------------------
-//    
-void CATStorageServer::RunServerL()
-    {
-    LOGSTR1( "STSE void CATStorageServer::RunServerL()" );
-    
-    // Create and install an active scheduler
-    CActiveScheduler* activeSched = new (ELeave) CActiveScheduler;
-    CleanupStack::PushL( activeSched );
-    CActiveScheduler::Install( activeSched );
-
-    // Create server
-    CATStorageServer::NewLC();
-     
-    // The initialization performed alright, signal the client
-    RProcess::Rendezvous( KErrNone );
-
-    // Start the active scheduler
-    CActiveScheduler::Start();
-
-    // Remove the server and active scheduler from the cleanup stack
-    CleanupStack::PopAndDestroy( 2, activeSched );
-    }
-  
-// -----------------------------------------------------------------------------
-// CATStorageServer::IncSessionCount
-// Increments the count of active sessions for this server.
-// -----------------------------------------------------------------------------
-// 
-void CATStorageServer::IncSessionCount()
-    {
-    LOGSTR1( "STSE void CATStorageServer::IncSessionCount()" );
-    
-    iSessionCount++;
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServer::DecSessionCount
-// Decrements the count of active sessions for this server.
-// -----------------------------------------------------------------------------
-// 
-void CATStorageServer::DecSessionCount()
-    {
-    LOGSTR1( "STSE void CATStorageServer::DecSessionCount()" );
-       
-    iSessionCount--;
-    
-    // Cancels all outstanding messages and stops the active scheduler,
-    // if there are no other sessions open at the moment
-    if ( iSessionCount <= 0 )
-        {
-        this->Cancel();
-        CActiveScheduler::Stop();
-        }
-    }
-  
-// -----------------------------------------------------------------------------
-// CATStorageServer::AddProcessL
-// -----------------------------------------------------------------------------
-// 
-TInt CATStorageServer::AddProcessL( const TDesC8& aProcessName,
-                                   TUint aProcessId,
-                                   CATStorageServerSession* aSessionObject,
-                                   const TInt64& aStartTime )
-    {
-    LOGSTR1( "STSE TInt CATStorageServer::AddProcessL()" );
-
-    TInt error( KErrNone );
-    TATProcessInfo processInfo;
-    
-    processInfo.iProcessId = aProcessId;
-    processInfo.iProcessName.Copy( aProcessName );
-    processInfo.iStartTime = aStartTime;
-    
-    // Insert the static process info into the iProcesses array
-    error = iProcesses.InsertInUnsignedKeyOrder( processInfo );
-    
-    // Return if an error occured
-    if ( error != KErrNone)
-        {
-        return error;
-        }
-    
-    // Construct a CATDynProcessInfo object with the given process ID and logging mode
-    CATDynProcessInfo* dynProcessInfo = 
-                            new (ELeave) CATDynProcessInfo( aProcessId,
-                                                            aSessionObject );
-    
-    // Insert the dynamic process info into the iProcessesDyn array
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    error = iProcessesDyn.InsertInOrder( dynProcessInfo, order );
-    
-    return error;
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServer::RemoveProcessL
-// -----------------------------------------------------------------------------
-// 
-TInt CATStorageServer::RemoveProcessL( TUint aProcessId )
-    {
-    LOGSTR1( "STSE TInt CATStorageServer::RemoveProcessL()" );
-    
-    TATProcessInfo processInfo;
-    processInfo.iProcessId = aProcessId;
-    
-    TInt index = iProcesses.FindInUnsignedKeyOrder( processInfo );
-
-    // Return, if a process with the requested process ID was not found
-    if ( index == KErrNotFound )
-        {
-        return index; 
-        }
-     
-    // Remove the TATProcessInfo object at "index" from the array
-    iProcesses.Remove( index );
-     
-    // Now, start removing the associated dynamic process info object
-
-    // Construct a CATDynProcessInfo object with the given process ID
-    CATDynProcessInfo* dynProcessInfo = 
-                            new (ELeave) CATDynProcessInfo( aProcessId );
-    
-    // Find the index of a CATDynProcessInfo object with the given ID in the array
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    index = iProcessesDyn.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-     
-    // Return, if a process with the requested process ID was not found
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-     
-    // Otherwise, delete the object and remove the pointer at "index"
-    delete iProcessesDyn[index];
-    iProcessesDyn.Remove( index ); 
-     
-    return KErrNone;   
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServer::AddDllL
-// -----------------------------------------------------------------------------
-// 
-TInt CATStorageServer::AddDllL( TUint aProcessId, 
-    const TATDllInfo aDllInfo )
-    {
-    LOGSTR1( "STSE TInt CATStorageServer::AddDllL()" );
- 
-    // Construct a CATDynProcessInfo object with the given process ID
-    CATDynProcessInfo* dynProcessInfo = 
-		new (ELeave) CATDynProcessInfo( aProcessId );
-  
-    // Find out if a process with this ID can be found in the dynamic process array
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = iProcessesDyn.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-     
-    // Return, if a process with the requested process ID was not found 
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-        
-    // If we are here, the wanted process was found at index => append a DLL for it
-    dynProcessInfo = iProcessesDyn[index];
-    
-    // Get the DLL array from this dynamic process info object
-    RArray<TATDllInfo>& dllArray = dynProcessInfo->iDlls;    
-    
-    // Let's see if the DLL to be added already exists
-    TIdentityRelation<TATDllInfo> matcher( TATDllInfo::Match );
-    index = dllArray.Find( aDllInfo, matcher );
-    
-    // If so, return KErrAlreadyExists
-    if ( index != KErrNotFound )
-        {
-        return KErrAlreadyExists;
-        }
-
-    // Otherwise append this DLL to the array and return 
-    return dynProcessInfo->iDlls.Append( aDllInfo );
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServer::RemoveDllL
-// -----------------------------------------------------------------------------
-// 
-TInt CATStorageServer::RemoveDllL( TUint aProcessId,
-                                  const TDesC8& aDllName )
-    {
-    LOGSTR1( "STSE TInt CATStorageServer::RemoveDllL()" );
-
-    // Construct a CATDynProcessInfo object with the given process ID
-    CATDynProcessInfo* dynProcessInfo = 
-		new (ELeave) CATDynProcessInfo( aProcessId );
-  
-    // Find out if a process with this ID can be found in the dynamic process array
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = iProcessesDyn.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-     
-    // Return, if a process with the requested process ID was not found 
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-        
-    // If we are here, the wanted process was found at index
-    dynProcessInfo = iProcessesDyn[index];
-
-    // Get the DLL array from this dynamic process info object
-    RArray<TATDllInfo>& dllArray = dynProcessInfo->iDlls;
-    
-    // Try to find wanted DLL
-    TIdentityRelation<TATDllInfo> matcher( TATDllInfo::Match );    
-    index = dllArray.Find( TATDllInfo( 0, 0, 0, aDllName  ), matcher );
-    
-    // Return, if a process with the requested process ID was not found 
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-        
-    // Otherwise remove the found DLL at "index"
-    dllArray.Remove( index );    
-        
-    return KErrNone;  
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServer::ProcessInfoArray
-// -----------------------------------------------------------------------------
-// 
-const RArray<TATProcessInfo>& CATStorageServer::ProcessInfoArray()
-    {
-    LOGSTR1( "STSE RArray<TATProcessInfo>& CATStorageServer::ProcessInfoArray()" );
-     
-    return iProcesses;   
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServer::DynProcessInfoArray
-// -----------------------------------------------------------------------------
-// 
-const RPointerArray<CATDynProcessInfo>& CATStorageServer::DynProcessInfoArray()
-    {
-    LOGSTR1( "STSE RPointerArray<CATDynProcessInfo>& CATStorageServer::DynProcessInfoArray()" );
-     
-    return iProcessesDyn;   
-    }    
-    
-//  End of File
--- a/analyzetool/storageserver/server/src/atstorageserversession.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3397 +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:  Definitions and constants for the class CATStorageServerSession
-*
-*/
-
-
-
-// INCLUDE FILES
-#include    <utf.h>
-#include    <analyzetool/analyzetooltraceconstants.h>
-#include    "atstorageserversession.h"
-#include    "atstorageserver.h"
-#include    "atstorageservercommon.h"
-#include    "atmemoryentry.h"
-#include    "atlog.h"
-#include    "atdynprocessinfo.h"
-#include    "atdriveinfo.h"
-
-// CONSTANTS
-
-// New file name start and end index.
-const TInt KNameIndexStart = 1;
-const TInt KNameIndexEnd = 100;
-
-// ==================== MEMBER FUNCTIONS for TAllocInfo ========================
-
-// -----------------------------------------------------------------------------
-// TAllocInfo::TAllocInfo
-// Implementation for the constructor of the class TAllocInfo
-// -----------------------------------------------------------------------------
-//
-TAllocInfo::TAllocInfo( TUint32 aMemAddress, TInt aAllocSize ) :
-    iMemAddress( aMemAddress ),
-    iAllocSize( aAllocSize )
-    {
-    }
-
-
-// ============== MEMBER FUNCTIONS for CATStorageServerSession =================
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::CATStorageServerSession
-// C++ default constructor. It Does not contain any code that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CATStorageServerSession::CATStorageServerSession( CATStorageServer& aStorageServer ) :
-    iStorageServer( aStorageServer ),
-    iError( 0 ),
-    iLeakArray( KLeakArrayGranularity ),
-    iProcessId( KNullProcessId ),
-    iLoggingOngoing( EFalse ),
-    iLogOption( KDefaultLoggingMode ),
-    iCurAllocSize( 0 ),
-    iMaxAllocs( 0 ),
-    iMaxAllocSize( 0 ),
-    iLogFile( KEmpty() ),
-    iIsUdeb( 1 )
-    {
-    LOGSTR1( "STSE CATStorageServerSession::CATStorageServerSession()" );
-    
-    // Initialize iMicroSecondsAt1970
-    TTime time( KJanuaryFirst1970 );
-    iMicroSecondsAt1970 = time.Int64();
-    
-    // Increment the server's session count by one (1)
-    iStorageServer.IncSessionCount();
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CATStorageServerSession::ConstructL()
-    {
-    // Intentionally left empty
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CATStorageServerSession* CATStorageServerSession::NewL( CATStorageServer& aStorageServer )
-    { 
-    CATStorageServerSession* self = NewLC( aStorageServer );
-    CleanupStack::Pop( self );
-    
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::NewLC
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CATStorageServerSession* CATStorageServerSession::NewLC( CATStorageServer& aStorageServer )
-    { 
-    CATStorageServerSession* self = new ( ELeave ) CATStorageServerSession( aStorageServer );
-    
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::~CATStorageServerSession
-// Destructor
-// -----------------------------------------------------------------------------
-CATStorageServerSession::~CATStorageServerSession()
-    {
-    LOGSTR1( "STSE CATStorageServerSession::~CATStorageServerSession()" );
-      
-    // Empty the array and delete the referenced objects
-    iLeakArray.ResetAndDestroy();
-  
-    // Close the leak array
-    iLeakArray.Close();
-    
-    // Close the allocation info array
-    iAllocInfoArray.Close();
-    
-    // Check if process closed abnormal
-    if ( iProcessId != KNullProcessId && 
-         iLoggingOngoing && iLogOption != EATLoggingOff && 
-         iError != KErrNoMemory )
-        {
-        LogAbnormalEnd();
-        }
-    
-    // Close the file and the handle to the file server
-    CloseFsAndFile();
-    
-    // Remove the process with the current PID from the server's array of processes
-    TRAP_IGNORE( iStorageServer.RemoveProcessL( iProcessId ) );
-    
-    // Decrement the server's session count by one (1)
-    iStorageServer.DecSessionCount();
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::ServiceL
-// This function is called by the client/server framework
-// -----------------------------------------------------------------------------
-//
-void CATStorageServerSession::ServiceL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE void CATStorageServerSession::ServiceL()" );
-    
-    // If logging has been cancelled for this session, return immediately
-    if( iLogOption == EATLoggingOff )
-        {
-        aMessage.Complete( KErrCancel );
-        return;
-        }
-    
-    switch ( aMessage.Function() )
-        {
-        case CATStorageServer::EProcessStarted:
-            {
-            // If logging is not ongoing, set the log option
-            if( !iLoggingOngoing )
-                {
-                // Set the operation mode
-                SetLogOption( aMessage );
-                }
-
-            switch ( iLogOption )
-                {
-                case EATLogToTrace:
-                    {
-                    iError = LogProcessStartTraceL( aMessage );
-                    }
-                break;
-                
-                case EATLogToFile:
-                    {
-                    iError = LogProcessStartedL( aMessage );
-                    }
-                break;
-                
-                default:
-                    {
-                    // Panic the client and set iError KErrCancel, because being
-                    // here implies that an illegal log option has been given.
-                    PanicClient( EAToolIllegalLogOption, aMessage );
-                    iError = KErrCancel;
-                    }
-                break;
-                }
-            } 
-        break;
-        
-        
-        case CATStorageServer::EDllLoaded:
-            {
-            switch ( iLogOption )
-                {
-                case EATLogToTrace:
-                    {
-                    iError = LogDllLoadTraceL( aMessage );
-                    }
-                break;
-                
-                case EATLogToFile:
-                    {
-                    iError = LogDllLoadedL( aMessage );
-                    }
-                break;
-                
-                default:
-                    {
-                    // Panic the client and set iError KErrCancel, because being
-                    // here implies that an illegal log option has been given.
-                    PanicClient( EAToolIllegalLogOption, aMessage );
-                    iError = KErrCancel;
-                    }
-                break;
-                }
-            }
-        break;
-        
-        
-        case CATStorageServer::EDllUnloaded:
-            {
-            switch ( iLogOption )
-                {
-                case EATLogToTrace:
-                    {
-                    iError = LogDllUnloadTraceL( aMessage );
-                    }
-                break;
-                
-                case EATLogToFile:
-                    {
-                    iError = LogDllUnloadedL( aMessage );
-                    }
-                break;
-                
-                default:
-                    {
-                    // Panic the client and set iError KErrCancel, because being
-                    // here implies that an illegal log option has been given.
-                    PanicClient( EAToolIllegalLogOption, aMessage );
-                    iError = KErrCancel;
-                    }
-                break;
-                }
-            }
-        break;
-        
-        
-        case CATStorageServer::EMemoryAllocated:
-            {
-            switch ( iLogOption )
-                {
-                case EATLogToTrace:
-                    {
-                    iError = LogMemoryAllocTraceL( aMessage );
-                    }
-                break;
-                
-                case EATLogToFile:
-                    {
-                    iError = LogMemoryAllocatedL( aMessage );
-                    }
-                break;
-                
-                default:
-                    {
-                    // Panic the client and set iError KErrCancel, because being
-                    // here implies that an illegal log option has been given.
-                    PanicClient( EAToolIllegalLogOption, aMessage );
-                    iError = KErrCancel;
-                    }
-                break;
-                }
-            }
-        break;
-        
-        
-        case CATStorageServer::EMemoryFreed:
-            {
-            switch ( iLogOption )
-                {
-                case EATLogToTrace:
-                    {
-                    iError = LogMemoryFreedTraceL( aMessage );
-                    }
-                break;
-                
-                case EATLogToFile:
-                    {
-                    iError = LogMemoryFreedL( aMessage );
-                    }
-                break;
-                
-                default:
-                    {
-                    // Panic the client and set iError KErrCancel, because being
-                    // here implies that an illegal log option has been given.
-                    PanicClient( EAToolIllegalLogOption, aMessage );
-                    iError = KErrCancel;
-                    }
-                break;
-                }
-            }
-        break;
-        
-        
-        case CATStorageServer::EProcessEnded:
-            {
-            switch ( iLogOption )
-                {
-                case EATLogToTrace:
-                    {
-                    iError = LogProcessEndTraceL( aMessage );
-                    }
-                break;
-                
-                case EATLogToFile:
-                    {
-                    iError = LogProcessEndedL( aMessage );
-                    }
-                break;
-                
-                default:
-                    {
-                    // Panic the client and set iError KErrCancel, because being
-                    // here implies that an illegal log option has been given.
-                    PanicClient( EAToolIllegalLogOption, aMessage );
-                    iError = KErrCancel;
-                    }
-                break;
-                }
-            }
-        break;
-        
-        
-        case CATStorageServer::EMemoryCheck:
-            {
-            switch ( iLogOption )
-                {
-                case EATLogToTrace:
-                    {
-                    iError = CheckMemoryAddressTrace( aMessage );
-                    }
-                break;
-                
-                case EATLogToFile:
-                    {
-                    iError = CheckMemoryAddressL( aMessage );
-                    }
-                break;
-                
-                default:
-                    {
-                    // Panic the client and set iError KErrCancel, because being
-                    // here implies that an illegal log option has been given.
-                    PanicClient( EAToolIllegalLogOption, aMessage );
-                    iError = KErrCancel;
-                    }
-                break;
-                }
-            }
-        break;
-        
-        
-        case CATStorageServer::EGetProcesses:
-            {
-            iError = GetProcessesL( aMessage );
-            }
-        break;
-        
-        
-        case CATStorageServer::EGetDlls:
-            {
-            iError = GetDllsL( aMessage );
-            }
-        break;
-        
-        case CATStorageServer::EGetLoggingMode:
-            {
-            iError = GetLoggingModeL( aMessage );
-            }
-        break;
-        
-        case CATStorageServer::ESubtestStart:
-            {
-            iError = StartSubtestL( aMessage );
-            }
-        break;
-        
-        case CATStorageServer::ESubtestStop:
-            {
-            iError = StopSubtestL( aMessage );
-            }
-        break;
-        
-        case CATStorageServer::ESubtestStart2:
-            {
-            iError = StartSubtest2L( aMessage );
-            }
-        break;
-               
-        case CATStorageServer::ESubtestStop2:
-            {
-            iError = StopSubtest2( aMessage );
-            }
-        break;
-        
-        case CATStorageServer::EGetCurrentAllocs:
-            {
-            iError = GetCurrentAllocsL( aMessage );
-            }
-        break;
-        
-        case CATStorageServer::EGetMaxAllocs:
-            {
-            iError = GetMaxAllocsL( aMessage );
-            }
-        break;
-        
-        case CATStorageServer::ECancelLogging:
-            {
-            iError = CancelLoggingL( aMessage );
-            }
-        break;
-
-        case CATStorageServer::EGetUdeb:
-            {
-            iError = GetUdebL( aMessage );
-            }
-        break;
-        
-        case CATStorageServer::EGetLoggingFile:
-            {
-            iError = GetLoggingFileL( aMessage );
-            }
-        break;
-
-        case CATStorageServer::EProcessUdeb:
-            {
-            SetUdeb( aMessage );
-            }
-        break;
-        
-        case CATStorageServer::EIsMemoryAdded:
-            {
-            iError = IsMemoryAdded( aMessage );
-            LOGSTR2( "STSE > IsMemoryAdded err = %i", iError );
-            }
-        break;       
-        
-        default:
-            {
-            // Panic both the client and server, because being here implies
-            // that there is an internal error in the client/server.
-            PanicClient( EAToolBadRequest, aMessage );
-            StorageServerPanic( KCategoryServer, EAToolBadRequest );
-            }
-        break;
-            
-        }
-    
-    // Complete the message, if it has not been already cancelled.
-    if ( iError != KErrCancel )
-        {
-        // Log the error code. Only KErrNoMemory errors are logged.
-        if ( iLogOption == EATLogToFile && iError == KErrNoMemory  )
-            {
-            HandleError( iError );
-            }
-        else if ( iLogOption == EATLogToTrace && iError == KErrNoMemory )
-            {
-            HandleErrorTrace( iError );
-            }
-               
-        // Complete serving the message 
-        aMessage.Complete( iError );
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogProcessStartedL()
-// Opens a logging file with the requested name and then writes information
-// on process start into the file.
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::LogProcessStartedL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogProcessStartedL()" );
-    
-    // Panic the client and return, if this method has already been called for this
-    // session object (and a logging file has been opened)
-    if ( iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    iError = KErrNone;
-    
-    LOGMEM;
-    
-    // READ THE FIRST ARGUMENT (descriptor)  
-    
-    // Length of the first argument (index 0)
-    TInt length = aMessage.GetDesLength( 0 );
-    
-    LOGSTR2( "STSE length of the fileName: %i", length );
-    
-    // Return if errors
-    if ( length == KErrArgument || length == KErrBadDescriptor )
-        {
-        return length;
-        }
-    
-    // Construct a buffer for file name, and leave the pointer on Cleanup Stack
-    HBufC* fileName = HBufC::NewLC( length );
-    TPtr fileNamePtr( fileName->Des() );
-     
-    // Read the client side's descriptor at index 0
-    iError = aMessage.Read( 0, fileNamePtr );
-    
-    if ( iError != KErrNone )
-        {
-        CleanupStack::PopAndDestroy( fileName );
-        return iError;
-        }
-    
-    // READ THE SECOND ARGUMENT (descriptor)  
-    
-    // Length of the second argument (index 1)   
-    length = aMessage.GetDesLength( 1 );
-    
-    LOGSTR2( "STSE length of the processName: %i", length );
-    
-    // Return if errors
-    if ( length == KErrArgument || length == KErrBadDescriptor )
-        {
-        CleanupStack::PopAndDestroy( fileName );
-        return length;
-        }
-    
-    HBufC8* processName = HBufC8::NewL( length );
-    TPtr8 bufPtr( processName->Des() );
-
-    // Read the client side's descriptor at index 1 
-    iError = aMessage.Read( 1, bufPtr );
-  
-    if ( iError != KErrNone )
-        {
-        delete processName;
-        CleanupStack::PopAndDestroy( fileName );
-        return iError;
-        }
-    
-    // READ THE THIRD ARGUMENT (integer, a process ID)    
-    TInt processId = aMessage.Int2();
-    
-    // Open a file server session and a file. The file
-    // will be opened with the name received from the client
-    iError = OpenFsAndFile( *fileName, *processName );
-    CleanupStack::PopAndDestroy( fileName );
-    // Return without logging, if an error occured
-    if ( iError != KErrNone )
-        {
-        // Delete the local objects
-        delete processName;
-        return iError;
-        }
-    
-    // Get the home time for the configuration UI
-    iTime.HomeTime();
-    
-    // Add the process into the server's array of processes
-    iError = iStorageServer.AddProcessL( *processName,
-                                        processId,
-                                        this,
-                                        iTime.Int64() );
-
-    // Return without logging, if an error occured
-    if ( iError )
-        {
-        // Remove, if something was added regardless of the error
-        // However, we must not remove an existing process
-        if ( iError != KErrAlreadyExists )
-            {
-            iStorageServer.RemoveProcessL( processId );
-            }
-        return iError;
-        }
-      
-    // Make a buffer that will be logged into the opened logging file
-    TBuf8<KProcessStartBufLength> loggingBuf;
-    loggingBuf.Format( KProcessStart, processName, processId );
-    
-    delete processName;
-    
-    // Get the current universal time       
-    TInt64 timeFrom1970( GetTime() );
-    
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    loggingBuf.AppendNum( timeFrom1970, EHex );
-    
-    // Append udeb/urel information to the process start
-    loggingBuf.Append( KSpace );  
-    loggingBuf.AppendNum( iIsUdeb, EHex );
-    
-    // Append trace version information
-    loggingBuf.Append( KSpace );
-    loggingBuf.AppendNum( KATTraceVersion, EHex );
-    
-    // Append a new line
-    loggingBuf.Append( KNewLine );
-    
-    // Write the buffer into the file  
-    iError = iFile.Write( loggingBuf );
-    
-    // Return, if an error occured
-    if ( iError )
-        {
-        iStorageServer.RemoveProcessL( processId );
-        return iError;
-        }
-    
-    LOGMEM;
-    
-    // Set the process ID value for this logging session
-    iProcessId = processId;
-    // Set logging session started
-    iLoggingOngoing = ETrue;
-    
-    return iError;
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogProcessStartTraceL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::LogProcessStartTraceL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogProcessStartTraceL()" );
-    
-    // Panic the client and return, if this method has already been called for this
-    // session object
-    if ( iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    iError = KErrNone;
-    
-    LOGMEM;
-    
-    // READ THE SECOND ARGUMENT (descriptor)
-    // The first argument, file name, is ignored when logging thru trace  
-    
-    // Length of the second argument (index 1)
-    TInt length = aMessage.GetDesLength( 1 );
-    
-    LOGSTR2( "STSE length of the processName: %i", length );
-
-    // Return if errors
-    if ( length == KErrArgument || length == KErrBadDescriptor )
-        {
-        return length;
-        }
-
-    HBufC8* processName = HBufC8::NewL( length );
-    TPtr8 bufPtr( processName->Des() );
-
-    // Read the client side's descriptor at index 1 
-    iError = aMessage.Read( 1, bufPtr );
-  
-    if ( iError != KErrNone )
-        {
-        // Delete local objects and return
-        delete processName;
-        return iError;
-        }
-    
-    // READ THE THIRD ARGUMENT (integer, a process ID)    
-    TInt processId = aMessage.Int2();
-
-    // Get the home time for the configuration UI
-    iTime.HomeTime();
-    
-    // Add the process into the server's array of processes
-    iError = iStorageServer.AddProcessL( *processName, processId, this,
-                                             iTime.Int64() );
-    
-    // Return without logging, if an error occured
-    if ( iError )
-        {
-        // Remove, if something was added regardless of the error
-        // However, we must not remove an existing process
-        if ( iError != KErrAlreadyExists )
-            {
-            iStorageServer.RemoveProcessL( processId );
-            }
-        return iError;
-        }
-
-    // Make a buffer that will be logged
-    TBuf8<KProcessStartBufLength> loggingBuf;
-    
-    loggingBuf.Format( KProcessStart, processName, processId );
-    
-    delete processName;
-    
-    // Get the current universal time      
-    TInt64 timeFrom1970( GetTime() );
-    
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    loggingBuf.AppendNum( timeFrom1970, EHex );
-    
-    // Append udeb/urel information to the process start
-    loggingBuf.Append( KSpace );
-    loggingBuf.AppendNum( iIsUdeb, EHex );
-    
-    // Append version number
-    loggingBuf.Append( KSpace );  
-    loggingBuf.AppendNum( KATTraceVersion, EHex );
-    
-    // Append a new line
-    loggingBuf.Append( KNewLine );
-    
-    // Log to trace
-    TBuf<KProcessStartBufLength> traceBuf;
-    traceBuf.Copy( loggingBuf );
-    RDebug::Print( KTraceMessage, processId ,&traceBuf );
-    
-    LOGMEM;
-    
-    // Set the process ID value for this logging session
-    iProcessId = processId;
-    // Set logging session started
-    iLoggingOngoing = ETrue;
-    
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogDllLoadedL()
-// Logs to the file opened by the function LogProcessStartedL()
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::LogDllLoadedL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogDllLoadedL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    iError = KErrNone;
-    
-    // Read the length of the first argument (index 0)   
-    TInt length = aMessage.GetDesLength( 0 );
-    
-    // Return if errors
-    if ( length == KErrArgument || length == KErrBadDescriptor )
-        {
-        return length;
-        }
-    
-    HBufC8* dllName = HBufC8::NewL( length );
-    TPtr8 bufPtr( dllName->Des() );
-
-    // Read the client side's descriptor (the argument 0) 
-    iError = aMessage.Read( 0, bufPtr );
-  
-    if ( iError != KErrNone )
-        {
-        delete dllName;
-        return iError;
-        }
-    
-    // Get the current universal time
-	TInt64 timeFrom1970( GetTime() );
-        
-    // Add this dll into the server's array
-    TUint32 startAddress( aMessage.Int1() );        
-    TUint32 endAddress( aMessage.Int2() );
-    iError = iStorageServer.AddDllL( iProcessId, 
-    		TATDllInfo( startAddress, endAddress, timeFrom1970, *dllName ) );
-    
-    // Return without logging, if an error occured
-    if ( iError )
-        {
-        delete dllName;
-        return iError;
-        }
-    
-    // Make a buffer that will be logged into the opened logging file
-    TBuf8<KDllLoadBufLength> loggingBuf;
-    loggingBuf.Format( KDllLoad, dllName, timeFrom1970, startAddress, endAddress );
-    
-    delete dllName;
-    
-    // Write the buffer into a file and return the error code   
-    return iFile.Write( loggingBuf );
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogDllLoadTraceL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::LogDllLoadTraceL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogDllLoadTraceL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    iError = KErrNone;
-    
-    // Read the length of the first argument (index 0)
-    TInt length = aMessage.GetDesLength( 0 );
-    
-    // Return if errors
-    if ( length == KErrArgument || length == KErrBadDescriptor )
-        {
-        return length;
-        }
-    
-    HBufC8* dllName = HBufC8::NewL( length );
-    TPtr8 bufPtr( dllName->Des() );
-
-    // Read the client side's descriptor (the argument 0) 
-    iError = aMessage.Read( 0, bufPtr );
-  
-    if ( iError != KErrNone )
-        {
-        delete dllName;
-        return iError;
-        }
-    // Get the current universal time
-	TInt64 timeFrom1970( GetTime() );
-    	
-    TUint32 startAddress( aMessage.Int1() );
-    TUint32 endAddress( aMessage.Int2() );
-        
-    // Add this dll into the server's array 
-    iError = iStorageServer.AddDllL( iProcessId, 
-    		TATDllInfo( startAddress, endAddress, timeFrom1970, *dllName ) );
-    
-    // Return without logging, if an error occured
-    if ( iError )
-        {
-        delete dllName;
-        return iError;
-        }
-    
-    // Make a buffer that will be logged
-    TBuf8<KDllLoadBufLength> loggingBuf;
-    loggingBuf.Format( KDllLoad, dllName, timeFrom1970, startAddress, endAddress );
-    
-    delete dllName;
-    
-    TBuf<KDllLoadBufLength> traceBuf;
-    traceBuf.Copy( loggingBuf );
-    RDebug::Print( KTraceMessage, iProcessId ,&traceBuf );
-    return iError;
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogDllUnloadedL()
-// Logs to the file opened by the function LogProcessStartedL()
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::LogDllUnloadedL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogDllUnloadedL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    iError = KErrNone;
-    
-    // Read the length of the first argument (index 0)   
-    TInt length = aMessage.GetDesLength( 0 );
-    
-    LOGSTR2( "STSE length %i", length );
-    
-    // Return if errors
-    if ( length == KErrArgument || length == KErrBadDescriptor )
-        {
-        return length;
-        }
-    
-    HBufC8* dllName = HBufC8::NewL( length );
-    TPtr8 bufPtr( dllName->Des() );
-
-    // Read the client side's descriptor (the argument 0) 
-    iError = aMessage.Read( 0, bufPtr );
-  
-    if ( iError != KErrNone )
-        {
-        delete dllName;
-        return iError;
-        }
-       
-    TUint32 startAddress = aMessage.Int1();
-    TUint32 endAddress = aMessage.Int2();
-    
-    // Get the current universal time
-    TInt64 timeFrom1970( GetTime() );
-        
-    // Make a buffer that will be logged into the opened logging file
-    TBuf8<KDllUnloadBufLength> loggingBuf;
-    loggingBuf.Format( KDllUnload, dllName, timeFrom1970, startAddress, endAddress );
-    
-    // Remove this dll from the server's array
-    iError = iStorageServer.RemoveDllL( iProcessId, bufPtr );
-    
-    delete dllName;
-    
-    // Return without logging, if an error occured
-    if ( iError )
-        {
-        return iError;
-        }
-     
-    // Write the buffer into a file and return the error code   
-    return iFile.Write( loggingBuf );
-    }
- 
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogDllUnloadTraceL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::LogDllUnloadTraceL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogDllUnloadTraceL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-        
-    iError = KErrNone;
-    
-    // Read the length of the first argument (index 0)   
-    TInt length = aMessage.GetDesLength( 0 );
-    
-    LOGSTR2( "STSE length %i", length );
-    
-    // Return if errors
-    if ( length == KErrArgument || length == KErrBadDescriptor )
-        {
-        return length;
-        }
-    
-    HBufC8* dllName = HBufC8::NewL( length );
-    TPtr8 bufPtr( dllName->Des() );
-
-    // Read the client side's descriptor (the argument 0) 
-    iError = aMessage.Read( 0, bufPtr );
-  
-    if ( iError != KErrNone )
-        {
-        delete dllName;
-        return iError;
-        }
-    
-    TUint32 startAddress = aMessage.Int1();
-    TUint32 endAddress = aMessage.Int2();
-    
-    // Get the current universal time
-    TInt64 timeFrom1970( GetTime() );
-        
-    // Make a buffer that will be logged
-    TBuf8<KDllUnloadBufLength> loggingBuf;
-    loggingBuf.Format( KDllUnload, dllName, timeFrom1970, startAddress, endAddress );
-    
-    // Remove this dll from the server's array
-    iError = iStorageServer.RemoveDllL( iProcessId, bufPtr );
-    
-    delete dllName;
-    
-    // Return without logging, if an error occured
-    if ( iError )
-        {
-        return iError;
-        }
-    
-    TBuf<KDllLoadBufLength> traceBuf;
-    traceBuf.Copy( loggingBuf );
-    RDebug::Print( KTraceMessage, iProcessId ,&traceBuf );
-    return iError;
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogMemoryAllocatedL()
-// Constructs a CATMemoryEntry object and appends it into iLeakArray.
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::LogMemoryAllocatedL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogMemoryAllocatedL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }     
-    
-    // A pointer to a buffer of call stack's memory addresses
-    CBufFlat* stackBuf = NULL;
-    
-    iError = KErrNone;
-    
-    // Get the current universal time
-    TInt64 timeFrom1970( GetTime() );
-    
-    // Read the first argument (index 0)
-    TUint32 memAddress = aMessage.Int0();
-    if ( memAddress == 0 )
-        {
-        return KErrNotSupported;
-        }
-    
-    // Read the length of the descriptor argument (index 1) that should include
-    // call stack memory addresses associated with this memory allocation
-    TInt bufferLength = aMessage.GetDesLength( 1 );
-    
-    // Construct a buffer for aCallstack
-    stackBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( stackBuf );
-    
-    // Buffer position
-    TInt pos = 0;
-    
-    stackBuf->ExpandL( pos, bufferLength );
-
-    TPtr8 bufPtr = stackBuf->Ptr( pos );
-
-    // Read the descriptor argument into the buffer
-    aMessage.ReadL( 1, bufPtr );
-
-    // Read the third argument (index 2) that tells the size of this allocation
-    TInt size = aMessage.Int2();
-    
-    // Construct a new CATMemoryEntry object.   
-    // The ownership of the current stackBuf object is given to the "entry" object.
-    CATMemoryEntry* entry = 
-        new (ELeave) CATMemoryEntry( memAddress, stackBuf, timeFrom1970, size );
-    
-    // Pop stackBuf from CleanupStack and set it to NULL, because it is not used anymore.
-    CleanupStack::Pop( stackBuf );
-    stackBuf = NULL;
-    
-    // Make sure that the same memory area is not tryed to be allocated a second time
-    TIdentityRelation<CATMemoryEntry> matcher( CATMemoryEntry::Match );
-
-    TInt index = iLeakArray.Find( entry, matcher );
-    
-    if ( index == KErrNotFound )
-        {
-        TLinearOrder<CATMemoryEntry> order( CATMemoryEntry::Compare );
-        
-        // Insert the "entry" object into "iLeakArray". The ownership of
-        // the "entry" object is given to the array.
-        iError = iLeakArray.InsertInOrderAllowRepeats( entry, order );
-               
-        // If an insertion to the array was not successful, delete the created
-        // entry manually and return.
-        if ( iError )
-            {
-            delete entry;
-            return iError;
-            }
-        
-        // Make a TAllocInfo object, and give values for its members.
-        TAllocInfo allocInfo( memAddress, size );
-
-        // Insert the allocInfo object into iAllocInfoArray
-        iError = iAllocInfoArray.InsertInUnsignedKeyOrder( allocInfo );
-    
-        // If an insertion to the array was not successful, delete the created entry
-        // and remove its pointer from iLeakArray.
-        if ( iError )
-            {
-            index = iLeakArray.Find( entry, matcher );
-            // Delete the entry object and remove remove the pointer from the array
-            delete entry;
-            // The index should be in a legal range, because the earlier insertion of
-            // the entry was successful
-            iLeakArray.Remove( index );
-            }
-        
-        // Otherwise update the iCurAllocSize, iMaxAllocs and iMaxAllocSize variables
-        
-        iCurAllocSize += size;
-        
-        // The count can never be negative => associate it to an unsigned int
-        TUint allocCount = iAllocInfoArray.Count();
-        if ( allocCount > iMaxAllocs )
-            {
-            iMaxAllocs = allocCount;
-            }
-        
-        if ( iCurAllocSize > iMaxAllocSize )
-            {
-            iMaxAllocSize = iCurAllocSize;
-            }
-        
-        return iError;
-        }
-        
-    // This shouldn't happen, because the same memory area shouldn't be allocated
-    // more than once (without deallocating it first)
-    else
-        {
-        delete entry;
-        return KErrAlreadyExists;
-        }
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogMemoryAllocTraceL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::LogMemoryAllocTraceL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogMemoryAllocTraceL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    // Read the first argument (index 0)
-    TUint32 memAddress = aMessage.Int0();
-    if ( memAddress == 0 )
-        {
-        return KErrNotSupported;
-        }
-    
-    // Read the third argument (index 2) that tells the size of this allocation
-    TInt size = aMessage.Int2();
-    
-    // Append this allocation into the iAllocInfoArray array. This array is for
-    // providing the configuration UI with information on allocations
-    
-    // Make a TAllocInfo object, and give values for its members.
-    TAllocInfo allocInfo( memAddress, size );
-
-    // Insert the allocInfo object into iAllocInfoArray
-    iError = iAllocInfoArray.InsertInUnsignedKeyOrder( allocInfo );
-    
-    // Log debug message if duplicated allocation.
-    if ( iError == KErrAlreadyExists )
-        {
-        LOGSTR2( "STSE TInt CATStorageServerSession::LogMemoryAllocTraceL() Error, duplicate allocation :%i", memAddress );
-        }
-
-    // A pointer to a buffer of call stack's memory addresses
-    CBufFlat* stackBuf = NULL;
-    
-    // Get the current universal time           
-    TInt64 timeFrom1970( GetTime() );     
-    
-    // Read the length of the descriptor argument (index 1) that should include
-    // call stack memory addresses associated with this memory allocation
-    TInt bufferLength = aMessage.GetDesLength( 1 );
-    
-    // Construct a buffer for aCallstack
-    stackBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( stackBuf );
-    
-    // Buffer position
-    TInt pos( 0 );    
-    stackBuf->ExpandL( pos, bufferLength );
-    
-    TPtr8 bufPtr = stackBuf->Ptr( pos );
-    
-    // Read the descriptor argument (index 1) into the buffer
-    aMessage.ReadL( 1, bufPtr );
-    
-    // Variable for the number of memory addresses in the call stack
-    TInt addrCount( 0 );    
-    TUint32 callStackAddr;
-    
-    // Read the first word of the buffer. This includes the number of
-    // memory addresses stored in the current stackBuf   
-    stackBuf->Read( pos, &addrCount, KWordSize );
-    
-    // Move the position one word onwards.    
-    pos += KWordSize;
-    
-    // Create a 16-bit buffer, and a pointer descriptor for it    
-    // ALLOCH <Memory address> <Time stamp> <Allocation size> <Call stack address count> 
-    // <Call stack address> <Call stack address> ...
-    HBufC* traceBuf = HBufC::NewL( KMemAllocBufLength );
-    TPtr tracePtr( traceBuf->Des() );
-    
-    // Pop stackBuf from CleanupStack, since no leavable operations will be done
-    // anymore
-    CleanupStack::Pop( stackBuf );
-    
-    // Append the tag implying a memory allocation line in the data file
-    tracePtr.Append( KMemoryAllocHeader );
-    
-    // Append the start address of this allocation in the 32-bit (max 8 characters)
-    // hexadecimal text format.
-    tracePtr.AppendNum( memAddress, EHex );
-    
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    tracePtr.Append( KSpaceTrace );
-    tracePtr.AppendNum( timeFrom1970, EHex );
-    
-    // Append the size of the allocation in the 32-bit (max 8 characters) hexadecimal
-    // text format.
-    tracePtr.Append( KSpaceTrace );
-    tracePtr.AppendNum( size, EHex );
-    
-    // Append call stack address count
-    tracePtr.Append( KSpaceTrace );
-    tracePtr.AppendNum( addrCount, EHex );
-    
-    // Calculate last item length
-    TInt lastItemLength( KTraceMessage().Length() + KHexa32Length + 
-            KSpaceLength + KNewlineLength );
-    
-    TUint packetNumber( 1 );
-    
-    // Go through all call stack's memory addresses associated with
-    // this memory allocation 
-    for ( TInt j = 0; j < addrCount; j++ )
-        {
-        // ALLOCF <Memory address> <Time stamp> <Packet number> 
-        // <Call stack address> <Call stack address> ...
-        if ( tracePtr.Length() <= 0 )
-            {                
-            // Create alloc fragment message header
-            tracePtr.Append( KMemoryAllocFragment );
-            tracePtr.AppendNum( memAddress, EHex );
-            tracePtr.Append( KSpaceTrace );
-            tracePtr.AppendNum( timeFrom1970, EHex );
-            tracePtr.Append( KSpaceTrace );        
-            tracePtr.AppendNum( packetNumber, EHex );
-            // Increase packet number
-            packetNumber++;
-            }
-        
-        // Read the next call stack's memory address stored in the buffer.
-        stackBuf->Read( pos, &callStackAddr, KWordSize );
-        
-        // Append the read memory address as a hexadecimal number
-        tracePtr.AppendFormat( KHexaNumberTrace, callStackAddr );
-        
-        // Move the pos variable one word onwards.
-        pos += KWordSize;
-        
-        // Check if buffer max length exceed
-        if ( lastItemLength + tracePtr.Length() >= KMemAllocBufLength )
-            {
-            tracePtr.Append( KNewLineTrace );
-            // Log through debug channel 
-            RDebug::Print( KTraceMessage, iProcessId, traceBuf );
-            // Empty trace buffer
-            tracePtr.Delete( 0, tracePtr.MaxLength() );
-            }
-        }
-    
-    // Send the last message if exists
-    if ( tracePtr.Length() > 0 )
-        {
-        tracePtr.Append( KNewLineTrace );
-        
-        // Log through debug channel 
-        RDebug::Print( KTraceMessage, iProcessId, traceBuf );
-        }
-    
-    delete traceBuf;
-    delete stackBuf;
-    
-    // Update the iCurAllocSize, iMaxAllocs and iMaxAllocSize variables            
-    iCurAllocSize += size;
-    
-    // The count can never be negative => associate it to an unsigned int
-    TUint allocCount = iAllocInfoArray.Count();
-    if ( allocCount > iMaxAllocs )
-        {
-        iMaxAllocs = allocCount;
-        }
-    
-    if ( iCurAllocSize > iMaxAllocSize )
-        {
-        iMaxAllocSize = iCurAllocSize;
-        }
-    
-    return KErrNone;    
-    }    
-    
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogMemoryFreedL()
-// Removes a TATMemoryEntry object with the specified memory address from 
-// iLeakArray, if found.
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::LogMemoryFreedL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogMemoryFreedL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    // Get the memory address
-    TUint32 memAddress = aMessage.Int0();
-    
-    // Remove this memory allocation from the leak array
-    TIdentityRelation<CATMemoryEntry> matcher( CATMemoryEntry::Match );
-    CATMemoryEntry* entry = new (ELeave) CATMemoryEntry( memAddress, NULL, 0, 0 );
-    TInt index = iLeakArray.Find( entry, matcher );
-    delete entry;
-    
-    // Return, if the requested memory address was not found
-    // (had not been allocated)
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-    
-    // Delete the CATMemoryEntry object at "index" and remove from the array
-    delete iLeakArray[index];
-    iLeakArray.Remove( index );
-    
-    // Remove this memory allocation also from the allocation info array
-    // Make a TAllocInfo object for a "find" operation
-    TAllocInfo allocInfo( memAddress, 0 );
-    index = iAllocInfoArray.FindInUnsignedKeyOrder( allocInfo );
-    
-    // The index should not be KErrNotFound, because an object with this memory address
-    // was found in the iLeakArray array. If the index is out of range, something is
-    // badly wrong, so it would be alright to panic in that case.
-    if ( index == KErrNotFound )
-        {
-        PanicClient( EAToolInternalError, aMessage );
-        return KErrCancel;
-        }
-    
-    // Decrease the current alloc size and remove the requested allocation
-    // from iAllocInfoArray
-    iCurAllocSize -= iAllocInfoArray[index].iAllocSize;
-    iAllocInfoArray.Remove( index );
-    
-    // If we are here, everything has gone alright
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::IsMemoryAdded()
-// Check a memory allocation (memory address) from an internal array.
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::IsMemoryAdded( const RMessage2& aMessage, 
-    const TBool aRemoveAlloc )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::IsMemoryAdded()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-        
-    // Read the first argument (index 0)
-    TUint32 memAddress = aMessage.Int0();
-    
-    // Try to find this memory allocation from the allocation info array
-    
-    // Make a TAllocInfo object for a "find" operation
-    TAllocInfo allocInfo( memAddress, 0 );
-    TInt index( iAllocInfoArray.FindInUnsignedKeyOrder( allocInfo ) );
-    
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-    else if ( aRemoveAlloc )
-        {
-        // Otherwise decrease the current alloc size and remove the requested allocation
-        // from iAllocInfoArray
-        iCurAllocSize -= iAllocInfoArray[index].iAllocSize;
-        iAllocInfoArray.Remove( index );
-        }
-    
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogMemoryFreedTraceL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::LogMemoryFreedTraceL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogMemoryFreedTraceL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    // A pointer to a buffer of call stack's memory addresses
-    CBufFlat* stackBuf = NULL;        
-    iError = KErrNone;    
-    
-    // Read the first argument (index 0)
-    TUint32 memAddress = aMessage.Int0();
-
-    // Remove address from allocation table and its size from alloc size,
-    // if found from table.
-    TAllocInfo allocInfo( memAddress, 0 ); // Dummy info for search.
-    TInt index( iAllocInfoArray.FindInUnsignedKeyOrder( allocInfo ) );
-    if ( index != KErrNotFound )
-        {
-        // Decrease the current alloc size and remove the requested allocation
-        // from table.
-        iCurAllocSize -= iAllocInfoArray[index].iAllocSize;
-        iAllocInfoArray.Remove( index );
-        }
-    else
-        {
-        LOGSTR2( "STSE TInt CATStorageServerSession::LogMemoryFreedTrace() Error, cannot find alloc for free: %i", memAddress );
-        }
-    
-    // Read the length of the descriptor argument (index 1) that should include
-    // call stack memory addresses associated with this memory allocation
-    TInt bufferLength = aMessage.GetDesLength( 1 );
-    
-    // Construct a buffer for aCallstack
-    stackBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( stackBuf );
-    
-    // Buffer position
-    TInt pos = 0;
-    
-    stackBuf->ExpandL( pos, bufferLength );
-
-    TPtr8 bufPtr = stackBuf->Ptr( pos );
-
-    // Read the descriptor argument (index 1) into the buffer
-    aMessage.ReadL( 1, bufPtr );
-    
-    // Variable for the number of memory addresses in the call stack
-    TInt addrCount( 0 );    
-    TUint32 callStackAddr( 0 );
-
-    // Read the first word of the buffer. This includes the number of
-    // memory addresses stored in the current stackBuf
-    stackBuf->Read( pos, &addrCount, KWordSize );
-
-    // Move the position one word onwards.
-    pos += KWordSize;
-    
-    // Create a 16-bit buffer, and a pointer descriptor for it
-    HBufC* traceBuf = HBufC::NewL( KMemFreedBufLength );
-    TPtr tracePtr( traceBuf->Des() );
-    
-    // Pop stackBuf from CleanupStack, since no leavable operations will be done
-    // anymore
-    CleanupStack::Pop( stackBuf );
-    
-	// Get the current universal time		
-	TInt64 timeFrom1970( GetTime() );
-			
-    // Memory deallocation header message.
-    // FREEH <Memory address> <Time stamp> <Call stack address count> <Call stack address>
-    // <Call stack address> ...
-
-    // Append the tag implying a memory free line in the data file
-    tracePtr.Append( KMemoryFreedHeader );
-    
-    // Append the start address of this allocation in the 32-bit (max 8 characters)
-    // hexadecimal text format.
-    tracePtr.AppendNum( memAddress, EHex );    
-    
-	// Append the current time in the 64-bit (max 16 characters) hexadecimal text
-	// format
-	tracePtr.Append( KSpaceTrace );
-	tracePtr.AppendNum( timeFrom1970, EHex );
-			
-    // Append call stack address count
-    tracePtr.Append( KSpaceTrace );
-    tracePtr.AppendNum( addrCount, EHex );
-    
-    // Packet number
-    TUint packetNumber( 1 );
-    
-    // Calculate last item length
-    TInt lastItemLength( KTraceMessage().Length() + KHexa32Length + 
-            KSpaceLength + KNewlineLength );
-    
-    // Go through all call stack's memory addresses associated with
-    // this memory allocation 
-    for ( TInt j = 0; j < addrCount; j++ )
-        {
-        if ( tracePtr.Length() <= 0 )
-            {
-            // Memory deallocation fragment message.
-            // FREEF <Memory address> <Time stamp> <Packet number> <Call stack address count>
-            // <Call stack address>...
-            // Create free fragment message header
-            tracePtr.Append( KMemoryFreedFragment );
-            tracePtr.AppendNum( memAddress, EHex );
-            tracePtr.Append( KSpaceTrace );    
-			tracePtr.AppendNum( timeFrom1970, EHex );
-			tracePtr.Append( KSpaceTrace );	
-            tracePtr.AppendNum( packetNumber, EHex );
-            // Increase packet number
-            packetNumber++;
-            }
-        
-        // Read the next call stack's memory address stored in the buffer.
-        stackBuf->Read( pos, &callStackAddr, KWordSize );
-        
-        // Append the read memory address as a hexadecimal number
-        tracePtr.AppendFormat( KHexaNumberTrace, callStackAddr );
-        
-        // Move the pos variable one word onwards.
-        pos += KWordSize;
-        
-        // Check if buffer max length exceed
-        if ( lastItemLength + tracePtr.Length() >= KMemFreedBufLength )
-            {
-            tracePtr.Append( KNewLineTrace );
-            // Log through debug channel 
-            RDebug::Print( KTraceMessage, iProcessId, traceBuf );
-            // Empty trace buffer
-            tracePtr.Delete( 0, tracePtr.MaxLength() );
-            }
-        }
-    
-    // Send the last message if exists
-    if ( tracePtr.Length() > 0 )
-        {
-        tracePtr.Append( KNewLineTrace );
-        
-        // Log through debug channel 
-        RDebug::Print( KTraceMessage, iProcessId, traceBuf );
-        }
-        
-    delete traceBuf;
-    delete stackBuf;
-    // If we are here, everything has gone alright
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogProcessEndedL()
-// Prints memory leaks and information on process end into a file opened by the
-// function LogProcessStartedL()
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::LogProcessEndedL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogProcessEndedL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    iError = KErrNone;
-    
-    // Read the sent process ID
-    TUint processId = aMessage.Int0();
- 
-    // The process ID got from the client should equal iProcessId.
-    // If it does not, return KErrNotSupported
-    if ( processId != iProcessId )
-        {
-        return KErrNotSupported;
-        }
-    
-    //////////////////////////////////////////////
-    // Log memory leaks
-    //////////////////////////////////////////////  
-    
-    // Print the information on the memory allocations that were never freed
-    iError = PrintLeaksL( aMessage );
-    
-    if ( iError != KErrNone )
-        {
-        return iError;
-        }    
-    
-    //////////////////////////////////////////////
-    // Log handle leaks
-    ////////////////////////////////////////////// 
-
-    TUint handleLeakCount = aMessage.Int1();
-    
-    if( handleLeakCount == 0 )
-        {
-        LOGSTR1( "STSE TInt CATStorageServerSession::LogProcessEndedL() No handle leaks to report" );
-        }
-    else
-        {
-        // Make a buffer that will be logged
-        TBuf8<KHandleLeakBufLength> loggingBuf;
-        
-        // Set handle leak module name to unknown since it can not be defined.
-        // Write the handle leak count from aMessage.
-        loggingBuf.Format( KHandleLeak, &KUnknownModule, handleLeakCount );
-    
-        // Write the constructed string into the data file and return if error
-        iError = iFile.Write( loggingBuf );
-    
-        if ( iError != KErrNone )
-            {
-            return iError;
-            }
-        }
-    
-    //////////////////////////////////////////////
-    // Log process end
-    //////////////////////////////////////////////
-           
-    // Make a buffer that will be logged into the opened logging file
-    TBufC8<KProcessEndBufLength> processEndBuf;
-    
-    TPtr8 bufPtr = processEndBuf.Des();
-    
-    bufPtr.AppendFormat( KProcessEnd, iProcessId );
-    
-    // Get the current universal time       
-    TInt64 timeFrom1970( GetTime() );
-    
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format         
-    bufPtr.AppendNum( timeFrom1970, EHex );
-    
-    // Append a new line
-    bufPtr.Append( KNewLine );
-    
-    // Write the buffer into a file and return the error code   
-    iError = iFile.Write( processEndBuf );
-    
-    // Close the file and the handle to the file server
-    CloseFsAndFile();
-    
-    // Remove the process from the server's array of processes
-    iError = iStorageServer.RemoveProcessL( processId );
-    
-    // Reset iProcesssId and set the logging flag false
-    iProcessId = KNullProcessId;
-    iLoggingOngoing = EFalse;
-    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogProcessEndTraceL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::LogProcessEndTraceL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogProcessEndTraceL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    iError = KErrNone;
-    
-    // Read the sent process ID
-    TUint processId = aMessage.Int0();
- 
-    // The process ID got from the client should equal iProcessId.
-    // If it does not, return KErrNotSupported
-    if ( processId != iProcessId )
-        {
-        return KErrNotSupported;
-        }
-    
-    //////////////////////////////////////////////
-    // Log handle leaks
-    ////////////////////////////////////////////// 
-
-    TUint handleLeakCount = aMessage.Int1();
-
-    if( handleLeakCount == 0 )
-        {
-        LOGSTR1( "STSE TInt CATStorageServerSession::LogProcessEndTraceL() No handle leaks to report" );
-        }
-    else
-        {
-        // Make a buffer that will be logged
-        TBuf8<KHandleLeakBufLength> loggingBuf;
-        
-        // Make a 16-bit buffer that can be logged using RDebug
-        TBuf<KHandleLeakBufLength> traceBuf;
-        
-        // Set handle leak module name to unknown since it can not be defined.
-        // Write the handle leak count from aMessage.
-        loggingBuf.Format( KHandleLeak, &KUnknownModule, handleLeakCount );
-        
-        traceBuf.Copy( loggingBuf );
-    
-        // Log through debug channel 
-        RDebug::Print( KTraceMessage, iProcessId , &traceBuf );
-        }
-
-    //////////////////////////////////////////////
-    // Log process end
-    //////////////////////////////////////////////
-    
-    // Make a buffer that will be logged
-    TBuf<KProcessEndBufLength> processEndBuf;    
-    processEndBuf.AppendFormat( KProcessEndTrace, iProcessId );
-    
-    // Get the current universal time
-    TInt64 timeFrom1970( GetTime() );
-    
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    processEndBuf.AppendNum( timeFrom1970, EHex );
-    
-    // Append a new line
-    processEndBuf.Append( KNewLineTrace );
-    
-    // Log through debug channel
-    RDebug::Print( KTraceMessage, iProcessId, &processEndBuf );
-
-    // Remove the process from the server's array of processes
-    iError = iStorageServer.RemoveProcessL( iProcessId );
-
-    // Reset iProcesssId and set the logging flag false
-    iProcessId = KNullProcessId;
-    iLoggingOngoing = EFalse;
-    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::CheckMemoryAddressL()
-// Checks if given memory address can be found
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::CheckMemoryAddressL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::CheckMemoryAddressL()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    iError = KErrNone;
-    
-    // Check if memory address can be found in iLeakArray
-    TUint32 memAddress = aMessage.Int0();
-    TIdentityRelation<CATMemoryEntry> matcher( CATMemoryEntry::Match );
-    CATMemoryEntry* entry = new (ELeave) CATMemoryEntry( memAddress, NULL, 0, 0 );
-    
-    // Get the index or an error code
-    iError = iLeakArray.Find( entry, matcher );
-    delete entry;
-    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::CheckMemoryAddressTrace()
-// Checks if some memory address can be found
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::CheckMemoryAddressTrace( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::CheckMemoryAddressTrace()" );
-    
-    // Panic the client and return, if a logging session is not ongoing
-    // ( can be started by calling the client's LogProcessStarted() )
-    if ( !iLoggingOngoing )
-        {
-        PanicClient( EAToolNotAllowed, aMessage );
-        return KErrCancel;
-        }
-    
-    // Always return KErrNone in this mode
-    return KErrNone;
-    }
- 
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::GetProcessesL()
-// Checks if some memory address can be found
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::GetProcessesL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::GetProcessesL()" );
-    
-    iError = KErrNone;
-    
-    TInt processInfoSize = sizeof( TATProcessInfo );
-    
-    CBufFlat* processInfoBuf;
-    
-    // Buffer position
-    TInt pos( 0 );
-    
-    // Calculate the length of the buffer to be constructed for processes
-    // One word will be reserved for the length of the array.
-    TInt bufferLength = KWordSize + KATMaxProcesses * processInfoSize;
-    
-    // Construct processInfoBuf and expand it before the beginning (index 0)
-    processInfoBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( processInfoBuf );
-    processInfoBuf->ExpandL( pos, bufferLength );
-    
-    RArray<TATProcessInfo> processArray = iStorageServer.ProcessInfoArray();
-
-    // Variable for the number of TATProcessInfo objects in processArray
-    TInt count = processArray.Count();
-    
-    // The count cannot be greater than KATMaxProcesses, because the client
-    // has reserved a buffer of this size to be filled by the server
-    if ( count > KATMaxProcesses )
-        {
-        count = KATMaxProcesses;
-        }
-
-    // Write the count (4 bytes) into the beginning of processInfoBuf
-    processInfoBuf->Write( pos, &count, KWordSize );
-    
-    // Move the position one word onwards.    
-    pos += KWordSize;
-    
-    // Write all the process info objects into the buffer 
-    for ( TInt i = 0; i < count; i++ )
-        {
-        TATProcessInfo& processInfo = processArray[i];
-        
-        // Write the current process info into the buffer
-        processInfoBuf->Write( pos, &processInfo, processInfoSize );
-        
-        // Move the pos variable onwards.
-        pos += processInfoSize;
-        }
-    
-    // Make a pointer descriptor pointing to the start of processInfoBuf
-    TPtr8 bufPtr( processInfoBuf->Ptr(0) );
-    
-    // Write the buffer into aMessage at index 0 for the client
-    aMessage.WriteL( 0, bufPtr );
-    
-    CleanupStack::PopAndDestroy( processInfoBuf );
-    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::GetDllsL()
-// Checks if some memory address can be found
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::GetDllsL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::GetDllsL()" );
-    
-    // Read the process ID at index 0
-    TUint processId = aMessage.Int0();
-    
-    // Size of a DLL descriptor
-    TInt sizeOfDllDesc = sizeof( TBuf8<KMaxLibraryName> );
-    
-    // Buffer position
-    TInt pos( 0 );
-    
-    // Calculate the length of the buffer to be constructed for DLL names.
-    // One word will be reserved for the length of the array.
-    TInt bufferLength = KWordSize + KATMaxDlls * sizeOfDllDesc;
-    
-    CBufFlat* dllBuf;
-    // Construct dllBuf and expand it before the beginning (index 0)
-    dllBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( dllBuf );
-    dllBuf->ExpandL( pos, bufferLength );
-
-    RPointerArray<CATDynProcessInfo> dynProcessArray =
-                                             iStorageServer.DynProcessInfoArray();
-    
-    // Construct a CATDynProcessInfo object with the given process ID for searching
-    CATDynProcessInfo* dynProcessInfo = new (ELeave) CATDynProcessInfo( processId );
-    
-    // Find the index of a CATDynProcessInfo object with the given process ID
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = dynProcessArray.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-    
-    // Return, if a process with the requested process ID was not found 
-    if ( index == KErrNotFound )
-        {
-        CleanupStack::PopAndDestroy( dllBuf );
-        return index;
-        }
-    
-    // Get the wanted dynamic process info 
-    dynProcessInfo = dynProcessArray[index];
- 
-    // Fetch a reference to the desired DLL array
-    RArray<TATDllInfo>& dllArray = dynProcessInfo->iDlls;
-    
-    // Take the count of names in the array 
-    TInt count = dllArray.Count();
-
-    // The count cannot be greater than KATMaxDlls, because the client
-    // has reserved a buffer of this size to be filled by the server
-    if ( count > KATMaxDlls )
-        {
-        count = KATMaxDlls;
-        }
-
-    // Write the count (4 bytes) into the beginning of dllBuf
-    dllBuf->Write( pos, &count, KWordSize );
-    
-    // Move the position one word onwards.
-    pos += KWordSize;
-
-    // Go through all DLL names objects sent to the server 
-    for ( TInt i = 0; i < count; i++ )
-        {
-        TBuf8<KMaxLibraryName>& dllName = dllArray[i].iName;
-        
-        // Write the current DLL name into the buffer
-        dllBuf->Write( pos, &dllName, sizeOfDllDesc );
-        
-        // Move the pos variable onwards.
-        pos += sizeOfDllDesc;
-        }  
-    
-    // Make a pointer descriptor pointing to the start of dllBuf
-    TPtr8 bufPtr( dllBuf->Ptr(0) );
-    
-    // Write the whole buffer into aMessage at index 1 for the client
-    aMessage.WriteL( 1, bufPtr );
-    
-    CleanupStack::PopAndDestroy( dllBuf );
-
-    // The dynProcessInfo object will not be deleted, because it is still owned by the
-    // server object's dynamic process info array.  
-    dynProcessInfo = NULL;
-    
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::GetLoggingModeL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::GetLoggingModeL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::GetLoggingModeL()" );
-    
-    iError = KErrNone;
-    
-    // Read the process ID at index 0
-    TUint processId = aMessage.Int0();
-    
-    // Buffer position
-    TInt pos( 0 );
-    
-    // The length of the buffer to be constructed for logging mode
-    TInt bufferLength = KWordSize;
-    
-    // Get the dynamic process info array
-    RPointerArray<CATDynProcessInfo> dynProcessArray =
-                                             iStorageServer.DynProcessInfoArray();
-    
-    // Construct a CATDynProcessInfo object with the given process ID for searching
-    CATDynProcessInfo* dynProcessInfo = new (ELeave) CATDynProcessInfo( processId );
-    
-    // Find the index of a CATDynProcessInfo object with the given process ID
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = dynProcessArray.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-    
-    // Return, if a process with the requested process ID was not found 
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-    
-    // Otherwise get the wanted dynamic process info
-    dynProcessInfo = dynProcessArray[index];
-
-    // Get the desired process's associated session object
-    CATStorageServerSession* sessionObject = dynProcessInfo->iSessionObject;
-    CBufFlat* loggingModeBuf;
-    // Construct allocInfoBuf and expand it before the beginning (index 0)
-    loggingModeBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( loggingModeBuf );
-    loggingModeBuf->ExpandL( 0, bufferLength );
-    
-    // Write the current logging mode of the requested process into the buffer.
-    loggingModeBuf->Write( pos, &sessionObject->iLogOption, KWordSize );
-    
-    // Make a pointer descriptor that points to the data of allocInfoBuf
-    TPtr8 bufPtr( loggingModeBuf->Ptr(0) );
-    
-    // Write the whole buffer into aMessage at index 1 for the client
-    aMessage.WriteL( 1, bufPtr );
-    
-    CleanupStack::PopAndDestroy( loggingModeBuf );
-    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::StartSubtestL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::StartSubtestL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::StartSubtestL()" );
-    
-    iError = KErrNone;
-    
-    // Read the process ID at index 0
-    TUint processId = aMessage.Int0();
-    
-    // Read the sub test ID at index 1
-    TBuf8<KATMaxSubtestIdLength> subTestName;
-    iError = aMessage.Read( 1, subTestName );
-    
-    // Return if reading was not successful
-    if ( iError != KErrNone )
-        {
-        return iError;
-        }
-    
-    // Create another (non-8-bit) descriptor for logging to trace
-    // and copy the contents
-    TBuf<KATMaxSubtestIdLength> subTestNameTrace;
-    subTestNameTrace.Copy( subTestName );
-
-    // Read the handle count at index 2
-    TInt handleCount = aMessage.Int2();
-    
-    // FIND THE REQUESTED PROCESS
-    
-    // Get the dynamic process array
-    RPointerArray<CATDynProcessInfo> dynProcessArray =
-                                             iStorageServer.DynProcessInfoArray();
-    
-    // Construct a CATDynProcessInfo object with the given process ID for searching
-    CATDynProcessInfo* dynProcessInfo = new (ELeave) CATDynProcessInfo( processId );
-    
-    // Find the index of a CATDynProcessInfo object with the given process ID
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = dynProcessArray.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-    
-    // Return, if a process with the requested process ID was not found
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-    
-    // Get the wanted dynamic process info
-    dynProcessInfo = dynProcessArray[index];
-    
-    // Get the desired process's associated session object
-    const CATStorageServerSession* sessionObject = dynProcessInfo->iSessionObject;
-  
-    // Make a buffer for logging thru trace
-    TBuf<KTestStartBufLength> loggingBuf;
-    
-    // Copy the line tag into the buffer  
-    loggingBuf.Copy( KSubtestStart );
-    
-    // Get the current universal time
-    TInt64 timeFrom1970( GetTime() );
-    
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    loggingBuf.AppendNum( timeFrom1970, EHex );
-    
-    // Append a space
-    loggingBuf.Append( KSpaceTrace );
-    
-    // Append the sub test ID
-    loggingBuf.Append( subTestNameTrace );
-
-    // Append a space
-    loggingBuf.Append( KSpaceTrace );
-    
-    // Append current handle leak count
-    loggingBuf.AppendNum( handleCount );
-    
-    // Append a new line
-    loggingBuf.Append( KNewLineTrace );
-    
-    // Log the string through trace
-    iError = sessionObject->LogThroughTrace( loggingBuf );
-        
-    // *******************
-    // Send loaded DLL's
-    // *******************
-    
-    // Fetch a reference to the desired DLL array
-	RArray<TATDllInfo>& dllArray = dynProcessInfo->iDlls;
-	
-	// Take the count of dll info items
-	TInt count( dllArray.Count() );
-	LOGSTR2( "STSE > dllArray.Count( %i )", count );
-	
-	// Create buffers
-	TBuf<KDllLoadBufLength> traceBuf;
-	TBuf8<KDllLoadBufLength> dllBuf;
-	
-	for ( TInt x = 0; x < count; x++ )
-		{
-		dllBuf.Format( KDllLoad, &dllArray[x].iName, dllArray[x].iLoadTime,
-				dllArray[x].iStartAddress, dllArray[x].iEndAddress );
-		traceBuf.Copy( dllBuf );
-		
-		// Log the string through trace
-		iError = sessionObject->LogThroughTrace( traceBuf );
-		if ( iError != KErrNone )
-			{
-			LOGSTR2( "STSE > LogThroughTrace() err( %i )", iError );
-			}
-		}
-    sessionObject = NULL;
-    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::StopSubtestL()
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::StopSubtestL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::StopSubtestL()" );
-    
-    iError = KErrNone;
-    
-    // Read the process ID at index 0
-    TUint processId = aMessage.Int0();
-    
-    // Read the sub test ID at index 1
-    TBuf8<KATMaxSubtestIdLength> subTestName;
-    iError = aMessage.Read( 1, subTestName );
-    
-    // Return if reading was not successful
-    if ( iError != KErrNone )
-        {
-        return iError;
-        }
-
-    // Create another (non-8-bit) descriptor for logging to trace,
-    // and copy the contents
-    TBuf<KATMaxSubtestIdLength> subTestNameTrace;
-    subTestNameTrace.Copy( subTestName );
-
-    // Read the handle count at index 2
-    TInt handleCount = aMessage.Int2();
-    
-    // FIND THE REQUESTED PROCESS
-    
-    // Get the dynamic process array
-    RPointerArray<CATDynProcessInfo> dynProcessArray =
-                                             iStorageServer.DynProcessInfoArray();
-    
-    // Construct a CATDynProcessInfo object with the given process ID for searching
-    CATDynProcessInfo* dynProcessInfo = new (ELeave) CATDynProcessInfo( processId );
-    
-    // Find the index of a CATDynProcessInfo object with the given process ID
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = dynProcessArray.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-    
-    // Return, if a process with the requested process ID was not found
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-    
-    // Get the wanted dynamic process info
-    dynProcessInfo = dynProcessArray[index];
-    
-    // Get the desired process's associated session object
-    const CATStorageServerSession* sessionObject = dynProcessInfo->iSessionObject;
-  
-    // Make a buffer for logging thru trace
-    TBuf<KTestEndBufLength> loggingBuf;
-    
-    // Copy the line tag into the buffer  
-    loggingBuf.Copy( KSubtestEnd );
-    
-    // Get the current universal time
-    TInt64 timeFrom1970( GetTime() );
-    
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    loggingBuf.AppendNum( timeFrom1970, EHex );
-    
-    // Append a space
-    loggingBuf.Append( KSpaceTrace );
-    
-    // Append the sub test ID
-    loggingBuf.Append( subTestNameTrace );
-
-    // Append a space
-    loggingBuf.Append( KSpaceTrace );
-    
-    // Append current handle leak count
-    loggingBuf.AppendNum( handleCount );
-    
-    // Append a new line
-    loggingBuf.Append( KNewLineTrace );
-    
-    // Log the string through trace
-    iError = sessionObject->LogThroughTrace( loggingBuf );
-    
-    sessionObject = NULL;
-    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::StartSubtest2L()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::StartSubtest2L( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::StartSubtest2L()" );
-    
-    iError = KErrNone;
-    
-    // Read the sub test ID at index 0
-    TBuf8<KATMaxSubtestIdLength> subTestName;
-    iError = aMessage.Read( 0, subTestName );
-    
-    // Return if reading was not successful
-    if ( iError != KErrNone )
-        {
-        return iError;
-        }
-    
-    // Create another (non-8-bit) descriptor for logging to trace
-    // and copy the contents
-    TBuf<KATMaxSubtestIdLength> subTestNameTrace;
-    subTestNameTrace.Copy( subTestName );
-
-    // Make a buffer for logging thru trace
-    TBuf<KTestStartBufLength> loggingBuf;
-    
-    // Copy the line tag into the buffer  
-    loggingBuf.Copy( KSubtestStart );
-    
-    // Get the current universal time
-    TInt64 timeFrom1970( GetTime() );
-    
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    loggingBuf.AppendNum( timeFrom1970, EHex );
-    
-    // Append a space
-    loggingBuf.Append( KSpaceTrace );
-    
-    // Append the sub test ID
-    loggingBuf.Append( subTestNameTrace );
-    
-    // Append a new line
-    loggingBuf.Append( KNewLineTrace );
-    
-    // Log the string through trace
-    iError = LogThroughTrace( loggingBuf );
-    
-    // *******************
-	// Send loaded DLL's
-	// *******************
-	
-    // Get the dynamic process array
-	RPointerArray<CATDynProcessInfo> dynProcessArray =
-		iStorageServer.DynProcessInfoArray();
-	
-	// Construct a CATDynProcessInfo object with the given process ID for searching
-	CATDynProcessInfo* dynProcessInfo = new (ELeave) CATDynProcessInfo( iProcessId );
-	
-	// Find the index of a CATDynProcessInfo object with the given process ID
-	TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-	TInt index = dynProcessArray.FindInOrder( dynProcessInfo, order );
-	delete dynProcessInfo;
-	dynProcessInfo = NULL;
-	 
-	// Return, if a process with the requested process ID was not found
-	if ( index == KErrNotFound )
-		{
-		return index;
-		}
-	
-	// Get the wanted dynamic process info
-	dynProcessInfo = dynProcessArray[index];
-        
-	// Fetch a reference to the desired DLL array
-	RArray<TATDllInfo>& dllArray = dynProcessInfo->iDlls;
-	
-	// Take the count of dll info items
-	TInt count( dllArray.Count() );
-	LOGSTR2( "STSE > dllArray.Count( %i )", count );
-	
-	// Create buffers
-	TBuf<KDllLoadBufLength> traceBuf;
-	TBuf8<KDllLoadBufLength> dllBuf;
-	
-	for ( TInt x = 0; x < count; x++ )
-		{
-		dllBuf.Format( KDllLoad, &dllArray[x].iName, dllArray[x].iLoadTime,
-				dllArray[x].iStartAddress, dllArray[x].iEndAddress );
-		traceBuf.Copy( dllBuf );
-		
-		// Log the string through trace
-		iError = LogThroughTrace( traceBuf );
-		if ( iError != KErrNone )
-			{
-			LOGSTR2( "STSE > LogThroughTrace() err( %i )", iError );
-			}
-		}
-    	
-    return iError;
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::StopSubtest2()
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::StopSubtest2( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::StopSubtest2()" );
-    
-    iError = KErrNone;
-    
-    // Read the sub test ID at index 0
-    TBuf8<KATMaxSubtestIdLength> subTestName;
-    iError = aMessage.Read( 0, subTestName );
-    
-    // Return if reading was not successful
-    if ( iError != KErrNone )
-        {
-        return iError;
-        }
-
-    // Create another (non-8-bit) descriptor for logging to trace,
-    // and copy the contents
-    TBuf<KATMaxSubtestIdLength> subTestNameTrace;
-    subTestNameTrace.Copy( subTestName );
-
-    // Make a buffer for logging thru trace
-    TBuf<KTestEndBufLength> loggingBuf;
-    
-    // Copy the line tag into the buffer  
-    loggingBuf.Copy( KSubtestEnd );
-    
-    // Get the current universal time    
-    TInt64 timeFrom1970( GetTime() );
-    
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    loggingBuf.AppendNum( timeFrom1970, EHex );
-    
-    // Append a space
-    loggingBuf.Append( KSpaceTrace );
-    
-    // Append the sub test ID
-    loggingBuf.Append( subTestNameTrace );
-    
-    // Append a new line
-    loggingBuf.Append( KNewLineTrace );
-    
-    // Log the string through trace
-    iError = LogThroughTrace( loggingBuf );
-    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::GetCurrentAllocsL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::GetCurrentAllocsL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::GetCurrentAllocsL()" );
-    
-    iError = KErrNone;
-    
-    // Read the process ID at index 0
-    TUint processId = aMessage.Int0();
-    TUint32 allocNumber( 0 );
-    TUint32 allocSize( 0 );
-    
-    // Buffer position
-    TInt pos( 0 );
-    
-    // The length of the buffer to be constructed for allocation number and size
-    TInt bufferLength = KWordSize + KWordSize;
-    
-    // Get the dynamic process info array
-    RPointerArray<CATDynProcessInfo> dynProcessArray =
-                                             iStorageServer.DynProcessInfoArray();
-    
-    // Construct a CATDynProcessInfo object with the given process ID for searching
-    CATDynProcessInfo* dynProcessInfo = new (ELeave) CATDynProcessInfo( processId );
-    
-    // Find the index of a CATDynProcessInfo object with the given process ID
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = dynProcessArray.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-    
-    // Return, if a process with the requested process ID was not found
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-    
-    // Otherwise get the wanted dynamic process info
-    dynProcessInfo = dynProcessArray[index];
-
-    // Get the desired process's associated session object
-    CATStorageServerSession* sessionObject = dynProcessInfo->iSessionObject;
-    
-    // Get the alloc info array of that session object
-    RArray<TAllocInfo> allocInfo = sessionObject->AllocInfoArray();
-    
-    // Get the values for current allocations number and size
-    allocNumber = allocInfo.Count();
-    
-    // Calculate the total size of the current allocations
-    for ( TUint32 i = 0; i < allocNumber; i++ )
-        {
-        allocSize += allocInfo[i].iAllocSize;
-        }
-    
-    LOGSTR2( "STSE allocSize: %u", allocSize );
-    LOGSTR2( "STSE iCurAllocSize: %u", iCurAllocSize );
-    
-    CBufFlat* allocInfoBuf;
-    // Construct allocInfoBuf and expand it before the beginning (index 0)
-    allocInfoBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( allocInfoBuf );
-    allocInfoBuf->ExpandL( 0, bufferLength );
-    
-    // Write the current number of allocations of the requested process into the buffer.
-    allocInfoBuf->Write( pos, &allocNumber, KWordSize );
-    
-    // Move the position one word onwards
-    pos += KWordSize;
-    
-    // Write the current total size of the allocations of the requested process into the
-    // buffer.
-    allocInfoBuf->Write( pos, &allocSize, KWordSize );
-    
-    // Make a pointer descriptor that points to the data of allocInfoBuf
-    TPtr8 bufPtr( allocInfoBuf->Ptr(0) );
-    
-    // Write the whole buffer into aMessage at index 1 for the client
-    aMessage.WriteL( 1, bufPtr );
-    
-    CleanupStack::PopAndDestroy( allocInfoBuf );
-                    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::GetMaxAllocsL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::GetMaxAllocsL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::GetMaxAllocsL()" );
-    
-    iError = KErrNone;
-    
-    // Read the process ID at index 0
-    TUint processId = aMessage.Int0();
-    TUint32 allocNumber( 0 );
-    TUint32 allocSize( 0 );
-    
-    // Buffer position
-    TInt pos( 0 );
-    
-    // The length of the buffer to be constructed for allocation number and size
-    TInt bufferLength = KWordSize + KWordSize;
-    
-    // Get the dynamic process info array
-    RPointerArray<CATDynProcessInfo> dynProcessArray =
-                                             iStorageServer.DynProcessInfoArray();
-    
-    // Construct a CATDynProcessInfo object with the given process ID for searching
-    CATDynProcessInfo* dynProcessInfo = new (ELeave) CATDynProcessInfo( processId );
-    
-    // Find the index of a CATDynProcessInfo object with the given process ID
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = dynProcessArray.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-    
-    // Return, if a process with the requested process ID was not found 
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-    
-    // Otherwise get the wanted dynamic process info 
-    dynProcessInfo = dynProcessArray[index];
-
-    // Get the desired process's associated session object
-    CATStorageServerSession* sessionObject = dynProcessInfo->iSessionObject;
-    
-    // Get values for the maximum allocations number and size
-    allocNumber = sessionObject->iMaxAllocs;
-    allocSize = sessionObject->iMaxAllocSize;
-    
-    CBufFlat* allocInfoBuf;
-    // Construct allocInfoBuf and expand it before the beginning (index 0)
-    allocInfoBuf = CBufFlat::NewL( bufferLength );
-    CleanupStack::PushL( allocInfoBuf );
-    allocInfoBuf->ExpandL( 0, bufferLength );
-    
-    // Write the maximum number of allocations of the requested process into the buffer.
-    allocInfoBuf->Write( pos, &allocNumber, KWordSize );
-    
-    // Move the position one word onwards
-    pos += KWordSize;
-    
-    // Write the maximum total size of the allocations of the requested process into the
-    // buffer.
-    allocInfoBuf->Write( pos, &allocSize, KWordSize );
-    
-    // Make a pointer descriptor that points to the data of allocInfoBuf
-    TPtr8 bufPtr( allocInfoBuf->Ptr(0) );
-    
-    // Write the whole buffer into aMessage at index 1 for the client
-    aMessage.WriteL( 1, bufPtr );
-    
-    CleanupStack::PopAndDestroy( allocInfoBuf );
-                    
-    return iError;
-    }
-  
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::CancelLoggingL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::CancelLoggingL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::CancelLoggingL()" );
-    
-    iError = KErrNone;
-    
-    // Read the process ID at index 0
-    TUint processId = aMessage.Int0();
-        
-    // FIND THE REQUESTED PROCESS
-    
-    // Get the dynamic process array
-    RPointerArray<CATDynProcessInfo> dynProcessArray =
-                                             iStorageServer.DynProcessInfoArray();
-    
-    // Construct a CATDynProcessInfo object with the given process ID for searching
-    CATDynProcessInfo* dynProcessInfo = new (ELeave) CATDynProcessInfo( processId );
-    
-    // Find the index of a CATDynProcessInfo object with the given process ID
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = dynProcessArray.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-     
-    // Return, if a process with the requested process ID was not found
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-    
-    // Otherwise get the wanted dynamic process info
-    dynProcessInfo = dynProcessArray[index];
-    
-    // Get the session object of the requested process
-    CATStorageServerSession* sessionObject = dynProcessInfo->iSessionObject;
-      
-    // Get the current universal time
-    TInt64 timeFrom1970( GetTime() );
-    
-    // Make a buffer for logging "logging cancelled"
-    TBuf8<KCancelBufLength> loggingBuf;
-    
-    // Copy the "logging cancelled" tag into the buffer with the current time 
-    loggingBuf.AppendFormat( KLoggingCancelled, timeFrom1970 );
-    
-    // Log the buffer eather to a file or to debug channel depending on the current
-    // logging mode
-    
-    if ( sessionObject->iLoggingOngoing && 
-         sessionObject->iLogOption == EATLogToFile )
-        {
-        // Write the buffer into the file  
-        sessionObject->iFile.Write( loggingBuf );
-        }
-    
-    else if ( sessionObject->iLoggingOngoing &&
-              sessionObject->iLogOption == EATLogToTrace )
-        {
-        // Make a buffer for logging to trace
-        TBuf<KCancelBufLength> traceBuf;
-        traceBuf.Copy( loggingBuf );
-        
-        // Write the buffer into the debug channel
-        RDebug::Print( KTraceMessage, processId ,&traceBuf );
-        }
-    
-    // Switch off logging of the requested process 
-    sessionObject->iLogOption = EATLoggingOff;
-    
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::HandleError
-// Internally used for handling error situations.
-// -----------------------------------------------------------------------------
-// 
-void CATStorageServerSession::HandleError( TInt aError )
-    {
-    LOGSTR1( "STSE void CATStorageServerSession::HandleError()" );
-      
-    // Get the current universal time
-    TInt64 timeFrom1970( GetTime() );
-        
-    // Make a buffer that will be logged into the opened logging file
-    TBufC8<KErrOccuredBufLength> loggingBuf;
-    
-    TPtr8 bufPtr( loggingBuf.Des() );
-     
-    // Write the error code to the buffer  
-    bufPtr.Format( KErrorOccured, aError );
-       
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    bufPtr.AppendNum( timeFrom1970, EHex );
-    
-    // Append a new line
-    bufPtr.Append( KNewLine );
-            
-    // Write the buffer into a file (if possible in the current condition)
-    iFile.Write( loggingBuf );
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::HandleErrorTrace()
-// Internally used for handling error situations.
-// -----------------------------------------------------------------------------
-//    
-void CATStorageServerSession::HandleErrorTrace( TInt aError )
-    {
-    LOGSTR1( "STSE void CATStorageServerSession::HandleErrorTrace()" );
-    
-     // Get the current universal time
-    TInt64 timeFrom1970( GetTime() );
-        
-    // Make a buffer that will be logged
-    TBuf<KErrOccuredBufLength> traceBuf;
-     
-    // Write the error code to the buffer  
-    traceBuf.Format( KErrorOccuredTrace, aError );
-       
-    // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-    // format
-    traceBuf.AppendNum( timeFrom1970, EHex );
-    
-    // Append a new line
-    traceBuf.Append( KNewLineTrace );
-                 
-    RDebug::Print( KTraceMessage, iProcessId , &traceBuf );
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::OpenFsAndFile
-// Internally used for opening a handle to the file server and a file
-// -----------------------------------------------------------------------------
-// 
-TInt CATStorageServerSession::OpenFsAndFile( const TDesC& aFileName, 
-    const TDesC8& aProcessName )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::OpenFsAndFile()" );
-    
-    // Connect file server, return if error occured
-    iError = iFileServer.Connect();
-    if ( iError )
-        {
-        iFileServer.Close();
-        return iError;
-        }
-
-    // Open a file
-    TBuf<KMaxFileName> fileNameBuf;    
-    iError = TATDriveInfo::CreatePath( fileNameBuf, aFileName, iFileServer );
-                        
-    // Return, if an error occured, and it
-    // is not KErrAlreadyExists
-    if ( iError && iError != KErrAlreadyExists )
-        {
-        iFileServer.Close();
-        return iError;
-        }
-    
-    // Save the file name for this session
-    CnvUtfConverter::ConvertFromUnicodeToUtf8( iLogFile, fileNameBuf );
-        
-    // Try to open file
-    CheckIfFileAlreadyExist( fileNameBuf );
-    
-    // If a data file with the requested name already existed, and was opened
-    // successfully, check the version of the file. If the line telling the version of
-    // the file is not the expected, replace the file
-    // If cannot open the file(error is KErrInUse), generate new filename and 
-    // then try to create new file.
-    if ( iError == KErrNone )
-        {
-        CheckFileVersion( fileNameBuf );
-        }    
-    else if ( iError == KErrInUse )
-        {
-        GenerateNewFileName( fileNameBuf, aProcessName );
-        
-        // Save the file name for this session
-        CnvUtfConverter::ConvertFromUnicodeToUtf8( iLogFile, fileNameBuf );
-        }
-    LOGSTR2( "STSE > iError(%i)", iError );
-        
-    // If the file does not exist, create it. Write also the version number of
-    // the file at the beginning of the new file
-    if ( iError == KErrNotFound )
-        {
-        iError = iFile.Create( iFileServer, fileNameBuf, EFileWrite );
-        
-        if ( !iError )
-            {
-            iError = iFile.Write( KDataFileVersion );
-            }
-        }   
-       
-    if ( iError )
-        {
-        iFile.Close();
-        iFileServer.Close();
-        return iError;
-        }
-        
-    // Seek the end of the file and set the current file position there
-    TInt offset = 0;
-    iError = iFile.Seek( ESeekEnd, offset );
-    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::GenerateNewFileName
-// Called internally when need generate new file name.
-// -----------------------------------------------------------------------------
-//                     
-void CATStorageServerSession::GenerateNewFileName( TDes& aFileName,
-    const TDesC8& aProcessName )
-    {    
-    LOGSTR1( "STSE void CATStorageServerSession::GenerateNewFileName()" );
-        
-    // Extension
-    TBuf<KExtensionLength> extension;
-
-    // Parse file extension
-    ParseExtension( aFileName, extension );
-
-    // Try to find UID3 from current process name
-    TInt uidErr( KErrBadName );
-    TBuf<KMaxFileName> unicodeFile;
-
-    // Converts text encoded using the Unicode transformation format UTF-8 
-    // into the Unicode UCS-2 character set. 
-    CnvUtfConverter::ConvertToUnicodeFromUtf8( unicodeFile, aProcessName );
-    LOGSTR2( "STSE > unicodeFile(%S)", &unicodeFile );
-
-    // Find square brackets
-    TInt sPos( unicodeFile.Find( KOpenSquareBracket ) );
-    TInt ePos( unicodeFile.Find( KCloseSquareBracket ) );
-    LOGSTR3( "STSE > sPos(%i), ePos(%i)", sPos, ePos );
-            
-    if ( sPos != KErrNotFound && ePos != KErrNotFound )
-        {
-        TBuf<KProcessUidLength> processUid;
-        TInt pEnd( ePos - sPos - KOpenSquareBracket().Length() );
-        LOGSTR2( "STSE > pEnd(%i)", pEnd );
-        
-        // Copy UID value
-        if ( pEnd > 0 )
-            {
-            processUid.Copy( unicodeFile.Mid( 
-                    sPos + KOpenSquareBracket().Length(), pEnd ) );
-            LOGSTR2( "STSE > processUid(%S)", &processUid );
-            }
-        
-        if ( aFileName.Find( processUid ) == KErrNotFound )
-            {
-            // UID not exist, create new filename
-            // Append uid to filename (<file name>_<uid>.<extension>)
-            aFileName.Append( KUnderLine );
-            aFileName.Append( processUid );
-            aFileName.Append( extension );
-            // Try to open file
-            CheckIfFileAlreadyExist( aFileName );
-
-            if ( iError == KErrNone )
-                {
-                uidErr = KErrNone;
-                CheckFileVersion( aFileName );
-                }
-            }
-        }
-
-    if ( uidErr == KErrBadName && iError != KErrNotFound )
-        {
-        // Need re-create file name, add end off file _xx (xx=01, 02...)
-        LOGSTR2( "STSE > Re-create file name, aFileName(%S)", &aFileName );
-                
-        // Parse file extension if exists.
-        ParseExtension( aFileName, extension );
-        
-        // Temp file name
-        TBuf<KMaxFileName> tempName;
-        
-        for ( TInt i = KNameIndexStart; i < KNameIndexEnd; i++ )
-            {
-            tempName.Delete( 0, tempName.MaxLength() );
-            tempName.Format( KFormat, &aFileName, &KUnderLine, i, &extension );
-            LOGSTR2( "STSE > tempName(%S)", &tempName );
-            // Try to open file
-            CheckIfFileAlreadyExist( tempName );
-            
-            if ( iError == KErrNone || iError == KErrNotFound )
-                {
-                aFileName.Copy( tempName );
-                break;
-                }
-            }
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::ParseExtension
-// Method is used to parse file name extension.
-// -----------------------------------------------------------------------------
-//                     
-void CATStorageServerSession::ParseExtension( 
-    TDes& aFileName, TDes& aExtension )
-    {    
-    LOGSTR2( "STSE void CATStorageServerSession::ParseExtension(%S)", 
-            &aFileName );
-
-    // Parse current file name
-    TParse parse;
-    // Set up the TParse object 
-    parse.Set( aFileName, NULL, NULL );
-
-    // Tests whether an extension is present.
-    if ( parse.ExtPresent() )
-        {
-        // Gets the extension
-        aExtension.Copy( parse.Ext() );
-        // Remove extension from file name
-        TInt pos( aFileName.Find( aExtension ) );
-        aFileName.Delete( pos, aFileName.Length() );
-        LOGSTR3( "STSE > aFileName(%S), aExtension(%S)", 
-                &aFileName, &aExtension );
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::CheckIfFileAlreadyExist
-// Method is used to check that file exists and is valid.
-// -----------------------------------------------------------------------------
-//                     
-void CATStorageServerSession::CheckIfFileAlreadyExist( 
-    const TDes& aFileName )
-    {    
-    LOGSTR2( "STSE void CATStorageServerSession::CheckIfFileAlreadyExist(%S)", 
-            &aFileName );
-    
-    iError = iFile.Open( iFileServer, aFileName, EFileWrite );
-    LOGSTR2( "STSE > iError(%i)", iError );
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::CheckFileVersion
-// Method is used to check file version.
-// -----------------------------------------------------------------------------
-//                     
-void CATStorageServerSession::CheckFileVersion( 
-    const TDes& aFileName )
-    {    
-    LOGSTR2( "STSE void CATStorageServerSession::CheckFileVersion(%S)", 
-            &aFileName );
-
-    TBuf8<KVersionStringLength> versionString;
-
-    // Read version information from the beginning of the file (offset 0)
-    iFile.Read( 0, versionString, KVersionStringLength );
-
-    // Delete the existing file, if the version string read from the file does not
-    // match with KDataFileVersion.
-    if ( versionString.Compare( KDataFileVersion ) != 0 )
-        {
-        // Close the existing, opened file, and delete it
-        iFile.Close();
-        iError = iFileServer.Delete( aFileName );
-        
-        // If the deletion was successful, set iError = KErrNotFound, so a new
-        // file will be created in the next few lines 
-        if ( iError == KErrNone )
-            {
-            iError = KErrNotFound;
-            }
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::CloseFsAndFile
-// Internally used for closing a handle to the file server and a file
-// -----------------------------------------------------------------------------
-// 
-void CATStorageServerSession::CloseFsAndFile()
-    {
-    LOGSTR1( "STSE void CATStorageServerSession::CloseFsAndFile()" );
-    
-    // Close the file    
-    iFile.Close();
-                 
-    // Close the server session and return the error code   
-    iFileServer.Close();
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::PrintLeaksL()
-// Called internally when a process is closed. Prints possible memory leaks
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::PrintLeaksL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::PrintLeaksL()" );
-    
-    // Panic both the client and the server, if this method is called in a wrong
-    // state (logging should be ongoing, and the system should be logging into a file,
-    // not into debug channel)
-    if ( !iLoggingOngoing || iLogOption != EATLogToFile )
-        {
-        PanicClient( EAToolInternalError, aMessage );
-        StorageServerPanic( KCategoryServer, EAToolInternalError );
-        }
-   
-    LOGMEM;
-
-    // A pointer to a buffer of call stack's memory addresses
-    CBufFlat* stackBuf = NULL;
-    
-    iError = KErrNone;
-    
-    TUint32 callStackAddr;
-    
-    // Number of leaks
-    TInt leakCount = iLeakArray.Count();
-    
-    // Variable for the number of memory addresses in the call stack
-    TInt addrCount( 0 );
-    
-    // Buffer position
-    TInt pos( 0 );
-                     
-    // Go through all the leaks 
-    for ( TInt i = 0; i < leakCount; i++ ) 
-        {   
-        pos = 0;
-        
-        // Get the call stack buffer of the the leak i.
-        stackBuf = const_cast<CBufFlat*>( iLeakArray[i]->iCallstackBuf );
-    
-        // Read the first word of the buffer. This includes the number of
-        // memory addresses stored in the current stackBuf
-        stackBuf->Read( pos, &addrCount, KWordSize );
-    
-        // Move the position one word onwards.
-        pos += KWordSize;
-         
-        // Construct a buffer for the string to be written into the logging file
-        // because of this memory leak. MEM_LEAK: <Memory address> <Time stamp>
-        // <Allocation size> <Call stack address> <Call stack address> ...
-        HBufC8* leakString = 
-            HBufC8::NewL( KMemleakLength +
-                          KHexa32Length +
-                          KSpaceLength + KHexa64Length +
-                          KSpaceLength + KHexa32Length +
-                          ( addrCount * (KSpaceLength + KHexa32Length) ) +
-                          KNewlineLength 
-                        );
-            
-        // Make a pointer descriptor that points to leakString
-        TPtr8 leakStringPtr( leakString->Des() );
-        
-        // Append the tag implying a memory leak line in the data file
-        leakStringPtr.Append( KMemoryLeak );
-        
-        // Append the address of the memory leak         
-        TUint32 memAddress = iLeakArray[i]->iMemAddress;
-        leakStringPtr.AppendNum( memAddress, EHex );
-        
-        // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-        // format
-        leakStringPtr.Append( KSpace );
-        TInt64 allocTime = iLeakArray[i]->iAllocTime;
-        leakStringPtr.AppendNum( allocTime, EHex );
-        
-        // Append the size of the allocation in the 32-bit (max 8 characters) hexadecimal
-        // text format.
-        leakStringPtr.Append( KSpace );
-        TInt allocSize = iLeakArray[i]->iAllocSize;
-        leakStringPtr.AppendNum( allocSize, EHex );
-        
-        // Go through all call stack's memory addresses associated with
-        // the current memory leak 
-        for ( TInt j = 0; j < addrCount; j++ )
-            {
-            // Read the next call stack's memory address stored in the buffer.
-            stackBuf->Read( pos, &callStackAddr, KWordSize );
-            
-            // Append the read memory address as a hexadecimal number
-            leakStringPtr.AppendFormat( KHexaNumber,  callStackAddr );
-    
-            // Move the pos variable one word onwards.
-            pos += KWordSize;
-            }
-        
-        leakStringPtr.Append( KNewLine );
-        
-        // Set stackBuf to NULL, because it is not used anymore.
-        stackBuf = NULL;
-        
-        // Write the constructed string into the data file and return if error
-        iError = iFile.Write( *leakString );
-        
-        delete leakString;
-          
-        if ( iError != KErrNone )
-            {
-            return iError;
-            }
-              
-        } // The outer for
-   
-    LOGSTR1( "STSE End of CATStorageServerSession::PrintLeaks()" );
-    LOGMEM;
-   
-    // Empty the leak array and delete the referenced objects
-    iLeakArray.ResetAndDestroy();
-   
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::SetLogOption()
-// For setting the logging mode.
-// -----------------------------------------------------------------------------
-//
-void CATStorageServerSession::SetLogOption( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE void CATStorageServerSession::SetLogOption()" );
-        
-    // Panic both the client and the server, if this method is called in a wrong
-    // state (logging must not be ongoing when changing the mode of operation).
-    // So, the mode cannot be changed "on the fly".
-    if ( iLoggingOngoing )
-        {
-        PanicClient( EAToolInternalError, aMessage );
-        StorageServerPanic( KCategoryServer, EAToolInternalError );
-        }    
-
-    iLogOption = static_cast<TATLogOption>( aMessage.Int3() );
-    
-    // The default is EATLogToFile
-    if ( iLogOption == EATUseDefault )
-        {
-        iLogOption = KDefaultLoggingMode;
-        } 
-    }
-    
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogThroughTrace()
-// -----------------------------------------------------------------------------
-//
-TInt CATStorageServerSession::LogThroughTrace( const TDesC& aLogString ) const
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::LogThroughTrace()" );
-
-    // Return KErrNotSupported, if a logging session is not currently ongoing, or
-    // the logging mode is not EATLogToTrace
-    if ( !iLoggingOngoing || iLogOption != EATLogToTrace)
-        {
-        return KErrNotSupported;
-        }
-        
-    RDebug::Print( KTraceMessage, iProcessId, &aLogString );
-    
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::AllocInfoArray
-// -----------------------------------------------------------------------------
-// 
-RArray<TAllocInfo>& CATStorageServerSession::AllocInfoArray()
-    {
-    LOGSTR1( "STSE RArray<TAllocInfo>& CATStorageServerSession::AllocInfoArray()" );
-     
-    return iAllocInfoArray;
-    }    
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::PanicClient
-// Creates a panic in the associated client's code.
-// -----------------------------------------------------------------------------
-//
-void CATStorageServerSession::PanicClient( TInt aPanic, const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE void CATStorageServerSession::PanicClient()" );
-    
-    aMessage.Panic( KCategoryClient, aPanic );
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::GetLoggingFileL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::GetLoggingFileL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::GetLoggingFileL()" );
-    
-    iError = KErrNone;
-    
-    // Read the process ID at index 0
-    TUint processId = aMessage.Int0();
-    
-    // Get the dynamic process info array
-    RPointerArray<CATDynProcessInfo> dynProcessArray =
-                                             iStorageServer.DynProcessInfoArray();
-    
-    // Construct a CATDynProcessInfo object with the given process ID for searching
-    CATDynProcessInfo* dynProcessInfo = new (ELeave) CATDynProcessInfo( processId );
-    
-    // Find the index of a CATDynProcessInfo object with the given process ID
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = dynProcessArray.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-    
-    // Return, if a process with the requested process ID was not found 
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-    
-    // Otherwise get the wanted dynamic process info
-    dynProcessInfo = dynProcessArray[index];
-
-    // Get the desired process's associated session object
-    CATStorageServerSession* sessionObject = dynProcessInfo->iSessionObject;
-            
-    // Write the whole buffer into aMessage at index 1 for the client
-    aMessage.WriteL( 1, sessionObject->iLogFile );
-                    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::GetUdebL()
-// -----------------------------------------------------------------------------
-//    
-TInt CATStorageServerSession::GetUdebL( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE TInt CATStorageServerSession::GetUdebL()" );
-    
-    iError = KErrNone;
-    
-    // Read the process ID at index 0
-    TUint processId = aMessage.Int0();
-    
-    // Get the dynamic process info array
-    RPointerArray<CATDynProcessInfo> dynProcessArray =
-                                             iStorageServer.DynProcessInfoArray();
-    
-    // Construct a CATDynProcessInfo object with the given process ID for searching
-    CATDynProcessInfo* dynProcessInfo = new (ELeave) CATDynProcessInfo( processId );
-    
-    // Find the index of a CATDynProcessInfo object with the given process ID
-    TLinearOrder<CATDynProcessInfo> order( CATDynProcessInfo::Compare );
-    TInt index = dynProcessArray.FindInOrder( dynProcessInfo, order );
-    delete dynProcessInfo;
-    dynProcessInfo = NULL;
-    
-    // Return, if a process with the requested process ID was not found 
-    if ( index == KErrNotFound )
-        {
-        return index;
-        }
-    
-    // Otherwise get the wanted dynamic process info
-    dynProcessInfo = dynProcessArray[index];
-
-    // Get the desired process's associated session object
-    CATStorageServerSession* sessionObject = dynProcessInfo->iSessionObject;
-    
-    TBuf8<KMaxVersionName> isUdeb;
-    if ( sessionObject->iIsUdeb == 1 )
-        {
-        isUdeb.Copy( KUdeb() );
-        }
-    else if ( sessionObject->iIsUdeb == 0 )
-        {
-        isUdeb.Copy( KUrel() );
-        }
-    else
-        {
-        return KErrNotFound;
-        }
-    // Write the whole buffer into aMessage at index 1 for the client
-    aMessage.WriteL( 1, isUdeb );
-    
-    return iError;
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::SetUdeb()
-// -----------------------------------------------------------------------------
-//    
-void CATStorageServerSession::SetUdeb( const RMessage2& aMessage )
-    {
-    LOGSTR1( "STSE void CATStorageServerSession::SetUdeb()" );
- 
-    iIsUdeb = aMessage.Int0();
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::LogAbnormalEnd()
-// -----------------------------------------------------------------------------
-//    
-void CATStorageServerSession::LogAbnormalEnd()
-    {
-    LOGSTR1( "STSE void CATStorageServerSession::LogAbnormalEnd()" );
-    
-    // Get the current universal time     
-    TInt64 timeFrom1970( GetTime() );
-        
-    switch ( iLogOption )
-        {
-        case EATLogToTrace:
-            {            
-            // Make a buffer that will be logged
-            TBuf<KEndAbnormalBufLength> traceBuf;
-            
-            // Write the process id to the buffer  
-            traceBuf.Format( KProcessEndAbnormalTrace, iProcessId );
-            
-            // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-            // format         
-            traceBuf.AppendNum( timeFrom1970, EHex );
-                
-            // Append a new line
-            traceBuf.Append( KNewLineTrace );
-            
-            // Write the buffer into the debug channel
-            RDebug::Print( KTraceMessage, iProcessId, &traceBuf );
-            }
-        break;
-        
-        case EATLogToFile:
-            {            
-            // Make a buffer that will be logged
-            TBuf8<KEndAbnormalBufLength> loggingBuf;
-            
-            // Write the process id to the buffer  
-            loggingBuf.Format( KProcessEndAbnormal, iProcessId );
-            
-            // Append the current time in the 64-bit (max 16 characters) hexadecimal text
-            // format         
-            loggingBuf.AppendNum( timeFrom1970, EHex );
-                
-            // Append a new line
-            loggingBuf.Append( KNewLine );
-            
-            // Write the buffer into a file (if possible in the current condition)
-            iFile.Write( loggingBuf );
-            }
-        break;
-              
-        default:
-            break;
-        }    
-    }
-
-// -----------------------------------------------------------------------------
-// CATStorageServerSession::GetTime()
-// Get the current universal time
-// -----------------------------------------------------------------------------
-//    
-TInt64 CATStorageServerSession::GetTime()
-    {
-    LOGSTR1( "STSE void CATStorageServerSession::GetTime()" );
-    
-    // Get the current universal time
-    iTime.UniversalTime();
-        
-    // Change the time format that tells the number of microseconds from January First,
-    // 0 AD nominal Gregorian, into a format that tells the number of microseconds from
-    // January First, 1970 AD nominal Gregorian. This is a more generic format and
-    // can be directly exploited by the PC code parsing the data file that this
-    // server generates.        
-    return ( iTime.Int64() - iMicroSecondsAt1970 );        
-    }
-
-//  End of File
--- a/analyzetool/storageserver/sis/atstorageserver.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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:
-;
-;
-; An installation file for AnalyzeTool StorageServer
-;
-
-;Language - standard language definitions
-&EN
-
-; standard SIS file header
-#{"ATStorageServer"},(0xA22E6C80),1,8,1
-
-;Localised Vendor name
-%{"Vendor-EN"}
-
-;Unique Vendor name
-:"Vendor"
-
-;Supports Series 60 v 3.0
-[0x101F7961], 0, 0, 0, {"Series60ProductID"}
-
-; 4 Files to install
-"\epoc32\release\armv5\urel\atoolstorageserver.exe"-"!:\sys\bin\atoolstorageserver.exe"
-"\epoc32\release\armv5\urel\atoolstorageserverclnt.dll"-"!:\sys\bin\atoolstorageserverclnt.dll"
--- a/analyzetool/storageserver/sis/atstorageserver_udeb.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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:
-;
-;
-; An installation file for AnalyzeTool StorageServer
-;
-
-;Language - standard language definitions
-&EN
-
-; standard SIS file header
-#{"ATStorageServer"},(0xA22E6C80),1,8,1
-
-;Localised Vendor name
-%{"Vendor-EN"}
-
-;Unique Vendor name
-:"Vendor"
-
-;Supports Series 60 v 3.0
-[0x101F7961], 0, 0, 0, {"Series60ProductID"}
-
-; 4 Files to install
-"\epoc32\release\armv5\udeb\atoolstorageserver.exe"-"!:\sys\bin\atoolstorageserver.exe"
-"\epoc32\release\armv5\udeb\atoolstorageserverclnt.dll"-"!:\sys\bin\atoolstorageserverclnt.dll"
--- a/analyzetool/symbian_version.hrh	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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: Symbian version configuration file 
-*
-*/
-
-#ifndef __SYMBIAN_VERSION_HRH
-#define __SYMBIAN_VERSION_HRH
-
-// S60 and Symbian version number enumeration definitions
-
-#define S60_30                                              30
-#define S60_31                                              31
-#define S60_32                                              32
-#define S60_50                                              50
-#define S60_51                                              91
-#define S60_52                                              92
-#define SYMBIAN_1                                           50
-#define SYMBIAN_2                                           91
-#define SYMBIAN_3                                           92
-#define SYMBIAN_4                                           101
-
-
-/**
- * Defines the S60 or Symbian version used by this component. This flag can be
- * used to variate the source code based on the SDK in use. The value of the
- * flag should be always changed to reflect the current build environment.
- */
-#define SYMBIAN_VERSION_SUPPORT                              SYMBIAN_4
-
-
-#endif  // __SYMBIAN_VERSION_HRH
--- a/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +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:  
-
-    bld.inf Top-level build information for osrndtools
-
------------------------------------------------------------------------------
-*/
-
-#include "../osrndtools_plat/group/bld.inf"
-#include "../memspy/group/bld.inf"
-#include "../piprofiler/group/bld.inf"
-#include "../analyzetool/group/bld.inf"
\ No newline at end of file
--- a/layers.sysdef.xml	Fri Aug 27 11:37:29 2010 +0300
+++ b/layers.sysdef.xml	Mon Sep 06 15:00:47 2010 +0300
@@ -7,15 +7,21 @@
   <systemModel>
     <layer name="os_layer">
       <module name="osrndtools">
-      	<component name="osrndtools">
-        	<unit unitID="tools.osrndtools" mrp="" bldFile="&layer_real_source_path;/group" name="osrndtools" />
-        </component>
         <component name="tracecompiler">
           <unit unitID="tools.tracecompiler" mrp="" bldFile="&layer_real_source_path;/tracefw/tracecompiler/group" name="tracecompiler" />
         </component>
         <component name="runmodedebug">
           <unit unitID="tools.runmodedebug" mrp="" bldFile="&layer_real_source_path;/debugsrv/runmodedebug/group" name="runmodedebug" />
-        </component>        
+        </component>       
+        <component name="piprofiler">
+          <unit unitID="tools.piprofiler" mrp="" bldFile="&layer_real_source_path;/perfsrv/piprofiler/group" name="piprofiler" />
+        </component>   
+        <component name="memspy">
+          <unit unitID="tools.memspy" mrp="" bldFile="&layer_real_source_path;/perfsrv/memspy/group" name="memspy" />
+        </component>   
+        <component name="analyzetool">
+          <unit unitID="tools.analyzetool" mrp="" bldFile="&layer_real_source_path;/perfsrv/analyzetool/group" name="analyzetool" />
+        </component>    
       </module>
     </layer>
   </systemModel>
--- a/memspy/CommandLine/Include/MemSpyCommandLine.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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 MEMSPYCOMMANDLINE_H
-#define MEMSPYCOMMANDLINE_H
-
-// System includes
-#include <e32base.h>
-#include <f32file.h>
-#include <badesca.h>
-#include <e32cons.h>
-
-#include "MemSpyCommands.h"
-
-#ifdef _DEBUG
-#   define TRACE( x ) x
-#else
-#   define TRACE( x )
-#endif
-
-// Constants
-const TInt KMemSpyCommandLineMaxLength = 128;
-
-// Classes referenced
-class RFs;
-class CCommandLineArguments;
-class RMemSpyEngineClientInterface;
-class CConsoleBase;
-class RMemSpySession;
-
-class CMemSpyCommandLine :  public CActive
-    {
-public:
-    //static CMemSpyCommandLine* NewLC();
-	static CMemSpyCommandLine* NewLC( CConsoleBase& aConsole );
-    ~CMemSpyCommandLine();
-
-private:
-    //CMemSpyCommandLine();
-    CMemSpyCommandLine( CConsoleBase& aConsole );
-    void ConstructL();
-
-public: // API
-    //void PerformBatchL( const TDesC& aFileName ); 	//support of the batch files removed 
-    void PerformOpL( const CCommandLineArguments& aCommandLine );
-    void PerformSingleOpL( const TDesC& aCommand, const CDesCArray& aParameters );
-    //
-    //AO request method
-    void WaitForInput();
-
-private: // Internal methods
-    void ConnectToMemSpyL();
-    void LaunchMemSpyL();
-    CDesCArray* ReadLinesL( RFile& aFile );
-    void ParseSWMTParametersL( const CDesCArray& aParameters, TInt& aCategories, TDes& aFilter );
-    TInt FindBatchFile( TDes &aFileName );
-    TInt FindFile( TDes &aFileName, const TDesC &aDirPath );
-
-private: // Console write methods
-    void RedrawInputPrompt();
-    void RedrawStatusMessage();
-    void RedrawStatusMessage( const TDesC& aMessage );
-    void ProcessCommandBufferL();
-    void RunL(); // from CActive
-    TInt RunError( TInt aError );
-    void DoCancel();
-    
-private: // Data members
-    RFs iFsSession;
-    RMemSpyEngineClientInterface* iMemSpy;
-    RMemSpySession* iMemSpySession;
-    TBool iIsBatch; // For avoiding recursion
-    
-private: // Data members - console - write status messages
-    CConsoleBase& iConsole;
-    TPoint iCommandPromptPos;
-    TPoint iStatusMessagePos;
-    TBuf<KMemSpyMaxInputBufferLength> iCommandBuffer;
-    };
-
-
-#endif
--- a/memspy/CommandLine/Include/MemSpyCommands.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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 MEMSPYCOMMANDS_H
-#define MEMSPYCOMMANDS_H
-
-// Literal constants
-_LIT( KMemSpyCLINewLine, "\r\n" );
-_LIT( KMemSpyCLIName, "MemSpy CommandLineInterpreter" );
-_LIT( KMemSpyCLIInputPrompt, " > %S" );
-_LIT( KMemSpyCLIWildcardCharacter, "*" );
-
-// Numerical constants
-const TInt KMemSpyMaxDisplayLengthThreadName = 48;
-const TInt KMemSpyMaxDisplayLengthSizeText = 14;
-const TInt KMemSpyMaxInputBufferLength = 200;
-
-// Key constants (S60)
-const TInt KMemSpyUiS60KeyCodeButtonOk = 2000;
-const TInt KMemSpyUiS60KeyCodeButtonCancel = 2001;
-const TInt KMemSpyUiS60KeyCodeRockerEnter = 63557;
-
-// Status messages
-_LIT( KOutputChangeMessage, "Change output mode opetarion in progress" );
-_LIT( KHeapDumpMessage, "Heap dump opetarion in progress" );
-_LIT( KSWMTMessage, "System Wide Memory Tracking opetarion in progress" );
-
-// Help text
-_LIT( KHelpMessage, "=== MemSpy CommandLineInterpreter Help ===\r\n" );
-_LIT( KHelpOutputCommand, "Change output mode to trace: 'memspy output trace'\r\n" );
-_LIT( KHelpOutputToFileCommand, "Change output mode to trace: 'memspy output file'\r\n" );
-_LIT( KHelpHeapDumpCommand, "Heap dump: 'memspy heapdup <all | kernel | user heap filter >'\r\n" );
-_LIT( KHelpSwmtCommand, "SWMT: 'memspy swmt <starttimer <value in seconds> | stop timer | dumpnow > <categories>'\r\n" );
-_LIT( KHelpKillServerCommand, "Kill server: 'memspy killserver'\r\n" );
-_LIT( KHelpCommand, "Press 'c' to continue" );
-
-//new commands
-
-//HELP
-_LIT( KMemSpyCmdHelp1, "-?" );
-_LIT( KMemSpyCmdHelp2, "-h" );
-_LIT( KMemSpyCmdHelp3, "-help" );
-_LIT( KMemSpyCmdHelp4, "--help" );
-
-//OUTPUT
-_LIT( KMemSpyCmdOutput, "output" );
-_LIT( KMemSpyCmdOutputParameterTrace, "trace" );
-_LIT( KMemSpyCmdOutputParameterFile, "file" );
-//<directory> //parameter to be parsed
-
-//HEAP DUMP
-_LIT( KMemSpyCmdHeapDump, "heapdump" );
-_LIT( KMemSpyCmdHeapDumpParameterAll, "all" ); //default
-_LIT( KMemSpyCmdHeapDumpParameterKernel, "kernel" ); //kernel heap dump
-
-//SWMT
-_LIT( KMemSpyCmdSwmt, "swmt" );
-_LIT( KMemSpyCmdSwmtParameterStarttimer, "starttimer" ); //<value in seconds> optionaly
-_LIT( KMemSpyCmdSwmtParameterStoptimer, "stoptimer" );
-_LIT( KMemSpyCmdSwmtParameterDumpnow, "dumpnow" );
-
-//KILL SERVER
-_LIT( KMemSpyCmdKillServer, "killserver"); //kills the server in case of it is running
-
-//SWMT CATEGORIES (TYPES)
-_LIT( KMemSpyCmdSWMTTypeHeap,                    "heap" );
-_LIT( KMemSpyCmdSWMTTypeChunk,                   "chnk" );
-_LIT( KMemSpyCmdSWMTTypeCode,                    "code" );
-_LIT( KMemSpyCmdSWMTTypeStack,                   "stak" );
-_LIT( KMemSpyCmdSWMTTypeGlobalData,              "glob" );
-_LIT( KMemSpyCmdSWMTTypeRamDrive,                "ramd" );
-_LIT( KMemSpyCmdSWMTTypeOpenFile,                "file" );
-_LIT( KMemSpyCmdSWMTTypeDiskSpace,               "disk" );
-_LIT( KMemSpyCmdSWMTTypeHandleGeneric,           "hgen" );
-_LIT( KMemSpyCmdSWMTTypeFbserv,                  "fabs" );
-_LIT( KMemSpyCmdSWMTTypeFileServerCache,         "f32c" );
-_LIT( KMemSpyCmdSWMTTypeSystemMemory,            "sysm" );
-_LIT( KMemSpyCmdSWMTTypeWindowGroup,             "wndg" );
-_LIT( KMemSpyCmdSWMTTypeAll,					 "all"	); //default value, dumps all categories expect heap dumps	
-#endif
--- a/memspy/CommandLine/Source/MemSpyCommandLine.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,698 +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 "MemSpyCommandLine.h"
-
-// System includes
-#include <bacline.h>
-#include <bautils.h>
-#include <memspyengineclientinterface.h>
-#include <memspysession.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-// User includes
-#include "MemSpyCommands.h"
-
-/*
-CMemSpyCommandLine::CMemSpyCommandLine()
-    {	
-    }
-*/
-
-CMemSpyCommandLine::CMemSpyCommandLine( CConsoleBase& aConsole )
-	: CActive( EPriorityHigh ), iConsole( aConsole )
-    {	
-	CActiveScheduler::Add( this );
-    }
-
-CMemSpyCommandLine::~CMemSpyCommandLine()
-    {
-	Cancel();
-	
-    if ( iMemSpySession )
-        {
-        iMemSpySession->Close();
-        }
-    delete iMemSpySession;
-    iFsSession.Close();
-    }
-
-
-void CMemSpyCommandLine::ConstructL()
-    {
-    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;
-    }
-
-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();
-
-        // 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 );
-
-        // 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();
-
-#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 ) );
-        }
-#else
-    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 );
-
-	    // 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( paramCount == 2 )
-					{
-					TBuf<KMaxFileName> directory;
-					directory.Copy( aParameters[1] );
-					iMemSpySession->SwitchOutputToFileL( directory );
-					}
-				else
-					{
-					iMemSpySession->SwitchOutputToFileL( KNullDesC );
-					}
-				}
-			else if( aParameters[0].CompareF( KMemSpyCmdOutputParameterTrace ) == 0)
-				{
-				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 ) );			
-			// Dump heap data for all threads - Thread agnostic operation					
-			iMemSpySession->OutputHeapData();
-			// Dump kernel heap data
-			iMemSpySession->OutputThreadHeapDataL( KMemSpyClientServerThreadIdKernel );					
-			}
-		else if( paramCount >= 1)
-			{
-			if( aParameters[0].CompareF( KMemSpyCmdHeapDumpParameterAll ) == 0 )
-				{
-				iMemSpySession->OutputHeapData();				
-				iMemSpySession->OutputThreadHeapDataL( KMemSpyClientServerThreadIdKernel );				
-				}
-			else if( aParameters[0].CompareF( KMemSpyCmdHeapDumpParameterKernel ) == 0 )
-				{
-				TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_DumpKernel", this ) );
-				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 );
-				}
-  			}
-		}
-    
-    // --- 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
-			{
-			TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - dumpnow command", this ) );
-			TInt category = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
-			iMemSpySession->SetSwmtCategoriesL( category );			
-			iMemSpySession->ForceSwmtUpdateL();			
-			}
-		else if( paramCount >= 1)
-			{
-			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
-				    	{
-						if( result >= KMemSpySysMemTrackerConfigMinTimerPeriod && result <= KMemSpySysMemTrackerConfigMaxTimerPeriod )
-							{
-							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();									
-				//	}	
-				}
-			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)
-				{
-				categories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
-				if( paramCount >= 2 ) // user gave some optional parameters - <categories>
-					{
-					TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) );
-					}				
-																
-				if( !err )
-					{
-					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
-				{
-				TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) );
-				if( !err )
-					{
-					iMemSpySession->SetSwmtCategoriesL( categories );
-					if( threadNameFilter.Length() > 0 )
-						{
-						iMemSpySession->SetSwmtFilter( threadNameFilter );
-						}
-					}								
-					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 ) );
-
-    // 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() );
-        }
-
-    // Spacer
-    RDebug::Printf( " " );
-    }
-
-
-void CMemSpyCommandLine::ConnectToMemSpyL()
-    {
-    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 ) );
-
-    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 ) );
-        }
-
-    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 ) );
-
-    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.Resume();
-
-		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - MemSpy resumed, waiting for Rendezvous... - this: 0x%08x", this ) );
-
-		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 )
-			{
-			TFullName 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.Resume();
-	
-			TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - MemSpy resumed, waiting for Rendezvous... - this: 0x%08x", this ) );
-			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() - 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 );
-
-    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 );
-        }
-
-    // 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 );
-
-    // 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 );
-            }
-        }
-
-    // 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 ) );
-
-    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;
-    }
-
-
-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;
-    }
-
-
-//CLI status messages methods
-void CMemSpyCommandLine::RedrawInputPrompt()
-    {
-    iConsole.SetCursorPosAbs( iCommandPromptPos );
-    iConsole.ClearToEndOfLine();
-    iConsole.Printf( KMemSpyCLIInputPrompt, &iCommandBuffer );
-    }
-
-
-void CMemSpyCommandLine::RedrawStatusMessage()
-    {
-    RedrawStatusMessage( KNullDesC );
-    }
-
-
-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();
-    }
-
-void CMemSpyCommandLine::DoCancel()
-    {
-    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 ) );
-                }
-
-            RedrawInputPrompt();
-            }
-        }
-
-    WaitForInput();
-    }
-
-TInt CMemSpyCommandLine::RunError( TInt aError )
-	{	
-	return KErrNone;
-	}
-
-void CMemSpyCommandLine::ProcessCommandBufferL()
-    {
-    iCommandBuffer.Trim();
-    //
-#ifdef _DEBUG
-    RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - cmd: [%S]"), &iCommandBuffer );
-#endif
-    //
-    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();
-        }
-    }
--- a/memspy/CommandLine/Source/MemSpyCommandLineMain.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +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:
-*
-*/
-
-// System includes
-#include <e32std.h>
-#include <f32file.h>
-#include <e32base.h>
-#include <e32cons.h>
-#include <f32file.h>
-#include <bacline.h>
-
-// User includes
-#include "MemSpyCommandLine.h"
-#include "MemSpyCommands.h"
-
-// ---------------------------------------------------------------------------
-// DoMainL()
-// 
-// 
-// ---------------------------------------------------------------------------
-static void DoMainL()
-    {
-    // Scheduler
-    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
-    CActiveScheduler::Install( scheduler );
-    CleanupStack::PushL( scheduler );
-    
-    // Get command line 
-    CCommandLineArguments* args = CCommandLineArguments::NewLC();
-    
-    //--
-    CConsoleBase* console = Console::NewL( KMemSpyCLIName, TSize( KConsFullScreen, KConsFullScreen ) );
-    CleanupStack::PushL( console );
-    //--
-    
-    // Command line manager
-    CMemSpyCommandLine* commandLineMgr = CMemSpyCommandLine::NewLC( *console );
-
-    // Play nicely with external processes
-    RProcess::Rendezvous( KErrNone );
-
-    // Perform op
-    commandLineMgr->PerformOpL( *args );  
-        
-    // Tidy up
-    //CleanupStack::PopAndDestroy( 3, scheduler ); // scheduler, args, commandLineMgr
-    CleanupStack::PopAndDestroy( 4 ); // scheduler, args,  console, commandLineMgr
-    }
-   
-
-
-// ---------------------------------------------------------------------------
-// E32Main()
-// 
-// 
-// ---------------------------------------------------------------------------
-GLDEF_C TInt E32Main()
-    {
-    __UHEAP_MARK;
-
-#ifdef _DEBUG
-    RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - Thread %d is STARTING"), (TUint) RThread().Id() );
-#endif
-
-    CTrapCleanup* cleanupTrap = CTrapCleanup::New();
-    TRAPD(err, DoMainL());  
-    if  ( err != KErrNone )
-        {
-        RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - error: %d"), err);
-        }
-    delete cleanupTrap; 
-
-    __UHEAP_MARKEND;
-
-#ifdef _DEBUG
-    RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - Thread %d is ENDING"), (TUint) RThread().Id() );
-#endif
-
-    return err;
-    }
-
--- a/memspy/CommandLine/group/MemSpyCommandLine.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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 <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGET          MemSpy.exe
-TARGETTYPE      exe
-UID             0x1000008d 0x2002129D
-VENDORID		VID_DEFAULT
-SMPSAFE
-
-CAPABILITY		WriteDeviceData
-
-SOURCEPATH      ../Source
-SOURCE          MemSpyCommandLine.cpp
-SOURCE          MemSpyCommandLineMain.cpp
-
-
-USERINCLUDE     ../Include
-
-
-OS_LAYER_SYSTEMINCLUDE
-
-APP_LAYER_SYSTEMINCLUDE
-
-LIBRARY         MemSpyClient.lib
-
-LIBRARY					euser.lib 
-LIBRARY 				efsrv.lib 
-LIBRARY 				bafl.lib 
-
-
--- a/memspy/CommandLine/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +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:
-*
-*/
-
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-MemSpyCommandLine.mmp
--- a/memspy/Console/Include/ConsoleConstants.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +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 CONSOLE_CONSTANTS_H
-#define CONSOLE_CONSTANTS_H
-
-// System includes
-#include <e32std.h>
-
-// Literal constants
-_LIT( KMemSpyConsoleNewLine, "\r\n" );
-_LIT( KMemSpyConsoleName, "MemSpy Console" );
-_LIT( KMemSpyConsoleInputPrompt, " > %S" );
-_LIT( KMemSpyConsoleWildcardCharacter, "*" );
-
-// Numerical constants
-const TInt KMemSpyMaxDisplayLengthThreadName = 48;
-const TInt KMemSpyMaxDisplayLengthSizeText = 14;
-const TInt KMemSpyMaxInputBufferLength = 200;
-
-// Key constants (S60)
-const TInt KMemSpyUiS60KeyCodeButtonOk = 2000;
-const TInt KMemSpyUiS60KeyCodeButtonCancel = 2001;
-const TInt KMemSpyUiS60KeyCodeRockerEnter = 63557;
-
-#endif
--- a/memspy/Console/Include/ConsoleDWOperation.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 CONSOLEDWOPERATION_H
-#define CONSOLEDWOPERATION_H
-
-// Engine includes
-#include <memspy/engine/memspydevicewideoperations.h>
-
-// Classes referenced
-class CMemSpyEngine;
-
-
-class CMemSpyDeviceWideOperationWaiter : public CBase, public MMemSpyDeviceWideOperationsObserver
-    {
-public:
-    static void ExecuteLD( CMemSpyEngine& aEngine, CMemSpyDeviceWideOperations::TOperation aOperation );
-    ~CMemSpyDeviceWideOperationWaiter();
-
-private:
-    CMemSpyDeviceWideOperationWaiter( CMemSpyEngine& aEngine );
-    void ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation );
-
-private: // From MMemSpyDeviceWideOperationsObserver
-    void HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 );
-
-private: // Internal 
-    void StopWait();
-
-private: // Member data
-    CMemSpyEngine& iEngine;
-    CActiveSchedulerWait* iWaiter;
-    CMemSpyDeviceWideOperations* iOperation;
-    };
-
-
-#endif
--- a/memspy/Console/Include/ConsoleMenu.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +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 CONSOLEMENU_H
-#define CONSOLEMENU_H
-
-// System includes
-#include <e32base.h>
-#include <e32cons.h>
-#include <e32hashtab.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobserver.h>
-#include <memspysession.h>
-// User includes
-#include "ConsoleConstants.h"
-
-// Classes referenced
-class CConsoleBase;
-class RMemSpySession;
-
-class CMemSpyConsoleMenu : public CActive, public MMemSpyEngineObserver
-    {
-public:
-    static CMemSpyConsoleMenu* NewLC( RMemSpySession& aSession, CConsoleBase& aConsole );
-    ~CMemSpyConsoleMenu();
-
-private:
-    CMemSpyConsoleMenu( RMemSpySession& aEngine, CConsoleBase& aConsole );
-    void ConstructL();
-
-public: // API
-    void DrawMenuL();
-    void WaitForInput();
-
-private: // From CActive
-    void RunL();
-    void DoCancel();
-
-private: // From MMemSpyEngineObserver
-    void HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext );
-
-private: // Command handlers
-    void OnCmdSinkTypeToggleL();
-    void OnCmdKernelObjectListingL();
-    void OnCmdHeapDataKernelL();
-    void OnCmdHeapDataUserL();
-    void OnCmdCSVListingHeapL();
-    void OnCmdCSVListingStackL();
-    void OnCmdHeapCellListUserL();
-
-private: // Internal methods
-    void ClearCommandBuffer();
-    void ProcessCommandBufferL();
-    void RedrawInputPrompt();
-    void RedrawStatusMessage();
-    void RedrawStatusMessage( const TDesC& aMessage );
-    void GetProcessName();
-    void InitiateMemSpyClientServerOperationL( TInt aOpCode );
-
-private: // Data members
-    RMemSpySession& iSession;
-    CConsoleBase& iConsole;
-    
-    TMemSpyOutputType iOutputType;
-    //
-    TBuf<KMemSpyMaxInputBufferLength> iCommandBuffer;
-    TPoint iCommandPromptPos;
-    TPoint iStatusMessagePos;
-    TBool iRunningDeviceWideOperation;
-    };
-
-
-
-#endif
--- a/memspy/Console/Source/ConsoleDWOperation.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +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 "ConsoleDWOperation.h"
-
-// System includes
-#include <e32debug.h>
-
-
-CMemSpyDeviceWideOperationWaiter::CMemSpyDeviceWideOperationWaiter( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-
-CMemSpyDeviceWideOperationWaiter::~CMemSpyDeviceWideOperationWaiter()
-    {
-#ifdef _DEBUG
-    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::~CMemSpyDeviceWideOperationWaiter() - START" );
-#endif
-
-#ifdef _DEBUG
-    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::~CMemSpyDeviceWideOperationWaiter() - deleting operation...: 0x%08x", iOperation );
-#endif
-    delete iOperation;
-
-#ifdef _DEBUG
-    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::~CMemSpyDeviceWideOperationWaiter() - deleting waiter...: 0x%08x", iWaiter );
-#endif
-    delete iWaiter;
-
-#ifdef _DEBUG
-    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::~CMemSpyDeviceWideOperationWaiter() - END" );
-#endif
-    }
-
-
-void CMemSpyDeviceWideOperationWaiter::ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation )
-    {
-#ifdef _DEBUG
-    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::ExecuteL() - START" );
-#endif
-
-    iWaiter = new(ELeave) CActiveSchedulerWait();
-    //iOperation = CMemSpyDeviceWideOperations::NewL( iEngine, *this, aOperation );
-
-#ifdef _DEBUG
-    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::ExecuteL() - starting scheduler wait..." );
-#endif
-
-    iWaiter->Start();
-
-#ifdef _DEBUG
-    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::ExecuteL() - END" );
-#endif
-    }
-
-void CMemSpyDeviceWideOperationWaiter::ExecuteLD( CMemSpyEngine& aEngine, CMemSpyDeviceWideOperations::TOperation aOperation )
-    {
-    CMemSpyDeviceWideOperationWaiter* self = new(ELeave) CMemSpyDeviceWideOperationWaiter( aEngine );
-    CleanupStack::PushL( self );
-    self->ExecuteL( aOperation );
-    CleanupStack::PopAndDestroy( self );
-    }
-
-
-void CMemSpyDeviceWideOperationWaiter::StopWait()
-    {
-#ifdef _DEBUG
-    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::StopWait() - START - iOperation: 0x%08x", iOperation );
-#endif
-
-    if  ( iWaiter->IsStarted() )
-        {
-        iWaiter->AsyncStop();
-        }
-
-#ifdef _DEBUG
-    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::StopWait() - END" );
-#endif
-    }
-
-
-void CMemSpyDeviceWideOperationWaiter::HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 )
-    {
-#ifdef _DEBUG
-    RDebug::Print( _L("[MCon] CMemSpyDeviceWideOperationWaiter::HandleDeviceWideOperationEvent() - START - aEvent: %d, aParam1: %d, aParam2: %S"), aEvent, aParam1, &aParam2 );
-#else
-    (void) aParam1;
-    (void) aParam2;
-#endif
-
-    switch( aEvent )
-        {
-    case MMemSpyDeviceWideOperationsObserver::EOperationCompleted:
-        StopWait();
-        break;
-    default:
-    case MMemSpyDeviceWideOperationsObserver::EOperationSized:
-    case MMemSpyDeviceWideOperationsObserver::EOperationStarting:
-    case MMemSpyDeviceWideOperationsObserver::EOperationProgressStart:
-    case MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd:
-    case MMemSpyDeviceWideOperationsObserver::EOperationCancelled:
-    case MMemSpyDeviceWideOperationsObserver::EOperationCompleting:
-        break;
-        }
-
-#ifdef _DEBUG
-    RDebug::Print( _L("[MCon] CMemSpyDeviceWideOperationWaiter::HandleDeviceWideOperationEvent() - END - aEvent: %d, aParam1: %d, aParam2: %S"), aEvent, aParam1, &aParam2 );
-#endif
-    }
-
-
-
-
--- a/memspy/Console/Source/ConsoleMain.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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:
-*
-*/
-
-// System includes
-#include <e32std.h>
-#include <e32test.h>
-#include <f32file.h>
-#include <e32base.h>
-#include <e32cons.h>
-#include <f32file.h>
-#include <bacline.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspysession.h>
-
-// User includes
-#include "ConsoleMenu.h"
-#include "ConsoleConstants.h"
-
-
-// ---------------------------------------------------------------------------
-// DoMainL()
-// 
-// 
-// ---------------------------------------------------------------------------
-static void DoMainL()
-    {
-    // Scheduler
-    CActiveScheduler* scheduler = new CActiveScheduler();
-    CActiveScheduler::Install( scheduler );
-    CleanupStack::PushL( scheduler );
-
-    // F32
-    RFs fsSession;
-    User::LeaveIfError( fsSession.Connect() );
-    CleanupClosePushL( fsSession );
-    
-    // Console
-	CConsoleBase* console = Console::NewL( KMemSpyConsoleName, TSize( KConsFullScreen, KConsFullScreen ) );
-	CleanupStack::PushL( console );
-
-    // Engine
-    RMemSpySession session;
-    User::LeaveIfError(session.Connect());
-    CleanupClosePushL(session);
-
-    // Menu & event handler AO
-    CMemSpyConsoleMenu::NewLC( session, *console );
-
-    // Play nicely with external processes
-    RProcess::Rendezvous( KErrNone );
-
-    // Start wait loop - console will stop it when done.
-    CActiveScheduler::Start();
-
-    // Tidy up
-    CleanupStack::PopAndDestroy( 5, scheduler );
-    }
-   
-
-
-// ---------------------------------------------------------------------------
-// E32Main()
-// 
-// 
-// ---------------------------------------------------------------------------
-GLDEF_C TInt E32Main()
-    {
-    __UHEAP_MARK;
-    RDebug::Print(_L("[MCon] E32Main() - MEMSPY CONSOLE"));
-
-    CTrapCleanup* cleanupTrap = CTrapCleanup::New();
-    TRAPD(err, DoMainL());  
-    if  ( err != KErrNone )
-        {
-        RDebug::Printf( " " );
-        RDebug::Printf( " " );
-        RDebug::Print(_L("[MCon] E32Main() - MEMSPY CONSOLE - error: %d"), err);
-        if ( err == KErrAlreadyExists )
-            {
-            RDebug::Printf( "\t\t [MCon] NB: MemSpy and MemSpyConsoleUi cannot run simultaneously!", err);
-            RDebug::Printf( " " );
-            RDebug::Printf( " " );
-            }
-        }
-    delete cleanupTrap; 
-
-    __UHEAP_MARKEND;
-
-    return KErrNone;
-    }
-
--- a/memspy/Console/Source/ConsoleMenu.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,649 +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 "ConsoleMenu.h"
-
-// System includes
-#include <e32debug.h>
-
-// Engine includes
-#include <memspyengineclientinterface.h>
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyenginehelperstack.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspydevicewideoperations.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperkernelcontainers.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-
-// User includes
-#include "ConsoleConstants.h"
-#include "ConsoleDWOperation.h"
-
-
-CMemSpyConsoleMenu::CMemSpyConsoleMenu( RMemSpySession& aSession, CConsoleBase& aConsole )
-:   CActive( EPriorityHigh ), iSession( aSession ), iConsole( aConsole ), iOutputType(EOutputTypeDebug)
-    {
-    CActiveScheduler::Add( this );
-    // TODO: iEngine.SetObserver( this );
-    }
-
-
-CMemSpyConsoleMenu::~CMemSpyConsoleMenu()
-    {
-    Cancel();
-    }
-
-
-void CMemSpyConsoleMenu::ConstructL()
-    {
-    DrawMenuL();
-    WaitForInput();
-    }
-
-
-CMemSpyConsoleMenu* CMemSpyConsoleMenu::NewLC( RMemSpySession& aSession, CConsoleBase& aConsole )
-    {
-    CMemSpyConsoleMenu* self = new(ELeave) CMemSpyConsoleMenu( aSession, aConsole );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-void CMemSpyConsoleMenu::DrawMenuL()
-    {
-    iConsole.ClearScreen();
-   
-    // First line - sink type (defaults to file)
-    _LIT( KLine1, "1 or T. Toggle output mode between file or trace [%S]" );
-    if  ( iOutputType == EOutputTypeDebug )
-        {
-        _LIT( KLine1Trace, "Trace" );
-        iConsole.Printf( KLine1, &KLine1Trace );
-        }
-    else
-        {
-        _LIT( KLine1File, "File" );
-        iConsole.Printf( KLine1, &KLine1File );
-        }
-    iConsole.Write( KMemSpyConsoleNewLine );
-
-    // Kernel heap dump
-    _LIT( KLine2, "2 or K. Dump kernel heap data" );
-    iConsole.Write( KLine2 );
-    iConsole.Write( KMemSpyConsoleNewLine );
-
-    // Kernel heap dump
-    _LIT( KLine3, "3 or O. Dump kernel object listing" );
-    iConsole.Write( KLine3 );
-    iConsole.Write( KMemSpyConsoleNewLine );
-
-    // Heap (CSV) listing
-    _LIT( KLine4, "4 or H. Heap CSV-information (for all threads)" );
-    iConsole.Write( KLine4 );
-    iConsole.Write( KMemSpyConsoleNewLine );
-
-    // Stack (CSV) listing
-    _LIT( KLine5, "5 or S. Stack CSV-information (for all threads)" );
-    iConsole.Write( KLine5 );
-    iConsole.Write( KMemSpyConsoleNewLine );
-
-    // Heap data
-    _LIT( KLine6, "6 or D. Get heap data for a user-thread" );
-    iConsole.Write( KLine6 );
-    iConsole.Write( KMemSpyConsoleNewLine );
-
-    // Heap cell listing
-    _LIT( KLine7, "7 or L. Get heap cell list for a user-thread" );
-    iConsole.Write( KLine7 );
-    iConsole.Write( KMemSpyConsoleNewLine );
-
-    // Exit key
-    _LIT( KLine8, "8 or X. Exit" );
-    iConsole.Write( KLine8 );
-    iConsole.Write( KMemSpyConsoleNewLine );
-
-    // Spacer
-    iConsole.Write( KMemSpyConsoleNewLine );
-    iConsole.Write( KMemSpyConsoleNewLine );
-
-    // Status message
-    iStatusMessagePos = iConsole.CursorPos();
-    RedrawStatusMessage();
-
-    // Spacer
-    iConsole.Write( KMemSpyConsoleNewLine );
-
-    // Show input prompt.
-    iCommandPromptPos = iConsole.CursorPos();
-    RedrawInputPrompt();
-    }
-
-
-void CMemSpyConsoleMenu::WaitForInput()
-    {
-    ASSERT( !IsActive() );
-    iConsole.Read( iStatus );
-    SetActive();
-    }
-
-
-void CMemSpyConsoleMenu::RunL()
-    {
-    TKeyCode key = iConsole.KeyCode();
-    //
-#ifdef _DEBUG
-    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::RunL() - START - key = %d", key );
-#endif
-    //
-    if  ( key == EKeyEnter || key == KMemSpyUiS60KeyCodeButtonOk || key == KMemSpyUiS60KeyCodeRockerEnter )
-        {
-        TRAP_IGNORE( ProcessCommandBufferL() );
-        }
-    else if ( key == EKeyEscape || key == KMemSpyUiS60KeyCodeButtonCancel )
-        {
-        ClearCommandBuffer();
-        RedrawInputPrompt();
-        }   
-    else if ( key == EKeyBackspace )
-        {
-        const TInt cmdBufLength = iCommandBuffer.Length();
-        if  ( cmdBufLength > 0 )
-            {
-            iCommandBuffer.SetLength( cmdBufLength - 1 );
-            RedrawInputPrompt();
-            }
-        }
-    else
-        {
-        TChar character( key );
-        if  ( character.IsPrint() )
-            {
-            if  ( iCommandBuffer.Length() < iCommandBuffer.MaxLength() )
-                {
-                iCommandBuffer.Append( TChar( key ) );
-                }
-
-            RedrawInputPrompt();
-            }
-        }
-
-    WaitForInput();
-
-#ifdef _DEBUG
-    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::RunL() - END" );
-#endif
-    }
-
-
-void CMemSpyConsoleMenu::DoCancel()
-    {
-    iConsole.ReadCancel();
-    }
-
-
-void CMemSpyConsoleMenu::OnCmdSinkTypeToggleL()
-    {
-	iOutputType = iOutputType == EOutputTypeFile ? EOutputTypeDebug : EOutputTypeFile;
-    }
-
-
-void CMemSpyConsoleMenu::OnCmdHeapDataKernelL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataKernelL() - START" );
-#endif
-
-    _LIT( KMsg, "Ouputting Kernel data..." );
-    RedrawStatusMessage( KMsg );
-
-    iSession.OutputKernelHeapDataL( iOutputType );
-
-    RedrawStatusMessage( KNullDesC );
-    }
-
-
-void CMemSpyConsoleMenu::OnCmdKernelObjectListingL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdKernelObjectListingL() - START" );
-#endif
-
-    _LIT( KMsg, "Ouputting Kernel Object listing..." );
-    RedrawStatusMessage( KMsg );
-    //
-    iSession.OutputKernelObjectsL( iOutputType );
-
-    RedrawStatusMessage( KNullDesC );
-    }
-
-
-void CMemSpyConsoleMenu::OnCmdCSVListingStackL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdCSVListingStackL() - START" );
-#endif
-
-    iSession.OutputCompactStackInfoL( iOutputType );
-    }
-
-
-void CMemSpyConsoleMenu::OnCmdCSVListingHeapL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdCSVListingHeapL() - START" );
-#endif
-
-    iSession.OutputCompactHeapInfoL( iOutputType );
-    }
-
-
-void CMemSpyConsoleMenu::OnCmdHeapDataUserL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - START" );
-#endif
-
-    GetProcessName();
-
-    // Work out what to do.
-    iCommandBuffer.Trim();
-
-#ifdef _DEBUG
-    RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - requested dump heap for proc: %S"), &iCommandBuffer );
-#endif
-
-    if  ( iCommandBuffer.Length() > 0 )
-        {
-        iConsole.Write( KMemSpyConsoleNewLine );
-        iConsole.Write( KMemSpyConsoleNewLine );
-        //
-        HBufC* cmdBuf = HBufC::NewLC( KMemSpyMaxInputBufferLength + 10 );
-        TPtr pCmdBuf( cmdBuf->Des() );
-        pCmdBuf.Copy( iCommandBuffer );
-        pCmdBuf.Append( KMemSpyConsoleWildcardCharacter );
-        
-        TInt err;
-        TProcessId procId;
-        TRAP(err, procId = iSession.GetProcessIdByNameL(pCmdBuf));
-        //
-        if (err == KErrNone) 
-        	{
-        	RArray<CMemSpyApiThread*> threads;
-        	
-        	TRAP(err, iSession.GetThreadsL(procId, threads));
-        	if (err == KErrNone)
-        		{
-				_LIT( KProcessingRequest, "** Dumping Heap Data for thread: %S" );     	
-				TFullName fullThreadName;
-				
-                for( TInt i=0; i<threads.Count(); i++ )
-                    {
-                    CMemSpyApiThread* thread = threads[i];
-                    //
-                    fullThreadName = thread->Name();
-                    iConsole.Printf( KProcessingRequest, &fullThreadName );
-                    iConsole.Write( KMemSpyConsoleNewLine );
-                    //
-                    TRAP_IGNORE( iSession.OutputThreadHeapDataL(iOutputType, thread->Id()) );
-                    
-                    delete thread;
-                    }
-                }
-            }
-
-        CleanupStack::PopAndDestroy( cmdBuf );
-        DrawMenuL();
-        }
-    else
-        {
-        // Bad user data entry
-        DrawMenuL();
-        _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
-        RedrawStatusMessage( KInvalidEntry );
-        RedrawInputPrompt();
-        }
-    }
-
-
-void CMemSpyConsoleMenu::OnCmdHeapCellListUserL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapCellListUserL() - START" );
-#endif
-
-    GetProcessName();
-
-    // Work out what to do.
-    iCommandBuffer.Trim();
-    if  ( iCommandBuffer.Length() > 0 )
-        {
-        iConsole.Write( KMemSpyConsoleNewLine );
-        iConsole.Write( KMemSpyConsoleNewLine );
-        //
-        HBufC* cmdBuf = HBufC::NewLC( KMemSpyMaxInputBufferLength + 10 );
-        TPtr pCmdBuf( cmdBuf->Des() );
-        pCmdBuf.Copy( iCommandBuffer );
-        pCmdBuf.Append( KMemSpyConsoleWildcardCharacter );
-        
-        TInt err;
-		TProcessId procId;
-		TRAP(err, procId = iSession.GetProcessIdByNameL(pCmdBuf));
-		//
-		if (err == KErrNone) 
-			{
-			RArray<CMemSpyApiThread*> threads;
-			
-			TRAP(err, iSession.GetThreadsL(procId, threads));
-			if (err == KErrNone)
-				{
-				_LIT( KProcessingRequest, "** Dumping Heap Cell List for thread: %S" );     	
-				TFullName fullThreadName;
-				
-				for( TInt i=0; i<threads.Count(); i++ )
-					{
-					CMemSpyApiThread* thread = threads[i];
-					//
-					fullThreadName = thread->Name();
-					iConsole.Printf( KProcessingRequest, &fullThreadName );
-					iConsole.Write( KMemSpyConsoleNewLine );
-					//
-					TRAP_IGNORE( iSession.OutputThreadCellListL(iOutputType, thread->Id()) );
-					
-					delete thread;
-					}
-				}
-			}
-        
-        CleanupStack::PopAndDestroy( cmdBuf );
-        DrawMenuL();
-        }
-    else
-        {
-        // Bad user data entry
-        DrawMenuL();
-        _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
-        RedrawStatusMessage( KInvalidEntry );
-        RedrawInputPrompt();
-        }
-    }
-
-
-void CMemSpyConsoleMenu::ClearCommandBuffer()
-    {
-    iCommandBuffer.Zero();
-    }
-
-
-void CMemSpyConsoleMenu::ProcessCommandBufferL()
-    {
-    iCommandBuffer.Trim();
-    //
-#ifdef _DEBUG
-    RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - cmd: [%S]"), &iCommandBuffer );
-#endif
-    //
-    TBool validCommand = EFalse;
-    if  ( iCommandBuffer.Length() == 1 )
-        {
-        // Reset if not recognised...
-        validCommand = ETrue;
-
-        const TChar cmd = iCommandBuffer[ 0 ]; 
-        switch( cmd )
-            {
-        case '1':
-        case 't':
-        case 'T':
-            OnCmdSinkTypeToggleL();
-            break;
-        case '2':
-        case 'k':
-        case 'K':
-            OnCmdHeapDataKernelL();
-            break;
-        case '3':
-        case 'o':
-        case 'O':
-            OnCmdKernelObjectListingL();
-            break;
-        case '4':
-        case 'h':
-        case 'H':
-            OnCmdCSVListingHeapL();
-            break;
-        case '5':
-        case 's':
-        case 'S':
-            OnCmdCSVListingStackL();
-            break;
-        case '6':
-        case 'd':
-        case 'D':
-            OnCmdHeapDataUserL();
-            break;
-        case '7':
-        case 'l':
-        case 'L':
-            OnCmdHeapCellListUserL();
-            break;
-        case '8':
-        case 'x':
-        case 'X':
-            CActiveScheduler::Stop();
-            return; // NB: avoid redrawing menu when exiting
-
-        default:
-            validCommand = EFalse;
-            break;
-            }
-        }
-    //
-    ClearCommandBuffer();
-    //
-    if  ( !validCommand )
-        {
-        _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
-        RedrawStatusMessage( KInvalidEntry );
-        RedrawInputPrompt();
-        }
-    else
-        {
-        DrawMenuL();
-        }
-
-#ifdef _DEBUG
-    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - END" );
-#endif
-    }
-
-
-void CMemSpyConsoleMenu::RedrawInputPrompt()
-    {
-    iConsole.SetCursorPosAbs( iCommandPromptPos );
-    iConsole.ClearToEndOfLine();
-    iConsole.Printf( KMemSpyConsoleInputPrompt, &iCommandBuffer );
-    }
-
-
-void CMemSpyConsoleMenu::RedrawStatusMessage()
-    {
-    RedrawStatusMessage( KNullDesC );
-    }
-
-
-void CMemSpyConsoleMenu::RedrawStatusMessage( const TDesC& aMessage )
-    {
-    iConsole.SetCursorPosAbs( iStatusMessagePos );
-    iConsole.ClearToEndOfLine();
-    iConsole.Write( aMessage );
-    iConsole.Write( KMemSpyConsoleNewLine );
-    }
-
-
-void CMemSpyConsoleMenu::GetProcessName()
-    {
-    iConsole.ClearScreen();
-
-    _LIT( KPromptMessage1, "Enter the full or partial process name" );
-    iConsole.Write( KPromptMessage1 );
-    iConsole.Write( KMemSpyConsoleNewLine );
-    _LIT( KPromptMessage2, "of the process that you are interested in." );
-    iConsole.Write( KPromptMessage2 );
-    iConsole.Write( KMemSpyConsoleNewLine );
-    _LIT( KPromptMessage3, "Press \'enter\' when done." );
-    iConsole.Write( KPromptMessage3 );
-    iConsole.Write( KMemSpyConsoleNewLine );
-    //
-    ClearCommandBuffer();
-    iConsole.Write( KMemSpyConsoleNewLine );
-    iCommandPromptPos = iConsole.CursorPos();
-    RedrawInputPrompt();
-    //
-    TBool done = EFalse;
-    while( !done )
-        {
-        // Get a key
-        const TKeyCode key = iConsole.Getch();
-
-        // Process it
-#ifdef _DEBUG
-        RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - START - key = %d", key );
-#endif
-        //
-        if  ( key == EKeyEnter || key == KMemSpyUiS60KeyCodeButtonOk || key == KMemSpyUiS60KeyCodeRockerEnter )
-            {
-            done = ETrue;
-            }
-        else if ( key == EKeyEscape || key == KMemSpyUiS60KeyCodeButtonCancel )
-            {
-            ClearCommandBuffer();
-            done = ETrue;
-            }   
-        else if ( key == EKeyBackspace )
-            {
-            const TInt cmdBufLength = iCommandBuffer.Length();
-            if  ( cmdBufLength > 0 )
-                {
-                iCommandBuffer.SetLength( cmdBufLength - 1 );
-                RedrawInputPrompt();
-                }
-            }
-        else
-            {
-            TChar character( key );
-            if  ( character.IsPrint() )
-                {
-                if  ( iCommandBuffer.Length() < iCommandBuffer.MaxLength() )
-                    {
-                    iCommandBuffer.Append( TChar( key ) );
-                    }
-
-                RedrawInputPrompt();
-                }
-            }
-        }
-    }
-
-
-void CMemSpyConsoleMenu::HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext )
-    {
-    if  ( aEvent == MMemSpyEngineObserver::EHandleClientServerOperationRequest )
-        {
-        const TInt function = reinterpret_cast< TInt >( aContext );
-        InitiateMemSpyClientServerOperationL( function );
-        }
-    }
-
-
-void CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL( TInt aOpCode )
-    {
-	// TODO: ....
-//#ifdef _DEBUG
-//    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL() - START - aOpCode: %d, iRunningDeviceWideOperation: %d", aOpCode, iRunningDeviceWideOperation );
-//#endif
-//    //
-//    if ( aOpCode == EMemSpyClientServerOpExit )
-//        {
-//        // Exit console app UI
-//        CActiveScheduler::Stop();
-//        }
-//    else
-//        {
-//        CMemSpyDeviceWideOperations::TOperation op = CMemSpyDeviceWideOperations::EPerEntityGeneralSummary;
-//        switch( aOpCode )
-//            {
-//        case EMemSpyClientServerOpSummaryInfo:
-//            op = CMemSpyDeviceWideOperations::EPerEntityGeneralSummary;
-//            break;
-//        case EMemSpyClientServerOpSummaryInfoDetailed:
-//            op = CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed;
-//            break;
-//        //
-//        case EMemSpyClientServerOpHeapInfo:
-//            op = CMemSpyDeviceWideOperations::EPerEntityHeapInfo;
-//            break;
-//        case EMemSpyClientServerOpHeapCellListing:
-//            op = CMemSpyDeviceWideOperations::EPerEntityHeapCellListing;
-//            break;
-//        case EMemSpyClientServerOpHeapData:
-//            op = CMemSpyDeviceWideOperations::EPerEntityHeapData;
-//            break;
-//        //
-//        case EMemSpyClientServerOpStackInfo:
-//            op = CMemSpyDeviceWideOperations::EPerEntityStackInfo;
-//            break;
-//        case EMemSpyClientServerOpStackDataUser:
-//            op = CMemSpyDeviceWideOperations::EPerEntityStackDataUser;
-//            break;
-//        case EMemSpyClientServerOpStackDataKernel:
-//            op = CMemSpyDeviceWideOperations::EPerEntityStackDataKernel;
-//            break;
-//        
-//        // These are not supported by the console UI
-//        default:
-//        case EMemSpyClientServerOpBitmapsSave:
-//        case EMemSpyClientServerOpSendToBackground:
-//        case EMemSpyClientServerOpBringToForeground:
-//            User::Leave( KErrNotSupported );
-//            break;
-//            }
-//
-//        if  ( iRunningDeviceWideOperation )
-//            {
-//            User::Leave( KErrInUse );
-//            }
-//        else
-//            {
-//            iRunningDeviceWideOperation = ETrue;
-//            TRAP_IGNORE( CMemSpyDeviceWideOperationWaiter::ExecuteLD( iEngine, op ) );
-//            iRunningDeviceWideOperation = EFalse;
-//            }
-//        }
-//
-//#ifdef _DEBUG
-//    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL() - END - aOpCode: %d", aOpCode );
-//#endif
-    }
-
-
-
--- a/memspy/Console/data/MemSpyEComInterfaceIds.xml	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?xml version="1.0" standalone="yes"?>
-<memspy_ecom_sections>
-
-    <category name="Messaging">
-		<interface uid="0xABCD1234" name="Watchers" />
-    </category>
-
-    <category name="App-Protocols">
-		<interface uid="0x101F446D" name="HTTP Filters" />
-		<interface uid="0x1000A449" name="HTTP Protocol" />
-    </category>
-
-    <category name="S60 AIW">
-		<interface uid="0x101F8650" name="AIW Class Base" />
-		<interface uid="0x101F8652" name="AIW Class Menu" />
-    </category>
-
-</memspy_ecom_sections>
\ No newline at end of file
--- a/memspy/Console/data/MemSpyProcessMemoryTrackingAutoStartConfig.xml	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0" standalone="yes"?>
-<memspy_process_memory_tracking>
-
-    <process sid="0x100058EC"/>
-	<process sid="0x1000484B"/>
-
-</memspy_process_memory_tracking>
\ No newline at end of file
--- a/memspy/Console/data/backup_registration.xml	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" standalone="yes"?>
-<backup_registration>
-
-    <passive_backup>
-        <include_directory name="\"/>
-        <exclude name="MemSpy_Passive_Excluded.txt"/>
-    </passive_backup>
-
-    <system_backup/>
-
-    <public_backup>
-        <include_directory name="C:\Data\Others\MemSpy\"/>
-    </public_backup>
-
-    <restore requires_reboot = "no"/>
-
-</backup_registration>
\ No newline at end of file
--- a/memspy/Console/group/MemSpyConsole.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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 <platform_paths.hrh>
-
-TARGET          memspyconsole.exe
-UID             0x10000000 0x2002129E
-TARGETTYPE      exe
-SMPSAFE
-
-#include		"../../group/MemSpyCapabilities.mmh"
-
-//EPOCSTACKSIZE   0x4000
-//EPOCHEAPSIZE	0x100000 0x4000000
-
-
-SOURCEPATH      ../Source
-SOURCE          ConsoleMain.cpp
-SOURCE          ConsoleMenu.cpp
-SOURCE          ConsoleDWOperation.cpp
-
-USERINCLUDE     ../Include
-
-OS_LAYER_SYSTEMINCLUDE
-
-LIBRARY         euser.lib
-LIBRARY         efsrv.lib 
-
-LIBRARY		MemSpyClient.lib
-LIBRARY     MemSpyEngine.lib
\ No newline at end of file
--- a/memspy/Console/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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:
-*
-*/
-
-
-PRJ_EXPORTS
-../data/MemSpyEComInterfaceIds.xml									z:/private/2002129E/memspyecominterfaceids.xml
-../data/MemSpyProcessMemoryTrackingAutoStartConfig.xml				z:/private/2002129E/memspyprocessmemorytrackingautostartconfig.xml
-../data/backup_registration.xml										z:/private/2002129E/backup_registration.xml
-
-
-PRJ_MMPFILES
-//MemSpyConsole.mmp
--- a/memspy/Driver/BWINS/memspydriverclientu.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-EXPORTS
-	?Close@RMemSpyDriverClient@@QAEXXZ @ 1 NONAME ; void RMemSpyDriverClient::Close(void)
-	?Close@RMemSpyMemStreamReader@@QAEXXZ @ 2 NONAME ; void RMemSpyMemStreamReader::Close(void)
-	?EventMonitorClose@RMemSpyDriverClient@@QAEHI@Z @ 3 NONAME ; int RMemSpyDriverClient::EventMonitorClose(unsigned int)
-	?EventMonitorNotify@RMemSpyDriverClient@@QAEXIAAVTRequestStatus@@AAI@Z @ 4 NONAME ; void RMemSpyDriverClient::EventMonitorNotify(unsigned int, class TRequestStatus &, unsigned int &)
-	?EventMonitorNotifyCancel@RMemSpyDriverClient@@QAEXI@Z @ 5 NONAME ; void RMemSpyDriverClient::EventMonitorNotifyCancel(unsigned int)
-	?EventMonitorOpen@RMemSpyDriverClient@@QAEHAAI@Z @ 6 NONAME ; int RMemSpyDriverClient::EventMonitorOpen(unsigned int &)
-	?GetApproximateKernelObjectSize@RMemSpyDriverClient@@QAEHW4TMemSpyDriverContainerType@@@Z @ 7 NONAME ; int RMemSpyDriverClient::GetApproximateKernelObjectSize(enum TMemSpyDriverContainerType)
-	?GetChunkHandles@RMemSpyDriverClient@@QAEHPAPAXAAH@Z @ 8 NONAME ; int RMemSpyDriverClient::GetChunkHandles(void * *, int &)
-	?GetChunkHandlesForProcess@RMemSpyDriverClient@@QAEHIPAPAXAAH@Z @ 9 NONAME ; int RMemSpyDriverClient::GetChunkHandlesForProcess(unsigned int, void * *, int &)
-	?GetChunkHandlesForThread@RMemSpyDriverClient@@QAEHIPAPAXAAH@Z @ 10 NONAME ; int RMemSpyDriverClient::GetChunkHandlesForThread(unsigned int, void * *, int &)
-	?GetChunkInfo@RMemSpyDriverClient@@QAEHPAXAAVTMemSpyDriverChunkInfo@@@Z @ 11 NONAME ; int RMemSpyDriverClient::GetChunkInfo(void *, class TMemSpyDriverChunkInfo &)
-	?GetChunkInfo@RMemSpyDriverClient@@QAEHPAXAAVTMemSpyDriverChunkInfoWithoutName@@@Z @ 12 NONAME ; int RMemSpyDriverClient::GetChunkInfo(void *, class TMemSpyDriverChunkInfoWithoutName &)
-	?GetCodeSegInfo@RMemSpyDriverClient@@QAEHPAXIAAVTMemSpyDriverCodeSegInfo@@@Z @ 13 NONAME ; int RMemSpyDriverClient::GetCodeSegInfo(void *, unsigned int, class TMemSpyDriverCodeSegInfo &)
-	?GetCodeSegs@RMemSpyDriverClient@@QAEHIPAPAXAAH@Z @ 14 NONAME ; int RMemSpyDriverClient::GetCodeSegs(unsigned int, void * *, int &)
-	?GetCodeSegs@RMemSpyDriverClient@@QAEHPAPAXAAHH@Z @ 15 NONAME ; int RMemSpyDriverClient::GetCodeSegs(void * *, int &, int)
-	?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> &)
-	?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> &)
-	?GetHeapInfoUser@RMemSpyDriverClient@@QAEHAAVTMemSpyHeapInfo@@I@Z @ 23 NONAME ; int RMemSpyDriverClient::GetHeapInfoUser(class TMemSpyHeapInfo &, unsigned int)
-	?GetHeapInfoUser@RMemSpyDriverClient@@QAEHAAVTMemSpyHeapInfo@@IAAV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 24 NONAME ; int RMemSpyDriverClient::GetHeapInfoUser(class TMemSpyHeapInfo &, unsigned int, class RArray<class TMemSpyDriverFreeCell> &)
-	?GetPAndSInfo@RMemSpyDriverClient@@QAEHPAXAAVTMemSpyDriverPAndSInfo@@@Z @ 25 NONAME ; int RMemSpyDriverClient::GetPAndSInfo(void *, class TMemSpyDriverPAndSInfo &)
-	?GetProcessHandlesByType@RMemSpyDriverClient@@QAEHHW4TMemSpyDriverContainerType@@PAPAXAAH@Z @ 26 NONAME ; int RMemSpyDriverClient::GetProcessHandlesByType(int, enum TMemSpyDriverContainerType, void * *, int &)
-	?GetProcessInfo@RMemSpyDriverClient@@QAEHIAAVTMemSpyDriverProcessInfo@@@Z @ 27 NONAME ; int RMemSpyDriverClient::GetProcessInfo(unsigned int, class TMemSpyDriverProcessInfo &)
-	?GetReferencesToMyProcess@RMemSpyDriverClient@@QAEHI@Z @ 28 NONAME ; int RMemSpyDriverClient::GetReferencesToMyProcess(unsigned int)
-	?GetReferencesToMyThread@RMemSpyDriverClient@@QAEHI@Z @ 29 NONAME ; int RMemSpyDriverClient::GetReferencesToMyThread(unsigned int)
-	?GetServerSessionHandles@RMemSpyDriverClient@@QAEHPAXPAPAXAAH@Z @ 30 NONAME ; int RMemSpyDriverClient::GetServerSessionHandles(void *, void * *, int &)
-	?GetServerSessionInfo@RMemSpyDriverClient@@QAEHPAXAAVTMemSpyDriverServerSessionInfo@@@Z @ 31 NONAME ; int RMemSpyDriverClient::GetServerSessionInfo(void *, class TMemSpyDriverServerSessionInfo &)
-	?GetStackData@RMemSpyDriverClient@@QAEHIAAVTDes8@@AAIW4TMemSpyDriverDomainType@@H@Z @ 32 NONAME ; int RMemSpyDriverClient::GetStackData(unsigned int, class TDes8 &, unsigned int &, enum TMemSpyDriverDomainType, int)
-	?GetStackDataNext@RMemSpyDriverClient@@QAEHIAAVTDes8@@AAIW4TMemSpyDriverDomainType@@H@Z @ 33 NONAME ; int RMemSpyDriverClient::GetStackDataNext(unsigned int, class TDes8 &, unsigned int &, enum TMemSpyDriverDomainType, int)
-	?GetStackInfo@RMemSpyDriverClient@@QAEHIAAVTMemSpyDriverStackInfo@@@Z @ 34 NONAME ; int RMemSpyDriverClient::GetStackInfo(unsigned int, class TMemSpyDriverStackInfo &)
-	?GetThreadHandlesByType@RMemSpyDriverClient@@QAEHHW4TMemSpyDriverContainerType@@PAPAXAAH@Z @ 35 NONAME ; int RMemSpyDriverClient::GetThreadHandlesByType(int, enum TMemSpyDriverContainerType, void * *, int &)
-	?GetThreadInfo@RMemSpyDriverClient@@QAEHIAAVTMemSpyDriverThreadInfo@@@Z @ 36 NONAME ; int RMemSpyDriverClient::GetThreadInfo(unsigned int, class TMemSpyDriverThreadInfo &)
-	?GetThreadsL@RMemSpyDriverClient@@QAEXABVTProcessId@@AAV?$RArray@VTThreadId@@@@@Z @ 37 NONAME ; void RMemSpyDriverClient::GetThreadsL(class TProcessId const &, class RArray<class TThreadId> &)
-	?GetVersion@RMemSpyDriverClient@@QAEXAAVTVersion@@@Z @ 38 NONAME ; void RMemSpyDriverClient::GetVersion(class TVersion &)
-	?Impersonate@RMemSpyDriverClient@@QAEHK@Z @ 39 NONAME ; int RMemSpyDriverClient::Impersonate(unsigned long)
-	?IsDebugKernel@RMemSpyDriverClient@@QAEHXZ @ 40 NONAME ; int RMemSpyDriverClient::IsDebugKernel(void)
-	?MemoryModelType@RMemSpyDriverClient@@QAE?AW4TMemSpyMemoryModelType@@XZ @ 41 NONAME ; enum TMemSpyMemoryModelType RMemSpyDriverClient::MemoryModelType(void)
-	?Open@RMemSpyDriverClient@@QAEHXZ @ 42 NONAME ; int RMemSpyDriverClient::Open(void)
-	?OpenProcess@RMemSpyDriverClient@@QAEHIAAVRProcess@@@Z @ 43 NONAME ; int RMemSpyDriverClient::OpenProcess(unsigned int, class RProcess &)
-	?OpenThread@RMemSpyDriverClient@@QAEHIAAVRThread@@@Z @ 44 NONAME ; int RMemSpyDriverClient::OpenThread(unsigned int, class RThread &)
-	?ProcessInspectionAutoStartItemsAdd@RMemSpyDriverClient@@QAEHI@Z @ 45 NONAME ; int RMemSpyDriverClient::ProcessInspectionAutoStartItemsAdd(unsigned int)
-	?ProcessInspectionAutoStartItemsReset@RMemSpyDriverClient@@QAEXXZ @ 46 NONAME ; void RMemSpyDriverClient::ProcessInspectionAutoStartItemsReset(void)
-	?ProcessInspectionClose@RMemSpyDriverClient@@QAEHI@Z @ 47 NONAME ; int RMemSpyDriverClient::ProcessInspectionClose(unsigned int)
-	?ProcessInspectionOpen@RMemSpyDriverClient@@QAEHI@Z @ 48 NONAME ; int RMemSpyDriverClient::ProcessInspectionOpen(unsigned int)
-	?ProcessInspectionRequestChanges@RMemSpyDriverClient@@QAEXIAAVTRequestStatus@@AAVTMemSpyDriverProcessInspectionInfo@@@Z @ 49 NONAME ; void RMemSpyDriverClient::ProcessInspectionRequestChanges(unsigned int, class TRequestStatus &, class TMemSpyDriverProcessInspectionInfo &)
-	?ProcessInspectionRequestChangesCancel@RMemSpyDriverClient@@QAEXI@Z @ 50 NONAME ; void RMemSpyDriverClient::ProcessInspectionRequestChangesCancel(unsigned int)
-	?ProcessThreadsResume@RMemSpyDriverClient@@QAEHI@Z @ 51 NONAME ; int RMemSpyDriverClient::ProcessThreadsResume(unsigned int)
-	?ProcessThreadsSuspend@RMemSpyDriverClient@@QAEHI@Z @ 52 NONAME ; int RMemSpyDriverClient::ProcessThreadsSuspend(unsigned int)
-	?ReadInt32L@RMemSpyMemStreamReader@@QAEJXZ @ 53 NONAME ; long RMemSpyMemStreamReader::ReadInt32L(void)
-	?ReadL@RMemSpyMemStreamReader@@QAEXAAVTDes16@@@Z @ 54 NONAME ; void RMemSpyMemStreamReader::ReadL(class TDes16 &)
-	?ReadL@RMemSpyMemStreamReader@@QAEXAAVTDes8@@@Z @ 55 NONAME ; void RMemSpyMemStreamReader::ReadL(class TDes8 &)
-	?ReadMemory@RMemSpyDriverClient@@QAEHIKAAVTDes8@@@Z @ 56 NONAME ; int RMemSpyDriverClient::ReadMemory(unsigned int, unsigned long, class TDes8 &)
-	?ReadUint32L@RMemSpyMemStreamReader@@QAEKXZ @ 57 NONAME ; unsigned long RMemSpyMemStreamReader::ReadUint32L(void)
-	?RoundToPageSize@RMemSpyDriverClient@@QAEKK@Z @ 58 NONAME ; unsigned long RMemSpyDriverClient::RoundToPageSize(unsigned long)
-	?SetPriority@RMemSpyDriverClient@@QAEHIW4TThreadPriority@@@Z @ 59 NONAME ; int RMemSpyDriverClient::SetPriority(unsigned int, enum TThreadPriority)
-	?StreamOpenL@RMemSpyDriverClient@@QAE?AVRMemSpyMemStreamReader@@XZ @ 60 NONAME ; class RMemSpyMemStreamReader RMemSpyDriverClient::StreamOpenL(void)
-	?ThreadEnd@RMemSpyDriverClient@@QAEHIW4TExitType@@@Z @ 61 NONAME ; int RMemSpyDriverClient::ThreadEnd(unsigned int, enum TExitType)
-	?WalkHeapClose@RMemSpyDriverClient@@QAEXXZ @ 62 NONAME ; void RMemSpyDriverClient::WalkHeapClose(void)
-	?WalkHeapGetCellInfo@RMemSpyDriverClient@@QAEHAAPAXAAW4TMemSpyDriverCellType@@AAH2220@Z @ 63 NONAME ; int RMemSpyDriverClient::WalkHeapGetCellInfo(void * &, enum TMemSpyDriverCellType &, int &, int &, int &, int &, void * &)
-	?WalkHeapInit@RMemSpyDriverClient@@QAEHI@Z @ 64 NONAME ; int RMemSpyDriverClient::WalkHeapInit(unsigned int)
-	?WalkHeapNextCell@RMemSpyDriverClient@@QAEHIAAW4TMemSpyDriverCellType@@AAPAXAAH2221@Z @ 65 NONAME ; int RMemSpyDriverClient::WalkHeapNextCell(unsigned int, enum TMemSpyDriverCellType &, void * &, int &, int &, int &, int &, void * &)
-	?WalkHeapReadCellData@RMemSpyDriverClient@@QAEHPAXAAVTDes8@@H@Z @ 66 NONAME ; int RMemSpyDriverClient::WalkHeapReadCellData(void *, class TDes8 &, int)
-	?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)
-
--- a/memspy/Driver/Kernel/Include/MemSpyDriverDevice.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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 MEMSPYDRIVERDEVICE_H
-#define MEMSPYDRIVERDEVICE_H
-
-// System includes
-#include <kernel.h>
-
-// Classes referenced
-class DMemSpyEventMonitor;
-class DMemSpyDriverOSAdaption;
-class DMemSpySuspensionManager;
-class DMemSpyInspectedProcessManager;
-
-class DMemSpyDriverDevice : public DLogicalDevice
-	{
-public:
-	DMemSpyDriverDevice();
-    ~DMemSpyDriverDevice();
-
-public: // from DLogicalDevice
-	TInt Install();
-	void GetCaps( TDes8& aDes ) const;
-	TInt Create( DLogicalChannelBase*& aChannel );
-
-public: // API
-    void Cleanup();
-    //
-    inline TUint32 RHeapVTable() const { return iRHeapVTable; }
-    inline void SetRHeapVTable( TUint32 aVTable ) { iRHeapVTable = aVTable; }
-    //
-    inline DMemSpyEventMonitor& EventMonitor() { return *iEventMonitor; }
-    inline DMemSpyDriverOSAdaption& OSAdaption() { return *iOSAdaption; }
-    inline DMemSpySuspensionManager& SuspensionManager() const { return *iSuspensionManager; }
-    inline DMemSpyInspectedProcessManager& ProcessInspectionManager() { return *iProcessManager; }
-
-private: // Data members
-    TUint32 iRHeapVTable;
-    DMemSpyEventMonitor* iEventMonitor;
-    DMemSpyDriverOSAdaption* iOSAdaption;
-    DMemSpySuspensionManager* iSuspensionManager;
-    DMemSpyInspectedProcessManager* iProcessManager;
-	};
-
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverEventMonitor.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +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 MEMSPYEVENTMONITOR_H
-#define MEMSPYEVENTMONITOR_H
-
-// System includes
-#include <kernel.h>
-#include <kern_priv.h>
-
-// Classes referenced
-class DMemSpyDriverDevice;
-
-// For EMTypeMask
-enum TMemSpyEventMonitorEvent
-    {
-    EMemSpyEventNull                = 0x0000,
-    //
-    EMemSpyEventThreadAdd           = 0x0001,
-    EMemSpyEventThreadRemove        = 0x0002,
-    EMemSpyEventThreadKill          = 0x0004,
-    //
-    EMemSpyEventProcessAdd          = 0x0008,
-    EMemSpyEventProcessUpdate       = 0x0010,
-    EMemSpyEventProcessRemove       = 0x0020,
-    //
-    EMemSpyEventChunkAdd            = 0x0040,
-    EMemSpyEventChunkUpdate         = 0x0080,
-    EMemSpyEventChunkDelete         = 0x0100,
-    };
-
-
-class MMemSpyEventMonitorObserver
-	{
-public: // From MMemSpyEventMonitorObserver
-    virtual TUint EMTypeMask() const = 0;
-    //
-    virtual void EMHandleProcessAdd( DProcess& /*aProcess*/ ) { }
-    virtual void EMHandleProcessUpdated( DProcess& /*aProcess*/ ) { }
-    virtual void EMHandleProcessRemoved( DProcess& /*aProcess*/ ) { }
-    //
-    virtual void EMHandleThreadAdd( DThread& /*aThread*/ ) { }
-    virtual void EMHandleThreadRemoved( DThread& /*aThread*/ ) { }
-    virtual void EMHandleThreadKilled( DThread& /*aThread*/ ) { }
-    //
-    virtual void EMHandleChunkAdd( DChunk& /*aChunk*/ ) { }
-    virtual void EMHandleChunkUpdated( DChunk& /*aChunk*/ ) { }
-    virtual void EMHandleChunkDeleted( DChunk& /*aChunk*/ ) { }
-
-public: // Nasty, but I don't care...
-    SDblQueLink __iEMLink;
-    };
-
-
-
-class DMemSpyEventMonitor : public DKernelEventHandler
-	{
-public:
-	DMemSpyEventMonitor();
-	~DMemSpyEventMonitor();
-
-public: // Device API
-    TInt Create( DMemSpyDriverDevice* aDevice );
-	TInt Start();
-	TInt Stop();
-	
-public: // API
-    TInt RequestEvents( MMemSpyEventMonitorObserver& aObserver );
-    TInt RequestEventsCancel( MMemSpyEventMonitorObserver& aObserver );
-
-private: // Handle kernel event callbacks
-	static TUint EventHandler( TKernelEvent aEvent, TAny* a1, TAny* a2, TAny* aThis );
-	TUint HandleEvent( TKernelEvent aType, TAny* a1, TAny* a2 );
-    //
-	void EventProcessAdd( DProcess* aProcess );
-	void EventProcessUpdate( DProcess* aProcess );
-	void EventProcessRemoved( DProcess* aProcess );
-	//
-	void EventThreadAdd( DThread* aThread );
-	void EventThreadRemoved( DThread* aThread );
-	void EventThreadKilled( DThread* aThread );
-    //
-	void EventChunkAdd( DChunk* aChunk );
-	void EventChunkUpdate( DChunk* aChunk );
-	void EventChunkDelete( DChunk* aChunk );
-
-private: // Internal methods
-    TBool IsObserving( MMemSpyEventMonitorObserver& aObserver ); 
-
-private:
-	/** Lock serialising calls to event handler */
-	DMutex* iLock;
-
-    /** open reference to LDD for avoiding lifetime issues */
-	DLogicalDevice* iDevice;
-
-    // List of observers
-	SDblQue iObservers;
-	
-	// Whether we are tracking or not
-	TBool iTracking;
-	};
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverHeap.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +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 MEMSPYDRIVERHEAP_H
-#define MEMSPYDRIVERHEAP_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include "MemSpyDriverObjectsInternal.h"
-
-// Constants
-// We shouldn't be using any of these any more! -Tomsci
-const TUint KRHeapObjectSize = 0x74;
-const TUint KRAllocatorAndRHeapMemberDataOffset = 4; // 4 bytes past start of allocator address, i.e. skipping the vtable
-const TUint KRHeapMemberDataSize = KRHeapObjectSize - KRAllocatorAndRHeapMemberDataOffset;
-
-// Classes referenced
-class DMemSpyDriverOSAdaption;
-namespace LtkUtils
-	{
-	class RAllocatorHelper;
-	}
-
-/**
- * Essentially a mirror of RAllocator and RHeap's layout.
- */
-class RMemSpyDriverRHeapBase
-	{
-protected:
-    RMemSpyDriverRHeapBase();
-
-public: // API
-    void PrintInfo();
-	LtkUtils::RAllocatorHelper* Helper();
-	TMemSpyHeapInfo::THeapImplementationType GetTypeFromHelper() const;
-
-public: // Virtual API
-    virtual void Reset();
-	virtual void Close();
-    virtual DChunk& Chunk() = 0;
-    virtual const DChunk& Chunk() 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:
-    RMemSpyDriverRHeapUser( DMemSpyDriverOSAdaption& aOSAdaption );
-	TInt OpenUserHeap(DThread& aThread, TBool aEuserUdeb);
-
-	DChunk& Chunk() { return *iChunk; }
-	const DChunk& Chunk() const { return *iChunk; }
-
-private:
-    inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; }
-
-private:
-    DMemSpyDriverOSAdaption& iOSAdaption;
-	DChunk* iChunk;
-    };
-
-
-
-class RMemSpyDriverRHeapKernelFromCopy : public RMemSpyDriverRHeapReadFromCopy
-    {
-public:
-    RMemSpyDriverRHeapKernelFromCopy( DMemSpyDriverOSAdaption& aOSAdaption );
-    
-public: // API
-    void SetKernelHeap( RHeapK& aKernelHeap );
-
-public: // From RMemSpyDriverRHeapBase
-    //void DisassociateWithKernelChunk();
-	void Close();
-
-private:
-    RHeapK* iKernelHeap;
-    };
-
-
-
-class RMemSpyDriverRHeapKernelInPlace : public RMemSpyDriverRHeapBase
-    {
-public:
-    RMemSpyDriverRHeapKernelInPlace();
-	TInt OpenKernelHeap();
-    
-
-public: // From RMemSpyDriverRHeapBase
-    void Close();
-
-    DChunk& Chunk();
-    const DChunk& Chunk() const;
-
-	// Only important member data is the base class's RAllocatorHelper
-	// We do cache the chunk though
-private:
-	DChunk* iChunk;
-    };
-
-	
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverHeapStatistics.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +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 MEMSPYDRIVERHEAPSTATISTICS_H
-#define MEMSPYDRIVERHEAPSTATISTICS_H
-
-// System includes
-#include <e32cmn.h>
-
-
-class TMemSpyHeapWalkStatistics
-    {
-public:
-
-    // Total number of cells enumerated
-    TInt iNumberOfWalkedCells;
-
-    // The type of the last cell
-    TMemSpyDriverCellType iLastCellType;
-
-    // The address of the last cell
-    TLinAddr iLastCellAddress;
-
-public: // Free cell related
-
-    // The address of the first free heap cell
-    TLinAddr iFirstFreeCellAddress;
-    
-    // The length of the first free heap cell
-    TUint iFirstFreeCellLength;
-
-    // Whether the last cell in the entire heap was a free cell
-    // (i.e. slack space)
-    TBool iLastCellWasFreeCell;
-
-    // The length of the last free cell in the heap
-    TUint iLastFreeCellLength;
-
-    // The total amount of free space in the heap
-    TUint iTotalFreeSpace;
-
-    // The number of free heap cells
-    TUint iFreeCellCount;
-
-    // The size of the largest free cell
-    TUint iLargestCellSizeFree;
-
-    // The previous largest free cell size
-    TUint iLargestCellSizeFreePrevious;
-
-    // The address of the largest free cell
-    TLinAddr iLargestCellAddressFree;
-
-    // The previous address of the largest free cell
-    TUint iLargestCellAddressFreePrevious;
-
-    // The overhead associated with a free cell (header length)
-    //TUint iFreeCellOverheadHeaderLength;
-	TUint iReserved1;
-
-    // The slace space at the end of the heap
-    TUint iSlackSpace;
-
-    // The address of the slack space cell
-    TLinAddr iSpackSpaceCellAddress;
-
-    // A very simple XOR checksum of all the free cell addresses that were
-    // detected during the heap navigation
-    TUint32 iFreeCellCRC;
-
-public: // Alloc cell related
-
-    // The number of allocated heap cells
-    TUint iAllocCellCount;
-
-    // The size of the largest allocated cell
-    TUint iLargestCellSizeAlloc;
-
-    // The address of the largest allocated cell
-    TLinAddr iLargestCellAddressAlloc;
-   
-    // The overhead associated with an allocated cell (header length)
-    //TUint iAllocCellOverheadHeaderLength;
-	TUint iReserved2;
-
-public: // Common
-
-    // The total amount of allocated space in the heap
-    TUint iTotalAllocSpace;
-    };
-
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverHeapWalker.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +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 MEMSPYDRIVERHEAPWALKER_H
-#define MEMSPYDRIVERHEAPWALKER_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// Shared includes
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include "MemSpyDriverHeap.h"
-#include "MemSpyDriverHeapStatistics.h"
-
-#include "heaputils.h"
-using namespace LtkUtils;
-
-// Heap walker observer interface - can be used to make a record of each cell
-class MMemSpyHeapWalkerObserver
-    {
-public:
-    virtual TBool HandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber) = 0;
-    virtual void HandleHeapWalkInit() = 0;
-    };
-
-
-// Heap walker - allows in-place walking of any heap
-class RMemSpyDriverHeapWalker
-    {
-public:
-	RMemSpyDriverHeapWalker(RMemSpyDriverRHeapBase& aHeap, MMemSpyHeapWalkerObserver* aObserver=NULL);
-		
-public: // API
-    TInt Traverse();
-    void CopyStatsTo( TMemSpyHeapStatisticsRHeap& aStats );
-    void SetObserver( MMemSpyHeapWalkerObserver* aObserver );
-    inline void SetPrintDebug() { iPrintDebug = ETrue; }
-    inline const TMemSpyHeapWalkStatistics& Stats() const { return iStats; }
-
-private: // Internal methods
-	static TBool CellCallback(RAllocatorHelper& aHelper, TAny* aContext, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellAddress, TInt aLength);
-	TBool DoCellCallback(RAllocatorHelper& aHelper, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellAddress, TInt aLength);
-    TBool NotifyCell( TMemSpyDriverCellType aType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel = -1, TInt aAllocNumber = -1 );
-    //
-    void UpdateStats( TMemSpyDriverCellType aType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber );
-    void InitialiseStats();
-    void FinaliseStats();
-    void PrintStats();
-    //
-    inline TBool PrintDebug() const { return iPrintDebug; }
-
-private:
-    RMemSpyDriverRHeapBase& iHeap;
-    TBool iPrintDebug;
-    MMemSpyHeapWalkerObserver* iObserver;
-    TMemSpyHeapWalkStatistics iStats;
-    };
-
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverInspectedProcess.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +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 MEMSPYINSPECTEDPROCESS_H
-#define MEMSPYINSPECTEDPROCESS_H
-
-// System includes
-#include <kern_priv.h>
-
-// Shared includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverEventMonitor.h"
-
-// Classes referenced
-class DMemSpyInspectedProcessManager;
-class TMemSpyDriverProcessInspectionInfo;
-
-
-
-class TMemSpyTrackedChunk
-	{
-public:
-    enum TType
-        {
-        ETypeNotRelevant = -1,
-        //
-        ETypeChunkHeap = 0,
-        ETypeChunkLocal,
-        ETypeChunkGlobalData,
-        ETypeChunkProcessGlobalDataAndUserStack,
-        ETypeChunkShared
-        };
-
-public:
-	TMemSpyTrackedChunk( DChunk* aChunk, TType aType );
-
-public: // API
-    void SetSize( TInt aSize );
-    TInt Size() const { return iSize; }
-    //
-    void SetUnused( TBool aUnused );
-    TBool Unused() const { return iUnused; }
-    //
-    TAny* Handle() const { return iChunk; }
-    //
-    inline TType Type() const { return iType; }
-    inline void SetType( TType aType ) { iType = aType; }
-
-public: // Data members
-	SDblQueLink iLink;
-    DChunk* iChunk;
-    TType iType;
-    TInt iSize;
-    TBool iUnused;
-	};
-
-
-class TMemSpyTrackedChunkChangeInfo
-    {
-public: // Data members
-    TMemSpyDriverProcessInspectionInfo iInfo;
-	SDblQueLink iLink;
-    };
-
-
-
-
-
-class DMemSpyInspectedProcess : public DBase, public MMemSpyEventMonitorObserver
-    {
-public: // Construct / destruct
-	DMemSpyInspectedProcess( DMemSpyDriverDevice& aDevice );
-	~DMemSpyInspectedProcess();
-
-public: // API
-    TInt Open( DProcess* aProcess );
-    inline TUint ProcessId() const { return iProcessId; }
-
-public: // Change notification API
-	TInt NotifyOnChange( DThread* aThread, TRequestStatus* aRequestStatus, TMemSpyDriverProcessInspectionInfo* aInfo );
-	TInt NotifyOnChangeCancel();
-    TBool NotifyOnChangeQueued() const;
-
-public: // Queue link
-	SDblQueLink iLink;
-
-public: // From MMemSpyEventMonitorObserver
-    TUint EMTypeMask() const;
-    void EMHandleProcessUpdated( DProcess& aProcess );
-    void EMHandleProcessRemoved( DProcess& aProcess );
-    void EMHandleThreadAdd( DThread& aThread );
-    void EMHandleThreadRemoved( DThread& aThread );
-    void EMHandleThreadKilled( DThread& aThread );
-    void EMHandleChunkAdd( DChunk& aChunk );
-    void EMHandleChunkUpdated( DChunk& aChunk );
-    void EMHandleChunkDeleted( DChunk& aChunk );
-
-    // Internal helper
-    void EMHandleThreadChanged( DThread& aThread );
-
-private: // Tracked item management
-    void ResetTrackedList();
-    void SetTrackedListUnused();
-    void SetTrackedListUnusedStatusByType( TMemSpyTrackedChunk::TType aType, TBool aUnusedStatus );
-    void DiscardUnusedTrackListItems();
-    void AddTrackedChunk( DChunk* aChunk, TMemSpyTrackedChunk::TType aType );
-    TMemSpyTrackedChunk* TrackedChunkByHandle( TAny* aHandle );
-
-private: // Internal methods
-    DMemSpyInspectedProcessManager& PManager();
-    DMemSpyEventMonitor& EventMonitor();
-    TMemSpyTrackedChunk::TType ChunkType( DObject* aObject ) const;
-    TBool IsHeapChunk( DChunk& aChunk, const TName& aName ) const;
-    static TUint32 TotalStatistics( const TMemSpyDriverProcessInspectionInfo& aStats, TBool aIncludeShared = ETrue );
-    static TBool IsEqual( const TMemSpyDriverProcessInspectionInfo& aLeft, const TMemSpyDriverProcessInspectionInfo& aRight );
-    void ResetStatistics( TMemSpyDriverProcessInspectionInfo& aStats );
-    TBool UpdateStatistics();
-    void CompleteClientsRequest( TInt aCompletionCode, TMemSpyDriverProcessInspectionInfo* aInfo = NULL );
-    void FindChunks( DProcess& aProcess );
-    TInt StackSize( DProcess& aProcess );
-    void ResetPendingChanges();
-    void PrintChunkInfo( DChunk& aChunk ) const;
-    TBool IsChunkRelevantToOurProcess( DChunk& aChunk ) const;
-	void Lock() const;
-	void Unlock() const;
-
-public: // Queue link for process manager
-	SDblQueLink iPMLink;
-
-private: // Data members
-    DMemSpyDriverDevice& iDevice;
-	DMutex* iLock;
-    TUint iProcessId;
-    DProcess* iProcess;
-    TBool iAmDead;
-
-    // This differs from the 'inspection info' iMemoryStack field
-    // because it just contains the size of all user-thread stacks
-    // within the process.
-    TInt iUserThreadStackSize;
-
-    // Tracking chunks mapped into process
-	SDblQue iTrackedChunks;
-	
-	// Changes that have occurred whilst the client was AWOL
-	SDblQue iPendingChanges;
-
-    // Tracking totals
-    TMemSpyDriverProcessInspectionInfo iInfoLast;
-    TMemSpyDriverProcessInspectionInfo iInfoCurrent;
-    TMemSpyDriverProcessInspectionInfo iInfoPeaks;
-    TMemSpyDriverProcessInspectionInfo iInfoHWMIncShared;
-    TMemSpyDriverProcessInspectionInfo iInfoHWMExcShared;
-
-    // For change notification
-    TInt iChangeDeliveryCounter;
-	DThread* iChangeObserverThread;
-	TRequestStatus* iChangeObserverRS;
-    TMemSpyDriverProcessInspectionInfo* iChangeObserverInfo;
-    TBool iEventReceivedWhilstObserverWasAWOL;
-    };
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverInspectedProcessManager.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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 MEMSPYDRIVERINSPECTEDPROCESSMANAGER_H
-#define MEMSPYDRIVERINSPECTEDPROCESSMANAGER_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverEventMonitor.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class DMemSpyInspectedProcess;
-
-
-class DMemSpyInspectedProcessManager : public DObject, public MMemSpyEventMonitorObserver
-	{
-public:
-	DMemSpyInspectedProcessManager();
-	~DMemSpyInspectedProcessManager();
-    TInt Create( DMemSpyDriverDevice* aDevice );
-
-public: // API
-    TInt ProcessOpen( DProcess* aProcess );
-    TInt ProcessClose( DProcess* aProcess );
-    TInt ProcessCount() const;
-    //
-    DMemSpyInspectedProcess* InspectedProcessByProcessId( TUint aProcessId );
-    void AutoStartListReset();
-    TInt AutoStartListAdd( TUint aSID );
-
-private: // Event handler queue methods
-    void FreeAllInspectedProcesses();
-    DMemSpyEventMonitor& EventMonitor();
-
-private: // From MMemSpyEventMonitorObserver
-    TUint EMTypeMask() const;
-    void EMHandleProcessAdd( DProcess& aProcess );
-
-private:
-    DMemSpyDriverDevice* iDevice;
-	SDblQue iMonitoredProcesses;
-	
-	// So that MemSpy can be informed when one of the observed processes changed
-	DThread* iObserverThread;
-	TRequestStatus* iObserverRS;
-    RArray<TUint> iAutoStartSIDs;
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverLog.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +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 MEMSPYDRIVERLOG_H
-#define MEMSPYDRIVERLOG_H
-
-// System includes
-#include <kernel.h>
-
-// Uncomment this line to enable minimal op code tracing
-//#define TRACE_TYPE_OPCODES
-
-// Uncomment this line to enable driver tracing
-//#define TRACE_TYPE_GENERAL
-
-// Uncomment this line to dump raw binary data - usually heaps & stacks.
-//#define TRACE_TYPE_DATA 
-
-// Uncomment this line to trace heap walking etc
-//#define TRACE_TYPE_USERHEAP
-
-// Uncomment this line to trace chunks
-//#define TRACE_TYPE_CHUNK
-
-// Uncomment this line to trace event monitor functionality
-//#define TRACE_TYPE_EVENTMONITOR
-
-// Uncomment this line to trace kernel heap operations
-//#define TRACE_TYPE_KERNELHEAP
-
-// Uncomment this line to trace heap walking
-//#define TRACE_TYPE_HEAPWALK
-
-// This block switches on basic tracing in UDEB HW builds
-#if (defined(_DEBUG) && !defined(__WINS__))
-#   define TRACE_TYPE_OPCODES 
-#   define TRACE_TYPE_GENERAL
-//#   define TRACE_TYPE_HEAPWALK
-#   define TRACE_TYPE_CHUNK
-//#   define TRACE_TYPE_EVENTMONITOR
-//#   define TRACE_TYPE_DATA
-//#   define TRACE_TYPE_USERHEAP
-#   define TRACE_TYPE_KERNELHEAP
-#endif
-
-
-#if defined(TRACE_TYPE_OPCODES)
-#   define TRACE_OP( x ) x
-#else
-#   define TRACE_OP( x ) 
-#endif
-
-
-
-#if defined(TRACE_TYPE_GENERAL)
-#   define TRACE( x ) x
-#else
-#   define TRACE( x ) 
-#endif
-
-
-
-#if defined(TRACE_TYPE_USERHEAP)
-#   define TRACE_HEAP( x ) x
-#else
-#   define TRACE_HEAP( x ) 
-#endif
-
-
-
-#if defined(TRACE_TYPE_KERNELHEAP)
-#   define TRACE_KH( x ) x
-#else
-#   define TRACE_KH( x ) 
-#endif
-
-
-
-#if defined(TRACE_TYPE_HEAPWALK )
-#   define TRACE_HEAPWALK( x ) x
-#else
-#   define TRACE_HEAPWALK( x ) 
-#endif
-
-
-
-#if defined(TRACE_TYPE_EVENTMONITOR)
-#   define TRACE_EM( x ) x
-#else
-#   define TRACE_EM( x ) 
-#endif
-
-
-
-#if defined(TRACE_TYPE_DATA)
-#   define TRACE_DATA( x ) x
-#else
-#   define TRACE_DATA( x )
-#endif
-
-
-#if defined(TRACE_TYPE_CHUNK)
-#   define TRACE_CHUNK( x ) x
-#else
-#   define TRACE_CHUNK( x )
-#endif
-
-#define LOG(args...) TRACE(Kern::Printf(args))
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverLogicalChannel.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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 MEMSPYDRIVERLOGICALCHANNEL_H
-#define MEMSPYDRIVERLOGICALCHANNEL_H
-
-// System includes
-#include <e32cmn.h>
-#include <kernel.h>
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class DMemSpyDriverLogChanBase;
-
-
-class DMemSpyDriverLogicalChannel : public DLogicalChannelBase
-	{
-public:
-	DMemSpyDriverLogicalChannel();
-	~DMemSpyDriverLogicalChannel();
-
-private: // from DLogicalChannelBase
-	TInt DoCreate( TInt aUnit, const TDesC8* anInfo, const TVersion& aVer );
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-
-private: // Channel operation handlers
-    TInt SubChannelsRegister();
-    TInt SubChannelConstructAndSave( DMemSpyDriverLogChanBase*& aSubChannel );
-    void SubChannelsDestroy();
-    DMemSpyDriverLogChanBase* SubChannelForFunction( TInt aFunction );
-
-private: // Internal methods
-    DMemSpyDriverDevice& MemSpyDevice();
-
-private: // Data members
-	DThread* iClientThread;
-    RPointerArray<DMemSpyDriverLogChanBase> iSubChannels;
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverOSAdaption.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,505 +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 MEMSPYDRIVEROSADAPTION_H
-#define MEMSPYDRIVEROSADAPTION_H
-
-// System includes
-#include <kernel.h>
-#include <e32const.h>
-
-// User includes
-#include "MemSpyDriverObjectIx.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class DMemSpyPropertyRef;
-class DMemSpyDriverOSAdaption;
-
-
-
-class DMemSpyDriverOSAdaptionDObject : public DBase
-    {
-protected:
-    DMemSpyDriverOSAdaptionDObject( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TUint8 GetContainerID( DObject& aObject ) const;
-    TObjectType GetObjectType( DObject& aObject ) const;
-    DObject* GetOwner( DObject& aObject ) const;
-    DObject* GetOwner( DObject& aObject, TUint8 aExpectedContainerId ) const;
-    TInt GetAccessCount( DObject& aObject ) const;
-    TInt GetUniqueID( DObject& aObject ) const;
-    TUint GetProtection( DObject& aObject ) const;
-    TUint8* GetAddressOfKernelOwner( DObject& aObject ) const;
-
-protected:
-    DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; }
-
-private: // Data members
-    DMemSpyDriverOSAdaption& iOSAdaption;
-    };
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDThread : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDThread( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    NThread* GetNThread( DThread& aObject ) const;
-    TExitType GetExitType( DThread& aObject ) const;
-    TUint32 GetSupervisorStackBase( DThread& aObject ) const;
-    TInt GetSupervisorStackSize( DThread& aObject ) const;
-    RAllocator* GetAllocator( DThread& aObject ) const;
-    CActiveScheduler* GetActiveScheduler( DThread& aObject ) const;
-    TUint32 GetUserStackBase( DThread& aObject ) const;
-    TInt GetUserStackSize( DThread& aObject ) const;
-    DProcess* GetOwningProcess( DThread& aObject ) const;
-    TUint GetId( DThread& aObject ) const;
-    MemSpyObjectIx* GetHandles( DThread& aObject ) const;
-    TUint GetOwningProcessId( DThread& aObject ) const;
-    TInt GetPriority( DThread& aObject ) const;    
-    TUint8* GetAddressOfOwningProcess( DThread& aObject ) const;    
-    void GetNameOfOwningProcess( DThread& aObject, TDes& aName ) const;
-    TBool IsHandleIndexValid( DThread& aObject ) const;
-
-private: // Internal methods
-    RAllocator* GetAllocatorAndStackAddress( DThread& aObject, TUint32& aStackAddress ) const;
-
-private: // Data members
-    TUint32 iOffset_NThread;
-    TUint32 iOffset_ExitType;
-    TUint32 iOffset_SupervisorStackBase;
-    TUint32 iOffset_SupervisorStackSize;
-    };
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDProcess : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDProcess( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TUint GetId( DProcess& aObject ) const;
-    MemSpyObjectIx* GetHandles( DProcess& aObject ) const;
-    TExitType GetExitType( DProcess& aObject ) const;
-    DThread* OpenFirstThread( DProcess& aObject ) const;
-    TUint32 GetSID( DProcess& aObject ) const;
-    TUint GetSecurityZone( DProcess& aObject ) const;
-    SSecurityInfo& GetSecurityInfo( DProcess& aObject ) const;
-    TInt GetFlags( DProcess& aObject ) const;
-    TInt GetGeneration( DProcess& aObject ) const;
-    SDblQue& GetThreadQueue( DProcess& aObject ) const;
-    DThread* GetThread( SDblQueLink* aLink ) const;
-    void SetSID( DProcess& aObject, TUint32 aSID ) const;
-    void SetSecurityZone( DProcess& aObject, TUint aSecurityZone ) const;
-    TUint GetCreatorId( DProcess& aObject ) const;
-    TInt GetAttributes( DProcess& aObject ) const;
-    TInt GetPriority( DProcess& aObject ) const;
-    TUint8* GetAddressOfOwningProcess( DProcess& aObject ) const;
-    TUint8* GetAddressOfDataBssStackChunk( DProcess& aObject ) const;
-    TBool IsHandleIndexValid( DProcess& aObject ) const;
-	TBool IsKernProcess(DProcess& aProcess) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDChunk : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDChunk( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TInt GetSize( DChunk& aObject ) const;
-    TInt GetMaxSize( DChunk& aObject ) const;
-    TUint8* GetBase( DChunk& aObject ) const;
-    DProcess* GetOwningProcess( DChunk& aObject ) const;
-    TUint GetOwningProcessId( DChunk& aObject ) const;
-    TUint GetControllingOwnerId( DChunk& aObject ) const;
-    TChunkType GetType( DChunk& aObject ) const;
-    TInt GetAttributes( DChunk& aObject ) const;
-    TUint8* GetAddressOfOwningProcess( DChunk& aObject ) const;
-    TInt GetBottom( DChunk& aObject ) const;
-    TInt GetTop( DChunk& aObject ) const;
-    TInt GetStartPos( DChunk& aObject ) const;
-    TUint GetRestrictions( DChunk& aObject ) const;
-    TUint GetMapAttr( DChunk& aObject ) const;
-    void GetNameOfOwningProcess( DChunk& aObject, TDes& aName ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDServer : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDServer( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    SDblQue& GetSessionQueue( DServer& aObject ) const;
-    DSession* GetSession( SDblQueLink* aLink ) const;
-    TInt GetSessionCount( DServer& aObject ) const;
-    DThread* GetOwningThread( DServer& aObject ) const;
-    TUint GetOwningThreadId( DServer& aObject ) const;
-    TIpcSessionType GetSessionType( DServer& aObject ) const;
-    TUint8* GetAddressOfOwningThread( DServer& aObject ) const;
-    void GetNameOfOwningThread( DServer& aObject, TDes& aName ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDSession : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDSession( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TIpcSessionType GetSessionType( DSession& aObject ) const;
-    DServer* GetServer( DSession& aObject ) const;
-    TUint8* GetAddressOfServer( DSession& aObject ) const;
-    TUint16 GetTotalAccessCount( DSession& aObject ) const;
-    TUint8 GetSrvSessionType( DSession& aObject ) const;
-    TInt GetMsgCount( DSession& aObject ) const;
-    TInt GetMsgLimit( DSession& aObject ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDCodeSeg : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDCodeSeg( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    DCodeSeg* GetCodeSeg( SDblQueLink* aLink ) const;
-    DCodeSeg* GetCodeSeg( DLibrary& aLibrary ) const;
-    DCodeSeg* GetCodeSegFromHandle( TAny* aHandle ) const;
-    TBool GetIsXIP( DCodeSeg& aCodeSeg ) const;
-    TInt GetCodeSegQueue( DProcess& aObject, SDblQue& aQueue ) const;
-    void EmptyCodeSegQueue( SDblQue& aQueue ) const;
-    TUint32 GetSize( DCodeSeg& aCodeSeg ) const;
-    void GetCreateInfo( DCodeSeg& aCodeSeg, TCodeSegCreateInfo& aInfo ) const;
-    TUint8 GetState( DLibrary& aLibrary ) const;
-    TInt GetMapCount( DLibrary& aLibrary ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDSemaphore : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDSemaphore( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TInt GetCount( DSemaphore& aObject ) const;
-    TUint8 GetResetting( DSemaphore& aObject ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDMutex : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDMutex( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TInt GetHoldCount( DMutex& aObject ) const;
-    TInt GetWaitCount( DMutex& aObject ) const;
-    TUint8 GetResetting( DMutex& aObject ) const;
-    TUint8 GetOrder( DMutex& aObject ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDLogicalDevice : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDLogicalDevice( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TInt GetOpenChannels( DLogicalDevice& aObject ) const;
-    TVersion GetVersion( DLogicalDevice& aObject ) const;
-    TUint GetParseMask( DLogicalDevice& aObject ) const;
-    TUint GetUnitsMask( DLogicalDevice& aObject ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDPhysicalDevice : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDPhysicalDevice( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TVersion GetVersion( DPhysicalDevice& aObject ) const;
-    TUint GetUnitsMask( DPhysicalDevice& aObject ) const;
-    TUint8* GetAddressOfCodeSeg( DPhysicalDevice& aObject ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDChangeNotifier : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDChangeNotifier( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TUint GetChanges( DChangeNotifier& aObject ) const;
-    TUint8* GetAddressOfOwningThread( DChangeNotifier& aObject ) const;
-    void GetNameOfOwningThread( DChangeNotifier& aObject, TDes& aName ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDUndertaker : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDUndertaker( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TUint8* GetAddressOfOwningThread( DUndertaker& aObject ) const;
-    void GetNameOfOwningThread( DUndertaker& aObject, TDes& aName ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDCondVar : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDCondVar( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TUint8 GetResetting( DCondVar& aObject ) const;
-    TUint8* GetAddressOfMutex( DCondVar& aObject ) const;
-    void GetNameOfMutex( DCondVar& aObject, TDes& aName ) const;
-    TInt GetWaitCount( DCondVar& aObject ) const;
-    SDblQue& GetSuspendedQ( DCondVar& aObject ) const;
-    DThread* GetThread( SDblQueLink* aLink ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDTimer : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDTimer( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TTimer::TTimerType GetType( DTimer& aObject ) const;
-    TTimer::TTimerState GetState( DTimer& aObject ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-class DMemSpyDriverOSAdaptionDPropertyRef : public DMemSpyDriverOSAdaptionDObject
-    {
-public:
-    DMemSpyDriverOSAdaptionDPropertyRef( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public:
-    TBool GetIsReady( DObject& aObject ) const;
-    RProperty::TType GetType( DObject& aObject ) const;
-    TUint GetCategory( DObject& aObject ) const;
-    TUint GetKey( DObject& aObject ) const;
-    TInt GetRefCount( DObject& aObject ) const;
-    TUint GetThreadId( DObject& aObject ) const;
-    TUint32 GetCreatorSID( DObject& aObject ) const;
-
-private: // Internal methods
-    DMemSpyPropertyRef* GetPropertyRef( DObject& aObject ) const;
-
-private: // Data members
-    };
-
-
-
-
-
-
-class DMemSpyDriverOSAdaption : public DBase
-	{
-public:
-    DMemSpyDriverOSAdaption( DMemSpyDriverDevice& aDevice );
-    ~DMemSpyDriverOSAdaption();
-    TInt Construct();
-
-public: // API
-    inline DMemSpyDriverDevice& Device() { return iDevice; }
-    inline DMemSpyDriverOSAdaptionDProcess& DProcess() { return *iDProcess; }
-    inline DMemSpyDriverOSAdaptionDThread& DThread() { return *iDThread; }
-    inline DMemSpyDriverOSAdaptionDChunk& DChunk() { return *iDChunk; }
-    inline DMemSpyDriverOSAdaptionDServer& DServer() { return *iDServer; }
-    inline DMemSpyDriverOSAdaptionDSession& DSession() { return *iDSession; }
-    inline DMemSpyDriverOSAdaptionDCodeSeg& DCodeSeg() { return *iDCodeSeg; }
-    inline DMemSpyDriverOSAdaptionDSemaphore& DSemaphore() { return *iDSemaphore; }
-    inline DMemSpyDriverOSAdaptionDMutex& DMutex() { return *iDMutex; }
-    inline DMemSpyDriverOSAdaptionDLogicalDevice& DLogicalDevice() { return *iDLogicalDevice; }
-    inline DMemSpyDriverOSAdaptionDPhysicalDevice& DPhysicalDevice() { return *iDPhysicalDevice; }
-    inline DMemSpyDriverOSAdaptionDChangeNotifier& DChangeNotifier() { return *iDChangeNotifier; }
-    inline DMemSpyDriverOSAdaptionDUndertaker& DUndertaker() { return *iDUndertaker; }
-    inline DMemSpyDriverOSAdaptionDCondVar& DCondVar() { return *iDCondVar; }
-    inline DMemSpyDriverOSAdaptionDTimer& DTimer() { return *iDTimer; }
-    inline DMemSpyDriverOSAdaptionDPropertyRef& DPropertyRef() { return *iDPropertyRef; }
-
-private: // Data members
-    DMemSpyDriverDevice& iDevice;
-    DMemSpyDriverOSAdaptionDThread* iDThread;
-    DMemSpyDriverOSAdaptionDProcess* iDProcess;
-    DMemSpyDriverOSAdaptionDChunk* iDChunk;
-    DMemSpyDriverOSAdaptionDServer* iDServer;
-    DMemSpyDriverOSAdaptionDSession* iDSession;
-    DMemSpyDriverOSAdaptionDCodeSeg* iDCodeSeg;
-    DMemSpyDriverOSAdaptionDSemaphore* iDSemaphore;
-    DMemSpyDriverOSAdaptionDMutex* iDMutex;
-    DMemSpyDriverOSAdaptionDLogicalDevice* iDLogicalDevice;
-    DMemSpyDriverOSAdaptionDPhysicalDevice* iDPhysicalDevice;
-    DMemSpyDriverOSAdaptionDChangeNotifier* iDChangeNotifier;
-    DMemSpyDriverOSAdaptionDUndertaker* iDUndertaker;
-    DMemSpyDriverOSAdaptionDCondVar* iDCondVar;
-    DMemSpyDriverOSAdaptionDTimer* iDTimer;
-    DMemSpyDriverOSAdaptionDPropertyRef* iDPropertyRef;
-    };
-
-
-// KNOWN OMISSIONS:
-//
-// + kernel container listing & query interface
-// + event handler (events: process, threads, code segs, chunks, ... )
-// + kernel heap information
-// + end thread / process
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverObjectIx.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +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 MEMSPYDRIVEROBJECTIX_H
-#define MEMSPYDRIVEROBJECTIX_H
-
-// System includes
-#include <kernel.h>
-#include <kern_priv.h>
-
-#if MCL_ROBJECTIX_DUPLICATION
-
-class RMemSpyObjectIx
-	{
-public:
-	enum {ENoClose=KHandleNoClose,ELocalHandle=0x40000000};
-	enum {EReserved=0x80000000u, EAttributeMask=0xfffu};
-	enum {EMinSlots=8, EMaxSlots=32768};
-public:
-	enum {ENumFreeQ=6, EModCount=4, EBitMapSize=128, EMaxLockedIter=8};
-private:
-	// queue numbers
-	enum {EQFree=-6, EQAltFree=-5, EQTempFree=-4, EQRsvd=-3, EQAltRsvd=-2, EQTempRsvd=-1};
-	// iObjR, iRsvd fields
-	enum {EObjROccupied=4u, EObjRObjMask=0xfffffffcu, EObjRRsvd=1u};
-	// states
-	enum {ENormal=0u, ETidying=1u, EFindingLast=2u, ECounting=3u, ESearching=4u, ETerminated=5u};
-	struct	SSlotQLink
-		{
-		TInt16		iNext;	// pointer to next free slot, -n if no next
-		TInt16		iPrev;	// pointer to previous free slot, -n if no previous
-		};
-	struct	SFreeSlot : public SSlotQLink
-		{
-		TUint32		iRsvd;	// 0 for normal, 1 for reserved slot
-		};
-	struct	SUsedSlot
-		{
-		TUint32		iAttr;	// bits 0-13 = instance (nonzero), bits 14-19 = object type, bits 20-31 = handle attributes
-		TUint32		iObjR;	// pointer to object (nonzero), bit 0=1 if reserved slot
-		};
-	union SSlot
-		{
-		SFreeSlot	iFree;
-		SUsedSlot	iUsed;
-		};
-	struct SMonitorObj
-		{
-		DObject*	iObj;
-		TInt		iBoundary;
-		TInt		iResult;
-		};
-	union SModList
-		{
-		TInt16		iIndex[EModCount];
-		TUint32		iBitMap[EBitMapSize/32];
-		SMonitorObj	iMonitor;
-		};
-private:
-#ifdef __HANDLES_USE_RW_SPIN_LOCK__
-// Beginning of support for spinlock-only protection (i.e. not requiring the system lock)
-// for access to handles.  Requires changes everywhere objects returned from handles are
-// used, and some additional work in the handle lookup code in cutils.cia.
-#error "spinlocks for handle lookup not supported"
-	inline void AcquireReadLock()
-		{ __SPIN_LOCK_IRQ_R(iRWL); }
-	inline void ReleaseReadLock()
-		{ __SPIN_UNLOCK_IRQ_R(iRWL); }
-	inline void AcquireWriteLock()
-		{ __SPIN_LOCK_IRQ_W(iRWL); }
-	inline void ReleaseWriteLock()
-		{ __SPIN_UNLOCK_IRQ_W(iRWL); }
-#else
-	/* Places which use a read lock would already have the system lock held */
-	inline void AcquireReadLock()
-		{ __ASSERT_SYSTEM_LOCK; }
-	inline void ReleaseReadLock()
-		{  }
-	inline void AcquireWriteLock()
-		{ NKern::LockSystem(); }
-	inline void ReleaseWriteLock()
-		{ NKern::UnlockSystem(); }
-#endif
-private:
-	static inline DObject* Occupant(SSlot* aS)
-		{ return (DObject*)(aS->iUsed.iObjR & EObjRObjMask); }
-	static inline TBool IsReserved(SSlot* aS)
-		{ return aS->iUsed.iObjR & EObjRRsvd; }
-	static inline TBool IsFreeReserved(SSlot* aS)
-		{ return (aS->iUsed.iObjR & EObjRRsvd) && (aS->iUsed.iObjR<EObjROccupied); }
-    /*
-	void Empty(TInt aQueue);
-	SSlot* Dequeue(TInt aSlotIndex);
-	void AddHead(TInt aQueue, TInt aSlotIndex);
-	void AddTail(TInt aQueue, TInt aSlotIndex);
-	void AddBefore(TInt aBase, TInt aSlotIndex);
-	void AddAfter(TInt aBase, TInt aSlotIndex);
-	void AppendList(TInt aSrcQ, TInt aDestQ);
-	void PrependList(TInt aSrcQ, TInt aDestQ);
-	TInt DoAdd(DObject* aObj, TUint32 aAttr, SSlot* aSlot);	// add aObj using an existing slot (don't grow)
-	TInt DoRemove(TInt aHandle, DObject*& aObject, TUint32& aAttr);	// remove a handle (don't shrink)
-	void MarkModified(TInt aSlotIndex);
-	static TUint32 GetNextInstanceValue();
-	TInt UnReserveSlots(TInt aCount, TBool aAmortize);
-	TInt ReserveSlots(TInt aCount);
-	TInt Grow(TInt aReserve, SSlot* aSlotData);
-	void TidyAndCompact();
-	inline SSlotQLink* Link(TInt aIndex)
-		{ return (aIndex<0) ? (iFreeQ+ENumFreeQ+aIndex) : &(iSlots+aIndex)->iFree; }
-        */
-public:
-	// common operations
-    RMemSpyObjectIx();
-
-    //static void Wait();
-	//static void Signal();
-
-    inline TInt Count()
-		{ return iCount; }
-	inline TInt ActiveCount()
-		{ return iActiveCount; }
-
-public:
-	// uncommon operations
-	DObject* operator[](TInt aIndex);
-	TBool Find(DObject* aObject);
-
-private:
-	TRWSpinLock		iRWL;
-	TInt			iAllocated;			// Max entries before realloc needed
-	volatile TInt	iCount;				// Points to at least 1 above the highest occupied slot or unoccupied reserved slot
-	volatile TInt	iActiveCount;		// Number of occupied entries in the index (reserved or normal)
-	volatile TInt	iReservedFree;		// Number of unoccupied reserved slots
-	volatile TInt	iReservedTotal;		// Number of reserved slots (occupied or unoccupied)
-	volatile TInt	iReservedFreeHWM;	// Points to at least 1 above the last unoccupied reserved slot
-	SSlotQLink		iFreeQ[ENumFreeQ];	// queues of free slots
-	SSlot*			iSlots;				// array of handle slots
-	TInt			iAmortize;			// Number of handle removals before we see if we can shrink
-	TUint8			iState;
-	TUint8			iModCount;			// 255=not in use, 0...EModCount->use iModList.iIndex[], EModCount+1->use iModList.iBitMap
-	TUint8			iModListShift;
-	TUint8			iSpare1;
-	SModList		iModList;			// Entries modified while array moving
-
-public:
-	static volatile TUint32 NextInstance;
-	static DMutex* HandleMutex;
-	};
-
-#elif MCL_DOBJECTIX_DUPLICATION
-
-class DMemSpyObjectIx : public DBase
-	{
-public:
-    inline DMemSpyObjectIx() { }
-
-public:
-	DObject* At(TInt aHandle,TInt aUniqueID);
-	DObject* At(TInt aHandle);
-	TBool Find(DObject* aObject);
-	TInt Count(DObject* aObject);
-	DObject* operator[](TInt aIndex);
-	//static void Wait( DMemSpyObjectIx* aObjectIndex );
-	//static void Signal( DMemSpyObjectIx* aObjectIndex );
-	inline TInt Count();
-	inline TInt ActiveCount();
-
-private:
-	TInt iNextInstance;
-	TInt iAllocated;		// Max entries before realloc needed
-	TInt iCount;			// Points to at least 1 above the highest active index
-	TInt iActiveCount;		// Number of actual entries in the index
-	SDObjectIxRec* iObjects;
-	TAny* iPtr;
-	TInt iFree;				// The index of the first free slot or -1.
-	TInt iUpdateDisabled;   // If >0, disables: iCount update, reorder of the free list and memory shrinking.
-
-public:
-	static DMutex* HandleMutex;
-	};
-
-inline TInt DMemSpyObjectIx::Count()
-	{return iCount;}
-
-inline TInt DMemSpyObjectIx::ActiveCount()
-	{return iActiveCount;}
-
-#endif
-
-
-
-#if MCL_ROBJECTIX_DUPLICATION
-
-    #define MemSpyObjectIx                                          RMemSpyObjectIx
-    //#define MemSpyObjectIx_Wait( IX )                               RMemSpyObjectIx::Wait()
-    //#define MemSpyObjectIx_Signal( IX )                             RMemSpyObjectIx::Signal()
-    #define MemSpyObjectIx_GetHandlePointer_Thread( DTHREAD )       reinterpret_cast< MemSpyObjectIx* >( &DTHREAD.iHandles )
-    #define MemSpyObjectIx_GetHandlePointer_Process( DPROCESS )     reinterpret_cast< MemSpyObjectIx* >( &DPROCESS.iHandles )
-
-#elif MCL_DOBJECTIX_DUPLICATION
-
-    #define MemSpyObjectIx                                          DMemSpyObjectIx
-    //#define MemSpyObjectIx_Wait( IX )                               DMemSpyObjectIx::Wait( IX )
-    //#define MemSpyObjectIx_Signal( IX )                             DMemSpyObjectIx::Signal( IX )
-    #define MemSpyObjectIx_GetHandlePointer_Thread( DTHREAD )       reinterpret_cast< MemSpyObjectIx* >( DTHREAD.iHandles )
-    #define MemSpyObjectIx_GetHandlePointer_Process( DPROCESS )     reinterpret_cast< MemSpyObjectIx* >( DPROCESS.iHandles )
-
-#else
-
-    #define MemSpyObjectIx                  DObjectIx
-    //#define MemSpyObjectIx_Wait( IX )       
-    //#define MemSpyObjectIx_Signal( IX )     
-    #define MemSpyObjectIx_IsValid_Thread( DTHREAD )    ( DTHREAD.iHandles != NULL )
-    #define MemSpyObjectIx_IsValid_Process( DPROCESS )  ( DPROCESS.iHandles != NULL )
-    #define MemSpyObjectIx_GetHandlePointer_Thread( DTHREAD )       reinterpret_cast< MemSpyObjectIx* >( DTHREAD.iHandles )
-    #define MemSpyObjectIx_GetHandlePointer_Process( DPROCESS )     reinterpret_cast< MemSpyObjectIx* >( DPROCESS.iHandles )
-
-#endif
-
-#define MemSpyObjectIx_HandleLookupLock()							NKern::LockSystem()
-#define MemSpyObjectIx_HandleLookupUnlock()							NKern::UnlockSystem()
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverPAndS.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +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 MEMSPYDRIVERPANDS_H
-#define MEMSPYDRIVERPANDS_H
-
-// System includes
-#include <e32property.h>
-#include <kernel.h>
-#include <kern_priv.h>
-#include <sproperty.h>
-
-// User includes
-#include "MemSpyDriverLog.h"
-#include <memspy/driver/memspydriverpanics.h>
-
-
-/** 
- * Spoof TProperty, the kernel-side object that encapsulates all P&S keys
- */
-class TMemSpyProperty 
-	{
-public:
-	// The property attributes.
-	// Meaningful for defined properties only (ie. iType != RProperty::ETypeLimit)
-	// Constant while the property is defined
-	inline TUint32 Owner() { return iOwner; }
-
-public:
-	const TUint		iCategory;
-	const TUint		iKey;
-
-public:
-	// iType == RProperty::ETypeLimit means not defined
-	TUint8	iType;	// updates require the system lock AND the feature lock 
-					// reads require only one of them
-	// The property attributes.
-	// Meaningful for defined properties only (ie. iType != RProperty::ETypeLimit)
-	// Constant while the property is defined
-	TUint8	iAttr;
-	TCompiledSecurityPolicy iReadPolicy;
-	TCompiledSecurityPolicy iWritePolicy;
-	TUint32	iOwner;
-
-	TUint		iRefCount;	// protected by the feature lock
-	TProperty*	iNext;		// hash table collision list link -
-							//		protected by the feature lock
-
-	class TBuf
-		{ // Viraiable-size buffer for  byte array property values
-	public:
-		static TBuf* New(TInt aSize);
-
-		TUint16	iBufSize;		// buffer size - constant
-		TUint16	iSize;			// actual property size - protected by the system lock
-		TUint8	iBytes[1];		// byte array - protected by the system lock
-		};
-
-	// The property value
-	// Meaningful for defined properties only (ie. iType != RProperty::ETypeLimit)
-	union	// the value (ie. iValue or iBuf->iBytes) is protected by the system lock
-		{ 
-		TBuf*	iBuf;   // pointer updates of a defined property (eg. buffer 
-						//   reallocation) require the system AND the feature locks;
-						// pointer reads (eg to get/set byte values) require any of them
-		TInt	iValue;
-		};
-
-	// Called with system or feature locked
-	TInt Size()
-		{
-		return iBuf ? iBuf->iSize : 0;
-		}
-
-	// Called with system or feature locked
-	TUint8* Buf()
-		{
-		return iBuf ? iBuf->iBytes : NULL;
-		}
-
-	SDblQue	iPendingQue;	// pending subscriptions - protected by the system lock
-	};
-
-
-
-/**
- * Spoof of DPropertyRef - the kernel-side object that represents user-side P&S property keys
- */
-class DMemSpyPropertyRef : public DObject
-	{
-public:
-	TMemSpyProperty*		iProp;
-	TRequestStatus*			iStatus;
-	DThread*				iClient;
-	TPropertySubsRequest	iSubs;
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverStreamWriter.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +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 MEMSPYDRIVERSTREAMWRITER_H
-#define MEMSPYDRIVERSTREAMWRITER_H
-
-// System includes
-#include <e32cmn.h>
-#include <kernel.h>
-
-// Classes referenced
-class DMemSpyDriverXferBuffer;
-
-
-class RMemSpyMemStreamWriter
-    {
-public:
-    RMemSpyMemStreamWriter();
-    RMemSpyMemStreamWriter( DMemSpyDriverXferBuffer& aBuffer );
-
-public: // API - closure
-    void Close();
-    TInt WriteAndClose( TDes8* aDestinationPointer );
-
-public: // API - writing
-    TInt32* WriteInt32( TInt32 aValue );
-    TUint32* WriteUint32( TUint32 aValue );
-
-public: // API - positioning
-    TUint8* Current() const;
-    void Seek( TInt aPosition );
-    TUint32 Remaining() const;
-
-public: // API - marking
-    void MarkSet();
-    void MarkResume();
-
-public: // API - misc
-    TBool IsFull() const;
-    TBool IsOpen() const;
-
-public: // API - operators
-    RMemSpyMemStreamWriter& operator=( const RMemSpyMemStreamWriter& aCopy );
-
-private: // Internal methods
-    void IncrementPos( TInt aAmount );
-
-private:
-    DMemSpyDriverXferBuffer* iBuffer;
-    TUint8* iCurrent;
-    TUint8* iMax;
-    TUint8* iMark;
-    TInt iCommitted;
-    };
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverSuspensionManager.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +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 MEMSPYDRIVERSUSPENSIONMANAGER_H
-#define MEMSPYDRIVERSUSPENSIONMANAGER_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// Classes referenced
-class DMemSpyDriverDevice;
-
-
-class DMemSpySuspensionManager : public DBase
-	{
-public: // Construct & destruct
-	DMemSpySuspensionManager( DMemSpyDriverDevice& aDevice );
-	~DMemSpySuspensionManager();
-	TInt Construct();
-
-public: // API
-    TBool IsSuspended( TUint aPid ) const;
-    TBool IsSuspended( DThread& aThread ) const;
-    TBool IsSuspended( DProcess& aProcess ) const;
-    TInt SuspendAllThreadsInProcess( TUint aPid, DThread& aClientThread );
-    TInt ResumeAllThreadsInProcess( TUint aPid, DThread& aClientThread );
-
-private: // Internal methods
-    TInt DoSuspendAllThreadsInProcess( TUint aPid, DThread* aClientThread = NULL );
-    TInt DoResumeAllThreadsInProcess( TUint aPid, DThread* aClientThread = NULL );
-    TBool IsProcessTheClientThread( TUint aPid, DThread& aClientThread ) const;
-    TBool CheckProcessSuspended( TUint aExpectedPid, DThread& aClientThread ) const;
-	TInt OpenTempObject(TUint aId, TObjectType aType );
-	void CloseTempObject();
-
-private: // Data members
-    DMemSpyDriverDevice& iDevice;
-	DObject* iTempObj;
-    TBool iAlreadySuspended;
-	TUint iSuspendedProcessId;
-	TInt iSuspendCount;
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverUserEventMonitor.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +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 MEMSPYDRIVERUSEREVENTMONITOR_H
-#define MEMSPYDRIVERUSEREVENTMONITOR_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-#ifdef __MARM__
-#include <arm.h>
-#endif
-
-// User includes
-#include "MemSpyDriverEventMonitor.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class DMemSpyDriverClientEM;
-
-
-class DMemSpyDriverClientEMManager : public DBase
-    {
-public:
-    DMemSpyDriverClientEMManager( DMemSpyDriverDevice& aDevice );
-    ~DMemSpyDriverClientEMManager();
-    TInt Create();
-    
-public: // API
-    DMemSpyDriverClientEM* EMOpen();
-    TInt EMClose( TUint aHandle );
-    DMemSpyDriverClientEM* EMInstance( TUint aHandle );
-
-private: // Internal methods
-    void FreeAllInstances();
-
-private:
-    DMemSpyDriverDevice& iDevice;
-    TUint iNextHandle;
-	SDblQue iEMInstances;
-    };
-
-
-/**
- * This class represents a client-originated Event Monitor request
- */
-class DMemSpyDriverClientEM : public DBase, public MMemSpyEventMonitorObserver
-	{
-public:
-	DMemSpyDriverClientEM( DMemSpyDriverDevice& aDevice, TUint aHandle );
-	~DMemSpyDriverClientEM();
-    TInt Create();
-
-public: // API
-    inline TUint Handle() const { return iHandle; }
-    //
-	TInt NotifyChanges( DThread* aClientThread, TRequestStatus* aClientRS, TAny* aClientContext );
-	TInt NotifyChangesCancel();
-
-public: // From MMemSpyEventMonitorObserver
-    TUint EMTypeMask() const;
-    void EMHandleProcessAdd( DProcess& aProcess );
-    void EMHandleProcessRemoved( DProcess& aProcess );
-    void EMHandleThreadAdd( DThread& aThread );
-    void EMHandleThreadKilled( DThread& aThread );
-    void EMHandleChunkAdd( DChunk& aChunk );
-    void EMHandleChunkDeleted( DChunk& aChunk );
-
-private: // Internal methods
-    void ResetPendingChanges();
-    void CompleteClientsRequest( TInt aCompletionCode, TUint aContext = 0 );
-
-private: // Internal objects
-
-    class TChange
-        {
-    public:
-        inline TChange( TInt aCompletionCode, TUint aContext )
-        :   iCompletionCode( aCompletionCode ), iContext( aContext )
-            {
-            }
-
-    public: // Data members
-        TInt iCompletionCode;
-    	TUint iContext;
-    	SDblQueLink iLink;
-        };
-
-private:
-    DMemSpyDriverDevice& iDevice;
-	DMutex* iLock;
-    const TUint iHandle;
-	SDblQue iPendingChanges;
-
-    // Transient: client-originated
-    DThread* iClientThread;
-    TRequestStatus* iClientRS;
-    TAny* iClientContext;
-
-public:
-    SDblQueLink iLink;
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverUtils.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +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 MEMSPYDRIVERUTILS_H
-#define MEMSPYDRIVERUTILS_H
-
-// System includes
-#include <kernel.h>
-#include <memspy/driver/memspydriverpanics.h>
-
-// User includes
-#include "MemSpyDriverLog.h"
-
-// Classes referenced
-class TMemSpyDriverRegSet;
-class DMemSpyDriverOSAdaption;
-
-
-class MemSpyDriverUtils
-	{
-public:
-    static void DataDump( const char* aFmt, const TUint8* aAddress, TInt aLength, TInt aMaxLength);
-    static void PanicThread( DThread& aThread, TMemSpyDriverPanic aPanicType );
-    static void Fault( TInt aReason );
-    static void GetThreadRegisters( NThread* aThread, TMemSpyDriverRegSet& aInfo );
-    static TThreadPriority MapToUserThreadPriority( TInt aPriority );
-    static TInt MapToAbsoluteThreadPriority( TThreadPriority aPriority );
-    static void PrintChunkInfo( DChunk& aChunk, DMemSpyDriverOSAdaption& aOSAdaption );
-    };
-
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/MemSpyDriverXferBuffer.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +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 MEMSPYDRIVERXFERBUFFER_H
-#define MEMSPYDRIVERXFERBUFFER_H
-
-// System includes
-#include <e32cmn.h>
-#include <kernel.h>
-
-// Classes referenced
-class DMemSpyDriverDevice;
-
-
-class DMemSpyDriverXferBuffer : public DBase
-	{
-    friend class RMemSpyMemStreamWriter;
-
-public:
-	DMemSpyDriverXferBuffer( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverXferBuffer();
-    TInt Construct( TInt aSize );
-
-public: // API
-    TInt Size() const;
-    TInt GrowBy( TInt aSize );
-    TInt EnsureCapacity( TInt aSize );
-    void Reset();
-
-private: // Internal methods
-    TInt WriteToClient( TDes8* aDestinationPointer, TInt aLength );
-    DThread& ClientThread();
-    TUint8* Ptr();
-
-private: // Data members
-    DMemSpyDriverDevice& iDevice;
-	DThread& iClientThread;
-    TInt iSize;
-    TAny* iBuffer;
-	};
-
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanBase.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +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 MEMSPYDRIVERLOGCHANBASE_H
-#define MEMSPYDRIVERLOGCHANBASE_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-#ifdef __MARM__
-#include <arm.h>
-#endif
-
-// User includes
-#include "MemSpyDriverStreamWriter.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class DMemSpyDriverXferBuffer;
-class DMemSpyDriverOSAdaption;
-class DMemSpySuspensionManager;
-
-class DMemSpyDriverLogChanBase : public DBase
-	{
-public:
-	~DMemSpyDriverLogChanBase();
-
-protected: // Internal construction
-	DMemSpyDriverLogChanBase( DMemSpyDriverDevice& aDevice, DThread& aThread );
-    TInt BaseConstruct( TInt aTransferBufferSize = 0 );
-
-public: // API
-    /**
-     * Finish construction of the channel object
-     */
-    virtual TInt Construct();
-
-    /**
-     * Request a channel function - this function implementation (in this class)
-     * is able to perform general policing, e.g. SID, capability etc.
-     *
-     * Currently this always returns KErrNone, but none the less, derived classes
-     * should call this implementation and handle return value appropriately.
-     */
-    virtual TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-
-    /**
-     * Sub channel should return ETrue if it can handle the specified function
-     * request.
-     */
-    virtual TBool IsHandler( TInt aFunction ) const = 0;
-
-protected: // Internal access
-    DMemSpyDriverDevice& MemSpyDevice();
-    DMemSpySuspensionManager& SuspensionManager();
-
-protected: // Internal methods
-	TInt OpenTempObject( TUint aId, TObjectType aType, TBool aAllowDeadObjects = EFalse );
-	void CloseTempObject();
-    DThread& TempObjectAsThread();
-    DProcess& TempObjectAsProcess();
-
-protected: // Transfer buffer
-    RMemSpyMemStreamWriter OpenXferStream();
-    TInt OpenXferStream( RMemSpyMemStreamWriter& aWriter, TInt aRequiredSize );
-
-protected: // Internal access
-    DMemSpyDriverOSAdaption& OSAdaption();
-    inline DObject* TempObject() { return iTempObj; }
-    inline const DObject* TempObject() const { return iTempObj; }
-    //
-    inline DThread& ClientThread() { return iClientThread; }
-
-private: // Data members
-    DMemSpyDriverDevice& iDevice;
-	DThread& iClientThread;
-	DObject* iTempObj;
-    DMemSpyDriverXferBuffer* iXferBuffer;
-	};
-
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanChunks.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +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 MEMSPYDRIVERLOGICALCHANCHUNKS_H
-#define MEMSPYDRIVERLOGICALCHANCHUNKS_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include "MemSpyDriverLogChanBase.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class TMemSpyDriverInternalChunkInfoParams;
-class TMemSpyDriverInternalChunkHandleParams;
-
-
-class DMemSpyDriverLogChanChunks : public DMemSpyDriverLogChanBase
-	{
-public:
-	DMemSpyDriverLogChanChunks( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanChunks();
-
-public: // From DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt GetChunkInfo( TMemSpyDriverInternalChunkInfoParams* aParams );
-    TInt GetChunkHandles( TMemSpyDriverInternalChunkHandleParams* aParams );
-
-private: // Internal methods
-    void PrintChunkInfo( DChunk& aChunk );
-    TMemSpyDriverChunkType IdentifyChunkType( DChunk& aChunk );
-    TBool IsHeapChunk( DChunk& aChunk, const TName& aName );
-    TBool DoesChunkRelateToProcess( DChunk& aChunk, DProcess& aProcess );
-
-private: // Data members
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanClientServer.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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 MEMSPYDRIVERLOGICALCHANCLIENTSERVER_H
-#define MEMSPYDRIVERLOGICALCHANCLIENTSERVER_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverLogChanContainerBase.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class TMemSpyDriverServerSessionInfo;
-class TMemSpyDriverInternalServerSessionHandleParams;
-
-
-
-class DMemSpyDriverLogChanClientServer : public DMemSpyDriverLogChanContainerBase
-	{
-public:
-	DMemSpyDriverLogChanClientServer( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanClientServer();
-
-public: // From DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt GetServerSessionHandles( TMemSpyDriverInternalServerSessionHandleParams* aParams );
-    TInt GetServerSessionInfo( TAny* aSessionHandle, TMemSpyDriverServerSessionInfo* aParams );
-
-private: // Internal methods
-
-private: // Data members
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanCodeSegs.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +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 MEMSPYDRIVERLOGICALCHANCODESEGS_H
-#define MEMSPYDRIVERLOGICALCHANCODESEGS_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverLogChanBase.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class TMemSpyDriverInternalCodeSegParams;
-class TMemSpyDriverInternalCodeSnapshotParams;
-
-
-class DMemSpyDriverLogChanCodeSegs : public DMemSpyDriverLogChanBase
-	{
-public:
-	DMemSpyDriverLogChanCodeSegs( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanCodeSegs();
-
-public: // From DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt GetCodeSegs( TMemSpyDriverInternalCodeSnapshotParams* aParams );
-	TInt GetCodeSegsForProcess( TMemSpyDriverInternalCodeSnapshotParams* aParams );
-	TInt GetCodeSegInfo( TMemSpyDriverInternalCodeSegParams* aParams );
-
-private: // Data members
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanContainerBase.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +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 MEMSPYDRIVERLOGICALCHANCONTAINERBASE_H
-#define MEMSPYDRIVERLOGICALCHANCONTAINERBASE_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverLogChanBase.h"
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// Classes referenced
-class DMemSpyDriverDevice;
-
-// Constants
-const TInt KMemSpyDriverMaxHandles = 1024 * 2;
-
-
-class DMemSpyDriverLogChanContainerBase : public DMemSpyDriverLogChanBase
-	{
-public:
-	DMemSpyDriverLogChanContainerBase( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanContainerBase();
-
-protected: // Internal methods
-    static TObjectType ObjectTypeFromMemSpyContainerType( TMemSpyDriverContainerType aType );
-
-	// Must be in critical section to call
-	DObject* CheckedOpen(TMemSpyDriverContainerType aContainerType, DObject* aObject, TBool aQuick=EFalse);
-
-protected: // Internal methods
-    void ResetTempHandles();
-    void AddTempHandle( TAny* aHandle);
-    TAny* TempHandleAt( TInt aIndex ) const;
-    TInt TempHandleCount() const;
-    TInt WriteToClient( TAny** aHandlePtr, TInt* aCountPtr, TInt aMaxCount );
-
-private: // Data members
-	TInt iTempHandleCount;
-	TAny* iTempHandles[ KMemSpyDriverMaxHandles ];
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanContainers.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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 MEMSPYDRIVERLOGICALCHANCONTAINERS_H
-#define MEMSPYDRIVERLOGICALCHANCONTAINERS_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverLogChanContainerBase.h"
-
-// Classes referenced
-class TMemSpyDriverPAndSInfo;
-class DMemSpyDriverDevice;
-class TMemSpyDriverHandleInfoGeneric;
-class TMemSpyDriverInternalContainerHandleParams;
-class TMemSpyDriverInternalRefsToThreadOrProcess;
-class TMemSpyDriverInternalCondVarSuspendedThreadParams;
-class TMemSpyDriverCondVarSuspendedThreadInfo;
-
-
-class DMemSpyDriverLogChanContainers : public DMemSpyDriverLogChanContainerBase
-	{
-public:
-	DMemSpyDriverLogChanContainers( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanContainers();
-    TInt Construct();
-
-public: // From DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt GetContainerHandles( TMemSpyDriverInternalContainerHandleParams* aParams );
-    TInt GetKernelObjectSizeApproximation( TMemSpyDriverContainerType aType, TInt* aSize );
-    TInt GetGenericHandleInfo( TInt aTid, TMemSpyDriverHandleInfoGeneric* aParams );
-    TInt GetReferencesToMyThread( TUint aTid, TDes8* aBufferSink );
-    TInt GetReferencesToMyProcess( TUint aTid, TDes8* aBufferSink );
-    TInt GetPAndSInfo( DObject* aHandle, TMemSpyDriverPAndSInfo* aInfo );
-    TInt GetCondVarSuspendedThreads( TMemSpyDriverInternalCondVarSuspendedThreadParams* aParams );
-    TInt GetCondVarSuspendedThreadInfo( TAny* aThreadHandle, TMemSpyDriverCondVarSuspendedThreadInfo* aParams );
-
-    
-private: // Internal methods
-    TInt SearchThreadsFor( DObject* aHandleToLookFor, RMemSpyMemStreamWriter& aStream );
-    TInt SearchProcessFor( DObject* aHandleToLookFor, RMemSpyMemStreamWriter& aStream );
-    static TMemSpyDriverTimerState MapToMemSpyTimerState( TTimer::TTimerState aState );
-    static TMemSpyDriverTimerType MapToMemSpyTimerType( TTimer::TTimerType aType );
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapBase.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +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 MEMSPYDRIVERLOGICALCHANHEAPBASE_H
-#define MEMSPYDRIVERLOGICALCHANHEAPBASE_H
-
-// System includes
-#include <kern_priv.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverLogChanBase.h"
-#include "MemSpyDriverObjectsInternal.h"
-#include "MemSpyDriverHeapWalker.h"
-#include "MemSpyDriverEnumerationsInternal.h"
-
-// Classes referenced
-class TMemSpyHeapInfo;
-class DMemSpyDriverDevice;
-class RMemSpyDriverRHeapUser;
-class RMemSpyMemStreamWriter;
-class RMemSpyDriverRHeapKernelInPlace;
-class RMemSpyDriverRHeapKernelFromCopy;
-
-
-class DMemSpyDriverLogChanHeapBase : public DMemSpyDriverLogChanBase, public MMemSpyHeapWalkerObserver
-	{
-public:
-    enum TDrmMatchType
-        {
-        EMatchTypeNone = 0,
-        EMatchTypeName,
-        EMatchTypeUid
-        };
-public:
-	~DMemSpyDriverLogChanHeapBase();
-
-protected:
-	DMemSpyDriverLogChanHeapBase( DMemSpyDriverDevice& aDevice, DThread& aThread );
-    TInt Construct();
-
-protected: // From DMemSpyDriverLogChanBase
-    TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-
-protected: // Capability checks for heap access
-    TDrmMatchType IsDrmThread( DThread& aThread );
-
-protected: // From MHeapWalkerObserver
-    void HandleHeapWalkInit();
-    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
-
-    // Points to stack-based object whilst walking in progress
-    RMemSpyMemStreamWriter* iStackStream;
-    TInt iFreeCellCount;
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapData.h	Fri Aug 27 11:37:29 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
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapInfo.h	Fri Aug 27 11:37:29 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/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapWalk.h	Fri Aug 27 11:37:29 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
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanMisc.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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 MEMSPYDRIVERLOGICALCHANMISC_H
-#define MEMSPYDRIVERLOGICALCHANMISC_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverLogChanBase.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-
-
-class DMemSpyDriverLogChanMisc : public DMemSpyDriverLogChanBase
-	{
-public:
-	DMemSpyDriverLogChanMisc( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanMisc();
-
-public: // From DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt SetRHeapVTable( TAny* aRHeapVTable );
-    TInt GetMemoryModelType();
-    TInt GetRoundToPageSize( TUint32* aValue );
-    TInt Impersonate( TUint32 aValue );
-
-private: // Data members
-    TUint32 iSID;
-    TUint32 iSecurityZone;
-    TBool iClientIsMemSpy;
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanProcessInspection.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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 MEMSPYDRIVERLOGICALCHANPROCESSINSPECTION_H
-#define MEMSPYDRIVERLOGICALCHANPROCESSINSPECTION_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverLogChanBase.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class TMemSpyDriverProcessInspectionInfo;
-
-
-class DMemSpyDriverLogChanProcessInspection : public DMemSpyDriverLogChanBase
-	{
-public:
-	DMemSpyDriverLogChanProcessInspection( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanProcessInspection();
-
-public: // From DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt ProcessInspectionOpen( TUint aPid );
-    TInt ProcessInspectionClose( TUint aPid );
-    TInt ProcessInspectionRequestChanges( TRequestStatus* aStatus, TMemSpyDriverProcessInspectionInfo* aInfo );
-    TInt ProcessInspectionRequestChangesCancel( TUint aPid );
-    TInt ProcessInspectionAutoStartItemsClear();
-    TInt ProcessInspectionAutoStartItemsAdd( TUint aSID );
-
-private: // Data members
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanRawMemory.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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 MEMSPYDRIVERLOGICALCHANRAWMEMORY_H
-#define MEMSPYDRIVERLOGICALCHANRAWMEMORY_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverLogChanBase.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class TMemSpyDriverInternalReadMemParams;
-
-
-class DMemSpyDriverLogChanRawMemory : public DMemSpyDriverLogChanBase
-	{
-public:
-	DMemSpyDriverLogChanRawMemory( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanRawMemory();
-
-public: // From DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-	TInt ReadMem( TMemSpyDriverInternalReadMemParams* aParams );
-
-private: // Data members
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanStack.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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 MEMSPYDRIVERLOGICALCHANSTACK_H
-#define MEMSPYDRIVERLOGICALCHANSTACK_H
-
-// System includes
-#include <e32cmn.h>
-#include <kernel.h>
-
-// Shared includes
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include "MemSpyDriverLogChanBase.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class TMemSpyDriverStackInfo;
-class TMemSpyDriverInternalStackDataParams;
-
-
-
-class DMemSpyDriverLogChanStack : public DMemSpyDriverLogChanBase
-	{
-public:
-	DMemSpyDriverLogChanStack( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanStack();
-
-public: // From DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt GetStackData( TMemSpyDriverInternalStackDataParams* aParams );
-    TInt GetStackInfo( TUint aTid, TMemSpyDriverStackInfo* aParams );
-
-private: // Internal methods
-    void GetStackPointers( DThread* aThread, TUint& aSupSP, TUint& aUsrSP );
-    TInt GetStackHighWatermark( DThread& aThread, TLinAddr& aHighWaterMark, TMemSpyDriverDomainType aDomain, TUint aRune );
-    TInt ReadStackData( DThread& aThread, TDes8& aDestination, TUint8*& aReadAddress, TMemSpyDriverDomainType aDomain );
-    TLinAddr GetStackPointerByDomain( DThread* aThread, TMemSpyDriverDomainType aDomainType );
-
-private: // Data members
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanThreadAndProcess.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +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 MEMSPYDRIVERLOGICALCHANTHREADANDPROCESS_H
-#define MEMSPYDRIVERLOGICALCHANTHREADANDPROCESS_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverLogChanBase.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class TMemSpyDriverProcessInfo;
-class TMemSpyDriverInternalThreadInfoParams;
-
-
-class DMemSpyDriverLogChanThreadAndProcess : public DMemSpyDriverLogChanBase
-	{
-public:
-	DMemSpyDriverLogChanThreadAndProcess( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanThreadAndProcess();
-    TInt Construct();
-
-public: // From DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-	TInt GetInfoThread(TUint aTid, TMemSpyDriverInternalThreadInfoParams* aParams );
-	TInt GetInfoProcess(TUint aTid, TMemSpyDriverProcessInfo* aParams );
-    TInt EndThread( TUint aId, TExitType aType );
-    TInt OpenThread( TUint aId );
-    TInt OpenProcess( TUint aId );
-    TInt SuspendAllThreadsInProcess( TUint aPid );
-    TInt ResumeAllThreadsInProcess( TUint aPid );
-    TInt GetThreadsForProcess( TUint aPid, TDes8* aBufferSink );
-    TInt SetPriority( TUint aTid, TThreadPriority aPriority );
-
-private: // Internal methods
-    static TInt MapToMemSpyExitReason( TExitType aType );
-
-private: // Data members
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanUserEventMonitor.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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 MEMSPYDRIVERLOGICALCHANUSEREVENTMONITOR_H
-#define MEMSPYDRIVERLOGICALCHANUSEREVENTMONITOR_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverLogChanBase.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class DMemSpyDriverClientEMManager;
-class TMemSpyDriverInternalEventMonitorParams;
-
-
-class DMemSpyDriverLogChanUserEventMonitor : public DMemSpyDriverLogChanBase
-	{
-public:
-	DMemSpyDriverLogChanUserEventMonitor( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanUserEventMonitor();
-
-public: // From DMemSpyDriverLogChanBase
-    TInt Construct();
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt EventMonitorOpen( TAny* aHandle );
-    TInt EventMonitorClose( TUint aHandle );
-    TInt EventMonitorNotify( TMemSpyDriverInternalEventMonitorParams* aParams );
-    TInt EventMonitorNotifyCancel( TUint aHandle );
-
-private: // Data members
-    DMemSpyDriverClientEMManager* iEventMonitorManager;
-	};
-
-
-#endif
--- a/memspy/Driver/Kernel/Source/MemSpyDriverDevice.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +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 "MemSpyDriverDevice.h"
-
-// System includes
-#include <memspy/driver/memspydriverconstants.h>
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverOSAdaption.h"
-#include "MemSpyDriverEventMonitor.h"
-#include "MemSpyDriverLogicalChannel.h"
-#include "MemSpyDriverSuspensionManager.h"
-#include "MemSpyDriverInspectedProcessManager.h"
-
-
-
-DMemSpyDriverDevice::DMemSpyDriverDevice()
-	{
-	iVersion = KMemSpyDriverVersion();
-	}
-
-
-DMemSpyDriverDevice::~DMemSpyDriverDevice()
-    {
-	TRACE( Kern::Printf("DMemSpyDriverDevice::~DMemSpyDriverDevice() - START"));
-
-    Cleanup();
-    
-    TRACE( Kern::Printf("DMemSpyDriverDevice::~DMemSpyDriverDevice() - END"));
-    }
-
-
-TInt DMemSpyDriverDevice::Install()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - START"));
-    TInt error = KErrNone;
-    //
-	TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - creating event monitor..."));
-	iEventMonitor = new DMemSpyEventMonitor();
-	//
-	if	( iEventMonitor != NULL )
-    	{
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - constructing event monitor..."));
-		error = iEventMonitor->Create( this );
-		//
-		if	( error == KErrNone )
-			{
-	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - starting event monitor..."));
-			error = iEventMonitor->Start();
-			//
-			if	( error == KErrNone )
-				{
-	            TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - creating process manager..."));
-                iProcessManager = new DMemSpyInspectedProcessManager();
-                //
-                if  ( iProcessManager != NULL )
-                    {
-	                TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - constructing process manager..."));
-                    error = iProcessManager->Create( this );
-                    //
-                    if  ( error == KErrNone )
-                        {
-	                    TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - creating process manager..."));
-                        iSuspensionManager = new DMemSpySuspensionManager( *this );
-                        //
-                        if  ( iSuspensionManager != NULL )
-                            {
-	                        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - constructing process manager..."));
-                            error = iSuspensionManager->Construct();
-                            //
-                            if  ( error == KErrNone )
-                                {
-	                            TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - creating os adaption..."));
-                                iOSAdaption = new DMemSpyDriverOSAdaption( *this );
-                                //
-                                if  ( iOSAdaption != NULL )
-                                    {
-	                                TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - constructing os adaption..."));
-                                    error = iOSAdaption->Construct();
-                                    //
-                                    if  ( error == KErrNone )
-                                        {
-                                        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - setting name..."));
-				                        error = SetName( &KMemSpyDriverDeviceName );
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-				}
-			}
-        }
-    
-    // Handle errors
-    if  ( error != KErrNone )
-        {
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - error: %d", error ));
-        if  ( iProcessManager )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - closing PM" ));
-            iProcessManager->Close( NULL );
-            iProcessManager = NULL;
-            }
-        if  ( iEventMonitor )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - stopping EM" ));
-            iEventMonitor->Stop();
-	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - closing EM" ));
-            iEventMonitor->Close();
-	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - deleting EM" ));
-            iEventMonitor = NULL;
-            }
-        if  ( iSuspensionManager )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - deleting SM" ));
-            delete iSuspensionManager;
-            iSuspensionManager = NULL;
-            }
-        }
-    //
-	TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - END - error: %d", error ));
-	return error;
-	}
-
-
-void DMemSpyDriverDevice::GetCaps( TDes8& /*aDes*/ ) const
-	{
-	}
-
-
-TInt DMemSpyDriverDevice::Create( DLogicalChannelBase*& aChannel )
-	{
-    TRACE( Kern::Printf("DMemSpyDriverDevice::Create() - START"));
-    TInt r = KErrNoMemory;
-    //
-	aChannel = new DMemSpyDriverLogicalChannel;
-    //
-    if  ( aChannel )
-        {
-        if  ( iProcessManager == NULL && iEventMonitor == NULL && iSuspensionManager == NULL )
-            {
-            TRACE( Kern::Printf("DMemSpyDriverDevice::Create() - need to re-create objects, calling Install()"));
-            r = Install();
-            TRACE( Kern::Printf("DMemSpyDriverDevice::Create() - called Install()"));
-            }
-        else
-            {
-            r = KErrNone;
-            }
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverDevice::Create() - END - r: %d", r ));
-	return r;
-	}
-
-
-void DMemSpyDriverDevice::Cleanup()
-    {
-
-    NKern::ThreadEnterCS();
-    if  ( iProcessManager )
-        {
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - destroying process manager..."));
-        iProcessManager->Close( NULL );
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - process manager destroyed"));
-        iProcessManager = NULL;
-        }
-    
-    if  ( iEventMonitor )
-        {
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - destroying event monitor..."));
-        iEventMonitor->Stop();
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - stopped event monitor..."));
-        iEventMonitor->Close();
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - closed event monitor..."));
-        iEventMonitor = NULL;
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - event monitor destroyed"));
-        }
-    
-    if  ( iSuspensionManager )
-        {
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - destroying suspension manager..."));
-        delete iSuspensionManager;
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - suspension manager destroyed"));
-        iSuspensionManager = NULL;
-        }
-
-    if  ( iOSAdaption )
-        {
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - destroying os adaption..."));
-        delete iOSAdaption;
-	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - suspension os adaption destroyed"));
-        iOSAdaption = NULL;
-        }
-
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - END"));
-    }
-
-
-
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverEntryPoint.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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 "MemSpyDriverDevice.h"
-
-// System includes
-#include <kernel.h>
-
-DECLARE_STANDARD_LDD()
-	{
-	return new DMemSpyDriverDevice();
-	}
--- a/memspy/Driver/Kernel/Source/MemSpyDriverEventMonitor.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,450 +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 "MemSpyDriverEventMonitor.h"
-
-// System includes
-#include <kern_priv.h>
-#include <nk_trace.h>
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-
-#ifdef __MARM__
-#include "kdebug.h"
-#endif //__MARM__
-
-_LIT( KMemSpyEventMonitorMutexName, "MemSpyEventMonitor");
-
-
-DMemSpyEventMonitor::DMemSpyEventMonitor()
-:	DKernelEventHandler( EventHandler, this )
-	{
-	}
-
-
-DMemSpyEventMonitor::~DMemSpyEventMonitor()
-	{
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::~DMemSpyEventMonitor() - START" ));
-
-	if  ( iLock )
-		{
-        TRACE_EM( Kern::Printf("DMemSpyEventMonitor::~DMemSpyEventMonitor() - closing iLock mutex" ));
-		iLock->Close(NULL);
-		}
-
-	if  ( iDevice )
-		{
-        TRACE_EM( Kern::Printf("DMemSpyEventMonitor::~DMemSpyEventMonitor() - closing iDevice" ));
-		iDevice->Close(NULL);
-		}
-
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::~DMemSpyEventMonitor() - END" ));
-	}
-
-
-TInt DMemSpyEventMonitor::Create( DMemSpyDriverDevice* aDevice )
-	{
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Create() - START - aDevice: 0x%08x", aDevice ));
-    TInt err = aDevice->Open();
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Create() - device open err: %d", err ));
-    //
-    if (err == KErrNone )
-	    {
-        iDevice = aDevice;
-        //
-        err = Kern::MutexCreate( iLock, KMemSpyEventMonitorMutexName, KMutexOrdNone );
-        TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Create() - mutex create error: %d", err ));
-        //
-        if (!err)
-	        {
-	        err = Add();
-	        }
-        }
-    //	
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Create() - END - err: %d", err ));
-	return err;
-	}
-
-
-TInt DMemSpyEventMonitor::Start()
-	{
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Start() - START"));
-
-	NKern::ThreadEnterCS();
-	Kern::MutexWait( *iLock );
-
-    iTracking = ETrue;
-
-	Kern::MutexSignal( *iLock );
-	NKern::ThreadLeaveCS();
-
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Start() - END") );
-	return KErrNone;
-	}
-
-
-TInt DMemSpyEventMonitor::Stop()
-	{
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Stop() - START") );
-
-    NKern::ThreadEnterCS();
-	Kern::MutexWait( *iLock );
-
-	iTracking = EFalse;
-
-	Kern::MutexSignal( *iLock );
-	NKern::ThreadLeaveCS();
-
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Stop() - END") );
-    return KErrNone;
-    }
-    
-    
-TInt DMemSpyEventMonitor::RequestEvents( MMemSpyEventMonitorObserver& aObserver )
-    {
-    NKern::ThreadEnterCS();
-	Kern::MutexWait( *iLock );
-
-    TInt error = KErrAlreadyExists;
-    //
-    if  ( IsObserving( aObserver ) == EFalse )
-        {
-        iObservers.Add( &aObserver.__iEMLink );
-        error = KErrNone;
-        }
-    //
-	Kern::MutexSignal( *iLock );
-	NKern::ThreadLeaveCS();
-    //
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::RequestEvents() - END - error: %d", error) );
-    return error;
-    }
-
-
-TInt DMemSpyEventMonitor::RequestEventsCancel( MMemSpyEventMonitorObserver& aObserver )
-    {
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::RequestEventsCancel() - START - aObserver: 0x%08x", &aObserver) );
-    NKern::ThreadEnterCS();
-	Kern::MutexWait( *iLock );
-
-    const TBool isObserving = IsObserving( aObserver );
-    if  ( isObserving )
-        {
-        TRACE_EM( Kern::Printf("DMemSpyEventMonitor::RequestEventsCancel() - dequing observer...") );
-        aObserver.__iEMLink.Deque();
-        TRACE_EM( Kern::Printf("DMemSpyEventMonitor::RequestEventsCancel() - observer dequeued") );
-        }
-
-	Kern::MutexSignal( *iLock );
-	NKern::ThreadLeaveCS();
-    //
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::RequestEventsCancel() - END") );
-    return KErrNone;
-    }
-
-
-TUint DMemSpyEventMonitor::EventHandler( TKernelEvent aType, TAny* a1, TAny* a2, TAny* aSelf )
-	{
-    DMemSpyEventMonitor* self = (DMemSpyEventMonitor*) aSelf;
-	const TUint ret = self->HandleEvent( aType, a1, a2 );
-    return ret;
-	}
-
-
-TUint DMemSpyEventMonitor::HandleEvent( TKernelEvent aType, TAny* a1, TAny* /*a2*/ )
-	{ 
-	// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - PRE WAIT"));
-	NKern::ThreadEnterCS();
-	Kern::MutexWait(*iLock);
-	// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - POST WAIT"));
-
-	if  ( iTracking )
-		{
-		switch( aType )
-			{
-        //////////////////////////////////
-        // THREAD HANDLING
-        //////////////////////////////////
-		case EEventAddThread:
-			{
-			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventAddThread"));
-			EventThreadAdd( (DThread*) a1 );
-			break;
-			}
-		case EEventRemoveThread:
-			{
-			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventRemoveThread"));
-			EventThreadRemoved( (DThread*) a1 );
-			break;
-			}
-		case EEventKillThread:
-			{
-			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventKillThread"));
-			EventThreadKilled( (DThread*) a1 );
-			break;
-			}
-
-        //////////////////////////////////
-        // PROCESS HANDLING
-        //////////////////////////////////
-	    case EEventAddProcess:
-			{
-			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventAddProcess"));
-			EventProcessAdd( (DProcess*) a1 );
-			break;
-			}
-	    case EEventUpdateProcess:
-			{
-			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventUpdateProcess"));
-			EventProcessUpdate( (DProcess*) a1 );
-			break;
-			}
-	    case EEventRemoveProcess:
-			{
-			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventRemoveProcess"));
-			EventProcessRemoved( (DProcess*) a1 );
-			break;
-			}
-			
-        //////////////////////////////////
-        // CHUNK HANDLING
-        //////////////////////////////////
-	    case EEventNewChunk:
-			{
-			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventNewChunk"));
-			EventChunkAdd( (DChunk*) a1 );
-			break;
-			}
-	    case EEventUpdateChunk:
-			{
-			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventUpdateChunk"));
-			EventChunkUpdate( (DChunk*) a1 );
-			break;
-			}
-		case EEventDeleteChunk:
-			{
-			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventDeleteChunk"));
-			EventChunkDelete( (DChunk*) a1 );
-			break;
-			}
-
-        default:
-			break;
-			}
-		}
-
-	// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - PRE SIGNAL "));
-	Kern::MutexSignal( *iLock );
-	NKern::ThreadLeaveCS();
-	// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - POST SIGNAL "));
-
-	// Allow other handlers to see this event
-	return DKernelEventHandler::ERunNext;
-	}
-
-
-void DMemSpyEventMonitor::EventProcessAdd( DProcess* aProcess )
-    {
-	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventProcessAdd() - aProcess: 0x%08x [%d] (%O)", aProcess, aProcess->iId, aProcess ));
-    //
-    const SDblQueLink* const anchor = &iObservers.iA;
-	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
-		{
-		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
-        const TInt typeMask = observer->EMTypeMask();
-        //
-        if ( typeMask & EMemSpyEventProcessAdd )
-			{
-            observer->EMHandleProcessAdd( *aProcess );
-			}
-        }
-    }
-
-
-void DMemSpyEventMonitor::EventProcessUpdate( DProcess* aProcess )
-    {
-	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventProcessUpdate() - aProcess: 0x%08x [%d] (%O)", aProcess, aProcess->iId, aProcess ));
-    //
-	const SDblQueLink* const anchor = &iObservers.iA;
-	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
-		{
-		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
-        const TInt typeMask = observer->EMTypeMask();
-        //
-        if ( typeMask & EMemSpyEventProcessUpdate )
-			{
-            observer->EMHandleProcessUpdated( *aProcess );
-			}
-        }
-    }
-
-
-void DMemSpyEventMonitor::EventProcessRemoved( DProcess* aProcess )
-    {
-	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventProcessRemoved() - aProcess: 0x%08x [%d] (%O)", aProcess, aProcess->iId, aProcess ));
-    //
-	const SDblQueLink* const anchor = &iObservers.iA;
-	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
-		{
-		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
-        const TInt typeMask = observer->EMTypeMask();
-        //
-        if ( typeMask & EMemSpyEventProcessRemove )
-			{
-            observer->EMHandleProcessRemoved( *aProcess );
-			}
-        }
-    }
-
-
-void DMemSpyEventMonitor::EventThreadAdd( DThread* aThread )
-    {
-	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventThreadAdd() - aThread: 0x%08x [%4d] (%O)", aThread, aThread->iId, aThread ));
-    //
-	const SDblQueLink* const anchor = &iObservers.iA;
-	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
-		{
-		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
-        const TInt typeMask = observer->EMTypeMask();
-        //
-        if ( typeMask & EMemSpyEventThreadAdd )
-			{
-            observer->EMHandleThreadAdd( *aThread );
-			}
-        }
-    }
-
-
-void DMemSpyEventMonitor::EventThreadRemoved( DThread* aThread )
-    {
-	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventThreadRemoved() - aThread: 0x%08x [%4d] (%O)", aThread, aThread->iId, aThread ));
-    //
-	const SDblQueLink* const anchor = &iObservers.iA;
-	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
-		{
-		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
-        const TInt typeMask = observer->EMTypeMask();
-        //
-        if ( typeMask & EMemSpyEventThreadRemove )
-			{
-            observer->EMHandleThreadRemoved( *aThread );
-			}
-        }
-    }
-
-
-void DMemSpyEventMonitor::EventThreadKilled( DThread* aThread )
-    {
-	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventThreadKilled() - aThread: 0x%08x [%4d] (%O)", aThread, aThread->iId, aThread ));
-    //
-	const SDblQueLink* const anchor = &iObservers.iA;
-	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
-		{
-		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
-        const TInt typeMask = observer->EMTypeMask();
-        //
-        if ( typeMask & EMemSpyEventThreadKill )
-			{
-            observer->EMHandleThreadKilled( *aThread );
-			}
-        }
-    }
-
-
-void DMemSpyEventMonitor::EventChunkAdd( DChunk* aChunk )
-    {
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventChunkAdd() - aChunk: 0x%08x [%10d] {OP: %4d, CO: %4d} (%O)", aChunk, aChunk->Size(), ( aChunk->iOwningProcess ? aChunk->iOwningProcess->iId : 0 ), aChunk->iControllingOwner, aChunk ));
-    //
-	const SDblQueLink* const anchor = &iObservers.iA;
-	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
-		{
-		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
-        const TInt typeMask = observer->EMTypeMask();
-        //
-        if ( typeMask & EMemSpyEventChunkAdd )
-			{
-            observer->EMHandleChunkAdd( *aChunk );
-			}
-        }
-    }
-
-
-void DMemSpyEventMonitor::EventChunkUpdate( DChunk* aChunk )
-    {
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventChunkUpdate() - aChunk: 0x%08x [%10d] {OP: %4d, CO: %4d} (%O)", aChunk, aChunk->Size(), ( aChunk->iOwningProcess ? aChunk->iOwningProcess->iId : 0 ), aChunk->iControllingOwner, aChunk ));
-    //
-	const SDblQueLink* const anchor = &iObservers.iA;
-	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
-		{
-		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
-        const TInt typeMask = observer->EMTypeMask();
-        //
-        if ( typeMask & EMemSpyEventChunkUpdate )
-			{
-            observer->EMHandleChunkUpdated( *aChunk );
-			}
-        }
-    }
-
-
-void DMemSpyEventMonitor::EventChunkDelete( DChunk* aChunk )
-    {
-    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventChunkDelete() - aChunk: 0x%08x [%10d] {OP: %4d, CO: %4d} (%O)", aChunk, aChunk->Size(), ( aChunk->iOwningProcess ? aChunk->iOwningProcess->iId : 0 ), aChunk->iControllingOwner, aChunk ));
-    //
-	const SDblQueLink* const anchor = &iObservers.iA;
-	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
-		{
-		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
-        const TInt typeMask = observer->EMTypeMask();
-        //
-        if ( typeMask & EMemSpyEventChunkDelete )
-			{
-            observer->EMHandleChunkDeleted( *aChunk );
-			}
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-TBool DMemSpyEventMonitor::IsObserving( MMemSpyEventMonitorObserver& aObserver )
-    {
-    TBool ret = EFalse;
-	const SDblQueLink* const anchor = &iObservers.iA;
-	
-	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
-		{
-		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
-
-		if  ( observer == &aObserver )
-			{
-			ret = ETrue;
-            break;
-			}
-		}
-
-	return ret;
-    }
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverHeap.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,321 +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 "MemSpyDriverHeap.h"
-
-// System includes
-#include <kern_priv.h>
-
-// User includes
-#include "MemSpyDriverOSAdaption.h"
-#include "MemSpyDriverUtils.h"
-#include "heaputils.h"
-
-
-
-RMemSpyDriverRHeapBase::RMemSpyDriverRHeapBase()
-	: iHelper(NULL)
-    {
-    Reset();
-    }
-
-LtkUtils::RAllocatorHelper* RMemSpyDriverRHeapBase::Helper()
-	{
-	return iHelper;
-	}
-
-TMemSpyHeapInfo::THeapImplementationType RMemSpyDriverRHeapBase::GetTypeFromHelper() const
-	{
-	if (iHelper)
-		{
-		LtkUtils::RAllocatorHelper::TType type = iHelper->GetType();
-		switch (type)
-			{
-			case LtkUtils::RAllocatorHelper::ETypeRHeap:
-				return TMemSpyHeapInfo::ETypeRHeap;
-			case LtkUtils::RAllocatorHelper::ETypeRHybridHeap:
-				return TMemSpyHeapInfo::ETypeRHybridHeap;
-			case LtkUtils::RAllocatorHelper::ETypeUnknown:
-			default:
-				return TMemSpyHeapInfo::ETypeUnknown;
-			}
-		}
-	return TMemSpyHeapInfo::ETypeUnknown;
-	}
-
-void RMemSpyDriverRHeapBase::Reset()
-    {
-	Close();
-	}
-
-void RMemSpyDriverRHeapBase::Close()
-	{
-	if (iHelper)
-		{
-	    NKern::ThreadEnterCS();
-		iHelper->Close();
-		delete iHelper;
-		iHelper = NULL;
-		NKern::ThreadLeaveCS();
-		}
-    }
-
-void RMemSpyDriverRHeapBase::PrintInfo()
-    {
-	/* TOMSCI TODO
-#if defined(TRACE_TYPE_KERNELHEAP) || defined(TRACE_TYPE_USERHEAP)
-    Kern::Printf(" " );
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iAccessCount:    0x%08x", iAccessCount );
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iHandleCount:    0x%08x", iHandleCount );
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iHandles:        0x%08x", iHandles );
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iFlags:          0x%08x", iFlags );
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iCellCount:      0x%08x", iCellCount );
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iTotalAllocSize: 0x%08x", iTotalAllocSize );
-
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iMinLength:      0x%08x", iMinLength );
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iMaxLength:      0x%08x", iMaxLength );
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iOffset:         0x%08x", iOffset);
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iGrowBy:         0x%08x", iGrowBy);
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iChunkHandle:    0x%08x", iChunkHandle);
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iBase:           0x%08x", Base());
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iTop:            0x%08x", iTop );
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iAlign:          0x%08x", iAlign);
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iMinCell:        0x%08x", iMinCell);
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iPageSize:       0x%08x", iPageSize);
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iFree len:       0x%08x", iFree.len);
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iFree next:      0x%08x", iFree.next);
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iNestingLevel:   0x%08x", iNestingLevel);
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iAllocCount:     0x%08x", iAllocCount);
-    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      size:              %8d",  Size() );
-    Kern::Printf(" " );
-    Kern::Printf(" " );
-#endif
-	*/
-    }
-
-RMemSpyDriverRHeapReadFromCopy::RMemSpyDriverRHeapReadFromCopy( DMemSpyDriverOSAdaption& aOSAdaption )
-:   iOSAdaption( aOSAdaption ), iChunk( NULL ), iChunkAddress( 0 ), iChunkMappingAttributes( 0 ) /*, iClientToKernelDelta( 0 )*/
-    {
-    }
-
-
-void RMemSpyDriverRHeapReadFromCopy::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()
-    {
-    TRACE_HEAP( Kern::Printf("RMemSpyDriverRHeapReadFromCopy::DisassociateWithKernelChunk() - START - iChunk: 0x%08x", iChunk ) );
-
-    NKern::ThreadEnterCS();
-    if  ( iChunk != NULL )
-        {
-        Kern::ChunkClose( iChunk );
-        iChunk = NULL;
-        }
-    NKern::ThreadLeaveCS();
-
-    TRACE_HEAP( Kern::Printf("RMemSpyDriverRHeapReadFromCopy::DisassociateWithKernelChunk() - END") );
-    }
-*/
-
-DChunk& RMemSpyDriverRHeapReadFromCopy::Chunk()
-    {
-    return *iChunk;
-    }
-
-
-const DChunk& RMemSpyDriverRHeapReadFromCopy::Chunk() const
-    {
-    return *iChunk;
-    }
-
-
-/*TLinAddr RMemSpyDriverRHeapReadFromCopy::ChunkKernelAddress() const
-    {
-    return iChunkAddress;
-    }
-
-
-TBool RMemSpyDriverRHeapReadFromCopy::ChunkIsInitialised() const
-    {
-    return iChunk != NULL;
-    }
-
-TUint RMemSpyDriverRHeapReadFromCopy::ClientToKernelDelta() const
-    {
-    return iClientToKernelDelta;
-    }
-*/
-
-
-
-
-
-RMemSpyDriverRHeapUser::RMemSpyDriverRHeapUser( DMemSpyDriverOSAdaption& aOSAdaption )
-	: RMemSpyDriverRHeapBase(), iOSAdaption(aOSAdaption)
-    {
-    }
-
-
-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
-	}
-
-RMemSpyDriverRHeapKernelInPlace::RMemSpyDriverRHeapKernelInPlace()
-	: iChunk(NULL)
-    {
-    }
-
-TInt RMemSpyDriverRHeapKernelInPlace::OpenKernelHeap()
-	{
-	NKern::ThreadEnterCS();
-	LtkUtils::RAllocatorHelper* helper = new LtkUtils::RAllocatorHelper;
-	if (!helper)
-		{
-		NKern::ThreadLeaveCS();
-		return KErrNoMemory;
-		}
-	TInt err = helper->OpenKernelHeap();
-	if (!err)
-		{
-		iChunk = helper->OpenUnderlyingChunk();
-		if (!iChunk) err = KErrNotFound;
-		}
-
-	if (err)
-		{
-		delete helper;
-		}
-	else
-		{
-		iHelper = helper;
-		}
-	NKern::ThreadLeaveCS();
-	return err;
-	}
-
-void RMemSpyDriverRHeapKernelInPlace::Close()
-    {
-	NKern::ThreadEnterCS();
-	iChunk->Close(NULL);
-	iChunk = NULL;
-	RMemSpyDriverRHeapBase::Close();
-	NKern::ThreadLeaveCS();
-    }
-
-DChunk& RMemSpyDriverRHeapKernelInPlace::Chunk()
-    {
-    return *iChunk;
-    }
-
-
-const DChunk& RMemSpyDriverRHeapKernelInPlace::Chunk() const
-    {
-    return *iChunk;
-    }
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverHeapWalker.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +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 "MemSpyDriverHeapWalker.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-
-// Defines
-#define PRINTDEBUG( a ) { if ( PrintDebug() ) a; }
-
-
-RMemSpyDriverHeapWalker::RMemSpyDriverHeapWalker(RMemSpyDriverRHeapBase& aHeap, MMemSpyHeapWalkerObserver* aObserver)
-	: iHeap(aHeap), iPrintDebug(EFalse), iObserver(aObserver)
-	{
-	InitialiseStats();
-	}
-
-
-TInt RMemSpyDriverHeapWalker::Traverse()
-//
-// Walk the heap calling the info function.
-//
-	{
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - START"));
-    InitialiseStats();
-    if  ( iObserver )
-        {
-        PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - heap walk init..." ));
-        iObserver->HandleHeapWalkInit();
-        }
-
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - heap walk init complete" ));
-
-	TInt err = iHeap.Helper()->Walk(&CellCallback, this);
-    FinaliseStats();
-    //PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - END - pF: 0x%08x, pC: 0x%08x, heapBase: 0x%08x, heapTop: 0x%08x", pF, pC, heapBase, heapTop));
-	return err;
-	}
-
-TBool RMemSpyDriverHeapWalker::CellCallback(RAllocatorHelper& aHelper, TAny* aContext, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellAddress, TInt aLength)
-	{
-	return static_cast<RMemSpyDriverHeapWalker*>(aContext)->DoCellCallback(aHelper, aCellType, aCellAddress, aLength);
-	}
-
-TBool RMemSpyDriverHeapWalker::DoCellCallback(RAllocatorHelper& aHelper, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellAddress, TInt aLength)
-	{
-	TAny* cellAddress = (TAny*)aCellAddress;
-	TMemSpyDriverCellType memspyCellType = (TMemSpyDriverCellType)aCellType; // We make sure these use the same values
-	switch (aCellType)
-		{
-		case RAllocatorHelper::EHeapBadFreeCellAddress:
-			PRINTDEBUG(Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EBadFreeCellAddress: 0x%08x", cellAddress));
-			NotifyCell(memspyCellType, cellAddress, 0);
-			return EFalse;
-		case RAllocatorHelper::EHeapBadFreeCellSize:
-			PRINTDEBUG(Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EBadFreeCellSize: 0x%08x", cellAddress));
-			NotifyCell(memspyCellType, cellAddress, aLength);
-			return EFalse;
-		case RAllocatorHelper::EHeapBadAllocatedCellSize:
-			PRINTDEBUG(Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EBadAllocatedCellSize: 0x%08x", cellAddress));
-			NotifyCell(memspyCellType, cellAddress, aLength);
-			return EFalse;
-		case RAllocatorHelper::EHeapBadAllocatedCellAddress:
-			PRINTDEBUG(Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EBadAllocatedCellAddress: 0x%08x", cellAddress));
-			NotifyCell(memspyCellType, cellAddress, aLength);
-			return EFalse;
-		default:
-			break;
-		}
-
-	if (aCellType & RAllocatorHelper::EAllocationMask)
-		{
-		PRINTDEBUG(Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EGoodAllocatedCell: 0x%08x", cellAddress));
-		TInt nestingLevel = -1;
-		aHelper.GetCellNestingLevel(cellAddress, nestingLevel);
-		TInt allocCount = aHelper.AllocCountForCell(cellAddress);
-		if (allocCount < 0) allocCount = -1; // This is what NotifyCell expects
-		return NotifyCell(memspyCellType, cellAddress, aLength, nestingLevel, allocCount);
-		}
-	else if (aCellType & RAllocatorHelper::EFreeMask)
-		{
-		PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EGoodFreeCell: 0x%08x", cellAddress));
-		return NotifyCell(memspyCellType, cellAddress, aLength);
-		}
-	else if (aCellType & RAllocatorHelper::EBadnessMask)
-		{
-		NotifyCell(memspyCellType, cellAddress, aLength);
-		return EFalse;
-		}
-	return ETrue; // For any new types that get added
-	}
-
-
-void RMemSpyDriverHeapWalker::CopyStatsTo( TMemSpyHeapStatisticsRHeap& aStats )
-    {
-	PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::CopyStatsTo() - START"));
-
-    // Copy free cell info
-    TMemSpyHeapStatisticsRHeapFree& free = aStats.StatsFree();
-    free.SetTypeCount( iStats.iFreeCellCount );
-    free.SetTypeSize( iStats.iTotalFreeSpace );
-
-    // If the last cell was a free cell, and it was also the largest cell
-    // then we use the prior largest free cell instead. This is because
-    // slack space is already reported separately.
-    TAny* largestFreeCellAddress = (TAny*) iStats.iLargestCellAddressFree;
-    TUint largestFreeCellSize = iStats.iLargestCellSizeFree;
-    if ( iStats.iLastCellWasFreeCell && iStats.iLargestCellSizeFree == iStats.iSlackSpace && iStats.iSpackSpaceCellAddress == iStats.iLargestCellAddressFree )
-        {
-	    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::CopyStatsTo() - using previous max free cell stats, since largest free cell is slack cell at end of heap..."));
-        largestFreeCellAddress = (TAny*) iStats.iLargestCellAddressFreePrevious;
-        largestFreeCellSize = iStats.iLargestCellSizeFreePrevious;
-        }
-
-    free.SetLargestCellAddress( largestFreeCellAddress );
-    free.SetLargestCellSize( largestFreeCellSize );
-    free.SetSlackSpaceCellSize( iStats.iSlackSpace );
-    free.SetSlackSpaceCellAddress( (TAny*) iStats.iSpackSpaceCellAddress );
-    free.SetChecksum( iStats.iFreeCellCRC );
-
-    // Copy allocated cell info
-    TMemSpyHeapStatisticsRHeapAllocated& alloc = aStats.StatsAllocated();
-    alloc.SetTypeCount( iStats.iAllocCellCount );
-    alloc.SetTypeSize( iStats.iTotalAllocSpace );
-    alloc.SetLargestCellAddress( (TAny*) iStats.iLargestCellAddressAlloc );
-    alloc.SetLargestCellSize( iStats.iLargestCellSizeAlloc );
-
-	aStats.iCommittedFreeSpace = iHeap.Helper()->CommittedFreeSpace();
-
-	PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::CopyStatsTo() - END"));
-    }
-
-
-void RMemSpyDriverHeapWalker::SetObserver( MMemSpyHeapWalkerObserver* aObserver )
-    {
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::SetObserver() - aObserver: 0x%08x", aObserver ));
-    iObserver = aObserver;
-    }
-
-TBool RMemSpyDriverHeapWalker::NotifyCell( TMemSpyDriverCellType aType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber )
-    {
-    // Update stats first
-    UpdateStats( aType, aCellAddress, aLength, aNestingLevel, aAllocNumber );
-	
-    // Notify observer
-    TBool continueTraversal = ETrue;
-    if  ( iObserver )
-        {
-        continueTraversal = iObserver->HandleHeapCell( aType, aCellAddress, aLength, aNestingLevel, aAllocNumber );
-        }
-    //
-    return continueTraversal;
-    }
-
-
-void RMemSpyDriverHeapWalker::UpdateStats( TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber )
-    {
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::UpdateStats - type: %d address: 0x%08x, len: %8d, nestingLev: %8d, allocNum: %8d", aCellType, aCellAddress, aLength, aNestingLevel, aAllocNumber ));
-
-    if (aCellType & EMemSpyDriverFreeCellMask)
-        {
-        // Update checksum
-        iStats.iFreeCellCRC = iStats.iFreeCellCRC ^ reinterpret_cast<TUint32>( aCellAddress );
-
-        // Track cell counts and length
-        ++iStats.iFreeCellCount;
-        iStats.iTotalFreeSpace += aLength;
-        iStats.iLastFreeCellLength = aLength;
-
-        PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::UpdateStats - WAS FREE CELL - iFreeCellCRC: 0x%08x, iFreeCellCount: %d, iTotalFreeSpace: %d, iLastFreeCellLength: %d", iStats.iFreeCellCRC, iStats.iFreeCellCount, iStats.iTotalFreeSpace, iStats.iLastFreeCellLength));
-        
-        // Identify biggest cell
-        if  ( (TUint) aLength > iStats.iLargestCellSizeFree )
-            {
-            PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::UpdateStats - this cell (%d bytes big) is bigger than previous largested FREE cell (%d bytes) => making it the new largest FREE cell", aLength, iStats.iLargestCellSizeFree));
-            iStats.iLargestCellSizeFreePrevious = iStats.iLargestCellSizeFree;
-            iStats.iLargestCellSizeFree = aLength;
-            iStats.iLargestCellAddressFreePrevious = iStats.iLargestCellAddressFree;
-            iStats.iLargestCellAddressFree = (TLinAddr) aCellAddress;
-            }
-
-        // Identify first cell
-        if  ( iStats.iFirstFreeCellAddress == 0 )
-            {
-            iStats.iFirstFreeCellLength = aLength;
-            iStats.iFirstFreeCellAddress = (TLinAddr) aCellAddress;
-            }
-        }
-    else if (aCellType & EMemSpyDriverAllocatedCellMask)
-        {
-        // Track cell counts and length
-        ++iStats.iAllocCellCount;
-        iStats.iTotalAllocSpace += aLength;
-        iStats.iLastFreeCellLength = 0; 
-
-        PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::UpdateStats - WAS ALLOC CELL - iAllocCellCount: %d, iTotalAllocSpace: %d", iStats.iAllocCellCount, iStats.iTotalAllocSpace));
-
-        // Identify biggest cell
-        if  ( (TUint) aLength > iStats.iLargestCellSizeAlloc )
-            {
-            PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::UpdateStats - this cell (%d bytes big) is bigger than previous largested ALLOC cell (%d bytes) => making it the new largest ALLOC cell", aLength, iStats.iLargestCellSizeAlloc));
-            iStats.iLargestCellSizeAlloc = aLength;
-            iStats.iLargestCellAddressAlloc = (TLinAddr) aCellAddress;
-            }
-        }
-
-    iStats.iLastCellType = aCellType;
-    iStats.iLastCellAddress = (TLinAddr) aCellAddress;
-    iStats.iLastCellWasFreeCell = (aCellType & EMemSpyDriverFreeCellMask);
-    ++iStats.iNumberOfWalkedCells;
-    }
-
-
-void RMemSpyDriverHeapWalker::InitialiseStats()
-    {
-    iStats.iFreeCellCRC = 0;
-    iStats.iNumberOfWalkedCells = 0;
-    iStats.iFirstFreeCellAddress = 0;
-    iStats.iFirstFreeCellLength = 0;
-    iStats.iLastCellType = EMemSpyDriverAllocatedCellMask;
-    iStats.iLastCellWasFreeCell = EFalse;
-    iStats.iLastFreeCellLength = 0;
-    iStats.iTotalFreeSpace = 0;
-    iStats.iTotalAllocSpace = 0;
-    iStats.iSlackSpace = 0;
-    iStats.iFreeCellCount = 0;
-    iStats.iAllocCellCount = 0;
-    iStats.iLargestCellSizeFree = 0;
-    iStats.iLargestCellSizeAlloc = 0;
-    iStats.iLargestCellAddressFree = 0;
-    iStats.iLargestCellAddressAlloc = 0;
-    iStats.iLargestCellSizeFreePrevious = 0;
-    iStats.iLargestCellAddressFreePrevious = 0;
-    iStats.iSpackSpaceCellAddress = 0;
-    iStats.iLastCellAddress = 0;
-    }
-
-
-void RMemSpyDriverHeapWalker::FinaliseStats()
-    {
-    if  ( iStats.iLastCellWasFreeCell )
-        {
-        iStats.iSlackSpace = iStats.iLastFreeCellLength;
-        iStats.iSpackSpaceCellAddress = iStats.iLastCellAddress;
-        }
-
-    PrintStats();
-    }
-
-
-void RMemSpyDriverHeapWalker::PrintStats()
-    {
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - HEAP SUMMARY FOR THREAD:" ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - ------------------------------------------------------------" ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iNumberOfWalkedCells         : %10d", iStats.iNumberOfWalkedCells ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iFirstFreeCellAddress        : 0x%08x", iStats.iFirstFreeCellAddress ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iFirstFreeCellLength         : %10d", iStats.iFirstFreeCellLength ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLastCellWasFreeCell         : %10d", iStats.iLastCellWasFreeCell ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLastCellType                : %10d", iStats.iLastCellType ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLastFreeCellLength          : %10d", iStats.iLastFreeCellLength ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iTotalFreeSpace              : %10d", iStats.iTotalFreeSpace ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iTotalAllocSpace             : %10d", iStats.iTotalAllocSpace ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iSlackSpace                  : %10d", iStats.iSlackSpace ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iFreeCellCount               : %10d", iStats.iFreeCellCount ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iAllocCellCount              : %10d", iStats.iAllocCellCount ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLargestCellSizeFree         : %10d", iStats.iLargestCellSizeFree ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLastFreeCellLength          : %10d", iStats.iLastFreeCellLength ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLargestCellSizeAlloc        : %10d", iStats.iLargestCellSizeAlloc ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLargestCellAddressFree      : 0x%08x", iStats.iLargestCellAddressFree ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLargestCellAddressAlloc     : 0x%08x", iStats.iLargestCellAddressAlloc ) );
-    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iFreeCellCRC                 : 0x%08x", iStats.iFreeCellCRC ) );
-    }
--- a/memspy/Driver/Kernel/Source/MemSpyDriverInspectedProcess.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1268 +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 "MemSpyDriverInspectedProcess.h"
-
-// System includes
-#include <kern_priv.h>
-#include <nk_trace.h>
-#include <u32hal.h>
-
-#ifdef __MARM__
-#include "kdebug.h"
-#endif //__MARM__
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include "MemSpyDriverOSAdaption.h"
-#include "MemSpyDriverInspectedProcessManager.h"
-
-// Constants
-_LIT8( KMemSpyLitDollarHeap, "$HEAP" );
-_LIT8( KMemSpyLitDollarDllData, "DLL$DATA" );
-_LIT8( KMemSpyLitDollarDat, "$DAT" );
-_LIT( KMemSpyInspectedProcessMutexName, "MemSpyInspectedProcess_0x" );
-
-
-DMemSpyInspectedProcess::DMemSpyInspectedProcess( DMemSpyDriverDevice& aDevice )
-:   iDevice( aDevice )
-	{
-	}
-
-
-DMemSpyInspectedProcess::~DMemSpyInspectedProcess()
-	{
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - START - this: 0x%08x, %O", this, iProcess ));
-	EventMonitor().RequestEventsCancel( *this );
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - calling NotifyOnChangeCancel..." ) );
-    NotifyOnChangeCancel();
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - calling ResetTrackedList..." ) );
-    ResetTrackedList();
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - calling ResetPendingChanges..." ) );
-    ResetPendingChanges();
-
-	if  ( iLock )
-		{
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - closing mutex..." ) );
-		iLock->Close(NULL);
-		}
-
-    if  ( iProcess )
-        {
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - closing process..." ) );
-	    Kern::SafeClose( (DObject*&) iProcess, NULL );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - closed process!" ) );
-        }
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - END - this: 0x%08x", this ) );
-	}
-
-
-TInt DMemSpyInspectedProcess::Open( DProcess* aProcess )
-    {
-	__ASSERT_CRITICAL;
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::Open() - START - this: 0x%08x, aProcess: 0x%08x (%O)", this, aProcess, aProcess ));
-
-    TInt error = KErrNone;
-    //
-    iProcess = aProcess;
-    error = iProcess->Open();
-    //
-    if  ( error == KErrNone )
-        {
-        iProcessId = iDevice.OSAdaption().DProcess().GetId( *aProcess );
-
-        // Create mutex
-        TName name( KMemSpyInspectedProcessMutexName );
-        name.AppendNumFixedWidth( (TUint) this, EHex, 8 );
-        error = Kern::MutexCreate( iLock, name, KMutexOrdNone );
-        //
-        if  ( error == KErrNone )
-            {
-            // Get size of all stacks (user & supervsior) for process. Also
-            // updates iUserThreadStackSize with the current size of just
-            // the user-side thread stacks.
-            iInfoCurrent.iMemoryStack = StackSize( *aProcess );
-        
-            // Request events
-            EventMonitor().RequestEvents( *this );
-        
-            // Find initial chunks that are mapped into process
-            FindChunks( *aProcess );
-        
-            // Indicate that we have data waiting for client. This will
-            // cause the client's RS to be completed as soon as it 
-            // registers with us...
-            UpdateStatistics();
-            CompleteClientsRequest( KErrNone, &iInfoCurrent );
-            }
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::Open() - END - this: 0x%08x, error: %d", this, error ));
-    return error;
-    }
-
-
-
-
-
-
-
-
-TInt DMemSpyInspectedProcess::NotifyOnChange( DThread* aThread, TRequestStatus* aRequestStatus, TMemSpyDriverProcessInspectionInfo* aInfo )
-    {
-	Lock();
-
-    TInt err = KErrInUse;
-    const TBool notificationQueued = NotifyOnChangeQueued();
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChange() - START - this: 0x%08x, iAmDead: %d, aRequestStatus: 0x%08x, notificationQueued: %d, iChangeObserverThread: 0x%08x (%O)", this, iAmDead, aRequestStatus, notificationQueued, iChangeObserverThread, iChangeObserverThread ) );
-    //
-    if  ( notificationQueued == EFalse )
-        {
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChange() - Saving client RS..." ) );
-        iChangeObserverThread = aThread;
-        iChangeObserverRS = aRequestStatus;
-        iChangeObserverInfo = aInfo;
-        
-        // Whilst we still have items in the buffer, we let the client drain them fully.
-        // However, if the process is now marked as dead and the buffer is exhausted,
-        // we indicate this via KErrDied completion which will cause the client to
-        // stop requesting any more changes.
-        if	( !iPendingChanges.IsEmpty() )
-			{
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChange() - Have buffered changes - SENDING TO CLIENT IMMEDIATELY..." ) );
-			
-            // We have something in the pending buffer so we can
-			// give it back to the client immediately.
-	        TMemSpyTrackedChunkChangeInfo* cachedChange = _LOFF( iPendingChanges.First(), TMemSpyTrackedChunkChangeInfo, iLink );
-			cachedChange->iLink.Deque();
-			
-            // Notify about change			
-			CompleteClientsRequest( KErrNone, &cachedChange->iInfo );
-			
-			// Discard cached entry
-			delete cachedChange;
-			}
-        else if ( iAmDead )
-            {
-            // We must stop listening outside of an event monitor callback...
-    	    EventMonitor().RequestEventsCancel( *this );
-			CompleteClientsRequest( KErrDied );
-            }
-        //
-		err = KErrNone;
-        }
-	//
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChange() - END - this: 0x%08x, err: %d", this, err ) );
-
-	Unlock();
-    return err;
-    }
-
-
-TInt DMemSpyInspectedProcess::NotifyOnChangeCancel()
-    {
-	Lock();
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChangeCancel() - START - this: 0x%08x, queued: %d, iChangeObserverThread: 0x%08x, iChangeObserverRS: 0x%08x", this, NotifyOnChangeQueued(), iChangeObserverThread, iChangeObserverRS ) );
-    //
-    if  ( NotifyOnChangeQueued() )
-        {
-        TRACE( Kern::Printf( "DMemSpyInspectedProcess::NotifyOnChangeCancel() - this: 0x%08x, iChangeObserverRS: 0x%08x, iProcessId: %d (0x%04x)", this, iChangeObserverRS, iProcessId, iProcessId ) );
-		Kern::RequestComplete( iChangeObserverThread, iChangeObserverRS, KErrCancel );
-        iChangeObserverThread = NULL;
-        iChangeObserverRS = NULL;
-        iChangeObserverInfo = NULL;
-        }
-	//
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChangeCancel() - END - this: 0x%08x", this ) );
-	Unlock();
-
-    return KErrNone;
-    }
-
-
-TBool DMemSpyInspectedProcess::NotifyOnChangeQueued() const
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChangeQueued() - START - this: 0x%08x", this ) );
-    //
-	Lock();
-    const TBool queued = ( iChangeObserverRS != NULL );
-	Unlock();
-    //
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChangeQueued() - END - this: 0x%08x, queued: %d", this, queued ) );
-    return queued;
-    }
-
-
-
-
-
-
-
-
-
-void DMemSpyInspectedProcess::CompleteClientsRequest( TInt aCompletionCode, TMemSpyDriverProcessInspectionInfo* aInfo )
-    {
-    const TBool notificationQueued = NotifyOnChangeQueued();
-    TRACE( Kern::Printf( "DMemSpyInspectedProcess::CompleteClientsRequest() - START - this: 0x%08x, iChangeObserverThread: 0x%08x, iChangeObserverRS: 0x%08x, iChangeObserverInfo: 0x%08x, notificationQueued: %d", this, iChangeObserverThread, iChangeObserverRS, iChangeObserverInfo, notificationQueued ) );
-    TRACE( Kern::Printf( "DMemSpyInspectedProcess::CompleteClientsRequest() - iAmDead: %d, buffer is empty: %d, aCompletionCode: %d, iProcessId: %d (0x%04x), aInfo: 0x%08x, iChangeDeliveryCounter: %d", iAmDead, iPendingChanges.IsEmpty(), aCompletionCode, iProcessId, iProcessId, aInfo, iChangeDeliveryCounter ) );
-
-    if  ( notificationQueued )
-        {
-        ++iChangeDeliveryCounter;
-        TInt completionCode = aCompletionCode;
-        
-        // Write them to client...
-        if ( aInfo != NULL )
-            {
-            const TInt writeErr = Kern::ThreadRawWrite( iChangeObserverThread, iChangeObserverInfo, aInfo, sizeof(TMemSpyDriverProcessInspectionInfo) );
-    		if  ( writeErr != KErrNone )
-    		    {
-                completionCode = writeErr;
-    		    }
-            }
-
-        // Complete client's async request
-        DThread* changeThread = iChangeObserverThread;
-        TRequestStatus* changeRS = iChangeObserverRS;
-
-        // Zero these out first to avoid race condition
-        iChangeObserverThread = NULL;
-        iChangeObserverRS = NULL;
-        iChangeObserverInfo = NULL;
-
-        // ...and then tell client.
-        TRACE( Kern::Printf( "DMemSpyInspectedProcess::CompleteClientsRequest() - SENDING CHANGE [%4d] TO CLIENT [err: %d]", iChangeDeliveryCounter, completionCode ) );
-		Kern::RequestComplete( changeThread, changeRS, completionCode );
-        }
-	else if ( aInfo )
-		{
-		// Buffer the change for next time around...
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::CompleteClientsRequest() - BUFFERING change event whilst client is AWOL...", this ) );
-        NKern::ThreadEnterCS();
-        
-        TMemSpyTrackedChunkChangeInfo* changeInfo = new TMemSpyTrackedChunkChangeInfo();
-        if ( changeInfo )
-            {
-            changeInfo->iInfo = *aInfo;
-            iPendingChanges.Add( &changeInfo->iLink );
-            }
-        //
-        NKern::ThreadLeaveCS();
-		}
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::CompleteClientsRequest() - END - this: 0x%08x", this ) );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-void DMemSpyInspectedProcess::ResetTrackedList()
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetTrackedList() - START - this: 0x%08x", this ) );
-    NKern::ThreadEnterCS();
-    //
-    SDblQueLink* link = iTrackedChunks.GetFirst();
-	while( link )
-		{
-		TMemSpyTrackedChunk* object = _LOFF( link, TMemSpyTrackedChunk, iLink );
-        delete object;
-        link = iTrackedChunks.GetFirst();
-		}
-    //
-    NKern::ThreadLeaveCS();
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetTrackedList() - END - this: 0x%08x", this ) );
-    }
-
-
-void DMemSpyInspectedProcess::SetTrackedListUnused()
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::SetTrackedListUnused() - START - this: 0x%08x", this ) );
-	SDblQueLink* anchor = &iTrackedChunks.iA;
-	for (SDblQueLink* link = iTrackedChunks.First(); link != anchor; link = link->iNext)
-		{
-		TMemSpyTrackedChunk* trackedChunk = _LOFF( link, TMemSpyTrackedChunk, iLink );
-        trackedChunk->SetUnused( ETrue );
-		}
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::SetTrackedListUnused() - END - this: 0x%08x", this ) );
-    }
-
-
-void DMemSpyInspectedProcess::SetTrackedListUnusedStatusByType( TMemSpyTrackedChunk::TType aType, TBool aUnusedStatus )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::SetTrackedListUnusedStatusByType() - START - this: 0x%08x", this ) );
-	SDblQueLink* anchor = &iTrackedChunks.iA;
-	for (SDblQueLink* link = iTrackedChunks.First(); link != anchor; link = link->iNext)
-		{
-		TMemSpyTrackedChunk* trackedChunk = _LOFF( link, TMemSpyTrackedChunk, iLink );
-		if ( trackedChunk->Type() == aType )
-		    {
-            trackedChunk->SetUnused( aUnusedStatus );
-		    }
-		}
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::SetTrackedListUnusedStatusByType() - END - this: 0x%08x", this ) );
-    }
-
-
-void DMemSpyInspectedProcess::DiscardUnusedTrackListItems()
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::DiscardUnusedTrackListItems() - START - this: 0x%08x", this ) );
-    NKern::ThreadEnterCS();
-	const SDblQueLink* const anchor = &iTrackedChunks.iA;
-    //	
-	SDblQueLink* link = iTrackedChunks.First();
-	while( link && link != anchor )
-		{
-		TMemSpyTrackedChunk* trackedChunk = _LOFF( link, TMemSpyTrackedChunk, iLink );
-        const TBool unused = trackedChunk->iUnused;
-        //
-        link = link->iNext;
-        //
-        if  ( unused )
-            {
-    		trackedChunk->iLink.Deque();
-            delete trackedChunk;
-            }
-        else
-            {
-            trackedChunk->SetUnused( EFalse );
-            }
-		}
-    //
-    NKern::ThreadLeaveCS();
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::DiscardUnusedTrackListItems() - END - this: 0x%08x", this ) );
-    }
-
-
-void DMemSpyInspectedProcess::AddTrackedChunk( DChunk* aChunk, TMemSpyTrackedChunk::TType aType )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::AddTrackedChunk() - START - this: 0x%08x, aChunk: 0x%08x (%O)", this, aChunk, aChunk ) );
-    NKern::ThreadEnterCS();
-    //
-    TMemSpyTrackedChunk* wrapper = new TMemSpyTrackedChunk( aChunk, aType );
-    if ( wrapper )
-        {
-        DMemSpyDriverOSAdaptionDChunk& chunkAdaption = iDevice.OSAdaption().DChunk();
-        const TInt cSize = chunkAdaption.GetSize( *aChunk );
-        wrapper->SetSize( cSize );
-        iTrackedChunks.Add( &wrapper->iLink );
-        }
-    //
-    NKern::ThreadLeaveCS();
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::AddTrackedChunk() - END - this: 0x%08x", this ) );
-    }
-
-
-TMemSpyTrackedChunk* DMemSpyInspectedProcess::TrackedChunkByHandle( TAny* aHandle )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::TrackedChunkByHandle() - START - this: 0x%08x", this ) );
-    TMemSpyTrackedChunk* ret = NULL;
-    //
-	const SDblQueLink* const anchor = &iTrackedChunks.iA;
-	for (SDblQueLink* link = iTrackedChunks.First(); link != anchor; link = link->iNext)
-		{
-		TMemSpyTrackedChunk* const trackedChunk = _LOFF( link, TMemSpyTrackedChunk, iLink );
-
-		if  ( trackedChunk && trackedChunk->Handle() == aHandle )
-			{
-			ret = trackedChunk;
-            break;
-			}
-		}
-    //
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::TrackedChunkByHandle() - END - this: 0x%08x, entry: 0x%08x (%O)", this, ret, ret ? ret->iChunk : NULL ) );
-	return ret;
-    }
-
-
-
-
-
-
-
-
-    
-
-
-DMemSpyInspectedProcessManager& DMemSpyInspectedProcess::PManager()
-    {
-    return iDevice.ProcessInspectionManager();
-    }
-
-
-DMemSpyEventMonitor& DMemSpyInspectedProcess::EventMonitor()
-    {
-    return iDevice.EventMonitor();
-    }
-
-
-
-
-
-
-
-TUint DMemSpyInspectedProcess::EMTypeMask() const
-    {
-    TUint ret = EMemSpyEventThreadAdd     | EMemSpyEventThreadRemove  | EMemSpyEventThreadKill |
-                EMemSpyEventProcessUpdate | EMemSpyEventProcessRemove | 
-                EMemSpyEventChunkAdd      | EMemSpyEventChunkUpdate   | EMemSpyEventChunkDelete;
-
-    if  ( iAmDead )
-        {
-        // Not interested anymore...
-        ret = 0;
-        }
-
-    return ret;
-    }
-
-
-void DMemSpyInspectedProcess::EMHandleProcessUpdated( DProcess& aProcess )
-    {
-    const TUint procId = iDevice.OSAdaption().DProcess().GetId( aProcess );
-    if  ( procId == iProcessId )
-        {
-	    Lock();
-
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleProcessUpdated() - START - this: 0x%08x, iProcess: 0x%08x (%O)", this, iProcess, iProcess ) );
-
-        // Mark all tracked chunks as dirty whilst we work out
-        // what is and isn't mapped into the process
-        SetTrackedListUnused();
-        SetTrackedListUnusedStatusByType( TMemSpyTrackedChunk::ETypeChunkGlobalData, EFalse /* global data chunks are still in use */ );
-
-        // Locate any suitable chunks, tagging existing entries as
-        // 'in use' so that we can easily spot ones which are no longer
-        // mapped into the process.
-        FindChunks( *iProcess );
-
-        // Throw away and tracked chunks which aren't mapped into the 
-        // process anymore.
-        DiscardUnusedTrackListItems();
-
-        // Calculate latest statistics...
-        const TBool changeDetected = UpdateStatistics();
-        if  ( changeDetected )
-            {
-            // Inform observer about new results.
-            CompleteClientsRequest( KErrNone, &iInfoCurrent );
-            }
-
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleProcessUpdated() - END - this: 0x%08x", this ) );
-
-        Unlock();
-        }
-    }
-
-
-void DMemSpyInspectedProcess::EMHandleProcessRemoved( DProcess& aProcess )
-    {
-    DMemSpyDriverOSAdaptionDProcess& dProcessAdaption = iDevice.OSAdaption().DProcess();
-    const TUint pid = dProcessAdaption.GetId( aProcess );
-
-    if  ( pid == iProcessId )
-        {
-	    Lock();
-
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleProcessRemoved() - START - this: 0x%08x", this ) );
-
-        // We will implement a multi phased approach to the process being removed.
-        //
-        // The first notification we will send will show that the process heap and
-        // local chunks have been removed, leaving shared chunk sizes intact.
-        //
-        // We will then send another change, this time setting everything to zero...
-        SetTrackedListUnused();
-        SetTrackedListUnusedStatusByType( TMemSpyTrackedChunk::ETypeChunkShared, EFalse /* shared chunks are still in use */ );
-        SetTrackedListUnusedStatusByType( TMemSpyTrackedChunk::ETypeChunkGlobalData, EFalse /* global data chunks are still in use */ );
-        DiscardUnusedTrackListItems();
-        const TBool changeDetected1 = UpdateStatistics();
-        if  ( changeDetected1 )
-            {
-            // Inform observer about new results.
-            CompleteClientsRequest( KErrNone, &iInfoCurrent );
-            }
-
-        // Now repeat the exercise, this time removing everything.
-        ResetTrackedList();
-    
-        // ... including stack
-        iInfoCurrent.iMemoryStack = 0;
-        
-        const TBool changeDetected2 = UpdateStatistics();
-        if  ( changeDetected2 )
-            {
-            // Inform observer about new results.
-            CompleteClientsRequest( KErrNone, &iInfoCurrent );
-            }
-
-        // Stop listening to events since we've drained everything now...
-        iAmDead = ETrue;
-
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleProcessRemoved() - END - this: 0x%08x", this ) );
-
-        Unlock();
-        }
-    }
-
-
-void DMemSpyInspectedProcess::EMHandleThreadAdd( DThread& aThread )
-    {
-    DMemSpyDriverOSAdaptionDThread& dThreadAdaption = iDevice.OSAdaption().DThread();
-    DMemSpyDriverOSAdaptionDProcess& dProcessAdaption = iDevice.OSAdaption().DProcess();
-    //
-    DProcess* owningProcess = dThreadAdaption.GetOwningProcess( aThread );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleThreadAdd() - this: 0x%08x, aThread: 0x%08x, owningProcess: 0x%08x", this, &aThread, owningProcess ) );
-    if ( owningProcess )
-        {
-        const TUint owningProcessId = dProcessAdaption.GetId( *owningProcess );
-        const TUint myId = dProcessAdaption.GetId( *iProcess );
-        //
-        if ( myId == owningProcessId )
-            {
-            EMHandleThreadChanged( aThread );
-            }
-        }
-    }
-
-
-void DMemSpyInspectedProcess::EMHandleThreadRemoved( DThread& aThread )
-    {
-    DMemSpyDriverOSAdaptionDThread& dThreadAdaption = iDevice.OSAdaption().DThread();
-    DMemSpyDriverOSAdaptionDProcess& dProcessAdaption = iDevice.OSAdaption().DProcess();
-    //
-    DProcess* owningProcess = dThreadAdaption.GetOwningProcess( aThread );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleThreadRemoved() - this: 0x%08x, aThread: 0x%08x, owningProcess: 0x%08x", this, &aThread, owningProcess ) );
-    if ( owningProcess )
-        {
-        const TUint owningProcessId = dProcessAdaption.GetId( *owningProcess );
-        const TUint myId = dProcessAdaption.GetId( *iProcess );
-        //
-        if ( myId == owningProcessId )
-            {
-            EMHandleThreadChanged( aThread );
-            }
-        }
-    }
-
-
-void DMemSpyInspectedProcess::EMHandleThreadKilled( DThread& aThread )
-    {
-    //
-    DMemSpyDriverOSAdaptionDThread& dThreadAdaption = iDevice.OSAdaption().DThread();
-    DMemSpyDriverOSAdaptionDProcess& dProcessAdaption = iDevice.OSAdaption().DProcess();
-    //
-    DProcess* owningProcess = dThreadAdaption.GetOwningProcess( aThread );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleThreadKilled() - this: 0x%08x, aThread: 0x%08x, owningProcess: 0x%08x", this, &aThread, owningProcess ) );
-    if ( owningProcess )
-        {
-        const TUint owningProcessId = dProcessAdaption.GetId( *owningProcess );
-        const TUint myId = dProcessAdaption.GetId( *iProcess );
-        //
-        if ( myId == owningProcessId )
-            {
-            EMHandleThreadChanged( aThread );
-            }
-        }
-    }
-
-
-void DMemSpyInspectedProcess::EMHandleThreadChanged( DThread& /*aThread*/ )
-    {
-	Lock();
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleThreadChanged() - START - this: 0x%08x", this ) );
-
-    // This is called when a thread is added, changed, or terminated/killed.
-    // We must be careful to only access the members of aThread that still
-    // exist as if it is being destroyed, the object may be in an intermediate
-    // state.
-
-    // All we are really interested in is recalculating the stack usage
-    // for the process... 
-    iInfoCurrent.iMemoryStack = StackSize( *iProcess );
-
-    // Always inform observer about new results.
-    CompleteClientsRequest( KErrNone, &iInfoCurrent );
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleThreadChanged() - END - this: 0x%08x", this ) );
-
-    Unlock();
-    }
-
-
-void DMemSpyInspectedProcess::EMHandleChunkAdd( DChunk& aChunk )
-    {
-	Lock();
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - START - this: 0x%08x, aChunk: 0x%08x (%O)", this, &aChunk, &aChunk ) );
-
-    // Is this chunk related to our process somehow?
-    if  ( IsChunkRelevantToOurProcess( aChunk ) )
-        {
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - processes match, checking chunk type..." ) );
-
-        const TMemSpyTrackedChunk::TType type = ChunkType( &aChunk );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - chunkType: %d", type ) );
-
-        if  ( type != TMemSpyTrackedChunk::ETypeNotRelevant )
-            {
-            // It's a new entry in our process
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - this: 0x%08x, creating new entry for chunk: 0x%08x", this, &aChunk ) );
-
-            AddTrackedChunk( &aChunk, type );
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - added chunk..." ));
-
-            const TBool changeDetected = UpdateStatistics();
-            if  ( changeDetected )
-                {
-                // Inform observer about new results.
-                CompleteClientsRequest( KErrNone, &iInfoCurrent );
-                }
-            }
-        }
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - END - this: 0x%08x", this ) );
-
-    Unlock();
-    }
-
-
-void DMemSpyInspectedProcess::EMHandleChunkUpdated( DChunk& aChunk )
-    {
-	Lock();
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkUpdated() - START - this: 0x%08x, aChunk: 0x%08x [S: %8d] (%O)", this, &aChunk, aChunk.Size(), &aChunk ) );
-
-    // Is this chunk mapped into our process?
-    TMemSpyTrackedChunk* trackedEntry = TrackedChunkByHandle( &aChunk );
-    if  ( trackedEntry != NULL )
-        {
-        const TInt oldSize = trackedEntry->Size();
-        const TInt newSize = iDevice.OSAdaption().DChunk().GetSize( aChunk );
-
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkUpdated() - was tracked entry [0x%08x, size; %10d, type: %d] vs new size: %d", trackedEntry, oldSize, trackedEntry->Type(), newSize ) );
-        
-        // If the existing entry had a size of 0 and the new size is non-zero
-        // then we may have enough data such that we can validate type information.
-        // For example, any secondary heap chunk that is created within the process will
-        // most likely have a Local-NNNNNN style name, and this chunk will be created with
-        // an initial size of zero.
-        //
-        // We can only identify it's type once the chunk has been updated with some data
-        // that supports vTable verification. Hence the type may fluctuate...
-        if  ( oldSize == 0 && newSize > 0 )
-            {
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkUpdated() - checking type again as chunk size was zero..." ) );
-
-            PrintChunkInfo( aChunk );
-            const TMemSpyTrackedChunk::TType type = ChunkType( &aChunk );
-            if  ( type != trackedEntry->Type() )
-                {
-                // Type has changed
-                TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkUpdated() - type has transitioned from: %d to %d", trackedEntry->Type(), type ) );
-                trackedEntry->SetType( type );
-                }
-            }
-
-        // Update our record with new chunk size
-        trackedEntry->SetSize( newSize );
-
-        const TBool changeDetected = UpdateStatistics();
-        if  ( changeDetected )
-            {
-            // Inform observer about new results.
-            CompleteClientsRequest( KErrNone, &iInfoCurrent );
-            }
-        }
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkUpdated() - END - this: 0x%08x", this ) );
-
-    Unlock();
-    }
-
-
-void DMemSpyInspectedProcess::EMHandleChunkDeleted( DChunk& aChunk )
-    {
-	Lock();
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkDeleted() - START - this: 0x%08x", this ) );
-
-    // Is this chunk mapped into our process?
-    TMemSpyTrackedChunk* trackedEntry = TrackedChunkByHandle( &aChunk );
-    if ( trackedEntry != NULL )
-        {
-        // Delete entry
-		trackedEntry->iLink.Deque();
-        delete trackedEntry;
-
-        const TBool changeDetected = UpdateStatistics();
-        if  ( changeDetected )
-            {
-            // Inform observer about new results.
-            CompleteClientsRequest( KErrNone, &iInfoCurrent );
-            }
-        }
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkDeleted() - END - this: 0x%08x", this ) );
-
-    Unlock();
-    }
-
-
-void DMemSpyInspectedProcess::PrintChunkInfo( DChunk& aChunk ) const
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::PrintChunkInfo() - iProcess*:           0x%08x", iProcess ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::PrintChunkInfo() - iProcess id:         0x%04x", iProcessId ) );
-    MemSpyDriverUtils::PrintChunkInfo( aChunk, iDevice.OSAdaption() );
-    }
-
-
-TBool DMemSpyInspectedProcess::IsChunkRelevantToOurProcess( DChunk& aChunk ) const
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsChunkRelevantToOurProcess() - START - this: 0x%08x, iProcess: 0x%08x (%4d), aChunk: 0x%08x (%O)", this, iProcess, iProcessId, &aChunk, &aChunk) );
-
-    TBool relevant = EFalse;
-    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = iDevice.OSAdaption().DChunk();
-    //
-    PrintChunkInfo( aChunk );
-    //
-    DProcess* chunkProc = chunkAdaption.GetOwningProcess( aChunk );
-    if  ( chunkProc )
-        {
-        const TUint procId = iDevice.OSAdaption().DProcess().GetId( *chunkProc );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::IsChunkRelevantToOurProcess() - [Owning Process] Comparing chunk pid: 0x%04x with procPid: 0x%04x", this, procId, iProcessId ) );
-        relevant = ( procId == iProcessId );
-        }
-    else if ( chunkAdaption.GetOwner( aChunk ) == iProcess )
-        {
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::IsChunkRelevantToOurProcess() - [Owner Match]" ) );
-        relevant = ETrue;
-        }
-    else
-        {
-        const TUint controllingOwnerPid = chunkAdaption.GetControllingOwnerId( aChunk );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::IsChunkRelevantToOurProcess() - [Controlling Owner] Comparing chunk owner: 0x%04x with procPid: 0x%04x", this, controllingOwnerPid, iProcessId ) );
-        relevant = ( controllingOwnerPid == iProcessId );
-        }
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsChunkRelevantToOurProcess() - END - this: 0x%08x, relevant: %d", this, relevant ) );
-    return relevant;
-    }
-
-
-TMemSpyTrackedChunk::TType DMemSpyInspectedProcess::ChunkType( DObject* aObject ) const
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - START - this: 0x%08x, iProcess: 0x%08x, aObject: 0x%08x (%O)", this, iProcess, aObject, aObject ) );
-    TMemSpyTrackedChunk::TType ret = TMemSpyTrackedChunk::ETypeNotRelevant;
-
-    // Firstly, check if it's actually held within the chunk container.
-    if  ( aObject )
-        {
-        DMemSpyDriverOSAdaptionDChunk& chunkAdaption = iDevice.OSAdaption().DChunk();
-        const TObjectType objectType = chunkAdaption.GetObjectType( *aObject );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - objectType: %d vs EChunk (%d)", objectType, EChunk ) );
-
-        if  ( objectType == EChunk )
-            {
-            DChunk* chunk = (DChunk*) aObject;
-            //
-            if  ( IsChunkRelevantToOurProcess( *chunk ) )
-                {
-                TName name;
-                TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - getting chunk name..." ) );
-                chunk->Name( name );
-                TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - name: %S", &name ) );
-
-                // It is definitely owned by this process. That means that
-                // it could be a heap, or then it's a just some other kind
-                // of data chunk which our process happens to have created.
-                //
-                // The main thread within a process results in the creation
-                // of a heap called $HEAP, but that isn't the case for other
-                // secondary (etc) threads.
-                //
-                // Only way I can think to identify these is via vTables.
-                if  ( name == KMemSpyLitDollarDllData )
-                    {
-                    // This chunk contains Dll Global Data for the process
-                    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - TMemSpyTrackedChunk::ETypeChunkGlobalData" ) );
-                    ret = TMemSpyTrackedChunk::ETypeChunkGlobalData;
-                    }
-                else if ( name == KMemSpyLitDollarDat )
-                    {
-                    // This chunk contains process global data as well as user-side stacks for
-                    // the process. However, we calculate the stacks independently, so we must 
-                    // adjust this later on to remove stack overhead.
-                    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - TMemSpyTrackedChunk::ETypeChunkProcessGlobalDataAndUserStack" ) );
-                    ret = TMemSpyTrackedChunk::ETypeChunkProcessGlobalDataAndUserStack;
-                    }
-                else if ( IsHeapChunk( *chunk, name ) )
-                    {
-                    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - TMemSpyTrackedChunk::ETypeChunkHeap" ) );
-                    ret = TMemSpyTrackedChunk::ETypeChunkHeap;
-                    }
-                else
-                    {
-                    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - TMemSpyTrackedChunk::ETypeChunkLocal" ) );
-                    ret = TMemSpyTrackedChunk::ETypeChunkLocal;
-                    }
-                }
-            else
-                {
-                // It's a chunk that is mapped into our process,
-                // but isn't owned by us. Therefore it is shared by some
-                // other process.
-                TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - TMemSpyTrackedChunk::ETypeChunkShared" ) );
-                ret = TMemSpyTrackedChunk::ETypeChunkShared;
-                }
-            }
-        }
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - END - this: 0x%08x, ret: %d", this, ret ) );
-    return ret;
-    }
-
-
-TBool DMemSpyInspectedProcess::IsHeapChunk( DChunk& aChunk, const TName& aName ) const
-    {
-    const TUint rHeapVTable = iDevice.RHeapVTable();
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - START - this: 0x%08x, aChunk: 0x%08x, RHeapVTable: 0x%08x, iProcess: 0x%08x, aName: %S, (%O)", this, &aChunk, rHeapVTable, iProcess, &aName, &aChunk ) );
-    
-    // The first 4 bytes of every chunk correspond to the allocator VTable (For heap chunks).
-    // If it matches RHeap's vtable, we'll treat it as a heap.
-    TBool isHeap = EFalse;
-
-    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = iDevice.OSAdaption().DChunk();
-    TUint8* base = chunkAdaption.GetBase( aChunk );
-    const TInt size = chunkAdaption.GetSize( aChunk );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - base: 0x%08x, size: %d", base, size ) );
-
-    if  ( iProcess && size >= 4 )
-        {
-        // Chunks are mapped into entire process so any thread within the process is enough...
-        DThread* firstThread = iProcess->FirstThread();
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - firstThread: 0x%08x (%O)", firstThread, firstThread ) );
-        if  ( firstThread != NULL )
-            {
-			NKern::ThreadEnterCS();
-            TInt err = firstThread->Open();
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - firstThread open result: %d", err ) );
-
-            if  ( err == KErrNone )
-                {
-                TBuf8<4> allocatorVTableBuffer;
-                err = Kern::ThreadRawRead( firstThread, base, (TUint8*) allocatorVTableBuffer.Ptr(), allocatorVTableBuffer.MaxLength() );
-                TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk - read result of vtable data from requested thread is: %d", err ));
-                //
-                if  ( err == KErrNone )
-                    {
-                    TRACE( MemSpyDriverUtils::DataDump("possible chunk vtable data - %lS", allocatorVTableBuffer.Ptr(), allocatorVTableBuffer.MaxLength(), allocatorVTableBuffer.MaxLength() ) );
-                    allocatorVTableBuffer.SetLength( allocatorVTableBuffer.MaxLength() );
-                    
-                    const TUint32 vtable =   allocatorVTableBuffer[0] +
-                                            (allocatorVTableBuffer[1] << 8) + 
-                                            (allocatorVTableBuffer[2] << 16) + 
-                                            (allocatorVTableBuffer[3] << 24);
-                    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk - [possible] vTable within chunk is: 0x%08x", vtable) );
-
-                    // Check the v-table to work out if it really is an RHeap
-                    isHeap = ( vtable == rHeapVTable );
-                    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - isHeap: %d", isHeap ) );
-                    }
-
-                TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - closing first thread..." ) );
-            	Kern::SafeClose( (DObject*&) firstThread, NULL );
-                }
-			NKern::ThreadLeaveCS();
-            }
-        }
-    //
-    if  ( !isHeap && aName == KMemSpyLitDollarHeap )
-        {
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - is standard Symbian OS initial heap chunk - $HEAP" ) );
-        isHeap = ETrue;
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - END - this: 0x%08x, isHeap: %d", this, isHeap ) );
-    return isHeap;
-    }
-
-
-TUint32 DMemSpyInspectedProcess::TotalStatistics( const TMemSpyDriverProcessInspectionInfo& aStats, TBool aIncludeShared )
-    {
-    TUint32 total = aStats.iMemoryStack + 
-                    aStats.iMemoryHeap +
-                    aStats.iMemoryChunkLocal + 
-                    aStats.iMemoryGlobalData;
-    //
-    if ( aIncludeShared )
-        {
-        total += aStats.iMemoryChunkShared;
-        }
-    //
-    return total;
-    }
-
-
-TBool DMemSpyInspectedProcess::IsEqual( const TMemSpyDriverProcessInspectionInfo& aLeft, const TMemSpyDriverProcessInspectionInfo& aRight )
-    {
-    const TBool equal = ( aLeft.iMemoryStack == aRight.iMemoryStack &&
-                          aLeft.iMemoryHeap == aRight.iMemoryHeap &&
-                          aLeft.iMemoryChunkLocal == aRight.iMemoryChunkLocal &&
-                          aLeft.iMemoryChunkShared == aRight.iMemoryChunkShared &&
-                          aLeft.iMemoryGlobalData == aRight.iMemoryGlobalData 
-                        );
-    return equal;
-    }
-
-
-void DMemSpyInspectedProcess::ResetStatistics( TMemSpyDriverProcessInspectionInfo& aStats )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetStatistics() - START - this: 0x%08x", this ) );
-    aStats.iProcessId = iProcessId;
-    aStats.iMemoryHeap = 0;
-    aStats.iMemoryChunkLocal = 0;
-    aStats.iMemoryChunkShared = 0;
-    aStats.iMemoryGlobalData = 0;
-    aStats.iTime = Kern::SystemTime();
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetStatistics() - END - this: 0x%08x", this ) );
-    }
-
-
-TBool DMemSpyInspectedProcess::UpdateStatistics()
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - START - this: 0x%08x, iChangeDeliveryCounter: %04d, iProcess: 0x%08x %O", this, iChangeDeliveryCounter, iProcess, iProcess ) );
-
-    // Preserve last stats so we can identify if something really changed...
-    iInfoLast = iInfoCurrent;
-
-    // Reset current stats ready for updating. This doesn't wipe the stack field, since
-    // that only changes when some kind of thread event occurs...
-    ResetStatistics( iInfoCurrent );
-    
-    // Go through all tracked chunks and update our stats based upon
-    // their current values...
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() CHUNK ENTRIES:" ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-	const SDblQueLink* const anchor = &iTrackedChunks.iA;
-	for (SDblQueLink* link = iTrackedChunks.First(); link != anchor; link = link->iNext)
-		{
-		TMemSpyTrackedChunk* const trackedChunk = _LOFF( link, TMemSpyTrackedChunk, iLink );
-        //
-        switch( trackedChunk->Type() )
-            {
-        case TMemSpyTrackedChunk::ETypeChunkHeap:
-            iInfoCurrent.iMemoryHeap += trackedChunk->Size();
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - [0x%08x] TMemSpyTrackedChunk::ETypeChunkHeap       - %12d (0x%08x, %O)", trackedChunk, trackedChunk->Size(), trackedChunk->iChunk, trackedChunk->iChunk ) );
-            break;
-        case TMemSpyTrackedChunk::ETypeChunkLocal:
-            iInfoCurrent.iMemoryChunkLocal += trackedChunk->Size();
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - [0x%08x] TMemSpyTrackedChunk::ETypeChunkLocal      - %12d (0x%08x, %O)", trackedChunk, trackedChunk->Size(), trackedChunk->iChunk, trackedChunk->iChunk ) );
-            break;
-        case TMemSpyTrackedChunk::ETypeChunkShared:
-            iInfoCurrent.iMemoryChunkShared += trackedChunk->Size();
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - [0x%08x] TMemSpyTrackedChunk::ETypeChunkShared     - %12d (0x%08x, %O)", trackedChunk, trackedChunk->Size(), trackedChunk->iChunk, trackedChunk->iChunk ) );
-            break;
-        case TMemSpyTrackedChunk::ETypeChunkGlobalData:
-            iInfoCurrent.iMemoryGlobalData += trackedChunk->Size();
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - [0x%08x] TMemSpyTrackedChunk::ETypeChunkGlobalData - %12d (0x%08x, %O)", trackedChunk, trackedChunk->Size(), trackedChunk->iChunk, trackedChunk->iChunk ) );
-            break;
-        case TMemSpyTrackedChunk::ETypeChunkProcessGlobalDataAndUserStack:
-            break;
-
-        default:
-        case TMemSpyTrackedChunk::ETypeNotRelevant:
-            break;
-            }
-		}
-
-    const TUint32 totalLastIncShared = TotalStatistics( iInfoLast );
-    const TUint32 totalLastExcShared = TotalStatistics( iInfoLast, EFalse );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() LAST:" ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast.iMemoryStack:                   %12d", iInfoLast.iMemoryStack ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast.iMemoryHeap:                    %12d", iInfoLast.iMemoryHeap ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast.iMemoryChunkLocal:              %12d", iInfoLast.iMemoryChunkLocal ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast.iMemoryChunkShared:             %12d", iInfoLast.iMemoryChunkShared ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast.iMemoryGlobalData:              %12d", iInfoLast.iMemoryGlobalData ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - --------------------------------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast total:                          %12d / %12d", totalLastIncShared, totalLastExcShared ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-
-
-    const TUint32 totalCurrentIncShared = TotalStatistics( iInfoCurrent );
-    const TUint32 totalCurrentExcShared = TotalStatistics( iInfoCurrent, EFalse );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() CURRENT:" ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent.iMemoryStack:                %12d", iInfoCurrent.iMemoryStack ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent.iMemoryHeap:                 %12d", iInfoCurrent.iMemoryHeap ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent.iMemoryChunkLocal:           %12d", iInfoCurrent.iMemoryChunkLocal ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent.iMemoryChunkShared:          %12d", iInfoCurrent.iMemoryChunkShared ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent.iMemoryGlobalData:           %12d", iInfoCurrent.iMemoryGlobalData ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - --------------------------------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent total:                       %12d / %12d", totalCurrentIncShared, totalCurrentExcShared ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-
-    // Update peaks, i.e. how large each individual element reached
-    const TUint32 totalPeaks = TotalStatistics( iInfoPeaks );
-    iInfoPeaks.iMemoryStack = Max( iInfoPeaks.iMemoryStack, iInfoCurrent.iMemoryStack );
-    iInfoPeaks.iMemoryHeap = Max( iInfoPeaks.iMemoryHeap, iInfoCurrent.iMemoryHeap );
-    iInfoPeaks.iMemoryChunkLocal = Max( iInfoPeaks.iMemoryChunkLocal, iInfoCurrent.iMemoryChunkLocal );
-    iInfoPeaks.iMemoryChunkShared = Max( iInfoPeaks.iMemoryChunkShared, iInfoCurrent.iMemoryChunkShared );
-    iInfoPeaks.iMemoryGlobalData = Max( iInfoPeaks.iMemoryGlobalData, iInfoCurrent.iMemoryGlobalData );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() PEAK:" ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks.iMemoryStack:                  %12d", iInfoPeaks.iMemoryStack ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks.iMemoryHeap:                   %12d", iInfoPeaks.iMemoryHeap ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks.iMemoryChunkLocal:             %12d", iInfoPeaks.iMemoryChunkLocal ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks.iMemoryChunkShared:            %12d", iInfoPeaks.iMemoryChunkShared ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks.iMemoryGlobalData:             %12d", iInfoPeaks.iMemoryGlobalData ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - -----------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks total:                         %12d", totalPeaks ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-
-    // Update HWM, i.e. the largest total so far.
-    const TUint32 totalHWMIncShared = TotalStatistics( iInfoHWMIncShared );
-    const TUint32 totalHWMExcShared = TotalStatistics( iInfoHWMIncShared, EFalse );
-    if  ( totalCurrentIncShared > totalHWMIncShared )
-        {
-        iInfoHWMIncShared = iInfoCurrent;
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() HWM INC SHARED:" ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared.iMemoryStack:           %12d", iInfoHWMIncShared.iMemoryStack ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared.iMemoryHeap:            %12d", iInfoHWMIncShared.iMemoryHeap ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared.iMemoryChunkLocal:      %12d", iInfoHWMIncShared.iMemoryChunkLocal ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared.iMemoryChunkShared:     %12d", iInfoHWMIncShared.iMemoryChunkShared ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared.iMemoryGlobalData:      %12d", iInfoHWMIncShared.iMemoryGlobalData ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - -----------------------------------------------------" ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared total:                  %12d", totalHWMIncShared ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-        }
-    if  ( totalCurrentExcShared > totalHWMExcShared )
-        {
-        iInfoHWMExcShared = iInfoCurrent;
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() HWM EXC SHARED:" ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared.iMemoryStack:           %12d", iInfoHWMExcShared.iMemoryStack ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared.iMemoryHeap:            %12d", iInfoHWMExcShared.iMemoryHeap ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared.iMemoryChunkLocal:      %12d", iInfoHWMExcShared.iMemoryChunkLocal ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared.iMemoryChunkShared:     %12d", iInfoHWMExcShared.iMemoryChunkShared ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared.iMemoryGlobalData:      %12d", iInfoHWMExcShared.iMemoryGlobalData ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - -----------------------------------------------------" ) );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared total:                  %12d", totalHWMExcShared ) );
-        }
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
-
-    // Work out if something changed...
-    const TBool statsChanged = !IsEqual( iInfoLast, iInfoCurrent );
-    if  ( statsChanged )
-        {
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - STATS CHANGED!" ) );
-        }
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - END - this: 0x%08x, statsChanged: %d, iChangeDeliveryCounter: %04d, iProcess: 0x%08x %O", this, statsChanged, iChangeDeliveryCounter, iProcess, iProcess ) );
-    return statsChanged;
-    }
-
-
-void DMemSpyInspectedProcess::FindChunks( DProcess& aProcess )
-    {
-	__ASSERT_CRITICAL;
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - START - this: 0x%08x", this ) );
-  
-    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = iDevice.OSAdaption().DChunk();
-    DMemSpyDriverOSAdaptionDProcess& processAdaption = iDevice.OSAdaption().DProcess();
-
-    // Iterate through each handle in the process
-    if  ( processAdaption.IsHandleIndexValid( aProcess ) )
-        {
-	    MemSpyObjectIx* processHandles = processAdaption.GetHandles( aProcess );
-		
-		MemSpyObjectIx_HandleLookupLock();
-        const TInt count = processHandles->Count();
-		MemSpyObjectIx_HandleLookupUnlock();
-
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - got: %d handles...", count ) );
-
-	    for( TInt i=0; i<count; i++ )
-    	    {
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - checking handle index: %2d", i ) );
-
-    	    // Get a handle from the process container...
-            MemSpyObjectIx_HandleLookupLock();
-			if (i >= processHandles->Count()) break; // Count may have changed in the meantime
-    	    DObject* object = (*processHandles)[ i ];
-			if (object && object->Open() != KErrNone) object = NULL;
-			MemSpyObjectIx_HandleLookupUnlock();
-
-            const TObjectType objectType = ( object ? chunkAdaption.GetObjectType( *object ) : EObjectTypeAny );
-            TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - object: 0x%08x, type: %2d (%O)", object, objectType, object ) );
-
-            // Is it a chunk that is already mapped into our process?
-            // See if we're already aware of this chunk...
-            if  ( object != NULL && objectType == EChunk )
-                {
-                TMemSpyTrackedChunk* existingEntry = TrackedChunkByHandle( object );
-                TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - found a chunk, existing lookup entry: 0x%08x", existingEntry ) );
-
-                if  ( existingEntry != NULL )
-                    {
-                    const TInt cSize = chunkAdaption.GetSize( *existingEntry->iChunk );
-                    TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - setting existing entry size to: %d", cSize ) );
-
-                    // It must be a chunk then... Update size
-                    existingEntry->SetSize( cSize );
-
-                    // This item is in use, i.e. it is not unused
-                    existingEntry->SetUnused( EFalse );
-                    }
-                else
-                    {
-                    DChunk* chunk = (DChunk*) object;
-                    TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - chunk not known, checking type..." ) );
-
-                    // We have no record of this item so far. Is it really a chunk?
-                    const TMemSpyTrackedChunk::TType type = ChunkType( object );
-                    TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - type is: %d", type ) );
-
-                    if  ( type != TMemSpyTrackedChunk::ETypeNotRelevant )
-                        {
-                        // It's a new entry
-                        TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - this: 0x%08x, creating new entry for chunk: 0x%08x", this, chunk ) );
-
-                        AddTrackedChunk( chunk, type );
-                        TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - added chunk..." ));
-                        }
-                    }
-                }
-			if (object) object->Close(NULL);
-    	    }
-        }
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - END - this: 0x%08x", this ) );
-    }
-    
-    
-TInt DMemSpyInspectedProcess::StackSize( DProcess& aProcess )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::StackSize() - START - this: 0x%08x", this ) );
-    TInt ret = 0;
-    //
-    DMemSpyDriverOSAdaptionDThread& dThreadAdaption = iDevice.OSAdaption().DThread();
-
-    iUserThreadStackSize = 0;
-    //
-	SDblQueLink* pLink = aProcess.iThreadQ.First();
-	while(pLink != &aProcess.iThreadQ.iA)
-		{
-		DThread* pT = _LOFF( pLink, DThread, iProcessLink );
-        //
-        const TUint32 userStackSize = dThreadAdaption.GetUserStackSize( *pT );
-        const TUint32 suprStackSize = dThreadAdaption.GetSupervisorStackSize( *pT );
-        TRACE( Kern::Printf("DMemSpyInspectedProcess::StackSize() - thread: 0x%08x, userStack: %8d, suprStack: %8d, total: %8d %O", pT, userStackSize, suprStackSize, userStackSize + suprStackSize, pT ));
-        //
-        iUserThreadStackSize += userStackSize;
-		ret += userStackSize + suprStackSize;
-        //
-		pLink = pLink->iNext;
-		}
-	//
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::StackSize() - END - this: 0x%08x, total stack size for process: %8d, iUserThreadStackSize: %8d", this, ret, iUserThreadStackSize ) );
-	return ret;
-    }
-
-
-void DMemSpyInspectedProcess::ResetPendingChanges()
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetPendingChanges() - START - this: 0x%08x", this ) );
-    NKern::ThreadEnterCS();
-    //
-    SDblQueLink* link = iPendingChanges.GetFirst();
-	while( link )
-		{
-        TMemSpyTrackedChunkChangeInfo* cachedChange = _LOFF( link, TMemSpyTrackedChunkChangeInfo, iLink );
-        delete cachedChange;
-        link = iPendingChanges.GetFirst();
-		}
-    //
-    NKern::ThreadLeaveCS();
-    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetPendingChanges() - END - this: 0x%08x", this ) );
-    }
-
-
-void DMemSpyInspectedProcess::Lock() const
-	{
-	NKern::ThreadEnterCS();
-	Kern::MutexWait(*iLock);
-	}
-
-void DMemSpyInspectedProcess::Unlock() const
-	{
-	Kern::MutexSignal(*iLock);
-	NKern::ThreadLeaveCS();
-	}
-
-
-
-
-
-
-
-
-
-
-TMemSpyTrackedChunk::TMemSpyTrackedChunk( DChunk* aChunk, TType aType )
-:   iChunk( aChunk ), iType( aType ), iSize( 0 ), iUnused( EFalse )
-    {
-    }
-
-
-void TMemSpyTrackedChunk::SetSize( TInt aSize )
-    {
-    iSize = aSize;
-    }
-
-
-void TMemSpyTrackedChunk::SetUnused( TBool aUnused )
-    {
-    iUnused = aUnused;
-    }
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverInspectedProcessManager.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +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 "MemSpyDriverInspectedProcessManager.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include "MemSpyDriverInspectedProcess.h"
-
-
-DMemSpyInspectedProcessManager::DMemSpyInspectedProcessManager()
-    {
-    }
-
-
-DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager()
-	{
-	TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - START"));
-    NKern::ThreadEnterCS();
-
-	TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - cancelling event monitor..."));
-    EventMonitor().RequestEventsCancel( *this );
-
-	TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - freeing all inspected processes..."));
-    FreeAllInspectedProcesses();
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - closing auto-start SID list..."));
-    iAutoStartSIDs.Close();
-
-    if  ( iDevice )
-		{
-        TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - closing iDevice" ));
-		iDevice->Close(NULL);
-		}
-
-    NKern::ThreadLeaveCS();
-	TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - END"));
-	}
-
-
-TInt DMemSpyInspectedProcessManager::Create( DMemSpyDriverDevice* aDevice )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::Create() - START" ) );
-    //
-    TInt error = aDevice->Open();
-    if  ( error == KErrNone )
-        {
-        iDevice = aDevice;
-
-        TRACE( Kern::Printf("DMemSpyInspectedProcessManager::Create() - requesting events..." ) );
-        EventMonitor().RequestEvents( *this );
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::Create() - END - error: %d", error ) );
-    return error;
-    }
-
-
-TInt DMemSpyInspectedProcessManager::ProcessOpen( DProcess* aProcess )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessOpen() - START - aProcess: 0x%08x (%O)", aProcess, aProcess ) );
-    NKern::ThreadEnterCS();
-    TInt error = KErrNotFound;
-    //
-    DMemSpyInspectedProcess* object = InspectedProcessByProcessId( aProcess->iId );
-    if  ( object == NULL )
-        {
-        object = new DMemSpyInspectedProcess( *iDevice );
-        //
-        if ( object == NULL )
-            {
-            error = KErrNoMemory;
-            }
-        else
-            {
-            error = object->Open( aProcess );
-            //
-            if  ( error == KErrNone )
-                {
-                iMonitoredProcesses.Add( &object->iPMLink );
-                }
-            else
-                {
-                delete object;
-                }
-            }
-        }
-    else
-        {
-        error = KErrNone;
-        }
-    //
-    NKern::ThreadLeaveCS();
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessOpen() - END - aProcess: 0x%08x, error: %d", aProcess, error ) );
-    return error;
-    }
-
-
-TInt DMemSpyInspectedProcessManager::ProcessClose( DProcess* aProcess )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessClose() - START - aProcess: 0x%08x (%O)", aProcess, aProcess ) );
-    TInt error = KErrNotFound;
-    //
-    DMemSpyInspectedProcess* object = InspectedProcessByProcessId( aProcess->iId );
-    if  ( object != NULL )
-        {
-        NKern::ThreadEnterCS();
-        object->iPMLink.Deque();
-        delete object;
-        NKern::ThreadLeaveCS();
-        error = KErrNone;
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessClose() - END - aProcess: 0x%08x, error: %d", aProcess, error ) );
-    return error;
-    }
-
-
-TInt DMemSpyInspectedProcessManager::ProcessCount() const
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessCount() - START" ) );
-    TInt ret = 0;
-    //
-	const SDblQueLink* const anchor = &iMonitoredProcesses.iA;
-	for (SDblQueLink* link = iMonitoredProcesses.First(); link != anchor; link = link->iNext )
-		{
-        ++ret;
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessCount() - END - count: %d", ret ) );
-    return ret;
-    }
-
-
-DMemSpyInspectedProcess* DMemSpyInspectedProcessManager::InspectedProcessByProcessId( TUint aProcessId )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::InspectedProcessByProcessId() - START - aProcessId: 0x%08x", aProcessId ) );
-    DMemSpyInspectedProcess* ret = 0;
-    //
-	const SDblQueLink* const anchor = &iMonitoredProcesses.iA;
-	for (SDblQueLink* link = iMonitoredProcesses.First(); link != anchor; link = link->iNext )
-		{
-		DMemSpyInspectedProcess* object = _LOFF( link, DMemSpyInspectedProcess, iPMLink );
-        //
-        if  ( object->ProcessId() == aProcessId )
-            {
-            ret = object;
-            break;
-            }
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::InspectedProcessByProcessId() - END - aProcessId: 0x%08x, ret: 0x%08x", aProcessId, ret ) );
-    return ret;
-    }
-
-
-void DMemSpyInspectedProcessManager::AutoStartListReset()
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::AutoStartListReset() - START") );
-    NKern::ThreadEnterCS();
-
-    iAutoStartSIDs.Reset();
-
-    NKern::ThreadLeaveCS();
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::AutoStartListReset() - END") );
-    }
-
-
-TInt DMemSpyInspectedProcessManager::AutoStartListAdd( TUint aSID )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::AutoStartListAdd() - START - aSID: 0x%08x", aSID ) );
-    //
-    NKern::ThreadEnterCS();
-    const TInt error = iAutoStartSIDs.Append( aSID );
-    NKern::ThreadLeaveCS();
-    //
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::AutoStartListAdd() - END - error: %d", error ) );
-    return error;
-    }
-
-
-
-
-
-
-void DMemSpyInspectedProcessManager::FreeAllInspectedProcesses()
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::FreeAllInspectedProcesses() - START") );
-	
-    SDblQueLink* link = iMonitoredProcesses.GetFirst();
-	while( link )
-		{
-		DMemSpyInspectedProcess* object = _LOFF( link, DMemSpyInspectedProcess, iPMLink );
-        if  ( object )
-            {
-            delete object;
-            }
-
-        link = iMonitoredProcesses.GetFirst();
-		}
-
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::FreeAllInspectedProcesses() - END") );
-    }
-
-
-DMemSpyEventMonitor& DMemSpyInspectedProcessManager::EventMonitor()
-    {
-    return iDevice->EventMonitor();
-    }
-
-
-TUint DMemSpyInspectedProcessManager::EMTypeMask() const
-    {
-    return EMemSpyEventProcessAdd;
-    }
-
-
-void DMemSpyInspectedProcessManager::EMHandleProcessAdd( DProcess& aProcess )
-    {
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::EMHandleProcessAdd() - START - aProcess: 0x%08x %O", &aProcess, &aProcess ) );
- 
-    const TUint uid3 = aProcess.iUids.iUid[ 2 ].iUid;
-    const TInt findResult = iAutoStartSIDs.Find( uid3 );
-
-#ifdef _DEBUG
-    const TUint uid1 = aProcess.iUids.iUid[ 0 ].iUid;
-    const TUint uid2 = aProcess.iUids.iUid[ 1 ].iUid;
-    Kern::Printf("DMemSpyInspectedProcessManager::EMHandleProcessAdd() - uids[ 0x%08x / 0x%08x / 0x%08x ], findResult: %d", uid1, uid2, uid3, findResult );
-#endif
-    //
-    if  ( findResult != KErrNotFound )
-        {
-        TRACE( Kern::Printf("DMemSpyInspectedProcessManager::EMHandleProcessAdd() - AUTO-START FOR PROCESS %O DETECTED", &aProcess ) );
-        const TInt error = ProcessOpen( &aProcess );
-        (void) error;
-        TRACE( Kern::Printf("DMemSpyInspectedProcessManager::EMHandleProcessAdd() - auto-start error: %d", error ) );
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::EMHandleProcessAdd() - END" ) );
-    }
-
-
-
-
-
-
-
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverLogicalChannel.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,325 +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 "MemSpyDriverLogicalChannel.h"
-
-// System includes
-#include <u32hal.h>
-#include <e32rom.h>
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include <memspy/driver/memspydriverconstants.h>
-#include "MemSpyDriverLogChanChunks.h"
-#include "MemSpyDriverLogChanClientServer.h"
-#include "MemSpyDriverLogChanCodeSegs.h"
-#include "MemSpyDriverLogChanContainers.h"
-#include "MemSpyDriverLogChanHeapData.h"
-#include "MemSpyDriverLogChanHeapWalk.h"
-#include "MemSpyDriverLogChanHeapInfo.h"
-#include "MemSpyDriverLogChanMisc.h"
-#include "MemSpyDriverLogChanProcessInspection.h"
-#include "MemSpyDriverLogChanStack.h"
-#include "MemSpyDriverLogChanRawMemory.h"
-#include "MemSpyDriverLogChanUserEventMonitor.h"
-#include "MemSpyDriverLogChanThreadAndProcess.h"
-
-
-DMemSpyDriverLogicalChannel::DMemSpyDriverLogicalChannel()
-    {
-    }
-
-
-DMemSpyDriverLogicalChannel::~DMemSpyDriverLogicalChannel()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::~DMemSpyDriverLogicalChannel() - START"));
-
-    NKern::ThreadEnterCS();
-    SubChannelsDestroy();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::~DMemSpyDriverLogicalChannel() - closing client thread..."));
-    Kern::SafeClose( (DObject*&) iClientThread, NULL );
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::~DMemSpyDriverLogicalChannel() - calling device to cleanup..."));
-    MemSpyDevice().Cleanup();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::~DMemSpyDriverLogicalChannel() - END"));
-	}
-
-
-TInt DMemSpyDriverLogicalChannel::DoCreate( TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& aVer )
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::DoCreate() - START - heldFM: %d, device: 0x%08x", Kern::CurrentThread().iNThread.iHeldFastMutex != NULL, &MemSpyDevice() ) );
-
-    TInt error = KErrNone;
-    //
-    if  ( !Kern::QueryVersionSupported( KMemSpyDriverVersion(), aVer ) )
-        {
-        error = KErrNotSupported;
-        }
-    else
-        {
-        // Try to get the memory model type
-        
-    	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::DoCreate - opening client thread..."));
-
-        iClientThread = &Kern::CurrentThread();
-	    error = iClientThread->Open();
-        TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::DoCreate - client thread open error: %d", error ));
-
-        if  ( error == KErrNone )
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::DoCreate - creating sub channels error: %d", error ));
-            error = SubChannelsRegister();
-            }
-        }
-    //
-	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::DoCreate() - END - heldFM: %d", Kern::CurrentThread().iNThread.iHeldFastMutex != NULL ) );
-    return error;
-	}
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogicalChannel::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TRACE( Kern::Printf(" " ) );
-	TRACE( Kern::Printf(" " ) );
-	TRACE( Kern::Printf("--------------------------------------------------------------------------------------------------------------------- " ) );
-	TRACE_OP( Kern::Printf("DMemSpyDriverLogicalChannel::Request() - START - fn: %3d, a1: 0x%08x, a2: 0x%08x, heldFM: %d", aFunction, a1, a2, iClientThread->iNThread.iHeldFastMutex != NULL ) );
-	TRACE( Kern::Printf("--------------------------------------------------------------------------------------------------------------------- " ) );
-	//
-    TInt r = KErrNotSupported;
-    //
-    DMemSpyDriverLogChanBase* handler = SubChannelForFunction( aFunction );
-    if  ( handler )
-        {
-        r = handler->Request( aFunction, a1, a2 );
-        }
-    //
-#ifdef _DEBUG
-    if  ( r < 0 && r != KErrEof )
-        {
-	    Kern::Printf( "DMemSpyDriverLogicalChannel::Request() - END - fn: %3d, a1: 0x%08x, a2: 0x%08x, heldFM: %d, r: %d", aFunction, a1, a2, iClientThread->iNThread.iHeldFastMutex != NULL, r );
-        }
-#endif
-	TRACE( Kern::Printf(" " ) );
-	TRACE( Kern::Printf(" " ) );
-    //
-    return r;
-	}
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogicalChannel::SubChannelsRegister()
-    {
-    TInt r = KErrNone;
-    DMemSpyDriverDevice& device = MemSpyDevice();
-    DMemSpyDriverLogChanBase* subChan = NULL;
-    //
-    subChan = new DMemSpyDriverLogChanChunks( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanClientServer( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanCodeSegs( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanContainers( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanHeapData( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanHeapInfo( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanHeapWalk( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanMisc( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanProcessInspection( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanRawMemory( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanStack( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanThreadAndProcess( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    subChan = new DMemSpyDriverLogChanUserEventMonitor( device, *iClientThread );
-    r = SubChannelConstructAndSave( subChan );
-    if ( r != KErrNone )
-        {
-        return r;
-        }
-    //
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogicalChannel::SubChannelConstructAndSave( DMemSpyDriverLogChanBase*& aSubChannel )
-    {
-    TInt r = KErrNoMemory;
-    //
-    if ( aSubChannel )
-        {
-        NKern::ThreadEnterCS();
-        r = aSubChannel->Construct();
-        //
-        if  ( r == KErrNone )
-            {
-            r = iSubChannels.Append( aSubChannel );
-            if  ( r != KErrNone )
-                {
-                delete aSubChannel;
-                }
-            }
-        else
-            {
-            delete aSubChannel;
-            }
-        //
-        NKern::ThreadLeaveCS();
-        }
-    //
-    aSubChannel = NULL;
-    return r;
-    }
-
-
-void DMemSpyDriverLogicalChannel::SubChannelsDestroy()
-    {
-    const TInt count = iSubChannels.Count();
-	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::SubChannelsDestroy() - START - count: %d", count ) );
-    //
-    NKern::ThreadEnterCS();
-    for( TInt i=0; i<count; i++ )
-        {
-        DMemSpyDriverLogChanBase* subChan = iSubChannels[ i ];
-	    TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::SubChannelsDestroy() - deleting subChannel: 0x%08x", subChan ) );
-        delete subChan;
-        }
-    //
-    iSubChannels.Reset();
-    NKern::ThreadLeaveCS();
-    //
-	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::SubChannelsDestroy() - END" ) );
-    }
-
-
-DMemSpyDriverLogChanBase* DMemSpyDriverLogicalChannel::SubChannelForFunction( TInt aFunction )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::SubChannelForFunction() - START - aFunction: %d", aFunction ) );
-    //
-    DMemSpyDriverLogChanBase* ret = NULL;
-    const TInt count = iSubChannels.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        DMemSpyDriverLogChanBase* subChan = iSubChannels[ i ];
-        if  ( subChan->IsHandler( aFunction ) )
-            {
-            ret = subChan;
-            break;
-            }
-        }
-    //
-	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::SubChannelForFunction() - END - aFunction: %d, subChannel: 0x%08x", aFunction, ret ) );
-    return ret;
-    }
-
-
-DMemSpyDriverDevice& DMemSpyDriverLogicalChannel::MemSpyDevice()
-    {
-    DMemSpyDriverDevice& device = *((DMemSpyDriverDevice*) iDevice);
-    return device;
-    }
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverOSAdaption.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1515 +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 "MemSpyDriverOSAdaption.h"
-
-// System includes
-#include <kern_priv.h>
-#include <nkern.h>
-#include <nk_plat.h>
-
-#ifdef __MARM__
-#include <arm.h>
-#endif
-
-// I've removed UNALIGNED_DATA_MEMBER in preference for just using memcpy to get round the potential unaligned access. -TomS
-
-// User includes
-#include "MemSpyDriverLog.h"
-#include "MemSpyDriverPAndS.h"
-#include "MemSpyDriverDevice.h"
-
-// Internal constants
-const TInt KMemSpyLocalThreadDataSizeEstimate = 0x80; // The amount of user stack that MemSpy attempts to scan for the RHeaep vTable
-
-
-
-DMemSpyDriverOSAdaptionDObject::DMemSpyDriverOSAdaptionDObject( DMemSpyDriverOSAdaption& aOSAdaption )
-:   iOSAdaption( aOSAdaption )
-    {
-    }
-
-
-TUint8 DMemSpyDriverOSAdaptionDObject::GetContainerID( DObject& aObject ) const
-    {
-    return aObject.iContainerID;
-    }
-
-
-TObjectType DMemSpyDriverOSAdaptionDObject::GetObjectType( DObject& aObject ) const
-    {
-    const TUint8 containerId = GetContainerID( aObject );
-    const TObjectType ret = static_cast< TObjectType >( containerId - 1 );
-    return ret;
-    }
-
-
-DObject* DMemSpyDriverOSAdaptionDObject::GetOwner( DObject& aObject ) const
-    {
-    return aObject.iOwner;
-    }
-
-
-DObject* DMemSpyDriverOSAdaptionDObject::GetOwner( DObject& aObject, TUint8 aExpectedContainerId ) const
-    {
-    DObject* owner = GetOwner( aObject );
-    //
-    const TUint8 containerId = GetContainerID( aObject ) - 1;
-    if ( containerId != aExpectedContainerId )
-        {
-        owner = NULL;
-        }
-    //
-    return owner;
-    }
-
-TInt DMemSpyDriverOSAdaptionDObject::GetAccessCount( DObject& aObject ) const
-    {
-    return aObject.AccessCount();
-    }
-
-TInt DMemSpyDriverOSAdaptionDObject::GetUniqueID( DObject& aObject ) const
-    {
-    return aObject.UniqueID();
-    }
-
-TUint DMemSpyDriverOSAdaptionDObject::GetProtection( DObject& aObject ) const
-    {
-    return aObject.Protection();
-    }
-
-TUint8* DMemSpyDriverOSAdaptionDObject::GetAddressOfKernelOwner( DObject& aObject ) const
-    {
-    return (TUint8*)aObject.Owner();
-    }
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDThread::DMemSpyDriverOSAdaptionDThread( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    // Get current NThread and map it on to DThread
-    NThread* nThread = NKern::CurrentThread();
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - nThread: 0x%08x", nThread ) );
-    DThread* dThread = Kern::NThreadToDThread( nThread );
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - dThread: 0x%08x", dThread ) );
-
-    // At this point, it should be possible to work out the offset of the NThread within DThread.
-    iOffset_NThread = reinterpret_cast<TUint32>( nThread ) - reinterpret_cast<TUint32>( dThread );
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - difference: 0x%08x", iOffset_NThread ) );
-
-    // Work out the delta between compile time and run time
-    TInt delta = iOffset_NThread - _FOFF( DThread, iNThread );
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - compile time vs run time offset delta: %d", delta ));
-
-    // iNThread
-    TRACE( Kern::Printf( "OSA - [DThread::iNThread]              compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iNThread), iOffset_NThread ));
-
-    // iExitType
-    iOffset_ExitType = _FOFF( DThread, iExitType ) + delta;
-    TRACE( Kern::Printf( "OSA - [DThread::iExitType]             compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iExitType), iOffset_ExitType ));
-
-    // iSupervisorStack
-    iOffset_SupervisorStackBase = _FOFF( DThread, iSupervisorStack ) + delta;
-    TRACE( Kern::Printf( "OSA - [DThread::iSupervisorStack]      compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iSupervisorStack), iOffset_SupervisorStackBase ));
-
-    // iSupervisorStackSize
-    iOffset_SupervisorStackSize = _FOFF( DThread, iSupervisorStackSize ) + delta;
-    TRACE( Kern::Printf( "OSA - [DThread::iSupervisorStackSize]  compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iSupervisorStackSize), iOffset_SupervisorStackSize ));
-    }
-
-
-NThread* DMemSpyDriverOSAdaptionDThread::GetNThread( DThread& aObject ) const
-    {
-    DThread* dThread = &aObject;
-    TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_NThread;
-    NThread* pRet = reinterpret_cast< NThread* >( pTarget );
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetNThread() - aObject: 0x%08x, ret: 0x%08x", &aObject, pRet ) );
-    return pRet;
-    }
-
-
-TExitType DMemSpyDriverOSAdaptionDThread::GetExitType( DThread& aObject ) const
-    {
-    DThread* dThread = &aObject;
-    TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_ExitType;
-	TUint8 exitType = *reinterpret_cast<TUint8*>(pTarget);
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetExitType() - aObject: 0x%08x, ret: %d", &aObject, (TInt)exitType ) );
-    return (TExitType)exitType;
-    }
-
-
-TUint32 DMemSpyDriverOSAdaptionDThread::GetSupervisorStackBase( DThread& aObject ) const
-    {
-    DThread* dThread = &aObject;
-    TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_SupervisorStackBase;
-
-	TUint32 ret;
-	memcpy(&ret, (const TAny*)pTarget, sizeof(TUint32));
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetSupervisorStackBase() - aObject: 0x%08x, ret: 0x%08x", &aObject, ret ) );
-    return ret;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDThread::GetSupervisorStackSize( DThread& aObject ) const
-    {
-    DThread* dThread = &aObject;
-    TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_SupervisorStackSize;
-	
-	TInt ret;
-	memcpy(&ret, (const TAny*)pTarget, sizeof(TInt));
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetSupervisorStackSize() - aObject: 0x%08x, ret: %d", &aObject, ret ) );
-    return ret;
-    }
-
-
-RAllocator* DMemSpyDriverOSAdaptionDThread::GetAllocator( DThread& aObject ) const
-    {
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocator() - START" ) );
-    //
-    RAllocator* ret = aObject.iAllocator;
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocator() - allocator: 0x%08x", ret ) );
-    //
-    if  ( ret == NULL )
-        {
-        TUint32 stackAddress = 0;
-        ret = GetAllocatorAndStackAddress( aObject, stackAddress );
-        }
-    //
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocator() - END - ret: 0x%08x", ret ) );
-    return ret;
-    }
-
-
-CActiveScheduler* DMemSpyDriverOSAdaptionDThread::GetActiveScheduler( DThread& aObject ) const
-    {
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - START" ) );
-    CActiveScheduler* ret = aObject.iScheduler;
-    //
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - scheduler: 0x%08x", ret ) );
-    if  ( ret == NULL )
-        {
-        // We need the stack address of the heap in order to locate the active scheduler.
-        // Implicitly this means that MemSpy can only list active scheduler contents for threads
-        // that use a default RHeap. This has always been the case, so this is not a functional break.
-        //
-        // Assumed stack layout is something like this:
-        // 
-        // stack[0x00403ffc] 0x00000000, vTable: 0x00000000 (offset: 0004)
-        // stack[0x00403ff8] 0x00000000, vTable: 0x00000000 (offset: 0008)
-        // stack[0x00403ff4] 0x00000002, vTable: 0x00000000 (offset: 0012)
-        // stack[0x00403ff0] 0x00000002, vTable: 0x00000000 (offset: 0016)
-        // stack[0x00403fec] 0x00000000, vTable: 0x00000000 (offset: 0020)
-        // stack[0x00403fe8] 0x0000000c, vTable: 0x00000000 (offset: 0024)
-        // stack[0x00403fe4] 0x00600078, vTable: 0x80228938 (offset: 0028)
-        // stack[0x00403fe0] 0x00000001, vTable: 0x00000000 (offset: 0032)
-        // stack[0x00403fdc] 0x00600000, vTable: 0x80268430 (offset: 0036)		TLocalThreadData::iTlsHeap       RAllocator*		  80268428    0034    vtable for RHeap
-        // stack[0x00403fd8] 0x0060009c, vTable: 0x80268394 (offset: 0040)		TLocalThreadData::iTrapHandler   TTrapHandler		  8026838c    0014    vtable for TCleanupTrapHandler
-        // stack[0x00403fd4] 0x00600110, vTable: 0x802682ec (offset: 0044)		TLocalThreadData::iScheduler     CActiveScheduler*	  802682e4    002c    vtable for CActiveScheduler
-        // stack[0x00403fd0] 0x00600000, vTable: 0x80268430 (offset: 0048)      TLocalThreadData::iHeap          RAllocator*          80268428    0034    vtable for RHeap
-        // stack[0x00403fcc] 0x00000000, vTable: 0x00000000 (offset: 0052)
-        // stack[0x00403fc8] 0x00100000, vTable: 0x00000000 (offset: 0056)
-        //
-        // GetAllocatorAndStackAddress() will return the first RHeap* it finds, so this will be iTlsHeap, which
-        // is actually no bad thing as it will hopefully be initialised using an RHeap pointer.
-        // CActiveScheduler* is 8 bytes further on from that.
-        //
-        const TUint32 KOffsetToCActiveScheduler = 8;
-        // 
-        TUint32 stackAddress = 0;
-        RAllocator* allocator = GetAllocatorAndStackAddress( aObject, stackAddress );
-        TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - allocator: 0x%08x, stackAddress: 0x%08x", allocator, stackAddress ) );
-
-        // This assumes the layout of the thread local data structure, i.e. that the four bytes that follow the
-        // allocator pointer are always the active scheduler pointer.
-        if  ( allocator != NULL && stackAddress > 0 )
-            {
-            TUint32* ptr = reinterpret_cast< TUint32* >( stackAddress - KOffsetToCActiveScheduler );
-            const TInt r = Kern::ThreadRawRead( &aObject, ptr, &ret, sizeof( ret ) );
-            TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - stack address containing scheduler pointer: 0x%08x, read result: %d, CActiveScheduler*: 0x%08x", ptr, r, ret ) );
-            if  ( r != KErrNone )
-                {
-                ret = NULL;
-                }
-            }
-        }
-    //
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - END - ret: 0x%08x", ret ) );
-    return ret;
-    }
-
-
-TUint32 DMemSpyDriverOSAdaptionDThread::GetUserStackBase( DThread& aObject ) const
-    {
-    return aObject.iUserStackRunAddress;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDThread::GetUserStackSize( DThread& aObject ) const
-    {
-    return aObject.iUserStackSize;
-    }
-
-
-DProcess* DMemSpyDriverOSAdaptionDThread::GetOwningProcess( DThread& aObject ) const
-    {
-    return aObject.iOwningProcess;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDThread::GetId( DThread& aObject ) const
-    {
-    return aObject.iId;
-    }
-
-
-MemSpyObjectIx* DMemSpyDriverOSAdaptionDThread::GetHandles( DThread& aObject ) const
-    {
-    MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Thread( aObject );
-    return handles;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDThread::GetOwningProcessId( DThread& aObject ) const
-    {
-    DProcess* process = GetOwningProcess( aObject );
-    TUint ret = 0;
-    //
-    if  ( process )
-        {
-        ret = OSAdaption().DProcess().GetId( *process );
-        }
-    //
-    return ret;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDThread::GetPriority( DThread& aObject ) const
-    {
-    return aObject.iThreadPriority;
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDThread::GetAddressOfOwningProcess( DThread& aObject ) const
-    {
-    return (TUint8*)aObject.iOwningProcess;
-    }
-
-
-void DMemSpyDriverOSAdaptionDThread::GetNameOfOwningProcess( DThread& aObject, TDes& aName ) const
-    {
-    if  ( aObject.iOwningProcess )
-        {
-        aObject.iOwningProcess->FullName( aName );
-        }
-    }
-
-
-RAllocator* DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress( DThread& aObject, TUint32& aStackAddress ) const
-    {
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - START" ) );
-    //
-    aStackAddress = 0;
-    RAllocator* ret = NULL;
-
-    // We will assume the thread is running and that the user-side stack has been set up
-    // accordingly.
-    const TUint32 base = GetUserStackBase( aObject );
-    const TInt size = GetUserStackSize( aObject );
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - base: 0x%08x, size: %d, KMemSpyLocalThreadDataSizeEstimate: %d", base, size, KMemSpyLocalThreadDataSizeEstimate ) );
-    const TUint32 top = base + size;
-
-    // This is the RHeap vtable we are looking for
-    const TUint32 rHeapVTable = OSAdaption().Device().RHeapVTable();
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - rHeapVTable: 0x%08x", rHeapVTable ) );
-    //
-    TInt r = KErrNone;
-
-#ifdef TRACE_TYPE_GENERAL 
-    for( TUint32 addr = top - 4; addr >= top - KMemSpyLocalThreadDataSizeEstimate; addr -= 4 )
-        {
-        TUint32 value = 0;
-        TUint32 possibleVTable = 0;
-        //
-        TUint32* ptr = reinterpret_cast< TUint32* >( addr );
-        //
-        r = Kern::ThreadRawRead( &aObject, ptr, &value, sizeof( value ) );
-        if  ( r == KErrNone )
-            {
-            Kern::ThreadRawRead( &aObject, reinterpret_cast< const TAny* >( value ), &possibleVTable, sizeof( possibleVTable ) );
-            }
-        TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - stack[0x%08x] 0x%08x, vTable: 0x%08x (offset: %04d)", addr, value, possibleVTable, top - addr ) );
-        }
-#endif
-
-    for( TUint32 addr = top - 4; addr >= top - KMemSpyLocalThreadDataSizeEstimate; addr -= 4 )
-        {
-        TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - addr to read from: 0x%08x", addr ) );
-        TUint32 value = 0;
-        //
-        TUint32* ptr = reinterpret_cast< TUint32* >( addr );
-        //
-        r = Kern::ThreadRawRead( &aObject, ptr, &value, sizeof( value ) );
-        TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - read from: 0x%08x, result: %d, value: 0x%08x", addr, r, value ) );
-        //
-        if  ( r == KErrNone )
-            {
-            // Try and read from the address which is now stored within 'value'. We must do this because 
-            // the TLD class holds an RAllocator* and we need to ascertain the vTable of the RAllocator* matches the
-            // only supported vTable that MemSpy understands (RHeap*).
-            TUint32 possibleVTable = 0;
-            r = Kern::ThreadRawRead( &aObject, reinterpret_cast< const TAny* >( value ), &possibleVTable, sizeof( possibleVTable ) );
-            TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - possible vtable read from: 0x%08x, result: %d, possibleVTable: 0x%08x", value, r, possibleVTable ) );
-            if  ( r == KErrNone && possibleVTable == rHeapVTable )
-                {
-                aStackAddress = addr;
-                ret = reinterpret_cast< RAllocator* >( value );
-                break;
-                }
-            }
-        }
-    //
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - END - ret: 0x%08x, aStackAddress: 0x%08x", ret, aStackAddress ) );
-    return ret;
-    }    
-
-
-TBool DMemSpyDriverOSAdaptionDThread::IsHandleIndexValid( DThread& aObject ) const
-    {
-    MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Thread( aObject );
-    return ( handles != NULL );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDProcess::DMemSpyDriverOSAdaptionDProcess( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDProcess::GetId( DProcess& aObject ) const
-    {
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDProcess::GetId() - value: %d", aObject.iId ) );
-    return aObject.iId;
-    }
-
-
-MemSpyObjectIx* DMemSpyDriverOSAdaptionDProcess::GetHandles( DProcess& aObject ) const
-    {
-    MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Process( aObject );
-    return handles;
-    }
-
-
-TExitType DMemSpyDriverOSAdaptionDProcess::GetExitType( DProcess& aObject ) const
-    {
-    return static_cast< TExitType >( aObject.iExitType );
-    }
-
-
-DThread* DMemSpyDriverOSAdaptionDProcess::OpenFirstThread( DProcess& aProcess ) const
-    {
-	// It appears that the system lock needs to be held while manipulating the iThreadQ
-	DThread* result = NULL;
-	NKern::LockSystem();
-	// We don't use DProcess::FirstThread() as that doesn't appear to do any checking of whether the list is empty, ie if there are no threads at all
-	SDblQueLink* threadLink = aProcess.iThreadQ.First();
-	if (threadLink != NULL && threadLink != &aProcess.iThreadQ.iA)
-		{
-		result = _LOFF(threadLink,DThread,iProcessLink);
-		if (result->Open() != KErrNone)
-			{
-			result = NULL;
-			}
-		}
-	NKern::UnlockSystem();
-    return result;
-    }
-
-
-TUint32 DMemSpyDriverOSAdaptionDProcess::GetSID( DProcess& aObject ) const
-    {
-    return GetSecurityInfo( aObject ).iSecureId;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDProcess::GetSecurityZone( DProcess& aObject ) const
-    {
-    return aObject.iSecurityZone;
-    }
-
-
-SSecurityInfo& DMemSpyDriverOSAdaptionDProcess::GetSecurityInfo( DProcess& aObject ) const
-    {
-    return aObject.iS;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDProcess::GetFlags( DProcess& aObject ) const
-    {
-    return aObject.iFlags;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDProcess::GetGeneration( DProcess& aObject ) const
-    {
-    return aObject.iGeneration;
-    }
-
-
-SDblQue& DMemSpyDriverOSAdaptionDProcess::GetThreadQueue( DProcess& aObject ) const
-    {
-    return aObject.iThreadQ;
-    }
-
-
-DThread* DMemSpyDriverOSAdaptionDProcess::GetThread( SDblQueLink* aLink ) const
-    {
-	DThread* ret = _LOFF( aLink, DThread, iProcessLink );
-    return ret;
-    }
-
-
-void DMemSpyDriverOSAdaptionDProcess::SetSID( DProcess& aObject, TUint32 aSID ) const
-    {
-    GetSecurityInfo( aObject ).iSecureId = aSID;
-    }
-
-
-void DMemSpyDriverOSAdaptionDProcess::SetSecurityZone( DProcess& aObject, TUint aSecurityZone ) const
-    {
-    aObject.iSecurityZone = aSecurityZone;
-    }
-
-
-TBool DMemSpyDriverOSAdaptionDProcess::IsHandleIndexValid( DProcess& aObject ) const
-    {
-    MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Process( aObject );
-    return ( handles != NULL );
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDProcess::GetCreatorId( DProcess& aObject ) const
-    {
-    return aObject.iCreatorId;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDProcess::GetAttributes( DProcess& aObject ) const
-    {
-    return aObject.iAttributes;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDProcess::GetPriority( DProcess& aObject ) const
-    {
-    return aObject.iPriority;
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDProcess::GetAddressOfOwningProcess( DProcess& aObject ) const
-    {
-    return (TUint8*)aObject.iOwningProcess;
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDProcess::GetAddressOfDataBssStackChunk( DProcess& aObject ) const
-    {
-    return (TUint8*)aObject.iDataBssStackChunk;
-    }
-
-TBool DMemSpyDriverOSAdaptionDProcess::IsKernProcess(DProcess& aProcess) const
-	{
-	// The kernel process always has pid 1
-	return GetId(aProcess) == 1;
-	}
-
-
-
-DMemSpyDriverOSAdaptionDChunk::DMemSpyDriverOSAdaptionDChunk( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDChunk::GetSize( DChunk& aObject ) const
-    {
-    return aObject.Size();
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDChunk::GetMaxSize( DChunk& aObject ) const
-    {
-    return aObject.MaxSize();
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDChunk::GetBase( DChunk& aChunk ) const
-    {
-    TUint8* base = aChunk.Base();
-	if (base == 0)
-		{
-		// Under flexible memory model, DChunk::Base() will return NULL (for non-fixed chunks anyway, and that means most of them)
-		// A more useful thing to return is the base address in the owning process
-		DProcess* proc = GetOwningProcess(aChunk);
-		NKern::ThreadEnterCS();
-		if (proc && proc->Open() == KErrNone)
-			{
-			// Probably shouldn't call ChunkUserBase for a non-user-owned chunk
-			if (!OSAdaption().DProcess().IsKernProcess(*proc))
-				{
-				DThread* firstThread = OSAdaption().DProcess().OpenFirstThread(*proc);
-				if (firstThread)
-					{
-					base = Kern::ChunkUserBase(&aChunk, firstThread);
-					firstThread->Close(NULL);
-					}
-				}
-			proc->Close(NULL);
-			}
-		NKern::ThreadLeaveCS();
-		}
-	return base; 
-    }
-
-
-DProcess* DMemSpyDriverOSAdaptionDChunk::GetOwningProcess( DChunk& aObject ) const
-    {
-    return aObject.OwningProcess();
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDChunk::GetOwningProcessId( DChunk& aObject ) const
-    {
-    TUint ret = 0;
-    //
-    DProcess* process = GetOwningProcess( aObject );
-    if  ( process )
-        {
-        ret = OSAdaption().DProcess().GetId( *process );
-        }
-    //
-    return ret;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDChunk::GetControllingOwnerId( DChunk& aObject ) const
-    {
-    return aObject.iControllingOwner;
-    }
-
-
-TChunkType DMemSpyDriverOSAdaptionDChunk::GetType( DChunk& aObject ) const
-    {
-    return aObject.iChunkType;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDChunk::GetAttributes( DChunk& aObject ) const
-    {
-    return aObject.iAttributes;
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDChunk::GetAddressOfOwningProcess( DChunk& aObject ) const
-    {
-    return (TUint8*)aObject.iOwningProcess;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDChunk::GetBottom( DChunk& aObject ) const
-    {
-    return aObject.Bottom();
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDChunk::GetTop( DChunk& aObject ) const
-    {
-    return aObject.Top();
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDChunk::GetStartPos( DChunk& aObject ) const
-    {
-    return aObject.iStartPos;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDChunk::GetRestrictions( DChunk& aObject ) const
-    {
-    return aObject.iRestrictions;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDChunk::GetMapAttr( DChunk& aObject ) const
-    {
-    return aObject.iMapAttr;
-    }
-
-
-void DMemSpyDriverOSAdaptionDChunk::GetNameOfOwningProcess( DChunk& aObject, TDes& aName ) const
-    {
-    if ( aObject.OwningProcess() )
-        {
-         aObject.OwningProcess()->FullName( aName );
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDServer::DMemSpyDriverOSAdaptionDServer( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-SDblQue& DMemSpyDriverOSAdaptionDServer::GetSessionQueue( DServer& aObject ) const
-    {
-    return aObject.iSessionQ;
-    }
-
-
-DSession* DMemSpyDriverOSAdaptionDServer::GetSession( SDblQueLink* aLink ) const
-    {
-	DSession* session = _LOFF( aLink, DSession, iServerLink );
-    return session;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDServer::GetSessionCount( DServer& aObject ) const
-    {
-    TInt ret = 0;
-    //
-    SDblQueLink* anchor = &aObject.iSessionQ.iA;
-    SDblQueLink* link = aObject.iSessionQ.First();
-    //
-    while( link != anchor)
-	    {
- 	    ++ret;
-	    link = link->iNext;
-	    }
-    //
-    return ret;
-    }
-
-
-DThread* DMemSpyDriverOSAdaptionDServer::GetOwningThread( DServer& aObject ) const
-    {
-    return aObject.iOwningThread;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDServer::GetOwningThreadId( DServer& aObject ) const
-    {
-    TUint ret = 0;
-    //
-    DThread* thread = GetOwningThread( aObject );
-    if  ( thread )
-        {
-        ret = OSAdaption().DThread().GetId( *thread );
-        }
-    //
-    return ret;
-    }
-
-
-TIpcSessionType DMemSpyDriverOSAdaptionDServer::GetSessionType( DServer& aObject ) const
-    {
-    return static_cast< TIpcSessionType >( aObject.iSessionType );
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDServer::GetAddressOfOwningThread( DServer& aObject ) const
-    {
-    return (TUint8*)aObject.iOwningThread;
-    }
-
-
-void DMemSpyDriverOSAdaptionDServer::GetNameOfOwningThread( DServer& aObject, TDes& aName ) const
-    {
-    if ( aObject.iOwningThread )
-        {
-         aObject.iOwningThread->FullName( aName );
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDSession::DMemSpyDriverOSAdaptionDSession( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TIpcSessionType DMemSpyDriverOSAdaptionDSession::GetSessionType( DSession& aObject ) const
-    {
-    return static_cast< TIpcSessionType >( aObject.iSessionType );
-    }
-
-
-DServer* DMemSpyDriverOSAdaptionDSession::GetServer( DSession& aObject ) const
-    {
-    return aObject.iServer;
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDSession::GetAddressOfServer( DSession& aObject ) const
-    {
-    return (TUint8*)aObject.iServer;
-    }
-
-
-TUint16 DMemSpyDriverOSAdaptionDSession::GetTotalAccessCount( DSession& aObject ) const
-    {
-    return aObject.iTotalAccessCount;
-    }
-
-
-TUint8 DMemSpyDriverOSAdaptionDSession::GetSrvSessionType( DSession& aObject ) const
-    {
-    return aObject.iSvrSessionType;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDSession::GetMsgCount( DSession& aObject ) const
-    {
-    return aObject.iMsgCount;
-    }
-    
-
-TInt DMemSpyDriverOSAdaptionDSession::GetMsgLimit( DSession& aObject ) const
-    {
-    return aObject.iMsgLimit;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDCodeSeg::DMemSpyDriverOSAdaptionDCodeSeg( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-DCodeSeg* DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSeg( SDblQueLink* aLink ) const
-    {
-    DCodeSeg* ret = _LOFF( aLink, DCodeSeg, iTempLink );
-    return ret;
-    }
-
-
-DCodeSeg* DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSeg( DLibrary& aLibrary ) const
-    {
-    return aLibrary.iCodeSeg;
-    }
-
-
-DCodeSeg* DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSegFromHandle( TAny* aHandle ) const
-    {
-    DCodeSeg* ret = DCodeSeg::VerifyHandle( aHandle );
-    return ret;
-    }
-
-
-TBool DMemSpyDriverOSAdaptionDCodeSeg::GetIsXIP( DCodeSeg& aCodeSeg ) const
-    {
-    TBool ret = ETrue;
-    //
-#ifdef __WINS__
-    (void) aCodeSeg;
-#else
-    DEpocCodeSeg& epocCodeSegment = static_cast< DEpocCodeSeg& >( aCodeSeg );
-    ret = ( epocCodeSegment.iXIP != 0 );
-#endif
-    //
-    return ret;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSegQueue( DProcess& aObject, SDblQue& aQueue ) const
-    {
-	const TInt count = aObject.TraverseCodeSegs( &aQueue, NULL, DCodeSeg::EMarkDebug, DProcess::ETraverseFlagAdd );
-    return count;
-    }
-
-
-void DMemSpyDriverOSAdaptionDCodeSeg::EmptyCodeSegQueue( SDblQue& aQueue ) const
-    {
-	DCodeSeg::EmptyQueue( aQueue, DCodeSeg::EMarkDebug );
-    }
-
-
-TUint32 DMemSpyDriverOSAdaptionDCodeSeg::GetSize( DCodeSeg& aCodeSeg ) const
-    {
-    return aCodeSeg.iSize;
-    }
-
-
-void DMemSpyDriverOSAdaptionDCodeSeg::GetCreateInfo( DCodeSeg& aCodeSeg, TCodeSegCreateInfo& aInfo ) const
-    {
-    aCodeSeg.Info( aInfo );
-    }
-
-
-TUint8 DMemSpyDriverOSAdaptionDCodeSeg::GetState( DLibrary& aLibrary ) const
-    {
-    return aLibrary.iState;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDCodeSeg::GetMapCount( DLibrary& aLibrary ) const
-    {
-    return aLibrary.iMapCount;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDSemaphore::DMemSpyDriverOSAdaptionDSemaphore( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDSemaphore::GetCount( DSemaphore& aObject ) const
-    {
-    return aObject.iCount;
-    }
-
-
-TUint8 DMemSpyDriverOSAdaptionDSemaphore::GetResetting( DSemaphore& aObject ) const
-    {
-    return aObject.iResetting;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDMutex::DMemSpyDriverOSAdaptionDMutex( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDMutex::GetHoldCount( DMutex& aObject ) const
-    {
-    return aObject.iHoldCount;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDMutex::GetWaitCount( DMutex& aObject ) const
-    {
-    return aObject.iWaitCount;
-    }
-
-
-TUint8 DMemSpyDriverOSAdaptionDMutex::GetResetting( DMutex& aObject ) const
-    {
-    return aObject.iResetting;
-    }
-
-
-TUint8 DMemSpyDriverOSAdaptionDMutex::GetOrder( DMutex& aObject ) const
-    {
-    return aObject.iOrder;
-    }
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDLogicalDevice::DMemSpyDriverOSAdaptionDLogicalDevice( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDLogicalDevice::GetOpenChannels( DLogicalDevice& aObject ) const
-    {
-    return aObject.iOpenChannels;
-    }
-
-
-TVersion DMemSpyDriverOSAdaptionDLogicalDevice::GetVersion( DLogicalDevice& aObject ) const
-    {
-    return aObject.iVersion;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDLogicalDevice::GetParseMask( DLogicalDevice& aObject ) const
-    {
-    return aObject.iParseMask;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDLogicalDevice::GetUnitsMask( DLogicalDevice& aObject ) const
-    {
-    return aObject.iUnitsMask;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDPhysicalDevice::DMemSpyDriverOSAdaptionDPhysicalDevice( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TVersion DMemSpyDriverOSAdaptionDPhysicalDevice::GetVersion( DPhysicalDevice& aObject ) const
-    {
-    return aObject.iVersion;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDPhysicalDevice::GetUnitsMask( DPhysicalDevice& aObject ) const
-    {
-    return aObject.iUnitsMask;
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDPhysicalDevice::GetAddressOfCodeSeg( DPhysicalDevice& aObject ) const
-    {
-    return (TUint8*)aObject.iCodeSeg;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDChangeNotifier::DMemSpyDriverOSAdaptionDChangeNotifier( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDChangeNotifier::GetChanges( DChangeNotifier& aObject ) const
-    {
-    return aObject.iChanges;
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDChangeNotifier::GetAddressOfOwningThread( DChangeNotifier& aObject ) const
-    {
-    return (TUint8*)aObject.iThread;
-    }
-
-
-void DMemSpyDriverOSAdaptionDChangeNotifier::GetNameOfOwningThread( DChangeNotifier& aObject, TDes& aName ) const
-    {
-    if ( aObject.iThread )
-        {
-         aObject.iThread->FullName( aName );
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDUndertaker::DMemSpyDriverOSAdaptionDUndertaker( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDUndertaker::GetAddressOfOwningThread( DUndertaker& aObject ) const
-    {
-    return (TUint8*)aObject.iOwningThread;
-    }
-
-
-void DMemSpyDriverOSAdaptionDUndertaker::GetNameOfOwningThread( DUndertaker& aObject, TDes& aName ) const
-    {
-    if ( aObject.iOwningThread )
-        {
-         aObject.iOwningThread->FullName( aName );
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDCondVar::DMemSpyDriverOSAdaptionDCondVar( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TUint8 DMemSpyDriverOSAdaptionDCondVar::GetResetting( DCondVar& aObject ) const
-    {
-    return aObject.iResetting;
-    }
-
-
-TUint8* DMemSpyDriverOSAdaptionDCondVar::GetAddressOfMutex( DCondVar& aObject ) const
-    {
-    return (TUint8*)aObject.iMutex;
-    }
-
-
-void DMemSpyDriverOSAdaptionDCondVar::GetNameOfMutex( DCondVar& aObject, TDes& aName ) const
-    {
-    if ( aObject.iMutex )
-        {
-         aObject.iMutex->FullName( aName );
-        }
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDCondVar::GetWaitCount( DCondVar& aObject ) const
-    {
-    return aObject.iWaitCount;
-    }
-
-
-SDblQue& DMemSpyDriverOSAdaptionDCondVar::GetSuspendedQ( DCondVar& aObject ) const
-    {
-    return aObject.iSuspendedQ;
-    }
-
-
-DThread* DMemSpyDriverOSAdaptionDCondVar::GetThread( SDblQueLink* aLink ) const
-    {
-    DThread* thread = _LOFF( aLink, DThread, iWaitLink );
-    return thread;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDTimer::DMemSpyDriverOSAdaptionDTimer( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TTimer::TTimerType DMemSpyDriverOSAdaptionDTimer::GetType( DTimer& aObject ) const
-    {
-    const TTimer::TTimerType ret = aObject.iTimer.Type();
-    return ret;
-    }
-
-
-TTimer::TTimerState DMemSpyDriverOSAdaptionDTimer::GetState( DTimer& aObject ) const
-    {
-    const TTimer::TTimerState ret = static_cast<TTimer::TTimerState>( aObject.iTimer.iState );
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaptionDPropertyRef::DMemSpyDriverOSAdaptionDPropertyRef( DMemSpyDriverOSAdaption& aOSAdaption )
-:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
-    {
-    }
-
-
-TBool DMemSpyDriverOSAdaptionDPropertyRef::GetIsReady( DObject& aObject ) const
-    {
-    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
-    return ( prop != NULL );
-    }
-
-
-RProperty::TType DMemSpyDriverOSAdaptionDPropertyRef::GetType( DObject& aObject ) const
-    {
-    RProperty::TType ret = RProperty::EInt;
-    //
-    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
-    if  ( prop )
-        {
-        ret = (RProperty::TType) prop->iProp->iType;
-        }
-    //
-    return ret;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDPropertyRef::GetCategory( DObject& aObject ) const
-    {
-    TUint ret = 0;
-    //
-    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
-    if  ( prop )
-        {
-        ret = prop->iProp->iCategory;
-        }
-    //
-    return ret;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDPropertyRef::GetKey( DObject& aObject ) const
-    {
-    TUint ret = 0;
-    //
-    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
-    if  ( prop )
-        {
-        ret = prop->iProp->iKey;
-        }
-    //
-    return ret;
-    }
-
-
-TInt DMemSpyDriverOSAdaptionDPropertyRef::GetRefCount( DObject& aObject ) const
-    {
-    TInt ret = 0;
-    //
-    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
-    if  ( prop )
-        {
-        ret = prop->iProp->iRefCount;
-        }
-    //
-    return ret;
-    }
-
-
-TUint DMemSpyDriverOSAdaptionDPropertyRef::GetThreadId( DObject& aObject ) const
-    {
-    TUint ret = 0;
-    //
-    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
-    if  ( prop )
-        {
-        DThread* thread = prop->iClient;
-        if  ( thread )
-            {
-            ret = OSAdaption().DThread().GetId( *thread );
-            }
-        }
-    //
-    return ret;
-    }
-
-
-TUint32 DMemSpyDriverOSAdaptionDPropertyRef::GetCreatorSID( DObject& aObject ) const
-    {
-    TUint32 ret = 0;
-    //
-    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
-    if  ( prop )
-        {
-        ret = prop->iProp->iOwner;
-        }
-    //
-    return ret;
-    }
-
-
-DMemSpyPropertyRef* DMemSpyDriverOSAdaptionDPropertyRef::GetPropertyRef( DObject& aObject ) const
-    {
-    DMemSpyPropertyRef* ret = NULL;
-    //
-    const TUint8 containerId = GetContainerID( aObject ) - 1;
-    if ( containerId == EPropertyRef )
-        {
-        DMemSpyPropertyRef* prop = reinterpret_cast< DMemSpyPropertyRef* >( &aObject );
-        if ( prop->iProp && prop->iClient )
-            {
-            ret = prop;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverOSAdaption::DMemSpyDriverOSAdaption( DMemSpyDriverDevice& aDevice )
-:   iDevice( aDevice )
-    {
-    }
-
-
-DMemSpyDriverOSAdaption::~DMemSpyDriverOSAdaption()
-    {
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::~DMemSpyDriverOSAdaption() - START"));
-    NKern::ThreadEnterCS();
-    //
-    delete iDThread;
-    delete iDProcess;
-    delete iDChunk;
-    delete iDServer;
-    delete iDSession;
-    delete iDCodeSeg;
-    delete iDSemaphore;
-    delete iDMutex;
-    delete iDLogicalDevice;
-    delete iDPhysicalDevice;
-    delete iDChangeNotifier;
-    delete iDUndertaker;
-    delete iDCondVar;
-    delete iDTimer;
-    delete iDPropertyRef;
-    //
-    NKern::ThreadLeaveCS();
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::~DMemSpyDriverOSAdaption() - END"));
-    }
-
-
-TInt DMemSpyDriverOSAdaption::Construct()
-    {
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::Construct() - START" ) );
-    //
-    NKern::ThreadEnterCS();
-    //
-    TInt error = KErrNoMemory;
-    //
-    iDThread = new DMemSpyDriverOSAdaptionDThread( *this );
-    if  ( iDThread )
-        {
-        iDProcess = new DMemSpyDriverOSAdaptionDProcess( *this );
-        if  ( iDProcess )
-            {
-            iDChunk = new DMemSpyDriverOSAdaptionDChunk( *this );
-            if  ( iDChunk )
-                {
-                iDServer = new DMemSpyDriverOSAdaptionDServer( *this );
-                if  ( iDServer )
-                    {
-                    iDSession = new DMemSpyDriverOSAdaptionDSession( *this );
-                    if  ( iDSession )
-                        {
-                        iDCodeSeg = new DMemSpyDriverOSAdaptionDCodeSeg( *this );
-                        if  ( iDCodeSeg )
-                            {
-                            iDSemaphore = new DMemSpyDriverOSAdaptionDSemaphore( *this );
-                            if  ( iDSemaphore )
-                                {
-                                iDMutex = new DMemSpyDriverOSAdaptionDMutex( *this );
-                                if  ( iDMutex )
-                                    {
-                                    iDLogicalDevice = new DMemSpyDriverOSAdaptionDLogicalDevice( *this );
-                                    if  ( iDLogicalDevice )
-                                        {
-                                        iDPhysicalDevice = new DMemSpyDriverOSAdaptionDPhysicalDevice( *this );
-                                        if  ( iDPhysicalDevice )
-                                            {
-                                            iDChangeNotifier = new DMemSpyDriverOSAdaptionDChangeNotifier( *this );
-                                            if  ( iDChangeNotifier )
-                                                {
-                                                iDUndertaker = new DMemSpyDriverOSAdaptionDUndertaker( *this );
-                                                if ( iDUndertaker )
-                                                    {
-                                                    iDCondVar = new DMemSpyDriverOSAdaptionDCondVar( *this );
-                                                    if ( iDCondVar )
-                                                        {
-                                                        iDTimer = new DMemSpyDriverOSAdaptionDTimer( *this );
-                                                        if  ( iDTimer )
-                                                            {
-                                                            iDPropertyRef = new DMemSpyDriverOSAdaptionDPropertyRef( *this );
-                                                            if  ( iDPropertyRef )
-                                                                {
-                                                                error = KErrNone;
-                                                                }
-                                                            }
-                                                        }
-                                                    }
-                                                }
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    //
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::Construct() - END - error: %d", error ) );
-    return error;
-    }
-
-
-
-
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverObjectIx.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +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 "MemSpyDriverObjectIx.h"
-
-// System includes
-#include <kern_priv.h>
-//#include <dobject.h>
-
-//const TInt KObjectIxGranularity=8;
-const TInt KObjectIndexMask=0x7fff;
-//const TInt KObjectMaxIndex=0x7fff;
-const TInt KObjectInstanceShift=16;
-const TInt KObjectInstanceMask=0x3fff;
-//const TInt KObjectIxMaxHandles=0x8000;
-
-inline TInt index(TInt aHandle)
-	{return(aHandle&KObjectIndexMask);}
-inline TInt instance(TInt aHandle)
-	{return((aHandle>>KObjectInstanceShift)&KObjectInstanceMask);}
-inline TInt instanceLimit(TInt& aCount)
-	{return ((aCount&KObjectInstanceMask)==0) ? ((++aCount)&KObjectInstanceMask) : aCount&KObjectInstanceMask;}
-inline TInt makeHandle(TInt aIndex, TInt aInstance)
-	{return((TInt)((aInstance<<KObjectInstanceShift)|aIndex));}
-
-enum TDObjectPanic
-	{
-	EObjObjectStillReferenced,
-	EObjNegativeAccessCount,
-	EObjRemoveObjectNotFound,
-	EObjRemoveContainerNotFound,
-	EObjRemoveBadHandle,
-	EObjFindBadHandle,
-	EObjFindIndexOutOfRange,
-	EDObjectConDestroyed,
-	EArrayIndexOutOfRange,
-	EObjInconsistent,
-	};
-
-inline void Panic(TDObjectPanic aPanic)
-	{ Kern::Fault("DOBJECT",aPanic); }
-	
-
-TBool MemSpyObjectIx::Find(DObject* aObj)
-	{
-	//Check preconditions(debug build only)
-	__ASSERT_CRITICAL;
-	__ASSERT_NO_FAST_MUTEX;
-
-	// I don't like the implementation of At() that was here before, it wasn't safe at all without HandleMutex. So I'm replacing it with a simpler
-	// version based on operator[] that only does what we need and does it safely.
-
-	TBool found = EFalse;
-	MemSpyObjectIx_HandleLookupLock();
-	const TInt count = Count();
-	for (TInt i = 0; i < count; i++)
-		{
-		if ((*this)[i] == aObj)
-			{
-			found = ETrue;
-			break;
-			}
-		}
-	MemSpyObjectIx_HandleLookupUnlock();
-	return found;
-	}
-
-#if MCL_ROBJECTIX_DUPLICATION
-
-#define asserta(x)	do { if (!(x)) { __crash(); } } while(0)
-
-RMemSpyObjectIx::RMemSpyObjectIx()
-  : iRWL(TSpinLock::EOrderGenericIrqLow3)
-    {
-    }
-
-
-/*
-void RMemSpyObjectIx::Wait()
-	{
-	Kern::MutexWait(*HandleMutex);
-	} // RObjectIx::Wait
-
-
-void RMemSpyObjectIx::Signal()
-	{
-	Kern::MutexSignal(*HandleMutex);
-	} // RObjectIx::Signal
-*/
-
-DObject* RMemSpyObjectIx::operator[](TInt aIndex)
-	{
-	DObject* obj = 0;
-	AcquireReadLock();
-	asserta(TUint(aIndex)<TUint(iCount));
-	SSlot* slot = iSlots + aIndex;
-	obj = Occupant(slot);
-	ReleaseReadLock();
-	return obj;
-	} // RObjectIx::operator[]
-
-
-#elif MCL_DOBJECTIX_DUPLICATION
-
-/*
-void DMemSpyObjectIx::Wait( DMemSpyObjectIx* aObjectIndex )
-	{
-//	Kern::MutexWait(*aObjectIndex->HandleMutex);
-	}
-
-void DMemSpyObjectIx::Signal( DMemSpyObjectIx* aObjectIndex )
-	{
-//	Kern::MutexSignal(*aObjectIndex->HandleMutex);
-	}
-*/
-
-/** Counts the number of times an object appears in this index.
-
-	@param	aObject	Object whose occurrences are to be counted.
-
-	@return	Number of times aObject appears in the index.
-
-    @pre    Calling thread must be in a critical section.
-    @pre    No fast mutex can be held.
-	@pre	Call in a thread context.
-	@pre	DObject::HandleMutex held
- */
-TInt DMemSpyObjectIx::Count(DObject* aObject)
-	{
-	//Check preconditions(debug build only)
-	__ASSERT_CRITICAL;
-	__ASSERT_NO_FAST_MUTEX;
-
-	TInt c=0;
-	if (iCount)
-		{
-		SDObjectIxRec* pS=iObjects;
-		SDObjectIxRec* pE=pS+iCount;
-		do
-			{
-			if (pS->obj==aObject)
-				c++;
-			} while (++pS<pE);
-		}
-	return c;
-	}
-
-
-/**	Looks up an object in the index by handle.
-	
-	The object must be of a specified type (specified by container ID)
-
-	@param	aHandle		Handle to look up.
-	@param	aUniqueID	Unique ID (container ID) that object should have.
-	
-	@return	Pointer to object or NULL if handle invalid.
-
-	@pre	Call in a thread context.
-	@pre    System lock must be held.
- */
-DObject* DMemSpyObjectIx::At(TInt aHandle, TInt aUniqueID)
-	{
-	__ASSERT_SYSTEM_LOCK; //Check preconditions (debug build only)
-	TInt i=index(aHandle);
-	if (i>=iCount)
-		return(NULL);
-	SDObjectIxRec *pS=iObjects+i;
-	if (pS->str.instance!=instance(aHandle) || pS->str.uniqueID!=aUniqueID)
-		return(NULL);
-	return(pS->obj);
-	}
-
-
-/**	Looks up an object in the index by handle.
-
-	The object may be of any type.
-
-	@param	aHandle		Handle to look up.
-	
-	@return	Pointer to object or NULL if handle invalid.
-
-	@pre	Call in a thread context.
-	@pre    System lock must be held.
- */
-DObject* DMemSpyObjectIx::At(TInt aHandle)
-	{
-	__ASSERT_SYSTEM_LOCK; //Check preconditions (debug build only)
-	TInt i=index(aHandle);
-	if (i>=iCount)
-		return NULL;
-	SDObjectIxRec *pS=iObjects+i;
-	if (pS->str.instance!=instance(aHandle))
-		return NULL;
-	return pS->obj;
-	}
-
-/** Finds the object at a specific position in the index array.
-
-	@param	aIndex	Index into array.
-	
-	@return	Pointer to the object at that position (could be NULL).
-
-	@pre	Call in a thread context. 
-    @pre    System lock must be held.
- */
-DObject* DMemSpyObjectIx::operator[](TInt aIndex)
-	{
-	__ASSERT_SYSTEM_LOCK; //Check preconditions (debug build only)
-	__ASSERT_ALWAYS(aIndex>=0 && aIndex<iCount,Panic(EArrayIndexOutOfRange));
-	return iObjects[aIndex].obj;
-	}
-
-#endif
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverStreamWriter.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +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 "MemSpyDriverStreamWriter.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverXferBuffer.h"
-
-
-
-RMemSpyMemStreamWriter::RMemSpyMemStreamWriter()
-:   iBuffer( NULL ), iCurrent( NULL ), iMax( 0 ), iMark( NULL ), iCommitted( 0 )
-    {
-    }
-
-
-RMemSpyMemStreamWriter::RMemSpyMemStreamWriter( DMemSpyDriverXferBuffer& aBuffer )
-:   iBuffer( &aBuffer ), iMark( NULL ), iCommitted( 0 )
-    {
-    iCurrent = iBuffer->Ptr();
-    iMax = iCurrent + iBuffer->Size();
-    TRACE( Kern::Printf("RMemSpyMemStreamWriter::RMemSpyMemStreamWriter() - current: 0x%08x, max: 0x%08x, size: %d", iCurrent, iMax, iBuffer->Size() ) );
-    }
-
-
-void RMemSpyMemStreamWriter::Close()
-    {
-    iBuffer = NULL;
-    iMark = NULL;
-    }
-
-
-TInt RMemSpyMemStreamWriter::WriteAndClose( TDes8* aDestinationPointer )
-    {
-    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
-    //
-    const TInt ret = iBuffer->WriteToClient( aDestinationPointer, iCommitted );
-    Close();
-    //
-    return ret;
-    }
-
-
-TInt32* RMemSpyMemStreamWriter::WriteInt32( TInt32 aValue )
-    {
-    TInt32* ret = NULL;
-    //
-    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
-    if  ( !IsFull() )
-        {
-        ret = (TInt32*) iCurrent;
-        *ret = aValue;
-        IncrementPos( sizeof( TInt32 ) );
-        }
-    else
-        {
-        //TRACE( Kern::Printf( "RMemSpyMemStreamWriter::WriteInt32() - asked to write: 0x%08x from fn: 0x%08x BUT AM FULL", aValue, __return_address() ) );
-        }
-    //
-    return ret;
-    }
-
-
-TUint32* RMemSpyMemStreamWriter::WriteUint32( TUint32 aValue )
-    {
-    TUint32* ret = NULL;
-    //
-    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
-    if  ( !IsFull() )
-        {
-        ret = (TUint32*) iCurrent;
-        *ret = aValue;
-        IncrementPos( sizeof( TUint32 ) );
-        }
-    else
-        {
-        //TRACE( Kern::Printf( "RMemSpyMemStreamWriter::WriteUint32() - asked to write: 0x%08x from fn: 0x%08x BUT AM FULL", aValue, __return_address() ) );
-        }
-    //
-    return ret;
-    }
-
-
-TUint8* RMemSpyMemStreamWriter::Current() const
-    {
-    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
-    return iCurrent;
-    }
-
-
-void RMemSpyMemStreamWriter::Seek( TInt aPosition )
-    {
-    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
-    TUint8* pos = iBuffer->Ptr() + aPosition;
-    __ASSERT_ALWAYS( pos < iMax, MemSpyDriverUtils::Fault( __LINE__ ) );
-    iCurrent = pos;
-    }
-
-
-TUint32 RMemSpyMemStreamWriter::Remaining() const
-    {
-    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
-    const TUint32 max = reinterpret_cast< TUint32 >( iMax );
-    const TUint32 cur = reinterpret_cast< TUint32 >( iCurrent );
-    TRACE( Kern::Printf("RMemSpyMemStreamWriter::Remaining() - current: 0x%08x, max: 0x%08x, ret: %d", cur, max, ( max - cur ) ) );
-    return ( max - cur );
-    }
-
-
-void RMemSpyMemStreamWriter::MarkSet()
-    {
-    __ASSERT_ALWAYS( iMark == NULL, MemSpyDriverUtils::Fault( __LINE__ ) );
-    iMark = iCurrent;
-    }
-
-
-void RMemSpyMemStreamWriter::MarkResume()
-    {
-    __ASSERT_ALWAYS( iMark != NULL, MemSpyDriverUtils::Fault( __LINE__ ) );
-    iCurrent = iMark;
-    iMark = NULL;
-    }
-
-
-TBool RMemSpyMemStreamWriter::IsFull() const
-    {
-    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
-    const TBool ret = ( iCurrent >= iMax );
-    return ret;
-    }
-
-
-TBool RMemSpyMemStreamWriter::IsOpen() const
-    {
-    const TBool ret = ( iBuffer && iCurrent && iMax );
-    return ret;
-    }
-
-
-RMemSpyMemStreamWriter& RMemSpyMemStreamWriter::operator=( const RMemSpyMemStreamWriter& aCopy )
-    {
-    iBuffer = aCopy.iBuffer;
-    iMark = aCopy.iMark;
-    iCommitted = aCopy.iCommitted;
-    iCurrent = aCopy.iCurrent;
-    iMax = aCopy.iMax;
-    //
-    return *this;
-    }
-
-
-void RMemSpyMemStreamWriter::IncrementPos( TInt aAmount )
-    {
-    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
-    if  ( iCurrent + aAmount > iMax )
-        {
-        Kern::Printf("RMemSpyMemStreamWriter::IncrementPos() - OVERFLOW - current: 0x%08x, max: 0x%08x, aAmount: %d", iCurrent, iMax, aAmount );
-        }
-
-    iCurrent += aAmount;
-    iCommitted += aAmount;
-    }
-
-
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverSuspensionManager.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,508 +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 "MemSpyDriverSuspensionManager.h"
-
-// System includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include "MemSpyDriverOSAdaption.h"
-
-// Constants
-const TInt KSuspendResumeCount = 1;
-
-
-
-DMemSpySuspensionManager::DMemSpySuspensionManager( DMemSpyDriverDevice& aDevice )
-:   iDevice( aDevice )
-    {
-    }
-
-
-DMemSpySuspensionManager::~DMemSpySuspensionManager()
-	{
-	TRACE( Kern::Printf("DMemSpySuspensionManager::~DMemSpySuspensionManager() - START"));
-
-    if  ( iAlreadySuspended )
-        {
-        TRACE( Kern::Printf("DMemSpySuspensionManager::~DMemSpySuspensionManager() - resuming threads in process with id: %d", iSuspendedProcessId ));
-        DoResumeAllThreadsInProcess( iSuspendedProcessId );
-        }
-    if  ( iTempObj != NULL )
-        {
-    	Kern::SafeClose( iTempObj, NULL );
-        }
-
-    TRACE( Kern::Printf("DMemSpySuspensionManager::~DMemSpySuspensionManager() - END"));
-    }
-
-
-TInt DMemSpySuspensionManager::Construct()
-    {
-    return KErrNone;
-    }
-
-
-
-
-
-
-
- 
-
-
-
-TBool DMemSpySuspensionManager::IsSuspended( TUint aPid ) const
-    {
-    TBool ret = iAlreadySuspended;
-    //
-    if  ( ret )
-        {
-        ret = ( aPid == iSuspendedProcessId );
-        }
-    //
-    TRACE( Kern::Printf("DMemSpySuspensionManager::IsSuspended() - iAlreadySuspended: %d, iSuspendedProcessId: %d, aPid: %d, ret: %d", iAlreadySuspended, iSuspendedProcessId, aPid, ret ) );
-    return ret;
-    }
-
-
-TBool DMemSpySuspensionManager::IsSuspended( DThread& aThread ) const
-    {
-    TBool ret = EFalse;
-    //
-    const TUint tid = iDevice.OSAdaption().DThread().GetId( aThread );
-    DProcess* process = iDevice.OSAdaption().DThread().GetOwningProcess( aThread );
-    TRACE( Kern::Printf("DMemSpySuspensionManager::IsSuspended() - START - iSuspendedProcessId: %d, aThread: (%d) %O, process: 0x%08x", iSuspendedProcessId, tid, &aThread, process ) );
-    //
-    if ( process )
-        {
-        ret = IsSuspended( *process );
-        }
-    //
-    TRACE( Kern::Printf("DMemSpySuspensionManager::IsSuspended() - END - ret: %d", ret ) );
-    return ret;
-    }
-
-
-TBool DMemSpySuspensionManager::IsSuspended( DProcess& aProcess ) const
-    {
-    const TUint pid = iDevice.OSAdaption().DProcess().GetId( aProcess );
-    TRACE( Kern::Printf("DMemSpySuspensionManager::IsSuspended() - START - iSuspendedProcessId: %d, aProcess: (%d / %d) %O", iSuspendedProcessId, pid, aProcess.iId, &aProcess ) );
-    //
-    const TBool ret = IsSuspended( pid );
-    //
-    TRACE( Kern::Printf("DMemSpySuspensionManager::IsSuspended() - END - ret: %d", ret ) );
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpySuspensionManager::SuspendAllThreadsInProcess( TUint aPid, DThread& aClientThread )
-    {
-	// Suspend all threads in the process
-	TRACE( Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess() - START - id: %8d, iSuspendedProcessId: %8d, iAlreadySuspended: %d", aPid, iSuspendedProcessId, iAlreadySuspended ));
-    if  ( iAlreadySuspended && aPid != iSuspendedProcessId )
-        {
-		Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess() - END - trying to suspend multiple processes!");
-        MemSpyDriverUtils::PanicThread( aClientThread, EPanicAttemptingToSuspendMultipleProcesses );
-        return KErrNone;
-        }
-    else if ( IsProcessTheClientThread( aPid, aClientThread ) )
-        {
-		Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess() - END - trying to suspend client thread! - request ignored");
-        return KErrLocked;
-        }
-    
-	TInt r = KErrNone;
-	TRACE( Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess - iAlreadySuspended: %d", iAlreadySuspended));
-	if  ( !iAlreadySuspended ) 
-    	{
-    	r = DoSuspendAllThreadsInProcess( aPid, &aClientThread );
-    	if (r != KErrNone)
-    		{
-    		TRACE( Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess() - END - process not found") );
-    		return r;
-    		}
-
-        // To ensure we clean up in case of user-side problem...
-        iSuspendedProcessId = aPid;	
-        iAlreadySuspended = ETrue;
-    	iSuspendCount = 1;
-    	}
-	else
-    	{
-    	// Just increment the count
-    	++iSuspendCount;
-    	}
-
-    TRACE( Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess() - END - iSuspendCount: %d, iSuspendedProcessId: %d", iSuspendCount, iSuspendedProcessId ));
-	return iSuspendCount;
-    }
-
-
-TInt DMemSpySuspensionManager::ResumeAllThreadsInProcess( TUint aPid, DThread& aClientThread )
-    {
-	TRACE( Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - START - id: %8d, iSuspendedProcessId: %8d, iAlreadySuspended: %d", aPid, iSuspendedProcessId, iAlreadySuspended));
-	if  ( !iAlreadySuspended )
-    	{
-    	// Nothing suspended - don't panic
-     	TRACE( Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - END - nothing suspended, ignoring client request"));
-       	return KErrNone;
-    	}
-    else if  ( iAlreadySuspended && aPid != iSuspendedProcessId )
-        {
-		Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - END - trying to resume incorrect process!");
-        MemSpyDriverUtils::PanicThread( aClientThread, EPanicAttemptingToResumeNonSuspendedProcess );
-        return KErrNone;
-        }
-    else if  ( IsProcessTheClientThread( aPid, aClientThread ) )
-        {
-		Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - END - trying to resume client thread! - request ignored");
-        return KErrLocked;
-        }
-    
-    TRACE( Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess"));
-
-    TInt r = KErrNone;
-    if  ( --iSuspendCount <= 0 )
-        {
-    	r = DoResumeAllThreadsInProcess( aPid, &aClientThread );
-    	if (r != KErrNone)
-    		{
-    		Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - END - process not found");
-    		return r;
-    		}
-
-        // No longer need to clean up
-        iAlreadySuspended = EFalse;
-        iSuspendedProcessId = 0;
-        iSuspendCount = 0;
-        }
-    else
-        {
-    	// No action needed - we've already decremented the counter
-    	}
-
-	TRACE( Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - END - iSuspendCount: %d", iSuspendCount));
-	return iSuspendCount;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpySuspensionManager::DoSuspendAllThreadsInProcess( TUint aPid, DThread* /*aClientThread*/ )
-    {
-	TRACE( Kern::Printf("DMemSpySuspensionManager::DoSuspendAllThreadsInProcess() - START - aPid: %d", aPid));
-    TInt r = OpenTempObject( aPid, EProcess );
-    if  (r == KErrNone)
-    	{
-        DProcess* process = (DProcess*) iTempObj;
-        TFullName processName;
-        process->FullName( processName );
-        processName.Append('*');
-    
-        DObjectCon* container = Kern::Containers()[EThread];
-        NKern::ThreadEnterCS();
-        container->Wait();
-        //
-        TFullName result;
-#ifdef MCL_FIND_HANDLES
-        TFindHandle findHandle;
-#else
-        TInt findHandle = 0;
-#endif
-        r = container->FindByFullName( findHandle, processName, result );
-        while( r == KErrNone )
-            {
-            DThread* thread = (DThread*) container->At( findHandle );
-            if  ( thread )
-                {
-                const TUint tid = iDevice.OSAdaption().DThread().GetId( *thread );
-                TRACE( Kern::Printf("DMemSpySuspensionManager::DoSuspendAllThreadsInProcess - suspending thread: (%d), %O", tid, thread ));
-                //
-                Kern::ThreadSuspend( *thread, KSuspendResumeCount );
-                }
-            //
-            r = container->FindByFullName( findHandle, processName, result );
-            }
-        //
-        container->Signal();
-        NKern::ThreadLeaveCS();
-    
-        CloseTempObject();
-        r = KErrNone;
-    	}
-
-    TRACE( Kern::Printf("DMemSpySuspensionManager::DoSuspendAllThreadsInProcess() - END - ret: %d", r));
-    return r;
-    }
-
-
-TInt DMemSpySuspensionManager::DoResumeAllThreadsInProcess( TUint aPid, DThread* aClientThread )
-    {
-	TRACE( Kern::Printf("DMemSpySuspensionManager::DoResumeAllThreadsInProcess() - START - aPid: %d", aPid));
-    TInt r = OpenTempObject( aPid, EProcess );
-    if  (r == KErrNone)
-    	{
-        // Check that this process is suspended
-        DProcess* process = (DProcess*) iTempObj;
-        const TUint pid = iDevice.OSAdaption().DProcess().GetId( *process );
-        if  ( !aClientThread  || ( aClientThread && CheckProcessSuspended( pid, *aClientThread ) ) )
-            {
-            // Resume all threads in the process
-            TFullName processName;
-            process->FullName( processName );
-            processName.Append('*');
-    
-            DObjectCon* container = Kern::Containers()[EThread];
-            NKern::ThreadEnterCS();
-            container->Wait();
-            //
-            TFullName result;
-    #ifdef MCL_FIND_HANDLES
-            TFindHandle findHandle;
-    #else
-            TInt findHandle = 0;
-    #endif
-            r = container->FindByFullName( findHandle, processName, result );
-            while( r == KErrNone )
-                {
-                DThread* thread = (DThread*) container->At( findHandle );
-                TRACE( Kern::Printf("DMemSpySuspensionManager::DoResumeAllThreadsInProcess - resuming thread: %lS", &result));
-                //
-                Kern::ThreadResume(*thread);
-                r = container->FindByFullName( findHandle, processName, result );
-                }
-            //
-            container->Signal();
-            NKern::ThreadLeaveCS();
-    
-            r = KErrNone;
-            }
-        else
-            {
-            TRACE( Kern::Printf("DMemSpySuspensionManager::DoResumeAllThreadsInProcess - parent process not suspended => KErrAccessDenied"));
-            r = KErrAccessDenied;
-            }
-
-        CloseTempObject();
-        }
-
-    TRACE( Kern::Printf("DMemSpySuspensionManager::DoResumeAllThreadsInProcess() - END - ret: %d", r));
-    return r;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TBool DMemSpySuspensionManager::IsProcessTheClientThread( TUint aPid, DThread& aClientThread ) const
-    {
-    TBool ret = EFalse;
-    DProcess& clientProcess = *iDevice.OSAdaption().DThread().GetOwningProcess( aClientThread );
-    const TUint pid = iDevice.OSAdaption().DProcess().GetId( clientProcess );
-    if  ( pid == aPid )
-        {
-        ret = ETrue;
-        }
-    //
-    return ret;
-    }
-    
-
-TBool DMemSpySuspensionManager::CheckProcessSuspended( TUint aExpectedPid, DThread& aClientThread ) const
-    {
-    TBool suspended = ETrue;
-    //
-    if  ( !iAlreadySuspended )
-        {
-        MemSpyDriverUtils::PanicThread( aClientThread, EPanicThreadsInProcessNotSuspended );
-        }
-    else if ( aExpectedPid != iSuspendedProcessId )
-        {
-        MemSpyDriverUtils::PanicThread( aClientThread, EPanicWrongProcessSuspended );
-        }
-    //
-    return suspended;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpySuspensionManager::OpenTempObject(TUint aId, TObjectType aType)
-	{
-	__ASSERT_DEBUG( aType == EProcess || aType == EThread, MemSpyDriverUtils::Fault( __LINE__ ) );
-	__ASSERT_DEBUG( !iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
-
-	TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - START - aId: %d, aType: %d", aId, aType ));
-	DObjectCon* pC = Kern::Containers()[aType];
-	NKern::ThreadEnterCS();
-	pC->Wait();
-	iTempObj = (aType == EProcess) ? (DObject*)Kern::ProcessFromId(aId) : (DObject*)Kern::ThreadFromId(aId);
-	TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - kernel obj from id returned: 0x%08x %O", iTempObj, iTempObj ));
-    //
-    TBool openedOkay = EFalse;
-    TInt r = KErrNone;
-    //
-	if ( iTempObj )
-        {
-		r = iTempObj->Open();
-	    TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - open returned: %d", r ));
-		//
-        if  ( r == KErrNone )
-            {
-            openedOkay = ETrue;
-            if  ( aType == EProcess )
-                {
-                // Check the process is still alive
-                DProcess* process = (DProcess*) iTempObj;
-                const TExitType exitType = iDevice.OSAdaption().DProcess().GetExitType( *process );
-                if  ( exitType != EExitPending )
-					{
-                    r = KErrDied;
-	                TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - PROCESS IS DEAD!" ));
-					}
-                }
-            else if (aType == EThread )
-                {
-                // Check the thread is still alive
-                DThread* thread = (DThread*) iTempObj;
-                const TExitType exitType = iDevice.OSAdaption().DThread().GetExitType( *thread );
-                if  ( exitType != EExitPending )
-                    {
-                    r = KErrDied;
-	                TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - THREAD IS DEAD!" ));
-                    }
-                }
-            }
-
-        }
-    else if ( ! iTempObj )
-        {
-        r = KErrNotFound;
-	    TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - ENTITY NOT FOUND!" ));
-        }
-    //
-	pC->Signal();
-	TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - signalled container..." ));
-	NKern::ThreadLeaveCS();
-	TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - left CS..." ));
-    //
-    if  ( r != KErrNone && iTempObj )
-        {
-	    TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - ERROR CASE - closing temp object (r: %d, openedOkay: %d)...", r, openedOkay ));
-        //
-        if ( openedOkay )
-            {
-            CloseTempObject();
-            }
-        else
-            {
-            NKern::SafeSwap( NULL, (TAny*&) iTempObj );
-            }
-        //
-	    TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - ERROR CASE - closed temp object" ));
-        }
-    //
-	TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - END - r: %d", r ));
-	return r;
-	}
-
-
-void DMemSpySuspensionManager::CloseTempObject()
-	{
-	TRACE( Kern::Printf("DMemSpySuspensionManager::CloseTempObject() - START - iTempObj: 0x%08x %O", iTempObj, iTempObj ));
-
-	__ASSERT_DEBUG( iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
-    if  ( iTempObj )
-        {
-		NKern::ThreadEnterCS();
-	    Kern::SafeClose( iTempObj, NULL );
-		NKern::ThreadLeaveCS();
-        }
-
-    TRACE( Kern::Printf("DMemSpySuspensionManager::CloseTempObject() - END" ));
-	}
-
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverUserEventMonitor.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,429 +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 "MemSpyDriverUserEventMonitor.h"
-
-// System includes
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include "MemSpyDriverOSAdaption.h"
-#include "MemSpyDriverEventMonitor.h"
-
-// Literal constants
-_LIT( KMemSpyDriverClientEMMutexName, "MemSpyDriverClientEM_0x" );
-
-
-
-
-DMemSpyDriverClientEMManager::DMemSpyDriverClientEMManager( DMemSpyDriverDevice& aDevice )
-:   iDevice( aDevice )
-    {
-    }
-
-
-DMemSpyDriverClientEMManager::~DMemSpyDriverClientEMManager()
-	{
-	TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::~DMemSpyDriverClientEMManager() - START"));
-
-    NKern::ThreadEnterCS();
-    FreeAllInstances();
-    NKern::ThreadLeaveCS();
-
-	TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::~DMemSpyDriverClientEMManager() - END"));
-	}
-
-
-TInt DMemSpyDriverClientEMManager::Create()
-    {
-    return KErrNone;
-    }
-
-
-DMemSpyDriverClientEM* DMemSpyDriverClientEMManager::EMOpen()
-    {
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMOpen() - START - iNextHandle: %d, iDevice: 0x%08x", iNextHandle+1, &iDevice ) );
-    NKern::ThreadEnterCS();
-    //
-    DMemSpyDriverClientEM* object = new DMemSpyDriverClientEM( iDevice, ++iNextHandle );
-    if  ( object != NULL )
-        {
-        TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMOpen() - calling create..." ) );
-        const TInt error = object->Create();
-        if ( error != KErrNone )
-            {
-            TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMOpen() - creation error: %d", error ) );
-            delete object;
-            object = NULL;
-            }
-        else
-            {
-            iEMInstances.Add( &object->iLink );
-            }
-        }
-    //
-    NKern::ThreadLeaveCS();
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMOpen() - END - object: 0x%08x", object ) );
-    //
-    return object;
-    }
-
-
-TInt DMemSpyDriverClientEMManager::EMClose( TUint aHandle )
-    {
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMClose() - START - aHandle: 0x%08x", aHandle ) );
-    TInt error = KErrNotFound;
-    //
-    DMemSpyDriverClientEM* object = EMInstance( aHandle );
-    if  ( object != NULL )
-        {
-        NKern::ThreadEnterCS();
-        object->iLink.Deque();
-        delete object;
-        NKern::ThreadLeaveCS();
-        error = KErrNone;
-        }
-    //
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMClose() - END - error: %d", error ) );
-    return error;
-    }
-
-
-DMemSpyDriverClientEM* DMemSpyDriverClientEMManager::EMInstance( TUint aHandle )
-    {
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMInstance() - START - aHandle: 0x%08x", aHandle ) );
-    DMemSpyDriverClientEM* ret = NULL;
-    //
-	const SDblQueLink* const anchor = &iEMInstances.iA;
-	for (SDblQueLink* link = iEMInstances.First(); link != anchor; link = link->iNext )
-		{
-		DMemSpyDriverClientEM* object = _LOFF( link, DMemSpyDriverClientEM, iLink );
-        //
-        if  ( object->Handle() == aHandle )
-            {
-            ret = object;
-            break;
-            }
-        }
-    //
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMInstance() - END - aHandle: 0x%08x, ret: 0x%08x", aHandle, ret ) );
-    return ret;
-    }
-
-
-void DMemSpyDriverClientEMManager::FreeAllInstances()
-    {
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::FreeAllInstances() - START") );
-	
-    SDblQueLink* link = iEMInstances.GetFirst();
-	while( link )
-		{
-		DMemSpyDriverClientEM* object = _LOFF( link, DMemSpyDriverClientEM, iLink );
-        delete object;
-        link = iEMInstances.GetFirst();
-		}
-
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::FreeAllInstances() - END") );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverClientEM::DMemSpyDriverClientEM( DMemSpyDriverDevice& aDevice, TUint aHandle )
-:   iDevice( aDevice ), iHandle( aHandle )
-    {
-    }
-
-
-DMemSpyDriverClientEM::~DMemSpyDriverClientEM()
-    {
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::~DMemSpyDriverClientEM() - START - this: 0x%08x", this ));
-	iDevice.EventMonitor().RequestEventsCancel( *this );
-
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::~DMemSpyDriverClientEM() - calling NotifyChangesCancel..." ) );
-    NotifyChangesCancel();
-    
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::~DMemSpyDriverClientEM() - calling ResetPendingChanges..." ) );
-    ResetPendingChanges();
-
-	if  ( iLock )
-		{
-        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::~DMemSpyDriverClientEM() - closing mutex..." ) );
-		iLock->Close(NULL);
-		}
-
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::~DMemSpyDriverClientEM() - END - this: 0x%08x" ));
-    }
-
-
-TInt DMemSpyDriverClientEM::Create()
-    {
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::Create() - START - handle: 0x%08x", Handle() ) );
-
-    // Create mutex
-    TName name( KMemSpyDriverClientEMMutexName );
-    name.AppendNumFixedWidth( (TUint) this, EHex, 8 );
-    TInt error = Kern::MutexCreate( iLock, name, KMutexOrdNone );
-    //
-    if  ( error == KErrNone )
-        {
-        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::Create() - calling global device driver event monitor...") );
-        iDevice.EventMonitor().RequestEvents( *this );
-        }
-    //
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::Create() - END - handle: 0x%08x, err: %d", Handle(), error ) );
-    return error;
-    }
-
-
-TInt DMemSpyDriverClientEM::NotifyChanges( DThread* aClientThread, TRequestStatus* aClientRS, TAny* aClientContext )
-    {
-	Kern::MutexWait( *iLock );
-
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChanges() - START - handle: 0x%08x", Handle() ) );
-    TInt r = KErrInUse;
-    //
-    if  ( iClientRS == NULL )
-        {
-        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChanges() - saving client's request...") );
-        iClientThread = aClientThread;
-        iClientRS = aClientRS;
-        iClientContext = aClientContext;
-        //
-        if	( !iPendingChanges.IsEmpty() )
-			{
-            TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyOnChange() - Have buffered changes - SENDING TO CLIENT IMMEDIATELY..." ) );
-			
-            // We have something in the pending buffer so we can
-			// give it back to the client immediately.
-	        DMemSpyDriverClientEM::TChange* cachedChange = _LOFF( iPendingChanges.First(), DMemSpyDriverClientEM::TChange, iLink );
-			cachedChange->iLink.Deque();
-			
-            // Notify about change			
-			CompleteClientsRequest( cachedChange->iCompletionCode, cachedChange->iContext );
-			
-			// Discard cached entry
-            NKern::ThreadEnterCS();
-			delete cachedChange;
-            NKern::ThreadLeaveCS();
-			}
-        //
-        r = KErrNone;
-        }
-    //
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChanges() - END - handle: 0x%08x, error: %d", Handle(), r ) );
-	Kern::MutexSignal( *iLock );
-    return r;
-    }
-
-
-TInt DMemSpyDriverClientEM::NotifyChangesCancel()
-    {
-	Kern::MutexWait( *iLock );
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChangesCancel() - START - handle: 0x%08x, iClientThread: 0x%08x, iClientRS: 0x%08x", Handle(), iClientThread, iClientRS ) );
-    //
-    TInt r = KErrNotReady;
-    //
-    if  ( iClientRS != NULL )
-        {
-        DThread* clientThread = iClientThread;
-        TRequestStatus* clientRS = iClientRS;
-        //
-        iClientThread = NULL;
-        iClientRS = NULL;
-        iClientContext = NULL;
-        //
-        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChangesCancel() - doing final request complete...") );
-		Kern::RequestComplete( clientThread, clientRS, KErrCancel );
-        r = KErrNone;
-        }
-    //
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChangesCancel() - END - handle: 0x%08x, error: %d", Handle(), r ) );
-	Kern::MutexSignal( *iLock );
-    return r;
-    }
-
-
-TUint DMemSpyDriverClientEM::EMTypeMask() const
-    {
-    const TUint ret = EMemSpyEventThreadAdd  | EMemSpyEventThreadKill |
-                      EMemSpyEventProcessAdd | EMemSpyEventProcessRemove | 
-                      EMemSpyEventChunkAdd   | EMemSpyEventChunkDelete;
-    return ret;
-    }
-
-
-void DMemSpyDriverClientEM::EMHandleProcessAdd( DProcess& aProcess )
-    {
-    const TUint pid = iDevice.OSAdaption().DProcess().GetId( aProcess );
-    //
-	Kern::MutexWait( *iLock );
-    CompleteClientsRequest( EMemSpyDriverEventTypeProcessCreate, pid );
-	Kern::MutexSignal( *iLock );
-    }
-
-
-void DMemSpyDriverClientEM::EMHandleProcessRemoved( DProcess& aProcess )
-    {
-    const TUint pid = iDevice.OSAdaption().DProcess().GetId( aProcess );
-    //
-	Kern::MutexWait( *iLock );
-    CompleteClientsRequest( EMemSpyDriverEventTypeProcessRemove, pid );
-	Kern::MutexSignal( *iLock );
-    }
-
-
-void DMemSpyDriverClientEM::EMHandleThreadAdd( DThread& aThread )
-    {
-    const TUint tid = iDevice.OSAdaption().DThread().GetId( aThread );
-    //
-	Kern::MutexWait( *iLock );
-    CompleteClientsRequest( EMemSpyDriverEventTypeThreadCreate, tid );
-	Kern::MutexSignal( *iLock );
-    }
-
-
-void DMemSpyDriverClientEM::EMHandleThreadKilled( DThread& aThread )
-    {
-    const TUint tid = iDevice.OSAdaption().DThread().GetId( aThread );
-    //
-	Kern::MutexWait( *iLock );
-    CompleteClientsRequest( EMemSpyDriverEventTypeThreadKill, tid );
-	Kern::MutexSignal( *iLock );
-    }
-
-
-void DMemSpyDriverClientEM::EMHandleChunkAdd( DChunk& aChunk ) 
-    {
-	Kern::MutexWait( *iLock );
-    CompleteClientsRequest( EMemSpyDriverEventTypeChunkAdd, (TUint) &aChunk );
-	Kern::MutexSignal( *iLock );
-    }
-
-
-void DMemSpyDriverClientEM::EMHandleChunkDeleted( DChunk& aChunk )
-    {
-	Kern::MutexWait( *iLock );
-    CompleteClientsRequest( EMemSpyDriverEventTypeChunkDestroy, (TUint) &aChunk );
-	Kern::MutexSignal( *iLock );
-    }
-
-
-void DMemSpyDriverClientEM::CompleteClientsRequest( TInt aCompletionCode, TUint aContext )
-    {
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - START - handle: 0x%08x, iClientThread: 0x%08x, iClientRS: 0x%08x, iClientContext: 0x%08x, aCompletionCode: %d, aContext: %d, changesPending: %d", Handle(), iClientThread, iClientRS, iClientContext, aCompletionCode, aContext, !iPendingChanges.IsEmpty() ) );
-    //
-    if  ( iClientRS != NULL )
-        {
-        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - attempting to complete client's request...") );
-
-        // First write context info
-        const TInt writeErr = Kern::ThreadRawWrite( iClientThread, iClientContext, &aContext, sizeof(TUint) );
-		if  ( writeErr != KErrNone )
-		    {
-            TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - write error: %d", writeErr ) );
-            aCompletionCode = writeErr;
-		    }
-
-        // Now complete event - avoiding race conditions!
-        DThread* clientThread = iClientThread;
-        TRequestStatus* clientRS = iClientRS;
-        //
-        iClientThread = NULL;
-        iClientRS = NULL;
-        iClientContext = NULL;
-        //
-        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - doing final request complete...") );
-		Kern::RequestComplete( clientThread, clientRS, aCompletionCode );
-        }
-    else
-        {
-		// Buffer the change for next time around...
-        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - BUFFERING change event whilst client is AWOL...", this ) );
-        NKern::ThreadEnterCS();
-        
-        DMemSpyDriverClientEM::TChange* cachedChange = new DMemSpyDriverClientEM::TChange( aCompletionCode, aContext );
-        if  ( cachedChange )
-            {
-            iPendingChanges.Add( &cachedChange->iLink );
-            }
-        //
-        NKern::ThreadLeaveCS();
-        }
-    //
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - END - handle: 0x%08x", Handle() ) );
-    }
-
-
-void DMemSpyDriverClientEM::ResetPendingChanges()
-    {
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::ResetPendingChanges() - START - this: 0x%08x", this ) );
-    NKern::ThreadEnterCS();
-    //
-    SDblQueLink* link = iPendingChanges.GetFirst();
-	while( link )
-		{
-        DMemSpyDriverClientEM::TChange* cachedChange = _LOFF( link, DMemSpyDriverClientEM::TChange, iLink );
-        delete cachedChange;
-        link = iPendingChanges.GetFirst();
-		}
-    //
-    NKern::ThreadLeaveCS();
-    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::ResetPendingChanges() - END - this: 0x%08x", this ) );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverUtils.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,314 +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 "MemSpyDriverUtils.h"
-
-// System includes
-#include <kern_priv.h>
-#include <nk_plat.h>
-#ifdef __MARM__
-#include <arm.h>
-#endif
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyDriverOSAdaption.h"
-
-// Constants
-static const char KFault[] = "MemSpy-Bug";
-
-
-
-void MemSpyDriverUtils::DataDump( const char* aFmt, const TUint8* aAddress, TInt aLength, TInt aMaxLength)
-    {
-    const TInt maxLen = aMaxLength;
-    TInt len = aLength;
-    const TUint8* pDataAddr = aAddress;
-
-	TBuf8<81> out;
-	TBuf8<20> ascii;
-	TInt offset = 0;
-	const TUint8* a = pDataAddr;
-    //
-	while(len>0)
-		{
-		out.Zero();
-		ascii.Zero();
-		out.AppendNumFixedWidth((TUint) a, EHex, 8);
-		out.Append(_L(": "));
-
-        TUint b;
-		for (b=0; b<16; b++)
-			{
-            TUint8 c = ' ';
-            if	((pDataAddr + offset + b) < pDataAddr + maxLen)
-	            {
-	            c = *(pDataAddr + offset + b);
-				out.AppendNumFixedWidth(c, EHex, 2);
-	            }
-            else
-	            {
-				out.Append(_L("  "));
-	            }
-			out.Append(' ');
-			if (c<=0x20 || c == 0x27 || c>=0x7f || c=='%')
-				c=0x2e;
-			ascii.Append(TChar(c));
-			}
-		out.Append(ascii);
-        out.Append(TChar(0));
-
-        Kern::Printf(aFmt, &out);
-
-        a += 16;
-		offset += 16;
-		len -= 16;
-        }
-    }
-
-
-void MemSpyDriverUtils::PanicThread( DThread& aThread, TMemSpyDriverPanic aPanicType )
-    {
-    Kern::ThreadKill( &aThread, EExitPanic, aPanicType, KMemSpyClientPanic );
-    }
-
-
-void MemSpyDriverUtils::Fault( TInt aReason )
-    {
-    Kern::Fault( KFault, aReason );
-    }
-
-
-void MemSpyDriverUtils::GetThreadRegisters( NThread* aThread, TMemSpyDriverRegSet& aInfo )
-	{
-    DThread* dThread = Kern::NThreadToDThread( aThread );
-    TRACE( Kern::Printf( "MemSpyDriverUtils::GetThreadRegisters() - START - aThread: %O", dThread ));
-    memclr( &aInfo, sizeof( TMemSpyDriverRegSet ) );
-	TRACE( Kern::Printf( "MemSpyDriverUtils::GetThreadRegisters() - cleared" ));
-
-#ifdef __MARM__
-    if  ( aThread != NULL )
-        {
-	    TArmRegSet regSet;
-        memclr( &regSet, sizeof(TArmRegSet) );
-        //
-	    TUint32 unused;
-	    TRACE( Kern::Printf( "MemSpyDriverUtils::GetThreadRegisters() - getting user context..." ));
-	    NKern::ThreadGetUserContext( aThread, &regSet, unused);
-	    TRACE( Kern::Printf( "MemSpyDriverUtils::GetThreadRegisters() - got user context" ));
-        //
-	    aInfo.iRn[ 0] = regSet.iR0;
-	    aInfo.iRn[ 1] = regSet.iR1;
-	    aInfo.iRn[ 2] = regSet.iR2;
-	    aInfo.iRn[ 3] = regSet.iR3;
-	    aInfo.iRn[ 4] = regSet.iR4;
-	    aInfo.iRn[ 5] = regSet.iR5;
-	    aInfo.iRn[ 6] = regSet.iR6;
-	    aInfo.iRn[ 7] = regSet.iR7;
-	    aInfo.iRn[ 8] = regSet.iR8;
-	    aInfo.iRn[ 9] = regSet.iR9;
-	    aInfo.iRn[10] = regSet.iR10;
-	    aInfo.iRn[11] = regSet.iR11;
-	    aInfo.iRn[12] = regSet.iR12;
-	    aInfo.iRn[13] = regSet.iR13;
-	    aInfo.iRn[14] = regSet.iR14;
-	    aInfo.iRn[15] = regSet.iR15;
-        //
-	    aInfo.iCpsr = regSet.iFlags;
-        }
-#else
-    (void) aThread;
-#endif
-
-    TRACE( Kern::Printf( "MemSpyDriverUtils::GetThreadRegisters() - END" ));
-	}
-
-
-TThreadPriority MemSpyDriverUtils::MapToUserThreadPriority( TInt aPriority )
-    {
-    TThreadPriority tp = EPriorityNormal;
-    //
-	switch(aPriority)
-		{
-	case EThrdPriorityMuchLess:
-        tp=EPriorityMuchLess;
-        break;
-	case EThrdPriorityLess:
-        tp=EPriorityLess;
-        break;
-	default:
-	case EThrdPriorityNormal:
-        tp=EPriorityNormal;
-        break;
-	case EThrdPriorityMore:
-        tp=EPriorityMore;
-        break;
-	case EThrdPriorityMuchMore:
-        tp=EPriorityMuchMore;
-        break;
-	case EThrdPriorityRealTime:
-        tp=EPriorityRealTime;
-        break;
-	case EThrdPriorityAbsoluteVeryLow:
-        tp=EPriorityAbsoluteVeryLow;
-        break;
-	case EThrdPriorityAbsoluteLow:
-        tp=EPriorityAbsoluteLow;
-        break;
-	case EThrdPriorityAbsoluteBackground:
-        tp=EPriorityAbsoluteBackground;
-        break;
-	case EThrdPriorityAbsoluteForeground:
-        tp=EPriorityAbsoluteForeground;
-        break;
-	case EThrdPriorityAbsoluteHigh:
-        tp=EPriorityAbsoluteHigh;
-        break;
-    	}
-    //
-    return tp;
-    }
-
-
-TInt MemSpyDriverUtils::MapToAbsoluteThreadPriority( TThreadPriority aPriority )
-    {
-	TInt tp = KErrNotSupported;
-    switch( aPriority )
-        {
-	case EPriorityAbsoluteVeryLow:
-        tp=EThrdPriorityAbsoluteVeryLow; break;
-	case EPriorityAbsoluteLowNormal:
-        tp=EThrdPriorityAbsoluteLowNormal; break;
-	case EPriorityAbsoluteLow:
-        tp=EThrdPriorityAbsoluteLow; break;
-	case EPriorityAbsoluteBackgroundNormal:
-        tp=EThrdPriorityAbsoluteBackgroundNormal; break;
-	case EPriorityAbsoluteBackground:
-        tp=EThrdPriorityAbsoluteBackground; break;
-	case EPriorityAbsoluteForegroundNormal:
-        tp=EThrdPriorityAbsoluteForegroundNormal; break;
-	case EPriorityAbsoluteForeground:
-        tp=EThrdPriorityAbsoluteForeground; break;
-	case EPriorityAbsoluteHighNormal:
-        tp=EThrdPriorityAbsoluteHighNormal; break;
-	case EPriorityAbsoluteHigh:
-        tp=EThrdPriorityAbsoluteHigh; break;
-	case EPriorityAbsoluteRealTime1:
-        tp=EThrdPriorityAbsoluteRealTime1; break;
-	case EPriorityAbsoluteRealTime2:
-        tp=EThrdPriorityAbsoluteRealTime2; break;
-	case EPriorityAbsoluteRealTime3:
-        tp=EThrdPriorityAbsoluteRealTime3; break;
-	case EPriorityAbsoluteRealTime4:
-        tp=EThrdPriorityAbsoluteRealTime4; break;
-	case EPriorityAbsoluteRealTime5:
-        tp=EThrdPriorityAbsoluteRealTime5; break;
-	case EPriorityAbsoluteRealTime6:
-        tp=EThrdPriorityAbsoluteRealTime6; break;
-	case EPriorityAbsoluteRealTime7:
-        tp=EThrdPriorityAbsoluteRealTime7; break;
-	case EPriorityAbsoluteRealTime8:
-        tp=EThrdPriorityAbsoluteRealTime8; break;
-	default:
-		break;
-        }
-
-    return tp;
-    }
-
-
-void MemSpyDriverUtils::PrintChunkInfo( DChunk& aChunk, DMemSpyDriverOSAdaption& aOSAdaption )
-    {
-    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = aOSAdaption.DChunk();
-    //
-    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk->Name:        %O", &aChunk ) );
-    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - sizeof(DChunk):      %d", sizeof(DChunk) ) );
-    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk*:             0x%08x", &aChunk ) );
-
-    DObject* owner = chunkAdaption.GetOwner( aChunk );
-    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk->Owner():     0x%08x", owner ) );
-
-    if  ( owner )
-        {
-        const TObjectType objectType = chunkAdaption.GetObjectType( *owner );
-        if ( objectType == EProcess )
-            {
-            DProcess* ownerProc = (DProcess*) owner;
-            const TUint pid = aOSAdaption.DProcess().GetId( *ownerProc );
-            TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk->Owner()->Id: %d (%O)", pid, ownerProc ) );
-            }
-        }
-
-    DProcess* owningProcess = chunkAdaption.GetOwningProcess( aChunk );
-    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - iOwningProcess:      0x%08x (%O)", owningProcess, owningProcess ) );
-
-    const TUint controllingOwner = chunkAdaption.GetControllingOwnerId( aChunk );
-    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - iControllingOwner:   %d", controllingOwner ) );
-
-    const TInt attribs = chunkAdaption.GetAttributes( aChunk );
-    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - iAttributes:         0x%08x", attribs ) );
-
-    const TChunkType type = chunkAdaption.GetType( aChunk );
-    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - iChunkType:          %d", type ) );
-
-    const TUint8* base = chunkAdaption.GetBase( aChunk );
-    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk->Base:        0x%08x", base ) );
-
-    const TInt size = chunkAdaption.GetSize( aChunk );
-    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk->Size:        0x%08x", size ) );
-    //
-    const TInt mapType = attribs & 0x00c00000; // DMemModelChunk::EMapTypeMask
-    switch( mapType )
-        {
-    case 0x00000000: // EMapTypeLocal
-        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - map type:            DMemModelChunk::EMapTypeLocal" ) );
-        break;
-    case 0x00400000: // EMapTypeGlobal
-        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - map type:            DMemModelChunk::EMapTypeGlobal" ) );
-        break;
-    case 0x00800000: // EMapTypeShared
-        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - map type:            DMemModelChunk::EMapTypeShared" ) );
-        break;
-    default:
-        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - map type:            UNKNOWN!" ) );
-        break;
-        }
-    //
-	const TInt addressRange = ( attribs & 0x0f000000 ); // EAddressRangeMask
-	switch (addressRange)
-		{
-    case 0x00000000: //EAddressLocal
-        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       DMemModelChunk::EAddressLocal" ) );
-        break;
-	case 0x01000000: //EAddressShared
-        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       DMemModelChunk::EAddressShared" ) );
-        break;
-	case 0x02000000: //EAddressUserGlobal
-        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       DMemModelChunk::EAddressUserGlobal" ) );
-        break;
-	case 0x03000000: //EAddressKernel
-        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       DMemModelChunk::EAddressKernel" ) );
-        break;
-	case 0x04000000: //EAddressFixed
-        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       DMemModelChunk::EAddressFixed" ) );
-        break;
-    default:
-        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       UNKNOWN!" ) );
-        break;
-		}
-    }
-
--- a/memspy/Driver/Kernel/Source/MemSpyDriverXferBuffer.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +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 "MemSpyDriverXferBuffer.h"
-
-// System includes
-#include <u32hal.h>
-
-// Shared includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-
-
-
-DMemSpyDriverXferBuffer::DMemSpyDriverXferBuffer( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   iDevice( aDevice ), iClientThread( aThread )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverXferBuffer::DMemSpyDriverXferBuffer() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverXferBuffer::~DMemSpyDriverXferBuffer()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverXferBuffer::~DMemSpyDriverXferBuffer() - START - this: 0x%08x", this ));
-
-    NKern::ThreadEnterCS();
-    delete iBuffer;
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::~DMemSpyDriverXferBuffer() - END - this: 0x%08x", this ));
-	}
-
-
-TInt DMemSpyDriverXferBuffer::Construct( TInt aSize )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::Construct() - START - this: 0x%08x, newSize: %d, iSize: %d", this, aSize, iSize ));
-    TInt ret = KErrNone;
-    //
-    iBuffer = Kern::AllocZ( aSize );
-    if  ( iBuffer == NULL )
-        {
-        ret = KErrNoMemory;
-        }
-    else
-        {
-        iSize = aSize;
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::Construct() - END - this: 0x%08x, newSize: %d, iSize: %d", this, aSize, iSize ));
-    return ret;
-    }
-
-
-
-TInt DMemSpyDriverXferBuffer::Size() const
-    {
-    return iSize;
-    }
-
-
-TInt DMemSpyDriverXferBuffer::GrowBy( TInt aSize )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::GrowBy() - START - this: 0x%08x, newSize: %d, iSize: %d", this, iSize + aSize, iSize ));
-    //
-    TInt ret = KErrNone;
-    const TInt newSize = iSize + aSize;
-    if  ( newSize > iSize )
-        {
-        NKern::ThreadEnterCS();
-        ret = Kern::SafeReAlloc( iBuffer, iSize, newSize );
-        if  ( ret == KErrNone )
-            {
-            iSize = newSize;
-            }
-	    NKern::ThreadLeaveCS();
-        }
-    else
-        {
-        TRACE( Kern::Printf("DMemSpyDriverXferBuffer::GrowBy() - WARNING - new size would shrink buffer (or have no effect)!" ));
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::GrowBy() - END - this: 0x%08x, err: %d, iSize: %d", this, ret, iSize ));
-    return ret;
-    }
-
-
-TInt DMemSpyDriverXferBuffer::EnsureCapacity( TInt aSize )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::EnsureCapacity() - START - this: 0x%08x, aSize: %d, iSize: %d", this, aSize, iSize ));
-    //
-    TInt ret = KErrNone;
-    if  ( aSize > iSize )
-        {
-        const TInt newSize = aSize;
-        //
-        NKern::ThreadEnterCS();
-        ret = Kern::SafeReAlloc( iBuffer, iSize, newSize );
-        if  ( ret == KErrNone )
-            {
-            iSize = newSize;
-            }
-	    NKern::ThreadLeaveCS();
-        }
-    else
-        {
-        TRACE( Kern::Printf("DMemSpyDriverXferBuffer::EnsureCapacity() - WARNING - new size would shrink buffer (or have no effect)!" ));
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::EnsureCapacity() - END - this: 0x%08x, err: %d, iSize: %d", this, ret, iSize ));
-    return ret;
-    }
-
-
-void DMemSpyDriverXferBuffer::Reset()
-    {
-    memclr( iBuffer, iSize );
-    }
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverXferBuffer::WriteToClient( TDes8* aDestinationPointer, TInt aLength )
-    {
-    // Check the client has enough space
-    TInt err = Kern::ThreadGetDesMaxLength( &iClientThread, aDestinationPointer );
-    if  ( err >= 0 )
-        {
-        if  ( aLength > err )
-            {
-            Kern::Printf("DMemSpyDriverXferBuffer::WriteToClient() - client descriptor max len: %d, amount to write: %d => KErrOverflow", err, aLength );
-            err = KErrOverflow;
-            }
-        else
-            {
-            const TPtrC8 pData( (const TUint8*) iBuffer, aLength );
-            err = Kern::ThreadDesWrite( &iClientThread, aDestinationPointer, pData, 0, KChunkShiftBy0 | KTruncateToMaxLength, &iClientThread );
-            }
-        }
-
-    // Check for bad descriptor and panic the client
-    if  ( err == KErrBadDescriptor )
-        {
-        MemSpyDriverUtils::PanicThread( iClientThread, EPanicBadDescriptor );
-        }
-    //
-    return err;
-    }
-
-
-DThread& DMemSpyDriverXferBuffer::ClientThread()
-    {
-    return iClientThread;
-    }
-
-
-TUint8* DMemSpyDriverXferBuffer::Ptr()
-    {
-    return (TUint8*) iBuffer;
-    }
-
-
-
-
-
-
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanBase.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,306 +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 "MemSpyDriverLogChanBase.h"
-
-// System includes
-#include <u32hal.h>
-#include <kernel.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include "MemSpyDriverOSAdaption.h"
-#include "MemSpyDriverXferBuffer.h"
-
-
-
-DMemSpyDriverLogChanBase::DMemSpyDriverLogChanBase( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   iDevice( aDevice ), iClientThread( aThread )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::DMemSpyDriverLogChanBase() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanBase::~DMemSpyDriverLogChanBase()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::~DMemSpyDriverLogChanBase() - START - this: 0x%08x", this ));
-
-    NKern::ThreadEnterCS();
-
-    if  ( iTempObj != NULL )
-        {
-    	Kern::SafeClose( iTempObj, NULL );
-        }
-
-    delete iXferBuffer;
-	
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::~DMemSpyDriverLogChanBase() - END - this: 0x%08x", this ));
-	}
-
-
-TInt DMemSpyDriverLogChanBase::BaseConstruct( TInt aTransferBufferSize )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::BaseConstruct() - START - this: 0x%08x, aTransferBufferSize: %d", this, aTransferBufferSize ));
-    TInt ret = KErrNone;
-    //
-    if  ( aTransferBufferSize != 0 )
-        {
-        iXferBuffer = new DMemSpyDriverXferBuffer( iDevice, iClientThread );
-        if  ( !iXferBuffer )
-            {
-            ret = KErrNoMemory;
-            }
-        else
-            {
-            ret = iXferBuffer->Construct( aTransferBufferSize );
-            if  ( ret != KErrNone )
-                {
-                delete iXferBuffer;
-                iXferBuffer = NULL;
-                }
-            }
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::BaseConstruct() - END - this: 0x%08x, aTransferBufferSize: %d, size: %d", this, aTransferBufferSize, iXferBuffer ? iXferBuffer->Size() : 0 ));
-    return ret;
-    }
-
-
-TInt DMemSpyDriverLogChanBase::Construct()
-    {
-    const TInt baseErr = BaseConstruct();
-    return baseErr;
-    }
-
-
-TInt DMemSpyDriverLogChanBase::Request( TInt /*aFunction*/, TAny* /*a1*/, TAny* /*a2*/ )
-    {
-    return KErrNone;
-    }
-
-
-
-
-
-
-
-DMemSpyDriverDevice& DMemSpyDriverLogChanBase::MemSpyDevice()
-    {
-    return iDevice;
-    }
-
-
-DMemSpySuspensionManager& DMemSpyDriverLogChanBase::SuspensionManager()
-    {
-    return MemSpyDevice().SuspensionManager();
-    }
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanBase::OpenTempObject( TUint aId, TObjectType aType, TBool aAllowDeadObjects )
-	{
-	__ASSERT_DEBUG( aType == EProcess || aType == EThread, MemSpyDriverUtils::Fault( __LINE__ ) );
-	__ASSERT_DEBUG( !iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - START - aId: %d, aType: %d, aAllowDeadObjects: %d", aId, aType, aAllowDeadObjects ));
-	DObjectCon* pC = Kern::Containers()[ aType ];
-	NKern::ThreadEnterCS();
-	pC->Wait();
-	iTempObj = (aType == EProcess) ? (DObject*) Kern::ProcessFromId( aId ) : (DObject*) Kern::ThreadFromId( aId );
-	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - kernel obj from id returned: 0x%08x %O", iTempObj, iTempObj ));
-    //
-    TBool openedOkay = EFalse;
-    TInt r = KErrNone;
-    //
-	if ( iTempObj )
-        {
-		r = iTempObj->Open();
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - open returned: %d", r ));
-		//
-        if  ( r == KErrNone )
-            {
-            openedOkay = ETrue;
-            if  ( aType == EProcess )
-                {
-                // Check the process is still alive
-                DProcess* process = (DProcess*) iTempObj;
-                const TExitType exitType = OSAdaption().DProcess().GetExitType( *process );
-                TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - process exitType: %d", exitType ));
-
-                if  ( !aAllowDeadObjects && exitType != EExitPending )
-					{
-                    r = KErrDied;
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - PROCESS IS DEAD!" ));
-					}
-                }
-            else if ( aType == EThread )
-                {
-                // Check the thread is still alive
-                DThread* thread = (DThread*) iTempObj;
-                const TExitType exitType = OSAdaption().DThread().GetExitType( *thread );
-                TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - thread exitType: %d", exitType ));
-
-                if  ( !aAllowDeadObjects && exitType != EExitPending )
-                    {
-                    r = KErrDied;
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - THREAD IS DEAD!" ));
-                    }
-                }
-            }
-
-        }
-    else if ( !iTempObj )
-        {
-        r = KErrNotFound;
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - ENTITY NOT FOUND!" ));
-        }
-    //
-	pC->Signal();
-	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - signalled container..." ));
-	NKern::ThreadLeaveCS();
-	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - left CS..." ));
-    //
-    if  ( r != KErrNone && iTempObj )
-        {
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - ERROR CASE - closing temp object (r: %d, openedOkay: %d)...", r, openedOkay ));
-        //
-        if ( openedOkay )
-            {
-            CloseTempObject();
-            }
-        else
-            {
-            NKern::SafeSwap( NULL, (TAny*&) iTempObj );
-            }
-        //
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - ERROR CASE - closed temp object" ));
-        }
-    //
-	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - END - r: %d", r ));
-	return r;
-	}
-
-
-void DMemSpyDriverLogChanBase::CloseTempObject()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::CloseTempObject() - START - iTempObj: 0x%08x %O", iTempObj, iTempObj ));
-
-	__ASSERT_DEBUG( iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
-    if  ( iTempObj )
-        {
-	    NKern::ThreadEnterCS();
-        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::CloseTempObject() - in CS..." ));
-        //
-	    Kern::SafeClose( iTempObj, NULL );
-        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::CloseTempObject() - done safe close..." ));
-        //
-	    NKern::ThreadLeaveCS();
-        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::CloseTempObject() - left CS" ));
-        }
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::CloseTempObject() - END" ));
-	}
-
-
-DThread& DMemSpyDriverLogChanBase::TempObjectAsThread()
-    {
-	__ASSERT_DEBUG( iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
-    DThread* ret = (DThread*) iTempObj;
-    return *ret;
-    }
-
-
-DProcess& DMemSpyDriverLogChanBase::TempObjectAsProcess()
-    {
-	__ASSERT_DEBUG( iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
-    DProcess* ret = (DProcess*) iTempObj;
-    return *ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-RMemSpyMemStreamWriter DMemSpyDriverLogChanBase::OpenXferStream()
-    {
-	__ASSERT_ALWAYS( iXferBuffer, MemSpyDriverUtils::Fault( __LINE__ ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - this: 0x%08x, xferSize: %d", this, iXferBuffer->Size() ) );
-    RMemSpyMemStreamWriter ret( *iXferBuffer );
-    return ret;
-    }
-
-
-TInt DMemSpyDriverLogChanBase::OpenXferStream( RMemSpyMemStreamWriter& aWriter, TInt aRequiredSize )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - START - this: 0x%08x, xferSize: %d, aRequiredSize: %d", this, iXferBuffer->Size(), aRequiredSize ) );
-    __ASSERT_ALWAYS( iXferBuffer, MemSpyDriverUtils::Fault( __LINE__ ) );
-    
-    TInt err = KErrNone;
-    
-    // Never make the buffer smaller - but we will make it bigger if needs be.
-    if  ( aRequiredSize > iXferBuffer->Size() )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - Need to grow Xfer buffer..." ));
-        err = iXferBuffer->EnsureCapacity( aRequiredSize );
-        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - grow result: %d", err ));
-        }
-    //
-    if  ( err == KErrNone )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - creating writer... with xfer buffer size: %d", iXferBuffer->Size() ));
-        aWriter = RMemSpyMemStreamWriter( *iXferBuffer );
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - END - this: 0x%08x, xferSize: %d, aRequiredSize: %d", this, iXferBuffer->Size(), aRequiredSize ) );
-    return err;
-    }
-
-
-
-
-
-DMemSpyDriverOSAdaption& DMemSpyDriverLogChanBase::OSAdaption()
-    {
-    return iDevice.OSAdaption();
-    }
-
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanChunks.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,557 +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 "MemSpyDriverLogChanChunks.h"
-
-// System includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include "MemSpyDriverOSAdaption.h"
-
-// Constants
-_LIT8( KMemSpyLitDllDollarData, "DLL$DATA" );
-_LIT8( KMemSpyLitDollarDat, "$DAT" );
-_LIT8( KMemSpyLitDollarCode, "$CODE" );
-_LIT8( KMemSpyLitDollarGlobalCode, "GLOBAL$CODE" );
-_LIT8( KMemSpyLitLocalObject, "Local-" );
-
-
-DMemSpyDriverLogChanChunks::DMemSpyDriverLogChanChunks( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanBase( aDevice, aThread )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::DMemSpyDriverLogChanChunks() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanChunks::~DMemSpyDriverLogChanChunks()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::~DMemSpyDriverLogChanChunks() - START - this: 0x%08x", this ));
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::~DMemSpyDriverLogChanChunks() - END - this: 0x%08x", this ));
-	}
-
-
-
-TInt DMemSpyDriverLogChanChunks::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-        case EMemSpyDriverOpCodeChunkGetHandles:
-            r = GetChunkHandles( (TMemSpyDriverInternalChunkHandleParams*) a1 );
-            break;
-        case EMemSpyDriverOpCodeChunkGetInfo:
-            r = GetChunkInfo( (TMemSpyDriverInternalChunkInfoParams*) a1 );
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-    		}
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanChunks::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeChunkBase && aFunction < EMemSpyDriverOpCodeChunkEnd );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanChunks::GetChunkHandles( TMemSpyDriverInternalChunkHandleParams* aParams )
-    {
-	TMemSpyDriverInternalChunkHandleParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalChunkHandleParams) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkHandles() - END - params read error: %d", r));
-        return r;
-        }
-
-	const TInt maxCount = params.iMaxCount;
-	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkHandles() - START - id: %d,  maxCount: %d, type: %d", params.iId, maxCount, params.iType));
-
-    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
-    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
-
-
-    // This variable holds the number of handles that we have already
-    // written to the client-side.
-    TInt currentWriteIndex = 0;
-	
-    if  ( params.iType == EMemSpyDriverPrivateObjectTypeProcess || params.iType == EMemSpyDriverPrivateObjectTypeThread )
-        {
-        if  ( params.iType == EMemSpyDriverPrivateObjectTypeThread )
-    	    {
-	        r = OpenTempObject( params.iId, EThread );
-            if  ( r == KErrNone )
-                {
-                // Open the owning process instead, so that we can see which chunks are mapped
-                // into the thread.
-                DThread* thread = (DThread*) TempObject();
-                DProcess* process = threadAdaption.GetOwningProcess( *thread );
-                if  ( process )
-                    {
-                    const TUint parentProcessId = processAdaption.GetId( *process );
-                    CloseTempObject();
-                    r = OpenTempObject( parentProcessId, EProcess );
-                    }
-                else
-                    {
-                    CloseTempObject();
-                    r = KErrNotFound;
-                    }
-                }
-       	    }
-        else
-            {
-	        r = OpenTempObject( params.iId, EProcess );
-            }
-
-        // Handle error opening correct process
-        if (r != KErrNone)
-    	    {
-    	    Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkHandles() - END - parent process not found");
-    	    return r;
-    	    }
-   
-        DProcess* process = (DProcess*) TempObject();
-	    NKern::ThreadEnterCS();
-
-	    // Iterate through each handle in the process
-	    MemSpyObjectIx* processHandles = processAdaption.GetHandles( *process );
-		MemSpyObjectIx_HandleLookupLock();
-        const TInt processHandleCount = processHandles->Count();
-		MemSpyObjectIx_HandleLookupUnlock();
-
-	    for( TInt processHandleIndex = 0; processHandleIndex<processHandleCount && r == KErrNone && currentWriteIndex < maxCount; processHandleIndex++ )
-    	    {
-    	    // Get a handle from the process container...
-            MemSpyObjectIx_HandleLookupLock();
-			if (processHandleIndex >= processHandles->Count()) break; // Count may have changed in the meantime
-    	    DObject* object = (*processHandles)[ processHandleIndex ];
-			if (object && object->Open() != KErrNone) object = NULL;
-			MemSpyObjectIx_HandleLookupUnlock();
-            
-            if  ( object )
-                {
-                const TObjectType objectType = processAdaption.GetObjectType( *object );
-                if ( objectType == EChunk )
-                    {
-                    DChunk* chunk = (DChunk*) object;
-                    TAny* handle = (TAny*) chunk;
-                    r = Kern::ThreadRawWrite( &ClientThread(), params.iHandles + currentWriteIndex, &handle, sizeof(TAny*) );
-                    if  ( r == KErrNone )
-                        {
-                        ++currentWriteIndex;
-                        }
-                    }
-				object->Close(NULL);
-                }
-    	    }
-
-        // If we were asked for process-related chunks, also check the chunk container
-        // for entries which we don't have handles to, but do refer to our process
-        // Need a listing of all chunks in the system. Let client filter duplicates.
-        DObjectCon* container = Kern::Containers()[ EChunk ];
-        container->Wait();
-        //
-        const TInt count = container->Count();
-        for( TInt i=0; i<count && r == KErrNone && currentWriteIndex < maxCount; i++ )
-            {
-            DChunk* chunk= (DChunk*) (*container)[ i ];
-            //
-            const TBool isRelated = DoesChunkRelateToProcess( *chunk, TempObjectAsProcess() );
-            if  ( isRelated )
-                {
-                r = Kern::ThreadRawWrite( &ClientThread(), params.iHandles + currentWriteIndex, &chunk, sizeof(TAny*) );
-                if  ( r == KErrNone )
-                    {
-                    ++currentWriteIndex;
-                    }
-                }
-            }
-        //
-        container->Signal();
-        NKern::ThreadLeaveCS();
-
-        CloseTempObject();
-        }
-    else
-        {
-        // Need a listing of all chunks in the system. Let client filter duplicates.
-        DObjectCon* container = Kern::Containers()[ EChunk ];
-        NKern::ThreadEnterCS();
-        container->Wait();
-        //
-        const TInt count = container->Count();
-        for( TInt i=0; i<count && r == KErrNone && currentWriteIndex < maxCount; i++ )
-            {
-            DChunk* chunk= (DChunk*) (*container)[ i ];
-            //
-            r = Kern::ThreadRawWrite( &ClientThread(), params.iHandles + currentWriteIndex, &chunk, sizeof(TAny*) );
-            if  (r == KErrNone)
-                {
-                ++currentWriteIndex;
-                }
-            }
-        //
-        container->Signal();
-        NKern::ThreadLeaveCS();
-        }
-	
-	if  ( r == KErrBadDescriptor )
-        {
-        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
-        }
-    else
-        {
-        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), params.iCountPtr, &currentWriteIndex, sizeof(TInt) );
-        if  ( r == KErrNone )
-            {
-            r = finalWrite;
-            }
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkHandles() - END - number of handles written to client: %d, ret: %d", currentWriteIndex, r));
-	return r;
-    }
-
-
-TInt DMemSpyDriverLogChanChunks::GetChunkInfo( TMemSpyDriverInternalChunkInfoParams* aParams )
-    {
-	TMemSpyDriverInternalChunkInfoParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalChunkInfoParams) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkInfo() - END - params read error: %d", r));
-        return r;
-        }
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkInfo() - START - handle: 0x%08x", params.iHandle));
-		
-	DObjectCon* container = Kern::Containers()[EChunk];
-	NKern::ThreadEnterCS();
-
-    container->Wait();
-    const TInt count = container->Count();
-
-    DChunk* foundChunk = NULL;
-    
-    for(TInt i=0; i<count; i++)
-        {
-        DChunk* chunk = (DChunk*) (*container)[i];
-        if  ( chunk == params.iHandle )
-            {
-            foundChunk = chunk;
-            TRACE( PrintChunkInfo( *chunk ) );
-			r = foundChunk->Open();
-            break;
-            }
-        }
-
-    container->Signal();
-
-    if  ( foundChunk == NULL )
-        {
-    	Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkInfo() - END - KErrNotFound - couldnt find chunk");
-		NKern::ThreadLeaveCS();
-        return KErrNotFound;
-        }
-	if (r)
-		{
-		Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkInfo() - END - %d - Failed to open chunk", r);
-		NKern::ThreadLeaveCS();
-		return r;
-		}
-
-    // Prepare return data
-    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
-    //
-    params.iBaseAddress = chunkAdaption.GetBase( *foundChunk );
-    params.iSize = chunkAdaption.GetSize( *foundChunk );
-    params.iMaxSize = chunkAdaption.GetMaxSize( *foundChunk );
-    foundChunk->FullName( params.iName );
-
-    // Mirror the process memory tracker
-    DProcess* owner = chunkAdaption.GetOwningProcess( *foundChunk );
-    if  ( owner )
-        {
-        params.iOwnerId = OSAdaption().DProcess().GetId( *owner );
-        }
-    else
-        {
-        owner = static_cast< DProcess* >( chunkAdaption.GetOwner( *foundChunk, EProcess ) );
-        if  ( owner )
-            {
-            params.iOwnerId = OSAdaption().DProcess().GetId( *owner );
-            }
-        else
-            {
-            params.iOwnerId = chunkAdaption.GetControllingOwnerId( *foundChunk );
-            }
-        }
-
-    // Get type & attribs
-    params.iType = IdentifyChunkType( *foundChunk );
-    params.iAttributes = chunkAdaption.GetAttributes( *foundChunk );
-
-	// Finished with foundChunk
-	foundChunk->Close(NULL);
-	NKern::ThreadLeaveCS();
-    
-    // Write back to client
-    r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalChunkInfoParams) );
-	if  ( r == KErrBadDescriptor )
-        {
-        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkInfo() - END - handle: 0x%08x, params.iOwnerId: %d, r: %d", params.iHandle, params.iOwnerId, r ));
-    return r;
-    }
-
-
-void DMemSpyDriverLogChanChunks::PrintChunkInfo( DChunk& aChunk )
-    {
-    MemSpyDriverUtils::PrintChunkInfo( aChunk, OSAdaption() );
-    }
-
-
-TMemSpyDriverChunkType DMemSpyDriverLogChanChunks::IdentifyChunkType( DChunk& aChunk )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - START" ) );
-
-    TMemSpyDriverChunkType ret = EMemSpyDriverChunkTypeUnknown;
-
-    TName name;
-    aChunk.Name( name );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - name: %S", &name ) );
-
-    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
-    const TChunkType type = chunkAdaption.GetType( aChunk );
-
-    if  ( name == KMemSpyLitDllDollarData )
-        {
-        // This chunk contains Dll Global Data for the process
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeGlobalData" ) );
-        ret = EMemSpyDriverChunkTypeGlobalData;
-        }
-    else if ( type == ERamDrive )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeRamDrive" ) );
-        ret = EMemSpyDriverChunkTypeRamDrive;
-        }
-    else if ( type == EKernelStack )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeStackKernel" ) );
-        ret = EMemSpyDriverChunkTypeStackKernel;
-        }
-    else if ( name == KMemSpyLitDollarDat )
-        {
-        // This chunk contains process global data as well as user-side stacks for
-        // the process. 
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeStackAndProcessGlobalData" ) );
-        ret = EMemSpyDriverChunkTypeStackAndProcessGlobalData;
-        }
-    else if ( name == KMemSpyLitDollarGlobalCode && type == EDll )
-        {
-        // GLOBAL$CODE is used for RAM loaded code which is globally visible. This
-        // basically means locale DLLs - these must be visible to every process, even
-        // those which haven't loaded them.        
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeCodeGlobal" ) );
-        ret = EMemSpyDriverChunkTypeCodeGlobal;
-        }
-    else if ( name == KMemSpyLitDollarCode || type == EKernelCode || type == EDll || type == EUserCode )
-        {
-        // RAM-loaded code, which on the multiple memory model at least means that the code chunk is eseentially just a mapping
-        // artifact. The RAM itself is owned by the code segment, therefore counting the size of these CODE elements may result
-        // in inaccurate results if the code is shared amongst multiple processes.
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeCode" ) );
-        ret = EMemSpyDriverChunkTypeCode;
-        }
-    else if ( type == EUserSelfModCode )
-        {
-        // Dynamically create code chunk
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeCodeSelfModifiable" ) );
-        ret = EMemSpyDriverChunkTypeCodeSelfModifiable;
-        }
-    else if ( IsHeapChunk( aChunk, name ) )
-        {
-        // Catch kernel heap too
-        if  ( type == EKernelData )
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeHeapKernel" ) );
-            ret = EMemSpyDriverChunkTypeHeapKernel;
-            }
-        else
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeHeap" ) );
-            ret = EMemSpyDriverChunkTypeHeap;
-            }
-        }
-    else if ( type == EUserData && chunkAdaption.GetOwningProcess( aChunk ) == NULL )
-        {
-        // Global shared chunks match this pattern. Of course, we could check the memory model mapping attributes
-        // as that would give us the info in a heartbeat, but it's too specific.
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeGlobal" ) );
-        ret = EMemSpyDriverChunkTypeGlobal;
-        }
-    else if ( type == EUserData && chunkAdaption.GetOwner( aChunk ) != NULL && name.Length() > KMemSpyLitLocalObject().Length() && name.Left( KMemSpyLitLocalObject().Length() ) == KMemSpyLitLocalObject )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeLocal" ) );
-        ret = EMemSpyDriverChunkTypeLocal;
-        }
-    else
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeUnknown" ) );
-        TRACE( PrintChunkInfo( aChunk ) );
-        ret = EMemSpyDriverChunkTypeUnknown;
-        }
-
-    return ret;
-    }
-
-
-TBool DMemSpyDriverLogChanChunks::IsHeapChunk( DChunk& aChunk, const TName& aName )
-    {
-    (void) aName; // UREL warning
-    const TUint rHeapVTable = MemSpyDevice().RHeapVTable();
-    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - START - this: 0x%08x, aChunk: 0x%08x, RHeapVTable: 0x%08x, aName: %S, [%O]", this, &aChunk, rHeapVTable, &aName, &aChunk ) );
-
-    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
-    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
-    
-    // The first 4 bytes of every chunk correspond to the allocator VTable (For heap chunks).
-    // If it matches RHeap's vtable, we'll treat it as a heap.
-    TBool isHeap = EFalse;
-
-    // There must be an owning process or else it's definitely not a heap chunk.
-    DProcess* process = chunkAdaption.GetOwningProcess( aChunk );
-    TUint8* base = chunkAdaption.GetBase( aChunk );
-    const TInt size = chunkAdaption.GetSize( aChunk );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - base: 0x%08x, size: %d, process: 0x%08x (%O)", base, size, process, process ) );
-
-    if  ( process && size >= 4 )
-        {
-		NKern::ThreadEnterCS();
-        // Chunks are mapped into entire process so any thread within the process is enough...
-        DThread* firstThread = processAdaption.OpenFirstThread( *process );
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - firstThread: 0x%08x (%O)", firstThread, firstThread ) );
-        if  ( firstThread != NULL )
-            {
-            TBuf8<4> allocatorVTableBuffer;
-            TInt err = Kern::ThreadRawRead( firstThread, base, (TUint8*) allocatorVTableBuffer.Ptr(), allocatorVTableBuffer.MaxLength() );
-            TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk - read result of vtable data from requested thread is: %d", err ));
-            //
-            if  ( err == KErrNone )
-                {
-                TRACE( MemSpyDriverUtils::DataDump("possible chunk vtable data - %lS", allocatorVTableBuffer.Ptr(), allocatorVTableBuffer.MaxLength(), allocatorVTableBuffer.MaxLength() ) );
-                allocatorVTableBuffer.SetLength( allocatorVTableBuffer.MaxLength() );
-                
-                const TUint32 vtable =   allocatorVTableBuffer[0] +
-                                        (allocatorVTableBuffer[1] << 8) + 
-                                        (allocatorVTableBuffer[2] << 16) + 
-                                        (allocatorVTableBuffer[3] << 24);
-                TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk - [possible] vTable within chunk is: 0x%08x", vtable) );
-
-                // Check the v-table to work out if it really is an RHeap
-                isHeap = ( vtable == rHeapVTable );
-                TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - isHeap: %d", isHeap ) );
-                }
-
-            TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - closing first thread..." ) );
-            Kern::SafeClose( (DObject*&) firstThread, NULL );
-            }
-		NKern::ThreadLeaveCS();
-        }
-
-    /* We only want RHeap's at the moment
-    if  ( !isHeap && aName == KMemSpyLitDollarHeap )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - its called $HEAP, but its not an RHeap... we\'ll let it through though..." ) );
-        isHeap = ETrue;
-        }
-    */
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - END - this: 0x%08x, isHeap: %d", this, isHeap ) );
-    return isHeap;
-    }
-
-
-TBool DMemSpyDriverLogChanChunks::DoesChunkRelateToProcess( DChunk& aChunk, DProcess& aProcess )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::DoesChunkRelateToProcess() - START - this: 0x%08x, chunk: 0x%08x (%O), process: 0x%08x (%O)", this, &aChunk, &aChunk, &aProcess, &aProcess ) );
-    TBool ret = EFalse;
-    //
-    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
-    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
-    //
-    const TUint pid = processAdaption.GetId( aProcess );
-    DProcess* process = chunkAdaption.GetOwningProcess( aChunk );
-    if  ( process )
-        {
-        ret = ( pid == processAdaption.GetId( *process ) );
-        }
-    else
-        {
-        DObject* owner = chunkAdaption.GetOwner( aChunk, EProcess );
-        if  ( owner )
-            {
-            process = (DProcess*) owner;
-            ret = ( pid == processAdaption.GetId( *process ) );
-            }
-        else
-            {
-            ret = ( pid == chunkAdaption.GetControllingOwnerId( aChunk ) );
-            }
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::DoesChunkRelateToProcess() - END - this: 0x%08x, chunk: 0x%08x (%O), process: 0x%08x (%O), ret: %d", this, &aChunk, &aChunk, &aProcess, &aProcess, ret ) );
-    return ret;
-    }
-
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanClientServer.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +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 "MemSpyDriverLogChanClientServer.h"
-
-// System includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverOSAdaption.h"
-
-
-
-DMemSpyDriverLogChanClientServer::DMemSpyDriverLogChanClientServer( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanContainerBase( aDevice, aThread )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::DMemSpyDriverLogChanChunks() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanClientServer::~DMemSpyDriverLogChanClientServer()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::~DMemSpyDriverLogChanClientServer() - START - this: 0x%08x", this ));
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::~DMemSpyDriverLogChanClientServer() - END - this: 0x%08x", this ));
-	}
-
-
-
-TInt DMemSpyDriverLogChanClientServer::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanContainerBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-	    case EMemSpyDriverOpCodeClientServerGetServerSessionHandles:
-            r = GetServerSessionHandles( (TMemSpyDriverInternalServerSessionHandleParams*) a1 );
-            break;
-	    case EMemSpyDriverOpCodeClientServerGetServerSessionInfo:
-            r = GetServerSessionInfo( a1, (TMemSpyDriverServerSessionInfo*) a2 );
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanClientServer::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeClientServerBase && aFunction < EMemSpyDriverOpCodeClientServerEnd );
-    }
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanClientServer::GetServerSessionHandles( TMemSpyDriverInternalServerSessionHandleParams* aParams )
-	{
-    TMemSpyDriverInternalServerSessionHandleParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalServerSessionHandleParams) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionHandles() - END - params read error: %d", r));
-        return r;
-        }
-
-    DMemSpyDriverOSAdaptionDServer& serverAdaption = OSAdaption().DServer();
-
-	const TInt maxCount = params.iMaxCount;
-    NKern::ThreadEnterCS();
-
-    DObject* serverHandle = (DObject*) params.iServerHandle;
-    DServer* server = static_cast<DServer*>(CheckedOpen(EMemSpyDriverContainerTypeServer, serverHandle));
-    if (server == NULL)
-        {
-    	Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionHandles() - END - server not found");
-        NKern::ThreadLeaveCS();
-        return KErrNotFound;
-        }
-
-	ResetTempHandles();
-
-    NKern::LockSystem(); // Iterating session queue requires system lock
-    // Iterate through this server's sessions, writing back session pointer (handle)
-    // to client
-    SDblQue& serverQueue = serverAdaption.GetSessionQueue( *server );
-    SDblQueLink* anchor = &serverQueue.iA;
-    SDblQueLink* link = serverQueue.First();
-    while( link != anchor )
-        {
-		DSession* session = serverAdaption.GetSession( link );
-
-        // Found a match in the specified container. Write the object's handle (aka the object address)
-        // back to the client address space
-        if  ( session )
-            {
-            AddTempHandle( session );
-            }
-
-        // Get next item
-        link = link->iNext;
-        }
-    NKern::UnlockSystem();
-	server->Close(NULL);
-	NKern::ThreadLeaveCS();
-
-    // This variable holds the number of handles that we have already
-	// written to the client-side.
-	TInt currentWriteIndex = 0;
-	const TInt handleCount = TempHandleCount();
-    TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionHandles - writing %d handles to client...", handleCount ) );
-    for( ; currentWriteIndex<handleCount && r == KErrNone && currentWriteIndex < maxCount; )
-        {
-        TAny* handle = TempHandleAt( currentWriteIndex );
-        r = Kern::ThreadRawWrite( &ClientThread(), params.iSessionHandles + currentWriteIndex, &handle, sizeof(TAny*) );
-        if  (r == KErrNone)
-            {
-            ++currentWriteIndex;
-            }
-        }
-
-	if  ( r == KErrBadDescriptor )
-        {
-        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
-        }
-    else
-        {
-        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), params.iSessionCountPtr, &currentWriteIndex, sizeof(TInt) );
-        if  ( r == KErrNone )
-            {
-            r = finalWrite;
-            }
-        }
-
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionHandles() - END - r: %d", r));
-	return r;
-    }
-
-
-TInt DMemSpyDriverLogChanClientServer::GetServerSessionInfo( TAny* aSessionHandle, TMemSpyDriverServerSessionInfo* aParams )
-    {
-    TMemSpyDriverServerSessionInfo params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverServerSessionInfo) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionInfo() - END - params read error: %d", r));
-        return r;
-        }
-
-    DMemSpyDriverOSAdaptionDSession& sessionAdaption = OSAdaption().DSession();
-    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
-
-	NKern::ThreadEnterCS();
-
-    DSession* session = (DSession*)CheckedOpen(EMemSpyDriverContainerTypeSession, (DObject*)aSessionHandle);
-    if (session == NULL )
-        {
-    	Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionInfo() - END - session not found");
-        NKern::ThreadLeaveCS();
-        return KErrNotFound;
-        }
-
-    session->FullName( params.iName );
-
-    // Get owner type and id
-    DObject* sessionOwner = sessionAdaption.GetOwner( *session );
-    if  ( sessionOwner )
-        {
-        const TObjectType objectType = sessionAdaption.GetObjectType( *sessionOwner );
-        if  ( objectType == EProcess )
-            {
-            DProcess* sessionProcess = (DProcess*) sessionOwner;
-            //
-            params.iOwnerId = processAdaption.GetId( *sessionProcess );
-            params.iOwnerType = TMemSpyDriverServerSessionInfo::EOwnerProcess;
-            }
-        else if ( objectType == EThread )
-            {
-            DThread* sessionThread = (DThread*) sessionOwner;
-            //
-            params.iOwnerId = threadAdaption.GetId( *sessionThread );
-            params.iOwnerType = TMemSpyDriverServerSessionInfo::EOwnerThread;
-            }
-        }
-    else
-        {
-        params.iOwnerId = -1;
-        params.iOwnerType = TMemSpyDriverServerSessionInfo::EOwnerNone;
-        }
-
-    // Other attributes
-    params.iSessionType = sessionAdaption.GetSessionType( *session );
-    params.iAddress = (TUint8*)session;
-	session->Close(NULL);
-	NKern::ThreadLeaveCS();
-    r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverServerSessionInfo) );
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionInfo() - END - r: %d", r));
-	return r;
-    }
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanCodeSegs.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +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 "MemSpyDriverLogChanCodeSegs.h"
-
-// System includes
-#include <plat_priv.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverOSAdaption.h"
-
-
-
-DMemSpyDriverLogChanCodeSegs::DMemSpyDriverLogChanCodeSegs( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanBase( aDevice, aThread )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::DMemSpyDriverLogChanCodeSegs() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanCodeSegs::~DMemSpyDriverLogChanCodeSegs()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::~DMemSpyDriverLogChanCodeSegs() - START - this: 0x%08x", this ));
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::~DMemSpyDriverLogChanCodeSegs() - END - this: 0x%08x", this ));
-	}
-
-
-
-TInt DMemSpyDriverLogChanCodeSegs::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-	    case EMemSpyDriverOpCodeCodeSegsGetAll:
-		    r = GetCodeSegs( (TMemSpyDriverInternalCodeSnapshotParams*) a1 );
-		    break;
-	    case EMemSpyDriverOpCodeCodeSegsGetCodeSegsForProcess:
-		    r = GetCodeSegsForProcess( (TMemSpyDriverInternalCodeSnapshotParams*) a1 );
-		    break;
-	    case EMemSpyDriverOpCodeCodeSegsGetCodeSegInfo:
-		    r = GetCodeSegInfo( (TMemSpyDriverInternalCodeSegParams*) a1 );
-		    break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanCodeSegs::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeCodeSegsBase && aFunction < EMemSpyDriverOpCodeCodeSegsEnd );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanCodeSegs::GetCodeSegs( TMemSpyDriverInternalCodeSnapshotParams* aParams )
-	{
-    TMemSpyDriverInternalCodeSnapshotParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalCodeSnapshotParams) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - END - params read error: %d", r));
-        return r;
-        }
-
-    DMemSpyDriverOSAdaptionDCodeSeg& codeSegAdaption = OSAdaption().DCodeSeg();
-
-	const TInt maxCount = params.iMaxCount;
-	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - START - RAM-only: %d, maxCount: %d", params.iFilter, maxCount));
-	
-    // This is the number of items we have written to the client
-    TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs() - START - maxCount: %d", maxCount));
-    TInt clientWriteCount = 0;
-
-    // Need to get the code segs for each process. We'll let the client worry about filtering
-    // duplicates.
-    DObjectCon* container = Kern::Containers()[ EProcess ];
-	Kern::AccessCode();
-    container->Wait();
-	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 1"));
-    //
-    TFullName name;
-    const TInt count = container->Count();
-	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 2, count: %d", count));
-    for(TInt i=0; i<count && r == KErrNone; i++)
-        {
-        DProcess* process = (DProcess*) (*container)[ i ];
-        process->Name( name );
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 3, proc: %O", process));
-
-        SDblQue queue;
-        //
-        const TInt clientSpaceRemaining = maxCount - clientWriteCount;
-        const TInt numberOfCodeSegs = codeSegAdaption.GetCodeSegQueue( *process, queue );
-        const TInt numberOfCodeSegsToWriteToClient = Min( numberOfCodeSegs, clientSpaceRemaining );
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 4, clientSpaceRemaining: %d", clientSpaceRemaining));
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 5, numberOfCodeSegs: %d", numberOfCodeSegs));
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 6, numberOfCodeSegsToWriteToClient: %d", numberOfCodeSegsToWriteToClient));
-        //
-	    SDblQueLink* link = queue.iA.iNext;
-	    r = KErrNone;
-        //
-	    for( TInt j=0; j<numberOfCodeSegsToWriteToClient && r == KErrNone; ++j, link = link->iNext )
-		    {
-		    DCodeSeg* codeSegment = codeSegAdaption.GetCodeSeg( link );
-
-            // If the client only wants RAM-loaded codesegs, then ignore XIP.
-            TBool writeEntryToClient = ETrue;
-            if  ( params.iFilter )
-                {
-                const TBool isXIP = codeSegAdaption.GetIsXIP( *codeSegment );
-                writeEntryToClient = ( !isXIP );
-                }
-
-            // Now write
-            if  ( writeEntryToClient )
-                {
-                r = Kern::ThreadRawWrite( &ClientThread(), params.iHandles + clientWriteCount, &codeSegment, sizeof(TAny*) );
-    	        TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 7, codeSegment: 0x%08x to client: %d", codeSegment, r));
-                if  ( r == KErrNone )
-                    {
-                    ++clientWriteCount;
-                    }
-                }
-		    }
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 8"));
-        codeSegAdaption.EmptyCodeSegQueue( queue );
-
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 9"));
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 10"));
-    container->Signal();
-	Kern::EndAccessCode();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 11 - r: %d", r));
-    if  ( r == KErrBadDescriptor )
-        {
-        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
-        }
-    else
-        {
-        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), params.iCountPtr, &clientWriteCount, sizeof(TInt) );
-        if  ( r == KErrNone )
-            {
-            r = finalWrite;
-            }
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs() - END - wrote %d handles to client, r: %d", clientWriteCount, r));
-	return r;
-	}
-
-
-TInt DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess( TMemSpyDriverInternalCodeSnapshotParams* aParams )
-	{
-    TMemSpyDriverInternalCodeSnapshotParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalCodeSnapshotParams) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - END - params read error: %d", r));
-        return r;
-        }
-
-    DMemSpyDriverOSAdaptionDCodeSeg& codeSegAdaption = OSAdaption().DCodeSeg();
-
-    const TInt maxCount = params.iMaxCount;
-	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - START - pid: %d, maxCount: %d", params.iFilter, maxCount));
-	
-	r = OpenTempObject( params.iFilter, EProcess );
-	if (r != KErrNone)
-		{
-		Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - END - process not found");
-		return r;
-		}
-		
-	DProcess* pP = (DProcess*) TempObject();
-
-	SDblQue q;
-
-    Kern::AccessCode();
-    const TInt actcount = codeSegAdaption.GetCodeSegQueue( *pP, q );
-
-    CloseTempObject();
-
-	TInt n = Min(actcount, maxCount);
-	SDblQueLink* pL = q.iA.iNext;
-	r = KErrNone;
-    //
-	for (TInt i=0; i<n; ++i, pL = pL->iNext)
-		{
-	    DCodeSeg* pS = codeSegAdaption.GetCodeSeg( pL );
-		
-        r = Kern::ThreadRawWrite( &ClientThread(), params.iHandles + i, &pS, sizeof(TAny*) );
-		if  ( r != KErrNone )
-            {
-			break;
-            }
-		}
-    codeSegAdaption.EmptyCodeSegQueue( q );
-	Kern::EndAccessCode();
-
-	if  (r == KErrBadDescriptor)
-        {
-        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
-        }
-    else
-        {
-        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), params.iCountPtr, &actcount, sizeof(TInt) );
-        if  ( r == KErrNone )
-            {
-            r = finalWrite;
-            }
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - END - act count: %d, r: %d", actcount, r));
-	return r;
-	}
-
-
-TInt DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo( TMemSpyDriverInternalCodeSegParams* aParams )
-	{
-    TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - START"));
-	TMemSpyDriverInternalCodeSegParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalCodeSegParams) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - END - params read error: %d", r));
-        return r;
-        }
-
-    TMemSpyDriverCodeSegInfo codeSegInfo;
-    codeSegInfo.iSize = 0;
-    
-    // Create info
-    codeSegInfo.iCreateInfo.iFileName.Zero();
-    codeSegInfo.iCreateInfo.iCodeSize = 0;
-    codeSegInfo.iCreateInfo.iTextSize = 0;
-    codeSegInfo.iCreateInfo.iDataSize = 0;
-    codeSegInfo.iCreateInfo.iBssSize = 0;
-    codeSegInfo.iCreateInfo.iTotalDataSize = 0;
-  
-    // Memory Info
-    codeSegInfo.iMemoryInfo.iCodeBase = 0;
-    codeSegInfo.iMemoryInfo.iCodeSize = 0;
-    codeSegInfo.iMemoryInfo.iConstDataBase = 0;
-    codeSegInfo.iMemoryInfo.iConstDataSize = 0;
-    codeSegInfo.iMemoryInfo.iInitialisedDataBase = 0;
-    codeSegInfo.iMemoryInfo.iInitialisedDataSize = 0;
-    codeSegInfo.iMemoryInfo.iUninitialisedDataBase = 0;
-    codeSegInfo.iMemoryInfo.iUninitialisedDataSize = 0;
-
-	DProcess* process = NULL;
-    DMemSpyDriverOSAdaptionDCodeSeg& codeSegAdaption = OSAdaption().DCodeSeg();
-
-	r = KErrNotFound;
-	Kern::AccessCode();
-	DCodeSeg* codeSeg = codeSegAdaption.GetCodeSegFromHandle( params.iHandle );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - codeSeg: 0x%08x, handle: 0x%08x", codeSeg, params.iHandle ));
-
-    if  ( codeSeg != NULL )
-		{
-#ifdef __EPOC32__
-        TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - calling Kern::CodeSegGetMemoryInfo for code seg: %C...", codeSeg ) );
-        Kern::CodeSegGetMemoryInfo( *codeSeg, codeSegInfo.iMemoryInfo, process );
-        r = KErrNone;
-        TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - called Kern::CodeSegGetMemoryInfo, r: %d", r ) );
-#else
-        r = KErrNone;
-#endif
-        //
-		if  ( r == KErrNone )
-			{
-            TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - calling Info...") );
-            codeSegAdaption.GetCreateInfo( *codeSeg, codeSegInfo.iCreateInfo );
-            TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - called info" ) );
-            
-            TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - codeSegInfo.iMemoryInfo.iCodeBase: 0x%08x, codeSegInfo.iMemoryInfo.iCodeSize: %8d", codeSegInfo.iMemoryInfo.iCodeBase, codeSegInfo.iMemoryInfo.iCodeSize ) );
-            codeSegInfo.iSize = codeSegAdaption.GetSize( *codeSeg );
-
-            TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - doing write to user land..." ) );
-            r = Kern::ThreadRawWrite( &ClientThread(), params.iInfoPointer, &codeSegInfo, sizeof(TMemSpyDriverCodeSegInfo) );
-            TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - done write to user-land, r: %d", r ) );
-			}
-		}
-	Kern::EndAccessCode();
-    //
-	if  ( r == KErrBadDescriptor )
-        {
-        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
-        }
-    //
-	return r;
-	}
-
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanContainerBase.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,278 +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 "MemSpyDriverLogChanContainerBase.h"
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include "MemSpyDriverOSAdaption.h"
-
-
-DMemSpyDriverLogChanContainerBase::DMemSpyDriverLogChanContainerBase( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanBase( aDevice, aThread )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::DMemSpyDriverLogChanContainerBase() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanContainerBase::~DMemSpyDriverLogChanContainerBase()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::~DMemSpyDriverLogChanContainerBase() - START - this: 0x%08x", this ));
-
-    ResetTempHandles();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::~DMemSpyDriverLogChanContainerBase() - END - this: 0x%08x", this ));
-	}
-
-
-
-
-
-
-DObject* DMemSpyDriverLogChanContainerBase::CheckedOpen(TMemSpyDriverContainerType aContainerType, DObject* aObject, TBool aQuick)
-	{
-	__ASSERT_CRITICAL;
-	__ASSERT_DEBUG(aObject != NULL, MemSpyDriverUtils::Fault( __LINE__ ));
-    const TObjectType expectedType = ObjectTypeFromMemSpyContainerType(aContainerType);
-
-    // Quick mode means we just check container ids and we trust that the object will exist.
-	// [TomS: not entirely convinced we can ever be certain of that]
-    TInt err = KErrNotFound;
-    if (aQuick)
-        {
-		LOG("quick CheckedOpen of %08x", aObject);
-        const TObjectType objectType = OSAdaption().DThread().GetObjectType(*aObject);
-        if (objectType == expectedType)
-            {
-            err = aObject->Open();
-            }
-        }
-	else
-		{
-        DObjectCon* container = Kern::Containers()[expectedType];
-        container->Wait();
-        const TInt count = container->Count();
-        for (TInt i = 0; i < count; i++)
-            {
-            DObject* object = (*container)[i];
-            if (object == aObject)
-                {
-                err = aObject->Open();
-				break;
-				}
-			}
-		container->Signal();
-		}
-
-	LOG("CheckedOpen(%d, 0x%08x, quick=%d) returned error %d", aContainerType, aObject, aQuick, err);
-	return (err == KErrNone) ? aObject : NULL;
-	}
-
-
-
-TObjectType DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType( TMemSpyDriverContainerType aType )
-    {
-    // Map type
-    TObjectType type = EObjectTypeAny;
-    switch( aType )
-        {
-    case EMemSpyDriverContainerTypeThread:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeThread" ));
-        type = EThread;
-        break;
-    case EMemSpyDriverContainerTypeProcess:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeProcess" ));
-        type = EProcess;
-        break;
-    case EMemSpyDriverContainerTypeChunk:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeChunk" ));
-        type = EChunk;
-        break;
-    case EMemSpyDriverContainerTypeLibrary:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeLibrary" ));
-        type = ELibrary;
-        break;
-    case EMemSpyDriverContainerTypeSemaphore:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeSemaphore" ));
-        type = ESemaphore;
-        break;
-    case EMemSpyDriverContainerTypeMutex:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeMutex" ));
-        type = EMutex;
-        break;
-    case EMemSpyDriverContainerTypeTimer:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeTimer" ));
-        type = ETimer;
-        break;
-    case EMemSpyDriverContainerTypeServer:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeServer" ));
-        type = EServer;
-        break;
-    case EMemSpyDriverContainerTypeSession:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeSession" ));
-        type = ESession;
-        break;
-    case EMemSpyDriverContainerTypeLogicalDevice:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeLogicalDevice" ));
-        type = ELogicalDevice;
-        break;
-    case EMemSpyDriverContainerTypePhysicalDevice:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypePhysicalDevice" ));
-        type = EPhysicalDevice;
-        break;
-    case EMemSpyDriverContainerTypeLogicalChannel:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeLogicalChannel" ));
-        type = ELogicalChannel;
-        break;
-    case EMemSpyDriverContainerTypeChangeNotifier:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeChangeNotifier" ));
-        type = EChangeNotifier;
-        break;
-    case EMemSpyDriverContainerTypeUndertaker:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeUndertaker" ));
-        type = EUndertaker;
-        break;
-    case EMemSpyDriverContainerTypeMsgQueue:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeMsgQueue" ));
-        type = EMsgQueue;
-        break;
-    case EMemSpyDriverContainerTypePropertyRef:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypePropertyRef" ));
-        type = EPropertyRef;
-        break;
-    case EMemSpyDriverContainerTypeCondVar:
- 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeCondVar" ));
-        type = ECondVar;
-        break;
-    default:
-        Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType - unsupported container type: %d", aType);
-        break;
-        }
-    //
-    return type;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    
-
-void DMemSpyDriverLogChanContainerBase::ResetTempHandles()
-    {
-    iTempHandleCount = 0;
-    }
-
-
-void DMemSpyDriverLogChanContainerBase::AddTempHandle( TAny* aHandle )
-    {
-    __ASSERT_ALWAYS( iTempHandleCount >= 0, MemSpyDriverUtils::Fault( __LINE__) );
-    if  ( iTempHandleCount < KMemSpyDriverMaxHandles )
-        {
-        iTempHandles[ iTempHandleCount++ ] = aHandle;
-        }
-    }
-
-
-TAny* DMemSpyDriverLogChanContainerBase::TempHandleAt( TInt aIndex ) const
-    {
-    __ASSERT_ALWAYS( aIndex >= 0 && aIndex < KMemSpyDriverMaxHandles, MemSpyDriverUtils::Fault(__LINE__) );
-    __ASSERT_ALWAYS( aIndex < iTempHandleCount, MemSpyDriverUtils::Fault(__LINE__) );
-    return iTempHandles[ aIndex ];
-    }
-
-
-TInt DMemSpyDriverLogChanContainerBase::TempHandleCount() const
-    {
-    TRACE( Kern::Printf( "DMemSpyDriverLogChanContainerBase::TempHandleCount() - END - count is: %d", iTempHandleCount ));
-    return iTempHandleCount;
-    }
-
-
-TInt DMemSpyDriverLogChanContainerBase::WriteToClient( TAny** aHandlePtr, TInt* aCountPtr, TInt aMaxCount )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::WriteToClient() - START - iTempHandleCount: %d", iTempHandleCount ));
-
-    TInt r = KErrNone;
-
-    // This variable holds the number of handles that we have already
-	// written to the client-side.
-	TInt currentWriteIndex = 0;
-
-    // If the client passed a bad descriptor then we panic it. Otherwise, we always update the amount
-    // of handles we have found (even if there was an error - i.e. we set the value to zero) or else
-    // the client will attempt to index through its huge stack-based handle array.
-	NKern::ThreadEnterCS();
-    TInt tempHandleCount = TempHandleCount();
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::GetContainerHandles - trying to write %d handles to client...", tempHandleCount ));
-
-    for( ; currentWriteIndex<tempHandleCount && r == KErrNone && currentWriteIndex < aMaxCount; )
-        {
-        TAny* handle = TempHandleAt( currentWriteIndex );
-        r = Kern::ThreadRawWrite( &ClientThread(), aHandlePtr + currentWriteIndex, &handle, sizeof(TAny*) );
-        if  (r == KErrNone)
-            {
-            ++currentWriteIndex;
-            }
-        }
-
-	if  ( r == KErrBadDescriptor )
-        {
-        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
-        }
-    else
-        {
-        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), aCountPtr, &currentWriteIndex, sizeof(TInt) );
-        if  ( r == KErrNone )
-            {
-            r = finalWrite;
-            }
-        }
-	NKern::ThreadLeaveCS();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::GetContainerHandles() - END - r: %d", r));
-	return r;
-    }
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanContainers.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1076 +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 "MemSpyDriverLogChanContainers.h"
-
-// System includes
-#include <memspy/driver/memspydriverconstants.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverUserEventMonitor.h"
-#include "MemSpyDriverSuspensionManager.h"
-#include "MemSpyDriverOSAdaption.h"
-
-// Constants
-const TInt KMemSpyDriverLogChanContainersXferBufferSize = 1024 * 4;
-
-
-DMemSpyDriverLogChanContainers::DMemSpyDriverLogChanContainers( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanContainerBase( aDevice, aThread )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::DMemSpyDriverLogChanContainers() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanContainers::~DMemSpyDriverLogChanContainers()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::~DMemSpyDriverLogChanContainers() - START - this: 0x%08x", this ));
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::~DMemSpyDriverLogChanContainers() - END - this: 0x%08x", this ));
-	}
-
-
-TInt DMemSpyDriverLogChanContainers::Construct()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::Construct() - START - this: 0x%08x", this ));
-    
-    const TInt ret = BaseConstruct( KMemSpyDriverLogChanContainersXferBufferSize );
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::Construct() - END - this: 0x%08x, err: %d", this, ret ));
-    return ret;
-	}
-
-
-TInt DMemSpyDriverLogChanContainers::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanContainerBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-	    case EMemSpyDriverOpCodeContainersGetHandles:
-            r = GetContainerHandles( (TMemSpyDriverInternalContainerHandleParams*) a1 );
-            break;
-	    case EMemSpyDriverOpCodeContainersGetHandleInfo:
-            r = GetGenericHandleInfo( (TInt) a1, (TMemSpyDriverHandleInfoGeneric*) a2 );
-            break;
-        case EMemSpyDriverOpCodeContainersGetApproxSize:
-            r = GetKernelObjectSizeApproximation( (TMemSpyDriverContainerType) ((TInt) a1), (TInt*) a2 );
-            break;
-        case EMemSpyDriverOpCodeContainersGetReferencesToMyThread:
-            r = GetReferencesToMyThread( (TUint) a1, (TDes8*) a2 );
-            break;
-        case EMemSpyDriverOpCodeContainersGetReferencesToMyProcess:
-            r = GetReferencesToMyProcess( (TUint) a1, (TDes8*) a2 );
-            break;
-        case EMemSpyDriverOpCodeContainersGetPAndSInfo:
-            r = GetPAndSInfo( (DObject*) a1, (TMemSpyDriverPAndSInfo*) a2 );
-            break;
-        case EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreads:
-            r = GetCondVarSuspendedThreads( (TMemSpyDriverInternalCondVarSuspendedThreadParams*)a1 );
-            break;
-        case EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreadInfo:
-            r = GetCondVarSuspendedThreadInfo( a1, (TMemSpyDriverCondVarSuspendedThreadInfo*)a2 );
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanContainers::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeContainersBase && aFunction < EMemSpyDriverOpCodeContainersEnd );
-    }
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanContainers::GetContainerHandles( TMemSpyDriverInternalContainerHandleParams* aParams )
-	{
-    TMemSpyDriverInternalContainerHandleParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalContainerHandleParams) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles() - END - params read error: %d", r));
-        return r;
-        }
-
-	const TInt maxCount = params.iMaxCount;
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles() - START - tid or pid: %d, maxCount: %d, container: %d, handleSource: %d", params.iTidOrPid, maxCount, params.iContainer, params.iHandleSource ));
-
-    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
-
-    ResetTempHandles();
-
-    if  ( params.iTidOrPid == KMemSpyDriverEnumerateContainerHandles )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - enumerating container handles... " ));
-	    NKern::ThreadEnterCS();
-
-        // We are enumerating an entire container - not a thread-specific request
-        const TObjectType type = ObjectTypeFromMemSpyContainerType( params.iContainer );
-
-        DObjectCon* container = Kern::Containers()[type];
-        container->Wait();
-
-        const TInt count = container->Count();
-        for(TInt i=0; i<count; i++)
-            {
-            DObject* object = (*container)[ i ];
-            if  ( object != NULL )
-                {
-                AddTempHandle( object );
-                }
-            }
-
-        container->Signal();
-    	NKern::ThreadLeaveCS();
-        }
-    else
-        {
-        // Are we dealing with threads or processes?
-        const TObjectType sourceContainerType = (TObjectType) params.iHandleSource;
-        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - sourceContainerType: %d", sourceContainerType ));
-
-        // We need to open the process or thread in order to get its handle
-        r = OpenTempObject( params.iTidOrPid, sourceContainerType );
-        if  ( r == KErrNone )
-		    {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - handle source object: %O", TempObject() ));
-
-            // This is the source for the handles we want to check. Its either the process or thread's handle index...
-            MemSpyObjectIx* handles = NULL;
-
-            // Check that the process' thread's are suspended and get handle index
-            if  ( params.iHandleSource == EMemSpyDriverThreadOrProcessTypeThread )
-                {
-                DThread* thread = (DThread*) TempObject();
-                if  ( !SuspensionManager().IsSuspended( *thread ) )
-                    {
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - parent process not suspended => KErrAccessDenied"));
-                    r = KErrAccessDenied;
-                    }
-                else
-                    {
-                    handles = threadAdaption.GetHandles( *thread );
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - checking handles for thread: %O", thread ));
-                    }
-                }
-            else if ( params.iHandleSource == EMemSpyDriverThreadOrProcessTypeProcess )
-                {
-                DProcess* process = (DProcess*) TempObject();
-                if  ( !SuspensionManager().IsSuspended( *process ) )
-                    {
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - process not suspended => KErrAccessDenied"));
-                    r =KErrAccessDenied;
-                    }
-                else
-                    {
-                    handles = processAdaption.GetHandles( *process );
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - checking handles for process: %O", process ));
-                    }
-                }
-
-            if  ( handles )
-                {
-	            NKern::ThreadEnterCS();
-
-                // Iterate through each handle in the thread/process and add it to the temp handles container if
-                // the handle is of the correct type.
-
-				MemSpyObjectIx_HandleLookupLock();
-				const TInt handleCount = handles->Count();
-				MemSpyObjectIx_HandleLookupUnlock();
-                TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - %d handles in index...", handleCount ));
-
-                for( TInt handleIndex=0; handleIndex<handleCount; handleIndex++ )
-    	            {
-    	            // Get a handle from the container...
-					MemSpyObjectIx_HandleLookupLock();
-					if (handleIndex >= handles->Count()) break; // Count may have changed in the meantime
-    				DObject* objectToSearchFor = (*handles)[ handleIndex ];
-					if (objectToSearchFor && objectToSearchFor->Open() != KErrNone) objectToSearchFor = NULL;
-					MemSpyObjectIx_HandleLookupUnlock();
-        
-                    if (objectToSearchFor && OSAdaption().DThread().GetObjectType(*objectToSearchFor) == ObjectTypeFromMemSpyContainerType(params.iContainer))
-                        {
-                        // Found a match in the specified container. Write the object's handle (aka the object address)
-                        // back to the client address space
-                        AddTempHandle( objectToSearchFor );
-                        }
-					if (objectToSearchFor) objectToSearchFor->Close(NULL);
-    	            }
-
-                NKern::ThreadLeaveCS();
-                }
-
-            // Done with this now.
-            CloseTempObject();
-            }
-        else
-		    {
-    	    Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - thread / process not found");
-		    }
-        }
-
-    // Write back handles to client
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - trying to write %d handles to client...", TempHandleCount() ));
-    r = WriteToClient( params.iHandles, params.iCountPtr, maxCount );
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles() - END - r: %d", r));
-	return r;
-    }
-
-
-TInt DMemSpyDriverLogChanContainers::GetGenericHandleInfo( TInt aTid, TMemSpyDriverHandleInfoGeneric* aParams )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - START" ));
-
-    TMemSpyDriverHandleInfoGeneric params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverHandleInfoGeneric) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - END - params read error: %d", r));
-        return r;
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo  - tid: %d, handle: 0x%08x", aTid, params.iHandle ));
-    
-    if  ( aTid == KMemSpyDriverEnumerateContainerHandles )
-        {
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - getting info for non-thread specific handle..."));
-        }
-    else
-        {
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - thread-specific request..."));
-
-        r = OpenTempObject( aTid, EThread );
-	    if (r != KErrNone)
-		    {
-    	    Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - END - thread not found");
-		    return r;
-		    }
-    
-        // Check that the process' thread's are suspended
-        DThread* thread = (DThread*) TempObject();
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - opened thread: %O", thread));
-        if  ( !SuspensionManager().IsSuspended( *thread ) )
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - END - parent process not suspended => KErrAccessDenied"));
-            CloseTempObject();
-            return KErrAccessDenied;
-            }
-        }
-
-	NKern::ThreadEnterCS();
-
-    // First, locate the specific DObject in question. Cast the handle, but don't use the object...
-    DObject* handleAsObject = (DObject*) params.iHandle;
-    handleAsObject = CheckedOpen(params.iType, handleAsObject);
-    if  ( handleAsObject != NULL )
-        {
-        // We found the right object. First get generic info.
-        handleAsObject->FullName( params.iName );
-        handleAsObject->Name( params.iNameDetail );
-        
-        // Using threadAddaption to fetch generic info.
-        // Implementations of following get functions are actually in DMemSpyDriverOSAdaptionDObject
-        // so it does not matter what adaption to use for generic info.
-        DMemSpyDriverOSAdaptionDThread& threadAddaption = OSAdaption().DThread();
-        params.iAccessCount = threadAddaption.GetAccessCount( *handleAsObject );
-        params.iUniqueID = threadAddaption.GetUniqueID( *handleAsObject );
-        params.iProtection = threadAddaption.GetProtection( *handleAsObject );
-        params.iAddressOfKernelOwner = threadAddaption.GetAddressOfKernelOwner( *handleAsObject );
-        
-        // Get type-specific info.
-        if  ( params.iType == EMemSpyDriverContainerTypeThread )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeThread" ));
-
-            DThread* object = (DThread*) handleAsObject;
-            DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-            //
-            params.iId = threadAdaption.GetId( *object );
-            params.iPriority = threadAdaption.GetPriority( *object );
-            params.iAddressOfOwningProcess = threadAdaption.GetAddressOfOwningProcess( *object );
-            threadAdaption.GetNameOfOwningProcess( *object, params.iNameOfOwner );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeProcess )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeProcess" ));
-
-            DProcess* object = (DProcess*) handleAsObject;
-            DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
-            //
-            params.iId = processAdaption.GetId( *object );
-            //
-            params.iPriority = processAdaption.GetPriority( *object );
-            params.iAddressOfOwningProcess = processAdaption.GetAddressOfOwningProcess( *object );
-            params.iCreatorId = processAdaption.GetCreatorId( *object );
-            params.iSecurityZone = processAdaption.GetSecurityZone( *object );
-            params.iAttributes = processAdaption.GetAttributes( *object );
-            params.iAddressOfDataBssStackChunk = processAdaption.GetAddressOfDataBssStackChunk( *object );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeChunk )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChunk" ));
-
-            DChunk* object = (DChunk*) handleAsObject;
-            DMemSpyDriverOSAdaptionDChunk& ca = OSAdaption().DChunk();
-            //
-            params.iSize = ca.GetSize( *object );
-            params.iId = ca.GetOwningProcessId( *object );
-            params.iAddressOfOwningProcess = ca.GetAddressOfOwningProcess( *object );
-            params.iMaxSize = ca.GetMaxSize( *object );
-            params.iBottom = ca.GetBottom( *object );
-            params.iTop = ca.GetTop( *object );
-            params.iAttributes = ca.GetAttributes( *object );
-            params.iStartPos = ca.GetStartPos( *object );
-            params.iControllingOwner = ca.GetControllingOwnerId( *object );
-            params.iRestrictions = ca.GetRestrictions( *object );
-            params.iMapAttr = ca.GetMapAttr( *object );
-            params.iChunkType = ca.GetType( *object );
-            ca.GetNameOfOwningProcess( *object, params.iNameOfOwner );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeLibrary )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLibrary" ));
-
-	        Kern::AccessCode();
-            //
-            DLibrary* object = (DLibrary*) handleAsObject;
-            DMemSpyDriverOSAdaptionDCodeSeg& csa = OSAdaption().DCodeSeg();
-            DCodeSeg* codeSeg = csa.GetCodeSeg( *object );
-            params.iAddressOfCodeSeg = (TUint8*)codeSeg;
-            params.iMapCount = csa.GetMapCount( *object );
-            params.iState = csa.GetState( *object );
-            //
-            if  ( codeSeg )
-                {
-                params.iSize = csa.GetSize( *codeSeg );
-                }
-            else
-                {
-                r = KErrNotFound;
-                }
-            //
-	        Kern::EndAccessCode();
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeSemaphore )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSemaphore" ));
-
-            DSemaphore* object = (DSemaphore*) handleAsObject;
-            DMemSpyDriverOSAdaptionDSemaphore& sa = OSAdaption().DSemaphore();
-            params.iCount = sa.GetCount( *object );
-            params.iResetting = sa.GetResetting( *object );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeMutex )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMutex" ));
-
-            DMutex* object = (DMutex*) handleAsObject;
-            DMemSpyDriverOSAdaptionDMutex& ma = OSAdaption().DMutex();
-            //
-            params.iCount = ma.GetHoldCount( *object );
-            params.iWaitCount = ma.GetWaitCount( *object );
-            params.iResetting = ma.GetResetting( *object );
-            params.iOrder = ma.GetOrder( *object );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeTimer )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeTimer" ));
-
-            // Get timer properties
-            DTimer* object = (DTimer*) handleAsObject;
-            DMemSpyDriverOSAdaptionDTimer& ta = OSAdaption().DTimer();
-            //
-            params.iTimerType = MapToMemSpyTimerType( ta.GetType( *object ) );
-            params.iTimerState = MapToMemSpyTimerState( ta.GetState( *object ) );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeServer )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeServer" ));
-
-            DServer* object = (DServer*) handleAsObject;
-            DMemSpyDriverOSAdaptionDServer& sa = OSAdaption().DServer();
-            //
-            params.iCount = sa.GetSessionCount( *object );
-            params.iId = sa.GetOwningThreadId( *object );
-            params.iSessionType = sa.GetSessionType( *object );
-            params.iAddressOfOwningThread = sa.GetAddressOfOwningThread( *object );
-            sa.GetNameOfOwningThread( *object, params.iNameOfOwner );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeSession )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSession" ));
-
-            DSession* object = (DSession*) handleAsObject;
-            DMemSpyDriverOSAdaptionDServer& serverAdaption = OSAdaption().DServer();
-            DMemSpyDriverOSAdaptionDSession& sessionAdaption = OSAdaption().DSession();
-
-            params.iName.Zero();
-
-            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting session type..." ));
-            params.iSessionType = sessionAdaption.GetSessionType( *object );
-            params.iAddressOfServer = sessionAdaption.GetAddressOfServer( *object );
-            params.iTotalAccessCount = sessionAdaption.GetTotalAccessCount( *object );
-            params.iSvrSessionType = sessionAdaption.GetSessionType( *object );
-            params.iMsgCount = sessionAdaption.GetMsgCount( *object );
-            params.iMsgLimit = sessionAdaption.GetMsgLimit( *object );
-            
-            // Its more useful in this instance, if the name object
-            // points to the server which the session is connected to
-            // (rather than displaying a process-local name).
-            DServer* server = (DServer*)CheckedOpen(EMemSpyDriverContainerTypeServer, sessionAdaption.GetServer( *object ));
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting full name, server: 0x%08x", server ));
-            //
-            if  ( server )
-                {
-                server->FullName( params.iName );
-
-                // Continue as normal for other items
-	            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - server: 0x%08x, server->iOwningThread: 0x%08x", server, server->iOwningThread ));
-                DThread* owningThread = serverAdaption.GetOwningThread( *server );
-                if  ( owningThread )
-                    {
-	                TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting server thread id..." ));
-                    params.iId = serverAdaption.GetOwningThreadId( *server );
-                    }
-
-                server->Close(NULL);
-                }
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeLogicalDevice )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalDevice" ));
-
-            DLogicalDevice* object = (DLogicalDevice*) handleAsObject;
-            DMemSpyDriverOSAdaptionDLogicalDevice& lda = OSAdaption().DLogicalDevice();
-            params.iOpenChannels = lda.GetOpenChannels( *object );
-            params.iVersion = lda.GetVersion( *object );
-            params.iParseMask = lda.GetParseMask( *object );
-            params.iUnitsMask = lda.GetUnitsMask( *object );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypePhysicalDevice )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypePhysicalDevice" ));
-	        
-	        DPhysicalDevice* object = (DPhysicalDevice*) handleAsObject;
-            DMemSpyDriverOSAdaptionDPhysicalDevice& pda = OSAdaption().DPhysicalDevice();
-            params.iVersion = pda.GetVersion( *object );
-            params.iUnitsMask = pda.GetUnitsMask( *object );
-            params.iAddressOfCodeSeg = pda.GetAddressOfCodeSeg( *object );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeLogicalChannel )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalChannel" ));
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeChangeNotifier )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChangeNotifier" ));
-
-	        DChangeNotifier* object = (DChangeNotifier*) handleAsObject;
-            DMemSpyDriverOSAdaptionDChangeNotifier& cna = OSAdaption().DChangeNotifier();
-            params.iChanges = cna.GetChanges( *object );
-            params.iAddressOfOwningThread = cna.GetAddressOfOwningThread( *object );
-            cna.GetNameOfOwningThread( *object, params.iNameOfOwner );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeUndertaker )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeUndertaker" ));
-	        
-            DUndertaker* object = (DUndertaker*) handleAsObject;
-            DMemSpyDriverOSAdaptionDUndertaker& uta = OSAdaption().DUndertaker();
-            params.iAddressOfOwningThread = uta.GetAddressOfOwningThread( *object );
-            uta.GetNameOfOwningThread( *object, params.iNameOfOwner );
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeMsgQueue )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMsgQueue" ));
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypePropertyRef )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypePropertyRef" ));
-            }
-        else if ( params.iType == EMemSpyDriverContainerTypeCondVar )
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeCondVar" ));
-	        
-            DCondVar* object = (DCondVar*) handleAsObject;
-            DMemSpyDriverOSAdaptionDCondVar& cva = OSAdaption().DCondVar();
-            params.iResetting = cva.GetResetting( *object );
-            params.iAddressOfOwningThread = cva.GetAddressOfMutex( *object );
-            cva.GetNameOfMutex( *object, params.iNameOfOwner );
-            params.iWaitCount = cva.GetWaitCount( *object );
-            }
-        else
-            {
-	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - KErrNotSupported" ));
-            r = KErrNotSupported;
-            }
-		handleAsObject->Close(NULL);
-        }
-    else
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - couldn not find object => KErrNotFound"));
-        r = KErrNotFound;
-        }
-
-	NKern::ThreadLeaveCS();
-
-    if  ( r == KErrNone )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - writing back to client thread..."));
-        r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverHandleInfoGeneric) );
-        }
-    if  ( TempObject() != NULL )
-        {
-    	CloseTempObject();
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - END - r: %d", r));
-	return r;
-    }
-
-
-TInt DMemSpyDriverLogChanContainers::GetKernelObjectSizeApproximation( TMemSpyDriverContainerType aType, TInt* aSize )
-    {
-    TInt r = KErrNone;
-    //
-	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetKernelObjectSizeApproximation() - START - aType: %d", aType));
-    const TObjectType objectType = ObjectTypeFromMemSpyContainerType( aType );
-    //
-    TInt size = 0;
-    //
-    switch( objectType )
-        {
-    case EThread:
-        size = sizeof(DThread);
-        break;
-    case EProcess:
-        size = sizeof(DProcess);
-        break;
-    case EChunk:
-        size = sizeof(DChunk);
-        break;
-    case ELibrary:
-        size = sizeof(DLibrary);
-        break;
-    case ESemaphore:
-        size = sizeof(DSemaphore);
-        break;
-    case EMutex:
-        size = sizeof(DMutex);
-        break;
-    case ETimer:
-        size = sizeof(DTimer);
-        break;
-    case EServer:
-        size = sizeof(DServer);
-        break;
-    case ESession:
-        size = sizeof(DSession);
-        break;
-    case ELogicalDevice:
-        size = sizeof(DLogicalDevice);
-        break;
-    case EPhysicalDevice:
-        size = sizeof(DPhysicalDevice);
-        break;
-    case ELogicalChannel:
-        size = sizeof(DLogicalChannel);
-        break;
-    case EChangeNotifier:
-        size = sizeof(DChangeNotifier);
-        break;
-    case EUndertaker:
-        size = sizeof(DUndertaker);
-        break;
-    case EMsgQueue:
-        size = sizeof(DObject); // best we can do!
-        break;
-    case EPropertyRef:
-        size = sizeof(DObject); // best we can do!
-        break;
-    case ECondVar:
-        size = sizeof(DCondVar);
-        break;
-    default:
-        break;
-        }
-    //
-    NKern::ThreadEnterCS();
-    r = Kern::ThreadRawWrite( &ClientThread(), aSize, &size, sizeof(TInt) );
-	NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetKernelObjectSizeApproximation() - END - r: %d, size; %d", r, size));
-	return r;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanContainers::GetReferencesToMyThread( TUint aTid, TDes8* aBufferSink )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetReferencesToMyThread() - START - aTid: %d", aTid ));
-
-    // We open the source thread or process, just to ensure it doesn't die underneath us...
-    TInt r = OpenTempObject( aTid, EThread );
-    if  ( r == KErrNone )
-		{
-		TInt count = 0;
-		
-        // Open stream
-        RMemSpyMemStreamWriter stream = OpenXferStream();
-
-        // Get references to this thread by searching the handles of other threads
-        TInt32* pCountMarkerThread = stream.WriteInt32( 0 );
-        count = SearchThreadsFor( TempObject(), stream );
-        *pCountMarkerThread = count;
-
-        // Get references to this thread by searching the handles of other processes
-        TInt32* pCountMarkerProcess = stream.WriteInt32( 0 );
-        count = SearchProcessFor( TempObject(), stream );
-        *pCountMarkerProcess = count;
-
-        // Tidy up
-        r = stream.WriteAndClose( aBufferSink );
-
-        CloseTempObject();
-        }
-                
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetReferencesToMyThread() - END - r: %d", r));
-	return r;
-    }
-
-
-TInt DMemSpyDriverLogChanContainers::GetReferencesToMyProcess( TUint aPid, TDes8* aBufferSink )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetReferencesToMyProcess() - START - aPid: %d", aPid ));
-
-    // We open the source thread or process, just to ensure it doesn't die underneath us...
-    TInt r = OpenTempObject( aPid, EProcess );
-    if  ( r == KErrNone )
-		{
-		TInt count = 0;
-		
-        // Open stream
-        RMemSpyMemStreamWriter stream = OpenXferStream();
-
-        // Get references to this thread by searching the handles of other threads
-        TInt32* pCountMarkerThread = stream.WriteInt32( 0 );
-        count = SearchThreadsFor( TempObject(), stream );
-        *pCountMarkerThread = count;
-
-        // Get references to this thread by searching the handles of other processes
-        TInt32* pCountMarkerProcess = stream.WriteInt32( 0 );
-        count = SearchProcessFor( TempObject(), stream );
-        *pCountMarkerProcess = count;
-
-        // Tidy up
-        r = stream.WriteAndClose( aBufferSink );
-
-        CloseTempObject();
-        }
-                
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetReferencesToMyProcess() - END - r: %d", r));
-	return r;
-    }
-
-
-TInt DMemSpyDriverLogChanContainers::GetPAndSInfo( DObject* aHandle, TMemSpyDriverPAndSInfo* aInfo )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - START - aHandle: 0x%08x", aHandle ));
-
-    TInt r = KErrNotFound;
-	NKern::ThreadEnterCS();
-
-    // First, locate the specific DObject in question. Cast the handle, but don't use the object...
-    DObject* object = CheckedOpen(EMemSpyDriverContainerTypePropertyRef, aHandle);
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - handle search returned: 0x%08x", object ));
-
-    if  ( object != NULL )
-        {
-        NKern::LockSystem(); // Keep this, the DPropertyRef APIs use it -TomS
-
-        DMemSpyDriverOSAdaptionDPropertyRef& pra = OSAdaption().DPropertyRef();
-        const TBool isReady = pra.GetIsReady( *object );
-        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - isReady: %d", isReady ));
-
-        if  ( isReady )
-            {
-            TMemSpyDriverPAndSInfo params;
-            //
-            params.iType = pra.GetType( *object );
-            params.iCategory = pra.GetCategory( *object );
-            params.iKey = pra.GetKey( *object );
-            params.iRefCount = pra.GetRefCount( *object );
-            params.iTid = pra.GetThreadId( *object );
-            params.iCreatorSID = pra.GetCreatorSID( *object );
-            //
-            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo - writing back to client thread..."));
-            r = Kern::ThreadRawWrite( &ClientThread(), aInfo, &params, sizeof( TMemSpyDriverPAndSInfo ) );
-            }
-        else
-            {
-            r = KErrNotReady;
-            }
-
-        NKern::UnlockSystem();
-		object->Close(NULL);
-        }
-
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - END - r: %d", r));
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogChanContainers::GetCondVarSuspendedThreads( TMemSpyDriverInternalCondVarSuspendedThreadParams* aParams )
-    {
-    
-    TMemSpyDriverInternalCondVarSuspendedThreadParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalCondVarSuspendedThreadParams) );
-    if  ( r != KErrNone )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - params read error: %d", r));
-        return r;
-        }
-    
-    DMemSpyDriverOSAdaptionDCondVar& condVarAdaption = OSAdaption().DCondVar();
-    
-    const TInt maxCount = params.iMaxCount;
-    NKern::ThreadEnterCS();
-    
-    DObject* condVarHandle = (DObject*) params.iCondVarHandle;
-    condVarHandle = CheckedOpen(EMemSpyDriverContainerTypeCondVar, condVarHandle);
-    if  ( condVarHandle == NULL )
-        {
-        Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - condVar not found");
-        NKern::ThreadLeaveCS();
-        return KErrNotFound;
-        }
-    
-    ResetTempHandles();
-        
-    DCondVar* condVar = (DCondVar*) condVarHandle;
-    
-    NKern::LockSystem(); // Keep this, needed for iterating suspended queue -TomS
-
-    // Iterate through suspended threads, writing back thread pointer (handle)
-    // to client
-    SDblQue& suspQueue = condVarAdaption.GetSuspendedQ( *condVar );
-    SDblQueLink* anchor = &suspQueue.iA;
-    SDblQueLink* link = suspQueue.First();
-    while( link != anchor )
-        {
-        DThread* thread = condVarAdaption.GetThread( link );
-
-        // Found a match in the specified container. Write the object's handle (aka the object address)
-        // back to the client address space
-        if  ( thread )
-            {
-            AddTempHandle( thread );
-            }
-
-        // Get next item
-        link = link->iNext;
-        }
-
-    NKern::UnlockSystem();
-
-    // This variable holds the number of handles that we have already
-    // written to the client-side.
-    TInt currentWriteIndex = 0;
-    const TInt handleCount = TempHandleCount();
-    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs - writing %d handles to client...", handleCount ) );
-    for( ; currentWriteIndex<handleCount && r == KErrNone && currentWriteIndex < maxCount; )
-        {
-        TAny* handle = TempHandleAt( currentWriteIndex );
-        r = Kern::ThreadRawWrite( &ClientThread(), params.iThrHandles + currentWriteIndex, &handle, sizeof(TAny*) );
-        if  (r == KErrNone)
-            {
-            ++currentWriteIndex;
-            }
-        }
-
-    if  ( r == KErrBadDescriptor )
-        {
-        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
-        }
-    else
-        {
-        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), params.iThrCountPtr, &currentWriteIndex, sizeof(TInt) );
-        if  ( r == KErrNone )
-            {
-            r = finalWrite;
-            }
-        }
-
-	condVarHandle->Close(NULL);
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - r: %d", r));
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogChanContainers::GetCondVarSuspendedThreadInfo( TAny* aThreadHandle, TMemSpyDriverCondVarSuspendedThreadInfo* aParams )
-    {
-    TMemSpyDriverCondVarSuspendedThreadInfo params;
-    
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverCondVarSuspendedThreadInfo) );
-    if  ( r != KErrNone )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - params read error: %d", r));
-        return r;
-        }
-    
-    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-
-    NKern::ThreadEnterCS();
-
-    DObject* threadHandle = (DObject*) aThreadHandle;
-    threadHandle = CheckedOpen(EMemSpyDriverContainerTypeThread, threadHandle);
-    if  ( threadHandle == NULL )
-        {
-        Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - thread not found");
-        NKern::ThreadLeaveCS();
-        return KErrNotFound;
-        }
-
-    DThread* thread = (DThread*) threadHandle;
-    thread->FullName( params.iName );
-    params.iAddress = (TUint8*)thread;
-
-    if  ( r == KErrNone )
-        {
-        r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverCondVarSuspendedThreadInfo) );
-        }
-    
-	threadHandle->Close(NULL);
-    NKern::ThreadLeaveCS();
-    
-    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - r: %d", r));
-    return r;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanContainers::SearchThreadsFor( DObject* aHandleToLookFor, RMemSpyMemStreamWriter& aStream )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor() - START" ) );
-
-    TInt matches = 0;
-    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-   
-    DObjectCon* container = Kern::Containers()[ EThread ];
-    NKern::ThreadEnterCS();
-    container->Wait();
-
-    const TInt containerEntryCount = container->Count();
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - containerEntryCount: %d", containerEntryCount ));
-
-    for( TInt i=0; i<containerEntryCount && !aStream.IsFull(); i++ )
-        {
-        DThread* thread = (DThread*) (*container)[ i ];
-        MemSpyObjectIx* handles = threadAdaption.GetHandles( *thread );
-        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - handles: 0x%08x", handles ));
-
-        if  ( handles != NULL )
-            {
-            TBool found = handles->Find( aHandleToLookFor );
-	        if (found)
-		        {
-                TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - found handle match in [%O]", thread ));
-                aStream.WriteUint32( (TUint32) thread );
-                ++matches;
-		        }
-            }
-        }
-
-    // Finished with thread/process container.
-    container->Signal();
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor() - END" ) );
-    return matches;
-    }
-
-
-TInt DMemSpyDriverLogChanContainers::SearchProcessFor( DObject* aHandleToLookFor, RMemSpyMemStreamWriter& aStream )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor() - START" ) );
-
-    TInt matches = 0;
-    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
-  
-    DObjectCon* container = Kern::Containers()[ EProcess ];
-    NKern::ThreadEnterCS();
-    container->Wait();
-
-    const TInt containerEntryCount = container->Count();
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - containerEntryCount: %d", containerEntryCount ));
-
-    for( TInt i=0; i<containerEntryCount && !aStream.IsFull(); i++ )
-        {
-        DProcess* process = (DProcess*) (*container)[ i ];
-        MemSpyObjectIx* handles = processAdaption.GetHandles( *process );
-        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - handles: 0x%08x", handles ));
-
-        if  ( handles != NULL )
-            {
-            TBool found = handles->Find( aHandleToLookFor );
-	        if  ( found )
-		        {
-                TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - found handle match in [%O]", process ));
-                aStream.WriteUint32( (TUint32) process );
-                ++matches;
-		        }
-            }
-        }
-
-    // Finished with thread/process container.
-    container->Signal();
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor() - END" ) );
-    return matches;
-    }    
-
-
-TMemSpyDriverTimerState DMemSpyDriverLogChanContainers::MapToMemSpyTimerState( TTimer::TTimerState aState )
-    {
-    TMemSpyDriverTimerState ret = EMemSpyDriverTimerStateUnknown;
-    //
-    switch( aState )
-        {
-    case TTimer::EIdle:
-        ret = EMemSpyDriverTimerStateIdle;
-        break;
-    case TTimer::EWaiting:
-        ret = EMemSpyDriverTimerStateWaiting;
-        break;
-    case TTimer::EWaitHighRes:
-        ret = EMemSpyDriverTimerStateWaitHighRes;
-        break;
-    default:
-        break;
-        }
-    //
-    return ret;
-    }
-
- 
-TMemSpyDriverTimerType DMemSpyDriverLogChanContainers::MapToMemSpyTimerType( TTimer::TTimerType aType )
-    {
-    TMemSpyDriverTimerType ret = EMemSpyDriverTimerTypeUnknown;
-    //
-    switch( aType )
-        {
-    case TTimer::ERelative:
-    case TTimer::ELocked:
-        ret = EMemSpyDriverTimerTypeRelative;
-        break;
-    case TTimer::EAbsolute:
-        ret = EMemSpyDriverTimerTypeAbsolute;
-        break;
-    case TTimer::EHighRes:
-        ret = EMemSpyDriverTimerTypeHighRes;
-        break;
-    case TTimer::EInactivity:
-        ret = EMemSpyDriverTimerTypeInactivity;
-        break;
-    default:
-        break;
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapBase.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,609 +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 "MemSpyDriverLogChanHeapBase.h"
-
-// System includes
-#include <u32hal.h>
-#include <e32rom.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"
-
-// Constants
-const TInt KMemSpyDriverLogChanHeapBaseXferBufferSize = 1024 * 16;
-
-
-
-
-DMemSpyDriverLogChanHeapBase::DMemSpyDriverLogChanHeapBase( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:	DMemSpyDriverLogChanBase( aDevice, aThread )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::DMemSpyDriverLogChanHeapBase() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanHeapBase::~DMemSpyDriverLogChanHeapBase()
-	{
-	}
-
-
-TInt DMemSpyDriverLogChanHeapBase::Construct()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::Construct() - START - this: 0x%08x", this ));
-    
-    const TInt ret = BaseConstruct( KMemSpyDriverLogChanHeapBaseXferBufferSize );
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::Construct() - END - this: 0x%08x, err: %d", this, ret ));
-    return ret;
-	}
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanHeapBase::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	const TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
-    return r;
-	}
-
-
-
-
-
-
-
-
-
-
-
-
-
-DMemSpyDriverLogChanHeapBase::TDrmMatchType DMemSpyDriverLogChanHeapBase::IsDrmThread( DThread& aThread )
-    {
-    TDrmMatchType ret = EMatchTypeNone;
-    //
-    const TUid procUid = aThread.iOwningProcess->iUids.iUid[ 2 ];
-    TRACE( Kern::Printf( "DMemSpyDriverLogChanHeapBase::IsDrmThread() - START - aThread: %O, process uid: 0x%08x", &aThread, procUid.iUid ));
-
-    // Some more rudimentary checks based upon process name and
-    // known uids.
-    TFullName fullName;
-    aThread.FullName( fullName );
-
-    // Exclude threads containing "DRM"
-    _LIT( KDrmThreadMatchText, "*DRM*" );
-    const TInt matchPos = fullName.MatchF( KDrmThreadMatchText );
-    if ( matchPos >= 0 )
-        {
-        TRACE( Kern::Printf( "DMemSpyDriverLogChanHeapBase::IsDrmThread() - found \'DRM\' at pos: %d (%S)", matchPos, &fullName ));
-        ret = EMatchTypeName;
-        }
-    else
-        {
-        // Some known DRM related process UIDs
-        switch( procUid.iUid )
-            {
-        case 0x10005A22: // DRMEncryptor.exe
-        case 0x01105901: // DRMEncryptor.exe
-        case 0x101F85C7: // DRMRightsManager.exe
-        case 0x10205CA8: // DcfRepSrv.exe
-        case 0x101F51F2: // RightsServer.exe
-        case 0x101F6DC5: // DRMHelperServer.exe
-        case 0x10282F1B: // wmdrmserver.exe
-            ret = EMatchTypeUid;
-            break;
-        default:
-            ret = EMatchTypeNone;
-            break;
-            }
-        }
-
-    TRACE( Kern::Printf( "DMemSpyDriverLogChanHeapBase::IsDrmThread() - END - procUid: 0x%08x, matchType: %d", procUid.iUid, ret ));
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-void DMemSpyDriverLogChanHeapBase::PrintHeapInfo( const TMemSpyHeapInfo& aInfo )
-    {
-    const TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
-    //const TMemSpyHeapObjectDataRHeap& rHeapObjectData = rHeapInfo.ObjectData();
-    const TMemSpyHeapStatisticsRHeap& rHeapStats = rHeapInfo.Statistics();
-    const TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
-
-    /*
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RAllocator                                      -" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RAllocator::iAccessCount:       %d", rHeapObjectData.iAccessCount ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RAllocator::iHandleCount:       %d", rHeapObjectData.iHandleCount ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RAllocator::iHandles:           0x%08x", rHeapObjectData.iHandles ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RAllocator::iFlags:             0x%08x", rHeapObjectData.iFlags ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RAllocator::iCellCount:         %d", rHeapObjectData.iCellCount ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RAllocator::iTotalAllocSize:    %d", rHeapObjectData.iTotalAllocSize ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - " ) );
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap                                           -" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iMinLength:              %d", rHeapObjectData.iMinLength ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iMaxLength:              %d", rHeapObjectData.iMaxLength ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iOffset:                 %d", rHeapObjectData.iOffset ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iGrowBy:                 %d", rHeapObjectData.iGrowBy ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iChunkHandle:            0x%08x", rHeapObjectData.iChunkHandle ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iBase:                   0x%08x", rHeapObjectData.iBase ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iTop:                    0x%08x", rHeapObjectData.iTop ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iAlign:                  %d", rHeapObjectData.iAlign ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iMinCell:                %d", rHeapObjectData.iAlign ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iPageSize:               %d", rHeapObjectData.iAlign ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iFree.next:              0x%08x", rHeapObjectData.iFree.next ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iFree.len:               %d", rHeapObjectData.iFree.len ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iNestingLevel:           %d", rHeapObjectData.iNestingLevel ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iAllocCount:             %d", rHeapObjectData.iAllocCount ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iFailType:               %d", rHeapObjectData.iFailType ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iFailRate:               %d", rHeapObjectData.iFailRate ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iFailed:                 %d", rHeapObjectData.iFailed ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iFailAllocCount:         %d", rHeapObjectData.iFailAllocCount ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iRand:                   %d", rHeapObjectData.iRand ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - RHeap::iTestData:               0x%08x", rHeapObjectData.iTestData ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - " ) );
-	*/
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - Stats (Free)                                    -" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell count:                     %d", rHeapStats.StatsFree().TypeCount() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell size:                      %d", rHeapStats.StatsFree().TypeSize() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell largest:                   0x%08x", rHeapStats.StatsFree().LargestCellAddress() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell largest size:              %d", rHeapStats.StatsFree().LargestCellSize() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - slack:                          0x%08x", rHeapStats.StatsFree().SlackSpaceCellAddress() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - slack size:                     %d", rHeapStats.StatsFree().SlackSpaceCellSize() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - checksum:                       0x%08x", rHeapStats.StatsFree().Checksum() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - " ) );
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - Stats (Alloc)                                   -" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell count:                     %d", rHeapStats.StatsAllocated().TypeCount() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell size:                      %d", rHeapStats.StatsAllocated().TypeSize() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell largest:                   0x%08x", rHeapStats.StatsAllocated().LargestCellAddress() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell largest size:              %d", rHeapStats.StatsAllocated().LargestCellSize() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - " ) );
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - Misc. Info                                      -" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - chunk size:                     %d", rHeapMetaData.ChunkSize() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - chunk handle:                   0x%08x", rHeapMetaData.ChunkHandle() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - chunk base address:             0x%08x", rHeapMetaData.ChunkBaseAddress() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - debug allocator:                %d", rHeapMetaData.IsDebugAllocator() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - shared heap:                    %d", rHeapMetaData.IsSharedHeap() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - user thread:                    %d", rHeapMetaData.IsUserThread() ) );
-    //TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell header size (free):        %d", rHeapMetaData.HeaderSizeFree() ) );
-    //TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell header size (alloc):       %d", rHeapMetaData.HeaderSizeAllocated() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - heap vTable:                    0x%08x", rHeapMetaData.VTable() ) );
-    //TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - heap object size:               %d", rHeapMetaData.ClassSize() ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - heap size:                      %d", rHeapMetaData.iHeapSize ) );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - allocator address:              0x%08x", rHeapMetaData.iAllocatorAddress ) );
-    }
-
-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 - locking system..." ));
-    NKern::LockSystem();
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel - disabling interrupts..." ));
-    const TInt irq = NKern::DisableAllInterrupts();
-    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 - restoring interrupts..." ));
-    NKern::RestoreInterrupts( irq );
-    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() ) ));
-    NKern::UnlockSystem();
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel - unlocked system" ));
-
-    // 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;
-    }
-
-
-
-
-
-
-
-
-
-
-    
-
-
-
-
-
-
-TBool DMemSpyDriverLogChanHeapBase::HandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt /*aNestingLevel*/, TInt /*aAllocNumber*/)
-    {
-    TInt error = KErrNone;
-    //
-    if  (aCellType & EMemSpyDriverFreeCellMask)
-        {
-        if  ( iStackStream )
-            {
-            if  ( !iStackStream->IsFull() )
-                {
-                ++iFreeCellCount;
-                TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::HandleHeapCell - writing free cell %d @ 0x%08x, space left: %u", iFreeCellCount, aCellAddress, iStackStream->Remaining() ));
-                //
-                iStackStream->WriteInt32( aCellType );
-                iStackStream->WriteUint32( reinterpret_cast<TUint32>( aCellAddress ) );
-                iStackStream->WriteInt32( aLength );
-                }
-            else
-                {
-                Kern::Printf( "DMemSpyDriverLogChanHeapBase::HandleHeapCell - Kernel Free Cell stack stream IS FULL!" );
-                error = KErrAbort;
-                }
-            }
-       }
-    //
-    return ( error == KErrNone );
-    }
-
-
-void DMemSpyDriverLogChanHeapBase::HandleHeapWalkInit()
-	{
-	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/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapData.cpp	Fri Aug 27 11:37:29 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::GetHeapInfoKernel() - 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::GetHeapInfoKernel() - 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;
-    }
-
-
-
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapInfo.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,413 +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
-        {
-    	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/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapWalk.cpp	Fri Aug 27 11:37:29 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 );
-    }
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanMisc.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +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 "MemSpyDriverLogChanMisc.h"
-
-// System includes
-#include <memspy/driver/memspydriverconstants.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"
-
-
-
-DMemSpyDriverLogChanMisc::DMemSpyDriverLogChanMisc( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanBase( aDevice, aThread )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::DMemSpyDriverLogChanMisc() - START - this: 0x%08x", this ));
-
-    DProcess* process = OSAdaption().DThread().GetOwningProcess( aThread );
-    if  ( process )
-        {
-        DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
-        //
-        iSID = processAdaption.GetSID( *process );
-        iSecurityZone = processAdaption.GetSecurityZone( *process );
-        //
-        iClientIsMemSpy = ( iSID == KMemSpyUiSID || iSID == KMemSpyConsoleUiSID );
-        }
-    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::DMemSpyDriverLogChanMisc() - END - sid: 0x%08x, sz: 0x%08x, isMemSpy: %d", iSID, iSecurityZone, iClientIsMemSpy ));
-    }
-
-
-DMemSpyDriverLogChanMisc::~DMemSpyDriverLogChanMisc()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::~DMemSpyDriverLogChanMisc() - START - this: 0x%08x", this ));
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::~DMemSpyDriverLogChanMisc() - END - this: 0x%08x", this ));
-	}
-
-
-
-TInt DMemSpyDriverLogChanMisc::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-        case EMemSpyDriverOpCodeMiscSetRHeapVTable:
-            r = SetRHeapVTable( a1 );
-            break;
-        case EMemSpyDriverOpCodeMiscGetMemoryModelType:
-            r = GetMemoryModelType();
-            break;
-        case EMemSpyDriverOpCodeMiscGetRoundToPageSize:
-            r = GetRoundToPageSize( (TUint32*) a1 );
-            break;
-        case EMemSpyDriverOpCodeMiscImpersonate:
-            r = Impersonate( (TUint32) a1 );
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanMisc::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeMiscBase && aFunction < EMemSpyDriverOpCodeMiscEnd );
-    }
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanMisc::SetRHeapVTable( TAny* aRHeapVTable )
-    {
-    const TUint32 vTable = (TUint32) aRHeapVTable;
-    MemSpyDevice().SetRHeapVTable( vTable );
-    return KErrNone;
-    }
-
-
-
-
-
-TInt DMemSpyDriverLogChanMisc::GetMemoryModelType()
-    {
-    TInt ret = EMemSpyMemoryModelTypeUnknown;
-    //
-  	const TUint32 memModelAttrib = (TUint32) Kern::HalFunction( EHalGroupKernel, EKernelHalMemModelInfo, NULL, NULL );	
-    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetMemoryModelType() - memModelAttrib: 0x%08x", memModelAttrib));
-    //
-    if  ( (memModelAttrib & EMemModelTypeMask ) == EMemModelTypeMultiple )
-        {
-        ret = EMemSpyMemoryModelTypeMultiple;
-        }
-    else if ( (memModelAttrib & EMemModelTypeMask ) == EMemModelTypeMoving )
-        {
-        ret = EMemSpyMemoryModelTypeMoving;
-        }
-    else if ( (memModelAttrib & EMemModelTypeMask ) == EMemModelTypeEmul )
-        {
-        ret = EMemSpyMemoryModelTypeEmulator;
-        }
-    //
-    return ret;
-    }
-
-
-TInt DMemSpyDriverLogChanMisc::GetRoundToPageSize( TUint32* aValue )
-    {
-    // We should probably do this user side... I think the HAL contains the page size.
-    TUint32 value = 0;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aValue, &value, sizeof(TUint32) );
-    //
-    if  ( r == KErrNone )
-        {
-        value = Kern::RoundToPageSize( value );
-        r = Kern::ThreadRawWrite( &ClientThread(), aValue, &value, sizeof(TUint32) );
-        }
-    //
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogChanMisc::Impersonate( TUint32 aValue )
-    {
-    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
-    //
-    TInt r = KErrNotFound;
-    //
-    TUint32 sid = iSID;
-    TUint32 sz = iSecurityZone;
-    //
-    if  ( aValue != 0 )
-        {
-        // Must impersonate a SID:
-	    NKern::ThreadEnterCS();
-
-        DObjectCon* container = Kern::Containers()[ EProcess ];
-        container->Wait();
-
-        const TInt count = container->Count();
-        for(TInt i=0; i<count; i++)
-            {
-            DObject* object = (*container)[ i ];
-            if  ( object != NULL )
-                {
-                DProcess* proc = (DProcess*) object;
-
-                const TUint32 processSID = processAdaption.GetSID( *proc );
-                if  ( processSID == aValue )
-                    {
-                    sid = processSID;
-                    sz = processAdaption.GetSecurityZone( *proc );
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::Impersonate() - MemSpy impersonates - pid: %d, sid: 0x%08x, sz: %d", proc->iId, sid, sz ));
-                    break;
-                    }
-
-                }
-            }
-
-        container->Signal();
-    	NKern::ThreadLeaveCS();
-        }
-
-    DThread& thread = ClientThread();
-    DProcess* myOwningProcess = threadAdaption.GetOwningProcess( thread );
-    //
-    if  ( myOwningProcess )
-        {
-        if  ( iClientIsMemSpy )
-            {
-            processAdaption.SetSID( *myOwningProcess, sid );
-            processAdaption.SetSecurityZone( *myOwningProcess, sz);
-            //
-            r = KErrNone;
-            }
-        else
-            {
-            r = KErrAccessDenied;
-            }
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::Impersonate() - MemSpy is now: 0x%08x", sid ));
-    return r;
-    }
-
-
-
-
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanProcessInspection.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,256 +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 "MemSpyDriverLogChanProcessInspection.h"
-
-// System includes
-#include <u32hal.h>
-#include <e32rom.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include "MemSpyDriverInspectedProcess.h"
-#include "MemSpyDriverInspectedProcessManager.h"
-
-
-DMemSpyDriverLogChanProcessInspection::DMemSpyDriverLogChanProcessInspection( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanBase( aDevice, aThread )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::DMemSpyDriverLogChanProcessInspection() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanProcessInspection::~DMemSpyDriverLogChanProcessInspection()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::~DMemSpyDriverLogChanProcessInspection() - START - this: 0x%08x", this ));
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::~DMemSpyDriverLogChanProcessInspection() - END - this: 0x%08x", this ));
-	}
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanProcessInspection::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-        case EMemSpyDriverOpCodeProcessInspectOpen:
-            r = ProcessInspectionOpen( (TUint) a1 );
-            break;
-        case EMemSpyDriverOpCodeProcessInspectClose:
-            r = ProcessInspectionClose( (TUint) a1 );
-            break;
-        case EMemSpyDriverOpCodeProcessInspectRequestChanges:
-            r = ProcessInspectionRequestChanges( (TRequestStatus*) a1, (TMemSpyDriverProcessInspectionInfo*) a2 );
-            break;
-        case EMemSpyDriverOpCodeProcessInspectRequestChangesCancel:
-            r = ProcessInspectionRequestChangesCancel( (TUint) a1 );
-            break;
-        case EMemSpyDriverOpCodeProcessInspectAutoStartListReset:
-            r = ProcessInspectionAutoStartItemsClear();
-            break;
-        case EMemSpyDriverOpCodeProcessInspectAutoStartListAdd:
-            r = ProcessInspectionAutoStartItemsAdd( (TUint) a1 );
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanProcessInspection::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeProcessInspectBase && aFunction < EMemSpyDriverOpCodeProcessInspectEnd );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionOpen( TUint aPid )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionOpen() - START"));
-    NKern::ThreadEnterCS();
-    
-    TInt error = OpenTempObject( aPid, EProcess );
-    if  ( error == KErrNone )
-    	{
-        DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
-        error = pidManager.ProcessOpen( (DProcess*) TempObject() );
-	    CloseTempObject();
-    	}
-    //
-    NKern::ThreadLeaveCS();
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionOpen() - END - error: %d", error ));
-    return error;
-    }
-
-
-TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionClose( TUint aPid )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionClose() - START"));
-    NKern::ThreadEnterCS();
-
-    TInt error = OpenTempObject( aPid, EProcess );
-    if  ( error == KErrNone )
-    	{
-        DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
-        error = pidManager.ProcessClose( (DProcess*) TempObject() );
-	    CloseTempObject();
-    	}
-    
-    NKern::ThreadLeaveCS();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionClose() - END - error: %d", error ));
-    return error;
-    }
-
-
-TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChanges( TRequestStatus* aStatus, TMemSpyDriverProcessInspectionInfo* aInfo )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChanges() - START"));
-    NKern::ThreadEnterCS();
-
-    // Read client info
-    TMemSpyDriverProcessInspectionInfo info;
-	TInt error = Kern::ThreadRawRead( &ClientThread(), aInfo, &info, sizeof(TMemSpyDriverProcessInspectionInfo) );
-    //
-    if  ( error == KErrNone )
-        {
-        DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
-        DMemSpyInspectedProcess* pid = pidManager.InspectedProcessByProcessId( info.iProcessId );
-        //
-        if ( pid != NULL )
-            {
-            error = pid->NotifyOnChange( &ClientThread(), aStatus, aInfo );
-            }
-        else
-            {
-            error = KErrNotFound;
-            }
-        }
-
-    // NB: Let client take care of completing request in error situations
-    NKern::ThreadLeaveCS();
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChanges() - END - error: %d", error ));
-    return error;
-    }
-
-
-TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChangesCancel( TUint aPid )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChangesCancel() - START"));
-    NKern::ThreadEnterCS();
-
-    TInt error = KErrNotFound;
-
-    DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
-    DMemSpyInspectedProcess* pid = pidManager.InspectedProcessByProcessId( aPid );
-    //
-    if ( pid != NULL )
-        {
-        error = pid->NotifyOnChangeCancel();
-        }
-
-    NKern::ThreadLeaveCS();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChangesCancel() - END - error: %d", error ));
-    return error;
-    }
-
-
-TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsClear()
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsClear() - START"));
-
-    NKern::ThreadEnterCS();
-
-    DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
-    pidManager.AutoStartListReset();
-
-    NKern::ThreadLeaveCS();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsClear() - END" ));
-    return KErrNone;
-    }
-
-
-TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsAdd( TUint aSID )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsAdd() - START - aSID: 0x%08x", aSID ));
-
-    NKern::ThreadEnterCS();
-    DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
-    const TInt error = pidManager.AutoStartListAdd( aSID );
-    NKern::ThreadLeaveCS();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsAdd() - END - error: %d", error ));
-    return error;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanRawMemory.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +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 "MemSpyDriverLogChanRawMemory.h"
-
-// System includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-
-
-
-DMemSpyDriverLogChanRawMemory::DMemSpyDriverLogChanRawMemory( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanBase( aDevice, aThread )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanRawMemory::DMemSpyDriverLogChanRawMemory() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanRawMemory::~DMemSpyDriverLogChanRawMemory()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanRawMemory::~DMemSpyDriverLogChanRawMemory() - START - this: 0x%08x", this ));
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanRawMemory::~DMemSpyDriverLogChanRawMemory() - END - this: 0x%08x", this ));
-	}
-
-
-
-TInt DMemSpyDriverLogChanRawMemory::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-	    case EMemSpyDriverOpCodeRawMemoryRead:
-		    r = ReadMem( (TMemSpyDriverInternalReadMemParams*) a1);
-		    break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanRawMemory::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeRawMemoryBase && aFunction < EMemSpyDriverOpCodeRawMemoryEnd );
-    }
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanRawMemory::ReadMem( TMemSpyDriverInternalReadMemParams* aParams )
-	{
-    TRACE( Kern::Printf("DMemSpyDriverLogChanRawMemory::ReadMem() - START"));
-	TMemSpyDriverInternalReadMemParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof( TMemSpyDriverInternalReadMemParams ) );
-    //
-    if  ( r == KErrNone )
-        {
-        NKern::ThreadEnterCS();
-
-        // 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("DMemSpyDriverLogChanRawMemory::ReadMem - user side descriptor: 0x%08x (0x%08x), len: %8d, maxLen: %8d, r: %d", params.iDes, destPtr, destLen, destMax, r ));
-        //
-        r = OpenTempObject( params.iTid, EThread );
-        //
-	    if  ( r == KErrNone )
-		    {
-		    r = Kern::ThreadRawRead( (DThread*) TempObject(), (TAny*) params.iAddr, destPtr, destMax );
-            //
-		    if  ( r == KErrNone )
-                {
-                r = destMax;
-                }
-            else
-                {
-        	    Kern::Printf( "DMemSpyDriverLogChanRawMemory::ReadMem - could not xfer memory" );
-                }
-            //
-		    CloseTempObject();
-		    }
-        else
-            {
-        	Kern::Printf( "DMemSpyDriverLogChanRawMemory::ReadMem - could not open thread: %d", params.iTid );
-            }
-        //
-	    NKern::ThreadLeaveCS();
-        }
-    else
-        {
-    	Kern::Printf( "DMemSpyDriverLogChanRawMemory::ReadMem - params read error" );
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanRawMemory::ReadMem() - END - r: %d", r));
-	return r;
-	}
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanStack.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,519 +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 "MemSpyDriverLogChanStack.h"
-
-// System includes
-#include <u32hal.h>
-#include <e32rom.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverOSAdaption.h"
-#include "MemSpyDriverSuspensionManager.h"
-
-// Constants
-const TUint32 KMemSpyStackFillPatternUser = 0x29292929;
-const TUint32 KMemSpyStackFillPatternSupervisor = 0xeeeeeeee;
-
-
-DMemSpyDriverLogChanStack::DMemSpyDriverLogChanStack( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanBase( aDevice, aThread )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::DMemSpyDriverLogChanStack() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanStack::~DMemSpyDriverLogChanStack()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::~DMemSpyDriverLogChanStack() - START - this: 0x%08x", this ));
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::~DMemSpyDriverLogChanStack() - END - this: 0x%08x", this ));
-	}
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanStack::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-	    case EMemSpyDriverOpCodeStackGetInfo:
-            r = GetStackInfo( (TUint) a1, (TMemSpyDriverStackInfo*) a2 );
-            break;
-	    case EMemSpyDriverOpCodeStackGetData:
-            r = GetStackData( (TMemSpyDriverInternalStackDataParams*) a1 );
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanStack::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeStackBase && aFunction < EMemSpyDriverOpCodeStackEnd );
-    }
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanStack::GetStackInfo( TUint aTid, TMemSpyDriverStackInfo* aParams )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackInfo() - START - thread id: %d", aTid));
-
-    TMemSpyDriverStackInfo params;
-	TInt r = OpenTempObject( aTid, EThread );
-	if  ( r == KErrNone )
-		{
-        DThread* thread = (DThread*) TempObject();
-
-        // Check the threads in the process are suspended
-        if  ( SuspensionManager().IsSuspended( *thread ) )
-            {
-            DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-            //
-            GetStackPointers( thread, params.iSupervisorStackPointer, params.iUserStackPointer );
-            //
-            params.iUserStackBase = threadAdaption.GetUserStackBase( *thread );
-            params.iUserStackSize = threadAdaption.GetUserStackSize( *thread );
-            params.iSupervisorStackBase = threadAdaption.GetSupervisorStackBase( *thread );
-            params.iSupervisorStackSize = threadAdaption.GetSupervisorStackSize( *thread );
-
-            // Try to get watermarks
-            GetStackHighWatermark( *thread, params.iUserStackHighWatermark, EMemSpyDriverDomainUser, KMemSpyStackFillPatternUser );
-            GetStackHighWatermark( *thread, params.iSupervisorStackHighWatermark, EMemSpyDriverDomainKernel, KMemSpyStackFillPatternSupervisor ) ;
-        
-    #ifdef __WINS__
-            params.iUserStackPointer = params.iUserStackBase;
-            params.iUserStackHighWatermark = params.iUserStackBase;
-            params.iSupervisorStackPointer = params.iSupervisorStackBase;
-            params.iSupervisorStackHighWatermark = params.iSupervisorStackBase;
-    #endif
-
-            // Write data to user-side
-            r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverStackInfo) );
-            }
-        else
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackInfo - parent process not suspended => KErrAccessDenied"));
-            r = KErrAccessDenied;
-            }
-
-        CloseTempObject();
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackInfo() - END - ret: %d", r));
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogChanStack::GetStackData( TMemSpyDriverInternalStackDataParams* aParams )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData() - START"));
-	TMemSpyDriverInternalStackDataParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalStackDataParams) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData() - END - params read error: %d", r));
-        return r;
-        }
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - thread id: %d, remaining: %8d", params.iTid, params.iRemaining));
-
-    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-
-    r = OpenTempObject( params.iTid, EThread );
-	if  ( r == KErrNone )
-		{
-        // Find the correct thread...
-        DThread* thread = (DThread*) TempObject();
-        DProcess* process = threadAdaption.GetOwningProcess( *thread );
-	    TFullName fullName;
-        thread->FullName( fullName );
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - thread: %lS", &fullName));
-
-        // Check the threads in the process are suspended
-        const TBool isSuspended = SuspensionManager().IsSuspended( *process );
-        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData() - isSuspended: %d", isSuspended ));
-        if  ( isSuspended )
-            {
-            TInt stackSize = 0;
-            TUint32 stackBase = 0;
-            TBool stackAvailable = EFalse;
-            //
-            if  ( params.iDomain == EMemSpyDriverDomainUser )
-                {
-                stackSize = threadAdaption.GetUserStackSize( *thread );
-                stackBase = threadAdaption.GetUserStackBase( *thread );
-                }
-            else if ( params.iDomain == EMemSpyDriverDomainKernel )
-                {
-                stackSize = threadAdaption.GetSupervisorStackSize( *thread );
-                stackBase = threadAdaption.GetSupervisorStackBase( *thread );
-                }
-            TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData() - stackAvailable: %d", stackAvailable ));
-            //           
-            if  ( stackAvailable )
-		        {
-                // 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("DMemSpyDriverLogChanStack::GetStackData - user side descriptor: 0x%08x (0x%08x), len: %8d, maxLen: %8d, r: %d", params.iDes, destPtr, destLen, destMax, r ));
-
-                if  ( r == KErrNone )
-                    {
-                    // Calculate stack starting address. If we want to get the entire stack data
-                    // then we use the information from DThread. If we only want the data from
-                    // the current SP onwards, then we use GetStackPointerByDomain to return
-                    // the current SP value. If we are only fetching a portion of the stack, then
-                    // the amount of data we will have to read is obviously reduced.
-                    TUint32 stackStartingAddress = 0;
-                    if  ( params.iEntireStack )
-                        {
-                        stackStartingAddress = stackBase;
-                        }
-                    else
-                        {
-                        stackStartingAddress = GetStackPointerByDomain( thread, params.iDomain ); 
-                        }
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - stackStartingAddress:  0x%08x", stackStartingAddress));
-                    __ASSERT_ALWAYS( stackStartingAddress != 0, MemSpyDriverUtils::Fault( __LINE__ ) );
-
-                    // Calculate how much data (maximum) there is to read, depending on whether the
-                    // client asked for all or just the active part of the stack.
-                    TUint stackDataSize = 0;
-                    if  ( params.iEntireStack )
-                        {
-                        stackDataSize = stackSize;
-                        }
-                    else
-                        {
-                        stackDataSize = stackBase + stackSize - stackStartingAddress;
-                        }
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - stackDataSize:           %8d", stackDataSize ));
-
-                    // Deal with the initial case - i.e. whereby the client is requesting stack
-                    // data for the first time. In this situation, the magic rune for "first
-                    // request" is a remaining value of -1.
-                    if  ( params.iRemaining < 0 )
-                        {
-                        params.iRemaining = stackDataSize;
-                        }
-
-                    // The remaining number of bytes should allow us to calculate the position
-                    // to read from.
-                    const TInt amountToRead = Min( params.iRemaining, destMax );
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - amountToRead:            %8d", amountToRead));
-                    const TInt readOffset = ( stackDataSize - params.iRemaining );
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - readOffset:              %8d", readOffset));
-                    const TAny* readAddress = (const TAny*) ( stackStartingAddress + readOffset );
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - readAddress:           0x%08x", readAddress));
-        
-                    // Do the read into user-space
-            #ifndef __WINS__
-                    if  ( params.iDomain == EMemSpyDriverDomainKernel )
-                        {
-                        const TPtrC8 pData( (TUint8*) readAddress, amountToRead );
-                        r = Kern::ThreadDesWrite( &Kern::CurrentThread(), params.iDes, pData, 0 );
-                        }
-                    else
-                        {
-                        r = Kern::ThreadRawRead( thread, readAddress, destPtr, amountToRead );
-                        }
-
-                    // Update user-side
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - mem. operation result: %d", r));
-                    if  ( r == KErrNone )
-                        {
-                        // Update remaining bytes and write back to user address space
-                        params.iRemaining -= amountToRead;
-                        r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalStackDataParams) );
-
-                        if  ( r == KErrNone )
-                            {
-                            // Client takes care of updating descriptor length.
-                            r = amountToRead;
-                            }
-                        }
-                    else if ( r == KErrBadDescriptor )
-                        {
-                        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
-                        }
-            #else
-                    (void) destPtr;
-                    params.iRemaining -= amountToRead;
-                    r = amountToRead;
-                    Kern::Printf( "DMemSpyDriverLogChanStack::GetStackData - not reading data on WINS" );
-            #endif
-                    }
-                else
-                    {
-                    Kern::Printf( "DMemSpyDriverLogChanStack::GetStackData - error getting client descriptor info" );
-                    }
-                }
-	        else
-                {
-    	        Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - stack address or stack length is invalid");
-                r = KErrArgument;
-                }
-            }
-        else
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - parent process not suspended => KErrAccessDenied"));
-            r = KErrAccessDenied;
-            }
-
-	    CloseTempObject();
-        }
-    else
-        {
-    	Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - thread not found");
-		}
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData() - END - ret: %d", r));
-    return r;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#ifdef __MARM__
-
-#define __INCLUDE_REG_OFFSETS__  // for SP_R13U in nk_plat.h
-#include "nk_plat.h"
-#include "arm.h"
-
-void DMemSpyDriverLogChanStack::GetStackPointers( DThread* aThread, TUint& aSupSP, TUint& aUsrSP )
-	{
-    __ASSERT_ALWAYS( aThread != &Kern::CurrentThread(), MemSpyDriverUtils::Fault( __LINE__ ) );
-
-    // Get NThread associated with DThread
-    NThread* nThread = OSAdaption().DThread().GetNThread( *aThread );
-
-    TMemSpyDriverRegSet regs;
-    MemSpyDriverUtils::GetThreadRegisters( nThread, regs );
-    //
-    aSupSP = aThread->iNThread.iSavedSP;
-    aUsrSP = regs.iRn[13];
-    //
-	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackPointers() - usr: 0x%08x [0x%08x-0x%08x], svc: 0x%08x [0x%08x-0x%08x]", aUsrSP, aThread->iUserStackRunAddress, (TUint) aThread->iUserStackRunAddress + (TUint) aThread->iUserStackSize, aSupSP, aThread->iSupervisorStack, (TUint) aThread->iSupervisorStack + (TUint) aThread->iSupervisorStackSize ));
-	}
-
-
-TLinAddr DMemSpyDriverLogChanStack::GetStackPointerByDomain( DThread* aThread, TMemSpyDriverDomainType aDomainType )
-    {
-    TUint stackPointer = 0;
-    //
-    if  ( aDomainType == EMemSpyDriverDomainUser )
-        {
-        // Get NThread associated with DThread
-        NThread* nThread = OSAdaption().DThread().GetNThread( *aThread );
- 
-        TMemSpyDriverRegSet regSet;
-        MemSpyDriverUtils::GetThreadRegisters( nThread, regSet );
-        stackPointer = regSet.iRn[13];
-        }
-    else if ( aDomainType == EMemSpyDriverDomainKernel )
-        {
-        TUint userSPNotUsed = 0;
-        GetStackPointers( aThread, stackPointer, userSPNotUsed );
-        }
-    //
-    return TLinAddr( stackPointer );
-    }
-
-#else
-
-void DMemSpyDriverLogChanStack::GetStackPointers( DThread* /*aThread*/, TUint& aSupSP, TUint& aUsrSP )
-	{
-    aSupSP = 0;
-    aUsrSP = 0;
-	}
-
-
-TLinAddr DMemSpyDriverLogChanStack::GetStackPointerByDomain( DThread* aThread, TMemSpyDriverDomainType aDomainType )
-    {
-    // Just return the base address in WINS
-    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-    TUint32 stackPointer = 0;
-    //
-    if  ( aDomainType == EMemSpyDriverDomainUser )
-        {
-        stackPointer = threadAdaption.GetUserStackBase( *aThread );
-        }
-    else if ( aDomainType == EMemSpyDriverDomainKernel )
-        {
-        stackPointer = threadAdaption.GetSupervisorStackBase( *aThread );
-        }
-    //
-    return TLinAddr( stackPointer );
-    }
-
-#endif
-
-
-TInt DMemSpyDriverLogChanStack::GetStackHighWatermark( DThread& aThread, TLinAddr& aHighWatermark, TMemSpyDriverDomainType aDomain, TUint aRune )
-    {
-    aHighWatermark = 0;
-    const TInt KStackPageSize = 512;
-    
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark() - START - domain: %d, rune: 0x%08x", aDomain, aRune ));
-
-    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-   
-    const TUint32 baseAddress = aDomain == EMemSpyDriverDomainUser ? threadAdaption.GetUserStackBase( aThread ) : threadAdaption.GetSupervisorStackBase( aThread );
-    const TInt size           = aDomain == EMemSpyDriverDomainUser ? threadAdaption.GetUserStackSize( aThread ) : threadAdaption.GetSupervisorStackSize( aThread );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - baseAddress: 0x%08x, size: %8d", baseAddress, size));
-
-    TInt r = KErrNone;
-    //
-	if  ( baseAddress && size )
-		{
-        aHighWatermark = baseAddress;
-        TBuf8<KStackPageSize> stackBuf;
-        TUint8* readAddress = NULL;
-        //
-        while( r == KErrNone )
-            {
-            // Read a chunk of data
-            r = ReadStackData( aThread, stackBuf, readAddress, aDomain );
-
-            // Process the data, looking for the first bytes that aren't 0x29292929
-            if  ( r == KErrNone )
-                {
-                const TInt readLength = stackBuf.Length();
-                TRACE_DATA( MemSpyDriverUtils::DataDump("stackdata - %lS", stackBuf.Ptr(), readLength, readLength ) );
-
-                TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - readLength: %d", readLength));
-
-                for( TInt readPos = 0; readPos < readLength && ((readLength - readPos) >= 4); readPos += 4, aHighWatermark += 4 )
-                    {
-                    const TUint dword =  stackBuf[ readPos ] +
-                                        (stackBuf[ readPos + 1 ] <<  8) + 
-                                        (stackBuf[ readPos + 2 ] << 16) + 
-                                        (stackBuf[ readPos + 3 ] << 24);
-                    //
-                    if  ( dword != aRune )
-                        {
-                        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - found end of uninit. stack!"));
-                        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - dword:          0x%08x", dword));
-                        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - readPos:          %8d", readPos));
-                        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - aHighWatermark: 0x%08x", aHighWatermark));
-                        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark() - END"));
-                        return KErrNone;
-                        }
-                    }
-                }
-            }
-        }
-    //
-    aHighWatermark = 0;
-    Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark() - END - error: %d", r);
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogChanStack::ReadStackData( DThread& aThread, TDes8& aDestination, TUint8*& aReadAddress, TMemSpyDriverDomainType aDomain )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData() - START - domain: %d", aDomain ));
-
-    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
-
-    const TUint32 baseAddress = aDomain == EMemSpyDriverDomainUser ? threadAdaption.GetUserStackBase( aThread ) : threadAdaption.GetSupervisorStackBase( aThread );
-    const TInt size           = aDomain == EMemSpyDriverDomainUser ? threadAdaption.GetUserStackSize( aThread ) : threadAdaption.GetSupervisorStackSize( aThread );
-    const TUint32 topAddress  = ( baseAddress + size );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - baseAddress:   0x%08x", baseAddress));
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - size:          0x%08x", size));
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - topAddress:    0x%08x", topAddress));
-    //
-    if  ( aReadAddress == NULL )
-        {
-        aReadAddress = (TUint8*) baseAddress; 
-        }
-
-    // Work out how much we should read
-    TInt readLen = Min( aDestination.MaxLength(), topAddress - (TLinAddr) aReadAddress );
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - aReadAddress:  0x%08x", aReadAddress));
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - readLen:         %8d", readLen));
-
-    TInt r = KErrNotSupported;
-    aDestination.Zero();
-
-#ifndef __WINS__
-    if  ( aDomain == EMemSpyDriverDomainKernel )
-        {
-        const TPtrC8 pData( (TUint8*) aReadAddress, readLen );
-        aDestination.Copy( pData );
-        r = KErrNone;
-        readLen = aDestination.Length();
-        }
-    else
-        {
-        r = Kern::ThreadRawRead( &aThread, aReadAddress, (TAny*) aDestination.Ptr(), readLen );
-        }
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - read result: %d", r));
-    if  (r == KErrNone)
-        {
-        aDestination.SetLength( readLen );
-        aReadAddress += aDestination.Length();
-        }
-#else
-    Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - not reading data on WINS");
-#endif
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData() - END - ret: %d", r));
-    return r;
-    }
-
-
-
-
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanThreadAndProcess.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,511 +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 "MemSpyDriverLogChanThreadAndProcess.h"
-
-// System includes
-#include <platform.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/driver/memspydriverpanics.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverOSAdaption.h"
-#include "MemSpyDriverSuspensionManager.h"
-
-// Constants
-const TBool KMemSpyDriverAllowDeadOpenRequests = ETrue;
-const TInt KMemSpyDriverLogChanThreadAndProcessXferBufferSize = 512;
-
-
-DMemSpyDriverLogChanThreadAndProcess::DMemSpyDriverLogChanThreadAndProcess( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanBase( aDevice, aThread )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::DMemSpyDriverLogChanThreadAndProcess() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanThreadAndProcess::~DMemSpyDriverLogChanThreadAndProcess()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::~DMemSpyDriverLogChanThreadAndProcess() - START - this: 0x%08x", this ));
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::~DMemSpyDriverLogChanThreadAndProcess() - END - this: 0x%08x", this ));
-	}
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::Construct()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::Construct() - START - this: 0x%08x", this ));
-    
-    const TInt ret = BaseConstruct( KMemSpyDriverLogChanThreadAndProcessXferBufferSize );
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::Construct() - END - this: 0x%08x, err: %d", this, ret ));
-    return ret;
-	}
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-	    case EMemSpyDriverOpCodeThreadAndProcessGetInfoThread:
-		    r = GetInfoThread( (TUint)a1, (TMemSpyDriverInternalThreadInfoParams*) a2);
-		    break;
-	    case EMemSpyDriverOpCodeThreadAndProcessGetInfoProcess:
-		    r = GetInfoProcess( (TUint)a1, (TMemSpyDriverProcessInfo*) a2);
-		    break;
-        case EMemSpyDriverOpCodeThreadAndProcessEndThread:
-            r = EndThread( (TUint) a1, (TExitType) ((TUint) a2) );
-            break;
-        case EMemSpyDriverOpCodeThreadAndProcessOpenThread:
-            r = OpenThread( (TUint) a1 );
-            break;
-        case EMemSpyDriverOpCodeThreadAndProcessOpenProcess:
-            r = OpenProcess( (TUint) a1 );
-            break;
-        case EMemSpyDriverOpCodeThreadAndProcessSuspendAllThreads:
-            r = SuspendAllThreadsInProcess( (TUint) a1 );
-            break;
-        case EMemSpyDriverOpCodeThreadAndProcessResumeAllThreads:
-            r = ResumeAllThreadsInProcess( (TUint) a1 );
-            break;
-        case EMemSpyDriverOpCodeThreadAndProcessGetThreads:
-            r = GetThreadsForProcess( (TUint) a1, (TDes8*) a2 );
-            break;
-        case EMemSpyDriverOpCodeThreadAndProcessSetPriorityThread:
-            r = SetPriority( (TUint) a1, (TThreadPriority) ((TUint) a2) );
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanThreadAndProcess::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeThreadAndProcessBase && aFunction < EMemSpyDriverOpCodeThreadAndProcessEnd );
-    }
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::GetInfoThread( TUint aTid, TMemSpyDriverInternalThreadInfoParams* aParams )
-	{
-    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - START"));
-
-    TMemSpyDriverInternalThreadInfoParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalThreadInfoParams) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - END - params read error: %d", r));
-        return r;
-        }
-
-	r = OpenTempObject( aTid, EThread );
-	if  ( r == KErrNone )
-		{
-		DThread* dThread = (DThread*) TempObject();
-  	    NKern::ThreadEnterCS();
-
-        // Get DThread adaptor. This is a means of querying DThread internals
-        // without accessing them directly. Takes into account possible differences
-        // between compile time and run time
-        DMemSpyDriverOSAdaptionDThread& dThreadAdaptor = OSAdaption().DThread();
-
-        // Saved CPU registers for thread. Need to get NThread to do this.
-        NThread* nThread = dThreadAdaptor.GetNThread( *dThread );
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting regs..." ));
-        MemSpyDriverUtils::GetThreadRegisters( nThread, params.iCpu );
-		
-        // Name
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting full name..." ));
-		dThread->FullName( params.iFullName );
-
-        // User framework
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting allocator..." ));
-        params.iAllocator = dThreadAdaptor.GetAllocator( *dThread );
-
-        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting scheduler..." ));
-        params.iScheduler = dThreadAdaptor.GetActiveScheduler( *dThread );
-
-        // User stack information - rest comes from user side API calls
-        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting user stack pointer..." ));
-        params.iStackInfo.iUserStackPointer = params.iCpu.iRn[ 12 ];
-
-        // Supervisor stack information
-        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting supervisor stack..." ));
-        params.iStackInfo.iSupervisorStackPointer = 0;
-        params.iStackInfo.iSupervisorStackHighWatermark = 0;
-        params.iStackInfo.iSupervisorStackBase = dThreadAdaptor.GetSupervisorStackBase( *dThread );
-        params.iStackInfo.iSupervisorStackSize = dThreadAdaptor.GetSupervisorStackSize( *dThread );
- 
-        // Write back to user-side
-        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - writing to user side..." ));
-        r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalThreadInfoParams) );
-	    NKern::ThreadLeaveCS();
-		CloseTempObject();
-		}
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - END - ret: %d", r));
-    return r;
-	}
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::GetInfoProcess( TUint aPid, TMemSpyDriverProcessInfo* aParams )
-	{
-    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoProcess() - START"));
-
-    TMemSpyDriverProcessInfo params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverProcessInfo) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoProcess() - END - params read error: %d", r));
-        return r;
-        }
-
-	r = OpenTempObject( aPid, EProcess );
-	if  ( r == KErrNone )
-		{
-        DMemSpyDriverOSAdaptionDProcess& processAdaptor = OSAdaption().DProcess();
-  
-        DProcess* process = (DProcess*) TempObject();
-  	    NKern::ThreadEnterCS();
-		//
-        params.iFlags = processAdaptor.GetFlags( *process );
-        params.iGeneration = processAdaptor.GetGeneration( *process );
-        params.iSecurityInfo = processAdaptor.GetSecurityInfo( *process );
-
-        // Write back to user-side
-        r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverProcessInfo) );
-	    NKern::ThreadLeaveCS();
-		CloseTempObject();
-		}
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoProcess() - END - ret: %d", r));
-    return r;
-	}
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::EndThread( TUint aId, TExitType aType )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::EndThread() - START - aId: %d, aType: %d", aId, aType ));
-
-	TInt r = OpenTempObject( aId, EThread );
-	if  ( r == KErrNone )
-		{
-        DThread* thread = (DThread*) TempObject();
-        //
-        const TInt reason = MapToMemSpyExitReason( aType );
-        Kern::ThreadKill( thread, aType, reason, KMemSpyClientPanic );
-        //
-	    CloseTempObject();
-        }
-    else
-        {
-        r = KErrNotFound;
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::EndThread() - END - r: %d", r));
-	return r;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::OpenThread( TUint aId )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - START - aId: %d", aId));
-
-	TInt r = OpenTempObject( aId, EThread, KMemSpyDriverAllowDeadOpenRequests );
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - done open temp object, r: %d", r ));
-	if  ( r == KErrNone )
-		{
-        NKern::ThreadEnterCS();
-        DThread* threadToOpen = (DThread*) TempObject();
-        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - thread exit type: %d", threadToOpen->iExitType ));
-
-        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - making handle..." ));
-        r = Kern::MakeHandleAndOpen( &ClientThread(), threadToOpen );
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - handle: %d",r ));
-    	NKern::ThreadLeaveCS();
-
-        // Balance reference count, handle is still open and mapped into our process since we opened
-        // it above via MakeHandleAndOpen
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - closing temp object..." ));
-	    CloseTempObject();
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - closed temp object" ));
-        }
-    else
-        {
-        r = KErrNotFound;
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - END - r: %d", r));
-	return r;
-    }
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::OpenProcess( TUint aId )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenProcess() - START - aId: %d", aId));
-
-	TInt r = OpenTempObject( aId, EProcess, KMemSpyDriverAllowDeadOpenRequests );
-	if  ( r == KErrNone )
-		{
-        NKern::ThreadEnterCS();
-        DProcess* processToOpen = (DProcess*) TempObject();
-        r = Kern::MakeHandleAndOpen( &ClientThread(), processToOpen );
-    	NKern::ThreadLeaveCS();
-
-        // Balance reference count, handle is still open and mapped into our process since we opened
-        // it above via MakeHandleAndOpen
-	    CloseTempObject();
-        }
-    else
-        {
-        r = KErrNotFound;
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenProcess() - END - r: %d", r));
-	return r;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::SuspendAllThreadsInProcess( TUint aPid )
-    {
-	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::SuspendAllThreadsInProcess() - START - aPid: %d", aPid ));
-
-    DMemSpySuspensionManager& susMan = SuspensionManager();
-    const TInt err = susMan.SuspendAllThreadsInProcess( aPid, ClientThread() );
-
-	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::SuspendAllThreadsInProcess() - END - aPid: %d, err: %d", aPid, err ));
-	return err;
-    }
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::ResumeAllThreadsInProcess( TUint aPid )
-    {
-	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::ResumeAllThreadsInProcess() - START - aPid: %d", aPid ));
-
-    DMemSpySuspensionManager& susMan = SuspensionManager();
-    const TInt err = susMan.ResumeAllThreadsInProcess( aPid, ClientThread() );
-
-	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::ResumeAllThreadsInProcess() - END - aPid: %d, err: %d", aPid, err ));
-	return err;
-    }
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess( TUint aPid, TDes8* aBufferSink )
-    {
-	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - START - aPid: %d", aPid ) );
-
-    // We open the source thread or process, just to ensure it doesn't die underneath us...
-    TInt r = OpenTempObject( aPid, EProcess );
-    if  ( r == KErrNone )
-		{
-		DProcess& process = TempObjectAsProcess();
-
-        // Open stream
-        RMemSpyMemStreamWriter stream = OpenXferStream();
-        TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - stream remaining: %d", stream.Remaining() ) ); 
-
-        // Save marker pos for the thread count - we'll update it after the loop
-        TInt count = 0;
-        TInt32* pCountMarkerThread = stream.WriteInt32( 0 );
-
-        DMemSpyDriverOSAdaptionDProcess& processAdaptor = OSAdaption().DProcess();
-        SDblQue& threadQueue = processAdaptor.GetThreadQueue( process );
-        SDblQueLink* pLink = threadQueue.First();
-		while( pLink != & threadQueue.iA && !stream.IsFull() )
-			{
-			DThread* pT = processAdaptor.GetThread( pLink );
-            //
-            if  ( pT )
-                {
-                const TUint tid = OSAdaption().DThread().GetId( *pT );
-                TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - id: %d (0x%04x)", tid, tid ) );
-                stream.WriteUint32( tid );
-                }
-
-            pLink = pLink->iNext;
-			++count;
-            }
- 
-        if  ( stream.IsFull() )
-            {
-            Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - STREAM FULL - id: %d (0x%04x), thread: %O", process.iId, process.iId, &process );
-            }
-
-        // Now write the count
-        *pCountMarkerThread = count;
-
-        // Tidy up
-        r = stream.WriteAndClose( aBufferSink );
-        TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - r: %d, count: %d", r, count ));
-
-        CloseTempObject();
-        }
-
-	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - END - aPid: %d, err: %d", aPid, r ));
-	return r;
-    }
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::SetPriority( TUint aId, TThreadPriority aPriority )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::SetPriority(T) - START - aId: %d, aPriority: %d", aId, aPriority ));
-
-	TInt r = OpenTempObject( aId, EThread );
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::SetPriority(T) - done open temp object, r: %d", r ));
-	if  ( r == KErrNone )
-		{
-        // Map user side thread priority to kernel-side absolute thread priority (typically 0-63)
-        const TInt kernelThreadPri = MemSpyDriverUtils::MapToAbsoluteThreadPriority( aPriority );
-        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::SetPriority(T) - user: %d, kernel absolute: %d", aPriority, kernelThreadPri ));
-
-        if  ( kernelThreadPri > 0 && kernelThreadPri < KNumPriorities )
-            {
-            NKern::ThreadEnterCS();
-            DThread& thread = TempObjectAsThread();
-            r = Kern::SetThreadPriority( kernelThreadPri, &thread );
-            TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::SetPriority(T) - Kern::SetThreadPriority() returned: %d", r ));
-    	    NKern::ThreadLeaveCS();
-            }
-        else
-            {
-            // Error
-            r = kernelThreadPri;
-            }
-
-        CloseTempObject();
-        }
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::SetPriority(T) - END - r: %d", r));
-	return r;
-    }
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanThreadAndProcess::MapToMemSpyExitReason( TExitType aType )
-    {
-    TInt ret = 0;
-    //
-    switch( aType )
-        {
-    default:
-    case EExitKill:
-        ret = EPanicForcedKill;
-        break;
-    case EExitTerminate:
-        ret = EPanicForcedTerminate;
-        break;
-    case EExitPanic:
-        ret = EPanicForcedPanic;
-        break;
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanUserEventMonitor.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +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 "MemSpyDriverLogChanUserEventMonitor.h"
-
-// System includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverUserEventMonitor.h"
-
-
-
-DMemSpyDriverLogChanUserEventMonitor::DMemSpyDriverLogChanUserEventMonitor( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:   DMemSpyDriverLogChanBase( aDevice, aThread )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::DMemSpyDriverLogChanThreadAndProcess() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanUserEventMonitor::~DMemSpyDriverLogChanUserEventMonitor()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::~DMemSpyDriverLogChanThreadAndProcess() - START - this: 0x%08x", this ));
-
-    NKern::ThreadEnterCS();
-    delete iEventMonitorManager;
-    NKern::ThreadLeaveCS();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::~DMemSpyDriverLogChanThreadAndProcess() - END - this: 0x%08x", this ));
-	}
-
-
-TInt DMemSpyDriverLogChanUserEventMonitor::Construct()
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::Construct() - START"));
-    //
-    TInt error = BaseConstruct();
-    //
-    if  ( error == KErrNone )
-        {
-        iEventMonitorManager = new DMemSpyDriverClientEMManager( MemSpyDevice() );
-
-        if  ( iEventMonitorManager )
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::DoCreate - creating event monitor" ));
-
-            error = iEventMonitorManager->Create();
-
-            TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::DoCreate - event monitor create error: %d", error ));
-            }
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::Construct() - END - error: %d", error ));
-    return error;
-    }
-
-
-
-TInt DMemSpyDriverLogChanUserEventMonitor::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-        case EMemSpyDriverOpCodeEventMonitorOpen:
-            r = EventMonitorOpen( a1 );
-            break;
-        case EMemSpyDriverOpCodeEventMonitorClose:
-            r = EventMonitorClose( (TUint) a1 );
-            break;
-        case EMemSpyDriverOpCodeEventMonitorNotify:
-            r = EventMonitorNotify( (TMemSpyDriverInternalEventMonitorParams*) a1 );
-            break;
-        case EMemSpyDriverOpCodeEventMonitorNotifyCancel:
-            r = EventMonitorNotifyCancel( (TUint) a1 );
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanUserEventMonitor::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeEventMonitorBase && aFunction < EMemSpyDriverOpCodeEventMonitorEnd );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanUserEventMonitor::EventMonitorOpen( TAny* aHandle )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorOpen() - START") );
-    NKern::ThreadEnterCS();
-    
-    DMemSpyDriverClientEM* monitor = iEventMonitorManager->EMOpen();
-    TInt error = ( monitor != NULL )? KErrNone : KErrNoMemory;
-    const TUint handle = ( monitor != NULL )? monitor->Handle() : KNullHandle;
-    
-    // Write handle back
-    const TInt writeErr = Kern::ThreadRawWrite( &ClientThread(), aHandle, &handle, sizeof(TUint) );
-	if  ( writeErr != KErrNone )
-		{
-        TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorOpen() - write error: %d", writeErr ) );
-        error = writeErr;
-		}
-    //
-    NKern::ThreadLeaveCS();
-	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorOpen() - END - handle: 0x%08x, error: %d", handle, error ));
-    return error;
-    }
-
-
-TInt DMemSpyDriverLogChanUserEventMonitor::EventMonitorClose( TUint aHandle )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorClose() - START - aHandle: 0x%08x", aHandle));
-
-    NKern::ThreadEnterCS();
-    const TInt error = iEventMonitorManager->EMClose( aHandle );
-    NKern::ThreadLeaveCS();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorClose() - END - error: %d", error ));
-    return error;
-    }
-
-
-TInt DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotify( TMemSpyDriverInternalEventMonitorParams* aParams )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotify() - START"));
-    NKern::ThreadEnterCS();
-
-    // Read client info
-    TMemSpyDriverInternalEventMonitorParams params;
-	TInt error = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalEventMonitorParams) );
-    //
-    if  ( error == KErrNone )
-        {
-        DMemSpyDriverClientEM* monitor = iEventMonitorManager->EMInstance( params.iHandle );
-        //
-        if  ( monitor != NULL )
-            {
-            error = monitor->NotifyChanges( &ClientThread(), params.iStatus, params.iContext );
-            }
-        else
-            {
-            error = KErrNotFound;
-            }
-        }
-
-    // NB: Let client take care of completing request in error situations
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotify() - END - error: %d", error ));
-    return error;
-    }
-
-
-TInt DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotifyCancel( TUint aHandle )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotifyCancel() - START - aHandle: 0x%08x", aHandle));
-    NKern::ThreadEnterCS();
-
-    TInt error = KErrNotFound;
-    DMemSpyDriverClientEM* monitor = iEventMonitorManager->EMInstance( aHandle );
-    //
-    if  ( monitor != NULL )
-        {
-        error = monitor->NotifyChangesCancel();
-        }
-
-    NKern::ThreadLeaveCS();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotifyCancel() - END - error: %d", error ));
-    return error;
-    }
-
-
-
-
--- a/memspy/Driver/Shared/MemSpyDriverEnumerationsInternal.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +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 MEMSPYDRIVERENUMERATIONSINTERNAL_H
-#define MEMSPYDRIVERENUMERATIONSINTERNAL_H
-
-
-enum TMemSpyDriverPrivateObjectType
-    {
-    EMemSpyDriverPrivateObjectTypeAll = 0,
-    EMemSpyDriverPrivateObjectTypeProcess,
-    EMemSpyDriverPrivateObjectTypeThread
-    };
-
-
-
-#endif
--- a/memspy/Driver/Shared/MemSpyDriverObjectsInternal.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +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 MEMSPYDRIVEROBJECTSINTERNAL_H
-#define MEMSPYDRIVEROBJECTSINTERNAL_H
-
-// System includes
-#include <e32cmn.h>
-
-// User includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-#include "MemSpyDriverEnumerationsInternal.h"
-
-
-
-
-class TMemSpyDriverInternalHeapRequestParameters
-    {
-public:
-    inline TMemSpyDriverInternalHeapRequestParameters()
-        : iTid(0), iRHeapVTable(0), iBuildFreeCellList(EFalse), iBuildAllocCellList(EFalse), iDebugAllocator(EFalse), iMasterInfo(NULL)
-        {
-        }
-
-public: // Params IN
-    TUint iTid;
-    TUint32 iRHeapVTable;
-    TBool iBuildFreeCellList;
-	TBool iBuildAllocCellList;
-
-public: // Params IN or OUT (IN in User heap requests, OUT in Kernel heap requests)
-    TBool iDebugAllocator;
-
-public: // Params IN and OUT
-    TMemSpyHeapInfo* iMasterInfo;
-    };
-
-
-
-
-
-	
-
-
-
-/**
- * Parameters for User & Kernel heap data fetch
- */
-struct TMemSpyDriverInternalHeapDataParams
-    {
-    TUint iTid;
-    TUint iRHeapVTable;
-    TDes8* iDes; // Not used during kernel heap fetch
-    TInt iRemaining; // Not used during kernel heap fetch
-    TUint iReadAddress;
-    TUint32 iChecksum;
-    TBool iDebugAllocator;
-    };
-
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalStackDataParams
-    {
-    TUint iTid;
-    TDes8* iDes;
-    TMemSpyDriverDomainType iDomain;
-    TBool iEntireStack;
-    TInt iRemaining;
-    };
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalChunkHandleParams
-	{
-	TUint iId;
-	TMemSpyDriverPrivateObjectType iType;
-	TAny** iHandles;
-	TInt* iCountPtr;
-    TInt iMaxCount;
-	};
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalChunkInfoParams
-	{
-	TAny* iHandle;
-	TAny* iBaseAddress;
-	TInt iSize;
-	TInt iMaxSize;
-	TUint iOwnerId;
-	TBuf8<KMaxFullName> iName;
-    TMemSpyDriverChunkType iType;
-    TInt iAttributes;
-	};
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalCodeSnapshotParams
-	{
-	TUint iFilter;
-	TAny** iHandles;
-	TInt* iCountPtr;
-    TInt iMaxCount;
-	};
-
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalCodeSegParams
-	{
-	TUint iPid;
-	TAny* iHandle;
-	TMemSpyDriverCodeSegInfo* iInfoPointer;
-	};
-
-
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalContainerHandleParams
-	{
-    TInt iTidOrPid;
-    TMemSpyDriverThreadOrProcess iHandleSource;
-    TMemSpyDriverContainerType iContainer;
-	TAny** iHandles;
-	TInt* iCountPtr;
-    TInt iMaxCount;
-	};
-
-
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalServerSessionHandleParams
-	{
-    TAny* iServerHandle;
-	TAny** iSessionHandles;
-	TInt* iSessionCountPtr;
-    TInt iMaxCount;
-	};
-
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalContainerObjectParams
-	{
-    TUint iTid;
-	TAny* iHandle;
-	TBuf8<KMaxFullName> iFullName;
-	};
-
-
-
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalReadMemParams
-	{
-	TUint iTid;
-	TLinAddr iAddr;
-	TDes8* iDes;
-	};
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalThreadInfoParams : public TMemSpyDriverThreadInfoBase
-	{
-    // In:
-    TUint iRHeapVTable;
-	TBool iDebugAllocator;
-
-    // Out:
-	TBuf8<KMaxFullName> iFullName;
-
-    /*
-	TUint iPid;
-	TLinAddr iStackBase;
-	TInt iStackSize;
-	TMemSpyDriverRegSet iCpu;
-	TLinAddr iSupervisorStackBase;
-	TInt iSupervisorStackSize;
-    CActiveScheduler* iScheduler;
-	RAllocator* iAllocator;
-
-	TBuf8<KMaxExitCategoryName> iExitCategory;
-	TInt iExitReason;
-    TThreadPriority iThreadPriority;
-    TInt iDefaultPriority;
-    TExitType iExitType;
-    TInt iIpcCount;
-	RAllocator* iCreatedAllocator;
-    TInt iThreadType;
-    TInt iLeaveDepth;
-    TUint32 iFlags;
-    */
-	};
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalWalkHeapParamsInit
-	{
-	TUint iTid;
-	TUint iRHeapVTable;
-	TBool iDebugAllocator;
-	};
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalWalkHeapParamsCell
-	{
-	TInt iCellType;
-	TAny* iCellAddress;
-	TInt iLength;
-	TInt iNestingLevel;
-	TInt iAllocNumber;
-	};
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalWalkHeapCellDataReadParams
-    {
-    TAny* iCellAddress;
-    TInt iReadLen;
-    TDes8* iDes;
-    };
-
-
-
-
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalEventMonitorParams
-	{
-	TUint iHandle;
-	TRequestStatus* iStatus;
-	TAny* iContext;
-	};
-
-
-
-
-/**
- *
- */
-struct TMemSpyDriverInternalCondVarSuspendedThreadParams
-    {
-    TAny* iCondVarHandle;
-    TAny** iThrHandles;
-    TInt* iThrCountPtr;
-    TInt iMaxCount;
-    };
-
-#endif
--- a/memspy/Driver/Shared/MemSpyDriverOpCodes.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +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 MEMSPYDRIVEROPCODES_H
-#define MEMSPYDRIVEROPCODES_H
-
-enum TMemSpyDriverOpCode
-	{
-    // RAW MEMORY
-    EMemSpyDriverOpCodeRawMemoryBase = 100,
-    EMemSpyDriverOpCodeRawMemoryRead,
-    EMemSpyDriverOpCodeRawMemoryEnd,
-
-    // THREAD & PROCESS
-	EMemSpyDriverOpCodeThreadAndProcessBase = 120,
-	EMemSpyDriverOpCodeThreadAndProcessGetInfoThread,
-	EMemSpyDriverOpCodeThreadAndProcessGetInfoProcess,
-    EMemSpyDriverOpCodeThreadAndProcessEndThread,
-    EMemSpyDriverOpCodeThreadAndProcessOpenThread,
-    EMemSpyDriverOpCodeThreadAndProcessOpenProcess,
-    EMemSpyDriverOpCodeThreadAndProcessSuspendAllThreads,
-    EMemSpyDriverOpCodeThreadAndProcessResumeAllThreads,
-	EMemSpyDriverOpCodeThreadAndProcessGetThreads,
-    EMemSpyDriverOpCodeThreadAndProcessSetPriorityThread,
-	EMemSpyDriverOpCodeThreadAndProcessEnd,
-
-    // CODE SEGS
-	EMemSpyDriverOpCodeCodeSegsBase = 140,
-	EMemSpyDriverOpCodeCodeSegsGetAll,
-	EMemSpyDriverOpCodeCodeSegsGetCodeSegsForProcess,
-	EMemSpyDriverOpCodeCodeSegsGetCodeSegInfo,
-	EMemSpyDriverOpCodeCodeSegsEnd,
-
-    // CHUNKS
-	EMemSpyDriverOpCodeChunkBase = 160,
-    EMemSpyDriverOpCodeChunkGetHandles,
-    EMemSpyDriverOpCodeChunkGetInfo,
-	EMemSpyDriverOpCodeChunkEnd,
-
-    // HEAP INFO
-    EMemSpyDriverOpCodeHeapInfoBase = 180,
-	EMemSpyDriverOpCodeHeapInfoGetUser,
-	EMemSpyDriverOpCodeHeapInfoGetKernel,
-    EMemSpyDriverOpCodeHeapInfoGetIsDebugKernel,
-    EMemSpyDriverOpCodeHeapInfoFetchCellList,
-    EMemSpyDriverOpCodeHeapInfoEnd,
-
-    // HEAP DATA
-    EMemSpyDriverOpCodeHeapDataBase = 200,
-    EMemSpyDriverOpCodeHeapDataGetUser,
-    EMemSpyDriverOpCodeHeapDataGetKernelInit,
-    EMemSpyDriverOpCodeHeapDataGetKernelFetch,
-    EMemSpyDriverOpCodeHeapDataEnd,
-
-    // HEAP WALK
-    EMemSpyDriverOpCodeWalkHeapBase = 220,
-    EMemSpyDriverOpCodeWalkHeapInit,
-    EMemSpyDriverOpCodeWalkHeapGetCellInfo,
-    EMemSpyDriverOpCodeWalkHeapReadCellData,
-    EMemSpyDriverOpCodeWalkHeapNextCell,
-    EMemSpyDriverOpCodeWalkHeapClose,
-    EMemSpyDriverOpCodeWalkHeapEnd,
-
-    // STACK
-    EMemSpyDriverOpCodeStackBase = 240,
-    EMemSpyDriverOpCodeStackGetInfo,
-    EMemSpyDriverOpCodeStackGetData,
-    EMemSpyDriverOpCodeStackEnd,
-
-    // CONTAINERS
-    EMemSpyDriverOpCodeContainersBase = 260,
-    EMemSpyDriverOpCodeContainersGetHandles,
-    EMemSpyDriverOpCodeContainersGetHandleInfo,
-    EMemSpyDriverOpCodeContainersGetApproxSize,
-    EMemSpyDriverOpCodeContainersGetReferencesToMyThread,
-    EMemSpyDriverOpCodeContainersGetReferencesToMyProcess,
-    EMemSpyDriverOpCodeContainersGetPAndSInfo,
-    EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreads,
-    EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreadInfo,
-    EMemSpyDriverOpCodeContainersEnd,
-
-    // CLIENT SERVER
-    EMemSpyDriverOpCodeClientServerBase = 280,
-    EMemSpyDriverOpCodeClientServerGetServerSessionHandles,
-    EMemSpyDriverOpCodeClientServerGetServerSessionInfo,
-    EMemSpyDriverOpCodeClientServerEnd,
-    
-    // PROCESS INSPECTION
-    EMemSpyDriverOpCodeProcessInspectBase = 300,
-    EMemSpyDriverOpCodeProcessInspectOpen,
-    EMemSpyDriverOpCodeProcessInspectClose,
-    EMemSpyDriverOpCodeProcessInspectRequestChanges,
-    EMemSpyDriverOpCodeProcessInspectRequestChangesCancel,
-    EMemSpyDriverOpCodeProcessInspectAutoStartListReset,
-    EMemSpyDriverOpCodeProcessInspectAutoStartListAdd,
-    EMemSpyDriverOpCodeProcessInspectEnd,
-
-    // EVENT MONITOR
-    EMemSpyDriverOpCodeEventMonitorBase = 320,
-    EMemSpyDriverOpCodeEventMonitorOpen,
-    EMemSpyDriverOpCodeEventMonitorClose,
-    EMemSpyDriverOpCodeEventMonitorNotify,
-    EMemSpyDriverOpCodeEventMonitorNotifyCancel,
-    EMemSpyDriverOpCodeEventMonitorEnd,
-
-    // MISC
-    EMemSpyDriverOpCodeMiscBase = 340,
-    EMemSpyDriverOpCodeMiscSetRHeapVTable,
-    EMemSpyDriverOpCodeMiscGetMemoryModelType,
-    EMemSpyDriverOpCodeMiscGetRoundToPageSize,
-    EMemSpyDriverOpCodeMiscImpersonate,
-    EMemSpyDriverOpCodeMiscEnd,
-	};
-	
-#endif
--- a/memspy/Driver/Shared/heaputils.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1678 +0,0 @@
-// heaputils.cpp
-// 
-// Copyright (c) 2010 Accenture. All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the "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:
-// Accenture - Initial contribution
-//
-#ifdef TEST_HYBRIDHEAP_ASSERTS
-#define private public
-#include <e32def.h>
-#include "slab.h"
-#include "page_alloc.h"
-#include "heap_hybrid.h"
-#endif
-
-#include "heaputils.h"
-
-#ifdef __KERNEL_MODE__
-
-#include <kern_priv.h>
-#define MEM Kern
-__ASSERT_COMPILE(sizeof(LtkUtils::RKernelSideAllocatorHelper) == 10*4);
-#define KERN_ENTER_CS() NKern::ThreadEnterCS()
-#define KERN_LEAVE_CS() NKern::ThreadLeaveCS()
-#define LOG(args...)
-#define HUEXPORT_C
-#else
-
-#include <e32std.h>
-#define MEM User
-#define KERN_ENTER_CS()
-#define KERN_LEAVE_CS()
-//#include <e32debug.h>
-//#define LOG(args...) RDebug::Printf(args)
-#define LOG(args...)
-
-#ifdef STANDALONE_ALLOCHELPER
-#define HUEXPORT_C
-#else
-#define HUEXPORT_C EXPORT_C
-#endif
-
-#endif // __KERNEL_MODE__
-
-using LtkUtils::RAllocatorHelper;
-const TUint KPageSize = 4096;
-__ASSERT_COMPILE(sizeof(RAllocatorHelper) == 9*4);
-
-// RAllocatorHelper
-
-HUEXPORT_C RAllocatorHelper::RAllocatorHelper()
-	: iAllocatorAddress(0), iAllocatorType(EUnknown), iInfo(NULL), iValidInfo(0), iTempSlabBitmap(NULL), iPageCache(NULL), iPageCacheAddr(0)
-#ifdef __KERNEL_MODE__
-	, iChunk(NULL)
-#endif
-	{
-	}
-
-namespace LtkUtils
-	{
-	class THeapInfo
-		{
-	public:
-		THeapInfo()
-			{
-			ClearStats();
-			}
-
-		void ClearStats()
-			{
-			memclr(this, sizeof(THeapInfo));
-			}
-
-		TInt iAllocatedSize; // number of bytes in allocated cells (excludes free cells, cell header overhead)
-		TInt iCommittedSize; // amount of memory actually committed (includes cell header overhead, gaps smaller than an MMU page)
-		TInt iAllocationCount; // number of allocations currently
-		TInt iMaxCommittedSize; // or thereabouts
-		TInt iMinCommittedSize;
-		TInt iUnusedPages;
-		TInt iCommittedFreeSpace;
-		// Heap-only stats
-		TInt iHeapFreeCellCount;
-		// Hybrid-only stats
-		TInt iDlaAllocsSize;
-		TInt iDlaAllocsCount;
-		TInt iDlaFreeSize;
-		TInt iDlaFreeCount;
-		TInt iSlabAllocsSize;
-		TInt iSlabAllocsCount;
-		TInt iPageAllocsSize;
-		TInt iPageAllocsCount;
-		TInt iSlabFreeCellSize;
-		TInt iSlabFreeCellCount;
-		TInt iSlabFreeSlabSize;
-		TInt iSlabFreeSlabCount;
-		};
-	}
-
-const TInt KTempBitmapSize = 256; // KMaxSlabPayload / mincellsize, technically. Close enough.
-
-#ifdef __KERNEL_MODE__
-
-TInt RAllocatorHelper::OpenKernelHeap()
-	{
-	_LIT(KName, "SvHeap");
-	NKern::ThreadEnterCS();
-	DObjectCon* chunkContainer = Kern::Containers()[EChunk];
-	chunkContainer->Wait();
-	const TInt chunkCount = chunkContainer->Count();
-	DChunk* foundChunk = NULL;
-	for(TInt i=0; i<chunkCount; i++)
-		{
-		DChunk* chunk = (DChunk*)(*chunkContainer)[i];
-		if (chunk->NameBuf() && chunk->NameBuf()->Find(KName) != KErrNotFound)
-			{
-			// Found it. No need to open it, we can be fairly confident the kernel heap isn't going to disappear from under us
-			foundChunk = chunk;
-			break;
-			}
-		}
-	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.
-
-#endif
-	if (!err) err = FinishConstruction();
-	NKern::ThreadLeaveCS();
-	return err;
-	}
-
-#else
-
-HUEXPORT_C TInt RAllocatorHelper::Open(RAllocator* aAllocator)
-	{
-	iAllocatorAddress = (TLinAddr)aAllocator;
-	TInt udeb = EuserIsUdeb();
-	if (udeb < 0) return udeb; // error
-
-	TInt err = IdentifyAllocatorType(udeb);
-	if (!err)
-		{
-		err = FinishConstruction(); // Allocate everything up front
-		}
-	if (!err)
-		{
-		// We always stealth our own allocations, again to avoid tripping up allocator checks
-		SetCellNestingLevel(iInfo, -1);
-		SetCellNestingLevel(iTempSlabBitmap, -1);
-		SetCellNestingLevel(iPageCache, -1);
-		}
-	return err;
-	}
-
-#endif
-
-TInt RAllocatorHelper::FinishConstruction()
-	{
-	TInt err = KErrNone;
-	KERN_ENTER_CS();
-	if (!iInfo)
-		{
-		iInfo = new THeapInfo;
-		if (!iInfo) err = KErrNoMemory;
-		}
-	if (!err && !iTempSlabBitmap)
-		{
-		iTempSlabBitmap = (TUint8*)MEM::Alloc(KTempBitmapSize);
-		if (!iTempSlabBitmap) err = KErrNoMemory;
-		}
-	if (!err && !iPageCache)
-		{
-		iPageCache = MEM::Alloc(KPageSize);
-		if (!iPageCache) err = KErrNoMemory;
-		}
-
-	if (err)
-		{
-		delete iInfo;
-		iInfo = NULL;
-		MEM::Free(iTempSlabBitmap);
-		iTempSlabBitmap = NULL;
-		MEM::Free(iPageCache);
-		iPageCache = NULL;
-		}
-	KERN_LEAVE_CS();
-	return err;
-	}
-
-TInt RAllocatorHelper::ReadWord(TLinAddr aLocation, TUint32& aResult) const
-	{
-	// Check if we can satisfy the read from the cache
-	if (aLocation >= iPageCacheAddr)
-		{
-		TUint offset = aLocation - iPageCacheAddr;
-		if (offset < KPageSize)
-			{
-			aResult = ((TUint32*)iPageCache)[offset >> 2];
-			return KErrNone;
-			}
-		}
-
-	// If we reach here, not in page cache. Try and read in the new page
-	if (iPageCache)
-		{
-		TLinAddr pageAddr = aLocation & ~(KPageSize-1);
-		TInt err = ReadData(pageAddr, iPageCache, KPageSize);
-		if (!err)
-			{
-			iPageCacheAddr = pageAddr;
-			aResult = ((TUint32*)iPageCache)[(aLocation - iPageCacheAddr) >> 2];
-			return KErrNone;
-			}
-		}
-
-	// All else fails, try just reading it uncached
-	return ReadData(aLocation, &aResult, sizeof(TUint32));
-	}
-
-TInt RAllocatorHelper::ReadByte(TLinAddr aLocation, TUint8& aResult) const
-	{
-	// Like ReadWord but 8-bit
-
-	// Check if we can satisfy the read from the cache
-	if (aLocation >= iPageCacheAddr)
-		{
-		TUint offset = aLocation - iPageCacheAddr;
-		if (offset < KPageSize)
-			{
-			aResult = ((TUint8*)iPageCache)[offset];
-			return KErrNone;
-			}
-		}
-
-	// If we reach here, not in page cache. Try and read in the new page
-	if (iPageCache)
-		{
-		TLinAddr pageAddr = aLocation & ~(KPageSize-1);
-		TInt err = ReadData(pageAddr, iPageCache, KPageSize);
-		if (!err)
-			{
-			iPageCacheAddr = pageAddr;
-			aResult = ((TUint8*)iPageCache)[(aLocation - iPageCacheAddr)];
-			return KErrNone;
-			}
-		}
-
-	// All else fails, try just reading it uncached
-	return ReadData(aLocation, &aResult, sizeof(TUint8));
-	}
-
-
-TInt RAllocatorHelper::WriteWord(TLinAddr aLocation, TUint32 aWord)
-	{
-	// Invalidate the page cache if necessary
-	if (aLocation >= iPageCacheAddr && aLocation - iPageCacheAddr < KPageSize)
-		{
-		iPageCacheAddr = 0;
-		}
-
-	return WriteData(aLocation, &aWord, sizeof(TUint32));
-	}
-
-TInt RAllocatorHelper::ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const
-	{
-	// RAllocatorHelper base class impl is for allocators in same address space, so just copy it
-	memcpy(aResult, (const TAny*)aLocation, aSize);
-	return KErrNone;
-	}
-
-TInt RAllocatorHelper::WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize)
-	{
-	memcpy((TAny*)aLocation, aData, aSize);
-	return KErrNone;
-	}
-
-#ifdef __KERNEL_MODE__
-
-LtkUtils::RKernelSideAllocatorHelper::RKernelSideAllocatorHelper()
-	: iThread(NULL)
-	{}
-
-void LtkUtils::RKernelSideAllocatorHelper::Close()
-	{
-	NKern::ThreadEnterCS();
-	if (iThread)
-		{
-		iThread->Close(NULL);
-		}
-	iThread = NULL;
-	RAllocatorHelper::Close();
-	NKern::ThreadLeaveCS();
-	}
-
-TInt LtkUtils::RKernelSideAllocatorHelper::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)
-	{
-	return Kern::ThreadRawWrite(iThread, (TAny*)aLocation, aData, aSize);
-	}
-
-TInt LtkUtils::RKernelSideAllocatorHelper::TryLock()
-	{
-	return KErrNotSupported;
-	}
-
-void LtkUtils::RKernelSideAllocatorHelper::TryUnlock()
-	{
-	// Not supported
-	}
-
-TInt LtkUtils::RKernelSideAllocatorHelper::OpenUserHeap(TUint aThreadId, TLinAddr aAllocatorAddress, TBool aEuserIsUdeb)
-	{
-	NKern::ThreadEnterCS();
-	DObjectCon* threads = Kern::Containers()[EThread];
-	threads->Wait();
-	iThread = Kern::ThreadFromId(aThreadId);
-	if (iThread && iThread->Open() != KErrNone)
-		{
-		// Failed to open
-		iThread = NULL;
-		}
-	threads->Signal();
-	NKern::ThreadLeaveCS();
-	if (!iThread) return KErrNotFound;
-	iAllocatorAddress = aAllocatorAddress;
-	TInt err = IdentifyAllocatorType(aEuserIsUdeb);
-	if (err) Close();
-	return err;
-	}
-
-#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.
-	TInt udeb = EFalse; // We can't figure this out until after we've got the heap
-#else
-	// Assumes the chunk isn't the kernel heap. It's not a good idea to try messing with the kernel heap from user side...
-	TInt udeb = EuserIsUdeb();
-	if (udeb < 0) return udeb; // error
-#endif
-
-	TInt err = IdentifyAllocatorType(udeb);
-	if (err == KErrNone && iAllocatorType == EAllocator)
-		{
-		// We've no reason to assume it's an allocator because we don't know the iAllocatorAddress actually is an RAllocator*
-		err = KErrNotFound;
-		}
-	if (err)
-		{
-		TInt oldErr = err;
-		TAllocatorType oldType = iAllocatorType;
-		// Try middle of chunk, in case it's an RHybridHeap
-		iAllocatorAddress += aChunkMaxSize / 2;
-		err = IdentifyAllocatorType(udeb);
-		if (err || iAllocatorType == EAllocator)
-			{
-			// No better than before
-			iAllocatorAddress = aChunkBase;
-			iAllocatorType = oldType;
-			err = oldErr;
-			}
-		}
-#ifdef __KERNEL_MODE__
-	if (err == KErrNone)
-		{
-		// Now we know the allocator, we can figure out the udeb-ness
-		RAllocator* kernelAllocator = reinterpret_cast<RAllocator*>(iAllocatorAddress);
-		kernelAllocator->DebugFunction(RAllocator::ESetFail, (TAny*)9999, (TAny*)0); // Use an invalid fail reason - this should have no effect on the operation of the heap
-		TInt err = kernelAllocator->DebugFunction(7, NULL, NULL); // 7 is RAllocator::TAllocDebugOp::EGetFail
-		if (err == 9999)
-			{
-			// udeb new
-			udeb = ETrue;
-			}
-		else if (err == KErrNotSupported)
-			{
-			// Old heap - fall back to slightly nasty non-thread-safe method
-			kernelAllocator->DebugFunction(RAllocator::ESetFail, (TAny*)RAllocator::EFailNext, (TAny*)1);
-			TAny* res = Kern::Alloc(4);
-			if (res) udeb = ETrue;
-			Kern::Free(res);
-			}
-		else
-			{
-			// it's new urel
-			}
-
-		// Put everything back
-		kernelAllocator->DebugFunction(RAllocator::ESetFail, (TAny*)RAllocator::ENone, (TAny*)0);
-		// And update the type now we know the udeb-ness for certain
-		err = IdentifyAllocatorType(udeb);
-		}
-#endif
-	return err;
-	}
-
-
-// The guts of RAllocatorHelper
-
-enum TWhatToGet
-	{
-	ECommitted = 1,
-	EAllocated = 2,
-	ECount = 4,
-	EMaxSize = 8,
-	EUnusedPages = 16,
-	ECommittedFreeSpace = 32,
-	EMinSize = 64,
-	EHybridStats = 128,
-	};
-
-class RHackAllocator : public RAllocator
-	{
-public:
-	using RAllocator::iHandles;
-	using RAllocator::iTotalAllocSize;
-	using RAllocator::iCellCount;
-	};
-
-class RHackHeap : public RHeap
-	{
-public:
-	// Careful, only allowed to use things that are still in the new RHeap, and are still in the same place
-	using RHeap::iMaxLength;
-	using RHeap::iChunkHandle;
-	using RHeap::iLock;
-	using RHeap::iBase;
-	using RHeap::iAlign;
-	using RHeap::iTop;
-	};
-
-const TInt KChunkSizeOffset = 30*4;
-const TInt KPageMapOffset = 141*4;
-//const TInt KDlOnlyOffset = 33*4;
-const TInt KMallocStateOffset = 34*4;
-const TInt KMallocStateTopSizeOffset = 3*4;
-const TInt KMallocStateTopOffset = 5*4;
-const TInt KMallocStateSegOffset = 105*4;
-const TInt KUserHybridHeapSize = 186*4;
-const TInt KSparePageOffset = 167*4;
-const TInt KPartialPageOffset = 165*4;
-const TInt KFullSlabOffset = 166*4;
-const TInt KSlabAllocOffset = 172*4;
-const TInt KSlabParentOffset = 1*4;
-const TInt KSlabChild1Offset = 2*4;
-const TInt KSlabChild2Offset = 3*4;
-const TInt KSlabPayloadOffset = 4*4;
-const TInt KSlabsetSize = 4;
-
-#ifdef TEST_HYBRIDHEAP_ASSERTS
-__ASSERT_COMPILE(_FOFF(RHybridHeap, iChunkSize) == KChunkSizeOffset);
-__ASSERT_COMPILE(_FOFF(RHybridHeap, iPageMap) == KPageMapOffset);
-__ASSERT_COMPILE(_FOFF(RHybridHeap, iGlobalMallocState) == KMallocStateOffset);
-__ASSERT_COMPILE(sizeof(malloc_state) == 107*4);
-__ASSERT_COMPILE(_FOFF(malloc_state, iTopSize) == KMallocStateTopSizeOffset);
-__ASSERT_COMPILE(_FOFF(malloc_state, iTop) == KMallocStateTopOffset);
-__ASSERT_COMPILE(_FOFF(malloc_state, iSeg) == KMallocStateSegOffset);
-__ASSERT_COMPILE(sizeof(RHybridHeap) == KUserHybridHeapSize);
-__ASSERT_COMPILE(_FOFF(RHybridHeap, iSparePage) == KSparePageOffset);
-__ASSERT_COMPILE(_FOFF(RHybridHeap, iPartialPage) == KPartialPageOffset);
-__ASSERT_COMPILE(_FOFF(RHybridHeap, iSlabAlloc) == KSlabAllocOffset);
-__ASSERT_COMPILE(_FOFF(slab, iParent) == KSlabParentOffset);
-__ASSERT_COMPILE(_FOFF(slab, iChild1) == KSlabChild1Offset);
-__ASSERT_COMPILE(_FOFF(slab, iChild2) == KSlabChild2Offset);
-__ASSERT_COMPILE(_FOFF(slab, iPayload) == KSlabPayloadOffset);
-__ASSERT_COMPILE(sizeof(slabset) == KSlabsetSize);
-#endif
-
-TInt RAllocatorHelper::TryLock()
-	{
-#ifdef __KERNEL_MODE__
-	NKern::ThreadEnterCS();
-	DMutex* m = *(DMutex**)(iAllocatorAddress + _FOFF(RHackHeap, iLock));
-	if (m) Kern::MutexWait(*m);
-	return KErrNone;
-#else
-	if (iAllocatorType != EUnknown && iAllocatorType != EAllocator)
-		{
-		RFastLock& lock = *reinterpret_cast<RFastLock*>(iAllocatorAddress + _FOFF(RHackHeap, iLock));
-		lock.Wait();
-		return KErrNone;
-		}
-	return KErrNotSupported;
-#endif
-	}
-
-void RAllocatorHelper::TryUnlock()
-	{
-#ifdef __KERNEL_MODE__
-	DMutex* m = *(DMutex**)(iAllocatorAddress + _FOFF(RHackHeap, iLock));
-	if (m) Kern::MutexSignal(*m);
-	NKern::ThreadLeaveCS();
-#else
-	if (iAllocatorType != EUnknown && iAllocatorType != EAllocator)
-		{
-		RFastLock& lock = *reinterpret_cast<RFastLock*>(iAllocatorAddress + _FOFF(RHackHeap, iLock));
-		lock.Signal();
-		}
-#endif
-	}
-
-HUEXPORT_C void RAllocatorHelper::Close()
-	{
-	KERN_ENTER_CS();
-	iAllocatorType = EUnknown;
-	iAllocatorAddress = 0;
-	delete iInfo;
-	iInfo = NULL;
-	iValidInfo = 0;
-	MEM::Free(iTempSlabBitmap);
-	iTempSlabBitmap = NULL;
-	MEM::Free(iPageCache);
-	iPageCache = NULL;
-	iPageCacheAddr = 0;
-	KERN_LEAVE_CS();
-	}
-
-TInt RAllocatorHelper::IdentifyAllocatorType(TBool aAllocatorIsUdeb)
-	{
-	iAllocatorType = EUnknown;
-
-	TUint32 handlesPtr = 0;
-	TInt err = ReadWord(iAllocatorAddress + _FOFF(RHackAllocator, iHandles), handlesPtr);
-
-	if (err) return err;
-	if (handlesPtr == iAllocatorAddress + _FOFF(RHackHeap, iChunkHandle) || handlesPtr == iAllocatorAddress + _FOFF(RHackHeap, iLock))
-		{
-		// It's an RHeap of some kind - I doubt any other RAllocator subclass will use iHandles in this way
-		TUint32 base = 0;
-		err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iBase), base);
-		if (err) return err;
-		TInt objsize = (TInt)base - (TInt)iAllocatorAddress;
-		if (objsize <= 32*4)
-			{
-			// Old RHeap
-			iAllocatorType = aAllocatorIsUdeb ? EUdebOldRHeap : EUrelOldRHeap;
-			}
-		else
-			{
-			// new hybrid heap - bigger than the old one. Likewise figure out if udeb or urel.
-			iAllocatorType = aAllocatorIsUdeb ? EUdebHybridHeap : EUrelHybridHeap;
-			}
-		}
-	else
-		{
-		iAllocatorType = EAllocator;
-		}
-	return KErrNone;
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::SetCellNestingLevel(TAny* aCell, TInt aNestingLevel)
-	{
-	TInt err = KErrNone;
-
-	switch (iAllocatorType)
-		{
-		case EUdebOldRHeap:
-		case EUdebHybridHeap:
-			// By this reckoning, they're in the same place amazingly
-			{
-			TLinAddr nestingAddr = (TLinAddr)aCell - 8;
-			err = WriteWord(nestingAddr, aNestingLevel);
-			break;
-			}
-		default:
-			break;
-		}
-	return err;
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::GetCellNestingLevel(TAny* aCell, TInt& aNestingLevel)
-	{
-	switch (iAllocatorType)
-		{
-		case EUdebOldRHeap:
-		case EUdebHybridHeap:
-			// By this reckoning, they're in the same place amazingly
-			{
-			TLinAddr nestingAddr = (TLinAddr)aCell - 8;
-			return ReadWord(nestingAddr, (TUint32&)aNestingLevel);
-			}
-		default:
-			return KErrNotSupported;
-		}
-	}
-
-TInt RAllocatorHelper::RefreshDetails(TUint aMask)
-	{
-	TInt err = FinishConstruction();
-	if (err) return err;
-
-	// Invalidate the page cache
-	iPageCacheAddr = 0;
-
-	TryLock();
-	err = DoRefreshDetails(aMask);
-	TryUnlock();
-	return err;
-	}
-
-const TInt KHeapWalkStatsForOldHeap = (EUnusedPages|ECommittedFreeSpace);
-const TInt KHeapWalkStatsForNewHeap = (EAllocated|ECount|EUnusedPages|ECommittedFreeSpace|EHybridStats);
-
-TInt RAllocatorHelper::DoRefreshDetails(TUint aMask)
-	{
-	TInt err = KErrNotSupported;
-	switch (iAllocatorType)
-		{
-		case EUrelOldRHeap:
-		case EUdebOldRHeap:
-			{
-			if (aMask & ECommitted)
-				{
-				// The old RHeap::Size() used to use iTop - iBase, which was effectively chunkSize - sizeof(RHeap)
-				// I think that for CommittedSize we should include the size of the heap object, just as it includes
-				// the size of heap cell metadata and overhead. Plus it makes sure the committedsize is a multiple of the page size
-				TUint32 top = 0;
-				//TUint32 base = 0;
-				//err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iBase), base);
-				//if (err) return err;
-				err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iTop), top);
-				if (err) return err;
-
-				//iInfo->iCommittedSize = top - base;
-				iInfo->iCommittedSize = top - iAllocatorAddress;
-				iValidInfo |= ECommitted;
-				}
-			if (aMask & EAllocated)
-				{
-				TUint32 allocSize = 0;
-				err = ReadWord(iAllocatorAddress + _FOFF(RHackAllocator, iTotalAllocSize), allocSize);
-				if (err) return err;
-				iInfo->iAllocatedSize = allocSize;
-				iValidInfo |= EAllocated;
-				}
-			if (aMask & ECount)
-				{
-				TUint32 count = 0;
-				err = ReadWord(iAllocatorAddress + _FOFF(RHackAllocator, iCellCount), count);
-				if (err) return err;
-				iInfo->iAllocationCount = count;
-				iValidInfo |= ECount;
-				}
-			if (aMask & EMaxSize)
-				{
-				TUint32 maxlen = 0;
-				err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iMaxLength), maxlen);
-				if (err) return err;
-				iInfo->iMaxCommittedSize = maxlen;
-				iValidInfo |= EMaxSize;
-				}
-			if (aMask & EMinSize)
-				{
-				TUint32 minlen = 0;
-				err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iMaxLength) - 4, minlen); // This isn't a typo! iMinLength is 4 bytes before iMaxLength, on old heap ONLY
-				if (err) return err;
-				iInfo->iMinCommittedSize = minlen;
-				iValidInfo |= EMinSize;
-				}
-			if (aMask & KHeapWalkStatsForOldHeap)
-				{
-				// Need a heap walk
-				iInfo->ClearStats();
-				iValidInfo = 0;
-				err = DoWalk(&WalkForStats, NULL);
-				if (err == KErrNone) iValidInfo |= KHeapWalkStatsForOldHeap;
-				}
-			return err;
-			}
-		case EUrelHybridHeap:
-		case EUdebHybridHeap:
-			{
-			TBool needWalk = EFalse;
-			if (aMask & ECommitted)
-				{
-				// RAllocator::Size uses iChunkSize - sizeof(RHybridHeap);
-				// We can't do exactly the same, because we can't calculate sizeof(RHybridHeap), only ROUND_UP(sizeof(RHybridHeap), iAlign)
-				// And if fact we don't bother and just use iChunkSize
-				TUint32 chunkSize = 0;
-				err = ReadWord(iAllocatorAddress + KChunkSizeOffset, chunkSize);
-				if (err) return err;
-				//TUint32 baseAddr = 0;
-				//err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iBase), baseAddr);
-				//if (err) return err;
-				iInfo->iCommittedSize = chunkSize; // - (baseAddr - iAllocatorAddress);
-				iValidInfo |= ECommitted;
-				}
-			if (aMask & (EAllocated|ECount))
-				{
-				if (iAllocatorType == EUdebHybridHeap)
-					{
-					// Easy, just get them from the counter
-					TUint32 totalAlloc = 0;
-					err = ReadWord(iAllocatorAddress + _FOFF(RHackAllocator, iTotalAllocSize), totalAlloc);
-					if (err) return err;
-					iInfo->iAllocatedSize = totalAlloc;
-					iValidInfo |= EAllocated;
-
-					TUint32 cellCount = 0;
-					err = ReadWord(iAllocatorAddress + _FOFF(RHackAllocator, iCellCount), cellCount);
-					if (err) return err;
-					iInfo->iAllocationCount = cellCount;
-					iValidInfo |= ECount;
-					}
-				else
-					{
-					// A heap walk is needed
-					needWalk = ETrue;
-					}
-				}
-			if (aMask & EMaxSize)
-				{
-				TUint32 maxlen = 0;
-				err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iMaxLength), maxlen);
-				if (err) return err;
-				iInfo->iMaxCommittedSize = maxlen;
-				iValidInfo |= EMaxSize;
-				}
-			if (aMask & EMinSize)
-				{
-				TUint32 minlen = 0;
-				err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iAlign) + 4*4, minlen); // iMinLength is in different place to old RHeap
-				if (err) return err;
-				iInfo->iMinCommittedSize = minlen;
-				iValidInfo |= EMinSize;
-				}
-			if (aMask & (EUnusedPages|ECommittedFreeSpace|EHybridStats))
-				{
-				// EAllocated and ECount have already been taken care of above
-				needWalk = ETrue;
-				}
-
-			if (needWalk)
-				{
-				iInfo->ClearStats();
-				iValidInfo = 0;
-				err = DoWalk(&WalkForStats, NULL);
-				if (err == KErrNone) iValidInfo |= KHeapWalkStatsForNewHeap;
-				}
-			return err;
-			}
-		default:
-			return KErrNotSupported;
-		}
-	}
-
-TInt RAllocatorHelper::CheckValid(TUint aMask)
-	{
-	if ((iValidInfo & aMask) == aMask)
-		{
-		return KErrNone;
-		}
-	else
-		{
-		return RefreshDetails(aMask);
-		}
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::CommittedSize()
-	{
-	TInt err = CheckValid(ECommitted);
-	if (err) return err;
-	return iInfo->iCommittedSize;
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::AllocatedSize()
-	{
-	TInt err = CheckValid(EAllocated);
-	if (err) return err;
-	return iInfo->iAllocatedSize;
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::AllocationCount()
-	{
-	TInt err = CheckValid(ECount);
-	if (err) return err;
-	return iInfo->iAllocationCount;
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::RefreshDetails()
-	{
-	return RefreshDetails(iValidInfo);
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::MaxCommittedSize()
-	{
-	TInt err = CheckValid(EMaxSize);
-	if (err) return err;
-	return iInfo->iMaxCommittedSize;
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::MinCommittedSize()
-	{
-	TInt err = CheckValid(EMinSize);
-	if (err) return err;
-	return iInfo->iMinCommittedSize;
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::AllocCountForCell(TAny* aCell) const
-	{
-	TUint32 allocCount = 0;
-	switch (iAllocatorType)
-		{
-		case EUdebOldRHeap:
-		case EUdebHybridHeap: // Both are in the same place, amazingly
-			{
-			TLinAddr allocCountAddr = (TLinAddr)aCell - 4;
-			TInt err = ReadWord(allocCountAddr, allocCount);
-			if (err) return err;
-			return (TInt)allocCount;
-			}
-		default:
-			return KErrNotSupported;
-		}
-	}
-
-struct SContext3
-	{
-	RAllocatorHelper::TWalkFunc3 iOrigWalkFn;
-	TAny* iOrigContext;
-	};
-
-TBool RAllocatorHelper::DispatchClientWalkCallback(RAllocatorHelper& aHelper, TAny* aContext, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellPtr, TInt aCellLength)
-	{
-	WalkForStats(aHelper, NULL, aCellType, aCellPtr, aCellLength);
-	SContext3* context = static_cast<SContext3*>(aContext);
-	return (*context->iOrigWalkFn)(aHelper, context->iOrigContext, aCellType, aCellPtr, aCellLength);
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::Walk(TWalkFunc3 aCallbackFn, TAny* aContext)
-	{
-	// Might as well take the opportunity of updating our stats at the same time as walking the heap for the client
-	SContext3 context = { aCallbackFn, aContext };
-
-	TInt err = FinishConstruction(); // In case this hasn't been done yet
-	if (err) return err;
-
-	TryLock();
-	err = DoWalk(&DispatchClientWalkCallback, &context);
-	TryUnlock();
-	return err;
-	}
-
-TInt RAllocatorHelper::DoWalk(TWalkFunc3 aCallbackFn, TAny* aContext)
-	{
-	TInt err = KErrNotSupported;
-	switch (iAllocatorType)
-		{
-		case EUdebOldRHeap:
-		case EUrelOldRHeap:
-			err = OldSkoolWalk(aCallbackFn, aContext);
-			break;
-		case EUrelHybridHeap:
-		case EUdebHybridHeap:
-			err = NewHotnessWalk(aCallbackFn, aContext);
-			break;
-		default:
-			err = KErrNotSupported;
-			break;
-		}
-	return err;
-	}
-
-struct SContext
-	{
-	RAllocatorHelper::TWalkFunc iOrigWalkFn;
-	TAny* iOrigContext;
-	};
-
-struct SContext2
-	{
-	RAllocatorHelper::TWalkFunc2 iOrigWalkFn;
-	TAny* iOrigContext;
-	};
-
-#define New2Old(aNew) (((aNew)&RAllocatorHelper::EAllocationMask) ? RAllocatorHelper::EAllocation : ((aNew)&RAllocatorHelper::EFreeMask) ? RAllocatorHelper::EFreeSpace : RAllocatorHelper::EBadness)
-
-TBool DispatchOldTWalkFuncCallback(RAllocatorHelper& /*aHelper*/, TAny* aContext, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellPtr, TInt aCellLength)
-	{
-	SContext* context = static_cast<SContext*>(aContext);
-	return (*context->iOrigWalkFn)(context->iOrigContext, New2Old(aCellType), aCellPtr, aCellLength);
-	}
-
-TBool DispatchOldTWalk2FuncCallback(RAllocatorHelper& aHelper, TAny* aContext, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellPtr, TInt aCellLength)
-	{
-	SContext2* context = static_cast<SContext2*>(aContext);
-	return (*context->iOrigWalkFn)(aHelper, context->iOrigContext, New2Old(aCellType), aCellPtr, aCellLength);
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::Walk(TWalkFunc aCallbackFn, TAny* aContext)
-	{
-	// For backwards compatability insert a compatability callback to map between the different types of callback that clients requested
-	SContext context = { aCallbackFn, aContext };
-	return Walk(&DispatchOldTWalkFuncCallback, &context);
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::Walk(TWalkFunc2 aCallbackFn, TAny* aContext)
-	{
-	SContext2 context = { aCallbackFn, aContext };
-	return Walk(&DispatchOldTWalk2FuncCallback, &context);
-	}
-
-
-TInt RAllocatorHelper::OldSkoolWalk(TWalkFunc3 aCallbackFn, TAny* aContext)
-	{
-	TLinAddr pC = 0;
-	TInt err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iBase), pC); // pC = iBase; // allocated cells
-	if (err) return err;
-	TLinAddr pF = iAllocatorAddress + _FOFF(RHackHeap, iAlign) + 3*4; // pF = &iFree; // free cells
-
-	TLinAddr top = 0;
-	err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iTop), top);
-	if (err) return err;
-	const TInt KAllocatedCellHeaderSize = iAllocatorType == EUdebOldRHeap ? 12 : 4;
-	TInt minCell = 0;
-	err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iAlign) + 4, (TUint32&)minCell);
-	if (err) return err;
-	TInt align = 0;
-	err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iAlign), (TUint32&)align);
-	if (err) return err;
-
-	FOREVER
-		{
-		err = ReadWord(pF+4, pF); // pF = pF->next; // next free cell
-		if (err) return err;
-		TLinAddr pFnext = 0;
-		if (pF) err = ReadWord(pF + 4, pFnext);
-		if (err) return err;
-
-		if (!pF)
-			{
-			pF = top; // to make size checking work
-			}
-		else if (pF>=top || (pFnext && pFnext<=pF) )
-			{
-			// free cell pointer off the end or going backwards
-			//Unlock();
-			(*aCallbackFn)(*this, aContext, EHeapBadFreeCellAddress, pF, 0);
-			return KErrCorrupt;
-			}
-		else
-			{
-			TInt l; // = pF->len
-			err = ReadWord(pF, (TUint32&)l);
-			if (err) return err;
-			if (l<minCell || (l & (align-1)))
-				{
-				// free cell length invalid
-				//Unlock();
-				(*aCallbackFn)(*this, aContext, EHeapBadFreeCellSize, pF, l);
-				return KErrCorrupt;
-				}
-			}
-		while (pC!=pF)				// walk allocated cells up to next free cell
-			{
-			TInt l; // pC->len;
-			err = ReadWord(pC, (TUint32&)l);
-			if (err) return err;
-			if (l<minCell || (l & (align-1)))
-				{
-				// allocated cell length invalid
-				//Unlock();
-				(*aCallbackFn)(*this, aContext, EHeapBadAllocatedCellSize, pC, l);
-				return KErrCorrupt;
-				}
-			TBool shouldContinue = (*aCallbackFn)(*this, aContext, EHeapAllocation, pC + KAllocatedCellHeaderSize, l - KAllocatedCellHeaderSize);
-			if (!shouldContinue) return KErrNone;
-			
-			//SCell* pN = __NEXT_CELL(pC);
-			TLinAddr pN = pC + l;
-			if (pN > pF)
-				{
-				// cell overlaps next free cell
-				//Unlock();
-				(*aCallbackFn)(*this, aContext, EHeapBadAllocatedCellAddress, pC, l);
-				return KErrCorrupt;
-				}
-			pC = pN;
-			}
-		if (pF == top)
-			break;		// reached end of heap
-		TInt pFlen = 0;
-		err = ReadWord(pF, (TUint32&)pFlen);
-		if (err) return err;
-		pC = pF + pFlen; // pC = __NEXT_CELL(pF);	// step to next allocated cell
-		TBool shouldContinue = (*aCallbackFn)(*this, aContext, EHeapFreeCell, pF, pFlen);
-		if (!shouldContinue) return KErrNone;
-		}
-	return KErrNone;
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::CountUnusedPages()
-	{
-	TInt err = CheckValid(EUnusedPages);
-	if (err) return err;
-	return iInfo->iUnusedPages;
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::CommittedFreeSpace()
-	{
-	TInt err = CheckValid(ECommittedFreeSpace);
-	if (err) return err;
-	return iInfo->iCommittedFreeSpace;
-	}
-
-#define ROUND_DOWN(val, pow2) ((val) & ~((pow2)-1))
-#define ROUND_UP(val, pow2) ROUND_DOWN((val) + (pow2) - 1, (pow2))
-
-HUEXPORT_C TLinAddr RAllocatorHelper::AllocatorAddress() const
-	{
-	return iAllocatorAddress;
-	}
-
-TBool RAllocatorHelper::WalkForStats(RAllocatorHelper& aSelf, TAny* /*aContext*/, TExtendedCellType aType, TLinAddr aCellPtr, TInt aCellLength)
-	{
-	//ASSERT(aCellLength >= 0);
-	THeapInfo& info = *aSelf.iInfo;
-
-	TInt pagesSpanned = 0; // The number of pages that fit entirely inside the payload of this cell
-	if ((TUint)aCellLength > KPageSize)
-		{
-		TLinAddr nextPageAlignedAddr = ROUND_UP(aCellPtr, KPageSize);
-		pagesSpanned = ROUND_DOWN(aCellPtr + aCellLength - nextPageAlignedAddr, KPageSize) / KPageSize;
-		}
-
-	if (aSelf.iAllocatorType == EUrelOldRHeap || aSelf.iAllocatorType == EUdebOldRHeap)
-		{
-		if (aType & EFreeMask)
-			{
-			info.iUnusedPages += pagesSpanned;
-			info.iCommittedFreeSpace += aCellLength;
-			info.iHeapFreeCellCount++;
-			}
-		}
-	else
-		{
-		if (aType & EAllocationMask)
-			{
-			info.iAllocatedSize += aCellLength;
-			info.iAllocationCount++;
-			}
-		else if (aType & EFreeMask)
-			{
-			// I *think* that DLA will decommit pages from inside free cells...
-			TInt committedLen = aCellLength - (pagesSpanned * KPageSize);
-			info.iCommittedFreeSpace += committedLen;
-			}
-
-		switch (aType)
-			{
-			case EDlaAllocation:
-				info.iDlaAllocsSize += aCellLength;
-				info.iDlaAllocsCount++;
-				break;
-			case EPageAllocation:
-				info.iPageAllocsSize += aCellLength;
-				info.iPageAllocsCount++;
-				break;
-			case ESlabAllocation:
-				info.iSlabAllocsSize += aCellLength;
-				info.iSlabAllocsCount++;
-				break;
-			case EDlaFreeCell:
-				info.iDlaFreeSize += aCellLength;
-				info.iDlaFreeCount++;
-				break;
-			case ESlabFreeCell:
-				info.iSlabFreeCellSize += aCellLength;
-				info.iSlabFreeCellCount++;
-				break;
-			case ESlabFreeSlab:
-				info.iSlabFreeSlabSize += aCellLength;
-				info.iSlabFreeSlabCount++;
-				break;
-			default:
-				break;
-			}
-		}
-
-	return ETrue;
-	}
-
-#define PAGESHIFT 12
-
-TUint RAllocatorHelper::PageMapOperatorBrackets(unsigned ix, TInt& err) const
-	{
-	//return 1U&(iBase[ix>>3] >> (ix&7));
-	TUint32 basePtr = 0;
-	err = ReadWord(iAllocatorAddress + KPageMapOffset, basePtr);
-	if (err) return 0;
-
-	TUint8 res = 0;
-	err = ReadByte(basePtr + (ix >> 3), res);
-	if (err) return 0;
-
-	return 1U&(res >> (ix&7));
-	}
-
-
-TInt RAllocatorHelper::PageMapFind(TUint start, TUint bit, TInt& err)
-	{
-	TUint32 iNbits = 0;
-	err = ReadWord(iAllocatorAddress + KPageMapOffset + 4, iNbits);
-	if (err) return 0;
-
-	if (start<iNbits) do
-		{
-		//if ((*this)[start]==bit)
-		if (PageMapOperatorBrackets(start, err) == bit || err)
-			return start;
-		} while (++start<iNbits);
-	return -1;
-	}
-
-TUint RAllocatorHelper::PagedDecode(TUint pos, TInt& err)
-	{
-	unsigned bits = PageMapBits(pos,2,err);
-	if (err) return 0;
-	bits >>= 1;
-	if (bits == 0)
-		return 1;
-	bits = PageMapBits(pos+2,2,err);
-	if (err) return 0;
-	if ((bits & 1) == 0)
-		return 2 + (bits>>1);
-	else if ((bits>>1) == 0)
-		{
-		return PageMapBits(pos+4, 4,err);
-		}
-	else
-		{
-		return PageMapBits(pos+4, 18,err);
-		}
-	}
-
-TUint RAllocatorHelper::PageMapBits(unsigned ix, unsigned len, TInt& err)
-	{
-	int l=len;
-	unsigned val=0;
-	unsigned bit=0;
-	while (--l>=0)
-		{
-		//val |= (*this)[ix++]<<bit++;
-		val |= PageMapOperatorBrackets(ix++, err) << bit++;
-		if (err) return 0;
-		}
-	return val;
-	}
-
-enum TSlabType { ESlabFullInfo, ESlabPartialInfo, ESlabEmptyInfo };
-
-#ifndef TEST_HYBRIDHEAP_ASSERTS
-#define MAXSLABSIZE		56
-#define	SLABSHIFT		10
-#define	SLABSIZE		(1 << SLABSHIFT)
-const TInt KMaxSlabPayload = SLABSIZE - KSlabPayloadOffset;
-#endif
-
-TInt RAllocatorHelper::NewHotnessWalk(TWalkFunc3 aCallbackFn, TAny* aContext)
-	{
-	// RHybridHeap does paged, slab then DLA, so that's what we do too
-	// Remember Kernel RHybridHeaps don't even have the page and slab members
-
-	TUint32 basePtr;
-	TInt err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iBase), basePtr);
-	if (err) return err;
-	if (basePtr < iAllocatorAddress + KUserHybridHeapSize)
-		{
-		// Must be a kernel one - don't do page and slab
-		}
-	else
-		{
-		// Paged
-		TUint32 membase = 0;
-		err = ReadWord(iAllocatorAddress + KPageMapOffset + 8, membase);
-		if (err) return err;
-
-		TBool shouldContinue = ETrue;
-		for (int ix = 0;(ix = PageMapFind(ix,1,err)) >= 0 && err == KErrNone;)
-			{
-			int npage = PagedDecode(ix, err);
-			if (err) return err;
-			// Introduce paged buffer to the walk function 
-			TLinAddr bfr = membase + (1 << (PAGESHIFT-1))*ix;
-			int len = npage << PAGESHIFT;
-			if ( (TUint)len > KPageSize )
-				{ // If buffer is not larger than one page it must be a slab page mapped into bitmap
-				if (iAllocatorType == EUdebHybridHeap)
-					{
-					bfr += 8;
-					len -= 8;
-					}
-				shouldContinue = (*aCallbackFn)(*this, aContext, EPageAllocation, bfr, len);
-				if (!shouldContinue) return KErrNone;
-				}
-			ix += (npage<<1);
-			}
-		if (err) return err;
-
-		// Slab
-		TUint32 sparePage = 0;
-		err = ReadWord(iAllocatorAddress + KSparePageOffset, sparePage);
-		if (err) return err;
-		if (sparePage)
-			{
-			//Walk(wi, iSparePage, iPageSize, EGoodFreeCell, ESlabSpare); // Introduce Slab spare page to the walk function 
-			// This counts as 4 spare slabs
-			for (TInt i = 0; i < 4; i++)
-				{
-				shouldContinue = (*aCallbackFn)(*this, aContext, ESlabFreeSlab, sparePage + SLABSIZE*i, SLABSIZE);
-				if (!shouldContinue) return KErrNone;
-				}
-			}
-
-		//TreeWalk(&iFullSlab, &SlabFullInfo, i, wi);
-		TInt err = TreeWalk(iAllocatorAddress + KFullSlabOffset, ESlabFullInfo, aCallbackFn, aContext, shouldContinue);
-		if (err || !shouldContinue) return err;
-		for (int ix = 0; ix < (MAXSLABSIZE>>2); ++ix)
-			{
-			TUint32 partialAddr = iAllocatorAddress + KSlabAllocOffset + ix*KSlabsetSize;
-			//TreeWalk(&iSlabAlloc[ix].iPartial, &SlabPartialInfo, i, wi);
-			err = TreeWalk(partialAddr, ESlabPartialInfo, aCallbackFn, aContext, shouldContinue);
-			if (err || !shouldContinue) return err;
-			}
-		//TreeWalk(&iPartialPage, &SlabEmptyInfo, i, wi);
-		TreeWalk(iAllocatorAddress + KPartialPageOffset, ESlabEmptyInfo, aCallbackFn, aContext, shouldContinue);
-		}
-
-	// DLA
-#define CHUNK_OVERHEAD (sizeof(TUint))
-#define CHUNK_ALIGN_MASK (7) 
-#define CHUNK2MEM(p)        ((TLinAddr)(p) + 8)
-#define MEM2CHUNK(mem)      ((TLinAddr)(p) - 8)
-/* chunk associated with aligned address A */
-#define ALIGN_OFFSET(A)\
-	((((TLinAddr)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
-	((8 - ((TLinAddr)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))
-#define ALIGN_AS_CHUNK(A)   ((A) + ALIGN_OFFSET(CHUNK2MEM(A)))
-#define CINUSE_BIT 2
-#define INUSE_BITS 3
-
-	TUint32 topSize = 0;
-	err = ReadWord(iAllocatorAddress + KMallocStateOffset + KMallocStateTopSizeOffset, topSize);
-	if (err) return err;
-
-	TUint32 top = 0;
-	err = ReadWord(iAllocatorAddress + KMallocStateOffset + KMallocStateTopOffset, top);
-	if (err) return err;
-
-	TInt max = ((topSize-1) & ~CHUNK_ALIGN_MASK) - CHUNK_OVERHEAD;
-	if ( max < 0 )
-		max = 0;
-	
-	TBool shouldContinue = (*aCallbackFn)(*this, aContext, EDlaFreeCell, top, max);
-	if (!shouldContinue) return KErrNone;
-	
-	TUint32 mallocStateSegBase = 0;
-	err = ReadWord(iAllocatorAddress + KMallocStateOffset + KMallocStateSegOffset, mallocStateSegBase);
-	if (err) return err;
-
-	for (TLinAddr q = ALIGN_AS_CHUNK(mallocStateSegBase); q != top; /*q = NEXT_CHUNK(q)*/)
-		{
-		TUint32 qhead = 0;
-		err = ReadWord(q + 4, qhead);
-		if (err) return err;
-		//TInt sz = CHUNKSIZE(q);
-		TInt sz = qhead & ~(INUSE_BITS);
-		if (!(qhead & CINUSE_BIT))
-			{
-			//Walk(wi, CHUNK2MEM(q), sz, EGoodFreeCell, EDougLeaAllocator); // Introduce DL free buffer to the walk function 
-			shouldContinue = (*aCallbackFn)(*this, aContext, EDlaFreeCell, CHUNK2MEM(q), sz);
-			if (!shouldContinue) return KErrNone;
-			}
-		else
-			{
-			//Walk(wi, CHUNK2MEM(q), (sz- CHUNK_OVERHEAD), EGoodAllocatedCell, EDougLeaAllocator); // Introduce DL allocated buffer to the walk function 
-			TLinAddr addr = CHUNK2MEM(q);
-			TInt size = sz - CHUNK_OVERHEAD;
-			if (iAllocatorType == EUdebHybridHeap)
-				{
-				size -= 8;
-				addr += 8;
-				}
-			shouldContinue = (*aCallbackFn)(*this, aContext, EDlaAllocation, addr, size);
-			if (!shouldContinue) return KErrNone;
-			}
-		// This is q = NEXT_CHUNK(q) expanded
-		q = q + sz;
-		}
-	return KErrNone;
-	}
-
-TInt RAllocatorHelper::TreeWalk(TUint32 aSlabRoot, TInt aSlabType, TWalkFunc3 aCallbackFn, TAny* aContext, TBool& shouldContinue)
-	{
-	const TSlabType type = (TSlabType)aSlabType;
-
-	TUint32 s = 0;
-	TInt err = ReadWord(aSlabRoot, s);
-	if (err) return err;
-	//slab* s = *root;
-	if (!s)
-		return KErrNone;
-	
-	for (;;)
-		{
-		//slab* c;
-		//while ((c = s->iChild1) != 0)
-		//	s = c;		// walk down left side to end
-		TUint32 c;
-		for(;;)
-			{
-			err = ReadWord(s + KSlabChild1Offset, c);
-			if (err) return err;
-			if (c == 0) break;
-			else s = c;
-			}
-		for (;;)
-			{
-			//TODOf(s, i, wi);
-			//TODO __HEAP_CORRUPTED_TEST_STATIC
-			TUint32 h;
-			err = ReadWord(s, h); // = aSlab->iHeader;
-			if (err) return err;
-			TUint32 size = (h&0x0003f000)>>12; //SlabHeaderSize(h);
-			TUint debugheadersize = 0;
-			if (iAllocatorType == EUdebHybridHeap) debugheadersize = 8;
-			TUint32 usedCount = (((h&0x0ffc0000)>>18) + 4) / size; // (SlabHeaderUsedm4(h) + 4) / size;
-			switch (type)
-				{
-				case ESlabFullInfo:
-					{
-					TUint32 count = usedCount;
-					TUint32 i = 0;
-					while ( i < count )
-						{
-						TUint32 addr = s + KSlabPayloadOffset + i*size; //&aSlab->iPayload[i*size];
-						shouldContinue = (*aCallbackFn)(*this, aContext, ESlabAllocation, addr + debugheadersize, size - debugheadersize);
-						if (!shouldContinue) return KErrNone;
-						i++;
-						}
-					break;
-					}
-				case ESlabPartialInfo:
-					{
-					//TODO __HEAP_CORRUPTED_TEST_STATIC
-					TUint32 count = KMaxSlabPayload / size;
-					TUint32 freeOffset = (h & 0xff) << 2;
-					if (freeOffset == 0)
-						{
-						// TODO Shouldn't happen for a slab on the partial list
-						}
-					memset(iTempSlabBitmap, 1, KTempBitmapSize); // Everything defaults to in use
-					TUint wildernessCount = count - usedCount;
-					while (freeOffset)
-						{
-						wildernessCount--;
-						TInt idx = (freeOffset-KSlabPayloadOffset)/size;
-						LOG("iTempSlabBitmap freeOffset %d index %d", freeOffset, idx);
-						iTempSlabBitmap[idx] = 0; // Mark it as free
-
-						TUint32 addr = s + freeOffset;
-						TUint8 nextCell = 0;
-						err = ReadByte(addr, nextCell);
-						if (err) return err;
-						freeOffset = ((TUint32)nextCell) << 2;
-						}
-					memset(iTempSlabBitmap + count - wildernessCount, 0, wildernessCount); // Mark the wilderness as free
-					for (TInt i = 0; i < count; i++)
-						{
-						TLinAddr addr = s + KSlabPayloadOffset + i*size;
-						if (iTempSlabBitmap[i])
-							{
-							// In use
-							shouldContinue = (*aCallbackFn)(*this, aContext, ESlabAllocation, addr + debugheadersize, size - debugheadersize);
-							}
-						else
-							{
-							// Free
-							shouldContinue = (*aCallbackFn)(*this, aContext, ESlabFreeCell, addr, size);
-							}
-						if (!shouldContinue) return KErrNone;
-						}
-					break;
-					}
-				case ESlabEmptyInfo:
-					{
-					// Check which slabs of this page are empty
-					TUint32 pageAddr = ROUND_DOWN(s, KPageSize);
-					TUint32 headerForPage = 0;
-					err = ReadWord(pageAddr, headerForPage);
-					if (err) return err;
-					TUint32 slabHeaderPageMap = (headerForPage & 0x00000f00)>>8; // SlabHeaderPagemap(unsigned h)
-					for (TInt slabIdx = 0; slabIdx < 4; slabIdx++)
-						{
-						if (slabHeaderPageMap & (1<<slabIdx))
-							{
-							TUint32 addr = pageAddr + SLABSIZE*slabIdx + KSlabPayloadOffset; //&aSlab->iPayload[i*size];
-							shouldContinue = (*aCallbackFn)(*this, aContext, ESlabFreeSlab, addr, KMaxSlabPayload);
-							if (!shouldContinue) return KErrNone;
-							}
-						}
-					break;
-					}
-				}
-
-			//c = s->iChild2;
-			err = ReadWord(s + KSlabChild2Offset, c);
-			if (err) return err;
-
-			if (c)
-				{	// one step down right side, now try and walk down left
-				s = c;
-				break;
-				}
-			for (;;)
-				{	// loop to walk up right side
-				TUint32 pp = 0;
-				err = ReadWord(s + KSlabParentOffset, pp);
-				if (err) return err;
-				//slab** pp = s->iParent;
-				if (pp == aSlabRoot)
-					return KErrNone;
-#define SlabFor(x) ROUND_DOWN(x, SLABSIZE)
-				s = SlabFor(pp);
-				//if (pp == &s->iChild1)
-				if (pp == s + KSlabChild1Offset)
-					break;
-				}
-			}
-		}
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::SizeForCellType(TExtendedCellType aType)
-	{
-	if (aType & EBadnessMask) return KErrArgument;
-	if (aType == EAllocationMask) return AllocatedSize();
-
-	if (iAllocatorType == EUdebOldRHeap || iAllocatorType == EUrelOldRHeap)
-		{
-		switch (aType)
-			{
-			case EHeapAllocation:
-				return AllocatedSize();
-			case EHeapFreeCell:
-			case EFreeMask:
-				return CommittedFreeSpace();
-			default:
-				return KErrNotSupported;
-			}
-		}
-	else if (iAllocatorType == EUrelHybridHeap || iAllocatorType == EUdebHybridHeap)
-		{
-		TInt err = CheckValid(EHybridStats);
-		if (err) return err;
-
-		switch (aType)
-			{
-			case EHeapAllocation:
-			case EHeapFreeCell:
-				return KErrNotSupported;
-			case EDlaAllocation:
-				return iInfo->iDlaAllocsSize;
-			case EPageAllocation:
-				return iInfo->iPageAllocsSize;
-			case ESlabAllocation:
-				return iInfo->iSlabAllocsSize;
-			case EDlaFreeCell:
-				return iInfo->iDlaFreeSize;
-			case ESlabFreeCell:
-				return iInfo->iSlabFreeCellSize;
-			case ESlabFreeSlab:
-				return iInfo->iSlabFreeSlabSize;
-			case EFreeMask:
-				// Note this isn't the same as asking for CommittedFreeSpace(). SizeForCellType(EFreeMask) may include decommitted pages that lie inside a free cell
-				return iInfo->iDlaFreeSize + iInfo->iSlabFreeCellSize + iInfo->iSlabFreeSlabSize;
-			default:
-				return KErrNotSupported;
-			}
-		}
-	else
-		{
-		return KErrNotSupported;
-		}
-	}
-
-HUEXPORT_C TInt RAllocatorHelper::CountForCellType(TExtendedCellType aType)
-	{
-	if (aType & EBadnessMask) return KErrArgument;
-	if (aType == EAllocationMask) return AllocationCount();
-
-	if (iAllocatorType == EUdebOldRHeap || iAllocatorType == EUrelOldRHeap)
-		{
-		switch (aType)
-			{
-			case EHeapAllocation:
-				return AllocationCount();
-			case EHeapFreeCell:
-			case EFreeMask:
-				{
-				TInt err = CheckValid(ECommittedFreeSpace);
-				if (err) return err;
-				return iInfo->iHeapFreeCellCount;
-				}
-			default:
-				return KErrNotSupported;
-			}
-		}
-	else if (iAllocatorType == EUrelHybridHeap || iAllocatorType == EUdebHybridHeap)
-		{
-		TInt err = CheckValid(EHybridStats);
-		if (err) return err;
-
-		switch (aType)
-			{
-			case EHeapAllocation:
-			case EHeapFreeCell:
-				return KErrNotSupported;
-			case EDlaAllocation:
-				return iInfo->iDlaAllocsCount;
-			case EPageAllocation:
-				return iInfo->iPageAllocsCount;
-			case ESlabAllocation:
-				return iInfo->iSlabAllocsCount;
-			case EDlaFreeCell:
-				return iInfo->iDlaFreeCount;
-			case ESlabFreeCell:
-				return iInfo->iSlabFreeCellCount;
-			case ESlabFreeSlab:
-				return iInfo->iSlabFreeSlabCount;
-			case EFreeMask:
-				// This isn't a hugely meaningful value, but if that's what they asked for...
-				return iInfo->iDlaFreeCount + iInfo->iSlabFreeCellCount + iInfo->iSlabFreeSlabCount;
-			default:
-				return KErrNotSupported;
-			}
-		}
-	else
-		{
-		return KErrNotSupported;
-		}
-	}
-
-HUEXPORT_C TBool LtkUtils::RAllocatorHelper::AllocatorIsUdeb() const
-	{
-	return iAllocatorType == EUdebOldRHeap || iAllocatorType == EUdebHybridHeap;
-	}
-
-
-HUEXPORT_C const TDesC& LtkUtils::RAllocatorHelper::Description() const
-	{
-	_LIT(KRHeap, "RHeap");
-	_LIT(KRHybridHeap, "RHybridHeap");
-	_LIT(KUnknown, "Unknown");
-	switch (iAllocatorType)
-		{
-		case EUrelOldRHeap:
-		case EUdebOldRHeap:
-			return KRHeap;
-		case EUrelHybridHeap:
-		case EUdebHybridHeap:
-			return KRHybridHeap;
-		case EAllocator:
-		case EUnknown:
-		default:
-			return KUnknown;
-		}
-	}
-
-#ifdef __KERNEL_MODE__
-
-DChunk* LtkUtils::RAllocatorHelper::OpenUnderlyingChunk()
-	{
-	// Enter and leave in CS and with no locks held. On exit the returned DChunk has been Open()ed.
-	TInt err = iChunk->Open();
-	if (err) return NULL;
-	return iChunk;
-	}
-
-DChunk* LtkUtils::RKernelSideAllocatorHelper::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.
-	// It is for this reason that iChunk is private, to remove temptation
-	
-	// Enter and leave in CS and with no locks held. On exit the returned DChunk has been Open()ed.
-	TUint32 chunkHandle = 0;
-	TInt err = ReadData(iAllocatorAddress + _FOFF(RHackHeap, iChunkHandle), &chunkHandle, sizeof(TUint32));
-	if (err) return NULL;
-
-	NKern::LockSystem();
-	DChunk* result = (DChunk*)Kern::ObjectFromHandle(iThread, chunkHandle, EChunk);
-	if (result && result->Open() != KErrNone)
-		{
-		result = NULL;
-		}
-	NKern::UnlockSystem();
-	return result;
-	}
-
-LtkUtils::RAllocatorHelper::TType LtkUtils::RAllocatorHelper::GetType() const
-	{
-	switch (iAllocatorType)
-		{
-		case EUrelOldRHeap:
-		case EUdebOldRHeap:
-			return ETypeRHeap;
-		case EUrelHybridHeap:
-		case EUdebHybridHeap:
-			return ETypeRHybridHeap;
-		case EAllocator:
-		case EUnknown:
-		default:
-			return ETypeUnknown;
-		}
-	}
-
-#else
-
-TInt LtkUtils::RAllocatorHelper::EuserIsUdeb()
-	{
-	TAny* buf = User::Alloc(4096);
-	if (!buf) return KErrNoMemory;
-	RAllocator* dummyHeap = UserHeap::FixedHeap(buf, 4096, 4, ETrue);
-	if (!dummyHeap) return KErrNoMemory; // Don't think this can happen
-
-	dummyHeap->__DbgSetAllocFail(RAllocator::EFailNext, 1);
-	TAny* ptr = dummyHeap->Alloc(4);
-	// Because we specified singleThreaded=ETrue we can allow dummyHeap to just go out of scope here
-	User::Free(buf);
-
-	if (ptr)
-		{
-		// Clearly the __DbgSetAllocFail had no effect so we must be urel
-		// We don't need to free ptr because it came from the dummy heap
-		return EFalse;
-		}
-	else
-		{
-		return ETrue;
-		}
-	}
-
-#ifndef STANDALONE_ALLOCHELPER
-
-#include <fshell/ltkutils.h>
-HUEXPORT_C void LtkUtils::MakeHeapCellInvisible(TAny* aCell)
-	{
-	RAllocatorHelper helper;
-	TInt err = helper.Open(&User::Allocator());
-	if (err == KErrNone)
-		{
-		helper.SetCellNestingLevel(aCell, -1);
-		helper.Close();
-		}
-	}
-#endif // STANDALONE_ALLOCHELPER
-
-#endif
--- a/memspy/Driver/Shared/heaputils.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,216 +0,0 @@
-// heaputils.h
-// 
-// Copyright (c) 2010 Accenture. All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the "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:
-// Accenture - Initial contribution
-//
-
-
-#ifndef FSHELL_HEAP_UTILS_H
-#define FSHELL_HEAP_UTILS_H
-
-#include <e32cmn.h>
-
-#ifdef __KERNEL_MODE__
-class DThread;
-class DChunk;
-#else
-class RMemoryAccess;
-#endif // __KERNEL_MODE__
-
-#if defined(STANDALONE_ALLOCHELPER) || defined(__KERNEL_MODE__)
-#define HUIMPORT_C
-#define HUCLASS(x) NONSHARABLE_CLASS(x)
-#else
-#define HUIMPORT_C IMPORT_C
-#define HUCLASS(x) class x
-#endif
-
-namespace LtkUtils
-	{
-
-class THeapInfo;
-	
-HUCLASS(RAllocatorHelper) // class RAllocatorHelper
-	{
-public:
-	HUIMPORT_C RAllocatorHelper();
-#ifdef __KERNEL_MODE__
-	TInt OpenKernelHeap();
-#else
-	HUIMPORT_C TInt Open(RAllocator* aAllocator);
-#endif
-	HUIMPORT_C TInt SetCellNestingLevel(TAny* aCell, TInt aNestingLevel);
-	HUIMPORT_C TInt GetCellNestingLevel(TAny* aCell, TInt& aNestingLevel);
-	HUIMPORT_C TInt AllocCountForCell(TAny* aCell) const;
-	HUIMPORT_C TLinAddr AllocatorAddress() const;
-	HUIMPORT_C TInt RefreshDetails();
-	
-	HUIMPORT_C TInt CommittedSize();
-	HUIMPORT_C TInt AllocatedSize();
-	HUIMPORT_C TInt AllocationCount();
-	HUIMPORT_C TInt MaxCommittedSize();
-	HUIMPORT_C TInt MinCommittedSize();
-	HUIMPORT_C TInt CountUnusedPages();
-	HUIMPORT_C TInt CommittedFreeSpace();
-
-	enum TCellType
-		{
-		EAllocation, EFreeSpace, EBadness
-		};
-
-	enum TExtendedCellType
-		{
-		EAllocationMask = 0xFF,
-		EFreeMask = 0xFF00,
-		EBadnessMask = 0xFF000000,
-
-		EHeapAllocation = 1,
-		EDlaAllocation = 2,
-		EPageAllocation = 3,
-		ESlabAllocation = 4,
-		
-		EHeapFreeCell = 0x0100,
-		EDlaFreeCell = 0x0200,
-		// There is nothing 'free' in the page allocator
-		ESlabFreeCell = 0x0300, // Used to track free cells in partially-filled slabs
-		ESlabFreeSlab = 0x0400, // Used to track entirely empty slabs (that don't have a specific cell size)
-
-		EHeapBadFreeCellAddress = 0x01000000,
-		EHeapBadFreeCellSize = 0x02000000,
-		EHeapBadAllocatedCellSize = 0x03000000,
-		EHeapBadAllocatedCellAddress = 0x04000000,
-		};
-			
-	// TBool WalkFunc(TAny* aContext, TCellType aCellType, TLinAddr aCellPtr, TInt aCellLength)
-	// aCellPtr points to the start of the cell payload for allocated cells (unlike RHeap's walker, which points to the cell header)
-	// aCellLength is the payload length, ie what AllocLen(aCellPtr) would return
-	// return ETrue to continue walking, EFalse to stop the walk
-	typedef TBool (*TWalkFunc)(TAny*, TCellType, TLinAddr, TInt);
-	typedef TBool (*TWalkFunc2)(RAllocatorHelper&, TAny*, TCellType, TLinAddr, TInt);
-	typedef TBool (*TWalkFunc3)(RAllocatorHelper&, TAny*, TExtendedCellType, TLinAddr, TInt);
-	HUIMPORT_C TInt Walk(TWalkFunc aCallbackFn, TAny* aContext);
-	HUIMPORT_C TInt Walk(TWalkFunc2 aCallbackFn, TAny* aContext); // Like the other but the walk func gives you the RAllocatorHelper pointer too
-	HUIMPORT_C TInt Walk(TWalkFunc3 aCallbackFn, TAny* aContext); // Like the other but the walk func gives you more details about the allocation type
-	HUIMPORT_C TInt SizeForCellType(TExtendedCellType aType);
-	HUIMPORT_C TInt CountForCellType(TExtendedCellType aType);
-	HUIMPORT_C TBool AllocatorIsUdeb() const;
-	HUIMPORT_C const TDesC& Description() const;
-	HUIMPORT_C virtual void Close();
-
-#ifdef __KERNEL_MODE__
-	virtual DChunk* OpenUnderlyingChunk(); // Must be in CS
-	enum TType
-		{
-		ETypeUnknown,
-		ETypeRHeap,
-		ETypeRHybridHeap,
-		};
-	TType GetType() const; // This is for information only, nothing should care about the return value
-#endif
-
-protected:
-	TInt FinishConstruction();
-	TInt IdentifyAllocatorType(TBool aAllocatorIsUdeb);
-	TInt OpenChunkHeap(TLinAddr aChunkBase, TInt aChunkMaxSize);
-#ifndef __KERNEL_MODE__
-	static TInt EuserIsUdeb();
-#endif
-	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:
-	TInt ReadWord(TLinAddr aLocation, TUint32& aResult) const;
-	TInt ReadByte(TLinAddr aLocation, TUint8& aResult) const;
-	TInt WriteWord(TLinAddr aLocation, TUint32 aWord);
-	TInt RefreshDetails(TUint aMask);
-	TInt DoRefreshDetails(TUint aMask);
-	TInt CheckValid(TUint aMask);
-	TInt DoWalk(TWalkFunc3 aCallbackFn, TAny* aContext);
-	TInt OldSkoolWalk(TWalkFunc3 aCallbackFn, TAny* aContext);
-	TInt NewHotnessWalk(TWalkFunc3 aCallbackFn, TAny* aContext);
-	static TBool DispatchClientWalkCallback(RAllocatorHelper& aHelper, TAny* aContext, TExtendedCellType aCellType, TLinAddr aCellPtr, TInt aCellLength);
-	static TBool WalkForStats(RAllocatorHelper& aSelf, TAny* aContext, TExtendedCellType aType, TLinAddr aCellPtr, TInt aCellLength);
-	TUint PageMapOperatorBrackets(unsigned ix, TInt& err) const;
-	TInt PageMapFind(TUint start, TUint bit, TInt& err);
-	TUint PageMapBits(unsigned ix, unsigned len, TInt& err);
-	TUint PagedDecode(TUint pos, TInt& err);
-	TInt TreeWalk(TUint32 aSlabRoot, TInt aSlabType, TWalkFunc3 aCallbackFn, TAny* aContext, TBool& shouldContinue);
-protected:
-	TLinAddr iAllocatorAddress;
-	enum TAllocatorType
-		{
-		EUnknown,
-		EAllocator,
-		EUrelOldRHeap,
-		EUdebOldRHeap,
-		EUrelHybridHeap,
-		EUdebHybridHeap,
-		};
-	TAllocatorType iAllocatorType;
-private:
-	THeapInfo* iInfo;
-	TUint iValidInfo;
-	TUint8* iTempSlabBitmap;
-	mutable TAny* iPageCache;
-	mutable TLinAddr iPageCacheAddr;
-#ifdef __KERNEL_MODE__
-	DChunk* iChunk;
-	//TUint iSpare[0];
-#else
-	TUint iSpare[1];
-#endif
-	};
-
-#ifdef __KERNEL_MODE__
-
-class RKernelSideAllocatorHelper : public RAllocatorHelper
-	{
-public:
-	RKernelSideAllocatorHelper();
-	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();
-private:
-	DThread* iThread;
-	};
-
-#else
-
-class RProxyAllocatorHelper : public RAllocatorHelper
-	{
-public:
-	HUIMPORT_C RProxyAllocatorHelper();
-	HUIMPORT_C TInt Open(RMemoryAccess& aMem, TUint aThreadId);
-	HUIMPORT_C TInt OpenChunkHeap(RMemoryAccess& aMem, TAny* aDChunkPtr);
-	HUIMPORT_C 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:
-	RMemoryAccess* iMemoryAccess;
-	TUint iThreadId;
-	};
-
-#endif // __KERNEL_MODE__
-
-	} // namespace LtkUtils
-
-#endif
--- a/memspy/Driver/User/Include/MemSpyDriverStreamReaderImp.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +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 MEMSPYDRIVERSTREAMREADERIMP_H
-#define MEMSPYDRIVERSTREAMREADERIMP_H
-
-// System includes
-#include <e32base.h>
-
-// Classes referenced
-
-
-class CMemSpyMemStreamReader : public CBase
-    {
-public:
-    CMemSpyMemStreamReader( const TDesC8& aData );
-    void ConstructL();
-    
-public: // API
-    TInt32 ReadInt32L();
-    TUint32 ReadUint32L();
-    void ReadL( TDes8& aDes );
-    void ReadL( TDes16& aDes );
-
-private: // Internal methods
-    void IsAvailableL( TInt aRequired ) const;
-    void IncrementPos( TInt aAmount );
-
-private: // Data members
-    const TUint8* iCurrent;
-    const TUint8* iMax;
-    };
-
-
-#endif
--- a/memspy/Driver/User/Source/MemSpyDriverClient.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1555 +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 <memspy/driver/memspydriverclient.h>
-
-// System includes
-#include <e32svr.h>
-
-// User includes
-#include "MemSpyDriverOpCodes.h"
-#include <memspy/driver/memspydriverconstants.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include "MemSpyDriverStreamReaderImp.h"
-#include "MemSpyDriverObjectsInternal.h"
-#include "heaputils.h"
-
-// Constants
-const TInt KMemSpyClientBufferGrowSize = 0x1000 * 8; // 32kb
-
-// Forward declarations
-static void PrintHeapInfo( const TMemSpyHeapInfo& aInfo );
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::Open()
-	{
-    TInt err = iBuffer.Create( KMemSpyClientBufferGrowSize );
-    if  ( err == KErrNone )
-        {
-        err = User::LoadLogicalDevice( KMemSpyDriverDeviceName );
-        if  ( err == KErrNone || err == KErrAlreadyExists )
-		    {
-		    err = DoCreate( KMemSpyDriverDeviceName, KMemSpyDriverVersion(), KNullUnit, NULL, NULL, EOwnerThread );
-            if  ( err == KErrNone )
-                {
-                TUint heapVTable = RHeapVTable();
- 	            err = DoControl( EMemSpyDriverOpCodeMiscSetRHeapVTable, (TAny*) heapVTable );
-                }
-		    }
-        }
-    //
-    if ( err != KErrNone )
-        {
-        RDebug::Printf( "[MemSpy] RMemSpyDriverClient::Open() - END - err: %d", err );
-        }
-    //
-	return err;
-	}
-
-
-
-EXPORT_C void RMemSpyDriverClient::Close()
-	{
-    RBusLogicalChannel::Close();
-    const TInt err = User::FreeLogicalDevice( KMemSpyDriverDeviceName );
-    //
-    if ( err != KErrNone )
-        {
-        RDebug::Printf( "[MemSpy] RMemSpyDriverClient::Close() - free logical device error: %d", err );
-        }
-    //
-    iBuffer.Close();
-    (void) err;
-	}
-
-
-EXPORT_C void RMemSpyDriverClient::GetVersion( TVersion& aVersion )
-    {
-    TVersion v = KMemSpyDriverVersion();
-    Mem::Copy( (TAny*)&aVersion, (TAny*)&v, sizeof( TVersion ) );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::ReadMemory( TUint aTid, TLinAddr aSrc, TDes8& aDest )
-	{
-	TMemSpyDriverInternalReadMemParams params;
-	params.iTid = aTid;
-	params.iAddr = aSrc;
-	params.iDes = &aDest;
-    aDest.Zero();
-    //
-	TInt r = DoControl( EMemSpyDriverOpCodeRawMemoryRead, &params, NULL );
-    if  ( r >= KErrNone )
-        {
-        aDest.SetLength( r );
-        r = KErrNone;
-        }
-    //
-    return r;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetCodeSegs( TAny** aHandleArray, TInt& aHandleCount, TBool aOnlyRamLoaded )
-    {
-	TMemSpyDriverInternalCodeSnapshotParams params;
-	params.iFilter = aOnlyRamLoaded;
-	params.iHandles = aHandleArray;
-	params.iCountPtr = &aHandleCount;
-	params.iMaxCount = aHandleCount;
-    //
-    aHandleCount = 0;
-    //
-	return DoControl( EMemSpyDriverOpCodeCodeSegsGetAll, &params, NULL );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetCodeSegs( TUint aPid, TAny** aHandleArray, TInt& aHandleCount )
-	{
-	TMemSpyDriverInternalCodeSnapshotParams params;
-	params.iFilter = aPid;
-	params.iHandles = aHandleArray;
-	params.iCountPtr = &aHandleCount;
-	params.iMaxCount = aHandleCount;
-    //
-    aHandleCount = 0;
-    //
-	return DoControl( EMemSpyDriverOpCodeCodeSegsGetCodeSegsForProcess, &params, NULL );
-	}
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetCodeSegInfo( TAny* aHandle, TUint aPid, TMemSpyDriverCodeSegInfo& aInfo )
-	{
-	TMemSpyDriverInternalCodeSegParams params;
-	params.iPid = aPid;
-	params.iHandle = aHandle;
-	params.iInfoPointer = &aInfo;
-    //
-	const TInt r = DoControl( EMemSpyDriverOpCodeCodeSegsGetCodeSegInfo, &params, NULL );
-	return r;
-	}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetChunkHandles( TAny** aHandleArray, TInt& aHandleCount )
-    {
-	TMemSpyDriverInternalChunkHandleParams params;
-	params.iId = 0;
-	params.iType = EMemSpyDriverPrivateObjectTypeAll;
-	params.iHandles = aHandleArray;
-	params.iCountPtr = &aHandleCount;
-    params.iMaxCount = aHandleCount;
-    //
-    aHandleCount = 0;
-	//
-	const TInt err = DoControl( EMemSpyDriverOpCodeChunkGetHandles, &params, NULL );
-    return err;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetChunkInfo( TAny* aHandle, TMemSpyDriverChunkInfo& aInfo )
-    {
-	TMemSpyDriverInternalChunkInfoParams params;
-	TBuf8<KMaxFullName> name;
-	params.iHandle = aHandle;
-	const TInt r = DoControl( EMemSpyDriverOpCodeChunkGetInfo, &params, NULL );
-	//
-	if  ( r == KErrNone )
-		{
-        aInfo.iHandle = aHandle;
-		aInfo.iBaseAddress = params.iBaseAddress;
-		aInfo.iSize = params.iSize;
-		aInfo.iMaxSize = params.iMaxSize;
-		aInfo.iOwnerId = params.iOwnerId;
-        aInfo.iType = params.iType;
-        aInfo.iAttributes = params.iAttributes;
-		aInfo.iName.Copy( params.iName );
-		}
-	//
-	return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetChunkInfo( TAny* aHandle, TMemSpyDriverChunkInfoWithoutName& aInfo )
-    {
-    TMemSpyDriverChunkInfo info;
-    //
-    const TInt r = GetChunkInfo( aHandle, info );
-    if  ( r == KErrNone )
-        {
-        aInfo = info;
-        }
-    //
-    return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetChunkHandlesForProcess( TUint aPid, TAny** aHandleArray, TInt& aHandleCount )
-    {
-	TMemSpyDriverInternalChunkHandleParams params;
-	params.iId = aPid;
-	params.iType = EMemSpyDriverPrivateObjectTypeProcess;
-	params.iHandles = aHandleArray;
-	params.iCountPtr = &aHandleCount;
-	params.iMaxCount = aHandleCount;
-	//
-    aHandleCount = 0;
-    //
-	return DoControl( EMemSpyDriverOpCodeChunkGetHandles, &params, NULL );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetChunkHandlesForThread( TUint aTid, TAny** aHandleArray, TInt& aHandleCount )
-    {
-	TMemSpyDriverInternalChunkHandleParams params;
-	params.iId = aTid;
-	params.iType = EMemSpyDriverPrivateObjectTypeThread;
-	params.iHandles = aHandleArray;
-	params.iCountPtr = &aHandleCount;
-	params.iMaxCount = aHandleCount;
-	//
-    aHandleCount = 0;
-    //
-	return DoControl( EMemSpyDriverOpCodeChunkGetHandles, &params, NULL );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetThreadInfo( TUint aTid, TMemSpyDriverThreadInfo& aInfo )
-	{
-	TMemSpyDriverInternalThreadInfoParams params;
-    params.iRHeapVTable = RHeapVTable();
-    params.iDebugAllocator = DebugEUser();
-    //
-	TInt r = DoControl( EMemSpyDriverOpCodeThreadAndProcessGetInfoThread, (TAny*)aTid, &params);
-	//
-	if  ( r == KErrNone )
-		{
-        // Copy common properties
-        Mem::Copy( &aInfo, &params, sizeof( TMemSpyDriverThreadInfoBase ) );
-
-        // Copy name
-        aInfo.iFullName.Copy( params.iFullName );
-
-        // Get other basic properties via RThread
-        RThread thread;
-        r = OpenThread( aTid, thread );
-        if ( r == KErrNone )
-            {
-            RProcess process;
-            r = thread.Process( process );
-            if ( r == KErrNone )
-                {
-	            aInfo.iPid = process.Id();
-                process.Close();
-                }
-
-            aInfo.iThreadPriority = thread.Priority();
-            aInfo.iExitReason = thread.ExitReason();
-            aInfo.iExitType = thread.ExitType();
-            aInfo.iExitCategory = thread.ExitCategory();
-
-            thread.Close();
-            }
-        }
-
-    return r;
-	}
-
-EXPORT_C TInt RMemSpyDriverClient::GetProcessInfo( TUint aPid, TMemSpyDriverProcessInfo& aInfo )
-    {
-	TInt r = DoControl( EMemSpyDriverOpCodeThreadAndProcessGetInfoProcess, (TAny*)aPid, &aInfo);
-    
-    // Get other properties via RProcess.
-    if  ( r == KErrNone )
-        {
-        RProcess process;
-        r = OpenProcess( aPid, process );
-        if  ( r == KErrNone )
-            {
-            aInfo.iUids = process.Type();
-            aInfo.iPriority = process.Priority();
-            //
-            process.Close();
-            }
-        }
-
-    return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::ProcessThreadsSuspend( TUint aPid )
-    {
-	return DoControl( EMemSpyDriverOpCodeThreadAndProcessSuspendAllThreads, (TAny*) aPid, NULL );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::ProcessThreadsResume( TUint aPid )
-    {
-	return DoControl( EMemSpyDriverOpCodeThreadAndProcessResumeAllThreads, (TAny*) aPid, NULL );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::ThreadEnd( TUint aId, TExitType aType )
-    {
-    TInt err = KErrNone;
-    //
-    if  ( aType == EExitPending )
-        {
-        err = KErrArgument;
-        }
-    else
-        {
-        err = DoControl( EMemSpyDriverOpCodeThreadAndProcessEndThread, (TAny*) aId, (TAny*) aType );
-        }
-    //
-    return err;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::OpenThread( TUint aId, RThread& aThread )
-    {
-    TInt ret = KErrNone;
-    aThread.Close();
-    //
-    const TInt err = DoControl( EMemSpyDriverOpCodeThreadAndProcessOpenThread, (TAny*) aId );
-    if  ( err > 0 )
-        {
-        aThread.SetHandle( err );
-        ret = KErrNone;
-        }
-    else
-        {
-        ret = err;
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::OpenProcess( TUint aId, RProcess& aProcess )
-    {
-    TInt ret = KErrNone;
-    aProcess.Close();
-    //
-    const TInt err = DoControl( EMemSpyDriverOpCodeThreadAndProcessOpenProcess, (TAny*) aId );
-    if  ( err > 0 )
-        {
-        aProcess.SetHandle( err );
-        ret = KErrNone;
-        }
-    else
-        {
-        ret = err;
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C void RMemSpyDriverClient::GetThreadsL( const TProcessId& aId, RArray<TThreadId>& aThreads )
-    {
-	aThreads.Reset();
-    //
-    ResetStreamBuffer();
-    const TInt err = DoControl( EMemSpyDriverOpCodeThreadAndProcessGetThreads, (TAny*) (TUint) aId, (TAny*) &iBuffer );
-    User::LeaveIfError( err );
-
-    // Open stream
-    RMemSpyMemStreamReader stream = StreamOpenL();
-    CleanupClosePushL( stream );
-        
-    // Extract thread ids
-    const TInt threadCount = stream.ReadInt32L();
-    for( TInt i=0; i<threadCount; i++ )
-        {
-        const TThreadId id( stream.ReadUint32L() );
-        aThreads.AppendL( id );
-        }
-        
-    // Tidy up
-    CleanupStack::PopAndDestroy( &stream );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::SetPriority( TUint aId, TThreadPriority aPriority )
-    {
-    // The kernel side API to set thread priority expects a value in the range of 0-63, i.e. an absolute
-    // NThread priority. In order to support process-relative thread priorities, we'd need to duplicate
-    // the kernel priority mapping tables - not a good idea - therefore we'll only support absolute values.
-    TInt err = KErrNone;
-    if  ( aPriority < EPriorityAbsoluteVeryLow )
-        {
-        err = KErrArgument;
-        }
-    else
-        {
-        err = DoControl( EMemSpyDriverOpCodeThreadAndProcessSetPriorityThread, (TAny*) aId, (TAny*) aPriority );
-        }
-    //
-    return err;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoUser( TMemSpyHeapInfo& aInfo, TUint aTid )
-    {
-    TMemSpyDriverInternalHeapRequestParameters params;
-    //
-    params.iTid = aTid;
-    params.iRHeapVTable = RHeapVTable();
-    params.iDebugAllocator = DebugEUser();
-    params.iMasterInfo = &aInfo;
-    //
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetUser, &params, NULL );
-	//
-	if  ( r == KErrNone )
-    	{
-        PrintHeapInfo( aInfo );
-        
-        // Need to do this on the user-side
-        if  ( aInfo.Type() == TMemSpyHeapInfo::ETypeRHeap )
-            {
-            TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
-            TMemSpyHeapMetaDataRHeap& metaData = rHeapInfo.MetaData();
-            metaData.SetVTable( RHeapVTable() );
-            //metaData.SetClassSize( sizeof( RHeap ) );
-            }
-        }
-    else if ( r == KErrNotSupported )
-        {
-        aInfo.SetType( TMemSpyHeapInfo::ETypeUnknown );
-        r = KErrNone;
-        }
-	//
-	return r;
-    }
-
-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)
-	{
-    TMemSpyDriverInternalHeapRequestParameters params;
-    //
-    params.iTid = aTid;
-    params.iRHeapVTable = RHeapVTable();
-    params.iDebugAllocator = DebugEUser();
-    params.iMasterInfo = &aInfo;
-    params.iBuildFreeCellList = ETrue;
-	params.iBuildAllocCellList = aCollectAllocatedCellsAsWellAsFree;
-
-    //
-    aCells.Reset();
-    ResetStreamBuffer();
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetUser, &params );
-	//
-	if  ( r >= KErrNone )
-    	{
-        PrintHeapInfo( aInfo );
-        
-        // Need to do this on the user-side
-        if  ( aInfo.Type() == TMemSpyHeapInfo::ETypeRHeap )
-            {
-            TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
-            TMemSpyHeapMetaDataRHeap& metaData = rHeapInfo.MetaData();
-            metaData.SetVTable( RHeapVTable() );
-            //metaData.SetClassSize( sizeof( RHeap ) );
-            }
-
-        // 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( EMemSpyDriverOpCodeHeapInfoFetchCellList, &iBuffer );
-            if  ( r == KErrNone )
-                {
-                TRAP( r, ReadHeapInfoFreeCellsFromXferBufferL( aCells ) );
-                }
-            }
-        }
-    else if ( r == KErrNotSupported )
-        {
-        aInfo.SetType( TMemSpyHeapInfo::ETypeUnknown );
-        r = KErrNone;
-        }
-	//
-	return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoKernel( TMemSpyHeapInfo& aInfo )
-    {
-    TMemSpyDriverInternalHeapRequestParameters params;
-    params.iTid = KMemSpyDriverGetKernelHeapDataPseudoThreadId;
-    params.iRHeapVTable = NULL;
-    params.iMasterInfo = &aInfo;
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetKernel, &params, NULL );
-	//
-	if  ( r == KErrNone )
-    	{
-        PrintHeapInfo( aInfo );
-        }
-    else if ( r == KErrNotSupported )
-        {
-        aInfo.SetType( TMemSpyHeapInfo::ETypeUnknown );
-        r = KErrNone;
-        }
-	//
-	return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoKernel( TMemSpyHeapInfo& aInfo, RArray< TMemSpyDriverFreeCell >& aFreeCells )
-    {
-    TMemSpyDriverInternalHeapRequestParameters params;
-    params.iTid = KMemSpyDriverGetKernelHeapDataPseudoThreadId;
-    params.iRHeapVTable = NULL;
-    params.iMasterInfo = &aInfo;
-    //
-    aFreeCells.Reset();
-    ResetStreamBuffer();
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetKernel, &params, (TAny*) &iBuffer );
-	//
-	if  ( r == KErrNone )
-    	{
-        PrintHeapInfo( aInfo );
-        TRAP( r, ReadHeapInfoFreeCellsFromXferBufferL( aFreeCells ) );
-        }
-    else if ( r == KErrNotSupported )
-        {
-        aInfo.SetType( TMemSpyHeapInfo::ETypeUnknown );
-        r = KErrNone;
-        }
-	//
-	return r;
-    }
-
-
-EXPORT_C TBool RMemSpyDriverClient::IsDebugKernel()
-    {
-    TBool isDebugKernel = EFalse;
-    DoControl( EMemSpyDriverOpCodeHeapInfoGetIsDebugKernel, (TAny*) &isDebugKernel );
-    return isDebugKernel;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetHeapData( TUint aTid, TUint32 aFreeCellChecksum, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining )
-    {
-    TMemSpyDriverInternalHeapDataParams params;
-    params.iTid = aTid;
-    params.iRHeapVTable = RHeapVTable();
-    params.iDebugAllocator = DebugEUser();
-    params.iDes = &aDest;
-    params.iChecksum = aFreeCellChecksum;
-    params.iRemaining = -1;
-	params.iReadAddress = 0;
-    aDest.Zero();
-    //
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapDataGetUser, &params, NULL );
-	//
-	if  ( r >= KErrNone )
-    	{
-        aDest.SetLength( r );
-        aReadAddress = params.iReadAddress;
-    	aAmountRemaining = params.iRemaining;
-        r = KErrNone;
-    	}
-	//
-	return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetHeapDataNext( 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( EMemSpyDriverOpCodeHeapDataGetUser, &params, NULL );
-	//
-	if  ( r >= KErrNone )
-    	{
-        aDest.SetLength( r );
-        aReadAddress = params.iReadAddress;
-    	aAmountRemaining = params.iRemaining;
-        r = KErrNone;
-    	}
-	//
-    return r;
-    }
-
-
-
-EXPORT_C HBufC8* RMemSpyDriverClient::GetHeapDataKernelLC( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>& aFreeCells )
-    {
-    HBufC8* data = NULL;
-
-    // Going to fetch free cells via stream buffer...
-    ResetStreamBuffer();
-
-    // 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 );
-            }
-        }
-
-    User::LeaveIfError( sizeOrError );
-    return data;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::WalkHeapInit( TUint aTid )
-    {
-    TMemSpyDriverInternalWalkHeapParamsInit params;
-    params.iTid = aTid;
-    params.iRHeapVTable = RHeapVTable();
-    params.iDebugAllocator = DebugEUser();
-    //
-	const TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapInit, &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 )
-    {
-    aCellType = EMemSpyDriverBadCellMask;
-    aCellAddress = NULL;
-    aLength = 0;
-    aNestingLevel = 0;
-    aAllocNumber = 0;
-    aCellHeaderSize = 0;
-    aCellPayloadAddress = NULL;
-    //
-    TMemSpyDriverInternalWalkHeapParamsCell params;
-	const TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapNextCell, (TAny*) aTid, &params );
-    //
-	if  ( r == KErrNone )
-	    {
-        aCellType = (TMemSpyDriverCellType) params.iCellType;
-        aCellAddress = params.iCellAddress;
-        aLength = params.iLength;
-        aNestingLevel = params.iNestingLevel;
-        aAllocNumber = params.iAllocNumber;
-        aCellPayloadAddress = ((TUint8*) aCellAddress) + aCellHeaderSize;
-        }
-    //
-   	return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::WalkHeapReadCellData( TAny* aCellAddress, TDes8& aDest, TInt aReadLen )
-    {
-    TMemSpyDriverInternalWalkHeapCellDataReadParams params;
-    params.iCellAddress = aCellAddress;
-    params.iReadLen = aReadLen;
-    params.iDes = &aDest;
-    aDest.Zero();
-    //
-	TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapReadCellData, &params, NULL );
-    if  ( r >= KErrNone )
-        {
-        aDest.SetLength( r );
-        r = KErrNone;
-        }
-    //
-	return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::WalkHeapGetCellInfo( TAny*& aCellAddress, TMemSpyDriverCellType& aCellType, TInt& aLength, TInt& aNestingLevel, TInt& aAllocNumber, TInt& aCellHeaderSize, TAny*& aCellPayloadAddress )
-    {
-    aCellType = EMemSpyDriverBadCellMask;
-    aLength = 0;
-    aNestingLevel = 0;
-    aAllocNumber = 0;
-    aCellHeaderSize = 0;
-    aCellPayloadAddress = NULL;
-    //
-    TMemSpyDriverInternalWalkHeapParamsCell params;
-	const TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapGetCellInfo, aCellAddress, &params );
-    //
-	if  ( r == KErrNone )
-	    {
-        aCellAddress = params.iCellAddress;
-        aCellType = (TMemSpyDriverCellType) params.iCellType;
-        aLength = params.iLength;
-        aNestingLevel = params.iNestingLevel;
-        aAllocNumber = params.iAllocNumber;
-        aCellPayloadAddress = ((TUint8*) aCellAddress) + aCellHeaderSize;
-        }
-    //
-   	return r;
-    }
-
-
-EXPORT_C void RMemSpyDriverClient::WalkHeapClose()
-    {
-	DoControl( EMemSpyDriverOpCodeWalkHeapClose, NULL, NULL );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetStackInfo( TUint aTid, TMemSpyDriverStackInfo& aInfo )
-    {
-    TMemSpyDriverStackInfo params;
-	const TInt r = DoControl( EMemSpyDriverOpCodeStackGetInfo, (TAny*)aTid, &params );
-	if  (r==KErrNone)
-		{
-		aInfo.iUserStackPointer = params.iUserStackPointer;
-		aInfo.iUserStackBase = params.iUserStackBase;
-		aInfo.iUserStackSize = params.iUserStackSize;
-		aInfo.iUserStackHighWatermark = params.iUserStackHighWatermark;
-		aInfo.iSupervisorStackPointer = params.iSupervisorStackPointer;
-		aInfo.iSupervisorStackBase = params.iSupervisorStackBase;
-		aInfo.iSupervisorStackSize = params.iSupervisorStackSize;
-		aInfo.iSupervisorStackHighWatermark = params.iSupervisorStackHighWatermark;
-		}
-	//
-	return r;
-    }    
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetStackData( TUint aTid, TDes8& aDest, TUint& aAmountRemaining, TMemSpyDriverDomainType aDomain, TBool aEntireStack )
-    {
-    TMemSpyDriverInternalStackDataParams params;
-    params.iTid = aTid;
-    params.iDes = &aDest;
-    params.iDomain = aDomain;
-    params.iEntireStack = aEntireStack;
-    params.iRemaining = -1;
-    aDest.Zero();
-    //
-	TInt r = DoControl( EMemSpyDriverOpCodeStackGetData, &params, NULL );
-	//
-	if  ( r >= KErrNone )
-    	{
-        aDest.SetLength( r );
-    	aAmountRemaining = params.iRemaining;
-        r = KErrNone;
-    	}
-	//
-	return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetStackDataNext( TUint aTid, TDes8& aDest, TUint& aAmountRemaining, TMemSpyDriverDomainType aDomain, TBool aEntireStack )
-    {
-    TMemSpyDriverInternalStackDataParams params;
-    params.iTid = aTid;
-    params.iDes = &aDest;
-    params.iDomain = aDomain;
-    params.iEntireStack = aEntireStack;
-    params.iRemaining = aAmountRemaining;
-    //
-	TInt r = DoControl( EMemSpyDriverOpCodeStackGetData, &params, NULL );
-	//
-	if  ( r >= KErrNone )
-    	{
-        aDest.SetLength( r );
-    	aAmountRemaining = params.iRemaining;
-        r = KErrNone;
-    	}
-	//
-    return r;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::EventMonitorOpen( TUint& aHandle )
-    {
-    const TInt error = DoControl( EMemSpyDriverOpCodeEventMonitorOpen, (TAny*) &aHandle );
-    return error;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::EventMonitorClose( TUint aHandle )
-    {
-    const TInt error = DoControl( EMemSpyDriverOpCodeEventMonitorClose, (TAny*) aHandle );
-    return error;
-    }
-
-
-EXPORT_C void RMemSpyDriverClient::EventMonitorNotify( TUint aHandle, TRequestStatus& aStatus, TUint& aContext )
-    {
-    aStatus = KRequestPending;
-    //
-    TMemSpyDriverInternalEventMonitorParams params;
-    params.iHandle = aHandle;
-    params.iStatus = &aStatus;
-    params.iContext = (TAny*) &aContext;
-    //
-    const TInt err = DoControl( EMemSpyDriverOpCodeEventMonitorNotify, (TAny*) &params );
-    if  ( err != KErrNone )
-        {
-        TRequestStatus* status = &aStatus;
-        User::RequestComplete( status, err );
-        }
-    }
-
-
-EXPORT_C void RMemSpyDriverClient::EventMonitorNotifyCancel( TUint aHandle )
-    {
-    const TInt error = DoControl( EMemSpyDriverOpCodeEventMonitorNotifyCancel, (TAny*) aHandle );
-    (void) error;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::ProcessInspectionOpen( TUint aPid )
-    {
-    const TInt error = DoControl( EMemSpyDriverOpCodeProcessInspectOpen, (TAny*) aPid );
-    return error;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::ProcessInspectionClose( TUint aPid )
-    {
-    const TInt error = DoControl( EMemSpyDriverOpCodeProcessInspectClose, (TAny*) aPid );
-    return error;
-    }
-
-
-EXPORT_C void RMemSpyDriverClient::ProcessInspectionRequestChanges( TUint aPid, TRequestStatus& aStatus, TMemSpyDriverProcessInspectionInfo& aInfo )
-    {
-    aInfo.iProcessId = aPid;
-    aStatus = KRequestPending;
-    const TInt err = DoControl( EMemSpyDriverOpCodeProcessInspectRequestChanges, (TAny*) &aStatus, (TAny*) &aInfo );
-    if  ( err != KErrNone )
-        {
-        TRequestStatus* status = &aStatus;
-        User::RequestComplete( status, err );
-        }
-    }
-
-
-EXPORT_C void RMemSpyDriverClient::ProcessInspectionRequestChangesCancel( TUint aPid )
-    {
-    const TInt error = DoControl( EMemSpyDriverOpCodeProcessInspectRequestChangesCancel, (TAny*) aPid );
-    (void) error;
-    }
-
-
-EXPORT_C void RMemSpyDriverClient::ProcessInspectionAutoStartItemsReset()
-    {
-    const TInt error = DoControl( EMemSpyDriverOpCodeProcessInspectAutoStartListReset );
-    (void) error;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::ProcessInspectionAutoStartItemsAdd( TUint aSID )
-    {
-    const TInt error = DoControl( EMemSpyDriverOpCodeProcessInspectAutoStartListAdd, (TAny*) aSID );
-    return error;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetContainerHandles( TMemSpyDriverContainerType aContainer, TAny** aHandleArray, TInt& aHandleCount )
-    {
-	TMemSpyDriverInternalContainerHandleParams params;
-	params.iTidOrPid = KMemSpyDriverEnumerateContainerHandles;
-	params.iContainer = aContainer;
-	params.iHandles = aHandleArray;
-	params.iCountPtr = &aHandleCount;
-    params.iMaxCount = aHandleCount;
-    params.iHandleSource = EMemSpyDriverThreadOrProcessTypeThread; // Not used
-    //
-    aHandleCount = 0;
-	//
-	return DoControl( EMemSpyDriverOpCodeContainersGetHandles, &params, NULL );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetThreadHandlesByType( TInt aTid, TMemSpyDriverContainerType aType, TAny** aHandleArray, TInt& aHandleCount )
-    {
-	TMemSpyDriverInternalContainerHandleParams params;
-	params.iTidOrPid = aTid;
-	params.iContainer = aType;
-	params.iHandles = aHandleArray;
-	params.iCountPtr = &aHandleCount;
-    params.iMaxCount = aHandleCount;
-    params.iHandleSource = EMemSpyDriverThreadOrProcessTypeThread;
-	//
-    aHandleCount = 0;
-    //
-	return DoControl( EMemSpyDriverOpCodeContainersGetHandles, &params, NULL );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetProcessHandlesByType( TInt aPid, TMemSpyDriverContainerType aType, TAny** aHandleArray, TInt& aHandleCount )
-    {
-	TMemSpyDriverInternalContainerHandleParams params;
-	params.iTidOrPid = aPid;
-	params.iContainer = aType;
-	params.iHandles = aHandleArray;
-	params.iCountPtr = &aHandleCount;
-    params.iMaxCount = aHandleCount;
-    params.iHandleSource = EMemSpyDriverThreadOrProcessTypeProcess;
-	//
-    aHandleCount = 0;
-    //
-	return DoControl( EMemSpyDriverOpCodeContainersGetHandles, &params, NULL );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetGenericHandleInfo( TInt aTid, TMemSpyDriverContainerType aType, TAny* aHandle, TMemSpyDriverHandleInfoGeneric& aParams )
-    {
-    aParams.iType = aType;
-    aParams.iHandle = aHandle;
-    //
-    const TInt r = DoControl( EMemSpyDriverOpCodeContainersGetHandleInfo, (TAny*) aTid, &aParams );
-    return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetApproximateKernelObjectSize( TMemSpyDriverContainerType aType )
-    {
-    TInt size = 0;
-    const TInt error = DoControl( EMemSpyDriverOpCodeContainersGetApproxSize, (TAny*) aType, (TAny*) &size );
-    (void) error;
-    //
-    return size;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetReferencesToMyThread( TUint aTid )
-    {
-    ResetStreamBuffer();
-	return DoControl( EMemSpyDriverOpCodeContainersGetReferencesToMyThread, (TAny*) aTid, (TAny*) &iBuffer );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetReferencesToMyProcess( TUint aPid )
-    {
-    ResetStreamBuffer();
-	return DoControl( EMemSpyDriverOpCodeContainersGetReferencesToMyProcess, (TAny*) aPid, (TAny*) &iBuffer );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetPAndSInfo( TAny* aHandle, TMemSpyDriverPAndSInfo& aInfo )
-    {
-    const TInt r = DoControl( EMemSpyDriverOpCodeContainersGetPAndSInfo, (TAny*) aHandle, &aInfo );
-    return r;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetCondVarSuspendedThreads( TAny* aCondVarHandle, TAny** aThreadHandleArray, TInt& aThreadCount )
-    {
-    TMemSpyDriverInternalCondVarSuspendedThreadParams params;
-    params.iCondVarHandle = aCondVarHandle;
-    params.iThrHandles = aThreadHandleArray;
-    params.iThrCountPtr = &aThreadCount;
-    params.iMaxCount = aThreadCount;
-    //
-    aThreadCount = 0;
-    //
-    return DoControl( EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreads, &params, NULL );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetCondVarSuspendedThreadInfo( TAny* aHandle, TMemSpyDriverCondVarSuspendedThreadInfo& aParams )
-    {
-    return DoControl( EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreadInfo, aHandle, &aParams );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetServerSessionHandles( TAny* aServerHandle, TAny** aSessionHandleArray, TInt& aSessionHandleCount )
-    {
-	TMemSpyDriverInternalServerSessionHandleParams params;
-	params.iServerHandle = aServerHandle;
-	params.iSessionHandles = aSessionHandleArray;
-	params.iSessionCountPtr = &aSessionHandleCount;
-    params.iMaxCount = aSessionHandleCount;
-    //
-    aSessionHandleCount = 0;
-	//
-	return DoControl( EMemSpyDriverOpCodeClientServerGetServerSessionHandles, &params, NULL );
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::GetServerSessionInfo( TAny* aSessionHandle, TMemSpyDriverServerSessionInfo& aParams )
-    {
-    return DoControl( EMemSpyDriverOpCodeClientServerGetServerSessionInfo, aSessionHandle, &aParams );
-    }
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C RMemSpyMemStreamReader RMemSpyDriverClient::StreamOpenL()
-    {
-    CMemSpyMemStreamReader* imp = new(ELeave) CMemSpyMemStreamReader( iBuffer );
-    RMemSpyMemStreamReader ret( imp );
-    CleanupClosePushL( ret ); 
-    imp->ConstructL();
-    CleanupStack::Pop( &ret );
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C TMemSpyMemoryModelType RMemSpyDriverClient::MemoryModelType()
-    {
-    TMemSpyMemoryModelType ret = EMemSpyMemoryModelTypeUnknown;
-    //
-    const TInt err = DoControl( EMemSpyDriverOpCodeMiscGetMemoryModelType );
-    switch( err )
-        {
-    default:
-    case EMemSpyMemoryModelTypeUnknown:
-        ret = EMemSpyMemoryModelTypeUnknown;
-        break;
-    case EMemSpyMemoryModelTypeMoving:
-        ret = EMemSpyMemoryModelTypeMoving;
-        break;
-    case EMemSpyMemoryModelTypeMultiple:
-        ret = EMemSpyMemoryModelTypeMultiple;
-        break;
-    case EMemSpyMemoryModelTypeEmulator:
-        ret = EMemSpyMemoryModelTypeEmulator;
-        break;
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C TUint32 RMemSpyDriverClient::RoundToPageSize( TUint32 aValue )
-    {
-    TUint32 temp = aValue;
-    TAny* pValue = (TAny*) &temp;
-    DoControl( EMemSpyDriverOpCodeMiscGetRoundToPageSize, pValue );
-    return temp;
-    }
-
-
-EXPORT_C TInt RMemSpyDriverClient::Impersonate( TUint32 aValue )
-    {
-    return DoControl( EMemSpyDriverOpCodeMiscImpersonate, (TAny*) aValue );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TUint RMemSpyDriverClient::RHeapVTable()
-    {
-    RHeap* heap = (RHeap*) &User::Allocator();
-    //
-    TUint* pHeap = (TUint*) heap;
-    const TUint heapVTable = *pHeap;
-    //
-    ////RDebug::Printf( "[MemSpy] RMemSpyDriverClient::RHeapVTable() - ret: 0x%08x", heapVTable );
-    return heapVTable;
-    }
-
-
-TBool RMemSpyDriverClient::DebugEUser()
-    {
-	LtkUtils::RAllocatorHelper allocHelper;
-	TBool result = EFalse;
-	TInt err = allocHelper.Open(&User::Allocator());
-	if (!err)
-		{
-		result = allocHelper.AllocatorIsUdeb();
-		allocHelper.Close();
-		}
-	return result;
-    }
-
-
-void RMemSpyDriverClient::ResetStreamBuffer()
-    {
-    iBuffer.Zero();
-    }
-
-
-void RMemSpyDriverClient::ReadHeapInfoFreeCellsFromXferBufferL( RArray<TMemSpyDriverFreeCell>& aFreeCells )
-    {
-    aFreeCells.Reset();
-
-#ifdef _DEBUG
-    RDebug::Printf( "[MemSpy] RMemSpyDriverClient::ReadHeapInfoFreeCellsFromXferBufferL() - buf len: %d", iBuffer.Length() );
-#endif
-
-    if  ( iBuffer.Length() )
-        {
-        RMemSpyMemStreamReader stream = StreamOpenL();
-        CleanupClosePushL( stream );
-
-        const TInt count = stream.ReadInt32L();
-#ifdef _DEBUG
-        RDebug::Printf( "[MemSpy] RMemSpyDriverClient::ReadHeapInfoFreeCellsFromXferBufferL() - count: %d", count );
-#endif
-
-        for( TInt i=0; i<count; i++ )
-            {
-            TMemSpyDriverFreeCell entry;
-            entry.iType = (TMemSpyDriverCellType)stream.ReadInt32L();
-            entry.iAddress = reinterpret_cast< TAny* >( stream.ReadUint32L() );
-            entry.iLength = stream.ReadInt32L();
-            aFreeCells.AppendL( entry );
-            }
-
-        CleanupStack::PopAndDestroy( &stream );
-        }
-
-    ResetStreamBuffer();
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-static void PrintHeapInfo( const TMemSpyHeapInfo& aInfo )
-    {
-#if defined( _DEBUG ) && !defined( __WINS__ )
-    const TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
-    //const TMemSpyHeapObjectDataRHeap& rHeapObjectData = rHeapInfo.ObjectData();
-    const TMemSpyHeapStatisticsRHeap& rHeapStats = rHeapInfo.Statistics();
-    const TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
-
-	/*
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator                                      -");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iAccessCount:       %d", rHeapObjectData.iAccessCount);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iHandleCount:       %d", rHeapObjectData.iHandleCount);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iHandles:           0x%08x", rHeapObjectData.iHandles);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iFlags:             0x%08x", rHeapObjectData.iFlags);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iCellCount:         %d", rHeapObjectData.iCellCount);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iTotalAllocSize:    %d", rHeapObjectData.iTotalAllocSize);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - ");
-
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap                                           -");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iMinLength:              %d", rHeapObjectData.iMinLength);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iMaxLength:              %d", rHeapObjectData.iMaxLength);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iOffset:                 %d", rHeapObjectData.iOffset);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iGrowBy:                 %d", rHeapObjectData.iGrowBy);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iChunkHandle:            0x%08x", rHeapObjectData.iChunkHandle);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iBase:                   0x%08x", rHeapObjectData.iBase);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iTop:                    0x%08x", rHeapObjectData.iTop);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iAlign:                  %d", rHeapObjectData.iAlign);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iMinCell:                %d", rHeapObjectData.iAlign);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iPageSize:               %d", rHeapObjectData.iAlign);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFree.next:              0x%08x", rHeapObjectData.iFree.next);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFree.len:               %d", rHeapObjectData.iFree.len);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iNestingLevel:           %d", rHeapObjectData.iNestingLevel);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iAllocCount:             %d", rHeapObjectData.iAllocCount);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFailType:               %d", rHeapObjectData.iFailType);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFailRate:               %d", rHeapObjectData.iFailRate);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFailed:                 %d", rHeapObjectData.iFailed);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFailAllocCount:         %d", rHeapObjectData.iFailAllocCount);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iRand:                   %d", rHeapObjectData.iRand);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iTestData:               0x%08x", rHeapObjectData.iTestData);
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - ");
-	*/
-
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - Stats (Free)                                    -");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell count:                     %d", rHeapStats.StatsFree().TypeCount());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell size:                      %d", rHeapStats.StatsFree().TypeSize());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell largest:                   0x%08x", rHeapStats.StatsFree().LargestCellAddress());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell largest size:              %d", rHeapStats.StatsFree().LargestCellSize());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - slack:                          0x%08x", rHeapStats.StatsFree().SlackSpaceCellAddress());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - slack size:                     %d", rHeapStats.StatsFree().SlackSpaceCellSize());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - checksum:                       0x%08x", rHeapStats.StatsFree().Checksum());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - ");
-
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - Stats (Alloc)                                   -");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell count:                     %d", rHeapStats.StatsAllocated().TypeCount());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell size:                      %d", rHeapStats.StatsAllocated().TypeSize());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell largest:                   0x%08x", rHeapStats.StatsAllocated().LargestCellAddress());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell largest size:              %d", rHeapStats.StatsAllocated().LargestCellSize());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - ");
-
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - Misc. Info                                      -");
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
-    const TPtrC chunkName( rHeapMetaData.ChunkName() );
-    RDebug::Print(_L("RMemSpyDriverClient::PrintHeapInfo() - chunk name:                     [%S]"), &chunkName );
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - chunk size:                     %d", rHeapMetaData.ChunkSize());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - chunk handle:                   0x%08x", rHeapMetaData.ChunkHandle());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - chunk base address:             0x%08x", rHeapMetaData.ChunkBaseAddress());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - debug allocator:                %d", rHeapMetaData.IsDebugAllocator());
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - shared heap:                    %d", rHeapMetaData.IsSharedHeap() );
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - user thread:                    %d", rHeapMetaData.IsUserThread() );
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - thread id:                      %d", aInfo.Tid() );
-    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - process id:                     %d", aInfo.Pid() );
-    //RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell header size (free):        %d", rHeapMetaData.HeaderSizeFree());
-    //RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell header size (alloc):       %d", rHeapMetaData.HeaderSizeAllocated());
-#else
-    (void) aInfo;
-#endif
-    }
-
--- a/memspy/Driver/User/Source/MemSpyDriverStreamReader.cpp	Fri Aug 27 11:37:29 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:
-*
-*/
-
-#include <memspy/driver/memspydriverstreamreader.h>
-
-// User includes
-#include "MemSpyDriverStreamReaderImp.h"
-
-
-
-
-RMemSpyMemStreamReader::RMemSpyMemStreamReader( CMemSpyMemStreamReader* aImp )
-:   iImp( aImp )
-    {
-    ASSERT( iImp );
-    }
-
-
-EXPORT_C void RMemSpyMemStreamReader::Close()
-    {
-    delete iImp;
-    iImp = NULL; // To pacify code scanner
-    }
-
-
-EXPORT_C TInt32 RMemSpyMemStreamReader::ReadInt32L()
-    {
-    return iImp->ReadInt32L();
-    }
-
-
-EXPORT_C TUint32 RMemSpyMemStreamReader::ReadUint32L()
-    {
-    return iImp->ReadUint32L();
-    }
-
-
-EXPORT_C void RMemSpyMemStreamReader::ReadL( TDes8& aDes )
-    {
-    iImp->ReadL( aDes );
-    }
-
-
-EXPORT_C void RMemSpyMemStreamReader::ReadL( TDes16& aDes )
-    {
-    iImp->ReadL( aDes );
-    }
-
-
-
-
-
--- a/memspy/Driver/User/Source/MemSpyDriverStreamReaderImp.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +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 "MemSpyDriverStreamReaderImp.h"
-
-
-
-
-CMemSpyMemStreamReader::CMemSpyMemStreamReader( const TDesC8& aData )
-    {
-    iCurrent = aData.Ptr();
-    iMax = iCurrent + aData.Length();
-    }
-
-
-void CMemSpyMemStreamReader::ConstructL()
-    {
-    }
-
-
-TInt32 CMemSpyMemStreamReader::ReadInt32L()
-    {
-    TInt32 ret = 0;
-    //
-    const TInt size = sizeof( TInt32 );
-    IsAvailableL( size );
-    Mem::Copy( (TAny*) &ret, iCurrent, size );
-    IncrementPos( size );
-    //
-    return ret;
-    }
-
-
-TUint32 CMemSpyMemStreamReader::ReadUint32L()
-    {
-    TUint32 ret = 0;
-    //
-    const TInt size = sizeof( TUint32 );
-    IsAvailableL( size );
-    Mem::Copy( (TAny*) &ret, iCurrent, size );
-    IncrementPos( size );
-    //
-    return ret;
-    }
-
-
-void CMemSpyMemStreamReader::ReadL( TDes8& aDes )
-    {
-    const TInt length = ReadInt32L();
-
-    // Need to check the remaining text is actually present...
-    IsAvailableL( length );
-
-    // Now read into client descriptor
-    aDes.SetLength( length );
-    if  ( length > 0 ) 
-        {
-        TUint8* dest = const_cast< TUint8* >( aDes.Ptr() );
-        Mem::Copy( dest, iCurrent, length );
-        }
-    //
-    IncrementPos( length );
-    }
-
-
-void CMemSpyMemStreamReader::ReadL( TDes16& aDes )
-    {
-    // The kernel driver only ever writes narrow descriptors.
-    // However, we can expand them to be UCS2
-    const TInt length = ReadInt32L();
-
-    // Need to check the remaining text is actually present...
-    IsAvailableL( length );
-
-    // Set final length in descriptor
-    aDes.SetLength( length );
-
-    // Read each char
-    TUint16* dest = const_cast< TUint16* >( aDes.Ptr() );
-    for( TInt i=0; i<length; i++ )
-        {
-        *dest++ = *iCurrent++;
-        }
-    }
-
-
-void CMemSpyMemStreamReader::IsAvailableL( TInt aRequired ) const
-    {
-    const TUint8* endPos = iCurrent + aRequired;
-    if  ( endPos > iMax )
-        {
-        User::Leave( KErrOverflow );
-        }
-    }
-
-
-void CMemSpyMemStreamReader::IncrementPos( TInt aAmount )
-    {
-    iCurrent += aAmount;
-    }
-
-
-
-
--- a/memspy/Driver/eabi/memspydriverclientu.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-EXPORTS
-	_ZN19RMemSpyDriverClient10GetVersionER8TVersion @ 1 NONAME
-	_ZN19RMemSpyDriverClient10OpenThreadEjR7RThread @ 2 NONAME
-	_ZN19RMemSpyDriverClient10ReadMemoryEjmR5TDes8 @ 3 NONAME
-	_ZN19RMemSpyDriverClient11GetCodeSegsEPPvRii @ 4 NONAME
-	_ZN19RMemSpyDriverClient11GetCodeSegsEjPPvRi @ 5 NONAME
-	_ZN19RMemSpyDriverClient11GetHeapDataEjmR5TDes8RjS2_ @ 6 NONAME
-	_ZN19RMemSpyDriverClient11GetThreadsLERK10TProcessIdR6RArrayI9TThreadIdE @ 7 NONAME
-	_ZN19RMemSpyDriverClient11ImpersonateEm @ 8 NONAME
-	_ZN19RMemSpyDriverClient11OpenProcessEjR8RProcess @ 9 NONAME
-	_ZN19RMemSpyDriverClient11SetPriorityEj15TThreadPriority @ 10 NONAME
-	_ZN19RMemSpyDriverClient11StreamOpenLEv @ 11 NONAME
-	_ZN19RMemSpyDriverClient12GetChunkInfoEPvR22TMemSpyDriverChunkInfo @ 12 NONAME
-	_ZN19RMemSpyDriverClient12GetChunkInfoEPvR33TMemSpyDriverChunkInfoWithoutName @ 13 NONAME
-	_ZN19RMemSpyDriverClient12GetPAndSInfoEPvR22TMemSpyDriverPAndSInfo @ 14 NONAME
-	_ZN19RMemSpyDriverClient12GetStackDataEjR5TDes8Rj23TMemSpyDriverDomainTypei @ 15 NONAME
-	_ZN19RMemSpyDriverClient12GetStackInfoEjR22TMemSpyDriverStackInfo @ 16 NONAME
-	_ZN19RMemSpyDriverClient12WalkHeapInitEj @ 17 NONAME
-	_ZN19RMemSpyDriverClient13GetThreadInfoEjR23TMemSpyDriverThreadInfo @ 18 NONAME
-	_ZN19RMemSpyDriverClient13IsDebugKernelEv @ 19 NONAME
-	_ZN19RMemSpyDriverClient13WalkHeapCloseEv @ 20 NONAME
-	_ZN19RMemSpyDriverClient14GetCodeSegInfoEPvjR24TMemSpyDriverCodeSegInfo @ 21 NONAME
-	_ZN19RMemSpyDriverClient14GetProcessInfoEjR24TMemSpyDriverProcessInfo @ 22 NONAME
-	_ZN19RMemSpyDriverClient15GetChunkHandlesEPPvRi @ 23 NONAME
-	_ZN19RMemSpyDriverClient15GetHeapDataNextEjR5TDes8RjS2_ @ 24 NONAME
-	_ZN19RMemSpyDriverClient15GetHeapInfoUserER15TMemSpyHeapInfoj @ 25 NONAME
-	_ZN19RMemSpyDriverClient15GetHeapInfoUserER15TMemSpyHeapInfojR6RArrayI21TMemSpyDriverFreeCellE @ 26 NONAME
-	_ZN19RMemSpyDriverClient15MemoryModelTypeEv @ 27 NONAME
-	_ZN19RMemSpyDriverClient15RoundToPageSizeEm @ 28 NONAME
-	_ZN19RMemSpyDriverClient16EventMonitorOpenERj @ 29 NONAME
-	_ZN19RMemSpyDriverClient16GetStackDataNextEjR5TDes8Rj23TMemSpyDriverDomainTypei @ 30 NONAME
-	_ZN19RMemSpyDriverClient16WalkHeapNextCellEjR21TMemSpyDriverCellTypeRPvRiS4_S4_S4_S3_ @ 31 NONAME
-	_ZN19RMemSpyDriverClient17EventMonitorCloseEj @ 32 NONAME
-	_ZN19RMemSpyDriverClient17GetHeapInfoKernelER15TMemSpyHeapInfo @ 33 NONAME
-	_ZN19RMemSpyDriverClient17GetHeapInfoKernelER15TMemSpyHeapInfoR6RArrayI21TMemSpyDriverFreeCellE @ 34 NONAME
-	_ZN19RMemSpyDriverClient18EventMonitorNotifyEjR14TRequestStatusRj @ 35 NONAME
-	_ZN19RMemSpyDriverClient19GetContainerHandlesE26TMemSpyDriverContainerTypePPvRi @ 36 NONAME
-	_ZN19RMemSpyDriverClient19GetHeapDataKernelLCER15TMemSpyHeapInfoR6RArrayI21TMemSpyDriverFreeCellE @ 37 NONAME
-	_ZN19RMemSpyDriverClient19WalkHeapGetCellInfoERPvR21TMemSpyDriverCellTypeRiS4_S4_S4_S1_ @ 38 NONAME
-	_ZN19RMemSpyDriverClient20GetGenericHandleInfoEi26TMemSpyDriverContainerTypePvR30TMemSpyDriverHandleInfoGeneric @ 39 NONAME
-	_ZN19RMemSpyDriverClient20GetServerSessionInfoEPvR30TMemSpyDriverServerSessionInfo @ 40 NONAME
-	_ZN19RMemSpyDriverClient20ProcessThreadsResumeEj @ 41 NONAME
-	_ZN19RMemSpyDriverClient20WalkHeapReadCellDataEPvR5TDes8i @ 42 NONAME
-	_ZN19RMemSpyDriverClient21ProcessInspectionOpenEj @ 43 NONAME
-	_ZN19RMemSpyDriverClient21ProcessThreadsSuspendEj @ 44 NONAME
-	_ZN19RMemSpyDriverClient22GetThreadHandlesByTypeEi26TMemSpyDriverContainerTypePPvRi @ 45 NONAME
-	_ZN19RMemSpyDriverClient22ProcessInspectionCloseEj @ 46 NONAME
-	_ZN19RMemSpyDriverClient23GetProcessHandlesByTypeEi26TMemSpyDriverContainerTypePPvRi @ 47 NONAME
-	_ZN19RMemSpyDriverClient23GetReferencesToMyThreadEj @ 48 NONAME
-	_ZN19RMemSpyDriverClient23GetServerSessionHandlesEPvPS0_Ri @ 49 NONAME
-	_ZN19RMemSpyDriverClient24EventMonitorNotifyCancelEj @ 50 NONAME
-	_ZN19RMemSpyDriverClient24GetChunkHandlesForThreadEjPPvRi @ 51 NONAME
-	_ZN19RMemSpyDriverClient24GetReferencesToMyProcessEj @ 52 NONAME
-	_ZN19RMemSpyDriverClient25GetChunkHandlesForProcessEjPPvRi @ 53 NONAME
-	_ZN19RMemSpyDriverClient30GetApproximateKernelObjectSizeE26TMemSpyDriverContainerType @ 54 NONAME
-	_ZN19RMemSpyDriverClient31ProcessInspectionRequestChangesEjR14TRequestStatusR34TMemSpyDriverProcessInspectionInfo @ 55 NONAME
-	_ZN19RMemSpyDriverClient34ProcessInspectionAutoStartItemsAddEj @ 56 NONAME
-	_ZN19RMemSpyDriverClient36ProcessInspectionAutoStartItemsResetEv @ 57 NONAME
-	_ZN19RMemSpyDriverClient37ProcessInspectionRequestChangesCancelEj @ 58 NONAME
-	_ZN19RMemSpyDriverClient4OpenEv @ 59 NONAME
-	_ZN19RMemSpyDriverClient5CloseEv @ 60 NONAME
-	_ZN19RMemSpyDriverClient9ThreadEndEj9TExitType @ 61 NONAME
-	_ZN22RMemSpyMemStreamReader10ReadInt32LEv @ 62 NONAME
-	_ZN22RMemSpyMemStreamReader11ReadUint32LEv @ 63 NONAME
-	_ZN22RMemSpyMemStreamReader5CloseEv @ 64 NONAME
-	_ZN22RMemSpyMemStreamReader5ReadLER5TDes8 @ 65 NONAME
-	_ZN22RMemSpyMemStreamReader5ReadLER6TDes16 @ 66 NONAME
-	_ZN19RMemSpyDriverClient26GetCondVarSuspendedThreadsEPvPS0_Ri @ 67 NONAME
-	_ZN19RMemSpyDriverClient29GetCondVarSuspendedThreadInfoEPvR39TMemSpyDriverCondVarSuspendedThreadInfo @ 68 NONAME
-	_ZN19RMemSpyDriverClient15GetHeapInfoUserER15TMemSpyHeapInfojR6RArrayI21TMemSpyDriverFreeCellEi @ 69 NONAME
-
--- a/memspy/Driver/group/MemSpyDriver.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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 <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-#include "../../symbian_version.hrh"
-
-TARGET          memspydriver.ldd
-TARGETTYPE      ldd
-UID           	0x100000af  0x2002129B
-VENDORID        VID_DEFAULT
-SMPSAFE
-
-CAPABILITY      all
-
-SOURCEPATH      ../Kernel/Source
-
-SOURCE          MemSpyDriverEntryPoint.cpp
-SOURCE          MemSpyDriverDevice.cpp
-SOURCE          MemSpyDriverLogicalChannel.cpp
-
-SOURCE          MemSpyDriverSuspensionManager.cpp
-SOURCE          MemSpyDriverUserEventMonitor.cpp
-SOURCE          MemSpyDriverHeap.cpp
-SOURCE          MemSpyDriverHeapWalker.cpp
-SOURCE          MemSpyDriverUtils.cpp
-SOURCE          MemSpyDriverInspectedProcess.cpp
-SOURCE          MemSpyDriverInspectedProcessManager.cpp
-SOURCE          MemSpyDriverEventMonitor.cpp
-SOURCE          MemSpyDriverObjectIx.cpp
-SOURCE          MemSpyDriverStreamWriter.cpp
-SOURCE          MemSpyDriverXferBuffer.cpp
-source          MemSpyDriverOSAdaption.cpp
-
-SOURCEPATH      ../Kernel/Source/SubChannels
-SOURCE          MemSpyDriverLogChanBase.cpp
-SOURCE          MemSpyDriverLogChanChunks.cpp
-SOURCE          MemSpyDriverLogChanClientServer.cpp
-SOURCE          MemSpyDriverLogChanCodeSegs.cpp
-SOURCE          MemSpyDriverLogChanContainers.cpp
-SOURCE          MemSpyDriverLogChanContainerBase.cpp
-SOURCE          MemSpyDriverLogChanHeapBase.cpp
-SOURCE          MemSpyDriverLogChanHeapData.cpp
-SOURCE          MemSpyDriverLogChanHeapWalk.cpp
-SOURCE          MemSpyDriverLogChanHeapInfo.cpp
-SOURCE          MemSpyDriverLogChanMisc.cpp
-SOURCE          MemSpyDriverLogChanProcessInspection.cpp
-SOURCE          MemSpyDriverLogChanStack.cpp
-SOURCE          MemSpyDriverLogChanRawMemory.cpp
-SOURCE          MemSpyDriverLogChanUserEventMonitor.cpp
-SOURCE          MemSpyDriverLogChanThreadAndProcess.cpp
-
-
-USERINCLUDE     ../Shared
-USERINCLUDE     ../Kernel/Include
-USERINCLUDE     ../Kernel/Include/SubChannels
-
-// New Allocator support
-MACRO			STANDALONE_ALLOCHELPER
-SOURCEPATH      ../Shared
-SOURCE          heaputils.cpp
-
-OS_LAYER_KERNEL_SYSTEMINCLUDE
-
-START WINS
-            	win32_headers
-END
-
-MACRO           MCL_FIND_HANDLES
-
-#if (SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3) || defined(BSW_FLEXIBLE_MEMORY_MODEL)
-    MACRO       MCL_ROBJECTIX_DUPLICATION
-#else
-    MACRO       MCL_DOBJECTIX_DUPLICATION
-#endif
-
-#include <kernel/kern_ext.mmh>
--- a/memspy/Driver/group/MemSpyDriverClient.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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 <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGET					memspydriverclient.dll
-TARGETTYPE			dll
-UID							0x1000008D 0x2002129B
-VENDORID				VID_DEFAULT
-SMPSAFE
-
-#include		        "../../group/MemSpyCapabilities.mmh"
-
-SOURCEPATH				../User/Source
-SOURCE					MemSpyDriverClient.cpp
-SOURCE					MemSpyDriverStreamReader.cpp
-SOURCE					MemSpyDriverStreamReaderImp.cpp
-
-USERINCLUDE				../User/Include
-USERINCLUDE				../Shared
-
-OS_LAYER_SYSTEMINCLUDE
-
-LIBRARY					euser.lib efsrv.lib
-
-// New Allocator support
-MACRO			STANDALONE_ALLOCHELPER
-SOURCEPATH      ../Shared
-SOURCE          heaputils.cpp
-
-
-
-
-START WINS
-	baseaddress			0x40000000
-END
-
-START MARM
-
-END
--- a/memspy/Driver/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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:
-*
-*/
-
-PRJ_PLATFORMS
-
-DEFAULT 
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-MemSpyDriver.mmp
-MemSpyDriverClient.mmp
--- a/memspy/Engine/BWINS/MemSpyEngineu.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,427 +0,0 @@
-EXPORTS
-	??0CMemSpyEngineObject@@QAE@AAV0@@Z @ 1 NONAME ; CMemSpyEngineObject::CMemSpyEngineObject(class CMemSpyEngineObject &)
-	??0CMemSpyEngineObject@@QAE@XZ @ 2 NONAME ; CMemSpyEngineObject::CMemSpyEngineObject(void)
-	??1CMemSpyDeviceWideOperations@@UAE@XZ @ 3 NONAME ; CMemSpyDeviceWideOperations::~CMemSpyDeviceWideOperations(void)
-	??1CMemSpyEngine@@UAE@XZ @ 4 NONAME ; CMemSpyEngine::~CMemSpyEngine(void)
-	??1CMemSpyEngineActiveObject@@UAE@XZ @ 5 NONAME ; CMemSpyEngineActiveObject::~CMemSpyEngineActiveObject(void)
-	??1CMemSpyEngineActiveObjectArray@@UAE@XZ @ 6 NONAME ; CMemSpyEngineActiveObjectArray::~CMemSpyEngineActiveObjectArray(void)
-	??1CMemSpyEngineChunkList@@UAE@XZ @ 7 NONAME ; CMemSpyEngineChunkList::~CMemSpyEngineChunkList(void)
-	??1CMemSpyEngineCodeSegEntry@@UAE@XZ @ 8 NONAME ; CMemSpyEngineCodeSegEntry::~CMemSpyEngineCodeSegEntry(void)
-	??1CMemSpyEngineDriveEntry@@UAE@XZ @ 9 NONAME ; CMemSpyEngineDriveEntry::~CMemSpyEngineDriveEntry(void)
-	??1CMemSpyEngineDriveList@@UAE@XZ @ 10 NONAME ; CMemSpyEngineDriveList::~CMemSpyEngineDriveList(void)
-	??1CMemSpyEngineFbServBitmap@@UAE@XZ @ 11 NONAME ; CMemSpyEngineFbServBitmap::~CMemSpyEngineFbServBitmap(void)
-	??1CMemSpyEngineFbServBitmapArray@@UAE@XZ @ 12 NONAME ; CMemSpyEngineFbServBitmapArray::~CMemSpyEngineFbServBitmapArray(void)
-	??1CMemSpyEngineGenericKernelObjectContainer@@UAE@XZ @ 13 NONAME ; CMemSpyEngineGenericKernelObjectContainer::~CMemSpyEngineGenericKernelObjectContainer(void)
-	??1CMemSpyEngineGenericKernelObjectList@@UAE@XZ @ 14 NONAME ; CMemSpyEngineGenericKernelObjectList::~CMemSpyEngineGenericKernelObjectList(void)
-	??1CMemSpyEngineOpenFileList@@UAE@XZ @ 15 NONAME ; CMemSpyEngineOpenFileList::~CMemSpyEngineOpenFileList(void)
-	??1CMemSpyEngineServerEntry@@UAE@XZ @ 16 NONAME ; CMemSpyEngineServerEntry::~CMemSpyEngineServerEntry(void)
-	??1CMemSpyEngineServerList@@UAE@XZ @ 17 NONAME ; CMemSpyEngineServerList::~CMemSpyEngineServerList(void)
-	??1CMemSpyEngineSinkMetaData@@UAE@XZ @ 18 NONAME ; CMemSpyEngineSinkMetaData::~CMemSpyEngineSinkMetaData(void)
-	?AccessCount@CMemSpyEngineObject@@QBEHXZ @ 19 NONAME ; int CMemSpyEngineObject::AccessCount(void) const
-	?ActiveObjectListL@CMemSpyEngineHelperActiveObject@@QAEPAVCMemSpyEngineActiveObjectArray@@ABVCMemSpyThread@@@Z @ 20 NONAME ; class CMemSpyEngineActiveObjectArray * CMemSpyEngineHelperActiveObject::ActiveObjectListL(class CMemSpyThread const &)
-	?AddInfoL@CMemSpyEngineHelperROM@@QAEXAAVCMemSpyEngineOutputList@@@Z @ 21 NONAME ; void CMemSpyEngineHelperROM::AddInfoL(class CMemSpyEngineOutputList &)
-	?AddObserverL@CMemSpyEngineProcessMemoryTracker@@QAEXAAVMMemSpyEngineProcessMemoryTrackerObserver@@@Z @ 22 NONAME ; void CMemSpyEngineProcessMemoryTracker::AddObserverL(class MMemSpyEngineProcessMemoryTrackerObserver &)
-	?AmTracking@CMemSpyEngineProcessMemoryTracker@@QBEHXZ @ 23 NONAME ; int CMemSpyEngineProcessMemoryTracker::AmTracking(void) const
-	?AppendOwnerName@CMemSpyEngineChunkEntry@@QBEXAAVTDes16@@@Z @ 24 NONAME ; void CMemSpyEngineChunkEntry::AppendOwnerName(class TDes16 &) const
-	?At@CMemSpyEngineActiveObjectArray@@QAEAAVCMemSpyEngineActiveObject@@H@Z @ 25 NONAME ; class CMemSpyEngineActiveObject & CMemSpyEngineActiveObjectArray::At(int)
-	?At@CMemSpyEngineActiveObjectArray@@QBEABVCMemSpyEngineActiveObject@@H@Z @ 26 NONAME ; class CMemSpyEngineActiveObject const & CMemSpyEngineActiveObjectArray::At(int) const
-	?At@CMemSpyEngineChunkList@@QAEAAVCMemSpyEngineChunkEntry@@H@Z @ 27 NONAME ; class CMemSpyEngineChunkEntry & CMemSpyEngineChunkList::At(int)
-	?At@CMemSpyEngineChunkList@@QBEABVCMemSpyEngineChunkEntry@@H@Z @ 28 NONAME ; class CMemSpyEngineChunkEntry const & CMemSpyEngineChunkList::At(int) const
-	?At@CMemSpyEngineDriveList@@QAEAAVCMemSpyEngineDriveEntry@@H@Z @ 29 NONAME ; class CMemSpyEngineDriveEntry & CMemSpyEngineDriveList::At(int)
-	?At@CMemSpyEngineDriveList@@QBEABVCMemSpyEngineDriveEntry@@H@Z @ 30 NONAME ; class CMemSpyEngineDriveEntry const & CMemSpyEngineDriveList::At(int) const
-	?At@CMemSpyEngineEComCategory@@QAEAAVCMemSpyEngineEComInterface@@H@Z @ 31 NONAME ; class CMemSpyEngineEComInterface & CMemSpyEngineEComCategory::At(int)
-	?At@CMemSpyEngineEComInterface@@QAEAAVCMemSpyEngineEComImplementation@@H@Z @ 32 NONAME ; class CMemSpyEngineEComImplementation & CMemSpyEngineEComInterface::At(int)
-	?At@CMemSpyEngineFbServBitmapArray@@QAEAAVCMemSpyEngineFbServBitmap@@H@Z @ 33 NONAME ; class CMemSpyEngineFbServBitmap & CMemSpyEngineFbServBitmapArray::At(int)
-	?At@CMemSpyEngineFbServBitmapArray@@QBEABVCMemSpyEngineFbServBitmap@@H@Z @ 34 NONAME ; class CMemSpyEngineFbServBitmap const & CMemSpyEngineFbServBitmapArray::At(int) const
-	?At@CMemSpyEngineGenericKernelObjectContainer@@QBEABVCMemSpyEngineGenericKernelObjectList@@H@Z @ 35 NONAME ; class CMemSpyEngineGenericKernelObjectList const & CMemSpyEngineGenericKernelObjectContainer::At(int) const
-	?At@CMemSpyEngineGenericKernelObjectList@@QBEABVTMemSpyDriverHandleInfoGeneric@@H@Z @ 36 NONAME ; class TMemSpyDriverHandleInfoGeneric const & CMemSpyEngineGenericKernelObjectList::At(int) const
-	?At@CMemSpyEngineHelperECom@@QAEAAVCMemSpyEngineEComCategory@@H@Z @ 37 NONAME ; class CMemSpyEngineEComCategory & CMemSpyEngineHelperECom::At(int)
-	?At@CMemSpyEngineObjectContainer@@QBEAAVCMemSpyProcess@@H@Z @ 38 NONAME ; class CMemSpyProcess & CMemSpyEngineObjectContainer::At(int) const
-	?At@CMemSpyEngineOpenFileList@@QBEABVCMemSpyEngineOpenFileListForThread@@H@Z @ 39 NONAME ; class CMemSpyEngineOpenFileListForThread const & CMemSpyEngineOpenFileList::At(int) const
-	?At@CMemSpyEngineOpenFileListForThread@@QBEABVCMemSpyEngineOpenFileListEntry@@H@Z @ 40 NONAME ; class CMemSpyEngineOpenFileListEntry const & CMemSpyEngineOpenFileListForThread::At(int) const
-	?At@CMemSpyEngineServerList@@QBEABVCMemSpyEngineServerEntry@@H@Z @ 41 NONAME ; class CMemSpyEngineServerEntry const & CMemSpyEngineServerList::At(int) const
-	?At@CMemSpyProcess@@QBEAAVCMemSpyThread@@H@Z @ 42 NONAME ; class CMemSpyThread & CMemSpyProcess::At(int) const
-	?Bitmap@CMemSpyEngineFbServBitmap@@QAEAAVCFbsBitmap@@XZ @ 43 NONAME ; class CFbsBitmap & CMemSpyEngineFbServBitmap::Bitmap(void)
-	?Bitmap@CMemSpyEngineFbServBitmap@@QBEABVCFbsBitmap@@XZ @ 44 NONAME ; class CFbsBitmap const & CMemSpyEngineFbServBitmap::Bitmap(void) const
-	?BitmapByHandleL@CMemSpyEngineFbServBitmapArray@@QAEAAVCMemSpyEngineFbServBitmap@@H@Z @ 45 NONAME ; class CMemSpyEngineFbServBitmap & CMemSpyEngineFbServBitmapArray::BitmapByHandleL(int)
-	?BitmapIndexByHandle@CMemSpyEngineFbServBitmapArray@@QBEHH@Z @ 46 NONAME ; int CMemSpyEngineFbServBitmapArray::BitmapIndexByHandle(int) const
-	?CalculateStackSizes@CMemSpyEngineHelperStack@@QAEHABVCMemSpyProcess@@@Z @ 47 NONAME ; int CMemSpyEngineHelperStack::CalculateStackSizes(class CMemSpyProcess const &)
-	?Cancel@CMemSpyDeviceWideOperations@@QAEXXZ @ 48 NONAME ; void CMemSpyDeviceWideOperations::Cancel(void)
-	?Caption@CMemSpyEngineFbServBitmap@@QBEABVTDesC16@@XZ @ 49 NONAME ; class TDesC16 const & CMemSpyEngineFbServBitmap::Caption(void) const
-	?Caption@CMemSpyEngineHelperSysMemTrackerCycle@@QBEABVTDesC16@@XZ @ 50 NONAME ; class TDesC16 const & CMemSpyEngineHelperSysMemTrackerCycle::Caption(void) const
-	?ChangeCount@CMemSpyEngineHelperSysMemTrackerCycle@@QBEHXZ @ 51 NONAME ; int CMemSpyEngineHelperSysMemTrackerCycle::ChangeCount(void) const
-	?CleanupTextLC@MemSpyEngineUtils@@SAPAVHBufC16@@ABVTDesC16@@@Z @ 52 NONAME ; class HBufC16 * MemSpyEngineUtils::CleanupTextLC(class TDesC16 const &)
-	?Close@CMemSpyEngineObject@@UAEXXZ @ 53 NONAME ; void CMemSpyEngineObject::Close(void)
-	?Close@CMemSpyProcess@@UAEXXZ @ 54 NONAME ; void CMemSpyProcess::Close(void)
-	?Close@CMemSpyThread@@UAEXXZ @ 55 NONAME ; void CMemSpyThread::Close(void)
-	?Close@CMemSpyThreadInfoContainer@@UAEXXZ @ 56 NONAME ; void CMemSpyThreadInfoContainer::Close(void)
-	?CodeSegmentListL@CMemSpyEngineHelperCodeSegment@@QAEPAVCMemSpyEngineCodeSegList@@VTProcessId@@@Z @ 57 NONAME ; class CMemSpyEngineCodeSegList * CMemSpyEngineHelperCodeSegment::CodeSegmentListL(class TProcessId)
-	?CodeSegmentListL@CMemSpyEngineHelperCodeSegment@@QAEPAVCMemSpyEngineCodeSegList@@XZ @ 58 NONAME ; class CMemSpyEngineCodeSegList * CMemSpyEngineHelperCodeSegment::CodeSegmentListL(void)
-	?CompletedCycles@CMemSpyEngineHelperSysMemTracker@@QBEABV?$RPointerArray@VCMemSpyEngineHelperSysMemTrackerCycle@@@@XZ @ 59 NONAME ; class RPointerArray<class CMemSpyEngineHelperSysMemTrackerCycle> const & CMemSpyEngineHelperSysMemTracker::CompletedCycles(void) const
-	?ConnectionCount@CMemSpyThreadInfoSession@@QBEHABVTDesC16@@@Z @ 60 NONAME ; int CMemSpyThreadInfoSession::ConnectionCount(class TDesC16 const &) const
-	?Container@CMemSpyEngine@@QAEAAVCMemSpyEngineObjectContainer@@XZ @ 61 NONAME ; class CMemSpyEngineObjectContainer & CMemSpyEngine::Container(void)
-	?Container@CMemSpyEngine@@QBEABVCMemSpyEngineObjectContainer@@XZ @ 62 NONAME ; class CMemSpyEngineObjectContainer const & CMemSpyEngine::Container(void) const
-	?Count@CMemSpyEngineActiveObjectArray@@QBEHXZ @ 63 NONAME ; int CMemSpyEngineActiveObjectArray::Count(void) const
-	?Count@CMemSpyEngineChunkList@@QBEHXZ @ 64 NONAME ; int CMemSpyEngineChunkList::Count(void) const
-	?Count@CMemSpyEngineDriveList@@QBEHXZ @ 65 NONAME ; int CMemSpyEngineDriveList::Count(void) const
-	?Count@CMemSpyEngineFbServBitmapArray@@QBEHXZ @ 66 NONAME ; int CMemSpyEngineFbServBitmapArray::Count(void) const
-	?Count@CMemSpyEngineGenericKernelObjectContainer@@QBEHXZ @ 67 NONAME ; int CMemSpyEngineGenericKernelObjectContainer::Count(void) const
-	?Count@CMemSpyEngineGenericKernelObjectList@@QBEHXZ @ 68 NONAME ; int CMemSpyEngineGenericKernelObjectList::Count(void) const
-	?Count@CMemSpyEngineObjectContainer@@QBEHXZ @ 69 NONAME ; int CMemSpyEngineObjectContainer::Count(void) const
-	?Count@CMemSpyEngineOpenFileList@@QBEHXZ @ 70 NONAME ; int CMemSpyEngineOpenFileList::Count(void) const
-	?Count@CMemSpyEngineOpenFileListForThread@@QBEHXZ @ 71 NONAME ; int CMemSpyEngineOpenFileListForThread::Count(void) const
-	?Count@CMemSpyEngineServerList@@QBEHXZ @ 72 NONAME ; int CMemSpyEngineServerList::Count(void) const
-	?CountAll@CMemSpyEngineObjectContainer@@QBEHXZ @ 73 NONAME ; int CMemSpyEngineObjectContainer::CountAll(void) const
-	?CycleNumber@CMemSpyEngineHelperSysMemTrackerCycle@@QBEHXZ @ 74 NONAME ; int CMemSpyEngineHelperSysMemTrackerCycle::CycleNumber(void) const
-	?DataStreamBeginL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@0@Z @ 75 NONAME ; void CMemSpyEngineOutputSink::DataStreamBeginL(class TDesC16 const &, class TDesC16 const &)
-	?DataStreamBeginL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@@Z @ 76 NONAME ; void CMemSpyEngineOutputSink::DataStreamBeginL(class TDesC16 const &)
-	?DataStreamTimeStampBeginL@CMemSpyEngineOutputSink@@QAEXABVTTime@@@Z @ 77 NONAME ; void CMemSpyEngineOutputSink::DataStreamTimeStampBeginL(class TTime const &)
-	?DataStreamTimeStampEnd@CMemSpyEngineOutputSink@@QAEXXZ @ 78 NONAME ; void CMemSpyEngineOutputSink::DataStreamTimeStampEnd(void)
-	?DetailsIndexByEntry@CMemSpyThreadInfoHandleObjectBase@@QBEHABVTMemSpyDriverHandleInfoGeneric@@@Z @ 79 NONAME ; int CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry(class TMemSpyDriverHandleInfoGeneric const &) const
-	?DetailsIndexByHandle@CMemSpyThreadInfoHandleObjectBase@@QBEHPAX@Z @ 80 NONAME ; int CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle(void *) const
-	?DriveListL@CMemSpyEngineHelperFileSystem@@QAEPAVCMemSpyEngineDriveList@@XZ @ 81 NONAME ; class CMemSpyEngineDriveList * CMemSpyEngineHelperFileSystem::DriveListL(void)
-	?Engine@CMemSpyThreadInfoContainer@@QBEAAVCMemSpyEngine@@XZ @ 82 NONAME ; class CMemSpyEngine & CMemSpyThreadInfoContainer::Engine(void) const
-	?Engine@CMemSpyThreadInfoItemBase@@QBEAAVCMemSpyEngine@@XZ @ 83 NONAME ; class CMemSpyEngine & CMemSpyThreadInfoItemBase::Engine(void) const
-	?EntryByDriveNumber@CMemSpyEngineDriveList@@QAEPAVCMemSpyEngineDriveEntry@@W4TDriveNumber@@@Z @ 84 NONAME ; class CMemSpyEngineDriveEntry * CMemSpyEngineDriveList::EntryByDriveNumber(enum TDriveNumber)
-	?EntryExists@CMemSpyEngineChunkList@@QBEHPAX@Z @ 85 NONAME ; int CMemSpyEngineChunkList::EntryExists(void *) const
-	?FileName@CMemSpyEngineOpenFileListEntry@@QBEABVTDesC16@@XZ @ 86 NONAME ; class TDesC16 const & CMemSpyEngineOpenFileListEntry::FileName(void) const
-	?FormatHex@MemSpyEngineUtils@@SAXAAVTDes16@@H@Z @ 87 NONAME ; void MemSpyEngineUtils::FormatHex(class TDes16 &, int)
-	?FormatPercentage@MemSpyEngineUtils@@SA?AV?$TBuf@$0BO@@@NN@Z @ 88 NONAME ; class TBuf<30> MemSpyEngineUtils::FormatPercentage(double, double)
-	?FormatSizeText@MemSpyEngineUtils@@SA?AV?$TBuf@$0BE@@@AB_JHH@Z @ 89 NONAME ; class TBuf<20> MemSpyEngineUtils::FormatSizeText(long long const &, int, int)
-	?FormatSizeText@MemSpyEngineUtils@@SA?AV?$TBuf@$0BE@@@H@Z @ 90 NONAME ; class TBuf<20> MemSpyEngineUtils::FormatSizeText(int)
-	?FormatSizeTextPrecise@MemSpyEngineUtils@@SA?AV?$TBuf@$0BE@@@H@Z @ 91 NONAME ; class TBuf<20> MemSpyEngineUtils::FormatSizeTextPrecise(int)
-	?FormatTimeL@MemSpyEngineUtils@@SAXAAVTDes16@@ABVTTime@@H@Z @ 92 NONAME ; void MemSpyEngineUtils::FormatTimeL(class TDes16 &, class TTime const &, int)
-	?FormatTimeL@MemSpyEngineUtils@@SAXAAVTDes16@@AB_JH@Z @ 93 NONAME ; void MemSpyEngineUtils::FormatTimeL(class TDes16 &, long long const &, int)
-	?FsSession@CMemSpyEngine@@QAEAAVRFs@@XZ @ 94 NONAME ; class RFs & CMemSpyEngine::FsSession(void)
-	?FullName@CMemSpyThread@@QBE?AV?$TBuf@$0BAA@@@XZ @ 95 NONAME ; class TBuf<256> CMemSpyThread::FullName(void) const
-	?GetArrayOfBitmapHandlesL@CMemSpyEngineHelperFbServ@@QAEXAAV?$RArray@H@@@Z @ 96 NONAME ; void CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL(class RArray<int> &)
-	?GetCapabilityName@MemSpyEngineUtils@@SAXAAVTDes16@@W4TCapability@@@Z @ 97 NONAME ; void MemSpyEngineUtils::GetCapabilityName(class TDes16 &, enum TCapability)
-	?GetConfig@CMemSpyEngineHelperSysMemTracker@@QAEXAAVTMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 98 NONAME ; void CMemSpyEngineHelperSysMemTracker::GetConfig(class TMemSpyEngineHelperSysMemTrackerConfig &)
-	?GetExportableFileNameL@CMemSpyEngineFbServBitmap@@QBEXAAVTDes16@@@Z @ 99 NONAME ; void CMemSpyEngineFbServBitmap::GetExportableFileNameL(class TDes16 &) const
-	?GetFolderL@MemSpyEngineUtils@@SAXAAVRFs@@AAVTDes16@@ABVCMemSpyEngineSinkMetaData@@PBW4TDriveNumber@@@Z @ 100 NONAME ; void MemSpyEngineUtils::GetFolderL(class RFs &, class TDes16 &, class CMemSpyEngineSinkMetaData const &, enum TDriveNumber const *)
-	?GetHeapInfoKernelL@CMemSpyEngineHelperHeap@@QAEXAAVTMemSpyHeapInfo@@PAV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 101 NONAME ; void CMemSpyEngineHelperHeap::GetHeapInfoKernelL(class TMemSpyHeapInfo &, class RArray<class TMemSpyDriverFreeCell> *)
-	?GetHeapInfoUserL@CMemSpyEngineHelperHeap@@QAEXABVCMemSpyProcess@@AAV?$RArray@VTMemSpyHeapInfo@@@@@Z @ 102 NONAME ; void CMemSpyEngineHelperHeap::GetHeapInfoUserL(class CMemSpyProcess const &, class RArray<class TMemSpyHeapInfo> &)
-	?GetHeapInfoUserL@CMemSpyEngineHelperHeap@@QAEXABVTProcessId@@ABVTThreadId@@AAVTMemSpyHeapInfo@@PAV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 103 NONAME ; void CMemSpyEngineHelperHeap::GetHeapInfoUserL(class TProcessId const &, class TThreadId const &, class TMemSpyHeapInfo &, class RArray<class TMemSpyDriverFreeCell> *)
-	?GetRomInfoL@MemSpyEngineUtils@@SAXAAVTDes16@@0@Z @ 104 NONAME ; void MemSpyEngineUtils::GetRomInfoL(class TDes16 &, class TDes16 &)
-	?GetServerListL@CMemSpyEngineHelperServer@@QAEXAAV?$RArray@VTMemSpyDriverHandleInfoGeneric@@@@@Z @ 105 NONAME ; void CMemSpyEngineHelperServer::GetServerListL(class RArray<class TMemSpyDriverHandleInfoGeneric> &)
-	?GetServerSessionsL@CMemSpyEngineHelperServer@@QAEXABVTMemSpyDriverHandleInfoGeneric@@AAV?$RArray@VTMemSpyDriverServerSessionInfo@@@@@Z @ 106 NONAME ; void CMemSpyEngineHelperServer::GetServerSessionsL(class TMemSpyDriverHandleInfoGeneric const &, class RArray<class TMemSpyDriverServerSessionInfo> &)
-	?GetServerSessionsL@CMemSpyEngineHelperServer@@QAEXPAXAAV?$RArray@VTMemSpyDriverServerSessionInfo@@@@@Z @ 107 NONAME ; void CMemSpyEngineHelperServer::GetServerSessionsL(void *, class RArray<class TMemSpyDriverServerSessionInfo> &)
-	?GetSessionsL@CMemSpyEngineServerEntry@@QBEXAAVCMemSpyEngineHelperServer@@AAV?$RArray@VTMemSpyDriverServerSessionInfo@@@@@Z @ 108 NONAME ; void CMemSpyEngineServerEntry::GetSessionsL(class CMemSpyEngineHelperServer &, class RArray<class TMemSpyDriverServerSessionInfo> &) const
-	?GetSystemDrive@CMemSpyEngineHelperFileSystem@@SA?AW4TDriveNumber@@XZ @ 109 NONAME ; enum TDriveNumber CMemSpyEngineHelperFileSystem::GetSystemDrive(void)
-	?GetVersion@CMemSpyEngine@@QAEXAAVTVersion@@@Z @ 110 NONAME ; void CMemSpyEngine::GetVersion(class TVersion &)
-	?Handle@CMemSpyEngineFbServBitmap@@QBEHXZ @ 111 NONAME ; int CMemSpyEngineFbServBitmap::Handle(void) const
-	?HasCapability@CMemSpyEngineCodeSegEntry@@QBEHW4TCapability@@@Z @ 112 NONAME ; int CMemSpyEngineCodeSegEntry::HasCapability(enum TCapability) const
-	?HelperActiveObject@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperActiveObject@@XZ @ 113 NONAME ; class CMemSpyEngineHelperActiveObject & CMemSpyEngine::HelperActiveObject(void)
-	?HelperChunk@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperChunk@@XZ @ 114 NONAME ; class CMemSpyEngineHelperChunk & CMemSpyEngine::HelperChunk(void)
-	?HelperCodeSegment@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperCodeSegment@@XZ @ 115 NONAME ; class CMemSpyEngineHelperCodeSegment & CMemSpyEngine::HelperCodeSegment(void)
-	?HelperECom@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperECom@@XZ @ 116 NONAME ; class CMemSpyEngineHelperECom & CMemSpyEngine::HelperECom(void)
-	?HelperFbServ@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperFbServ@@XZ @ 117 NONAME ; class CMemSpyEngineHelperFbServ & CMemSpyEngine::HelperFbServ(void)
-	?HelperFileSystem@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperFileSystem@@XZ @ 118 NONAME ; class CMemSpyEngineHelperFileSystem & CMemSpyEngine::HelperFileSystem(void)
-	?HelperHeap@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperHeap@@XZ @ 119 NONAME ; class CMemSpyEngineHelperHeap & CMemSpyEngine::HelperHeap(void)
-	?HelperKernelContainers@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperKernelContainers@@XZ @ 120 NONAME ; class CMemSpyEngineHelperKernelContainers & CMemSpyEngine::HelperKernelContainers(void)
-	?HelperProcess@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperProcess@@XZ @ 121 NONAME ; class CMemSpyEngineHelperProcess & CMemSpyEngine::HelperProcess(void)
-	?HelperRAM@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperRAM@@XZ @ 122 NONAME ; class CMemSpyEngineHelperRAM & CMemSpyEngine::HelperRAM(void)
-	?HelperROM@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperROM@@XZ @ 123 NONAME ; class CMemSpyEngineHelperROM & CMemSpyEngine::HelperROM(void)
-	?HelperServer@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperServer@@XZ @ 124 NONAME ; class CMemSpyEngineHelperServer & CMemSpyEngine::HelperServer(void)
-	?HelperStack@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperStack@@XZ @ 125 NONAME ; class CMemSpyEngineHelperStack & CMemSpyEngine::HelperStack(void)
-	?HelperSysMemTracker@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperSysMemTracker@@XZ @ 126 NONAME ; class CMemSpyEngineHelperSysMemTracker & CMemSpyEngine::HelperSysMemTracker(void)
-	?HelperThread@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperThread@@XZ @ 127 NONAME ; class CMemSpyEngineHelperThread & CMemSpyEngine::HelperThread(void)
-	?ImpersonateL@CMemSpyEngineHelperProcess@@QAEXK@Z @ 128 NONAME ; void CMemSpyEngineHelperProcess::ImpersonateL(unsigned long)
-	?IndexByHandle@CMemSpyEngineCodeSegList@@QBEHPAX@Z @ 129 NONAME ; int CMemSpyEngineCodeSegList::IndexByHandle(void *) const
-	?IndexOf@CMemSpyEngineEComCategory@@QAEHABVCMemSpyEngineEComInterface@@@Z @ 130 NONAME ; int CMemSpyEngineEComCategory::IndexOf(class CMemSpyEngineEComInterface const &)
-	?IndexOf@CMemSpyEngineEComInterface@@QAEHABVCMemSpyEngineEComImplementation@@@Z @ 131 NONAME ; int CMemSpyEngineEComInterface::IndexOf(class CMemSpyEngineEComImplementation const &)
-	?IndexOf@CMemSpyEngineHelperECom@@QAEHABVCMemSpyEngineEComCategory@@@Z @ 132 NONAME ; int CMemSpyEngineHelperECom::IndexOf(class CMemSpyEngineEComCategory const &)
-	?InfoContainerForceSyncronousConstructionL@CMemSpyThread@@QAEAAVCMemSpyThreadInfoContainer@@XZ @ 133 NONAME ; class CMemSpyThreadInfoContainer & CMemSpyThread::InfoContainerForceSyncronousConstructionL(void)
-	?InfoContainerL@CMemSpyThread@@QAEAAVCMemSpyThreadInfoContainer@@XZ @ 134 NONAME ; class CMemSpyThreadInfoContainer & CMemSpyThread::InfoContainerL(void)
-	?InfoCurrent@CMemSpyThreadInfoMemoryTracking@@QAEAAVMDesC16Array@@XZ @ 135 NONAME ; class MDesC16Array & CMemSpyThreadInfoMemoryTracking::InfoCurrent(void)
-	?InfoHWM@CMemSpyThreadInfoMemoryTracking@@QAEAAVMDesC16Array@@XZ @ 136 NONAME ; class MDesC16Array & CMemSpyThreadInfoMemoryTracking::InfoHWM(void)
-	?InfoItemIndexByType@CMemSpyThreadInfoContainer@@QAEHW4TMemSpyThreadInfoItemType@@@Z @ 137 NONAME ; int CMemSpyThreadInfoContainer::InfoItemIndexByType(enum TMemSpyThreadInfoItemType)
-	?InfoPeak@CMemSpyThreadInfoMemoryTracking@@QAEAAVMDesC16Array@@XZ @ 138 NONAME ; class MDesC16Array & CMemSpyThreadInfoMemoryTracking::InfoPeak(void)
-	?InstallSinkL@CMemSpyEngine@@QAEXW4TMemSpySinkType@@@Z @ 139 NONAME ; void CMemSpyEngine::InstallSinkL(enum TMemSpySinkType)
-	?IsActive@CMemSpyEngineActiveObject@@QBEHXZ @ 140 NONAME ; int CMemSpyEngineActiveObject::IsActive(void) const
-	?IsActive@CMemSpyEngineHelperSysMemTracker@@QBEHXZ @ 141 NONAME ; int CMemSpyEngineHelperSysMemTracker::IsActive(void) const
-	?IsAddedToScheduler@CMemSpyEngineActiveObject@@QBEHXZ @ 142 NONAME ; int CMemSpyEngineActiveObject::IsAddedToScheduler(void) const
-	?IsAknIconCacheConfigurable@CMemSpyEngineHelperRAM@@QBEHXZ @ 143 NONAME ; int CMemSpyEngineHelperRAM::IsAknIconCacheConfigurable(void) const
-	?IsAlive@CMemSpyEngineObjectContainer@@QBEHVTProcessId@@@Z @ 144 NONAME ; int CMemSpyEngineObjectContainer::IsAlive(class TProcessId) const
-	?IsAlive@CMemSpyEngineObjectContainer@@QBEHVTProcessId@@VTThreadId@@@Z @ 145 NONAME ; int CMemSpyEngineObjectContainer::IsAlive(class TProcessId, class TThreadId) const
-	?IsDead@CMemSpyProcess@@QBEHXZ @ 146 NONAME ; int CMemSpyProcess::IsDead(void) const
-	?IsDead@CMemSpyThread@@QBEHXZ @ 147 NONAME ; int CMemSpyThread::IsDead(void) const
-	?IsReady@CMemSpyThreadInfoItemBase@@QBEHXZ @ 148 NONAME ; int CMemSpyThreadInfoItemBase::IsReady(void) const
-	?IsRomAddress@MemSpyEngineUtils@@SAHPAX@Z @ 149 NONAME ; int MemSpyEngineUtils::IsRomAddress(void *)
-	?IsSystemCritical@CMemSpyProcess@@QBEHXZ @ 150 NONAME ; int CMemSpyProcess::IsSystemCritical(void) const
-	?IsSystemCritical@CMemSpyThread@@QBEHXZ @ 151 NONAME ; int CMemSpyThread::IsSystemCritical(void) const
-	?IsSystemPermanent@CMemSpyProcess@@QBEHXZ @ 152 NONAME ; int CMemSpyProcess::IsSystemPermanent(void) const
-	?IsSystemPermanent@CMemSpyThread@@QBEHXZ @ 153 NONAME ; int CMemSpyThread::IsSystemPermanent(void) const
-	?Item@CMemSpyThreadInfoContainer@@QAEAAVCMemSpyThreadInfoItemBase@@H@Z @ 154 NONAME ; class CMemSpyThreadInfoItemBase & CMemSpyThreadInfoContainer::Item(int)
-	?Item@CMemSpyThreadInfoContainer@@QAEAAVCMemSpyThreadInfoItemBase@@W4TMemSpyThreadInfoItemType@@@Z @ 155 NONAME ; class CMemSpyThreadInfoItemBase & CMemSpyThreadInfoContainer::Item(enum TMemSpyThreadInfoItemType)
-	?ItemIndex@CMemSpyEngineChunkList@@QBEHABVCMemSpyEngineChunkEntry@@@Z @ 156 NONAME ; int CMemSpyEngineChunkList::ItemIndex(class CMemSpyEngineChunkEntry const &) const
-	?ItemIndex@CMemSpyEngineDriveList@@QBEHABVCMemSpyEngineDriveEntry@@@Z @ 157 NONAME ; int CMemSpyEngineDriveList::ItemIndex(class CMemSpyEngineDriveEntry const &) const
-	?ItemIndex@CMemSpyEngineServerList@@QBEHABVCMemSpyEngineServerEntry@@@Z @ 158 NONAME ; int CMemSpyEngineServerList::ItemIndex(class CMemSpyEngineServerEntry const &) const
-	?KillL@CMemSpyProcess@@QAEXXZ @ 159 NONAME ; void CMemSpyProcess::KillL(void)
-	?KillL@CMemSpyThread@@QAEXXZ @ 160 NONAME ; void CMemSpyThread::KillL(void)
-	?ListForProcessL@CMemSpyEngineHelperChunk@@QAEPAVCMemSpyEngineChunkList@@VTProcessId@@@Z @ 161 NONAME ; class CMemSpyEngineChunkList * CMemSpyEngineHelperChunk::ListForProcessL(class TProcessId)
-	?ListForThreadL@CMemSpyEngineHelperChunk@@QAEPAVCMemSpyEngineChunkList@@VTThreadId@@@Z @ 162 NONAME ; class CMemSpyEngineChunkList * CMemSpyEngineHelperChunk::ListForThreadL(class TThreadId)
-	?ListL@CMemSpyEngineHelperChunk@@QAEPAVCMemSpyEngineChunkList@@XZ @ 163 NONAME ; class CMemSpyEngineChunkList * CMemSpyEngineHelperChunk::ListL(void)
-	?ListOpenFilesL@CMemSpyEngine@@QAEXXZ @ 164 NONAME ; void CMemSpyEngine::ListOpenFilesL(void)
-	?ListOpenFilesL@CMemSpyEngineHelperFileSystem@@QAEXABVTThreadId@@@Z @ 165 NONAME ; void CMemSpyEngineHelperFileSystem::ListOpenFilesL(class TThreadId const &)
-	?ListOpenFilesL@CMemSpyEngineHelperFileSystem@@QAEXXZ @ 166 NONAME ; void CMemSpyEngineHelperFileSystem::ListOpenFilesL(void)
-	?MdcaCount@CMemSpyEngineActiveObjectArray@@UBEHXZ @ 167 NONAME ; int CMemSpyEngineActiveObjectArray::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineChunkEntry@@UBEHXZ @ 168 NONAME ; int CMemSpyEngineChunkEntry::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineChunkList@@UBEHXZ @ 169 NONAME ; int CMemSpyEngineChunkList::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineCodeSegList@@UBEHXZ @ 170 NONAME ; int CMemSpyEngineCodeSegList::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineDriveEntry@@UBEHXZ @ 171 NONAME ; int CMemSpyEngineDriveEntry::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineDriveList@@UBEHXZ @ 172 NONAME ; int CMemSpyEngineDriveList::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineEComCategory@@UBEHXZ @ 173 NONAME ; int CMemSpyEngineEComCategory::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineEComImplementation@@UBEHXZ @ 174 NONAME ; int CMemSpyEngineEComImplementation::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineEComInterface@@UBEHXZ @ 175 NONAME ; int CMemSpyEngineEComInterface::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineFbServBitmapArray@@UBEHXZ @ 176 NONAME ; int CMemSpyEngineFbServBitmapArray::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineGenericKernelObjectContainer@@UBEHXZ @ 177 NONAME ; int CMemSpyEngineGenericKernelObjectContainer::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineHelperECom@@UBEHXZ @ 178 NONAME ; int CMemSpyEngineHelperECom::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineHelperSysMemTracker@@UBEHXZ @ 179 NONAME ; int CMemSpyEngineHelperSysMemTracker::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineHelperSysMemTrackerCycle@@UBEHXZ @ 180 NONAME ; int CMemSpyEngineHelperSysMemTrackerCycle::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineObjectContainer@@UBEHXZ @ 181 NONAME ; int CMemSpyEngineObjectContainer::MdcaCount(void) const
-	?MdcaCount@CMemSpyEngineServerList@@UBEHXZ @ 182 NONAME ; int CMemSpyEngineServerList::MdcaCount(void) const
-	?MdcaCount@CMemSpyProcess@@UBEHXZ @ 183 NONAME ; int CMemSpyProcess::MdcaCount(void) const
-	?MdcaCount@CMemSpyThreadInfoActiveObjects@@UBEHXZ @ 184 NONAME ; int CMemSpyThreadInfoActiveObjects::MdcaCount(void) const
-	?MdcaCount@CMemSpyThreadInfoChunk@@UBEHXZ @ 185 NONAME ; int CMemSpyThreadInfoChunk::MdcaCount(void) const
-	?MdcaCount@CMemSpyThreadInfoCodeSeg@@UBEHXZ @ 186 NONAME ; int CMemSpyThreadInfoCodeSeg::MdcaCount(void) const
-	?MdcaCount@CMemSpyThreadInfoContainer@@UBEHXZ @ 187 NONAME ; int CMemSpyThreadInfoContainer::MdcaCount(void) const
-	?MdcaCount@CMemSpyThreadInfoItemBase@@UBEHXZ @ 188 NONAME ; int CMemSpyThreadInfoItemBase::MdcaCount(void) const
-	?MdcaPoint@CMemSpyEngineActiveObjectArray@@UBE?AVTPtrC16@@H@Z @ 189 NONAME ; class TPtrC16 CMemSpyEngineActiveObjectArray::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineChunkEntry@@UBE?AVTPtrC16@@H@Z @ 190 NONAME ; class TPtrC16 CMemSpyEngineChunkEntry::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineChunkList@@UBE?AVTPtrC16@@H@Z @ 191 NONAME ; class TPtrC16 CMemSpyEngineChunkList::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineCodeSegList@@UBE?AVTPtrC16@@H@Z @ 192 NONAME ; class TPtrC16 CMemSpyEngineCodeSegList::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineDriveEntry@@UBE?AVTPtrC16@@H@Z @ 193 NONAME ; class TPtrC16 CMemSpyEngineDriveEntry::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineDriveList@@UBE?AVTPtrC16@@H@Z @ 194 NONAME ; class TPtrC16 CMemSpyEngineDriveList::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineEComCategory@@UBE?AVTPtrC16@@H@Z @ 195 NONAME ; class TPtrC16 CMemSpyEngineEComCategory::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineEComImplementation@@UBE?AVTPtrC16@@H@Z @ 196 NONAME ; class TPtrC16 CMemSpyEngineEComImplementation::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineEComInterface@@UBE?AVTPtrC16@@H@Z @ 197 NONAME ; class TPtrC16 CMemSpyEngineEComInterface::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineFbServBitmapArray@@UBE?AVTPtrC16@@H@Z @ 198 NONAME ; class TPtrC16 CMemSpyEngineFbServBitmapArray::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineGenericKernelObjectContainer@@UBE?AVTPtrC16@@H@Z @ 199 NONAME ; class TPtrC16 CMemSpyEngineGenericKernelObjectContainer::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineHelperECom@@UBE?AVTPtrC16@@H@Z @ 200 NONAME ; class TPtrC16 CMemSpyEngineHelperECom::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineHelperSysMemTracker@@UBE?AVTPtrC16@@H@Z @ 201 NONAME ; class TPtrC16 CMemSpyEngineHelperSysMemTracker::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineHelperSysMemTrackerCycle@@UBE?AVTPtrC16@@H@Z @ 202 NONAME ; class TPtrC16 CMemSpyEngineHelperSysMemTrackerCycle::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineObjectContainer@@UBE?AVTPtrC16@@H@Z @ 203 NONAME ; class TPtrC16 CMemSpyEngineObjectContainer::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyEngineServerList@@UBE?AVTPtrC16@@H@Z @ 204 NONAME ; class TPtrC16 CMemSpyEngineServerList::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyProcess@@UBE?AVTPtrC16@@H@Z @ 205 NONAME ; class TPtrC16 CMemSpyProcess::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyThreadInfoActiveObjects@@UBE?AVTPtrC16@@H@Z @ 206 NONAME ; class TPtrC16 CMemSpyThreadInfoActiveObjects::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyThreadInfoChunk@@UBE?AVTPtrC16@@H@Z @ 207 NONAME ; class TPtrC16 CMemSpyThreadInfoChunk::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyThreadInfoCodeSeg@@UBE?AVTPtrC16@@H@Z @ 208 NONAME ; class TPtrC16 CMemSpyThreadInfoCodeSeg::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyThreadInfoContainer@@UBE?AVTPtrC16@@H@Z @ 209 NONAME ; class TPtrC16 CMemSpyThreadInfoContainer::MdcaPoint(int) const
-	?MdcaPoint@CMemSpyThreadInfoItemBase@@UBE?AVTPtrC16@@H@Z @ 210 NONAME ; class TPtrC16 CMemSpyThreadInfoItemBase::MdcaPoint(int) const
-	?MemoryDelta@CMemSpyEngineHelperSysMemTrackerCycle@@QBE_JXZ @ 211 NONAME ; long long CMemSpyEngineHelperSysMemTrackerCycle::MemoryDelta(void) const
-	?MemoryFree@CMemSpyEngineHelperSysMemTrackerCycle@@QBEAB_JXZ @ 212 NONAME ; long long const & CMemSpyEngineHelperSysMemTrackerCycle::MemoryFree(void) const
-	?MemoryFreePreviousCycle@CMemSpyEngineHelperSysMemTrackerCycle@@QBE_JXZ @ 213 NONAME ; long long CMemSpyEngineHelperSysMemTrackerCycle::MemoryFreePreviousCycle(void) const
-	?Name@CMemSpyEngineGenericKernelObjectList@@QBE?AVTPtrC16@@XZ @ 214 NONAME ; class TPtrC16 CMemSpyEngineGenericKernelObjectList::Name(void) const
-	?Name@CMemSpyProcess@@QBE?AVTPtrC16@@XZ @ 215 NONAME ; class TPtrC16 CMemSpyProcess::Name(void) const
-	?Name@CMemSpyThread@@QBE?AVTPtrC16@@XZ @ 216 NONAME ; class TPtrC16 CMemSpyThread::Name(void) const
-	?Name@CMemSpyThreadInfoActiveObjects@@UBE?AVTPtrC16@@XZ @ 217 NONAME ; class TPtrC16 CMemSpyThreadInfoActiveObjects::Name(void) const
-	?Name@CMemSpyThreadInfoChangeNotifier@@UBE?AVTPtrC16@@XZ @ 218 NONAME ; class TPtrC16 CMemSpyThreadInfoChangeNotifier::Name(void) const
-	?Name@CMemSpyThreadInfoChunk@@UBE?AVTPtrC16@@XZ @ 219 NONAME ; class TPtrC16 CMemSpyThreadInfoChunk::Name(void) const
-	?Name@CMemSpyThreadInfoCodeSeg@@UBE?AVTPtrC16@@XZ @ 220 NONAME ; class TPtrC16 CMemSpyThreadInfoCodeSeg::Name(void) const
-	?Name@CMemSpyThreadInfoGeneral@@UBE?AVTPtrC16@@XZ @ 221 NONAME ; class TPtrC16 CMemSpyThreadInfoGeneral::Name(void) const
-	?Name@CMemSpyThreadInfoHeap@@UBE?AVTPtrC16@@XZ @ 222 NONAME ; class TPtrC16 CMemSpyThreadInfoHeap::Name(void) const
-	?Name@CMemSpyThreadInfoLDD@@UBE?AVTPtrC16@@XZ @ 223 NONAME ; class TPtrC16 CMemSpyThreadInfoLDD::Name(void) const
-	?Name@CMemSpyThreadInfoLogicalChannel@@UBE?AVTPtrC16@@XZ @ 224 NONAME ; class TPtrC16 CMemSpyThreadInfoLogicalChannel::Name(void) const
-	?Name@CMemSpyThreadInfoMemoryTracking@@UBE?AVTPtrC16@@XZ @ 225 NONAME ; class TPtrC16 CMemSpyThreadInfoMemoryTracking::Name(void) const
-	?Name@CMemSpyThreadInfoMutex@@UBE?AVTPtrC16@@XZ @ 226 NONAME ; class TPtrC16 CMemSpyThreadInfoMutex::Name(void) const
-	?Name@CMemSpyThreadInfoOpenFiles@@UBE?AVTPtrC16@@XZ @ 227 NONAME ; class TPtrC16 CMemSpyThreadInfoOpenFiles::Name(void) const
-	?Name@CMemSpyThreadInfoOtherProcesses@@UBE?AVTPtrC16@@XZ @ 228 NONAME ; class TPtrC16 CMemSpyThreadInfoOtherProcesses::Name(void) const
-	?Name@CMemSpyThreadInfoOtherThreads@@UBE?AVTPtrC16@@XZ @ 229 NONAME ; class TPtrC16 CMemSpyThreadInfoOtherThreads::Name(void) const
-	?Name@CMemSpyThreadInfoOwnedProcessHandles@@UBE?AVTPtrC16@@XZ @ 230 NONAME ; class TPtrC16 CMemSpyThreadInfoOwnedProcessHandles::Name(void) const
-	?Name@CMemSpyThreadInfoOwnedThreadHandles@@UBE?AVTPtrC16@@XZ @ 231 NONAME ; class TPtrC16 CMemSpyThreadInfoOwnedThreadHandles::Name(void) const
-	?Name@CMemSpyThreadInfoPDD@@UBE?AVTPtrC16@@XZ @ 232 NONAME ; class TPtrC16 CMemSpyThreadInfoPDD::Name(void) const
-	?Name@CMemSpyThreadInfoSemaphore@@UBE?AVTPtrC16@@XZ @ 233 NONAME ; class TPtrC16 CMemSpyThreadInfoSemaphore::Name(void) const
-	?Name@CMemSpyThreadInfoServer@@UBE?AVTPtrC16@@XZ @ 234 NONAME ; class TPtrC16 CMemSpyThreadInfoServer::Name(void) const
-	?Name@CMemSpyThreadInfoSession@@UBE?AVTPtrC16@@XZ @ 235 NONAME ; class TPtrC16 CMemSpyThreadInfoSession::Name(void) const
-	?Name@CMemSpyThreadInfoStack@@UBE?AVTPtrC16@@XZ @ 236 NONAME ; class TPtrC16 CMemSpyThreadInfoStack::Name(void) const
-	?Name@CMemSpyThreadInfoTimer@@UBE?AVTPtrC16@@XZ @ 237 NONAME ; class TPtrC16 CMemSpyThreadInfoTimer::Name(void) const
-	?Name@CMemSpyThreadInfoUndertaker@@UBE?AVTPtrC16@@XZ @ 238 NONAME ; class TPtrC16 CMemSpyThreadInfoUndertaker::Name(void) const
-	?NewHeapSummaryExtendedLC@CMemSpyEngineHelperHeap@@QAEPAVCMemSpyEngineOutputList@@ABVTMemSpyHeapInfo@@PBV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 239 NONAME ; class CMemSpyEngineOutputList * CMemSpyEngineHelperHeap::NewHeapSummaryExtendedLC(class TMemSpyHeapInfo const &, class RArray<class TMemSpyDriverFreeCell> const *)
-	?NewHeapSummaryShortLC@CMemSpyEngineHelperHeap@@QAEPAVCMemSpyEngineOutputList@@ABVTMemSpyHeapInfo@@@Z @ 240 NONAME ; class CMemSpyEngineOutputList * CMemSpyEngineHelperHeap::NewHeapSummaryShortLC(class TMemSpyHeapInfo const &)
-	?NewL@CMemSpyDeviceWideOperations@@SAPAV1@AAVCMemSpyEngine@@AAVMMemSpyDeviceWideOperationsObserver@@W4TOperation@1@@Z @ 241 NONAME ; class CMemSpyDeviceWideOperations * CMemSpyDeviceWideOperations::NewL(class CMemSpyEngine &, class MMemSpyDeviceWideOperationsObserver &, enum CMemSpyDeviceWideOperations::TOperation)
-	?NewL@CMemSpyEngine@@SAPAV1@AAVRFs@@@Z @ 242 NONAME ; class CMemSpyEngine * CMemSpyEngine::NewL(class RFs &)
-	?NewL@CMemSpyEngineFbServBitmapArray@@SAPAV1@ABV?$RArray@H@@@Z @ 243 NONAME ; class CMemSpyEngineFbServBitmapArray * CMemSpyEngineFbServBitmapArray::NewL(class RArray<int> const &)
-	?NewL@CMemSpyEngineFbServBitmapArray@@SAPAV1@HABV?$RArray@H@@AAVMMemSpyEngineFbSerbBitmapArrayObserver@@H@Z @ 244 NONAME ; class CMemSpyEngineFbServBitmapArray * CMemSpyEngineFbServBitmapArray::NewL(int, class RArray<int> const &, class MMemSpyEngineFbSerbBitmapArrayObserver &, int)
-	?NewL@CMemSpyEngineSinkMetaData@@SAPAV1@ABVTDesC16@@00HH@Z @ 245 NONAME ; class CMemSpyEngineSinkMetaData * CMemSpyEngineSinkMetaData::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, int, int)
-	?NewL@CMemSpyEngineSinkMetaData@@SAPAV1@ABVTDesC16@@00HHABVTTime@@@Z @ 246 NONAME ; class CMemSpyEngineSinkMetaData * CMemSpyEngineSinkMetaData::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, int, int, class TTime const &)
-	?NewL@CMemSpyEngineSinkMetaData@@SAPAV1@XZ @ 247 NONAME ; class CMemSpyEngineSinkMetaData * CMemSpyEngineSinkMetaData::NewL(void)
-	?NewL@CMemSpyProcess@@SAPAV1@ABV1@@Z @ 248 NONAME ; class CMemSpyProcess * CMemSpyProcess::NewL(class CMemSpyProcess const &)
-	?NewLC@CMemSpyEngineFbServBitmap@@SAPAV1@H@Z @ 249 NONAME ; class CMemSpyEngineFbServBitmap * CMemSpyEngineFbServBitmap::NewLC(int)
-	?ObjectByAddressL@CMemSpyEngineActiveObjectArray@@QAEAAVCMemSpyEngineActiveObject@@PAX@Z @ 250 NONAME ; class CMemSpyEngineActiveObject & CMemSpyEngineActiveObjectArray::ObjectByAddressL(void *)
-	?ObjectIndexByAddress@CMemSpyEngineActiveObjectArray@@QBEHPAX@Z @ 251 NONAME ; int CMemSpyEngineActiveObjectArray::ObjectIndexByAddress(void *) const
-	?ObjectsAllL@CMemSpyEngineHelperKernelContainers@@QAEPAVCMemSpyEngineGenericKernelObjectContainer@@XZ @ 252 NONAME ; class CMemSpyEngineGenericKernelObjectContainer * CMemSpyEngineHelperKernelContainers::ObjectsAllL(void)
-	?ObjectsForSpecificContainerL@CMemSpyEngineHelperKernelContainers@@QAEPAVCMemSpyEngineGenericKernelObjectList@@W4TMemSpyDriverContainerType@@@Z @ 253 NONAME ; class CMemSpyEngineGenericKernelObjectList * CMemSpyEngineHelperKernelContainers::ObjectsForSpecificContainerL(enum TMemSpyDriverContainerType)
-	?ObserverAddL@CMemSpyThreadInfoContainer@@QAEXAAVMMemSpyThreadInfoContainerObserver@@@Z @ 254 NONAME ; void CMemSpyThreadInfoContainer::ObserverAddL(class MMemSpyThreadInfoContainerObserver &)
-	?ObserverRemove@CMemSpyThreadInfoContainer@@QAEXAAVMMemSpyThreadInfoContainerObserver@@@Z @ 255 NONAME ; void CMemSpyThreadInfoContainer::ObserverRemove(class MMemSpyThreadInfoContainerObserver &)
-	?Open@CMemSpyEngineObject@@UAEXXZ @ 256 NONAME ; void CMemSpyEngineObject::Open(void)
-	?Open@CMemSpyProcess@@UAEXXZ @ 257 NONAME ; void CMemSpyProcess::Open(void)
-	?Open@CMemSpyThread@@UAEXXZ @ 258 NONAME ; void CMemSpyThread::Open(void)
-	?Open@CMemSpyThreadInfoContainer@@UAEXXZ @ 259 NONAME ; void CMemSpyThreadInfoContainer::Open(void)
-	?OutputBinaryDataCompressedL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@PBE1H@Z @ 260 NONAME ; void CMemSpyEngineOutputSink::OutputBinaryDataCompressedL(class TDesC16 const &, unsigned char const *, unsigned char const *, int)
-	?OutputBinaryDataL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@PBE1H@Z @ 261 NONAME ; void CMemSpyEngineOutputSink::OutputBinaryDataL(class TDesC16 const &, unsigned char const *, unsigned char const *, int)
-	?OutputBlankLineL@CMemSpyEngineOutputSink@@QAEXXZ @ 262 NONAME ; void CMemSpyEngineOutputSink::OutputBlankLineL(void)
-	?OutputCellListingUserL@CMemSpyEngineHelperHeap@@QAEXABVCMemSpyThread@@@Z @ 263 NONAME ; void CMemSpyEngineHelperHeap::OutputCellListingUserL(class CMemSpyThread const &)
-	?OutputChunkInfoForProcessL@CMemSpyEngineHelperChunk@@QAEXABVCMemSpyProcess@@@Z @ 264 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL(class CMemSpyProcess const &)
-	?OutputChunkInfoForProcessL@CMemSpyEngineHelperChunk@@QAEXVTProcessId@@@Z @ 265 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL(class TProcessId)
-	?OutputChunkInfoForProcessL@CMemSpyEngineHelperChunk@@QAEXVTProcessId@@AAVTDes16@@@Z @ 266 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL(class TProcessId, class TDes16 &)
-	?OutputChunkInfoForThreadL@CMemSpyEngineHelperChunk@@QAEXABVCMemSpyThread@@@Z @ 267 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL(class CMemSpyThread const &)
-	?OutputChunkInfoForThreadL@CMemSpyEngineHelperChunk@@QAEXVTThreadId@@@Z @ 268 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL(class TThreadId)
-	?OutputChunkInfoForThreadL@CMemSpyEngineHelperChunk@@QAEXVTThreadId@@AAVTDes16@@@Z @ 269 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL(class TThreadId, class TDes16 &)
-	?OutputCodeSegmentsL@CMemSpyEngineHelperCodeSegment@@QAEXIAAVTDes16@@ABVTDesC16@@VTChar@@H@Z @ 270 NONAME ; void CMemSpyEngineHelperCodeSegment::OutputCodeSegmentsL(unsigned int, class TDes16 &, class TDesC16 const &, class TChar, int)
-	?OutputDataColumnsL@CMemSpyEngineActiveObjectArray@@SAXAAVCMemSpyEngine@@@Z @ 271 NONAME ; void CMemSpyEngineActiveObjectArray::OutputDataColumnsL(class CMemSpyEngine &)
-	?OutputDataColumnsL@CMemSpyEngineChunkList@@SAXAAVCMemSpyEngine@@@Z @ 272 NONAME ; void CMemSpyEngineChunkList::OutputDataColumnsL(class CMemSpyEngine &)
-	?OutputDataColumnsL@CMemSpyEngineCodeSegList@@SAXAAVCMemSpyEngine@@@Z @ 273 NONAME ; void CMemSpyEngineCodeSegList::OutputDataColumnsL(class CMemSpyEngine &)
-	?OutputDataColumnsL@CMemSpyEngineFbServBitmap@@SAXAAVCMemSpyEngine@@@Z @ 274 NONAME ; void CMemSpyEngineFbServBitmap::OutputDataColumnsL(class CMemSpyEngine &)
-	?OutputDataColumnsL@CMemSpyEngineServerList@@SAXAAVCMemSpyEngine@@H@Z @ 275 NONAME ; void CMemSpyEngineServerList::OutputDataColumnsL(class CMemSpyEngine &, int)
-	?OutputDataL@CMemSpyEngineActiveObject@@QBEXAAVCMemSpyEngine@@@Z @ 276 NONAME ; void CMemSpyEngineActiveObject::OutputDataL(class CMemSpyEngine &) const
-	?OutputDataL@CMemSpyEngineChunkEntry@@QBEXAAVCMemSpyEngineHelperChunk@@@Z @ 277 NONAME ; void CMemSpyEngineChunkEntry::OutputDataL(class CMemSpyEngineHelperChunk &) const
-	?OutputDataL@CMemSpyEngineCodeSegEntry@@QBEXAAVCMemSpyEngineHelperCodeSegment@@@Z @ 278 NONAME ; void CMemSpyEngineCodeSegEntry::OutputDataL(class CMemSpyEngineHelperCodeSegment &) const
-	?OutputDataL@CMemSpyEngineFbServBitmap@@QBEXAAVCMemSpyEngine@@@Z @ 279 NONAME ; void CMemSpyEngineFbServBitmap::OutputDataL(class CMemSpyEngine &) const
-	?OutputDataL@CMemSpyEngineServerEntry@@QBEXAAVCMemSpyEngineHelperServer@@H@Z @ 280 NONAME ; void CMemSpyEngineServerEntry::OutputDataL(class CMemSpyEngineHelperServer &, int) const
-	?OutputHeapDataKernelL@CMemSpyEngineHelperHeap@@QAEXXZ @ 281 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapDataKernelL(void)
-	?OutputHeapDataUserL@CMemSpyEngineHelperHeap@@QAEXABVCMemSpyThread@@@Z @ 282 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapDataUserL(class CMemSpyThread const &)
-	?OutputHeapDataUserL@CMemSpyEngineHelperHeap@@QAEXABVTProcessId@@ABVTThreadId@@ABVTDesC16@@ABVTMemSpyHeapInfo@@PBV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 283 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapDataUserL(class TProcessId const &, class TThreadId const &, class TDesC16 const &, class TMemSpyHeapInfo const &, class RArray<class TMemSpyDriverFreeCell> const *)
-	?OutputHeapInfoForDeviceL@CMemSpyEngineHelperHeap@@QAEXH@Z @ 284 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapInfoForDeviceL(int)
-	?OutputHeapInfoKernelL@CMemSpyEngineHelperHeap@@QAEXXZ @ 285 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapInfoKernelL(void)
-	?OutputHeapInfoL@CMemSpyEngineHelperHeap@@QAEXABVTMemSpyHeapInfo@@ABVTDesC16@@PBV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 286 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapInfoL(class TMemSpyHeapInfo const &, class TDesC16 const &, class RArray<class TMemSpyDriverFreeCell> const *)
-	?OutputHeapInfoUserL@CMemSpyEngineHelperHeap@@QAEXABVCMemSpyThread@@@Z @ 287 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapInfoUserL(class CMemSpyThread const &)
-	?OutputItemAndValueL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@0@Z @ 288 NONAME ; void CMemSpyEngineOutputSink::OutputItemAndValueL(class TDesC16 const &, class TDesC16 const &)
-	?OutputItemAndValueL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@IH@Z @ 289 NONAME ; void CMemSpyEngineOutputSink::OutputItemAndValueL(class TDesC16 const &, unsigned int, int)
-	?OutputL@CMemSpyEngineGenericKernelObjectContainer@@QBEXAAVCMemSpyEngineOutputSink@@@Z @ 290 NONAME ; void CMemSpyEngineGenericKernelObjectContainer::OutputL(class CMemSpyEngineOutputSink &) const
-	?OutputL@CMemSpyEngineGenericKernelObjectList@@QBEXAAVCMemSpyEngineOutputSink@@@Z @ 291 NONAME ; void CMemSpyEngineGenericKernelObjectList::OutputL(class CMemSpyEngineOutputSink &) const
-	?OutputL@CMemSpyEngineHelperKernelContainers@@QBEXABVCMemSpyEngineGenericKernelObjectContainer@@@Z @ 292 NONAME ; void CMemSpyEngineHelperKernelContainers::OutputL(class CMemSpyEngineGenericKernelObjectContainer const &) const
-	?OutputLineFormattedL@CMemSpyEngineOutputSink@@QAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 293 NONAME ; void CMemSpyEngineOutputSink::OutputLineFormattedL(class TRefByValue<class TDesC16 const >, ...)
-	?OutputLineL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@H@Z @ 294 NONAME ; void CMemSpyEngineOutputSink::OutputLineL(class TDesC16 const &, int)
-	?OutputPrefixClear@CMemSpyEngineOutputSink@@QAEXXZ @ 295 NONAME ; void CMemSpyEngineOutputSink::OutputPrefixClear(void)
-	?OutputPrefixSetFormattedLC@CMemSpyEngineOutputSink@@QAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 296 NONAME ; void CMemSpyEngineOutputSink::OutputPrefixSetFormattedLC(class TRefByValue<class TDesC16 const >, ...)
-	?OutputPrefixSetLC@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@@Z @ 297 NONAME ; void CMemSpyEngineOutputSink::OutputPrefixSetLC(class TDesC16 const &)
-	?OutputProcessInfoDetailedL@CMemSpyEngineHelperProcess@@QAEXABVCMemSpyProcess@@@Z @ 298 NONAME ; void CMemSpyEngineHelperProcess::OutputProcessInfoDetailedL(class CMemSpyProcess const &)
-	?OutputProcessInfoL@CMemSpyEngineHelperProcess@@QAEXABVCMemSpyProcess@@@Z @ 299 NONAME ; void CMemSpyEngineHelperProcess::OutputProcessInfoL(class CMemSpyProcess const &)
-	?OutputRawL@CMemSpyEngineOutputSink@@QAEXABVTDesC8@@@Z @ 300 NONAME ; void CMemSpyEngineOutputSink::OutputRawL(class TDesC8 const &)
-	?OutputSectionHeadingL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@VTChar@@@Z @ 301 NONAME ; void CMemSpyEngineOutputSink::OutputSectionHeadingL(class TDesC16 const &, class TChar)
-	?OutputStackDataL@CMemSpyEngineHelperStack@@QAEXABVCMemSpyThread@@W4TMemSpyDriverDomainType@@@Z @ 302 NONAME ; void CMemSpyEngineHelperStack::OutputStackDataL(class CMemSpyThread const &, enum TMemSpyDriverDomainType)
-	?OutputStackDataL@CMemSpyEngineHelperStack@@QAEXABVCMemSpyThread@@W4TMemSpyDriverDomainType@@H@Z @ 303 NONAME ; void CMemSpyEngineHelperStack::OutputStackDataL(class CMemSpyThread const &, enum TMemSpyDriverDomainType, int)
-	?OutputStackInfoForDeviceL@CMemSpyEngineHelperStack@@QAEXXZ @ 304 NONAME ; void CMemSpyEngineHelperStack::OutputStackInfoForDeviceL(void)
-	?OutputStackInfoL@CMemSpyEngineHelperStack@@QAEXABVCMemSpyThread@@@Z @ 305 NONAME ; void CMemSpyEngineHelperStack::OutputStackInfoL(class CMemSpyThread const &)
-	?OutputStackInfoL@CMemSpyEngineHelperStack@@QAEXVTProcessId@@VTThreadId@@AAVTDes16@@@Z @ 306 NONAME ; void CMemSpyEngineHelperStack::OutputStackInfoL(class TProcessId, class TThreadId, class TDes16 &)
-	?OutputThreadInfoL@CMemSpyEngineHelperThread@@QAEXABVCMemSpyThread@@H@Z @ 307 NONAME ; void CMemSpyEngineHelperThread::OutputThreadInfoL(class CMemSpyThread const &, int)
-	?OwnerName@CMemSpyEngineChunkEntry@@QBEXAAVTDes16@@@Z @ 308 NONAME ; void CMemSpyEngineChunkEntry::OwnerName(class TDes16 &) const
-	?PanicL@CMemSpyProcess@@QAEXXZ @ 309 NONAME ; void CMemSpyProcess::PanicL(void)
-	?PanicL@CMemSpyThread@@QAEXXZ @ 310 NONAME ; void CMemSpyThread::PanicL(void)
-	?Parent@CMemSpyEngineObject@@QBEPAV1@XZ @ 311 NONAME ; class CMemSpyEngineObject * CMemSpyEngineObject::Parent(void) const
-	?PrintL@CMemSpyThreadInfoContainer@@QAEXXZ @ 312 NONAME ; void CMemSpyThreadInfoContainer::PrintL(void)
-	?PrintL@CMemSpyThreadInfoItemBase@@QAEXXZ @ 313 NONAME ; void CMemSpyThreadInfoItemBase::PrintL(void)
-	?ProcessAndThreadByFullName@CMemSpyEngineObjectContainer@@QBEHABVTDesC16@@AAPAVCMemSpyProcess@@AAPAVCMemSpyThread@@@Z @ 314 NONAME ; int CMemSpyEngineObjectContainer::ProcessAndThreadByFullName(class TDesC16 const &, class CMemSpyProcess * &, class CMemSpyThread * &) const
-	?ProcessAndThreadByPartialName@CMemSpyEngineObjectContainer@@QBEHABVTDesC16@@AAPAVCMemSpyProcess@@AAPAVCMemSpyThread@@@Z @ 315 NONAME ; int CMemSpyEngineObjectContainer::ProcessAndThreadByPartialName(class TDesC16 const &, class CMemSpyProcess * &, class CMemSpyThread * &) const
-	?ProcessAndThreadByThreadId@CMemSpyEngineObjectContainer@@QBEHVTThreadId@@AAPAVCMemSpyProcess@@AAPAVCMemSpyThread@@@Z @ 316 NONAME ; int CMemSpyEngineObjectContainer::ProcessAndThreadByThreadId(class TThreadId, class CMemSpyProcess * &, class CMemSpyThread * &) const
-	?ProcessByIdL@CMemSpyEngineObjectContainer@@QBEAAVCMemSpyProcess@@VTProcessId@@@Z @ 317 NONAME ; class CMemSpyProcess & CMemSpyEngineObjectContainer::ProcessByIdL(class TProcessId) const
-	?ProcessId@CMemSpyEngineOpenFileListForThread@@QBEABVTProcessId@@XZ @ 318 NONAME ; class TProcessId const & CMemSpyEngineOpenFileListForThread::ProcessId(void) const
-	?ProcessIndexById@CMemSpyEngineObjectContainer@@QBEHVTProcessId@@@Z @ 319 NONAME ; int CMemSpyEngineObjectContainer::ProcessIndexById(class TProcessId) const
-	?RebuildL@CMemSpyThreadInfoItemBase@@UAEXXZ @ 320 NONAME ; void CMemSpyThreadInfoItemBase::RebuildL(void)
-	?RefreshL@CMemSpyEngineObjectContainer@@QAEXABVTDesC16@@@Z @ 321 NONAME ; void CMemSpyEngineObjectContainer::RefreshL(class TDesC16 const &)
-	?RefreshL@CMemSpyEngineObjectContainer@@QAEXXZ @ 322 NONAME ; void CMemSpyEngineObjectContainer::RefreshL(void)
-	?RemoveObserver@CMemSpyEngineHelperSysMemTracker@@QAEXPAVMMemSpyEngineHelperSysMemTrackerObserver@@@Z @ 323 NONAME ; void CMemSpyEngineHelperSysMemTracker::RemoveObserver(class MMemSpyEngineHelperSysMemTrackerObserver *)
-	?RemoveObserver@CMemSpyEngineProcessMemoryTracker@@QAEXAAVMMemSpyEngineProcessMemoryTrackerObserver@@@Z @ 324 NONAME ; void CMemSpyEngineProcessMemoryTracker::RemoveObserver(class MMemSpyEngineProcessMemoryTrackerObserver &)
-	?RequestIsPending@CMemSpyEngineActiveObject@@QBEHXZ @ 325 NONAME ; int CMemSpyEngineActiveObject::RequestIsPending(void) const
-	?ResetHWML@CMemSpyEngineProcessMemoryTracker@@QAEXXZ @ 326 NONAME ; void CMemSpyEngineProcessMemoryTracker::ResetHWML(void)
-	?SID@CMemSpyProcess@@QBEKXZ @ 327 NONAME ; unsigned long CMemSpyProcess::SID(void) const
-	?ServerListL@CMemSpyEngineHelperServer@@QAEPAVCMemSpyEngineServerList@@XZ @ 328 NONAME ; class CMemSpyEngineServerList * CMemSpyEngineHelperServer::ServerListL(void)
-	?SessionType@CMemSpyThreadInfoServer@@SA?AVTPtrC16@@W4TIpcSessionType@@@Z @ 329 NONAME ; class TPtrC16 CMemSpyThreadInfoServer::SessionType(enum TIpcSessionType)
-	?SetAknIconCacheStatusL@CMemSpyEngineHelperRAM@@QAE_JH@Z @ 330 NONAME ; long long CMemSpyEngineHelperRAM::SetAknIconCacheStatusL(int)
-	?SetConfigL@CMemSpyEngineHelperSysMemTracker@@QAEXABVTMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 331 NONAME ; void CMemSpyEngineHelperSysMemTracker::SetConfigL(class TMemSpyEngineHelperSysMemTrackerConfig const &)
-	?SetMemoryTrackingAutoStartProcessListL@CMemSpyEngineHelperProcess@@QAEXABV?$RArray@VTUid@@@@@Z @ 332 NONAME ; void CMemSpyEngineHelperProcess::SetMemoryTrackingAutoStartProcessListL(class RArray<class TUid> const &)
-	?SetObserver@CMemSpyEngine@@QAEXPAVMMemSpyEngineObserver@@@Z @ 333 NONAME ; void CMemSpyEngine::SetObserver(class MMemSpyEngineObserver *)
-	?SetObserver@CMemSpyEngineDriveEntry@@QAEXPAVMMemSpyEngineDriveEntryObserver@@@Z @ 334 NONAME ; void CMemSpyEngineDriveEntry::SetObserver(class MMemSpyEngineDriveEntryObserver *)
-	?SetObserver@CMemSpyEngineDriveList@@QAEXPAVMMemSpyEngineDriveListObserver@@@Z @ 335 NONAME ; void CMemSpyEngineDriveList::SetObserver(class MMemSpyEngineDriveListObserver *)
-	?SetObserver@CMemSpyEngineHelperSysMemTracker@@QAEXPAVMMemSpyEngineHelperSysMemTrackerObserver@@@Z @ 336 NONAME ; void CMemSpyEngineHelperSysMemTracker::SetObserver(class MMemSpyEngineHelperSysMemTrackerObserver *)
-	?SetParent@CMemSpyEngineObject@@QAEXPAV1@@Z @ 337 NONAME ; void CMemSpyEngineObject::SetParent(class CMemSpyEngineObject *)
-	?SetPriorityL@CMemSpyThread@@QAEXW4TThreadPriority@@@Z @ 338 NONAME ; void CMemSpyThread::SetPriorityL(enum TThreadPriority)
-	?ShowOnlyEntriesWithGlobalDataL@CMemSpyEngineCodeSegList@@QAEXXZ @ 339 NONAME ; void CMemSpyEngineCodeSegList::ShowOnlyEntriesWithGlobalDataL(void)
-	?Sink@CMemSpyEngine@@QAEAAVCMemSpyEngineOutputSink@@XZ @ 340 NONAME ; class CMemSpyEngineOutputSink & CMemSpyEngine::Sink(void)
-	?SinkType@CMemSpyEngine@@QAE?AW4TMemSpySinkType@@XZ @ 341 NONAME ; enum TMemSpySinkType CMemSpyEngine::SinkType(void)
-	?Size@CMemSpyEngineOpenFileListEntry@@QBEHXZ @ 342 NONAME ; int CMemSpyEngineOpenFileListEntry::Size(void) const
-	?SortByCodeSegs@CMemSpyEngineObjectContainer@@QAEXXZ @ 343 NONAME ; void CMemSpyEngineObjectContainer::SortByCodeSegs(void)
-	?SortByCodeSizeL@CMemSpyEngineCodeSegList@@QAEXXZ @ 344 NONAME ; void CMemSpyEngineCodeSegList::SortByCodeSizeL(void)
-	?SortByDataSizeL@CMemSpyEngineCodeSegList@@QAEXXZ @ 345 NONAME ; void CMemSpyEngineCodeSegList::SortByDataSizeL(void)
-	?SortByFileNameL@CMemSpyEngineCodeSegList@@QAEXXZ @ 346 NONAME ; void CMemSpyEngineCodeSegList::SortByFileNameL(void)
-	?SortByHeapUsage@CMemSpyEngineObjectContainer@@QAEXXZ @ 347 NONAME ; void CMemSpyEngineObjectContainer::SortByHeapUsage(void)
-	?SortById@CMemSpyEngineObjectContainer@@QAEXXZ @ 348 NONAME ; void CMemSpyEngineObjectContainer::SortById(void)
-	?SortByName@CMemSpyEngineObjectContainer@@QAEXXZ @ 349 NONAME ; void CMemSpyEngineObjectContainer::SortByName(void)
-	?SortByNameL@CMemSpyEngineChunkList@@QAEXXZ @ 350 NONAME ; void CMemSpyEngineChunkList::SortByNameL(void)
-	?SortByNameL@CMemSpyEngineServerList@@QAEXXZ @ 351 NONAME ; void CMemSpyEngineServerList::SortByNameL(void)
-	?SortBySessionCountL@CMemSpyEngineServerList@@QAEXXZ @ 352 NONAME ; void CMemSpyEngineServerList::SortBySessionCountL(void)
-	?SortBySizeL@CMemSpyEngineChunkList@@QAEXXZ @ 353 NONAME ; void CMemSpyEngineChunkList::SortBySizeL(void)
-	?SortByStackUsage@CMemSpyEngineObjectContainer@@QAEXXZ @ 354 NONAME ; void CMemSpyEngineObjectContainer::SortByStackUsage(void)
-	?SortByThreadCount@CMemSpyEngineObjectContainer@@QAEXXZ @ 355 NONAME ; void CMemSpyEngineObjectContainer::SortByThreadCount(void)
-	?SortByUidsL@CMemSpyEngineCodeSegList@@QAEXXZ @ 356 NONAME ; void CMemSpyEngineCodeSegList::SortByUidsL(void)
-	?StartL@CMemSpyEngineHelperSysMemTracker@@QAEXABVTMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 357 NONAME ; void CMemSpyEngineHelperSysMemTracker::StartL(class TMemSpyEngineHelperSysMemTrackerConfig const &)
-	?StartL@CMemSpyEngineHelperSysMemTracker@@QAEXXZ @ 358 NONAME ; void CMemSpyEngineHelperSysMemTracker::StartL(void)
-	?StartL@CMemSpyEngineProcessMemoryTracker@@QAEXXZ @ 359 NONAME ; void CMemSpyEngineProcessMemoryTracker::StartL(void)
-	?Stop@CMemSpyEngineProcessMemoryTracker@@QAEXXZ @ 360 NONAME ; void CMemSpyEngineProcessMemoryTracker::Stop(void)
-	?StopL@CMemSpyEngineHelperSysMemTracker@@QAEXXZ @ 361 NONAME ; void CMemSpyEngineHelperSysMemTracker::StopL(void)
-	?StripText@MemSpyEngineUtils@@SAHAAVTDes16@@ABVTDesC16@@@Z @ 362 NONAME ; int MemSpyEngineUtils::StripText(class TDes16 &, class TDesC16 const &)
-	?TerminateL@CMemSpyProcess@@QAEXXZ @ 363 NONAME ; void CMemSpyProcess::TerminateL(void)
-	?TerminateL@CMemSpyThread@@QAEXXZ @ 364 NONAME ; void CMemSpyThread::TerminateL(void)
-	?TextAfterDoubleColon@MemSpyEngineUtils@@SAXAAVTDes16@@@Z @ 365 NONAME ; void MemSpyEngineUtils::TextAfterDoubleColon(class TDes16 &)
-	?TextBeforeDoubleColon@MemSpyEngineUtils@@SAXAAVTDes16@@@Z @ 366 NONAME ; void MemSpyEngineUtils::TextBeforeDoubleColon(class TDes16 &)
-	?ThreadByIdL@CMemSpyProcess@@QBEAAVCMemSpyThread@@VTThreadId@@@Z @ 367 NONAME ; class CMemSpyThread & CMemSpyProcess::ThreadByIdL(class TThreadId) const
-	?ThreadId@CMemSpyEngineOpenFileListForThread@@QBEABVTThreadId@@XZ @ 368 NONAME ; class TThreadId const & CMemSpyEngineOpenFileListForThread::ThreadId(void) const
-	?ThreadIndexById@CMemSpyProcess@@QBEHVTThreadId@@@Z @ 369 NONAME ; int CMemSpyProcess::ThreadIndexById(class TThreadId) const
-	?ThreadName@CMemSpyEngineOpenFileListForThread@@QBEABVTDesC16@@XZ @ 370 NONAME ; class TDesC16 const & CMemSpyEngineOpenFileListForThread::ThreadName(void) const
-	?Time@CMemSpyEngineHelperSysMemTrackerCycle@@QBEABVTTime@@XZ @ 371 NONAME ; class TTime const & CMemSpyEngineHelperSysMemTrackerCycle::Time(void) const
-	?TimeFormatted@CMemSpyEngineHelperSysMemTrackerCycle@@QBEABVTDesC16@@XZ @ 372 NONAME ; class TDesC16 const & CMemSpyEngineHelperSysMemTrackerCycle::TimeFormatted(void) const
-	?TotalIncludesSharedMemory@CMemSpyThreadInfoMemoryTracking@@QBEHXZ @ 373 NONAME ; int CMemSpyThreadInfoMemoryTracking::TotalIncludesSharedMemory(void) const
-	?TotalOperationSize@CMemSpyDeviceWideOperations@@QBEHXZ @ 374 NONAME ; int CMemSpyDeviceWideOperations::TotalOperationSize(void) const
-	?TrackingActive@CMemSpyThreadInfoMemoryTracking@@QBEHXZ @ 375 NONAME ; int CMemSpyThreadInfoMemoryTracking::TrackingActive(void) const
-	?TrackingObserverAddL@CMemSpyThreadInfoMemoryTracking@@QAEXAAVMMemSpyEngineProcessMemoryTrackerObserver@@@Z @ 376 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL(class MMemSpyEngineProcessMemoryTrackerObserver &)
-	?TrackingObserverRemove@CMemSpyThreadInfoMemoryTracking@@QAEXAAVMMemSpyEngineProcessMemoryTrackerObserver@@@Z @ 377 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove(class MMemSpyEngineProcessMemoryTrackerObserver &)
-	?TrackingResetHWML@CMemSpyThreadInfoMemoryTracking@@QAEXXZ @ 378 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingResetHWML(void)
-	?TrackingSetTotalIncludesSharedMemoryL@CMemSpyThreadInfoMemoryTracking@@QAEXH@Z @ 379 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingSetTotalIncludesSharedMemoryL(int)
-	?TrackingStartL@CMemSpyThreadInfoMemoryTracking@@QAEXXZ @ 380 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingStartL(void)
-	?TrackingStopL@CMemSpyThreadInfoMemoryTracking@@QAEXXZ @ 381 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingStopL(void)
-	?Type@CMemSpyEngineGenericKernelObjectList@@QBE?AW4TMemSpyDriverContainerType@@XZ @ 382 NONAME ; enum TMemSpyDriverContainerType CMemSpyEngineGenericKernelObjectList::Type(void) const
-	?Type@CMemSpyThreadInfoItemBase@@QBE?AW4TMemSpyThreadInfoItemType@@XZ @ 383 NONAME ; enum TMemSpyThreadInfoItemType CMemSpyThreadInfoItemBase::Type(void) const
-	?TypeAsString@CMemSpyEngineGenericKernelObjectList@@SA?AVTPtrC16@@W4TMemSpyDriverContainerType@@@Z @ 384 NONAME ; class TPtrC16 CMemSpyEngineGenericKernelObjectList::TypeAsString(enum TMemSpyDriverContainerType)
-	?VID@CMemSpyProcess@@QBEKXZ @ 385 NONAME ; unsigned long CMemSpyProcess::VID(void) const
-	__E32Dll @ 386 NONAME ABSENT ; int CMemSpyEngineWindowGroupList::MdcaCount(void) const
-	__E32Dll @ 387 NONAME ABSENT ; void CMemSpyEngineHelperWindowServer::GetWindowGroupListL(class RArray<class TMemSpyEngineWindowGroupInfo> &)
-	__E32Dll @ 388 NONAME ABSENT ; CMemSpyEngineWindowGroupList::~CMemSpyEngineWindowGroupList(void)
-	__E32Dll @ 389 NONAME ABSENT ; int CMemSpyEngineWindowGroupList::Count(void) const
-	__E32Dll @ 390 NONAME ABSENT ; int CMemSpyEngineWindowGroupList::ItemIndex(class TMemSpyEngineWindowGroupInfo const &) const
-	__E32Dll @ 391 NONAME ABSENT ; class CMemSpyEngineWindowGroupList * CMemSpyEngineHelperWindowServer::WindowGroupListL(void)
-	__E32Dll @ 392 NONAME ABSENT ; class CMemSpyEngineHelperWindowServer & CMemSpyEngine::HelperWindowServer(void)
-	__E32Dll @ 393 NONAME ABSENT ; class TPtrC16 CMemSpyEngineWindowGroupList::MdcaPoint(int) const
-	__E32Dll @ 394 NONAME ABSENT ; class TMemSpyEngineWindowGroupInfo const & CMemSpyEngineWindowGroupList::At(int) const
-	__E32Dll @ 395 NONAME ABSENT ; int CMemSpyEngineWindowGroupList::ItemIndex(class TMemSpyEngineWindowGroupBasicInfo const &) const
-	__E32Dll @ 396 NONAME ABSENT ; class TMemSpyEngineWindowGroupBasicInfo const & CMemSpyEngineWindowGroupList::At(int) const
-	__E32Dll @ 397 NONAME ABSENT ; void CMemSpyEngineHelperWindowServer::GetWindowGroupListL(class RArray<class TMemSpyEngineWindowGroupBasicInfo> &)
-	__E32Dll @ 398 NONAME ABSENT ; void CMemSpyEngineHelperWindowServer::GetWindowGroupDetailsL(int, class TMemSpyEngineWindowGroupDetails &)
-	__E32Dll @ 399 NONAME ABSENT ; void CMemSpyEngineHelperWindowServer::SwitchToL(int)
-	?Capabilities@CMemSpyProcess@@QBE?AUSCapabilitySet@@XZ @ 400 NONAME ; struct SCapabilitySet CMemSpyProcess::Capabilities(void) const
-	?UIDs@CMemSpyProcess@@QBE?AVTUidType@@XZ @ 401 NONAME ; class TUidType CMemSpyProcess::UIDs(void) const
-	?HelperCondVar@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperCondVar@@XZ @ 402 NONAME ; class CMemSpyEngineHelperCondVar & CMemSpyEngine::HelperCondVar(void)
-	?GetCondVarSuspendedThreadsL@CMemSpyEngineHelperCondVar@@QAEXABVTMemSpyDriverHandleInfoGeneric@@AAV?$RArray@VTMemSpyDriverCondVarSuspendedThreadInfo@@@@@Z @ 403 NONAME ; void CMemSpyEngineHelperCondVar::GetCondVarSuspendedThreadsL(class TMemSpyDriverHandleInfoGeneric const &, class RArray<class TMemSpyDriverCondVarSuspendedThreadInfo> &)
-	?HelperWindowServer@CMemSpyEngine@@QAEAAVMMemSpyEngineHelperWindowServer@@XZ @ 404 NONAME ; class MMemSpyEngineHelperWindowServer & CMemSpyEngine::HelperWindowServer(void)
-	?IsHelperWindowServerSupported@CMemSpyEngine@@QAEHXZ @ 405 NONAME ; int CMemSpyEngine::IsHelperWindowServerSupported(void)
-	__E32Dll @ 406 NONAME ABSENT ; int CMemSpyEngineGenericKernelObjectList::Size(void) const
-	__E32Dll @ 407 NONAME ABSENT ; int CMemSpyEngineGenericKernelObjectList::Size(void)
-	?Size@CMemSpyEngineGenericKernelObjectList@@QBEHXZ @ 408 NONAME ; int CMemSpyEngineGenericKernelObjectList::Size(void) const
-	?NewHeapRawInfo@CMemSpyEngineHelperHeap@@QAEAAVTMemSpyHeapData@@ABVTMemSpyHeapInfo@@@Z @ 409 NONAME ABSENT ; class TMemSpyHeapData & CMemSpyEngineHelperHeap::NewHeapRawInfo(class TMemSpyHeapInfo const &)
-	?NewHeapRawInfo@CMemSpyEngineHelperHeap@@QAE?AVTMemSpyHeapData@@ABVTMemSpyHeapInfo@@@Z @ 410 NONAME ; class TMemSpyHeapData CMemSpyEngineHelperHeap::NewHeapRawInfo(class TMemSpyHeapInfo const &)
-	?ItemsCount@CMemSpyEngineGenericKernelObjectList@@QBEHXZ @ 411 NONAME ; int CMemSpyEngineGenericKernelObjectList::ItemsCount(void) const
-	?Priority@CMemSpyThread@@QBE?AW4TThreadPriority@@XZ @ 412 NONAME ; enum TThreadPriority CMemSpyThread::Priority(void) const
-	?NewL@CMemSpyEngine@@SAPAV1@AAVRFs@@H@Z @ 413 NONAME ; class CMemSpyEngine * CMemSpyEngine::NewL(class RFs &, int)
-	?Value@CMemSpyThreadInfoItemBase@@QBE?AVTPtrC16@@H@Z @ 414 NONAME ; class TPtrC16 CMemSpyThreadInfoItemBase::Value(int) const
-	?ExitType@CMemSpyProcess@@QBE?AW4TExitType@@XZ @ 415 NONAME ; enum TExitType CMemSpyProcess::ExitType(void) const
-	?ExitCategory@CMemSpyProcess@@QBE?AV?$TBuf@$0BA@@@XZ @ 416 NONAME ; class TBuf<16> CMemSpyProcess::ExitCategory(void) const
-	?Priority@CMemSpyProcess@@QBE?AW4TProcessPriority@@XZ @ 417 NONAME ; enum TProcessPriority CMemSpyProcess::Priority(void) const
-	?Caption@CMemSpyThreadInfoItemBase@@QBE?AVTPtrC16@@H@Z @ 418 NONAME ; class TPtrC16 CMemSpyThreadInfoItemBase::Caption(int) const
-	?ExitReason@CMemSpyProcess@@QBEHXZ @ 419 NONAME ; int CMemSpyProcess::ExitReason(void) const
-	?NewL@CMemSpyEngineSinkMetaData@@SAPAV1@ABVTDesC16@@000HHABVTTime@@@Z @ 420 NONAME ; class CMemSpyEngineSinkMetaData * CMemSpyEngineSinkMetaData::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, int, int, class TTime const &)
-	?InstallDebugSinkL@CMemSpyEngine@@QAEXXZ @ 421 NONAME ; void CMemSpyEngine::InstallDebugSinkL(void)
-	?NewL@CMemSpyEngineSinkMetaData@@SAPAV1@ABVTDesC16@@000HH@Z @ 422 NONAME ; class CMemSpyEngineSinkMetaData * CMemSpyEngineSinkMetaData::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, int, int)
-	?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)
-
--- a/memspy/Engine/Include/ClientServer/MemSpyEngineServer.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +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 MEMSPYENGINESERVER_H
-#define MEMSPYENGINESERVER_H
-
-// System includes
-#include <e32base.h>
-
-// User includes
-#include <memspyengineclientinterface.h>
-#include <memspy/engine/memspydevicewideoperations.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyDwOperationTracker;
-
-NONSHARABLE_CLASS( CShutdown ) : public CTimer
-    {
-    enum {KMyShutdownDelay=10 * 1000000};       // 10s
-public:
-    inline CShutdown();
-    inline void ConstructL();
-    inline void Start();
-private:
-    void RunL();
-    };
-
-NONSHARABLE_CLASS( CMemSpyEngineServer ) : public CServer2
-    {
-public:
-    static CMemSpyEngineServer* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineServer();
-    
-    CMemSpyDwOperationTracker* CurrentOperationTracker() const { return iCurrentOperationTracker; }
-    void SetCurrentOperationTracker(CMemSpyDwOperationTracker* aTracker) { iCurrentOperationTracker = aTracker; }
-    
-    CMemSpyEngine& Engine() { return iEngine; } 
-    
-    void AddSession(TBool aCliRequest);
-    void DropSession(TBool aCliRequest);
-
-private:
-    CMemSpyEngineServer( CMemSpyEngine& aEngine );
-	void ConstructL();
-
-protected: // From CServer2
-	CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
-
-private:
-    CMemSpyEngine& iEngine;
-    CMemSpyDwOperationTracker* iCurrentOperationTracker;
-    
-    TInt iSessionCount;
-    TBool iCliConnected;
-    
-    CShutdown iShutdown;
-    };
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineSession ) : public CSession2
-	{
-public:
-	static CMemSpyEngineSession* NewL( CMemSpyEngine& aEngine, const RMessage2& aMessage );
-	~CMemSpyEngineSession();
-	
-	void CreateL();
-	
-private:
-	CMemSpyEngineSession( CMemSpyEngine& aEngine );
-	void ConstructL( const RMessage2& aMessage );
-
-private: // From CSession2
-	void ServiceL( const RMessage2& aMessage );
-
-private: // Internal methods
-    void DoServiceL( const RMessage2& aMessage );
-    void DoAsyncServiceL( const RMessage2& aMessage );
-    void DoUiServiceL( const RMessage2& aMessage );
-    void DoCmdServiceL( const RMessage2& aMessage );
-    static TInt ValidateFunction( TInt aFunction, TBool aIncludesThreadId, TBool aIncludesThreadName );
-    void HandleThreadSpecificOpL( TInt aFunction, const TThreadId& aThreadId );
-    void HandleThreadSpecificOpL( TInt aFunction, const TDesC& aThreadName );
-    void HandleThreadAgnosticOpL( TInt aFunction, const RMessage2& aMessage );
-    void StartDeviceWideOperationL(CMemSpyDeviceWideOperations::TOperation aOperation, const RMessage2& aMessage);
-    
-    inline CMemSpyEngineServer& Server() const { return *static_cast<CMemSpyEngineServer*>(const_cast<CServer2*>(CSession2::Server())); }
-
-private:
-    CMemSpyEngine& iEngine;
-    HBufC* iClientThreadName;
-    TUint32 iClientThreadId;
-    TBool iIsCliRequest;
-    };
-
-/**
- * CMemSpyDwOperationTracker
- * Tracks device wide operation progress and calls iOperationMessage.Complete upon completion. 
- */
-NONSHARABLE_CLASS( CMemSpyDwOperationTracker ) : public MMemSpyDeviceWideOperationsObserver
-	{
-public:
-	static CMemSpyDwOperationTracker* NewL(CMemSpyDeviceWideOperations::TOperation aOperation, 
-			const RMessage2& aOperationMessage,
-			CMemSpyEngineServer& aServer);
-	~CMemSpyDwOperationTracker();
-	
-	void AddNotificationL(const RMessage2& aMessage);
-	
-	void Cancel();
-
-public: // From MMemSpyDeviceWideOperationsObserver
-	void HandleDeviceWideOperationEvent(TEvent aEvent, TInt aParam1, const TDesC& aParam2);
-	
-private:
-	CMemSpyDwOperationTracker(const RMessage2& aOperationMessage, CMemSpyEngineServer& aServer);
-	void ConstructL(CMemSpyDeviceWideOperations::TOperation aOperation);
-	
-private:
-	RMessage2 iOperationMessage;
-	CMemSpyEngineServer& iServer;
-	CArrayFixFlat<RMessage2>* iPendingNotifications;
-	CMemSpyDeviceWideOperations* iOperation;
-	TInt iProgress;
-	};
-
-
-#endif
--- a/memspy/Engine/Include/EventHandlers/MemSpyEngineChunkWatcher.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +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 MEMSPYENGINECHUNKWATCHER_H
-#define MEMSPYENGINECHUNKWATCHER_H
-
-// System includes
-#include <e32base.h>
-
-// Classes referenced
-class RMemSpyDriverClient;
-
-
-class MMemSpyEngineChunkWatcherObserver
-	{
-public: // From MMemSpyEngineChunkWatcherObserver
-	virtual void HandleChunkAddL( TUint aChunkHandle ) = 0;
-    virtual void HandleChunkDestroyL( TUint aChunkHandle ) = 0;
-	};
-
-
-NONSHARABLE_CLASS( CMemSpyEngineChunkWatcher ) : public CActive
-    {
-public:
-	static CMemSpyEngineChunkWatcher* NewL( RMemSpyDriverClient& aDriver, TInt aPriority = CActive::EPriorityStandard );
-	~CMemSpyEngineChunkWatcher();
-
-private:
-	CMemSpyEngineChunkWatcher( RMemSpyDriverClient& aDriver, TInt aPriority );
-	void ConstructL();
-
-public: // API
-    void AddObserverL( MMemSpyEngineChunkWatcherObserver& aObserver );
-    void RemoveObserver( MMemSpyEngineChunkWatcherObserver& aObserver );
-
-private: // From CActive
-	void RunL();
-	void DoCancel();
-
-private: // Internal methods
-    void Request();
-    void NotifyChunkAddL( TUint aChunkHandle );
-    void NotifyChunkDestroyL( TUint aChunkHandle );
-
-private: // Data members
-    TUint iId;
-    TUint iEventMonitorHandle;
-    RMemSpyDriverClient& iDriver;
-	RPointerArray< MMemSpyEngineChunkWatcherObserver > iObservers;
-    };
-
-
-
-
-#endif
--- a/memspy/Engine/Include/Sink/MemSpyEngineOutputListItem.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +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 MEMSPYENGINEOUTPUTLISTITEM_H
-#define MEMSPYENGINEOUTPUTLISTITEM_H
-
-// System includes
-#include <e32base.h>
-
-
-NONSHARABLE_CLASS( CMemSpyEngineOutputListItem ) : public CBase
-    {
-    friend class CMemSpyEngineOutputList;
-
-public:
-    static CMemSpyEngineOutputListItem* NewLC( const CMemSpyEngineOutputListItem& aCopyMe );
-    static CMemSpyEngineOutputListItem* NewLC( const TDesC& aCaption );
-    static CMemSpyEngineOutputListItem* NewLC( const TDesC& aCaption, const TDesC& aValue );
-    static CMemSpyEngineOutputListItem* NewLC( const TDesC& aCaption, TUint aValue );
-    static CMemSpyEngineOutputListItem* NewHexLC( const TDesC& aCaption, TUint aValue );
-    static CMemSpyEngineOutputListItem* NewDecimalLC( const TDesC& aCaption, TInt aValue );
-    static CMemSpyEngineOutputListItem* NewLongLC( const TDesC& aCaption, const TInt64& aValue );
-    static CMemSpyEngineOutputListItem* NewYesNoLC( const TDesC& aCaption, TBool aYes );
-    static CMemSpyEngineOutputListItem* NewTrueFalseLC( const TDesC& aCaption, TBool aTrue );
-    static CMemSpyEngineOutputListItem* NewOnOffLC( const TDesC& aCaption, TBool aOn );
-    static CMemSpyEngineOutputListItem* NewPercentageLC( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue );
-    ~CMemSpyEngineOutputListItem();
-
-private:
-    CMemSpyEngineOutputListItem();
-    void ConstructL( const TDesC& aCaption, const TDesC& aValue );
-
-public: // API
-    inline const TDesC& Caption() const { return *iCaption; }
-    inline const TDesC& Value() const { return *iValue; }
-    inline const TDesC& Combined() const { return *iCombined; }
-    void UpdateCombinedL();
-
-public:
-    void SetValueL( const TDesC& aValue );
-    void SetHexL( TUint aValue );
-    void SetDecimalL( TInt aValue );
-    void SetUnsignedL( TUint aValue );
-    void SetLongL( const TInt64& aValue );
-    void SetYesNoL( TBool aYes );
-    void SetTrueFalseL( TBool aTrue );
-    void SetOnOffL( TBool aOn );
-    void SetPercentageL( TInt aOneHundredPercentValue, TInt aValue );
-
-private:
-    HBufC* iCaption;
-    HBufC* iValue;
-    HBufC* iCombined;
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/Sink/MemSpyEngineOutputSinkDebug.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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 MEMSPYENGINEOUTPUTSINKDEBUG_H
-#define MEMSPYENGINEOUTPUTSINKDEBUG_H
-
-// System includes
-#include <e32base.h>
-
-// User includes
-#include <memspy/engine/memspyengineoutputsink.h>
-
-// Classes referenced
-class CMemSpyEngine;
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineOutputSinkDebug ) : public CMemSpyEngineOutputSink
-    {
-public:
-    static CMemSpyEngineOutputSinkDebug* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineOutputSinkDebug();
-
-public:
-    CMemSpyEngineOutputSinkDebug( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-private: // From CMemSpyEngineOutputSink
-    TMemSpySinkType Type() const;
-    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension );
-    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite );
-    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseTimeStamp );
-    void DataStreamEndL();
-    void DoOutputLineL( const TDesC& aLine );
-    void DoOutputRawL( const TDesC8& aData );
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/Sink/MemSpyEngineOutputSinkFile.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +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 MEMSPYENGINEOUTPUTSINKFILE_H
-#define MEMSPYENGINEOUTPUTSINKFILE_H
-
-// System includes
-#include <e32base.h>
-#include <f32file.h>
-
-// User includes
-#include <memspy/engine/memspyengineoutputsink.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyEngineFileHolder;
-
-NONSHARABLE_CLASS( CMemSpyEngineOutputSinkFile ) : public CMemSpyEngineOutputSink
-    {
-public:
-    static CMemSpyEngineOutputSinkFile* NewL( CMemSpyEngine& aEngine, const TDesC& aRootFolder );
-    ~CMemSpyEngineOutputSinkFile();
-
-public:
-    CMemSpyEngineOutputSinkFile( CMemSpyEngine& aEngine );
-    void ConstructL( const TDesC& aRootFolder );
-    
-private: // From CMemSpyEngineOutputSink
-    void ProcessSuspendedL( TProcessId aId );
-    void ProcessResumed( TProcessId aId );
-    TMemSpySinkType Type() const;
-    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension );
-    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite );
-    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseTimeStamp );
-    void DataStreamEndL();
-    void DoOutputLineL( const TDesC& aLine );
-    void DoOutputRawL( const TDesC8& aData );
-    TBool IsPrefixAllowed( const TDesC& aPrefix );
-
-private: // Internal
-    void IdentifyFileServerProcessIdL();
-    void ConstructDefaultLogFileL();
-    void DisableAllBuffersAfterFileServerResumedL();
-    CMemSpyEngineFileHolder& HeadLog() const;
-
-private:
-    RFs iFsSession;
-    RPointerArray< CMemSpyEngineFileHolder > iLogs;
-    RPointerArray< CMemSpyEngineFileHolder > iLogsPendingDestruction;
-
-    TUint iFileServerProcessId;
-    TBool iFileServerSuspended;
-    
-    HBufC* iRoot;
-
-private:
-    friend class CMemSpyEngineFileHolder;
-    };
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineFileHolder ) : public CBase
-    {
-public:
-    static CMemSpyEngineFileHolder* NewLC( CMemSpyEngineOutputSinkFile& aParent );
-    static CMemSpyEngineFileHolder* NewL( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData );
-    static CMemSpyEngineFileHolder* NewLogToRAML( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData );
-    ~CMemSpyEngineFileHolder();
-
-private:
-    CMemSpyEngineFileHolder( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData = NULL );
-    void ConstructL();
-    void CommonConstructL();
-
-public: // API
-    void WriteLineL( const TDesC& aData );
-    void WriteRawL( const TDesC8& aData );
-    void EnableBufferL();
-    void DisableBufferL();
-    const TDesC& FileName() const;
-    //
-    inline TBool UsingBuffer() const { return iEntireFileBuffer != NULL; }
-    inline TBool IsMainLog() const { return iIsMainLog; }
-
-private: // Internal
-    void OpenFileL();
-    void AddToWorkingBufferL( const TDesC8& aText );
-    void FlushWorkingBufferL();
-    void PrepareFileL( const TDriveNumber* aForceDrive = NULL );
-    HBufC* CleanContextInfoLC( const TDesC& aContext );
-    HBufC* GenerateFileNameLC( const TDriveNumber* aForceDrive = NULL );
-    RFs& FsSession();
-
-private: // Data members
-    CMemSpyEngineOutputSinkFile& iParent;
-    CMemSpyEngineSinkMetaData* iMetaData;
-    RFile iFile;
-    HBufC* iFileName;
-    HBufC8* iLineBuffer;
-    TBool iIsMainLog;
-    CBufFlat* iEntireFileBuffer;
-    CBufFlat* iWorkingBuffer;
-    };
-
-
-
-#endif
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntries.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRIES_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRIES_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include <memspy/engine/memspyenginehelpersysmemtrackerenums.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-// Literal constants
-_LIT( KMemSpySWMTThreadNotFound, "Thread Not Found" );
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerEntry ) : public CBase
-    {
-protected:
-    CMemSpyEngineHelperSysMemTrackerEntry( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyEngineSysMemTrackerType aType );
-
-public: // API
-    void HandleNewCycleL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-public: // API - framework 
-    virtual TUint64 Key() const;
-    virtual void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
-
-protected: // API - framework, internal
-    virtual TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
-    virtual void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    virtual void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-public: // API - inline
-    inline TMemSpyEngineSysMemTrackerType Type() const { return iType; }
-    inline TUint8 Attributes() const { return iAttributes; }
-    //
-    inline TThreadId ThreadId() const { return iThreadId; }
-    inline void SetThread( TThreadId aThreadId ) { iThreadId = aThreadId; }
-    //
-    inline TProcessId ProcessId() const { return iProcessId; }
-    inline void SetProcess( TProcessId aProcessId ) { iProcessId = aProcessId; }
-    //
-    inline TUint32 Handle() const { return iHandle; }
-    inline void SetHandle( TAny* aHandle ) { iHandle = (TUint32) aHandle; }
-    inline void SetHandle( TUint32 aHandle ) { iHandle = aHandle; }
-    //
-    inline const TTime& LastUpdateTime() const { return iLastUpdateTime; }
-    
-public: // Attributes
-    inline TBool IsNew() const { return iAttributes & EMemSpyEngineSysMemTrackerEntryAttributeIsNew; }
-    inline void SetNew( TBool aNew );
-    //
-    inline TBool IsDead() const { return !IsAlive(); }
-    inline void SetDead() { iAttributes &= ~EMemSpyEngineSysMemTrackerEntryAttributeIsAlive; }
-    //
-    inline TBool IsAlive() const { return iAttributes & EMemSpyEngineSysMemTrackerEntryAttributeIsAlive; }
-    inline void SetAlive();
-
-protected: // Internal methods
-    CMemSpyEngine& Engine();
-    void UpdateTime();
-
-private: // Data members
-    CMemSpyEngineHelperSysMemTrackerImp& iTracker;
-    const TMemSpyEngineSysMemTrackerType iType;
-    TUint32 iThreadId;
-    TUint32 iProcessId;
-    TUint8 iAttributes;
-    TUint32 iHandle;
-    TTime iLastUpdateTime;
-    };
-
-
-
-
-
-// Helper class used when searching for entries
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerEntryWithSuppliedKey ) : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    inline CMemSpyEngineHelperSysMemTrackerEntryWithSuppliedKey( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TUint64& aKey )
-    : CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeCount ), iKey( aKey )
-        { }
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const { return iKey; }
-
-private: // Data members
-    const TUint64 iKey;
-    };
-
-
-
-
-
-inline void CMemSpyEngineHelperSysMemTrackerEntry::SetNew( TBool aNew )
-    {
-    if  ( aNew )
-        {
-        iAttributes |= EMemSpyEngineSysMemTrackerEntryAttributeIsNew;
-        }
-    else
-        {
-        iAttributes &= ~EMemSpyEngineSysMemTrackerEntryAttributeIsNew;
-        }
-    }
-
-
-inline void CMemSpyEngineHelperSysMemTrackerEntry::SetAlive()
-    {
-    iAttributes |= EMemSpyEngineSysMemTrackerEntryAttributeIsAlive;
-    UpdateTime();
-    }
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryBitmap.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYBITMAP_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYBITMAP_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
-
-// Classes referenced
-class CFbsBitmap;
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineOutputSink;
-class CMemSpyEngineOpenFileListEntry;
-class CMemSpyEngineOpenFileListForThread;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-class TMemSpyEngineFBServBitmapInfo;
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryBitmap : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryBitmap* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TInt aHandle );
-    ~CMemSpyEngineHelperSysMemTrackerEntryBitmap();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryBitmap( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
-    void ConstructL( TInt aHandle );
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const;
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-
-private: // Internal methods
-
-private: // Data members
-    TMemSpyEngineFBServBitmapInfo* iInfo;
-    };
-
-
-
-
-
-/**
- * Change descriptor associated with bitmap changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap* NewLC( TUint8 aAttribs, const TMemSpyEngineFBServBitmapInfo& aInfo );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap( TUint8 aAttrib );
-    void ConstructL( const TMemSpyEngineFBServBitmapInfo& aInfo );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    TMemSpyEngineFBServBitmapInfo* iInfo;
-    CFbsBitmap* iBitmap;
-    };
-
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryChunk.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYCHUNK_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYCHUNK_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryChunk : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryChunk* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo );
-    static CMemSpyEngineHelperSysMemTrackerEntryChunk* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo, CMemSpyProcess& aProcess );
-    ~CMemSpyEngineHelperSysMemTrackerEntryChunk();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryChunk( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
-    void ConstructL( const TMemSpyDriverChunkInfo& aInfo, const TDesC& aChunkFullName );
-    void ConstructL( const TMemSpyDriverChunkInfo& aInfo, CMemSpyProcess& aProcess );
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
-
-private: // Data members
-    TMemSpyDriverChunkInfo iLast;
-    TMemSpyDriverChunkInfo iCurrent;
-    HBufC* iChunkName;
-    };
-
-
-
-
-/**
- * Change descriptor associated with chunk-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeChunk ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeChunk* NewLC( TUint8 aAttribs, const TDesC& aChunkName, const TMemSpyDriverChunkInfo& aCurrent, const TMemSpyDriverChunkInfo* aLast = NULL );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeChunk();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeChunk( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent );
-    void ConstructL( const TDesC& aChunkName, const TMemSpyDriverChunkInfo* aLast );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    HBufC* iChunkName;
-    TMemSpyDriverChunkInfo iCurrent;
-    TMemSpyDriverChunkInfo* iLast;
-    };
-
-
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryCode.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYCODE_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYCODE_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineCodeSegEntry;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryCode : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryCode* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const CMemSpyEngineCodeSegEntry& aInfo );
-    ~CMemSpyEngineHelperSysMemTrackerEntryCode();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryCode( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
-    void ConstructL( const CMemSpyEngineCodeSegEntry& aInfo );
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-
-private: // Data members
-    HBufC* iCodeSegName;
-    TInt iSize;
-    };
-
-
-
-
-
-
-/**
- * Change descriptor associated with code-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeCode ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeCode* NewLC( TUint8 aAttribs, const TDesC& aCodeSegName, TUint32 aSize, TUint32 aHandle );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeCode();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeCode( TUint8 aAttribs, TUint32 aSize, TUint32 aHandle );
-    void ConstructL( const TDesC& aCodeSegName );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    HBufC* iCodeSegName;
-    TUint32 iSize;
-    TUint32 iHandle;
-    };
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryDiskSpace.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYDISKSPACE_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYDISKSPACE_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-#include <f32file.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryDiskSpace : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryDiskSpace* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TDriveNumber aDrive );
-    ~CMemSpyEngineHelperSysMemTrackerEntryDiskSpace();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryDiskSpace( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TDriveNumber aDrive );
-    void ConstructL();
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const;
-    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
-
-private: // Internal methods
-    void UpdateVolumeInfoL( TVolumeInfo& aInfo );
-
-private: // Data members
-    const TDriveNumber iDrive;
-    TVolumeInfo iLast;
-    TVolumeInfo iCurrent;
-    };
-
-
-
-
-
-
-
-
-
-/**
- * Change descriptor associated with open file-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace* NewLC( TUint8 aAttribs, TDriveNumber aDrive, const TVolumeInfo& aCurrent, const TVolumeInfo* aLast );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace( TUint8 aAttrib, TDriveNumber aDrive );
-    void ConstructL( const TVolumeInfo& aCurrent, const TVolumeInfo* aLast );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    const TDriveNumber iDrive;
-    TBuf<7> iDriveName;
-    //
-    HBufC* iName;
-    TUint iUniqueID;
-    TInt64 iSize;
-    TInt64 iFree;
-    };
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFbserv.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYFBSERV_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYFBSERV_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
-
-// Classes referenced
-class CFbsBitmap;
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineOutputSink;
-class CMemSpyEngineOpenFileListEntry;
-class CMemSpyEngineOpenFileListForThread;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-class TMemSpyEngineFBServBitmapInfo;
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryFbserv : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryFbserv* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aCurrentLarge, const TMemSpyDriverChunkInfo& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount );
-    ~CMemSpyEngineHelperSysMemTrackerEntryFbserv();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryFbserv( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aCurrentLarge, const TMemSpyDriverChunkInfo& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount );
-    void ConstructL();
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const;
-    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
-    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-
-private: // Internal methods
-
-private: // Data members
-    TMemSpyDriverChunkInfo iCurrentLarge;
-    TMemSpyDriverChunkInfo iCurrentShared;
-    TMemSpyDriverChunkInfoWithoutName iLastShared;
-    TMemSpyDriverChunkInfoWithoutName iLastLarge;
-    TInt iCurrentBitmapConCount;
-    TInt iCurrentFontConCount;
-    TInt iLastBitmapConCount;
-    TInt iLastFontConCount;
-    TInt iCurrentAccessibleBitmapCount;
-    TInt iLastAccessibleBitmapCount;
-    };
-
-
-
-
-
-/**
- * Change descriptor associated with bitmap changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv* NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfoWithoutName& aCurrentLarge, const TMemSpyDriverChunkInfoWithoutName& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv( TUint8 aAttrib, const TMemSpyDriverChunkInfoWithoutName& aCurrentLarge, const TMemSpyDriverChunkInfoWithoutName& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount );
-    void ConstructL();
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    const TMemSpyDriverChunkInfoWithoutName iSharedChunk;
-    const TMemSpyDriverChunkInfoWithoutName iLargeChunk;
-    const TInt iBitmapConCount;
-    const TInt iFontConCount;
-    const TInt iAccessibleBitmapCount;
-    };
-
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFileServerCache.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYFILESERVERCACHE_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYFILESERVERCACHE_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryFileServerCache : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryFileServerCache* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo );
-    ~CMemSpyEngineHelperSysMemTrackerEntryFileServerCache();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryFileServerCache( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo );
-    void ConstructL();
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
-
-private: // Data members
-    TMemSpyDriverChunkInfo iLast;
-    TMemSpyDriverChunkInfo iCurrent;
-    };
-
-
-
-
-/**
- * Change descriptor associated with chunk-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache* NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent );
-    void ConstructL();
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    TMemSpyDriverChunkInfo iCurrent;
-    };
-
-
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryGlobalData.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYGLOBALDATA_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYGLOBALDATA_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-class CMemSpyEngineHelperSysMemTrackerGlobalData : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerGlobalData* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyProcess& aProcess, const TMemSpyDriverChunkInfo& aChunkInfo );
-    ~CMemSpyEngineHelperSysMemTrackerGlobalData();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerGlobalData( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
-    void ConstructL( CMemSpyProcess& aProcess, const TMemSpyDriverChunkInfo& aChunkInfo );
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
-
-private: // Internal methods
-    TBool IsProcessGlobalData() const;
-    TInt CurrentGlobalDataSize() const;
-
-private: // Data members
-    TMemSpyDriverChunkInfoWithoutName iCurrent;
-    TMemSpyDriverChunkInfoWithoutName* iLast;
-    HBufC* iChunkName;
-    };
-
-
-
-
-
-
-
-/**
- * Change descriptor associated with global data-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData* NewLC( TUint8 aAttribs, const TDesC& aChunkName, const TMemSpyDriverChunkInfoWithoutName& aCurrent, const TMemSpyDriverChunkInfoWithoutName* aLast );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData( TUint8 aAttribs, const TMemSpyDriverChunkInfoWithoutName& aCurrent );
-    void ConstructL( const TDesC& aChunkName, const TMemSpyDriverChunkInfoWithoutName* aLast );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    HBufC* iChunkName;
-    TMemSpyDriverChunkInfoWithoutName iCurrent;
-    TMemSpyDriverChunkInfoWithoutName* iLast;
-    };
-
-
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHANDLEGENERIC_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHANDLEGENERIC_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineCodeSegEntry;
-class CMemSpyEngineOutputSink;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TAny* aHandle, TMemSpyDriverContainerType aType );
-    ~CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyDriverContainerType aType );
-    void ConstructL( TAny* aHandle );
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const;
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    HBufC* iName;
-    TMemSpyDriverContainerType iHandleType;
-    };
-
-
-
-
-
-/**
- * Change descriptor associated with handle-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric* NewLC( TUint8 aAttribs, const TDesC& aName, TUint32 aHandle, TMemSpyDriverContainerType aType );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric( TUint8 aAttribs, TUint32 aHandle, TMemSpyDriverContainerType aType );
-    void ConstructL( const TDesC& aName );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    HBufC* iName;
-    TUint32 iHandle;
-    TMemSpyDriverContainerType iType;
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHANDLEPANDS_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHANDLEPANDS_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineCodeSegEntry;
-class CMemSpyEngineOutputSink;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TAny* aHandle );
-    ~CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
-    void ConstructL( TAny* aHandle );
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const;
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    HBufC* iName;
-    HBufC* iThreadName;
-    TMemSpyDriverPAndSInfo iInfo;
-    };
-
-
-
-
-
-/**
- * Change descriptor associated with handle-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS* NewLC( TUint8 aAttribs, TUint32 aHandle, const TMemSpyDriverPAndSInfo& aInfo, const TDesC& aName, const TDesC& aThreadName );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS( TUint8 aAttribs, TUint32 aHandle, const TMemSpyDriverPAndSInfo& aInfo );
-    void ConstructL( const TDesC& aName, const TDesC& aThreadName );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    HBufC* iName;
-    HBufC* iThreadName;
-    TUint32 iHandle;
-    TMemSpyDriverPAndSInfo iInfo;
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHeap.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHEAP_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHEAP_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryHeap : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryHeap* NewUserLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyThread& aThread );
-    static CMemSpyEngineHelperSysMemTrackerEntryHeap* NewKernelLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
-    ~CMemSpyEngineHelperSysMemTrackerEntryHeap();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryHeap( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyEngineSysMemTrackerType aType );
-    void ConstructL();
-    void ConstructL( CMemSpyThread& aThread );
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const;
-    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
-    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-    void SetAsShared( TBool aShared );
-
-private: // Internal methods
-    void UpdateHeapInfoL( TMemSpyHeapInfo& aInfo );
-    TBool HasHeapSizeChanged() const;
-    TBool HaveFreeCellsChanged() const;
-    TBool HaveAllocCellsChanged() const;
-
-private: // Data members
-    TMemSpyHeapInfo iLast;
-    TMemSpyHeapInfo iCurrent;
-    HBufC* iThreadName;
-    };
-
-
-
-/**
- * Change descriptor associated with heap-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeHeap ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeHeap* NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TMemSpyHeapInfo& aCurrent, const TMemSpyHeapInfo* aLast = NULL );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeHeap();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeHeap( TUint8 aAttribs, const TMemSpyHeapInfo& aCurrent );
-    void ConstructL( const TDesC& aThreadName, const TMemSpyHeapInfo* aLast );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Internal methods
-    TBool IsKernel() const;
-    void FormatAttributes( TDes& aBuffer ) const;
-
-private: // Data members
-    HBufC* iThreadName;
-    TMemSpyHeapInfo iCurrent;
-    TMemSpyHeapInfo* iLast;
-    };
-
-
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryManager.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYMANAGER_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYMANAGER_H
-
-// System includes
-#include <e32base.h>
-
-// User includes
-#include <memspy/engine/memspyenginehelpersysmemtrackerenums.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class TMemSpyDriverChunkInfo;
-class CMemSpyEngineChunkList;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class CMemSpyEngineHelperSysMemTrackerEntry;
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerEntryManager ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryManager* NewL( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
-    static CMemSpyEngineHelperSysMemTrackerEntryManager* NewL( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyEngineHelperSysMemTrackerEntryManager& aMasterList );
-    ~CMemSpyEngineHelperSysMemTrackerEntryManager();
-
-protected:
-    CMemSpyEngineHelperSysMemTrackerEntryManager( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyEngineHelperSysMemTrackerEntryManager* aMasterList = NULL );
-    void ConstructL();
-
-public: // API
-    void IdentifyChangesL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void EverythingHasChangedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Internal methods
-    void ProcessChangesL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void AddItemAndPopL( CMemSpyEngineHelperSysMemTrackerEntry* aItem );
-    void MarkEverythingDead();
-    void MergeListIntoMeL( CMemSpyEngineHelperSysMemTrackerEntryManager& aOtherList );
-    TInt FindByHandle( TUint aHandle, TMemSpyEngineSysMemTrackerType aType ) const;
-    TInt FindByThreadId( const TThreadId& aThreadId ) const;
-    CMemSpyEngineHelperSysMemTrackerEntry* EntryByKey( const TUint64& aKey );
-    CMemSpyEngine& Engine();
-
-private: // Internal access
-    inline TBool ActingAsSecondaryList() const { return iMasterList != NULL; }
-
-private: // Sort order
-    static TInt CompareKey( const CMemSpyEngineHelperSysMemTrackerEntry& aLeft, const CMemSpyEngineHelperSysMemTrackerEntry& aRight );
-    static TInt CompareKeyAndTimeStamp( const CMemSpyEngineHelperSysMemTrackerEntry& aLeft, const CMemSpyEngineHelperSysMemTrackerEntry& aRight );
-
-private: // Seed creation
-    void CreateSeedItemsL();
-    void CreateSeedItemsHeapUserL( CMemSpyEngineChunkList& aList );
-    void CreateSeedItemsHeapUserL( CMemSpyProcess& aProcess, CMemSpyEngineChunkList* aList = NULL );
-    void CreateSeedItemsHeapUserL( CMemSpyThread& aThread, CMemSpyEngineChunkList* aList = NULL );
-    void CreateSeedItemsHeapKernelL( CMemSpyEngineChunkList& aList );
-    void CreateSeedItemsChunkLocalL( CMemSpyEngineChunkList& aList );
-    void CreateSeedItemsChunkGlobalL( CMemSpyEngineChunkList& aList );
-    void CreateSeedItemsGlobalDataL( CMemSpyEngineChunkList& aList );
-    void CreateSeedItemRamDriveL( CMemSpyEngineChunkList& aList );
-    void CreateSeedItemsBitmapL( CMemSpyEngineChunkList& aList );
-    void CreateSeedItemsStacksL( CMemSpyEngineChunkList& aList );
-    void CreateSeedItemsStacksL( CMemSpyThread& aThread, const TMemSpyDriverChunkInfo& aStackChunkInfo );
-    void CreateSeedItemsFileServerCacheL( CMemSpyEngineChunkList& aList );
-    void CreateSeedItemsCodeL();
-    void CreateSeedItemsHandlesL();
-    void CreateSeedItemsOpenFilesL();
-    void CreateSeedItemsDiskSpaceL();
-    void CreateSeedItemsSystemMemoryL();
-    void CreateSeedItemsWindowServerL();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerImp& iTracker;
-    CMemSpyEngineHelperSysMemTrackerEntryManager* iMasterList;
-    RPointerArray< CMemSpyEngineHelperSysMemTrackerEntry > iEntries;
-    };
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryOpenFile.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYOPENFILE_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYOPENFILE_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineOpenFileListEntry;
-class CMemSpyEngineOpenFileListForThread;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryOpenFile : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryOpenFile* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const CMemSpyEngineOpenFileListForThread& aThreadInfo, const CMemSpyEngineOpenFileListEntry& aEntryInfo );
-    ~CMemSpyEngineHelperSysMemTrackerEntryOpenFile();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryOpenFile( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
-    void ConstructL( const CMemSpyEngineOpenFileListForThread& aThreadInfo, const CMemSpyEngineOpenFileListEntry& aEntryInfo );
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const;
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-
-private: // Internal methods
-
-private: // Data members
-    TInt iSize;
-    HBufC* iFileName;
-    HBufC* iThreadName;
-    TInt iUniqueFileId;
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-/**
- * Change descriptor associated with open file-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile* NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TDesC& aFileName, TInt aSize, TInt aUniqueFileId );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile( TUint8 aAttrib, TInt aSize, TInt aUniqueFileId );
-    void ConstructL( const TDesC& aThreadName, const TDesC& aFileName );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    HBufC* iFileName;
-    HBufC* iThreadName;
-    TInt iSize;
-    TInt iUniqueFileId;
-    };
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryRamDrive.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYRAMDRIVE_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYRAMDRIVE_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryRamDrive : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryRamDrive* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo );
-    ~CMemSpyEngineHelperSysMemTrackerEntryRamDrive();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryRamDrive( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
-    void ConstructL( const TMemSpyDriverChunkInfo& aInfo );
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
-
-private: // Data members
-    TMemSpyDriverChunkInfo iLast;
-    TMemSpyDriverChunkInfo iCurrent;
-    };
-
-
-
-
-
-/**
- * Change descriptor associated with ramdrive-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent, const TMemSpyDriverChunkInfo* aLast = NULL );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent );
-    void ConstructL( const TMemSpyDriverChunkInfo* aLast );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    TMemSpyDriverChunkInfo iCurrent;
-    TMemSpyDriverChunkInfo* iLast;
-    };
-
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryStack.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYSTACK_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYSTACK_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryStack : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryStack* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyThread& aThread, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo );
-    ~CMemSpyEngineHelperSysMemTrackerEntryStack();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryStack( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo );
-    void ConstructL( CMemSpyThread& aThread );
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const;
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-
-private: // Internal methods
-    TInt StackSize() const;
-
-private: // Data members
-    TMemSpyDriverChunkInfo iChunkInfo;
-    TThreadStackInfo iStackInfo;
-    HBufC* iThreadName;
-    };
-
-
-
-
-
-
-
-/**
- * Change descriptor associated with stack-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeStack ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeStack* NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeStack();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeStack( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo );
-    void ConstructL( const TDesC& aThreadName );
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Internal methods
-    TInt StackSize() const;
-
-private: // Data members
-    const TMemSpyDriverChunkInfo iChunkInfo;
-    const TThreadStackInfo iStackInfo;
-    HBufC* iThreadName;
-    };
-
-
-
-
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntrySystemMemory.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYSYSTEMMEMORY_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYSYSTEMMEMORY_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-
-
-enum TSystemMemoryType
-    {
-    ETypeTotal = 0,
-    ETypeFree
-    };
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerEntrySystemMemory ) : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntrySystemMemory* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TSystemMemoryType aType );
-    ~CMemSpyEngineHelperSysMemTrackerEntrySystemMemory();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntrySystemMemory( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TSystemMemoryType aType );
-    void ConstructL();
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const;
-    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
-
-private: // Data members
-    const TSystemMemoryType iType;
-    TInt iLast;
-    TInt iCurrent;
-    };
-
-
-
-
-
-/**
- * Change descriptor associated with Ram-related changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory* NewLC( TUint8 aAttribs, TSystemMemoryType aType, TInt aCurrent, TInt aLast );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory( TUint8 aAttribs, TSystemMemoryType aType, TInt aCurrent, TInt aLast );
-    void ConstructL();
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
-    const TSystemMemoryType iType;
-    const TInt iCurrent;
-    const TInt iLast;
-    };
-
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryWindowServer.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYWINDOWSERVER_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYWINDOWSERVER_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
-#include <memspy/engine/memspyenginehelperwindowserver.h>
-
-// Classes referenced
-class CMemSpyEngineOutputSink;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-class TMemSpyEngineWindowGroupDetails;
-
-
-
-class CMemSpyEngineHelperSysMemTrackerEntryWindowServer : public CMemSpyEngineHelperSysMemTrackerEntry
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerEntryWindowServer* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyEngineWindowGroupDetails& aWindowGroupDetails );
-    ~CMemSpyEngineHelperSysMemTrackerEntryWindowServer();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerEntryWindowServer( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyEngineWindowGroupDetails& aWindowGroupDetails );
-    void ConstructL();
-
-public: // From CMemSpyEngineHelperSysMemTrackerEntry
-    TUint64 Key() const;
-    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
-    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
-    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
-
-private: // Internal methods
-
-private: // Data members
-    TMemSpyEngineWindowGroupDetails iCurrentWindowGroupDetails;
-    TMemSpyEngineWindowGroupDetails iLastWindowGroupDetails;
-    };
-
-
-
-
-
-
-
-/**
- * Change descriptor associated with window group changes
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
-    {
-public:
-    enum TMemSpyWindowServerEvent
-        {
-        EMemSpyWindowServerEventNoEvent,
-        EMemSpyWindowServerEventNameChanged,
-        EMemSpyWindowServerEventFocusGained,
-        EMemSpyWindowServerEventFocusLost
-        };
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* NewLC( TUint8 aAttribs, const TMemSpyEngineWindowGroupDetails aCurrent, TMemSpyWindowServerEvent aEvent = EMemSpyWindowServerEventNoEvent );
-    ~CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup( TUint8 aAttrib, const TMemSpyEngineWindowGroupDetails aCurrent, TMemSpyWindowServerEvent aEvent );
-    void ConstructL();
-
-public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
-    TMemSpyEngineSysMemTrackerType Type() const;
-    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-   
-private: // Data members
-    TMemSpyEngineWindowGroupDetails iCurrentWindowGroupDetails;
-    TMemSpyWindowServerEvent iEvent;
-    };
-
-
-
-#endif
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerImp.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +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 MEMSPYENGINEHELPERSYSMEMTRACKERIMP_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERIMP_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class MMemSpyEngineHelperSysMemTrackerObserver;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class CMemSpyEngineHelperSysMemTrackerEntryManager;
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerImp ) : public CTimer, public MDesCArray
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerImp* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperSysMemTrackerImp();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerImp( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    void StartL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
-    void StopL();
-
-    void SetObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver );
-    void RemoveObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver );
-    
-    const RPointerArray< CMemSpyEngineHelperSysMemTrackerCycle >& CompletedCycles() const;
-
-public: // From MDesCArray
-    TInt MdcaCount() const;
-    TPtrC MdcaPoint( TInt aIndex ) const;
-
-public: // But not exported
-    void Reset();
-    void CheckForChangesNowL();
-    //
-    inline CMemSpyEngine& Engine() { return iEngine; }
-    inline const TMemSpyEngineHelperSysMemTrackerConfig& Config() const { return iConfig; }
-
-private: // Internal methods
-    void PrepareInitialCycleL();
-    void CheckForChangesL();
-    void NotifyObserverCycleStartedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void NotifyObserverCycleFinishedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void AddCycleAndPopL( CMemSpyEngineHelperSysMemTrackerCycle* aCycle );
-    CMemSpyEngineHelperSysMemTrackerCycle* LastCycleOrNull();
-
-private: // From CActive
-    void RunL();
-    TInt RunError( TInt aError );
-
-private:
-    CMemSpyEngine& iEngine;
-    TMemSpyEngineHelperSysMemTrackerConfig iConfig;
-    CMemSpyEngineHelperSysMemTrackerEntryManager* iEntryManager;
-    RPointerArray< CMemSpyEngineHelperSysMemTrackerCycle > iCompletedCycles;
-    MMemSpyEngineHelperSysMemTrackerObserver* iObserver;
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerLog.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +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 MEMSPYENGINEHELPERSYSMEMTRACKERLOG_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERLOG_H
-
-// System includes
-#include <e32base.h>
-#include <e32debug.h>
-
-
-#ifdef SYSMEMTRACKERLOGGING
-
-    #define SYSMEMTRACKERLOG_PRINTF( command ) command
-
-#else
-
-    #define SYSMEMTRACKERLOG_PRINTF( command )
-
-#endif
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerOutputFormatter.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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 MEMSPYENGINEHELPERSYSMEMTRACKEROUTPUTFORMATTER_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKEROUTPUTFORMATTER_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// User includes
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerOutputFormatter ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerOutputFormatter* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperSysMemTrackerOutputFormatter();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerOutputFormatter( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    void SetConfig( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
-    void OutputL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    inline const TMemSpyEngineHelperSysMemTrackerConfig& Config() const { return iConfig; }
-
-private: // Internal methods
-    void OutputOverallHeaderL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void OutputOverallFooterL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    static TBool HaveTypesChanged( TInt aLeft, TInt aRight );
-
-private:
-    CMemSpyEngine& iEngine;
-    TMemSpyEngineHelperSysMemTrackerConfig iConfig;
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/Engine/Source/ClientServer/MemSpyEngineServer.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1440 +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 "MemSpyEngineServer.h"
-
-// System includes
-#include <e32svr.h>
-#include <w32std.h>
-#include <APGTASK.H>
-#include <APGWGNAM.H>  
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyenginelogger.h>
-#include <memspyengineclientinterface.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperstack.h>
-#include <memspy/engine/memspyenginehelperthread.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperfilesystem.h>
-#include <memspy/engine/memspyenginehelperram.h>
-#include <memspy/engine/memspyenginehelpersysmemtracker.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-#include <memspy/engine/memspyenginehelperkernelcontainers.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-
-#include <memspy/engine/memspyprocessdata.h>
-#include <memspy/engine/memspythreaddata.h>
-#include <memspy/engine/memspykernelobjectdata.h>
-#include <memspy/engine/memspythreadinfoitemdata.h>
-#include <memspy/engine/memspymemorytrackingcycledata.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyenginehelperactiveobject.h>
-
-inline CShutdown::CShutdown() :CTimer(-1)
-    {
-    CActiveScheduler::Add(this);
-    }
-
-inline void CShutdown::ConstructL()
-    {
-    CTimer::ConstructL();
-    }
-
-inline void CShutdown::Start()
-    {
-    After(KMyShutdownDelay);
-    }
-
-void CShutdown::RunL()
-    //
-    // Initiate server exit when the timer expires
-    //
-    {
-    CActiveScheduler::Stop();
-    }
-
-CMemSpyEngineServer::CMemSpyEngineServer( CMemSpyEngine& aEngine )
-:   CServer2( EPriorityNormal ), iEngine( aEngine )
-    {
-    }
-
-
-CMemSpyEngineServer::~CMemSpyEngineServer()
-    {
-    }
-
-
-void CMemSpyEngineServer::ConstructL()
-    {
-    StartL( KMemSpyServerName );
-    
-    iShutdown.ConstructL();
-    // ensure that the server still exits even if the 1st client fails to connect
-    iShutdown.Start();
-    }
-
-
-CMemSpyEngineServer* CMemSpyEngineServer::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineServer* self = new(ELeave) CMemSpyEngineServer( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-CSession2* CMemSpyEngineServer::NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const
-    {
-    if  ( aVersion.iMajor != KMemSpyClientServerVersion )
-        {
-        RDebug::Printf( "[MemSpy] CMemSpyEngineSession::NewSessionL() - BAD VERSION" );
-        User::Leave( KErrNotSupported );
-        }
-    //
-    CMemSpyEngineSession* session = CMemSpyEngineSession::NewL( iEngine, aMessage );
-	return session;
-    }
-
-void CMemSpyEngineServer::AddSession(TBool aCliRequest)
-    {
-    if (aCliRequest)
-        {
-        iCliConnected = ETrue;
-        }
-    else
-        {
-        ++iSessionCount;
-        }
-    iShutdown.Cancel();
-    }
-
-void CMemSpyEngineServer::DropSession(TBool aCliRequest)
-    {
-    if (!aCliRequest)
-        {
-        --iSessionCount;
-        }
-    
-    if (iSessionCount == 0 && !iCliConnected)
-        {
-        iShutdown.Start();
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineSession::CMemSpyEngineSession( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-
-CMemSpyEngineSession::~CMemSpyEngineSession()
-    {
-#ifdef _DEBUG
-    TPtrC pThreadName( KNullDesC );
-    if  ( iClientThreadName )
-        {
-        pThreadName.Set( *iClientThreadName );
-        }
-
-    RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::~CMemSpyEngineSession() - DEAD SESSION - this: 0x%08x, id: %4d, name: %S"), this, iClientThreadId, iClientThreadName );
-#endif
-
-    delete iClientThreadName;
-    
-    Server().DropSession(iIsCliRequest);
-    }
-
-
-void CMemSpyEngineSession::ConstructL( const RMessage2& aMessage )
-    {
-	RThread thread;
-    const TInt error = aMessage.Client( thread );
-    CleanupClosePushL( thread );
-
-    TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::ConstructL() - this: 0x%08x - opening client thread - err: %d", this, error ) );
-
-    User::LeaveIfError( error );
-
-    const TFullName threadName( thread.FullName() );
-    iClientThreadName = threadName.AllocL();
-    iClientThreadId = thread.Id();
-
-    CleanupStack::PopAndDestroy( &thread );
-    
-    const TUid KCliUid3 = { 0x2002129D };
-    iIsCliRequest = aMessage.SecureId() == TSecureId(KCliUid3);
-    
-    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::ConstructL() - NEW SESSION - this: 0x%08x, id: %4d, client: %S"), this, iClientThreadId, iClientThreadName ) );
-    }
-
-void CMemSpyEngineSession::CreateL()
-    {   
-    Server().AddSession(iIsCliRequest);
-    }
-
-CMemSpyEngineSession* CMemSpyEngineSession::NewL( CMemSpyEngine& aEngine, const RMessage2& aMessage )
-    {
-    CMemSpyEngineSession* self = new(ELeave) CMemSpyEngineSession( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL( aMessage );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-void CMemSpyEngineSession::ServiceL( const RMessage2& aMessage )
-    {
-    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::ServiceL() - START - this: 0x%08x, fn: 0x%08x, id: %4d, client: %S"), this, aMessage.Function(), iClientThreadId, iClientThreadName ) );
-
-    TRAPD( error, DoServiceL( aMessage ) );
-    if  ( error != KErrNone )
-        {
-        RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::ServiceL() - SERVICE ERROR - this: 0x%08x, fn: %d, err: %d, client: %S"), this, aMessage.Function(), error, iClientThreadName );
-        }
-    
-    if ((aMessage.Function() & KMemSpyOpFlagsAsyncOperation) == 0 || error != KErrNone)
-    	{
-		aMessage.Complete( error );
-    	}
-
-    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::ServiceL() - END - this: 0x%08x, fn: 0x%08x, id: %4d, client: %S"), this, aMessage.Function(), iClientThreadId, iClientThreadName ) );
-	}
-
-// ---------------------------------------------------------
-// DoServiceL( const RMessage2& aMessage )
-// ---------------------------------------------------------
-//
-void CMemSpyEngineSession::DoServiceL( const RMessage2& aMessage )
-	{
-	TInt function = aMessage.Function() & KMemSpyOpFlagsTypeMask;
-	if (function >= EMemSpyClientServerOpMarkerUiFirst && 
-		function < EMemSpyClientServerOpMarkerUiLast)
-		
-		DoUiServiceL(aMessage);
-	else
-		DoCmdServiceL(aMessage);
-	}
-// ---------------------------------------------------------
-// DoUiServiceL( const RMessage2& aMessage )
-// ---------------------------------------------------------
-//
-void CMemSpyEngineSession::DoUiServiceL( const RMessage2& aMessage )
-    {
-	switch (aMessage.Function() & KMemSpyOpFlagsTypeMask)
-		{
-		case EMemSpyClientServerOpGetProcessCount:
-			{
-			aMessage.WriteL(0, TPckgBuf<TInt>(iEngine.Container().Count()));
-			break;
-			}
-		case EMemSpyClientServerOpGetProcesses:
-			{
-			CMemSpyEngineObjectContainer& list = iEngine.Container();
-			
-			TPckgBuf<TInt> a0;
-			aMessage.ReadL(0, a0);
-			TInt realCount = Min(a0(), list.Count());
-			
-			for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyProcessData))
-				{
-				CMemSpyProcess& process = iEngine.Container().At(i);
-				TMemSpyProcessData data;
-				data.iIsDead = process.IsDead();
-				data.iId = process.Id();
-				data.iName.Copy(process.Name().Left(KMaxFullName));
-				data.iThreadCount = process.Count();
-				data.iPriority = process.Priority();
-				data.iExitType = process.ExitType();
-				data.iExitReason = process.ExitReason();
-				data.iExitCategory = process.ExitCategory();
-				data.iSID = process.SID();
-				
-				TPckgBuf<TMemSpyProcessData> buffer(data);
-				aMessage.WriteL(1, buffer, offset);
-				}
-			
-			a0 = list.Count();
-			aMessage.WriteL(0, a0);
-
-			break;
-			}
-		case EMemSpyClienServerOpGetProcessIdByName:
-			{
-			TFullName processName;
-			aMessage.ReadL(0, processName);
-			
-			TBool found(EFalse);
-			
-			for (TInt i=0; i<iEngine.Container().Count(); i++)
-				{
-				CMemSpyProcess& process = iEngine.Container().At(i);
-				if (process.Name().FindF(processName) >= 0)
-					{
-					found = ETrue;
-					TPckgBuf<TProcessId> procId(process.Id());
-					aMessage.WriteL(1, procId);
-					}
-				}
-			
-			if (!found)
-				{
-				User::Leave(KErrNotFound);
-				}
-			
-			break;
-			}
-		case EMemSpyClientServerOpProcessSystemPermanentOrCritical:
-			{
-			TBool ret = EFalse;
-			TPckgBuf<TProcessId> id;
-			aMessage.ReadL( 0, id );
-			
-			CMemSpyEngineObjectContainer& container = iEngine.Container();
-			CMemSpyProcess& process = container.ProcessByIdL( id() );
-			
-			if  ( process.IsSystemPermanent() || process.IsSystemCritical() )
-				{
-				ret = ETrue;
-				}
-			TPckgBuf<TBool> retBuf( ret );
-			aMessage.WriteL( 1, retBuf );
-			
-			break;
-			}
-		case EMemSpyClientServerOpEndProcess:
-			{
-			TPckgBuf<TProcessId> id;
-			aMessage.ReadL( 0, id );
-			TPckgBuf<TMemSpyEndType> type;
-			aMessage.ReadL( 1, type );
-					
-			CMemSpyEngineObjectContainer& container = iEngine.Container();			
-			CMemSpyProcess& process = container.ProcessByIdL( id() );
-									
-			switch ( type() )
-				{
-				case ETerminate:
-					{
-					process.TerminateL();
-					break;
-					}
-				case EPanic:
-					{
-					process.PanicL();
-					break;
-					}
-				case EKill:
-					{
-					process.KillL();
-					break;
-					}
-				}																
-			break;
-			}
-		case EMemSpyClientServerOpSwitchToProcess:
-			{/*
-			TInt wgCount;
-			RWsSession wsSession;
-			User::LeaveIfError( wsSession.Connect() );
-			CleanupClosePushL( wsSession );
-			User::LeaveIfError( wgCount = wsSession.NumWindowGroups() );
-			RArray<RWsSession::TWindowGroupChainInfo> wgArray;
-			CleanupClosePushL( wgArray );
-			User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) );
-			TApaTask task( wsSession );
-			TBool brought( EFalse );
-			TInt wgId( KErrNotFound );
-			TThreadId threadId;
-			
-			TPckgBuf<TProcessId> id;
-			aMessage.ReadL( 0, id );
-			CMemSpyEngineObjectContainer& container = iEngine.Container();
-			CMemSpyProcess& process = container.ProcessByIdL( id() );
-			
-			// loop trough threads in a process
-			for ( TInt i = 0; i < process.MdcaCount(); i++ )
-				{
-				TInt wgCountLocal = wgCount;
-							
-				// loop trough all window groups and see if a thread id matches
-				while( !brought && wgCountLocal-- )
-					{
-					wgId = wgArray[wgCountLocal].iId;
-					User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) );
-					if ( threadId == process.At( i ).Id() )
-						{
-						CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId );
-						task.SetWgId( wgId );
-						if ( !wgName->Hidden() && task.Exists() )
-							{
-							task.BringToForeground();
-							brought = ETrue;                        
-							}
-						CleanupStack::PopAndDestroy( wgName );
-						}
-					}
-				}
-			
-			TPckgBuf<TBool> ret( brought );
-			aMessage.WriteL( 1, ret );
-			
-			break;*/
-			}
-		case EMemSpyClientServerOpGetThreadCount:
-			{
-			TPckgBuf<TProcessId> pid;
-			aMessage.ReadL(1, pid);
-			CMemSpyProcess& process = iEngine.Container().ProcessByIdL(pid());
-			aMessage.WriteL(0, TPckgBuf<TInt>(process.Count()));
-			break;
-			}
-		case EMemSpyClientServerOpGetThreads:
-			{
-			TPckgBuf<TProcessId> pid;
-			aMessage.ReadL(2, pid);
-			
-			CMemSpyProcess& list = iEngine.Container().ProcessByIdL(pid());
-			
-			TPckgBuf<TInt> a0;
-			aMessage.ReadL(0, a0);
-			TInt realCount = Min(a0(), list.Count());
-						
-			for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyThreadData))
-				{
-				CMemSpyThread& thread = list.At(i);
-				
-				TMemSpyThreadData data;
-				data.iId = thread.Id();
-				data.iName.Copy(thread.Name().Left(KMaxFullName));
-				data.iThreadPriority = thread.Priority();
-				
-				TPckgBuf<TMemSpyThreadData> buffer(data);
-				aMessage.WriteL(1, buffer, offset);
-				}
-			
-			a0 = list.Count();
-			aMessage.WriteL(0, a0);
-
-			break;
-			}
-		case EMemSpyClientServerOpSetThreadPriority:
-			{
-			TPckgBuf<TThreadId> tid;
-			TPckgBuf<TInt> priority;
-			aMessage.ReadL(0, tid);
-			aMessage.ReadL(1, priority);
-			
-			CMemSpyProcess* process = NULL;
-			CMemSpyThread* thread = NULL; 
-			User::LeaveIfError(iEngine.Container().ProcessAndThreadByThreadId(tid(), process, thread));
-			
-			if (thread)
-				{				
-				thread->SetPriorityL(static_cast<TThreadPriority>(priority()));
-				}					
-			break;
-			}
-		case EMemSpyClientServerOpThreadSystemPermanentOrCritical:
-			{
-			TPckgBuf<TThreadId> id;
-			aMessage.ReadL( 0, id );
-			
-			CMemSpyEngineObjectContainer& container = iEngine.Container();            
-			CMemSpyProcess* process = NULL;
-			CMemSpyThread* thread = NULL; 
-			User::LeaveIfError( container.ProcessAndThreadByThreadId( id(), process, thread ) );
-			
-			TBool ret = thread && ( thread->IsSystemPermanent() || thread->IsSystemCritical() );
-			
-			TPckgBuf<TBool> retBuf( ret );
-			aMessage.WriteL( 1, retBuf );
-							
-			break;
-			}
-		case EMemSpyClientServerOpEndThread:
-			{
-			TPckgBuf<TThreadId> id;
-			aMessage.ReadL( 0, id );
-			TPckgBuf<TMemSpyEndType> type;
-			aMessage.ReadL( 1, type );
-			
-			CMemSpyEngineObjectContainer& container = iEngine.Container();
-			CMemSpyProcess* process = NULL;
-			CMemSpyThread* thread = NULL; 
-			User::LeaveIfError( container.ProcessAndThreadByThreadId( id(), process, thread ) );
-			
-			if( thread )
-				{
-				switch ( type() )
-					{
-					case ETerminate:
-						{
-						thread->TerminateL();
-						break;
-						}
-					case EPanic:
-						{
-						thread->PanicL();
-						break;
-						}
-					case EKill:
-						{
-						thread->KillL();
-						break;
-						}
-					}				
-				}			
-			break;
-			}
-		case EMemSpyClientServerOpSwitchToThread:
-			{
-			TInt wgCount;
-			RWsSession wsSession;
-			User::LeaveIfError( wsSession.Connect() );
-			CleanupClosePushL( wsSession );
-			User::LeaveIfError( wgCount = wsSession.NumWindowGroups() );
-			RArray<RWsSession::TWindowGroupChainInfo> wgArray;
-			CleanupClosePushL( wgArray );
-			User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) );
-			TApaTask task( wsSession );
-			TBool brought( EFalse );
-			TInt wgId( KErrNotFound );
-			TThreadId threadId;
-					
-			TPckgBuf<TThreadId> id;
-			aMessage.ReadL( 0, id );
-					
-			// loop trough all window groups and see if a thread id matches
-			while( !brought && wgCount-- )
-				{
-				wgId = wgArray[wgCount].iId;
-				User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) );
-				if ( threadId == id() )
-					{
-					CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId );
-					task.SetWgId( wgId );
-					if ( !wgName->Hidden() && task.Exists() )
-						{
-						task.BringToForeground();
-						brought = ETrue;                        
-						}
-					CleanupStack::PopAndDestroy( wgName );
-					}
-				}			
-			TPckgBuf<TBool> ret( brought );
-			aMessage.WriteL( 1, ret );															
-					
-			break;
-			}		
-		case EMemSpyClientServerOpGetInfoItemType:
-			{
-			
-			TPckgBuf<TInt> index;
-			aMessage.ReadL( 0, index );			
-			TPckgBuf<TThreadId> id;
-			aMessage.ReadL( 1, id);
-								
-			CMemSpyEngineObjectContainer& container = iEngine.Container();            
-			CMemSpyProcess* process = NULL; //not needed
-			CMemSpyThread* thread = NULL; 
-			User::LeaveIfError( container.ProcessAndThreadByThreadId( id(), process, thread ) );
-		            
-			CMemSpyThreadInfoContainer& threadInfoContainer = thread->InfoContainerForceSyncronousConstructionL();                        
-			TMemSpyThreadInfoItemType retType = threadInfoContainer.Item( index() ).Type();
-			
-			TPckgBuf<TMemSpyThreadInfoItemType> ret( retType );
-			aMessage.WriteL( 2, ret );			
-			
-			break;
-			}
-		case EMemSpyClientServerOpGetThreadInfoItemsCount:
-			{
-			TPckgBuf<TThreadId> id;
-			aMessage.ReadL( 0, id );
-			TPckgBuf<TMemSpyThreadInfoItemType> type;
-			aMessage.ReadL( 1, type );					 
-			
-			CMemSpyEngineObjectContainer& container = iEngine.Container();            
-			CMemSpyProcess* process = NULL;
-			CMemSpyThread* thread = NULL; 
-			
-			container.ProcessAndThreadByThreadId( id(), process, thread );
-			
-			CMemSpyThreadInfoContainer& threadInfoContainer = thread->InfoContainerForceSyncronousConstructionL();                 
-								
-			CMemSpyThreadInfoItemBase& threadInfoItemBase = threadInfoContainer.Item( type() );
-				    
-			TInt count = threadInfoItemBase.MdcaCount();		    
-			TPckgBuf<TInt> tempret( count );
-			aMessage.WriteL( 2, tempret );
-		
-			break;
-			}		
-		case EMemSpyClientServerOpGetThreadInfoItems:
-			{
-			TPckgBuf<TInt> count;
-			aMessage.ReadL( 0, count );						
-			TPckgBuf<TThreadId> id;
-			aMessage.ReadL( 1, id );
-			TPckgBuf<TMemSpyThreadInfoItemType> type;
-			aMessage.ReadL( 2, type );			
-			
-			CMemSpyEngineObjectContainer& container = iEngine.Container();            
-			CMemSpyProcess* process = NULL;
-			CMemSpyThread* thread = NULL; 
-			User::LeaveIfError( container.ProcessAndThreadByThreadId( id() , process, thread ) );
-							  
-			CMemSpyThreadInfoContainer& threadInfoContainer = thread->InfoContainerForceSyncronousConstructionL();      
-
-			CMemSpyThreadInfoItemBase& threadInfoItemBase = threadInfoContainer.Item( type() ); //get ThreadInfoItemBaseByType
-			
-			TInt itemCount = Min(count(), threadInfoItemBase.MdcaCount());
-								
-			for( TInt i=0, offset = 0; i<itemCount; i++, offset += sizeof( TMemSpyThreadInfoItemData ) )
-				{
-				TMemSpyThreadInfoItemData data;
-				
-				TPtrC caption(threadInfoItemBase.MdcaPoint(i).Mid(1));
-				TInt tabPos = caption.Locate('\t');
-				if (tabPos != KErrNotFound)
-					caption.Set(caption.Left(tabPos));
-				
-				TPtrC value(threadInfoItemBase.MdcaPoint(i));
-				tabPos = value.LocateReverse('\t');
-				if (tabPos != KErrNotFound)
-					value.Set(value.Mid(tabPos + 1));
-												
-				data.iCaption.Copy( caption.Left(64) );
-				data.iValue.Copy( value.Left(32) );
-							
-				TPckgBuf<TMemSpyThreadInfoItemData> buffer(data);
-				aMessage.WriteL(3, buffer, offset);				
-				}			
-			aMessage.WriteL(0, count);
-					
-			break;
-			}
-		// --- KernelObjects related functions ---
-		case EMemSpyClientServerOpGetKernelObjectCount:
-			{
-			TInt iCount = EMemSpyDriverContainerTypeLast - EMemSpyDriverContainerTypeFirst;
-			TPckgBuf<TInt> ret( iCount );
-			aMessage.WriteL(0, ret);			
-			break;
-			}
-		case EMemSpyClientServerOpGetKernelObjects:
-			{
-			TPckgBuf<TInt> count;
-			aMessage.ReadL(0, count);
-			
-			CMemSpyEngineGenericKernelObjectContainer* model = iEngine.HelperKernelContainers().ObjectsAllL(); //contains all the objects
-			CleanupStack::PushL( model );
-			
-			for( TInt i=0, offset = 0; i<count(); i++, offset += sizeof( TMemSpyKernelObjectData ) )
-				{
-				TMemSpyKernelObjectData data;
-				
-				TPtrC name(model->At(i).Name().Mid(1));
-				TInt tabPos = name.Locate('\t');
-				if (tabPos != KErrNotFound)
-					name.Set(name.Left(tabPos));
-												
-				data.iName.Copy(name);
-				data.iType = model->At(i).Type();
-				data.iCount = model->At(i).Count();											
-				data.iSize = model->At(i).Count() * model->At(i).Count();
-
-				TPckgBuf<TMemSpyKernelObjectData> buffer(data);
-				aMessage.WriteL(1, buffer, offset);
-				}			
-			aMessage.WriteL(0, count);
-			CleanupStack::PopAndDestroy( model );
-			break;
-			}
-		case EMemSpyClientServerOpGetKernelObjectItemCount:
-			{
-			TPckgBuf<TMemSpyDriverContainerType> tempType;
-			aMessage.ReadL(1, tempType); //get type of kernel object
-			TMemSpyDriverContainerType type = tempType();
-			
-			CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
-			CMemSpyEngineGenericKernelObjectList* iObjectList = kernelContainerManager.ObjectsForSpecificContainerL( type );
-			CleanupStack::PushL( iObjectList );
-			
-			TInt count = iObjectList->Count();
-			TPckgBuf<TInt> ret( count );
-			aMessage.WriteL( 0, ret );
-			
-			CleanupStack::PopAndDestroy( iObjectList );
-			break;
-			}
-		case EMemSpyClientServerOpGetKernelObjectItems:
-			{
-			TPckgBuf<TInt> count;
-			TPckgBuf<TMemSpyDriverContainerType> tempType;
-			aMessage.ReadL( 0, count ); //get count of items
-			aMessage.ReadL(1, tempType); //get type of kernel object
-			TInt c = count();
-						
-			CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
-			CMemSpyEngineGenericKernelObjectList* iObjectList = kernelContainerManager.ObjectsForSpecificContainerL( tempType() );
-			CleanupStack::PushL( iObjectList );
-			
-			for( TInt i=0, offset = 0; i<c; i++, offset += sizeof( TMemSpyDriverHandleInfoGeneric ) )
-				{
-				TMemSpyDriverHandleInfoGeneric data;								
-															
-				data = iObjectList->At( i );
-				
-				TPckgBuf<TMemSpyDriverHandleInfoGeneric> buffer(data);
-				aMessage.WriteL(2, buffer, offset);
-				}			
-			
-			CleanupStack::PopAndDestroy( iObjectList );			
-			break;
-			}
-			
-		case EMemSpyClientServerOpOutputAllContainerContents:
-			{
-			CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
-			CMemSpyEngineGenericKernelObjectContainer* model = kernelContainerManager.ObjectsAllL();
-			
-			model->OutputL( iEngine.Sink() );
-
-			break;
-			}
-			
-		case EMemSpyClientServerOpDumpKernelHeap:
-			{
-		    iEngine.HelperHeap().OutputHeapDataKernelL();
-			
-			break;
-			}
-			
-		case EMemSpyClientServerOpOutputInfoHandles:
-			{
-			TPckgBuf<TThreadId> id;
-			aMessage.ReadL(0, id);
-			CMemSpyEngineObjectContainer& container = iEngine.Container();            
-			CMemSpyProcess* process = NULL;
-			CMemSpyThread* thread = NULL; 
-			User::LeaveIfError( container.ProcessAndThreadByThreadId( id() , process, thread ) );
-										  
-			CMemSpyThreadInfoContainer& threadInfoContainer = thread->InfoContainerForceSyncronousConstructionL();
-			
-			threadInfoContainer.PrintL();
-			
-			break;
-			}
-			
-		case EMemSpyClientServerOpOutputAOList:
-			{
-			TPckgBuf<TThreadId> id;
-			TPckgBuf<TMemSpyThreadInfoItemType> type;
-			aMessage.ReadL(0, id);
-			aMessage.ReadL(1, type);
-			
-			CMemSpyEngineObjectContainer& container = iEngine.Container();            
-			CMemSpyProcess* process = NULL;
-			CMemSpyThread* thread = NULL; 
-			User::LeaveIfError( container.ProcessAndThreadByThreadId( id() , process, thread ) );
-										  
-			CMemSpyThreadInfoContainer& threadInfoContainer = thread->InfoContainerForceSyncronousConstructionL();      
-
-			CMemSpyThreadInfoItemBase* threadInfoItem = &threadInfoContainer.Item( type() );
-						
-			CMemSpyThreadInfoActiveObjects* activeObjectArray = static_cast< CMemSpyThreadInfoActiveObjects* >( threadInfoItem );			
-						
-		    // Begin a new data stream
-		    _LIT( KMemSpyContext, "Active Object List - " );
-		    _LIT( KMemSpyFolder, "Active Objects" );
-		    iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
-		    		    
-		    // Set prefix for overall listing
-		    iEngine.Sink().OutputPrefixSetLC( KMemSpyContext );
-
-		    // Create header
-		    CMemSpyEngineActiveObjectArray::OutputDataColumnsL( iEngine );
-		    
-		    // List items
-		    const TInt count = activeObjectArray->Array().Count();
-		    for(TInt i=0; i<count; i++)
-		        {
-		        const CMemSpyEngineActiveObject& object = activeObjectArray->Array().At( i );
-		        //
-		        object.OutputDataL( iEngine );
-		        }
-
-		    // Tidy up
-		    CleanupStack::PopAndDestroy(); // prefix
-
-		    // End data stream		    		    
-		    iEngine.Sink().DataStreamEndL();		    
-			
-			break;
-			}
-			
-		// --- Kernel Heap related functions ---
-		case EMemSpyClientServerOpGetHeap:
-			{
-			TMemSpyHeapInfo heapInfo;			
-			iEngine.HelperHeap().GetHeapInfoKernelL( heapInfo );
-			TMemSpyHeapData data = iEngine.HelperHeap().NewHeapRawInfo( heapInfo );
-			
-			TPckgBuf<TMemSpyHeapData> buffer(data);
-			aMessage.WriteL(0, buffer);
-			
-			break;
-			}
-		
-		case EMemSpyClientServerOpGetMemoryTrackingCycleCount:
-			aMessage.WriteL(0, TPckgBuf<TInt>(iEngine.HelperSysMemTracker().CompletedCycles().Count()));
-			break;
-			
-		case EMemSpyClientServerOpGetMemoryTrackingCycles:
-			{
-			const RPointerArray<CMemSpyEngineHelperSysMemTrackerCycle>& list = iEngine.HelperSysMemTracker().CompletedCycles();
-
-			TPckgBuf<TInt> a0;
-			aMessage.ReadL(0, a0);
-			TInt realCount = Min(a0(), list.Count());
-			
-			for (TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyMemoryTrackingCycleData))
-				{
-				CMemSpyProcess& process = iEngine.Container().At(i);
-				TMemSpyMemoryTrackingCycleData data;
-				data.iCycleNumber = list[i]->CycleNumber();
-				data.iCaption.Copy(list[i]->Caption().Left(KMaxFullName));
-				data.iTime = list[i]->Time();
-				data.iFreeMemory = list[i]->MemoryFree();
-				data.iMemoryDelta = list[i]->MemoryDelta();
-				data.iPreviousCycleDiff = list[i]->MemoryFreePreviousCycle();
-				
-				TPckgBuf<TMemSpyMemoryTrackingCycleData> buffer(data);
-				aMessage.WriteL(1, buffer, offset);
-				}
-			
-			a0 = list.Count();
-			aMessage.WriteL(0, a0);
-
-		break;
-		}
-	case EMemSpyClientServerOpIsSwmtRunning:
-		{
-		TPckgBuf<TBool> running(iEngine.HelperSysMemTracker().IsActive());
-		aMessage.WriteL(0, running);
-		break;
-		}
-			
-		
-	case EMemSpyClientServerOpNotifyDeviceWideOperationProgress:
-		{
-		if (!Server().CurrentOperationTracker())
-			{
-			User::Leave(KErrNotReady);
-			}
-		
-		Server().CurrentOperationTracker()->AddNotificationL(aMessage);
-		break;
-		}
-		
-	case EMemSpyClientServerOpCancelDeviceWideOperation:
-		if (!Server().CurrentOperationTracker())
-			{
-			User::Leave(KErrNotReady);
-			}
-		
-		Server().CurrentOperationTracker()->Cancel();
-		break;
-		}
-    }
-
-// ---------------------------------------------------------
-// DoCmdServiceL( const RMessage2& aMessage )
-// ---------------------------------------------------------
-//
-void CMemSpyEngineSession::DoCmdServiceL( const RMessage2& aMessage )
-    {
-    TInt error = KErrNone;
-
-    // Check function attributes
-    const TInt function = aMessage.Function() & KMemSpyOpFlagsTypeMask;
-    const TInt argSpec = aMessage.Function() & KMemSpyOpFlagsInclusionMask;
-    const TBool byThreadId = ( argSpec == KMemSpyOpFlagsIncludesThreadId );
-    const TBool byThreadName = ( argSpec == KMemSpyOpFlagsIncludesThreadName );
-
-    TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - START - unmodified function: 0x%08x, opCode: %d [TID: %d, TN: %d]", aMessage.Function(), function, byThreadId, byThreadName ) );
-
-    // Check function is supported and argument combination is valid
-    error = ValidateFunction( function, byThreadId, byThreadName );
-    TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - validation result: %d", error ) );
-    
-    // Process function request
-    if  ( error == KErrNone )
-        {
-        if  ( byThreadId )
-            {
-            TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - [TID] thread-specific..." ) );
-            
-            const TThreadId threadId( aMessage.Int0() );
-            HandleThreadSpecificOpL( function, threadId );
-            }
-        else if ( byThreadName )
-            {
-            TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - [TN] thread-specific..." ) );
-
-            error = aMessage.GetDesLength( 0 /*slot 0*/ );
-        
-            if  ( error > 0 && error <= KMaxFullName )
-                {
-                TFullName* threadName = new(ELeave) TFullName();
-                CleanupStack::PushL( threadName );
-                aMessage.ReadL( 0, *threadName );
-                HandleThreadSpecificOpL( function, *threadName );
-                CleanupStack::PopAndDestroy( threadName );
-                }
-            else
-                {
-                error = KErrArgument;
-                }
-            }
-        else
-            {
-            TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - thread-agnostic..." ) );
-
-            HandleThreadAgnosticOpL( function, aMessage );
-            }
-        }
-
-    User::LeaveIfError( error );
-
-    TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - END" ) );
-    }
-
-
-
-TInt CMemSpyEngineSession::ValidateFunction( TInt aFunction, TBool aIncludesThreadId, TBool aIncludesThreadName )
-    {
-    TInt err = KErrNotSupported;
-    
-    // Check the operation is within op-code range
-    if  ( aFunction >= EMemSpyClientServerOpMarkerFirst && aFunction < EMemSpyClientServerOpMarkerLast )
-        {
-        // Check the operation doesn't include unnecessary or not supported information
-        const TBool includesThreadIdentifier = ( aIncludesThreadId || aIncludesThreadName );
-        if  ( includesThreadIdentifier && aFunction >= EMemSpyClientServerOpMarkerThreadAgnosticFirst )
-            {
-            // Passing a thread identifier to a thread agnostic operation
-            err = KErrArgument;
-            }
-        else
-            {
-            err = KErrNone;
-            }
-        }
-    //
-    if  ( err != KErrNone )
-        {
-        RDebug::Printf( "[MemSpy] CMemSpyEngineSession::ValidateFunction() - function request did not validate - [withId: %d, withName: %d]", aIncludesThreadId, aIncludesThreadName );
-        }
-    //
-    return err;
-    }
-
-
-void CMemSpyEngineSession::HandleThreadSpecificOpL( TInt aFunction, const TThreadId& aThreadId )
-    {
-    TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - START - aFunction: %d, aThreadId: %d", aFunction, (TUint) aThreadId ) );
-
-    ASSERT( (TUint) aThreadId != 0 );
-    TInt error = KErrNone;
-
-    // Check if its a kernel thread identifier
-    const TBool isKernel = ( static_cast<TUint32>( aThreadId ) == KMemSpyClientServerThreadIdKernel );
-
-    // Treat as thread specific operation
-    CMemSpyProcess* process = NULL;
-    CMemSpyThread* thread = NULL;
-    if  ( !isKernel )
-        {
-        error = iEngine.Container().ProcessAndThreadByThreadId( aThreadId, process, thread );
-        TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - search result: %d, proc: 0x%08x, thread: 0x%08x", error, process, thread ) );
-        }
-    else
-        {
-        // Kernel is only supported for a couple of operations
-        if  ( aFunction == EMemSpyClientServerOpHeapInfo || aFunction == EMemSpyClientServerOpHeapData )
-            {
-            }
-        else
-            {
-            TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - trying to call unsupported function for kernel thread!" ) );
-            error = KErrArgument;
-            }
-        }
-
-    // Must be no error so far and we must have a valid thread & process when performing a non-kernel op
-    // or then if we are performing a kernel op, we don't need the thread or process.
-    if  ( error == KErrNone && ( ( thread && process && !isKernel ) || ( isKernel ) ) )
-        {
-#ifdef _DEBUG
-        if  ( thread )
-            {
-            HBufC* threadName = thread->FullName().AllocLC();
-            _LIT( KTrace2, "[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - thread: %S" );
-            RDebug::Print( KTrace2, threadName );
-            CleanupStack::PopAndDestroy( threadName );
-            }
-        else if ( isKernel )
-            {
-            _LIT( KTrace2, "[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - thread: Kernel" );
-            RDebug::Print( KTrace2 );
-            }
-#endif
-
-        // Got a valid thread object - now work out which operation to perform...
-        switch( aFunction )
-            {
-        case EMemSpyClientServerOpSummaryInfo:
-            iEngine.HelperProcess().OutputProcessInfoL( *process );
-            break;
-        case EMemSpyClientServerOpSummaryInfoDetailed:
-            iEngine.HelperProcess().OutputProcessInfoDetailedL( *process );
-            break;
-        case EMemSpyClientServerOpHeapInfo:
-            if  ( isKernel )
-                {
-                iEngine.HelperHeap().OutputHeapInfoKernelL();
-                }
-            else
-                {
-                iEngine.HelperHeap().OutputHeapInfoUserL( *thread );
-                }
-            break;
-        case EMemSpyClientServerOpHeapCellListing:
-            iEngine.HelperHeap().OutputCellListingUserL( *thread );
-            break;
-        case EMemSpyClientServerOpHeapData:
-            if  ( isKernel )
-                {
-                iEngine.HelperHeap().OutputHeapDataKernelL();
-                }
-            else
-                {
-                iEngine.HelperHeap().OutputHeapDataUserL( *thread );
-                }
-            break;
-        case EMemSpyClientServerOpStackInfo:
-            iEngine.HelperStack().OutputStackInfoL( *thread );
-            break;
-        case EMemSpyClientServerOpStackDataUser:
-            iEngine.HelperStack().OutputStackDataL( *thread, EMemSpyDriverDomainUser, EFalse );
-            break;
-        case EMemSpyClientServerOpStackDataKernel:
-            iEngine.HelperStack().OutputStackDataL( *thread, EMemSpyDriverDomainKernel, EFalse );
-            break;
-        case EMemSpyClientServerOpOpenFiles:
-            iEngine.HelperFileSystem().ListOpenFilesL( aThreadId );
-            break;
-
-        default:
-            error = KErrNotSupported;
-            break;
-            }
-        }
-
-    TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - END - aFunction: %d, aThreadId: %d, error: %d", aFunction, (TUint) aThreadId, error ) );
-    User::LeaveIfError( error );
-    }
-
-
-void CMemSpyEngineSession::HandleThreadSpecificOpL( TInt aFunction, const TDesC& aThreadName )
-    {
-    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - START - aFunction: %d, aThreadName: %S"), aFunction, &aThreadName ) );
-    //
-    CMemSpyProcess* process = NULL;
-    CMemSpyThread* thread = NULL;
-    TInt error = iEngine.Container().ProcessAndThreadByPartialName( aThreadName, process, thread );
-    User::LeaveIfError( error );
-    //
-    const TThreadId threadId( thread->Id() );
-    HandleThreadSpecificOpL( aFunction, threadId );
-    //
-    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - END - aFunction: %d, aThreadName: %S"), aFunction, &aThreadName ) );
-    }
-
-
-void CMemSpyEngineSession::HandleThreadAgnosticOpL( TInt aFunction, const RMessage2& aMessage )
-    {
-    TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - START" ) );
-    
-    //
-    if  ( aFunction ==  EMemSpyClientServerOpHeapInfoCompact )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpHeapInfoCompact") );
-        if (aMessage.Function() & KMemSpyOpFlagsAsyncOperation)
-        	{
-			StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EEntireDeviceHeapInfoCompact, aMessage);
-        	}
-        else
-        	{
-			iEngine.HelperHeap().OutputHeapInfoForDeviceL();
-        	}
-        }
-    else if ( aFunction ==  EMemSpyClientServerOpStackInfoCompact )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpStackInfoCompact") );
-        if (aMessage.Function() & KMemSpyOpFlagsAsyncOperation)
-			{
-			StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EEntireDeviceStackInfoCompact, aMessage);
-			}
-		else
-			{
-			iEngine.HelperStack().OutputStackInfoForDeviceL();
-			}
-        }
-    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart") );
-        iEngine.HelperSysMemTracker().StartL();
-        }
-    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop") );
-        iEngine.HelperSysMemTracker().StopL();
-        }
-    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingReset )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingReset") );
-        iEngine.HelperSysMemTracker().Reset();
-        }
-    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate") );
-        iEngine.HelperSysMemTracker().CheckForChangesNowL();
-        }
-    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet") );
-        
-        // Get current config
-        TMemSpyEngineHelperSysMemTrackerConfig config;
-        iEngine.HelperSysMemTracker().GetConfig( config );
-
-        // Set new timer value
-        config.iTimerPeriod = aMessage.Int0();
-
-        // And update config... which will leave if the config is invalid
-        iEngine.HelperSysMemTracker().SetConfigL( config );
-        }
-    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet") );
-        // Get current config
-        TMemSpyEngineHelperSysMemTrackerConfig config;
-        iEngine.HelperSysMemTracker().GetConfig( config );
-
-        // Set new categories
-        config.iEnabledCategories = aMessage.Int0();
-
-        // And update config... which will leave if the config is invalid
-        iEngine.HelperSysMemTracker().SetConfigL( config );
-        }
-    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet") );
-        // Get current config
-        TMemSpyEngineHelperSysMemTrackerConfig config;
-        iEngine.HelperSysMemTracker().GetConfig( config );
-
-        // Set new filter
-        RBuf buf;
-        buf.CleanupClosePushL();
-        TInt len = aMessage.GetDesLength( 0 );
-        if ( len > 0 )
-            {
-            buf.CreateL( len );
-            aMessage.ReadL( 0, buf, 0 );
-            config.iThreadNameFilter.Copy( buf );            
-            }
-        else
-            {
-            config.iThreadNameFilter.Zero();
-            }
-        CleanupStack::PopAndDestroy( &buf );
-
-        // And update config... which will leave if the config is invalid
-        iEngine.HelperSysMemTracker().SetConfigL( config );
-        }
-    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet )
-        {
-        // Get current config
-        TMemSpyEngineHelperSysMemTrackerConfig config;
-        iEngine.HelperSysMemTracker().GetConfig( config );
-        
-        // Set new Heap Dump value
-        config.iDumpData = aMessage.Int0();
-        
-        // And update config... which will leave if the config is invalid
-        iEngine.HelperSysMemTracker().SetConfigL( config );
-        }
-    else if ( aFunction == EMemSpyClientServerOpSwitchOutputSinkTrace )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSwitchOutputSinkTrace") );
-        iEngine.InstallDebugSinkL();
-        }
-    else if ( aFunction == EMemSpyClientServerOpSwitchOutputSinkFile )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSwitchOutputSinkFile") );
-        // Read file name from message.
-        TFileName fileName;
-        RBuf buf;
-		buf.CleanupClosePushL();
-		
-		TInt len = aMessage.GetDesLength( 0 );
-		if ( len > 0 )
-			{
-			buf.CreateL( len );
-			aMessage.ReadL( 0, buf, 0 );
-			
-			iEngine.InstallFileSinkL( buf );           
-			}
-		else
-			{
-			iEngine.InstallFileSinkL( KNullDesC );
-			}
-		
-		CleanupStack::PopAndDestroy( &buf );
-        
-        }
-    else if ( aFunction == EMemSpyClientServerOpEnumerateKernelContainer )
-        {
-        const TMemSpyDriverContainerType type = CMemSpyEngineHelperKernelContainers::MapToType( static_cast< TObjectType >( aMessage.Int0() ) );
-
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpEnumerateKernelContainer - type: %d", type ) );
-
-        CMemSpyEngineGenericKernelObjectList* model = iEngine.HelperKernelContainers().ObjectsForSpecificContainerL( type );
-        CleanupStack::PushL( model );
-        model->OutputL( iEngine.Sink() );
-        CleanupStack::PopAndDestroy( model );
-        }
-    else if ( aFunction == EMemSpyClientServerOpEnumerateKernelContainerAll )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpEnumerateKernelContainerAll") );
-        CMemSpyEngineGenericKernelObjectContainer* model = iEngine.HelperKernelContainers().ObjectsAllL();
-        CleanupStack::PushL( model );
-        model->OutputL( iEngine.Sink() );
-        CleanupStack::PopAndDestroy( model );
-        }
-    else if ( aFunction == EMemSpyClientServerOpOpenFiles )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpOpenFiles") );
-        iEngine.ListOpenFilesL();
-        }
-    else if ( aFunction == EMemSpyClientServerOpDisableAknIconCache )
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpDisableAknIconCache") );
-        iEngine.HelperRAM().SetAknIconCacheStatusL( EFalse );
-        }
-    else if ( aFunction == EMemSpyClientServerOpSummaryInfo )
-    	{
-		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSummaryInfo") );
-		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityGeneralSummary, aMessage);
-    	}
-    else if ( aFunction == EMemSpyClientServerOpSummaryInfoDetailed )
-		{
-		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSummaryInfoDetailed") );
-		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed, aMessage);
-		}
-    else if ( aFunction == EMemSpyClientServerOpHeapInfo )
-		{
-		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpHeapInfo") );
-		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityHeapInfo, aMessage);
-		}
-    else if ( aFunction == EMemSpyClientServerOpHeapCellListing )
-		{
-		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpHeapCellListing") );
-		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityHeapCellListing, aMessage);
-		}
-    else if ( aFunction == EMemSpyClientServerOpHeapData )
-		{
-		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpHeapData") );
-		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityHeapData, aMessage);
-		}
-    else if ( aFunction == EMemSpyClientServerOpStackInfo )
-		{
-		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpStackInfo") );
-		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityStackInfo, aMessage);
-		}
-    else if ( aFunction == EMemSpyClientServerOpStackDataUser )
-		{
-		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpStackDataUser") );
-		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityStackDataUser, aMessage);
-		}
-    else if ( aFunction == EMemSpyClientServerOpStackDataKernel )
-		{
-		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpStackDataKernel") );
-		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityStackDataKernel, aMessage);
-		}
-    else
-        {
-        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - [device-wide operation] => invoking UI") );
-        iEngine.NotifyClientServerOperationRequestL( aFunction );
-        }
-    //
-    TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - END" ) );
-    }
-
-void CMemSpyEngineSession::StartDeviceWideOperationL(CMemSpyDeviceWideOperations::TOperation aOperation, const RMessage2& aMessage)
-	{
-	if (Server().CurrentOperationTracker())
-		{
-		User::Leave(KErrInUse);
-		}
-	
-	Server().SetCurrentOperationTracker(CMemSpyDwOperationTracker::NewL(aOperation, aMessage, Server()));
-	}
-
-
-
-
-
-
-
-
-
-CMemSpyDwOperationTracker* CMemSpyDwOperationTracker::NewL(CMemSpyDeviceWideOperations::TOperation aOperation, 
-		const RMessage2& aOperationMessage, CMemSpyEngineServer& aServer)
-	{
-	CMemSpyDwOperationTracker* self = new (ELeave) CMemSpyDwOperationTracker(aOperationMessage, aServer);
-	CleanupStack::PushL( self );
-	self->ConstructL(aOperation);
-	CleanupStack::Pop( self );
-	return self;
-	}
-	
-CMemSpyDwOperationTracker::~CMemSpyDwOperationTracker()
-	{
-	delete iOperation;
-	delete iPendingNotifications;
-	}
-
-CMemSpyDwOperationTracker::CMemSpyDwOperationTracker(const RMessage2& aOperationMessage, CMemSpyEngineServer& aServer) : 
-		iOperationMessage(aOperationMessage),
-		iServer(aServer),
-		iPendingNotifications(0),
-		iOperation(0),
-		iProgress(0)
-	{
-	}
-
-
-void CMemSpyDwOperationTracker::ConstructL(CMemSpyDeviceWideOperations::TOperation aOperation)
-	{
-	iPendingNotifications = new (ELeave) CArrayFixFlat<RMessage2>(3);
-	iOperation = CMemSpyDeviceWideOperations::NewL(iServer.Engine(), *this, aOperation);
-	}
-
-void CMemSpyDwOperationTracker::AddNotificationL(const RMessage2& aMessage)
-	{
-	iPendingNotifications->AppendL(aMessage);
-	}
-
-void CMemSpyDwOperationTracker::Cancel()
-	{
-	iOperation->Cancel();
-	}
-
-void CMemSpyDwOperationTracker::HandleDeviceWideOperationEvent(TEvent aEvent, TInt aParam1, const TDesC& aParam2)
-	{
-	switch( aEvent )
-		{
-	case MMemSpyDeviceWideOperationsObserver::EOperationCompleted:
-	case MMemSpyDeviceWideOperationsObserver::EOperationCancelled:
-		iServer.SetCurrentOperationTracker(0);
-		
-		for (TInt i=0; i<iPendingNotifications->Count(); i++)
-			{
-			iPendingNotifications->At(i).Complete(KErrCancel);
-			}
-		
-		if (iOperationMessage.Function() & KMemSpyOpFlagsAsyncOperation)
-			{
-			iOperationMessage.Complete(
-				aEvent == MMemSpyDeviceWideOperationsObserver::EOperationCompleted ? KErrNone : KErrCancel);
-			}
-		
-		iPendingNotifications->Reset();
-		
-		delete this;
-		break;
-		
-	case MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd:
-		{
-		iProgress += aParam1;
-		for (TInt i=0; i<iPendingNotifications->Count(); i++)
-			{
-			TInt err;
-			TRAP(err, iPendingNotifications->At(i).WriteL(0, TPckgBuf<TInt>( iProgress * 100 / iOperation->TotalOperationSize() )));
-			TRAP(err, iPendingNotifications->At(i).WriteL(1, aParam2));
-			if (err != KErrNone)
-				{
-				// TODO: iPendingProgressNotifications->At(i).Panic()
-				}
-			iPendingNotifications->At(i).Complete(KErrNone);
-			}
-		iPendingNotifications->Reset();
-		break;
-		}
-		
-		}
-	
-	}
--- a/memspy/Engine/Source/DeviceWideOps/MemSpyDeviceWideOperations.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,449 +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 <memspy/engine/memspydevicewideoperations.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperstack.h>
-#include <memspy/engine/memspyenginehelperthread.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// Literal constants
-_LIT( KMemSpyUiThreadNameKernel, "Kernel" );
-_LIT( KMemSpyUiCompactHeap, "Compact Heap" );
-_LIT( KMemSpyUiCompactStack, "Compact Stack" );
-
-
-
-CMemSpyDeviceWideOperations::CMemSpyDeviceWideOperations( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationsObserver& aObserver, TOperation aOperation )
-:   CActive( EPriorityIdle ), iEngine( aEngine ), iObserver( aObserver ), iOperation( aOperation )
-    {
-    CActiveScheduler::Add( this );
-    }
-
-
-EXPORT_C CMemSpyDeviceWideOperations::~CMemSpyDeviceWideOperations()
-    {
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::~CMemSpyDeviceWideOperations() - START - iOperationCancelled: %d", iOperationCancelled );
-#endif
-
-    Cancel();
-
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::~CMemSpyDeviceWideOperations() - END" );
-#endif
-    }
-
-
-void CMemSpyDeviceWideOperations::ConstructL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::ConstructL() - START" );
-#endif
-
-    // Set engine sink time stamp, which will cause the data to be written to a 
-    // uniquely named folder (if we're using a file sink)
-    TTime now;
-    now.HomeTime();
-    iEngine.Sink().DataStreamTimeStampBeginL( now );
-
-    const TInt processCountUser = iEngine.Container().Count();
-    const TInt threadCountUser = TotalNumberOfThreads();
-    const TInt threadCountIncludingKernelSupervisor = threadCountUser + 1; // includes kernel supervisor thread
-
-    // Decide what the maximum progress bar value is...
-    // If we're performing a detailed operation, then skip straight to the end because
-    // the entire operation is performed in one go.
-    iTotalOperationSize = 0;
-    switch( iOperation )
-        {
-    // Only applicable to user-threads
-    default:
-    case EPerEntityGeneralSummary:
-    case EPerEntityGeneralDetailed:
-    case EPerEntityGeneralHandles:
-    case EPerEntityHeapCellListing:
-    case EPerEntityStackInfo:
-    case EPerEntityStackDataUser:
-    case EPerEntityStackDataKernel:
-        iTotalOperationSize = threadCountUser;
-        break;
-    // Applies to user and kernel threads
-    case EPerEntityHeapInfo:
-        iTotalOperationSize = threadCountIncludingKernelSupervisor;
-        break;
-    // Operation is performed in one go
-    case EEntireDeviceHeapInfoCompact:
-    case EEntireDeviceStackInfoCompact:
-        iProcessIndex = processCountUser;
-        iTotalOperationSize = 1;
-        break;
-        }
-
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::ConstructL() - op. count: %d", iTotalOperationSize );
-#endif
-
-    // Report total amount of work to observer
-    iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationSized, iTotalOperationSize, KNullDesC );
-
-    // Start the process rolling...
-    CompleteSelf( KErrNone );
-
-    // Indicate that we're now starting the operation
-    iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationStarting, 0, KNullDesC );
-
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::ConstructL() - END" );
-#endif
-    }
-
-
-EXPORT_C CMemSpyDeviceWideOperations* CMemSpyDeviceWideOperations::NewL( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationsObserver& aObserver, TOperation aOperation )
-    {
-    CMemSpyDeviceWideOperations* self = new(ELeave) CMemSpyDeviceWideOperations( aEngine, aObserver, aOperation );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::NewL() - about to pop..." );
-#endif
-    CleanupStack::Pop( self );
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::NewL() - popped" );
-#endif
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyDeviceWideOperations::Cancel()
-    {
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::Cancel() - START - IsActive: %d", IsActive() );
-#endif
-
-    if  ( IsActive() )
-        {
-        CActive::Cancel();
-        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationCancelled, 0, KNullDesC );
-        }
-
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::Cancel() - END" );
-#endif
-    }
-
-
-EXPORT_C TInt CMemSpyDeviceWideOperations::TotalOperationSize() const
-    {
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::TotalOperationSize::Cancel() - ret: %d", iTotalOperationSize );
-#endif
-    return iTotalOperationSize;
-    }
-
-
-void CMemSpyDeviceWideOperations::RunL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyDeviceWideOperations::RunL() - START - iStatus: %d, iOperationCancelled: %d, iThreadIndex: %03d, iOperation: %d", iStatus.Int(), iOperationCancelled, iThreadIndex, iOperation );
-#endif
-
-    User::LeaveIfError( iStatus.Int() );
-    User::ResetInactivityTime();
- 
-    if  ( iOperationCancelled )
-        {
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyDeviceWideOperations::RunL() - operation was cancelled whilst running... => Finished" );
-#endif
-        SetFinished();
-        }
-    else
-        {
-        // Get the current process
-        CMemSpyEngineObjectContainer& container = iEngine.Container();
-        const TInt processCount = container.Count();
-        //
-        if  ( iProcessIndex < processCount ) 
-            {
-            PerformNextStepL();
-            }
-        else
-            {
-            // We're done - RunL will not be called again
-            TRAP_IGNORE( PerformFinalOperationL() );
-            SetFinished();
-            }
-        }
-
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::RunL() - END" );
-#endif
-    }
-
-
-void CMemSpyDeviceWideOperations::DoCancel()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyDeviceWideOperations::DoCancel() - START" );
-#endif
-
-    // Nothing to do here
-    iOperationCancelled = ETrue;
-
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyDeviceWideOperations::DoCancel() - END" );
-#endif
-    }
-
-
-TInt CMemSpyDeviceWideOperations::RunError( TInt aError )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyDeviceWideOperations::RunError() - START - iOperationCancelled: %d, aError: %d", iOperationCancelled, aError );
-#endif
-
-    // KErrNotFound can come when trying to suspend a process or thread that no longer exists.
-    if  ( !( aError == KErrDied || aError == KErrNotFound ) )
-        {
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyDeviceWideOperations::RunError() - fatal error - cancelling..." );
-#endif       
-        Cancel();
-        }
-    //
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyDeviceWideOperations::RunError() - END - iOperationCancelled: %d, aError: %d", iOperationCancelled, aError );
-#endif
-    return KErrNone;
-    }
-
-
-void CMemSpyDeviceWideOperations::CompleteSelf( TInt aError )
-    {
-    TRequestStatus* status = &iStatus;
-    User::RequestComplete( status, aError );
-    SetActive();
-    }
-
-
-void CMemSpyDeviceWideOperations::PerformFinalOperationL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyDeviceWideOperations::PerformFinalOperationL() - START" );
-#endif
-
-    iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationCompleting, 0, KNullDesC );
- 
-    // Carry out any remaining final one-shot operation
-    TPtrC pType( KNullDesC );
-    switch( iOperation )
-        {
-    case EEntireDeviceHeapInfoCompact:
-        // Entire operation is performed here
-        pType.Set( KMemSpyUiCompactHeap );
-        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressStart, 0, pType );
-        iEngine.HelperHeap().OutputHeapInfoForDeviceL();
-        break;
-    case EEntireDeviceStackInfoCompact:
-        // Entire operation is performed here
-        pType.Set( KMemSpyUiCompactStack );
-        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressStart, 0, pType );
-        iEngine.HelperStack().OutputStackInfoForDeviceL();
-        break;
-    case EPerEntityHeapInfo:
-        // Complete op by outputting kernel heap summary
-        pType.Set( KMemSpyUiThreadNameKernel );
-        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressStart, 0, pType );
-        iEngine.HelperHeap().OutputHeapInfoKernelL();
-        break;
-    case EPerEntityHeapData:
-        // Complete op by outputting kernel heap data
-        // TODO: Uncomment after kernel heap dump is fixed
-//        pType.Set( KMemSpyUiThreadNameKernel );
-//        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressStart, 0, pType );
-//        iEngine.HelperHeap().OutputHeapDataKernelL();
-        break;
-    default:
-        break;
-        }
-
-    // Report progress
-    iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd, 1, pType );
-
-#ifdef _DEBUG
-    RDebug::Print( _L("CMemSpyDeviceWideOperations::PerformFinalOperationL() - END - pType: %S"), &pType );
-#endif
-    }
-
-
-void CMemSpyDeviceWideOperations::PerformNextStepL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyDeviceWideOperations::PerformNextStepL() - START - iProcessIndex: %d, iThreadIndex: %d", iProcessIndex, iThreadIndex );
-#endif
-
-    // Get the current process
-    CMemSpyEngineObjectContainer& container = iEngine.Container();
-    const TInt processCount = container.Count();
-    CMemSpyProcess& process = container.At( iProcessIndex );
-    const TInt threadCount = process.Count();
-    
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyDeviceWideOperations::PerformNextStepL() - threadCount: %d, processCount: %d", threadCount, processCount );
-#endif
-
-    // Get current thread
-    if  ( iThreadIndex < threadCount )
-        {
-        CMemSpyThread& thread = process.At( iThreadIndex++ );
-        const TPtrC pName( thread.Name() );
-    
-#ifdef _DEBUG
-        RDebug::Print( _L("CMemSpyDeviceWideOperations::PerformNextStepL() - thread: %S"), &pName );
-#endif
-
-        // Report progress
-        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressStart, 0, pName );
-
-        TInt progressAmount = 1;
-        TRAP_IGNORE(
-
-            switch(iOperation)
-                {
-            case EPerEntityGeneralSummary:
-            case EPerEntityGeneralDetailed:
-                if  ( iOperation == EPerEntityGeneralSummary )
-                    {
-                    iEngine.HelperProcess().OutputProcessInfoL( process );
-                    }
-                else
-                    {
-                    iEngine.HelperProcess().OutputProcessInfoDetailedL( process );
-                    }
-
-                // Process specific item, so do this only once per perocess
-                progressAmount = threadCount; 
-                iThreadIndex = threadCount;
-                break;
-            case EPerEntityGeneralHandles:
-                thread.InfoContainerForceSyncronousConstructionL().PrintL();
-                break;
-            case EPerEntityHeapInfo:
-                // Output user thread summary here, kernel thread summary will be
-                // handled when dialog dismissed
-                iEngine.HelperHeap().OutputHeapInfoUserL( thread );
-                break;
-            case EPerEntityHeapCellListing:
-                iEngine.HelperHeap().OutputCellListingUserL( thread );
-                break;
-            case EPerEntityHeapData:
-                iEngine.HelperHeap().OutputHeapDataUserL( thread );
-                break;
-            case EPerEntityStackInfo:
-                iEngine.HelperStack().OutputStackInfoL( thread );
-                break;
-            case EPerEntityStackDataUser:
-                iEngine.HelperStack().OutputStackDataL( thread, EMemSpyDriverDomainUser );
-                break;
-            case EPerEntityStackDataKernel:
-                iEngine.HelperStack().OutputStackDataL( thread, EMemSpyDriverDomainKernel );
-                break;
-            default:
-                break;
-                }
-            );
-
-        // Report progress
-        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd, progressAmount, pName );
-        }
-    else
-        {
-        // This process is exhausted - move on to the next
-        ++iProcessIndex;
-        iThreadIndex = 0;
- 
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyDeviceWideOperations::PerformNextStepL() - move to next process..." );
-#endif
-        }
-
-    // Request RunL be called again...
-    CompleteSelf( KErrNone );
-
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyDeviceWideOperations::PerformNextStepL() - END" );
-#endif
-    }
-
-
-void CMemSpyDeviceWideOperations::SetFinished()
-    {
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::SetFinished() - START" );
-#endif
-
-    // Cancel sink time stamp
-    iEngine.Sink().DataStreamTimeStampEnd();
-
-    iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationCompleted, 0, KNullDesC );
-
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::SetFinished() - END" );
-#endif
-    }
-
-
-TInt CMemSpyDeviceWideOperations::TotalNumberOfThreads() const
-    {
-    TInt count = 0;
-    //
-    const CMemSpyEngineObjectContainer& container = iEngine.Container();
-    const TInt processCount = container.Count();
-    //
-    for(TInt i=0; i<processCount; i++)
-        {
-        const CMemSpyProcess& process = container.At( i );
-        count += process.Count();
-        }
-    //
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyDeviceWideOperations::TotalNumberOfThreads() - count: %d", count );
-#endif
-    return count;
-    }
-
-
-
-
-
-
-
-
--- a/memspy/Engine/Source/EventHandlers/MemSpyEngineChunkWatcher.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +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 "MemSpyEngineChunkWatcher.h"
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-
-
-CMemSpyEngineChunkWatcher::CMemSpyEngineChunkWatcher( RMemSpyDriverClient& aDriver, TInt aPriority )
-:	CActive( aPriority ), iDriver( aDriver )
-	{
-	CActiveScheduler::Add( this );
-	}
-
-
-CMemSpyEngineChunkWatcher::~CMemSpyEngineChunkWatcher()
-	{
-	Cancel();
-    //
-    if ( iEventMonitorHandle != KNullHandle )
-        {
-        iDriver.EventMonitorClose( iEventMonitorHandle );
-        }
-    //
-    iObservers.Close();
-	}
-
-
-void CMemSpyEngineChunkWatcher::ConstructL()
-	{
-    const TInt error = iDriver.EventMonitorOpen( iEventMonitorHandle );
-    User::LeaveIfError( error );
-    //
-	Request();
-	}
-
-
-CMemSpyEngineChunkWatcher* CMemSpyEngineChunkWatcher::NewL( RMemSpyDriverClient& aDriver, TInt aPriority )
-	{
-	CMemSpyEngineChunkWatcher* self = new(ELeave) CMemSpyEngineChunkWatcher( aDriver, aPriority );
-	CleanupStack::PushL( self );
-	self->ConstructL();
-	CleanupStack::Pop( self );
-	return self;
-	}
-
-
-void CMemSpyEngineChunkWatcher::AddObserverL( MMemSpyEngineChunkWatcherObserver& aObserver )
-    {
-    RemoveObserver( aObserver );
-    iObservers.AppendL( &aObserver );
-    }
-
-
-void CMemSpyEngineChunkWatcher::RemoveObserver( MMemSpyEngineChunkWatcherObserver& aObserver )
-    {
-    const TInt count = iObservers.Count();
-    for( TInt i=count-1; i>=0; i-- )
-        {
-        MMemSpyEngineChunkWatcherObserver* obs = iObservers[ i ];
-        if ( obs == &aObserver )
-            {
-            iObservers.Remove( i );
-            }
-        }
-    }
-
-
-void CMemSpyEngineChunkWatcher::RunL()
-	{
-    const TUint notifiedId = iId;
-    const TInt typeAsInt = iStatus.Int();
-    User::LeaveIfError( typeAsInt );
-	Request();
-    //
-    const TMemSpyDriverEventType type = static_cast< TMemSpyDriverEventType >( typeAsInt );
-    switch( type )
-        {
-    case EMemSpyDriverEventTypeChunkAdd:
-        {
-        NotifyChunkAddL( notifiedId );
-        break;
-        }
-    case EMemSpyDriverEventTypeChunkDestroy:
-        {
-        NotifyChunkDestroyL( notifiedId );
-        break;
-        }
-    default:
-        break;
-        }
-	}
-
-
-void CMemSpyEngineChunkWatcher::DoCancel()
-	{
-	iDriver.EventMonitorNotifyCancel( iEventMonitorHandle );
-	}
-
-
-void CMemSpyEngineChunkWatcher::Request()
-	{
-    Cancel();
-    iDriver.EventMonitorNotify( iEventMonitorHandle, iStatus, iId );
-	SetActive();
-	}
-
-
-void CMemSpyEngineChunkWatcher::NotifyChunkAddL( TUint aChunkHandle )
-    {
-    const TInt count = iObservers.Count();
-    for( TInt i=count-1; i>=0; i-- )
-        {
-        MMemSpyEngineChunkWatcherObserver* obs = iObservers[ i ];
-        TRAP_IGNORE( obs->HandleChunkAddL( aChunkHandle ) );
-        }
-    }
-
-
-void CMemSpyEngineChunkWatcher::NotifyChunkDestroyL( TUint aChunkHandle )
-    {
-    const TInt count = iObservers.Count();
-    for( TInt i=count-1; i>=0; i-- )
-        {
-        MMemSpyEngineChunkWatcherObserver* obs = iObservers[ i ];
-        TRAP_IGNORE( obs->HandleChunkDestroyL( aChunkHandle ) );
-        }
-    }
-
--- a/memspy/Engine/Source/EventHandlers/MemSpyEngineMidwife.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +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 <memspy/engine/memspyenginemidwife.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-
-
-CMemSpyEngineMidwife::CMemSpyEngineMidwife( RMemSpyDriverClient& aDriver, TInt aPriority )
-:	CActive( aPriority ), iDriver( aDriver )
-	{
-	CActiveScheduler::Add( this );
-	}
-
-
-CMemSpyEngineMidwife::~CMemSpyEngineMidwife()
-	{
-	Cancel();
-    //
-    if ( iEventMonitorHandle != KNullHandle )
-        {
-        iDriver.EventMonitorClose( iEventMonitorHandle );
-        }
-    //
-    iObservers.Close();
-	}
-
-
-void CMemSpyEngineMidwife::ConstructL()
-	{
-    const TInt error = iDriver.EventMonitorOpen( iEventMonitorHandle );
-    User::LeaveIfError( error );
-    //
-	Request();
-	}
-
-
-CMemSpyEngineMidwife* CMemSpyEngineMidwife::NewL( RMemSpyDriverClient& aDriver, TInt aPriority )
-	{
-	CMemSpyEngineMidwife* self = new(ELeave) CMemSpyEngineMidwife( aDriver, aPriority );
-	CleanupStack::PushL( self );
-	self->ConstructL();
-	CleanupStack::Pop( self );
-	return self;
-	}
-
-
-void CMemSpyEngineMidwife::AddObserverL( MMemSpyEngineMidwifeObserver& aObserver )
-    {
-    RemoveObserver( aObserver );
-    iObservers.AppendL( &aObserver );
-    }
-
-
-void CMemSpyEngineMidwife::RemoveObserver( MMemSpyEngineMidwifeObserver& aObserver )
-    {
-    const TInt count = iObservers.Count();
-    for( TInt i=count-1; i>=0; i-- )
-        {
-        MMemSpyEngineMidwifeObserver* obs = iObservers[ i ];
-        if ( obs == &aObserver )
-            {
-            iObservers.Remove( i );
-            }
-        }
-    }
-
-
-void CMemSpyEngineMidwife::RunL()
-	{
-    const TUint notifiedId = iId;
-    const TInt typeAsInt = iStatus.Int();
-    User::LeaveIfError( typeAsInt );
-	Request();
-    //
-    const TMemSpyDriverEventType type = static_cast< TMemSpyDriverEventType >( typeAsInt );
-    switch( type )
-        {
-    case EMemSpyDriverEventTypeThreadCreate:
-        {
-        const TThreadId id( notifiedId );
-        NotifyThreadBornL( id );
-        break;
-        }
-    case EMemSpyDriverEventTypeProcessCreate:
-        {
-        const TProcessId id( notifiedId );
-        NotifyProcessBornL( id );
-        break;
-        }
-    default:
-        // Process removal not handled as not relevant
-        break;
-        }
-	}
-
-
-void CMemSpyEngineMidwife::DoCancel()
-	{
-	iDriver.EventMonitorNotifyCancel( iEventMonitorHandle );
-	}
-
-
-void CMemSpyEngineMidwife::Request()
-	{
-    Cancel();
-    iDriver.EventMonitorNotify( iEventMonitorHandle, iStatus, iId );
-	SetActive();
-	}
-
-
-void CMemSpyEngineMidwife::NotifyProcessBornL( const TProcessId& aId )
-    {
-    // NB: opening may fail - client's must tolerate this
-    RProcess process;
-    iDriver.OpenProcess( aId, process );
-    CleanupClosePushL( process );
-    //
-    const TInt count = iObservers.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        MMemSpyEngineMidwifeObserver* obs = iObservers[ i ];
-        TRAP_IGNORE( obs->ProcessIsBornL( aId, process ) );
-        }
-    //
-    CleanupStack::PopAndDestroy( &process );
-    }
-
-
-void CMemSpyEngineMidwife::NotifyThreadBornL( const TThreadId& aId )
-    {
-    // NB: opening may fail - client's must tolerate this
-    RThread thread;
-    iDriver.OpenThread( aId, thread );
-    CleanupClosePushL( thread );
-    //
-    const TInt count = iObservers.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        MMemSpyEngineMidwifeObserver* obs = iObservers[ i ];
-        TRAP_IGNORE( obs->ThreadIsBornL( aId, thread ) );
-        }
-    //
-    CleanupStack::PopAndDestroy( &thread );
-    }
-
--- a/memspy/Engine/Source/EventHandlers/MemSpyEngineUndertaker.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +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 <memspy/engine/memspyengineundertaker.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-
-
-CMemSpyEngineUndertaker::CMemSpyEngineUndertaker( RMemSpyDriverClient& aDriver, TInt aPriority )
-:	CActive( aPriority ), iDriver( aDriver )
-	{
-	CActiveScheduler::Add( this );
-	}
-
-
-CMemSpyEngineUndertaker::~CMemSpyEngineUndertaker()
-	{
-	Cancel();
-    //
-    if ( iEventMonitorHandle != KNullHandle )
-        {
-        iDriver.EventMonitorClose( iEventMonitorHandle );
-        }
-    //
-    iObservers.Close();
-	}
-
-
-void CMemSpyEngineUndertaker::ConstructL()
-	{
-    const TInt error = iDriver.EventMonitorOpen( iEventMonitorHandle );
-    User::LeaveIfError( error );
-    //
-	Request();
-	}
-
-
-CMemSpyEngineUndertaker* CMemSpyEngineUndertaker::NewL( RMemSpyDriverClient& aDriver, TInt aPriority )
-	{
-	CMemSpyEngineUndertaker* self = new(ELeave) CMemSpyEngineUndertaker( aDriver, aPriority );
-	CleanupStack::PushL( self );
-	self->ConstructL();
-	CleanupStack::Pop( self );
-	return self;
-	}
-
-
-void CMemSpyEngineUndertaker::AddObserverL( MMemSpyEngineUndertakerObserver& aObserver )
-    {
-    RemoveObserver( aObserver );
-    iObservers.AppendL( &aObserver );
-    }
-
-
-void CMemSpyEngineUndertaker::RemoveObserver( MMemSpyEngineUndertakerObserver& aObserver )
-    {
-    const TInt count = iObservers.Count();
-    for( TInt i=count-1; i>=0; i-- )
-        {
-        MMemSpyEngineUndertakerObserver* obs = iObservers[ i ];
-        if ( obs == &aObserver )
-            {
-            iObservers.Remove( i );
-            }
-        }
-    }
-
-
-void CMemSpyEngineUndertaker::RunL()
-	{
-    const TUint notifiedId = iId;
-    const TInt typeAsInt = iStatus.Int();
-    User::LeaveIfError( typeAsInt );
-	Request();
-    //
-    const TMemSpyDriverEventType type = static_cast< TMemSpyDriverEventType >( typeAsInt );
-    switch( type )
-        {
-    case EMemSpyDriverEventTypeProcessRemove:
-        {
-        const TProcessId id( notifiedId );
-        NotifyProcessDeadL( id );
-        break;
-        }
-    case EMemSpyDriverEventTypeThreadKill:
-        {
-        const TThreadId id( notifiedId );
-        NotifyThreadDeadL( id );
-        break;
-        }
-    default:
-        // Process removal not handled as not relevant
-        break;
-        }
-	}
-
-
-void CMemSpyEngineUndertaker::DoCancel()
-	{
-	iDriver.EventMonitorNotifyCancel( iEventMonitorHandle );
-	}
-
-
-void CMemSpyEngineUndertaker::Request()
-	{
-    Cancel();
-    iDriver.EventMonitorNotify( iEventMonitorHandle, iStatus, iId );
-	SetActive();
-	}
-
-
-void CMemSpyEngineUndertaker::NotifyProcessDeadL( const TProcessId& aId )
-    {
-    // NB: opening may fail - client's must tolerate this
-    RProcess process;
-    iDriver.OpenProcess( aId, process );
-    CleanupClosePushL( process );
-    //
-    const TInt count = iObservers.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        MMemSpyEngineUndertakerObserver* obs = iObservers[ i ];
-        TRAP_IGNORE( obs->ProcessIsDeadL( aId, process ) );
-        }
-    //
-    CleanupStack::PopAndDestroy( &process );
-    }
-
-
-void CMemSpyEngineUndertaker::NotifyThreadDeadL( const TThreadId& aId )
-    {
-    // NB: opening may fail - client's must tolerate this
-    RThread thread;
-    iDriver.OpenThread( aId, thread );
-    CleanupClosePushL( thread );
-    //
-    const TInt count = iObservers.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        MMemSpyEngineUndertakerObserver* obs = iObservers[ i ];
-        TRAP_IGNORE( obs->ThreadIsDeadL( aId, thread ) );
-        }
-    //
-    CleanupStack::PopAndDestroy( &thread );
-    }
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperActiveObject.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,737 +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 <memspy/engine/memspyenginehelperactiveobject.h>
-
-// System includes
-#include <s32mem.h>
-#include <e32svr.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverconstants.h>
-
-// Literal constants
-_LIT( KMemSpyEngineAOOutputComma, ", " );
-
-
-
-CMemSpyEngineHelperActiveObject::CMemSpyEngineHelperActiveObject( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperActiveObject::~CMemSpyEngineHelperActiveObject()
-    {
-    }
-
-
-void CMemSpyEngineHelperActiveObject::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperActiveObject* CMemSpyEngineHelperActiveObject::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperActiveObject* self = new(ELeave) CMemSpyEngineHelperActiveObject( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C CMemSpyEngineActiveObjectArray* CMemSpyEngineHelperActiveObject::ActiveObjectListL( const CMemSpyThread& aThread )
-    {
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - START");
-    CMemSpyEngineActiveObjectArray* array = CMemSpyEngineActiveObjectArray::NewLC();
-
-    // Is the thread's process already suspended? If not, we need to do it now.
-    const TProcessId parentProcessId( aThread.Process().Id() );
-    const TBool isSuspended = ( iEngine.SuspendedProcessId() == parentProcessId );
-    if  ( !isSuspended )
-        {
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - suspending process");
-        iEngine.ProcessSuspendLC( parentProcessId );
-        }
-
-    // Push a cleanup item to close the heap walk in case of leaves
-    CleanupStack::PushL( TCleanupItem( CleanupHeapWalk, this ) );
-
-    // Get the thread info
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - getting thread info...");
-    TMemSpyDriverThreadInfo threadInfo;
-    TInt err = iEngine.Driver().GetThreadInfo( aThread.Id(), threadInfo );
-    User::LeaveIfError( err );
-    TAny* scheduler = threadInfo.iScheduler;
-
-#if defined( _DEBUG ) && !defined( __WINS__ )
-    iEngine.HelperHeap().OutputCellListingUserL( aThread );
-#endif
-
-    // Get the heap info - we need this for verification purposes
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - getting heap info...");
-    err = iEngine.Driver().GetHeapInfoUser( iHeapInfo, aThread.Id() );
-    User::LeaveIfError( err );
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - allocated cell header length is: %d", iHeapInfo.iHeapCellHeaderLengthAllocated);
-
-    // Do we have a ROM-based scheduler pointer?
-    if  ( scheduler != NULL && iHeapInfo.Type() != TMemSpyHeapInfo::ETypeUnknown )
-        {
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - scheduler: 0x%08x", scheduler);
-
-        // Let's try to get the scheduler's heap cell...
-        HBufC8* data = SchedulerHeapCellDataLC( scheduler, aThread.Id() );
-        
-        // Try to extract the active object addresses
-        ExtractActiveObjectAddressesL( scheduler, *data, *array );
-        CleanupStack::PopAndDestroy( data );
-        }
-
-    // Tidy up
-    CleanupStack::PopAndDestroy(); // heap walk cleanup item
-    if  ( !isSuspended )
-        {
-        iEngine.ProcessResume();
-        }
-    //
-    CleanupStack::Pop( array );
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - END");
-    return array;
-    }
-
-
-HBufC8* CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC( TAny*& aCellAddress, TThreadId aThreadId )
-    {
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - START - aCellAddress: 0x%08x, aThread: %d", aCellAddress, I64INT(aThreadId.Id()));
-
-    // This is what we'll return, if we find it...
-    HBufC8* heapCellData = NULL;
-
-    // Now walk the heap!
-    TInt err = iEngine.Driver().WalkHeapInit( aThreadId );
-    User::LeaveIfError( err );
-
-    // Now we can try to find the cell's info
-    TMemSpyDriverCellType cellType;
-    TInt cellLength;
-    TInt cellNestingLevel;
-    TInt cellAllocationNumber;
-    TInt cellHeaderSize;
-    TAny* cellPayloadAddress;
-    //
-    err = iEngine.Driver().WalkHeapGetCellInfo( aCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType);
-    User::LeaveIfError( err );
-    
-	if (cellType & EMemSpyDriverAllocatedCellMask)
-        {
-        const TInt payloadLength = cellLength;
-        HBufC8* data = HBufC8::NewLC( payloadLength );
-        TPtr8 pData( data->Des() );
-        //
-        err = iEngine.Driver().WalkHeapReadCellData( aCellAddress, pData, payloadLength );
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - data fetch returned error: %d", err);
-        User::LeaveIfError( err );
-        heapCellData = data;
-        CleanupStack::Pop( data );
-        }
-    //
-    if  ( heapCellData == NULL )
-        {
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - END - didn't find the right cell => KErrNotFound");
-        User::Leave( KErrNotFound );
-        }
-    //
-    CleanupStack::PushL( heapCellData );
-
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - END - everything okay, cell is: 0x%08x", aCellAddress);
-    return heapCellData;
-    }
-
-
-void CMemSpyEngineHelperActiveObject::ExtractActiveObjectAddressesL( TAny* aSchedulerCellAddress, const TDesC8& aSchedulerCellData, CMemSpyEngineActiveObjectArray& aArray )
-    {
-    // Create read stream
-    RDesReadStream stream( aSchedulerCellData );
-    CleanupClosePushL( stream );
-
-    // First item is vtable
-    TUint address = stream.ReadUint32L();
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ExtractActiveObjectAddressesL() - vtable: 0x%08x", address );
-    (void) address;
-
-    // Next item is CActiveScheduler::iStack - which we'll skip, because it might be a stack address
-    // I suppose we could validate this against the thread's stack address range, but can't be bothered
-    // at the moment.
-    address = stream.ReadUint32L();
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ExtractActiveObjectAddressesL() - got CActiveScheduler::iStack as: 0x%08x", address);
-    (void) address;
-
-    // Then comes CActiveScheduler::iActiveQ - this is what we are interested in.... 
-    //
-    //  class TPriQue : public TDblQueBase
-    //        [TDblQueBase::iHead] - this just derives from TDblQueLinkBase and doesn't have any direct data members
-    //            class TDblQueLink : public TDblQueLinkBase
-    //                [ptr]  TDblQueLinkBase::iNext*
-    //                [ptr]  TDblQueLinkBase::iPrev*
-    // [TInt] TDblQueBase::iOffset
-    __ASSERT_COMPILE( sizeof( TDblQueLinkBase* ) == sizeof(TUint) );
-    __ASSERT_COMPILE( sizeof( TInt ) == 4 );
-
-    // Get read offset so that we know the starting address of the queue
-    const TStreamPos pos = stream.Source()->TellL(MStreamBuf::ERead);
-#ifdef __WINS__
-    const TAny* terminatingQueueAddress = (TAny*) (TUint(aSchedulerCellAddress) + pos.Offset());
-#else
-    const TAny* terminatingQueueAddress = (TAny*) aSchedulerCellAddress;
-#endif
-
-    const TAny* queueNext = (TAny*) stream.ReadUint32L();
-    const TAny* queuePrev = (TAny*) stream.ReadUint32L();
-    const TUint queueItemOffset = stream.ReadUint32L();
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ExtractActiveObjectAddressesL() - queueNext: 0x%08x, queuePrev: 0x%08x, queueItemOffset: %d, pos: %d, terminatingQueueAddress: 0x%08x", queueNext, queuePrev, queueItemOffset, pos.Offset(), terminatingQueueAddress);
-    (void) queuePrev;
-    CleanupStack::PopAndDestroy( &stream );
-        
-    // Iterate through the active objects
-    if  ( queueNext != NULL )
-        {
-        TAny* realNextCellHeapCell = NULL;
-        TAny* calculatedCellAddress = ((TAny*) (TUint(queueNext) - queueItemOffset));
-
-        while( !( calculatedCellAddress == NULL || calculatedCellAddress == terminatingQueueAddress || realNextCellHeapCell == terminatingQueueAddress ) )
-            {
-            // Create an active object for this cell
-            TAny* nextCell = ReadActiveObjectDataL( calculatedCellAddress, aArray );
-            
-            // Work out next cell address
-            calculatedCellAddress = ((TAny*) ( TUint( nextCell ) - queueItemOffset ) );
-            //RDebug::Printf("CMemSpyEngineHelperActiveObject::ExtractActiveObjectAddressesL() - calculatedCellAddress: 0x%08x, terminatingQueueAddress: 0x%08x", calculatedCellAddress, terminatingQueueAddress);
-
-            // Identify the next cell address
-            realNextCellHeapCell = ConvertAddressToRealHeapCellAddressL( nextCell );
-            }
-        }
-    }
-
-
-TAny* CMemSpyEngineHelperActiveObject::ConvertAddressToRealHeapCellAddressL( TAny* aAddress )
-    {
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ConvertAddressToRealHeapCellAddressL() - START - aAddress: 0x%08x", aAddress);
-
-    TMemSpyDriverCellType cellType;
-    TInt cellLength;
-    TInt cellNestingLevel;
-    TInt cellAllocationNumber;
-    TInt cellHeaderSize;
-    TAny* cellPayloadAddress;
-
-    TInt err = iEngine.Driver().WalkHeapGetCellInfo( aAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ConvertAddressToRealHeapCellAddressL() - END - err: %d, realCellAddress: 0x%08x, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, aAddress, cellLength, cellAllocationNumber, cellType);
-    User::LeaveIfError( err );
-
-    return aAddress;
-    }
-
-
-TAny* CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL( TAny* aCellAddress, CMemSpyEngineActiveObjectArray& aArray )
-    {
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - START");
-
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellAddress:     0x%08x", aCellAddress);
-    TAny* nextCellAddress = NULL;
-    
-    TMemSpyDriverCellType cellType;
-    TInt cellLength;
-    TInt cellNestingLevel;
-    TInt cellAllocationNumber;
-    TInt cellHeaderSize;
-    TAny* cellPayloadAddress;
-
-    // Make a separate copy of the cell address - calling GetCellInfo may well result in the address being
-    // changed in order to match the real starting address of a *heap cell*.
-    TAny* requestedCellAddress = aCellAddress;
-    TInt err = iEngine.Driver().WalkHeapGetCellInfo( requestedCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
-    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType);
-    User::LeaveIfError( err );
-    
-    if (cellType & EMemSpyDriverAllocatedCellMask)
-        {
-        const TInt payloadLength = cellLength;
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - payloadLength: %d", payloadLength);
-
-        // const TInt payloadLength = Max( 512, cellLength - iHeapInfo.iHeapCellHeaderLengthAllocated ); // Prevent negative payload lengths?
-        CBufFlat* data = CBufFlat::NewL( payloadLength );
-        CleanupStack::PushL( data );
-        data->ResizeL( payloadLength );
-        TPtr8 pData( data->Ptr( 0 ) );
-        //
-        err = iEngine.Driver().WalkHeapReadCellData( requestedCellAddress, pData, payloadLength );
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.heapCellAddress: 0x%08x (err: %d)", requestedCellAddress, err);
-        User::LeaveIfError( err );
-
-        // If an object is embedded directly within a class, for example
-        //
-        // class CSomething : public CBase
-        //   {
-        //   CIdle iEmbeddedIdler;
-        //   }
-        //
-        // then aCellAddress actually points to somewhere *within* a heap cell, not to the actual starting address of
-        // the heap cell itself. We must take this into account when parsing the heap cell data (i.e. the bit of the cell we
-        // are interested in starts part way through the cell data).
-        TInt cellOffset = TUint32( aCellAddress ) - TUint32( requestedCellAddress );
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellOffset:      %d (ignoring cell header)", cellOffset);
-        cellOffset -= cellHeaderSize;
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellOffset:      %d (adjusted for cell header)", cellOffset);
-
-        // Got the cell data for the active object. Let's parse it.
-        RBufReadStream stream( *data, cellOffset );
-        CleanupClosePushL( stream );
-
-        // First item should be vTable
-        TAny* vTable = (TAny*) stream.ReadUint32L();
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.vTable:          0x%08x", vTable );
-
-        // Next item should be the request status. First the iStatus, then the iFlags
-        const TInt requestStatusValue = stream.ReadInt32L();
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.rsVal:           %10d", requestStatusValue );
-        const TUint requestStatusFlags = stream.ReadUint32L();
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.rsFlags:         0x%02x", requestStatusFlags );
-
-        // Next comes the baseclass for the link - TDblQueLinkBase
-        TAny* nextEntryAddress = (TAny*) stream.ReadUint32L();
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Next:      0x%08x", nextEntryAddress );
-        TAny* prevEntryAddress = (TAny*) stream.ReadUint32L();
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Prev:      0x%08x", prevEntryAddress );
-
-        // Next comes the TPriQueueLink itself
-        const TInt priority = stream.ReadInt32L();
-        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Pri:       %d", priority );
-        
-        // Done - save object & tidy up
-        CMemSpyEngineActiveObject* object = CMemSpyEngineActiveObject::NewLC( aCellAddress, vTable, priority, requestStatusValue, requestStatusFlags, nextEntryAddress, prevEntryAddress, iEngine );
-        aArray.AddItemL( object );
-        CleanupStack::Pop( object );
-        CleanupStack::PopAndDestroy( 2, data ); // stream & data
-        
-        nextCellAddress = (TAny*) nextEntryAddress;
-        //RDebug::Printf(" ");
-        }
-
-    return nextCellAddress;
-    }
-
-
-void CMemSpyEngineHelperActiveObject::CleanupHeapWalk( TAny* aSelf )
-    {
-    CMemSpyEngineHelperActiveObject* self = reinterpret_cast< CMemSpyEngineHelperActiveObject* >( aSelf );
-    self->iEngine.Driver().WalkHeapClose();
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineActiveObjectArray::CMemSpyEngineActiveObjectArray()
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineActiveObjectArray::~CMemSpyEngineActiveObjectArray()
-    {
-    delete iHeader;
-    iObjects.ResetAndDestroy();
-    iObjects.Close();
-    }
-
-
-void CMemSpyEngineActiveObjectArray::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineActiveObjectArray* CMemSpyEngineActiveObjectArray::NewLC(  )
-    {
-    CMemSpyEngineActiveObjectArray* self = new(ELeave) CMemSpyEngineActiveObjectArray();
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineActiveObjectArray::Count() const
-    {
-    return iObjects.Count();
-    }
-
-
-EXPORT_C CMemSpyEngineActiveObject& CMemSpyEngineActiveObjectArray::At( TInt aIndex )
-    {
-    return *iObjects[ aIndex ];
-    }
-
-
-EXPORT_C const CMemSpyEngineActiveObject& CMemSpyEngineActiveObjectArray::At( TInt aIndex ) const
-    {
-    return *iObjects[ aIndex ];
-    }
-
-
-EXPORT_C CMemSpyEngineActiveObject& CMemSpyEngineActiveObjectArray::ObjectByAddressL( TAny* aAddress )
-    {
-    const TInt index = ObjectIndexByAddress( aAddress );
-    User::LeaveIfError( index );
-    CMemSpyEngineActiveObject& ret = At( index );
-    return ret;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineActiveObjectArray::ObjectIndexByAddress( TAny* aAddress ) const
-    {
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineActiveObject& object = At( i );
-        //
-        if  ( object.Address() == aAddress )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C void CMemSpyEngineActiveObjectArray::OutputDataColumnsL( CMemSpyEngine& aEngine )
-    {
-    HBufC* columns = HBufC::NewLC( 1024 );
-    TPtr pColumns( columns->Des() );
-    //
-    _LIT(KCol1, "Address");
-    pColumns.Append( KCol1 );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    _LIT(KCol3, "Priority");
-    pColumns.Append( KCol3 );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    _LIT(KCol4, "Is Active");
-    pColumns.Append( KCol4 );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    _LIT(KCol5, "Request Pending");
-    pColumns.Append( KCol5 );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    _LIT(KCol6, "Status Value");
-    pColumns.Append( KCol6 );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    _LIT(KCol7, "Status Flags");
-    pColumns.Append( KCol7 );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    _LIT(KCol8, "vTable Address");
-    pColumns.Append( KCol8 );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    _LIT(KCol9, "vTable for Symbolic Lookup");
-    pColumns.Append( KCol9 );
-    //
-    aEngine.Sink().OutputLineL( pColumns );
-    CleanupStack::PopAndDestroy( columns );
-    }
-
-
-EXPORT_C TInt CMemSpyEngineActiveObjectArray::MdcaCount() const
-    {
-    TInt count = Count();
-    //
-    if  ( count > 0 )
-        {
-        ++count;
-        }
-    //
-    return count;
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineActiveObjectArray::MdcaPoint( TInt aIndex ) const
-    {
-    TPtrC ret( *iHeader );
-    //
-    if  ( aIndex > 0 )
-        {
-        const CMemSpyEngineActiveObject& object = At( aIndex - 1 );
-        ret.Set( object.Caption() );
-        }
-    //
-    return ret;
-    }
-
-
-void CMemSpyEngineActiveObjectArray::AddItemL( CMemSpyEngineActiveObject* aItem )
-    {
-    iObjects.AppendL( aItem );
-    BuildHeaderCaptionL();
-    }
-
-
-void CMemSpyEngineActiveObjectArray::InsertL( CMemSpyEngineActiveObject* aItem, TInt aIndex )
-    {
-    iObjects.InsertL( aItem, aIndex );
-    BuildHeaderCaptionL();
-    }
-
-
-void CMemSpyEngineActiveObjectArray::BuildHeaderCaptionL()
-    {
-    const TInt KHeaderLength = 100;
-    //
-    if  ( !iHeader )
-        {
-        iHeader = HBufC::NewL( KHeaderLength );
-        }
-    //
-    TPtr pHeader( iHeader->Des() );
-    //
-    _LIT(KCaption, "\tNumber of AO\'s\t\t%d");
-    pHeader.Format( KCaption, Count() );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineActiveObject::CMemSpyEngineActiveObject( TAny* aAddress, TAny* aVTable, TInt aPriority, TInt aRSValue, TUint aRSFlags, TAny* aNextAOAddress, TAny* aPrevAOAddress )
-:   CDesCArrayFlat(6), iAddress( aAddress ), iVTable( aVTable ), iPriority( aPriority ), iRequestStatusValue( aRSValue ), iRequestStatusFlags( aRSFlags ), iNextAOAddress( aNextAOAddress ), iPrevAOAddress( aPrevAOAddress )
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineActiveObject::~CMemSpyEngineActiveObject()
-    {
-    delete iCaption;
-    }
-
-
-void CMemSpyEngineActiveObject::ConstructL( CMemSpyEngine& /*aEngine*/ )
-    {
-    TBuf<256> item;
-
-    _LIT(KBasicFormat, "\t0x%08x\t\t");
-    item.Format( KBasicFormat, VTable() );
-
-    // Add modifiers
-    _LIT( KModifiers, "%d" );
-    _LIT( KBoxedCharFormat, " [%c]" );
-    item.AppendFormat( KModifiers, RequestStatusValue() );
-    if  ( IsActive() )
-        {
-        item.AppendFormat( KBoxedCharFormat, 'A' );
-        }
-    if  ( RequestIsPending() )
-        {
-        item.AppendFormat( KBoxedCharFormat, 'P' );
-        }
-    iCaption = item.AllocL();
-
-    // Listbox items
-    TPtrC value;
-
-    // Address
-    _LIT(KCaption1, "\tAddress\t\t0x%08x");
-    item.Format( KCaption1, iAddress );
-    AppendL( item );
-
-    // vTable
-    _LIT(KCaption2, "\tVTable\t\t0x%08x");
-    item.Format( KCaption2, iVTable );
-    AppendL( item );
-
-    //
-    _LIT(KCaption3, "\tStatus Value\t\t%d");
-    item.Format( KCaption3, iRequestStatusValue );
-    AppendL( item );
-
-    //
-    _LIT(KCaption5, "\tIs Active\t\t%S");
-    value.Set( YesNoValue( IsActive() ) );
-    item.Format( KCaption5, &value );
-    AppendL( item );
-
-    //
-    _LIT(KCaption6, "\tRequest Pending\t\t%S");
-    value.Set( YesNoValue( RequestIsPending() ) );
-    item.Format( KCaption6, &value );
-    AppendL( item );
-
-    //
-    _LIT(KCaption4, "\tPriority\t\t%d");
-    item.Format( KCaption4, iPriority );
-    AppendL( item );
-    }
-
-
-CMemSpyEngineActiveObject* CMemSpyEngineActiveObject::NewLC( TAny* aAddress, TAny* aVTable, TInt aPriority, TInt aRSValue, TUint aRSFlags, TAny* aNextAOAddress, TAny* aPrevAOAddress, CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineActiveObject* self = new(ELeave) CMemSpyEngineActiveObject( aAddress, aVTable, aPriority, aRSValue, aRSFlags, aNextAOAddress, aPrevAOAddress );
-    CleanupStack::PushL( self );
-    self->ConstructL( aEngine );
-    return self;
-    }
-
-
-EXPORT_C TBool CMemSpyEngineActiveObject::IsActive() const
-    {
-    return ( iRequestStatusFlags & CMemSpyEngineActiveObject::EActive );
-    }
-
-
-EXPORT_C TBool CMemSpyEngineActiveObject::IsAddedToScheduler() const
-    {
-    return ( iNextAOAddress != NULL );
-    }
-
-
-EXPORT_C TBool CMemSpyEngineActiveObject::RequestIsPending() const
-    {
-    return ( iRequestStatusFlags & CMemSpyEngineActiveObject::ERequestPending );
-    }
-
-
-EXPORT_C void CMemSpyEngineActiveObject::OutputDataL( CMemSpyEngine& aEngine ) const
-    {
-    _LIT(KMemSpyEngineAOOutputHex, "0x%08x");
-    _LIT(KMemSpyEngineAOOutputDecimal, "%d");
-    _LIT(KMemSpyEngineAOOutputDecimalFixed10, "%10d");
-    _LIT(KMemSpyEngineAOOutputString, "%S");
-    _LIT(KMemSpyEngineAOOutputVTable, "vTable: 0x%08x");
-    //
-    TPtrC yesNoValue( KNullDesC );
-    HBufC* columns = HBufC::NewLC( 1024 );
-    TPtr pColumns( columns->Des() );
-    //
-    pColumns.AppendFormat( KMemSpyEngineAOOutputHex, Address() );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    pColumns.AppendFormat( KMemSpyEngineAOOutputDecimal, Priority() );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    yesNoValue.Set( YesNoValue( IsActive() ) );
-    pColumns.AppendFormat( KMemSpyEngineAOOutputString, &yesNoValue );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    yesNoValue.Set( YesNoValue( RequestIsPending() ) );
-    pColumns.AppendFormat( KMemSpyEngineAOOutputString, &yesNoValue );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    pColumns.AppendFormat( KMemSpyEngineAOOutputDecimalFixed10, RequestStatusValue() );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    pColumns.AppendFormat( KMemSpyEngineAOOutputDecimal, RequestStatusFlags() );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    pColumns.AppendFormat( KMemSpyEngineAOOutputHex, VTable() );
-    pColumns.Append( KMemSpyEngineAOOutputComma );
-    //
-    pColumns.AppendFormat( KMemSpyEngineAOOutputVTable, VTable() );
-    //
-    aEngine.Sink().OutputLineL( pColumns );
-    CleanupStack::PopAndDestroy( columns );
-    }
-
-
-TPtrC CMemSpyEngineActiveObject::YesNoValue( TBool aValue )
-    {
-    _LIT(KYesString, "Yes");
-    _LIT(KNoString, "No");
-    //
-    TPtrC pRet( KNoString );
-    if  ( aValue )
-        {
-        pRet.Set( KYesString );
-        }
-    //
-    return pRet;
-    }
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperChunk.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,812 +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 <memspy/engine/memspyenginehelperchunk.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-
-// Constants
-const TInt KMemSpyEngineMaxChunkCount = 768;
-
-// Literal constants
-_LIT( KMemSpyEngineChunkListOutputComma, ", " );
-
-
-
-CMemSpyEngineHelperChunk::CMemSpyEngineHelperChunk( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperChunk::~CMemSpyEngineHelperChunk()
-    {
-    }
-
-
-void CMemSpyEngineHelperChunk::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperChunk* CMemSpyEngineHelperChunk::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperChunk* self = new(ELeave) CMemSpyEngineHelperChunk( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL( const CMemSpyThread& aThread )
-    {
-    OutputChunkInfoForThreadL( aThread.Id() );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL( TThreadId aTid )
-    {
-    TBuf<512> lineBuffer;
-    OutputChunkInfoForThreadL( aTid, lineBuffer );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL( TThreadId aTid, TDes& aLineBuffer )
-    {
-    DoOutputChunkInfoForObjectL( aTid, aLineBuffer, EThread );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL( const CMemSpyProcess& aProcess )
-    {
-    OutputChunkInfoForProcessL( aProcess.Id() );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL( TProcessId aPid )
-    {
-    TBuf<512> lineBuffer;
-    OutputChunkInfoForProcessL( aPid, lineBuffer );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL( TProcessId aPid, TDes& aLineBuffer )
-    {
-    DoOutputChunkInfoForObjectL( aPid, aLineBuffer, EProcess );
-    }
-
-
-EXPORT_C CMemSpyEngineChunkList* CMemSpyEngineHelperChunk::ListL()
-    {
-    RArray<TAny*> handles( 128 );
-    CleanupClosePushL( handles );
-    //
-    GetChunkHandlesL( handles, EAll );
-    CMemSpyEngineChunkList* list = CreateListFromHandlesL( handles );
-    //
-    CleanupStack::PopAndDestroy( &handles );
-    return list;
-    }
-
-
-EXPORT_C CMemSpyEngineChunkList* CMemSpyEngineHelperChunk::ListForThreadL( TThreadId aTid )
-    {
-    RArray<TAny*> handles( 128 );
-    CleanupClosePushL( handles );
-    //
-    GetChunkHandlesL( handles, EThread, aTid );
-    CMemSpyEngineChunkList* list = CreateListFromHandlesL( handles );
-    //
-    CleanupStack::PopAndDestroy( &handles );
-    return list;
-    }
-
-
-EXPORT_C CMemSpyEngineChunkList* CMemSpyEngineHelperChunk::ListForProcessL( TProcessId aPid )
-    {
-    RArray<TAny*> handles( 128 );
-    CleanupClosePushL( handles );
-    //
-    GetChunkHandlesL( handles, EProcess, aPid );
-    CMemSpyEngineChunkList* list = CreateListFromHandlesL( handles );
-    //
-    CleanupStack::PopAndDestroy( &handles );
-    return list;
-    }
-
-
-void CMemSpyEngineHelperChunk::DoOutputChunkInfoForObjectL( TUint aId, TDes& aLineBuffer, TType aType )
-    {
-    TFullName ownerName;
-	//
-    RArray<TAny*> handles( 128 );
-    CleanupClosePushL( handles );
-    //
-    GetChunkHandlesL( handles, aType, aId );
-    CMemSpyEngineChunkList* list = CreateListFromHandlesL( handles );
-    //
-    CleanupStack::PopAndDestroy( &handles );
-    CleanupStack::PushL( list );
-    //
-    const TInt count = list->Count();
-    for (TInt i=0; i<count; i++)
-    	{
-        const CMemSpyEngineChunkEntry& entry = list->At( i );
-        //
-        _LIT(KLine1, "Name");
-        iEngine.Sink().OutputItemAndValueL( KLine1, entry.Name() );
-        //
-        _LIT(KLine2, "Owner");
-        entry.OwnerName( ownerName );
-        iEngine.Sink().OutputItemAndValueL( KLine2, ownerName );
-        //
-        _LIT(KLine3, "Address");
-        _LIT(KLine3Format, "0x%08x - 0x%08x");
-        aLineBuffer.Format(KLine3Format, entry.BaseAddress(), entry.UpperAddress() );
-        iEngine.Sink().OutputItemAndValueL( KLine3, aLineBuffer );
-        //
-        _LIT(KLine4, "Size (max)");
-        _LIT(KLine4Format, "%d (%d)");
-        aLineBuffer.Format(KLine4Format, entry.Size(), entry.MaxSize());
-        iEngine.Sink().OutputItemAndValueL( KLine4, aLineBuffer );
-        //
-        if  ( i < count - 1 )
-            {
-            iEngine.Sink().OutputBlankLineL();
-    		}
-        }
-    //
-    CleanupStack::PopAndDestroy( list );
-    }
-
-
-void CMemSpyEngineHelperChunk::GetChunkHandlesL( RArray<TAny*>& aHandles, TType aType, TUint aId )
-    {
-	TAny* handles[ KMemSpyEngineMaxChunkCount ];
-	TInt count = KMemSpyEngineMaxChunkCount;
-
-    TInt r = 0;
-    //
-    switch( aType )
-        {
-    case EThread:
-        r = iEngine.Driver().GetChunkHandlesForThread( aId, handles, count );
-        break;
-    case EProcess:
-        r = iEngine.Driver().GetChunkHandlesForProcess( aId, handles, count );
-        break;
-    default:
-    case EAll:
-        r = iEngine.Driver().GetChunkHandles( handles, count );
-        break;
-        }
-    //
-    if  ( r == KErrNone )
-    	{
-        count = Min( count, KMemSpyEngineMaxChunkCount );
-        for( TInt index = 0; index < count; index++ )
-            {
-            TAny* handle = handles[ index ];
-
-            if  ( aHandles.Find( handle ) == KErrNotFound )
-                {
-                aHandles.AppendL( handle );
-                }
-            }
-        }
-    }
-
-
-CMemSpyEngineChunkList* CMemSpyEngineHelperChunk::CreateListFromHandlesL( const RArray<TAny*>& aHandles )
-    {
-    CMemSpyEngineChunkList* list = CMemSpyEngineChunkList::NewLC( iEngine );
-    //
-    TMemSpyDriverChunkInfo info;
-    const TInt count = aHandles.Count();
-    //
-    for( TInt i=0; i<count; i++ )
-        {
-        TAny* handle = aHandles[ i ];
-        //
-    	const TInt error = iEngine.Driver().GetChunkInfo( handle, info );
-        if  ( error == KErrNone )
-            {
-            CMemSpyEngineChunkEntry* entry = CMemSpyEngineChunkEntry::NewLC( iEngine, info );
-            list->AddItemL( entry );
-            CleanupStack::Pop( entry );
-            }
-        }
-    //
-    list->SortBySizeL();
-    //
-    CleanupStack::Pop( list );
-    return list;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineChunkList::CMemSpyEngineChunkList( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineChunkList::~CMemSpyEngineChunkList()
-    {
-    iItems.ResetAndDestroy();
-    iItems.Close();
-    }
-
-
-void CMemSpyEngineChunkList::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineChunkList* CMemSpyEngineChunkList::NewLC( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineChunkList* self = new(ELeave) CMemSpyEngineChunkList( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineChunkList::Count() const
-    {
-    return iItems.Count();
-    }
-
-
-EXPORT_C CMemSpyEngineChunkEntry& CMemSpyEngineChunkList::At( TInt aIndex )
-    {
-    return *iItems[ aIndex ];
-    }
-
-
-EXPORT_C const CMemSpyEngineChunkEntry& CMemSpyEngineChunkList::At( TInt aIndex ) const
-    {
-    return *iItems[ aIndex ];
-    }
-
-
-EXPORT_C void CMemSpyEngineChunkList::SortByNameL()
-    {
-    TLinearOrder< CMemSpyEngineChunkEntry > comparer( CompareByName );
-    iItems.Sort( comparer );
-    }
-
-
-EXPORT_C void CMemSpyEngineChunkList::SortBySizeL()
-    {
-    TLinearOrder< CMemSpyEngineChunkEntry > comparer( CompareBySize );
-    iItems.Sort( comparer );
-    }
-
-
-EXPORT_C TInt CMemSpyEngineChunkList::ItemIndex( const CMemSpyEngineChunkEntry& aEntry ) const
-    {
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineChunkEntry* item = iItems[ i ];
-        //
-        if  ( item == &aEntry )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C void CMemSpyEngineChunkList::OutputDataColumnsL( CMemSpyEngine& aEngine )
-    {
-    HBufC* columns = HBufC::NewLC( 1024 );
-    TPtr pColumns( columns->Des() );
-
-    //
-    _LIT(KCol1, "Name");
-    pColumns.Append( KCol1 );
-    pColumns.Append( KMemSpyEngineChunkListOutputComma );
-
-    //
-    _LIT(KCol2, "Owning Process");
-    pColumns.Append( KCol2 );
-    pColumns.Append( KMemSpyEngineChunkListOutputComma );
-
-    //
-    _LIT(KCol3, "Size");
-    pColumns.Append( KCol3 );
-    pColumns.Append( KMemSpyEngineChunkListOutputComma );
-
-    //
-    _LIT(KCol4, "Max. Size");
-    pColumns.Append( KCol4 );
-    pColumns.Append( KMemSpyEngineChunkListOutputComma );
-
-    //
-    _LIT(KCol5, "Address");
-    pColumns.Append( KCol5 );
-
-    //
-    aEngine.Sink().OutputLineL( pColumns );
-    CleanupStack::PopAndDestroy( columns );
-    }
-
-
-EXPORT_C TBool CMemSpyEngineChunkList::EntryExists( TAny* aHandle ) const
-    {
-    TBool ret = EFalse;
-    //
-    const TInt count = Count();
-    for( TInt i=0; i<count && !ret; i++ )
-        {
-        const CMemSpyEngineChunkEntry* item = iItems[ i ];
-        ret = ( item->Handle() == aHandle );
-        }
-    //
-    return ret;
-    }
-
-
-void CMemSpyEngineChunkList::AddItemL( CMemSpyEngineChunkEntry* aItem )
-    {
-    iItems.AppendL( aItem );
-    }
-
-
-void CMemSpyEngineChunkList::Remove( TInt aIndex )
-    {
-    CMemSpyEngineChunkEntry* item = iItems[ aIndex ];
-    delete item;
-    iItems.Remove( aIndex );
-    }
-
-
-void CMemSpyEngineChunkList::RemoveByHandle( TAny* aChunkHandle )
-    {
-    const TInt index = ItemIndexByChunkHandle( aChunkHandle );
-    if  ( index >= 0 )
-        {
-        Remove( index );
-        }
-    }
-
-
-TInt CMemSpyEngineChunkList::ItemIndexByProcessId( TUint aPid ) const
-    {
-    const TInt ret = ItemIndexByProcessId( aPid, 0 );
-    return ret;
-    }
-
-
-TInt CMemSpyEngineChunkList::ItemIndexByProcessId( TUint aPid, TInt aStartIndex ) const
-    {
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = Count();
-    for( TInt i=aStartIndex; i<count; i++ )
-        {
-        const CMemSpyEngineChunkEntry* item = iItems[ i ];
-        //
-        if  ( item->OwnerId() == aPid )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineChunkList::ItemIndexByProcessId( TUint aPid, TMemSpyDriverChunkType aType ) const
-    {
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineChunkEntry* item = iItems[ i ];
-        //
-        if  ( item->OwnerId() == aPid && item->Info().iType == aType )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineChunkList::ItemIndexByChunkHandle( TAny* aHandle ) const
-    {
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineChunkEntry* item = iItems[ i ];
-        //
-        if  ( item->Handle() == aHandle )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineChunkList::MdcaCount() const
-    {
-    return Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineChunkList::MdcaPoint( TInt aIndex ) const
-    {
-    const CMemSpyEngineChunkEntry& item = At( aIndex );
-    return TPtrC( item.Caption() );
-    }
-
-
-TInt CMemSpyEngineChunkList::CompareByName( const CMemSpyEngineChunkEntry& aLeft, const CMemSpyEngineChunkEntry& aRight )
-    {
-    const TInt ret = aLeft.Name().CompareF( aRight.Name() );
-    return ret;
-    }
-
-
-TInt CMemSpyEngineChunkList::CompareBySize( const CMemSpyEngineChunkEntry& aLeft, const CMemSpyEngineChunkEntry& aRight )
-    {
-    TInt ret = -1;
-    //
-    if  ( aLeft.Size() < aRight.Size() )
-        {
-        ret = 1;
-        }
-    else if ( aLeft.Size() == aRight.Size() )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineChunkEntry::CMemSpyEngineChunkEntry( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-
-CMemSpyEngineChunkEntry::~CMemSpyEngineChunkEntry()
-    {
-    delete iCaption;
-    delete iInfo;
-    delete iList;
-    }
-
-
-void CMemSpyEngineChunkEntry::ConstructL( const TMemSpyDriverChunkInfo& aInfo )
-    {
-    // Copy info
-    iInfo = new(ELeave) TMemSpyDriverChunkInfo();
-    *iInfo = aInfo;
-
-    // Make caption
-    TBuf<KMaxFullName+128> item;
-    _LIT(KCaptionFormat, "\t%S\t\t%d");
-    item.Format( KCaptionFormat, &Name(), Size() );
-    iCaption = item.AllocL();
-
-    // Make other items
-    iList = CMemSpyEngineOutputList::NewL();
-
-    _LIT( KEntry0, "Name");
-    iList->AddItemL( KEntry0, Name() );
-
-    _LIT( KEntryType, "Type" );
-    switch( aInfo.iType )
-        {
-    default:
-    case EMemSpyDriverChunkTypeUnknown:
-        iList->AddItemL( KEntryType, _L("Unknown") );
-        break;
-    case EMemSpyDriverChunkTypeHeap:
-        iList->AddItemL( KEntryType, _L("Heap") );
-        break;
-    case EMemSpyDriverChunkTypeHeapKernel:
-        iList->AddItemL( KEntryType, _L("Kernel Heap") );
-        break;
-    case EMemSpyDriverChunkTypeStackAndProcessGlobalData:
-        iList->AddItemL( KEntryType, _L("Stack and Process Global Data") );
-        break;
-    case EMemSpyDriverChunkTypeStackKernel:
-        iList->AddItemL( KEntryType, _L("Kernel Stack") );
-        break;
-    case EMemSpyDriverChunkTypeGlobalData:
-        iList->AddItemL( KEntryType, _L("Global Data") );
-        break;
-    case EMemSpyDriverChunkTypeCode:
-        iList->AddItemL( KEntryType, _L("Code") );
-        break;
-    case EMemSpyDriverChunkTypeCodeGlobal:
-        iList->AddItemL( KEntryType, _L("Global Code") );
-        break;
-    case EMemSpyDriverChunkTypeCodeSelfModifiable:
-        iList->AddItemL( KEntryType, _L("Self Modifiable Code") );
-        break;
-    case EMemSpyDriverChunkTypeLocal:
-        iList->AddItemL( KEntryType, _L("Local") );
-        break;
-    case EMemSpyDriverChunkTypeGlobal:
-        iList->AddItemL( KEntryType, _L("Global") );
-        break;
-    case EMemSpyDriverChunkTypeRamDrive:
-        iList->AddItemL( KEntryType, _L("RAM Drive") );
-        break;
-        }
-
-    _LIT( KEntry1, "Owning Process");
-    OwnerName( item );
-    iList->AddItemL( KEntry1, item );
-
-    _LIT( KEntry2, "Address" );
-    _LIT( KEntry2Format, "0x%08x - 0x%08x" );
-    item.Format( KEntry2Format, BaseAddress(), UpperAddress() );
-    iList->AddItemL( KEntry2, item );
-
-    _LIT( KEntry3, "Size");
-    iList->AddItemL( KEntry3, Size() );
-
-    _LIT( KEntry4, "Max. Size");
-    iList->AddItemL( KEntry4, MaxSize() );
-
-    _LIT( KEntryAttributeFormat, "Attribute %d");
-    TInt attribNum = 0;
-    //
-    if  ( aInfo.iAttributes & ENormal )
-        {
-        item.Format( KEntryAttributeFormat, ++attribNum );
-        iList->AddItemL( item, _L("Normal") );
-        }
-    if  ( aInfo.iAttributes & EDoubleEnded )
-        {
-        item.Format( KEntryAttributeFormat, ++attribNum );
-        iList->AddItemL( item, _L("Double Ended") );
-        }
-    if  ( aInfo.iAttributes & EDisconnected )
-        {
-        item.Format( KEntryAttributeFormat, ++attribNum );
-        iList->AddItemL( item, _L("Disconnected") );
-        }
-    if  ( aInfo.iAttributes & EConstructed )
-        {
-        item.Format( KEntryAttributeFormat, ++attribNum );
-        iList->AddItemL( item, _L("Constructed") );
-        }
-    if  ( aInfo.iAttributes & EMemoryNotOwned )
-        {
-        item.Format( KEntryAttributeFormat, ++attribNum );
-        iList->AddItemL( item, _L("Memory Not Owned") );
-        }
-    }
-
-
-CMemSpyEngineChunkEntry* CMemSpyEngineChunkEntry::NewLC( CMemSpyEngine& aEngine, const TMemSpyDriverChunkInfo& aInfo )
-    {
-    CMemSpyEngineChunkEntry* self = new(ELeave) CMemSpyEngineChunkEntry( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL( aInfo );
-    return self;
-    }
-
-
-const TDesC& CMemSpyEngineChunkEntry::Name() const
-    {
-    return iInfo->iName;
-    }
-
-
-TAny* CMemSpyEngineChunkEntry::Handle() const 
-    {
-    return iInfo->iHandle;
-    }
-
-
-TInt CMemSpyEngineChunkEntry::Size() const
-    {
-    return iInfo->iSize;
-    }
-
-
-TInt CMemSpyEngineChunkEntry::MaxSize() const
-    {
-    return iInfo->iMaxSize;
-    }
-
-
-TAny* CMemSpyEngineChunkEntry::BaseAddress() const
-    { 
-    return iInfo->iBaseAddress;
-    }
-
-
-TAny* CMemSpyEngineChunkEntry::UpperAddress() const
-    {
-    return (TAny*) (TUint(BaseAddress()) + TUint(Size()));
-    }
-
-
-TUint CMemSpyEngineChunkEntry::OwnerId() const
-    {
-    return iInfo->iOwnerId;
-    }
-
-
-EXPORT_C void CMemSpyEngineChunkEntry::OwnerName( TDes& aDes ) const
-    {
-    aDes.Zero();
-    AppendOwnerName( aDes );
-    }
-
-
-EXPORT_C void CMemSpyEngineChunkEntry::AppendOwnerName( TDes& aDes ) const
-    {
-    RProcess owner;
-    const TInt error = owner.Open( (TProcessId) OwnerId() );
-    if  ( error == KErrNone )
-        {
-        aDes.Append( owner.FullName() );
-        owner.Close();
-        }
-    }
-
-
-EXPORT_C void CMemSpyEngineChunkEntry::OutputDataL( CMemSpyEngineHelperChunk& aHelper ) const
-    {
-    HBufC* columns = HBufC::NewLC( 1024 );
-    TPtr pColumns( columns->Des() );
-
-    // Name
-    pColumns.Copy( Name() );
-    MemSpyEngineUtils::TextAfterDoubleColon( pColumns );
-    pColumns.Append( KMemSpyEngineChunkListOutputComma );
-
-    // Owning Process
-    AppendOwnerName( pColumns );
-    pColumns.Append( KMemSpyEngineChunkListOutputComma );
-
-    // Size
-    pColumns.AppendNum( Size(), EDecimal ); 
-    pColumns.Append( KMemSpyEngineChunkListOutputComma );
-
-    // Max. Size
-    pColumns.AppendNum( MaxSize(), EDecimal ); 
-    pColumns.Append( KMemSpyEngineChunkListOutputComma );
-
-    // Address
-    _LIT( KAddressFormat, "0x%08x - 0x%08x");
-    pColumns.AppendFormat( KAddressFormat, BaseAddress(), UpperAddress() );
-
-    //
-    aHelper.Engine().Sink().OutputLineL( pColumns );
-    CleanupStack::PopAndDestroy( columns );
-    }
-
-
-EXPORT_C TInt CMemSpyEngineChunkEntry::MdcaCount() const
-    {
-    return iList->MdcaCount();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineChunkEntry::MdcaPoint( TInt aIndex ) const
-    {
-    return iList->MdcaPoint( aIndex );
-    }
-
-
-TMemSpyDriverChunkInfo& CMemSpyEngineChunkEntry::Info()
-    {
-    return *iInfo;
-    }
-
-
-const TMemSpyDriverChunkInfo& CMemSpyEngineChunkEntry::Info() const
-    {
-    return *iInfo;
-    }
-
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperCodeSegment.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,950 +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 <memspy/engine/memspyenginehelpercodesegment.h>
-
-// System includes
-#include <e32capability.h>
-#include <f32file.h>
-#include <babitflags.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-
-// Constants
-const TInt KMemSpyEngineMaxCodeSegmentCount = 512;
-
-// Literal constants
-_LIT( KMemSpyEngineCodeSegListOutputComma, ", " );
-
-
-
-CMemSpyEngineHelperCodeSegment::CMemSpyEngineHelperCodeSegment( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperCodeSegment::~CMemSpyEngineHelperCodeSegment()
-    {
-    }
-
-
-void CMemSpyEngineHelperCodeSegment::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperCodeSegment* CMemSpyEngineHelperCodeSegment::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperCodeSegment* self = new(ELeave) CMemSpyEngineHelperCodeSegment( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperCodeSegment::OutputCodeSegmentsL( TUint aPid, TDes& aLine, const TDesC& aPrefix, TChar aSectionUnderlineCharacter, TBool aLowerCaseSectionHeading)
-    {
-	_LIT(KHeaderLC, "Code Segments");
-	_LIT(KHeaderUC, "CODE SEGMENTS");
-
-	_LIT(KFmtOverflow, "Only first %d code segments displayed");
-	_LIT(KFmtMod, "%S%08X-%08X %S");
-
-	const TInt KMaxCount = 256;
-	TAny* handles[KMaxCount];
-	TInt c = KMaxCount;
-
-	TInt r = iEngine.Driver().GetCodeSegs(aPid, handles, c);
-	if  ( r == KErrNone )
-    	{
-        if  ( c > 0 )
-            {
-            if  ( aLowerCaseSectionHeading )
-                {
-                iEngine.Sink().OutputSectionHeadingL( KHeaderLC, aSectionUnderlineCharacter );
-                }
-            else
-                {
-            	iEngine.Sink().OutputSectionHeadingL( KHeaderUC, aSectionUnderlineCharacter );
-                }
-
-        	if (c > KMaxCount)
-        		{
-        		c = KMaxCount;
-        		aLine.Format(KFmtOverflow, c);
-        		iEngine.Sink().OutputLineL( aLine );
-        		}
-
-        	TBuf<KMaxFileName> path;
-        	TMemSpyDriverCodeSegInfo info;
-        	for (TInt i=0; i<c; i++)
-        		{
-        		r = iEngine.Driver().GetCodeSegInfo(handles[i], aPid, info);
-                //
-        		if  ( r == KErrNone )
-        			{
-        			path.Copy( info.iCreateInfo.iFileName );
-        			aLine.Format(KFmtMod, &aPrefix, info.iMemoryInfo.iCodeBase,info.iMemoryInfo.iCodeBase + info.iMemoryInfo.iCodeSize, &path);
-        			iEngine.Sink().OutputLineL( aLine );
-        			}
-        		}
-            }
-        }
-   }
-
-
-EXPORT_C CMemSpyEngineCodeSegList* CMemSpyEngineHelperCodeSegment::CodeSegmentListL()
-    {
-    RArray<TAny*> handles( 16 );
-    CleanupClosePushL( handles );
-
-    // Get everything
-    GetCodeSegmentHandlesL( handles, NULL, EFalse );
-    CMemSpyEngineCodeSegList* list = ListFromHandlesLC( handles );
-    //
-    CleanupStack::Pop( list );
-    CleanupStack::PopAndDestroy( &handles );
-    //
-    return list;
-    }
-
-
-CMemSpyEngineCodeSegList* CMemSpyEngineHelperCodeSegment::CodeSegmentListRamLoadedL()
-    {
-    RArray<TAny*> handles( 16 );
-    CleanupClosePushL( handles );
-
-    // Get just RAM-loaded
-    GetCodeSegmentHandlesL( handles, NULL, ETrue );
-    CMemSpyEngineCodeSegList* list = ListFromHandlesLC( handles );
-    //
-    CleanupStack::Pop( list );
-    CleanupStack::PopAndDestroy( &handles );
-    //
-    return list;
-    }
-
-
-EXPORT_C CMemSpyEngineCodeSegList* CMemSpyEngineHelperCodeSegment::CodeSegmentListL( TProcessId aProcess )
-    {
-    TUint processId = aProcess;
-    //
-    RArray<TAny*> handles( 16 );
-    CleanupClosePushL( handles );
-    
-    // Get process-specific list
-    GetCodeSegmentHandlesL( handles, &processId, EFalse );
-    CMemSpyEngineCodeSegList* list = ListFromHandlesLC( handles );
-    //
-    CleanupStack::Pop( list );
-    CleanupStack::PopAndDestroy( &handles );
-    //
-    return list;
-    }
-
-
-void CMemSpyEngineHelperCodeSegment::GetCodeSegmentHandlesL( RArray<TAny*>& aHandles, TUint* aProcessId, TBool aRamOnly ) const
-    {
-	TAny* handles[ KMemSpyEngineMaxCodeSegmentCount ];
-	TInt count = KMemSpyEngineMaxCodeSegmentCount;
-
-	TInt r = KErrNone;
-	
-	if  ( aProcessId == NULL )
-    	{
-	    r = iEngine.Driver().GetCodeSegs( handles, count, aRamOnly );
-	    }
-    else
-	    {
-	    r = iEngine.Driver().GetCodeSegs( *aProcessId, handles, count );
-	    }
-
-	if  ( r == KErrNone )
-    	{
-        TInt index;
-        TLinearOrder< TAny* > comparer( SortByAddress );
-        
-        // Remove duplicates - since we reqested code segments for all processes, there
-        // might be some dupes.
-        count = Min( count, KMemSpyEngineMaxCodeSegmentCount );
-        for( index = 0; index < count; index++ )
-            {
-            TAny* handle = handles[ index ];
-            const TInt error = aHandles.InsertInOrder( handle, comparer );
-            //
-            if  ( ! (error == KErrNone || error == KErrAlreadyExists ) )
-                {
-                User::Leave( error );
-                }
-            }
-        }
-    }
-
-
-CMemSpyEngineCodeSegList* CMemSpyEngineHelperCodeSegment::ListFromHandlesLC( RArray<TAny*>& aHandles ) const
-    {
-    CMemSpyEngineCodeSegList* list = CMemSpyEngineCodeSegList::NewLC( iEngine );
-    //
-    TMemSpyDriverCodeSegInfo info;
-    const TInt count = aHandles.Count();
-    //
-    for (TInt i=0; i<count; i++)
-        {
-        TAny* handle = aHandles[ i ];
-        const TInt err = iEngine.Driver().GetCodeSegInfo( handle, 0, info );
-        //
-        if  ( err == KErrNone )
-        	{
-            // Create item
-            CMemSpyEngineCodeSegEntry* entry = CMemSpyEngineCodeSegEntry::NewLC( handle, info.iSize, info.iCreateInfo, info.iMemoryInfo );
-            list->AddItemL( entry );
-            CleanupStack::Pop( entry );
-        	}
-        }
-    //
-    return list;
-    }
-
-
-TInt CMemSpyEngineHelperCodeSegment::SortByAddress( TAny* const& aLeft, TAny* const& aRight )
-    {
-    TInt ret = 1;
-    //
-    if  ( aLeft < aRight )
-        {
-        ret = -1;
-        }
-    else if ( aLeft == aRight )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineCodeSegList::CMemSpyEngineCodeSegList( CMemSpyEngine& aEngine )
-:   CMemSpyEngineTwiddlableItemArray<CMemSpyEngineCodeSegEntry>( aEngine )
-    {
-    }
-
-
-void CMemSpyEngineCodeSegList::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineCodeSegList* CMemSpyEngineCodeSegList::NewLC( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineCodeSegList* self = new(ELeave) CMemSpyEngineCodeSegList( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-    
-EXPORT_C TInt CMemSpyEngineCodeSegList::IndexByHandle( TAny* aHandle ) const
-    {
-    TInt index = KErrNotFound;
-    //
-    const TInt count = Count();
-    for(TInt i=0; i<count; i++)
-        {
-        const CMemSpyEngineCodeSegEntry& entry = At( i );
-        if  ( entry.Handle() == aHandle )
-            {
-            index = i;
-            break;
-            }
-        }
-    //
-    return index;
-    }
-
-
-EXPORT_C void CMemSpyEngineCodeSegList::SortByFileNameL()
-    {
-    TLinearOrder< CMemSpyEngineCodeSegEntry > comparer( CompareByFileName );
-    Sort( comparer );
-    }
-
-
-EXPORT_C void CMemSpyEngineCodeSegList::SortByCodeSizeL()
-    {
-    TLinearOrder< CMemSpyEngineCodeSegEntry > comparer( CompareByCodeSize );
-    Sort( comparer );
-    }
-
-
-EXPORT_C void CMemSpyEngineCodeSegList::SortByDataSizeL()
-    {
-    TLinearOrder< CMemSpyEngineCodeSegEntry > comparer( CompareByDataSize );
-    Sort( comparer );
-    }
-
-
-EXPORT_C void CMemSpyEngineCodeSegList::SortByUidsL()
-    {
-    TLinearOrder< CMemSpyEngineCodeSegEntry > comparer( CompareByUid );
-    Sort( comparer );
-    }
-
-
-EXPORT_C void CMemSpyEngineCodeSegList::ShowOnlyEntriesWithGlobalDataL()
-    {
-    TMemSpyEngineVisibiltyFunction< CMemSpyEngineCodeSegEntry > function( VisibilityFunctionGlobalData, NULL );
-    ShowL( function );
-    SortByDataSizeL();
-    }
-
-
-EXPORT_C void CMemSpyEngineCodeSegList::OutputDataColumnsL( CMemSpyEngine& aEngine )
-    {
-    HBufC* columns = HBufC::NewLC( 1500 );
-    TPtr pColumns( columns->Des() );
-
-    //
-    _LIT(KCol1, "Name");
-    pColumns.Append( KCol1 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol2, "Uid %d");
-    pColumns.AppendFormat( KCol2, 1 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-    pColumns.AppendFormat( KCol2, 2 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-    pColumns.AppendFormat( KCol2, 3 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol3, "Module Version");
-    pColumns.Append( KCol3 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol4, "SID");
-    pColumns.Append( KCol4 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol5, "VID");
-    pColumns.Append( KCol5 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol6, "Code Size");
-    pColumns.Append( KCol6 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol7, "Text Size");
-    pColumns.Append( KCol7 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol8, "Data Size");
-    pColumns.Append( KCol8 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol9, "BSS Size");
-    pColumns.Append( KCol9 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol10, "Total Data Size");
-    pColumns.Append( KCol10 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol11, "Entrypoint Veneer");
-    pColumns.Append( KCol11 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol12, "File Entrypoint");
-    pColumns.Append( KCol12 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol13, "Dependency Count");
-    pColumns.Append( KCol13 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol14, "ROM Code Load Address");
-    pColumns.Append( KCol14 );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    //
-    _LIT(KCol15, "Data Load Address");
-    pColumns.Append( KCol15 );
-
-    //
-    _LIT(KCol16, "Capabilities...");
-    pColumns.Append( KCol16 );
-
-    //
-    aEngine.Sink().OutputLineL( pColumns );
-    CleanupStack::PopAndDestroy( columns );
-    }
-
-
-EXPORT_C TInt CMemSpyEngineCodeSegList::MdcaCount() const
-    {
-    return Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineCodeSegList::MdcaPoint( TInt aIndex ) const
-    {
-    const CMemSpyEngineCodeSegEntry& item = At( aIndex );
-    return TPtrC( item.Caption() );
-    }
-
-
-TInt CMemSpyEngineCodeSegList::IndexByName( const TDesC& aName ) const
-    {
-    TInt index = KErrNotFound;
-    //
-    const TInt count = Count();
-    for(TInt i=0; i<count; i++)
-        {
-        const CMemSpyEngineCodeSegEntry& entry = At( i );
-        if  ( entry.FileName().FindF( aName ) >= 0 )
-            {
-            index = i;
-            break;
-            }
-        }
-    //
-    return index;
-    }
-
-
-TInt CMemSpyEngineCodeSegList::CompareByFileName( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight )
-    {
-    const TInt ret = aLeft.FileName().CompareF( aRight.FileName() );
-    return ret;
-    }
-
-
-TInt CMemSpyEngineCodeSegList::CompareByCodeSize( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight )
-    {
-    TInt ret = -1;
-    //
-    if  ( aLeft.CreateInfo().iCodeSize < aRight.CreateInfo().iCodeSize )
-        {
-        ret = 1;
-        }
-    else if ( aLeft.CreateInfo().iCodeSize == aRight.CreateInfo().iCodeSize )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineCodeSegList::CompareByDataSize( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight )
-    {
-    TInt ret = -1;
-    //
-    if  ( aLeft.CreateInfo().iTotalDataSize < aRight.CreateInfo().iTotalDataSize )
-        {
-        ret = 1;
-        }
-    else if ( aLeft.CreateInfo().iTotalDataSize == aRight.CreateInfo().iTotalDataSize )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineCodeSegList::CompareByUid( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight )
-    {
-    TInt ret = -1;
-    //
-    if  ( aLeft.CreateInfo().iUids.MostDerived().iUid < aRight.CreateInfo().iUids.MostDerived().iUid )
-        {
-        ret = 1;
-        }
-    else if ( aLeft.CreateInfo().iUids.MostDerived().iUid == aRight.CreateInfo().iUids.MostDerived().iUid )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-TBool CMemSpyEngineCodeSegList::VisibilityFunctionGlobalData( const CMemSpyEngineCodeSegEntry*& aItem, TAny* /*aRune*/ )
-    {
-    const TBool hasGlobalData = ( aItem->CreateInfo().iTotalDataSize > 0 );
-    return hasGlobalData;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineCodeSegEntry::CMemSpyEngineCodeSegEntry( TAny* aHandle, TInt aSize, const TCodeSegCreateInfo& aCreateInfo, const TProcessMemoryInfo& aMemoryInfo )
-:   CDesCArrayFlat( 10 ), iHandle( aHandle ), iSize( aSize ), iCreateInfo( aCreateInfo ), iMemoryInfo( aMemoryInfo )
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineCodeSegEntry::~CMemSpyEngineCodeSegEntry()
-    {
-    delete iCaption;
-    delete iFileName;
-    }
-
-
-void CMemSpyEngineCodeSegEntry::ConstructL()
-    {
-    iFileName = HBufC::NewL( iCreateInfo.iFileName.Length() );
-    iFileName->Des().Copy( iCreateInfo.iFileName );
-
-    // Make caption
-    TParsePtrC parser( *iFileName );
-    const TPtrC pFileNameWithoutPath( parser.NameAndExt() );
-    TBuf<KMaxFullName + 128> item;
-    //
-    _LIT(KCodeSegFormat, "\t%S\t\t%S code");
-    const TMemSpySizeText codeSize( MemSpyEngineUtils::FormatSizeText( iCreateInfo.iCodeSize ) );
-    item.Format( KCodeSegFormat, &pFileNameWithoutPath, &codeSize );
-    if  ( iCreateInfo.iDataSize > 0 )
-        {
-        _LIT(KCodeSegFormatAdditionalData, ", %S data");
-        const TMemSpySizeText dataSize( MemSpyEngineUtils::FormatSizeText( iCreateInfo.iTotalDataSize ) );
-        item.AppendFormat( KCodeSegFormatAdditionalData, &dataSize );
-        }
-    iCaption = item.AllocL();
-
-    //
-    _LIT(KItem0, "\tName\t\t%S");
-    item.Format( KItem0, &pFileNameWithoutPath );
-    AppendL( item );
-
-    // Uids
-    const TUidType uids( iCreateInfo.iUids );
-    for( TInt i=0; i<KMaxCheckedUid; i++ )
-        {
-        _LIT(KItem1, "\tUid #%d\t\t0x%08x");
-        const TUid uidValue( uids[ i ] );
-        //
-        item.Format( KItem1, i+1, uidValue.iUid );
-        AppendL( item );
-        }
-    //
-    if  ( iCreateInfo.iModuleVersion == KModuleVersionWild )
-        {
-        _LIT(KItem12, "\tModule Version\t\t[Wild]");
-        AppendL( KItem12 );
-        }
-    else if ( iCreateInfo.iModuleVersion == KModuleVersionNull )
-        {
-        _LIT(KItem12, "\tModule Version\t\t[Null]");
-        AppendL( KItem12 );
-        }
-    else
-        {
-        _LIT(KItem12, "\tModule Version\t\t0x%08x");
-        item.Format( KItem12, iCreateInfo.iModuleVersion );
-        AppendL( item );
-        }
-
-    //
-    _LIT(KItem13, "\tSID\t\t0x%08x");
-    item.Format( KItem13, iCreateInfo.iS.iSecureId );
-    AppendL( item );
-
-    //
-    _LIT(KItem14, "\tVID\t\t0x%08x");
-    item.Format( KItem14, iCreateInfo.iS.iVendorId );
-    AppendL( item );
-
-    //
-    if  ( iCreateInfo.iCodeSize > 0 )
-        {
-        _LIT(KItem2, "\tCode Size\t\t%d");
-        item.Format( KItem2, iCreateInfo.iCodeSize );
-        AppendL( item );
-        }
-
-    //
-    if  ( iCreateInfo.iTotalDataSize > 0 )
-        {
-        _LIT(KItem6, "\tTotal Data Size\t\t%d");
-        item.Format( KItem6, iCreateInfo.iTotalDataSize );
-        AppendL( item );
-        }
-
-    //
-    if  ( iCreateInfo.iTextSize > 0 )
-        {
-        _LIT(KItem3, "\tText Size\t\t%d");
-        item.Format( KItem3, iCreateInfo.iTextSize );
-        AppendL( item );
-        }
-
-    //
-    if  ( iCreateInfo.iDataSize > 0 )
-        {
-        _LIT(KItem4, "\tData Size\t\t%d");
-        item.Format( KItem4, iCreateInfo.iDataSize );
-        AppendL( item );
-        }
-
-    //
-    if  ( iCreateInfo.iBssSize > 0 )
-        {
-        _LIT(KItem5, "\tBSS Size\t\t%d");
-        item.Format( KItem5, iCreateInfo.iBssSize );
-        AppendL( item );
-        }
-
-    //
-    _LIT(KItem7, "\tEntrypoint Veneer\t\t0x%08x");
-    item.Format( KItem7, iCreateInfo.iEntryPtVeneer );
-    AppendL( item );
-
-    //
-    _LIT(KItem8, "\tFile Entrypoint\t\t0x%08x");
-    item.Format( KItem8, iCreateInfo.iFileEntryPoint );
-    AppendL( item );
-
-    //
-    _LIT(KItem9, "\tDependency Count\t\t%d");
-    item.Format( KItem9, iCreateInfo.iDepCount );
-    AppendL( item );
-
-    //
-    if  ( iCreateInfo.iCodeLoadAddress != 0 )
-        {
-        _LIT(KItem10, "\tROM Code Load Addr.\t\t0x%08x");
-        item.Format( KItem10, iCreateInfo.iCodeLoadAddress );
-        AppendL( item );
-        }
-    else
-        {
-        _LIT(KItem10, "\tROM Code Load Addr.\t\t[RAM Loaded]");
-        AppendL( KItem10 );
-        }
-
-    //
-    if  ( iCreateInfo.iDataLoadAddress != 0 )
-        {
-        _LIT(KItem11, "\tData Load Addr.\t\t0x%08x");
-        item.Format( KItem11, iCreateInfo.iDataLoadAddress );
-        AppendL( item );
-        }
-
-    //
-    AddCapabilityItemsL();
-    }
-
-
-CMemSpyEngineCodeSegEntry* CMemSpyEngineCodeSegEntry::NewLC( TAny* aHandle, TInt aSize, const TCodeSegCreateInfo& aCreateInfo, const TProcessMemoryInfo& aMemoryInfo )
-    {
-    CMemSpyEngineCodeSegEntry* self = new(ELeave) CMemSpyEngineCodeSegEntry( aHandle, aSize, aCreateInfo, aMemoryInfo );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-EXPORT_C TBool CMemSpyEngineCodeSegEntry::HasCapability( TCapability aCapability ) const
-    {
-    TBool hasCap = EFalse;
-    //
-    for( TInt i=0; i<SCapabilitySet::ENCapW && !hasCap; i++ )
-        {
-        const TUint32 capsRawValue = iCreateInfo.iS.iCaps[i];
-        const TBitFlags flags( capsRawValue );
-        //
-        hasCap = flags.IsSet( aCapability );
-        }
-    //
-    return hasCap;
-    }
-
-
-EXPORT_C void CMemSpyEngineCodeSegEntry::OutputDataL( CMemSpyEngineHelperCodeSegment& aHelper ) const
-    {
-    _LIT(KHexFormat, "0x%08x");
-
-    HBufC* columns = HBufC::NewLC( 4096 );
-    TPtr pColumns( columns->Des() );
-
-    // Name
-    TParsePtrC parser( *iFileName );
-    const TPtrC pFileNameWithoutPath( parser.NameAndExt() );
-    pColumns.Append( pFileNameWithoutPath );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // Uids
-    const TUidType uids( iCreateInfo.iUids );
-    for( TInt i=0; i<KMaxCheckedUid; i++ )
-        {
-        const TUid uidValue( uids[ i ] );
-        //
-        pColumns.AppendFormat( KHexFormat, uidValue.iUid );
-        pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-        }
-
-    // Module version
-    if  ( iCreateInfo.iModuleVersion == KModuleVersionWild )
-        {
-        _LIT( KCaption, "Wild");
-        pColumns.Append( KCaption );
-        }
-    else if ( iCreateInfo.iModuleVersion == KModuleVersionNull )
-        {
-        _LIT( KCaption, "Null");
-        pColumns.Append( KCaption );
-        }
-    else
-        {
-        pColumns.AppendFormat( KHexFormat, iCreateInfo.iModuleVersion );
-        }
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // SID
-    pColumns.AppendFormat( KHexFormat, iCreateInfo.iS.iSecureId );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // VID
-    pColumns.AppendFormat( KHexFormat, iCreateInfo.iS.iVendorId );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // Code size
-    if  ( iCreateInfo.iCodeSize > 0 )
-        {
-        pColumns.AppendNum( iCreateInfo.iCodeSize, EDecimal );
-        }
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // Text size
-    if  ( iCreateInfo.iTextSize > 0 )
-        {
-        pColumns.AppendNum( iCreateInfo.iTextSize, EDecimal );
-        }
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // Data size
-    if  ( iCreateInfo.iDataSize > 0 )
-        {
-        pColumns.AppendNum( iCreateInfo.iDataSize, EDecimal );
-        }
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // BSS
-    if  ( iCreateInfo.iBssSize > 0 )
-        {
-        pColumns.AppendNum( iCreateInfo.iBssSize, EDecimal );
-        }
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // Total data size
-    if  ( iCreateInfo.iTotalDataSize > 0 )
-        {
-        pColumns.AppendNum( iCreateInfo.iTotalDataSize, EDecimal );
-        }
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // Entrypoint veneer
-    pColumns.AppendFormat( KHexFormat, iCreateInfo.iEntryPtVeneer );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // File Entrypoint
-    pColumns.AppendFormat( KHexFormat, iCreateInfo.iFileEntryPoint );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // Dependency Count
-    pColumns.AppendNum( iCreateInfo.iDepCount, EDecimal );
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // ROM Code Load Address
-    if  ( iCreateInfo.iCodeLoadAddress != 0 )
-        {
-        pColumns.AppendFormat( KHexFormat, iCreateInfo.iCodeLoadAddress );
-        }
-    else
-        {
-        _LIT(KCaption, "N.A. - RAM Loaded");
-        pColumns.Append( KCaption );
-        }
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // Data Load Address
-    if  ( iCreateInfo.iDataLoadAddress != 0 )
-        {
-        pColumns.AppendFormat( KHexFormat, iCreateInfo.iDataLoadAddress );
-        }
-    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-
-    // Capabilities
-    CDesCArray* capabilities = CapabilityStringsLC();
-    const TInt count = capabilities->Count();
-    //
-    for( TInt j=0; j<count; j++ )
-        {
-        const TPtrC capabilityName( (*capabilities)[ j ] );
-        //
-        pColumns.Append( capabilityName );
-        if  ( j < count-1 )
-            {
-            pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
-            }
-        }
-    //
-    CleanupStack::PopAndDestroy( capabilities );
-
-    aHelper.Engine().Sink().OutputLineL( pColumns );
-
-    CleanupStack::PopAndDestroy( columns );
-    }
-
-
-void CMemSpyEngineCodeSegEntry::AddCapabilityItemsL()
-    {
-    _LIT(KCapFormat, "\tCapability #%3d\t\t%S");
-    TBuf<128> item;
-    //
-    CDesCArray* capabilities = CapabilityStringsLC();
-    const TInt count = capabilities->Count();
-    //
-    for( TInt i=0; i<count; i++ )
-        {
-        const TPtrC capabilityName( (*capabilities)[ i ] );
-        item.Format( KCapFormat, i+1, &capabilityName );
-        AppendL( item );
-        }
-    //
-    CleanupStack::PopAndDestroy( capabilities );
-    }
-
-
-CDesCArray* CMemSpyEngineCodeSegEntry::CapabilityStringsLC() const
-    {
-    CDesCArrayFlat* array = new(ELeave) CDesCArrayFlat( ECapability_Limit );
-    CleanupStack::PushL( array );
-    //
-    const TInt KCapabilityCountPer32Bits = 32;
-    //
-    for( TInt i=0; i<SCapabilitySet::ENCapW; i++ )
-        {
-        const TUint32 caps = iCreateInfo.iS.iCaps[i];
-        //
-        AddCapabilitiesL( caps, i * KCapabilityCountPer32Bits, *array );
-        }
-    //
-    return array;
-    }
-
-
-void CMemSpyEngineCodeSegEntry::AddCapabilitiesL( TUint32 aCaps, TInt aCapCount, CDesCArray& aArray ) const
-    {
-    TBitFlags flags( aCaps );
-    TBuf<128> capabilityName;
-    //
-    for( TInt i=aCapCount; i<aCapCount + 32 && i<ECapability_Limit; i++ )
-        {
-        const TBool isSet = flags.IsSet( i );
-        //
-        if  ( isSet )
-            {
-            // Get capability name
-            const TCapability capability = static_cast< TCapability >( i );
-            MemSpyEngineUtils::GetCapabilityName( capabilityName, capability );
-
-            // Make a capability entry for this item
-            aArray.AppendL( capabilityName );
-            }
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperCondVar.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +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 <memspy/engine/memspyenginehelpercondvar.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-
-
-
-CMemSpyEngineHelperCondVar::CMemSpyEngineHelperCondVar( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperCondVar::~CMemSpyEngineHelperCondVar()
-    {
-    }
-
-
-void CMemSpyEngineHelperCondVar::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperCondVar* CMemSpyEngineHelperCondVar::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperCondVar* self = new(ELeave) CMemSpyEngineHelperCondVar( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-EXPORT_C void CMemSpyEngineHelperCondVar::GetCondVarSuspendedThreadsL( const TMemSpyDriverHandleInfoGeneric& aCondVarDetails, RArray<TMemSpyDriverCondVarSuspendedThreadInfo>& aThreads )
-    {   
-    const TInt KMaxCount = 256;
-    TAny* handles[KMaxCount];
-    TInt c = KMaxCount;
-
-    TInt r = iEngine.Driver().GetCondVarSuspendedThreads( aCondVarDetails.iHandle, handles, c );
-    if  ( r == KErrNone )
-        {
-        if  ( c > 0 )
-            {
-            if (c > KMaxCount)
-                {
-                c = KMaxCount;
-                }
-
-            TMemSpyDriverCondVarSuspendedThreadInfo info;
-            for (TInt i=0; i<c; i++)
-                {
-                r = iEngine.Driver().GetCondVarSuspendedThreadInfo( handles[i], info );
-                if (r == KErrNone)
-                    {
-                    aThreads.AppendL( info );
-                    }
-                }
-            }
-        }
-    }
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperECom.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,813 +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 <memspy/engine/memspyenginehelperecom.h>
-
-// System includes
-#include <charconv.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyenginehelperfilesystem.h>
-
-// Literal constants
-_LIT8( KMemSpyEComXmlFileMimeType, "text/xml" );
-_LIT8( KMemSpyXmlSpec_MasterSection, "memspy_ecom_sections" );
-_LIT8( KMemSpyXmlSpec_ChildSectionCategory, "category" );
-_LIT8( KMemSpyXmlSpec_ChildSectionCategory_Attribute_Name, "name" );
-_LIT8( KMemSpyXmlSpec_ChildSectionInterface, "interface" );
-_LIT8( KMemSpyXmlSpec_ChildSectionInterface_Name, "name" );
-_LIT8( KMemSpyXmlSpec_ChildSectionInterface_Uid, "uid" );
-_LIT8( KMemSpyXmlSpec_HexPrefix, "0x" );
-
-
-
-
-
-CMemSpyEngineHelperECom::CMemSpyEngineHelperECom( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperECom::~CMemSpyEngineHelperECom()
-    {
-    iCategories.ResetAndDestroy();
-    iCategories.Close();
-    //
-    delete iParser;
-    delete iConverter;
-    //
-    iEComSession.Close();
-    REComSession::FinalClose();
-    }
-
-
-void CMemSpyEngineHelperECom::ConstructL()
-    {
-    TRAPD( err, ConstructInternalL() );
-    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructL() - error: %d", err );
-    err = err;
-    }
-
-
-void CMemSpyEngineHelperECom::ConstructInternalL()
-    {
-    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructInternalL() - START" );
-    iEComSession = REComSession::OpenL();
-
-    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructInternalL() - creating parser..." );
-	iParser = CParser::NewL( KMemSpyEComXmlFileMimeType, *this );
-
-    // We only convert from UTF-8 to UTF-16
-    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructInternalL() - creating charconv object..." );
-    iConverter = CCnvCharacterSetConverter::NewL();
-    if  ( iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierUtf8, iEngine.FsSession() ) == CCnvCharacterSetConverter::ENotAvailable )
-	    {
-		User::Leave(KErrNotFound);
-		}
-
-    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructInternalL() - reading xml..." );
-    ConstructFromFileL();
-    
-    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructInternalL() - END" );
-    }
-
-
-void CMemSpyEngineHelperECom::ConstructFromFileL()
-    {
-    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructFromFileL() - START" );
-
-    // Locate the source file
-    TRAPD( err, 
-        HBufC* fileName = FindEComXmlFileNameLC();
-        ParseL( *fileName );
-        CleanupStack::PopAndDestroy( fileName );
-        );
-    err = err;
-
-    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructFromFileL() - parse error: %d", err );
-
-    delete iConverter;
-    iConverter = NULL;
-
-    // Build captions
-    const TInt categoryCount = iCategories.Count();
-    for( TInt i=0; i<categoryCount; i++ )
-        {
-        //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructFromFileL() - building caption: %d", i );
-
-        CMemSpyEngineEComCategory* cat = iCategories[ i ];
-        cat->BuildCaptionL();
-        }
-
-    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructFromFileL() - END" );
-    }
-
-
-CMemSpyEngineHelperECom* CMemSpyEngineHelperECom::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperECom* self = new(ELeave) CMemSpyEngineHelperECom( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-REComSession& CMemSpyEngineHelperECom::EComSession()
-    {
-    return iEComSession;
-    }
-
-
-EXPORT_C CMemSpyEngineEComCategory& CMemSpyEngineHelperECom::At( TInt aIndex )
-    {
-    return *iCategories[ aIndex ];
-    }
-
-
-EXPORT_C TInt CMemSpyEngineHelperECom::IndexOf( const CMemSpyEngineEComCategory& aEntry )
-    {
-    const TInt index = iCategories.Find( &aEntry );
-    return index;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineHelperECom::MdcaCount() const
-    {
-    return iCategories.Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineHelperECom::MdcaPoint( TInt aIndex ) const
-    {
-    CMemSpyEngineEComCategory* category = iCategories[ aIndex ];
-    return category->Caption();
-    }
-
-
-HBufC* CMemSpyEngineHelperECom::FindEComXmlFileNameLC()
-    {
-    RFs& fsSession = iEngine.FsSession();
-    //
-    TFileName* fileName = new(ELeave) TFileName();
-    CleanupStack::PushL( fileName );
-    //
-    fsSession.PrivatePath( *fileName );
-    //
-    TFindFile findFile( fsSession );
-    User::LeaveIfError( findFile.FindByPath( KMemSpyEComInterfaceIdFileName, fileName ) );
-    //
-    HBufC* ret = findFile.File().AllocL();
-    CleanupStack::PopAndDestroy( fileName );
-    CleanupStack::PushL( ret );
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperECom::ConvertL( const TDesC8& aInput, TDes16& aOutput )
-    {
-    const TInt error = iConverter->ConvertToUnicode( aOutput, aInput, iCharconvConverterState );
-    User::LeaveIfError( error );
-    }
-
-
-void CMemSpyEngineHelperECom::ParseL( const TDesC& aFileName )
-    {
-	Xml::ParseL( *iParser, iEngine.FsSession(), aFileName );
-    //
-    const TInt error = iParserErrorCode;
-    //RDebug::Printf( "CMemSpyEngineHelperECom::ParseL() - iParserErrorCode: %d", iParserErrorCode );
-    iParserErrorCode = KErrNone;
-    //
-	User::LeaveIfError( error );
-    }
-
-
-void CMemSpyEngineHelperECom::OnChildSectionCategoryL( const RAttributeArray& aAttributes )
-    {
-    TBuf<128> name;
-    TBool gotName = EFalse;
-    //
-    const TInt count = aAttributes.Count();
-	for( TInt i=0; i<count; i++ )
-		{
-		const TPtrC8 attrib( aAttributes[ i ].Attribute().LocalName().DesC() );
-		const TPtrC8 value( aAttributes[ i ].Value().DesC() );
-        //
-		if  ( attrib.CompareF( KMemSpyXmlSpec_ChildSectionCategory_Attribute_Name ) == 0 )
-			{
-            if  ( gotName )
-                {
-                User::LeaveIfError( KErrCorrupt );
-                }
-            else
-                {
-                ConvertL( value, name );
-                gotName = ETrue;
-                }
-			}
-        }
-    //
-    if  ( gotName )
-        {
-        // Make a new category
-        //RDebug::Print( _L("CMemSpyEngineHelperECom::OnChildSectionCategoryL() - creating category: %S"), &name );
-
-        CMemSpyEngineEComCategory* category = CMemSpyEngineEComCategory::NewLC( *this, name );
-        iCategories.AppendL( category );
-        CleanupStack::Pop( category );
-
-        //RDebug::Print( _L("CMemSpyEngineHelperECom::OnChildSectionCategoryL() - created category: %S"), &name );
-        }
-    else
-        {
-        User::Leave( KErrCorrupt );
-        }
-    }
-
-
-void CMemSpyEngineHelperECom::OnChildSectionInterfaceL( const RAttributeArray& aAttributes )
-    {
-    TUid uid = KNullUid;
-    TBuf<128> name;
-    TBool gotName = EFalse;
-    TBool gotUid = EFalse;
-    //
-    const TInt count = aAttributes.Count();
-	for( TInt i=0; i<count; i++ )
-		{
-		const TPtrC8 attrib( aAttributes[ i ].Attribute().LocalName().DesC() );
-		const TPtrC8 value( aAttributes[ i ].Value().DesC() );
-        //
-		if  ( attrib.CompareF( KMemSpyXmlSpec_ChildSectionInterface_Name ) == 0 )
-			{
-            if  ( gotName )
-                {
-                User::LeaveIfError( KErrCorrupt );
-                }
-            else
-                {
-                ConvertL( value, name );
-                gotName = ETrue;
-                }
-			}
-		else if ( attrib.CompareF( KMemSpyXmlSpec_ChildSectionInterface_Uid ) == 0 )
-			{
-            if  ( gotUid )
-                {
-                User::LeaveIfError( KErrCorrupt );
-                }
-            else
-                {
-                if  ( value.Length() >= 8 )
-                    {
-                    TRadix radix = EDecimal;
-                    TPtrC8 pValue( value );
-                    //
-                    if  ( value.Length() == 10 && value.Left( 2 ) == KMemSpyXmlSpec_HexPrefix )
-                        {
-                        pValue.Set( value.Mid( 2 ) );
-                        radix = EHex;
-                        }
-                    //
-                    TUint32 uidVal = 0;
-                    TLex8 lexer( pValue );
-                    const TInt err = lexer.Val( uidVal, radix );
-                    User::LeaveIfError( err );
-                    uid.iUid = uidVal;
-                    gotUid = ETrue;
-                    }
-                }
-			}
-        }
-    //
-    const TInt catCount = iCategories.Count();
-    if  ( gotName && gotUid && catCount > 0 )
-        {
-        //RDebug::Print( _L("CMemSpyEngineHelperECom::OnChildSectionInterfaceL() - creating interface for %S [0x%08x]"), &name, uid.iUid );
-
-        CMemSpyEngineEComCategory* category = iCategories[ catCount - 1 ];
-        TRAPD( err, category->CreateInterfaceL( name, uid ) );
-        err = err;
-        //RDebug::Print( _L("CMemSpyEngineHelperECom::OnChildSectionInterfaceL() - error: %d, for %S [0x%08x]"), err, &name, uid.iUid );
-        }
-    else
-        {
-        User::Leave( KErrCorrupt );
-        }
-    }
-
-
-void CMemSpyEngineHelperECom::OnStartDocumentL( const RDocumentParameters& /*aDocParam*/, TInt aErrorCode )
-    {
-    User::LeaveIfError( aErrorCode );
-    }
-
-
-void CMemSpyEngineHelperECom::OnEndDocumentL( TInt aErrorCode )
-    {
-    User::LeaveIfError( aErrorCode );
-    }
-
-
-void CMemSpyEngineHelperECom::OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode )
-    {
-    User::LeaveIfError( aErrorCode );
-    //
-	TInt err = KErrNone;
-	const TPtrC8 name( aElement.LocalName().DesC() );
-    //
-    if  ( name.CompareF( KMemSpyXmlSpec_MasterSection ) == 0 )
-		{
-		iSeenMasterSection = ETrue;
-		}
-    else if ( iSeenMasterSection )
-        {
-        if  ( name.CompareF( KMemSpyXmlSpec_ChildSectionCategory ) == 0 )
-            {
-            OnChildSectionCategoryL( aAttributes );
-            }
-        else if ( name.CompareF( KMemSpyXmlSpec_ChildSectionInterface ) == 0 )
-            {
-            OnChildSectionInterfaceL( aAttributes );
-            }
-        }
-    //
-    User::LeaveIfError( err );
-    }
-
-
-void CMemSpyEngineHelperECom::OnEndElementL( const RTagInfo& /*aElement*/, TInt aErrorCode )
-    {
-    User::LeaveIfError( aErrorCode );
-    }
-
-
-void CMemSpyEngineHelperECom::OnContentL( const TDesC8& /*aBytes*/, TInt aErrorCode )
-    {
-    User::LeaveIfError( aErrorCode );
-    }
-
-
-void CMemSpyEngineHelperECom::OnStartPrefixMappingL( const RString& /*aPrefix*/, const RString& /*aUri*/, TInt aErrorCode )
-    {
-    User::LeaveIfError( aErrorCode );
-    }
-
-
-void CMemSpyEngineHelperECom::OnEndPrefixMappingL( const RString& /*aPrefix*/, TInt aErrorCode )
-    {
-    User::LeaveIfError( aErrorCode );
-    }
-
-
-void CMemSpyEngineHelperECom::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, TInt aErrorCode )
-    {
-    User::LeaveIfError( aErrorCode );
-    }
-
-
-void CMemSpyEngineHelperECom::OnSkippedEntityL( const RString& /*aName*/, TInt aErrorCode )
-    {
-    User::LeaveIfError( aErrorCode );
-    }
-
-
-void CMemSpyEngineHelperECom::OnProcessingInstructionL( const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt aErrorCode )
-    {
-    User::LeaveIfError( aErrorCode );
-    }
-
-
-void CMemSpyEngineHelperECom::OnError( TInt aErrorCode )
-    {
-    iParserErrorCode = aErrorCode;
-    }
-
-
-TAny* CMemSpyEngineHelperECom::GetExtendedInterface( const TInt32 /*aUid*/ )
-    {
-    return NULL;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineEComCategory::CMemSpyEngineEComCategory( CMemSpyEngineHelperECom& aHelper )
-:   iHelper( aHelper )
-    {
-    }
-
-    
-CMemSpyEngineEComCategory::~CMemSpyEngineEComCategory()
-    {
-    delete iCaption;
-    delete iName;
-    iInterfaces.ResetAndDestroy();
-    iInterfaces.Close();
-    }
-
-
-void CMemSpyEngineEComCategory::ConstructL( const TDesC& aName )
-    {
-    iName = aName.AllocL();
-    iCaption = aName.AllocL(); // Replace later on
-    }
-
-
-CMemSpyEngineEComCategory* CMemSpyEngineEComCategory::NewLC( CMemSpyEngineHelperECom& aHelper, const TDesC& aName )
-    {
-    CMemSpyEngineEComCategory* self = new(ELeave) CMemSpyEngineEComCategory( aHelper );
-    CleanupStack::PushL( self );
-    self->ConstructL( aName );
-    return self;
-    }
-
-
-EXPORT_C CMemSpyEngineEComInterface& CMemSpyEngineEComCategory::At( TInt aIndex )
-    {
-    return *iInterfaces[ aIndex ];
-    }
-
-
-EXPORT_C TInt CMemSpyEngineEComCategory::IndexOf( const CMemSpyEngineEComInterface& aEntry )
-    {
-    const TInt index = iInterfaces.Find( &aEntry );
-    return index;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineEComCategory::MdcaCount() const
-    {
-    return iInterfaces.Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineEComCategory::MdcaPoint( TInt aIndex ) const
-    {
-    CMemSpyEngineEComInterface* iface = iInterfaces[ aIndex ];
-    return iface->Caption();
-    }
-
-
-void CMemSpyEngineEComCategory::CreateInterfaceL( const TDesC& aName, TUid aUid )
-    {
-    CMemSpyEngineEComInterface* iface = CMemSpyEngineEComInterface::NewLC( *this, aName, aUid );
-    iInterfaces.AppendL( iface );
-    CleanupStack::Pop( iface );
-    }
-
-
-void CMemSpyEngineEComCategory::BuildCaptionL()
-    {
-    delete iCaption; 
-    iCaption = NULL;
-
-    _LIT( KCaptionFormat, "\t%S\t\t%d interface" );
-    iCaption = HBufC::NewL( 256 );
-    TPtr pCaption( iCaption->Des() );
-    pCaption.Format( KCaptionFormat, iName, iInterfaces.Count() );
-    if  ( iInterfaces.Count() > 1 )
-        {
-        pCaption.Append( 's' );
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineEComInterface::CMemSpyEngineEComInterface( CMemSpyEngineEComCategory& aCategory, TUid aUid )
-:   iUid( aUid ), iCategory( aCategory )
-    {
-    }
-
-    
-CMemSpyEngineEComInterface::~CMemSpyEngineEComInterface()
-    {
-    delete iCaption;
-    delete iName;
-    iImplementations.ResetAndDestroy();
-    iImplementations.Close();
-    }
-
-
-void CMemSpyEngineEComInterface::ConstructL( const TDesC& aName )
-    {
-    iName = aName.AllocL();
-
-    // Get implementation information for this interface...
-    RImplInfoPtrArray infoArray;
-    CleanupResetAndDestroyPushL( infoArray );
-    REComSession::ListImplementationsL( iUid, infoArray );
-
-    // Make implementation objects for each impl that exists.
-    const TInt count = infoArray.Count();
-    for( TInt i=count-1; i>=0; i-- )
-        {
-        CImplementationInformation* info = infoArray[ i ];
-
-        // Get info
-        CMemSpyEngineEComImplementation* impl = CMemSpyEngineEComImplementation::NewLC( *this, info );
-
-        // Now owned by impl
-        infoArray.Remove( i );
-
-        // Add to container
-        iImplementations.AppendL( impl );
-        CleanupStack::Pop( impl );
-        }
-
-    // Tidy up
-    CleanupStack::PopAndDestroy( &infoArray );
-
-    // Build caption
-    _LIT( KCaptionFormat, "\t%S\t\t[0x%08x] [%d impl]" );
-    iCaption = HBufC::NewL( 256 );
-    TPtr pCaption( iCaption->Des() );
-    pCaption.Format( KCaptionFormat, iName, iUid.iUid, count );
-    }
-
-
-CMemSpyEngineEComInterface* CMemSpyEngineEComInterface::NewLC( CMemSpyEngineEComCategory& aCategory, const TDesC& aName, TUid aUid )
-    {
-    CMemSpyEngineEComInterface* self = new(ELeave) CMemSpyEngineEComInterface( aCategory, aUid );
-    CleanupStack::PushL( self );
-    self->ConstructL( aName );
-    return self;
-    }
-
-
-EXPORT_C CMemSpyEngineEComImplementation& CMemSpyEngineEComInterface::At( TInt aIndex )
-    {
-    return *iImplementations[ aIndex ];
-    }
-
-
-EXPORT_C TInt CMemSpyEngineEComInterface::IndexOf( const CMemSpyEngineEComImplementation& aEntry )
-    {
-    const TInt index = iImplementations.Find( &aEntry );
-    return index;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineEComInterface::MdcaCount() const
-    {
-    return iImplementations.Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineEComInterface::MdcaPoint( TInt aIndex ) const
-    {
-    CMemSpyEngineEComImplementation* impl = iImplementations[ aIndex ];
-    return impl->Caption();
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineEComImplementation::CMemSpyEngineEComImplementation( CMemSpyEngineEComInterface& aInterface )
-:   iInterface( aInterface )
-    {
-    }
-
-    
-CMemSpyEngineEComImplementation::~CMemSpyEngineEComImplementation()
-    {
-    delete iCaption;
-    delete iName;
-    delete iInfoText;
-    delete iInfo;
-    }
-
-
-void CMemSpyEngineEComImplementation::ConstructL( CImplementationInformation* aInfo )
-    {
-    iInfoText = new(ELeave) CDesCArrayFlat( 10 );
-    TBuf< 256 > temp;
-
-    // Make items.
-    if  ( aInfo->DisplayName().Length() )
-        {
-        _LIT( KNameFormat, "0x%08x - %S" );
-        temp.Format( KNameFormat, aInfo->ImplementationUid().iUid, &aInfo->DisplayName() );
-        }
-    else
-        {
-        _LIT( KNameFormat, "0x%08x" );
-        temp.Format( KNameFormat, aInfo->ImplementationUid().iUid );
-        }
-    iName = temp.AllocL();
-
-    _LIT( KItem1, "\tImpl. Uid\t\t0x%08x" );
-    temp.Format( KItem1, aInfo->ImplementationUid().iUid );
-    iInfoText->AppendL( temp );
-
-    if  ( aInfo->DisplayName().Length() )
-        {
-        _LIT( KItem2, "\tDisplay Name\t\t%S" );
-        temp.Format( KItem2, &aInfo->DisplayName() );
-        }
-    else
-        {
-        _LIT( KItem2, "\tDisplay Name\t\t[Undefined]" );
-        temp.Copy( KItem2 );
-        }
-    iInfoText->AppendL( temp );
-
-    _LIT( KItem3, "\tVersion\t\t%d" );
-    temp.Format( KItem3, aInfo->Version() );
-    iInfoText->AppendL( temp );
-
-    HBufC* opaqueData = CopyAndCropLC( aInfo->OpaqueData() );
-    if  ( opaqueData->Length() )
-        {
-        _LIT( KItem4, "\tOpaque Data\t\t%S" );
-        temp.Format( KItem4, opaqueData );
-        }
-    else
-        {
-        _LIT( KItem4, "\tOpaque Data\t\t[Undefined]" );
-        temp.Copy( KItem4 );
-        }
-    iInfoText->AppendL( temp );
-    CleanupStack::PopAndDestroy( opaqueData );
-
-    HBufC* dataType = CopyAndCropLC( aInfo->DataType() );
-    if  ( opaqueData->Length() )
-        {
-        _LIT( KItem5, "\tData Type\t\t%S" );
-        temp.Format( KItem5, dataType );
-        }
-    else
-        {
-        _LIT( KItem5, "\tData Type\t\t[Undefined]" );
-        temp.Copy( KItem5 );
-        }
-    iInfoText->AppendL( temp );
-    CleanupStack::PopAndDestroy( dataType );
-
-    _LIT( KItem6, "\tDrive\t\t%S" );
-    TBuf< 10 > drive;
-    const TDriveNumber driveNumber = static_cast< TDriveNumber >( static_cast< TInt >( aInfo->Drive() ) );
-    CMemSpyEngineHelperFileSystem::GetDriveNumberText( driveNumber, drive );
-    temp.Format( KItem6, &drive );
-    iInfoText->AppendL( temp );
-
-    if  ( aInfo->Disabled() )
-        {
-        iInfoText->AppendL( _L("\tIs Disabled\t\tYes") );
-        }
-    else
-        {
-        iInfoText->AppendL( _L("\tIs Disabled\t\tNo") );
-        }
-
-    if  ( aInfo->RomOnly() )
-        {
-        iInfoText->AppendL( _L("\tROM-Only\t\tYes") );
-        }
-    else
-        {
-        iInfoText->AppendL( _L("\tROM-Only\t\tNo") );
-        }
-    
-    if  ( aInfo->RomBased() )
-        {
-        iInfoText->AppendL( _L("\tROM-Based\t\tYes") );
-        }
-    else
-        {
-        iInfoText->AppendL( _L("\tROM-Based\t\tNo") );
-        }
-    
-    // Make caption
-    if  ( aInfo->DisplayName().Length() )
-        {
-        _LIT( KCaptionFormat, "\t0x%08x\t\t%S" );
-        temp.Format( KCaptionFormat, aInfo->ImplementationUid().iUid, &aInfo->DisplayName() );
-        }
-    else
-        {
-        _LIT( KCaptionFormat, "\t0x%08x\t\t[Name Undefined]" );
-        temp.Format( KCaptionFormat, aInfo->ImplementationUid().iUid );
-        }
-    iCaption = temp.AllocL();
-
-    // Must do this last
-    iInfo = aInfo;
-    }
-
-
-CMemSpyEngineEComImplementation* CMemSpyEngineEComImplementation::NewLC( CMemSpyEngineEComInterface& aInterface, CImplementationInformation* aInfo )
-    {
-    CMemSpyEngineEComImplementation* self = new(ELeave) CMemSpyEngineEComImplementation( aInterface );
-    CleanupStack::PushL( self );
-    self->ConstructL( aInfo );
-    return self;
-    }
-
-
-HBufC* CMemSpyEngineEComImplementation::CopyAndCropLC( const TDesC8& aText )
-    {
-    const TInt KMaxEComDataLength = 200; // Any longer and we'll crop it...
-    //
-    HBufC* data = HBufC::NewLC( aText.Length() );
-    data->Des().Copy( aText );
-    //
-    if  ( data->Length() > KMaxEComDataLength )
-        {
-        data->Des().SetLength( KMaxEComDataLength );
-        }
-    //
-    return data;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineEComImplementation::MdcaCount() const
-    {
-    return iInfoText->MdcaCount();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineEComImplementation::MdcaPoint( TInt aIndex ) const
-    {
-    return iInfoText->MdcaPoint( aIndex );
-    }
-
-
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperFbServ.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1335 +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 <memspy/engine/memspyenginehelperfbserv.h>
-
-// System includes
-#include <s32mem.h>
-#include <f32file.h>
-#include <e32rom.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-
-// Literal constants
-_LIT( KMemSpyEngineFBServComma, ", " );
-_LIT( KMemSpyEngineFBServExportFileName, "Image_%08x_%02d_bpp_(%d x %d).bmp");
-_LIT( KMemSpyEngineFBSLargeChunkName, "FbsLargeChunk" );
-_LIT( KMemSpyEngineFBSSharedChunkName, "FbsSharedChunk" );
-
-
-CMemSpyEngineHelperFbServ::CMemSpyEngineHelperFbServ( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-
-CMemSpyEngineHelperFbServ::~CMemSpyEngineHelperFbServ()
-    {
-    iEngine.Driver().WalkHeapClose();
-    }
-
-
-void CMemSpyEngineHelperFbServ::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperFbServ* CMemSpyEngineHelperFbServ::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperFbServ* self = new(ELeave) CMemSpyEngineHelperFbServ( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-TBool CMemSpyEngineHelperFbServ::IsLargeBitmapChunk( const TMemSpyDriverChunkInfo& aChunkInfo )
-    {
-    TBool ret = EFalse;
-    //
-    if  ( aChunkInfo.iType == EMemSpyDriverChunkTypeGlobal )
-        {
-        ret = ( aChunkInfo.iName.FindF( KMemSpyEngineFBSLargeChunkName ) >= 0 );
-        }
-    //
-    return ret;
-    }
-
-
-TBool CMemSpyEngineHelperFbServ::IsSharedBitmapChunk( const TMemSpyDriverChunkInfo& aChunkInfo )
-    {
-    TBool ret = EFalse;
-    //
-    if  ( aChunkInfo.iType == EMemSpyDriverChunkTypeGlobal )
-        {
-        ret = ( aChunkInfo.iName.FindF( KMemSpyEngineFBSSharedChunkName ) >= 0 );
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL( RArray<TInt>& aHandles )
-    {
-    TInt fontConCount = 0;
-    TInt bitmapConCount =0;
-    //RArray<TInt> dirtyHandles;
-    //CleanupClosePushL( dirtyHandles );
-    GetArrayOfBitmapHandlesL( aHandles, bitmapConCount, fontConCount );
-    //CleanupStack::PopAndDestroy( &dirtyHandles );
-    }
-
-
-void CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL( RArray<TInt>& aHandles, TInt& aBitmapConCount, TInt& aFontConCount )
-    {
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - START") );
-    CMemSpyThread& fbServThread = IdentifyFbServThreadL();
-
-    // Suspend the process
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - got FBServ thread, suspending it..."));
-    iEngine.ProcessSuspendLC( fbServThread.Process().Id() );
-
-    // Get the heap cell data for the correct object (CFbTop)
-    TAny* cellAddress = NULL;
-    HBufC8* cellData = LocateCFbTopHeapCellDataLC( fbServThread, cellAddress );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - got CFbTop cell data: %d bytes", cellData->Length()));
-
-    // Work out the offset to the bitmap address handles array
-    const TUint offsetBitmapCon = OffsetToCObjectConBitmapCon();
-    const TUint offsetFontCon = OffsetToCObjectConFontCon();
-    const TUint offsetHandleArray = OffsetToBitmapHandleArray();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - offsetBitmapCon:   %d", offsetBitmapCon ));
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - offsetFontCon:     %d", offsetFontCon ));
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - offsetHandleArray: %d", offsetHandleArray ));
-
-    // Create stream for reading heap data (makes life a bit easier).
-    RDesReadStream stream( *cellData );
-    CleanupClosePushL( stream );
-    
-    // We need to skip over the preamble to the start of the actual data.
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - skipping %d bytes [to start of bitmap con]...", offsetBitmapCon ));
-    (void) stream.ReadL( offsetBitmapCon ); // skip this much
-
-    // Read CFbTop::iBitmapCon cell address
-    TAny* cellAddresBitmapCon = reinterpret_cast<TAny*>( stream.ReadUint32L() );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - cellAddresBitmapCon: 0x%08x", cellAddresBitmapCon ));
-    TInt bitmapConAllocated = 0;
-    RArray<TAny*> bitmapConAddresses;
-    CleanupClosePushL( bitmapConAddresses );
-    ReadCObjectConInfoL( cellAddresBitmapCon, bitmapConAddresses, aBitmapConCount, bitmapConAllocated );
-    CleanupStack::PopAndDestroy( &bitmapConAddresses );
-
-    // Read CFbTop::iFontCon cell address
-    TAny* cellAddresFontCon = reinterpret_cast<TAny*>( stream.ReadUint32L() );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - cellAddresFontCon: 0x%08x", cellAddresFontCon ));
-    TInt fontConAllocated = 0;
-    RArray<TAny*> fontConAddresses;
-    CleanupClosePushL( fontConAddresses );
-    ReadCObjectConInfoL( cellAddresFontCon, fontConAddresses, aFontConCount, fontConAllocated );
-    CleanupStack::PopAndDestroy( &fontConAddresses );
-
-    // Skip forwards to the bitmap handle array info
-    const TUint skipRemaining = ( offsetHandleArray - offsetFontCon );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - skipRemaining: %d", skipRemaining ));
-    (void) stream.ReadL( skipRemaining ); // skip this much
-
-    // The layout of RPointerArrayBase is as follows:
-    //
-    //  TInt iCount;
-	//  TAny** iEntries;
-	//  TInt iAllocated;
-	//  TInt iGranularity;
-	//  TInt iSpare1;
-	//  TInt iSpare2;
-
-    // Now read the next 4 bytes. This is the number of allocated array entries.
-    const TInt arrayEntryCount = stream.ReadInt32L();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - arrayEntryCount: %d", arrayEntryCount ));
-
-    // The next four bytes are the address of the cell we are interested in.
-    cellAddress = reinterpret_cast<TAny*>( stream.ReadUint32L() );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - cellAddress: 0x%08x", cellAddress ));
-    
-    // The next four bytes are the allocated count
-    const TInt arrayAlloctedCount = stream.ReadInt32L();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - arrayAlloctedCount: %d", arrayAlloctedCount ));
-    
-    // Validate
-    if  ( arrayEntryCount > arrayAlloctedCount || arrayEntryCount < 0 || arrayAlloctedCount < 0 )
-        {
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - invalid array details => Leave with KErrCorrupt"));
-        User::Leave( KErrCorrupt );
-        }
-    
-    // Clean up - don't need this data anymore. Real data is in another cell
-    CleanupStack::PopAndDestroy( 2, cellData );  // stream & cellData
-
-    // Now obtain the heap cell data for the actual array itself.
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - trying to find bitmap array data..."));
-    cellData = LocateBitmapArrayHeapCellDataLC( cellAddress, arrayAlloctedCount );
-    
-    // Parse the cell data in order to obtain the bitmap handles.
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - trying to extract bitmap handles..."));
-    ParseCellDataAndExtractHandlesL( *cellData, aHandles, arrayEntryCount );
-    
-    // Tidy up
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - resuming process..."));
-    CleanupStack::PopAndDestroy( cellData );
- 
-    // Close heap walker & resume process
-    iEngine.Driver().WalkHeapClose();
-    CleanupStack::PopAndDestroy();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - END"));
-    }
-
-
-void CMemSpyEngineHelperFbServ::GetBitmapInfoL( TInt aHandle, TMemSpyEngineFBServBitmapInfo& aInfo )
-    {
-    CFbsBitmap* bitmap = GetBitmapInfoLC( aHandle, aInfo );
-    CleanupStack::PopAndDestroy( bitmap );
-    }
- 
-
-CFbsBitmap* CMemSpyEngineHelperFbServ::GetBitmapInfoLC( TInt aHandle, TMemSpyEngineFBServBitmapInfo& aInfo )
-    {
-    CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
-    CleanupStack::PushL( bitmap );
-    const TInt error = bitmap->Duplicate( aHandle );
-    User::LeaveIfError( error );
-
-    // Basic info from bitmap itself
-    aInfo.iHandle = aHandle;
-    aInfo.iDisplayMode = bitmap->DisplayMode();
-
-    // Extended info comes from header
-    const SEpocBitmapHeader header( bitmap->Header() );
-    
-    aInfo.iSizeInPixels = header.iSizeInPixels;
-    aInfo.iCompressionType = header.iCompression;
-    aInfo.iColor = header.iColor;
-    aInfo.iBitsPerPixel = header.iBitsPerPixel;
-    aInfo.iSizeInBytes = header.iBitmapSize;
-
-    // Flags
-    aInfo.iFlags = TMemSpyEngineFBServBitmapInfo::EFlagsNone;
-    if  ( bitmap->IsRomBitmap() )
-        {
-        aInfo.iFlags |= TMemSpyEngineFBServBitmapInfo::EFlagsIsRomBitmap;
-        }
-     if  ( bitmap->IsLargeBitmap() )
-        {
-        aInfo.iFlags |= TMemSpyEngineFBServBitmapInfo::EFlagsIsLarge;
-        }
-    if  ( bitmap->IsCompressedInRAM() )
-        {
-        aInfo.iFlags |= TMemSpyEngineFBServBitmapInfo::EFlagsIsCompressedInRam;
-        }
-    else
-        {
-        // Can only do this if not compressed
-        if  ( bitmap->IsMonochrome() )
-             {
-             aInfo.iFlags |= TMemSpyEngineFBServBitmapInfo::EFlagsIsMonochrome;
-             }
-        }
- 
-    return bitmap;
-    }
-
-
-CMemSpyThread& CMemSpyEngineHelperFbServ::IdentifyFbServThreadL()
-    {
-    _LIT(KFbServThreadName, "FbServ::!Fontbitmapserver");
-    //
-    CMemSpyThread* thread = NULL;
-    CMemSpyProcess* process = NULL;
-
-    // Get the fbserv thread object
-    CMemSpyEngineObjectContainer& container = iEngine.Container();
-    User::LeaveIfError( container.ProcessAndThreadByFullName( KFbServThreadName, process, thread ) );
-    //
-    return *thread;
-    }
-
-
-HBufC8* CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC( CMemSpyThread& aFbServThread, TAny*& aCellAddress )
-    {
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - START"));
-
-    // We'll start looking for the CFbTop object at cell index 0, then we'll
-    // continue to a maximum of cell index 10. These are not actual allocation
-    // numbers, they are just cell indicies within FBServ's heap.
-    // Realistically, the cell should be the 7th.
-    const TInt KFbServWillingToStartAtCellIndex = 0;
-    const TInt KFbServWillingToSearchUntilCellIndex = 10;
-
-    // We know the size of the cell is pretty big, since it contains a large 
-    // hash-map object (4096 elements by default, 4 bytes big => 16k). We'll
-    // not try to retrieve more than 18k of data.
-    const TInt KFbServExpectedMinimumCellSize = 14*1024;
-    const TInt KFbServExpectedMaximumCellSize = 18*1024;
-
-    // This is what we'll return, if we find it...
-    aCellAddress = NULL;
-    HBufC8* heapCellData = NULL;
-
-    // Get the heap info - we need this for verification purposes
-    TMemSpyHeapInfo info;
-    TInt err = iEngine.Driver().GetHeapInfoUser( info, aFbServThread.Id() );
-    if ( err == KErrNone && info.Type() == TMemSpyHeapInfo::ETypeUnknown )
-        {
-        err = KErrNotSupported;
-        }
-    User::LeaveIfError( err );
-
-    // Now walk the heap!
-    err = iEngine.Driver().WalkHeapInit( aFbServThread.Id() );
-    if  ( err == KErrNone )
-        {
-        TMemSpyDriverCellType cellType;
-        TAny* cellAddress;
-        TInt cellLength;
-        TInt cellNestingLevel;
-        TInt cellAllocationNumber;
-        TInt cellHeaderSize;
-        TAny* cellPayloadAddress;
-        //
-        for( TInt cellIndex = KFbServWillingToStartAtCellIndex; err == KErrNone && cellIndex < KFbServWillingToSearchUntilCellIndex; cellIndex++ )
-            {
-            err = iEngine.Driver().WalkHeapNextCell( aFbServThread.Id(), cellType, cellAddress, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - cellIndex[%d] err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", cellIndex, err, cellLength, cellAllocationNumber, cellType));
-
-            if  ( err == KErrNone && (cellType & EMemSpyDriverAllocatedCellMask))
-                {
-                // We know we are looking for a relatively large *allocated* cell.
-                if  ( cellLength >= KFbServExpectedMinimumCellSize && cellLength <= KFbServExpectedMaximumCellSize )
-                    {
-                    const TInt payloadLength = cellLength;
-
-                    // This is *probably* the right cell. Let's get the data and check.
-                    HBufC8* data = HBufC8::NewLC( payloadLength );
-                    TPtr8 pData( data->Des() );
-                    //
-                    err = iEngine.Driver().WalkHeapReadCellData( cellAddress, pData, payloadLength );
-                    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - data fetch returned error: %d", err));
-
-                    if  ( err == KErrNone )
-                        {
-                        //_LIT(KHeapDumpDataFormat, "%S");
-                        //iEngine.Sink().OutputBinaryDataL( KHeapDumpDataFormat, pData.Ptr(), (const TUint8*) cellAddress, pData.Length() );
-                    
-                        // Check the data
-                        const TUint heapMaxSize = info.AsRHeap().MetaData().iMaxHeapSize;
-                        const TUint heapBaseAddress = (TUint) info.AsRHeap().MetaData().ChunkBaseAddress();
-                        const TBool correctHeapCellLocated = VerifyCorrectHeapCellL( *data, cellAddress, cellPayloadAddress, heapBaseAddress, heapMaxSize );
-                        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - verified: %d", correctHeapCellLocated));
-
-                        if  ( correctHeapCellLocated )
-                            {
-                            aCellAddress = cellAddress;
-                            heapCellData = data;
-                            CleanupStack::Pop( data );
-                            break;
-                            }
-                        else
-                            {
-                            // Not the right cell. Keep going...
-                            CleanupStack::PopAndDestroy( data );
-                            }
-                        }
-                    }
-                }
-            }
-
-        // NB: don't do this here - 
-        // iEngine.Driver().WalkHeapClose();
-        // It gets done after all reading is complete
-        }
-
-    if  ( heapCellData == NULL )
-        {
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - END - didn't find the right cell => KErrNotFound"));
-        User::Leave( KErrNotFound );
-        }
-    //
-    CleanupStack::PushL( heapCellData );
-
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - END - everything okay, cell is: 0x%08x", aCellAddress));
-    return heapCellData;
-    }
-
-
-void CMemSpyEngineHelperFbServ::ReadCObjectConInfoL( TAny* aCellAddress, RArray<TAny*>& aContainerObjects, TInt& aCount, TInt& aAllocated )
-    {
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - START - trying cell: 0x%08x", aCellAddress ));
-
-    // What we will return
-    HBufC8* cellData = NULL;
-    
-    // Try to get info about real cell
-    TMemSpyDriverCellType cellType;
-    TInt cellLength;
-    TInt cellNestingLevel;
-    TInt cellAllocationNumber;
-    TInt cellHeaderSize;
-    TAny* cellPayloadAddress;
-
-    // NOTE: this call may change the value of 'cellAddress'
-    TInt err = iEngine.Driver().WalkHeapGetCellInfo( aCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - err: %d, cellAddress: 0x%08x, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, aCellAddress, cellLength, cellAllocationNumber, cellType));
-
-	if (err == KErrNone && (cellType & EMemSpyDriverAllocatedCellMask))
-        {
-        // Check that the cell size meets our expectations - it should be a CObjectCon cell.
-        const TInt expectedCellSize = sizeof(CObjectCon*) + cellHeaderSize;
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - expectedCellSize: %d, actual: %d, address: 0x%08x", expectedCellSize, cellLength, aCellAddress));
-
-        if  ( expectedCellSize <= cellLength )
-            {
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - cell lengths are good, trying to get cell data..."));
-
-            // Try to get real cell data        
-            cellData = HBufC8::NewLC( cellLength );
-            TPtr8 pData( cellData->Des() );
-            //
-            err = iEngine.Driver().WalkHeapReadCellData( aCellAddress, pData, cellLength );
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - reading cell data returned error: %d", err));
-            }
-        else
-            {
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - not enough data -> KErrCorrupt"));
-            err = KErrCorrupt;
-            }
-        }
-    else
-        {
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - END - didn't find cell data => KErrNotFound"));
-        User::Leave( KErrNotFound );
-        }
-
-    CObjectCon* con = CObjectCon::NewL();
-    const TUint32 KExpectedObjectConVTable = *((TUint32*) con);
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - KExpectedObjectConVTable: 0x%08x", KExpectedObjectConVTable ));
-    delete con;
-
-    // We should have the valid CObjectCon data now.
-    RDesReadStream stream( *cellData );
-    CleanupClosePushL( stream );
-    
-    // Read vtable
-    const TUint32 vTable = stream.ReadUint32L();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - actual vTable: 0x%08x", vTable ));
-    if  ( vTable != KExpectedObjectConVTable )
-        {
-        User::Leave( KErrNotFound );
-        }
-
-    const TInt uniqueId = stream.ReadInt32L();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - uniqueId: %d", uniqueId ));
-
-    aCount = stream.ReadInt32L();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - aCount: %d", aCount ));
-
-    aAllocated = stream.ReadInt32L();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - aAllocated: %d", aAllocated ));
-
-    // This is actually CObject's iObject, i.e. CObject** iObjects.
-    TAny* pObjects = reinterpret_cast< TAny*>( stream.ReadUint32L() );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - pObjects: 0x%08x", pObjects ));
-
-    CleanupStack::PopAndDestroy( 2, cellData ); // cellData & stream
-
-    // Now fetch the cell containing the CObject pointers...
-    err = iEngine.Driver().WalkHeapGetCellInfo( pObjects, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - array of CObject* cell fetch err: %d, cellAddress: 0x%08x, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, aCellAddress, cellLength, cellAllocationNumber, cellType));
-    User::LeaveIfError( err );
-
-    const TInt expectedSize = ( aAllocated * sizeof(CObject*) ) + cellHeaderSize;
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - expectedSize: %d, actual size: %d", expectedSize, cellLength ));
-    if  ( cellLength < expectedSize )
-        {
-        User::Leave( KErrUnderflow );
-        }
-    
-    // Get the data
-    cellData = HBufC8::NewLC( cellLength );
-    TPtr8 pData( cellData->Des() );
-    err = iEngine.Driver().WalkHeapReadCellData( pObjects, pData, cellLength );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - reading cell data returned error: %d", err));
-    User::LeaveIfError( err );
-
-    // Open stream
-    stream.Open( *cellData );
-    CleanupClosePushL( stream );
-
-    // Extract array of pointers
-    for( TInt i=0; i<aCount; i++ )
-        {
-        TAny* objectAddress = reinterpret_cast< TAny*>( stream.ReadUint32L() );
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - object[%04d]: 0x%08x", i, objectAddress ));
-        aContainerObjects.AppendL( objectAddress );
-        }
-    CleanupStack::PopAndDestroy( 2, cellData ); // cellData & stream
-
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - END" ));
-    }
-
-
-HBufC8* CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC( TAny*& aArrayCellAddress, TInt aArrayAllocCount )
-    {
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - START - trying cell: 0x%08x, aArrayAllocCount: %d", aArrayCellAddress, aArrayAllocCount));
-
-    // What we will return
-    HBufC8* cellData = NULL;
-    
-    // Try to get info about real cell
-    TMemSpyDriverCellType cellType;
-    TInt cellLength;
-    TInt cellNestingLevel;
-    TInt cellAllocationNumber;
-    TInt cellHeaderSize;
-    TAny* cellPayloadAddress;
-
-    // NOTE: this call may change the value of 'cellAddress'
-    TInt err = iEngine.Driver().WalkHeapGetCellInfo( aArrayCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - err: %d, cellAddress: 0x%08x, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, aArrayCellAddress, cellLength, cellAllocationNumber, cellType));
-
-    if (err == KErrNone && (cellType & EMemSpyDriverAllocatedCellMask))
-        {
-        // Check that the cell size meets our expectations. 
-        // The cell should be a very specific length
-        const TInt expectedCellSize = (sizeof(CBase*) * aArrayAllocCount) + cellHeaderSize;
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - expectedCellSize: %d, actual: %d, address: 0x%08x", expectedCellSize, cellLength, aArrayCellAddress));
-
-        if  ( expectedCellSize <= cellLength )
-            {
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - cell lengths are good, trying to get cell data..."));
-
-            // Try to get real cell data        
-            cellData = HBufC8::NewLC( cellLength );
-            TPtr8 pData( cellData->Des() );
-            //
-            err = iEngine.Driver().WalkHeapReadCellData( aArrayCellAddress, pData, cellLength );
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - reading cell data returned error: %d", err));
-            }
-        else
-            {
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - not enough data -> KErrCorrupt"));
-            err = KErrCorrupt;
-            }
-        }
-    //
-    if  ( cellData == NULL )
-        {
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - END - didn't find cell data => KErrNotFound"));
-        err = KErrNotFound;
-        }
-    User::LeaveIfError( err );
-    //
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - END - ok! - got %d bytes", cellData->Length() ) );
-    return cellData;
-    }
-
-
-void CMemSpyEngineHelperFbServ::ParseCellDataAndExtractHandlesL( const TDesC8& aData, RArray<TInt>& aHandles, TInt aArrayEntryCount )
-    {
-    aHandles.Reset();
-    
-    // Create read stream
-    RDesReadStream stream( aData );
-    CleanupClosePushL( stream );
-    
-    for( TInt i=0; i<aArrayEntryCount; i++ )
-        {
-        const TInt handle = stream.ReadInt32L();
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ParseCellDataAndExtractHandlesL() - handle[%4d] = 0x%08x", i, handle));
-        aHandles.AppendL( handle );
-        }
-    
-    // Tidy up
-    CleanupStack::PopAndDestroy( &stream );
-    }
-
-
-TBool CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL( const TDesC8& aData, TAny* aCellAddress, TAny* aPayloadAddress, TUint aHeapStartingAddress, TUint aHeapMaxSize )
-    {
-    (void) aPayloadAddress;
-    (void) aCellAddress;
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - START - aDataLen: %d, aCellAddress: 0x%08x, aPayloadAddress: 0x%08x, aHeapStartingAddress: 0x%08x, aHeapSize: %d", aData.Length(), aCellAddress, aPayloadAddress, aHeapStartingAddress, aHeapMaxSize ));
-
-    const TUint KFbServHeapCeilingAddress = aHeapStartingAddress + aHeapMaxSize;
-
-    // Whether we can use this cell's data...
-    TBool correctCell = EFalse;
-
-    // We can use certain knowledge of the layout of the cell to work out
-    // if we've found the right one. 
-    // 
-    // This is fragile because of the font and bitmap server heap layout changes 
-    // significantly, then this can break.
-    RDesReadStream reader( aData );
-    CleanupClosePushL( reader );
-
-    // Get vtable address
-    TUint address = reader.ReadUint32L();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - suspected vtable: 0x%08x", address));
-
-#ifdef __EPOC32__
-    TBool isROMAddress = EFalse;
-    TInt err = User::IsRomAddress( isROMAddress, (TAny*) address );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - vtable (0x%08x) is in ROM: %d (error: %d)", address, isROMAddress, err));
-    User::LeaveIfError( err );
-
-    if  ( !isROMAddress )
-        {
-        // Close stream
-        CleanupStack::PopAndDestroy( &reader );
-
-        // VTable value should be in the ROM range.
-        correctCell = EFalse;
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - END - suspected CFbTop vTable isn't in ROM address range! - correctCell: %d", correctCell));
-        return correctCell;
-        }
-#else
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - skipping vtable: 0x%08x", address));
-#endif
-
-    // First real item is an RFs object instance. We can't check this
-    // very easily because its an embedded object-> We must skip it
-    __ASSERT_ALWAYS( sizeof(RFs) == 4, User::Invariant() );
-    address = reader.ReadUint32L();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - skipping RFs: 0x%08x", address));
-
-    // Next object is an address (CFontStore* iFontStore). We can validate this against
-    // the method arguments.
-    address = reader.ReadUint32L();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - iFontStore: 0x%08x", address));
-
-    if  ( address > aHeapStartingAddress && address < KFbServHeapCeilingAddress )
-        {
-        // Next comes another pointer (CObjectCon* iBitmapCon)
-        address = reader.ReadUint32L();
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - iBitmapCon: 0x%08x", address));
-
-        if  ( address > aHeapStartingAddress && address < KFbServHeapCeilingAddress )
-            {
-            // Next another pointer (CObjectCon* iFontCon)
-            address = reader.ReadUint32L();
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - iFontCon: 0x%08x", address));
-
-            if  ( address > aHeapStartingAddress && address < KFbServHeapCeilingAddress )
-                {
-                // And finally, yet another pointer (RHeap* iHeap)
-                address = reader.ReadUint32L();
-                TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - iHeap: 0x%08x", address));
-
-                if  ( address > aHeapStartingAddress && address < KFbServHeapCeilingAddress )
-                    {
-                    // That'll do.
-                    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - data seems okay!"));
-                    correctCell = ETrue;
-                    }
-                }
-            }
-        }
-
-    CleanupStack::PopAndDestroy( &reader );
-    //
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - END - correctCell: %d", correctCell));
-    return correctCell;
-    }
-
-
-TUint CMemSpyEngineHelperFbServ::OffsetToCObjectConBitmapCon()
-    {
-    TUint ret = 0;
-
-    // VTable
-    ret += 4;
-
-    // RFs
-    ret += sizeof(RFs);
-
-	// CFontStore* iFontStore;
-    ret += sizeof(CBase*); // best effort
-
-    return ret;
-    }
-
-
-TUint CMemSpyEngineHelperFbServ::OffsetToCObjectConFontCon()
-    {
-    TUint ret = OffsetToCObjectConBitmapCon();
-
-	// CObjectCon* iBitmapCon;
-    ret += sizeof(CObjectCon*);
-
-    return ret;
-    }
-
-
-TUint CMemSpyEngineHelperFbServ::OffsetToBitmapHandleArray()
-    {
-    TUint ret = OffsetToCObjectConFontCon();
-
-	// CObjectConIx* iConIx;
-    ret += sizeof(CObjectConIx*);
-
-	// RHeap* iHeap;
-    ret += sizeof(RHeap*);
-
-	// RChunk iChunk
-    ret += sizeof(RChunk);
-
-	// RChunk iLargeBitmapChunk
-    ret += sizeof(RChunk);
-
-	// RMutex iLargeBitmapAccess
-    ret += sizeof(RMutex);
-
-	// CChunkPile* iPile;
-    ret += sizeof(CBase*); // best effort
-
-	// RPointerArray<HBufC> iFontNameAlias;
-    ret += sizeof(RPointerArray<HBufC>);
-	
-    return ret;
-    }
-
-
-CMemSpyEngineHelperFbServ::CBitmapObject* CMemSpyEngineHelperFbServ::GetBitmapObjectLC( TAny* aCellAddress )
-    {
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - START - aCellAddress: 0x%08x", aCellAddress ));
-
-    // What we will return
-    CBitmapObject* object = new(ELeave) CBitmapObject();
-    CleanupStack::PushL( object );
-
-    // The data we will read
-    HBufC8* cellData = NULL;
-    
-    // Try to get info about real cell
-    TMemSpyDriverCellType cellType;
-    TInt cellLength;
-    TInt cellNestingLevel;
-    TInt cellAllocationNumber;
-    TInt cellHeaderSize;
-    TAny* cellPayloadAddress;
-
-    // NOTE: this call may change the value of 'cellAddress'
-    TInt err = iEngine.Driver().WalkHeapGetCellInfo( aCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - err: %d, cellAddress: 0x%08x, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, aCellAddress, cellLength, cellAllocationNumber, cellType));
-
-    if (err == KErrNone && (cellType & EMemSpyDriverAllocatedCellMask))
-        {
-        // Check that the cell size meets our expectations - it should be a CBitmapObject, but without the additional "this" pointer
-        // which we have tacked onto the object.
-        const TInt expectedCellSize = sizeof( CBitmapObject ) + cellHeaderSize - sizeof( CBitmapObject* );
-        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - expectedCellSize: %d, actual: %d, address: 0x%08x", expectedCellSize, cellLength, aCellAddress));
-
-        if  ( expectedCellSize <= cellLength )
-            {
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - cell lengths are good, trying to get cell data..."));
-
-            // Try to get real cell data        
-            cellData = HBufC8::NewLC( cellLength );
-            TPtr8 pData( cellData->Des() );
-            //
-            err = iEngine.Driver().WalkHeapReadCellData( aCellAddress, pData, cellLength );
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - reading cell data returned error: %d", err));
-            }
-        else
-            {
-            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - not enough data -> KErrCorrupt"));
-            err = KErrCorrupt;
-            }
-        }
-    else
-        {
-        User::Leave( KErrNotFound );
-        }
-
-    RDesReadStream stream( *cellData );
-    CleanupClosePushL( stream );
-    
-    // Read vtable
-    const TUint32 vTable = stream.ReadUint32L();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - actual vTable: 0x%08x", vTable ));
-    TBool isROMAddress = EFalse;
-    err = User::IsRomAddress( isROMAddress, (TAny*) vTable );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - vtable (0x%08x) is in ROM: %d (error: %d)", vTable, isROMAddress, err));
-    User::LeaveIfError( err );
-
-    // Skip CObject members
-    (void) stream.ReadL( sizeof( CObject ) ); // skip this much
-    object->iThisPointer = reinterpret_cast< CBitmapObject* >( cellPayloadAddress );;
-    object->iTop = reinterpret_cast< CBase* >( stream.ReadUint32L() );
-    object->iAddressPointer = reinterpret_cast< CBitwiseBitmap* >( stream.ReadUint32L() );
-    object->iHandle = stream.ReadInt32L();
-    object->iCleanBitmap = reinterpret_cast< CBitmapObject* >( stream.ReadUint32L() );
-
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - object->iThisPointer:    0x%08x", object->iThisPointer ));
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - object->iTop:            0x%08x", object->iTop ));
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - object->iAddressPointer: 0x%08x", object->iAddressPointer ));
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - object->iHandle:         0x%08x", object->iHandle ));
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - object->iCleanBitmap:    0x%08x", object->iCleanBitmap ));
-    
-    // Clean up - don't need this data anymore. Real data is in another cell
-    CleanupStack::PopAndDestroy( 2, cellData );  // stream & cellData
-
-    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - END - aCellAddress: 0x%08x", aCellAddress ));
-    return object;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineFbServBitmapArray::CMemSpyEngineFbServBitmapArray( const RArray<TInt>& aBitmapHandles )
-:   CActive( CActive::EPriorityIdle ), iBitmapHandles( aBitmapHandles ), iGranularity( 0 )
-    {
-    CActiveScheduler::Add( this );
-    }
-
-
-CMemSpyEngineFbServBitmapArray::CMemSpyEngineFbServBitmapArray( TInt aPriority, const RArray<TInt>& aBitmapHandles, MMemSpyEngineFbSerbBitmapArrayObserver& aObserver, TInt aGranularity )
-:   CActive( aPriority ), iBitmapHandles( aBitmapHandles ), iObserver( &aObserver ), iGranularity( aGranularity )
-    {
-    CActiveScheduler::Add( this );
-    CompleteSelf();
-    }
-
-
-EXPORT_C CMemSpyEngineFbServBitmapArray::~CMemSpyEngineFbServBitmapArray()
-    {
-    Cancel();
-    //
-    iBitmaps.ResetAndDestroy();
-    iBitmaps.Close();
-    }
-
-
-void CMemSpyEngineFbServBitmapArray::ConstructL()
-    {
-    if  ( !IsActive() )
-        {
-        // Sync construction...
-        const TInt count = iBitmapHandles.Count();
-        for(TInt i=0; i<count; i++ )
-            {
-            const TInt handle = iBitmapHandles[ i ];
-            //
-            TRAP_IGNORE( CreateBitmapL( handle ) );
-            }
-    
-        SortBySizeL();
-        }
-    }
-
-
-EXPORT_C CMemSpyEngineFbServBitmapArray* CMemSpyEngineFbServBitmapArray::NewL( const RArray<TInt>& aBitmapHandles )
-    {
-    CMemSpyEngineFbServBitmapArray* self = new(ELeave) CMemSpyEngineFbServBitmapArray( aBitmapHandles );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C CMemSpyEngineFbServBitmapArray* CMemSpyEngineFbServBitmapArray::NewL( TInt aPriority, const RArray<TInt>& aBitmapHandles, MMemSpyEngineFbSerbBitmapArrayObserver& aObserver, TInt aGranularity )
-    {
-    CMemSpyEngineFbServBitmapArray* self = new(ELeave) CMemSpyEngineFbServBitmapArray( aPriority, aBitmapHandles, aObserver, aGranularity );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineFbServBitmapArray::Count() const
-    {
-    return iBitmaps.Count();
-    }
-
-
-EXPORT_C CMemSpyEngineFbServBitmap& CMemSpyEngineFbServBitmapArray::At( TInt aIndex )
-    {
-    return *iBitmaps[ aIndex ];
-    }
-
-
-EXPORT_C const CMemSpyEngineFbServBitmap& CMemSpyEngineFbServBitmapArray::At( TInt aIndex ) const
-    {
-    return *iBitmaps[ aIndex ];
-    }
-
-
-EXPORT_C CMemSpyEngineFbServBitmap& CMemSpyEngineFbServBitmapArray::BitmapByHandleL( TInt aHandle )
-    {
-    const TInt index = BitmapIndexByHandle( aHandle );
-    User::LeaveIfError( index );
-    CMemSpyEngineFbServBitmap& ret = At( index );
-    return ret;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineFbServBitmapArray::BitmapIndexByHandle( TInt aHandle ) const
-    {
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineFbServBitmap& bitmap = At( i );
-        //
-        if  ( bitmap.Handle() == aHandle )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineFbServBitmapArray::MdcaCount() const
-    {
-    return Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineFbServBitmapArray::MdcaPoint( TInt aIndex ) const
-    {
-    const CMemSpyEngineFbServBitmap& bitmap = At( aIndex );
-    return TPtrC( bitmap.Caption() );
-    }
-
-
-void CMemSpyEngineFbServBitmapArray::RunL()
-    {
-    const TInt bitmapHandleCount = iBitmapHandles.Count();
-    const TInt endIndex = Min( iIndex + iGranularity, bitmapHandleCount );
-    //
-    for( ; iIndex < endIndex; iIndex++ )
-        {
-        const TInt handle = iBitmapHandles[ iIndex ];
-        //
-        TRAP_IGNORE( CreateBitmapL( handle ) );
-        }
-    
-    // Report progress & queue for next iteration
-    MMemSpyEngineFbSerbBitmapArrayObserver::TEvent event = MMemSpyEngineFbSerbBitmapArrayObserver::EBitmapArrayConstructionComplete;
-    if  ( endIndex < bitmapHandleCount )
-        {
-        CompleteSelf();
-        event = MMemSpyEngineFbSerbBitmapArrayObserver::EBitmapItemsCreated;
-        }
-    else
-        {
-        SortBySizeL();
-        }
-
-    if  ( iObserver )
-        {
-        iObserver->HandleFbServBitmapArrayEventL( event );
-        }
-    }
-
-
-void CMemSpyEngineFbServBitmapArray::DoCancel()
-    {
-    // Nothing to do
-    }
-
-
-TInt CMemSpyEngineFbServBitmapArray::RunError( TInt /*aError*/ )
-    {
-    return KErrNone;
-    }
-
-
-void CMemSpyEngineFbServBitmapArray::CompleteSelf()
-    {
-    TRequestStatus* status = &iStatus;
-    User::RequestComplete( status, KErrNone );
-    SetActive();
-    }
-
-
-void CMemSpyEngineFbServBitmapArray::CreateBitmapL( TInt aHandle )
-    {
-    CMemSpyEngineFbServBitmap* bitmap = CMemSpyEngineFbServBitmap::NewLC( aHandle );
-    iBitmaps.AppendL( bitmap );
-    CleanupStack::Pop( bitmap );
-    }
-
-
-void CMemSpyEngineFbServBitmapArray::SortBySizeL()
-    {
-    TLinearOrder< CMemSpyEngineFbServBitmap > comparer( CompareBySize );
-    iBitmaps.Sort( comparer );
-    }
-
-
-TInt CMemSpyEngineFbServBitmapArray::CompareBySize( const CMemSpyEngineFbServBitmap& aLeft, const CMemSpyEngineFbServBitmap& aRight )
-    {
-    TInt ret = 1;
-    //
-    if  ( aLeft.BitmapSizeInBytes() > aRight.BitmapSizeInBytes() )
-        {
-        ret = -1;
-        }
-    else if ( aLeft.BitmapSizeInBytes() == aRight.BitmapSizeInBytes() )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineFbServBitmap::CMemSpyEngineFbServBitmap()
-:   CDesCArrayFlat( 5 )
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineFbServBitmap::~CMemSpyEngineFbServBitmap()
-    {
-    delete iBitmap;
-    delete iCaption;
-    }
-
-
-void CMemSpyEngineFbServBitmap::ConstructL( TInt aHandle )
-    {
-    iBitmap = new(ELeave) CFbsBitmap();
-    const TInt error = iBitmap->Duplicate( aHandle );
-    User::LeaveIfError( error );
-    const SEpocBitmapHeader header( iBitmap->Header() );
-
-    // Prepare caption
-    _LIT( KCaptionFormat, "\t%2d bpp, %S\t\t%4d x %4d pixels" );
-    iCaption = HBufC::NewL( 128 );
-    TPtr pCaption( iCaption->Des() );
-    
-    // Create size string
-    const TMemSpySizeText size( MemSpyEngineUtils::FormatSizeText( header.iBitmapSize ) );
-    pCaption.AppendFormat( KCaptionFormat, header.iBitsPerPixel, &size, header.iSizeInPixels.iWidth, header.iSizeInPixels.iHeight );
-
-    // Prepare items
-    PrepareItemsL();
-    }
-
-
-EXPORT_C CMemSpyEngineFbServBitmap* CMemSpyEngineFbServBitmap::NewLC( TInt aHandle )
-    {
-    CMemSpyEngineFbServBitmap* self = new(ELeave) CMemSpyEngineFbServBitmap();
-    CleanupStack::PushL( self );
-    self->ConstructL( aHandle );
-    return self;
-    }
-
-
-TInt CMemSpyEngineFbServBitmap::BitmapSizeInBytes() const
-    {
-    const SEpocBitmapHeader header( iBitmap->Header() );
-    return header.iBitmapSize;
-    }
-
-
-EXPORT_C const TDesC& CMemSpyEngineFbServBitmap::Caption() const
-    {
-    return *iCaption;
-    }
-
-
-EXPORT_C CFbsBitmap& CMemSpyEngineFbServBitmap::Bitmap()
-    {
-    return *iBitmap;
-    }
-
-
-EXPORT_C const CFbsBitmap& CMemSpyEngineFbServBitmap::Bitmap() const
-    {
-    return *iBitmap;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineFbServBitmap::Handle() const
-    {
-    return iBitmap->Handle();
-    }
-
-
-EXPORT_C void CMemSpyEngineFbServBitmap::OutputDataL( CMemSpyEngine& aEngine ) const
-    {
-    const SEpocBitmapHeader header( iBitmap->Header() );
-    //
-    _LIT(KMemSpyFBServHex, "0x%08x");
-    _LIT(KMemSpyFBServDecimal, "%d");
-    //
-    HBufC* columns = HBufC::NewLC( 1024 );
-    TPtr pColumns( columns->Des() );
-    //
-    pColumns.AppendFormat( KMemSpyFBServHex, Handle() );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    pColumns.AppendFormat( KMemSpyFBServDecimal, header.iBitmapSize );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    pColumns.AppendFormat( KMemSpyFBServDecimal, header.iSizeInPixels.iWidth );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    pColumns.AppendFormat( KMemSpyFBServDecimal, header.iSizeInPixels.iHeight );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    pColumns.AppendFormat( KMemSpyFBServDecimal, header.iBitsPerPixel );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    pColumns.AppendFormat( KMemSpyFBServDecimal, header.iColor );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    TBuf<24> fileCompressionType;
-    GetFileCompressionTypeAsString( header.iCompression, fileCompressionType );
-    pColumns.Append( fileCompressionType );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    GetExportableFileNameL( pColumns );
-    //
-    aEngine.Sink().OutputLineL( pColumns );
-    CleanupStack::PopAndDestroy( columns );
-    }
-
-
-EXPORT_C void CMemSpyEngineFbServBitmap::OutputDataColumnsL( CMemSpyEngine& aEngine )
-    {
-    HBufC* columns = HBufC::NewLC( 1024 );
-    TPtr pColumns( columns->Des() );
-    //
-    _LIT(KCol1, "Handle");
-    pColumns.Append( KCol1 );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    _LIT(KCol2, "Uncompressed Size (Bytes)");
-    pColumns.Append( KCol2 );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    _LIT(KCol3, "Width");
-    pColumns.Append( KCol3 );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    _LIT(KCol4, "Height");
-    pColumns.Append( KCol4 );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    _LIT(KCol5, "BPP");
-    pColumns.Append( KCol5 );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    _LIT(KCol6, "Color");
-    pColumns.Append( KCol6 );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    _LIT(KCol7, "Compression");
-    pColumns.Append( KCol7 );
-    pColumns.Append( KMemSpyEngineFBServComma );
-    //
-    _LIT(KCol8, "File Name");
-    pColumns.Append( KCol8 );
-    //
-    aEngine.Sink().OutputLineL( pColumns );
-    CleanupStack::PopAndDestroy( columns );
-    }
-
-
-EXPORT_C void CMemSpyEngineFbServBitmap::GetExportableFileNameL( TDes& aAppendName ) const
-    {
-    const SEpocBitmapHeader header( iBitmap->Header() );
-
-    // Create a filename
-    aAppendName.AppendFormat( KMemSpyEngineFBServExportFileName, Handle(), header.iBitsPerPixel, header.iSizeInPixels.iWidth, header.iSizeInPixels.iHeight );
-    }
-
-
-void CMemSpyEngineFbServBitmap::GetExportableFileNameL( const TMemSpyEngineFBServBitmapInfo& aInfo, TDes& aAppendName )
-    {
-    aAppendName.AppendFormat( KMemSpyEngineFBServExportFileName, aInfo.iHandle, aInfo.iBitsPerPixel, aInfo.iSizeInPixels.iWidth, aInfo.iSizeInPixels.iHeight );
-    }
-
-
-void CMemSpyEngineFbServBitmap::PrepareItemsL()
-    {
-    const SEpocBitmapHeader header( iBitmap->Header() );
-    TBuf<256> item;
-
-    // View bitmap (ugly, but needed by UI)
-    _LIT(KCaptionMinus2, "\tView Bitmap\t\t");
-    AppendL( KCaptionMinus2 );
-
-    // Dimensions
-    _LIT(KCaptionMinus1, "\tDimensions\t\t%5d x %5d");
-    item.Format( KCaptionMinus1, header.iSizeInPixels.iWidth, header.iSizeInPixels.iHeight );
-    AppendL( item );
-
-    // Handle
-    _LIT(KCaption0, "\tHandle\t\t0x%08x");
-    item.Format( KCaption0, iBitmap->Handle() );
-    AppendL( item );
-
-    // In Rom?
-    _LIT(KCaption1, "\tIn ROM?\t\t%S");
-    _LIT(KIsRomBitmap, "Yes");
-    _LIT(KNotRomBitmap, "No");
-    if  ( iBitmap->IsRomBitmap() )
-        {
-        item.Format( KCaption1, &KIsRomBitmap );
-        }
-    else
-        {
-        item.Format( KCaption1, &KNotRomBitmap );
-        }
-    AppendL( item );
-
-    // Bits per pixel
-    _LIT(KCaption2, "\tBits Per Pixel\t\t%2d");
-    item.Format( KCaption2, header.iBitsPerPixel );
-    AppendL( item );
-
-    // Size of uncompressed bitmap data
-    _LIT(KCaption3, "\tUncompressed data size\t\t%S");
-    const TMemSpySizeText sizeStringUncompressed( MemSpyEngineUtils::FormatSizeText( header.iBitmapSize ) );
-    item.Format( KCaption3, &sizeStringUncompressed );
-    AppendL( item );
-
-    // Palette entry count
-    _LIT(KCaption4, "\tNumber of palette entries\t\t%d");
-    item.Format( KCaption4, header.iPaletteEntries );
-    AppendL( item );
-
-    // Colour
-    _LIT(KCaption5, "\tColour\t\t%d");
-    item.Format( KCaption5, header.iColor);
-    AppendL( item );
-
-    // Palette entry count
-    _LIT(KCaption6, "\tFile compression type\t\t%S");
-    TBuf<24> fileCompressionType;
-    GetFileCompressionTypeAsString( header.iCompression, fileCompressionType );
-    item.Format( KCaption6, &fileCompressionType );
-    AppendL( item );
-    }
-
-
-void CMemSpyEngineFbServBitmap::GetFileCompressionTypeAsString( TBitmapfileCompression aType, TDes& aString )
-    {
-    _LIT(KUnknown, "Unknown");
-    _LIT(KNoCompression, "None");
-    _LIT(KRLE, "RLE");
-    _LIT(KTwelveBitRLE, "12-bit RLE");
-    _LIT(KSixteenBitRLE, "16-bit RLE");
-    _LIT(KTwentyFourBitRLE, "24-bit RLE");
-    _LIT(KThirtyTwoBitRLE, "32-bit RLE");
-    //
-    switch( aType )
-        {
-    case ENoBitmapCompression:
-        aString = KNoCompression;
-        break;
-    case EByteRLECompression:
-        aString = KRLE;
-        break;
-    case ETwelveBitRLECompression:
-        aString = KTwelveBitRLE;
-        break;
-    case ESixteenBitRLECompression:
-        aString = KSixteenBitRLE;
-        break;
-    case ETwentyFourBitRLECompression:
-        aString = KTwentyFourBitRLE;
-        break;
-    case EThirtyTwoUBitRLECompression:
-        aString = KThirtyTwoBitRLE;
-        break;
-    default:
-    case ERLECompressionLast:
-        aString = KUnknown;
-        break;
-        }
-    }
-
-
-
-
-
-
-
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperFileSystem.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1191 +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 <memspy/engine/memspyenginehelperfilesystem.h>
-
-// System includes
-#include <f32file.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include "MemSpyEngineOutputListItem.h"
-
-// Remap of E32 constant since this value only exists in recent v9.3 builds and MemSpy needs to build on v9.1
-const TUint KMemSpyDriveAttPageable = 0x100; // KDriveAttPageable
-const TUint KMemSpyMediaAttPageable = 0x200; // KMediaAttPageable
-
-// Literal constants
-_LIT( KMemSpyVolumeLabelNotSet, "None" );
-
-
-CMemSpyEngineHelperFileSystem::CMemSpyEngineHelperFileSystem( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperFileSystem::~CMemSpyEngineHelperFileSystem()
-    {
-    }
-
-
-void CMemSpyEngineHelperFileSystem::ConstructL()
-    {
-    iFileServerProcessId = MemSpyEngineUtils::IdentifyFileServerProcessIdL();
-    }
-
-
-CMemSpyEngineHelperFileSystem* CMemSpyEngineHelperFileSystem::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperFileSystem* self = new(ELeave) CMemSpyEngineHelperFileSystem( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C CMemSpyEngineDriveList* CMemSpyEngineHelperFileSystem::DriveListL()
-    {
-    CMemSpyEngineDriveList* list = CMemSpyEngineDriveList::NewLC( iEngine.FsSession() );
-    CleanupStack::Pop( list );
-    return list;
-    }
-
-
-EXPORT_C TDriveNumber CMemSpyEngineHelperFileSystem::GetSystemDrive()
-    {
-    TDriveNumber ret = EDriveC;
-#ifndef __WINS__
-    const TInt KRFsGetSystemDriveOrdinal = 336;
-    typedef TDriveNumber(*TRFsGetSystemDriveFunc)();
-    //
-    RLibrary lib;
-    const TInt loadErr = lib.Load( _L("EFSRV.DLL") );
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineHelperFileSystem::GetSystemDrive() - dll load: %d", loadErr );
-#endif
-    if  ( loadErr == KErrNone )
-        {
-        TLibraryFunction ordinal = lib.Lookup( KRFsGetSystemDriveOrdinal );
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyEngineHelperFileSystem::GetSystemDrive() - ordinal: 0x%08x", ordinal );
-#endif
-        //
-        if  ( ordinal )
-            {
-            TRFsGetSystemDriveFunc func = (TRFsGetSystemDriveFunc) ordinal;
-            ret = (*func)();
-#ifdef _DEBUG
-            RDebug::Printf( "CMemSpyEngineHelperFileSystem::GetSystemDrive() - drive: %c:\\", 'A' + ret);
-#endif
-            }
-        //
-        lib.Close();
-        }
-#endif
-    //
-    return ret;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperFileSystem::ListOpenFilesL()
-    {
-    TOpenFileScan scanner( iEngine.FsSession() );
-
-    _LIT( KMemSpyContext, "Open File Listing" );
-    _LIT( KMemSpyFolder, "OpenFiles" );
-    iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
-
-    _LIT(KHeading, "OPEN FILES");
-    iEngine.Sink().OutputSectionHeadingL( KHeading, '=' );
-    
-    // Set prefix for overall listing
-    _LIT(KOverallPrefix, "OpenFiles - ");
-    iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
-
-    CFileList* list = NULL;
-    scanner.NextL( list );
-    while( list != NULL )
-        {
-        CleanupStack::PushL( list );
-        ListOpenFilesL( *list, scanner.ThreadId() );
-        CleanupStack::PopAndDestroy( list );
-        //
-        list = NULL;
-        scanner.NextL( list );
-        }
-
-    CleanupStack::PopAndDestroy(); // prefix
-    iEngine.Sink().DataStreamEndL();
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperFileSystem::ListOpenFilesL( const TThreadId& aThreadId )
-    {
-    TOpenFileScan scanner( iEngine.FsSession() );
-
-    _LIT( KMemSpyContext, "Open File Listing" );
-    _LIT( KMemSpyFolder, "OpenFiles" );
-    iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
-
-    _LIT(KHeading, "OPEN FILES");
-    iEngine.Sink().OutputSectionHeadingL( KHeading, '=' );
-    
-    // Set prefix for overall listing
-    _LIT(KOverallPrefix, "OpenFiles - ");
-    iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
-
-    CFileList* list = NULL;
-    scanner.NextL( list );
-    while( list != NULL )
-        {
-        if  ( scanner.ThreadId() == aThreadId )
-            {
-            CleanupStack::PushL( list );
-            ListOpenFilesL( *list, scanner.ThreadId() );
-            CleanupStack::Pop( list );
-            }
-        //
-        delete list;
-        list = NULL;
-        scanner.NextL( list );
-        }
-
-    CleanupStack::PopAndDestroy(); // prefix
-    iEngine.Sink().DataStreamEndL();
-    }
-
-
-void CMemSpyEngineHelperFileSystem::GetDriveNumberText( TDriveNumber aDriveNumber, TDes& aText )
-    {
-    const TInt offset = aDriveNumber - EDriveA;
-    const TChar driveChar = 'A' + offset;
-    aText.Copy( _L("EDrive") );
-    aText.Append( driveChar );
-    }
-
-
-void CMemSpyEngineHelperFileSystem::ListOpenFilesL( const CFileList& aList, const TThreadId& aThreadId )
-    {
-    _LIT( KLineFormatSpec, "%d %S %S %S %S" );
-    TBuf<64> timeBuf;
-    TMemSpySizeText valueBuf;
-
-    HBufC* itemBuf = HBufC::NewLC( 3 * KMaxFullName );
-    TPtr item( itemBuf->Des() );
-
-    TFullName threadName;
-    RThread thread;
-    if  ( iEngine.Driver().OpenThread( aThreadId, thread ) == KErrNone )
-        {
-        threadName = thread.FullName();
-        thread.Close();
-        }
-
-    const TInt entryCount = aList.Count();
-    for(TInt i=0; i<entryCount; i++)
-        {
-        const TEntry& entry = aList[ i ];
-
-        // Get time and size format strings
-        valueBuf = MemSpyEngineUtils::FormatSizeText( entry.iSize );
-        MemSpyEngineUtils::FormatTimeL( timeBuf, entry.iModified );
-
-        // Create item 
-        item.Format( KLineFormatSpec, 0, &entry.iName, &valueBuf, &timeBuf, &threadName );
-        iEngine.Sink().OutputLineL( item );
-        }
-
-    CleanupStack::PopAndDestroy( itemBuf );
-    }
-
-
-CMemSpyEngineOpenFileList* CMemSpyEngineHelperFileSystem::ListOpenFilesLC()
-    {
-    CMemSpyEngineOpenFileList* list = CMemSpyEngineOpenFileList::NewLC( iEngine );
-    return list;
-    }
-
-
-TProcessId CMemSpyEngineHelperFileSystem::FileServerProcessId() const
-    {
-    return iFileServerProcessId;
-    }
-
-
-const CMemSpyEngineChunkEntry* CMemSpyEngineHelperFileSystem::IdentifyCacheChunk( const CMemSpyEngineChunkList& aList, TInt& aIndex ) const
-    {
-    aIndex = KErrNotFound;
-    const CMemSpyEngineChunkEntry* ret = NULL;
-    //
-    const TInt count = aList.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineChunkEntry& entry = aList.At( i );
-        const TMemSpyDriverChunkInfo& info = entry.Info();
-        //
-        if  ( info.iType == EMemSpyDriverChunkTypeLocal )
-            {
-#ifdef _DEBUG
-            RDebug::Print( _L("CMemSpyEngineHelperFileSystem::IdentifyCacheChunk() - name: %S, pid: 0x%04x, f32Pid: 0x%04x, size: %d, max: %d, attribs: %d"), &info.iName, info.iOwnerId, (TUint) iFileServerProcessId, info.iSize, info.iMaxSize, info.iAttributes );
-#endif
-
-            if ( info.iOwnerId == FileServerProcessId() )
-                {
-                // Additionally, the chunk is disconnected.
-                const TBool isDisconnected = ( info.iAttributes & EMemSpyChunkAttributesDisconnected );
-#ifdef _DEBUG
-                RDebug::Printf( "CMemSpyEngineHelperFileSystem::IdentifyCacheChunk() - it is an f32 local chunk... isDisconnected: %d", isDisconnected );
-#endif
-
-                if  ( info.iSize > 0 && info.iMaxSize > 0 && isDisconnected )
-                    {
-                    aIndex = i;
-                    ret = &entry;
-#ifdef _DEBUG
-                    RDebug::Print( _L("CMemSpyEngineHelperFileSystem::IdentifyCacheChunk() - FOUND: %S, size: %d"), &info.iName, info.iSize );
-#endif
-                    break;
-                    }
-                }
-            }
-        }
-    //
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineHelperFileSystem::IdentifyCacheChunk() - END - ret: 0x%08x", ret );
-#endif
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineDriveList::CMemSpyEngineDriveList( RFs& aFsSession )
-:   CActive( EPriorityStandard ), iFsSession( aFsSession )
-    {
-    CActiveScheduler::Add( this );
-    }
-
-
-EXPORT_C CMemSpyEngineDriveList::~CMemSpyEngineDriveList()
-    {
-    Cancel();
-    //
-    iItems.ResetAndDestroy();
-    iItems.Close();
-    }
-
-
-void CMemSpyEngineDriveList::ConstructL()
-    {
-    TDriveList drives;
-    if  ( iFsSession.DriveList( drives ) == KErrNone )
-        {
-        for( TInt i=EDriveA; i<=EDriveZ; i++ )
-            {
-            const TDriveNumber drive = static_cast< TDriveNumber >( i );
-            if  ( drives[ i ] != KDriveAbsent )
-                {
-                TRAP_IGNORE( 
-                    CMemSpyEngineDriveEntry* driveEntry = CMemSpyEngineDriveEntry::NewLC( *this, drive );
-                    iItems.AppendL( driveEntry );
-                    CleanupStack::Pop( driveEntry );
-                    );
-                }
-            }
-        }
-
-    iFsSession.NotifyChange( ENotifyDisk, iStatus );
-    SetActive();
-    }
-
-
-CMemSpyEngineDriveList* CMemSpyEngineDriveList::NewLC( RFs& aFsSession )
-    {
-    CMemSpyEngineDriveList* self = new(ELeave) CMemSpyEngineDriveList( aFsSession );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-void CMemSpyEngineDriveList::RunL()
-    {
-    iFsSession.NotifyChange( ENotifyDisk, iStatus );
-    SetActive();
-    //
-    NotifyListChangedL();
-    }
-
-
-void CMemSpyEngineDriveList::DoCancel()
-    {
-    iFsSession.NotifyChangeCancel();
-    }
-
-
-EXPORT_C void CMemSpyEngineDriveList::SetObserver( MMemSpyEngineDriveListObserver* aObserver )
-    {
-    iObserver = aObserver;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineDriveList::Count() const
-    {
-    return iItems.Count();
-    }
-
-
-EXPORT_C CMemSpyEngineDriveEntry& CMemSpyEngineDriveList::At( TInt aIndex )
-    {
-    return *iItems[ aIndex ];
-    }
-
-
-EXPORT_C const CMemSpyEngineDriveEntry& CMemSpyEngineDriveList::At( TInt aIndex ) const
-    {
-    return *iItems[ aIndex ];
-    }
-
-
-EXPORT_C TInt CMemSpyEngineDriveList::ItemIndex( const CMemSpyEngineDriveEntry& aEntry ) const
-    {
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineDriveEntry* item = iItems[ i ];
-        //
-        if  ( item == &aEntry )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C CMemSpyEngineDriveEntry* CMemSpyEngineDriveList::EntryByDriveNumber( TDriveNumber aDrive )
-    {
-    CMemSpyEngineDriveEntry* ret = NULL;
-    //
-    const TInt count = Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        CMemSpyEngineDriveEntry* item = iItems[ i ];
-        //
-        if  ( item->DriveNumber() == aDrive )
-            {
-            ret = item;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-RFs& CMemSpyEngineDriveList::FsSession()
-    {
-    return iFsSession;
-    }
-
-
-void CMemSpyEngineDriveList::NotifyListChangedL()
-    {
-    if  ( iObserver != NULL )
-        {
-        TRAP_IGNORE( iObserver->HandleDriveListChangedL( *this ) );
-        }
-    }
-
-
-EXPORT_C TInt CMemSpyEngineDriveList::MdcaCount() const
-    {
-    return Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineDriveList::MdcaPoint( TInt aIndex ) const
-    {
-    const CMemSpyEngineDriveEntry& item = At( aIndex );
-    return TPtrC( item.Caption() );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineDriveEntry::CMemSpyEngineDriveEntry( CMemSpyEngineDriveList& aList, TDriveNumber aDriveNumber )
-:   CActive( CActive::EPriorityStandard), iList( aList ), iDriveNumber( aDriveNumber ), iDriveUnit( aDriveNumber )
-    {
-    CActiveScheduler::Add( this );
-    }
-
-
-EXPORT_C CMemSpyEngineDriveEntry::~CMemSpyEngineDriveEntry()
-    {
-    Cancel();
-    //
-    delete iCaption;
-    delete iItems;
-    }
-
-
-void CMemSpyEngineDriveEntry::ConstructL()
-    {
-    RunL();
-    }
-
-
-EXPORT_C void CMemSpyEngineDriveEntry::SetObserver( MMemSpyEngineDriveEntryObserver* aObserver )
-    {
-    iObserver = aObserver;
-    }
-
-
-void CMemSpyEngineDriveEntry::RefreshL()
-    {
-    CMemSpyEngineOutputList* items = CMemSpyEngineOutputList::NewL();
-    delete iItems;
-    iItems = items;
-
-    /*
-	RFs13VolumeIOParamEiR18TVolumeIOParamInfo @ 344 NONAME
-	RFs17FileSystemSubTypeEiR6TDes16 @ 345 NONAME
-	RFs18QueryVolumeInfoExtEi22TQueryVolumeInfoExtCmdR5TDes8 @ 346 NONAME
-    */
-    const TInt err1 = FsSession().Drive( iDriveInfo, iDriveNumber );
-    const TInt err2 = FsSession().Volume( iVolumeInfo, iDriveNumber );
-    if  ( err1 || err2 )
-        {
-        _LIT( KUnavailable, "Unavailable");
-        iItems->AddItemL( KUnavailable );
-
-        // Mostly empty caption
-        CreateCaptionL( KNullDesC, KNullDesC );
-        }
-    else
-        {
-        // Literal constants
-        TBuf<KMaxFileName * 2> temp;
-        TBuf<KMaxFileName * 2> item;
-
-        AddStandardFieldsL();
-
-        _LIT( KEntry2a, "Media Type");
-        TBuf<20> mediaType;
-        GetMediaTypeText( iDriveInfo.iType, mediaType );
-        iItems->AddItemL( KEntry2a, mediaType );
-
-        _LIT( KEntry2b, "Battery Status");
-        GetBatteryState( iDriveInfo.iBattery, temp );
-        iItems->AddItemL( KEntry2b, temp );
-
-        // Now have enough data to create caption
-        CreateCaptionL( iVolumeInfo.iName, mediaType );
-        
-        CreateDriveAttributesL( item );
-        CreateMediaAttributesL( item );
-
-        _LIT( KEntry3a, "Volume Name");
-        if  ( iVolumeInfo.iName.Length() )
-            {
-            iItems->AddItemL( KEntry3a, iVolumeInfo.iName );
-            }
-        else
-            {
-            iItems->AddItemL( KEntry3a, KMemSpyVolumeLabelNotSet );
-            }
-
-        _LIT( KEntry3, "Volume UID");
-        iItems->AddItemHexL( KEntry3, iVolumeInfo.iUniqueID );
-
-        _LIT( KEntry4, "Volume Size");
-        temp = MemSpyEngineUtils::FormatSizeText( iVolumeInfo.iSize );
-        iItems->AddItemL( KEntry4, temp );
-
-        _LIT( KEntry5, "Volume Free");
-        temp = MemSpyEngineUtils::FormatSizeText( iVolumeInfo.iFree );
-        iItems->AddItemL( KEntry5, temp );
-
-        TMediaSerialNumber serialNum;
-        if  ( FsSession().GetMediaSerialNumber( serialNum, iDriveNumber ) == KErrNone )
-            {
-            _LIT( KEntry6, "Serial Number");
-            TBuf<KMaxSerialNumLength> serialNumUnicode;
-            serialNumUnicode.Copy( serialNum );
-            iItems->AddItemL( KEntry6, serialNumUnicode );
-            }
-
-        if  ( FsSession().FileSystemName( temp, iDriveNumber ) == KErrNone )
-            {
-            _LIT( KEntry7, "File System");
-            iItems->AddItemL( KEntry7, temp );
-            }
-        }
-    }
-
-
-CMemSpyEngineDriveEntry* CMemSpyEngineDriveEntry::NewLC( CMemSpyEngineDriveList& aList, TDriveNumber aDriveNumber )
-    {
-    CMemSpyEngineDriveEntry* self = new(ELeave) CMemSpyEngineDriveEntry( aList, aDriveNumber );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-void CMemSpyEngineDriveEntry::CreateDriveAttributesL( TDes& aItemBuf )
-    {
-    TInt driveAttribIndex = 0;
-    _LIT( KEntryText, "Drive Attribute %d");
-
-    if  ( iDriveInfo.iDriveAtt & KDriveAttLocal )
-        {
-        _LIT( KAttribName, "Local" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iDriveAtt & KDriveAttRom )
-        {
-        _LIT( KAttribName, "ROM" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iDriveAtt & KDriveAttRedirected )
-        {
-        _LIT( KAttribName, "Redirected" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iDriveAtt & KDriveAttSubsted )
-        {
-        _LIT( KAttribName, "Substed" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iDriveAtt & KDriveAttInternal )
-        {
-        _LIT( KAttribName, "Internal" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iDriveAtt & KDriveAttRemovable )
-        {
-        _LIT( KAttribName, "Removable" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iDriveAtt & KDriveAttRemote )
-        {
-        _LIT( KAttribName, "Remote" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iDriveAtt & KDriveAttTransaction )
-        {
-        _LIT( KAttribName, "Transaction" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iDriveAtt & KMemSpyDriveAttPageable )
-        {
-        _LIT( KAttribName, "Pageable" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iDriveAtt & KDriveAttRemovable )
-        {
-        _LIT( KAttribName, "Removable" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    }
-
-
-void CMemSpyEngineDriveEntry::CreateMediaAttributesL( TDes& aItemBuf )
-    {
-    TInt driveAttribIndex = 0;
-    _LIT( KEntryText, "Media Attribute %d");
-
-    if  ( iDriveInfo.iMediaAtt & KMediaAttVariableSize )
-        {
-        _LIT( KAttribName, "Variable Size" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iMediaAtt & KMediaAttDualDensity )
-        {
-        _LIT( KAttribName, "Dual Density" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iMediaAtt & KMediaAttFormattable )
-        {
-        _LIT( KAttribName, "Formattable" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iMediaAtt & KMediaAttWriteProtected )
-        {
-        _LIT( KAttribName, "Write Protected" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iMediaAtt & KMediaAttLockable )
-        {
-        _LIT( KAttribName, "Lockable" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iMediaAtt & KMediaAttLocked )
-        {
-        _LIT( KAttribName, "Locked" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iMediaAtt & KMediaAttHasPassword )
-        {
-        _LIT( KAttribName, "Has Password" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iMediaAtt & KMediaAttReadWhileWrite )
-        {
-        _LIT( KAttribName, "Read-while-Write" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iMediaAtt & KMediaAttDeleteNotify )
-        {
-        _LIT( KAttribName, "Delete Notify" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    if  ( iDriveInfo.iMediaAtt & KMemSpyMediaAttPageable )
-        {
-        _LIT( KAttribName, "Pageable" );
-        aItemBuf.Format( KEntryText, ++driveAttribIndex );
-        iItems->AddItemL( aItemBuf, KAttribName );
-        }
-    }
-
-
-void CMemSpyEngineDriveEntry::AddStandardFieldsL()
-    {
-    _LIT( KEntry1, "Unit Name");
-    const TDriveName driveUnitName = iDriveUnit.Name();
-    iItems->AddItemL( KEntry1, driveUnitName );
-
-    _LIT( KEntry2, "Unit Number");
-    TBuf<30> temp;
-    CMemSpyEngineHelperFileSystem::GetDriveNumberText( iDriveNumber, temp );
-    iItems->AddItemL( KEntry2, temp );
-
-    const TDriveNumber sysDrive = GetSystemDrive();
-    if  ( sysDrive == iDriveNumber )
-        {
-        _LIT( KEntry3, "System Drive");
-        iItems->AddItemYesNoL( KEntry3, ETrue );
-        }
-    }
-
-
-void CMemSpyEngineDriveEntry::CreateCaptionL( const TDesC& aVolumeName, const TDesC& aMediaType )
-    {
-    TBuf<256 * 2> caption;
-
-    // Always include drive unit name
-    const TDriveName driveUnitName = iDriveUnit.Name();
-    caption.AppendFormat( _L("\t%S"), &driveUnitName );
-
-    // If we have a volume name, then include that too
-    if  ( aVolumeName.Length() )
-        {
-        caption.AppendFormat( _L(" [%S]"), &aVolumeName );
-        }
-    
-    // New line
-    caption.Append( _L("\t\t") );
-
-    // Include media type if known, or unknown otherwise
-    if  ( aMediaType.Length() )
-        {
-        caption.Append( aMediaType );
-        }
-    else
-        {
-        _LIT( KUnknownMediaType, "Unknown" );
-        caption.Append( KUnknownMediaType );
-        }
-
-    HBufC* finalCaption = caption.AllocL();
-    delete iCaption;
-    iCaption = finalCaption;
-    }
-
-void CMemSpyEngineDriveEntry::GetMediaTypeText( TMediaType aType, TDes& aText )
-    {
-    switch( aType )
-        {
-    case EMediaNotPresent:
-        aText.Copy( _L("Not Present") );
-        break;
-    case EMediaFloppy:
-        aText.Copy( _L("Floppy") );
-        break;
-    case EMediaHardDisk:
-        aText.Copy( _L("Hard Disk") );
-        break;
-    case EMediaCdRom:
-        aText.Copy( _L("CD-ROM") );
-        break;
-    case EMediaRam:
-        aText.Copy( _L("RAM") );
-        break;
-    case EMediaFlash:
-        aText.Copy( _L("Flash") );
-        break;
-    case EMediaRom:
-        aText.Copy( _L("ROM") );
-        break;
-    case EMediaRemote:
-        aText.Copy( _L("Remote") );
-        break;
-    case EMediaNANDFlash:
-        aText.Copy( _L("NAND Flash") );
-        break;
-    default:
-    case EMediaUnknown:
-        aText.Copy( _L("Unknown") );
-        break;
-        }
-    }
-
-
-void CMemSpyEngineDriveEntry::GetBatteryState( TBatteryState aBatteryState, TDes& aText )
-    {
-    switch( aBatteryState )
-        {
-    case EBatNotSupported:
-        aText.Copy( _L("Not Supported") );
-        break;
-    case EBatGood:
-        aText.Copy( _L("Good") );
-        break;
-    case EBatLow:
-        aText.Copy( _L("Low") );
-        break;
-    default:
-        aText.Copy( _L("Unknown") );
-        break;
-        }
-    }
-
-
-TDriveNumber CMemSpyEngineDriveEntry::GetSystemDrive()
-    {
-    return CMemSpyEngineHelperFileSystem::GetSystemDrive();
-    }
-
-
-EXPORT_C TInt CMemSpyEngineDriveEntry::MdcaCount() const
-    {
-    return iItems->Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineDriveEntry::MdcaPoint( TInt aIndex ) const
-    {
-    return iItems->MdcaPoint( aIndex );
-    }
-
-
-void CMemSpyEngineDriveEntry::RunL()
-    {
-    FsSession().NotifyChange( ENotifyDisk, iStatus );
-    SetActive();
-    //
-    TRAP_IGNORE( RefreshL() );
-    //
-    if ( iObserver != NULL )
-        {
-        TRAP_IGNORE( iObserver->HandleDriveEntryChangedL( *this ) );
-        }
-    }
-
-
-void CMemSpyEngineDriveEntry::DoCancel()
-    {
-    FsSession().NotifyChangeCancel();
-    }
-
-
-RFs& CMemSpyEngineDriveEntry::FsSession()
-    {
-    return iList.FsSession();
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineOpenFileListEntry::CMemSpyEngineOpenFileListEntry()
-    {
-    }
-
-
-CMemSpyEngineOpenFileListEntry::~CMemSpyEngineOpenFileListEntry()
-    {
-    delete iFileName;
-    }
-
-
-void CMemSpyEngineOpenFileListEntry::ConstructL( const TEntry& aEntry )
-    {
-    iFileName = aEntry.iName.AllocL();
-    iAtt = aEntry.iAtt;
-    iType = aEntry.iType;
-    iSize = aEntry.iSize;
-    iModified = aEntry.iModified;
-    }
-
-
-CMemSpyEngineOpenFileListEntry* CMemSpyEngineOpenFileListEntry::NewLC( const TEntry& aEntry )
-    {
-    CMemSpyEngineOpenFileListEntry* self = new(ELeave) CMemSpyEngineOpenFileListEntry();
-    CleanupStack::PushL( self );
-    self->ConstructL( aEntry );
-    return self;
-    }
-
-
-EXPORT_C const TDesC& CMemSpyEngineOpenFileListEntry::FileName() const
-    {
-    return *iFileName;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineOpenFileListEntry::Size() const
-    {
-    return iSize;
-    }
-
-
-TInt CMemSpyEngineOpenFileListEntry::UniqueFileId() const
-    {
-    return iUniqueFileIdentifier;
-    }
-
-
-void CMemSpyEngineOpenFileListEntry::SetUniqueFileId( TInt aValue )
-    {
-    iUniqueFileIdentifier = aValue;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineOpenFileListForThread::CMemSpyEngineOpenFileListForThread( const TThreadId& aThreadId, const TProcessId& aProcessId )
-:   iThreadId( aThreadId ), iProcessId( aProcessId )
-    {
-    }
-
-
-CMemSpyEngineOpenFileListForThread::~CMemSpyEngineOpenFileListForThread()
-    {
-    iItems.ResetAndDestroy();
-    iItems.Close();
-    delete iThreadName;
-    }
-
-
-void CMemSpyEngineOpenFileListForThread::ConstructL( const TDesC& aThreadName, const CFileList& aList )
-    {
-    iThreadName = aThreadName.AllocL();
-
-    // Create fs entries
-    const TInt entryCount = aList.Count();
-    for(TInt i=0; i<entryCount; i++)
-        {
-        const TEntry& fsEntry = (aList)[ i ];
-        //
-        CMemSpyEngineOpenFileListEntry* entry = CMemSpyEngineOpenFileListEntry::NewLC( fsEntry );
-        AddL( entry );
-        CleanupStack::Pop( entry );
-        }
-    }
-
-
-CMemSpyEngineOpenFileListForThread* CMemSpyEngineOpenFileListForThread::NewLC( const TDesC& aThreadName, const TThreadId& aThreadId, const TProcessId& aProcessId, const CFileList& aList )
-    {
-    CMemSpyEngineOpenFileListForThread* self = new(ELeave) CMemSpyEngineOpenFileListForThread( aThreadId, aProcessId );
-    CleanupStack::PushL( self );
-    self->ConstructL( aThreadName, aList );
-    return self;
-    }
-
-
-EXPORT_C const TDesC& CMemSpyEngineOpenFileListForThread::ThreadName() const
-    {
-    return *iThreadName;
-    }
-
-
-EXPORT_C const TThreadId& CMemSpyEngineOpenFileListForThread::ThreadId() const
-    {
-    return iThreadId;
-    }
-
-
-EXPORT_C const TProcessId& CMemSpyEngineOpenFileListForThread::ProcessId() const
-    {
-    return iProcessId;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineOpenFileListForThread::Count() const
-    {
-    return iItems.Count();
-    }
-
-
-EXPORT_C const CMemSpyEngineOpenFileListEntry& CMemSpyEngineOpenFileListForThread::At( TInt aIndex ) const
-    {
-    return *iItems[ aIndex ];
-    }
- 
-
-void CMemSpyEngineOpenFileListForThread::AddL( CMemSpyEngineOpenFileListEntry* aEntry )
-    {
-    // Ensure we increment the unique filename counter if adding an entry where the same filename
-    // already is registered with the list.
-    CMemSpyEngineOpenFileListEntry* existingEntry = EntryByFileName( aEntry->FileName() );
-    if  ( existingEntry )
-        {
-        // EntryByFileName() always returns the most recent entry with the same name. The list
-        // itself is not sorted as entries are always appended to it.
-        const TInt lastUID = existingEntry->UniqueFileId();
-#ifdef _DEBUG
-        RDebug::Print( _L("CMemSpyEngineOpenFileListForThread::AddL() - searched for %S and found existing entry with UID: %d"), &aEntry->FileName(), lastUID );
-#endif
-
-        aEntry->SetUniqueFileId( lastUID + 1 );
-        }
-
-    iItems.AppendL( aEntry );
-    }
-
-
-CMemSpyEngineOpenFileListEntry* CMemSpyEngineOpenFileListForThread::EntryByFileName( const TDesC& aFileName )
-    {
-    CMemSpyEngineOpenFileListEntry* ret = NULL;
-    //
-    const TInt count = iItems.Count();
-    for( TInt i=count-1; i>=0; i-- )
-        {
-        CMemSpyEngineOpenFileListEntry* item = iItems[ i ];
-        if  ( item->FileName().CompareF( aFileName ) == 0 )
-            {
-            ret = item;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineOpenFileList::CMemSpyEngineOpenFileList()
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineOpenFileList::~CMemSpyEngineOpenFileList()
-    {
-    iItems.ResetAndDestroy();
-    iItems.Close();
-    }
-
-
-void CMemSpyEngineOpenFileList::ConstructL( CMemSpyEngine& aEngine )
-    {
-    _LIT( KUnknownThread, "Unknown Thread" );
-    TFullName threadName;
-    TOpenFileScan scanner( aEngine.FsSession() );
-    //
-    CFileList* list = NULL;
-    scanner.NextL( list );
-    while( list != NULL )
-        {
-        CleanupStack::PushL( list );
-
-        // Reset name
-        threadName = KUnknownThread;
-        
-        // Try to get real thread name
-        TProcessId procId;
-        RThread thread;
-        if  ( aEngine.Driver().OpenThread( scanner.ThreadId(), thread ) == KErrNone )
-            {
-            RProcess process;
-            if ( thread.Process( process ) == KErrNone )
-                {
-                procId = process.Id();
-                process.Close();
-                }
-            //
-            thread.FullName( threadName );
-            thread.Close();
-            }
-
-        // Create thread entry
-        CMemSpyEngineOpenFileListForThread* threadEntry = CMemSpyEngineOpenFileListForThread::NewLC( threadName, scanner.ThreadId(), procId, *list );
-        iItems.AppendL( threadEntry );
-        CleanupStack::Pop( threadEntry );
-
-        // Destroy list and move on to next thread.
-        CleanupStack::PopAndDestroy( list );
-        list = NULL;
-        scanner.NextL( list );
-        }
-    }
-
-
-CMemSpyEngineOpenFileList* CMemSpyEngineOpenFileList::NewLC( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineOpenFileList* self = new(ELeave) CMemSpyEngineOpenFileList();
-    CleanupStack::PushL( self );
-    self->ConstructL( aEngine );
-    return self;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineOpenFileList::Count() const
-    {
-    return iItems.Count();
-    }
-
-
-EXPORT_C const CMemSpyEngineOpenFileListForThread& CMemSpyEngineOpenFileList::At( TInt aIndex ) const
-    {
-    return *iItems[ aIndex ];
-    }
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperHeap.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1207 +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 <memspy/engine/memspyenginehelperheap.h>
-
-// System includes
-#include <s32mem.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyenginehelperrom.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// Constants
-const TBool KMemSpyHeapDumpCreateOwnDataStream = ETrue;
-
-// Literal constants
-_LIT( KCellTypeGoodAllocatedCell,        "[Allocated Cell]            ");
-_LIT( KCellTypeGoodFreeCell,             "[Free Cell]                 ");
-_LIT( KCellTypeBadAllocatedCellSize,     "[Bad Allocated Cell Size]   ");
-_LIT( KCellTypeBadAllocatedCellAddress,  "[Bad Allocated Cell Address]");
-_LIT( KCellTypeBadFreeCellAddress,       "[Bad Free Cell Address]     ");
-_LIT( KCellTypeBadFreeCellSize,          "[Bad Free Cell Size]        ");
-_LIT( KCellTypeBad,                      "[Bad Cell]                  ");
-_LIT( KCellTypeUnknown,                  "[Unknown!]                  ");
-_LIT( KCellListLineFormat, "%S cell: 0x%08x, cellLen: %8d, allocNum: %8d, nestingLev: %8d, cellData: 0x%08x, cellDataAddr: 0x%08x, headerSize: %02d");
-_LIT( KMemSpyMarkerHeapData, "<%SMEMSPY_HEAP_DATA_%03d>" );
-_LIT( KMemSpyMarkerCSV, "<%SMEMSPY_HEAP_CSV>" );
-_LIT( KMemSpyPrefixHeapData, "HeapData - %S - ");
-_LIT( KMemSpyPrefixCellList, "CellList - %S - ");
-_LIT( KMemSpyPrefixCSV, "CSV - " );
-
-
-CMemSpyEngineHelperHeap::CMemSpyEngineHelperHeap( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperHeap::~CMemSpyEngineHelperHeap()
-    {
-    }
-
-
-void CMemSpyEngineHelperHeap::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperHeap* CMemSpyEngineHelperHeap::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperHeap* self = new(ELeave) CMemSpyEngineHelperHeap( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-
-
-
-
-
-
-
-
-EXPORT_C void CMemSpyEngineHelperHeap::OutputCellListingUserL( const CMemSpyThread& aThread )
-    {
-    // Suspend the process
-    iEngine.ProcessSuspendLC( aThread.Process().Id() );
-
-    // Free cells
-    RArray<TMemSpyDriverFreeCell> freeCells;
-    CleanupClosePushL( freeCells );
-
-    // Info section
-    TMemSpyHeapInfo heapInfo;
-    const TInt error = iEngine.Driver().GetHeapInfoUser( heapInfo, aThread.Id(), freeCells );
-    if ( error == KErrNone )
-        {
-        UpdateSharedHeapInfoL( aThread.Process().Id(), aThread.Id(), heapInfo );
-        }
-    if  ( error == KErrNone && heapInfo.Type() != TMemSpyHeapInfo::ETypeUnknown )
-        {
-        // Get thread name for context
-        const TFullName pName( aThread.FullName() );
-
-        // Begin a new data stream
-        _LIT( KMemSpyFolder, "Heap\\Cell List" );
-        _LIT( KMemSpyContext, "Cell List - %S" );
-        HBufC* context = HBufC::NewLC( KMaxFileName );
-        TPtr pContext( context->Des() );
-        pContext.Format( KMemSpyContext, &pName );
-        iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder );
-        CleanupStack::PopAndDestroy( context );
-
-        // Set prefix for overall listing
-        iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixCellList, &pName );
-
-        // Start new section
-        _LIT(KHeader, "CELL LISTING");
-        iEngine.Sink().OutputSectionHeadingL( KHeader, '=' );
-
-        // Prepare temp buffers
-        TBuf<KMaxFullName + 100> printFormat;
-        HBufC* tempBuffer = HBufC::NewLC( 2048 );
-        TPtr pTempBuffer( tempBuffer->Des() );
-
-        // Print initial info
-        OutputHeapInfoL( heapInfo, pName, &freeCells );
-
-        // Code segments (needed for map file reading...)
-        _LIT(KCellListCodeSegInfoFormat, "CodeSegs - ");
-        iEngine.HelperCodeSegment().OutputCodeSegmentsL( aThread.Process().Id(), printFormat, KCellListCodeSegInfoFormat, '-', ETrue );
-    
-        // Now walk the heap!
-        TInt r = iEngine.Driver().WalkHeapInit( aThread.Id() );
-        if  ( r == KErrNone )
-            {
-             _LIT(KHeader2, "Cells");
-            iEngine.Sink().OutputSectionHeadingL( KHeader2, '-' );
-
-            TMemSpyDriverCellType cellType;
-            TAny* cellAddress;
-            TInt cellLength;
-            TInt cellNestingLevel;
-            TInt cellAllocationNumber;
-            TInt cellHeaderSize;
-            TAny* cellPayloadAddress;
-            TBuf8<4> cellData;
-            //
-            r = iEngine.Driver().WalkHeapNextCell( aThread.Id(), cellType, cellAddress, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
-            while( r == KErrNone )
-                {
-                TUint fourByteCellData = 0;
-                TPtrC pType(KNullDesC);
-                //
-				if (cellType & EMemSpyDriverAllocatedCellMask)
-					{
-                    r = iEngine.Driver().WalkHeapReadCellData( cellAddress, cellData, 4 );
-                    if  ( r == KErrNone )
-                        {
-                        fourByteCellData = DescriptorAsDWORD( cellData );
-                        }
-                    pType.Set(KCellTypeGoodAllocatedCell);
-                    }
-				else if (cellType & EMemSpyDriverFreeCellMask)
-					{
-                    pType.Set(KCellTypeGoodFreeCell);
-					}
-				else if (cellType & EMemSpyDriverBadCellMask)
-					{
-					switch (cellType)
-						{
-					case EMemSpyDriverHeapBadAllocatedCellSize:
-						pType.Set(KCellTypeBadAllocatedCellSize);
-						break;
-					case EMemSpyDriverHeapBadAllocatedCellAddress:
-						pType.Set(KCellTypeBadAllocatedCellAddress);
-						break;
-					case EMemSpyDriverHeapBadFreeCellAddress:
-						pType.Set(KCellTypeBadFreeCellAddress);
-						break;
-					case EMemSpyDriverHeapBadFreeCellSize:
-						pType.Set(KCellTypeBadFreeCellSize);
-						break;
-					default:
-						pType.Set(KCellTypeBad);
-						break;
-						}
-					}
-				else
-					{
-                    pType.Set(KCellTypeUnknown);
-                    }
-
-                if  ( r == KErrNone )
-                    {
-                    pTempBuffer.Format( KCellListLineFormat, &pType, cellAddress, cellLength, cellAllocationNumber, cellNestingLevel, fourByteCellData, cellPayloadAddress, cellHeaderSize );
-                    iEngine.Sink().OutputLineL( pTempBuffer );
-                    //
-                    r = iEngine.Driver().WalkHeapNextCell( aThread.Id(), cellType, cellAddress, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
-                    }
-                }
-            //
-            iEngine.Driver().WalkHeapClose();
-            }
-        CleanupStack::PopAndDestroy( tempBuffer );
-        CleanupStack::PopAndDestroy(); // clear prefix
-
-        iEngine.Sink().DataStreamEndL();
-        }
-
-    CleanupStack::PopAndDestroy( &freeCells );
-    CleanupStack::PopAndDestroy(); // resume process
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapDataUserL( const CMemSpyThread& aThread )
-    {
-    OutputHeapDataUserL( aThread, KMemSpyHeapDumpCreateOwnDataStream );
-    }
-
-
-void CMemSpyEngineHelperHeap::OutputHeapDataUserL( const CMemSpyThread& aThread, TBool aCreateDataStream )
-    {
-    // Make sure the process is suspended for the entire time we are manipulating it's heap
-    iEngine.ProcessSuspendLC( aThread.Process().Id() );
-
-    // Get the heap info, including cell information
-    RArray<TMemSpyDriverCell> cells;
-    CleanupClosePushL( cells );
-    TMemSpyHeapInfo heapInfo;
-    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::OutputHeapDataUserL() - checksum1: 0x%08x", heapInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
-    GetHeapInfoUserL(aThread.Process().Id(), aThread.Id(), heapInfo, &cells, ETrue);
-    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::OutputHeapDataUserL() - checksum2: 0x%08x", heapInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
-
-    // Get the heap data
-    const TFullName pName( aThread.FullName() );
-    OutputHeapDataUserL( aThread.Process().Id(), aThread.Id(), pName, heapInfo, aCreateDataStream, &cells );
-    CleanupStack::PopAndDestroy( &cells );
-
-    // Resume process
-    CleanupStack::PopAndDestroy();
-    }
-
-
-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 )
-    {
-    TBuf<KMaxFullName + 100> printFormat;
-
-    // Begin a new data stream
-    if  ( aCreateDataStream )
-        {
-        _LIT( KMemSpyFolder, "Heap\\Data" );
-        _LIT( KMemSpyContext, "Heap Data - %S" );
-        HBufC* context = HBufC::NewLC( KMaxFileName );
-        TPtr pContext( context->Des() );
-        pContext.Format( KMemSpyContext, &aThreadName );
-        iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder );
-        CleanupStack::PopAndDestroy( context );
-        }
-
-    // Get the heap info first of all
-    iEngine.ProcessSuspendLC( aPid );
-
-    // Start marker
-    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KNullDesC, (TUint) aTid );
-
-    // Set overall prefix
-    iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixHeapData, &aThreadName );
-
-    // Info section
-    OutputHeapInfoL( aInfo, aThreadName, aCells );
-
-    // Code segments (needed for map file reading...)
-    _LIT(KCellListCodeSegInfoFormat, "CodeSegs - ");
-    iEngine.HelperCodeSegment().OutputCodeSegmentsL( aPid, printFormat, KCellListCodeSegInfoFormat, '-', ETrue );
-
-    // Dump section
-    _LIT(KHeaderDump, "Heap Data");
-    iEngine.Sink().OutputSectionHeadingL( KHeaderDump, '-' );
-
-    HBufC8* data = HBufC8::NewLC( 4096 * 12 );
-    TPtr8 pData(data->Des());
-    TUint remaining = 0;
-    TUint readAddress = 0;
-
-    // When we obtained the heap info, we also obtained a checksum of all the free cells
-    // within the specified heap. We validate that this hasn't changed at the time we
-    // request the heap data for paranoia purposes (There have been "Issues" with MemSpy
-    // not actually suspending a process between fetching heap info & heap data, causing
-    // a mismatch in free cell information).
-    const TUint32 checksum = aInfo.AsRHeap().Statistics().StatsFree().Checksum();
-    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::OutputHeapDataUserL() - checksum: 0x%08x", checksum ) );
-
-    TInt r = iEngine.Driver().GetHeapData( aTid, checksum, 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().GetHeapDataNext(aTid, 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(); // resume process
-
-    // End marker
-    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KMemSpySinkTagClose, (TUint) aTid );
-
-    if  ( aCreateDataStream )
-        {
-        iEngine.Sink().DataStreamEndL();
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapInfoL( const TMemSpyHeapInfo& aInfo, const TDesC& aThreadName, const RArray<TMemSpyDriverCell>* aCells )
-	{
-    CMemSpyEngineOutputList* list = NewHeapSummaryExtendedLC(aInfo, aCells);
-
-    // Format the thread name according to upper/lower case request parameters
-    _LIT( KOverallCaption1, "HEAP INFO FOR THREAD '%S'");
-    list->InsertItemFormatUCL( 0, KOverallCaption1, &aThreadName );
-    list->InsertUnderlineForItemAtL( 0 );
-
-    // Print it
-    list->PrintL();
-
-    // Tidy up
-    CleanupStack::PopAndDestroy( list );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-void CMemSpyEngineHelperHeap::OutputCSVEntryL( TInt aIndex, const TMemSpyHeapInfo& aInfo, const TDesC& aThreadName, const TDesC& aProcessName )
-    {
-    const TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
-    const TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
-    const TMemSpyHeapStatisticsRHeap& rHeapStats = rHeapInfo.Statistics();
-
-    // Example:
-    //
-    //  <ENTRY_001>
-    //      <THREAD_NAME_001>ESock_IP</THREAD_NAME_001>
-    //      <PROCESS_NAME_001>c32exe.exe[101f7989]0001</PROCESS_NAME_001>
-    //      <CHUNK_NAME_001>Local-c812ba58</CHUNK_NAME_001>
-    //      <FIELDS_001>1,0x12400000,0x00c00074,36744,4092,524288,0x00c011a4,0,13,6872,1368,1680,2584,219,40,28996,0</FIELDS_001>
-    //  </ENTRY_001>
-    
-    _LIT( KFmtTagOpenAndClose, "<%S_%04d>%S</%S_%04d>" );
-    
-    _LIT( KFmtEntryId, "<%SENTRY_%04d>");
-    _LIT( KFmtNameThread, "THREAD_NAME");
-    _LIT( KFmtNameProcess, "PROCESS_NAME");
-    _LIT( KFmtNameChunk, "CHUNK_NAME");
-    _LIT( KFmtFields, "FIELDS");
-    _LIT( KFmtFieldContent , "<%S_%04d>%06d,0x%08x,0x%08x,%d,%d,%d,0x%08x,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</%S_%04d>");
-
-    // <ENTRY_001>
-    iEngine.Sink().OutputLineFormattedL( KFmtEntryId, &KNullDesC, aIndex );
-    
-    //      <THREAD_NAME_001>ESock_IP</THREAD_NAME_001>
-    iEngine.Sink().OutputLineFormattedL( KFmtTagOpenAndClose, &KFmtNameThread, aIndex, &aThreadName, &KFmtNameThread, aIndex );
-    
-    //      <PROCESS_NAME_001>c32exe.exe[101f7989]0001</PROCESS_NAME_001>
-    iEngine.Sink().OutputLineFormattedL( KFmtTagOpenAndClose, &KFmtNameProcess, aIndex, &aProcessName, &KFmtNameProcess, aIndex );
-    
-    //      <CHUNK_NAME_001>Local-c812ba58</CHUNK_NAME_001>
-    const TPtrC pChunkName( rHeapMetaData.ChunkName() );
-    iEngine.Sink().OutputLineFormattedL( KFmtTagOpenAndClose, &KFmtNameChunk, aIndex, &pChunkName, &KFmtNameChunk, aIndex );
-    
-    // Fields
-    iEngine.Sink().OutputLineFormattedL( KFmtFieldContent,
-                                         &KFmtFields,
-                                         aIndex,
-                                         aInfo.Tid(),
-                                         rHeapMetaData.ChunkHandle(),
-                                         /*rHeapObjectData.Base(),*/ rHeapMetaData.iAllocatorAddress,
-                                         /*rHeapObjectData.Size(),*/ rHeapMetaData.iHeapSize,
-                                         /*rHeapObjectData.iMinLength,*/ rHeapMetaData.iMinHeapSize,
-                                         /*rHeapObjectData.iMaxLength,*/ rHeapMetaData.iMaxHeapSize,
-                                         /*rHeapObjectData.iFree.next,*/ NULL,
-                                         /*rHeapObjectData.iFree.len,*/ 0,
-                                         rHeapStats.StatsFree().TypeCount(),
-                                         rHeapStats.StatsFree().TypeSize(),
-                                         rHeapStats.StatsFree().SlackSpaceCellSize(),
-                                         rHeapStats.StatsFree().LargestCellSize(),
-                                         rHeapStats.StatsAllocated().LargestCellSize(),
-                                         /*rHeapObjectData.iCellCount,*/ rHeapStats.StatsAllocated().TypeCount(),
-                                         /*rHeapObjectData.iMinCell,*/ 0,
-                                         /*rHeapObjectData.iTotalAllocSize,*/ rHeapStats.StatsAllocated().TypeSize(),
-                                         rHeapMetaData.IsSharedHeap(),
-                                         &KFmtFields,
-                                         aIndex
-                                         );
-    
-    // </ENTRY_001>
-    iEngine.Sink().OutputLineFormattedL( KFmtEntryId, &KMemSpySinkTagClose, aIndex );
-    }
-
-
-
-EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapInfoForDeviceL( TBool aIncludeKernel )
-    {
-    // NB: The goal here is to minimise the line length. We already look like we
-    // could exceed the available RDebug::Print length...
-    const TInt count = iEngine.Container().Count();
-    TInt index = 0;
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-    //
-    _LIT( KMemSpyFolder, "Heap\\Compact" );
-    _LIT( KMemSpyContext, "Heap Compact" );
-    _LIT( KMemSpyExtension, ".log" );
-    iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder, KMemSpyExtension );
-
-    // Start marker
-    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerCSV, &KNullDesC );
-
-    // Set overall prefix
-    iEngine.Sink().OutputPrefixSetLC( KMemSpyPrefixCSV );
-    
-    // Output version info
-    _LIT( KVersionNumber, "<VERSION>1</VERSION>" );
-    iEngine.Sink().OutputLineL( KVersionNumber );
-    
-    // Output time stamp
-    _LIT( KTimeStamp, "<TIMESTAMP>%u</TIMESTAMP>" );
-    iEngine.Sink().OutputLineFormattedL( KTimeStamp, User::FastCounter() );
- 
-    // Heap info we'll populate by calling the driver
-    TMemSpyHeapInfo info;
-    TFullName processName;
-
-    if  ( aIncludeKernel )
-        {
-        // Get kernel heap info
-        GetHeapInfoKernelL( info );
-
-        if ( info.Type() != TMemSpyHeapInfo::ETypeUnknown )
-            {
-            TName threadName;
-            MemSpyEngineUtils::GetKernelHeapThreadAndProcessNames( threadName, processName );
-            OutputCSVEntryL( index++, info, threadName, processName );
-            }
-        }
-
-	for(TInt ii=0; ii<count; ii++)
-        {
-        const CMemSpyProcess& process = iEngine.Container().At( ii );
-        process.FullName( processName );
-        //
-        if  ( iEngine.ProcessSuspendAndGetErrorLC( process.Id() ) == KErrNone )
-            {
-            const TInt threadCount = process.Count();
-            //
-            for(TInt j=0; j<threadCount; j++)
-                {
-                const CMemSpyThread& thread = process.At( j );
-                const TPtrC threadName( thread.Name() );
-                //
-                const TInt error = iEngine.Driver().GetHeapInfoUser( info, thread.Id() );
-                if ( error == KErrNone )
-                    {
-                    UpdateSharedHeapInfoL( process.Id(), thread.Id(), info );
-                    }
-                if  ( error == KErrNone && info.Type() != TMemSpyHeapInfo::ETypeUnknown )
-                    {
-                    OutputCSVEntryL( index++, info, threadName, processName );
-                    }
-                }
-    
-            CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-            }
-        }
-
-    CleanupStack::PopAndDestroy(); // clear prefix
-    CleanupStack::PopAndDestroy( buf );
-
-	// End marker
-	iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerCSV, &KMemSpySinkTagClose );
-    iEngine.Sink().DataStreamEndL();
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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)
-    {
-    iEngine.ProcessSuspendLC( aProcess );
-    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::GetHeapInfoUserL() - checksum1: 0x%08x", aInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
-    
-    TInt r = KErrNone;
-    //
-    if  (aCells)
-        {
-        r = iEngine.Driver().GetHeapInfoUser( aInfo, aThread, *aCells, aCollectAllocatedCellsAsWellAsFree);
-        }
-    else
-        {
-        r = iEngine.Driver().GetHeapInfoUser( aInfo, aThread );
-        }
-    if ( !r )
-        {
-        UpdateSharedHeapInfoL( aProcess, aThread, aInfo );
-        }
-    
-    //
-    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::GetHeapInfoUserL() - checksum2: 0x%08x", aInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
-    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-    User::LeaveIfError( r );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoUserL( const CMemSpyProcess& aProcess, RArray<TMemSpyHeapInfo >& aInfos )
-    {
-    aInfos.Reset();
-    iEngine.ProcessSuspendLC( aProcess.Id() );
-    //
-    TMemSpyHeapInfo info;
-    //
-    const TInt count = aProcess.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyThread& thread = aProcess.At( i );
-        //
-        GetHeapInfoUserL( aProcess.Id(), thread.Id(), info );
-        aInfos.AppendL( info );
-        }
-    //
-    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapInfoUserL( const CMemSpyThread& aThread )
-    {
-    HBufC* threadName = aThread.FullName().AllocLC();
-    //
-    RArray<TMemSpyDriverFreeCell> freeCells;
-    CleanupClosePushL( freeCells );
-    //
-    TMemSpyHeapInfo info;
-    GetHeapInfoUserL( aThread.Process().Id(), aThread.Id(), info, &freeCells );
-    OutputHeapInfoL( info, *threadName, &freeCells );
-    //
-    CleanupStack::PopAndDestroy( 2, threadName ); // freecells & thread name
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>* aFreeCells )
-    {
-    TInt error = KErrNone;
-    //
-    if  ( aFreeCells )
-        {
-        error = iEngine.Driver().GetHeapInfoKernel( aInfo, *aFreeCells );
-        }
-    else
-        {
-        error = iEngine.Driver().GetHeapInfoKernel( aInfo );
-        }
-    //
-    User::LeaveIfError( error );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapInfoKernelL()
-    {
-    // Get thread name
-    TFullName threadName;
-    MemSpyEngineUtils::GetKernelHeapThreadName( threadName );
-
-    // Free cells
-    RArray<TMemSpyDriverFreeCell> freeCells;
-    CleanupClosePushL( freeCells );
-
-    // Get info
-    TMemSpyHeapInfo info;
-    GetHeapInfoKernelL( info, &freeCells );
-
-    // Ouput
-    OutputHeapInfoL( info, threadName, &freeCells );
-
-    CleanupStack::PopAndDestroy( &freeCells );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapDataKernelL()
-    {
-    OutputHeapDataKernelL( KMemSpyHeapDumpCreateOwnDataStream );
-    }
-
-
-void CMemSpyEngineHelperHeap::OutputHeapDataKernelL( TBool aCreateDataStream )
-    {
-    // Get thread name
-    TFullName threadName;
-    MemSpyEngineUtils::GetKernelHeapThreadName( threadName, EFalse );
-
-    // Begin a new data stream
-    if  ( aCreateDataStream )
-        {
-        _LIT( KMemSpyFolder, "Heap\\Data" );
-        _LIT( KMemSpyContext, "Heap Data - %S" );
-        HBufC* context = HBufC::NewLC( KMaxFileName );
-        TPtr pContext( context->Des() );
-        pContext.Format( KMemSpyContext, &threadName );
-        iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder );
-        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 );
-
-    // Start marker
-    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KNullDesC, info.Tid() );
-
-    // Set overall prefix
-    iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixHeapData, &threadName );
-
-    // Info section
-    OutputHeapInfoL( info, threadName, &freeCells );
-
-    // 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() );
-	*/
-
-    CleanupStack::PopAndDestroy(); // clear prefix
-    CleanupStack::PopAndDestroy( data );
-    CleanupStack::PopAndDestroy( &freeCells );
-
-    // End marker
-    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KMemSpySinkTagClose, info.Tid() );
-
-    if  ( aCreateDataStream )
-        {
-        iEngine.Sink().DataStreamEndL();
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXPORT_C CMemSpyEngineOutputList* CMemSpyEngineHelperHeap::NewHeapSummaryShortLC( const TMemSpyHeapInfo& aInfo )
-    {
-    CMemSpyEngineOutputList* list = CMemSpyEngineOutputList::NewLC( iEngine.Sink() );
-
-    // Heap type
-    _LIT( KItem0, "Heap type" );
-    if ( aInfo.Type() == TMemSpyHeapInfo::ETypeUnknown )
-        {
-        _LIT( KItem0_Type_Unknown, "Unknown" );
-        list->AddItemL( KItem0, KItem0_Type_Unknown );
-        }
-    else
-        {
-        const TMemSpyHeapInfoRHeap& rHeap = aInfo.AsRHeap();
-        const TMemSpyHeapMetaDataRHeap& metaData = rHeap.MetaData();
-        const TMemSpyHeapStatisticsRHeap& statistics = rHeap.Statistics();
-
-        _LIT( KItem0_Type_RHeap, "RHeap" );
-        _LIT( KItem0_Type_RHybridHeap, "RHybridHeap" );
-		if (aInfo.Type() == TMemSpyHeapInfo::ETypeRHeap)
-			{
-	        list->AddItemL( KItem0, KItem0_Type_RHeap );
-			}
-		else
-			{
-	        list->AddItemL( KItem0, KItem0_Type_RHybridHeap );
-			}
-
-        // Heap size is the size of the heap minus the size of the embedded (in-place) RHeap. 
-        _LIT( KItem1, "Heap size" );
-        list->AddItemL(KItem1, metaData.iHeapSize);
-
-        _LIT( KItem8b, "Allocator address" );
-        list->AddItemHexL( KItem8b, (TUint)metaData.iAllocatorAddress );
-        
-        _LIT( KItem1b, "Shared" );
-        list->AddItemYesNoL( KItem1b, metaData.IsSharedHeap() );
-
-        // This is the size (rounded to the page) of memory associated with
-        // the underlying heap chunk
-        _LIT( KItem2, "Chunk size" );
-        list->AddItemL( KItem2, metaData.ChunkSize() );
-
-        _LIT( KItem3, "Alloc. count" );
-        list->AddItemL( KItem3, statistics.StatsAllocated().TypeCount() );
-
-        _LIT( KItem4, "Free. count" );
-        list->AddItemL( KItem4, statistics.StatsFree().TypeCount() );
-
-        _LIT( KItem5, "Biggest alloc." );
-        list->AddItemL( KItem5, statistics.StatsAllocated().LargestCellSize() );
-
-        _LIT( KItem6, "Biggest free" );
-        list->AddItemL( KItem6, statistics.StatsFree().LargestCellSize() );
-
-        _LIT( KItem6a, "Total alloc." );
-        list->AddItemL( KItem6a, statistics.StatsAllocated().TypeSize() );
-
-        _LIT( KItem6b, "Total free" );
-        list->AddItemL( KItem6b, statistics.StatsFree().TypeSize() );
-
-        // Slack is the free space at the end of the heap
-        _LIT( KItem7, "Slack free space" );
-        list->AddItemL( KItem7, statistics.StatsFree().SlackSpaceCellSize() );
-
-        // Fragmentation is a measurement of free space scattered throughout the heap, but ignoring
-        // any slack space at the end (which can often be recovered, to the granularity of one page of ram)
-        _LIT( KItem8a, "Fragmentation" );
-        list->AddItemPercentageL( KItem8a, metaData.iHeapSize, ( statistics.StatsFree().TypeSize()  - statistics.StatsFree().SlackSpaceCellSize() ) );
-
-
-        _LIT( KItem9c, "Overhead (total)" );
-		const TInt totalOverhead = metaData.iHeapSize - statistics.StatsAllocated().TypeSize();
-        list->AddItemL( KItem9c, totalOverhead );
-
-        _LIT( KItem9d, "Overhead" );
-        list->AddItemPercentageL( KItem9d, metaData.iHeapSize, totalOverhead  );
-
-        _LIT( KItem10, "Min. length" );
-        list->AddItemL( KItem10, metaData.iMinHeapSize );
-
-        _LIT( KItem11, "Max. length" );
-        list->AddItemL( KItem11, metaData.iMaxHeapSize );
-
-        _LIT( KItem12, "Debug Allocator Library" );
-        list->AddItemYesNoL( KItem12, metaData.IsDebugAllocator() );
-        }
-
-    return list;
-    }
-
-
-EXPORT_C CMemSpyEngineOutputList* CMemSpyEngineHelperHeap::NewHeapSummaryExtendedLC( const TMemSpyHeapInfo& aInfo, const RArray<TMemSpyDriverCell>* aCells )
-	{
-    CMemSpyEngineOutputList* list = CMemSpyEngineOutputList::NewLC( iEngine.Sink() );
-    //
-    AppendMetaDataL( aInfo, *list );
-    AppendStatisticsL( aInfo, *list );
-    //
-    if  ( aCells )
-        {
-        AppendCellsL( *aCells, *list );
-        }
-    //
-    return list;
-    }
-
-
-//cigasto: not formatted - raw heap info 
-EXPORT_C TMemSpyHeapData CMemSpyEngineHelperHeap::NewHeapRawInfo( const TMemSpyHeapInfo& aInfo )
-	{
-	_LIT(KUnknown, "Unknown");
-	TMemSpyHeapData list;
-	list.iType.Copy(KUnknown);
-
-	// Heap type	
-	if (aInfo.Type() != TMemSpyHeapInfo::ETypeUnknown)
-		{
-		const TMemSpyHeapInfoRHeap& rHeap = aInfo.AsRHeap();
-		const TMemSpyHeapMetaDataRHeap& metaData = rHeap.MetaData();
-		const TMemSpyHeapStatisticsRHeap& statistics = rHeap.Statistics();
-
-		_LIT(KRHeap, "RHeap");
-		_LIT(KRHybridHeap, "RHybridHeap");
-		switch (aInfo.Type())
-			{
-			case TMemSpyHeapInfo::ETypeRHeap:
-				list.iType.Copy(KRHeap);
-				break;
-			case TMemSpyHeapInfo::ETypeRHybridHeap:
-				list.iType.Copy(KRHybridHeap);
-				break;
-			default:
-				break;
-			}
-
-	    // Heap size is the total amount of memory committed to the heap, which includes the size of the embedded (in-place) RHeap/RHybridHeap.
-	    list.iSize = metaData.iHeapSize;
-	    list.iBaseAddress = (TUint)metaData.iAllocatorAddress; // TODO we can't do the base address any more, allocator address is the closest thing
-	    list.iShared = metaData.IsSharedHeap();
-	    list.iChunkSize = metaData.ChunkSize();
-	    list.iAllocationsCount = statistics.StatsAllocated().TypeCount();
-	    list.iFreeCount = statistics.StatsFree().TypeCount();
-	    list.iBiggestAllocation = statistics.StatsAllocated().LargestCellSize();
-	    list.iBiggestFree = statistics.StatsFree().LargestCellSize();
-	    list.iTotalAllocations =  statistics.StatsAllocated().TypeSize();	        
-	    list.iTotalFree =  statistics.StatsFree().TypeSize();
-	    list.iSlackFreeSpace = statistics.StatsFree().SlackSpaceCellSize();
-	    list.iFragmentation = statistics.StatsFree().TypeSize() - statistics.StatsFree().SlackSpaceCellSize(); //to calculate percentage value use iSize as 100% value
-	    list.iHeaderSizeA = 0; //metaData.HeaderSizeAllocated();
-	    list.iHeaderSizeF = 0; //metaData.HeaderSizeFree();
-	    TInt allocOverhead = rHeap.Overhead(); //metaData.HeaderSizeAllocated() * statistics.StatsAllocated().TypeCount();
-	    list.iAllocationOverhead = allocOverhead;
-	    //TInt freeOverhead = metaData.HeaderSizeFree() * statistics.StatsFree().TypeCount();
-	    list.iFreeOverhead = 0; // TODO there is no way of calculating this
-	    list.iTotalOverhead = allocOverhead; // freeOverhead + allocOverhead
-	    list.iOverhead = allocOverhead; //freeOverhead + allocOverhead; //to calculate percentage value use iSize as 100% value    
-	    list.iMinLength = metaData.iMinHeapSize;
-	    list.iMaxLength = metaData.iMaxHeapSize;
-	    list.iDebugAllocatorLibrary = metaData.IsDebugAllocator();
-		}
-
-	return list;
-	}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TUint CMemSpyEngineHelperHeap::DescriptorAsDWORD( const TDesC8& aItem)
-    {
-    __ASSERT_ALWAYS( aItem.Length() >= 4, User::Invariant() );
-    const TUint ret =  aItem[0] +
-                      (aItem[1] << 8) + 
-                      (aItem[2] << 16) + 
-                      (aItem[3] << 24);
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperHeap::AppendMetaDataL( const TMemSpyHeapInfo& aInfo, CMemSpyEngineOutputList& aList )
-    {
-    const TMemSpyHeapInfoRHeap& rHeap = aInfo.AsRHeap();
-
-    // Make caption
-    _LIT( KOverallCaption1, "Meta Data" );
-    aList.AddItemL( KOverallCaption1 );
-    aList.AddUnderlineForPreviousItemL( '=', 0 );
-
-    // Type
-    _LIT( KMetaData_Type,  "Type:" );
-    if ( aInfo.Type() == TMemSpyHeapInfo::ETypeUnknown )
-        {
-        _LIT( KMetaData_Type_Unknown,  "Unknown" );
-        aList.AddItemL( KMetaData_Type, KMetaData_Type_Unknown );
-        }
-    else
-        {
-        const TMemSpyHeapMetaDataRHeap& metaData = rHeap.MetaData();
-    
-        // Type
-        _LIT( KMetaData_Type_RHeap,  "Symbian OS RHeap" );
-        _LIT( KMetaData_Type_RHybridHeap,  "Symbian OS RHybridHeap" );
-		if (aInfo.Type() == TMemSpyHeapInfo::ETypeRHeap)
-			{
-	        aList.AddItemL( KMetaData_Type, KMetaData_Type_RHeap );
-			}
-		else
-			{
-			aList.AddItemL( KMetaData_Type, KMetaData_Type_RHybridHeap );
-			}
-
-        // VTable
-        //_LIT( KMetaData_VTable,  "VTable:" );
-        //aList.AddItemHexL( KMetaData_VTable, metaData.VTable() );
-
-        // Object size
-        //_LIT( KMetaData_ObjectSize,  "Object Size:" );
-        //aList.AddItemL( KMetaData_ObjectSize, metaData.ClassSize() );
-
-        // Chunk name
-        _LIT( KMetaData_ChunkName,  "Chunk Name:" );
-        TPtrC pChunkName( metaData.ChunkName() );
-        aList.AddItemL( KMetaData_ChunkName, pChunkName );
-
-        // Chunk size
-        _LIT( KMetaData_ChunkSize,  "Chunk Size:" );
-        aList.AddItemL( KMetaData_ChunkSize, metaData.ChunkSize() );
-
-        // Chunk base address
-        _LIT( KMetaData_ChunkBaseAddress,  "Chunk Base Address:" );
-        aList.AddItemL( KMetaData_ChunkBaseAddress, metaData.ChunkBaseAddress() );
-
-        // Debug allocator
-        _LIT( KMetaData_DebugAllocator,  "Debug Allocator:" );
-        aList.AddItemYesNoL( KMetaData_DebugAllocator, metaData.IsDebugAllocator() );
-
-        // Shared Heap
-        _LIT( KMetaData_Shared,  "Shared:" );
-        aList.AddItemYesNoL( KMetaData_Shared, metaData.IsSharedHeap() );
-
-        // Add ROM info
-        iEngine.HelperROM().AddInfoL( aList );
-        }
-
-    aList.AddBlankItemL( 1 );
-    }
-
-void CMemSpyEngineHelperHeap::AppendStatisticsL( const TMemSpyHeapInfo& aInfo, CMemSpyEngineOutputList& aList )
-    {
-    if (aInfo.Type() != TMemSpyHeapInfo::ETypeUnknown)
-        {
-        const TMemSpyHeapInfoRHeap& rHeap = aInfo.AsRHeap();
-        const TMemSpyHeapStatisticsRHeap& rHeapStats = rHeap.Statistics();
-
-        // Shared captions
-        _LIT( KStatsData_CellCount,  "Number of cells:" );
-        _LIT( KStatsData_CellSize,  "Size of cells:" );
-        _LIT( KStatsData_LargestCellAddress,  "Largest cell:" );
-        _LIT( KStatsData_LargestCellSize,  "Largest cell size:" );
-
-        // Free space
-        _LIT( KOverallCaption1, "Free Cell Statistics" );
-        aList.AddItemL( KOverallCaption1 );
-        aList.AddUnderlineForPreviousItemL( '=', 0 );
-
-        aList.AddItemL( KStatsData_CellCount, rHeapStats.StatsFree().TypeCount() );
-        aList.AddItemL( KStatsData_CellSize, rHeapStats.StatsFree().TypeSize() );
-        aList.AddItemL( KStatsData_LargestCellAddress, rHeapStats.StatsFree().LargestCellAddress() );
-        aList.AddItemL( KStatsData_LargestCellSize, rHeapStats.StatsFree().LargestCellSize() );
-		if (aInfo.Type() == TMemSpyHeapInfo::ETypeRHeap)
-			{
-			_LIT( KStatsData_Free_SlackCellAddress,  "Slack:" );
-			aList.AddItemL( KStatsData_Free_SlackCellAddress, rHeapStats.StatsFree().SlackSpaceCellAddress() );
-			_LIT( KStatsData_Free_SlackCellSize,  "Slack size:" );
-			aList.AddItemL( KStatsData_Free_SlackCellSize, rHeapStats.StatsFree().SlackSpaceCellSize() );
-			}
-        _LIT( KStatsData_Free_Checksum,  "Checksum:" );
-        aList.AddItemHexL( KStatsData_Free_Checksum, rHeapStats.StatsFree().Checksum() );
-
-        aList.AddBlankItemL( 1 );
-
-        // Allocated space
-        _LIT( KOverallCaption2, "Allocated Cell Statistics" );
-        aList.AddItemL( KOverallCaption2 );
-        aList.AddUnderlineForPreviousItemL( '=', 0 );
-
-        aList.AddItemL( KStatsData_CellCount, rHeapStats.StatsAllocated().TypeCount() );
-        aList.AddItemL( KStatsData_CellSize, rHeapStats.StatsAllocated().TypeSize() );
-        aList.AddItemL( KStatsData_LargestCellAddress, rHeapStats.StatsAllocated().LargestCellAddress() );
-        aList.AddItemL( KStatsData_LargestCellSize, rHeapStats.StatsAllocated().LargestCellSize() );
-
-        aList.AddBlankItemL( 1 );
-         }
-    }
-
-
-void CMemSpyEngineHelperHeap::AppendCellsL(const RArray<TMemSpyDriverCell>& aCells, CMemSpyEngineOutputList& aList)
-    {
-    // For reasons that may or may not turn out to be sensible, we separate free and allocated cells in the output data
-
-    _LIT( KOverallCaption1, "Free Cell List" );
-    aList.AddItemL( KOverallCaption1 );
-    aList.AddUnderlineForPreviousItemL( '=', 0 );
-
-    TBuf<128> caption;
-    _LIT( KCaptionFormat, "FC %04d" );
-    _LIT( KValueFormat, "0x%08x %8d %d" );
-
-	TBool foundAllocatedCells = EFalse;
-    const TInt count = aCells.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const TMemSpyDriverCell& cell = aCells[ i ];
-		if (cell.iType & EMemSpyDriverAllocatedCellMask)
-			{
-			foundAllocatedCells = ETrue;
-			}
-		else if (cell.iType & EMemSpyDriverFreeCellMask)
-			{
-	        caption.Format( KCaptionFormat, i + 1 );
-		    aList.AddItemFormatL( caption, KValueFormat, cell.iAddress, cell.iLength, cell.iType );
-			}
-        }
-
-	if (foundAllocatedCells)
-		{
-        aList.AddBlankItemL( 1 );
-		_LIT( KOverallCaption1, "Allocated Cell List" );
-		aList.AddItemL( KOverallCaption1 );
-		aList.AddUnderlineForPreviousItemL( '=', 0 );
-
-		TBuf<128> caption;
-		_LIT( KCaptionFormat, "AC %04d" );
-		_LIT( KValueFormat, "0x%08x %8d %d" );
-
-		for (TInt i = 0; i < count; i++)
-			{
-			const TMemSpyDriverCell& cell = aCells[ i ];
-			if (cell.iType & EMemSpyDriverAllocatedCellMask)
-				{
-				caption.Format( KCaptionFormat, i + 1 );
-				aList.AddItemFormatL( caption, KValueFormat, cell.iAddress, cell.iLength, cell.iType );
-				}
-			}
-		}
-    }
-
-void CMemSpyEngineHelperHeap::UpdateSharedHeapInfoL( const TProcessId& aProcess, const TThreadId& aThread, TMemSpyHeapInfo& aInfo )
-    {
-    RArray<TThreadId> threads;
-    CleanupClosePushL( threads );
-    iEngine.Driver().GetThreadsL( aProcess, threads );
-    TMemSpyHeapInfo otherHeap;
-    TThreadId otherThreadId;
-    TInt r( KErrNone );
-    for ( TInt i = 0; i < threads.Count(); i++ )
-        {
-        otherThreadId = threads[i];
-        if ( aThread != otherThreadId ) // skip current thread
-            {
-            r = iEngine.Driver().GetHeapInfoUser( otherHeap, otherThreadId );
-            if ( !r && otherHeap.AsRHeap().MetaData().ChunkHandle() == aInfo.AsRHeap().MetaData().ChunkHandle() )
-                {
-                TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::UpdateSharedHeapInfoL - shared heap detected chunkhandle: 0x%08x", aInfo.AsRHeap().MetaData().ChunkHandle() ) );
-                aInfo.AsRHeap().MetaData().SetSharedHeap( ETrue );
-                break;
-                }
-            }
-        }
-    CleanupStack::PopAndDestroy( &threads );
-    }
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperKernelContainers.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,542 +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<memspy/engine/memspyenginehelperkernelcontainers.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-#include <memspy/driver/memspydriverconstants.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// Constants
-const TInt KMaxGenericHandleCount = 1024 * 2;
-_LIT( KMemSpyMarkerKernelContainer, "<%SMEMSPY_KERNEL_CONTAINER_%02d>" );
-_LIT( KMemSpyMarkerKernelContainersAll, "<%SMEMSPY_KERNEL_CONTAINERS>" );
-
-
-
-CMemSpyEngineHelperKernelContainers::CMemSpyEngineHelperKernelContainers( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperKernelContainers::~CMemSpyEngineHelperKernelContainers()
-    {
-    }
-
-
-void CMemSpyEngineHelperKernelContainers::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperKernelContainers* CMemSpyEngineHelperKernelContainers::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperKernelContainers* self = new(ELeave) CMemSpyEngineHelperKernelContainers( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C CMemSpyEngineGenericKernelObjectList* CMemSpyEngineHelperKernelContainers::ObjectsForSpecificContainerL( TMemSpyDriverContainerType aForContainer )
-    {
-    CMemSpyEngineGenericKernelObjectList* list = CMemSpyEngineGenericKernelObjectList::NewLC( aForContainer, iEngine );
-    AddObjectsFromContainerL( *list, aForContainer );
-    CleanupStack::Pop( list );
-    return list;
-    }
-
-
-EXPORT_C CMemSpyEngineGenericKernelObjectContainer* CMemSpyEngineHelperKernelContainers::ObjectsAllL()
-    {
-    CMemSpyEngineGenericKernelObjectContainer* container = CMemSpyEngineGenericKernelObjectContainer::NewLC();
-    //
-    for( TInt i=EMemSpyDriverContainerTypeFirst; i<=EMemSpyDriverContainerTypeLast; i++ )
-        {
-        const TMemSpyDriverContainerType type = static_cast< TMemSpyDriverContainerType >( i );
-        //
-        CMemSpyEngineGenericKernelObjectList* list = CMemSpyEngineGenericKernelObjectList::NewLC( type, iEngine );
-        AddObjectsFromContainerL( *list, type );
-        container->AddListL( list );
-        CleanupStack::Pop( list );
-        }
-    //
-    CleanupStack::Pop( container );
-    return container;
-    }
-
-
-CMemSpyEngineGenericKernelObjectContainer* CMemSpyEngineHelperKernelContainers::ObjectsAllLightweightL()
-    {
-    CMemSpyEngineGenericKernelObjectContainer* container = CMemSpyEngineGenericKernelObjectContainer::NewLC();
-    //
-    for( TInt i=EMemSpyDriverContainerTypeFirst; i<=EMemSpyDriverContainerTypeLast; i++ )
-        {
-        const TMemSpyDriverContainerType type = static_cast< TMemSpyDriverContainerType >( i );
-        //
-        CMemSpyEngineGenericKernelObjectList* list = CMemSpyEngineGenericKernelObjectList::NewLC( type, iEngine );
-        AddObjectsFromContainerL( *list, type, EFalse );
-        container->AddListL( list );
-        CleanupStack::Pop( list );
-        }
-    //
-    CleanupStack::Pop( container );
-    return container;
-    }
-
-
-TMemSpyDriverContainerType CMemSpyEngineHelperKernelContainers::MapToType( TObjectType aType )
-    {
-    TMemSpyDriverContainerType ret = EMemSpyDriverContainerTypeUnknown;
-    //
-    if ( aType >= EMemSpyDriverContainerTypeFirst && aType <= EMemSpyDriverContainerTypeLast )
-        {
-        ret = (TMemSpyDriverContainerType) aType;
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperKernelContainers::OutputL( const CMemSpyEngineGenericKernelObjectContainer& aContainer ) const
-    {
-    aContainer.OutputL( iEngine.Sink() );
-    }
-
-
-CMemSpyEngine& CMemSpyEngineHelperKernelContainers::Engine() const
-    {
-    return iEngine;
-    }
-
-
-void CMemSpyEngineHelperKernelContainers::AddObjectsFromContainerL( CMemSpyEngineGenericKernelObjectList& aList, TMemSpyDriverContainerType aContainer, TBool aGetInfo )
-    {
-	TAny* handles[KMaxGenericHandleCount];
-	TInt c = KMaxGenericHandleCount;
-
-	TInt r = iEngine.Driver().GetContainerHandles( aContainer, handles, c );
-	if  ( r == KErrNone )
-    	{
-        if  ( c > 0 )
-            {
-        	if (c > KMaxGenericHandleCount)
-        		{
-        		c = KMaxGenericHandleCount;
-        		}
-
-        	TMemSpyDriverHandleInfoGeneric info;
-        	for (TInt i=0; i<c && r == KErrNone; i++)
-        		{
-                if  ( aGetInfo )
-                    {
-        		    r = iEngine.Driver().GetGenericHandleInfo( KMemSpyDriverEnumerateContainerHandles, aContainer, handles[i], info );
-        		    if  ( r == KErrNone )
-        			    {
-        			    aList.AddItemL( info );
-        			    }
-                    }
-                else
-                    {
-                    aList.AddItemL( handles[ i ] );
-                    }
-        		}
-            }
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineGenericKernelObjectList::CMemSpyEngineGenericKernelObjectList( TMemSpyDriverContainerType aType )
-:   iType( aType ), iItems( 25 ), iHandles( 25 )
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineGenericKernelObjectList::~CMemSpyEngineGenericKernelObjectList()
-    {
-    delete iName;
-    iHandles.Close();
-    iItems.Close();
-    }
-
-
-void CMemSpyEngineGenericKernelObjectList::ConstructL( CMemSpyEngine& aEngine )
-    {
-    iName = HBufC::NewL( KMaxFullName );
-    iSize = aEngine.Driver().GetApproximateKernelObjectSize( iType );
-    UpdateNameL();
-    }
-
-
-CMemSpyEngineGenericKernelObjectList* CMemSpyEngineGenericKernelObjectList::NewLC( TMemSpyDriverContainerType aType, CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineGenericKernelObjectList* self = new(ELeave) CMemSpyEngineGenericKernelObjectList( aType );
-    CleanupStack::PushL( self );
-    self->ConstructL( aEngine );
-    return self;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineGenericKernelObjectList::Count() const
-    {
-    return iHandles.Count();
-    }
-
-
-EXPORT_C const TMemSpyDriverHandleInfoGeneric& CMemSpyEngineGenericKernelObjectList::At( TInt aIndex ) const
-    {
-    return iItems[ aIndex ];
-    }
-
-
-EXPORT_C TMemSpyDriverContainerType CMemSpyEngineGenericKernelObjectList::Type() const
-    {
-    return iType;
-    }
-
-EXPORT_C TInt CMemSpyEngineGenericKernelObjectList::Size() const
-    {
-    return iSize;
-    }
-
-EXPORT_C TInt CMemSpyEngineGenericKernelObjectList::ItemsCount() const
-	{
-	return iItems.Count();
-	}
-    
-
-EXPORT_C TPtrC CMemSpyEngineGenericKernelObjectList::TypeAsString( TMemSpyDriverContainerType aType )
-    {
-    _LIT( KTypeUnknown, "Unknown Type" );
-    _LIT( KTypeThread, "Thread" );
-    _LIT( KTypeProcess, "Process" );
-    _LIT( KTypeChunk, "Chunk" );
-    _LIT( KTypeLibrary, "Library" );
-    _LIT( KTypeSemaphore, "Semaphore" );
-    _LIT( KTypeMutex, "Mutex" );
-    _LIT( KTypeTimer, "Timer" );
-    _LIT( KTypeServer, "Server" );
-    _LIT( KTypeSession, "Session" );
-    _LIT( KTypeLogicalDevice, "Logical Device" );
-    _LIT( KTypePhysicalDevice, "Physical Device" );
-    _LIT( KTypeLogicalChannel, "Logical Channel" );
-    _LIT( KTypeChangeNotifier, "Change Notifier" );
-    _LIT( KTypeUndertaker, "Undertaker" );
-    _LIT( KTypeMsgQueue, "Msg. Queue" );
-    _LIT( KTypePropertyRef, "Property Ref." );
-    _LIT( KTypeCondVar, "Conditional Var." );
-     //
-    TPtrC pType( KTypeUnknown );
-    //
-    switch( aType )
-        {
-    case EMemSpyDriverContainerTypeThread:
-        pType.Set( KTypeThread );
-        break;
-    case EMemSpyDriverContainerTypeProcess:
-        pType.Set( KTypeProcess );
-        break;
-    case EMemSpyDriverContainerTypeChunk:
-        pType.Set( KTypeChunk );
-        break;
-    case EMemSpyDriverContainerTypeLibrary:
-        pType.Set( KTypeLibrary );
-        break;
-    case EMemSpyDriverContainerTypeSemaphore:
-        pType.Set( KTypeSemaphore );
-        break;
-    case EMemSpyDriverContainerTypeMutex:
-        pType.Set( KTypeMutex );
-        break;
-    case EMemSpyDriverContainerTypeTimer:
-        pType.Set( KTypeTimer );
-        break;
-    case EMemSpyDriverContainerTypeServer:
-        pType.Set( KTypeServer );
-        break;
-    case EMemSpyDriverContainerTypeSession:
-        pType.Set( KTypeSession );
-        break;
-    case EMemSpyDriverContainerTypeLogicalDevice:
-        pType.Set( KTypeLogicalDevice );
-        break;
-    case EMemSpyDriverContainerTypePhysicalDevice:
-        pType.Set( KTypePhysicalDevice );
-        break;
-    case EMemSpyDriverContainerTypeLogicalChannel:
-        pType.Set( KTypeLogicalChannel );
-        break;
-    case EMemSpyDriverContainerTypeChangeNotifier:
-        pType.Set( KTypeChangeNotifier );
-        break;
-    case EMemSpyDriverContainerTypeUndertaker:
-        pType.Set( KTypeUndertaker );
-        break;
-    case EMemSpyDriverContainerTypeMsgQueue:
-        pType.Set( KTypeMsgQueue );
-        break;
-    case EMemSpyDriverContainerTypePropertyRef:
-        pType.Set( KTypePropertyRef );
-        break;
-    case EMemSpyDriverContainerTypeCondVar:
-        pType.Set( KTypeCondVar );
-        break;
-        
-    default:
-        break;
-        }
-    //
-    return pType;
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineGenericKernelObjectList::Name() const
-    {
-    return TPtrC( *iName );
-    }
-
-
-EXPORT_C void CMemSpyEngineGenericKernelObjectList::OutputL( CMemSpyEngineOutputSink& aSink ) const
-    {
-    // Start marker
-    aSink.OutputLineFormattedL( KMemSpyMarkerKernelContainer, &KNullDesC, iType );
-
-    TBuf<70> itemPrefix;
-    TBuf<KMaxFullName + 128> buf;
-    const TInt entryCount = Count();
-    const TInt64 size( iSize * entryCount );
-    const TMemSpySizeText sizeText( MemSpyEngineUtils::FormatSizeText( size, 0 ) );
-    //    
-    _LIT(KContainerTitle, "CONTAINER \'%S\' => %d item(s), %S");
-    const TPtrC pType( TypeAsString( iType ) );
-    buf.Format(KContainerTitle, &pType, entryCount, &sizeText);
-    aSink.OutputSectionHeadingL( buf, '=' );
-    //
-    for( TInt entryIndex=0; entryIndex<entryCount; entryIndex++ )
-        {
-        const TMemSpyDriverHandleInfoGeneric& entry = At( entryIndex );
-        //
-        _LIT( KItemPrefixFormat, "[KernCont] {%04d} 0x%08x" );
-        itemPrefix.Format( KItemPrefixFormat, entryIndex, entry.iHandle );
-
-        buf.Copy( entry.iName );
-
-        aSink.OutputItemAndValueL( itemPrefix, buf );
-        }
-
-    // End marker
-    aSink.OutputBlankLineL();
-    aSink.OutputLineFormattedL( KMemSpyMarkerKernelContainer, &KMemSpySinkTagClose, iType );
-    aSink.OutputBlankLineL();
-    }
-
-
-TAny* CMemSpyEngineGenericKernelObjectList::HandleAt( TInt aIndex ) const
-    {
-    return iHandles[ aIndex ];
-    }
-
-
-void CMemSpyEngineGenericKernelObjectList::AddItemL( TAny* aHandle )
-    {
-    iHandles.InsertInAddressOrderL( aHandle );
-    }
-
-
-void CMemSpyEngineGenericKernelObjectList::AddItemL( const TMemSpyDriverHandleInfoGeneric& aItem )
-    {
-    AddItemL( aItem.iHandle );
-    iItems.AppendL( aItem );
-    //
-    //UpdateNameL();
-    }
-
-
-void CMemSpyEngineGenericKernelObjectList::UpdateNameL()
-    {
-    const TInt count = iItems.Count();
-    const TInt64 size( iSize * count );
-    const TMemSpySizeText sizeText( MemSpyEngineUtils::FormatSizeText( size, 0 ) );
-    //
-    _LIT(KNameFormat, "\t%S\t\t%d item");
-    TPtr pName( iName->Des() );
-    //
-    const TPtrC pType( TypeAsString( iType ) );
-    //
-    pName.Format( KNameFormat, &pType, count );
-    //
-    if  ( count == 0 || count > 1 )
-        {
-        pName.Append( _L("s") );
-        }
-
-    pName.AppendFormat( _L(", %S"), &sizeText );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineGenericKernelObjectContainer::CMemSpyEngineGenericKernelObjectContainer()
-:   iItems( 25 )
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineGenericKernelObjectContainer::~CMemSpyEngineGenericKernelObjectContainer()
-    {
-    iItems.ResetAndDestroy();
-    iItems.Close();
-    }
-
-
-void CMemSpyEngineGenericKernelObjectContainer::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineGenericKernelObjectContainer* CMemSpyEngineGenericKernelObjectContainer::NewLC()
-    {
-    CMemSpyEngineGenericKernelObjectContainer* self = new(ELeave) CMemSpyEngineGenericKernelObjectContainer();
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineGenericKernelObjectContainer::Count() const
-    {
-    return iItems.Count();
-    }
-
-
-EXPORT_C const CMemSpyEngineGenericKernelObjectList& CMemSpyEngineGenericKernelObjectContainer::At( TInt aIndex ) const
-    {
-    return *iItems[ aIndex ];
-    }
-
-
-EXPORT_C void CMemSpyEngineGenericKernelObjectContainer::OutputL( CMemSpyEngineOutputSink& aSink ) const
-    {
-    // Start marker
-    aSink.OutputLineFormattedL( KMemSpyMarkerKernelContainersAll, &KNullDesC );
-
-    const TInt listCount= Count();
-    for( TInt listIndex=0; listIndex<listCount; listIndex++ )
-        {
-        const CMemSpyEngineGenericKernelObjectList& list = At( listIndex );
-        list.OutputL( aSink );
-        }
-
-    // End marker
-    aSink.OutputLineFormattedL( KMemSpyMarkerKernelContainersAll, &KMemSpySinkTagClose );
-    }
-
-
-void CMemSpyEngineGenericKernelObjectContainer::AddListL( CMemSpyEngineGenericKernelObjectList* aList )
-    {
-    iItems.AppendL( aList );
-    }
-
-
-EXPORT_C TInt CMemSpyEngineGenericKernelObjectContainer::MdcaCount() const
-    {
-    return Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineGenericKernelObjectContainer::MdcaPoint( TInt aIndex ) const
-    {
-    const CMemSpyEngineGenericKernelObjectList& item = At( aIndex );
-    return item.Name();
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperProcess.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,289 +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 <memspy/engine/memspyenginehelperprocess.h>
-
-// System includes
-#include <e32debug.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyenginemidwife.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include <memspy/engine/memspyenginehelperthread.h>
-#include <memspy/engine/memspyengineprocessmemorytracker.h>
-
-
-
-CMemSpyEngineHelperProcess::CMemSpyEngineHelperProcess( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperProcess::~CMemSpyEngineHelperProcess()
-    {
-    delete iUndertaker;
-    iEngine.Midwife().RemoveObserver( *this );
-    //
-    iMemoryTrackers.ResetAndDestroy();
-    iMemoryTrackers.Close();
-    iMemoryTrackerAutoStartProcessList.Close();
-    }
-
-
-void CMemSpyEngineHelperProcess::ConstructL()
-    {
-    iUndertaker = CMemSpyEngineUndertaker::NewL( iEngine.Driver() );
-    iUndertaker->AddObserverL( *this );
-    iEngine.Midwife().AddObserverL( *this );
-    }
-
-
-CMemSpyEngineHelperProcess* CMemSpyEngineHelperProcess::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperProcess* self = new(ELeave) CMemSpyEngineHelperProcess( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperProcess::ImpersonateL( TUint32 aSID )
-    {
-    const TInt err = iEngine.Driver().Impersonate( aSID );
-    User::LeaveIfError( err );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperProcess::OutputProcessInfoL( const CMemSpyProcess& aProcess )
-    {
-    OutputProcessInfoL( aProcess, EFalse );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperProcess::OutputProcessInfoDetailedL( const CMemSpyProcess& aProcess )
-    {
-    OutputProcessInfoL( aProcess, ETrue );
-    }
-
-
-void CMemSpyEngineHelperProcess::OutputProcessInfoL( const CMemSpyProcess& aProcess, TBool aDetailed )
-    {
-    const TUint pid = aProcess.Id();
-    const TUint sid = aProcess.SID();
-    RProcess process;
-    User::LeaveIfError( iEngine.Driver().OpenProcess( pid, process ) );
-    CleanupClosePushL( process );
-
-    const TPtrC procName( aProcess.Name() );
-    TBuf<512> infoBuf;
-    //
-    _LIT(KProcessInfo, "SUMMARY FOR PROCESS \'%S\'");
-    infoBuf.Format(KProcessInfo, &procName);
-    iEngine.Sink().OutputSectionHeadingL( infoBuf, '=' );
-   
-    _LIT(KProcessId, "Id");
-    iEngine.Sink().OutputItemAndValueL( KProcessId, pid );
-
-    _LIT(KProcessPri, "Priority");
-    TBuf<30> priority;
-    const TProcessPriority procPriValue = process.Priority();
-    CMemSpyProcess::AppendPriority( priority, procPriValue );
-    iEngine.Sink().OutputItemAndValueL( KProcessPri, priority );
-
-    _LIT(KProcessSID, "SID");
-    iEngine.Sink().OutputItemAndValueL( KProcessSID, sid, ETrue );
-    CleanupStack::PopAndDestroy( &process );
-
-    if  ( aDetailed )
-        {
-        iEngine.ProcessSuspendLC( pid );
-        iEngine.HelperChunk().OutputChunkInfoForProcessL( aProcess );
-        iEngine.HelperCodeSegment().OutputCodeSegmentsL( pid, infoBuf, KNullDesC, '-', ETrue );
-        CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-        }
-
-    const TInt count = aProcess.Count();
-    for(TInt i=0; i<count; i++)
-        {
-        const CMemSpyThread& thread = aProcess.At( i );
-        iEngine.HelperThread().OutputThreadInfoL( thread, aDetailed );
-        }
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperProcess::SetMemoryTrackingAutoStartProcessListL( const RArray<TUid>& aProcessUids )
-    {
-    iEngine.Driver().ProcessInspectionAutoStartItemsReset();
-    //
-    const TInt count = aProcessUids.Count();
-    iMemoryTrackerAutoStartProcessList.Reset();
-    //
-    for( TInt i=0; i<count; i++ )
-        {
-        const TUid uid = aProcessUids[ i ];
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyEngineHelperProcess::SetMemoryTrackingAutoStartProcessListL() - uid[%2d] => 0x%08x", i, uid.iUid );
-#endif
-        //
-        User::LeaveIfError( iMemoryTrackerAutoStartProcessList.Append( uid ) );
-        //
-        const TInt driverErr = iEngine.Driver().ProcessInspectionAutoStartItemsAdd( uid.iUid );
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyEngineHelperProcess::SetMemoryTrackingAutoStartProcessListL() - driver err: %d", driverErr );
-#endif
-        User::LeaveIfError( driverErr );
-        }
-    }
-
-
-CMemSpyEngineProcessMemoryTracker* CMemSpyEngineHelperProcess::TrackerOrNull( const TProcessId& aId )
-    {
-    CMemSpyEngineProcessMemoryTracker* ret = NULL;
-    //
-    const TInt count = iMemoryTrackers.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        CMemSpyEngineProcessMemoryTracker* tracker = iMemoryTrackers[ i ];
-        //
-        if ( tracker->ProcessId() == aId )
-            {
-            ret = tracker;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-    
-
-CMemSpyEngineProcessMemoryTracker& CMemSpyEngineHelperProcess::TrackerL( const TProcessId& aId )
-    {
-    CMemSpyEngineProcessMemoryTracker* tracker = TrackerOrNull( aId );
-    //
-    if  ( tracker == NULL )
-        {
-        // Make a new entry
-        tracker = CMemSpyEngineProcessMemoryTracker::NewLC( iEngine, aId );
-        User::LeaveIfError( iMemoryTrackers.Append( tracker ) );
-        CleanupStack::Pop( tracker );
-        }
-    //
-    return *tracker;
-    }
-
-
-CMemSpyEngineProcessMemoryTracker& CMemSpyEngineHelperProcess::TrackerL( const CMemSpyProcess& aProcess )
-    {
-    return TrackerL( aProcess.Id() );
-    }
-
-
-void CMemSpyEngineHelperProcess::ThreadIsBornL( const TThreadId& aId, const RThread& aThread )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineHelperProcess::ThreadIsBornL() - aId: 0x%08x, aThread handle: 0x%08x", (TUint) aId, aThread.Handle() );
-#else
-    (void) aId;
-    (void) aThread;
-#endif
-    }
-
-
-void CMemSpyEngineHelperProcess::ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineHelperProcess::ProcessIsBornL() - aId: 0x%08x, aProcess handle: 0x%08x", (TUint) aId, aProcess.Handle() );
-#else
-    (void) aId;
-    (void) aProcess;
-#endif
-
-    if ( aProcess.Handle() != KNullHandle )
-        {
-        const TBool isAutoStart = IsAutoStartupProcess( aProcess.SecureId() );
-        //
-        if ( isAutoStart )
-            {
-            CMemSpyEngineProcessMemoryTracker& tracker = TrackerL( aId );
-            tracker.StartL();
-            }
-        }
-    }
-
-
-void CMemSpyEngineHelperProcess::ThreadIsDeadL( const TThreadId& aId, const RThread& aThread )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineHelperProcess::ThreadIsDeadL() - aId: 0x%08x, aThread handle: 0x%08x", (TUint) aId, aThread.Handle() );
-#else
-    (void) aId;
-    (void) aThread;
-#endif
-    }
-
-
-void CMemSpyEngineHelperProcess::ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineHelperProcess::ProcessIsDeadL() - aId: 0x%08x, aProcess handle: 0x%08x", (TUint) aId, aProcess.Handle() );
-#else
-    (void) aProcess;
-#endif
-
-    CMemSpyEngineProcessMemoryTracker* tracker = TrackerOrNull( aId );
-    if  ( tracker )
-        {
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyEngineHelperProcess::ProcessIsDeadL() - tracker for this process should take care of cleanup by itself..." );
-#endif
-        }
-    }
-    
-
-TBool CMemSpyEngineHelperProcess::IsAutoStartupProcess( TUid aUid ) const
-    {
-    TBool match = EFalse;
-    //
-    const TInt count = iMemoryTrackerAutoStartProcessList.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const TUid uid = iMemoryTrackerAutoStartProcessList[ i ];
-        if ( uid == aUid )
-            {
-            match = ETrue;
-            break;
-            }
-        }
-    //
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineHelperProcess::IsAutoStartupProcess() - aUid: 0x%08x, ret: %d", aUid.iUid, match );
-#endif
-    return match;
-    }
-    
-
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperRAM.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +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 <memspy/engine/memspyenginehelperram.h>
-
-// System includes
-#include <hal.h>
-#include <e32debug.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include "MemSpyEngineOutputListItem.h"
-#include <memspy/engine/memspyengineoutputsink.h>
-
-// Type defs
-typedef TInt(*TAknIconCacheConfigFunction)(TBool);
-
-// Constants
-const TInt KAknIconCacheConfigOrdinal = 44;
-
-// Literal constants
-_LIT( KMemSpyAknIconDllName, "AKNICON.DLL" );
-
-
-CMemSpyEngineHelperRAM::CMemSpyEngineHelperRAM( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperRAM::~CMemSpyEngineHelperRAM()
-    {
-    }
-
-
-void CMemSpyEngineHelperRAM::ConstructL()
-    {
-    CheckIfAknIconCacheCanBeConfiguredL();
-    }
-
-
-CMemSpyEngineHelperRAM* CMemSpyEngineHelperRAM::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperRAM* self = new(ELeave) CMemSpyEngineHelperRAM( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C TBool CMemSpyEngineHelperRAM::IsAknIconCacheConfigurable() const
-    {
-    return iIsAknIconCacheConfigurable;
-    }
-
-
-EXPORT_C TInt64 CMemSpyEngineHelperRAM::SetAknIconCacheStatusL( TBool aEnabled )
-    {
-    TInt64 ret( 0 );
-    //
-    if  ( iIsAknIconCacheConfigurable )
-        {
-        TInt freeRamBeforeOp = KErrNotFound;
-        User::LeaveIfError( HAL::Get( HALData::EMemoryRAMFree, freeRamBeforeOp ) );
-        //
-        const TInt error = SetAknIconStatus( aEnabled );
-        User::LeaveIfError( error );
-        //
-        if  ( aEnabled == EFalse )
-            {
-            // Turning cache off, check how much ram we saved...
-            TInt freeRamAfterOp = KErrNotFound;
-            User::LeaveIfError( HAL::Get( HALData::EMemoryRAMFree, freeRamAfterOp ) );
-
-            // Work out how much ram was saved... 
-            ret = ( freeRamAfterOp - freeRamBeforeOp );
-            }
-        }
-    //
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperRAM::CheckIfAknIconCacheCanBeConfiguredL()
-    {
-#ifndef __WINS__
-    RLibrary lib;
-    const TInt loadErr = lib.Load( KMemSpyAknIconDllName );
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineHelperRAM::SetAknIconStatus() - dll load: %d", loadErr );
-#endif
-    if  ( loadErr == KErrNone )
-        {
-        TLibraryFunction ordinal = lib.Lookup( KAknIconCacheConfigOrdinal );
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyEngineHelperRAM::SetAknIconStatus() - ordinal: 0x%08x", ordinal );
-#endif
-        //
-        iIsAknIconCacheConfigurable = ( ordinal != NULL );
-        lib.Close();
-        }
-#endif
-    }
-
-
-TInt CMemSpyEngineHelperRAM::SetAknIconStatus( TBool aEnabled )
-    {
-    TInt ret = KErrNotSupported;
-    //
-#ifndef __WINS__
-    RLibrary lib;
-    const TInt loadErr = lib.Load( KMemSpyAknIconDllName );
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineHelperRAM::SetAknIconStatus() - dll load: %d", loadErr );
-#endif
-    if  ( loadErr == KErrNone )
-        {
-        TLibraryFunction ordinal = lib.Lookup( KAknIconCacheConfigOrdinal );
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyEngineHelperRAM::SetAknIconStatus() - ordinal: 0x%08x", ordinal );
-#endif
-        //
-        if  ( ordinal )
-            {
-            TAknIconCacheConfigFunction func = (TAknIconCacheConfigFunction) ordinal;
-            ret = (*func)( aEnabled );
-#ifdef _DEBUG
-            RDebug::Printf( "CMemSpyEngineHelperRAM::SetAknIconStatus() - ret: %d", ret );
-#endif
-            }
-        //
-        lib.Close();
-        }
-#else
-	aEnabled = EFalse;
-#endif
-    //
-    return ret;
-    }
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperROM.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +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 <memspy/engine/memspyenginehelperrom.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include "MemSpyEngineOutputListItem.h"
-#include <memspy/engine/memspyengineoutputsink.h>
-
-
-CMemSpyEngineHelperROM::CMemSpyEngineHelperROM( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperROM::~CMemSpyEngineHelperROM()
-    {
-    delete iPlatformVersion;
-    delete iChecksum;
-    }
-
-
-void CMemSpyEngineHelperROM::ConstructL()
-    {
-    iPlatformVersion = HBufC::NewL( 128 );
-    iChecksum = HBufC::NewL( 10 );
-    //
-    TPtr pChecksum( iChecksum->Des() );
-    TPtr pPlatformVersion( iPlatformVersion->Des() );
-    //
-    MemSpyEngineUtils::GetRomInfoL( pPlatformVersion, pChecksum );
-    }
-
-
-CMemSpyEngineHelperROM* CMemSpyEngineHelperROM::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperROM* self = new(ELeave) CMemSpyEngineHelperROM( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperROM::AddInfoL( CMemSpyEngineOutputList& aList )
-    {
-    _LIT( KRomChecksum, "ROM Checksum" );
-    aList.AddItemL( KRomChecksum, *iChecksum );
-
-    _LIT( KRomVersion, "ROM Version" );
-    aList.AddItemL( KRomVersion, *iPlatformVersion );
-    }
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperServer.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,455 +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 <memspy/engine/memspyenginehelperserver.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-#include <memspy/driver/memspydriverconstants.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-
-// Literal constants
-_LIT( KMemSpyEngineServListOutputComma, ", " );
-
-
-
-CMemSpyEngineHelperServer::CMemSpyEngineHelperServer( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperServer::~CMemSpyEngineHelperServer()
-    {
-    }
-
-
-void CMemSpyEngineHelperServer::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperServer* CMemSpyEngineHelperServer::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperServer* self = new(ELeave) CMemSpyEngineHelperServer( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperServer::GetServerSessionsL( TAny* aServerHandle, RArray<TMemSpyDriverServerSessionInfo>& aSessions )
-    {
-	const TInt KMaxCount = 256;
-	TAny* handles[KMaxCount];
-	TInt c = KMaxCount;
-
-	TInt r = iEngine.Driver().GetServerSessionHandles( aServerHandle, handles, c );
-	if  ( r == KErrNone )
-    	{
-        if  ( c > 0 )
-            {
-        	if (c > KMaxCount)
-        		{
-        		c = KMaxCount;
-        		}
-
-        	TMemSpyDriverServerSessionInfo info;
-        	for (TInt i=0; i<c; i++)
-        		{
-        		r = iEngine.Driver().GetServerSessionInfo( handles[i], info );
-        		if (r == KErrNone)
-        			{
-        			aSessions.AppendL( info );
-        			}
-        		}
-            }
-        }
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperServer::GetServerSessionsL( const TMemSpyDriverHandleInfoGeneric& aServerDetails, RArray<TMemSpyDriverServerSessionInfo>& aSessions )
-    {
-    GetServerSessionsL( aServerDetails.iHandle, aSessions );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperServer::GetServerListL( RArray<TMemSpyDriverHandleInfoGeneric>& aServers )
-    {
-	const TInt KMaxCount = 256;
-	TAny* handles[KMaxCount];
-	TInt c = KMaxCount;
-
-	TInt r = iEngine.Driver().GetContainerHandles( EMemSpyDriverContainerTypeServer, handles, c );
-	if  ( r == KErrNone )
-    	{
-        if  ( c > 0 )
-            {
-        	if (c > KMaxCount)
-        		{
-        		c = KMaxCount;
-        		}
-
-        	TMemSpyDriverHandleInfoGeneric info;
-        	for (TInt i=0; i<c; i++)
-        		{
-        		r = iEngine.Driver().GetGenericHandleInfo( KMemSpyDriverEnumerateContainerHandles, EMemSpyDriverContainerTypeServer, handles[i], info );
-        		if (r == KErrNone)
-        			{
-        			aServers.AppendL( info );
-        			}
-        		}
-            }
-        }
-    }
-
-
-EXPORT_C CMemSpyEngineServerList* CMemSpyEngineHelperServer::ServerListL()
-    {
-    CMemSpyEngineServerList* list = CMemSpyEngineServerList::NewLC();
-    //
-    RArray<TMemSpyDriverHandleInfoGeneric> servers;
-    CleanupClosePushL( servers );
-    //
-    GetServerListL( servers );
-    //
-    const TInt count = servers.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const TMemSpyDriverHandleInfoGeneric& details = servers[ i ];
-        //
-        CMemSpyEngineServerEntry* serverEntry = CMemSpyEngineServerEntry::NewLC( details );
-        list->AddItemL( serverEntry );
-        CleanupStack::Pop( serverEntry );
-        }
-    //
-    CleanupStack::PopAndDestroy( &servers );
-
-    // Sort the list by session count
-    list->SortBySessionCountL();
-
-    // Done
-    CleanupStack::Pop( list );
-    return list;
-    }
-
-
-CMemSpyEngine& CMemSpyEngineHelperServer::Engine() const
-    {
-    return iEngine;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineServerList::CMemSpyEngineServerList()
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineServerList::~CMemSpyEngineServerList()
-    {
-    iItems.ResetAndDestroy();
-    iItems.Close();
-    }
-
-
-void CMemSpyEngineServerList::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineServerList* CMemSpyEngineServerList::NewLC()
-    {
-    CMemSpyEngineServerList* self = new(ELeave) CMemSpyEngineServerList();
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineServerList::Count() const
-    {
-    return iItems.Count();
-    }
-
-
-EXPORT_C const CMemSpyEngineServerEntry& CMemSpyEngineServerList::At( TInt aIndex ) const
-    {
-    return *iItems[ aIndex ];
-    }
-
-
-EXPORT_C void CMemSpyEngineServerList::SortByNameL()
-    {
-    TLinearOrder< CMemSpyEngineServerEntry > comparer( CompareByName );
-    iItems.Sort( comparer );
-    }
-
-
-EXPORT_C void CMemSpyEngineServerList::SortBySessionCountL()
-    {
-    TLinearOrder< CMemSpyEngineServerEntry > comparer( CompareBySessionCount );
-    iItems.Sort( comparer );
-    }
-
-
-EXPORT_C TInt CMemSpyEngineServerList::ItemIndex( const CMemSpyEngineServerEntry& aEntry ) const
-    {
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineServerEntry* item = iItems[ i ];
-        //
-        if  ( item == &aEntry )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C void CMemSpyEngineServerList::OutputDataColumnsL( CMemSpyEngine& aEngine, TBool aClientThreadColumns )
-    {
-    HBufC* columns = HBufC::NewLC( 1024 );
-    TPtr pColumns( columns->Des() );
-    //
-    _LIT(KCol1, "Thread/Process Id");
-    pColumns.Append( KCol1 );
-    pColumns.Append( KMemSpyEngineServListOutputComma );
-    //
-    _LIT(KCol2, "Name");
-    pColumns.Append( KCol2 );
-    pColumns.Append( KMemSpyEngineServListOutputComma );
-    //
-    _LIT(KCol3, "Connected Session Count");
-    pColumns.Append( KCol3 );
-    //
-    if  ( aClientThreadColumns )
-        {
-        _LIT(KCol4, "Connected Client");
-        pColumns.Append( KMemSpyEngineServListOutputComma );
-        pColumns.Append( KCol4 );
-        }
-    //
-    aEngine.Sink().OutputLineL( pColumns );
-    CleanupStack::PopAndDestroy( columns );
-    }
-
-
-void CMemSpyEngineServerList::AddItemL( CMemSpyEngineServerEntry* aItem )
-    {
-    iItems.AppendL( aItem );
-    }
-
-
-EXPORT_C TInt CMemSpyEngineServerList::MdcaCount() const
-    {
-    return Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineServerList::MdcaPoint( TInt aIndex ) const
-    {
-    const CMemSpyEngineServerEntry& item = At( aIndex );
-    return TPtrC( item.Caption() );
-    }
-
-
-TInt CMemSpyEngineServerList::CompareByName( const CMemSpyEngineServerEntry& aLeft, const CMemSpyEngineServerEntry& aRight )
-    {
-    const TInt ret = aLeft.Name().CompareF( aRight.Name() );
-    return ret;
-    }
-
-
-TInt CMemSpyEngineServerList::CompareBySessionCount( const CMemSpyEngineServerEntry& aLeft, const CMemSpyEngineServerEntry& aRight )
-    {
-    TInt ret = -1;
-    //
-    if  ( aLeft.SessionCount() < aRight.SessionCount() )
-        {
-        ret = 1;
-        }
-    else if ( aLeft.SessionCount() == aRight.SessionCount() )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineServerEntry::CMemSpyEngineServerEntry()
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineServerEntry::~CMemSpyEngineServerEntry()
-    {
-    delete iCaption;
-    delete iName;
-    }
-
-
-void CMemSpyEngineServerEntry::ConstructL( const TMemSpyDriverHandleInfoGeneric& aInfo )
-    {
-    iName = HBufC::NewL( aInfo.iName.Length() );
-    iName->Des().Copy( aInfo.iName );
-    iSessionCount = aInfo.iCount;
-    iId = aInfo.iId;
-    iHandle = aInfo.iHandle;
-
-    // Make caption
-    _LIT(KServerListFormat, "\t%S\t\t%d session");
-    TBuf<KMaxFullName + 128> item;
-    //
-    item.Format( KServerListFormat, iName, iSessionCount );
-    //
-    if  ( iSessionCount != 1 )
-        {
-        // Add missing 's' 
-        item.Append( TChar('s') );
-        }
-    //
-    iCaption = item.AllocL();
-    }
-
-
-CMemSpyEngineServerEntry* CMemSpyEngineServerEntry::NewLC( const TMemSpyDriverHandleInfoGeneric& aInfo )
-    {
-    CMemSpyEngineServerEntry* self = new(ELeave) CMemSpyEngineServerEntry();
-    CleanupStack::PushL( self );
-    self->ConstructL( aInfo );
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyEngineServerEntry::OutputDataL( CMemSpyEngineHelperServer& aHelper, TBool aClientThreadColumns ) const
-    {
-    _LIT(KMemSpyEngineServListOutputDecimal, "%d");
-    _LIT(KMemSpyEngineServListOutputString, "%S");
-    //
-    HBufC* columns = HBufC::NewLC( 1024 );
-    TPtr pColumns( columns->Des() );
-    //
-    pColumns.AppendFormat( KMemSpyEngineServListOutputDecimal, Id() );
-    pColumns.Append( KMemSpyEngineServListOutputComma );
-    //
-    pColumns.AppendFormat( KMemSpyEngineServListOutputString, &Name() );
-    pColumns.Append( KMemSpyEngineServListOutputComma );
-    //
-    pColumns.AppendFormat( KMemSpyEngineServListOutputDecimal, SessionCount() );
-    //
-    aHelper.Engine().Sink().OutputLineL( pColumns );
-
-    if  ( aClientThreadColumns )
-        {
-        RArray<TMemSpyDriverServerSessionInfo> sessions;
-        CleanupClosePushL( sessions );
-
-        // Get the sessions
-        GetSessionsL( aHelper, sessions );
-
-        // Output an additional line per entry
-        const TInt count = sessions.Count();
-        for( TInt i=0; i<count; i++ )
-            {
-            const TMemSpyDriverServerSessionInfo& session = sessions[ i ];
-            //
-            pColumns.Copy( session.iName );
-            pColumns.Insert( 0, KMemSpyEngineServListOutputComma );
-            pColumns.Insert( 0, KMemSpyEngineServListOutputComma );
-            pColumns.Insert( 0, KMemSpyEngineServListOutputComma );
-            //
-            aHelper.Engine().Sink().OutputLineL( pColumns );
-            }
-        //
-        CleanupStack::PopAndDestroy( &sessions );
-        }
-
-    CleanupStack::PopAndDestroy( columns );
-    }
-
-
-EXPORT_C void CMemSpyEngineServerEntry::GetSessionsL( CMemSpyEngineHelperServer& aHelper, RArray<TMemSpyDriverServerSessionInfo>& aSessions ) const
-    {
-    aHelper.GetServerSessionsL( Handle(), aSessions );
-    }
-
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperStack.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,407 +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 <memspy/engine/memspyenginehelperstack.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include "MemSpyEngineOutputListItem.h"
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-
-// Literal constants
-_LIT( KMemSpyPrefixStackData, "StackData - %S - " );
-_LIT( KMemSpyMarkerStackData, "<%SMEMSPY_STACK_DATA_%03d>" );
-
-
-CMemSpyEngineHelperStack::CMemSpyEngineHelperStack( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperStack::~CMemSpyEngineHelperStack()
-    {
-    }
-
-
-void CMemSpyEngineHelperStack::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperStack* CMemSpyEngineHelperStack::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperStack* self = new(ELeave) CMemSpyEngineHelperStack( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperStack::OutputStackInfoL( const CMemSpyThread& aThread )
-    {
-    const TFullName pName( aThread.FullName() );
-    //
-    _LIT(KHeader, "STACK INFO FOR THREAD '%S'");
-    TBuf<KMaxFullName + 100> printFormat;
-    printFormat.Format( KHeader, &pName );
-    iEngine.Sink().OutputSectionHeadingL( printFormat, '=' );
-
-    OutputStackInfoL( aThread.Process().Id(), aThread.Id(), printFormat );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperStack::OutputStackInfoL( TProcessId aPid, TThreadId aTid, TDes& aLineBuffer )
-    {
-    TMemSpyDriverStackInfo info;
-    //
-    iEngine.ProcessSuspendLC( aPid );
-    const TInt r = iEngine.Driver().GetStackInfo( aTid, info );
-    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-    //
-    if  ( r == KErrNone )
-        {
-        CMemSpyEngineOutputList* list = CMemSpyEngineOutputList::NewLC( iEngine.Sink() );
-
-        {
-        // Header - user stack
-        list->AddItemL( _L("USER STACK") );
-        list->AddUnderlineForPreviousItemL();
-
-        // Summary
-        list->AddItemFormatL( _L("Address range"), _L("0x%08x - 0x%08x (%8d)"), info.iUserStackBase, info.iUserStackBase + info.iUserStackSize, info.iUserStackSize );
-        list->AddItemHexL( _L("Current stack pointer"), info.iUserStackPointer );
-
-        // Calculate usage
-        const TInt usedUserStack = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackPointer;
-        const TInt userStackUsagePct = (TInt) (( (TReal) usedUserStack / (TReal) info.iUserStackSize) * 100.0);
-        aLineBuffer.Format(_L("%d (%3d"), usedUserStack, userStackUsagePct);
-        aLineBuffer.Append(_L(" pct)"));
-        list->AddItemL( _L("Stack usage"), aLineBuffer );
-
-        // High watermark
-        list->AddItemHexL( _L("High watermark"), info.iUserStackHighWatermark );
-        const TInt userHighWaterMarkUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackHighWatermark;
-        const TInt userStackHighWaterMarkUsagePct = (TInt) (( (TReal) userHighWaterMarkUsage / (TReal) info.iUserStackSize) * 100.0);
-        aLineBuffer.Format(_L("%d (%3d"), userHighWaterMarkUsage, userStackHighWaterMarkUsagePct);
-        aLineBuffer.Append(_L(" pct)"));
-        list->AddItemL( _L("High watermark usage"), aLineBuffer );
-        }
-
-
-        {
-        // Header - supervisor stack
-        list->AddItemL( _L("SUPERVISOR STACK") );
-        list->AddUnderlineForPreviousItemL();
-
-        // Summary
-        list->AddItemFormatL( _L("Address range"), _L("0x%08x - 0x%08x (%8d)"), info.iSupervisorStackBase, info.iSupervisorStackBase + info.iSupervisorStackSize, info.iSupervisorStackSize );
-        list->AddItemHexL( _L("Current stack pointer"), info.iSupervisorStackPointer );
-
-        // Calculate usage
-        const TInt usedSupervisorStack = (TInt) ( info.iSupervisorStackBase + info.iSupervisorStackSize ) - info.iSupervisorStackPointer;
-        const TInt supervisorStackUsagePct = (TInt) (( (TReal) usedSupervisorStack / (TReal) info.iSupervisorStackSize) * 100.0);
-        aLineBuffer.Format(_L("%d (%3d"), usedSupervisorStack, supervisorStackUsagePct );
-        aLineBuffer.Append(_L(" pct)"));
-        list->AddItemL( _L("Stack usage"), aLineBuffer );
-
-        // High watermark
-        list->AddItemHexL( _L("High watermark"), info.iSupervisorStackHighWatermark );
-        const TInt supervisorStackHighWaterMarkUsage = (TInt) ( info.iSupervisorStackBase + info.iSupervisorStackSize ) - info.iSupervisorStackHighWatermark;
-        const TInt supervisorStackHighWaterMarkUsagePct = (TInt) (( (TReal) supervisorStackHighWaterMarkUsage / (TReal) info.iSupervisorStackSize) * 100.0);
-        aLineBuffer.Format(_L("%d (%3d"), supervisorStackHighWaterMarkUsage, supervisorStackHighWaterMarkUsagePct );
-        aLineBuffer.Append(_L(" pct)"));
-        list->AddItemL( _L("High watermark usage"), aLineBuffer );
-        }
-
-        list->PrintL();
-        CleanupStack::PopAndDestroy( list );
-        }
-
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperStack::OutputStackDataL( const CMemSpyThread& aThread, TMemSpyDriverDomainType aType )
-    {
-    OutputStackDataL( aThread, aType, ETrue );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperStack::OutputStackDataL( const CMemSpyThread& aThread, TMemSpyDriverDomainType aType, TBool aEntireStack )
-    {
-    TBuf<KMaxFullName + 100> printFormat;
-    printFormat = aThread.FullName();
-
-    // Begin a new data stream
-    _LIT( KMemSpyFolder, "Stack" );
-    HBufC* context = HBufC::NewLC( KMaxFileName );
-    TPtr pContext( context->Des() );
-    if  ( aType == EMemSpyDriverDomainUser )
-        {
-        _LIT(KMemSpyContext, "Data (User) - %S");
-        pContext.Format( KMemSpyContext, &printFormat );
-        }
-    else if ( aType == EMemSpyDriverDomainKernel )
-        {
-        _LIT(KMemSpyContext, "Data (Supervisor) - %S");
-        pContext.Format( KMemSpyContext, &printFormat );
-        }
-    iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder );
-    CleanupStack::PopAndDestroy( context );
-
-    // Suspend all threads in the process
-    iEngine.ProcessSuspendLC( aThread.Process().Id() );
-
-    // Start marker
-    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerStackData, &KNullDesC, (TUint) aThread.Id() );
-
-    // Set overall prefix
-    iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixStackData, &printFormat );
-
-    // Prepare data buffer
-    HBufC8* data = HBufC8::NewLC( 4096 * 4 );
-    TPtr8 pData(data->Des());
-    TUint remaining = 0;
-
-    TMemSpyDriverStackInfo info;
-    TInt r = iEngine.Driver().GetStackInfo( aThread.Id(), info );
-    if  ( r == KErrNone )
-        {
-        TUint spAddress = 0;
-        if  ( aType == EMemSpyDriverDomainUser )
-            {
-            _LIT(KHeaderUser, "USER STACK DATA");
-            iEngine.Sink().OutputSectionHeadingL(KHeaderUser, '-');
-            spAddress = info.iUserStackPointer;
-            }
-        else if ( aType == EMemSpyDriverDomainKernel )
-            {
-            _LIT(KHeaderKernel, "SUPERVISOR STACK DATA");
-            iEngine.Sink().OutputSectionHeadingL(KHeaderKernel, '-');
-            spAddress = info.iSupervisorStackPointer;
-            }
-
-        // Print header information
-        // ========================
-        TBuf<240> buf;
-
-        // Stack pointer
-        _LIT( KLine1, "Current stack pointer: 0x%08x");
-        buf.Format( KLine1, spAddress );
-        iEngine.Sink().OutputLineL( buf );
-
-        // Stack address range
-        _LIT( KLine2, "Stack address range:   0x%08x - 0x%08x");
-        if  ( aType == EMemSpyDriverDomainUser )
-            {
-            buf.Format( KLine2, info.iUserStackBase, info.iUserStackBase + info.iUserStackSize );
-            }
-        else
-            {
-            buf.Format( KLine2, info.iSupervisorStackBase, info.iSupervisorStackBase + info.iSupervisorStackSize );
-            }
-        iEngine.Sink().OutputLineL( buf );
-
-        // Stack size
-        _LIT( KLine3, "Stack size:              %d");
-        buf.Format( KLine3, ( aType == EMemSpyDriverDomainUser ) ? info.iUserStackSize : info.iSupervisorStackSize );
-        iEngine.Sink().OutputLineL( buf );
-        iEngine.Sink().OutputBlankLineL();
-
-        // If we are only fetching the 'current' part of the stack, then we need to maniuplate the
-        // printing address used to display the stack content
-        if  ( !aEntireStack )
-            {
-            // We start at the stack pointer address and work towards the end of the stack.
-            info.iUserStackBase = spAddress;
-            }
-
-        // Code segments (needed for map file reading...)
-        _LIT(KCodeSegInfoPrefix, "CodeSeg - ");
-        iEngine.HelperCodeSegment().OutputCodeSegmentsL( aThread.Process().Id(), printFormat, KCodeSegInfoPrefix );
-        
-        // Get the stack data
-        // ==================
-        _LIT(KStackDataPrefix, "%S");
-        r = iEngine.Driver().GetStackData( aThread.Id(), pData, remaining, aType, aEntireStack );
-
-        if  ( r == KErrNone )
-            {
-            while ( r == KErrNone )
-                {
-                iEngine.Sink().OutputBinaryDataL( KStackDataPrefix, pData.Ptr(), (const TUint8*) info.iUserStackBase, pData.Length() );
-                //
-                if  ( remaining > 0 )
-                    {
-                    info.iUserStackBase += pData.Length();
-                    r = iEngine.Driver().GetStackDataNext( aThread.Id(), pData, remaining, aType, aEntireStack );
-                    }
-                else
-                    {
-                    break;
-                    }
-                }
-            }
-
-        }
-    CleanupStack::PopAndDestroy( data );
-
-    CleanupStack::PopAndDestroy(); // clear prefix
-    CleanupStack::PopAndDestroy(); // resume process
-
-    // End marker
-    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerStackData, &KMemSpySinkTagClose, (TUint) aThread.Id() );
-    iEngine.Sink().DataStreamEndL();
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperStack::OutputStackInfoForDeviceL()
-    {
-    const TInt count = iEngine.Container().Count();
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-    //
-    _LIT( KMemSpyContext, "Stack" );
-    _LIT( KMemSpyFolder, "Device-Wide" );
-    _LIT( KMemSpyExtension, ".csv" );
-    iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder, KMemSpyExtension );
-
-    // Set overall prefix
-    _LIT(KOverallPrefix, "[Stack Summary]");
-    iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
-
-    _LIT(KListingHeader, "Thread, US. Base Address, US. Size, US. Addr, US. Usage, US. Usage Pct, US. HWM Addr, US. HWM Usage, US. HWM Usage Pct, SS. Base Address, SS. Size, SS. Addr, SS. Usage, SS. Usage Pct., SS. HWM Addr, SS. HWM Usage, SS. HWM Usage Pct");
-    iEngine.Sink().OutputBlankLineL();
-    iEngine.Sink().OutputLineL(KListingHeader);
-    
-    for(TInt ii=0; ii<count; ii++)
-        {
-        const CMemSpyProcess& process = iEngine.Container().At( ii );
-        const TPtrC procName( process.Name() );
-        //
-        if  ( iEngine.ProcessSuspendAndGetErrorLC( process.Id() ) == KErrNone )
-            {
-            TMemSpyDriverStackInfo info;
-            const TInt threadCount = process.Count();
-            //
-            for(TInt j=0; j<threadCount; j++)
-                {
-                const CMemSpyThread& thread = process.At( j );
-                const TPtrC threadName(thread.Name());
-
-                const TInt error = iEngine.Driver().GetStackInfo( thread.Id(), info );
-                if  ( error == KErrNone )
-                    {
-                    const TInt userStackUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackPointer;
-                    const TInt userStackUsagePct = (TInt) (( (TReal) userStackUsage / (TReal) info.iUserStackSize) * 100.0);
-                    const TInt userStackHighWaterMarkUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackHighWatermark;
-                    const TInt userStackHighWaterMarkUsagePct = (TInt) (( (TReal) userStackHighWaterMarkUsage / (TReal) info.iUserStackSize) * 100.0);
-                    const TInt supervisorStackUsage = (TInt) ( info.iSupervisorStackBase + info.iSupervisorStackSize ) - info.iSupervisorStackPointer;
-                    const TInt supervisorStackUsagePct = (TInt) (( (TReal) supervisorStackUsage / (TReal) info.iSupervisorStackSize) * 100.0);
-                    const TInt supervisorStackHighWaterMarkUsage = (TInt) ( info.iSupervisorStackBase + info.iSupervisorStackSize ) - info.iSupervisorStackHighWatermark;
-                    const TInt supervisorStackHighWaterMarkUsagePct = (TInt) (( (TReal) supervisorStackHighWaterMarkUsage / (TReal) info.iSupervisorStackSize) * 100.0);
-
-                    _LIT(KFormat, "%S::%S, 0x%08x, %8d, 0x%08x, %8d, %8d, 0x%08x, %8d, %8d, 0x%08x, %8d, 0x%08x, %8d, %8d, 0x%08x, %8d, %8d");
-                    pBuf.Format(  KFormat, &procName, &threadName, 
-                                 info.iUserStackBase, 
-                                 info.iUserStackSize, 
-                                 info.iUserStackPointer, 
-                                 userStackUsage,
-                                 userStackUsagePct,
-                                 info.iUserStackHighWatermark,
-                                 userStackHighWaterMarkUsage,
-                                 userStackHighWaterMarkUsagePct,
-                                 info.iSupervisorStackBase,
-                                 info.iSupervisorStackSize,
-                                 info.iSupervisorStackPointer,
-                                 supervisorStackUsage,
-                                 supervisorStackUsagePct,
-                                 info.iSupervisorStackHighWatermark,
-                                 supervisorStackHighWaterMarkUsage,
-                                 supervisorStackHighWaterMarkUsagePct
-                                 );
-                    iEngine.Sink().OutputLineL( pBuf );
-                    }
-                }
-            }
-        
-        CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-        }
-
-    CleanupStack::PopAndDestroy(); // clear prefix
-
-    CleanupStack::PopAndDestroy( buf );
-
-    _LIT(KEndOfHeapListing, "<= End Stack Summary =>");
-    iEngine.Sink().OutputLineL( KEndOfHeapListing );
-
-    iEngine.Sink().DataStreamEndL();
-    }
-
-
-EXPORT_C TInt CMemSpyEngineHelperStack::CalculateStackSizes( const CMemSpyProcess& aProcess )
-    {
-    TInt ret = 0;
-    //
-    TRAPD( error, ret = CalculateStackSizesL( aProcess ) );
-    //
-    if ( error != KErrNone )
-        {
-        ret = error;
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineHelperStack::CalculateStackSizesL( const CMemSpyProcess& aProcess )
-    {
-	TInt ret = 0;
-	//
-    iEngine.ProcessSuspendLC( aProcess.Id() );
-
-    TMemSpyDriverStackInfo info;
-    //
-    const TInt threadCount = aProcess.Count();
-    for( TInt i=0; i<threadCount; i++ )
-        {
-        const CMemSpyThread& thread = aProcess.At( i );
-        //
-        TInt r = iEngine.Driver().GetStackInfo( thread.Id(), info );
-        if  ( r == KErrNone )
-            {
-            ret += info.iUserStackSize;
-            ret += info.iSupervisorStackSize;
-            }
-        }
-    //
-    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-	return ret;
-    }
-
-
-
--- a/memspy/Engine/Source/Helpers/MemSpyEngineHelperThread.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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 <memspy/engine/memspyenginehelperthread.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-
-
-
-CMemSpyEngineHelperThread::CMemSpyEngineHelperThread( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperThread::~CMemSpyEngineHelperThread()
-    {
-    }
-
-
-void CMemSpyEngineHelperThread::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperThread* CMemSpyEngineHelperThread::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperThread* self = new(ELeave) CMemSpyEngineHelperThread( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperThread::OutputThreadInfoL( const CMemSpyThread& aThread, TBool aDetailed )
-    {
-    CMemSpyThreadInfoContainer* container = CMemSpyThreadInfoContainer::NewLC( const_cast< CMemSpyThread& >( aThread ), EMemSpyThreadInfoItemTypeGeneralInfo );
-
-    if  ( aDetailed )
-        {
-        container->AddItemL( EMemSpyThreadInfoItemTypeStack );
-        }
-
-    container->PrintL();
-    CleanupStack::PopAndDestroy( container );
-    }
--- a/memspy/Engine/Source/MemSpyEngine.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,306 +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 <memspy/engine/memspyengine.h>
-
-// System includes
-#include <e32debug.h>
-
-// User includes
-#include <memspy/engine/memspyengineimp.h>
-
-
-CMemSpyEngine::CMemSpyEngine()
-    {
-    }
-
-
-EXPORT_C CMemSpyEngine::~CMemSpyEngine()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngine::~CMemSpyEngine() - START" );
-#endif
-
-    delete iImp;
-
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngine::~CMemSpyEngine() - END" );
-#endif
-    }
-
-
-void CMemSpyEngine::ConstructL( RFs& aFsSession )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngine::ConstructL() - START" );
-#endif
-    
-    iImp = new(ELeave) CMemSpyEngineImp( aFsSession, *this );
-    iImp->ConstructL();
-
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngine::ConstructL() - END" );
-#endif
-    }
-
-
-EXPORT_C CMemSpyEngine* CMemSpyEngine::NewL( RFs& aFsSession )
-    {
-    CMemSpyEngine* self = new(ELeave) CMemSpyEngine();
-    CleanupStack::PushL( self );
-    self->ConstructL( aFsSession );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-EXPORT_C CMemSpyEngine* CMemSpyEngine::NewL( RFs& aFsSession, TBool aStartServer )
-    {
-    return NewL(aFsSession);
-    }
-
-EXPORT_C RFs& CMemSpyEngine::FsSession()
-    {
-    return iImp->FsSession();
-    }
-
-
-EXPORT_C CMemSpyEngineObjectContainer& CMemSpyEngine::Container()
-    {
-    return iImp->Container();
-    }
-
-
-EXPORT_C const CMemSpyEngineObjectContainer& CMemSpyEngine::Container() const
-    {
-    return iImp->Container();
-    }
-
-
-EXPORT_C void CMemSpyEngine::SetObserver( MMemSpyEngineObserver* aObserver )
-    {
-    iImp->SetObserver( aObserver );
-    }
-
-
-void CMemSpyEngine::NotifyContainerChangeL()
-    {
-    iImp->NotifyContainerChangeL();
-    }
-
-
-void CMemSpyEngine::NotifyClientServerOperationRequestL( TInt aType )
-    {
-    iImp->NotifyClientServerOperationRequestL( aType );
-    }
-
-
-EXPORT_C CMemSpyEngineOutputSink& CMemSpyEngine::Sink()
-    {
-    return iImp->Sink();
-    }
-
-
-EXPORT_C TMemSpySinkType CMemSpyEngine::SinkType()
-    {
-    return iImp->SinkType();
-    }
-
-
-EXPORT_C void CMemSpyEngine::InstallSinkL( TMemSpySinkType aType )
-    {
-    iImp->InstallSinkL( aType, KNullDesC );
-    }
-
-EXPORT_C void CMemSpyEngine::InstallDebugSinkL()
-    {
-    iImp->InstallSinkL( ESinkTypeDebug, KNullDesC );
-    }
-
-EXPORT_C void CMemSpyEngine::InstallFileSinkL( const TDesC& aRootFolder )
-    {
-    iImp->InstallSinkL( ESinkTypeFile, aRootFolder );
-    }
-
-EXPORT_C void CMemSpyEngine::ListOpenFilesL()
-    {
-    iImp->ListOpenFilesL();
-    }
-
-
-EXPORT_C void CMemSpyEngine::GetVersion( TVersion& aVersion )
-    {
-    iImp->GetVersion( aVersion );
-    }
-
-
-EXPORT_C TBool CMemSpyEngine::IsHelperWindowServerSupported()
-    {
-    return iImp->IsHelperWindowServerSupported();
-    }
-
-
-CMemSpyEngineMidwife& CMemSpyEngine::Midwife()
-    {
-    return iImp->Midwife();
-    }
-
-
-CMemSpyEngineUndertaker& CMemSpyEngine::Undertaker()
-    {
-    return iImp->Undertaker();
-    }
-
-
-CMemSpyEngineChunkWatcher& CMemSpyEngine::ChunkWatcher()
-    {
-    return iImp->ChunkWatcher();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperHeap& CMemSpyEngine::HelperHeap()
-    {
-    return iImp->HelperHeap();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperStack& CMemSpyEngine::HelperStack()
-    {
-    return iImp->HelperStack();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperCodeSegment& CMemSpyEngine::HelperCodeSegment()
-    {
-    return iImp->HelperCodeSegment();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperChunk& CMemSpyEngine::HelperChunk()
-    {
-    return iImp->HelperChunk();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperThread& CMemSpyEngine::HelperThread()
-    {
-    return iImp->HelperThread();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperProcess& CMemSpyEngine::HelperProcess()
-    {
-    return iImp->HelperProcess();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperServer& CMemSpyEngine::HelperServer()
-    {
-    return iImp->HelperServer();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperActiveObject& CMemSpyEngine::HelperActiveObject()
-    {
-    return iImp->HelperActiveObject();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperKernelContainers& CMemSpyEngine::HelperKernelContainers()
-    {
-    return iImp->HelperKernelContainers();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperFileSystem& CMemSpyEngine::HelperFileSystem()
-    {
-    return iImp->HelperFileSystem();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperECom& CMemSpyEngine::HelperECom()
-    {
-    return iImp->HelperECom();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperSysMemTracker& CMemSpyEngine::HelperSysMemTracker()
-    {
-    return iImp->HelperSysMemTracker();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperFbServ& CMemSpyEngine::HelperFbServ()
-    {
-    return iImp->HelperFbServ();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperROM& CMemSpyEngine::HelperROM()
-    {
-    return iImp->HelperROM();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperRAM& CMemSpyEngine::HelperRAM()
-    {
-    return iImp->HelperRAM();
-    }
-
-
-EXPORT_C MMemSpyEngineHelperWindowServer& CMemSpyEngine::HelperWindowServer()
-    {
-    return iImp->HelperWindowServer();
-    }
-
-
-EXPORT_C CMemSpyEngineHelperCondVar& CMemSpyEngine::HelperCondVar()
-    {
-    return iImp->HelperCondVar();
-    }
-
-
-RMemSpyDriverClient& CMemSpyEngine::Driver()
-    {
-    return iImp->Driver();
-    }
-
-
-TInt CMemSpyEngine::ProcessSuspendAndGetErrorLC( TProcessId aId )
-    {
-    return iImp->ProcessSuspendAndGetErrorLC( aId );
-    }
-
-
-void CMemSpyEngine::ProcessSuspendLC( TProcessId aId )
-    {
-    iImp->ProcessSuspendLC( aId );
-    }
-
-
-void CMemSpyEngine::ProcessResume()
-    {
-    iImp->ProcessResume();
-    }
-    
-
-TProcessId CMemSpyEngine::SuspendedProcessId() const
-    {
-    return iImp->SuspendedProcessId();
-    }
-
-
-
--- a/memspy/Engine/Source/MemSpyEngineImp.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,582 +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 <memspy/engine/memspyengineimp.h>
-
-// System includes
-#include <e32svr.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineundertaker.h>
-#include "MemSpyEngineChunkWatcher.h"
-#include <memspy/engine/memspyengineobserver.h>
-#include "MemSpyEngineServer.h"
-#include <memspy/engine/memspyengineutils.h>
-#include "MemSpyEngineOutputSinkDebug.h"
-#include "MemSpyEngineOutputSinkFile.h"
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperstack.h>
-#include <memspy/engine/memspyenginehelperthread.h>
-#include <memspy/engine/memspyenginehelperserver.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperactiveobject.h>
-#include <memspy/engine/memspyenginehelperkernelcontainers.h>
-#include <memspy/engine/memspyenginehelperfilesystem.h>
-#include <memspy/engine/memspyenginehelperecom.h>
-#include <memspy/engine/memspyenginehelpersysmemtracker.h>
-#include <memspy/engine/memspyenginehelperfbserv.h>
-#include <memspy/engine/memspyenginehelperrom.h>
-#include <memspy/engine/memspyenginehelperram.h>
-#include <memspy/engine/memspyenginehelperwindowserver.h>
-#include <memspy/engine/memspyenginehelpercondvar.h>
-
-#ifdef _DEBUG
-#define LOG(args...) RDebug::Printf(args)
-#else
-#define LOG(args...)
-#endif
-
-CMemSpyEngineImp::CMemSpyEngineImp( RFs& aFsSession, CMemSpyEngine& aEngine )
-:   iFsSession( aFsSession ), iEngine( aEngine )
-    {
-    }
-
-
-CMemSpyEngineImp::~CMemSpyEngineImp()
-    {
-    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - START" );
-
-    if  ( iMidwife )
-        {
-        iMidwife->RemoveObserver( *this );
-        }
-
-    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - deleting helpers..." );
-    delete iHelperSysMemTracker;
-    delete iServer;
-    delete iHelperKernelContainers;
-    delete iHelperFbServ;
-    delete iHelperHeap;
-    delete iHelperStack;
-    delete iHelperCodeSegment;
-    delete iHelperChunk;
-    delete iHelperThread;
-    delete iHelperProcess;
-    delete iHelperServer;
-    delete iHelperActiveObject;
-    delete iHelperFileSystem;
-    delete iHelperECom;
-    delete iHelperROM;
-    delete iHelperRAM;
-    delete iHelperWindowServer;
-    delete iHelperCondVar;
-    
-    iHelperWindowServerLoader.Close();
-
-    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - deleting utilities..." );
-    delete iChunkWatcher;
-    delete iUndertaker;
-    delete iMidwife;
-
-    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - destroying containers..." );
-    iContainers.ResetAndDestroy();
-    iContainers.Close();
-
-    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - destroying driver..." );
-    if  ( iMemSpyDriver )
-        {
-        iMemSpyDriver->Close();
-        delete iMemSpyDriver;
-        }
-
-    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - destroying sink..." );
-    delete iSink;
-
-    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - END" );
-    }
-
-
-void CMemSpyEngineImp::ConstructL()
-    {
-    LOG( "CMemSpyEngineImp::ConstructL() - START" );
-    //
-    iFsSession.SetSessionPath( _L("\\") );
-    
-    iServer = CMemSpyEngineServer::NewL( iEngine );
-    
-    iMemSpyDriver = new(ELeave) RMemSpyDriverClient();
-    const TInt error = Driver().Open();
-    User::LeaveIfError( error );
-    //
-    InstallSinkL( ESinkTypeDebug );
-    //
-    iUndertaker = CMemSpyEngineUndertaker::NewL( Driver() );
-    iUndertaker->AddObserverL( *this );
-    //
-    iMidwife = CMemSpyEngineMidwife::NewL( Driver() );
-    //
-    iChunkWatcher = CMemSpyEngineChunkWatcher::NewL( Driver() );
-    //
-    CMemSpyEngineObjectContainer* container = CMemSpyEngineObjectContainer::NewL( iEngine );
-    CleanupStack::PushL( container );
-    iContainers.InsertL( container, 0 );
-    CleanupStack::Pop( container );
-    //
-    ConstructHelpersL();
-    //
-    iHelperSysMemTracker = CMemSpyEngineHelperSysMemTracker::NewL( iEngine );
-    iMidwife->AddObserverL( *this );
-
-    LOG( "CMemSpyEngineImp::ConstructL() - END" );
-    }
-
-
-void CMemSpyEngineImp::ConstructHelpersL()
-    {
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - START" );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Heap..." );
-    iHelperHeap = CMemSpyEngineHelperHeap::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Stack..." );
-    iHelperStack = CMemSpyEngineHelperStack::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Code Segments..." );
-    iHelperCodeSegment = CMemSpyEngineHelperCodeSegment::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Chunk..." );
-    iHelperChunk = CMemSpyEngineHelperChunk::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Thread..." );
-    iHelperThread = CMemSpyEngineHelperThread::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Process..." );
-    iHelperProcess = CMemSpyEngineHelperProcess::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Server..." );
-    iHelperServer = CMemSpyEngineHelperServer::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - AO..." );
-    iHelperActiveObject = CMemSpyEngineHelperActiveObject::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Kernel Containers..." );
-    iHelperKernelContainers = CMemSpyEngineHelperKernelContainers::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - File System..." );
-    iHelperFileSystem = CMemSpyEngineHelperFileSystem::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - ECOM..." );
-    iHelperECom = CMemSpyEngineHelperECom::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - FBSERV..." );
-    iHelperFbServ = CMemSpyEngineHelperFbServ::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - ROM..." );
-    iHelperROM = CMemSpyEngineHelperROM::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - RAM..." );
-    iHelperRAM = CMemSpyEngineHelperRAM::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - WindowServer..." );
-    
-    TInt err = iHelperWindowServerLoader.Load( _L("memspywindowserverhelper.dll") );
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - WindowServer load err: %d", err );
-    if ( !err )
-        {
-#ifdef __WINS__ // ordinal is different 
-        TLibraryFunction entry = iHelperWindowServerLoader.Lookup( 3 );
-#else
-        TLibraryFunction entry = iHelperWindowServerLoader.Lookup( 1 );
-#endif
-        if ( entry != NULL )
-            {
-			typedef MMemSpyEngineHelperWindowServer* (*TEntryFn)(void);
-			TRAP(err, iHelperWindowServer = ((TEntryFn)entry)());
-			if (err)
-				{
-				LOG("err from memspywindowserverhelper.dll - %d", err);
-				}
-            }
-        }
-    
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - CondVar..." );
-    iHelperCondVar = CMemSpyEngineHelperCondVar::NewL( iEngine );
-
-    LOG( "CMemSpyEngineImp::ConstructHelpersL() - END" );
-    }
-
-
-RFs& CMemSpyEngineImp::FsSession()
-    {
-    return iFsSession;
-    }
-
-
-CMemSpyEngineObjectContainer& CMemSpyEngineImp::Container()
-    {
-    __ASSERT_ALWAYS( iContainers.Count() >= 1, MemSpyEngineUtils::Panic( EMemSpyEnginePanicInvalidContainer1 ) );
-    CMemSpyEngineObjectContainer* headContainer = iContainers[ 0 ];
-    return *headContainer;
-    }
-
-
-const CMemSpyEngineObjectContainer& CMemSpyEngineImp::Container() const
-    {
-    __ASSERT_ALWAYS( iContainers.Count() >= 1, MemSpyEngineUtils::Panic( EMemSpyEnginePanicInvalidContainer2 ) );
-    const CMemSpyEngineObjectContainer* headContainer = iContainers[ 0 ];
-    return *headContainer;
-    }
-
-
-void CMemSpyEngineImp::SetObserver( MMemSpyEngineObserver* aObserver )
-    {
-    iObserver = aObserver;
-    }
-
-
-void CMemSpyEngineImp::NotifyContainerChangeL()
-    {
-    if  ( iObserver )
-        {
-        iObserver->HandleMemSpyEngineEventL( MMemSpyEngineObserver::EHandleThreadsOrProcessesChanged, &Container() );
-        }
-    }
-
-
-void CMemSpyEngineImp::NotifyClientServerOperationRequestL( TInt aType )
-    {
-    if  ( iObserver )
-        {
-        iObserver->HandleMemSpyEngineEventL( MMemSpyEngineObserver::EHandleClientServerOperationRequest, reinterpret_cast< TAny* >( aType ) );
-        }
-    }
-
-
-CMemSpyEngineOutputSink& CMemSpyEngineImp::Sink()
-    {
-    return *iSink;
-    }
-
-
-TMemSpySinkType CMemSpyEngineImp::SinkType()
-    {
-    return iSink->Type();
-    }
-
-void CMemSpyEngineImp::InstallSinkL( TMemSpySinkType aType )
-	{
-	InstallSinkL( aType, KNullDesC );
-	}
-
-void CMemSpyEngineImp::InstallSinkL( TMemSpySinkType aType, const TDesC& aRootFolder )
-    {
-    LOG( "CMemSpyEngineImp::InstallSinkL() - START - switching sink from %d to %d...", (iSink != NULL ? iSink->Type() : -1), aType );
-    //
-    CMemSpyEngineOutputSink* sink = NULL;
-    //
-    switch( aType )
-        {
-    case ESinkTypeDebug:
-        sink = CMemSpyEngineOutputSinkDebug::NewL( iEngine );
-        break;
-    case ESinkTypeFile:
-        sink = CMemSpyEngineOutputSinkFile::NewL( iEngine, aRootFolder );
-        break;
-        }
-    //
-    delete iSink;
-    iSink = sink;
-    //
-    LOG( "CMemSpyEngineImp::InstallSinkL() - END - sink type: %d", iSink->Type() );
-    }
-
-
-void CMemSpyEngineImp::ListOpenFilesL()
-    {
-    HelperFileSystem().ListOpenFilesL();
-    }
-
-
-void CMemSpyEngineImp::GetVersion( TVersion& aVersion )
-    {
-    iMemSpyDriver->GetVersion( aVersion );
-    }
-
-
-TBool CMemSpyEngineImp::IsHelperWindowServerSupported()
-    {
-    return iHelperWindowServer != NULL;
-    }
-
-
-CMemSpyEngineMidwife& CMemSpyEngineImp::Midwife()
-    {
-    return *iMidwife;
-    }
-
-
-CMemSpyEngineUndertaker& CMemSpyEngineImp::Undertaker()
-    {
-    return *iUndertaker;
-    }
-
-
-CMemSpyEngineChunkWatcher& CMemSpyEngineImp::ChunkWatcher()
-    {
-    return *iChunkWatcher;
-    }
-
-
-CMemSpyEngineHelperHeap& CMemSpyEngineImp::HelperHeap()
-    {
-    return *iHelperHeap;
-    }
-
-
-CMemSpyEngineHelperStack& CMemSpyEngineImp::HelperStack()
-    {
-    return *iHelperStack;
-    }
-
-
-CMemSpyEngineHelperCodeSegment& CMemSpyEngineImp::HelperCodeSegment()
-    {
-    return *iHelperCodeSegment;
-    }
-
-
-CMemSpyEngineHelperChunk& CMemSpyEngineImp::HelperChunk()
-    {
-    return *iHelperChunk;
-    }
-
-
-CMemSpyEngineHelperThread& CMemSpyEngineImp::HelperThread()
-    {
-    return *iHelperThread;
-    }
-
-
-CMemSpyEngineHelperProcess& CMemSpyEngineImp::HelperProcess()
-    {
-    return *iHelperProcess;
-    }
-
-
-CMemSpyEngineHelperServer& CMemSpyEngineImp::HelperServer()
-    {
-    return *iHelperServer;
-    }
-
-
-CMemSpyEngineHelperActiveObject& CMemSpyEngineImp::HelperActiveObject()
-    {
-    return *iHelperActiveObject;
-    }
-
-
-CMemSpyEngineHelperKernelContainers& CMemSpyEngineImp::HelperKernelContainers()
-    {
-    return *iHelperKernelContainers;
-    }
-
-
-CMemSpyEngineHelperFileSystem& CMemSpyEngineImp::HelperFileSystem()
-    {
-    return *iHelperFileSystem;
-    }
-
-
-CMemSpyEngineHelperECom& CMemSpyEngineImp::HelperECom()
-    {
-    return *iHelperECom;
-    }
-
-
-CMemSpyEngineHelperSysMemTracker& CMemSpyEngineImp::HelperSysMemTracker()
-    {
-    return *iHelperSysMemTracker;
-    }
-
-
-CMemSpyEngineHelperFbServ& CMemSpyEngineImp::HelperFbServ()
-    {
-    return *iHelperFbServ;
-    }
-
-
-CMemSpyEngineHelperROM& CMemSpyEngineImp::HelperROM()
-    {
-    return *iHelperROM;
-    }
-
-
-CMemSpyEngineHelperRAM& CMemSpyEngineImp::HelperRAM()
-    {
-    return *iHelperRAM;
-    }
-
-
-MMemSpyEngineHelperWindowServer& CMemSpyEngineImp::HelperWindowServer()
-    {
-    return *iHelperWindowServer;
-    }
-
-
-CMemSpyEngineHelperCondVar& CMemSpyEngineImp::HelperCondVar()
-    {
-    return *iHelperCondVar;
-    }
-
-
-RMemSpyDriverClient& CMemSpyEngineImp::Driver()
-    {
-    return *iMemSpyDriver;
-    }
-
-
-TInt CMemSpyEngineImp::ProcessSuspendAndGetErrorLC( TProcessId aId )
-    {
-    __ASSERT_ALWAYS( iSuspendedProcess == aId || iSuspendedProcess == 0, MemSpyEngineUtils::Panic( EMemSpyEnginePanicSuspendRequest1 ) );
-
-    TInt errorOrCount = Driver().ProcessThreadsSuspend( aId );
-    if  ( errorOrCount >= 0 )
-        {
-        if  ( errorOrCount == 1 )
-            {
-            iSuspendedProcess = aId;
-            }
-        else
-            {
-            // Suspending already suspended process
-            __ASSERT_ALWAYS( iSuspendedProcess == aId, MemSpyEngineUtils::Panic( EMemSpyEnginePanicSuspendRequest2 ) );
-            }
-        //
-        CleanupStack::PushL( TCleanupItem( ResumeSuspendedProcess, this ) );
-
-        if  ( errorOrCount == 1 )
-            {
-            iSink->ProcessSuspendedL( aId );
-            }
-            
-        // At this point, all was well
-        errorOrCount = KErrNone;
-        }
-
-    return errorOrCount;
-    }
-
-
-void CMemSpyEngineImp::ProcessSuspendLC( TProcessId aId )
-    {
-    const TInt error = ProcessSuspendAndGetErrorLC( aId );
-    User::LeaveIfError( error );
-    }
-
-
-void CMemSpyEngineImp::ProcessResume()
-    {
-    const TUint id = iSuspendedProcess;
-    //
-    const TInt errorOrCount = Driver().ProcessThreadsResume( id );
-    //
-    if  ( errorOrCount == 0 )
-        {
-        iSink->ProcessResumed( id );
-        iSuspendedProcess = 0;
-        }
-    }
-    
-
-TProcessId CMemSpyEngineImp::SuspendedProcessId() const
-    {
-    return TProcessId( iSuspendedProcess );
-    }
-
-
-void CMemSpyEngineImp::ResumeSuspendedProcess( TAny* aSelf )
-    {
-    CMemSpyEngineImp* self = reinterpret_cast< CMemSpyEngineImp* >( aSelf );
-    self->ProcessResume();
-    }
-
-
-void CMemSpyEngineImp::ThreadIsDeadL( const TThreadId& aId, const RThread& aThread )
-    {
-    if  ( aThread.Handle() != KNullHandle )
-        {
-        const TFullName name( aThread.FullName() );
-        //
-        TBuf<128> exitInfo;
-        const TExitCategoryName exitCategory( aThread.ExitCategory() );
-        CMemSpyThread::AppendExitInfo( exitInfo, aThread.ExitType(), aThread.ExitReason(), exitCategory );
-        //
-        _LIT( KMemSpyEventInfoText, "[MemSpy] Thread died: %S [%d - 0x%04x] %S" );
-        Sink().OutputLineFormattedL( KMemSpyEventInfoText, &name, (TUint32) aId, (TUint32) aId, &exitInfo );
-        }
-    }
-    
-
-void CMemSpyEngineImp::ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess )
-    {
-    if  ( aProcess.Handle() != KNullHandle )
-        {
-        const TFullName name( aProcess.FullName() );
-        //
-        TBuf<128> exitInfo;
-        const TExitCategoryName exitCategory( aProcess.ExitCategory() );
-        CMemSpyThread::AppendExitInfo( exitInfo, aProcess.ExitType(), aProcess.ExitReason(), exitCategory );
-        //
-        _LIT( KMemSpyEventInfoText, "[MemSpy] Process died: %S [%d - 0x%04x] %S" );
-        Sink().OutputLineFormattedL( KMemSpyEventInfoText, &name, (TUint32) aId, (TUint32) aId, &exitInfo );
-        }
-    }
-
-
-void CMemSpyEngineImp::ThreadIsBornL( const TThreadId& aId, const RThread& aThread )
-    {
-    if  ( aThread.Handle() != KNullHandle )
-        {
-        const TFullName name( aThread.FullName() );
-        //
-        _LIT( KMemSpyEventInfoText, "[MemSpy] Thread created: %S (%d / 0x%08x)" );
-        Sink().OutputLineFormattedL( KMemSpyEventInfoText, &name, (TUint32) aId, (TUint32) aId );
-        }
-    }
-
-
-void CMemSpyEngineImp::ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess )
-    {
-    if  ( aProcess.Handle() != KNullHandle )
-        {
-        const TFullName name( aProcess.FullName() );
-        //
-        _LIT( KMemSpyEventInfoText, "[MemSpy] Process created: %S (%d / 0x%08x)" );
-        Sink().OutputLineFormattedL( KMemSpyEventInfoText, &name, (TUint32) aId, (TUint32) aId );
-        }
-    }
-
-
-
--- a/memspy/Engine/Source/MemSpyEngineProcessMemoryTracker.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,352 +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 <memspy/engine/memspyengineprocessmemorytracker.h>
-
-// System includes
-#include <e32debug.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-
-// Constants
-const TInt KMemSpyNumberOfChangesReceivedProcessNotYetOpen = -1;
-const TInt KMemSpyNumberOfChangesReceivedProcessNowOpen = 0;
-
-
-CMemSpyEngineProcessMemoryTracker::CMemSpyEngineProcessMemoryTracker( CMemSpyEngine& aEngine, const TProcessId& aProcessId )
-:   CActive( EPriorityStandard ), iEngine( aEngine ), iProcessId( aProcessId ), iNumberOfChangesReceived( KMemSpyNumberOfChangesReceivedProcessNotYetOpen )
-    {
-    CActiveScheduler::Add( this );
-    }
-
-
-CMemSpyEngineProcessMemoryTracker::~CMemSpyEngineProcessMemoryTracker()
-    {
-    Cancel();
-    
-    // Don't close the process if we didn't successfully open it...
-    if  ( iNumberOfChangesReceived != KMemSpyNumberOfChangesReceivedProcessNotYetOpen )
-        {
-        iEngine.Driver().ProcessInspectionClose( iProcessId );
-        }
-
-    iObservers.Close();
-    delete iProcessName;
-    }
-
-
-void CMemSpyEngineProcessMemoryTracker::ConstructL()
-    {
-    // Cache name    
-    RProcess process;
-    User::LeaveIfError( iEngine.Driver().OpenProcess( iProcessId, process ) );
-    CleanupClosePushL( process );
-    iProcessName = process.FullName().AllocL();
-    iSID = process.SecureId();
-    CleanupStack::PopAndDestroy( &process );
-
-    // Indicate that we've opened the process
-    iNumberOfChangesReceived = KMemSpyNumberOfChangesReceivedProcessNowOpen;
-
-    // Open driver session
-    const TInt error = iEngine.Driver().ProcessInspectionOpen( iProcessId );
-    User::LeaveIfError( error );
-
-    // Pull out the first change which the driver always prepares for us when
-    // we open an initial connection.
-    TRequestStatus status = KRequestPending;
-    iEngine.Driver().ProcessInspectionRequestChanges( iProcessId, status, iInfoCurrent );
-    User::WaitForRequest( status );
-    
-    // And update our HWM value based upon this initial seed...
-    UpdatePeaks( iInfoCurrent );
-    UpdateHWMIncShared( iInfoCurrent );
-    UpdateHWMExcShared( iInfoCurrent );
-    }
-
-
-CMemSpyEngineProcessMemoryTracker* CMemSpyEngineProcessMemoryTracker::NewLC( CMemSpyEngine& aEngine, const TProcessId& aProcessId )
-    {
-    CMemSpyEngineProcessMemoryTracker* self = new(ELeave) CMemSpyEngineProcessMemoryTracker( aEngine, aProcessId );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-EXPORT_C TBool CMemSpyEngineProcessMemoryTracker::AmTracking() const
-    {
-    return iAmTracking;
-    }
-
-
-EXPORT_C void CMemSpyEngineProcessMemoryTracker::StartL()
-    {
-    Cancel();
-    iNumberOfChangesReceived = 0;
-    //
-    iEngine.Driver().ProcessInspectionRequestChanges( iProcessId, iStatus, iInfoCurrent );
-    SetActive();
-    iAmTracking = ETrue;
-    //
-    const TInt count = iObservers.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        MMemSpyEngineProcessMemoryTrackerObserver* obs = iObservers[ i ];
-        TRAP_IGNORE( obs->HandleMemoryTrackingStartedL() );
-        }
-    }
-
-
-EXPORT_C void CMemSpyEngineProcessMemoryTracker::Stop()
-    {
-    Cancel();
-    //
-    iAmTracking = EFalse;
-    //
-    const TInt count = iObservers.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        MMemSpyEngineProcessMemoryTrackerObserver* obs = iObservers[ i ];
-        TRAP_IGNORE( obs->HandleMemoryTrackingStoppedL() );
-        }
-    }
-
-
-EXPORT_C void CMemSpyEngineProcessMemoryTracker::AddObserverL( MMemSpyEngineProcessMemoryTrackerObserver& aObserver )
-    {
-    RemoveObserver( aObserver );
-    User::LeaveIfError( iObservers.Append( &aObserver ) );
-    }
- 
-
-EXPORT_C void CMemSpyEngineProcessMemoryTracker::RemoveObserver( MMemSpyEngineProcessMemoryTrackerObserver& aObserver )
-    {
-    TInt pos = iObservers.Find( &aObserver );
-    while( pos >= 0 )
-        {
-        iObservers.Remove( pos );
-        pos = iObservers.Find( &aObserver );
-        }
-    }
-
-
-EXPORT_C void CMemSpyEngineProcessMemoryTracker::ResetHWML()
-    {
-    iInfoHWMIncShared.iMemoryStack = 0;
-    iInfoHWMIncShared.iMemoryHeap = 0;
-    iInfoHWMIncShared.iMemoryChunkLocal = 0;
-    iInfoHWMIncShared.iMemoryChunkShared = 0;
-    iInfoHWMIncShared.iMemoryGlobalData = 0;
-    //
-    iInfoHWMExcShared.iMemoryStack = 0;
-    iInfoHWMExcShared.iMemoryHeap = 0;
-    iInfoHWMExcShared.iMemoryChunkLocal = 0;
-    iInfoHWMExcShared.iMemoryChunkShared = 0;
-    iInfoHWMExcShared.iMemoryGlobalData = 0;
-    //
-    const TInt count = iObservers.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        MMemSpyEngineProcessMemoryTrackerObserver* obs = iObservers[ i ];
-        TRAP_IGNORE( obs->HandleMemoryChangedL( iProcessId, InfoCurrent(), InfoHWMIncShared(), InfoHWMExcShared() ) );
-        }
-    }
-
-
-void CMemSpyEngineProcessMemoryTracker::RunL()
-    {
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::RunL() - START" );
-    ++iNumberOfChangesReceived;
-    
-    // Copy current results and request next event providing the driver didn't
-    // indicate an error (e.g. KErrDied in the case of process termination)
-    TMemSpyDriverProcessInspectionInfo info( iInfoCurrent );
-    if  ( iStatus.Int() >= KErrNone )
-        {
-        iEngine.Driver().ProcessInspectionRequestChanges( iProcessId, iStatus, iInfoCurrent );
-        SetActive();
-        }
-    else
-        {
-        //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::RunL() - iStatus: %d, not requesting further changes...", iStatus.Int() );
-        }
-
-    // Update stats
-    UpdatePeaks( info );
-    UpdateHWMIncShared( info );
-    UpdateHWMExcShared( info );
-
-    // Print out change to file/trace
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::RunL() - printing info..." );
-    PrintInfoL( info );
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::RunL() - done printing info" );
-
-    // Reset peak flags for next cycle
-    iInfoPeaks.ResetPeakFlags();
-
-    // Notify observers
-    const TInt count = iObservers.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        MMemSpyEngineProcessMemoryTrackerObserver* obs = iObservers[ i ];
-        TRAP_IGNORE( obs->HandleMemoryChangedL( iProcessId, info, InfoHWMIncShared(), InfoHWMExcShared() ) );
-        }
-
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::RunL() - END" );
-    }
-
-
-void CMemSpyEngineProcessMemoryTracker::DoCancel()
-    {
-    ////RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::DoCancel() - START - iStatus: %d", iStatus.Int() );
-    iEngine.Driver().ProcessInspectionRequestChangesCancel( iProcessId );
-    ////RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::DoCancel() - END - iStatus: %d", iStatus.Int() );
-    }
-
-
-void CMemSpyEngineProcessMemoryTracker::UpdatePeaks( const TMemSpyDriverProcessInspectionInfo& aLatestInfo )
-    {
-    if  ( aLatestInfo.iMemoryStack > iInfoPeaks.iMemoryStack )
-        {
-        iInfoPeaks.iPeakStack = ETrue;
-        iInfoPeaks.iMemoryStack = aLatestInfo.iMemoryStack;
-        }
-    if  ( aLatestInfo.iMemoryHeap > iInfoPeaks.iMemoryHeap )
-        {
-        iInfoPeaks.iPeakHeap = ETrue;
-        iInfoPeaks.iMemoryHeap = aLatestInfo.iMemoryHeap;
-        }
-    if  ( aLatestInfo.iMemoryChunkLocal > iInfoPeaks.iMemoryChunkLocal )
-        {
-        iInfoPeaks.iPeakChunkLocal = ETrue;
-        iInfoPeaks.iMemoryChunkLocal = aLatestInfo.iMemoryChunkLocal;
-        }
-    if  ( aLatestInfo.iMemoryChunkShared > iInfoPeaks.iMemoryChunkShared )
-        {
-        iInfoPeaks.iPeakChunkShared = ETrue;
-        iInfoPeaks.iMemoryChunkShared = aLatestInfo.iMemoryChunkShared;
-        }
-    if  ( aLatestInfo.iMemoryGlobalData > iInfoPeaks.iMemoryGlobalData )
-        {
-        iInfoPeaks.iPeakGlobalData = ETrue;
-        iInfoPeaks.iMemoryGlobalData = aLatestInfo.iMemoryGlobalData;
-        }
-    }
-
-
-void CMemSpyEngineProcessMemoryTracker::UpdateHWMIncShared( const TMemSpyDriverProcessInspectionInfo& aLatestInfo )
-    {
-    const TUint32 totalCurrent = aLatestInfo.TotalIncShared();
-    const TUint32 totalHWM = iInfoHWMIncShared.TotalIncShared();
-    //
-    if  ( totalCurrent > totalHWM )
-        {
-        // Got new HWM
-        iInfoHWMIncShared = aLatestInfo;
-        }
-    }
-
-
-void CMemSpyEngineProcessMemoryTracker::UpdateHWMExcShared( const TMemSpyDriverProcessInspectionInfo& aLatestInfo )
-    {
-    const TUint32 totalCurrent = aLatestInfo.TotalExcShared();
-    const TUint32 totalHWM = iInfoHWMExcShared.TotalExcShared();
-    //
-    if  ( totalCurrent > totalHWM )
-        {
-        // Got new HWM
-        iInfoHWMExcShared = aLatestInfo;
-        }
-    }
-
-
-void CMemSpyEngineProcessMemoryTracker::PrintInfoL( const TMemSpyDriverProcessInspectionInfo& aInfo )
-    {
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - START" );
-    TBuf<128> timeBuf;
-    TTime time( aInfo.iTime );
-    MemSpyEngineUtils::FormatTimeSimple( timeBuf, time );
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - got time..." );
-
-    // Output changes
-    const TBool noOverwrite = EFalse;
-    const TBool noTimeStamp = EFalse;
-
-    // Prepare prefix
-    _LIT( KMemSpyProcessMemoryTrackerPrefix, "[Change %05d] " );
-    TBuf<25> prefixBuf;
-    prefixBuf.Format( KMemSpyProcessMemoryTrackerPrefix, iNumberOfChangesReceived );
-    iEngine.Sink().OutputPrefixSetLC( prefixBuf );
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - set prefix" );
-
-    // Resume (or create) a data stream
-    _LIT( KMemSpyFolder, "Process Memory Tracking" );
-    _LIT( KMemSpyContext, "Process [0x%08x]" );
-    HBufC* context = HBufC::NewLC( KMaxFileName );
-    TPtr pContext( context->Des() );
-    pContext.Format( KMemSpyContext, (TUint) iSID );
-    iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder, KNullDesC, noOverwrite, noTimeStamp );
-    CleanupStack::PopAndDestroy( context );
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - set context" );
-
-    // Preapre peak characters
-    const TText KItemPeaked     = '*';
-    const TText KItemDidNotPeak = ' ';
-    const TText peakStack       = ( iInfoPeaks.iPeakStack       ? KItemPeaked : KItemDidNotPeak );
-    const TText peakHeap        = ( iInfoPeaks.iPeakHeap        ? KItemPeaked : KItemDidNotPeak );
-    const TText peakChunkLocal  = ( iInfoPeaks.iPeakChunkLocal  ? KItemPeaked : KItemDidNotPeak );
-    const TText peakChunkShared = ( iInfoPeaks.iPeakChunkShared ? KItemPeaked : KItemDidNotPeak );
-    const TText peakGlobalData  = ( iInfoPeaks.iPeakGlobalData  ? KItemPeaked : KItemDidNotPeak );
-
-    // Write data
-    _LIT( KMemSpyMemChangeFormat, "%S - pID: 0x%04x, stack[%c]: %6d, heap[%c]: %10d, local[%c]: %10d, shared[%c]: %10d, globalD[%c]: %10d, totalC: [%10d/%10d], totalHWM: [%10d/%10d] %S" );
-    HBufC* buf = HBufC::NewLC( 1024 );
-
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - formatting buffer..." );
-    buf->Des().Format( KMemSpyMemChangeFormat, &timeBuf, (TUint) iProcessId, 
-                                               peakStack, aInfo.iMemoryStack,
-                                               peakHeap, aInfo.iMemoryHeap,
-                                               peakChunkLocal, aInfo.iMemoryChunkLocal,
-                                               peakChunkShared, aInfo.iMemoryChunkShared, 
-                                               peakGlobalData, aInfo.iMemoryGlobalData, 
-                                               aInfo.TotalIncShared(), aInfo.TotalExcShared(), 
-                                               InfoHWMIncShared().TotalIncShared(), InfoHWMExcShared().TotalExcShared(), 
-                                               iProcessName );
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - outputting - 1, sinkType: %d", iEngine.Sink().Type() );
-    //RDebug::Print( _L("%S"), buf );
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - outputting - 2" );
-    iEngine.Sink().OutputLineL( *buf, ETrue );
-    CleanupStack::PopAndDestroy( buf );
-
-    // End stream
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - ending stream" );
-    iEngine.Sink().DataStreamEndL();
-
-    // Remove prefix
-    CleanupStack::PopAndDestroy();
-    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - END" );
-    }
-
-
-
--- a/memspy/Engine/Source/MemSpyEngineTwiddlableItemArray.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +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 <memspy/engine/memspyenginetwiddlableitemarray.h>
-
-// System includes
-#include <e32svr.h>
-
-// User includes
-
-
--- a/memspy/Engine/Source/MemSpyEngineUtils.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,732 +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 <memspy/engine/memspyengineutils.h>
-
-// System includes
-#include <e32svr.h>
-#include <e32capability.h>
-#ifdef __EPOC32__
-#include <e32rom.h>
-#endif
-
-// User includes
-#include <memspy/engine/memspyengineoutputsink.h>
-
-// Typedefs
-typedef TInt(*TSysUtilGetSWVersionFunction)(TDes&);
-
-// Literal constants
-_LIT( KMemSpyEngineDoubleColon, "::" );
-_LIT( KMemSpyKernelProcessName, "ekern" );
-_LIT( KMemSpyKernelProcessFullName, "ekern.exe[100041af]0001" );
-_LIT( KMemSpyKernelThreadName, "Supervisor" );
-_LIT( KMemSpyLogRootPath, "\\MemSpy\\" );
-_LIT( KMemSpyLogDefaultName, "Log" );
-_LIT( KMemSpyLogFileNameWithTimeStamp, "MemSpy - %4d%02d%02d - %02d.%02d.%02d.%06d - " );
-
-
-EXPORT_C void MemSpyEngineUtils::FormatTimeL( TDes& aBuf, const TInt64& aTimeVal, TBool aLocalTime )
-    {
-    const TTime time( aTimeVal );
-    FormatTimeL( aBuf, time, aLocalTime );
-    }
-
-
-EXPORT_C void MemSpyEngineUtils::FormatTimeL( TDes& aBuf, const TTime& aTime, TBool aLocalTime )
-    {
-    if  ( aLocalTime )
-        {
-        _LIT( KFormatSpecLocal, "%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B" );
-        // 
-        TTime time( aTime );
-        time += User::UTCOffset();
-        time.FormatL( aBuf, KFormatSpecLocal );
-        }
-    else
-        {
-        _LIT( KFormatSpecUTC, "%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B UTC" );
-        aTime.FormatL( aBuf, KFormatSpecUTC );
-        }
-    }
-
-
-void MemSpyEngineUtils::FormatTimeSimple( TDes& aBuf, const TTime& aTime )
-    {
-    const TDateTime dt = aTime.DateTime();
-    //
-    _LIT( KTimeFormatSpec, "%04d%02d%02d %02d:%02d:%02d" );
-    aBuf.Format( KTimeFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second() );
-    }
-
-
-EXPORT_C void MemSpyEngineUtils::FormatHex( TDes& aBuf, TInt aValue )
-    {
-    _LIT(KMemSpyNumericHexFormat, "0x%08x");
-    aBuf.Format( KMemSpyNumericHexFormat, aValue );
-    }
-
-
-EXPORT_C TMemSpySizeText MemSpyEngineUtils::FormatSizeText( const TInt64& aValue, TInt aDecimalPlaces, TBool aExtraRounding )
-    {
-    _LIT(KFormatKilo, "%dK");
-    _LIT(KFormatMega, "%SM");
-    _LIT(KFormatGiga, "%SG");
-
-	TMemSpySizeText buf;
-	if  ( aValue < 1024000 )					// If < 1000K
-		{
-		TInt sizeInK = 0;
-
-        if  ( aValue != 0 )
-			{
-			sizeInK = I64INT( (aValue + 512) >> 10 );
-			if  (sizeInK < 1)
-                {
-				sizeInK = 1;
-                }
-			if  (sizeInK > 999)
-                {
-				sizeInK = 999;
-                }
-			}
-
-        buf.Format( KFormatKilo, sizeInK );
-		}
-	else
-		{
-		TReal sizeInM = I64INT( aValue );
-		sizeInM /= 1048576;
-		if  ( sizeInM < 1 )
-            {
-			sizeInM = 1;
-            }
-
-        TPtrC pFormat( KFormatMega );
-		if  ( sizeInM >= 1000 )
-			{
-			sizeInM /= 1024;				// Size in G
-			if  (sizeInM < 1)
-                {
-				sizeInM = 1;
-                }
-			
-            pFormat.Set( KFormatGiga );
-			}
-
-        if  ( sizeInM > 999.9)
-            {
-            sizeInM = 999.9;
-            }
-
-        if  ( aExtraRounding )
-            {
-			sizeInM += 0.499999;
-            }
-
-		TBuf<16> size;
-		size.Num( sizeInM, TRealFormat( 14, aDecimalPlaces ) );	// Allow for "17179869184.0"G which is 2^64
-        buf.Format( pFormat, &size );
-		}
-
-    return buf;
-    }
-
-
-EXPORT_C TMemSpySizeText MemSpyEngineUtils::FormatSizeText( TInt aValue )
-    {
-    const TInt64 value( aValue );
-	return FormatSizeText( value );
-    }
-
-
-EXPORT_C TMemSpySizeText MemSpyEngineUtils::FormatSizeTextPrecise( TInt aValue )
-    {
-    /*
-    0123456789
-    ==========
-    1234567890
-
-    1,234,567,890
-
-    len = 10;
-    */
-
-	TMemSpySizeText buf;
-    buf.Num( aValue );
-    TInt index = buf.Length() - 3;
-    while( index > 0 )
-        {
-        buf.Insert( index, _L(",") );
-        index -= 3;
-        }
-
-    return buf;
-    }
-
-
-EXPORT_C TBool MemSpyEngineUtils::IsRomAddress( TAny* aAddress )
-    {
-    TBool inRom = EFalse;
-    //
-#ifdef __EPOC32__
-    const TInt err = User::IsRomAddress( inRom, aAddress );
-    if  ( err != KErrNone )
-        {
-        inRom = EFalse;
-        }
-#else
-    (void) aAddress;
-    inRom = ETrue;
-#endif
-    //
-    return inRom;
-    }
-
-
-EXPORT_C void MemSpyEngineUtils::GetCapabilityName( TDes& aBuf, TCapability aCapability )
-    {
-    const TPtrC8 pName( (const TUint8*) CapabilityNames[ aCapability ] );
-    aBuf.Copy( pName );
-    }
-
-
-EXPORT_C TBool MemSpyEngineUtils::StripText( TDes& aText, const TDesC& aStrip )
-    {
-    TBool stripped = EFalse;
-    const TInt stripTextLength = aStrip.Length();
-    //
-    if  ( aText.Length() > stripTextLength )
-        {
-        const TPtrC leftText( aText.Left( stripTextLength ) );
-        if  ( leftText.CompareF( aStrip ) == 0)
-            {
-            // Try to find the first double colon
-            const TInt doubleColonPos = aText.Find( KMemSpyEngineDoubleColon );
-            if  ( doubleColonPos >= stripTextLength )
-                {
-                aText.Delete( 0, doubleColonPos + 2 );
-                }
-            else
-                {
-                aText.Delete( 0, stripTextLength );
-                }
-
-            stripped = ETrue;
-            }
-        }
-    //
-    return stripped;
-    }
-
-
-EXPORT_C void MemSpyEngineUtils::TextBeforeDoubleColon( TDes& aText )
-    {
-    const TInt doubleColonPos = aText.Find( KMemSpyEngineDoubleColon );
-    if  ( doubleColonPos >= 0 )
-        {
-        aText.SetLength( doubleColonPos );
-        }
-    }
-
-
-EXPORT_C void MemSpyEngineUtils::TextAfterDoubleColon( TDes& aText )
-    {
-    const TInt doubleColonPos = aText.Find( KMemSpyEngineDoubleColon );
-    if  ( doubleColonPos >= 0 )
-        {
-        aText.Delete( 0, doubleColonPos + 2 );
-        }
-    }
-
-
-TPtrC MemSpyEngineUtils::TextAfterLastDoubleColon( const TDesC& aText )
-    {
-    TPtrC ret( aText );
-
-    // ABCD::123
-    const TInt doubleColonPos = aText.LocateReverseF( ':' );
-    if  ( doubleColonPos > 0 )
-        {
-        if ( aText[ doubleColonPos ] == ':' )
-            {
-            ret.Set( aText.Mid( doubleColonPos + 1 ) );
-            }
-        }
-
-    return ret;
-    }
-
-
-EXPORT_C TMemSpyPercentText MemSpyEngineUtils::FormatPercentage( TReal aOneHundredPercentValue, TReal aValue )
-    {
-    const TReal value = (( aValue / aOneHundredPercentValue) * 100.0);
-    
-    _LIT(KPercentFormat, "%3.2f %%");
-
-    TMemSpyPercentText val;
-    val.Format( KPercentFormat, value );
-    
-    return val;
-    }
-
-
-EXPORT_C HBufC* MemSpyEngineUtils::CleanupTextLC( const TDesC& aText )
-    {
-    _LIT( KMemSpyTabChar, "\t" );
-    _LIT( KMemSpyTabReplacementChar, " " );
-    _LIT( KMemSpyNewLineChar, "\n" );
-    _LIT( KMemSpyNewLineReplacementChar, " " );
-
-    TInt pos = KErrNotFound;
-
-    // Create replacement
-    const TInt originalLength = aText.Length();
-    HBufC* text = HBufC::NewLC( originalLength );
-    TPtr pText( text->Des() );
-    pText.Copy( aText );
-
-    // Replace tabs
-    pos = pText.Find( KMemSpyTabChar );
-    while( pos >= 0 )
-        {
-        pText.Replace( pos, KMemSpyTabChar().Length(), KMemSpyTabReplacementChar );
-        pos = pText.Find( KMemSpyTabChar );
-        }
-
-    // Replace tabs
-    pos = pText.Find( KMemSpyNewLineChar );
-    while( pos >= 0 )
-        {
-        pText.Replace( pos, KMemSpyNewLineChar().Length(), KMemSpyNewLineReplacementChar );
-        pos = pText.Find( KMemSpyNewLineChar );
-        }
-
-    __ASSERT_ALWAYS( pText.Length() == aText.Length(), User::Invariant() );
-    return text;
-    }
-
-
-EXPORT_C void MemSpyEngineUtils::GetRomInfoL( TDes& aPlatform, TDes& aChecksum )
-    {
-    aPlatform.Zero();
-    aChecksum.Zero();
-
-#ifdef __EPOC32__
-    // Get checksum 
-    TRomHeader* romHeader = (TRomHeader*) UserSvr::RomHeaderAddress();
-    if  ( romHeader )
-        {
-        aChecksum.Format( _L("0x%08x"), romHeader->iCheckSum );
-        }
-#endif
-
-    // Platform version
-    _LIT( KS60VersionDllName, "SysUtil.dll" );
-    RLibrary lib;
-    if  ( lib.Load( KS60VersionDllName ) == KErrNone )
-        {
-        // Get exported version function
-#ifdef __EPOC32__
-        const TInt KSysUtilOrdinal = 9;
-#else
-        const TInt KSysUtilOrdinal = 6;
-#endif
-        TLibraryFunction fn = lib.Lookup( KSysUtilOrdinal );
-        if ( fn != NULL )
-            {
-            TSysUtilGetSWVersionFunction sysUtilGetSWVersion = (TSysUtilGetSWVersionFunction) fn;
-            TInt err = (*sysUtilGetSWVersion)( aPlatform );
-            err = err;
-#ifdef _DEBUG
-            RDebug::Printf( "MemSpyEngineUtils::GetRomInfoL() - SysUtil::GetSWVersion() returned: %d", err );
-#endif
-            }
-
-        lib.Close();
-        }
-    }
-
-
-EXPORT_C void MemSpyEngineUtils::GetFolderL( RFs& aFsSession, TDes& aFolder, const CMemSpyEngineSinkMetaData& aMetaData, const TDriveNumber* aForceDrive )
-    {
-    const TChar KMemSpyDirectorySeparator = '\\';
-    const TChar KMemSpyDriveSeparator = ':';
-
-    TDriveList drives;
-    User::LeaveIfError( aFsSession.DriveList( drives ) );
-    
-    // We prefer to log to MMC if its available. If not, we'll log to C: instead. On
-    // WINS we prefer to log to C: because its easier to find via Windows Explorer.
-    TDriveNumber logDrive = EDriveC;
-    if  ( aForceDrive )
-        {
-        logDrive = *aForceDrive;
-        TRACE( RDebug::Printf( "MemSpyEngineUtils::GetFolderL() - FORCED TO DRIVE: %c:\\", *aForceDrive + 'A' ) );
-        }
-    else
-        {
-		// check if drive is specified in root path
-		if ( aMetaData.Root().Length() > 2 && aMetaData.Root()[1] == KMemSpyDriveSeparator )
-			{
-			TChar drive = aMetaData.Root()[0];
-			
-			// check if drive is valid
-			if (drives.Locate(drive) != KErrNone)
-				{
-				TDriveUnit driveUnit( aMetaData.Root().Left(1) );
-				logDrive = static_cast<TDriveNumber>(static_cast<TInt>(driveUnit));
-				}
-			else
-				{
-				logDrive = MemSpyEngineUtils::LocateSuitableDrive( aFsSession );
-				}
-			}
-		else
-			{
-			logDrive = MemSpyEngineUtils::LocateSuitableDrive( aFsSession );
-			}
-        }
-
-    // Prepare the drive buffer
-    HBufC* fileName = HBufC::NewLC( KMaxFileName * 2 );
-    TPtr pFileName( fileName->Des() );
-
-    // Prepare the drive name
-    TDriveUnit driveUnit( logDrive );
-    pFileName.Append( driveUnit.Name() );
-    
-    if ( aMetaData.Root().Length() == 0 )
-    	{
-		pFileName.Append( KMemSpyLogRootPath );
-    	}
-    else
-    	{
-		TPtrC root( aMetaData.Root() );
-		// check if root path contains drive (e.g. c:) and remove it
-		if ( root.Length() > 2 && root[1] == KMemSpyDriveSeparator )
-			{
-			root.Set( root.Mid( 2 ) );
-			}
-		// check if root starts with \ and remove it
-		if ( root.Length() > 1 && root[0] == KMemSpyDirectorySeparator )
-			{
-			root.Set( root.Mid( 1 ) );
-			}
-		
-		// append root path
-		pFileName.Append( KMemSpyDirectorySeparator );
-		pFileName.Append( root );
-		
-		// add trailing slash if necessary
-		if ( root[root.Length() - 1] != KMemSpyDirectorySeparator )
-			{
-			pFileName.Append( KMemSpyDirectorySeparator );
-			}
-    	}
-
-    // Add any custom folder information
-    if  ( aMetaData.Folder().Length() > 0 )
-        {
-        pFileName.Append( aMetaData.Folder() );
-        TRACE( RDebug::Print( _L("MemSpyEngineUtils::GetFolderL() - client folder: %S" ), &pFileName ) );
-
-        TChar lastChar = pFileName[ pFileName.Length() - 1 ];
-
-        // Take into account any "group" timestamp appendix
-        if  ( aMetaData.FolderTimeStamp().Length() )
-            {
-            if  ( lastChar != KMemSpyDirectorySeparator )
-                {
-                // Doesn't end with a backslash, so we must
-                // add separator info before the timestamp
-                pFileName.Append( ' ' );
-                pFileName.Append( '-' );
-                pFileName.Append( ' ' );
-                }
-
-            pFileName.Append( aMetaData.FolderTimeStamp() );
-            TRACE( RDebug::Print( _L("MemSpyEngineUtils::GetFolderL() - timestamp folder: %S" ), &pFileName ) );
-            }
-
-        // Ensure post-fixed by '\\' character
-        lastChar = ( pFileName[ pFileName.Length() - 1 ] );
-        if  ( lastChar != KMemSpyDirectorySeparator )
-            {
-            pFileName.Append( KMemSpyDirectorySeparator );
-            }
-        }
-
-    // Generate the timestamp file name
-    if  ( aMetaData.UseFileTimeStamp() )
-        {
-        TTime now;
-        now.HomeTime();
-        const TDateTime dateTime( now.DateTime() );
-        pFileName.AppendFormat( KMemSpyLogFileNameWithTimeStamp, dateTime.Year(), dateTime.Month() + 1, dateTime.Day() + 1,
-                                                                 dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond() );
-        TRACE( RDebug::Print( _L("MemSpyEngineUtils::GetFolderL() - timestamp file: %S" ), &pFileName ) );
-        }
-        
-    // Do we have some context information? If so, make sure its printable
-    HBufC* cleanedContext = NULL;
-    if  ( aMetaData.Context().Length() )
-        {
-        cleanedContext = CleanContextInfoLC( aMetaData.Context() );
-        }
-    else
-        {
-        // This must be the standard log then...
-        cleanedContext = KMemSpyLogDefaultName().AllocLC();
-        }
-
-    TRACE( RDebug::Print( _L("MemSpyEngineUtils::GetFolderL() - cleaned context: %S" ), cleanedContext ) );
-
-    // Build final part of file name
-    pFileName.Append( *cleanedContext );
-    CleanupStack::PopAndDestroy( cleanedContext );
-
-    // and finally, add the extension
-    if  ( aMetaData.Extension().Length() )
-        {
-        pFileName.Append( aMetaData.Extension() );
-        }
-    else
-        {
-        pFileName.Append( KMemSpyLogDefaultExtension );
-        }
-
-    TRACE( RDebug::Print( _L("MemSpyEngineUtils::GetFolderL() - END - fileName: %S"), fileName ) );
-    if  ( pFileName.Length() > aFolder.MaxLength() )
-        {
-        User::Leave( KErrOverflow );
-        }
-
-    aFolder.Copy( pFileName );
-    CleanupStack::PopAndDestroy( fileName );
-    }
-
-
-TDriveNumber MemSpyEngineUtils::LocateSuitableDrive( RFs& aFsSession )
-    {
-#ifndef __WINS__
-    TDriveInfo driveInfo;
-    TDriveList drives;
-    if  ( aFsSession.DriveList( drives ) == KErrNone )
-        {
-        for( TInt i=EDriveY; i>=EDriveD; i-- )
-            {
-            const TDriveNumber drive = static_cast< TDriveNumber >( i );
-            TRACE( RDebug::Print( _L("MemSpyEngineUtils::LocateSuitableDrive() - drive: %c:\\, available: %d"), drive + 'A', drives[ drive ] ) );
-
-            // Is drive available from an OS perspective?
-            if  ( drives[ drive ] != 0 )
-                {
-                // Check whether there is a disk present or not.
-                const TInt driveInfoErr = aFsSession.Drive( driveInfo, drive );
-                TRACE( RDebug::Print( _L("MemSpyEngineUtils::LocateSuitableDrive() - drive: %c:\\, driveInfoErr: %d"), drive + 'A', driveInfoErr ) );
-                if  ( driveInfoErr == KErrNone )
-                    {
-                    // Check if the drive is removable. We'll try to 
-                    // save data here in preference to the system drive if at all
-                    // possible...
-                    const TBool removable = ( driveInfo.iDriveAtt & KDriveAttRemovable );
-                    const TBool ram = ( driveInfo.iType == EMediaRam );
-                    const TBool rom = ( driveInfo.iType == EMediaRom );
-                    TRACE( RDebug::Printf( "MemSpyEngineUtils::LocateSuitableDrive() - drive: %c:\\, removable: %d, ram: %d, rom: %d", drive + 'A', removable, ram, rom ) );
-                    //
-                    if  ( removable && !( ram || rom ) )
-                        {
-                        // Check free space etc
-                        TVolumeInfo volInfo;
-                        const TInt volInfoErr = aFsSession.Volume( volInfo, drive );
-                        TRACE( RDebug::Printf( "MemSpyEngineUtils::LocateSuitableDrive() - drive: %c:\\, volInfoErr: %d", drive + 'A', volInfoErr ) );
-                        if  ( volInfoErr == KErrNone )
-                            {
-                            TRACE( RDebug::Printf( "MemSpyEngineUtils::LocateSuitableDrive() - END - using drive: %c:\\", drive + 'A', removable ) );
-                            return drive;
-                            }
-                        }
-                    }
-                }
-            }
-
-        }
-#else
-	(void) aFsSession;
-#endif
-
-    // Don't use RFs::GetSystemDrive() as it isn't available on v9.1
-    TRACE( RDebug::Printf( "MemSpyEngineUtils::LocateSuitableDrive() - END - fallback to EDriveC" ) );
-    return EDriveC;
-    }
-
-
-void MemSpyEngineUtils::FormatTimeNowL( TDes& aBuf, TBool aLocalTime )
-    {
-    TTime time;
-    if  ( aLocalTime )
-        {
-        time.HomeTime();
-        }
-    else
-        {
-        time.UniversalTime();
-        }
-
-    FormatTimeL( aBuf, time, aLocalTime );
-    }
-
-
-HBufC* MemSpyEngineUtils::DataStreamFolderNameWithTimeStampLC( const TDesC& aFolderName )
-    {
-    TMemSpyTimeText time;
-    FormatTimeNowL( time, ETrue );
-    //
-    HBufC* folder = HBufC::NewLC( aFolderName.Length() + time.Length() + 10 );
-    TPtr pFolder( folder->Des() );
-    //
-    pFolder.Append( aFolderName );
-    pFolder.Append( time );
-    //
-    return folder;
-    }
-
-
-void MemSpyEngineUtils::GetKernelHeapThreadName( TDes& aBuf, TBool aFullName )
-    {
-    if  ( !aFullName )
-        {
-        aBuf.Copy( KMemSpyKernelProcessName );
-        }
-    else
-        {
-        aBuf.Copy( KMemSpyKernelProcessFullName );
-        }
-
-    aBuf.Append( KMemSpyEngineDoubleColon );
-    aBuf.Append( KMemSpyKernelThreadName );
-    }
-
-
-void MemSpyEngineUtils::GetKernelHeapThreadAndProcessNames( TDes& aThreadName, TDes& aProcessName )
-    {
-    aThreadName.Copy( KMemSpyKernelThreadName );
-    aProcessName.Copy( KMemSpyKernelProcessName );
-    }
-
-
-TUint32 MemSpyEngineUtils::Hash( const TDesC& aText )
-    {
-    // DJB Hash Function
-    TUint32 hash = 5381;
-    //
-    const TInt length = aText.Length();
-    for( TInt i = 0; i < length; i++)
-        {
-        hash = ((hash << 5) + hash) + aText[ i ];
-        }
-    //
-    return hash;
-    }
-
-
-void MemSpyEngineUtils::Panic( TMemSpyEnginePanic aPanic )
-    {
-    _LIT( KMemSpyEnginePanicCategory, "MemSpyEngine" );
-    User::Panic( KMemSpyEnginePanicCategory, aPanic );
-    }
-
-
-TProcessId MemSpyEngineUtils::IdentifyFileServerProcessIdL()
-    {
-    TRACE( RDebug::Printf( "MemSpyEngineUtils::IdentifyFileServerProcessIdL() - START" ) );
-
-    TProcessId ret = KNullProcessId;
-
-    _LIT(KFindMask, "efile*");
-    TFullName name( KFindMask );
-    TFindProcess finder( name );
-
-    if  ( finder.Next( name ) == KErrNone )
-        {
-        RProcess process;
-        const TInt error = process.Open( name );
-        TRACE( RDebug::Print( _L("MemSpyEngineUtils::IdentifyFileServerProcessIdL() - process open err: %d, name: %S"), error, &name ) );
-        if  ( error == KErrNone )
-            {
-            ret = process.Id();
-            }
-
-        process.Close();
-        }
-
-    TRACE( RDebug::Printf( "MemSpyEngineUtils::IdentifyFileServerProcessIdL() - almost done - ret: %d", (TUint) ret ) );
-
-    if  ( static_cast< TUint >( ret ) == KNullProcessId )
-        {
-        User::Leave( KErrNotFound );
-        }
-
-    TRACE( RDebug::Printf( "MemSpyEngineUtils::IdentifyFileServerProcessIdL() - END - ret: %d", (TUint) ret ) );
-    return ret;
-    }
-
-
-HBufC* MemSpyEngineUtils::CleanContextInfoLC( const TDesC& aContext )
-    {
-    TRACE( RDebug::Print( _L("MemSpyEngineUtils::CleanContextInfoLC() - START - %S"), &aContext ) );
-    TFileName fileName;
-
-    TBool seenDoubleColon = EFalse;
-    const TInt length = aContext.Length();
-    for( TInt i=0; i<length; i++ )
-        {
-        const TChar c( aContext[ i ] );
-        const TBool haveNextChar = ( i+1 < length );
-        //
-        //TRACE( RDebug::Print( _L("MemSpyEngineUtils::CleanContextInfoLC() - c[%03d]: \'%c\', haveNextChar: %d, seenDoubleColon: %d"), i, (TUint32) c, haveNextChar, seenDoubleColon ) );
-        //
-        if  ( c == ':' && haveNextChar && aContext[ i + 1 ] == ':' )
-            {
-            // Skip double colon
-            i++;
-            fileName.Append( '-' );
-            seenDoubleColon = ETrue;
-            }
-        else if ( c == '.' )
-            {
-            if  ( seenDoubleColon )
-                {
-                break;
-                }
-            else
-                {
-                fileName.Append( '-' );
-                }
-            }
-        else
-            {
-            fileName.Append( c );
-            }
-        }
-
-    TRACE( RDebug::Print( _L("MemSpyEngineUtils::CleanContextInfoLC() - END - %S"), &fileName ) );
-    return fileName.AllocLC();
-    }
-
-
--- a/memspy/Engine/Source/Sink/MemSpyEngineOutputList.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,433 +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 <memspy/engine/memspyengineoutputlist.h>
-
-// System includes
-#include <e32debug.h>
-
-// User includes
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include "MemSpyEngineOutputListItem.h"
-
-// Constants
-_LIT( KMemSpyOutputListPseudoBlankItem, " " );
-
-
-CMemSpyEngineOutputList::CMemSpyEngineOutputList( CMemSpyEngineOutputSink* aSink )
-:   iSink( aSink ), iFormatBufferPtr( NULL, 0 )
-    {
-    }
-
-
-CMemSpyEngineOutputList::~CMemSpyEngineOutputList()
-    {
-    delete iFormatBuffer;
-    iItems.ResetAndDestroy();
-    iItems.Close();
-    }
-
-
-void CMemSpyEngineOutputList::ConstructL()
-    {
-    iFormatBuffer = HBufC::NewL( 1024 );
-    iFormatBufferPtr.Set( iFormatBuffer->Des() );
-    }
-
-
-CMemSpyEngineOutputList* CMemSpyEngineOutputList::NewL()
-    {
-    CMemSpyEngineOutputList* self = new(ELeave) CMemSpyEngineOutputList();
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-CMemSpyEngineOutputList* CMemSpyEngineOutputList::NewLC( CMemSpyEngineOutputSink& aSink )
-    {
-    CMemSpyEngineOutputList* self = new(ELeave) CMemSpyEngineOutputList( &aSink );
-    CleanupStack::PushL( self );
-
-    // No need to call ConstructL - it uses the sink's format buffer
-    return self;
-    }
-
-
-TInt CMemSpyEngineOutputList::MdcaCount() const
-    {
-    return iItems.Count();
-    }
-
-
-TPtrC CMemSpyEngineOutputList::MdcaPoint( TInt aPos ) const
-    {
-    CMemSpyEngineOutputListItem* item = iItems[ aPos ];
-    return TPtrC( item->Combined() );
-    }
-
-
-void CMemSpyEngineOutputList::PrintL()
-    {
-    ASSERT( iSink != NULL );
-    PrintL( *iSink );
-    }
-
-
-void CMemSpyEngineOutputList::PrintL( CMemSpyEngineOutputSink& aSink )
-    {
-    const TInt count = iItems.Count();
-    if  ( count > 0 )
-        {
-        // First pass to get max lengths
-        TInt maxLengthCaption = 0;
-        TInt maxLengthValue = 0;
-
-        for( TInt j=0; j<count; j++ )
-            {
-            const CMemSpyEngineOutputListItem* item = iItems[ j ];
-			if (item->Value().Length())
-				{
-	            maxLengthCaption = Max( maxLengthCaption, item->Caption().Length() );
-	            maxLengthValue = Max( maxLengthValue, item->Value().Length() );
-				}
-			else
-				{
-				// If something doesn't have a value (ie it's a section header, represented as just a caption) then the caption
-				// shouldn't be factored into the maxcaptionlength. But consider it in maxlengthValue to make sure we actually
-				// make the overall buffers big enough
-				maxLengthValue = Max( maxLengthValue, item->Caption().Length() );
-				}
-            }
-
-        // Second pass - real this time - to print the values
-        HBufC* line = HBufC::NewLC( ( maxLengthCaption + maxLengthValue ) + 20 );
-        TPtr pLine( line->Des() );
-        //
-        for( TInt i=0; i<count; i++ )
-            {
-            const CMemSpyEngineOutputListItem* item = iItems[ i ];
-
-            // Remove initial tabs in caption
-            HBufC* caption = MemSpyEngineUtils::CleanupTextLC( item->Caption() );
-        
-            // Create value item & replace any further tabs
-            HBufC* value = MemSpyEngineUtils::CleanupTextLC( item->Value() );
-
-            // Now format the final line, with padding.
-			if (value->Length()) 
-				{
-	            pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') );
-				}
-			else
-				{
-				// items without value (ie just captions, ie section headers) aren't constrained by the maxLengthCaption restriction
-				pLine.Copy(*caption);
-				}
-            pLine.Append( *value );
-            CleanupStack::PopAndDestroy( 2, caption );
-
-            // Sink output
-            aSink.OutputLineL( pLine );
-            }
-        //
-        CleanupStack::PopAndDestroy( line );
-        }
-    }
-
-
-CMemSpyEngineOutputListItem& CMemSpyEngineOutputList::Item( TInt aPos )
-    {
-    CMemSpyEngineOutputListItem* ret = iItems[ aPos ];
-    return *ret;
-    }
-
-
-const CMemSpyEngineOutputListItem& CMemSpyEngineOutputList::Item( TInt aPos ) const
-    {
-    const CMemSpyEngineOutputListItem* ret = iItems[ aPos ];
-    return *ret;
-    }
-
-
-void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption )
-    {
-    AddItemL( aCaption, KNullDesC );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, const TDesC& aValue )
-    {
-    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewLC( aCaption, aValue );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, TInt aValue )
-    {
-    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewDecimalLC( aCaption, aValue );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, TUint aValue )
-    {
-    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewDecimalLC( aCaption, aValue );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, const TInt64& aValue )
-    {
-    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewLongLC( aCaption, aValue );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, TAny* aValue )
-    {
-    AddItemHexL( aCaption, (TUint) aValue );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, TUint* aValue )
-    {
-    AddItemHexL( aCaption, (TUint) aValue );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, TUint8* aValue )
-    {
-    AddItemHexL( aCaption, (TUint) aValue );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemFormatL( TRefByValue<const TDesC> aFormat, ... )
-    {
-	VA_LIST list;
-	VA_START(list,aFormat);
-
-    TPtr formatBuffer( FormatBuffer() );
-	formatBuffer.Zero();
-    formatBuffer.FormatList( aFormat, list );
-    //
-    AddItemL( formatBuffer, KNullDesC );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemFormatL( const TDesC& aCaption, TRefByValue<const TDesC> aValueFormat, ... )
-    {
-	VA_LIST list;
-	VA_START(list,aValueFormat);
-
-    TPtr formatBuffer( FormatBuffer() );
-	formatBuffer.Zero();
-    formatBuffer.FormatList( aValueFormat, list );
-    //
-    AddItemL( aCaption, formatBuffer );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemFormatUCL( TRefByValue<const TDesC> aFormat, ... )
-    {
-	VA_LIST list;
-	VA_START(list,aFormat);
-
-    TPtr formatBuffer( FormatBuffer() );
-	formatBuffer.Zero();
-    formatBuffer.FormatList( aFormat, list );
-    //
-    AddItemUCL( formatBuffer, KNullDesC );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemUCL( const TDesC& aCaption, const TDesC& aValue )
-    {
-    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewLC( aCaption, aValue );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    //
-    item->iCaption->Des().UpperCase();
-    item->UpdateCombinedL();
-    }
-
-
-void CMemSpyEngineOutputList::AddItemFormatUCL( const TDesC& aCaption, TRefByValue<const TDesC> aValueFormat, ... )
-    {
-	VA_LIST list;
-	VA_START(list,aValueFormat);
-
-    TPtr formatBuffer( FormatBuffer() );
-	formatBuffer.Zero();
-    formatBuffer.FormatList( aValueFormat, list );
-    //
-    AddItemUCL( aCaption, formatBuffer );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemHexL( const TDesC& aCaption, TUint aValue )
-    {
-    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewHexLC( aCaption, aValue );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemYesNoL( const TDesC& aCaption, TBool aYes )
-    {
-    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewYesNoLC( aCaption, aYes );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemTrueFalseL( const TDesC& aCaption, TBool aTrue )
-    {
-    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewTrueFalseLC( aCaption, aTrue );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemOnOffL( const TDesC& aCaption, TBool aOn )
-    {
-    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewOnOffLC( aCaption, aOn );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyEngineOutputList::AddItemPercentageL( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue )
-    {
-    const TMemSpyPercentText val( MemSpyEngineUtils::FormatPercentage( TReal( aOneHundredPercentValue ), TReal( aValue ) ) );
-    AddItemL( aCaption, val );
-    }
-
-
-void CMemSpyEngineOutputList::AddBlankItemL( TInt aRepetitions )
-    {
-    const TInt count = Count();
-    InsertBlankItemL( count, aRepetitions );
-    }
-
-
-void CMemSpyEngineOutputList::AddUnderlineForPreviousItemL( TChar aUnderlineCharacter, TInt aBlankItemCount )
-    {
-    const TInt count = iItems.Count();
-    if  ( count > 0 )
-        {
-        InsertUnderlineForItemAtL( count - 1, aUnderlineCharacter, aBlankItemCount );
-        }
-    }
-
-
-void CMemSpyEngineOutputList::InsertItemL( TInt aPos, const TDesC& aCaption )
-    {
-    InsertItemL( aPos, aCaption, KNullDesC );
-    }
-
-
-void CMemSpyEngineOutputList::InsertItemL( TInt aPos, const TDesC& aCaption, const TDesC& aValue )
-    {
-    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewLC( aCaption, aValue );
-    iItems.InsertL( item, aPos );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyEngineOutputList::InsertItemFormatUCL( TInt aPos, TRefByValue<const TDesC> aValueFormat, ... )
-    {
-	VA_LIST list;
-	VA_START(list,aValueFormat);
-
-    TPtr formatBuffer( FormatBuffer() );
-	formatBuffer.Zero();
-    formatBuffer.FormatList( aValueFormat, list );
-    //
-    InsertItemL( aPos, formatBuffer, KNullDesC );
-    }
-
-
-void CMemSpyEngineOutputList::InsertBlankItemL( TInt aPos, TInt aRepetitions )
-    {
-    while( aRepetitions-- > 0 )
-        {
-        InsertItemL( aPos, KMemSpyOutputListPseudoBlankItem, KMemSpyOutputListPseudoBlankItem );
-        }
-    }
-
-
-void CMemSpyEngineOutputList::InsertUnderlineForItemAtL( TInt aPos, TChar aUnderlineCharacter, TInt aBlankItemCount )
-    {
-    const CMemSpyEngineOutputListItem& item = Item( aPos );
-    
-    // Clean text
-    HBufC* caption = MemSpyEngineUtils::CleanupTextLC( item.Caption() );
-    //RDebug::Print( _L("CMemSpyEngineOutputList::AddUnderlineForPreviousItemL() - [%3d] caption: %S"), caption->Length(), caption );
-    HBufC* value = MemSpyEngineUtils::CleanupTextLC( item.Value() );
-    //RDebug::Print( _L("CMemSpyEngineOutputList::AddUnderlineForPreviousItemL() - [%3d] value: %S"), value->Length(), value );
-    
-    // Make underline descriptor
-    TBuf<1> underline;
-    underline.Append( aUnderlineCharacter );
-
-    // Make underline items
-    const TInt lenCaption = caption->Length();
-    if ( lenCaption > 0 )
-        {
-        TPtr pText( caption->Des() );
-        pText.Repeat( underline );
-        }
-
-    const TInt lenValue = value->Length();
-    if ( lenValue > 0 )
-        {
-        TPtr pText( value->Des() );
-        pText.Repeat( underline );
-        }
-
-    // Create new item
-    InsertItemL( aPos + 1, *caption, *value );
-
-    // Clean up
-    CleanupStack::PopAndDestroy( 2, caption );
-
-    // Make blank row if needed
-    InsertBlankItemL( aPos + 2, aBlankItemCount );
-    }
-
-
-TPtr& CMemSpyEngineOutputList::FormatBuffer()
-    {
-    if  ( iSink )
-        {
-        return iSink->FormatBuffer();
-        }
-    //
-    return iFormatBufferPtr;
-    }
-
-
-
-
-
--- a/memspy/Engine/Source/Sink/MemSpyEngineOutputListItem.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,280 +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 "MemSpyEngineOutputListItem.h"
-
-// System includes
-#include <e32debug.h>
-
-// User includes
-#include <memspy/engine/memspyengineutils.h>
-
-// Constants
-const TInt KMemSpyNumericFormatBufferSize = 20;
-
-// Literal constants
-_LIT(KMemSpyNumericHexFormat, "0x%08x");
-_LIT(KMemSpyNumericUnsignedFormat, "%u");
-_LIT(KMemSpyNumericDecFormat, "%d");
-_LIT(KMemSpyNumericLongFormat, "%Ld");
-_LIT(KMemSpyCaptionYes, "Yes");
-_LIT(KMemSpyCaptionNo, "No");
-_LIT(KMemSpyCaptionOn, "On");
-_LIT(KMemSpyCaptionOff, "Off");
-_LIT(KMemSpyCaptionTrue, "True");
-_LIT(KMemSpyCaptionFalse, "False");
-
-
-
-CMemSpyEngineOutputListItem::CMemSpyEngineOutputListItem()
-    {
-    }
-
-
-CMemSpyEngineOutputListItem::~CMemSpyEngineOutputListItem()
-    {
-    delete iCaption;
-    delete iValue;
-    delete iCombined;
-    }
-
-
-void CMemSpyEngineOutputListItem::ConstructL( const TDesC& aCaption, const TDesC& aValue )
-    {
-    iCaption = aCaption.AllocL();
-    iValue = aValue.AllocL();
-    //
-    UpdateCombinedL();
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewLC( const CMemSpyEngineOutputListItem& aCopyMe )
-    {
-    CMemSpyEngineOutputListItem* self = new(ELeave) CMemSpyEngineOutputListItem();
-    CleanupStack::PushL( self );
-    self->ConstructL( aCopyMe.Caption(), aCopyMe.Value() );
-    return self;
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewLC( const TDesC& aCaption )
-    {
-    CMemSpyEngineOutputListItem* self = new(ELeave) CMemSpyEngineOutputListItem();
-    CleanupStack::PushL( self );
-    self->ConstructL( aCaption, KNullDesC );
-    return self;
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewLC( const TDesC& aCaption, const TDesC& aValue )
-    {
-    CMemSpyEngineOutputListItem* self = new(ELeave) CMemSpyEngineOutputListItem();
-    CleanupStack::PushL( self );
-    self->ConstructL( aCaption, aValue );
-    return self;
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewLC( const TDesC& aCaption, TUint aValue )
-    {
-    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
-    ret->SetUnsignedL( aValue );
-    return ret;
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewHexLC( const TDesC& aCaption, TUint aValue )
-    {
-    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
-    ret->SetHexL( aValue );
-    return ret;
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewDecimalLC( const TDesC& aCaption, TInt aValue )
-    {
-    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
-    ret->SetDecimalL( aValue );
-    return ret;
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewLongLC( const TDesC& aCaption, const TInt64& aValue )
-    {
-    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
-    ret->SetLongL( aValue );
-    return ret;
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewYesNoLC( const TDesC& aCaption, TBool aYes )
-    {
-    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
-    ret->SetYesNoL( aYes );
-    return ret;
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewTrueFalseLC( const TDesC& aCaption, TBool aTrue )
-    {
-    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
-    ret->SetTrueFalseL( aTrue );
-    return ret;
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewOnOffLC( const TDesC& aCaption, TBool aOn )
-    {
-    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
-    ret->SetOnOffL( aOn );
-    return ret;
-    }
-
-
-CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewPercentageLC( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue )
-    {
-    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
-    ret->SetPercentageL( aOneHundredPercentValue, aValue );
-    return ret;
-    }
-
-
-void CMemSpyEngineOutputListItem::SetValueL( const TDesC& aValue )
-    {
-    if  ( iValue == NULL )
-        {
-        iValue = aValue.AllocL();
-        }
-    else
-        {
-        if  ( iValue->Des().MaxLength() < aValue.Length() )
-            {
-            iValue = iValue->ReAllocL( aValue.Length() );
-            }
-            
-        // Now its safe to assign new content
-        *iValue = aValue;
-        }
-        
-    UpdateCombinedL();
-    }
-
-
-void CMemSpyEngineOutputListItem::SetUnsignedL( TUint aValue )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    val.Format( KMemSpyNumericUnsignedFormat, aValue );
-    SetValueL( val );
-    }
-
-
-void CMemSpyEngineOutputListItem::SetHexL( TUint aValue )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    val.Format( KMemSpyNumericHexFormat, aValue );
-    SetValueL( val );
-    }
-
-
-void CMemSpyEngineOutputListItem::SetDecimalL( TInt aValue )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    val.Format( KMemSpyNumericDecFormat, aValue );
-    SetValueL( val );
-    }
-
-
-void CMemSpyEngineOutputListItem::SetLongL( const TInt64& aValue )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    val.Format( KMemSpyNumericLongFormat, aValue );
-    SetValueL( val );
-    }
-
-
-void CMemSpyEngineOutputListItem::SetYesNoL( TBool aYes )
-    {
-    if  ( aYes )
-        {
-        SetValueL( KMemSpyCaptionYes );
-        }
-    else
-        {
-        SetValueL( KMemSpyCaptionNo );
-        }
-    }
-
-
-void CMemSpyEngineOutputListItem::SetTrueFalseL( TBool aTrue )
-    {
-    if  ( aTrue )
-        {
-        SetValueL( KMemSpyCaptionTrue );
-        }
-    else
-        {
-        SetValueL( KMemSpyCaptionFalse );
-        }
-    }
-
-
-void CMemSpyEngineOutputListItem::SetOnOffL( TBool aOn )
-    {
-    if  ( aOn )
-        {
-        SetValueL( KMemSpyCaptionOn );
-        }
-    else
-        {
-        SetValueL( KMemSpyCaptionOff );
-        }
-    }
-
-
-void CMemSpyEngineOutputListItem::SetPercentageL( TInt aOneHundredPercentValue, TInt aValue )
-    {
-    const TMemSpyPercentText val( MemSpyEngineUtils::FormatPercentage( TReal( aOneHundredPercentValue ), TReal( aValue ) ) );
-    SetValueL( val );
-    }
-
-
-void CMemSpyEngineOutputListItem::UpdateCombinedL()
-    {
-    const TInt requiredLength = Caption().Length() + Value().Length() + 10;
-    //
-    if  ( iCombined == NULL )
-        {
-        iCombined = HBufC::NewL( requiredLength );
-        }
-    else if ( iCombined->Des().MaxLength() < requiredLength )
-        {
-        iCombined = iCombined->ReAllocL( requiredLength );
-        }
-        
-    TPtr pCombined( iCombined->Des() );
-    pCombined.Zero();
-    pCombined.Append( _L("\t") );
-    pCombined.Append( Caption() );
-    pCombined.Append( _L("\t\t") );
-    pCombined.Append( Value() );
-    }
-
-
-
-
-
-
--- a/memspy/Engine/Source/Sink/MemSpyEngineOutputSink.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,444 +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 <memspy/engine/memspyengineoutputsink.h>
-
-// User includes
-#include <memspy/engine/memspyengineutils.h>
-
-// Constants
-const TInt KMemSpyItemAndValueAlignmentAmount = 30;
-const TInt KMemSpyNumericFormatBufferSize = 20;
-
-// Literal constants
-_LIT( KMemSpyNumericHexFormat, "0x%08x" );
-_LIT( KMemSpyNumericDecFormat, "%d" );
-_LIT( KMemSpyDataStreamFolderNameFormatSpec, "%04d%02d%02d - %02dh %02dm %02ds" );
-
-
-CMemSpyEngineOutputSink::CMemSpyEngineOutputSink( CMemSpyEngine& aEngine )
-:   iEngine( aEngine ), iFormatBufferPointer( NULL, 0 )
-    {
-    }
-
-
-CMemSpyEngineOutputSink::~CMemSpyEngineOutputSink()
-    {
-    delete iFormatBuffer;
-    delete iPrefix;
-    delete iLocalBuffer;
-    delete iDataStreamTimeStampSpecifier;
-    }
-
-
-void CMemSpyEngineOutputSink::BaseConstructL()
-    {
-    iFormatBuffer = HBufC::NewL( 1024 );
-    iFormatBufferPointer.Set( iFormatBuffer->Des() );
-    iPrefix = HBufC::NewL( 2048 );
-    iLocalBuffer = HBufC::NewL( 2048 );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::DataStreamTimeStampBeginL( const TTime& aTime )
-    {
-    const TDateTime dt( aTime.DateTime() );
-
-    // Build it up...
-    HBufC* spec = HBufC::NewL( KMaxFileName );
-    TPtr pName( spec->Des() );
-    pName.Format( KMemSpyDataStreamFolderNameFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second());
-    
-    DataStreamTimeStampEnd();
-    iDataStreamTimeStampSpecifier = spec;
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::DataStreamTimeStampEnd()
-    {
-    delete iDataStreamTimeStampSpecifier;
-    iDataStreamTimeStampSpecifier = NULL;
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::DataStreamBeginL( const TDesC& aContext )
-    {
-    DataStreamBeginL( aContext, KNullDesC );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder )
-    {
-    DataStreamBeginL( aContext, aFolder, KNullDesC );
-    }
-
-
-void CMemSpyEngineOutputSink::ProcessSuspendedL( TProcessId /*aId*/ )
-    {
-    }
-
-
-void CMemSpyEngineOutputSink::ProcessResumed( TProcessId /*aId*/ )
-    {
-    }
-
-
-TBool CMemSpyEngineOutputSink::IsPrefixAllowed( const TDesC& /*aPrefix*/ )
-    {
-    return ETrue;
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputPrefixSetLC( const TDesC& aPrefix )
-    {
-    __ASSERT_ALWAYS( aPrefix.Length() <= iPrefix->Des().MaxLength(), User::Invariant() );
-    TPtr pPrefix( iPrefix->Des() );
-    pPrefix.Zero();
-
-    if  ( IsPrefixAllowed( aPrefix ) )
-        {
-        pPrefix.Copy( aPrefix );
-        }
-
-    CleanupStack::PushL( TCleanupItem( ClearPrefix, this ) );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputPrefixSetFormattedLC( TRefByValue<const TDesC> aFormat, ... )
-    {
-	VA_LIST list;
-	VA_START(list,aFormat);
-    //
-	iFormatBufferPointer.Zero();
-    iFormatBufferPointer.FormatList( aFormat, list );
-    //
-    OutputPrefixSetLC( iFormatBufferPointer );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputPrefixClear()
-    {
-    iPrefix->Des().Zero();
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputRawL( const TDesC8& aData )
-    {
-    DoOutputRawL( aData );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputLineL( const TDesC& aLine, TBool aIncludePrefix )
-    {
-    TPtr pBuffer( iLocalBuffer->Des() );
-    if  ( aIncludePrefix )
-        {
-        pBuffer.Copy( *iPrefix );
-        }
-    else
-        {
-        pBuffer.Zero();
-        }
-
-    pBuffer.Append( aLine );
-    DoOutputLineL( pBuffer );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputLineFormattedL( TRefByValue<const TDesC> aFormat, ... )
-    {
-	VA_LIST list;
-	VA_START(list,aFormat);
-
-	iFormatBufferPointer.Zero();
-    iFormatBufferPointer.FormatList( aFormat, list );
-    //
-    OutputLineL( iFormatBufferPointer );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputBlankLineL()
-    {
-    DoOutputLineL( KNullDesC );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputSectionHeadingL( const TDesC& aCaption, TChar aUnderlineCharacter )
-    {
-    OutputBlankLineL();
-    OutputLineL( aCaption );
-    //
-    HBufC* underline = HBufC::NewLC( aCaption.Length() );
-    TPtr pUnderline( underline->Des() );
-    pUnderline.Fill( aUnderlineCharacter, aCaption.Length());
-    OutputLineL( *underline );
-    CleanupStack::PopAndDestroy( underline );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputItemAndValueL( const TDesC& aItem, const TDesC& aValue )
-    {
-    FormatBuffer().Zero();
-    FormatBuffer().Append( aItem );
-    FormatBuffer().Append( ':' );
-
-    const TInt padAmount = KMemSpyItemAndValueAlignmentAmount - aItem.Length();
- 
-    FormatBuffer().AppendFill(' ', padAmount);
-    FormatBuffer().Append( ' ' );
-    FormatBuffer().Append( aValue );
-
-    OutputLineL( FormatBuffer() );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputItemAndValueL( const TDesC& aItem, TUint aValue, TBool aHex )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    //
-    if  ( aHex )
-        {
-        val.Format( KMemSpyNumericHexFormat, aValue );
-        }
-    else
-        {
-        val.Format( KMemSpyNumericDecFormat, aValue );
-        }
-    //
-    OutputItemAndValueL( aItem, val );
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputBinaryDataL( const TDesC& aFormat, const TUint8* aBufferAddress, const TUint8* aDisplayStartAddress, TInt aLength )
-    {
-    _LIT(KAddresPostfix, ": ");
-    _LIT(KDoubleSpace, "  ");
-    _LIT(KSingleSpace, " ");
-
-    const TInt maxLen = aLength;
-    TInt len = aLength;
-    const TUint8* pDataAddr = aBufferAddress;
-
-	TBuf<81> out;
-	TBuf<20> ascii;
-	TInt offset = 0;
-	const TUint8* a = pDataAddr;
-    const TUint8* displayAddress = aDisplayStartAddress;
-    //
-	while(len>0)
-		{
-		out.Zero();
-		ascii.Zero();
-		out.AppendNumFixedWidth((TUint) displayAddress, EHex, 8);
-		out.Append(KAddresPostfix);
-
-        TUint b;
-		for (b=0; b<16; b++)
-			{
-            TUint8 c = ' ';
-            if	((pDataAddr + offset + b) < pDataAddr + maxLen)
-	            {
-	            c = *(pDataAddr + offset + b);
-				out.AppendNumFixedWidth(c, EHex, 2);
-	            }
-            else
-	            {
-				out.Append(KDoubleSpace);
-	            }
-			out.Append( KSingleSpace );
-			if (c<=0x20 || c == 0x27 || c>=0x7f || c=='%')
-				c=0x2e;
-			ascii.Append(TChar(c));
-			}
-		out.Append(ascii);
-        out.ZeroTerminate();
-
-        FormatBuffer().Format( aFormat, &out );
-        OutputLineL( FormatBuffer() );
-
-        displayAddress += 16;
-        a += 16;
-		offset += 16;
-		len -= 16;
-        }
-    }
-
-
-EXPORT_C void CMemSpyEngineOutputSink::OutputBinaryDataCompressedL( const TDesC& aFormat, const TUint8* aBufferAddress, const TUint8* aDisplayStartAddress, TInt aLength )
-    {
-    _LIT(KAddresPostfix, ": ");
-    _LIT(KDoubleSpace, "  ");
-
-    const TInt maxLen = aLength;
-    TInt len = aLength;
-    const TUint8* pDataAddr = aBufferAddress;
-
-	TBuf<81> out;
-	TInt offset = 0;
-	const TUint8* a = pDataAddr;
-    const TUint8* displayAddress = aDisplayStartAddress;
-    //
-	while(len>0)
-		{
-		out.Zero();
-		out.AppendNumFixedWidth((TUint) displayAddress, EHex, 8);
-		out.Append(KAddresPostfix);
-
-        TUint b;
-		for (b=0; b<16; b++)
-			{
-            TUint8 c = ' ';
-            if	((pDataAddr + offset + b) < pDataAddr + maxLen)
-	            {
-	            c = *(pDataAddr + offset + b);
-				out.AppendNumFixedWidth(c, EHex, 2);
-	            }
-            else
-	            {
-				out.Append(KDoubleSpace);
-	            }
-			if (c<=0x20 || c>=0x7f || c=='%')
-				c=0x2e;
-			}
-        out.ZeroTerminate();
-
-        FormatBuffer().Format( aFormat, &out );
-        OutputLineL( FormatBuffer() );
-
-        displayAddress += 16;
-        a += 16;
-		offset += 16;
-		len -= 16;
-        }
-    }
-
-
-TPtr& CMemSpyEngineOutputSink::FormatBuffer()
-    {
-    return iFormatBufferPointer;
-    }
-
-
-CMemSpyEngine& CMemSpyEngineOutputSink::Engine()
-    {
-    return iEngine;
-    }
-
-
-void CMemSpyEngineOutputSink::ClearPrefix( TAny* aSelf )
-    {
-    CMemSpyEngineOutputSink* self = reinterpret_cast< CMemSpyEngineOutputSink* >( aSelf );
-    self->OutputPrefixClear();
-    }
-
-
-const TDesC& CMemSpyEngineOutputSink::DataStreamTimeStamp() const
-    {
-    if  ( iDataStreamTimeStampSpecifier )
-        {
-        return *iDataStreamTimeStampSpecifier;
-        }
-
-    return KNullDesC;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineSinkMetaData::CMemSpyEngineSinkMetaData( TBool aOverwrite, TBool aUseFileTimeStamp )
-:   iOverwrite( aOverwrite ), iUseFileTimeStamp( aUseFileTimeStamp )
-    {
-    }
-
-
-EXPORT_C CMemSpyEngineSinkMetaData::~CMemSpyEngineSinkMetaData()
-    {
-	delete iRoot;
-    delete iContext;
-    delete iFolder;
-    delete iExtension;
-    delete iFolderTimeStamp;
-    }
-
-
-void CMemSpyEngineSinkMetaData::ConstructL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, const TTime& aFolderTime )
-    {
-	iRoot = aRoot.AllocL();
-    iContext = aContext.AllocL();
-    iFolder = aFolder.AllocL();
-    iExtension = aExtension.AllocL();
-
-    const TDateTime dt = aFolderTime.DateTime();
-    HBufC* spec = HBufC::NewLC( KMaxFileName );
-    TPtr pName( spec->Des() );
-    pName.Format( KMemSpyDataStreamFolderNameFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second());
-    iFolderTimeStamp = pName.AllocL();
-    CleanupStack::PopAndDestroy( spec );
-    }
-
-
-EXPORT_C CMemSpyEngineSinkMetaData* CMemSpyEngineSinkMetaData::NewL()
-    {
-    return CMemSpyEngineSinkMetaData::NewL( KNullDesC, KNullDesC, KNullDesC, ETrue, ETrue );
-    }
-
-EXPORT_C CMemSpyEngineSinkMetaData* CMemSpyEngineSinkMetaData::NewL(  const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp )
-	{
-	return NewL( KNullDesC, aContext, aFolder, aExtension, aOverwrite, aUseFileTimeStamp );
-	}
-
-EXPORT_C CMemSpyEngineSinkMetaData* CMemSpyEngineSinkMetaData::NewL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp, const TTime& aFolderTimeStamp )
-    {
-    return NewL( KNullDesC, aContext, aFolder, aExtension, aOverwrite, aUseFileTimeStamp, aFolderTimeStamp );
-    }
-
-EXPORT_C CMemSpyEngineSinkMetaData* CMemSpyEngineSinkMetaData::NewL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp )
-    {
-    // Create a dummy time, we'll clear it after ConstructL() returns...
-    TTime now; now.HomeTime();
-
-    CMemSpyEngineSinkMetaData* self = new(ELeave) CMemSpyEngineSinkMetaData( aOverwrite, aUseFileTimeStamp );
-    CleanupStack::PushL( self );
-    self->ConstructL( aRoot, aContext, aFolder, aExtension, now );
-    CleanupStack::Pop( self );
-
-    // Clear folder time stamp
-    self->iFolderTimeStamp->Des().Zero();
-    return self;
-    }
-
-EXPORT_C CMemSpyEngineSinkMetaData* CMemSpyEngineSinkMetaData::NewL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp, const TTime& aFolderTimeStamp )
-    {
-    CMemSpyEngineSinkMetaData* self = new(ELeave) CMemSpyEngineSinkMetaData( aOverwrite, aUseFileTimeStamp );
-    CleanupStack::PushL( self );
-    self->ConstructL( aRoot, aContext, aFolder, aExtension, aFolderTimeStamp );
-    CleanupStack::Pop( self );
-    return self;
-    }
--- a/memspy/Engine/Source/Sink/MemSpyEngineOutputSinkDebug.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +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 "MemSpyEngineOutputSinkDebug.h"
-
-// System includes
-#include <e32svr.h>
-
-// Constants
-const TInt KMemSpyEngineOutputSinkDebugMaxLineLength = 0x100;
-
-
-CMemSpyEngineOutputSinkDebug::CMemSpyEngineOutputSinkDebug( CMemSpyEngine& aEngine )
-:   CMemSpyEngineOutputSink( aEngine )
-    {
-    }
-
-
-CMemSpyEngineOutputSinkDebug::~CMemSpyEngineOutputSinkDebug()
-    {
-    }
-
-
-void CMemSpyEngineOutputSinkDebug::ConstructL()
-    {
-    BaseConstructL();
-    }
-
-
-CMemSpyEngineOutputSinkDebug* CMemSpyEngineOutputSinkDebug::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineOutputSinkDebug* self = new(ELeave) CMemSpyEngineOutputSinkDebug( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-TMemSpySinkType CMemSpyEngineOutputSinkDebug::Type() const
-    {
-    return ESinkTypeDebug;
-    }
-
-
-void CMemSpyEngineOutputSinkDebug::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension )
-    {
-    DataStreamBeginL( aContext, aFolder, aExtension, ETrue );
-    }
-
-
-void CMemSpyEngineOutputSinkDebug::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite )
-    {
-    DataStreamBeginL( aContext, aFolder, aExtension, aOverwrite, ETrue );
-    }
-
-
-void CMemSpyEngineOutputSinkDebug::DataStreamBeginL( const TDesC& /*aContext*/, const TDesC& /*aFolder*/, const TDesC& /*aExtension*/, TBool /*aOverwrite*/, TBool /*aUseTimeStamp*/ )
-    {
-    // Doesn't support data streams
-    }
-
-
-void CMemSpyEngineOutputSinkDebug::DataStreamEndL()
-    {
-    // Doesn't support data streams
-    }
-
-
-void CMemSpyEngineOutputSinkDebug::DoOutputLineL( const TDesC& aLine )
-    {
-    if  ( !aLine.Length() )
-        {
-        // Blank line is special case
-        RDebug::Printf( " " );
-        }
-    else
-        {
-        _LIT( KPrintFormat, "%S" );
-
-        HBufC* buf = aLine.AllocLC();
-        if  ( aLine.Length() > KMemSpyEngineOutputSinkDebugMaxLineLength )
-            {
-            buf->Des().SetLength( KMemSpyEngineOutputSinkDebugMaxLineLength );
-            }
-        RDebug::Print( KPrintFormat, buf );
-        CleanupStack::PopAndDestroy( buf );
-        }
-    }
-
-
-void CMemSpyEngineOutputSinkDebug::DoOutputRawL( const TDesC8& /*aData*/ )
-    {
-    User::Leave( KErrNotSupported );
-    }
-
-
--- a/memspy/Engine/Source/Sink/MemSpyEngineOutputSinkFile.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,749 +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 "MemSpyEngineOutputSinkFile.h"
-
-// System includes
-#include <e32svr.h>
-
-// User includes
-#include <memspy/engine/memspyenginelogger.h>
-#include <memspy/engine/memspyengineutils.h>
-
-// Constants
-const TInt KMemSpyLineBufferLength = 1024;
-const TInt KMemSpyFileServerBufferExpandSize = 1024 * 32;
-
-// Literal constants
-_LIT8( KMemSpyCRLF, "\r\n" );
-
-
-CMemSpyEngineOutputSinkFile::CMemSpyEngineOutputSinkFile( CMemSpyEngine& aEngine )
-:   CMemSpyEngineOutputSink( aEngine )
-    {
-    }
-
-
-CMemSpyEngineOutputSinkFile::~CMemSpyEngineOutputSinkFile()
-    {
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::~CMemSpyEngineOutputSinkFile() - START" ) );
-    
-    delete iRoot;
-
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::~CMemSpyEngineOutputSinkFile() - destroying normal logs..." ) );
-    iLogs.ResetAndDestroy();
-    iLogs.Close();
-
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::~CMemSpyEngineOutputSinkFile() - destroying limbo logs..." ) );
-    iLogsPendingDestruction.ResetAndDestroy();
-    iLogsPendingDestruction.Close();
-
-    iFsSession.Close();
-
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::~CMemSpyEngineOutputSinkFile() - END" ) );
-    }
-
-
-void CMemSpyEngineOutputSinkFile::ConstructL( const TDesC& aRootFolder )
-    {
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructL() - START" ) );
-    
-    iRoot = aRootFolder.AllocL();
-
-    BaseConstructL();
-
-    // Identify the file server process id
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructL() - identifying f32 process id..." ) );
-    iFileServerProcessId = MemSpyEngineUtils::IdentifyFileServerProcessIdL();
-
-    // Create the standard output file
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructL() - connecting to f32..." ) );
-    User::LeaveIfError( iFsSession.Connect() );
-    
-    // Make default log file
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructL() - preparing default log..." ) );
-    ConstructDefaultLogFileL();
-
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructL() - END" ) );
-    }
-
-
-CMemSpyEngineOutputSinkFile* CMemSpyEngineOutputSinkFile::NewL( CMemSpyEngine& aEngine, const TDesC& aRootFolder )
-    {
-    CMemSpyEngineOutputSinkFile* self = new(ELeave) CMemSpyEngineOutputSinkFile( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL( aRootFolder );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-void CMemSpyEngineOutputSinkFile::ProcessSuspendedL( TProcessId aId )
-    {
-    TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::ProcessSuspendedL() - START - aId: %d, iFileServerSuspended: %d, iFileServerProcessId: %d"), (TUint) aId, iFileServerSuspended, (TUint) iFileServerProcessId ) );
-
-    iFileServerSuspended = ( (TUint) aId == iFileServerProcessId );
-    if  ( iFileServerSuspended )
-        {
-        const TInt count = iLogs.Count();
-        TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::ProcessSuspendedL() - enabling buffers for %d logs"), count ) );
-        for( TInt i=0; i<count; i++ )
-            {
-            CMemSpyEngineFileHolder* log = iLogs[i];
-            log->EnableBufferL();
-            }
-        }
-
-    TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::ProcessSuspendedL() - END - aId: %d, iFileServerSuspended: %d"), (TUint) aId, iFileServerSuspended ) );
-    }
-
-
-void CMemSpyEngineOutputSinkFile::ProcessResumed( TProcessId aId )
-    {
-    const TBool isF32Process = ( (TUint) aId == iFileServerProcessId );
-    TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::ProcessResumed() - START - aId: %d, iFileServerSuspended: %d, isF32Process: %d"), (TUint) aId, iFileServerSuspended, isF32Process ) );
-    //
-    if  ( iFileServerSuspended )
-        {
-        __ASSERT_ALWAYS( isF32Process, User::Invariant() );
-
-        TRAPD( err, DisableAllBuffersAfterFileServerResumedL() );
-        if ( err != KErrNone )
-            {
-            TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ProcessResumed() - disabled all buffers, completed with err: %d", err ) );
-            }
-
-        iLogsPendingDestruction.ResetAndDestroy();
-        TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ProcessResumed() - deleted all pending destruction logs..." ) );
-
-        // Indicate file server is no longer suspended
-        iFileServerSuspended = EFalse;
-        }
-    
-    TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::ProcessResumed() - END - aId: %d, iFileServerSuspended: %d, isF32Process: %d"), (TUint) aId, iFileServerSuspended, isF32Process ) );
-    }
-
-
-TMemSpySinkType CMemSpyEngineOutputSinkFile::Type() const
-    {
-    return ESinkTypeFile;
-    }
-
-
-void CMemSpyEngineOutputSinkFile::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension )
-    {
-    DataStreamBeginL( aContext, aFolder, aExtension, ETrue );
-    }
-
-
-void CMemSpyEngineOutputSinkFile::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite )
-    {
-    DataStreamBeginL( aContext, aFolder, aExtension, aOverwrite, ETrue );
-    }
-
-
-void CMemSpyEngineOutputSinkFile::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseTimeStamp )
-    {
-    CMemSpyEngineSinkMetaData* meta = CMemSpyEngineSinkMetaData::NewL( iRoot->Des(), aContext, aFolder, aExtension, aOverwrite, aUseTimeStamp );
-    CleanupStack::PushL( meta );
-
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamBeginL() - START - log count: %d, iFileServerSuspended: %d", iLogs.Count(), iFileServerSuspended ) );
-    //
-    CMemSpyEngineFileHolder* log = NULL;
-    if  ( iFileServerSuspended )
-        {
-        TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamBeginL() - F32 SUSPENDED!" ) );
-        log = CMemSpyEngineFileHolder::NewLogToRAML( *this, meta );
-        }
-    else
-        {
-        log = CMemSpyEngineFileHolder::NewL( *this, meta );
-        }
-    //
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamBeginL() - log: 0x%08x", log ) );
-    CleanupStack::Pop( meta );
-    CleanupStack::PushL( log );
-    iLogs.AppendL( log );
-    CleanupStack::Pop( log );
-    //
-    TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::DataStreamBeginL() - END - log count: %d, iFileServerSuspended: %d, fileName: [%S]"), iLogs.Count(), iFileServerSuspended, &log->FileName() ) );
-    }
-
-
-void CMemSpyEngineOutputSinkFile::DataStreamEndL()
-    {
-    const TInt count = iLogs.Count();
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamEndL() - count: %d", count ) );
-
-    __ASSERT_ALWAYS( count > 1, User::Invariant() );
-
-    CMemSpyEngineFileHolder* headLog = iLogs[ count - 1 ];
-    iLogs.Remove( count - 1 );
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamEndL() - headLog: 0x%08x", headLog ) );
-
-    if  ( headLog->UsingBuffer() )
-        {
-        TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamEndL() - headLog is using buffer so doing deferred delete when F32 is not suspended anymore..." ) );
-
-        // Must save the log until after its safe to resume 
-        // writing to disk.
-        CleanupStack::PushL( headLog );
-        iLogsPendingDestruction.AppendL( headLog );
-        CleanupStack::Pop( headLog );
-        }
-    else
-        {
-        TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamEndL() - deleting head log immediately!" ) );
-        delete headLog;
-        }
-
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamEndL() - END" ) );
-    }
-
-
-void CMemSpyEngineOutputSinkFile::DoOutputLineL( const TDesC& aLine )
-    {
-    HeadLog().WriteLineL( aLine );
-    }
-
-
-void CMemSpyEngineOutputSinkFile::DoOutputRawL( const TDesC8& aData )
-    {
-    HeadLog().WriteRawL( aData );
-    }
-
-
-TBool CMemSpyEngineOutputSinkFile::IsPrefixAllowed( const TDesC& /*aPrefix*/ )
-    {
-    // If we are outputting to the main log, then we must allow
-    // the prefix. If we are outputting to a child log, then we don't
-    // need it.
-    return HeadLog().IsMainLog();
-    }
-
-
-void CMemSpyEngineOutputSinkFile::ConstructDefaultLogFileL()
-    {
-    CMemSpyEngineFileHolder* log = CMemSpyEngineFileHolder::NewLC( *this );
-
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructDefaultLogFileL() - START - headLog: 0x%08x", log ) );
-    iLogs.AppendL( log );
-    CleanupStack::Pop( log );
-
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructDefaultLogFileL() - END - headLog: 0x%08x", log ) );
-    }
-
-
-void CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL()
-    {
-    const TInt count = iLogs.Count();
-    const TInt count2 = iLogsPendingDestruction.Count();
-
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() - START - logs: %d, pending: %d", count, count2 ) );
-
-    TInt err = KErrNone;
-
-    // Inform logging object that they should stop logging to RAM. This may cause files
-    // to be opened and data flushed.
-    for( TInt i=0; i<count; i++ )
-        {
-        CMemSpyEngineFileHolder* log = iLogs[ i ];
-        TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() -  logN[%2d]: 0x%08x, name: %S"), i, log, &log->FileName() ) );
-        TRAP(err, log->DisableBufferL() );
-        if  ( err != KErrNone )
-            {
-            TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() - error whilst closing log: %d", err ) );
-            }
-        }
-
-    // Finalise any pending destruction log objects. These are log objects
-    // that were created and finalised whilst the file server was suspended.
-    for( TInt ii = count2-1; ii>=0; ii--)
-        {
-        CMemSpyEngineFileHolder* log = iLogsPendingDestruction[ ii ];
-        TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() - logPD[%2d]: 0x%08x, name: %S"), ii, log, &log->FileName() ) );
-        TRAP(err, log->DisableBufferL() );
-        if  ( err != KErrNone )
-            {
-            TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() - error whilst closing log: %d", err ) );
-            }
-        }
-
-    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() - END" ) );
-    }
-
-
-CMemSpyEngineFileHolder& CMemSpyEngineOutputSinkFile::HeadLog() const
-    {
-    // Head log is always the first log
-    const TInt count = iLogs.Count();
-    __ASSERT_ALWAYS( count >= 1, User::Invariant() );
-    CMemSpyEngineFileHolder* headLog = iLogs[ count - 1 ];
-
-    //TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::HeadLog() - headLog: 0x%08x %S"), headLog, &headLog->FileName() ) );
-    return *headLog;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineFileHolder::CMemSpyEngineFileHolder( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData )
-:   iParent( aParent ), iMetaData( aMetaData )
-    {
-    }
-
-
-CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder()
-    {
-    TPtrC pFileName( KNullDesC );
-    if  ( iFileName != NULL )
-        {
-        pFileName.Set( *iFileName );
-        }
-    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - START - this: 0x%08x, iFileName: %S, handle: 0x%08x, iEntireFileBuffer: 0x%08x, iIsMainLog: %d"), this, &pFileName, iFile.SubSessionHandle(), iEntireFileBuffer, iIsMainLog ) );
-
-    if  ( iEntireFileBuffer || iWorkingBuffer )
-        {
-        // This may actually open the file
-        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - disabling file buffers..." ) );
-        TRAP_IGNORE( DisableBufferL() );
-        }
-
-    // Now close the file, deleting anything that is empty
-    if  ( iFile.SubSessionHandle() != KNullHandle )
-        {
-        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - flushing file..." ) );
-
-        // Flush anything that is pending and then check whether 
-        // the file is empty. If so, delete it.
-        iFile.Flush(); // Ignore error
-       
-        // Delete empty files
-        TInt size = 0;
-        TInt err = iFile.Size( size );
-        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - size: %d, err: %d", size, err ) );
-
-        if  ( err == KErrNone && size == 0 )
-            {
-            // Close the file and get F32 to delete it...
-            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - deleting empty file!" ) );
-            iFile.Close();
-            err = FsSession().Delete( *iFileName );
-            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - delete err: %d", err ) );
-            }
-        }
-    //
-    iFile.Close();
-    //
-    delete iLineBuffer;
-    delete iWorkingBuffer;
-    delete iEntireFileBuffer;
-    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - END - this: 0x%08x, iFileName: %S, iIsMainLog: %d"), this, &pFileName, iIsMainLog ) );
-    delete iFileName;
-    delete iMetaData;
-    }
-
-
-void CMemSpyEngineFileHolder::CommonConstructL()
-    {
-    if  ( iLineBuffer == NULL )
-        {
-        iLineBuffer = HBufC8::NewL( KMemSpyLineBufferLength );
-        }
-    if  ( iWorkingBuffer == NULL )
-        {
-        iWorkingBuffer = CBufFlat::NewL( KMemSpyFileServerBufferExpandSize );
-        }
-    }
-
-
-void CMemSpyEngineFileHolder::ConstructL()
-    {
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::ConstructL(D) - START" ) );
-    iIsMainLog = ETrue;
-
-    // Make emtpy meta data
-    ASSERT( !iMetaData );
-    iMetaData = CMemSpyEngineSinkMetaData::NewL( KNullDesC, KNullDesC, KNullDesC, KNullDesC, ETrue, ETrue );
-
-    // Prepare common details
-    CommonConstructL();
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::ConstructL(D) - CommonConstructL() completed okay..." ) );
-
-    // Construct the default log file.
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::ConstructL(D) - calling OpenFileL()..." ) );
-    OpenFileL();
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::ConstructL(D) - called OpenFileL()" ) );
-
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::ConstructL(D) - END - iIsMainLog: %d", iIsMainLog ) );
-    }
-
-
-
-CMemSpyEngineFileHolder* CMemSpyEngineFileHolder::NewLC( CMemSpyEngineOutputSinkFile& aParent )
-    {
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::NewLC() - START") );
-    CMemSpyEngineFileHolder* self = new(ELeave) CMemSpyEngineFileHolder( aParent, NULL );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-CMemSpyEngineFileHolder* CMemSpyEngineFileHolder::NewL( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData )
-    {
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::NewL() - START") );
-    CMemSpyEngineFileHolder* self = new(ELeave) CMemSpyEngineFileHolder( aParent, aMetaData );
-    CleanupStack::PushL( self );
-    self->CommonConstructL();
-    self->OpenFileL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-CMemSpyEngineFileHolder* CMemSpyEngineFileHolder::NewLogToRAML( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData )
-    {
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::NewLogToRAML() - START") );
-    CMemSpyEngineFileHolder* self = new(ELeave) CMemSpyEngineFileHolder( aParent, aMetaData );
-    CleanupStack::PushL( self );
-    self->CommonConstructL();
-    self->EnableBufferL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-void CMemSpyEngineFileHolder::OpenFileL()
-    {
-    TInt err = KErrNone;
-
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - START - iMetaData: 0x%08x", iMetaData ) );
-    ASSERT( iMetaData );
-
-    delete iFileName;
-    iFileName = NULL;
-    if  ( iFile.SubSessionHandle() != KNullHandle )
-        {
-        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - closing existing file..." ) );
-        iFile.Flush();
-        iFile.Close();
-        }
-    
-    // First try, with current external drive
-    TRAP( err, PrepareFileL() );
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - PrepareFileL(1) - err: %d", err ) );
-    
-    if  ( err != KErrNone )
-        {
-        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - trying with forced C:\\ ..." ) );
-
-        // Try again with C:\ instead...
-        const TDriveNumber cDrive = EDriveC;
-        TRAP(err, PrepareFileL( &cDrive ) );
-        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - PrepareFileL(2) - err: %d", err ) );
-        }
-
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - final err: %d", err ) );
-    User::LeaveIfError( err );
-
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - END - OK - iIsMainLog: %d", iIsMainLog ) );
-    }
-
-
-void CMemSpyEngineFileHolder::PrepareFileL( const TDriveNumber* aForceDrive )
-    {
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - START - this: 0x%08x", this ) );
-    ASSERT( iMetaData );
-
-    iFileName = GenerateFileNameLC( aForceDrive );
-    CleanupStack::Pop( iFileName );
-
-    // Try to make log directory - ignore if already exists
-    TInt error = FsSession().MkDirAll( *iFileName );
-    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::PrepareFileL() - iFileName: %S, mkDir: %d, aOverwrite: %d"), iFileName, error, iMetaData->Overwrite() ) );
-
-    if  ( error == KErrNone || error == KErrAlreadyExists )
-        {
-        if  ( iMetaData->Overwrite() )
-            {
-            error = iFile.Replace( FsSession(), *iFileName, EFileWrite );
-            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - overwrite/replace error: %d", error ) );
-            }
-        else
-            {
-            error = iFile.Open( FsSession(), *iFileName, EFileWrite );
-            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - open error: %d", error ) );
-            
-            // Try creating it then...
-            if  ( error == KErrNotFound )
-                {
-                error = iFile.Create( FsSession(), *iFileName, EFileWrite );
-                TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - create error: %d", error ) );
-                }
-            }
-            
-        // Seek to end of file
-        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - final error: %d", error ) );
-        if  ( error == KErrNone )
-            {
-            TInt pos = 0;
-            error = iFile.Seek( ESeekEnd, pos );
-            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - seek error: %d", error ) );
-            }
-        }
-
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - END - this: 0x%08x, error: %d", this, error ) );
-    User::LeaveIfError( error );
-    }
-
-
-void CMemSpyEngineFileHolder::WriteLineL( const TDesC& aData )
-    {
-    TPtr8 pText( iLineBuffer->Des() );
-    pText.Copy( aData );
-    pText.Append( KMemSpyCRLF );
-
-    if  ( iWorkingBuffer != NULL )
-        {
-        AddToWorkingBufferL( pText );
-        }
-    else if ( iFile.SubSessionHandle() != KNullHandle )
-        {
-        const TInt error = iFile.Write( pText );
-        if  ( error != KErrNone )
-            {
-            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::WriteLineL() - FILE WRITE ERROR - this: 0x%08x, error: %d", this, error ) );
-            }
-        User::LeaveIfError( error );
-        }
-    else
-        {
-        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::WriteLineL() - DISCARDING LINE!" ) );
-        }
-    }
-
-
-void CMemSpyEngineFileHolder::WriteRawL( const TDesC8& aData )
-    {
-    const TInt error = iFile.Write( aData );
-    User::LeaveIfError( error );
-    }
-
-
-void CMemSpyEngineFileHolder::EnableBufferL()
-    {
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::EnableBufferL() - START - this: 0x%08x", this ) );
-    if  ( iEntireFileBuffer == NULL )
-        {
-        iEntireFileBuffer = CBufFlat::NewL( KMemSpyFileServerBufferExpandSize );
-        }
-    //
-    iEntireFileBuffer->Reset();
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::EnableBufferL() - END - this: 0x%08x", this ) );
-    }
-
-
-void CMemSpyEngineFileHolder::DisableBufferL()
-    {
-#ifdef _DEBUG
-    TInt size = 0;
-    if  ( iFile.SubSessionHandle() != KNullHandle )
-        {
-        iFile.Size( size );
-        }
-    TInt ramBufferSize = 0;
-    if  ( iEntireFileBuffer )
-        {
-        ramBufferSize = iEntireFileBuffer->Size();
-        }
-    //
-    RDebug::Printf( "CMemSpyEngineFileHolder::DisableBufferL() - START - file handle: 0x%08x, iEntireFileBuffer: 0x%08x, fileSize: %d, ramBufferSize: %d", iFile.SubSessionHandle(), iEntireFileBuffer, size, ramBufferSize );
-#endif
-
-    // This will also open the file if necessary
-    FlushWorkingBufferL();
-    //
-    if  ( iEntireFileBuffer != NULL )
-        {
-        // Probably need to open the file...
-        if  ( iFile.SubSessionHandle() == KNullHandle )
-            {
-            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::DisableBufferL() - FILE IS NOT YET OPEN!" ) );
-            OpenFileL();
-            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::DisableBufferL() - file opened okay." ) );
-            }
-
-        TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::DisableBufferL() - about to write entire file buffer - file: %S"), &FileName() ) );
-        const TPtr8 pBuffer( iEntireFileBuffer->Ptr( 0 ) );
-        const TInt error = iFile.Write( pBuffer );
-        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::DisableBufferL() - write result: %d", error ) );
-        //
-        delete iEntireFileBuffer;
-        iEntireFileBuffer = NULL;
-        //
-        User::LeaveIfError( error );
-        }
-    
-    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::DisableBufferL() - END" ) );
-    }
-
-
-void CMemSpyEngineFileHolder::FlushWorkingBufferL()
-    {
-    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::FlushWorkingBufferL() - START - fileName: [%S], file handle: 0x%08x, iWorkingBuffer: 0x%08x"), &FileName(), iFile.SubSessionHandle(), iWorkingBuffer ) );
-    __ASSERT_ALWAYS( iWorkingBuffer, MemSpyEngineUtils::Panic( EMemSpyEnginePanicSinkFileWorkingFileBufferIsNull ) );
-
-    // The underlying file may not be open - it could be that we are buffering everything
-    // to RAM (i.e. the file server is currently suspended).
-    const TPtr8 pBuffer( iWorkingBuffer->Ptr(0) );
-    //
-    if  ( iEntireFileBuffer )
-        {
-        __ASSERT_ALWAYS( iEntireFileBuffer, MemSpyEngineUtils::Panic( EMemSpyEnginePanicSinkFileEntireFileBufferNull ) );
-
-        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::FlushWorkingBufferL() - file not open or we are currently bufferring to RAM - copying %d bytes to entire file buffer (%d)", pBuffer.Length(), iEntireFileBuffer->Size() ) );
-        iEntireFileBuffer->InsertL( iEntireFileBuffer->Size(), pBuffer );
-        }
-    else if ( iFile.SubSessionHandle() != KNullHandle )
-        {
-        const TInt error = iFile.Write( pBuffer );
-        if  ( error != KErrNone )
-            {
-            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::FlushWorkingBufferL() - write result: %d", error ) );
-            }
-        User::LeaveIfError( error );
-        }
-
-    iWorkingBuffer->Reset();
-    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::FlushWorkingBufferL() - END - fileName: %S"), &FileName() ) );
-    }
-
-
-void CMemSpyEngineFileHolder::AddToWorkingBufferL( const TDesC8& aText )
-    {
-    if  ( iWorkingBuffer->Size() + aText.Length() > KMemSpyFileServerBufferExpandSize )
-        {
-        FlushWorkingBufferL();
-        }
-    //
-    iWorkingBuffer->InsertL( iWorkingBuffer->Size(), aText );
-    }
-
-
-HBufC* CMemSpyEngineFileHolder::CleanContextInfoLC( const TDesC& aContext )
-    {
-    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::CleanContextInfoLC() - START - %S"), &aContext ) );
-    TFileName fileName;
-
-    TBool seenDoubleColon = EFalse;
-    const TInt length = aContext.Length();
-    for( TInt i=0; i<length; i++ )
-        {
-        const TChar c( aContext[ i ] );
-        const TBool haveNextChar = ( i+1 < length );
-        //
-        //TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::CleanContextInfoLC() - c[%03d]: \'%c\', haveNextChar: %d, seenDoubleColon: %d"), i, (TUint32) c, haveNextChar, seenDoubleColon ) );
-        //
-        if  ( c == ':' && haveNextChar && aContext[ i + 1 ] == ':' )
-            {
-            // Skip double colon
-            i++;
-            fileName.Append( '-' );
-            seenDoubleColon = ETrue;
-            }
-        else if ( c == '.' )
-            {
-            if  ( seenDoubleColon )
-                {
-                break;
-                }
-            else
-                {
-                fileName.Append( '-' );
-                }
-            }
-        else
-            {
-            fileName.Append( c );
-            }
-        }
-
-    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::CleanContextInfoLC() - END - %S"), &fileName ) );
-    return fileName.AllocLC();
-    }
-
-
-HBufC* CMemSpyEngineFileHolder::GenerateFileNameLC( const TDriveNumber* aForceDrive )
-    {
-    TFileName name;
-    MemSpyEngineUtils::GetFolderL( FsSession(), name, *iMetaData, aForceDrive );
-    return name.AllocLC();
-    }
-
-
-RFs& CMemSpyEngineFileHolder::FsSession()
-    {
-    return iParent.iFsSession;
-    }
-
-
-const TDesC& CMemSpyEngineFileHolder::FileName() const 
-    {
-    if  ( iFileName )
-        {
-        return *iFileName;
-        }
-    //
-    return KNullDesC;
-    }
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTracker.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +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 <memspy/engine/memspyenginehelpersysmemtracker.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerobserver.h>
-#include "MemSpyEngineHelperSysMemTrackerOutputFormatter.h"
-
-
-CMemSpyEngineHelperSysMemTracker::CMemSpyEngineHelperSysMemTracker()
-    {
-    }
-
-    
-CMemSpyEngineHelperSysMemTracker::~CMemSpyEngineHelperSysMemTracker()
-    {
-    delete iOutputFormatter;
-    delete iImp;
-    }
-
-
-void CMemSpyEngineHelperSysMemTracker::ConstructL( CMemSpyEngine& aEngine )
-    {
-    iOutputFormatter = CMemSpyEngineHelperSysMemTrackerOutputFormatter::NewL( aEngine );
-    //
-    iImp = CMemSpyEngineHelperSysMemTrackerImp::NewL( aEngine );
-    iImp->SetObserver( this );
-    }
-
-
-CMemSpyEngineHelperSysMemTracker* CMemSpyEngineHelperSysMemTracker::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperSysMemTracker* self = new(ELeave) CMemSpyEngineHelperSysMemTracker();
-    CleanupStack::PushL( self );
-    self->ConstructL( aEngine );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C TBool CMemSpyEngineHelperSysMemTracker::IsActive() const
-    {
-    return iImp->IsActive();
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperSysMemTracker::StartL()
-    {
-    const TMemSpyEngineHelperSysMemTrackerConfig& config = iOutputFormatter->Config();
-    iImp->StartL( config );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperSysMemTracker::StartL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
-    {
-    SetConfigL( aConfig );
-    StartL();
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperSysMemTracker::StopL()
-    {
-    iImp->StopL();
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperSysMemTracker::SetConfigL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
-    {
-    TMemSpyEngineHelperSysMemTrackerConfig config( aConfig );
-
-    // Cap the value to ensure it doesn't fall beneath minimum value.
-    const TInt timeInSeconds = config.TimerPeriod().Int() / 1000000;
-    if  ( timeInSeconds < KMemSpySysMemTrackerConfigMinTimerPeriod )
-        {
-        config.iTimerPeriod = KMemSpySysMemTrackerConfigMinTimerPeriod * 1000000;
-        }
-    iOutputFormatter->SetConfig( config );
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperSysMemTracker::GetConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
-    {
-    aConfig = iOutputFormatter->Config();
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperSysMemTracker::SetObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver )
-    {
-    iRealObserver = aObserver;
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperSysMemTracker::RemoveObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver )
-    {
-    if ( iRealObserver == aObserver )
-        {
-        iRealObserver = NULL;
-        }
-    }
-
-
-EXPORT_C const RPointerArray< CMemSpyEngineHelperSysMemTrackerCycle >& CMemSpyEngineHelperSysMemTracker::CompletedCycles() const
-    {
-    return iImp->CompletedCycles();
-    }
-
-
-void CMemSpyEngineHelperSysMemTracker::Reset()
-    {
-    iImp->Reset();
-    }
-
-
-EXPORT_C void CMemSpyEngineHelperSysMemTracker::CheckForChangesNowL()
-    {
-    iImp->CheckForChangesNowL();
-    }
-
-
-EXPORT_C TInt CMemSpyEngineHelperSysMemTracker::MdcaCount() const
-    {
-    return iImp->MdcaCount();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineHelperSysMemTracker::MdcaPoint( TInt aIndex ) const
-    {
-    return iImp->MdcaPoint( aIndex );
-    }
-
-
-void CMemSpyEngineHelperSysMemTracker::HandleCyclesResetL()
-    {
-    if  ( iRealObserver )
-        {
-        TRAP_IGNORE( iRealObserver->HandleCyclesResetL() );
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTracker::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    if  ( iRealObserver )
-        {
-        TRAP_IGNORE( iRealObserver->HandleCycleStartedL( aCycle ) );
-        }
-    }
-
-void CMemSpyEngineHelperSysMemTracker::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    iOutputFormatter->OutputL( aCycle );
-    //
-    if  ( iRealObserver )
-        {
-        TRAP_IGNORE( iRealObserver->HandleCycleFinishedL( aCycle ) );
-        }
-    }
-
-
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycle.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,382 +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 <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-
-// System includes
-#include <e32debug.h>
-#include <hal.h>
-#include <hal_data.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
-    
-// Literal constants
-_LIT( KMemSpySWMTDataFolderSpecification, "Data" );
-_LIT( KMemSpySWMTFolderSpecification, "System Wide MT\\Cycle %04d" );
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycle::CMemSpyEngineHelperSysMemTrackerCycle( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig, const CMemSpyEngineHelperSysMemTrackerCycle* aPreviousCycle )
-:   iConfig( aConfig ), iPreviousCycle( aPreviousCycle ), iCycleNumber( 1 )
-    {
-    iTime.HomeTime();
-    if  ( aPreviousCycle )
-        {
-        iCycleNumber = aPreviousCycle->CycleNumber() + 1;
-        }
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycle::~CMemSpyEngineHelperSysMemTrackerCycle()
-    {
-    delete iFixedItems;
-    delete iCaption;
-    delete iTimeFormatted;
-    //
-    DiscardChanges();
-    iChangeDescriptors.Close();
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::ConstructL()
-    {
-    iFixedItems = CMemSpyEngineOutputList::NewL();
-
-    // Get time stamp
-    TBuf<128> timeBuf;
-    MemSpyEngineUtils::FormatTimeSimple( timeBuf, iTime );
-    iTimeFormatted = timeBuf.AllocL();
-    
-    // Get free ram
-    TInt freeRam = KErrNotFound;
-    User::LeaveIfError( HAL::Get( HALData::EMemoryRAMFree, freeRam ) );
-    iMemoryFree = freeRam;
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycle* CMemSpyEngineHelperSysMemTrackerCycle::NewLC( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig, const CMemSpyEngineHelperSysMemTrackerCycle* aPreviousCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycle* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycle( aConfig, aPreviousCycle );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineHelperSysMemTrackerCycle::CycleNumber() const
-    {
-    return iCycleNumber;
-    }
-
-
-EXPORT_C const TTime& CMemSpyEngineHelperSysMemTrackerCycle::Time() const
-    {
-    return iTime;
-    }
-
-
-EXPORT_C const TDesC& CMemSpyEngineHelperSysMemTrackerCycle::TimeFormatted() const
-    {
-    return *iTimeFormatted;
-    }
-
-
-EXPORT_C const TDesC& CMemSpyEngineHelperSysMemTrackerCycle::Caption() const
-    {
-    return *iCaption;
-    }
-
-
-EXPORT_C const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryFree() const
-    {
-    return iMemoryFree;
-    }
-
-
-EXPORT_C TInt64 CMemSpyEngineHelperSysMemTrackerCycle::MemoryFreePreviousCycle() const
-    {
-    TInt64 ret = MemoryFree();
-    //
-    if  ( iPreviousCycle )
-        {
-        ret = iPreviousCycle->MemoryFree();
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C TInt64 CMemSpyEngineHelperSysMemTrackerCycle::MemoryDelta() const
-    {
-    const TInt64 ret = ( iMemoryFree - iMemoryUsed );
-    return ret;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineHelperSysMemTrackerCycle::ChangeCount() const
-    {
-    return iChangeCount;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineHelperSysMemTrackerCycle::MdcaCount() const
-    {
-    return iFixedItems->Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineHelperSysMemTrackerCycle::MdcaPoint( TInt aIndex ) const
-    {
-    return iFixedItems->MdcaPoint( aIndex );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::FinalizeL()
-    {
-    _LIT( KChange, "change" );
-    _LIT( KChanges, "changes" );
-
-    // Save change count
-    iChangeCount = iChangeDescriptors.Count();
-
-    // First make the main caption
-    TMemSpySizeText sizeText;
-    TMemSpySizeText deltaText;
-    TPtrC pChangeText( KChange );
-   
-    // Get free RAM formatted as a descriptor
-    sizeText = MemSpyEngineUtils::FormatSizeTextPrecise( MemoryFree() );
-
-    // Get delta formatted as a descriptor
-    const TInt64 delta( MemoryDelta() );
-    deltaText = MemSpyEngineUtils::FormatSizeTextPrecise( delta );
-
-    // Get number of changed threads as a descriptor
-    if  ( ChangeCount() == 0 || ChangeCount() > 1 )
-        {
-        pChangeText.Set( KChanges );
-        }
-
-    // Now make the caption
-    if  ( MemoryDelta() != 0 )
-        {
-        TBuf<300> buf;
-        _LIT( KMainCaption1, "\t[%03d] F: %S\t\tD: %S, %d %S" );
-        buf.Format( KMainCaption1, CycleNumber(), &sizeText, &deltaText, ChangeCount(), &pChangeText );
-        HBufC* caption = buf.AllocL();
-        delete iCaption;
-        iCaption = caption;
-        }
-    else
-        {
-        TBuf<300> buf;
-        _LIT( KMainCaption2, "\t[%03d] F: %S\t\tNo Delta, %d %S" );
-        buf.Format( KMainCaption2, CycleNumber(), &sizeText, ChangeCount(), &pChangeText );
-        HBufC* caption = buf.AllocL();
-        delete iCaption;
-        iCaption = caption;
-        }
-
-    // Now make the child entries
-    if  ( CycleNumber() > 0 )
-        {
-        _LIT(KItem1a, "Cycle");
-        iFixedItems->AddItemL( KItem1a, CycleNumber() );
-        }
-    else
-        {
-        _LIT(KItem1a, "Baseline");
-        iFixedItems->AddItemL( KItem1a );
-        }
-    //
-    _LIT(KItem1c, "Time");
-    iFixedItems->AddItemL( KItem1c, iTimeFormatted );
-    //
-    _LIT(KItem2, "Memory Free");
-    iFixedItems->AddItemL( KItem2, sizeText );
-    //
-    if  ( CycleNumber() > 0 )
-        {
-        _LIT(KItem2b, "Memory Change (vs. Last Cycle)");
-        sizeText = MemSpyEngineUtils::FormatSizeTextPrecise( MemoryFree() - MemoryFreePreviousCycle() );
-        iFixedItems->AddItemL( KItem2b, sizeText );
-        //
-        _LIT(KItem3, "Number of Changes");
-        iFixedItems->AddItemL( KItem3, ChangeCount() );
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::DiscardChanges()
-    {
-    iChangeDescriptors.ResetAndDestroy();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChange& CMemSpyEngineHelperSysMemTrackerCycle::ChangeAt( TInt aIndex )
-    {
-    return *iChangeDescriptors[ aIndex ];
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::GetDataFolderL( RFs& aFsSession, TDes& aFolder )
-    {
-    TFileName fileName;
-    fileName.Format( KMemSpySWMTFolderSpecification, CycleNumber() );
-
-    CMemSpyEngineSinkMetaData* metaData = CMemSpyEngineSinkMetaData::NewL( KNullDesC, fileName, KNullDesC, ETrue, EFalse, Time() );
-    CleanupStack::PushL( metaData );
-    MemSpyEngineUtils::GetFolderL( aFsSession, aFolder, *metaData );
-    CleanupStack::PopAndDestroy( metaData );
-
-    // This get's us something like:
-    //
-    //    E:\MemSpy\System Wide MT\Data - Cycle 001\Log.txt
-    //
-    // Now we must strip off the filename and return just the folder specification
-    const TParsePtrC parser( aFolder );
-    if  ( parser.NamePresent() && parser.ExtPresent() )
-        {
-        const TPtrC nameAndExt( parser.NameAndExt() );
-        aFolder.SetLength( aFolder.Length() - nameAndExt.Length() );
-        }
-
-    // Add "Data" on to the end so that we put all data in a clearly marked subdir)
-    aFolder.Append( KMemSpySWMTDataFolderSpecification );
-    TRACE( RDebug::Print(_L("CMemSpyEngineHelperSysMemTrackerCycle::GetDataFolderL() - folder1: %S"), &aFolder ) );
-
-    // Now we should return something like:
-    //
-    //    E:\MemSpy\System Wide MT\Data - Cycle 001
-    TRACE( RDebug::Print(_L("CMemSpyEngineHelperSysMemTrackerCycle::GetDataFolderL() - folder2: %S"), &aFolder ) );
-
-    const TInt err = aFsSession.MkDirAll( aFolder );
-    if  ( !(err == KErrNone || err == KErrAlreadyExists ) )
-        {
-        User::LeaveIfError( err );
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::DataStreamBeginL( CMemSpyEngineOutputSink& aSink, const TDesC& aContext )
-    {
-    // First make the folder...
-    HBufC* folder = HBufC::NewLC( KMemSpySWMTFolderSpecification().Length() + 10 );
-    TPtr pFolder( folder->Des() );
-    pFolder.Format( KMemSpySWMTFolderSpecification, CycleNumber() );
-
-    // Now start the data stream
-    aSink.DataStreamBeginL( aContext, pFolder, KMemSpyLogDefaultExtension, ETrue, EFalse );
-    CleanupStack::PopAndDestroy( folder );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::DataStreamEndL( CMemSpyEngineOutputSink& aSink )
-    {
-	aSink.DataStreamEndL();
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::AddAndPopL( CMemSpyEngineHelperSysMemTrackerCycleChange* aInfo )
-    {
-    iChangeDescriptors.AppendL( aInfo );
-    CleanupStack::Pop( aInfo );
-    }
-
-
-const TMemSpyEngineHelperSysMemTrackerConfig& CMemSpyEngineHelperSysMemTrackerCycle::Config() const
-    {
-    return iConfig; 
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::AddToMemoryUsed( TInt aValue )
-    {
-    iMemoryUsed += aValue;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::AddToMemoryHeapAllocs( TInt aValue )
-    {
-    iMemoryHeapAllocs += aValue;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::AddToMemoryHeapFrees( TInt aValue )
-    {
-    iMemoryHeapFrees += aValue;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::AddToCellCountFree( TInt aValue )
-    {
-    iCellCountsFrees += aValue;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycle::AddToCellCountAlloc( TInt aValue )
-    {
-    iCellCountsAllocs += aValue;
-    }
-
-
-const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryUsed() const
-    {
-    return iMemoryUsed;
-    }
-
-
-const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryHeapAllocs() const
-    {
-    return iMemoryHeapAllocs;
-    }
-
-
-const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryHeapFrees() const
-    {
-    return iMemoryHeapFrees;
-    }
-
-
-const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryHeapCellCountAlloc() const
-    {
-    return iCellCountsAllocs;
-    }
-
-
-const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryHeapCellCountFree() const
-    {
-    return iCellCountsFrees;
-    }
-
-
-
-
-
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycleChange.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +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 <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
-
-// System includes
-#include <e32debug.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyenginemidwife.h>
-#include <memspy/engine/memspyengineundertaker.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChange::CMemSpyEngineHelperSysMemTrackerCycleChange( TUint8 aAttribs )
-:   iAttributes( aAttribs )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChange::~CMemSpyEngineHelperSysMemTrackerCycleChange()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChange::BaseConstructL()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChange::FormatType( TMemSpySWMTTypeName& aBuffer ) const
-    {
-    _LIT( KTypeUnknown,                 "{????}" );
-    _LIT( KTypeHeap,                    "{HEAP}" );
-    _LIT( KTypeChunk,                   "{CHNK}" );
-    _LIT( KTypeCode,                    "{CODE}" );
-    _LIT( KTypeStack,                   "{STAK}" );
-    _LIT( KTypeGlobalData,              "{GLOD}" );
-    _LIT( KTypeRamDrive,                "{RAMD}" );
-    _LIT( KTypeOpenFile,                "{FILE}" );
-    _LIT( KTypeDiskSpace,               "{DISK}" );
-    _LIT( KTypeBitmap,                  "{BITM}" );
-    _LIT( KTypeHandleGeneric,           "{HGEN}" );
-    _LIT( KTypeHandlePAndS,             "{HPAS}" );
-    _LIT( KTypeFbserv,                  "{FABS}" );
-    _LIT( KTypeFileServerCache,         "{F32C}" );
-    _LIT( KTypeSystemMemory,            "{SYSM}" );
-    _LIT( KTypeWindowGroup,             "{WNDG}" );
-    //
-    switch( Type() )
-        {
-        case EMemSpyEngineSysMemTrackerTypeHeapUser:
-        case EMemSpyEngineSysMemTrackerTypeHeapKernel:
-            aBuffer.Append( KTypeHeap );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeChunk:
-            aBuffer.Append( KTypeChunk );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeCode:
-            aBuffer.Append( KTypeCode );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeHandleGeneric:
-            aBuffer.Append( KTypeHandleGeneric );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeHandlePAndS:
-            aBuffer.Append( KTypeHandlePAndS );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeStack:
-            aBuffer.Append( KTypeStack );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeGlobalData:
-            aBuffer.Append( KTypeGlobalData );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeRamDrive:
-            aBuffer.Append( KTypeRamDrive );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeOpenFile:
-            aBuffer.Append( KTypeOpenFile );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeDiskSpace:
-            aBuffer.Append( KTypeDiskSpace );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeBitmap:
-            aBuffer.Append( KTypeBitmap );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeFbserv:
-            aBuffer.Append( KTypeFbserv );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeFileServerCache:
-            aBuffer.Append( KTypeFileServerCache );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeSystemMemory:
-            aBuffer.Append( KTypeSystemMemory );
-            break;
-        case EMemSpyEngineSysMemTrackerTypeWindowServer:
-            aBuffer.Append( KTypeWindowGroup );
-            break;            
-        default:
-            aBuffer.Append( KTypeUnknown );
-            break;
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChange::FormatAttributes( TDes& aBuffer ) const
-    {
-    _LIT( KAttribNew,   "[N]" );
-    _LIT( KAttribDead,  "[D]" );
-    _LIT( KAttribAlive, "[A]" );
-    _LIT( KAttribPlus,  "+" );
-    //
-    aBuffer.Zero();
-    // 
-    if  ( iAttributes & EMemSpyEngineSysMemTrackerEntryAttributeIsNew )
-        {
-        aBuffer.Append( KAttribNew );
-        }
-    //
-    const TBool isDead = !( iAttributes & EMemSpyEngineSysMemTrackerEntryAttributeIsAlive );
-    if  ( isDead )
-        {
-        if  ( aBuffer.Length() )
-            {
-            aBuffer.Append( KAttribPlus );
-            }
-
-        aBuffer.Append( KAttribDead );
-        }
-    else
-        {
-        if  ( aBuffer.Length() )
-            {
-            aBuffer.Append( KAttribPlus );
-            }
-
-        aBuffer.Append( KAttribAlive );
-        }
-    }
-
-
-
-
-
-
-
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntries.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +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 "MemSpyEngineHelperSysMemTrackerEntries.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntry::CMemSpyEngineHelperSysMemTrackerEntry( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyEngineSysMemTrackerType aType )
-:   iTracker( aTracker ), iType( aType )
-    {
-    // Entry starts out alive - this also updates it's timestamp
-    SetAlive();
-
-    // Entry starts out new by default
-    SetNew( ETrue );
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntry::Key() const
-    {
-    const TUint32 val = ( Type() << 28 ); 
-    TUint64 ret = val;
-    ret <<= 32;
-    ret += Handle();
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntry::HandleNewCycleL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    __ASSERT_ALWAYS( !( IsNew() && IsDead() ), User::Panic(_L("MemSpySysMemT"), __LINE__ ) );
-
-    // First of all, if the item is not dead, then we can update the cycle stats
-    if  ( IsAlive() )
-        {
-        UpdateCycleStatistics( aCycle );
-        }
-
-    // We create change descriptors only if the item has changed state in some way.
-    // I.e.:
-    //
-    // 1) If the entry is new or is dead, then we will require a change descriptor.
-    // 2) If the entry has changed, we'll require a change descriptor.
-    //
-    // Case (1)
-    if  ( IsNew() || IsDead() )
-        {
-        CreateChangeDescriptorL( aCycle );
-        }
-    else
-        {
-        // Case (2) 
-        const TBool hasChanged = HasChangedL( aCycle.Config() );
-        if  ( hasChanged )
-            {
-            CreateChangeDescriptorL( aCycle );
-            }
-        }
-    }
-
-
-CMemSpyEngine& CMemSpyEngineHelperSysMemTrackerEntry::Engine()
-    {
-    return iTracker.Engine();
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntry::UpdateTime()
-    {
-    iLastUpdateTime.HomeTime();
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntry::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& /*aEntry*/ )
-    {
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntry::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
-    {
-    // This item does not internally change state once created
-    return EFalse;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntry::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntry::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    }
-
-
-
-
-
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryBitmap.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,227 +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 "MemSpyEngineHelperSysMemTrackerEntryBitmap.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperfbserv.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperfilesystem.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-CMemSpyEngineHelperSysMemTrackerEntryBitmap::CMemSpyEngineHelperSysMemTrackerEntryBitmap( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeOpenFile )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryBitmap::~CMemSpyEngineHelperSysMemTrackerEntryBitmap()
-    {
-    delete iInfo;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryBitmap::ConstructL( TInt aHandle )
-    {
-    iInfo = new(ELeave) TMemSpyEngineFBServBitmapInfo();
-    CMemSpyEngineHelperFbServ::GetBitmapInfoL( aHandle, *iInfo );
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryBitmap* CMemSpyEngineHelperSysMemTrackerEntryBitmap::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TInt aHandle )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryBitmap* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryBitmap( aTracker );
-    CleanupStack::PushL( self );
-    self->ConstructL( aHandle );
-    return self;
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntryBitmap::Key() const
-    {
-    return TUint64( iInfo->iHandle );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryBitmap::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::NewLC( Attributes(), *iInfo );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryBitmap::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    // Doesn't participate in direct memory usage and indirect usage cannot really be measured.
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap( TUint8 aAttribs )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::~CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap()
-    {
-    delete iInfo;
-    delete iBitmap;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::ConstructL( const TMemSpyEngineFBServBitmapInfo& aInfo )
-    {
-    BaseConstructL();
-
-    iInfo = new(ELeave) TMemSpyEngineFBServBitmapInfo();
-    *iInfo = aInfo;
-
-    iBitmap = new(ELeave) CFbsBitmap();
-    const TInt err = iBitmap->Duplicate( aInfo.iHandle );
-    if ( err != KErrNone )
-        {
-        RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::ConstructL() - aInfo.iHandle: 0x%08x, dupe Err: %d", aInfo.iHandle, err );
-        delete iBitmap;
-        iBitmap = NULL;
-        }
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap* CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::NewLC( TUint8 aAttribs, const TMemSpyEngineFBServBitmapInfo& aInfo )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap( aAttribs );
-    CleanupStack::PushL( self );
-    self->ConstructL( aInfo );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeBitmap;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderLine, "Type, Handle, Dimensions [W x H], BPP, Disp. Mode, Color, Comp. Type, Size (Bytes), In Rom, Is Large, Is Mono, Is Compressed in Ram, Attribs");
-    aSink.OutputLineL( KHeaderLine );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,0x%08x,[%05d x %05d],%d,%d,%d,%d,%d,%d,%d,%d,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-
-    // Now output line
-    aSink.OutputLineFormattedL( KFormat,
-                                &type,
-                                iInfo->iHandle,
-                                iInfo->iSizeInPixels.iWidth,
-                                iInfo->iSizeInPixels.iHeight,
-                                iInfo->iBitsPerPixel,
-                                iInfo->iDisplayMode,
-                                iInfo->iColor,
-                                iInfo->iCompressionType,
-                                iInfo->iSizeInBytes,
-                                ( iInfo->iFlags & TMemSpyEngineFBServBitmapInfo::EFlagsIsRomBitmap ) ? 1 : 0,
-                                ( iInfo->iFlags & TMemSpyEngineFBServBitmapInfo::EFlagsIsMonochrome ) ? 1 : 0,
-                                ( iInfo->iFlags & TMemSpyEngineFBServBitmapInfo::EFlagsIsLarge ) ? 1 : 0,
-                                ( iInfo->iFlags & TMemSpyEngineFBServBitmapInfo::EFlagsIsCompressedInRam ) ? 1 : 0,
-                                &attribs
-                                );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    TRACE( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputDataL() - iInfo.iHandle: 0x%08x, iBitmap: 0x%08x, size: %03d x %03d", iInfo->iHandle, iBitmap, iInfo->iSizeInPixels.iWidth, iInfo->iSizeInPixels.iHeight ) );
-    if  ( iBitmap && iInfo->iSizeInPixels.iWidth > 0 && iInfo->iSizeInPixels.iHeight > 0 )
-        {
-        // Get folder
-        HBufC* fileName = HBufC::NewLC( KMaxFileName );
-        TPtr pFileName( fileName->Des() );
-        aCycle.GetDataFolderL( aSink.Engine().FsSession(), pFileName );
-        TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputDataL() - fileName1: [%S]"), fileName ) );
-
-        // Get file name
-        CMemSpyEngineFbServBitmap::GetExportableFileNameL( *iInfo, pFileName );
-        TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputDataL() - fileName2: [%S]"), fileName ) );
-
-        // Remove .bmp extension, since we're actually saving mbms
-        const TParsePtrC parser( pFileName );
-        if ( parser.ExtPresent() )
-            {
-            const TInt extLength = parser.Ext().Length();
-            const TInt totalLength = pFileName.Length();
-            pFileName.SetLength( totalLength - extLength );
-            }
-
-        // Add .MBM
-        _LIT( KEpocBitmapExtension, ".mbm" );
-        pFileName.Append( KEpocBitmapExtension );
-
-        const TInt err = iBitmap->Save( pFileName );
-        if  ( err != KErrNone )
-            {
-            RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputDataL() - err: %d, fileName: [%S]"), err, fileName ); 
-            }
-
-        // Clean up
-        CleanupStack::PopAndDestroy( fileName );
-        delete iBitmap;
-        iBitmap = NULL;
-        }
-    }
-
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryChunk.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +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 "MemSpyEngineHelperSysMemTrackerEntryChunk.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntryChunk::CMemSpyEngineHelperSysMemTrackerEntryChunk( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeChunk )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryChunk::~CMemSpyEngineHelperSysMemTrackerEntryChunk()
-    {
-    delete iChunkName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryChunk::ConstructL( const TMemSpyDriverChunkInfo& aInfo, const TDesC& aFullChunkName )
-    {
-    iCurrent = aInfo;
-    iLast = aInfo;
-    //
-    iChunkName = aFullChunkName.AllocL();
-    SetHandle( aInfo.iHandle );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryChunk::ConstructL( const TMemSpyDriverChunkInfo& aInfo, CMemSpyProcess& aProcess )
-    {
-    ConstructL( aInfo, aInfo.iName );
-    //
-    SetProcess( aProcess.Id() );
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryChunk* CMemSpyEngineHelperSysMemTrackerEntryChunk::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryChunk* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryChunk( aTracker );
-    CleanupStack::PushL( self );
-    self->ConstructL( aInfo, aInfo.iName );
-    return self;
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryChunk* CMemSpyEngineHelperSysMemTrackerEntryChunk::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo, CMemSpyProcess& aProcess )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryChunk* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryChunk( aTracker );
-    CleanupStack::PushL( self );
-    self->ConstructL( aInfo, aProcess );
-    return self;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryChunk::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
-    {
-    const CMemSpyEngineHelperSysMemTrackerEntryChunk& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryChunk& >( aEntry );
-    
-    // Update state
-    iLast = iCurrent;
-    iCurrent = entry.iCurrent;
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntryChunk::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
-    {
-    const TBool hasChanged = ( iCurrent.iSize != iLast.iSize );
-    return hasChanged;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryChunk::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeChunk* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::NewLC( Attributes(), *iChunkName, iCurrent, IsNew() ? NULL : &iLast );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryChunk::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    aCycle.AddToMemoryUsed( iCurrent.iSize );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::CMemSpyEngineHelperSysMemTrackerCycleChangeChunk( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::~CMemSpyEngineHelperSysMemTrackerCycleChangeChunk()
-    {
-    delete iLast;
-    delete iChunkName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::ConstructL( const TDesC& aChunkName, const TMemSpyDriverChunkInfo* aLast )
-    {
-    BaseConstructL();
-
-    // Save the thread name
-    iChunkName = aChunkName.AllocL();
-
-    // Save last heap data (if available)
-    if ( aLast )
-        {
-        iLast = new (ELeave) TMemSpyDriverChunkInfo();
-        *iLast = *aLast;
-        }
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeChunk* CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::NewLC( TUint8 aAttribs, const TDesC& aChunkName, const TMemSpyDriverChunkInfo& aCurrent, const TMemSpyDriverChunkInfo* aLast )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeChunk* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeChunk( aAttribs, aCurrent );
-    CleanupStack::PushL( self );
-    self->ConstructL( aChunkName, aLast );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeChunk;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderChunk, "Type, Process, Chunk, Handle, Base Addr, Size, Max Size, Attribs");
-    aSink.OutputLineL( KHeaderChunk );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,%S,0x%08x,0x%08x,%d,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-
-    // Try to get associated process name
-    TFullName processName( KNullDesC );
-    CMemSpyEngine& engine = aSink.Engine();
-    const TInt procIndex = engine.Container().ProcessIndexById( iCurrent.iOwnerId );
-    if  ( procIndex >= 0 )
-        {
-        CMemSpyProcess& process = engine.Container().At( procIndex );
-        process.FullName( processName );
-        }
-
-    // Now output line
-    pBuf.Format( KFormat, 
-                 &type,
-                 &processName, 
-                 iChunkName,
-                 iCurrent.iHandle,
-                 iCurrent.iBaseAddress,
-                 iCurrent.iSize,
-                 iCurrent.iMaxSize,
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::OutputDataL( CMemSpyEngineOutputSink& /*aSink*/, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    }
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryCode.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +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 "MemSpyEngineHelperSysMemTrackerEntryCode.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntryCode::CMemSpyEngineHelperSysMemTrackerEntryCode( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeCode )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryCode::~CMemSpyEngineHelperSysMemTrackerEntryCode()
-    {
-    delete iCodeSegName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryCode::ConstructL( const CMemSpyEngineCodeSegEntry& aInfo )
-    {
-    SetHandle( aInfo.Handle() );
-    iSize = Engine().Driver().RoundToPageSize( aInfo.Size() );
-    iCodeSegName = HBufC::NewL( aInfo.CreateInfo().iFileName.Length() );
-    iCodeSegName->Des().Copy( aInfo.CreateInfo().iFileName );
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryCode* CMemSpyEngineHelperSysMemTrackerEntryCode::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const CMemSpyEngineCodeSegEntry& aInfo )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryCode* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryCode( aTracker );
-    CleanupStack::PushL( self );
-    self->ConstructL( aInfo );
-    return self;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryCode::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeCode* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeCode::NewLC( Attributes(), *iCodeSegName, iSize, Handle() );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryCode::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    aCycle.AddToMemoryUsed( iSize );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeCode::CMemSpyEngineHelperSysMemTrackerCycleChangeCode( TUint8 aAttribs, TUint32 aSize, TUint32 aHandle )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iSize( aSize ), iHandle( aHandle )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeCode::~CMemSpyEngineHelperSysMemTrackerCycleChangeCode()
-    {
-    delete iCodeSegName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeCode::ConstructL( const TDesC& aCodeSegName )
-    {
-    BaseConstructL();
-
-    // Save the thread name
-    iCodeSegName = aCodeSegName.AllocL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeCode* CMemSpyEngineHelperSysMemTrackerCycleChangeCode::NewLC( TUint8 aAttribs, const TDesC& aCodeSegName, TUint32 aSize, TUint32 aHandle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeCode* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeCode( aAttribs, aSize, aHandle );
-    CleanupStack::PushL( self );
-    self->ConstructL( aCodeSegName );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeCode::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeCode;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeCode::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderCode, "Type, Name, Handle, Size, Attribs");
-    aSink.OutputLineL( KHeaderCode );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeCode::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,0x%08x,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-
-    // Now output line
-    pBuf.Format( KFormat, 
-                 &type,
-                 iCodeSegName, 
-                 iHandle,
-                 iSize,
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryDiskSpace.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +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 "MemSpyEngineHelperSysMemTrackerEntryDiskSpace.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::CMemSpyEngineHelperSysMemTrackerEntryDiskSpace( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TDriveNumber aDrive )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeDiskSpace ), iDrive( aDrive )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::~CMemSpyEngineHelperSysMemTrackerEntryDiskSpace()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::ConstructL()
-    {
-    UpdateVolumeInfoL( iCurrent );
-    iLast = iCurrent;
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryDiskSpace* CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TDriveNumber aDrive )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryDiskSpace* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryDiskSpace( aTracker, aDrive );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::Key() const
-    {
-    const TUint32 val = ( Type() << 28 );
-    TUint64 ret = val;
-    ret <<= 32;
-    ret += iDrive;
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::NewLC( Attributes(), iDrive, iCurrent, IsNew() ? NULL : &iLast );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
-    {
-    const TBool hasChanged = ( iCurrent.iFree != iLast.iFree ) || ( iCurrent.iSize != iLast.iSize );
-    TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::HasChangedL() - drive: %C:\\, iCurrent.iSize: %Ld, iLast.iSize: %Ld, iCurrent.iFree: %Ld, iLast.iFree: %Ld"), iDrive + 'A', iCurrent.iSize, iLast.iSize, iCurrent.iFree, iLast.iFree ) ); 
-    return hasChanged;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
-    {
-    const CMemSpyEngineHelperSysMemTrackerEntryDiskSpace& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryDiskSpace& >( aEntry );
-
-    TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::UpdateFromL() - START - drive: %C:\\, iCurrent.iSize: %Ld, iLast.iSize: %Ld, iCurrent.iFree: %Ld, iLast.iFree: %Ld"), iDrive + 'A', iCurrent.iSize, iLast.iSize, iCurrent.iFree, iLast.iFree ) ); 
-  
-    // Update state
-    iLast = iCurrent;
-    iCurrent = entry.iCurrent;
-
-    TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::UpdateFromL() - END - drive: %C:\\, iCurrent.iSize: %Ld, iLast.iSize: %Ld, iCurrent.iFree: %Ld, iLast.iFree: %Ld"), iDrive + 'A', iCurrent.iSize, iLast.iSize, iCurrent.iFree, iLast.iFree ) ); 
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::UpdateVolumeInfoL( TVolumeInfo& aInfo )
-    {
-    RFs& fsSession = Engine().FsSession();
-    User::LeaveIfError( fsSession.Volume( aInfo, iDrive ) );
-    TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::UpdateVolumeInfoL() - drive: %C:\\, aInfo.iSize: %Ld, aInfo.iFree: %Ld"), iDrive + 'A', iCurrent.iSize, iLast.iSize, iCurrent.iFree, iLast.iFree ) ); 
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace( TUint8 aAttribs, TDriveNumber aDrive )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iDrive( aDrive )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::~CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace()
-    {
-    delete iName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::ConstructL( const TVolumeInfo& aCurrent, const TVolumeInfo* /*aLast*/ )
-    {
-    BaseConstructL();
-
-    // Format drive letter
-    _LIT( KDriveFormatSpec, "EDrive%c" );
-    TChar driveChar( 'A' + iDrive );
-    iDriveName.Format( KDriveFormatSpec, (TInt) driveChar );
-
-    iName = aCurrent.iName.AllocL();
-    iUniqueID = aCurrent.iUniqueID;
-    iSize = aCurrent.iSize;
-    iFree = aCurrent.iFree;
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace* CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::NewLC( TUint8 aAttribs, TDriveNumber aDrive, const TVolumeInfo& aCurrent, const TVolumeInfo* aLast )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace( aAttribs, aDrive );
-    CleanupStack::PushL( self );
-    self->ConstructL( aCurrent, aLast );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeDiskSpace;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderLine, "Type, Drive Name, Drive Number, Size, Free, UID, Volume Name, Attribs");
-    aSink.OutputLineL( KHeaderLine );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,%1d,%ld,%ld,%8x,%S,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf( buf->Des() );
-
-    // Now output line
-    pBuf.Format( KFormat,
-                 &type,
-                 &iDriveName,
-                 iDrive,
-                 iSize,
-                 iFree,
-                 iUniqueID,
-                 iName,
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFbserv.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +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 "MemSpyEngineHelperSysMemTrackerEntryFbserv.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntryFbserv::CMemSpyEngineHelperSysMemTrackerEntryFbserv( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aCurrentLarge, const TMemSpyDriverChunkInfo& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeFbserv ), 
-    iCurrentLarge( aCurrentLarge ), iCurrentShared( aCurrentShared ), 
-    iCurrentBitmapConCount( aBitmapConCount ), 
-    iCurrentFontConCount( aFontConCount ),
-    iCurrentAccessibleBitmapCount( aAccessibleBitmapCount )
-    {
-    iLastShared = aCurrentShared;
-    iLastLarge = aCurrentLarge;
-    iLastBitmapConCount = aBitmapConCount;
-    iLastFontConCount = aFontConCount;
-    iLastAccessibleBitmapCount = aAccessibleBitmapCount;
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryFbserv::~CMemSpyEngineHelperSysMemTrackerEntryFbserv()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryFbserv::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryFbserv* CMemSpyEngineHelperSysMemTrackerEntryFbserv::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aCurrentLarge, const TMemSpyDriverChunkInfo& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryFbserv* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryFbserv( aTracker, aCurrentLarge, aCurrentShared, aBitmapConCount, aFontConCount, aAccessibleBitmapCount );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntryFbserv::Key() const
-    {
-    const TUint32 val = ( Type() << 28 );
-    TUint64 ret = val;
-    ret <<= 32;
-    ret += reinterpret_cast< TUint32 >( iCurrentLarge.iHandle );
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryFbserv::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
-    {
-    const CMemSpyEngineHelperSysMemTrackerEntryFbserv& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryFbserv& >( aEntry );
-    
-    // Update state
-    iLastShared = iCurrentShared;
-    iCurrentShared = entry.iCurrentShared;
-    iLastLarge = iCurrentLarge;
-    iCurrentLarge = entry.iCurrentLarge;
-    
-    // Counts
-    iLastBitmapConCount = iCurrentBitmapConCount;
-    iCurrentBitmapConCount = entry.iCurrentBitmapConCount;
-    //
-    iLastFontConCount = iCurrentFontConCount;
-    iCurrentFontConCount = entry.iCurrentFontConCount;
-    //
-    iLastAccessibleBitmapCount = iCurrentAccessibleBitmapCount;
-    iCurrentAccessibleBitmapCount = entry.iCurrentAccessibleBitmapCount;
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntryFbserv::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
-    {
-    const TBool hasChanged = ( iCurrentShared.iSize != iLastShared.iSize ) || ( iCurrentLarge.iSize != iLastLarge.iSize ) ||
-                             ( iCurrentFontConCount != iLastFontConCount ) || ( iCurrentBitmapConCount != iLastBitmapConCount ) ||
-                             ( iCurrentAccessibleBitmapCount != iCurrentAccessibleBitmapCount )
-                             ;
-    return hasChanged;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryFbserv::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::NewLC( Attributes(), iCurrentLarge, iCurrentShared, iCurrentBitmapConCount, iCurrentFontConCount, iCurrentAccessibleBitmapCount );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryFbserv::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    aCycle.AddToMemoryUsed( iCurrentShared.iSize );
-    aCycle.AddToMemoryUsed( iCurrentLarge.iSize );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv( TUint8 aAttribs, const TMemSpyDriverChunkInfoWithoutName& aCurrentLarge, const TMemSpyDriverChunkInfoWithoutName& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iSharedChunk( aCurrentShared ), iLargeChunk( aCurrentLarge ), iBitmapConCount( aBitmapConCount ), iFontConCount( aFontConCount ), iAccessibleBitmapCount( aAccessibleBitmapCount )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::~CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::ConstructL()
-    {
-    BaseConstructL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv* CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfoWithoutName& aCurrentLarge, const TMemSpyDriverChunkInfoWithoutName& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv( aAttribs, aCurrentLarge, aCurrentShared, aBitmapConCount, aFontConCount, aAccessibleBitmapCount );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeFbserv;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderChunk, "Type, FbsSharedChunk[Handle,Base,Size,Max Size], FbsLargeChunk[Handle,Base,Size,Max Size], AllBC, BCC, FCC, Attribs");
-    aSink.OutputLineL( KHeaderChunk );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,FbsSharedChunk[0x%08x,0x%08x,%d,%d],FbsLargeChunk[0x%08x,0x%08x,%d,%d],%d,%d,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-
-    // Now output line
-    pBuf.Format( KFormat, 
-                 &type,
-
-                 // Shared chunk
-                 iSharedChunk.iHandle,
-                 iSharedChunk.iBaseAddress,
-                 iSharedChunk.iSize,
-                 iSharedChunk.iMaxSize,
-
-                 // Large chunk
-                 iLargeChunk.iHandle,
-                 iLargeChunk.iBaseAddress,
-                 iLargeChunk.iSize,
-                 iLargeChunk.iMaxSize,
-
-                 // Container counts
-                 iAccessibleBitmapCount,
-                 iBitmapConCount,
-                 iFontConCount,
-
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFileServerCache.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +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 "MemSpyEngineHelperSysMemTrackerEntryFileServerCache.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::CMemSpyEngineHelperSysMemTrackerEntryFileServerCache( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeFileServerCache ), iLast( aInfo ), iCurrent( aInfo )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::~CMemSpyEngineHelperSysMemTrackerEntryFileServerCache()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::ConstructL()
-    {
-    SetHandle( iCurrent.iHandle );
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryFileServerCache* CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryFileServerCache* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryFileServerCache( aTracker, aInfo );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
-    {
-    const CMemSpyEngineHelperSysMemTrackerEntryFileServerCache& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryFileServerCache& >( aEntry );
-    
-    // Update state
-    iLast = iCurrent;
-    iCurrent = entry.iCurrent;
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
-    {
-    const TBool hasChanged = ( iCurrent.iSize != iLast.iSize );
-    return hasChanged;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::NewLC( Attributes(), iCurrent );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    aCycle.AddToMemoryUsed( iCurrent.iSize );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::~CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::ConstructL()
-    {
-    BaseConstructL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache* CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache( aAttribs, aCurrent );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeFileServerCache;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderChunk, "Type, Name, Handle, Base Addr, Size, Max Size, Attribs");
-    aSink.OutputLineL( KHeaderChunk );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,0x%08x,0x%08x,%d,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-
-    // Now output line
-    pBuf.Format( KFormat, 
-                 &type,
-                 &iCurrent.iName, 
-                 iCurrent.iHandle,
-                 iCurrent.iBaseAddress,
-                 iCurrent.iSize,
-                 iCurrent.iMaxSize,
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    CMemSpyEngine& engine = aSink.Engine();
-    }
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryGlobalData.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +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 "MemSpyEngineHelperSysMemTrackerEntryGlobalData.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerGlobalData::CMemSpyEngineHelperSysMemTrackerGlobalData( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeGlobalData )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerGlobalData::~CMemSpyEngineHelperSysMemTrackerGlobalData()
-    {
-    delete iChunkName;
-    delete iLast;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerGlobalData::ConstructL( CMemSpyProcess& aProcess, const TMemSpyDriverChunkInfo& aChunkInfo )
-    {
-    iCurrent = aChunkInfo;
-    //
-    SetProcess( aProcess.Id() );
-    SetHandle( aChunkInfo.iHandle );
-
-    if  ( aChunkInfo.iType == EMemSpyDriverChunkTypeGlobalData )
-        {
-        // Pure global data, unique chunk
-        iLast = new(ELeave) TMemSpyDriverChunkInfo();
-        *iLast = aChunkInfo;
-        }
-    else if ( aChunkInfo.iType == EMemSpyDriverChunkTypeStackAndProcessGlobalData )
-        {
-        // Mostly stack, possibly some global data too. Get the global data size from
-        // the code seg associated with the process.
-        CMemSpyEngineCodeSegList* codeSegs = Engine().HelperCodeSegment().CodeSegmentListL( aProcess.Id() );
-        CleanupStack::PushL( codeSegs );
-
-        // We're looking for the process codesegment...
-        TFileName* fileName = new(ELeave) TFileName();
-        CleanupStack::PushL( fileName );
-        aProcess.GetFileName( *fileName );
-        const TInt pos = codeSegs->IndexByName( *fileName );
-        CleanupStack::PopAndDestroy( fileName );
-
-        // Get total data size
-        if  ( pos >= 0 )
-            {
-            const CMemSpyEngineCodeSegEntry& entry = codeSegs->At( pos );
-            const TCodeSegCreateInfo& createInfo = entry.CreateInfo();
-            iCurrent.iSize = Engine().Driver().RoundToPageSize( createInfo.iTotalDataSize );
-            
-            // If there is no data, then we don't want an entry in the list, so bail out.
-            if  ( iCurrent.iSize == 0 )
-                {
-                User::Leave( KErrNotSupported );
-                }
-            }
-
-        CleanupStack::PopAndDestroy( codeSegs );
-        }
-
-    iChunkName = aChunkInfo.iName.AllocL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerGlobalData* CMemSpyEngineHelperSysMemTrackerGlobalData::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyProcess& aProcess, const TMemSpyDriverChunkInfo& aChunkInfo )
-    {
-    CMemSpyEngineHelperSysMemTrackerGlobalData* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerGlobalData( aTracker );
-    CleanupStack::PushL( self );
-    self->ConstructL( aProcess, aChunkInfo );
-    return self;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerGlobalData::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
-    {
-    const CMemSpyEngineHelperSysMemTrackerGlobalData& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerGlobalData& >( aEntry );
-    __ASSERT_ALWAYS( entry.IsProcessGlobalData() == IsProcessGlobalData(), User::Panic(_L("MemSpySysMemT"), __LINE__ ) );
-   
-    if  ( !IsProcessGlobalData() )
-        {
-        // Update state
-        *iLast = iCurrent;
-        iCurrent = entry.iCurrent;
-        }
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerGlobalData::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
-    {
-    TBool hasChanged = EFalse;
-    //
-    if  ( !IsProcessGlobalData() )
-        {
-        hasChanged = ( iCurrent.iSize != iLast->iSize );
-        }
-    //
-    return hasChanged;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerGlobalData::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::NewLC( Attributes(), *iChunkName, iCurrent, IsNew() ? NULL : iLast );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerGlobalData::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    const TInt size = CurrentGlobalDataSize();
-    aCycle.AddToMemoryUsed( size );
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerGlobalData::IsProcessGlobalData() const
-    {
-    return ( iLast == NULL );
-    }
-
-
-TInt CMemSpyEngineHelperSysMemTrackerGlobalData::CurrentGlobalDataSize() const
-    {
-    const TInt size = iCurrent.iSize;
-    return size;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData( TUint8 aAttribs, const TMemSpyDriverChunkInfoWithoutName& aCurrent )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::~CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData()
-    {
-    delete iLast;
-    delete iChunkName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::ConstructL( const TDesC& aChunkName, const TMemSpyDriverChunkInfoWithoutName* aLast )
-    {
-    BaseConstructL();
-
-    // Save the thread name
-    iChunkName = aChunkName.AllocL();
-
-    // Save last heap data (if available)
-    if  ( aLast )
-        {
-        iLast = new (ELeave) TMemSpyDriverChunkInfoWithoutName();
-        *iLast = *aLast;
-        }
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData* CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::NewLC( TUint8 aAttribs, const TDesC& aChunkName, const TMemSpyDriverChunkInfoWithoutName& aCurrent, const TMemSpyDriverChunkInfoWithoutName* aLast )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData( aAttribs, aCurrent );
-    CleanupStack::PushL( self );
-    self->ConstructL( aChunkName, aLast );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeGlobalData;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderGlobalData, "Type, Process, Chunk, Handle, Base Addr, Size, Max Size, Attribs");
-    aSink.OutputLineL( KHeaderGlobalData );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,%S,0x%08x,0x%08x,%d,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-
-    // Try to get associated process name
-    TPtrC pProcessName( KNullDesC );
-    CMemSpyEngine& engine = aSink.Engine();
-    const TInt procIndex = engine.Container().ProcessIndexById( iCurrent.iOwnerId );
-    if  ( procIndex >= 0 )
-        {
-        CMemSpyProcess& process = engine.Container().At( procIndex );
-        pProcessName.Set( process.Name() );
-        }
-
-    // Now output line
-    pBuf.Format( KFormat, 
-                 &type,
-                 &pProcessName, 
-                 iChunkName,
-                 iCurrent.iHandle,
-                 iCurrent.iBaseAddress,
-                 iCurrent.iSize,
-                 iCurrent.iMaxSize,
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    CMemSpyEngine& engine = aSink.Engine();
-    }
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +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 "MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-#include <memspy/driver/memspydriverconstants.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelperkernelcontainers.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyDriverContainerType aType )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeHandleGeneric ), iHandleType( aType )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::~CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric()
-    {
-    delete iName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::ConstructL( TAny* aHandle )
-    {
-    SetHandle( aHandle );
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric* CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TAny* aHandle, TMemSpyDriverContainerType aType )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric( aTracker, aType );
-    CleanupStack::PushL( self );
-    self->ConstructL( aHandle );
-    return self;
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::Key() const
-    {
-    const TUint32 val = ( Type() << 28 ) + iHandleType; 
-    TUint64 ret = val;
-    ret <<= 32;
-    ret += Handle();
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    // We lazy fetch the name to avoid having to get info for every single handle whenever a change cycle occurs...
-    if  ( iName == NULL )
-        {
-        TMemSpyDriverHandleInfoGeneric info;
-        const TInt err = Engine().Driver().GetGenericHandleInfo( KMemSpyDriverEnumerateContainerHandles, iHandleType, (TAny*) Handle(), info );
-        if  ( err == KErrNone )
-            {
-            // Save name
-            iName = HBufC::NewL( info.iName.Length() );
-            iName->Des().Copy( info.iName );
-            }
-        else
-            {
-            iName = KNullDesC().AllocL();
-            }
-        }
-    
-    CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::NewLC( Attributes(), *iName, Handle(), iHandleType );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric( TUint8 aAttribs, TUint32 aHandle, TMemSpyDriverContainerType aType )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iHandle( aHandle ), iType( aType )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::~CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric()
-    {
-    delete iName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::ConstructL( const TDesC& aName )
-    {
-    BaseConstructL();
-
-    // Save the thread name
-    iName = aName.AllocL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric* CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::NewLC( TUint8 aAttribs, const TDesC& aName, TUint32 aHandle, TMemSpyDriverContainerType aType )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric( aAttribs, aHandle, aType );
-    CleanupStack::PushL( self );
-    self->ConstructL( aName );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeHandleGeneric;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderLine, "Type, Name, Handle, Handle Type, Attribs");
-    aSink.OutputLineL( KHeaderLine );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,0x%08x,%S,%S" );
-    //
-    TMemSpySWMTTypeName type;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-    //
-    const TPtrC pType( CMemSpyEngineGenericKernelObjectList::TypeAsString( iType ) );
-
-    // Now output line
-    pBuf.Format( KFormat, 
-                 &type,
-                 iName, 
-                 iHandle,
-                 &pType,
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +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 "MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-#include <memspy/driver/memspydriverconstants.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include<memspy/engine/memspyenginehelperkernelcontainers.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeHandlePAndS )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::~CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS()
-    {
-    delete iName;
-    delete iThreadName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::ConstructL( TAny* aHandle )
-    {
-    SetHandle( aHandle );
-    TInt err = Engine().Driver().GetPAndSInfo( aHandle, iInfo );
-    User::LeaveIfError( err );
-    SetThread( iInfo.iTid );
-
-    // Get thread name, if possible.
-    CMemSpyThread* thread = NULL;
-    CMemSpyProcess* process = NULL;
-    err = Engine().Container().ProcessAndThreadByThreadId( iInfo.iTid, process, thread );
-    if  ( err == KErrNone && thread )
-        {
-        TFullName* name = new(ELeave) TFullName();
-        CleanupStack::PushL( name );
-        thread->FullName( *name );
-        iThreadName = name->AllocL();
-        CleanupStack::PopAndDestroy( name );
-        }
-    else
-        {
-        iThreadName = KMemSpySWMTThreadNotFound().AllocL();
-        }
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS* CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TAny* aHandle )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS( aTracker );
-    CleanupStack::PushL( self );
-    self->ConstructL( aHandle );
-    return self;
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::Key() const
-    {
-    const TUint32 val = ( Type() << 28 ); 
-    TUint64 ret = val;
-    ret <<= 32;
-    ret += Handle();
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    // We lazy fetch the name to avoid having to get info for every single handle whenever a change cycle occurs...
-    if  ( iName == NULL )
-        {
-        TMemSpyDriverHandleInfoGeneric info;
-        const TInt err = Engine().Driver().GetGenericHandleInfo( KMemSpyDriverEnumerateContainerHandles, EMemSpyDriverContainerTypePropertyRef, (TAny*) Handle(), info );
-        if  ( err == KErrNone )
-            {
-            // Save name
-            iName = HBufC::NewL( info.iName.Length() );
-            iName->Des().Copy( info.iName );
-            }
-        else
-            {
-            iName = KNullDesC().AllocL();
-            }
-        }
-    
-    CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::NewLC( Attributes(), Handle(), iInfo, *iName, *iThreadName );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS( TUint8 aAttribs, TUint32 aHandle, const TMemSpyDriverPAndSInfo& aInfo )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iHandle( aHandle ), iInfo( aInfo )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::~CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS()
-    {
-    delete iName;
-    delete iThreadName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::ConstructL( const TDesC& aName, const TDesC& aThreadName )
-    {
-    BaseConstructL();
-    //
-    iName = aName.AllocL();
-    iThreadName = aThreadName.AllocL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS* CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::NewLC( TUint8 aAttribs, TUint32 aHandle, const TMemSpyDriverPAndSInfo& aInfo, const TDesC& aName, const TDesC& aThreadName )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS( aAttribs, aHandle, aInfo );
-    CleanupStack::PushL( self );
-    self->ConstructL( aName, aThreadName );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeHandlePAndS;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderLine, "Type, Name, Handle, Key Type, Category, Key, Ref. Count, Creator SID, Thread Id, Thread Name, Attribs");
-    aSink.OutputLineL( KHeaderLine );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,0x%08x,%d,0x%08x,0x%08x,%d,0x%08x,%d,%S,%S" );
-    //
-    TMemSpySWMTTypeName type;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-
-    // Now output line
-    pBuf.Format( KFormat, 
-                 &type,
-                 iName, 
-                 iHandle,
-                 iInfo.iType,
-                 iInfo.iCategory,
-                 iInfo.iKey,
-                 iInfo.iRefCount,
-                 iInfo.iCreatorSID,
-                 iInfo.iTid,
-                 iThreadName,
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
-
-
-
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHeap.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,407 +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 "MemSpyEngineHelperSysMemTrackerEntryHeap.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-#include <memspy/engine/memspyenginehelpersysmemtracker.h>
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntryHeap::CMemSpyEngineHelperSysMemTrackerEntryHeap( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyEngineSysMemTrackerType aType )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, aType )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryHeap::~CMemSpyEngineHelperSysMemTrackerEntryHeap()
-    {
-    delete iThreadName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHeap::ConstructL()
-    {
-    // Kernel
-    TFullName name;
-    MemSpyEngineUtils::GetKernelHeapThreadName( name );
-    iThreadName = name.AllocL();
-    //
-    UpdateHeapInfoL( iLast );
-    iCurrent = iLast;
-    //
-    SetHandle( iCurrent.AsRHeap().MetaData().ChunkHandle() );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHeap::ConstructL( CMemSpyThread& aThread )
-    {
-    TFullName* name = new(ELeave) TFullName();
-    CleanupStack::PushL( name );
-    aThread.FullName( *name );
-    iThreadName = name->AllocL();
-    CleanupStack::PopAndDestroy( name );
-    //
-    SetThread( aThread.Id() );
-    SetProcess( aThread.Process().Id() );
-    //
-    UpdateHeapInfoL( iLast );
-    iCurrent = iLast;
-    //
-    SetHandle( iCurrent.AsRHeap().MetaData().ChunkHandle() );
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryHeap* CMemSpyEngineHelperSysMemTrackerEntryHeap::NewUserLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyThread& aThread )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryHeap* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryHeap( aTracker, EMemSpyEngineSysMemTrackerTypeHeapUser );
-    CleanupStack::PushL( self );
-    self->ConstructL( aThread );
-    return self;
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryHeap* CMemSpyEngineHelperSysMemTrackerEntryHeap::NewKernelLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryHeap* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryHeap( aTracker, EMemSpyEngineSysMemTrackerTypeHeapKernel );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntryHeap::Key() const
-    {
-    const TUint32 val = ( Type() << 28 ) + ThreadId(); 
-    TUint64 ret = val;
-    ret <<= 32;
-    ret += Handle();
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHeap::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
-    {
-    const CMemSpyEngineHelperSysMemTrackerEntryHeap& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryHeap& >( aEntry );
-    
-    // Update state
-    iLast = iCurrent;
-    iCurrent = entry.iCurrent;
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntryHeap::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
-    {
-    TBool hasChanged = EFalse;
-
-    // Work out if something has changed...
-    if  ( HasHeapSizeChanged() )
-        {
-        hasChanged = ETrue;
-        }
-    else if ( HaveAllocCellsChanged() )
-        {
-        hasChanged = ETrue;
-        }
-    else if ( HaveFreeCellsChanged() )
-        {
-        hasChanged = ETrue;
-        }
-
-    return hasChanged;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHeap::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeHeap* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::NewLC( Attributes(), *iThreadName, iCurrent, IsNew() ? NULL : &iLast );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHeap::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    const TMemSpyHeapMetaDataRHeap& metaC = iCurrent.AsRHeap().MetaData();
-    const TMemSpyHeapStatisticsRHeap& statsC = iCurrent.AsRHeap().Statistics();
-    //
-    aCycle.AddToMemoryUsed( metaC.ChunkSize() );
-    aCycle.AddToCellCountAlloc( statsC.StatsAllocated().TypeCount() );
-    aCycle.AddToMemoryHeapAllocs( statsC.StatsAllocated().TypeSize() );
-    aCycle.AddToCellCountFree( statsC.StatsFree().TypeCount() );
-    aCycle.AddToMemoryHeapFrees( statsC.StatsFree().TypeSize() );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHeap::SetAsShared( TBool aShared )
-    {
-    iCurrent.AsRHeap().MetaData().SetSharedHeap( aShared );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryHeap::UpdateHeapInfoL( TMemSpyHeapInfo& aInfo )
-    {
-    TInt error = KErrNone;
-    //
-    if  ( Type() == EMemSpyEngineSysMemTrackerTypeHeapUser )
-        {
-        // Get the heap info first of all
-        Engine().ProcessSuspendLC( ProcessId() );
-        error = Engine().Driver().GetHeapInfoUser( aInfo, ThreadId() );
-        CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-        }
-    else if ( Type() == EMemSpyEngineSysMemTrackerTypeHeapKernel )
-        {
-        // Kernel
-        error = Engine().Driver().GetHeapInfoKernel( aInfo );
-        }
-    else
-        {
-        User::Invariant();
-        }
-    //
-    User::LeaveIfError( error );
-    //
-    if  ( aInfo.Type() == TMemSpyHeapInfo::ETypeUnknown )
-        {
-        User::Leave( KErrNotSupported );
-        }
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntryHeap::HasHeapSizeChanged() const
-    {
-    return ( iCurrent.AsRHeap().MetaData().ChunkSize() != iLast.AsRHeap().MetaData().ChunkSize() );
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntryHeap::HaveFreeCellsChanged() const
-    {
-    TBool changed = ( iCurrent.AsRHeap().Statistics().StatsFree().TypeCount() != iLast.AsRHeap().Statistics().StatsFree().TypeCount() ) ||
-		( iCurrent.AsRHeap().Statistics().StatsFree().TypeSize() != iLast.AsRHeap().Statistics().StatsFree().TypeSize() );
-    //
-    return changed;
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntryHeap::HaveAllocCellsChanged() const
-    {
-    return 
-        ( iCurrent.AsRHeap().Statistics().StatsAllocated().TypeCount() != iLast.AsRHeap().Statistics().StatsAllocated().TypeCount() ) ||
-        ( iCurrent.AsRHeap().Statistics().StatsAllocated().TypeSize() != iLast.AsRHeap().Statistics().StatsAllocated().TypeSize() );
-    }
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::CMemSpyEngineHelperSysMemTrackerCycleChangeHeap( TUint8 aAttribs, const TMemSpyHeapInfo& aCurrent )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::~CMemSpyEngineHelperSysMemTrackerCycleChangeHeap()
-    {
-    delete iLast;
-    delete iThreadName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::ConstructL( const TDesC& aThreadName, const TMemSpyHeapInfo* aLast )
-    {
-    BaseConstructL();
-
-    // Save the thread name
-    iThreadName = aThreadName.AllocL();
-
-    // Save last heap data (if available)
-    if ( aLast )
-        {
-        iLast = new (ELeave) TMemSpyHeapInfo();
-        *iLast = *aLast;
-        }
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeHeap* CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TMemSpyHeapInfo& aCurrent, const TMemSpyHeapInfo* aLast )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeHeap* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeHeap( aAttribs, aCurrent );
-    CleanupStack::PushL( self );
-    self->ConstructL( aThreadName, aLast );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::Type() const
-    {
-    TMemSpyEngineSysMemTrackerType ret = EMemSpyEngineSysMemTrackerTypeHeapUser;
-    //
-    if  ( IsKernel() )
-        {
-        ret = EMemSpyEngineSysMemTrackerTypeHeapKernel;
-        }
-    //
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderHeap, "Type, Thread, Chunk, Handle, Heap Addr, Size, Min, Max, 1st Free Addr, 1st Free Len, Alloc Count, Alloc Space, Free Count, Free Space, Free Slack, F.Largest, A.Largest, Attribs");
-    aSink.OutputLineL( KHeaderHeap );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,%S,0x%08x,0x%08x,%d,%d,%d,0x%08x,%d,%d,%d,%d,%d,%d,%d,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-
-    const TMemSpyHeapMetaDataRHeap& metaData = iCurrent.AsRHeap().MetaData();
-    const TMemSpyHeapStatisticsRHeap& stats = iCurrent.AsRHeap().Statistics();
-
-    // Strip any process & thread
-    const TPtrC pChunkName( MemSpyEngineUtils::TextAfterLastDoubleColon( metaData.ChunkName() ) );
-
-    pBuf.Format( KFormat, 
-                 &type,
-                 iThreadName, 
-                 &pChunkName,
-                 metaData.ChunkHandle(),
-                 /*objectData.Base(),*/ metaData.iAllocatorAddress,
-                 metaData.ChunkSize(),
-                 /*objectData.iMinLength,*/ metaData.iMinHeapSize,
-                 /*objectData.iMaxLength,*/ metaData.iMaxHeapSize,
-                 /*objectData.iFree.next,*/ NULL, //TODO
-                 /*objectData.iFree.len,*/ 0,
-                 stats.StatsAllocated().TypeCount(),
-                 stats.StatsAllocated().TypeSize(),
-                 stats.StatsFree().TypeCount(),
-                 stats.StatsFree().TypeSize(),
-                 stats.StatsFree().SlackSpaceCellSize(),
-                 stats.StatsFree().LargestCellSize(),
-                 stats.StatsAllocated().LargestCellSize(),
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngine& engine = aSink.Engine();
-
-    // First check that we can find the user-thread okay.
-    CMemSpyThread* thread = NULL;
-    CMemSpyProcess* process = NULL;
-    TBool allowedToDump = ETrue;
-    TMemSpyEngineHelperSysMemTrackerConfig config;
-    engine.HelperSysMemTracker().GetConfig( config );
-    if ( config.iThreadNameFilter.Length() > 0 && iThreadName->FindF( config.iThreadNameFilter ) == KErrNotFound )
-        {
-        allowedToDump = EFalse;
-        }
-    if  ( allowedToDump && !IsKernel() )
-        {
-        allowedToDump = ( engine.Container().ProcessAndThreadByThreadId( iCurrent.Tid(), process, thread ) == KErrNone );
-        }
-
-	// Now dump the heap data
-    if  ( allowedToDump )
-        {
-        // Starts a data Stream
-        aCycle.DataStreamBeginL( aSink, *iThreadName );
-        
-        TInt err = KErrNone;
-
-        if  ( IsKernel() )
-            {
-            TRAP(err, engine.HelperHeap().OutputHeapDataKernelL( KMemSpyEngineSinkDoNotCreateOwnDataStream ));
-            }
-        else if ( thread )
-            {
-            TRAP(err, engine.HelperHeap().OutputHeapDataUserL( *thread, KMemSpyEngineSinkDoNotCreateOwnDataStream )); 
-            }
-
-        // End the stream (commit the file)
-        aCycle.DataStreamEndL( aSink );
-        
-        User::LeaveIfError(err);
-        }
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::IsKernel() const
-    {
-    return ( iCurrent.Pid() == 0 && iCurrent.Tid() == 0 );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::FormatAttributes( TDes& aBuffer ) const
-    {
-    _LIT( KAttribShared, "[S]" ); // Attribute for Shared Heap
-    _LIT( KAttribPlus,  "+" );
-    CMemSpyEngineHelperSysMemTrackerCycleChange::FormatAttributes( aBuffer );
-    if ( iCurrent.AsRHeap().MetaData().IsSharedHeap() )
-        {
-        if ( aBuffer.Length() )
-            {
-            aBuffer.Append( KAttribPlus );
-            }
-        aBuffer.Append( KAttribShared );
-        }
-    }
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryManager.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1150 +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 "MemSpyEngineHelperSysMemTrackerEntryManager.h"
-
-// System includes
-#include <e32debug.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyenginemidwife.h>
-#include <memspy/engine/memspyengineundertaker.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyenginehelperfbserv.h>
-#include <memspy/engine/memspyenginehelperfilesystem.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include <memspy/engine/memspyenginehelperkernelcontainers.h>
-#include <memspy/engine/memspyenginehelperwindowserver.h>
-#include <memspy/engine/memspyenginehelpersysmemtracker.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include "MemSpyEngineHelperSysMemTrackerLog.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
-#include "MemSpyEngineHelperSysMemTrackerEntries.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryChunk.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryGlobalData.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryHeap.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryRamDrive.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryStack.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryCode.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryOpenFile.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryDiskSpace.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryBitmap.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryFbserv.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryFileServerCache.h"
-#include "MemSpyEngineHelperSysMemTrackerEntrySystemMemory.h"
-#include "MemSpyEngineHelperSysMemTrackerEntryWindowServer.h"
-
-
-// Constants
-
-// Message printed to RDebug output for some clients that may be reading traces 
-_LIT( KMemSpyKeepaliveMessage, "<MEMSPY_PROGRESS>" );
-
-
-CMemSpyEngineHelperSysMemTrackerEntryManager::CMemSpyEngineHelperSysMemTrackerEntryManager( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyEngineHelperSysMemTrackerEntryManager* aMasterList )
-:   iTracker( aTracker ), iMasterList( aMasterList )
-    {
-    }
-
-    
-CMemSpyEngineHelperSysMemTrackerEntryManager::~CMemSpyEngineHelperSysMemTrackerEntryManager()
-    {
-    iEntries.ResetAndDestroy();
-    iEntries.Close();
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::ConstructL()
-    {
-    CreateSeedItemsL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryManager* CMemSpyEngineHelperSysMemTrackerEntryManager::NewL( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryManager* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryManager( aTracker );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryManager* CMemSpyEngineHelperSysMemTrackerEntryManager::NewL( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyEngineHelperSysMemTrackerEntryManager& aMasterList )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryManager* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryManager( aTracker, &aMasterList );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::IdentifyChangesL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    // Mark everything in this list (i.e. the master list) as dead.
-    MarkEverythingDead();
-
-    // Create a new list which will act as a secondary list. This new list will only contain
-    // new entries. Any entries which it attempts to create that already exist in the master list
-    // will be discared (after updating the corresponding master list entry with new values).
-    CMemSpyEngineHelperSysMemTrackerEntryManager* newEM = CMemSpyEngineHelperSysMemTrackerEntryManager::NewL( iTracker, *this );
-    CleanupStack::PushL( newEM );
-
-    // At this point, we have performed several key operations
-    // 
-    // 1) We have tagged everything that is still alive as "alive".
-    // 2) We have left everything that no longer exists as "dead"
-    // 3) We have updated all alive entries with new values (if they have changed)
-    // 4) We have identified new entries (these are currently orphaned within the secondary list right now).
-    //
-    // We now need to merge the two lists, i.e. take all the new entries in 'newEM' and merge them
-    // into the current master list.
-    MergeListIntoMeL( *newEM );
-
-    // We can throw the other list away now as it will be empty.
-    CleanupStack::PopAndDestroy( newEM );
-
-    // At this point we have our final new list, but it still contains dead entries.
-    // We must next output all the change information required for this cycle.
-    ProcessChangesL( aCycle );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::EverythingHasChangedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    ProcessChangesL( aCycle );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::ProcessChangesL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    const TInt count = iEntries.Count();
-    for( TInt i=count-1; i>=0; i-- )
-        {
-        CMemSpyEngineHelperSysMemTrackerEntry* entry = iEntries[ i ];
-        
-        // Create any change descriptors etc
-        TRAP_IGNORE( entry->HandleNewCycleL( aCycle ) );
-
-        // Destroy the entry if it's no longer needed
-        if  ( entry->IsDead() )
-            {
-            delete entry;
-            iEntries.Remove( i );
-            }
-        else
-            {
-            // It's not new anymore
-            entry->SetNew( EFalse );
-            }
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::AddItemAndPopL( CMemSpyEngineHelperSysMemTrackerEntry* aItem )
-    {
-    // We sort by entry key, we do not allow duplicates
-    TLinearOrder<CMemSpyEngineHelperSysMemTrackerEntry> orderer( CompareKey );
-
-    // Before we save the entry we must check to see if the master list knows about it.
-    const TUint64 key( aItem->Key() );
-
-    // Operates in one of two ways. If we're in stand-alone mode, then it saves every specified entry.
-    // If we're in secondary mode (i.e. we have an associated master list) then it only saves new entries.
-    // Entries which are changed are updated (in the master list) and entries that don't exist anymore
-    // are tagged as dead.
-    //
-    if  ( ActingAsSecondaryList() )
-        {
-        CMemSpyEngineHelperSysMemTrackerEntry* existingEntry = iMasterList->EntryByKey( key );
-        if  ( existingEntry )
-            {
-            // Entry used to exist, still does. Update the master list entry with the information
-            // from the transient (new) entry.
-            existingEntry->UpdateFromL( *aItem );
-
-            // Entry is still alive. Previously, at the start of the cycle, we'd tagged all master list
-            // entries as dead, hence we must undo that if we find the entry really still exists...
-            // NB: this also updates the timestamp for the entry, to show when it was last still alive.
-            existingEntry->SetAlive();
-
-            // But it definitely isn't new anymore as we've seen it at least once before
-            existingEntry->SetNew( EFalse );
-
-            // Transient entry not needed anymore, keep original
-            CleanupStack::PopAndDestroy( aItem );
-            }
-        else
-            {
-            // Entry didn't exist before - it's a new one
-            iEntries.InsertInOrderL( aItem, orderer );
-            CleanupStack::Pop( aItem );
-            }
-
-        // Any entries in the master list which aren't present anymore in this list (aka, dead entries)
-        // will remain tagged as dead and will be filtered out and dealt with shortly...
-        }
-    else
-        {
-        // We ARE the master list
-        const TInt err = iEntries.InsertInOrder( aItem, orderer );
-        if  ( err == KErrAlreadyExists )
-            {
-            // Don't allow duplicates
-            RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::AddItemAndPopL() - ******* duplicate key ******* key: %LU, type: %d, tid: 0x%08x, pid: 0x%08x, handle: 0x%08x", key, aItem->Type(), (TUint32) aItem->ThreadId(), (TUint32) aItem->ProcessId(), aItem->Handle() );
-            delete aItem;
-            }
-        else if ( err != KErrNone )
-            {
-            User::Leave( err );
-            }
-
-        CleanupStack::Pop( aItem );
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::MarkEverythingDead()
-    {
-    const TInt count = iEntries.Count();
-    for( TInt i=count-1; i>=0; i-- )
-        {
-        CMemSpyEngineHelperSysMemTrackerEntry* entry = iEntries[ i ];
-        entry->SetDead();
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::MergeListIntoMeL( CMemSpyEngineHelperSysMemTrackerEntryManager& aOtherList )
-    {
-    const TInt count = aOtherList.iEntries.Count();
-    for( TInt i=count-1; i>=0; i-- )
-        {
-        CMemSpyEngineHelperSysMemTrackerEntry* entry = aOtherList.iEntries[ i ];
-        CleanupStack::PushL( entry );
-        aOtherList.iEntries.Remove( i );
-        AddItemAndPopL( entry );
-        }
-    }
-
-
-TInt CMemSpyEngineHelperSysMemTrackerEntryManager::FindByHandle( TUint aHandle, TMemSpyEngineSysMemTrackerType aType ) const
-    {
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = iEntries.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineHelperSysMemTrackerEntry* entry = iEntries[ i ];
-        if  ( entry->Handle() == aHandle && entry->Type() == aType )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineHelperSysMemTrackerEntryManager::FindByThreadId( const TThreadId& aThreadId ) const
-    {
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = iEntries.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineHelperSysMemTrackerEntry* entry = iEntries[ i ];
-        if  ( entry->ThreadId() == aThreadId )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntry* CMemSpyEngineHelperSysMemTrackerEntryManager::EntryByKey( const TUint64& aKey )
-    {
-    TLinearOrder<CMemSpyEngineHelperSysMemTrackerEntry> orderer( CompareKey );
-    //
-    CMemSpyEngineHelperSysMemTrackerEntryWithSuppliedKey tempEntry( iTracker, aKey );
-    const TInt pos = iEntries.FindInOrder( &tempEntry, orderer );
-    //
-    CMemSpyEngineHelperSysMemTrackerEntry* ret = NULL;
-    if  ( pos >= 0 )
-        {
-        ret = iEntries[ pos ];
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineHelperSysMemTrackerEntryManager::CompareKey( const CMemSpyEngineHelperSysMemTrackerEntry& aLeft, const CMemSpyEngineHelperSysMemTrackerEntry& aRight )
-    {
-    TInt ret = -1;
-    //
-    const TUint64 kLeft( aLeft.Key() );
-    const TUint64 kRight( aRight.Key() );
-    //
-    if  ( kLeft > kRight )
-        {
-        ret = 1;
-        }
-    else if ( kLeft == kRight )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineHelperSysMemTrackerEntryManager::CompareKeyAndTimeStamp( const CMemSpyEngineHelperSysMemTrackerEntry& aLeft, const CMemSpyEngineHelperSysMemTrackerEntry& aRight )
-    {
-    TInt ret = CompareKey( aLeft, aRight );
-    if  ( ret == 0 )
-        {
-        // Keys are the same, so compare time stamps
-        const TTime& tLeft = aLeft.LastUpdateTime();
-        const TTime& tRight = aRight.LastUpdateTime();
-        //
-        ret = -1;
-        if  ( tLeft > tRight )
-            {
-            ret = 1;
-            }
-        else if ( tLeft == tRight )
-            {
-            ret = 0;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-CMemSpyEngine& CMemSpyEngineHelperSysMemTrackerEntryManager::Engine()
-    {
-    return iTracker.Engine();
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL()
-    {
-    RDebug::Print( KMemSpyKeepaliveMessage );
-    
-    TMemSpyEngineHelperSysMemTrackerConfig config;
-    Engine().HelperSysMemTracker().GetConfig( config );
-    
-    // Get chunk list for entire device
-    CMemSpyEngineChunkList* chunks = Engine().HelperChunk().ListL( );
-    CleanupStack::PushL( chunks );
-
-#ifdef SYSMEMTRACKERLOGGING
-    {
-    const TInt chunkCount = chunks->Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
-        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() - MASTER - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
-        }
-    }
-#endif
-    
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache )
-        {
-        RDebug::Print( KMemSpyKeepaliveMessage );
-        // Extract F32 cache chunk
-        CreateSeedItemsFileServerCacheL( *chunks );        
-        }
-
-#ifdef SYSMEMTRACKERLOGGING
-    {
-    const TInt chunkCount = chunks->Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
-        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER F32 CACHE - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
-        }
-    }
-#endif
-
-// TODO: Uncomment when  bitmap handels are fixed
-//    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles )
-//        {
-//        RDebug::Print( KMemSpyKeepaliveMessage );
-//        // Bitmap
-//        CreateSeedItemsBitmapL( *chunks );        
-//        }
-
-#ifdef SYSMEMTRACKERLOGGING
-    {
-    const TInt chunkCount = chunks->Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
-        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER BITMAPS - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
-        }
-    }
-#endif
-
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap )
-        {
-        RDebug::Print( KMemSpyKeepaliveMessage );
-        // Look for user heaps
-        CreateSeedItemsHeapUserL( *chunks );
-        }
-
-#ifdef SYSMEMTRACKERLOGGING
-    {
-    const TInt chunkCount = chunks->Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
-        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER USER HEAP - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
-        }
-    }
-#endif
-
-//  TODO: Uncomment after fix
-//    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap )
-//        {
-//        RDebug::Print( KMemSpyKeepaliveMessage );
-//        // Look for kernel heaps
-//        CreateSeedItemsHeapKernelL( *chunks );
-//        }
-
-#ifdef SYSMEMTRACKERLOGGING
-    {
-    const TInt chunkCount = chunks->Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
-        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER KERNEL HEAP - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
-        }
-    }
-#endif
-
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks )
-        {
-        RDebug::Print( KMemSpyKeepaliveMessage );
-        // Local chunks
-        CreateSeedItemsChunkLocalL( *chunks );        
-        }
-
-#ifdef SYSMEMTRACKERLOGGING
-    {
-    const TInt chunkCount = chunks->Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
-        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER LOCL CHUNK - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
-        }
-    }
-#endif
-
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks )
-        {
-        RDebug::Print( KMemSpyKeepaliveMessage );
-        // Global chunks
-        CreateSeedItemsChunkGlobalL( *chunks );        
-        }
-
-#ifdef SYSMEMTRACKERLOGGING
-    {
-    const TInt chunkCount = chunks->Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
-        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER GLOB CHUNK - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
-        }
-    }
-#endif
-
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive )
-        {
-        RDebug::Print( KMemSpyKeepaliveMessage );
-        // RAM drive
-        CreateSeedItemRamDriveL( *chunks );        
-        }
-
-#ifdef SYSMEMTRACKERLOGGING
-    {
-    const TInt chunkCount = chunks->Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
-        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER RAMD - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
-        }
-    }
-#endif
-
-//    TODO: Uncomment after fix
-//    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks )
-//        {
-//        RDebug::Print( KMemSpyKeepaliveMessage );
-//        // Stacks ($DAT)
-//        CreateSeedItemsStacksL( *chunks );        
-//        }
-
-#ifdef SYSMEMTRACKERLOGGING
-     {
-   const TInt chunkCount = chunks->Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
-        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER STACKS - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
-        }
-    }
-#endif
-
-//  TODO: Uncomment after fix
-//    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData )
-//        {
-//        RDebug::Print( KMemSpyKeepaliveMessage );
-//        // Global data (DLL$DATA)
-//        CreateSeedItemsGlobalDataL( *chunks );        
-//        }
-
- #ifdef SYSMEMTRACKERLOGGING
-    {
-    const TInt chunkCount = chunks->Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
-        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER GLOBAL DATA - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
-        }
-    }
-#endif
-
-    // Don't need the chunks anymore
-    CleanupStack::PopAndDestroy( chunks );
-
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode )
-        {
-        RDebug::Print( KMemSpyKeepaliveMessage );
-        // Code
-        CreateSeedItemsCodeL();        
-        }
-
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles )
-        {
-        // Handles
-        RDebug::Print( KMemSpyKeepaliveMessage);
-        CreateSeedItemsHandlesL();        
-        }
-
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles )
-        {
-        RDebug::Print( KMemSpyKeepaliveMessage );
-        // Open files
-        CreateSeedItemsOpenFilesL();        
-        }
-
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage )
-        {
-        RDebug::Print( KMemSpyKeepaliveMessage );
-        // Disk space
-        CreateSeedItemsDiskSpaceL();        
-        }
-
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory )
-        {
-        RDebug::Print( KMemSpyKeepaliveMessage );
-        // System memory
-        CreateSeedItemsSystemMemoryL();        
-        }
-	
-    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups )
-        {
-        RDebug::Print( KMemSpyKeepaliveMessage );
-        // Window Server
-        CreateSeedItemsWindowServerL();        
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL( CMemSpyEngineChunkList& aList )
-    {
-    CMemSpyEngine& engine = Engine();
-    const TInt procCount = engine.Container().Count();
-    for(TInt i=0; i<procCount; i++)
-        {
-        if ( !( i % 10 ) ) // Print the message on only every 10th cycle
-            {
-            RDebug::Print( KMemSpyKeepaliveMessage  );
-            }
-        CMemSpyProcess& process = engine.Container().At( i );
-        TRAP_IGNORE( CreateSeedItemsHeapUserL( process, &aList ) );
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL( CMemSpyProcess& aProcess, CMemSpyEngineChunkList* aList )
-    {
-    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL() - START - aProcess: %d", (TUint) aProcess.Id() ) );
-    
-    CMemSpyEngine& engine = Engine();
-    engine.ProcessSuspendLC( aProcess.Id() );
-
-    const TInt threadCount = aProcess.Count();
-    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL() - threadCount: %d", threadCount ) );
-
-    for( TInt j=0; j<threadCount; j++ )
-        {
-        CMemSpyThread& thread = aProcess.At( j );
-        //
-        if  ( !thread.IsDead() )
-            {
-            TRAP_IGNORE( CreateSeedItemsHeapUserL( thread, aList ) );
-            }
-        }
-    
-    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-
-    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL() - END" ) );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL( CMemSpyThread& aThread, CMemSpyEngineChunkList* aList )
-    {
-    TBool exists = FindByThreadId( aThread.Id() ) != KErrNotFound;
-    //
-    if  ( !exists )
-        {
-        CMemSpyEngineHelperSysMemTrackerEntryHeap* entry = CMemSpyEngineHelperSysMemTrackerEntryHeap::NewUserLC( iTracker, aThread );
-
-        // Check if chunk already logged
-        TInt entryIndex = FindByHandle( entry->Handle(), EMemSpyEngineSysMemTrackerTypeHeapUser ); 
-        exists =  entryIndex != KErrNotFound;
-        SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL() - heapChunkHandle: 0x%08x, already exists: %d", entry->Handle(), exists ) );
-        if ( exists )
-            {
-            CMemSpyEngineHelperSysMemTrackerEntryHeap& sharedheapEntry = static_cast< CMemSpyEngineHelperSysMemTrackerEntryHeap& >( *iEntries[ entryIndex ] );
-            sharedheapEntry.SetAsShared( ETrue );
-            }
-
-        // Remove utilised entries
-        if  ( aList )
-            {
-            aList->RemoveByHandle( (TAny*) entry->Handle() );
-            }
-
-        // Save
-        if  ( !exists )
-            {
-            AddItemAndPopL( entry );
-            }
-        else
-            {
-            CleanupStack::PopAndDestroy( entry );
-            }
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapKernelL( CMemSpyEngineChunkList& aList )
-    {
-    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapKernelL() - START" ) );
-
-    CMemSpyEngine& engine = Engine();
-    CMemSpyEngineHelperSysMemTrackerEntryHeap* entry = CMemSpyEngineHelperSysMemTrackerEntryHeap::NewKernelLC( iTracker );
-    AddItemAndPopL( entry );
-
-    // Remove utilised entries
-    aList.RemoveByHandle( (TAny*) entry->Handle() );
-
-    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapKernelL() - END" ) );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkLocalL( CMemSpyEngineChunkList& aList )
-    {
-    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkL() - START" ) );
-
-    const TInt chunkCount = aList.Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = aList.At( i ).Info();
-        SYSMEMTRACKERLOG_PRINTF( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkLocalL() - info[%03d]: type: %d, pid: 0x%04x, size: %d, name: %S"), i, info.iType, info.iOwnerId, info.iSize, &info.iName ) );
-        //
-        if  ( info.iType == EMemSpyDriverChunkTypeLocal )
-            {
-            // Try to find corresponding process
-            const TInt processIndex = Engine().Container().ProcessIndexById( info.iOwnerId );
-            SYSMEMTRACKERLOG_PRINTF( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkLocalL() - processIndex: %d"), processIndex ) );
-            //
-            if  ( processIndex >= 0 )
-                {
-                CMemSpyProcess& process = Engine().Container().At( processIndex );
-                //
-                TRAP_IGNORE(
-                    CMemSpyEngineHelperSysMemTrackerEntryChunk* entry = CMemSpyEngineHelperSysMemTrackerEntryChunk::NewLC( iTracker, info, process );
-                    AddItemAndPopL( entry );
-                    );
-                //
-                aList.Remove( i );
-                }
-            }
-        }
-
-    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkL() - END" ) );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkGlobalL( CMemSpyEngineChunkList& aList )
-    {
-    const TInt chunkCount = aList.Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = aList.At( i ).Info();
-        if  ( info.iType == EMemSpyDriverChunkTypeGlobal )
-            {
-            if  ( CMemSpyEngineHelperFbServ::IsSharedBitmapChunk( info ) || CMemSpyEngineHelperFbServ::IsLargeBitmapChunk( info ) )
-                {
-                // Don't process these two yet, they'll be handled by the bitmap code
-                }
-            else
-                {
-                TRAP_IGNORE(
-                    CMemSpyEngineHelperSysMemTrackerEntryChunk* entry = CMemSpyEngineHelperSysMemTrackerEntryChunk::NewLC( iTracker, info );
-                    AddItemAndPopL( entry );
-                    );
-
-                // Remove processed item
-                aList.Remove( i );
-                }
-            }
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemRamDriveL( CMemSpyEngineChunkList& aList )
-    {
-    const TInt chunkCount = aList.Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = aList.At( i ).Info();
-        if  ( info.iType == EMemSpyDriverChunkTypeRamDrive )
-            {
-            TRAP_IGNORE(
-                CMemSpyEngineHelperSysMemTrackerEntryRamDrive* entry = CMemSpyEngineHelperSysMemTrackerEntryRamDrive::NewLC( iTracker, info );
-                AddItemAndPopL( entry );
-                );
-
-            // Remove processed item
-            aList.Remove( i );
-            }
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsStacksL( CMemSpyEngineChunkList& aList )
-    {
-    CMemSpyEngine& engine = Engine();
-    CMemSpyEngineObjectContainer& container = engine.Container();
-    //
-    const TInt procCount = container.Count();
-    for( TInt p=0; p<procCount; p++ )
-        {
-        CMemSpyProcess& process = container.At( p );
-
-        // We've now sized the user-mode stacks for the process.
-        // Try to locate the stack/data chunk
-        const TInt index = aList.ItemIndexByProcessId( process.Id(), EMemSpyDriverChunkTypeStackAndProcessGlobalData );
-        if  ( index >= 0 )
-            {
-            const TMemSpyDriverChunkInfo& stackChunkInfo = aList.At( index ).Info();
-            //
-            const TInt threadCount = process.Count();
-            for( TInt t=0; t<threadCount; t++ )
-                {
-                CMemSpyThread& thread = process.At( t );
-                //
-                if  ( !thread.IsDead() )
-                    {
-                    TRAP_IGNORE( CreateSeedItemsStacksL( thread, stackChunkInfo ) );
-                    }
-                }
-            }
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsStacksL( CMemSpyThread& aThread, const TMemSpyDriverChunkInfo& aStackChunkInfo )
-    {
-    RThread rThread;
-    if  ( aThread.Open( rThread ) == KErrNone )
-        {
-        CleanupClosePushL( rThread );
-
-        TThreadStackInfo stackInfo;
-        if  ( rThread.StackInfo( stackInfo ) == KErrNone )
-            {
-            CMemSpyEngineHelperSysMemTrackerEntryStack* entry = CMemSpyEngineHelperSysMemTrackerEntryStack::NewLC( iTracker, aThread, aStackChunkInfo, stackInfo );
-            AddItemAndPopL( entry );
-            }
-
-        CleanupStack::PopAndDestroy( &rThread );
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsGlobalDataL( CMemSpyEngineChunkList& aList )
-    {
-    CMemSpyEngine& engine = Engine();
-    CMemSpyEngineObjectContainer& container = engine.Container();
-    //
-    const TInt chunkCount = aList.Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = aList.At( i ).Info();
-
-        if  ( info.iType == EMemSpyDriverChunkTypeGlobalData || info.iType == EMemSpyDriverChunkTypeStackAndProcessGlobalData )
-            {
-            // Need to get associated process
-            const TInt processIndex = container.ProcessIndexById( info.iOwnerId );
-            if  ( processIndex >= 0 )
-                {
-                CMemSpyProcess& process = container.At( processIndex );
-                //
-                if  ( info.iType == EMemSpyDriverChunkTypeGlobalData )
-                    {
-                    if ( !( i % 10 ) ) // Print the message on only every 10th cycle
-                        {
-                        RDebug::Print( KMemSpyKeepaliveMessage  );
-                        }
-                    // Pure global data, unique chunk
-                    TRAP_IGNORE( 
-                        CMemSpyEngineHelperSysMemTrackerGlobalData* entry = CMemSpyEngineHelperSysMemTrackerGlobalData::NewLC( iTracker, process, info );
-                        AddItemAndPopL( entry );
-                        );
-
-                    // Remove processed item
-                    aList.Remove( i );
-                    }
-                else if ( info.iType == EMemSpyDriverChunkTypeStackAndProcessGlobalData )
-                    {
-                    if ( !( i % 10 ) ) // Print the message on only every 10th cycle
-                        {
-                        RDebug::Print( KMemSpyKeepaliveMessage  );
-                        }
-                    // We don't check uniqueness as any stack entries share a common handle with the process
-                    // global data.
-                    TRAP_IGNORE( 
-                        CMemSpyEngineHelperSysMemTrackerGlobalData* entry = CMemSpyEngineHelperSysMemTrackerGlobalData::NewLC( iTracker, process, info );
-                        AddItemAndPopL( entry );
-                        );
-
-                    // Remove processed item
-                    aList.Remove( i );
-                    }
-                }
-            }
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsCodeL()
-    {
-    CMemSpyEngineCodeSegList* code = Engine().HelperCodeSegment().CodeSegmentListRamLoadedL();
-    CleanupStack::PushL( code );
-    //
-    const TInt count = code->Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineCodeSegEntry& info = code->At( i );
-        //
-        TRAP_IGNORE( 
-            CMemSpyEngineHelperSysMemTrackerEntryCode* entry = CMemSpyEngineHelperSysMemTrackerEntryCode::NewLC( iTracker, info );
-            AddItemAndPopL( entry );
-            );
-        }
-    //
-    CleanupStack::PopAndDestroy( code );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHandlesL()
-    {
-    CMemSpyEngineGenericKernelObjectContainer* allContainers = Engine().HelperKernelContainers().ObjectsAllLightweightL();
-    CleanupStack::PushL( allContainers );
-    //
-    const TInt count = allContainers->Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineGenericKernelObjectList& list = allContainers->At( i );
-        //
-        const TInt entryCount = list.Count();
-        for( TInt j=0; j<entryCount; j++ )
-            {
-            TAny* handle = list.HandleAt( j );
-            CMemSpyEngineHelperSysMemTrackerEntry* entry = NULL;
-            //
-            TRAP_IGNORE( 
-                if  ( list.Type() == EMemSpyDriverContainerTypePropertyRef )
-                    {
-                    entry = CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::NewLC( iTracker, handle );
-                    }
-                else
-                    {
-                    entry = CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::NewLC( iTracker, handle, list.Type() );
-                    }
-
-                AddItemAndPopL( entry );
-                );
-            }
-        }
-    //
-    CleanupStack::PopAndDestroy( allContainers );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsOpenFilesL()
-    {
-    CMemSpyEngineOpenFileList* list = Engine().HelperFileSystem().ListOpenFilesLC();
-    //
-    const TInt threadCount = list->Count();
-    for( TInt t=0; t<threadCount; t++ )
-        {
-        const CMemSpyEngineOpenFileListForThread& thread = list->At( t );
-        //
-        const TInt entryCount = thread.Count();
-        for( TInt e=0; e<entryCount; e++ )
-            {
-            const CMemSpyEngineOpenFileListEntry& fileEntry = thread.At( e );
-            //
-            TRAP_IGNORE( 
-                CMemSpyEngineHelperSysMemTrackerEntryOpenFile* entry = CMemSpyEngineHelperSysMemTrackerEntryOpenFile::NewLC( iTracker, thread, fileEntry );
-                AddItemAndPopL( entry );
-                );
-            }
-        }
-    //
-    CleanupStack::PopAndDestroy( list );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsDiskSpaceL()
-    {
-    TDriveList list;
-    //
-    RFs& fsSession = Engine().FsSession();
-    if  ( fsSession.DriveList( list ) == KErrNone )
-        {
-        TDriveInfo info;
-        //
-        for( TInt i=0; i<KMaxDrives; i++ )
-            {
-            if  ( list[ i ] != KDriveAbsent )
-                {
-                if  ( fsSession.Drive( info, i ) == KErrNone )
-                    {
-                    TRAP_IGNORE( 
-                        CMemSpyEngineHelperSysMemTrackerEntryDiskSpace* entry = CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::NewLC( iTracker, static_cast<TDriveNumber>( i ) );
-                        AddItemAndPopL( entry );
-                        );
-                    }
-                }
-            }
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsSystemMemoryL()
-    {
-    TRAP_IGNORE( 
-        CMemSpyEngineHelperSysMemTrackerEntrySystemMemory* entryT = CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::NewLC( iTracker, ETypeTotal );
-        AddItemAndPopL( entryT );
-        );
-    TRAP_IGNORE( 
-        CMemSpyEngineHelperSysMemTrackerEntrySystemMemory* entryF = CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::NewLC( iTracker, ETypeFree );
-        AddItemAndPopL( entryF );
-        );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsBitmapL( CMemSpyEngineChunkList& aList )
-    {
-    TInt bitmapConCount = 0;
-    TInt fontConCount = 0;
-    //
-    RArray<TInt> handles;
-    CleanupClosePushL( handles );
-    Engine().HelperFbServ().GetArrayOfBitmapHandlesL( handles, bitmapConCount, fontConCount );
-    //
-    const TInt count = handles.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const TInt handle = handles[ i ];
-        //
-        TRAP_IGNORE( 
-            CMemSpyEngineHelperSysMemTrackerEntryBitmap* entry = CMemSpyEngineHelperSysMemTrackerEntryBitmap::NewLC( iTracker, handle );
-            AddItemAndPopL( entry );
-            );
-        }
-    //
-    CleanupStack::PopAndDestroy( &handles );
-    
-    // Make overall fbserv info item
-    TMemSpyDriverChunkInfo infoChunkLarge;
-    TMemSpyDriverChunkInfo infoChunkShared;
-    //
-    const TInt chunkCount = aList.Count();
-    for( TInt i=chunkCount-1; i>=0; i-- )
-        {
-        const TMemSpyDriverChunkInfo& info = aList.At( i ).Info();
-        if  ( CMemSpyEngineHelperFbServ::IsSharedBitmapChunk( info ) )
-            {
-            SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsBitmapL() - found FbsSharedChunk..." ) );
-            infoChunkShared = info;
-            aList.Remove( i );
-            }
-        else if ( CMemSpyEngineHelperFbServ::IsLargeBitmapChunk( info ) )
-            {
-            SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsBitmapL() - found FbsLargeChunk..." ) );
-            infoChunkLarge = info;
-            aList.Remove( i );
-            }
-        }
-
-    TRAP_IGNORE( 
-        CMemSpyEngineHelperSysMemTrackerEntryFbserv* entry = CMemSpyEngineHelperSysMemTrackerEntryFbserv::NewLC( iTracker, infoChunkLarge, infoChunkShared, bitmapConCount, fontConCount, count );
-        AddItemAndPopL( entry );
-        );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsFileServerCacheL( CMemSpyEngineChunkList& aList )
-    {
-    TInt index = KErrNotFound;
-    const CMemSpyEngineChunkEntry* entry = Engine().HelperFileSystem().IdentifyCacheChunk( aList, index );
-    //
-    if  ( entry )
-        {
-        const TMemSpyDriverChunkInfo& info = entry->Info();
-        SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsFileServerCacheL() - found F32 cache chunk..." ) );
-        //
-        TRAP_IGNORE( 
-            CMemSpyEngineHelperSysMemTrackerEntryFileServerCache* entry = CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::NewLC( iTracker, info );
-            AddItemAndPopL( entry );
-        );
-        //
-        aList.Remove( index );
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsWindowServerL()
-    {
-    if ( Engine().IsHelperWindowServerSupported() )
-        {
-        MMemSpyEngineHelperWindowServer& windowServerManager = Engine().HelperWindowServer();
-        MMemSpyEngineWindowGroupList* windowGroupList = windowServerManager.WindowGroupListL();
-        CleanupDeletePushL( windowGroupList );
-        TInt count = windowGroupList->Count();
-        TBool isFocused( EFalse );
-        for ( TInt i = 0; i < count; i++ )
-            {
-            TMemSpyEngineWindowGroupDetails windowGroupDetails;
-            windowServerManager.GetWindowGroupDetailsL( windowGroupList->At( i ).iId, windowGroupDetails );
-            windowGroupDetails.iOrdinalPosition = windowGroupList->At( i ).iOrdinalPosition;
-            if ( !isFocused && windowGroupDetails.iPriority == 0 )
-                {
-                windowGroupDetails.iIsFocused = ETrue;
-                isFocused = ETrue;
-                }
-            else
-                {
-                windowGroupDetails.iIsFocused = EFalse;
-                }
-            TRAP_IGNORE( 
-                CMemSpyEngineHelperSysMemTrackerEntryWindowServer* entry = CMemSpyEngineHelperSysMemTrackerEntryWindowServer::NewLC( iTracker, windowGroupDetails );
-                AddItemAndPopL( entry );
-                );
-            }
-        CleanupStack::PopAndDestroy( windowGroupList );
-        }
-    else
-        {
-        SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsWindowServerL() - Not supported" ) );
-        }
-    }
-
-
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryOpenFile.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +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 "MemSpyEngineHelperSysMemTrackerEntryOpenFile.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperfilesystem.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-CMemSpyEngineHelperSysMemTrackerEntryOpenFile::CMemSpyEngineHelperSysMemTrackerEntryOpenFile( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeOpenFile )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryOpenFile::~CMemSpyEngineHelperSysMemTrackerEntryOpenFile()
-    {
-    delete iFileName;
-    delete iThreadName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryOpenFile::ConstructL( const CMemSpyEngineOpenFileListForThread& aThreadInfo, const CMemSpyEngineOpenFileListEntry& aEntryInfo )
-    {
-    // Get basic details
-    iThreadName = aThreadInfo.ThreadName().AllocL();
-    SetThread( aThreadInfo.ThreadId() );
-    SetProcess( aThreadInfo.ProcessId() );
-
-    // Set file details
-    iFileName = aEntryInfo.FileName().AllocL();
-    iSize = aEntryInfo.Size();
-    iUniqueFileId = aEntryInfo.UniqueFileId();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryOpenFile* CMemSpyEngineHelperSysMemTrackerEntryOpenFile::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const CMemSpyEngineOpenFileListForThread& aThreadInfo, const CMemSpyEngineOpenFileListEntry& aEntryInfo )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryOpenFile* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryOpenFile( aTracker );
-    CleanupStack::PushL( self );
-    self->ConstructL( aThreadInfo, aEntryInfo );
-    return self;
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntryOpenFile::Key() const
-    {
-    const TUint32 val = ( Type() << 28 ) + ( iUniqueFileId < 24 ) + ThreadId(); 
-    TUint64 ret = val;
-    ret <<= 32;
-    //
-    const TUint32 fileNameHash = MemSpyEngineUtils::Hash( *iFileName );
-    ret += fileNameHash;
-    //
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryOpenFile::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::NewLC( Attributes(), *iThreadName, *iFileName, iSize, iUniqueFileId );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryOpenFile::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    // Doesn't participate in direct memory usage and indirect usage cannot really be measured.
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile( TUint8 aAttribs, TInt aSize, TInt aUniqueFileId )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iSize( aSize ), iUniqueFileId( aUniqueFileId )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::~CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile()
-    {
-    delete iFileName;
-    delete iThreadName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::ConstructL( const TDesC& aThreadName, const TDesC& aFileName )
-    {
-    BaseConstructL();
-
-    // Save the thread name
-    iFileName = aFileName.AllocL();
-    iThreadName = aThreadName.AllocL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile* CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TDesC& aFileName, TInt aSize, TInt aUniqueFileId )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile( aAttribs, aSize, aUniqueFileId );
-    CleanupStack::PushL( self );
-    self->ConstructL( aThreadName, aFileName );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeOpenFile;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderLine, "Type, File Name, Thread, File Size, Instance Id, Attribs");
-    aSink.OutputLineL( KHeaderLine );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,%S,%d,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf( buf->Des() );
-
-    // Now output line
-    pBuf.Format( KFormat,
-                 &type,
-                 iFileName,
-                 iThreadName,
-                 iSize,
-                 iUniqueFileId,
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::OutputDataL( CMemSpyEngineOutputSink& /*aSink*/, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    }
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryRamDrive.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +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 "MemSpyEngineHelperSysMemTrackerEntryRamDrive.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntryRamDrive::CMemSpyEngineHelperSysMemTrackerEntryRamDrive( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeRamDrive )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryRamDrive::~CMemSpyEngineHelperSysMemTrackerEntryRamDrive()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::ConstructL( const TMemSpyDriverChunkInfo& aInfo )
-    {
-    iCurrent = aInfo;
-    iLast = aInfo;
-    //
-    SetHandle( aInfo.iHandle );
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryRamDrive* CMemSpyEngineHelperSysMemTrackerEntryRamDrive::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryRamDrive* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryRamDrive( aTracker );
-    CleanupStack::PushL( self );
-    self->ConstructL( aInfo );
-    return self;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
-    {
-    const CMemSpyEngineHelperSysMemTrackerEntryRamDrive& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryRamDrive& >( aEntry );
-    
-    // Update state
-    iLast = iCurrent;
-    iCurrent = entry.iCurrent;
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntryRamDrive::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
-    {
-    const TBool hasChanged = ( iCurrent.iSize != iLast.iSize );
-    return hasChanged;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::NewLC( Attributes(), iCurrent, IsNew() ? NULL : &iLast );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    aCycle.AddToMemoryUsed( iCurrent.iSize );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::~CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive()
-    {
-    delete iLast;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::ConstructL( const TMemSpyDriverChunkInfo* aLast )
-    {
-    BaseConstructL();
-
-    // Save last heap data (if available)
-    if ( aLast )
-        {
-        iLast = new (ELeave) TMemSpyDriverChunkInfo();
-        *iLast = *aLast;
-        }
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent, const TMemSpyDriverChunkInfo* aLast )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive( aAttribs, aCurrent );
-    CleanupStack::PushL( self );
-    self->ConstructL( aLast );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeRamDrive;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderRamDrive, "Type, Chunk, Handle, Base Addr, Size, Max Size, Attribs");
-    aSink.OutputLineL( KHeaderRamDrive );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,0x%08x,0x%08x,%d,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-
-    // Now output line
-    pBuf.Format( KFormat, 
-                 &type,
-                 &iCurrent.iName,
-                 iCurrent.iHandle,
-                 iCurrent.iBaseAddress,
-                 iCurrent.iSize,
-                 iCurrent.iMaxSize,
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryStack.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,229 +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 "MemSpyEngineHelperSysMemTrackerEntryStack.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-CMemSpyEngineHelperSysMemTrackerEntryStack::CMemSpyEngineHelperSysMemTrackerEntryStack( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeStack ), iChunkInfo( aChunkInfo ), iStackInfo( aStackInfo )
-    {
-    SetHandle( aChunkInfo.iHandle );
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryStack::~CMemSpyEngineHelperSysMemTrackerEntryStack()
-    {
-    delete iThreadName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryStack::ConstructL( CMemSpyThread& aThread )
-    {
-    TFullName* name = new(ELeave) TFullName();
-    CleanupStack::PushL( name );
-    aThread.FullName( *name );
-    iThreadName = name->AllocL();
-    CleanupStack::PopAndDestroy( name );
-    //
-    SetThread( aThread.Id() );
-    SetProcess( aThread.Process().Id() );
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryStack* CMemSpyEngineHelperSysMemTrackerEntryStack::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyThread& aThread, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryStack* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryStack( aTracker, aChunkInfo, aStackInfo );
-    CleanupStack::PushL( self );
-    self->ConstructL( aThread );
-    return self;
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntryStack::Key() const
-    {
-    const TUint32 val = ( Type() << 28 ) + ThreadId(); 
-    TUint64 ret = val;
-    ret <<= 32;
-    ret += Handle();
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryStack::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeStack* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeStack::NewLC( Attributes(), *iThreadName, iChunkInfo, iStackInfo );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryStack::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    const TInt size = StackSize();
-    aCycle.AddToMemoryUsed( size );
-    }
-
-
-TInt CMemSpyEngineHelperSysMemTrackerEntryStack::StackSize() const
-    {
-    const TInt size = iStackInfo.iBase - iStackInfo.iLimit;
-    return size;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeStack::CMemSpyEngineHelperSysMemTrackerCycleChangeStack( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iChunkInfo( aChunkInfo ), iStackInfo( aStackInfo )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeStack::~CMemSpyEngineHelperSysMemTrackerCycleChangeStack()
-    {
-    delete iThreadName;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeStack::ConstructL( const TDesC& aThreadName )
-    {
-    BaseConstructL();
-
-    // Save the thread name
-    iThreadName = aThreadName.AllocL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeStack* CMemSpyEngineHelperSysMemTrackerCycleChangeStack::NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeStack* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeStack( aAttribs, aChunkInfo, aStackInfo );
-    CleanupStack::PushL( self );
-    self->ConstructL( aThreadName );
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeStack::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeStack;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeStack::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderStack, "Type, Thread, Chunk, Handle, Size, Attribs");
-    aSink.OutputLineL( KHeaderStack );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeStack::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,%S,0x%08x,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-
-    pBuf.Format( KFormat, 
-                 &type,
-                 iThreadName, 
-                 &iChunkInfo.iName,
-                 iChunkInfo.iHandle,
-                 StackSize(),
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeStack::OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    CMemSpyEngine& engine = aSink.Engine();
-    }
-
-
-TInt CMemSpyEngineHelperSysMemTrackerCycleChangeStack::StackSize() const
-    {
-    const TInt size = iStackInfo.iBase - iStackInfo.iLimit;
-    return size;
-    }
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntrySystemMemory.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +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 "MemSpyEngineHelperSysMemTrackerEntrySystemMemory.h"
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-#include <hal.h>
-#include <hal_data.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include "MemSpyEngineHelperSysMemTrackerImp.h"
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::CMemSpyEngineHelperSysMemTrackerEntrySystemMemory( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TSystemMemoryType aType )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeSystemMemory ), iType( aType )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::~CMemSpyEngineHelperSysMemTrackerEntrySystemMemory()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::ConstructL()
-    {
-    if ( iType == ETypeFree )
-        {
-        HAL::Get( HALData::EMemoryRAMFree, iCurrent );
-        }
-    else if ( iType == ETypeTotal )
-        {
-        HAL::Get( HALData::EMemoryRAM, iCurrent );
-        }
-    //
-    iLast = iCurrent;
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntrySystemMemory* CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TSystemMemoryType aType )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntrySystemMemory* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntrySystemMemory( aTracker, aType );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::Key() const
-    {
-    const TUint32 val = ( Type() << 28 ); 
-    TUint64 ret = val;
-    ret <<= 32;
-    ret += static_cast<TInt>( iType );
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
-    {
-    const CMemSpyEngineHelperSysMemTrackerEntrySystemMemory& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntrySystemMemory& >( aEntry );
-    
-    // Update state
-    iLast = iCurrent;
-    iCurrent = entry.iCurrent;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::NewLC( Attributes(), iType, iCurrent, iLast );
-    aCycle.AddAndPopL( changeDescriptor );
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
-    {
-    const TBool hasChanged = ( iCurrent != iLast );
-    return hasChanged;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory( TUint8 aAttribs, TSystemMemoryType aType, TInt aCurrent, TInt aLast )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iType( aType ), iCurrent( aCurrent ), iLast( aLast )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::~CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::ConstructL()
-    {
-    BaseConstructL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory* CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::NewLC( TUint8 aAttribs, TSystemMemoryType aType, TInt aCurrent, TInt aLast )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory( aAttribs, aType, aCurrent, aLast );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeSystemMemory;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderSystemMemory, "Type, Name, Size, Attribs");
-    aSink.OutputLineL( KHeaderSystemMemory );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%S,%d,%S" );
-    //
-    TMemSpySWMTTypeName category;
-    FormatType( category );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    _LIT( KTypeSystemMemoryFree, "Free" );
-    _LIT( KTypeSystemMemoryTotal, "Total" );
-    TBuf<20> type( KTypeSystemMemoryFree );
-    if ( iType == ETypeTotal )
-        {
-        type = KTypeSystemMemoryTotal;
-        }
-    //
-    aSink.OutputLineFormattedL( KFormat, &category, &type, iCurrent, &attribs );
-    }
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryWindowServer.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +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 "MemSpyEngineHelperSysMemTrackerEntryWindowServer.h"
-
-// User includes
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerEntryWindowServer::CMemSpyEngineHelperSysMemTrackerEntryWindowServer( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyEngineWindowGroupDetails& aWindowGroupDetails )
-:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeFbserv ), 
-    iCurrentWindowGroupDetails( aWindowGroupDetails ),
-    iLastWindowGroupDetails( aWindowGroupDetails )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryWindowServer::~CMemSpyEngineHelperSysMemTrackerEntryWindowServer()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryWindowServer::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerEntryWindowServer* CMemSpyEngineHelperSysMemTrackerEntryWindowServer::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyEngineWindowGroupDetails& aWindowGroupDetails )
-    {
-    CMemSpyEngineHelperSysMemTrackerEntryWindowServer* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryWindowServer( aTracker, aWindowGroupDetails );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-TUint64 CMemSpyEngineHelperSysMemTrackerEntryWindowServer::Key() const
-    {
-    return TUint64( iCurrentWindowGroupDetails.iId );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryWindowServer::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
-    {
-    const CMemSpyEngineHelperSysMemTrackerEntryWindowServer& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryWindowServer& >( aEntry );
-    iLastWindowGroupDetails = iCurrentWindowGroupDetails;
-    iCurrentWindowGroupDetails = entry.iCurrentWindowGroupDetails;
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerEntryWindowServer::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
-    {
-    const TBool hasChanged = ( iCurrentWindowGroupDetails.iIsFocused != iLastWindowGroupDetails.iIsFocused ) ||
-                             ( iCurrentWindowGroupDetails.iCaption != iLastWindowGroupDetails.iCaption )
-                             ;
-    return hasChanged;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryWindowServer::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::TMemSpyWindowServerEvent event( CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::EMemSpyWindowServerEventNoEvent );
-    if ( iCurrentWindowGroupDetails.iCaption != iLastWindowGroupDetails.iCaption )
-        {
-        event = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::EMemSpyWindowServerEventNameChanged;
-        CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::NewLC( Attributes(), iCurrentWindowGroupDetails, event );
-        aCycle.AddAndPopL( changeDescriptor );
-        }
-    if ( iCurrentWindowGroupDetails.iIsFocused && !iLastWindowGroupDetails.iIsFocused )
-        {
-        event = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::EMemSpyWindowServerEventFocusGained;
-        CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::NewLC( Attributes(), iCurrentWindowGroupDetails, event );
-        aCycle.AddAndPopL( changeDescriptor );
-        }
-    if ( !iCurrentWindowGroupDetails.iIsFocused && iLastWindowGroupDetails.iIsFocused )
-        {
-        event = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::EMemSpyWindowServerEventFocusLost;
-        CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::NewLC( Attributes(), iCurrentWindowGroupDetails, event );
-        aCycle.AddAndPopL( changeDescriptor );
-        }
-    if ( event == CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::EMemSpyWindowServerEventNoEvent )
-        {
-        // If there were no events detected, it was a creation or deletion of a window group:
-        CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::NewLC( Attributes(), iCurrentWindowGroupDetails );
-        aCycle.AddAndPopL( changeDescriptor );        
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerEntryWindowServer::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup( TUint8 aAttribs, const TMemSpyEngineWindowGroupDetails aCurrent, TMemSpyWindowServerEvent aEvent )
-:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ),
-    iCurrentWindowGroupDetails( aCurrent ),
-    iEvent( aEvent )
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::~CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::ConstructL()
-    {
-    BaseConstructL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::NewLC( TUint8 aAttribs, const TMemSpyEngineWindowGroupDetails aCurrent, TMemSpyWindowServerEvent aEvent )
-    {
-    CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup( aAttribs, aCurrent, aEvent );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::Type() const
-    {
-    return EMemSpyEngineSysMemTrackerTypeWindowServer;
-    }
-   
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KHeaderWindowServer, "Type, Id, Name, Order, Event, Attribs");
-    aSink.OutputLineL( KHeaderWindowServer );
-    }
- 
-
-void CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    _LIT( KFormat, "%S,%d,%S,%d,%d,%S" );
-    //
-    TMemSpySWMTTypeName type;;
-    FormatType( type );
-    //
-    TBuf<20> attribs;
-    FormatAttributes( attribs );
-    //
-    TFullName name;
-    if ( iCurrentWindowGroupDetails.iCaption.Length() )
-        {
-        name.Copy( iCurrentWindowGroupDetails.iCaption );
-        }
-    else
-        {
-        name.Copy( iCurrentWindowGroupDetails.iFullName );
-        }
-
-    HBufC* buf = HBufC::NewLC( 1024 );
-    TPtr pBuf(buf->Des());
-    
-    // Now output line
-    pBuf.Format( KFormat, 
-                 &type,
-                 //
-                 iCurrentWindowGroupDetails.iId,
-                 &name,
-                 iCurrentWindowGroupDetails.iOrdinalPosition, 
-                 iEvent,
-                 &attribs
-                 );
-
-    aSink.OutputLineL( pBuf );
-    CleanupStack::PopAndDestroy( buf );
-    }
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerImp.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +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 "MemSpyEngineHelperSysMemTrackerImp.h"
-
-// System includes
-#include <e32debug.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerobserver.h>
-#include "MemSpyEngineHelperSysMemTrackerEntryManager.h"
-
-// Constants
-const TInt KMemSpyDefaultTrackerTimerPeriod = 30; // Seconds
-
-
-CMemSpyEngineHelperSysMemTrackerImp::CMemSpyEngineHelperSysMemTrackerImp( CMemSpyEngine& aEngine )
-:   CTimer( EPriorityStandard ), iEngine( aEngine )
-    {
-    CActiveScheduler::Add( this );
-    iConfig.iTimerPeriod = TTimeIntervalMicroSeconds32( KMemSpyDefaultTrackerTimerPeriod * 1000000 );
-    }
-
-    
-CMemSpyEngineHelperSysMemTrackerImp::~CMemSpyEngineHelperSysMemTrackerImp()
-    {
-    Cancel();
-    //
-    delete iEntryManager;
-    //
-    iCompletedCycles.ResetAndDestroy();
-    iCompletedCycles.Close();
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::ConstructL()
-    {
-    CTimer::ConstructL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerImp* CMemSpyEngineHelperSysMemTrackerImp::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperSysMemTrackerImp* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerImp( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::StartL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
-    {
-    TRACE( RDebug::Printf("CMemSpyEngineHelperSysMemTrackerImp::StartL() - START - timer period: %d", Config().TimerPeriod().Int() ) );
-
-    // Zap any old data
-    Reset();
-
-    // Cache client settings
-    iConfig = aConfig;
-
-    // Make new cycle
-    PrepareInitialCycleL();
-
-    // Start tracking via timer - future updates will by driven by RunL().
-    After( Config().TimerPeriod() );
-    TRACE( RDebug::Printf("CMemSpyEngineHelperSysMemTrackerImp::END() - START - timer period: %d", Config().TimerPeriod().Int() ) );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::StopL()
-    {
-    Cancel();
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::SetObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver )
-    {
-    iObserver = aObserver;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::RemoveObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver )
-    {
-    if  ( iObserver == aObserver )
-        {
-        iObserver = NULL;
-        }
-    }
-
-
-const RPointerArray< CMemSpyEngineHelperSysMemTrackerCycle >& CMemSpyEngineHelperSysMemTrackerImp::CompletedCycles() const
-    {
-    return iCompletedCycles;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::Reset()
-    {
-    Cancel();
-    iCompletedCycles.ResetAndDestroy();
-    //
-    if  ( iObserver )
-        {
-        TRAP_IGNORE( iObserver->HandleCyclesResetL() );
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::CheckForChangesNowL()
-    {
-    const TInt count = iCompletedCycles.Count();
-    TRACE( RDebug::Printf("CMemSpyEngineHelperSysMemTrackerImp::CheckForChangesNowL() - START - isActive: %d, cycleCount: %d", IsActive(), count ) );
-
-    if  ( IsActive() )
-        {
-        Cancel();
-        CheckForChangesL();
-        After( Config().TimerPeriod() );
-        }
-    else
-        {
-        // Timer not running, so we're probably being poked by some external-to-memspy client that
-        // wants to force an update.
-        //
-        // If we've never yet performed an initital cycle, then prep that. Otherwise, just proceed as normal
-        // as if we had been called back via RunL().
-        if  ( count == 0 )
-            {
-            PrepareInitialCycleL();
-            }
-        else
-            {
-            CheckForChangesL();
-            }
-        }
-
-    TRACE( RDebug::Printf("CMemSpyEngineHelperSysMemTrackerImp::CheckForChangesNowL() - END - isActive: %d, cycleCount: %d", IsActive(), iCompletedCycles.Count() ) );
-    }
-
-
-TInt CMemSpyEngineHelperSysMemTrackerImp::MdcaCount() const
-    {
-    return iCompletedCycles.Count();
-    }
-
-
-TPtrC CMemSpyEngineHelperSysMemTrackerImp::MdcaPoint( TInt aIndex ) const
-    {
-    const CMemSpyEngineHelperSysMemTrackerCycle* cycleInfo = iCompletedCycles[ aIndex ];
-    const TPtrC ret( cycleInfo->Caption() );
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::NotifyObserverCycleStartedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    if  ( iObserver )
-        {
-        TRAP_IGNORE( iObserver->HandleCycleStartedL( aCycle ) );
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::NotifyObserverCycleFinishedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    if  ( iObserver )
-        {
-        TRAP_IGNORE( iObserver->HandleCycleFinishedL( aCycle ) );
-        aCycle.DiscardChanges();
-        }
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::AddCycleAndPopL( CMemSpyEngineHelperSysMemTrackerCycle* aCycle )
-    {
-    iCompletedCycles.AppendL( aCycle );
-    CleanupStack::Pop( aCycle );
-    aCycle->FinalizeL();
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerCycle* CMemSpyEngineHelperSysMemTrackerImp::LastCycleOrNull()
-    {
-    CMemSpyEngineHelperSysMemTrackerCycle* ret = NULL;
-    //
-    const TInt count = iCompletedCycles.Count();
-    if  ( count )
-        {
-        ret = iCompletedCycles[ count - 1 ];
-        }
-    //
-    return ret;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::PrepareInitialCycleL()
-    {
-    // Create seed items
-    CMemSpyEngineHelperSysMemTrackerEntryManager* entryManager = CMemSpyEngineHelperSysMemTrackerEntryManager::NewL( *this );
-    delete iEntryManager;
-    iEntryManager = entryManager;
-
-    // Everything changes on the first cycle.
-    CMemSpyEngineHelperSysMemTrackerCycle* baselineCycle = CMemSpyEngineHelperSysMemTrackerCycle::NewLC( iConfig );
-    NotifyObserverCycleStartedL( *baselineCycle );
-    iEntryManager->EverythingHasChangedL( *baselineCycle );
-    AddCycleAndPopL( baselineCycle );
-    NotifyObserverCycleFinishedL( *baselineCycle );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::CheckForChangesL()
-    {
-    // Create info structure 
-    CMemSpyEngineHelperSysMemTrackerCycle* cycle = CMemSpyEngineHelperSysMemTrackerCycle::NewLC( iConfig, LastCycleOrNull() );
-
-    // Notify 
-    NotifyObserverCycleStartedL( *cycle );
-
-    // Find changes
-    iEntryManager->IdentifyChangesL( *cycle );
-
-    // Finalise the cycle and save it
-    AddCycleAndPopL( cycle );
-
-    // Notify
-    NotifyObserverCycleFinishedL( *cycle );
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerImp::RunL()
-    {
-    CheckForChangesL();
-    After( Config().TimerPeriod() );
-    }
-
-
-TInt CMemSpyEngineHelperSysMemTrackerImp::RunError( TInt aError )
-    {
-    RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerImp::RunError() - aError: %d", aError );
-    (void) aError;
-    //
-    Cancel();
-    After( Config().TimerPeriod() );
-    //
-    return KErrNone;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerOutputFormatter.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +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 "MemSpyEngineHelperSysMemTrackerOutputFormatter.h"
-
-// System includes
-#include <e32debug.h>
-
-// User includes
-#include "MemSpyEngineOutputListItem.h"
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyenginehelperrom.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
-
-// Constants
-_LIT( KMemSpyHeapDeltaTrackerFormatPrefix, "[MemSpy] [SMT %04d] " );
-_LIT( KMemSpyHeapDeltaTrackerFormatHeaderStart, "<SYSTEM WIDE MEMORY TRACKER>" );
-_LIT( KMemSpyHeapDeltaTrackerFormatFooterEnd, "</SYSTEM WIDE MEMORY TRACKER>" );
-const TInt KMemSpySWMTDataFileFormat = 2;
-
-
-CMemSpyEngineHelperSysMemTrackerOutputFormatter::CMemSpyEngineHelperSysMemTrackerOutputFormatter( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-    
-CMemSpyEngineHelperSysMemTrackerOutputFormatter::~CMemSpyEngineHelperSysMemTrackerOutputFormatter()
-    {
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerOutputFormatter::ConstructL()
-    {
-    }
-
-
-CMemSpyEngineHelperSysMemTrackerOutputFormatter* CMemSpyEngineHelperSysMemTrackerOutputFormatter::NewL( CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineHelperSysMemTrackerOutputFormatter* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerOutputFormatter( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerOutputFormatter::SetConfig( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
-    {
-    iConfig = aConfig;
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerOutputFormatter::OutputL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineOutputSink& sink = iEngine.Sink();
-    CMemSpyEngineHelperSysMemTrackerCycle& cycle = const_cast<CMemSpyEngineHelperSysMemTrackerCycle&>( aCycle );
-
-    // Set up prefix for info listing
-    sink.OutputPrefixSetFormattedLC( KMemSpyHeapDeltaTrackerFormatPrefix, aCycle.CycleNumber() );
-
-    // Begin a new data stream for heap info
-    _LIT( KMemSpyFolder1, "System Wide MT" );
-    _LIT( KMemSpyContext1, "Summary - Cycle %03d" );
-    HBufC* context1 = HBufC::NewLC( KMaxFileName );
-    TPtr pContext1( context1->Des() );
-    pContext1.Format( KMemSpyContext1, aCycle.CycleNumber() );
-    sink.DataStreamBeginL( pContext1, KMemSpyFolder1 );
-    CleanupStack::PopAndDestroy( context1 );
-
-    // Output overall header for cycle
-    OutputOverallHeaderL( cycle );
-
-    // Output the cycle information
-    TMemSpyEngineSysMemTrackerType lastType = EMemSpyEngineSysMemTrackerTypeCount;
-	const TInt changedCount = cycle.ChangeCount();
-	for( TInt j=0; j<changedCount; j++ )
-		{
-		CMemSpyEngineHelperSysMemTrackerCycleChange& item = cycle.ChangeAt( j );
-        const TMemSpyEngineSysMemTrackerType type = item.Type();
-
-        // Header (if needed)
-        if  ( HaveTypesChanged( type, lastType ) )
-            {
-            lastType = type;
-
-            CMemSpyEngineOutputSink& sink = iEngine.Sink();
-            sink.OutputBlankLineL();
-            sink.OutputBlankLineL();
-            item.OutputHeaderL( sink, cycle );
-            }
-        
-        // Content
-        TRAP_IGNORE( item.OutputContentL( sink, cycle ) );
-        }
-   
-    // Now dump the data for any changed entries
-    if  ( iConfig.DumpData() )
-        {
-		for( TInt j=0; j<changedCount; j++ )
-			{
-			CMemSpyEngineHelperSysMemTrackerCycleChange& item = cycle.ChangeAt( j );
-            TRAP_IGNORE( item.OutputDataL( sink, cycle ) );
-			}
-		}
-
-    // Output overall footer for cycle
-    OutputOverallFooterL( cycle );
-
-    // End summary data stream
-    sink.DataStreamEndL();
-		
-	CleanupStack::PopAndDestroy(); // prefix
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerOutputFormatter::OutputOverallHeaderL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
-    {
-    CMemSpyEngineOutputSink& sink = iEngine.Sink();
-    sink.OutputBlankLineL();
-    sink.OutputBlankLineL();
-    sink.OutputBlankLineL();
-    sink.OutputBlankLineL();
-    //
-    sink.OutputLineL( KMemSpyHeapDeltaTrackerFormatHeaderStart );
-    sink.OutputBlankLineL();
-
-    // Lines
-    CMemSpyEngineOutputList* list = CMemSpyEngineOutputList::NewLC( sink );
-    
-    _LIT( KLine0, "File format version" );
-    list->AddItemL( KLine0, KMemSpySWMTDataFileFormat );
-
-    _LIT( KLine1, "Cycle number" );
-    list->AddItemL( KLine1, aCycle.CycleNumber() );
-
-    _LIT( KLine2, "Time" );
-    list->AddItemL( KLine2, aCycle.TimeFormatted() );
-
-    _LIT( KLine3, "Change count" );
-    list->AddItemL( KLine3, aCycle.ChangeCount() );
-
-    _LIT( KLine4, "Free memory (now)" );
-    list->AddItemL( KLine4, aCycle.MemoryFree() );
-
-    _LIT( KLine5, "Free memory (previous)" );
-    list->AddItemL( KLine5, aCycle.MemoryFreePreviousCycle() );
-
-    _LIT( KLine6, "MemSpy (RAM)" );
-    list->AddItemL( KLine6, User::Heap().Size() );
-
-    // Add ROM info
-    iEngine.HelperROM().AddInfoL( *list );
-
-    list->PrintL();
-    CleanupStack::PopAndDestroy( list );
-
-    sink.OutputBlankLineL();
-    sink.OutputBlankLineL();
-    }
-
-
-void CMemSpyEngineHelperSysMemTrackerOutputFormatter::OutputOverallFooterL( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
-    {
-    CMemSpyEngineOutputSink& sink = iEngine.Sink();
-    //
-    sink.OutputBlankLineL();
-    sink.OutputBlankLineL();
-    sink.OutputLineL( KMemSpyHeapDeltaTrackerFormatFooterEnd );
-    sink.OutputBlankLineL();
-    sink.OutputBlankLineL();
-    }
-
-
-TBool CMemSpyEngineHelperSysMemTrackerOutputFormatter::HaveTypesChanged( TInt aLeft, TInt aRight )
-    {
-    TBool ret = ( aLeft != aRight );
-    //
-    if ( ret )
-        {
-        // Check whether heap types are kernel vs user. We silently ignore this change.
-        if ( ( aLeft == EMemSpyEngineSysMemTrackerTypeHeapUser && aRight == EMemSpyEngineSysMemTrackerTypeHeapKernel ) ||
-             ( aLeft == EMemSpyEngineSysMemTrackerTypeHeapKernel && aRight == EMemSpyEngineSysMemTrackerTypeHeapUser ) )
-            {
-            ret = EFalse;
-            }
-        }
-    //
-    return ret;
-    }
-
--- a/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObject.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +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 <memspy/engine/memspyengineobject.h>
-
-
-EXPORT_C CMemSpyEngineObject::CMemSpyEngineObject()
-    {
-    Open();
-    }
-
-
-EXPORT_C CMemSpyEngineObject::CMemSpyEngineObject( CMemSpyEngineObject& aParent )
-:   iParent( &aParent )
-    {
-    Open();
-    }
-
-
-CMemSpyEngineObject::~CMemSpyEngineObject()
-    {
-    }
-
-
-EXPORT_C TInt CMemSpyEngineObject::AccessCount() const
-    {
-    __ASSERT_ALWAYS( iAccessCount >= 0, User::Invariant() );
-    return iAccessCount;
-    }
-
-
-EXPORT_C void CMemSpyEngineObject::Close()
-    {
-    __ASSERT_ALWAYS( iAccessCount >= 0, User::Invariant() );
-    if  ( --iAccessCount <= 0 )
-        {
-        delete this;
-        }
-    }
-
-
-EXPORT_C void CMemSpyEngineObject::Open()
-    {
-    __ASSERT_ALWAYS( iAccessCount >= 0, User::Invariant() );
-    ++iAccessCount;
-    }
-
-
-EXPORT_C CMemSpyEngineObject* CMemSpyEngineObject::Parent() const
-    {
-    return iParent;
-    }
-
-
-EXPORT_C void CMemSpyEngineObject::SetParent( CMemSpyEngineObject* aParent )
-    {
-    iParent = aParent;
-    }
--- a/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectContainer.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,958 +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 <memspy/engine/memspyengineobjectcontainer.h>
-
-// System includes
-#include <e32svr.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperstack.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-
-// Literal constants
-_LIT(KProcessFilter, "*");
-_LIT(KEKernProcessName, "ekern");
-
-
-CMemSpyEngineObjectContainer::CMemSpyEngineObjectContainer( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-	/*
-    TFindProcess procFinder( KProcessFilter );
-    TFullName nextMatch;
-    //
-    while( procFinder.Next( nextMatch ) == KErrNone )
-        {
-        _LIT(KProcListing, "%S");
-        RDebug::Print(KProcListing, &nextMatch);
-
-
-        _LIT(KFindMask, "*");
-        nextMatch += KFindMask;
-        //
-        TFindThread threadFinder( nextMatch );
-        //
-        while( threadFinder.Next( nextMatch ) == KErrNone )
-            {
-            _LIT(KThreadListing, "+--- %S");
-            RDebug::Print(KThreadListing, &nextMatch);
-            }
-        }
-	*/
-    }
-
-
-CMemSpyEngineObjectContainer::~CMemSpyEngineObjectContainer()
-    {
-    DestroyProcesses( iGarbage );
-    DestroyProcesses( iProcesses );
-    delete iUndertaker;
-    delete iMidwife;
-    delete iIdleNotifyContainerChanged;
-    }
-
-
-void CMemSpyEngineObjectContainer::ConstructL( const TDesC& aFilter )
-    {
-    iUndertaker = CMemSpyEngineUndertaker::NewL( iEngine.Driver() );
-    iUndertaker->AddObserverL( *this );
-    //
-    iMidwife = CMemSpyEngineMidwife::NewL( iEngine.Driver() );
-    iMidwife->AddObserverL( *this );
-    //
-    iIdleNotifyContainerChanged = CIdle::NewL( CActive::EPriorityIdle );
-    //
-    RefreshL( aFilter );
-    }
-
-
-CMemSpyEngineObjectContainer* CMemSpyEngineObjectContainer::NewL( CMemSpyEngine& aEngine )
-    {
-    return NewL( KProcessFilter, aEngine );
-    }
-
-
-CMemSpyEngineObjectContainer* CMemSpyEngineObjectContainer::NewL( const TDesC& aFilter, CMemSpyEngine& aEngine )
-    {
-    CMemSpyEngineObjectContainer* self = new(ELeave) CMemSpyEngineObjectContainer( aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL( aFilter );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineObjectContainer::Count() const
-    {
-    return iProcesses.Count();
-    }
-
-
-EXPORT_C TInt CMemSpyEngineObjectContainer::CountAll() const
-    {
-    TInt ret = 0;
-    //
-    const TInt count = iProcesses.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        CMemSpyProcess* process = iProcesses[ i ];
-        ret += process->Count();
-        }
-    //
-    return ret;
-    }
-
-
-EXPORT_C void CMemSpyEngineObjectContainer::RefreshL()
-    {
-    RefreshL( KProcessFilter );
-    }
-
-
-EXPORT_C void CMemSpyEngineObjectContainer::RefreshL( const TDesC& aFilter )
-    {
-    LocateProcessesL( aFilter );
-    }
-
-
-EXPORT_C CMemSpyProcess& CMemSpyEngineObjectContainer::At( TInt aIndex ) const
-    {
-    CMemSpyProcess* ret = iProcesses[ aIndex ];
-    return *ret;
-    }
-
-
-EXPORT_C CMemSpyProcess& CMemSpyEngineObjectContainer::ProcessByIdL( TProcessId aId ) const
-    {
-    CMemSpyProcess* ret = NULL;
-    //
-    const TInt count = iProcesses.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        CMemSpyProcess* process = iProcesses[ i ];
-        if  ( process->Id() == aId )
-            {
-            ret = process;
-            break;
-            }
-        }
-    //
-    if  ( ret == NULL )
-        {
-        User::Leave( KErrNotFound );
-        }
-    //
-    return *ret;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineObjectContainer::ProcessIndexById( TProcessId aId ) const
-    {
-    TInt index = KErrNotFound;
-    //
-    const TInt count = iProcesses.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyProcess* process = iProcesses[ i ];
-        if  ( process->Id() == aId )
-            {
-            index = i;
-            break;
-            }
-        }
-    //
-    return index;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineObjectContainer::ProcessAndThreadByThreadId( TThreadId aTid, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const
-    {
-    aProcess = NULL;
-    aThread = NULL;
-    TInt error = KErrNotFound;
-    //
-    const TInt count = iProcesses.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        CMemSpyProcess* process = iProcesses[ i ];
-
-        // Check whether this process contains the thread we are looking for...
-        const TInt index = process->ThreadIndexById( aTid );
-        if  ( index >= 0 )
-            {
-            // Found it
-            aProcess = process;
-            aThread = &process->At( index );
-            error = KErrNone;
-            break;
-            }
-        }
-    //
-    if  ( error == KErrNotFound )
-        {
-        CMemSpyEngineObjectContainer* self = const_cast< CMemSpyEngineObjectContainer* >( this );
-        TRAP( error, self->TryToCreateProcessAndThreadL( aTid, aProcess, aThread ) );
-        }
-    //
-    return error;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineObjectContainer::ProcessAndThreadByFullName( const TDesC& aFullName, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const
-    {
-    aProcess = NULL;
-    aThread = NULL;
-    TInt error = KErrNotFound;
-    //
-    const TInt count = iProcesses.Count();
-    for( TInt i=0; i<count && aThread == NULL; i++ )
-        {
-        CMemSpyProcess& process = *iProcesses[ i ];
-        const TInt threadCount = process.Count();
-        //
-        for(TInt j=0; j<threadCount; j++)
-            {
-            CMemSpyThread& thread = process.At( j );
-            const TFullName threadName( thread.FullName() );
-            //
-            if  ( threadName.CompareF( aFullName ) == 0 )
-                {
-                // Found it
-                aProcess = &process;
-                aThread = &thread;
-                error = KErrNone;
-                break;
-                }
-            }
-
-        }
-    //
-    if  ( error == KErrNotFound )
-        {
-        // NB: cannot use driver API as we must open thread by name, and that only supports opening
-        // by id.
-        RThread thread;
-        error = thread.Open( aFullName );
-        if ( error == KErrNone )
-            {
-            const TThreadId threadId = thread.Id();
-            thread.Close();
-
-            CMemSpyEngineObjectContainer* self = const_cast< CMemSpyEngineObjectContainer* >( this );
-            TRAP( error, self->TryToCreateProcessAndThreadL( threadId, aProcess, aThread ) );
-            }
-        }
-    //
-    return error;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineObjectContainer::ProcessAndThreadByPartialName( const TDesC& aPartialName, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const
-    {
-    aProcess = NULL;
-    aThread = NULL;
-    TInt error = KErrNotFound;
-    //
-    const TInt count = iProcesses.Count();
-    for( TInt i=0; i<count && aThread == NULL; i++ )
-        {
-        CMemSpyProcess& process = *iProcesses[ i ];
-        const TInt threadCount = process.Count();
-        //
-        for(TInt j=0; j<threadCount; j++)
-            {
-            CMemSpyThread& thread = process.At( j );
-            const TFullName threadName( thread.FullName() );
-            //
-            if  ( threadName.FindF( aPartialName ) >= 0 )
-                {
-                // Found it
-                aProcess = &process;
-                aThread = &thread;
-                error = KErrNone;
-                break;
-                }
-            }
-
-        }
-    //
-    return error;
-    }
-
-
-EXPORT_C TBool CMemSpyEngineObjectContainer::IsAlive( TProcessId aPid ) const
-    {
-    const TInt processIndex = ProcessIndexById( aPid );
-    return ( processIndex >= 0 );
-    }
-
-
-EXPORT_C TBool CMemSpyEngineObjectContainer::IsAlive( TProcessId aPid, TThreadId aTid ) const
-    {
-    TBool isAlive = IsAlive( aPid );
-    if  ( isAlive )
-        {
-        const TInt processIndex = ProcessIndexById( aPid );
-        const CMemSpyProcess& process = At( processIndex );
-
-        // Check whether the thread is alive
-        isAlive = ( process.ThreadIndexById( aTid ) >= 0 );
-        }
-    //
-    return isAlive;
-    }
-
-
-EXPORT_C TInt CMemSpyEngineObjectContainer::MdcaCount() const
-    {
-    return iProcesses.Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyEngineObjectContainer::MdcaPoint(TInt aIndex) const
-    {
-    const CMemSpyProcess* process = iProcesses[ aIndex ];
-    return TPtrC( process->NameForListBox() );
-    }
-
-
-void CMemSpyEngineObjectContainer::LocateProcessesL( const TDesC& aFilter )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineObjectContainer::LocateProcessesL() - START" );
-#endif
-    DestroyProcesses( iProcesses );
-    //
-    const TProcessId myProcessId = RProcess().Id();
-	//
-    TFindProcess finder( aFilter );
-    TFullName nextMatch;
-    //
-    while( finder.Next( nextMatch ) == KErrNone )
-        {
-        if  ( nextMatch.FindF(KEKernProcessName) == KErrNotFound )
-            {
-#ifdef _DEBUG
-            RDebug::Print(_L( "CMemSpyEngineObjectContainer::LocateProcessesL() - found Proc: %S"), &nextMatch );
-#endif
-
-            RProcess p;
-            const TInt r = p.Open( nextMatch );
-            TProcessId processId( KNullProcessId );
-            if ( r == KErrNone )
-                {
-                processId = p.Id();
-                }
-            p.Close();
-
-#ifdef _DEBUG
-            RDebug::Printf( "CMemSpyEngineObjectContainer::LocateProcessesL() - open err: %d", r );
-#endif
-
-            if  ( r == KErrNone )
-                {
-                if  ( processId != myProcessId )
-                    {
-                    TRAPD( err, CreateProcessL( processId ) );
-#ifdef _DEBUG
-                    RDebug::Printf( "CMemSpyEngineObjectContainer::LocateProcessesL() - CreateProcessL err: %d", err );
-#endif
-                    err = err;
-                    }
-                }
-            }
-        }
-    //
-    SortByName();
-
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyEngineObjectContainer::LocateProcessesL() - END" );
-#endif
-    }
-
-
-CMemSpyProcess* CMemSpyEngineObjectContainer::CreateProcessL( const TProcessId& aId )
-    {
-#ifdef _DEBUG
-	RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::CreateProcessL() - START - pid: 0x%04x", (TUint) aId );
-#endif
-
-    CMemSpyProcess* processObj = CMemSpyProcess::NewLC( aId, iEngine );
-    const TPtrC pName( processObj->Name() );
-
-    if  ( pName.FindF( KEKernProcessName ) == KErrNotFound )
-        {
-        if  ( processObj->Count() == 0 )
-            {
-            // Calls delete
-#ifdef _DEBUG
-	        RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::CreateProcessL() - process has no threads... deleting it!" );
-#endif
-            processObj->Close();
-            processObj = NULL;
-            }
-        else
-            {
-            // Make sure we don't add duplicate processes...
-            AppendL( processObj );
-            }
-        }
-    else
-        {
-        // We don't support kernel-side threads
-#ifdef _DEBUG
-        RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::CreateProcessL() - kernel process... deleting it!" );
-#endif
-        processObj->Close();
-        processObj = NULL;
-        }
-
-    CleanupStack::Pop();
-
-#ifdef _DEBUG
-    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::CreateProcessL() - END - pid: 0x%04x, processObj: 0x%08x", (TUint) aId, processObj );
-#endif
-    return processObj;
-    }
-
-
-void CMemSpyEngineObjectContainer::DestroyProcesses( RArray< CMemSpyProcess* >& aList )
-    {
-    while( aList.Count() ) 
-        {
-        CMemSpyProcess* process = aList[ 0 ];
-        aList.Remove( 0 );
-        process->Close();
-        }
-
-    aList.Close();
-    }
-
-
-void CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL( const TThreadId& aTid, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(1) - START - aTid: 0x%04x", (TUint) aTid );
-#endif
-
-    // Must open thread and process in order to get process id.
-    RThread thread;
-    User::LeaveIfError( iEngine.Driver().OpenThread( aTid, thread ) );
-    CleanupClosePushL( thread );
-    RProcess process;
-    User::LeaveIfError( thread.Process( process ) );
-    const TProcessId processId = process.Id();
-    process.Close();
-
-    // Call overload
-    TryToCreateProcessAndThreadL( thread, aProcess, aThread );
-
-    CleanupStack::PopAndDestroy( &thread );
-
-#ifdef _DEBUG
-    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(1) - END - aTid: 0x%04x", (TUint) aTid );
-#endif
-    }
-
-
-void CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL( const RThread& aRThread, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - START - aTid: 0x%04x", (TUint) aRThread.Id() );
-#endif
-
-    // Full name of process
-    TFullName* name = new(ELeave) TFullName();
-    CleanupStack::PushL( name );
-
-    // Must open thread and process in order to get process id.
-    RProcess process;
-    User::LeaveIfError( aRThread.Process( process ) );
-    process.FullName( *name );
-    const TProcessId processId = process.Id();
-    process.Close();
-
-    const TBool isKernel = ( name->FindF( KEKernProcessName ) >= KErrNone );
-
-#ifdef _DEBUG
-    RDebug::Print( _L("[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - pid: 0x%04x, name: %S"), (TUint) processId, name );
-#endif
-
-    CleanupStack::PopAndDestroy( name );
-
-    // See if we have already created a process for this process id...
-    CMemSpyProcess* processObj = NULL;
-    const TInt procIndex = ProcessIndexById( processId );
-
-#ifdef _DEBUG
-    RDebug::Print( _L("[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - pid: 0x%04x, index: %d"), (TUint) processId, procIndex );
-#endif
-
-    if  ( isKernel )
-        {
-#ifdef _DEBUG
-        RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - caller requested a kernel thread/process..." );
-#endif
-        __ASSERT_ALWAYS( procIndex == KErrNotFound, MemSpyEngineUtils::Panic( EMemSpyEnginePanicEncounteredKernelUnexpectedly ) );
-
-#ifdef _DEBUG
-        RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - leaving with KErrNotSupported" );
-#endif
-        User::Leave( KErrNotSupported );
-        }
-    else if ( aRThread.Id() == RThread().Id() )
-        {
-        TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - trying to create MemSpy -> leaving with KErrNotSupported" ) );
-        User::Leave( KErrNotSupported );
-        }
-    else
-        {
-        if  ( procIndex >= 0 )
-            {
-            // Existing process, but new thread?
-            processObj = iProcesses[ procIndex ];
-
-            // Make new thread
-            processObj->HandleThreadIsBornL( aRThread.Id() );
-            }
-        else
-            {
-            // Must also create a new process. This should, in theory, ensure
-            // the thread is also created.
-            processObj = CMemSpyProcess::NewLC( processId, iEngine );
-            if  ( processObj->Count() == 0 )
-                {
-                // No threads, discard process and leave
-                User::Leave( KErrNotFound );
-                }
-            else
-                {
-                // Save process
-                AppendL( processObj );
-                }
-
-            // Tidy up
-            CleanupStack::Pop();
-            }
-
-        // Check to see if the process contains the specified thread (it should do, since we just found
-        // the process using it).
-        CMemSpyThread& threadObj = processObj->ThreadByIdL( aRThread.Id() );
-
-        // We're done now.
-        aProcess = processObj;
-        aThread = &threadObj;
-
-        // Update sort order
-        Resort();
-
-        // Signal UI        
-        AsyncNotifyUiOfContainerChanges();
-        }
-
-#ifdef _DEBUG
-    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - END - aTid: 0x%04x, pid: 0x%04x", (TUint) aRThread.Id(), (TUint) processId );
-#endif
-    }
-
-
-void CMemSpyEngineObjectContainer::Resort()
-    {
-    switch( iSortType )
-        {
-    case ESortById:
-        {
-        TLinearOrder< CMemSpyProcess* > comparer( CompareById );
-        iProcesses.Sort( comparer );
-        }
-        break;
-    default:
-    case ESortByName:
-        {
-        TLinearOrder< CMemSpyProcess* > comparer( CompareByName );
-        iProcesses.Sort( comparer );
-        }
-        break;
-    case ESortByThreadCount:
-        {
-        TLinearOrder< CMemSpyProcess* > comparer( CompareByThreadCount );
-        iProcesses.Sort( comparer );
-        }
-        break;
-    case ESortByCodeSegs:
-        {
-        TLinearOrder< CMemSpyProcess* > comparer( CompareByCodeSegs );
-        iProcesses.Sort( comparer );
-        }
-        break;
-    case ESortByHeapUsage:
-        {
-        TLinearOrder< CMemSpyProcess* > comparer( CompareByHeapUsage );
-        iProcesses.Sort( comparer );
-        }
-        break;
-    case ESortByStackUsage:
-        {
-        TLinearOrder< CMemSpyProcess* > comparer( CompareByStackUsage );
-        iProcesses.Sort( comparer );
-        }
-        break;
-        }
-    }
-
-
-EXPORT_C void CMemSpyEngineObjectContainer::SortById()
-    {
-    iSortType = ESortById;
-    Resort();
-    }
-
-
-EXPORT_C void CMemSpyEngineObjectContainer::SortByName()
-    {
-    iSortType = ESortByName;
-    Resort();
-    }
-
-
-EXPORT_C void CMemSpyEngineObjectContainer::SortByThreadCount()
-    {
-    iSortType = ESortByThreadCount;
-    Resort();
-    }
-
-
-EXPORT_C void CMemSpyEngineObjectContainer::SortByCodeSegs()
-    {
-    iSortType = ESortByCodeSegs;
-    Resort();
-    }
-
-
-EXPORT_C void CMemSpyEngineObjectContainer::SortByHeapUsage()
-    {
-    iSortType = ESortByHeapUsage;
-    Resort();
-    }
-
-
-EXPORT_C void CMemSpyEngineObjectContainer::SortByStackUsage()
-    {
-    iSortType = ESortByStackUsage;
-    Resort();
-    }
-
-
-void CMemSpyEngineObjectContainer::Remove( CMemSpyProcess& aProcess )
-    {
-    const TInt index = ProcessIndexById( aProcess.Id() );
-    if ( index >= 0 )
-        {
-        iProcesses.Remove( index );
-        }
-    }
-    
-    
-void CMemSpyEngineObjectContainer::AppendL( CMemSpyProcess* aProcess )
-    {
-    const TInt error = iProcesses.Append( aProcess );
-    User::LeaveIfError( error );    
-    }
-
-
-TInt CMemSpyEngineObjectContainer::CompareById( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
-    {
-    TInt ret = 1;
-    //
-    if  ( aLeft->Id() < aRight->Id() )
-        {
-        ret = -1;
-        }
-    else if ( aLeft->Id() == aRight->Id() )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineObjectContainer::CompareByThreadCount( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
-    {
-    TInt ret = -1;
-    //
-    if  ( aLeft->Count() < aRight->Count() )
-        {
-        ret = 1;
-        }
-    else if ( aLeft->Count() == aRight->Count() )
-        {
-        // Sort by name when thread counts are the same
-        ret = aLeft->Name().CompareF( aRight->Name() );
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineObjectContainer::CompareByName( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
-    {
-    return aLeft->Name().CompareF( aRight->Name() );
-    }
-
-
-TInt CMemSpyEngineObjectContainer::CompareByCodeSegs( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
-    {
-    CMemSpyEngine& engine = aLeft->Engine();
-    CMemSpyEngineHelperCodeSegment& helper = engine.HelperCodeSegment();
-    //
-    TInt leftCount = 0;
-    TInt rightCount = 0;
-    //
-    TRAP_IGNORE( 
-        CMemSpyEngineCodeSegList* leftList = helper.CodeSegmentListL( aLeft->Id() );
-        leftCount = leftList->Count();
-        delete leftList;
-        //
-        CMemSpyEngineCodeSegList* rightList = helper.CodeSegmentListL( aRight->Id() );
-        rightCount = rightList->Count();
-        delete rightList;
-        );
-    //
-    TInt ret = -1;
-    //
-    if  ( leftCount < rightCount )
-        {
-        ret = 1;
-        }
-    else if ( leftCount == rightCount )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineObjectContainer::CompareByHeapUsage( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
-    {
-    CMemSpyEngine& engine = aLeft->Engine();
-    CMemSpyEngineHelperHeap& helper = engine.HelperHeap();
-    //
-    TInt leftSize = 0;
-    TInt rightSize = 0;
-    //
-    TRAP_IGNORE( 
-        RArray< TMemSpyHeapInfo > leftInfos;
-        CleanupClosePushL( leftInfos );
-        helper.GetHeapInfoUserL( *aLeft, leftInfos );
-        const TInt leftCount = leftInfos.Count();
-        for( TInt i=0; i<leftCount; i++ )
-            {
-            const TMemSpyHeapInfo& info = leftInfos[ i ];
-            if ( info.Type() != TMemSpyHeapInfo::ETypeUnknown )
-                {
-                leftSize += (TInt) info.AsRHeap().MetaData().iHeapSize;
-                }
-            }
-        CleanupStack::PopAndDestroy( &leftInfos );
-        );
-    //
-    TRAP_IGNORE( 
-        RArray< TMemSpyHeapInfo > rightInfos;
-        CleanupClosePushL( rightInfos );
-        helper.GetHeapInfoUserL( *aRight, rightInfos );
-        const TInt rightCount = rightInfos.Count();
-        for( TInt i=0; i<rightCount; i++ )
-            {
-            const TMemSpyHeapInfo& info = rightInfos[ i ];
-            if ( info.Type() == TMemSpyHeapInfo::ETypeUnknown )
-                {
-                rightSize += (TInt) info.AsRHeap().MetaData().iHeapSize;
-                }
-            }
-        CleanupStack::PopAndDestroy( &rightInfos );
-        );
-    //
-    TInt ret = -1;
-    //
-    if  ( leftSize < rightSize )
-        {
-        ret = 1;
-        }
-    else if ( leftSize == rightSize )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-TInt CMemSpyEngineObjectContainer::CompareByStackUsage( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
-    {
-    CMemSpyEngine& engine = aLeft->Engine();
-    CMemSpyEngineHelperStack& helper = engine.HelperStack();
-    //
-    const TInt leftCount = helper.CalculateStackSizes( *aLeft );
-    const TInt rightCount = helper.CalculateStackSizes( *aRight );
-    //
-    TInt ret = -1;
-    //
-    if  ( leftCount < rightCount )
-        {
-        ret = 1;
-        }
-    else if ( leftCount == rightCount )
-        {
-        ret = 0;
-        }
-    //
-    return ret;
-    }
-
-
-TBool CMemSpyEngineObjectContainer::MoveToGarbageL( const TProcessId& aId )
-    {
-    const TInt pos = ProcessIndexById( aId );
-
-    if  ( pos >= 0 )
-        {
-        CMemSpyProcess* proc = iProcesses[ pos ];
-
-#ifdef _DEBUG
-        const TPtrC pName( proc->Name() );
-        RDebug::Print( _L("[MemSpy] CMemSpyEngineObjectContainer::MoveToGarbageL() - pid: 0x%04x, proc: 0x%08x, pos: %d, id: 0x%04x, name: %S"), (TUint) aId, proc, pos, (TUint) proc->Id(), &pName );
-#endif
-
-        User::LeaveIfError( iGarbage.Append( proc ) );
-        iProcesses.Remove( pos );
-        }
-	else
-        {
-#ifdef _DEBUG
-        RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::MoveToGarbageL() - pid: 0x%04x, pos: KErrNotFound", (TUint) aId );
-#endif
-        }
-        
-    return ( pos >= 0 );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-void CMemSpyEngineObjectContainer::ThreadIsDeadL( const TThreadId& aId, const RThread& aThread )
-    {
-    // Try to find the thread in question...
-    CMemSpyProcess* process = NULL;
-    CMemSpyThread* thread = NULL;
-    //
-    const TInt err = ProcessAndThreadByThreadId( aId, process, thread );
-    if  ( err == KErrNone && thread )
-        {
-        // This will force the thread to detect if it is dead or not...
-        thread->SetDeadL( aThread );
-
-        // Signal UI        
-        AsyncNotifyUiOfContainerChanges();
-        }
-    }
-    
-
-void CMemSpyEngineObjectContainer::ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess )
-    {
-    const TInt index = ProcessIndexById( aId );
-    if  ( index >= 0 )
-        {
-        CMemSpyProcess* process = iProcesses[ index ];
-        process->SetDeadL( aProcess );
-
-        // Signal UI        
-        AsyncNotifyUiOfContainerChanges();
-        }
-    }
-
-
-void CMemSpyEngineObjectContainer::ThreadIsBornL( const TThreadId& /*aId*/, const RThread& aThread )
-    {
-    if  ( aThread.Handle() != KNullHandle )
-        {
-        // The thread and process objects that will be created (or found, if they already exist).
-        CMemSpyProcess* process = NULL;
-        CMemSpyThread* thread = NULL;
-
-        // Create the objects if needed
-        TryToCreateProcessAndThreadL( aThread, process, thread );
-        }
-    }
-
-
-void CMemSpyEngineObjectContainer::ProcessIsBornL( const TProcessId& aId, const RProcess& /*aProcess*/ )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::ProcessIsBornL() - START - pid: 0x%04x", (TUint) aId );
-#endif
-    (void) aId;
-
-    // This gets handled by the new thread creation. When the first thread in the process
-    // is created, we'll also prepare a new process object.
-
-#ifdef _DEBUG
-	RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::ProcessIsBornL() - END - pid: 0x%04x", (TUint) aId );
-#endif
-    }
-    
-
-void CMemSpyEngineObjectContainer::AsyncNotifyUiOfContainerChanges()
-    {
-    iIdleNotifyContainerChanged->Cancel();
-    iIdleNotifyContainerChanged->Start( TCallBack( NotifyUiOfContainerChanges, this ) );
-    }
-
-
-TBool CMemSpyEngineObjectContainer::NotifyUiOfContainerChanges( TAny* aSelf )
-    {
-    CMemSpyEngineObjectContainer* self = reinterpret_cast< CMemSpyEngineObjectContainer* >( aSelf );
-    TRAP_IGNORE( self->iEngine.NotifyContainerChangeL() );
-    return EFalse;
-    }
-
-
-    
--- a/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectProcess.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,651 +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 <memspy/engine/memspyengineobjectprocess.h>
-
-// System includes
-#include <e32svr.h>
-#include <u32std.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-#include <memspy/driver/memspydriverpanics.h> // for terminate
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-
-// Literal constants
-_LIT( KMemSpyUnknownProcessName, "Unknown" );
-_LIT( KMemSpyUnknownExitCategory, "Unknown ExitCat" );
-_LIT( KMemSpyStandardProcessExtension, ".exe" );
-
-
-CMemSpyProcess::CMemSpyProcess( TProcessId aId, CMemSpyEngine& aEngine  )
-:   iId( aId ), iEngine( aEngine )
-    {
-    }
-
-
-CMemSpyProcess::~CMemSpyProcess()
-    {
-#ifdef _DEBUG
-    if  ( iName != NULL )
-        {
-        RDebug::Print(_L( "MEMSPY - dtor - CMemSpyProcess() - this: 0x%08x, name: %S"), this, iName);
-        }
-    else
-        {
-        RDebug::Printf( "MEMSPY - dtor - CMemSpyProcess() - this: 0x%08x", this );
-        }
-#endif
-
-    CloseAllThreads();
-    iThreads.Close();
-    delete iName;
-    delete iInfo;
-    }
-
-
-void CMemSpyProcess::ConstructL()
-    {
-    iInfo = new(ELeave) TMemSpyDriverProcessInfo();
-
-    RMemSpyDriverClient& driver = iEngine.Driver();
-    RProcess process;
-    User::LeaveIfError( driver.OpenProcess( iId, process ) );
-    CleanupClosePushL( process );
-
-    // Find the threads before we start tinkering with the process
-    // name
-    LocateThreadsL( process );
-
-    // Now build the process name
-    RefreshL( process );
-
-    CleanupStack::PopAndDestroy( &process );
-
-    
-#ifdef _DEBUG
-    if  ( iName != NULL )
-        {
-        RDebug::Print(_L( "MEMSPY - ctor - CMemSpyProcess() - this: 0x%08x, name: %S"), this, iName);
-        }
-    else
-        {
-        RDebug::Printf( "MEMSPY - ctor - CMemSpyProcess() - this: 0x%08x", this );
-        }
-#endif
-    }
-
-
-EXPORT_C CMemSpyProcess* CMemSpyProcess::NewL( const CMemSpyProcess& aCopyMe )
-    {
-    CMemSpyProcess* self = NewL( aCopyMe.Id(), aCopyMe.iEngine );
-    return self;
-    }
-
-
-CMemSpyProcess* CMemSpyProcess::NewL( TProcessId aId, CMemSpyEngine& aEngine )
-    {
-    CMemSpyProcess* self = CMemSpyProcess::NewL( aId, aEngine );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-CMemSpyProcess* CMemSpyProcess::NewLC( TProcessId aId, CMemSpyEngine& aEngine )
-    {
-    CMemSpyProcess* self = new(ELeave) CMemSpyProcess( aId, aEngine );
-    CleanupClosePushL( *self );
-    self->ConstructL();
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyProcess::Close()
-    {
-    if  ( !OpenOrCloseInProgress() )
-        {
-        const TInt ac = AccessCount();
-        SetOpenOrCloseInProgress( ETrue );
-
-        // Calling close can do a "delete this" so make sure
-        // we don't try to access the object again in that situation...
-        CMemSpyEngineObject::Close();
-        if  ( ac - 1 > 0 )
-            {
-            SetOpenOrCloseInProgress( EFalse );
-            }
-        else
-            {
-            // We don't care - we've just been deleted!
-            }
-        }
-    }
-
-
-EXPORT_C void CMemSpyProcess::Open()
-    {
-    if  ( !OpenOrCloseInProgress() )
-        {
-        SetOpenOrCloseInProgress( ETrue );
-        CMemSpyEngineObject::Open();
-        SetOpenOrCloseInProgress( EFalse );
-        }
-    }
-
-
-EXPORT_C TInt CMemSpyProcess::MdcaCount() const
-    {
-    return iThreads.Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyProcess::MdcaPoint(TInt aIndex) const
-    {
-    const CMemSpyThread* thread = iThreads[ aIndex ];
-    return TPtrC( thread->NameForListBox() );
-    }
-
-
-EXPORT_C TInt CMemSpyProcess::ThreadIndexById( TThreadId aId ) const
-    {
-    TInt index = KErrNotFound;
-    //
-    const TInt count = iThreads.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyThread* thread = iThreads[ i ];
-        if  ( thread->Id() == aId )
-            {
-            index = i;
-            break;
-            }
-        }
-    //
-    return index;
-    }
-
-
-EXPORT_C CMemSpyThread& CMemSpyProcess::ThreadByIdL( TThreadId aId ) const
-    {
-    CMemSpyThread* ret = NULL;
-    //
-    const TInt count = iThreads.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        CMemSpyThread* thread = iThreads[ i ];
-        if  ( thread->Id() == aId )
-            {
-            ret = thread;
-            break;
-            }
-        }
-    //
-    if  ( ret == NULL )
-        {
-        User::Leave( KErrNotFound );
-        }
-    //
-    return *ret;
-    }
-
-
-
-EXPORT_C TPtrC CMemSpyProcess::Name() const
-    {
-    // Just return the pure name, minus the leading tab
-    TPtrC pRet( iName->Mid(2) );
-    
-    // Find the last tab position
-    TInt pos = pRet.Locate(TChar('\t'));
-    if  ( pos > 0 )
-        {
-        pRet.Set( pRet.Left( pos ) );
-        }
-    //    
-    return pRet;
-    }
-
-
-EXPORT_C CMemSpyThread& CMemSpyProcess::At( TInt aIndex ) const
-    {
-    CMemSpyThread* ret = iThreads[ aIndex ];
-    return *ret;
-    }
-
-
-EXPORT_C void CMemSpyProcess::TerminateL()
-    {
-    RMemSpyDriverClient& driver = iEngine.Driver();
-    RProcess process;
-    User::LeaveIfError( driver.OpenProcess( iId, process ) );
-    process.Terminate( EPanicForcedTerminate );
-    process.Close();
-    //
-    RefreshL();
-    }
-
-
-EXPORT_C void CMemSpyProcess::KillL()
-    {
-    RMemSpyDriverClient& driver = iEngine.Driver();
-    RProcess process;
-    User::LeaveIfError( driver.OpenProcess( iId, process ) );
-    process.Kill( EPanicForcedKill );
-    process.Close();
-    //
-    RefreshL();
-    }
-
-
-EXPORT_C void CMemSpyProcess::PanicL()
-    {
-    RMemSpyDriverClient& driver = iEngine.Driver();
-    RProcess process;
-    User::LeaveIfError( driver.OpenProcess( iId, process ) );
-    process.Panic( KMemSpyClientPanic, EPanicForcedPanic );
-    process.Close();
-    //
-    RefreshL();
-    }
-
-
-EXPORT_C TBool CMemSpyProcess::IsSystemPermanent() const
-    {
-    const TBool ret = ( iInfo->iFlags & KProcessFlagSystemPermanent );
-    return ret;
-    }
-
-
-EXPORT_C TBool CMemSpyProcess::IsSystemCritical() const
-    {
-    const TBool ret = ( iInfo->iFlags & KProcessFlagSystemCritical );
-    return ret;
-    }
-
-
-void CMemSpyProcess::LocateThreadsL( RProcess& aProcess )
-    {
-    __ASSERT_ALWAYS( aProcess.Handle() != KNullHandle, MemSpyEngineUtils::Panic( EMemSpyEnginePanicProcessHandleNullWhenAttemptingToIdentifyThreads ) );
-
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyProcess::LocateThreadsL() - START - this: 0x%08x, pid: %d (0x%04x)", this, (TUint) aProcess.Id(), (TUint) aProcess.Id() );
-#endif
-
-    RArray<TThreadId> threadIds;
-    CleanupClosePushL( threadIds );
-
-    // Get list of child threads from driver.
-    iEngine.Driver().GetThreadsL( aProcess.Id(), threadIds );
-
-    // Create therad object for each thread the driver returned to us...
-    const TInt count = threadIds.Count();
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyProcess::LocateThreadsL() - got %d threads", count );
-#endif
-
-    for( TInt i=0; i<count; i++ )
-        {
-        const TThreadId threadId( threadIds[ i ] );
-#ifdef _DEBUG
-        RDebug::Printf("CMemSpyProcess::LocateThreadsL() - thread id: %d (0x%04d)", (TUint) threadId, (TUint) threadId );
-#endif
-        //
-        TRAP_IGNORE( 
-            CMemSpyThread* threadObj = CMemSpyThread::NewLC( threadId, *this );
-            iThreads.AppendL( threadObj );
-            CleanupStack::Pop( threadObj );
-            );
-        }
-
-    // Tidy up
-    CleanupStack::PopAndDestroy( &threadIds );
-    
-#ifdef _DEBUG
-    RDebug::Printf("CMemSpyProcess::LocateThreadsL() - END - this: 0x%08x, pid: %d (0x%04x), thread count: %d", this, (TUint) aProcess.Id(), (TUint) aProcess.Id(), iThreads.Count() );
-#endif
-    }
-
-
-void CMemSpyProcess::AppendPriority( TDes& aDes, TProcessPriority aPriority )
-    {
-    switch( aPriority )
-        {
-    case EPriorityLow:
-        aDes += _L("[L]");
-        break;
-    case EPriorityBackground:
-        aDes += _L("[B]");
-        break;
-    case EPriorityForeground:
-        aDes += _L("[F]");
-        break;
-    case EPriorityHigh:
-        aDes += _L("[H]");
-        break;
-    case EPriorityWindowServer:
-        aDes += _L("[WS]");
-        break;
-    case EPriorityFileServer:
-        aDes += _L("[FS]");
-        break;
-    case EPriorityRealTimeServer:
-        aDes += _L("[RTS]");
-        break;
-    case EPrioritySupervisor:
-        aDes += _L("[SUP]");
-        break;
-    default:
-        aDes += _L("[?]");
-        break;
-        }
-    }
-
-
-void CMemSpyProcess::GetFileName( TFileName& aFileName )
-    {
-    // Fallback
-    const TPtrC pNameCleaned( Name() );
-    aFileName.Zero();
-    aFileName.AppendFormat( _L("%S.exe"), &pNameCleaned );
-
-    // Try to get the proper name
-    RProcess process;
-    RMemSpyDriverClient& driver = iEngine.Driver();
-    if  ( driver.OpenProcess( iId, process ) == KErrNone )
-        {
-        aFileName = process.FileName();
-        process.Close();
-        }
-    }
-
-void CMemSpyProcess::RefreshL()
-    {
-    RMemSpyDriverClient& driver = iEngine.Driver();
-    RProcess process;
-
-    // Deliberately ignore error - the other overload of RefreshL can cope with
-    // a null handle.
-    driver.OpenProcess( iId, process );
-    CleanupClosePushL( process );
-
-    RefreshL( process );
-
-    CleanupStack::PopAndDestroy( &process );
-    }
-
-
-void CMemSpyProcess::RefreshL( const RProcess& aProcess )
-    {
-    const TBool handleValid = aProcess.Handle() != KNullHandle;
-    if  ( handleValid )
-        {
-        RMemSpyDriverClient& driver = iEngine.Driver();
-        User::LeaveIfError( driver.GetProcessInfo( iId, *iInfo ) );
-        }
-
-    // Get priority, exit info etc
-    iExitType = handleValid ? aProcess.ExitType() : EExitKill;
-    iPriority = handleValid ? aProcess.Priority() : EPriorityForeground;
-
-    // If the process is dead then we may not be able to get some attributes
-    // (it depends on whether the thread handle is valid anymore).
-    iExitReason = 0;
-    iExitCategory.Zero();
-
-    if  ( IsDead() )
-        {
-        if  ( handleValid )
-            {
-            iExitReason = aProcess.ExitReason();
-            iExitCategory = aProcess.ExitCategory(); 
-            }
-        else
-            {
-            iExitCategory = KMemSpyUnknownExitCategory;
-            }
-        }
-    else
-        {
-        // We only reset the flags if the process is still alive.
-        // If it is dead (i.e. 'if' branch) then we do not reset because
-        // we have no way to fetch them any more.
-        iFlags = EFlagsNone;
-        }
-
-    // Get raw process name and check whether it includes .exe suffix
-    TBool includesExecutableSuffix = EFalse;
-    HBufC* rawProcessName = GetProcessNameLC( aProcess, includesExecutableSuffix );
-    if ( includesExecutableSuffix )
-        {
-        iFlags |= EFlagsIncludedExecutableWithinName;
-        }
-
-    // Format priority as string
-    TBuf<10> priority;
-    AppendPriority( priority, iPriority );
-
-    // Convert the full name to the format we want in the UI
-    TBuf<KMaxFullName + 60> name;
-    TMemSpyTruncateOverflow overflow;
-
-    // FOR ALIVE PROCESSES:
-    //
-    // 1] Space, followed by tab
-    // 2] Process name (minus .exe)
-    // 3] Tab, Tab
-    // 4] Process uid
-    // 5] Thread count
-    // 6] Process priority
-    //
-    // FOR DEAD PROCESSES:
-    //
-    // 1] Space, followed by tab
-    // 2] Process name (minus .exe)
-    // 3] Tab, Tab
-    // 4] Process uid
-    // 5] Exit info
-
-    // Common
-    _LIT( KMemSpyProcessNameFormatSpecBasicName, " \t%S\t\t%8x, " );
-    name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, rawProcessName, iInfo->SID() );
-    CleanupStack::PopAndDestroy( rawProcessName );
-
-    if  ( IsDead() )
-        {
-        CMemSpyThread::AppendExitInfo( name, iExitType, iExitReason, iExitCategory );
-        }
-    else
-        {
-        _LIT( KMemSpyProcessNameFormatSpecAlive, "%2d thr, %S" );
-        name.AppendFormat( KMemSpyProcessNameFormatSpecAlive, &overflow, iThreads.Count(), &priority );
-        }
-
-    // Save end result
-    HBufC* finalName = name.AllocL();
-    delete iName;
-    iName = finalName;
-    }
-
-
-void CMemSpyProcess::SetDeadL()
-    {
-    RefreshL();
-    }
-
-
-void CMemSpyProcess::SetDeadL( const RProcess& aProcess )
-    {
-    RefreshL( aProcess );
-    }
-
-
-EXPORT_C TBool CMemSpyProcess::IsDead() const
-    {
-    const TBool isDead = ( iExitType != EExitPending );
-    return  isDead;
-    }
-
-
-EXPORT_C TUint32 CMemSpyProcess::SID() const
-    {
-    return iInfo->SID();
-    }
-
-
-EXPORT_C TUint32 CMemSpyProcess::VID() const
-    {
-    return iInfo->VID();
-    }
-
-EXPORT_C TProcessPriority CMemSpyProcess::Priority() const
-	{
-	return iPriority;
-	}
-
-EXPORT_C TExitCategoryName CMemSpyProcess::ExitCategory() const
-	{
-	return iExitCategory;
-	}
-
-EXPORT_C TInt CMemSpyProcess::ExitReason() const
-	{
-	return iExitReason;
-	}
-
-EXPORT_C TExitType CMemSpyProcess::ExitType() const
-	{
-	return iExitType;
-	}
-
-EXPORT_C TUidType CMemSpyProcess::UIDs() const
-    {
-    return iInfo->iUids;
-    }
-
-
-EXPORT_C SCapabilitySet CMemSpyProcess::Capabilities() const
-    {
-    return iInfo->iSecurityInfo.iCaps;
-    }
-
-void CMemSpyProcess::FullName( TDes& aFullName ) const
-    {
-    // c32exe.exe[101f7989]0001
-    aFullName.Zero();
-    aFullName.Append( Name() );
-    if ( iFlags & EFlagsIncludedExecutableWithinName )
-        {
-        // Add .exe
-        aFullName.Append( KMemSpyStandardProcessExtension );
-        }
-
-    aFullName.Append( '[' );
-	aFullName.AppendNumFixedWidth( iInfo->iUids[ 2 ].iUid, EHex, 8 );
-    aFullName.Append( ']' );
-	aFullName.AppendNumFixedWidth( iInfo->iGeneration, EDecimal, 4 );
-    }
-
-
-void CMemSpyProcess::HandleThreadIsBornL( const TThreadId& aId )
-    {
-    // A new thread has been created in this process. Just in case, we'll
-    // check there isn't already an existing thread with the same id...
-    const TInt index = ThreadIndexById( aId );
-    if  ( index < 0 )
-        {
-        TRAP_IGNORE( 
-            CMemSpyThread* threadObj = CMemSpyThread::NewLC( aId, *this );
-            iThreads.AppendL( threadObj );
-            CleanupStack::Pop( threadObj );
-            );
-        }
-    }
-
-
-HBufC* CMemSpyProcess::GetProcessNameLC( const RProcess& aProcessOrNull, TBool& aProcessNameIncludesExeSuffix ) const
-    {
-    _LIT( KMemSpySquareBraceOpen, "[" );
-    //
-    TFullName processName;
-    
-    // Assume the flags have already been set once previously in order to form default response
-    aProcessNameIncludesExeSuffix = ( iFlags & EFlagsIncludedExecutableWithinName );
-
-    const TBool handleValid = aProcessOrNull.Handle() != KNullHandle;
-    if  ( handleValid )
-        {
-        // Easy case - we have a valid thread handle...
-        //
-        // Get full name, e.g.:
-        //
-        // c32exe.exe[101f7989]0001
-        aProcessOrNull.FullName( processName );
-
-        // ... but we need to clean up the name so that it
-        // doesn't include the process UID, and neither does it
-        // include the extension (.exe).
-        TInt pos = processName.FindF( KMemSpySquareBraceOpen );
-        if  ( pos > 0 )
-            {
-            processName.SetLength( pos );
-            }
-        
-        // Discard '.exe'
-        pos = processName.FindF( KMemSpyStandardProcessExtension );
-        if  ( pos > 0 )
-            {
-            aProcessNameIncludesExeSuffix = ETrue;
-            processName.SetLength( pos );
-            }
-        }
-    else
-        {
-        // Since we don't have the possibility to enquire after the process's name
-        // we'll assume that it used to be alive and therefore at some point we did
-        // manage to grep it's name...
-        if  ( iName )
-            {
-            const TPtrC pOriginalName( Name() );
-            processName.Append( pOriginalName );
-            }
-        else
-            {
-            // Don't have a process handle, don't have any possibility to get the
-            // name from a prior cached version. Must use "unknown"
-            processName.Append( KMemSpyUnknownProcessName );
-            }
-        }
-    //
-    HBufC* ret = processName.AllocLC();
-    return ret;
-    }
-
-
-void CMemSpyProcess::CloseAllThreads()
-    {
-    const TInt count = iThreads.Count();
-    for(TInt i=count-1; i>=0; i--)
-        {
-        CMemSpyThread* thread = iThreads[ i ];
-        thread->Close();
-        }
-    }
-
--- a/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThread.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,532 +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 <memspy/engine/memspyengineobjectthread.h>
-
-// System includes
-#include <e32svr.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverclient.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-
-// Constants
-_LIT( KMemSpyUnknownExitCategory, "Unknown ExitCat" );
-_LIT( KMemSpyUnknownThreadName, "Unknown Thread" );
-_LIT( KMemSpyThreadDoubleColon, "::" );
-
-
-CMemSpyThread::CMemSpyThread( TThreadId aId, CMemSpyProcess& aProcess )
-:   CMemSpyEngineObject( aProcess ), iId( aId ), iProcess( &aProcess )
-    {
-    }
-
-
-CMemSpyThread::~CMemSpyThread()
-    {
-    if  ( iInfoContainer )
-        {
-        iInfoContainer->Close();
-        }
-    delete iName;
-    }
-
-
-void CMemSpyThread::ConstructL()
-    {
-    RefreshL();
-    }
-
-
-CMemSpyThread* CMemSpyThread::NewL( TThreadId aId, CMemSpyProcess& aProcess )
-    {
-    CMemSpyThread* self = CMemSpyThread::NewLC( aId, aProcess );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-CMemSpyThread* CMemSpyThread::NewLC( TThreadId aId, CMemSpyProcess& aProcess )
-    {
-    CMemSpyThread* self = new(ELeave) CMemSpyThread( aId, aProcess );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-EXPORT_C void CMemSpyThread::Open()
-    {
-    if  ( !OpenOrCloseInProgress() )
-        {
-        SetOpenOrCloseInProgress( ETrue );
-        CMemSpyEngineObject::Open();
-        SetOpenOrCloseInProgress( EFalse );
-        }
-    }
-
-
-EXPORT_C void CMemSpyThread::Close()
-    {
-    if  ( !OpenOrCloseInProgress() )
-        {
-        SetOpenOrCloseInProgress( ETrue );
-        CMemSpyEngineObject::Close();
-        SetOpenOrCloseInProgress( EFalse );
-        }
-    }
-
-
-void CMemSpyThread::AppendPriority( TDes& aDes, TThreadPriority aPriority )
-    {
-    switch( aPriority )
-        {
-    case EPriorityNull:
-        aDes += _L("[Null]");
-        break;
-    case EPriorityMuchLess:
-        aDes += _L("[Much Less]");
-        break;
-    case EPriorityLess:
-        aDes += _L("[Less]");
-        break;
-    case EPriorityNormal:
-        aDes += _L("[Normal]");
-        break;
-    case EPriorityMore:
-        aDes += _L("[More]");
-        break;
-    case EPriorityMuchMore:
-        aDes += _L("[Much More]");
-        break;
-    case EPriorityRealTime:
-        aDes += _L("[Real Time]");
-        break;
-
-    // Absolute values
-    case EPriorityAbsoluteVeryLow:
-        aDes += _L("[Abs Very Low]");
-        break;
-    case EPriorityAbsoluteLowNormal:
-        aDes += _L("[Abs Low Norm]");
-        break;
-    case EPriorityAbsoluteLow:
-        aDes += _L("[Abs Low]");
-        break;
-    case EPriorityAbsoluteBackground:
-        aDes += _L("[Abs Bgnd]");
-        break;
-    case EPriorityAbsoluteBackgroundNormal:
-        aDes += _L("[Abs Bgnd Norm]");
-        break;
-    case EPriorityAbsoluteForeground:
-        aDes += _L("[Abs Fgnd]");
-        break;
-    case EPriorityAbsoluteForegroundNormal:
-        aDes += _L("[Abs Fgnd Norm]");
-        break;
-    case EPriorityAbsoluteHigh:
-        aDes += _L("[Abs High]");
-        break;
-    case EPriorityAbsoluteHighNormal:
-        aDes += _L("[Abs High Norm]");
-        break;
-    case EPriorityAbsoluteRealTime1:
-    case EPriorityAbsoluteRealTime2:
-    case EPriorityAbsoluteRealTime3:
-    case EPriorityAbsoluteRealTime4:
-    case EPriorityAbsoluteRealTime5:
-    case EPriorityAbsoluteRealTime6:
-    case EPriorityAbsoluteRealTime7:
-    case EPriorityAbsoluteRealTime8:
-        aDes.AppendFormat( _L("[Abs RT %d]"), ( aPriority - EPriorityAbsoluteRealTime1 ) + 1 );
-        break;
-    default:
-        aDes += _L("[Unknown Pri.]");
-        break;
-        }
-    }
-
-
-void CMemSpyThread::AppendExitType( TDes& aDes, TExitType aType )
-    {
-    _LIT( KExitTypeKilled, "Killed" );
-    _LIT( KExitTypeTerminated, "Terminated" );
-    _LIT( KExitTypePanicked, "Panicked" );
-    _LIT( KExitTypePending, "Pending" );
-    
-    // Panic and Terminate are exceptional exit conditions.
-    // Kill, is ironically, not an exceptional condition.
-    switch( aType )
-        {
-    case EExitKill:
-        aDes += KExitTypeKilled;
-        break;
-    case EExitTerminate:
-        aDes += KExitTypeTerminated;
-        break;
-    case EExitPanic:
-        aDes += KExitTypePanicked;
-        break;
-    default:
-    case EExitPending:
-        aDes += KExitTypePending;
-        break;
-        }
-    }
-
-
-void CMemSpyThread::AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory )
-    {
-    aDes.Append( '[' );
-    const TInt length = aDes.Length();
-    AppendExitType( aDes, aType );
-    aDes.SetLength( length + 1 ); // Remove all but the first letter
-    aDes.Append( ']' );
-    
-    if  ( aType == EExitKill || aType == EExitPending )
-        {
-        // Kill implies "clean" exit. Pending implies not yet dead.
-        }
-    else
-        {
-        TMemSpyTruncateOverflow overflow;
-
-        // Terminate or Panic implies abnormal exit condition, so
-        // show full exit info.
-        _LIT( KAbnormalFormatSpec, " %S-%d" );
-        aDes.AppendFormat( KAbnormalFormatSpec, &overflow, &aExitCategory, aExitReason );
-        }
-    }
-
-
-CMemSpyEngine& CMemSpyThread::Engine() const
-    {
-    return Process().Engine();
-    }
-
-
-void CMemSpyThread::OpenLC( RThread& aThread )
-    {
-    const TInt error = Open( aThread );
-    User::LeaveIfError( error );
-    CleanupClosePushL( aThread );
-    }
-
-
-TInt CMemSpyThread::Open( RThread& aThread )
-    {
-    CMemSpyEngine& engine = iProcess->Engine();
-    RMemSpyDriverClient& driver = engine.Driver();
-    const TInt error = driver.OpenThread( iId, aThread );
-    return error;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThread::Name() const
-    {
-    // Just return the pure name, minus the leading tab
-    TPtrC pRet( iName->Mid(2) );
-    
-    // Find the last tab position
-    TInt pos = pRet.Locate(TChar('\t'));
-    if  ( pos > 0 )
-        {
-        pRet.Set( pRet.Left( pos ) );
-        }
-    //    
-    return pRet;
-    }
-
-
-EXPORT_C TFullName CMemSpyThread::FullName() const
-    {
-    TFullName name( iProcess->Name() );
-    name += KMemSpyThreadDoubleColon;
-    name += Name();
-    //
-    return name;
-    }
-
-
-EXPORT_C TBool CMemSpyThread::IsSystemPermanent() const
-    {
-    const TBool ret = ( iFlags & KThreadFlagSystemPermanent );
-    return ret;
-    }
-
-
-EXPORT_C TBool CMemSpyThread::IsSystemCritical() const
-    {
-    const TBool ret = ( iFlags & KThreadFlagSystemCritical );
-    return ret;
-    }
-
-
-EXPORT_C CMemSpyThreadInfoContainer& CMemSpyThread::InfoContainerL()
-    {
-    if  ( iInfoContainer == NULL )
-        {
-        const TBool KConstructAsynchronously = ETrue;
-        iInfoContainer = CMemSpyThreadInfoContainer::NewL( *this, KConstructAsynchronously );
-        }
-    //
-    return *iInfoContainer;
-    }
-
-
-EXPORT_C CMemSpyThreadInfoContainer& CMemSpyThread::InfoContainerForceSyncronousConstructionL()
-    {
-    if  ( iInfoContainer == NULL )
-        {
-        const TBool KConstructSynchronously = EFalse;
-        iInfoContainer = CMemSpyThreadInfoContainer::NewL( *this, KConstructSynchronously );
-        }
-    //
-    return *iInfoContainer;
-    }
-
-
-EXPORT_C void CMemSpyThread::KillL()
-    {
-    CMemSpyEngine& engine = iProcess->Engine();
-    RMemSpyDriverClient& driver = engine.Driver();
-    //
-    User::LeaveIfError( driver.ThreadEnd( Id(), EExitKill ) );
-    }
-
-
-EXPORT_C void CMemSpyThread::TerminateL()
-    {
-    CMemSpyEngine& engine = iProcess->Engine();
-    RMemSpyDriverClient& driver = engine.Driver();
-    //
-    User::LeaveIfError( driver.ThreadEnd( Id(), EExitTerminate ) );
-    }
-
-
-EXPORT_C void CMemSpyThread::PanicL()
-    {
-    CMemSpyEngine& engine = iProcess->Engine();
-    RMemSpyDriverClient& driver = engine.Driver();
-    //
-    User::LeaveIfError( driver.ThreadEnd( Id(), EExitPanic ) );
-    }
-
-
-EXPORT_C void CMemSpyThread::SetPriorityL( TThreadPriority aPriority )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThread::SetPriorityL() - START - aPriority: %d, orig pri: %d", aPriority, iPriority );
-#endif
-    CMemSpyEngine& engine = iProcess->Engine();
-    RMemSpyDriverClient& driver = engine.Driver();
-    //
-    const TInt err = driver.SetPriority( Id(), aPriority );
-#ifdef _DEBUG
-    TInt newPri = -1;
-    RThread thread;
-    if ( driver.OpenThread( iId, thread ) == KErrNone )
-        {
-        newPri = thread.Priority();
-        thread.Close();
-        }
-    RDebug::Printf( "CMemSpyThread::SetPriorityL() - err: %d, newPri: %d", err, newPri );
-#endif
-
-    User::LeaveIfError( err );
-    RefreshL();
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThread::SetPriorityL() - END" );
-#endif
-    }
-
-
-void CMemSpyThread::SetDeadL()
-    {
-    RefreshL();
-    }
-
-
-void CMemSpyThread::SetDeadL( const RThread& aThread )
-    {
-    RefreshL( aThread );
-	}
-
-
-void CMemSpyThread::FullName( TDes& aName ) const
-    {
-    iProcess->FullName( aName );
-    aName.Append( KMemSpyThreadDoubleColon );
-    aName.Append( Name() );
-    }
-
-
-EXPORT_C TBool CMemSpyThread::IsDead() const
-    {
-    const TBool isDead = ( iExitType != EExitPending );
-    return  isDead;
-    }
-
-EXPORT_C TThreadPriority CMemSpyThread::Priority() const
-	{
-	return iPriority;
-	}
-
-
-void CMemSpyThread::RefreshL()
-    {
-    CMemSpyEngine& engine = iProcess->Engine();
-    RMemSpyDriverClient& driver = engine.Driver();
-    
-    // Try to open thread. We use the device driver since
-    // it doesn't check (i.e. it bypasses) some of the conditions which the
-    // default RThread::Open() implementation enforces...
-    //
-    // Deliberately ignore error. The other overload of RefreshL will
-    // cope with the failure.
-    RThread thread;
-    driver.OpenThread( iId, thread );
-    CleanupClosePushL( thread );
-
-    // Call refresh with thread to perform actual heavy lifting...
-    RefreshL( thread );
-
-    // Clean up. This thread handle might actually not even be open, but that's okay...
-    CleanupStack::PopAndDestroy( &thread );
-    }
-
-
-void CMemSpyThread::RefreshL( const RThread& aThread )
-    {
-    const TBool handleValid = aThread.Handle() != KNullHandle;
-    if  ( handleValid )
-        {
-        // Annoyingly, we request the entire thread info structure just to get the thread flags...
-        iFlags = 0;
-        const User::TCritical critType = User::Critical( aThread );
-        if  ( critType == User::ESystemPermanent )
-            {
-            iFlags |= KThreadFlagSystemPermanent;
-            }
-        else if ( critType == User::ESystemCritical )
-            {
-            iFlags |= KThreadFlagSystemCritical;
-            }
-
-#ifdef _DEBUG
-        TMemSpyDriverThreadInfo threadInfo;
-        User::LeaveIfError( iProcess->Engine().Driver().GetThreadInfo( iId, threadInfo ) );
-        RDebug::Print( _L("CMemSpyThread::RefreshL() - old user pri: %d, curr user pri: %d, curr kernel pri: %d, iFlags: %d, name: %S"), iPriority, aThread.Priority(), threadInfo.iThreadPriority, iFlags, &threadInfo.iFullName );
-#endif
-        }
-
-    // Get exit info
-    iExitType = handleValid ? aThread.ExitType() : EExitKill;
-    iPriority = handleValid ? aThread.Priority() : EPriorityNormal;
-
-    // If the thread is dead then we may not be able to get some attributes
-    // (it depends on whether the thread handle is valid anymore).
-    iExitReason = 0;
-    iExitCategory.Zero();
-
-    if  ( IsDead() )
-        {
-        if  ( handleValid )
-            {
-            iExitReason = aThread.ExitReason();
-            iExitCategory = aThread.ExitCategory(); 
-            }
-        else
-            {
-            iExitCategory = KMemSpyUnknownExitCategory;
-            }
-        }
-    else
-        {
-        }
-
-    // Get raw thread name
-    HBufC* rawThreadName = GetThreadNameLC( aThread ); 
-
-    // Full name is enough for the thread name as well as the extra info
-    // we show
-    TFullName name;
-
-    // Build S60 listbox formatted name
-    _LIT( KMemSpyThreadNameFormatSpecBasicName, " \t%S\t\t" );
-    name.Format( KMemSpyThreadNameFormatSpecBasicName, rawThreadName );
-    CleanupStack::PopAndDestroy( rawThreadName );
-
-    // If the thread is dead show exit info
-    if  ( IsDead() )
-        {
-        AppendExitInfo( name, iExitType, iExitReason, iExitCategory );
-        }
-    else
-        {
-        // Otherwise, show priority
-        AppendPriority( name, iPriority );
-        }
-
-    // Save new fully formatted name
-    HBufC* newName = name.AllocL();
-    delete iName;
-    iName = newName;
-    }
-
-
-HBufC* CMemSpyThread::GetThreadNameLC( const RThread& aThreadOrNull ) const
-    {
-    TName threadName;
-    //
-    const TBool handleValid = aThreadOrNull.Handle() != KNullHandle;
-    //
-    if  ( handleValid )
-        {
-        // Easy case - we have a valid thread handle.
-        threadName.Append( aThreadOrNull.Name() );
-        }
-    else
-        {
-        // Since we don't have the possibility to enquire after the thread's name
-        // we'll assume that it used to be alive and therefore at some point we did
-        // manage to grep it's name...
-        if  ( iName )
-            {
-            const TPtrC pOriginalName( Name() );
-            threadName.Append( pOriginalName );
-            }
-        else
-            {
-            // Don't have a thread handle, don't have any possibility to get the
-            // name from a prior cached version. Must use "unknown"
-            threadName.Append( KMemSpyUnknownThreadName );
-            }
-        }
-    //
-    HBufC* ret = threadName.AllocLC();
-    return ret;
-    }
-
-
-
--- a/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoContainer.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,355 +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 <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-
-// System includes
-#include <e32svr.h>
-
-// User includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-
-
-
-CMemSpyThreadInfoContainer::CMemSpyThreadInfoContainer( CMemSpyThread& aThread )
-:   CMemSpyEngineObject( aThread ), iThread( &aThread )
-    {
-    }
-
-
-CMemSpyThreadInfoContainer::~CMemSpyThreadInfoContainer()
-    {
-    CloseAllInfoItems();
-    //
-    iItems.Close();
-    iObservers.Close();
-    }
-
-
-void CMemSpyThreadInfoContainer::ConstructItemByTypeL( TBool aAsync, TMemSpyThreadInfoItemType aType )
-    {
-    CMemSpyThreadInfoItemBase* item = NULL;
-    //
-    switch( aType )
-        {
-    case EMemSpyThreadInfoItemTypeGeneralInfo:
-        item = CMemSpyThreadInfoGeneral::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeHeap:
-        item = CMemSpyThreadInfoHeap::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeStack:
-        item = CMemSpyThreadInfoStack::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeChunk:
-        item = CMemSpyThreadInfoChunk::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeCodeSeg:
-        item = CMemSpyThreadInfoCodeSeg::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeOpenFiles:
-        item = CMemSpyThreadInfoOpenFiles::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeActiveObject:
-        item = CMemSpyThreadInfoActiveObjects::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeServer:
-        item = CMemSpyThreadInfoServer::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeSession:
-        item = CMemSpyThreadInfoSession::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeSemaphore:
-        item = CMemSpyThreadInfoSemaphore::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeMutex:
-        item = CMemSpyThreadInfoMutex::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeTimer:
-        item = CMemSpyThreadInfoTimer::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeLDD:
-        item = CMemSpyThreadInfoLDD::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypePDD:
-        item = CMemSpyThreadInfoPDD::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeLogicalChannel:
-        item = CMemSpyThreadInfoLogicalChannel::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeChangeNotifier:
-        item = CMemSpyThreadInfoChangeNotifier::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeUndertaker:
-        item = CMemSpyThreadInfoUndertaker::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeOwnedThreadHandles:
-        item = CMemSpyThreadInfoOwnedThreadHandles::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeOwnedProcessHandles:
-        item = CMemSpyThreadInfoOwnedProcessHandles::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeOtherThreads:
-        item = CMemSpyThreadInfoOtherThreads::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeOtherProcesses:
-        item = CMemSpyThreadInfoOtherProcesses::NewLC( *this, aAsync );
-        break;
-    case EMemSpyThreadInfoItemTypeMemoryTracking:
-        item = CMemSpyThreadInfoMemoryTracking::NewLC( *this, aAsync );
-        break;
-    default:
-    case EMemSpyThreadInfoItemTypeMessageQueue:
-    case EMemSpyThreadInfoItemTypeConditionalVariable:
-        break;
-        }
-    //
-    if  ( item )
-        {
-        iItems.AppendL( item );
-        CleanupStack::Pop( item );
-        }
-    }
-
-
-void CMemSpyThreadInfoContainer::ConstructL( TBool aAsync )
-    {
-    for( TInt type = EMemSpyThreadInfoItemTypeFirst; type<EMemSpyThreadInfoItemTypeLast; type++ )
-        {
-        const TMemSpyThreadInfoItemType realType = static_cast< TMemSpyThreadInfoItemType >( type );
-        ConstructItemByTypeL( aAsync, realType );
-        }
-    }
-
-
-CMemSpyThreadInfoContainer* CMemSpyThreadInfoContainer::NewL( CMemSpyThread& aThread, TBool aAsync )
-    {
-    CMemSpyThreadInfoContainer* self = CMemSpyThreadInfoContainer::NewLC( aThread, aAsync );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-CMemSpyThreadInfoContainer* CMemSpyThreadInfoContainer::NewLC( CMemSpyThread& aThread, TBool aAsync )
-    {
-    CMemSpyThreadInfoContainer* self = new(ELeave) CMemSpyThreadInfoContainer( aThread );
-    CleanupStack::PushL( self );
-    self->ConstructL( aAsync );
-    return self;
-    }
-
-
-CMemSpyThreadInfoContainer* CMemSpyThreadInfoContainer::NewLC( CMemSpyThread& aThread, TMemSpyThreadInfoItemType aSpecificType )
-    {
-    CMemSpyThreadInfoContainer* self = new(ELeave) CMemSpyThreadInfoContainer( aThread );
-    CleanupStack::PushL( self );
-    self->ConstructItemByTypeL( EFalse, aSpecificType );
-    return self;
-    }
-
-
-void CMemSpyThreadInfoContainer::AddItemL( TMemSpyThreadInfoItemType aType )
-    {
-    const TInt index = InfoItemIndexByType( aType );
-    if  ( index == KErrNotFound )
-        {
-        ConstructItemByTypeL( EFalse, aType );
-        }
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoContainer::Open()
-    {
-    if  ( !OpenOrCloseInProgress() )
-        {
-        SetOpenOrCloseInProgress( ETrue );
-        CMemSpyEngineObject::Open();
-        SetOpenOrCloseInProgress( EFalse );
-        }
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoContainer::Close()
-    {
-    if  ( !OpenOrCloseInProgress() )
-        {
-        SetOpenOrCloseInProgress( ETrue );
-        CMemSpyEngineObject::Close();
-        SetOpenOrCloseInProgress( EFalse );
-        }
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoContainer::PrintL()
-    {
-    _LIT( KMemSpyFolder, "ThreadInfo" );
-    _LIT( KMemSpyContext, "ThreadInfo - %S" );
-    //
-    CMemSpyEngine& engine = Engine();
-    CMemSpyEngineOutputSink& sink = engine.Sink();
-    //
-    TFullName fullName( iThread->FullName() );
-    HBufC* context = HBufC::NewLC( KMaxFileName * 2 );
-    TPtr pContext( context->Des() );
-    pContext.Format( KMemSpyContext, &fullName );
-    sink.DataStreamBeginL( pContext, KMemSpyFolder );
-    CleanupStack::PopAndDestroy( context );
-    //
-    sink.OutputSectionHeadingL( fullName, TChar('=') );
-    sink.OutputBlankLineL();
-    //
-    const TInt count = iItems.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        CMemSpyThreadInfoItemBase* item = iItems[ i ];
-        item->PrintL();
-        }
-    //
-    sink.OutputBlankLineL();
-    sink.DataStreamEndL();
-    }
-
-
-EXPORT_C TInt CMemSpyThreadInfoContainer::MdcaCount() const
-    {
-    return iItems.Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoContainer::MdcaPoint( TInt aIndex ) const
-    {
-    return iItems[ aIndex ]->Name();
-    }
-
-
-EXPORT_C CMemSpyEngine& CMemSpyThreadInfoContainer::Engine() const
-    {
-    return iThread->Engine();
-    }
-
-
-EXPORT_C CMemSpyThreadInfoItemBase& CMemSpyThreadInfoContainer::Item( TInt aIndex )
-    {
-    return *iItems[ aIndex ];
-    }
-
-
-EXPORT_C CMemSpyThreadInfoItemBase& CMemSpyThreadInfoContainer::Item( TMemSpyThreadInfoItemType aType )
-    {
-    const TInt index = InfoItemIndexByType( aType );
-    CMemSpyThreadInfoItemBase* ret = iItems[ index ];
-    __ASSERT_ALWAYS( ret != NULL, User::Invariant() );
-    return *ret;
-    }
-
-
-EXPORT_C TInt CMemSpyThreadInfoContainer::InfoItemIndexByType( TMemSpyThreadInfoItemType aType )
-    {
-    TInt index = KErrNotFound;
-    //
-    const TInt count = iItems.Count();
-    for(TInt i=0; i<count; i++)
-        {
-        CMemSpyThreadInfoItemBase* item = iItems[ i ];
-        if  ( item->Type() == aType )
-            {
-            index = i;
-            break;
-            }
-        }
-    //
-    return index;
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoContainer::ObserverAddL( MMemSpyThreadInfoContainerObserver& aObserver )
-    {
-    const TInt count = iObservers.Count();
-    for(TInt i=count-1; i>=0; i--)
-        {
-        MMemSpyThreadInfoContainerObserver* observer = iObservers[ i ];
-        if  ( observer == &aObserver )
-            {
-            return;
-            }
-        }
-
-    iObservers.AppendL( &aObserver );
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoContainer::ObserverRemove( MMemSpyThreadInfoContainerObserver& aObserver )
-    {
-    const TInt count = iObservers.Count();
-    for(TInt i=count-1; i>=0; i--)
-        {
-        MMemSpyThreadInfoContainerObserver* observer = iObservers[ i ];
-        if  ( observer == &aObserver )
-            {
-            iObservers.Remove( i );
-            break;
-            }
-        }
-    }
-
-
-void CMemSpyThreadInfoContainer::NotifyObserverL( MMemSpyThreadInfoContainerObserver::TEvent aEvent, TMemSpyThreadInfoItemType aType )
-    {
-    if  ( aEvent == MMemSpyThreadInfoContainerObserver::EInfoItemDestroyed )
-        {
-        // Make sure we remove dead item
-        const TInt index = InfoItemIndexByType( aType );
-        if  ( index >= 0 )
-            {
-            iItems.Remove( index );
-            }
-        }
-        
-    const TInt count = iObservers.Count();
-    for(TInt i=count-1; i>=0; i--)
-        {
-        MMemSpyThreadInfoContainerObserver* observer = iObservers[ i ];
-        observer->HandleMemSpyEngineInfoContainerEventL( aEvent, aType );
-        }
-    }
-
-
-void CMemSpyThreadInfoContainer::OpenAllInfoItems()
-    {
-    const TInt count = iItems.Count();
-    for(TInt i=count-1; i>=0; i--)
-        {
-        CMemSpyThreadInfoItemBase* item = iItems[ i ];
-        item->Open();
-        }
-    }
-
-
-void CMemSpyThreadInfoContainer::CloseAllInfoItems()
-    {
-    const TInt count = iItems.Count();
-    for(TInt i=count-1; i>=0; i--)
-        {
-        CMemSpyThreadInfoItemBase* item = iItems[ i ];
-        item->Close();
-        }
-    }
-
--- a/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3432 +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 <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-
-// System includes
-#include <f32file.h>
-#include <hal.h>
-#include <kernel/arm/arm_types.h>
-#include <memspy/driver/memspydriverclient.h>
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include <memspy/engine/memspyenginehelperactiveobject.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-
-// User includes
-#include "MemSpyEngineOutputListItem.h"
-
-// Constants
-const TInt KMemSpyNumericFormatBufferSize = 20;
-
-// Literal constants
-_LIT( KMemSpyNumericHexFormat, "0x%08x" );
-_LIT( KMemSpyNumericDecFormat, "%d" );
-_LIT( KMemSpyNumericLongFormat, "%Ld" );
-_LIT( KMemSpyCaptionYes, "Yes" );
-_LIT( KMemSpyCaptionNo, "No" );
-_LIT( KMemSpyCaptionOn, "On" );
-_LIT( KMemSpyCaptionOff, "Off" );
-_LIT( KMemSpyUnavailable, "Unavailable" );
-_LIT( KMemSpyDead, "Dead" );
-_LIT( KMemSpyNoItems, "(No items)" );
-
-
-
-CMemSpyThreadInfoItemBase::CMemSpyThreadInfoItemBase( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aType, TBool aAsyncConstruction )
-:   CMemSpyEngineObject( aContainer ), iContainer( aContainer ), iCallBack( CActive::EPriorityLow ), iType( aType )
-    {
-    if  ( aAsyncConstruction )
-        {
-        TCallBack callBackMethod( CallConstructL, this );
-        iCallBack.Set( callBackMethod );
-        iCallBack.CallBack();
-        }
-    }
-
-
-CMemSpyThreadInfoItemBase::~CMemSpyThreadInfoItemBase()
-    {
-    TRAP_IGNORE( iContainer.NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemDestroyed, iType ) );
-    //
-    iItems.ResetAndDestroy();
-    iItems.Close();
-    }
-
-
-TInt CMemSpyThreadInfoItemBase::CallConstructL( TAny* aSelf )
-    {
-    CMemSpyThreadInfoItemBase* self = reinterpret_cast< CMemSpyThreadInfoItemBase* >( aSelf );
-    self->iReady = EFalse;
-    
-    // Don't try to refresh dead thread
-    TInt err = KErrNone;
-    if ( !self->Container().Thread().IsDead() )
-        {
-        TRAP(err, self->ConstructL());
-        if  ( err != KErrNone )
-            {
-    #ifdef _DEBUG
-            RDebug::Printf( "CMemSpyThreadInfoItemBase::CallConstructL() - construction err: %d, iType: %d", err, self->iType );
-    #endif
-            self->AddItemL( KMemSpyUnavailable, KNullDesC );
-            self->iIsEmpty = ETrue;
-            }
-        else if ( self->MdcaCount() == 0 )
-            {
-            self->AddItemL( KMemSpyNoItems, KNullDesC );
-            self->iIsEmpty = ETrue;
-            }        
-        }
-    else
-        {
-        self->AddItemL( KMemSpyDead, KNullDesC );
-        self->iIsEmpty = ETrue;
-        }
-    //
-    self->iReady = ETrue;
-    return KErrNone;
-    }
-
-
-EXPORT_C TInt CMemSpyThreadInfoItemBase::MdcaCount() const
-    {
-    return iItems.Count();
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoItemBase::MdcaPoint( TInt aIndex ) const
-    {
-    CItem* item = iItems[ aIndex ];
-    return TPtrC( item->Combined() );
-    }
-
-EXPORT_C TPtrC CMemSpyThreadInfoItemBase::Caption(TInt aIndex ) const
-	{
-	CItem* item = iItems[ aIndex ];
-	return TPtrC( item->Caption() );
-	}
-
-EXPORT_C TPtrC CMemSpyThreadInfoItemBase::Value(TInt aIndex ) const
-	{
-	CItem* item = iItems[ aIndex ];
-	return TPtrC( item->Value() );
-	}
-
-EXPORT_C CMemSpyEngine& CMemSpyThreadInfoItemBase::Engine() const
-    {
-    return iContainer.Engine();
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoItemBase::PrintL()
-    {
-    const TInt count = iItems.Count();
-    if  ( count > 0 && !iIsEmpty )
-        {
-        CMemSpyEngine& engine = Engine();
-        CMemSpyEngineOutputSink& sink = engine.Sink();
-
-        HBufC* name = MemSpyEngineUtils::CleanupTextLC( Name() );
-        sink.OutputSectionHeadingL( *name, TChar('-') );
-        CleanupStack::PopAndDestroy( name );
-        sink.OutputPrefixSetLC( _L("  ") ); // Slight insertion
-
-        // First pass to get max lengths
-        TInt maxLengthCaption = 0;
-        TInt maxLengthValue = 0;
-
-        for( TInt j=0; j<count; j++ )
-            {
-            const CItem* item = iItems[ j ];
-            maxLengthCaption = Max( maxLengthCaption, item->Caption().Length() );
-            maxLengthValue = Max( maxLengthValue, item->Value().Length() );
-            }
-
-        // Second pass - real this time - to print the values
-        HBufC* line = HBufC::NewLC( ( maxLengthCaption + maxLengthValue ) + 20 );
-        TPtr pLine( line->Des() );
-        //
-        for( TInt i=0; i<count; i++ )
-            {
-            const CItem* item = iItems[ i ];
-
-            // Remove initial tabs in caption
-            HBufC* caption = MemSpyEngineUtils::CleanupTextLC( item->Caption() );
-        
-            // Create value item & replace any further tabs
-            HBufC* value = MemSpyEngineUtils::CleanupTextLC( item->Value() );
-
-            // Now format the final line, with padding.
-            pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') );
-            pLine.Append( *value );
-            CleanupStack::PopAndDestroy( 2, caption );
-
-            // Sink output
-            sink.OutputLineL( pLine );
-            }
-        //
-        CleanupStack::PopAndDestroy( line );
-        sink.OutputBlankLineL();
-        CleanupStack::PopAndDestroy(); // clear prefix
-        }
-    }
-
-
-
-void CMemSpyThreadInfoItemBase::AddItemL( const TDesC& aCaption, const TDesC& aValue )
-    {
-    CItem* item = CItem::NewLC( aCaption, aValue );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyThreadInfoItemBase::AddItemHexL( const TDesC& aCaption, TUint aValue )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    val.Format( KMemSpyNumericHexFormat, aValue );
-    AddItemL( aCaption, val );
-    }
-
-
-void CMemSpyThreadInfoItemBase::AddItemDecimalL( const TDesC& aCaption, TInt aValue )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    val.Format( KMemSpyNumericDecFormat, aValue );
-    AddItemL( aCaption, val );
-    }
-
-
-void CMemSpyThreadInfoItemBase::AddItemLongL( const TDesC& aCaption, const TInt64& aValue )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    val.Format( KMemSpyNumericLongFormat, aValue );
-    AddItemL( aCaption, val );
-    }
-
-
-void CMemSpyThreadInfoItemBase::AddItemYesNoL( const TDesC& aCaption, TBool aYes )
-    {
-    CItem* item = CItem::NewYesNoLC( aCaption, aYes );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyThreadInfoItemBase::AddItemOnOffL( const TDesC& aCaption, TBool aOn )
-    {
-    CItem* item = CItem::NewOnOffLC( aCaption, aOn );
-    iItems.AppendL( item );
-    CleanupStack::Pop( item );
-    }
-
-
-void CMemSpyThreadInfoItemBase::AddItemPercentageL( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue )
-    {
-    const TMemSpyPercentText val( MemSpyEngineUtils::FormatPercentage( TReal( aOneHundredPercentValue ), TReal( aValue ) ) );
-    AddItemL( aCaption, val );
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoItemBase::RebuildL()
-    {
-    Reset();
-    CallConstructL( this );
-    }
-
-
-EXPORT_C TBool CMemSpyThreadInfoItemBase::IsReady() const
-    {
-    return iReady;
-    }
-
-
-EXPORT_C TMemSpyThreadInfoItemType CMemSpyThreadInfoItemBase::Type() const
-    {
-    return iType;
-    }
-
-
-void CMemSpyThreadInfoItemBase::Reset()
-    {
-    iItems.ResetAndDestroy();
-    }
-
-
-void CMemSpyThreadInfoItemBase::StripProcessAndThreadNames( TDes& aText )
-    {
-    StripProcessName( aText );
-    StripThreadName( aText );
-    }
-
-
-void CMemSpyThreadInfoItemBase::StripProcessName( TDes& aText )
-    {
-    CMemSpyProcess& process = Container().Thread().Process();
-    const TPtrC processName( process.Name() );
-    TFullName temp;
-    //
-    _LIT( KProcessNameUidFormat1, "%S.exe[%08x]" );
-    temp.Format( KProcessNameUidFormat1, &processName, process.SID() );
-    const TBool stripped = MemSpyEngineUtils::StripText( aText, temp );
-    //
-    if  ( stripped == EFalse )
-        {
-        _LIT( KProcessNameUidFormat2, "%S[%08x]" );
-        temp.Format( KProcessNameUidFormat2, &processName, process.SID() );
-        MemSpyEngineUtils::StripText( aText, temp );
-        }
-    }
-
-
-void CMemSpyThreadInfoItemBase::StripThreadName( TDes& aText )
-    {
-    CMemSpyThread& thread = Container().Thread();
-    const TPtrC threadName( thread.Name() );
-    const TBool stripped = MemSpyEngineUtils::StripText( aText, threadName );
-    (void) stripped;
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem& CMemSpyThreadInfoItemBase::Item( TInt aIndex )
-    {
-    CItem* item = iItems[ aIndex ];
-    return *item;
-    }
-
-
-const CMemSpyThreadInfoItemBase::CItem& CMemSpyThreadInfoItemBase::Item( TInt aIndex ) const
-    {
-    const CItem* item = iItems[ aIndex ];
-    return *item;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoItemBase::CItem::CItem()
-    {
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem::~CItem()
-    {
-    delete iCaption;
-    delete iValue;
-    delete iCombined;
-    }
-
-
-void CMemSpyThreadInfoItemBase::CItem::ConstructL( const TDesC& aCaption, const TDesC& aValue )
-    {
-    iCaption = aCaption.AllocL();
-    iValue = aValue.AllocL();
-    //
-    UpdateCombinedL();
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLC( const CItem& aCopyMe )
-    {
-    CItem* self = new(ELeave) CItem();
-    CleanupStack::PushL( self );
-    self->ConstructL( aCopyMe.Caption(), aCopyMe.Value() );
-    return self;
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLC( const TDesC& aCaption )
-    {
-    CItem* self = new(ELeave) CItem();
-    CleanupStack::PushL( self );
-    self->ConstructL( aCaption, KNullDesC );
-    return self;
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLC( const TDesC& aCaption, const TDesC& aValue )
-    {
-    CItem* self = new(ELeave) CItem();
-    CleanupStack::PushL( self );
-    self->ConstructL( aCaption, aValue );
-    return self;
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewHexLC( const TDesC& aCaption, TUint aValue )
-    {
-    CItem* ret = CItem::NewLC( aCaption );
-    ret->SetHexL( aValue );
-    return ret;
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewDecimalLC( const TDesC& aCaption, TInt aValue )
-    {
-    CItem* ret = CItem::NewLC( aCaption );
-    ret->SetDecimalL( aValue );
-    return ret;
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLongLC( const TDesC& aCaption, const TInt64& aValue )
-    {
-    CItem* ret = CItem::NewLC( aCaption );
-    ret->SetLongL( aValue );
-    return ret;
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewYesNoLC( const TDesC& aCaption, TBool aYes )
-    {
-    CItem* ret = CItem::NewLC( aCaption );
-    ret->SetYesNoL( aYes );
-    return ret;
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewOnOffLC( const TDesC& aCaption, TBool aOn )
-    {
-    CItem* ret = CItem::NewLC( aCaption );
-    ret->SetOnOffL( aOn );
-    return ret;
-    }
-
-
-CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewPercentageLC( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue )
-    {
-    CItem* ret = CItem::NewLC( aCaption );
-    ret->SetPercentageL( aOneHundredPercentValue, aValue );
-    return ret;
-    }
-
-
-void CMemSpyThreadInfoItemBase::CItem::SetValueL( const TDesC& aValue )
-    {
-    if  ( iValue == NULL )
-        {
-        iValue = aValue.AllocL();
-        }
-    else
-        {
-        if  ( iValue->Des().MaxLength() < aValue.Length() )
-            {
-            iValue = iValue->ReAllocL( aValue.Length() );
-            }
-            
-        // Now its safe to assign new content
-        *iValue = aValue;
-        }
-        
-    UpdateCombinedL();
-    }
-
-
-void CMemSpyThreadInfoItemBase::CItem::SetHexL( TUint aValue )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    val.Format( KMemSpyNumericHexFormat, aValue );
-    SetValueL( val );
-    }
-
-
-void CMemSpyThreadInfoItemBase::CItem::SetDecimalL( TInt aValue )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    val.Format( KMemSpyNumericDecFormat, aValue );
-    SetValueL( val );
-    }
-
-
-void CMemSpyThreadInfoItemBase::CItem::SetLongL( const TInt64& aValue )
-    {
-    TBuf<KMemSpyNumericFormatBufferSize> val;
-    val.Format( KMemSpyNumericLongFormat, aValue );
-    SetValueL( val );
-    }
-
-
-void CMemSpyThreadInfoItemBase::CItem::SetYesNoL( TBool aYes )
-    {
-    if  ( aYes )
-        {
-        SetValueL( KMemSpyCaptionYes );
-        }
-    else
-        {
-        SetValueL( KMemSpyCaptionNo );
-        }
-    }
-
-
-void CMemSpyThreadInfoItemBase::CItem::SetOnOffL( TBool aOn )
-    {
-    if  ( aOn )
-        {
-        SetValueL( KMemSpyCaptionOn );
-        }
-    else
-        {
-        SetValueL( KMemSpyCaptionOff );
-        }
-    }
-
-
-void CMemSpyThreadInfoItemBase::CItem::SetPercentageL( TInt aOneHundredPercentValue, TInt aValue )
-    {
-    const TMemSpyPercentText val( MemSpyEngineUtils::FormatPercentage( TReal( aOneHundredPercentValue ), TReal( aValue ) ) );
-    SetValueL( val );
-    }
-
-
-void CMemSpyThreadInfoItemBase::CItem::UpdateCombinedL()
-    {
-    const TInt requiredLength = Caption().Length() + Value().Length() + 10;
-    //
-    if  ( iCombined == NULL )
-        {
-        iCombined = HBufC::NewL( requiredLength );
-        }
-    else if ( iCombined->Des().MaxLength() < requiredLength )
-        {
-        iCombined = iCombined->ReAllocL( requiredLength );
-        }
-        
-    TPtr pCombined( iCombined->Des() );
-    pCombined.Zero();
-    pCombined.Append( _L("\t") );
-    pCombined.Append( Caption() );
-    pCombined.Append( _L("\t\t") );
-    pCombined.Append( Value() );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoGeneral::CMemSpyThreadInfoGeneral( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeGeneralInfo, aAsyncConstruction )
-    {
-    }
-
-
-void CMemSpyThreadInfoGeneral::ConstructL()
-    {
-    TBuf<50> temp;
-    RThread thread;
-    Container().Thread().OpenLC( thread );
-    const CMemSpyProcess& process = Container().Thread().Process();
-
-    _LIT( KItem1, "Thread Id" );
-    AddItemLongL( KItem1, thread.Id() );
-
-    _LIT( KItem1a, "Process Id" );
-    AddItemLongL( KItem1a, (TUint) process.Id() );
-  
-    _LIT( KItem1b, "SID" );
-    AddItemHexL( KItem1b, process.SID() );
-  
-    _LIT( KItem1c, "VID" );
-    AddItemHexL( KItem1c, process.VID() );
-
-    _LIT( KItem2, "Thread Priority" );
-    CMemSpyThread::AppendPriority( temp, thread.Priority() );
-    AddItemL( KItem2, temp );
-    temp.Zero();
-   
-    _LIT( KItem3, "Process Priority" );
-    CMemSpyProcess::AppendPriority( temp, thread.ProcessPriority() );
-    AddItemL( KItem3, temp );
-    temp.Zero();
-   
-    _LIT( KItem4, "Request Count" );
-    AddItemDecimalL( KItem4, thread.RequestCount() );
-   
-    TInt processHandleCount = 0;
-    TInt threadHandleCount = 0;
-    thread.HandleCount( processHandleCount, threadHandleCount );
-
-    _LIT( KItem5a, "Process Handles" );
-    AddItemDecimalL( KItem5a, processHandleCount );
-
-    _LIT( KItem5b, "Thread Handles" );
-    AddItemDecimalL( KItem5b, threadHandleCount );
-
-    // Thread handle info
-    THandleInfo handleInfo;
-    thread.HandleInfo( &handleInfo );
-
-    _LIT( KItem5c, "Num. Proc. (Using)" );
-    AddItemDecimalL( KItem5c, handleInfo.iNumProcesses );
-
-    _LIT( KItem5d, "Num. Thread (Using)" );
-    AddItemDecimalL( KItem5d, handleInfo.iNumThreads );
-
-    _LIT( KItem5e, "Attributes" );
-    AddItemDecimalL( KItem5e, thread.Attributes() );
-    
-    // CPU time (request special kernel build)
-    TTimeIntervalMicroSeconds cpuTime;
-    if  ( thread.GetCpuTime( cpuTime ) == KErrNone )
-        {
-        _LIT( KItem5f, "CPU Time (us)" );
-        const TInt64 time = cpuTime.Int64();
-        AddItemLongL( KItem5f, time );
-        }
-
-    // Exit info
-    _LIT( KItem6, "Exit Type" );
-    CMemSpyThread::AppendExitType( temp, thread.ExitType() );
-    AddItemL( KItem6, temp );
-    temp.Zero();
-
-    if  ( thread.ExitType() != EExitPending )
-        {
-        _LIT( KItem7, "Exit Reason" );
-        AddItemDecimalL( KItem7, thread.ExitReason() );
-
-        _LIT( KItem8, "Exit Category" );
-        const TExitCategoryName cat( thread.ExitCategory() );
-        AddItemL( KItem8, cat );
-        }
-
-    // Registers
-    MakeRegisterListingL( thread );
-    
-    CleanupStack::PopAndDestroy( &thread );
-
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-    }
-
-
-CMemSpyThreadInfoGeneral* CMemSpyThreadInfoGeneral::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoGeneral* self = new(ELeave) CMemSpyThreadInfoGeneral( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoGeneral::Name() const
-    {
-    _LIT(KName, "\tGeneral");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoGeneral::MakeRegisterListingL( RThread& aThread )
-    {
-#ifndef __WINS__
-    _LIT(KRegFormatGeneral, "R%02d");
-    _LIT(KRegFormatSP, "SP");
-    _LIT(KRegFormatLR, "LR");
-    _LIT(KRegFormatPC, "PC");
-    _LIT(KRegFormatFlags, "Flags");
-    _LIT(KRegFormatDACR, "DACR"); // Data access control register
-    //
-    TArmRegSet regList;
-    TPckg<TArmRegSet> pRegList( regList );
-    //
-    aThread.Context( pRegList );
-	TArmReg* pReg = reinterpret_cast<TArmReg*>( &regList );
-    //
-    for( TInt i=0; i<KArmRegisterCount; i++ )
-        {
-        const TArmReg regValue = pReg[ i ];
-        //
-        if  ( i <= EArmR12 )
-            {
-            TBuf<128> buf;
-            buf.Format( KRegFormatGeneral, i );
-            AddItemHexL( buf, regValue );
-            }
-        else
-            {
-            TPtrC pCaption( KRegFormatGeneral );
-            //
-            if  ( i == EArmSp )
-                {
-                pCaption.Set( KRegFormatSP );
-                }
-            else if ( i == EArmLr )
-                {
-                pCaption.Set( KRegFormatLR );
-                }
-            else if ( i == EArmPc )
-                {
-                pCaption.Set( KRegFormatPC );
-                }
-            else if ( i == EArmFlags )
-                {
-                pCaption.Set( KRegFormatFlags );
-                }
-            else if ( i == EArmDacr )
-                {
-                pCaption.Set( KRegFormatDACR );
-                }
-            //
-            AddItemHexL( pCaption, regValue );
-            }
-        }
-#else
-    (void) aThread;
-#endif
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoHeap::CMemSpyThreadInfoHeap( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeHeap, aAsyncConstruction )
-    {
-    }
-
-
-void CMemSpyThreadInfoHeap::ConstructL()
-    {
-    CMemSpyEngineHelperHeap& heapHelper = Engine().HelperHeap();
-
-    // Get heap info first of all
-    TMemSpyHeapInfo info;
-    heapHelper.GetHeapInfoUserL( Container().Thread().Process().Id(), Container().Thread().Id(), info );
-    CMemSpyEngineOutputList* list = heapHelper.NewHeapSummaryShortLC( info );
-
-    // Now add each item to our view
-    const TInt count = list->Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const CMemSpyEngineOutputListItem& item = list->Item( i );
-        //
-        AddItemL( item.Caption(), item.Value() );
-        }
-
-    // Tidy up
-    CleanupStack::PopAndDestroy( list );
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-    }
-
-
-CMemSpyThreadInfoHeap* CMemSpyThreadInfoHeap::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoHeap* self = new(ELeave) CMemSpyThreadInfoHeap( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoHeap::Name() const
-    {
-    _LIT(KName, "\tHeap");
-    return TPtrC( KName );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoActiveObjects::CMemSpyThreadInfoActiveObjects( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeActiveObject, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoActiveObjects::~CMemSpyThreadInfoActiveObjects()
-    {
-    delete iItems;
-    }
-
-
-void CMemSpyThreadInfoActiveObjects::ConstructL()
-    {
-    CMemSpyEngine& engine = Container().Thread().Process().Engine();
-    engine.ProcessSuspendLC( Container().Thread().Process().Id() );
-    //
-    CMemSpyEngineActiveObjectArray* activeObjects = engine.HelperActiveObject().ActiveObjectListL( Container().Thread() );
-    delete iItems;
-    iItems = activeObjects;
-    //
-    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-    }
-
-
-CMemSpyThreadInfoActiveObjects* CMemSpyThreadInfoActiveObjects::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoActiveObjects* self = new(ELeave) CMemSpyThreadInfoActiveObjects( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoActiveObjects::Name() const
-    {
-    _LIT(KName, "\tActive Objects");
-    return TPtrC( KName );
-    }
-
-
-EXPORT_C TInt CMemSpyThreadInfoActiveObjects::MdcaCount() const
-    {
-    TInt count = 0;
-    //
-    if  ( iItems )
-        {
-        count = iItems->MdcaCount();
-        }
-    //
-    return count;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoActiveObjects::MdcaPoint(TInt aIndex) const
-    {
-    TPtrC ret( KNullDesC );
-    //
-    if  ( iItems )
-        {
-        ret.Set( iItems->MdcaPoint( aIndex ) );
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoOpenFiles::CMemSpyThreadInfoOpenFiles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeOpenFiles, aAsyncConstruction )
-    {
-    }
-
-
-void CMemSpyThreadInfoOpenFiles::ConstructL()
-    {
-    _LIT(KSpace, " ");
-    //
-    const TThreadId myThreadId = Container().Thread().Id();
-    CMemSpyEngine& engine = Container().Thread().Process().Engine();
-    RFs& fsSession = engine.FsSession();
-    //
-    TMemSpySizeText valueBuf;
-    TBuf<128> timeBuf;
-    TOpenFileScan scanner( fsSession );
-    //
-    CFileList* list = NULL;
-    scanner.NextL( list );
-
-    while( list != NULL )
-        {
-        if  ( scanner.ThreadId() == myThreadId )
-            {
-            CleanupStack::PushL( list );
-    
-            const TInt entryCount = list->Count();
-            for(TInt i=0; i<entryCount; i++)
-                {
-                const TEntry& entry = (*list)[ i ];
-
-                // Get time and size format strings
-                valueBuf = MemSpyEngineUtils::FormatSizeText( entry.iSize );
-                MemSpyEngineUtils::FormatTimeL( timeBuf, entry.iModified );
-                timeBuf.Insert( 0, KSpace );
-                timeBuf.Insert( 0, valueBuf );
-
-                // Get just file name
-                TParsePtrC parser( entry.iName );
-                const TPtrC pJustName( parser.NameAndExt() );
-
-                // Create item 
-                AddItemL( pJustName, timeBuf );
-                }
-
-            CleanupStack::Pop( list );
-            }
-
-        delete list;
-        list = NULL;
-        scanner.NextL( list );
-        }
-
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-    }
-
-
-CMemSpyThreadInfoOpenFiles* CMemSpyThreadInfoOpenFiles::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoOpenFiles* self = new(ELeave) CMemSpyThreadInfoOpenFiles( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoOpenFiles::Name() const
-    {
-    _LIT(KName, "\tOpen Files");
-    return TPtrC( KName );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoStack::CMemSpyThreadInfoStack( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeStack, aAsyncConstruction )
-    {
-    }
-
-
-void CMemSpyThreadInfoStack::ConstructL()
-    {
-    CMemSpyEngine& engine = Container().Thread().Process().Engine();
-    engine.ProcessSuspendLC( Container().Thread().Process().Id() );
-    //
-    TMemSpyDriverStackInfo info;
-    const TInt error = engine.Driver().GetStackInfo( Container().Thread().Id(), info );
-    User::LeaveIfError( error );
-    
-    _LIT( KItem1, "Size" );
-    AddItemDecimalL( KItem1, info.iUserStackSize );
-
-#ifndef __WINS__
-    const TInt userStackUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackPointer;
-    const TInt userStackHighWaterMarkUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackHighWatermark;
-
-    _LIT( KItem2, "Stack used" );
-    AddItemDecimalL( KItem2, userStackUsage );
-    
-    _LIT( KItem3, "(percentage)" );
-    AddItemPercentageL( KItem3, info.iUserStackSize, userStackUsage );
-
-    _LIT( KItem4, "High watermark" );
-    AddItemDecimalL( KItem4, userStackHighWaterMarkUsage );
-    
-    _LIT( KItem5, "(percentage)" );
-    AddItemPercentageL( KItem5, info.iUserStackSize, userStackHighWaterMarkUsage );
-#endif
-
-    _LIT( KItem6, "Base address" );
-    AddItemHexL( KItem6, info.iUserStackBase );
-
-#ifndef __WINS__
-    _LIT( KItem7, "Current pointer" );
-    AddItemHexL( KItem7, info.iUserStackPointer );
-#endif
-    //
-    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-    }
-
-
-CMemSpyThreadInfoStack* CMemSpyThreadInfoStack::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoStack* self = new(ELeave) CMemSpyThreadInfoStack( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoStack::Name() const
-    {
-    _LIT(KName, "\tStack");
-    return TPtrC( KName );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoChunk::CMemSpyThreadInfoChunk( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeChunk, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoChunk::~CMemSpyThreadInfoChunk()
-    {
-    delete iList;
-    }
-
-
-void CMemSpyThreadInfoChunk::ConstructL()
-    {
-    CMemSpyEngine& engine = Container().Thread().Process().Engine();
-    engine.ProcessSuspendLC( Container().Thread().Process().Id() );
-    //
-    CMemSpyEngineChunkList* list = engine.HelperChunk().ListForThreadL( Container().Thread().Id() );
-    delete iList;
-    iList = list;
-    //
-    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-    }
-
-
-CMemSpyThreadInfoChunk* CMemSpyThreadInfoChunk::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoChunk* self = new(ELeave) CMemSpyThreadInfoChunk( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoChunk::Name() const
-    {
-    _LIT(KName, "\tChunks");
-    return TPtrC( KName );
-    }
-
-
-EXPORT_C TInt CMemSpyThreadInfoChunk::MdcaCount() const
-    {
-    TInt count = 0;
-    //
-    if  ( iList )
-        {
-        count = iList->MdcaCount();
-        }
-    //
-    return count;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoChunk::MdcaPoint(TInt aIndex) const
-    {
-    TPtrC ret( KNullDesC );
-    //
-    if  ( iList )
-        {
-        ret.Set( iList->MdcaPoint( aIndex ) );
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoCodeSeg::CMemSpyThreadInfoCodeSeg( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeCodeSeg, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoCodeSeg::~CMemSpyThreadInfoCodeSeg()
-    {
-    delete iList;
-    }
-
-
-void CMemSpyThreadInfoCodeSeg::ConstructL()
-    {
-    CMemSpyEngine& engine = Container().Thread().Process().Engine();
-    engine.ProcessSuspendLC( Container().Thread().Process().Id() );
-    //
-    CMemSpyEngineCodeSegList* list = engine.HelperCodeSegment().CodeSegmentListL( Container().Thread().Process().Id() );
-    delete iList;
-    iList = list;
-    //
-    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-    }
-
-
-CMemSpyThreadInfoCodeSeg* CMemSpyThreadInfoCodeSeg::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoCodeSeg* self = new(ELeave) CMemSpyThreadInfoCodeSeg( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoCodeSeg::Name() const
-    {
-    _LIT(KName, "\tCode Segments");
-    return TPtrC( KName );
-    }
-
-
-EXPORT_C TInt CMemSpyThreadInfoCodeSeg::MdcaCount() const
-    {
-    TInt count = 0;
-    //
-    if  ( iList )
-        {
-        count = iList->MdcaCount();
-        }
-    //
-    return count;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoCodeSeg::MdcaPoint(TInt aIndex) const
-    {
-    TPtrC ret( KNullDesC );
-    //
-    if  ( iList )
-        {
-        ret.Set( iList->MdcaPoint( aIndex ) );
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoHandleObjectBase::CMemSpyThreadInfoHandleObjectBase( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, aItemType, aAsyncConstruction ), iContainerType( aContainerType )
-    {
-    }
-
-
-CMemSpyThreadInfoHandleObjectBase::~CMemSpyThreadInfoHandleObjectBase()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::~CMemSpyThreadInfoHandleObjectBase() - this: 0x%08x", this );
-#endif
-    iInfoItems.Close();
-    }
-
-
-void CMemSpyThreadInfoHandleObjectBase::ConstructL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - START" );
-#endif
-    iInfoItems.Reset();
-    //
-    CMemSpyProcess& process = Container().Thread().Process();
-    CMemSpyEngine& engine = process.Engine();
-    engine.ProcessSuspendLC( process.Id() );
-    //
-    RArray<THandleWrapper> handles;
-    CleanupClosePushL( handles );
-    GetHandlesL( handles );
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - got %d handle entries...", handles.Count() );
-#endif
-    //
-    TFullName name;
-    TMemSpyDriverHandleInfoGeneric info;
-    //
-    const TInt count = handles.Count();
-    for (TInt i=0; i<count; i++)
-    	{
-    	const THandleWrapper& handleWrapper = handles[ i ];
-        //
-    	const TInt r = engine.Driver().GetGenericHandleInfo( Container().Thread().Id(), handleWrapper.iType, handleWrapper.iHandle, info );
-        //
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - handle[%3d] 0x%08x, type: %d, refCount: %d, r: %d", i, handleWrapper.iHandle, handleWrapper.iType, handleWrapper.iRefCount, r );
-#endif
-        //
-        if  (r == KErrNone)
-    		{
-            name.Copy( info.iName );
-#ifdef _DEBUG
-            RDebug::Print( _L( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - HANDLE [%3d] %S"), handleWrapper.iRefCount, &name );
-#endif
-            StripProcessAndThreadNames( name );
-            //
-            iInfoItems.AppendL( info );
-            HandleContainerItemL( info, handleWrapper.iRefCount, name );
-            }
-     	}
-
-    CleanupStack::PopAndDestroy( &handles );
-    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
-
-    HandleAllItemsLocatedL();
-
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-    }
-
-
-TBool CMemSpyThreadInfoHandleObjectBase::THandleWrapper::Match( const THandleWrapper& aLeft, const THandleWrapper& aRight )
-    {
-    return ( aLeft.iHandle == aRight.iHandle );
-    }
-
-
-EXPORT_C TInt CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry( const TMemSpyDriverHandleInfoGeneric& aEntry ) const
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry() - START - this: 0x%08x, aEntry.iHandle: 0x%08x", this, aEntry.iHandle );
-#endif
-    //
-    const TInt ret = DetailsIndexByHandle( aEntry.iHandle );
-    //
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry() - END - ret: %d", ret );
-#endif
-    return ret;
-    }
-
-
-EXPORT_C TInt CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle( TAny* aHandle ) const
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle() - START - this: 0x%08x, aHandle: 0x%08x", this, aHandle );
-#endif
-    TInt ret = KErrNotFound;
-    //
-    const TInt count = DetailsCount();
-    for(TInt i=0; i<count; i++)
-        {
-        const TMemSpyDriverHandleInfoGeneric& item = DetailsAt( i );
-        if  ( item.iHandle == aHandle )
-            {
-            ret = i;
-            break;
-            }
-        }
-    //
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle() - END - ret: %d", ret );
-#endif
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoHandleByContainer::CMemSpyThreadInfoHandleByContainer( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleObjectBase( aContainer, aItemType, aContainerType, aAsyncConstruction )
-    {
-    }
-
-
-void CMemSpyThreadInfoHandleByContainer::GetHandlesL( RArray<THandleWrapper>& aArray )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - START - container: %d", ContainerType() );
-#endif
-
-    aArray.Reset();
-
-    // Our handles will be stored here... duplicates are filtered out
-    TInt r = KErrNone;
-	TInt c = KMemSpyDefaultMaxHandleCount;
-	TAny* handles[ KMemSpyDefaultMaxHandleCount ];
-
-    CMemSpyProcess& process = Container().Thread().Process();
-    CMemSpyEngine& engine = process.Engine();
-    TIdentityRelation<CMemSpyThreadInfoHandleObjectBase::THandleWrapper> finder( THandleWrapper::Match );
-
-    // First get the handles for the process
-    if  ( r == KErrNone )
-        {
-        c = KMemSpyDefaultMaxHandleCount;
-        r = engine.Driver().GetProcessHandlesByType( process.Id(), ContainerType(), handles, c );
-        if  ( r == KErrNone && c > 0 )
-    	    {
-            c = Min( c, KMemSpyDefaultMaxHandleCount );
-    	    for( TInt i=0; i<c; i++ )
-    		    {
-    		    TAny* handle = handles[ i ];
-
-                // Create temporary entry that we'll use as the key in our array...
-                CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, ContainerType() );
-                
-                // Find existing duplicate entry (if there is one...)
-                const TInt errorOrIndex = aArray.Find( entry, finder );
-#ifdef _DEBUG
-                RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - PROC[%03d/%03d] - handle: 0x%08x, foundIndex: %d", i+1, c, handle, errorOrIndex );
-#endif
-
-    		    if  ( errorOrIndex == KErrNotFound )
-        		    {
-        		    // Not a duplicate handle, so keep it
-        		    aArray.AppendL( entry );
-#ifdef _DEBUG
-                    RDebug::Printf( "      new entry: 0x%08x", handle );
-#endif
-        		    }
-                else if ( errorOrIndex >= 0 )
-                    {
-                    // Increment reference count for duplicates...
-                    CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ];
-                    ++existingEntry.iRefCount;
-#ifdef _DEBUG
-                    RDebug::Printf( "      dupe entry - count is now: %d", existingEntry.iRefCount );
-#endif
-                    }
-     		    }
-            }
-        }
-
-    // Next get the handles for the thread
-    if  ( r == KErrNone )
-        {
-        c = KMemSpyDefaultMaxHandleCount;
-        r = engine.Driver().GetThreadHandlesByType( Container().Thread().Id(), ContainerType(), handles, c );
-        if  ( r == KErrNone && c > 0 )
-    	    {
-            c = Min( c, KMemSpyDefaultMaxHandleCount );
-    	    for( TInt i=0; i<c; i++ )
-    		    {
-    		    TAny* handle = handles[ i ];
-
-                // Create temporary entry that we'll use as the key in our array...
-                CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, ContainerType() );
-                
-                // Find existing duplicate entry (if there is one...)
-                const TInt errorOrIndex = aArray.Find( entry, finder );
-#ifdef _DEBUG
-                RDebug::Printf(  "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - THRD[%03d/%03d] - handle: 0x%08x, foundIndex: %d", i+1, c, handle, errorOrIndex );
-#endif
-    		    
-    		    if  ( errorOrIndex == KErrNotFound )
-        		    {
-        		    // Not a duplicate handle, so keep it
-        		    aArray.AppendL( entry );
-#ifdef _DEBUG
-                    RDebug::Printf( "      new entry: 0x%08x", handle );
-#endif
-        		    }
-                else if ( errorOrIndex >= 0 )
-                    {
-                    // Increment reference count for duplicates...
-                    CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ];
-                    ++existingEntry.iRefCount;
-#ifdef _DEBUG
-                    RDebug::Printf( "      dupe entry - count is now: %d", existingEntry.iRefCount );
-#endif
-                    }
-     		    }
-            }
-        }
-
-#ifdef _DEBUG
-    RDebug::Printf(  "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - final handle listing: " );
-
-    const TInt finalCount = aArray.Count();
-    for( TInt i=0; i<finalCount; i++ )
-        {
-        const THandleWrapper& handle = aArray[ i ];
-        RDebug::Printf(  "entry[%03d/%03d] - handle: 0x%08x, type: %d, refCount: %d", i+1, finalCount, handle.iHandle, handle.iType, handle.iRefCount );
-        }
-
-    RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - END - container: %d, finalCount: %d", ContainerType(), finalCount );
-#endif
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoServer::CMemSpyThreadInfoServer( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeServer, EMemSpyDriverContainerTypeServer, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoServer* CMemSpyThreadInfoServer::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoServer* self = new(ELeave) CMemSpyThreadInfoServer( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoServer::Name() const
-    {
-    _LIT(KName, "\tServers Running in Thread");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoServer::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    AddItemL( aFullName, KNullDesC );
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoServer::SessionType( TIpcSessionType aType )
-    {
-    _LIT( KUnsharable, "Unsharable" );
-    _LIT( KSharable, "Sharable" );
-    _LIT( KGlobalSharable, "Global Sharable" );
-    //
-    TPtrC pType(KNullDesC);
-    switch( aType )
-        {
-    case EIpcSession_Unsharable:
-        pType.Set( KUnsharable );
-        break;
-    case EIpcSession_Sharable:
-        pType.Set( KSharable );
-        break;
-    case EIpcSession_GlobalSharable:
-        pType.Set( KGlobalSharable );
-        break;
-    default:
-        pType.Set( KMemSpyUnavailable );
-        break;
-        }
-    //
-    return pType;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoSession::CMemSpyThreadInfoSession( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeSession, EMemSpyDriverContainerTypeSession, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoSession::~CMemSpyThreadInfoSession()
-    {
-    iServerNames.ResetAndDestroy();
-    iServerNames.Close();
-    }
-
-
-CMemSpyThreadInfoSession* CMemSpyThreadInfoSession::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoSession* self = new(ELeave) CMemSpyThreadInfoSession( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoSession::Name() const
-    {
-    _LIT(KName, "\tClient <-> Server\nConnections");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoSession::Reset()
-    {
-    CMemSpyThreadInfoHandleByContainer::Reset();
-    iServerNames.ResetAndDestroy();
-    }
-
-
-EXPORT_C TInt CMemSpyThreadInfoSession::ConnectionCount( const TDesC& aName ) const
-    {
-    TInt ret = 0;
-
-#ifdef _DEBUG
-    RDebug::Print( _L("CMemSpyThreadInfoSession::ConnectionCount() - START - aName: %S"), &aName );
-#endif
-
-    // See if we have an entry with that name...
-    TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
-    HBufC* name = aName.AllocLC();
-    CSessionInfoEntry* entry = new(ELeave) CSessionInfoEntry( name );
-    CleanupStack::Pop( name );
-    CleanupStack::PushL( entry );
-    const TInt foundIndex = iServerNames.Find( entry, comparer );
-    CleanupStack::PopAndDestroy( entry );
-    
-    // If we did, get the count
-    if  ( foundIndex >=0 && foundIndex < iServerNames.Count() )
-        {
-        ret = iServerNames[ foundIndex ]->iCount;
-        }
-    //
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoSession::ConnectionCount() - END - ret: %d", ret );
-#endif
-    //
-    return ret;
-    }
-
-
-void CMemSpyThreadInfoSession::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    // Check whether we have the item already?
-    TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
-
-    // Prepare object, just in case we don't find it...
-    HBufC* name = aFullName.AllocLC();
-
-#ifdef _DEBUG
-    TBuf<KMaxName> origName; origName.Copy( aItem.iName );
-    RDebug::Print( _L("CMemSpyThreadInfoSession::HandleContainerItemL() - START - handle: 0x%08x, type: %d, origName: %S, modName: %S"), aItem.iHandle, aItem.iType, &origName, name );
-#else
-    (void) aItem;
-#endif
-
-    CSessionInfoEntry* entry = new(ELeave) CSessionInfoEntry( name );
-    CleanupStack::Pop( name );
-    CleanupStack::PushL( entry );
-
-    // Search
-    const TInt foundIndex = iServerNames.Find( entry, comparer );
-    if  ( foundIndex == KErrNotFound )
-        {
-        // Make new entry
-        iServerNames.AppendL( entry );
-        CleanupStack::Pop( entry );
-        }
-    else if ( foundIndex >= 0 )
-        {
-        // Existing entry, increment count
-        CleanupStack::PopAndDestroy( entry );
-        entry = iServerNames[ foundIndex ];
-        ++entry->iCount;
-        }
-    else
-        {
-        CleanupStack::PopAndDestroy( entry );
-        }
- 
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoSession::HandleContainerItemL() - END - foundIndex: %d", foundIndex );
-#endif
-    }
-
-
-void CMemSpyThreadInfoSession::HandleAllItemsLocatedL()
-    {
-    _LIT(KSecondLineFormatStringCount1, "1 connection");
-    _LIT(KSecondLineFormatStringCountMoreThanOne, "%d connections");
-    TBuf<50> buf;
-
-    // All items have been found, now create listbox entries
-    const TInt count = iServerNames.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        CSessionInfoEntry* entry = iServerNames[ i ];
-
-        if  ( entry->iCount == 1 )
-            {
-            buf.Copy( KSecondLineFormatStringCount1 );
-            }
-        else
-            {
-            buf.Format( KSecondLineFormatStringCountMoreThanOne, entry->iCount );
-            }
-
-        AddItemL( *entry->iName, buf );
-        }
-    }
-
-
-TBool CMemSpyThreadInfoSession::CompareEntries( const CSessionInfoEntry& aLeft, const CSessionInfoEntry& aRight )
-    {
-    return ( aLeft.iName->CompareF( *aRight.iName ) == 0 );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoSemaphore::CMemSpyThreadInfoSemaphore( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeSemaphore, EMemSpyDriverContainerTypeSemaphore, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoSemaphore* CMemSpyThreadInfoSemaphore::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoSemaphore* self = new(ELeave) CMemSpyThreadInfoSemaphore( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoSemaphore::Name() const
-    {
-    _LIT(KName, "\tSemaphores");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoSemaphore::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    _LIT( KFormatSpec, "Count: %d" );
-    TBuf<50> buf;
-    buf.AppendFormat( KFormatSpec, aItem.iCount );
-
-    AddItemL( aFullName, buf );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoMutex::CMemSpyThreadInfoMutex( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeMutex, EMemSpyDriverContainerTypeMutex, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoMutex* CMemSpyThreadInfoMutex::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoMutex* self = new(ELeave) CMemSpyThreadInfoMutex( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoMutex::Name() const
-    {
-    _LIT(KName, "\tMutexes");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoMutex::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    _LIT( KFormatSpec, "Count: %d" );
-    TBuf<50> buf;
-    buf.AppendFormat( KFormatSpec, aItem.iCount );
-
-    AddItemL( aFullName, buf );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoTimer::CMemSpyThreadInfoTimer( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeTimer, EMemSpyDriverContainerTypeTimer, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoTimer* CMemSpyThreadInfoTimer::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoTimer* self = new(ELeave) CMemSpyThreadInfoTimer( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoTimer::Name() const
-    {
-    _LIT(KName, "\tTimers");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoTimer::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& /*aFullName*/ )
-    {
-    // Get useful strings
-    TBuf<20> state;
-    GetTimerState( aItem.iTimerState, state );
-    TBuf<20> type;
-    GetTimerType( aItem.iTimerType, type );
-
-    AddItemL( type, state );
-    }
-
-
-void CMemSpyThreadInfoTimer::GetTimerState( TMemSpyDriverTimerState aState, TDes& aBuf )
-    {
-    switch( aState )
-        {
-    default:
-    case EMemSpyDriverTimerStateUnknown: 
-        {
-        _LIT(KStateUnknown, "Unknown");
-        aBuf.Copy( KStateUnknown );
-        }
-        break;
-    case EMemSpyDriverTimerStateIdle:
-        {
-        _LIT(KStateIdle, "Idle");
-        aBuf.Copy( KStateIdle );
-        }
-        break;
-    case EMemSpyDriverTimerStateWaiting: 
-        {
-        _LIT(KStateWaiting, "Waiting");
-        aBuf.Copy( KStateWaiting );
-        }
-        break;
-    case EMemSpyDriverTimerStateWaitHighRes: 
-        {
-        _LIT(KStateWaitHighRes, "Waiting, High Res.");
-        aBuf.Copy( KStateWaitHighRes );
-        }
-        break;
-        }
-    }
-
-
-void CMemSpyThreadInfoTimer::GetTimerType( TMemSpyDriverTimerType aType, TDes& aBuf )
-    {
-    switch( aType )
-        {
-    case EMemSpyDriverTimerTypeRelative:
-        {
-        _LIT( KType, "Relative" );
-        aBuf.Copy( KType );
-        }
-        break;
-    case EMemSpyDriverTimerTypeAbsolute:
-        {
-        _LIT( KType, "Absolute" );
-        aBuf.Copy( KType );
-        }
-        break;
-    case EMemSpyDriverTimerTypeHighRes:
-        {
-        _LIT( KType, "High Res." );
-        aBuf.Copy( KType );
-        }
-        break;
-    case EMemSpyDriverTimerTypeInactivity:
-        {
-        _LIT( KType, "Inactivity" );
-        aBuf.Copy( KType );
-        }
-        break;
-    default:
-        {
-        _LIT( KType, "Unknown" );
-        aBuf.Copy( KType );
-        }
-        break;
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoLDD::CMemSpyThreadInfoLDD( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeLDD, EMemSpyDriverContainerTypeLogicalDevice, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoLDD* CMemSpyThreadInfoLDD::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoLDD* self = new(ELeave) CMemSpyThreadInfoLDD( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoLDD::Name() const
-    {
-    _LIT(KName, "\tLogical Device Drivers");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoLDD::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    _LIT( KFormatSpec, "Open channels: %d" );
-    TBuf<50> buf;
-    buf.AppendFormat( KFormatSpec, aItem.iOpenChannels );
-
-    AddItemL( aFullName, buf );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoPDD::CMemSpyThreadInfoPDD( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypePDD, EMemSpyDriverContainerTypePhysicalDevice, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoPDD* CMemSpyThreadInfoPDD::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoPDD* self = new(ELeave) CMemSpyThreadInfoPDD( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoPDD::Name() const
-    {
-    _LIT(KName, "\tPhysical Device Drivers");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoPDD::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    AddItemL( aFullName, KNullDesC );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoLogicalChannel::CMemSpyThreadInfoLogicalChannel( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeLogicalChannel, EMemSpyDriverContainerTypeLogicalChannel, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoLogicalChannel* CMemSpyThreadInfoLogicalChannel::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoLogicalChannel* self = new(ELeave) CMemSpyThreadInfoLogicalChannel( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoLogicalChannel::Name() const
-    {
-    _LIT(KName, "\tLogical DD Channels");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoLogicalChannel::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    AddItemL( aFullName, KNullDesC );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoChangeNotifier::CMemSpyThreadInfoChangeNotifier( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeChangeNotifier, EMemSpyDriverContainerTypeChangeNotifier, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoChangeNotifier* CMemSpyThreadInfoChangeNotifier::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoChangeNotifier* self = new(ELeave) CMemSpyThreadInfoChangeNotifier( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoChangeNotifier::Name() const
-    {
-    _LIT(KName, "\tChange Notifiers");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoChangeNotifier::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    AddItemL( aFullName, KNullDesC );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoUndertaker::CMemSpyThreadInfoUndertaker( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeUndertaker, EMemSpyDriverContainerTypeUndertaker, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoUndertaker* CMemSpyThreadInfoUndertaker::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoUndertaker* self = new(ELeave) CMemSpyThreadInfoUndertaker( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoUndertaker::Name() const
-    {
-    _LIT(KName, "\tUndertakers");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoUndertaker::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    AddItemL( aFullName, KNullDesC );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoOwnedThreadHandles::CMemSpyThreadInfoOwnedThreadHandles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeOwnedThreadHandles, EMemSpyDriverContainerTypeThread, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoOwnedThreadHandles* CMemSpyThreadInfoOwnedThreadHandles::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoOwnedThreadHandles* self = new(ELeave) CMemSpyThreadInfoOwnedThreadHandles( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoOwnedThreadHandles::Name() const
-    {
-    _LIT(KName, "\tHandles to other\nThreads");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoOwnedThreadHandles::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName )
-    {
-    const TInt bracketPosStart = aFullName.LocateF( TChar('[') );
-    const TInt doubleColonPos = aFullName.FindF( _L("::" ) );
-    //
-    if  ( bracketPosStart >= 0 && doubleColonPos > bracketPosStart && doubleColonPos < aFullName.Length() - 2 )
-        {
-        // Process
-        TPtrC pProcessName( aFullName.Left( bracketPosStart ) );
-        HBufC* caption = HBufC::NewLC( KMaxName + 10 );
-        TPtr pCaption( caption->Des() );
-        pCaption.AppendFormat( _L("[%2d] %S"), aRefCount, &pProcessName );
-        
-        // Thread id & thread name
-        TPtrC pThreadName( aFullName.Mid( doubleColonPos + 2 ) );
-        HBufC* value = HBufC::NewLC( KMaxName + 10 );
-        TPtr pValue( value->Des() );
-        pValue.AppendFormat( _L("[%3d] %S"), aItem.iId, &pThreadName );
-
-        // Add it & tidy up
-        AddItemL( pCaption, pValue );
-        CleanupStack::PopAndDestroy( 2, caption );
-        }
-    else
-        {
-        AddItemL( aFullName, KNullDesC );
-        }
-    }
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoOwnedProcessHandles::CMemSpyThreadInfoOwnedProcessHandles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeOwnedProcessHandles, EMemSpyDriverContainerTypeProcess, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoOwnedProcessHandles* CMemSpyThreadInfoOwnedProcessHandles::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoOwnedProcessHandles* self = new(ELeave) CMemSpyThreadInfoOwnedProcessHandles( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoOwnedProcessHandles::Name() const
-    {
-    _LIT(KName, "\tHandles to other\nProcesses");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoOwnedProcessHandles::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName )
-    {
-    const TInt bracketPosStart = aFullName.LocateF( TChar('[') );
-    const TInt doubleColonPos = aFullName.FindF( _L("::" ) );
-    //
-    if  ( bracketPosStart >= 0 && doubleColonPos > bracketPosStart && doubleColonPos < aFullName.Length() - 2 )
-        {
-        // Process
-        TPtrC pProcessName( aFullName.Left( bracketPosStart ) );
-        HBufC* caption = HBufC::NewLC( KMaxName + 10 );
-        TPtr pCaption( caption->Des() );
-        pCaption.AppendFormat( _L("[%2d] %S"), aRefCount, &pProcessName );
-        
-        // Thread id & thread name
-        TPtrC pThreadName( aFullName.Mid( doubleColonPos + 2 ) );
-        HBufC* value = HBufC::NewLC( KMaxName + 10 );
-        TPtr pValue( value->Des() );
-        pValue.AppendFormat( _L("[%3d] %S"), aItem.iId, &pThreadName );
-
-        // Add it & tidy up
-        AddItemL( pCaption, pValue );
-        CleanupStack::PopAndDestroy( 2, caption );
-        }
-    else
-        {
-        AddItemL( aFullName, KNullDesC );
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoReferencedBy::CMemSpyThreadInfoReferencedBy( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoHandleObjectBase( aContainer, aItemType, aContainerType, aAsyncConstruction )
-    {
-    }
-
-
-void CMemSpyThreadInfoReferencedBy::GetHandlesL( RArray<THandleWrapper>& aArray )
-    {
-    aArray.Reset();
-    //
-    TInt r = KErrNone;
-    //
-    CMemSpyProcess& process = Container().Thread().Process();
-    CMemSpyEngine& engine = process.Engine();
-    TIdentityRelation<CMemSpyThreadInfoHandleObjectBase::THandleWrapper> finder( THandleWrapper::Match );
-
-    // We need to either search through:
-    //
-    // a) all thread & process handles looking for *this thread*, or
-    // b) all thread & process handles looking for *this process*
-    //
-    // We abuse the "container type" as a means of deciding whether it is
-    // the thread or the process we are looking for.
-    //
-    RMemSpyDriverClient& driver = engine.Driver();
-    if  ( ContainerType() == EMemSpyDriverContainerTypeProcess )
-        {
-        const TUint id = Container().Thread().Process().Id();
-        r = driver.GetReferencesToMyProcess( id );
-        }
-    else if ( ContainerType() == EMemSpyDriverContainerTypeThread )
-        {
-        const TUint id = Container().Thread().Id();
-        r = driver.GetReferencesToMyThread( id );
-        }
-    else
-        {
-        ASSERT( EFalse );
-        }
-    User::LeaveIfError( r );
-
-    RMemSpyMemStreamReader stream = driver.StreamOpenL();
-    CleanupClosePushL( stream );
-    
-    // Extract thread matches
-    const TInt threadCount = stream.ReadInt32L();
-    for( TInt i=0; i<threadCount; i++ )
-        {
-        TAny* handle = (TAny*) stream.ReadUint32L();
-
-        // Create temporary entry that we'll use as the key in our array...
-        CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, EMemSpyDriverContainerTypeThread );
-        
-        // Find existing duplicate entry (if there is one...)
-        const TInt errorOrIndex = aArray.Find( entry, finder );
-	    
-	    if  ( errorOrIndex == KErrNotFound )
-		    {
-		    // Not a duplicate handle, so keep it
-		    aArray.AppendL( entry );
-		    }
-        else if ( errorOrIndex >= 0 )
-            {
-            // Increment reference count for duplicates...
-            CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ];
-            ++existingEntry.iRefCount;
-            }
-        }
-    
-    // Extract process matches
-    const TInt processCount = stream.ReadInt32L();
-    for( TInt i=0; i<processCount; i++ )
-        {
-        TAny* handle = (TAny*) stream.ReadUint32L();
-
-        // Create temporary entry that we'll use as the key in our array...
-        CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, EMemSpyDriverContainerTypeProcess );
-        
-        // Find existing duplicate entry (if there is one...)
-        const TInt errorOrIndex = aArray.Find( entry, finder );
-	    
-	    if  ( errorOrIndex == KErrNotFound )
-		    {
-		    // Not a duplicate handle, so keep it
-		    aArray.AppendL( entry );
-		    }
-        else if ( errorOrIndex >= 0 )
-            {
-            // Increment reference count for duplicates...
-            CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ];
-            ++existingEntry.iRefCount;
-            }
-        }
-        
-    // Tidy up
-    CleanupStack::PopAndDestroy( &stream );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoOtherThreads::CMemSpyThreadInfoOtherThreads( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoReferencedBy( aContainer, EMemSpyThreadInfoItemTypeOtherThreads, EMemSpyDriverContainerTypeThread, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoOtherThreads* CMemSpyThreadInfoOtherThreads::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoOtherThreads* self = new(ELeave) CMemSpyThreadInfoOtherThreads( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoOtherThreads::Name() const
-    {
-    _LIT(KName, "\tReferences this Thread");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoOtherThreads::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    AddItemL( aFullName, KNullDesC );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoOtherProcesses::CMemSpyThreadInfoOtherProcesses( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoReferencedBy( aContainer, EMemSpyThreadInfoItemTypeOtherProcesses, EMemSpyDriverContainerTypeProcess, aAsyncConstruction )
-    {
-    }
-
-
-CMemSpyThreadInfoOtherProcesses* CMemSpyThreadInfoOtherProcesses::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoOtherProcesses* self = new(ELeave) CMemSpyThreadInfoOtherProcesses( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoOtherProcesses::Name() const
-    {
-    _LIT(KName, "\tReferences this Process");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoOtherProcesses::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
-    {
-    AddItemL( aFullName, KNullDesC );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoMemoryTracking::CMemSpyThreadInfoMemoryTracking( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTracking, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue )
-    {
-    }
-
-
-CMemSpyThreadInfoMemoryTracking::~CMemSpyThreadInfoMemoryTracking()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::~CMemSpyThreadInfoMemoryTracking() - START - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
-#endif
-    //
-    TrackingObserverRemove( *this );
-    //
-    delete iInfoHWM;
-    delete iInfoPeak;
-    delete iInfoCurrent;
-    //
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::~CMemSpyThreadInfoMemoryTracking() - END - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
-#endif
-    }
-
-
-void CMemSpyThreadInfoMemoryTracking::ConstructL()
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - START - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
-#endif
-    CMemSpyEngine& engine = Container().Thread().Process().Engine();
-    //
-    const TProcessId pid = Container().Thread().Process().Id();
-    iTracker = engine.HelperProcess().TrackerOrNull( pid );
-
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - requesting observer add... - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
-#endif
-    TrackingObserverAddL( *this );
-    //
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - preparing info item... - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
-#endif
-    if  ( iTracker )
-        {
-        delete iInfoCurrent;
-        iInfoCurrent = NULL;
-        iInfoCurrent = CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::NewLC( Container(), EFalse );
-        CleanupStack::Pop( iInfoCurrent );
-        //
-        delete iInfoHWM;
-        iInfoHWM = NULL;
-        iInfoHWM = CMemSpyThreadInfoMemoryTrackingStatisticsHWM::NewLC( Container(), EFalse );
-        CleanupStack::Pop( iInfoHWM );
-        //
-        delete iInfoPeak;
-        iInfoPeak = NULL;
-        iInfoPeak = CMemSpyThreadInfoMemoryTrackingStatisticsPeak::NewLC( Container(), EFalse );
-        CleanupStack::Pop( iInfoPeak );
-        }
-    
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - prepared info items - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
-#endif
-
-    // Prepare items
-    _LIT( KItem0, "Tracking" );
-    AddItemOnOffL( KItem0, ( iTracker ) ? iTracker->AmTracking() : EFalse );
-
-    TInt64 valCurrent( 0 );
-    if  ( iTracker )
-        {
-        if  ( TotalIncludesSharedMemory() )
-            {
-            valCurrent = iTracker->InfoCurrent().TotalIncShared();
-            }
-        else
-            {
-            valCurrent = iTracker->InfoCurrent().TotalExcShared();
-            }
-        }
-    _LIT( KItem1, "Total [Current]" );
-    AddItemLongL( KItem1, valCurrent );
-
-    TInt64 valHWM( 0 );
-    if  ( iTracker )
-        {
-        if  ( TotalIncludesSharedMemory() )
-            {
-            valHWM = iTracker->InfoHWMIncShared().TotalIncShared();
-            }
-        else
-            {
-            valHWM = iTracker->InfoHWMExcShared().TotalExcShared();
-            }
-        }
-    _LIT( KItem2, "Total [HWM]" );
-    AddItemLongL( KItem2, valHWM );
-
-    TInt64 valPeak( 0 );
-    if  ( iTracker )
-        {
-        if  ( TotalIncludesSharedMemory() )
-            {
-            valPeak = iTracker->InfoPeaks().TotalIncShared();
-            }
-        else
-            {
-            valPeak = iTracker->InfoPeaks().TotalExcShared();
-            }
-        }
-    _LIT( KItem3, "Total [Peaks]" );
-    AddItemLongL( KItem3, valPeak );
-
-    //
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - END - this: 0x%08x", this );
-#endif
-    }
-
-
-CMemSpyThreadInfoMemoryTracking* CMemSpyThreadInfoMemoryTracking::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoMemoryTracking* self = new(ELeave) CMemSpyThreadInfoMemoryTracking( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-EXPORT_C TPtrC CMemSpyThreadInfoMemoryTracking::Name() const
-    {
-    _LIT(KName, "\tMemory Tracking");
-    return TPtrC( KName );
-    }
-
-
-EXPORT_C TBool CMemSpyThreadInfoMemoryTracking::TrackingActive() const
-    {
-    return ( iTracker != NULL ? iTracker->AmTracking() : EFalse );
-    }
-
-
-EXPORT_C TBool CMemSpyThreadInfoMemoryTracking::TotalIncludesSharedMemory() const
-    {
-    return iTotalIncludesSharedMemory;
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingSetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory )
-    {
-    iTotalIncludesSharedMemory = aIncludesSharedMemory;
-
-    if  ( iTracker )
-        {
-        iInfoCurrent->SetTotalIncludesSharedMemoryL( aIncludesSharedMemory );
-        iInfoHWM->SetTotalIncludesSharedMemoryL( aIncludesSharedMemory );
-        iInfoPeak->SetTotalIncludesSharedMemoryL( aIncludesSharedMemory );
-        
-        // Update totals
-        TRAP_IGNORE( UpdateCaptionsL( iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() ) );
-        }
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingStartL()
-    {
-    if  ( iTracker == NULL )
-        {
-        CMemSpyProcess& process = Container().Thread().Process();
-        CMemSpyEngine& engine = process.Engine();
-        iTracker = &engine.HelperProcess().TrackerL( process );
-
-        // Make sure we are also listening to the tracker!
-        TrackingObserverAddL( *this );
-        //
-        CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* infoCurrent = CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::NewLC( Container(), EFalse );
-        CMemSpyThreadInfoMemoryTrackingStatisticsHWM* infoHWM = CMemSpyThreadInfoMemoryTrackingStatisticsHWM::NewLC( Container(), EFalse );
-        CMemSpyThreadInfoMemoryTrackingStatisticsPeak* infoPeak = CMemSpyThreadInfoMemoryTrackingStatisticsPeak::NewLC( Container(), EFalse );
-        //
-        iInfoCurrent = infoCurrent;
-        iInfoHWM = infoHWM;
-        iInfoPeak = infoPeak;
-        //
-        CleanupStack::Pop( iInfoPeak );
-        CleanupStack::Pop( infoHWM );
-        CleanupStack::Pop( infoCurrent );
-        //
-        TrackingSetTotalIncludesSharedMemoryL( iTotalIncludesSharedMemory );
-        }
-
-    iTracker->StartL();
-
-    UpdateCaptionsL();
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingStopL()
-    {
-    if  ( iTracker != NULL )
-        {
-        iTracker->Stop();
-        }
-
-    UpdateCaptionsL();
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingResetHWML()
-    {
-    if  ( iTracker != NULL )
-        {
-        iTracker->ResetHWML();
-        }
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL( MMemSpyEngineProcessMemoryTrackerObserver& aObserver )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL() - START - iTracker: 0x%08x, this: 0x%08x", iTracker, this );
-#endif
-
-    if  ( iTracker != NULL )
-        {
-        iTracker->AddObserverL( aObserver );
-        }
-
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL() - END - iTracker: 0x%08x, this: 0x%08x", iTracker, this );
-#endif
-    }
-
-
-EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove( MMemSpyEngineProcessMemoryTrackerObserver& aObserver )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove() - START - iTracker: 0x%08x, this: 0x%08x", iTracker, this );
-#endif
-
-    if  ( iTracker != NULL )
-        {
-        iTracker->RemoveObserver( aObserver );
-        }
-
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove() - END - iTracker: 0x%08x, this: 0x%08x", iTracker, this );
-#endif
-    }
-
-
-EXPORT_C MDesCArray& CMemSpyThreadInfoMemoryTracking::InfoCurrent()
-    {
-    return *iInfoCurrent;
-    }
-
-
-EXPORT_C MDesCArray& CMemSpyThreadInfoMemoryTracking::InfoHWM()
-    {
-    return *iInfoHWM;
-    }
-
-
-EXPORT_C MDesCArray& CMemSpyThreadInfoMemoryTracking::InfoPeak()
-    {
-    return *iInfoPeak;
-    }
-
-
-void CMemSpyThreadInfoMemoryTracking::HandleMemoryTrackingStartedL()
-    {
-    __ASSERT_ALWAYS( iTracker, MemSpyEngineUtils::Panic( EMemSpyEnginePanicTrackerNull1 ) );
-    CMemSpyThreadInfoItemBase::CItem& trackingItem = Item( 0 );
-    trackingItem.SetOnOffL( iTracker->AmTracking() );
-    //
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-    }
-
-
-void CMemSpyThreadInfoMemoryTracking::HandleMemoryTrackingStoppedL()
-    {
-    __ASSERT_ALWAYS( iTracker, MemSpyEngineUtils::Panic( EMemSpyEnginePanicTrackerNull2 ) );
-    CMemSpyThreadInfoItemBase::CItem& trackingItem = Item( 0 );
-    trackingItem.SetOnOffL( iTracker->AmTracking() );
-    //
-    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-    }
-
-
-void CMemSpyThreadInfoMemoryTracking::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared )
-    {
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::HandleMemoryChangedL() - START - this: 0x%08x", this );
-#endif 
-
-    __ASSERT_ALWAYS( iTracker, MemSpyEngineUtils::Panic( EMemSpyEnginePanicTrackerNull3 ) );
-    UpdateCaptionsL( aInfoCurrent, aHWMInfoIncShared, aHWMInfoExcShared );
-
-#ifdef _DEBUG
-    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::HandleMemoryChangedL() - END - this: 0x%08x", this );
-#endif 
-    }
-
-
-void CMemSpyThreadInfoMemoryTracking::UpdateCaptionsL()
-    {
-    if  ( iTracker )
-        {
-        UpdateCaptionsL( iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() );
-        }
-    }
-
-
-void CMemSpyThreadInfoMemoryTracking::UpdateCaptionsL( const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared )
-    {
-    if  ( iTracker )
-        {
-        // Update caption
-        Item( 0 ).SetOnOffL( TrackingActive() );
-  
-        if  ( TotalIncludesSharedMemory() )
-            {
-            Item( 1 ).SetLongL( aInfoCurrent.TotalIncShared() );
-            Item( 2 ).SetLongL( aHWMInfoIncShared.TotalIncShared() );
-            Item( 3 ).SetLongL( iTracker->InfoPeaks().TotalIncShared() );
-            }
-        else
-            {
-            Item( 1 ).SetLongL( aInfoCurrent.TotalExcShared() );
-            Item( 2 ).SetLongL( aHWMInfoExcShared.TotalExcShared() );
-            Item( 3 ).SetLongL( iTracker->InfoPeaks().TotalExcShared() );
-            }
-
-        Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::CMemSpyThreadInfoMemoryTrackingStatisticsCurrent( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTrackingCurrent, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue )
-    {
-    }
-
-
-CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::~CMemSpyThreadInfoMemoryTrackingStatisticsCurrent()
-    {
-    if  ( iTracker )
-        {
-        iTracker->RemoveObserver( *this );
-        }
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::ConstructL()
-    {
-    CMemSpyEngine& engine = Container().Thread().Process().Engine();
-    //
-    if  ( iTracker )
-        {
-        iTracker->RemoveObserver( *this );
-        }
-    iTracker = &Container().Engine().HelperProcess().TrackerL( Container().Thread().Process() );
-    if  ( iTracker )
-        {
-        iTracker->AddObserverL( *this );
-        //
-        _LIT( KItem1, "Stack Memory" );
-        AddItemDecimalL( KItem1, iTracker->InfoCurrent().iMemoryStack );
-        //
-        _LIT( KItem2, "Heap Memory" );
-        AddItemDecimalL( KItem2, iTracker->InfoCurrent().iMemoryHeap );
-        //
-        _LIT( KItem3, "Local Chunk Memory" );
-        AddItemDecimalL( KItem3, iTracker->InfoCurrent().iMemoryChunkLocal );
-        //
-        _LIT( KItem4, "Shared Chunk Memory" );
-        AddItemDecimalL( KItem4, iTracker->InfoCurrent().iMemoryChunkShared );
-        //
-        _LIT( KItem5, "Global Data Memory" );
-        AddItemDecimalL( KItem5, iTracker->InfoCurrent().iMemoryGlobalData );
-        //
-        _LIT( KItem6, "Total" );
-        if  ( iTotalIncludesSharedMemory )
-            {
-            AddItemLongL( KItem6, iTracker->InfoCurrent().TotalIncShared() );
-            }
-        else
-            {
-            AddItemLongL( KItem6, iTracker->InfoCurrent().TotalExcShared() );
-            }
-        }
-    }
-
-
-CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* self = new(ELeave) CMemSpyThreadInfoMemoryTrackingStatisticsCurrent( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-TPtrC CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::Name() const
-    {
-    _LIT(KName, "\tCurrent Statistics");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory )
-    {
-    iTotalIncludesSharedMemory = aIncludesSharedMemory;
-    
-    // Update totals
-    HandleMemoryChangedL( iTracker->ProcessId(), iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() );
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::HandleMemoryTrackingStartedL()
-    {
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::HandleMemoryTrackingStoppedL()
-    {
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
-    {
-    Item( 0 ).SetDecimalL( aInfoCurrent.iMemoryStack );
-    Item( 1 ).SetDecimalL( aInfoCurrent.iMemoryHeap );
-    Item( 2 ).SetDecimalL( aInfoCurrent.iMemoryChunkLocal );
-    Item( 3 ).SetDecimalL( aInfoCurrent.iMemoryChunkShared );
-    Item( 4 ).SetDecimalL( aInfoCurrent.iMemoryGlobalData );
-    //
-    if  ( iTotalIncludesSharedMemory )
-        {
-        Item( 5 ).SetLongL( aInfoCurrent.TotalIncShared() );
-        }
-    else
-        {
-        Item( 5 ).SetLongL( aInfoCurrent.TotalExcShared() );
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoMemoryTrackingStatisticsPeak::CMemSpyThreadInfoMemoryTrackingStatisticsPeak( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTrackingPeak, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue )
-    {
-    }
-
-
-CMemSpyThreadInfoMemoryTrackingStatisticsPeak::~CMemSpyThreadInfoMemoryTrackingStatisticsPeak()
-    {
-    if  ( iTracker )
-        {
-        iTracker->RemoveObserver( *this );
-        }
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::ConstructL()
-    {
-    CMemSpyEngine& engine = Container().Thread().Process().Engine();
-    //
-    if  ( iTracker )
-        {
-        iTracker->RemoveObserver( *this );
-        }
-    iTracker = &Container().Engine().HelperProcess().TrackerL( Container().Thread().Process() );
-    if  ( iTracker )
-        {
-        iTracker->AddObserverL( *this );
-        //
-        _LIT( KItem1, "Stack Memory" );
-        AddItemDecimalL( KItem1, iTracker->InfoPeaks().iMemoryStack );
-        //
-        _LIT( KItem2, "Heap Memory" );
-        AddItemDecimalL( KItem2, iTracker->InfoPeaks().iMemoryHeap );
-        //
-        _LIT( KItem3, "Local Chunk Memory" );
-        AddItemDecimalL( KItem3, iTracker->InfoPeaks().iMemoryChunkLocal );
-        //
-        _LIT( KItem4, "Shared Chunk Memory" );
-        AddItemDecimalL( KItem4, iTracker->InfoPeaks().iMemoryChunkShared );
-        //
-        _LIT( KItem5, "Global Data Memory" );
-        AddItemDecimalL( KItem5, iTracker->InfoPeaks().iMemoryGlobalData );
-        //
-        _LIT( KItem6, "Total" );
-        if  ( iTotalIncludesSharedMemory )
-            {
-            AddItemLongL( KItem6, iTracker->InfoPeaks().TotalIncShared() );
-            }
-        else
-            {
-            AddItemLongL( KItem6, iTracker->InfoPeaks().TotalExcShared() );
-            }
-        }
-    }
-
-
-CMemSpyThreadInfoMemoryTrackingStatisticsPeak* CMemSpyThreadInfoMemoryTrackingStatisticsPeak::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoMemoryTrackingStatisticsPeak* self = new(ELeave) CMemSpyThreadInfoMemoryTrackingStatisticsPeak( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-TPtrC CMemSpyThreadInfoMemoryTrackingStatisticsPeak::Name() const
-    {
-    _LIT(KName, "\tPeak Statistics");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory )
-    {
-    iTotalIncludesSharedMemory = aIncludesSharedMemory;
-    
-    // Update totals
-    HandleMemoryChangedL( iTracker->ProcessId(), iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() );
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::HandleMemoryTrackingStartedL()
-    {
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::HandleMemoryTrackingStoppedL()
-    {
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aInfoCurrent*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
-    {
-    Item( 0 ).SetDecimalL( iTracker->InfoPeaks().iMemoryStack );
-    Item( 1 ).SetDecimalL( iTracker->InfoPeaks().iMemoryHeap );
-    Item( 2 ).SetDecimalL( iTracker->InfoPeaks().iMemoryChunkLocal );
-    Item( 3 ).SetDecimalL( iTracker->InfoPeaks().iMemoryChunkShared );
-    Item( 4 ).SetDecimalL( iTracker->InfoPeaks().iMemoryGlobalData );
-    //
-    if ( iTotalIncludesSharedMemory )
-        {
-        Item( 5 ).SetLongL( iTracker->InfoPeaks().TotalIncShared() );
-        }
-    else
-        {
-        Item( 5 ).SetLongL( iTracker->InfoPeaks().TotalExcShared() );
-        }
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyThreadInfoMemoryTrackingStatisticsHWM::CMemSpyThreadInfoMemoryTrackingStatisticsHWM( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTrackingHWM, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue )
-    {
-    }
-
-
-CMemSpyThreadInfoMemoryTrackingStatisticsHWM::~CMemSpyThreadInfoMemoryTrackingStatisticsHWM()
-    {
-    if  ( iTracker )
-        {
-        iTracker->RemoveObserver( *this );
-        }
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::ConstructL()
-    {
-    CMemSpyEngine& engine = Container().Thread().Process().Engine();
-    //
-    if  ( iTracker )
-        {
-        iTracker->RemoveObserver( *this );
-        }
-    iTracker = &Container().Engine().HelperProcess().TrackerL( Container().Thread().Process() );
-    if  ( iTracker )
-        {
-        iTracker->AddObserverL( *this );
-        //
-        _LIT( KItem1, "Stack Memory" );
-        _LIT( KItem2, "Heap Memory" );
-        _LIT( KItem3, "Local Chunk Memory" );
-        _LIT( KItem4, "Shared Chunk Memory" );
-        _LIT( KItem5, "Global Data Memory" );
-        _LIT( KItem6, "Total" );
-        //
-        if  ( iTotalIncludesSharedMemory )
-            {
-            AddItemDecimalL( KItem1, iTracker->InfoHWMIncShared().iMemoryStack );
-            AddItemDecimalL( KItem2, iTracker->InfoHWMIncShared().iMemoryHeap );
-            AddItemDecimalL( KItem3, iTracker->InfoHWMIncShared().iMemoryChunkLocal );
-            AddItemDecimalL( KItem4, iTracker->InfoHWMIncShared().iMemoryChunkShared );
-            AddItemDecimalL( KItem5, iTracker->InfoHWMIncShared().iMemoryGlobalData );
-            AddItemLongL(    KItem6, iTracker->InfoHWMIncShared().TotalIncShared() );
-            }
-        else
-            {
-            AddItemDecimalL( KItem1, iTracker->InfoHWMExcShared().iMemoryStack );
-            AddItemDecimalL( KItem2, iTracker->InfoHWMExcShared().iMemoryHeap );
-            AddItemDecimalL( KItem3, iTracker->InfoHWMExcShared().iMemoryChunkLocal );
-            AddItemDecimalL( KItem4, iTracker->InfoHWMExcShared().iMemoryChunkShared );
-            AddItemDecimalL( KItem5, iTracker->InfoHWMExcShared().iMemoryGlobalData );
-            AddItemLongL(    KItem6, iTracker->InfoHWMExcShared().TotalExcShared() );
-            }
-        }
-    }
-
-
-CMemSpyThreadInfoMemoryTrackingStatisticsHWM* CMemSpyThreadInfoMemoryTrackingStatisticsHWM::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
-    {
-    CMemSpyThreadInfoMemoryTrackingStatisticsHWM* self = new(ELeave) CMemSpyThreadInfoMemoryTrackingStatisticsHWM( aContainer, aAsyncConstruction );
-    CleanupStack::PushL( self );
-    if  ( !aAsyncConstruction )
-        {
-        self->ConstructL();
-        }
-    return self;
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory )
-    {
-    iTotalIncludesSharedMemory = aIncludesSharedMemory;
-    
-    // Update totals
-    HandleMemoryChangedL( iTracker->ProcessId(), iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() );
-    }
-
-
-TPtrC CMemSpyThreadInfoMemoryTrackingStatisticsHWM::Name() const
-    {
-    _LIT(KName, "\tHigh-Water-Mark Statistics");
-    return TPtrC( KName );
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::HandleMemoryTrackingStartedL()
-    {
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::HandleMemoryTrackingStoppedL()
-    {
-    }
-
-
-void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aInfoCurrent*/, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared )
-    {
-    if  ( iTotalIncludesSharedMemory )
-        {
-        Item( 0 ).SetDecimalL( aHWMInfoIncShared.iMemoryStack );
-        Item( 1 ).SetDecimalL( aHWMInfoIncShared.iMemoryHeap );
-        Item( 2 ).SetDecimalL( aHWMInfoIncShared.iMemoryChunkLocal );
-        Item( 3 ).SetDecimalL( aHWMInfoIncShared.iMemoryChunkShared );
-        Item( 4 ).SetDecimalL( aHWMInfoIncShared.iMemoryGlobalData );
-        Item( 5 ).SetLongL(    aHWMInfoIncShared.TotalIncShared() );
-        }
-    else
-        {
-        Item( 0 ).SetDecimalL( aHWMInfoExcShared.iMemoryStack );
-        Item( 1 ).SetDecimalL( aHWMInfoExcShared.iMemoryHeap );
-        Item( 2 ).SetDecimalL( aHWMInfoExcShared.iMemoryChunkLocal );
-        Item( 3 ).SetDecimalL( aHWMInfoExcShared.iMemoryChunkShared );
-        Item( 4 ).SetDecimalL( aHWMInfoExcShared.iMemoryGlobalData );
-        Item( 5 ).SetLongL(    aHWMInfoExcShared.TotalExcShared() );
-        }
-    }
--- a/memspy/Engine/eabi/MemSpyEngineu.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,556 +0,0 @@
-EXPORTS
-	_ZN13CMemSpyEngine10GetVersionER8TVersion @ 1 NONAME
-	_ZN13CMemSpyEngine10HelperEComEv @ 2 NONAME
-	_ZN13CMemSpyEngine10HelperHeapEv @ 3 NONAME
-	_ZN13CMemSpyEngine11HelperChunkEv @ 4 NONAME
-	_ZN13CMemSpyEngine11HelperStackEv @ 5 NONAME
-	_ZN13CMemSpyEngine11SetObserverEP21MMemSpyEngineObserver @ 6 NONAME
-	_ZN13CMemSpyEngine12HelperFbServEv @ 7 NONAME
-	_ZN13CMemSpyEngine12HelperServerEv @ 8 NONAME
-	_ZN13CMemSpyEngine12HelperThreadEv @ 9 NONAME
-	_ZN13CMemSpyEngine12InstallSinkLE15TMemSpySinkType @ 10 NONAME
-	_ZN13CMemSpyEngine13HelperProcessEv @ 11 NONAME
-	_ZN13CMemSpyEngine14ListOpenFilesLEv @ 12 NONAME
-	_ZN13CMemSpyEngine16HelperFileSystemEv @ 13 NONAME
-	_ZN13CMemSpyEngine17HelperCodeSegmentEv @ 14 NONAME
-	_ZN13CMemSpyEngine18HelperActiveObjectEv @ 15 NONAME
-	_ZN13CMemSpyEngine19HelperSysMemTrackerEv @ 16 NONAME
-	_ZN13CMemSpyEngine22HelperKernelContainersEv @ 17 NONAME
-	_ZN13CMemSpyEngine4NewLER3RFs @ 18 NONAME
-	_ZN13CMemSpyEngine4SinkEv @ 19 NONAME
-	_ZN13CMemSpyEngine8SinkTypeEv @ 20 NONAME
-	_ZN13CMemSpyEngine9ContainerEv @ 21 NONAME
-	_ZN13CMemSpyEngine9FsSessionEv @ 22 NONAME
-	_ZN13CMemSpyEngine9HelperRAMEv @ 23 NONAME
-	_ZN13CMemSpyEngine9HelperROMEv @ 24 NONAME
-	_ZN13CMemSpyEngineD0Ev @ 25 NONAME
-	_ZN13CMemSpyEngineD1Ev @ 26 NONAME
-	_ZN13CMemSpyEngineD2Ev @ 27 NONAME
-	_ZN13CMemSpyThread10TerminateLEv @ 28 NONAME
-	_ZN13CMemSpyThread12SetPriorityLE15TThreadPriority @ 29 NONAME
-	_ZN13CMemSpyThread14InfoContainerLEv @ 30 NONAME
-	_ZN13CMemSpyThread41InfoContainerForceSyncronousConstructionLEv @ 31 NONAME
-	_ZN13CMemSpyThread4OpenEv @ 32 NONAME
-	_ZN13CMemSpyThread5CloseEv @ 33 NONAME
-	_ZN13CMemSpyThread5KillLEv @ 34 NONAME
-	_ZN13CMemSpyThread6PanicLEv @ 35 NONAME
-	_ZN14CMemSpyProcess10TerminateLEv @ 36 NONAME
-	_ZN14CMemSpyProcess4NewLERKS_ @ 37 NONAME
-	_ZN14CMemSpyProcess4OpenEv @ 38 NONAME
-	_ZN14CMemSpyProcess5CloseEv @ 39 NONAME
-	_ZN14CMemSpyProcess5KillLEv @ 40 NONAME
-	_ZN14CMemSpyProcess6PanicLEv @ 41 NONAME
-	_ZN17MemSpyEngineUtils10GetFolderLER3RFsR6TDes16RK25CMemSpyEngineSinkMetaDataPK12TDriveNumber @ 42 NONAME
-	_ZN17MemSpyEngineUtils11FormatTimeLER6TDes16RK5TTimei @ 43 NONAME
-	_ZN17MemSpyEngineUtils11FormatTimeLER6TDes16RKxi @ 44 NONAME
-	_ZN17MemSpyEngineUtils11GetRomInfoLER6TDes16S1_ @ 45 NONAME
-	_ZN17MemSpyEngineUtils12IsRomAddressEPv @ 46 NONAME
-	_ZN17MemSpyEngineUtils13CleanupTextLCERK7TDesC16 @ 47 NONAME
-	_ZN17MemSpyEngineUtils14FormatSizeTextERKxii @ 48 NONAME
-	_ZN17MemSpyEngineUtils14FormatSizeTextEi @ 49 NONAME
-	_ZN17MemSpyEngineUtils16FormatPercentageEdd @ 50 NONAME
-	_ZN17MemSpyEngineUtils17GetCapabilityNameER6TDes1611TCapability @ 51 NONAME
-	_ZN17MemSpyEngineUtils20TextAfterDoubleColonER6TDes16 @ 52 NONAME
-	_ZN17MemSpyEngineUtils21FormatSizeTextPreciseEi @ 53 NONAME
-	_ZN17MemSpyEngineUtils21TextBeforeDoubleColonER6TDes16 @ 54 NONAME
-	_ZN17MemSpyEngineUtils9FormatHexER6TDes16i @ 55 NONAME
-	_ZN17MemSpyEngineUtils9StripTextER6TDes16RK7TDesC16 @ 56 NONAME
-	_ZN19CMemSpyEngineObject4OpenEv @ 57 NONAME
-	_ZN19CMemSpyEngineObject5CloseEv @ 58 NONAME
-	_ZN19CMemSpyEngineObject9SetParentEPS_ @ 59 NONAME
-	_ZN19CMemSpyEngineObjectC1ERS_ @ 60 NONAME
-	_ZN19CMemSpyEngineObjectC1Ev @ 61 NONAME
-	_ZN19CMemSpyEngineObjectC2ERS_ @ 62 NONAME
-	_ZN19CMemSpyEngineObjectC2Ev @ 63 NONAME
-	_ZN22CMemSpyEngineChunkList11SortByNameLEv @ 64 NONAME
-	_ZN22CMemSpyEngineChunkList11SortBySizeLEv @ 65 NONAME
-	_ZN22CMemSpyEngineChunkList18OutputDataColumnsLER13CMemSpyEngine @ 66 NONAME
-	_ZN22CMemSpyEngineChunkList2AtEi @ 67 NONAME
-	_ZN22CMemSpyEngineChunkListD0Ev @ 68 NONAME
-	_ZN22CMemSpyEngineChunkListD1Ev @ 69 NONAME
-	_ZN22CMemSpyEngineChunkListD2Ev @ 70 NONAME
-	_ZN22CMemSpyEngineDriveList11SetObserverEP30MMemSpyEngineDriveListObserver @ 71 NONAME
-	_ZN22CMemSpyEngineDriveList18EntryByDriveNumberE12TDriveNumber @ 72 NONAME
-	_ZN22CMemSpyEngineDriveList2AtEi @ 73 NONAME
-	_ZN22CMemSpyEngineDriveListD0Ev @ 74 NONAME
-	_ZN22CMemSpyEngineDriveListD1Ev @ 75 NONAME
-	_ZN22CMemSpyEngineDriveListD2Ev @ 76 NONAME
-	_ZN22CMemSpyEngineHelperRAM22SetAknIconCacheStatusLEi @ 77 NONAME
-	_ZN22CMemSpyEngineHelperROM8AddInfoLER23CMemSpyEngineOutputList @ 78 NONAME
-	_ZN23CMemSpyEngineDriveEntry11SetObserverEP31MMemSpyEngineDriveEntryObserver @ 79 NONAME
-	_ZN23CMemSpyEngineDriveEntryD0Ev @ 80 NONAME
-	_ZN23CMemSpyEngineDriveEntryD1Ev @ 81 NONAME
-	_ZN23CMemSpyEngineDriveEntryD2Ev @ 82 NONAME
-	_ZN23CMemSpyEngineHelperECom2AtEi @ 83 NONAME
-	_ZN23CMemSpyEngineHelperECom7IndexOfERK25CMemSpyEngineEComCategory @ 84 NONAME
-	_ZN23CMemSpyEngineHelperHeap15OutputHeapInfoLERK15TMemSpyHeapInfoRK7TDesC16PK6RArrayI21TMemSpyDriverFreeCellE @ 85 NONAME
-	_ZN23CMemSpyEngineHelperHeap16GetHeapInfoUserLERK10TProcessIdRK9TThreadIdR15TMemSpyHeapInfoP6RArrayI21TMemSpyDriverFreeCellE @ 86 NONAME
-	_ZN23CMemSpyEngineHelperHeap16GetHeapInfoUserLERK14CMemSpyProcessR6RArrayI15TMemSpyHeapInfoE @ 87 NONAME
-	_ZN23CMemSpyEngineHelperHeap18GetHeapInfoKernelLER15TMemSpyHeapInfoP6RArrayI21TMemSpyDriverFreeCellE @ 88 NONAME
-	_ZN23CMemSpyEngineHelperHeap19OutputHeapDataUserLERK10TProcessIdRK9TThreadIdRK7TDesC16RK15TMemSpyHeapInfoPK6RArrayI21TMemSpyDriverFreeCellE @ 89 NONAME
-	_ZN23CMemSpyEngineHelperHeap19OutputHeapDataUserLERK13CMemSpyThread @ 90 NONAME
-	_ZN23CMemSpyEngineHelperHeap19OutputHeapInfoUserLERK13CMemSpyThread @ 91 NONAME
-	_ZN23CMemSpyEngineHelperHeap21NewHeapSummaryShortLCERK15TMemSpyHeapInfo @ 92 NONAME
-	_ZN23CMemSpyEngineHelperHeap21OutputHeapDataKernelLEv @ 93 NONAME
-	_ZN23CMemSpyEngineHelperHeap21OutputHeapInfoKernelLEv @ 94 NONAME
-	_ZN23CMemSpyEngineHelperHeap22OutputCellListingUserLERK13CMemSpyThread @ 95 NONAME
-	_ZN23CMemSpyEngineHelperHeap24NewHeapSummaryExtendedLCERK15TMemSpyHeapInfoPK6RArrayI21TMemSpyDriverFreeCellE @ 96 NONAME
-	_ZN23CMemSpyEngineHelperHeap24OutputHeapInfoForDeviceLEi @ 97 NONAME
-	_ZN23CMemSpyEngineOutputSink10OutputRawLERK6TDesC8 @ 98 NONAME
-	_ZN23CMemSpyEngineOutputSink11OutputLineLERK7TDesC16i @ 99 NONAME
-	_ZN23CMemSpyEngineOutputSink16DataStreamBeginLERK7TDesC16 @ 100 NONAME
-	_ZN23CMemSpyEngineOutputSink16DataStreamBeginLERK7TDesC16S2_ @ 101 NONAME
-	_ZN23CMemSpyEngineOutputSink16OutputBlankLineLEv @ 102 NONAME
-	_ZN23CMemSpyEngineOutputSink17OutputBinaryDataLERK7TDesC16PKhS4_i @ 103 NONAME
-	_ZN23CMemSpyEngineOutputSink17OutputPrefixClearEv @ 104 NONAME
-	_ZN23CMemSpyEngineOutputSink17OutputPrefixSetLCERK7TDesC16 @ 105 NONAME
-	_ZN23CMemSpyEngineOutputSink19OutputItemAndValueLERK7TDesC16S2_ @ 106 NONAME
-	_ZN23CMemSpyEngineOutputSink19OutputItemAndValueLERK7TDesC16ji @ 107 NONAME
-	_ZN23CMemSpyEngineOutputSink20OutputLineFormattedLE11TRefByValueIK7TDesC16Ez @ 108 NONAME
-	_ZN23CMemSpyEngineOutputSink21OutputSectionHeadingLERK7TDesC165TChar @ 109 NONAME
-	_ZN23CMemSpyEngineOutputSink22DataStreamTimeStampEndEv @ 110 NONAME
-	_ZN23CMemSpyEngineOutputSink25DataStreamTimeStampBeginLERK5TTime @ 111 NONAME
-	_ZN23CMemSpyEngineOutputSink26OutputPrefixSetFormattedLCE11TRefByValueIK7TDesC16Ez @ 112 NONAME
-	_ZN23CMemSpyEngineOutputSink27OutputBinaryDataCompressedLERK7TDesC16PKhS4_i @ 113 NONAME
-	_ZN23CMemSpyEngineServerList11SortByNameLEv @ 114 NONAME
-	_ZN23CMemSpyEngineServerList18OutputDataColumnsLER13CMemSpyEnginei @ 115 NONAME
-	_ZN23CMemSpyEngineServerList19SortBySessionCountLEv @ 116 NONAME
-	_ZN23CMemSpyEngineServerListD0Ev @ 117 NONAME
-	_ZN23CMemSpyEngineServerListD1Ev @ 118 NONAME
-	_ZN23CMemSpyEngineServerListD2Ev @ 119 NONAME
-	_ZN23CMemSpyThreadInfoServer11SessionTypeE15TIpcSessionType @ 120 NONAME
-	_ZN24CMemSpyEngineCodeSegList11SortByUidsLEv @ 121 NONAME
-	_ZN24CMemSpyEngineCodeSegList15SortByCodeSizeLEv @ 122 NONAME
-	_ZN24CMemSpyEngineCodeSegList15SortByDataSizeLEv @ 123 NONAME
-	_ZN24CMemSpyEngineCodeSegList15SortByFileNameLEv @ 124 NONAME
-	_ZN24CMemSpyEngineCodeSegList18OutputDataColumnsLER13CMemSpyEngine @ 125 NONAME
-	_ZN24CMemSpyEngineCodeSegList30ShowOnlyEntriesWithGlobalDataLEv @ 126 NONAME
-	_ZN24CMemSpyEngineHelperChunk14ListForThreadLE9TThreadId @ 127 NONAME
-	_ZN24CMemSpyEngineHelperChunk15ListForProcessLE10TProcessId @ 128 NONAME
-	_ZN24CMemSpyEngineHelperChunk25OutputChunkInfoForThreadLE9TThreadId @ 129 NONAME
-	_ZN24CMemSpyEngineHelperChunk25OutputChunkInfoForThreadLE9TThreadIdR6TDes16 @ 130 NONAME
-	_ZN24CMemSpyEngineHelperChunk25OutputChunkInfoForThreadLERK13CMemSpyThread @ 131 NONAME
-	_ZN24CMemSpyEngineHelperChunk26OutputChunkInfoForProcessLE10TProcessId @ 132 NONAME
-	_ZN24CMemSpyEngineHelperChunk26OutputChunkInfoForProcessLE10TProcessIdR6TDes16 @ 133 NONAME
-	_ZN24CMemSpyEngineHelperChunk26OutputChunkInfoForProcessLERK14CMemSpyProcess @ 134 NONAME
-	_ZN24CMemSpyEngineHelperChunk5ListLEv @ 135 NONAME
-	_ZN24CMemSpyEngineHelperStack16OutputStackDataLERK13CMemSpyThread23TMemSpyDriverDomainType @ 136 NONAME
-	_ZN24CMemSpyEngineHelperStack16OutputStackDataLERK13CMemSpyThread23TMemSpyDriverDomainTypei @ 137 NONAME
-	_ZN24CMemSpyEngineHelperStack16OutputStackInfoLE10TProcessId9TThreadIdR6TDes16 @ 138 NONAME
-	_ZN24CMemSpyEngineHelperStack16OutputStackInfoLERK13CMemSpyThread @ 139 NONAME
-	_ZN24CMemSpyEngineHelperStack19CalculateStackSizesERK14CMemSpyProcess @ 140 NONAME
-	_ZN24CMemSpyEngineHelperStack25OutputStackInfoForDeviceLEv @ 141 NONAME
-	_ZN24CMemSpyEngineServerEntryD0Ev @ 142 NONAME
-	_ZN24CMemSpyEngineServerEntryD1Ev @ 143 NONAME
-	_ZN24CMemSpyEngineServerEntryD2Ev @ 144 NONAME
-	_ZN25CMemSpyEngineActiveObjectD0Ev @ 145 NONAME
-	_ZN25CMemSpyEngineActiveObjectD1Ev @ 146 NONAME
-	_ZN25CMemSpyEngineActiveObjectD2Ev @ 147 NONAME
-	_ZN25CMemSpyEngineCodeSegEntryD0Ev @ 148 NONAME
-	_ZN25CMemSpyEngineCodeSegEntryD1Ev @ 149 NONAME
-	_ZN25CMemSpyEngineCodeSegEntryD2Ev @ 150 NONAME
-	_ZN25CMemSpyEngineEComCategory2AtEi @ 151 NONAME
-	_ZN25CMemSpyEngineEComCategory7IndexOfERK26CMemSpyEngineEComInterface @ 152 NONAME
-	_ZN25CMemSpyEngineFbServBitmap18OutputDataColumnsLER13CMemSpyEngine @ 153 NONAME
-	_ZN25CMemSpyEngineFbServBitmap5NewLCEi @ 154 NONAME
-	_ZN25CMemSpyEngineFbServBitmap6BitmapEv @ 155 NONAME
-	_ZN25CMemSpyEngineFbServBitmapD0Ev @ 156 NONAME
-	_ZN25CMemSpyEngineFbServBitmapD1Ev @ 157 NONAME
-	_ZN25CMemSpyEngineFbServBitmapD2Ev @ 158 NONAME
-	_ZN25CMemSpyEngineHelperFbServ24GetArrayOfBitmapHandlesLER6RArrayIiE @ 159 NONAME
-	_ZN25CMemSpyEngineHelperServer11ServerListLEv @ 160 NONAME
-	_ZN25CMemSpyEngineHelperServer14GetServerListLER6RArrayI30TMemSpyDriverHandleInfoGenericE @ 161 NONAME
-	_ZN25CMemSpyEngineHelperServer18GetServerSessionsLEPvR6RArrayI30TMemSpyDriverServerSessionInfoE @ 162 NONAME
-	_ZN25CMemSpyEngineHelperServer18GetServerSessionsLERK30TMemSpyDriverHandleInfoGenericR6RArrayI30TMemSpyDriverServerSessionInfoE @ 163 NONAME
-	_ZN25CMemSpyEngineHelperThread17OutputThreadInfoLERK13CMemSpyThreadi @ 164 NONAME
-	_ZN25CMemSpyEngineOpenFileListD0Ev @ 165 NONAME
-	_ZN25CMemSpyEngineOpenFileListD1Ev @ 166 NONAME
-	_ZN25CMemSpyEngineOpenFileListD2Ev @ 167 NONAME
-	_ZN25CMemSpyEngineSinkMetaData4NewLERK7TDesC16S2_S2_ii @ 168 NONAME
-	_ZN25CMemSpyEngineSinkMetaData4NewLERK7TDesC16S2_S2_iiRK5TTime @ 169 NONAME
-	_ZN25CMemSpyEngineSinkMetaData4NewLEv @ 170 NONAME
-	_ZN25CMemSpyEngineSinkMetaDataD0Ev @ 171 NONAME
-	_ZN25CMemSpyEngineSinkMetaDataD1Ev @ 172 NONAME
-	_ZN25CMemSpyEngineSinkMetaDataD2Ev @ 173 NONAME
-	_ZN25CMemSpyThreadInfoItemBase6PrintLEv @ 174 NONAME
-	_ZN25CMemSpyThreadInfoItemBase8RebuildLEv @ 175 NONAME
-	_ZN26CMemSpyEngineEComInterface2AtEi @ 176 NONAME
-	_ZN26CMemSpyEngineEComInterface7IndexOfERK31CMemSpyEngineEComImplementation @ 177 NONAME
-	_ZN26CMemSpyEngineHelperProcess12ImpersonateLEm @ 178 NONAME
-	_ZN26CMemSpyEngineHelperProcess18OutputProcessInfoLERK14CMemSpyProcess @ 179 NONAME
-	_ZN26CMemSpyEngineHelperProcess26OutputProcessInfoDetailedLERK14CMemSpyProcess @ 180 NONAME
-	_ZN26CMemSpyEngineHelperProcess38SetMemoryTrackingAutoStartProcessListLERK6RArrayI4TUidE @ 181 NONAME
-	_ZN26CMemSpyThreadInfoContainer12ObserverAddLER34MMemSpyThreadInfoContainerObserver @ 182 NONAME
-	_ZN26CMemSpyThreadInfoContainer14ObserverRemoveER34MMemSpyThreadInfoContainerObserver @ 183 NONAME
-	_ZN26CMemSpyThreadInfoContainer19InfoItemIndexByTypeE25TMemSpyThreadInfoItemType @ 184 NONAME
-	_ZN26CMemSpyThreadInfoContainer4ItemE25TMemSpyThreadInfoItemType @ 185 NONAME
-	_ZN26CMemSpyThreadInfoContainer4ItemEi @ 186 NONAME
-	_ZN26CMemSpyThreadInfoContainer4OpenEv @ 187 NONAME
-	_ZN26CMemSpyThreadInfoContainer5CloseEv @ 188 NONAME
-	_ZN26CMemSpyThreadInfoContainer6PrintLEv @ 189 NONAME
-	_ZN27CMemSpyDeviceWideOperations4NewLER13CMemSpyEngineR35MMemSpyDeviceWideOperationsObserverNS_10TOperationE @ 190 NONAME
-	_ZN27CMemSpyDeviceWideOperations6CancelEv @ 191 NONAME
-	_ZN27CMemSpyDeviceWideOperationsD0Ev @ 192 NONAME
-	_ZN27CMemSpyDeviceWideOperationsD1Ev @ 193 NONAME
-	_ZN27CMemSpyDeviceWideOperationsD2Ev @ 194 NONAME
-	_ZN28CMemSpyEngineObjectContainer10SortByNameEv @ 195 NONAME
-	_ZN28CMemSpyEngineObjectContainer14SortByCodeSegsEv @ 196 NONAME
-	_ZN28CMemSpyEngineObjectContainer15SortByHeapUsageEv @ 197 NONAME
-	_ZN28CMemSpyEngineObjectContainer16SortByStackUsageEv @ 198 NONAME
-	_ZN28CMemSpyEngineObjectContainer17SortByThreadCountEv @ 199 NONAME
-	_ZN28CMemSpyEngineObjectContainer8RefreshLERK7TDesC16 @ 200 NONAME
-	_ZN28CMemSpyEngineObjectContainer8RefreshLEv @ 201 NONAME
-	_ZN28CMemSpyEngineObjectContainer8SortByIdEv @ 202 NONAME
-	_ZN29CMemSpyEngineHelperFileSystem10DriveListLEv @ 203 NONAME
-	_ZN29CMemSpyEngineHelperFileSystem14GetSystemDriveEv @ 204 NONAME
-	_ZN29CMemSpyEngineHelperFileSystem14ListOpenFilesLERK9TThreadId @ 205 NONAME
-	_ZN29CMemSpyEngineHelperFileSystem14ListOpenFilesLEv @ 206 NONAME
-	_ZN30CMemSpyEngineActiveObjectArray16ObjectByAddressLEPv @ 207 NONAME
-	_ZN30CMemSpyEngineActiveObjectArray18OutputDataColumnsLER13CMemSpyEngine @ 208 NONAME
-	_ZN30CMemSpyEngineActiveObjectArray2AtEi @ 209 NONAME
-	_ZN30CMemSpyEngineActiveObjectArrayD0Ev @ 210 NONAME
-	_ZN30CMemSpyEngineActiveObjectArrayD1Ev @ 211 NONAME
-	_ZN30CMemSpyEngineActiveObjectArrayD2Ev @ 212 NONAME
-	_ZN30CMemSpyEngineFbServBitmapArray15BitmapByHandleLEi @ 213 NONAME
-	_ZN30CMemSpyEngineFbServBitmapArray2AtEi @ 214 NONAME
-	_ZN30CMemSpyEngineFbServBitmapArray4NewLERK6RArrayIiE @ 215 NONAME
-	_ZN30CMemSpyEngineFbServBitmapArray4NewLEiRK6RArrayIiER38MMemSpyEngineFbSerbBitmapArrayObserveri @ 216 NONAME
-	_ZN30CMemSpyEngineFbServBitmapArrayD0Ev @ 217 NONAME
-	_ZN30CMemSpyEngineFbServBitmapArrayD1Ev @ 218 NONAME
-	_ZN30CMemSpyEngineFbServBitmapArrayD2Ev @ 219 NONAME
-	_ZN30CMemSpyEngineHelperCodeSegment16CodeSegmentListLE10TProcessId @ 220 NONAME
-	_ZN30CMemSpyEngineHelperCodeSegment16CodeSegmentListLEv @ 221 NONAME
-	_ZN30CMemSpyEngineHelperCodeSegment19OutputCodeSegmentsLEjR6TDes16RK7TDesC165TChari @ 222 NONAME
-	_ZN31CMemSpyEngineHelperActiveObject17ActiveObjectListLERK13CMemSpyThread @ 223 NONAME
-	_ZN31CMemSpyThreadInfoMemoryTracking11InfoCurrentEv @ 224 NONAME
-	_ZN31CMemSpyThreadInfoMemoryTracking13TrackingStopLEv @ 225 NONAME
-	_ZN31CMemSpyThreadInfoMemoryTracking14TrackingStartLEv @ 226 NONAME
-	_ZN31CMemSpyThreadInfoMemoryTracking17TrackingResetHWMLEv @ 227 NONAME
-	_ZN31CMemSpyThreadInfoMemoryTracking20TrackingObserverAddLER41MMemSpyEngineProcessMemoryTrackerObserver @ 228 NONAME
-	_ZN31CMemSpyThreadInfoMemoryTracking22TrackingObserverRemoveER41MMemSpyEngineProcessMemoryTrackerObserver @ 229 NONAME
-	_ZN31CMemSpyThreadInfoMemoryTracking37TrackingSetTotalIncludesSharedMemoryLEi @ 230 NONAME
-	_ZN31CMemSpyThreadInfoMemoryTracking7InfoHWMEv @ 231 NONAME
-	_ZN31CMemSpyThreadInfoMemoryTracking8InfoPeakEv @ 232 NONAME
-	_ZN32CMemSpyEngineHelperSysMemTracker10SetConfigLERK38TMemSpyEngineHelperSysMemTrackerConfig @ 233 NONAME
-	_ZN32CMemSpyEngineHelperSysMemTracker11SetObserverEP40MMemSpyEngineHelperSysMemTrackerObserver @ 234 NONAME
-	_ZN32CMemSpyEngineHelperSysMemTracker14RemoveObserverEP40MMemSpyEngineHelperSysMemTrackerObserver @ 235 NONAME
-	_ZN32CMemSpyEngineHelperSysMemTracker5StopLEv @ 236 NONAME
-	_ZN32CMemSpyEngineHelperSysMemTracker6StartLERK38TMemSpyEngineHelperSysMemTrackerConfig @ 237 NONAME
-	_ZN32CMemSpyEngineHelperSysMemTracker6StartLEv @ 238 NONAME
-	_ZN32CMemSpyEngineHelperSysMemTracker9GetConfigER38TMemSpyEngineHelperSysMemTrackerConfig @ 239 NONAME
-	_ZN33CMemSpyEngineProcessMemoryTracker12AddObserverLER41MMemSpyEngineProcessMemoryTrackerObserver @ 240 NONAME
-	_ZN33CMemSpyEngineProcessMemoryTracker14RemoveObserverER41MMemSpyEngineProcessMemoryTrackerObserver @ 241 NONAME
-	_ZN33CMemSpyEngineProcessMemoryTracker4StopEv @ 242 NONAME
-	_ZN33CMemSpyEngineProcessMemoryTracker6StartLEv @ 243 NONAME
-	_ZN33CMemSpyEngineProcessMemoryTracker9ResetHWMLEv @ 244 NONAME
-	_ZN35CMemSpyEngineHelperKernelContainers11ObjectsAllLEv @ 245 NONAME
-	_ZN35CMemSpyEngineHelperKernelContainers28ObjectsForSpecificContainerLE26TMemSpyDriverContainerType @ 246 NONAME
-	_ZN36CMemSpyEngineGenericKernelObjectList12TypeAsStringE26TMemSpyDriverContainerType @ 247 NONAME
-	_ZN36CMemSpyEngineGenericKernelObjectListD0Ev @ 248 NONAME
-	_ZN36CMemSpyEngineGenericKernelObjectListD1Ev @ 249 NONAME
-	_ZN36CMemSpyEngineGenericKernelObjectListD2Ev @ 250 NONAME
-	_ZN41CMemSpyEngineGenericKernelObjectContainerD0Ev @ 251 NONAME
-	_ZN41CMemSpyEngineGenericKernelObjectContainerD1Ev @ 252 NONAME
-	_ZN41CMemSpyEngineGenericKernelObjectContainerD2Ev @ 253 NONAME
-	_ZNK13CMemSpyEngine9ContainerEv @ 254 NONAME
-	_ZNK13CMemSpyThread16IsSystemCriticalEv @ 255 NONAME
-	_ZNK13CMemSpyThread17IsSystemPermanentEv @ 256 NONAME
-	_ZNK13CMemSpyThread4NameEv @ 257 NONAME
-	_ZNK13CMemSpyThread6IsDeadEv @ 258 NONAME
-	_ZNK13CMemSpyThread8FullNameEv @ 259 NONAME
-	_ZNK14CMemSpyProcess11ThreadByIdLE9TThreadId @ 260 NONAME
-	_ZNK14CMemSpyProcess15ThreadIndexByIdE9TThreadId @ 261 NONAME
-	_ZNK14CMemSpyProcess16IsSystemCriticalEv @ 262 NONAME
-	_ZNK14CMemSpyProcess17IsSystemPermanentEv @ 263 NONAME
-	_ZNK14CMemSpyProcess2AtEi @ 264 NONAME
-	_ZNK14CMemSpyProcess3SIDEv @ 265 NONAME
-	_ZNK14CMemSpyProcess3VIDEv @ 266 NONAME
-	_ZNK14CMemSpyProcess4NameEv @ 267 NONAME
-	_ZNK14CMemSpyProcess6IsDeadEv @ 268 NONAME
-	_ZNK14CMemSpyProcess9MdcaCountEv @ 269 NONAME
-	_ZNK14CMemSpyProcess9MdcaPointEi @ 270 NONAME
-	_ZNK19CMemSpyEngineObject11AccessCountEv @ 271 NONAME
-	_ZNK19CMemSpyEngineObject6ParentEv @ 272 NONAME
-	_ZNK20CMemSpyThreadInfoLDD4NameEv @ 273 NONAME
-	_ZNK20CMemSpyThreadInfoPDD4NameEv @ 274 NONAME
-	_ZNK21CMemSpyThreadInfoHeap4NameEv @ 275 NONAME
-	_ZNK22CMemSpyEngineChunkList11EntryExistsEPv @ 276 NONAME
-	_ZNK22CMemSpyEngineChunkList2AtEi @ 277 NONAME
-	_ZNK22CMemSpyEngineChunkList5CountEv @ 278 NONAME
-	_ZNK22CMemSpyEngineChunkList9ItemIndexERK23CMemSpyEngineChunkEntry @ 279 NONAME
-	_ZNK22CMemSpyEngineChunkList9MdcaCountEv @ 280 NONAME
-	_ZNK22CMemSpyEngineChunkList9MdcaPointEi @ 281 NONAME
-	_ZNK22CMemSpyEngineDriveList2AtEi @ 282 NONAME
-	_ZNK22CMemSpyEngineDriveList5CountEv @ 283 NONAME
-	_ZNK22CMemSpyEngineDriveList9ItemIndexERK23CMemSpyEngineDriveEntry @ 284 NONAME
-	_ZNK22CMemSpyEngineDriveList9MdcaCountEv @ 285 NONAME
-	_ZNK22CMemSpyEngineDriveList9MdcaPointEi @ 286 NONAME
-	_ZNK22CMemSpyEngineHelperRAM26IsAknIconCacheConfigurableEv @ 287 NONAME
-	_ZNK22CMemSpyThreadInfoChunk4NameEv @ 288 NONAME
-	_ZNK22CMemSpyThreadInfoChunk9MdcaCountEv @ 289 NONAME
-	_ZNK22CMemSpyThreadInfoChunk9MdcaPointEi @ 290 NONAME
-	_ZNK22CMemSpyThreadInfoMutex4NameEv @ 291 NONAME
-	_ZNK22CMemSpyThreadInfoStack4NameEv @ 292 NONAME
-	_ZNK22CMemSpyThreadInfoTimer4NameEv @ 293 NONAME
-	_ZNK23CMemSpyEngineChunkEntry11OutputDataLER24CMemSpyEngineHelperChunk @ 294 NONAME
-	_ZNK23CMemSpyEngineChunkEntry15AppendOwnerNameER6TDes16 @ 295 NONAME
-	_ZNK23CMemSpyEngineChunkEntry9MdcaCountEv @ 296 NONAME
-	_ZNK23CMemSpyEngineChunkEntry9MdcaPointEi @ 297 NONAME
-	_ZNK23CMemSpyEngineChunkEntry9OwnerNameER6TDes16 @ 298 NONAME
-	_ZNK23CMemSpyEngineDriveEntry9MdcaCountEv @ 299 NONAME
-	_ZNK23CMemSpyEngineDriveEntry9MdcaPointEi @ 300 NONAME
-	_ZNK23CMemSpyEngineHelperECom9MdcaCountEv @ 301 NONAME
-	_ZNK23CMemSpyEngineHelperECom9MdcaPointEi @ 302 NONAME
-	_ZNK23CMemSpyEngineServerList2AtEi @ 303 NONAME
-	_ZNK23CMemSpyEngineServerList5CountEv @ 304 NONAME
-	_ZNK23CMemSpyEngineServerList9ItemIndexERK24CMemSpyEngineServerEntry @ 305 NONAME
-	_ZNK23CMemSpyEngineServerList9MdcaCountEv @ 306 NONAME
-	_ZNK23CMemSpyEngineServerList9MdcaPointEi @ 307 NONAME
-	_ZNK23CMemSpyThreadInfoServer4NameEv @ 308 NONAME
-	_ZNK24CMemSpyEngineCodeSegList13IndexByHandleEPv @ 309 NONAME
-	_ZNK24CMemSpyEngineCodeSegList9MdcaCountEv @ 310 NONAME
-	_ZNK24CMemSpyEngineCodeSegList9MdcaPointEi @ 311 NONAME
-	_ZNK24CMemSpyEngineServerEntry11OutputDataLER25CMemSpyEngineHelperServeri @ 312 NONAME
-	_ZNK24CMemSpyEngineServerEntry12GetSessionsLER25CMemSpyEngineHelperServerR6RArrayI30TMemSpyDriverServerSessionInfoE @ 313 NONAME
-	_ZNK24CMemSpyThreadInfoCodeSeg4NameEv @ 314 NONAME
-	_ZNK24CMemSpyThreadInfoCodeSeg9MdcaCountEv @ 315 NONAME
-	_ZNK24CMemSpyThreadInfoCodeSeg9MdcaPointEi @ 316 NONAME
-	_ZNK24CMemSpyThreadInfoGeneral4NameEv @ 317 NONAME
-	_ZNK24CMemSpyThreadInfoSession15ConnectionCountERK7TDesC16 @ 318 NONAME
-	_ZNK24CMemSpyThreadInfoSession4NameEv @ 319 NONAME
-	_ZNK25CMemSpyEngineActiveObject11OutputDataLER13CMemSpyEngine @ 320 NONAME
-	_ZNK25CMemSpyEngineActiveObject16RequestIsPendingEv @ 321 NONAME
-	_ZNK25CMemSpyEngineActiveObject18IsAddedToSchedulerEv @ 322 NONAME
-	_ZNK25CMemSpyEngineActiveObject8IsActiveEv @ 323 NONAME
-	_ZNK25CMemSpyEngineCodeSegEntry11OutputDataLER30CMemSpyEngineHelperCodeSegment @ 324 NONAME
-	_ZNK25CMemSpyEngineCodeSegEntry13HasCapabilityE11TCapability @ 325 NONAME
-	_ZNK25CMemSpyEngineEComCategory9MdcaCountEv @ 326 NONAME
-	_ZNK25CMemSpyEngineEComCategory9MdcaPointEi @ 327 NONAME
-	_ZNK25CMemSpyEngineFbServBitmap11OutputDataLER13CMemSpyEngine @ 328 NONAME
-	_ZNK25CMemSpyEngineFbServBitmap22GetExportableFileNameLER6TDes16 @ 329 NONAME
-	_ZNK25CMemSpyEngineFbServBitmap6BitmapEv @ 330 NONAME
-	_ZNK25CMemSpyEngineFbServBitmap6HandleEv @ 331 NONAME
-	_ZNK25CMemSpyEngineFbServBitmap7CaptionEv @ 332 NONAME
-	_ZNK25CMemSpyEngineOpenFileList2AtEi @ 333 NONAME
-	_ZNK25CMemSpyEngineOpenFileList5CountEv @ 334 NONAME
-	_ZNK25CMemSpyThreadInfoItemBase4TypeEv @ 335 NONAME
-	_ZNK25CMemSpyThreadInfoItemBase6EngineEv @ 336 NONAME
-	_ZNK25CMemSpyThreadInfoItemBase7IsReadyEv @ 337 NONAME
-	_ZNK25CMemSpyThreadInfoItemBase9MdcaCountEv @ 338 NONAME
-	_ZNK25CMemSpyThreadInfoItemBase9MdcaPointEi @ 339 NONAME
-	_ZNK26CMemSpyEngineEComInterface9MdcaCountEv @ 340 NONAME
-	_ZNK26CMemSpyEngineEComInterface9MdcaPointEi @ 341 NONAME
-	_ZNK26CMemSpyThreadInfoContainer6EngineEv @ 342 NONAME
-	_ZNK26CMemSpyThreadInfoContainer9MdcaCountEv @ 343 NONAME
-	_ZNK26CMemSpyThreadInfoContainer9MdcaPointEi @ 344 NONAME
-	_ZNK26CMemSpyThreadInfoOpenFiles4NameEv @ 345 NONAME
-	_ZNK26CMemSpyThreadInfoSemaphore4NameEv @ 346 NONAME
-	_ZNK27CMemSpyDeviceWideOperations18TotalOperationSizeEv @ 347 NONAME
-	_ZNK27CMemSpyThreadInfoUndertaker4NameEv @ 348 NONAME
-	_ZNK28CMemSpyEngineObjectContainer12ProcessByIdLE10TProcessId @ 349 NONAME
-	_ZNK28CMemSpyEngineObjectContainer16ProcessIndexByIdE10TProcessId @ 350 NONAME
-	_ZNK28CMemSpyEngineObjectContainer26ProcessAndThreadByFullNameERK7TDesC16RP14CMemSpyProcessRP13CMemSpyThread @ 351 NONAME
-	_ZNK28CMemSpyEngineObjectContainer26ProcessAndThreadByThreadIdE9TThreadIdRP14CMemSpyProcessRP13CMemSpyThread @ 352 NONAME
-	_ZNK28CMemSpyEngineObjectContainer29ProcessAndThreadByPartialNameERK7TDesC16RP14CMemSpyProcessRP13CMemSpyThread @ 353 NONAME
-	_ZNK28CMemSpyEngineObjectContainer2AtEi @ 354 NONAME
-	_ZNK28CMemSpyEngineObjectContainer5CountEv @ 355 NONAME
-	_ZNK28CMemSpyEngineObjectContainer7IsAliveE10TProcessId @ 356 NONAME
-	_ZNK28CMemSpyEngineObjectContainer7IsAliveE10TProcessId9TThreadId @ 357 NONAME
-	_ZNK28CMemSpyEngineObjectContainer8CountAllEv @ 358 NONAME
-	_ZNK28CMemSpyEngineObjectContainer9MdcaCountEv @ 359 NONAME
-	_ZNK28CMemSpyEngineObjectContainer9MdcaPointEi @ 360 NONAME
-	_ZNK29CMemSpyThreadInfoOtherThreads4NameEv @ 361 NONAME
-	_ZNK30CMemSpyEngineActiveObjectArray20ObjectIndexByAddressEPv @ 362 NONAME
-	_ZNK30CMemSpyEngineActiveObjectArray2AtEi @ 363 NONAME
-	_ZNK30CMemSpyEngineActiveObjectArray5CountEv @ 364 NONAME
-	_ZNK30CMemSpyEngineActiveObjectArray9MdcaCountEv @ 365 NONAME
-	_ZNK30CMemSpyEngineActiveObjectArray9MdcaPointEi @ 366 NONAME
-	_ZNK30CMemSpyEngineFbServBitmapArray19BitmapIndexByHandleEi @ 367 NONAME
-	_ZNK30CMemSpyEngineFbServBitmapArray2AtEi @ 368 NONAME
-	_ZNK30CMemSpyEngineFbServBitmapArray5CountEv @ 369 NONAME
-	_ZNK30CMemSpyEngineFbServBitmapArray9MdcaCountEv @ 370 NONAME
-	_ZNK30CMemSpyEngineFbServBitmapArray9MdcaPointEi @ 371 NONAME
-	_ZNK30CMemSpyEngineOpenFileListEntry4SizeEv @ 372 NONAME
-	_ZNK30CMemSpyEngineOpenFileListEntry8FileNameEv @ 373 NONAME
-	_ZNK30CMemSpyThreadInfoActiveObjects4NameEv @ 374 NONAME
-	_ZNK30CMemSpyThreadInfoActiveObjects9MdcaCountEv @ 375 NONAME
-	_ZNK30CMemSpyThreadInfoActiveObjects9MdcaPointEi @ 376 NONAME
-	_ZNK31CMemSpyEngineEComImplementation9MdcaCountEv @ 377 NONAME
-	_ZNK31CMemSpyEngineEComImplementation9MdcaPointEi @ 378 NONAME
-	_ZNK31CMemSpyThreadInfoChangeNotifier4NameEv @ 379 NONAME
-	_ZNK31CMemSpyThreadInfoLogicalChannel4NameEv @ 380 NONAME
-	_ZNK31CMemSpyThreadInfoMemoryTracking14TrackingActiveEv @ 381 NONAME
-	_ZNK31CMemSpyThreadInfoMemoryTracking25TotalIncludesSharedMemoryEv @ 382 NONAME
-	_ZNK31CMemSpyThreadInfoMemoryTracking4NameEv @ 383 NONAME
-	_ZNK31CMemSpyThreadInfoOtherProcesses4NameEv @ 384 NONAME
-	_ZNK32CMemSpyEngineHelperSysMemTracker15CompletedCyclesEv @ 385 NONAME
-	_ZNK32CMemSpyEngineHelperSysMemTracker8IsActiveEv @ 386 NONAME
-	_ZNK32CMemSpyEngineHelperSysMemTracker9MdcaCountEv @ 387 NONAME
-	_ZNK32CMemSpyEngineHelperSysMemTracker9MdcaPointEi @ 388 NONAME
-	_ZNK33CMemSpyEngineProcessMemoryTracker10AmTrackingEv @ 389 NONAME
-	_ZNK33CMemSpyThreadInfoHandleObjectBase19DetailsIndexByEntryERK30TMemSpyDriverHandleInfoGeneric @ 390 NONAME
-	_ZNK33CMemSpyThreadInfoHandleObjectBase20DetailsIndexByHandleEPv @ 391 NONAME
-	_ZNK34CMemSpyEngineOpenFileListForThread10ThreadNameEv @ 392 NONAME
-	_ZNK34CMemSpyEngineOpenFileListForThread2AtEi @ 393 NONAME
-	_ZNK34CMemSpyEngineOpenFileListForThread5CountEv @ 394 NONAME
-	_ZNK34CMemSpyEngineOpenFileListForThread8ThreadIdEv @ 395 NONAME
-	_ZNK34CMemSpyEngineOpenFileListForThread9ProcessIdEv @ 396 NONAME
-	_ZNK35CMemSpyEngineHelperKernelContainers7OutputLERK41CMemSpyEngineGenericKernelObjectContainer @ 397 NONAME
-	_ZNK35CMemSpyThreadInfoOwnedThreadHandles4NameEv @ 398 NONAME
-	_ZNK36CMemSpyEngineGenericKernelObjectList2AtEi @ 399 NONAME
-	_ZNK36CMemSpyEngineGenericKernelObjectList4NameEv @ 400 NONAME
-	_ZNK36CMemSpyEngineGenericKernelObjectList4TypeEv @ 401 NONAME
-	_ZNK36CMemSpyEngineGenericKernelObjectList5CountEv @ 402 NONAME
-	_ZNK36CMemSpyEngineGenericKernelObjectList7OutputLER23CMemSpyEngineOutputSink @ 403 NONAME
-	_ZNK36CMemSpyThreadInfoOwnedProcessHandles4NameEv @ 404 NONAME
-	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle10MemoryFreeEv @ 405 NONAME
-	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle11ChangeCountEv @ 406 NONAME
-	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle11CycleNumberEv @ 407 NONAME
-	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle11MemoryDeltaEv @ 408 NONAME
-	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle13TimeFormattedEv @ 409 NONAME
-	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle23MemoryFreePreviousCycleEv @ 410 NONAME
-	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle4TimeEv @ 411 NONAME
-	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle7CaptionEv @ 412 NONAME
-	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle9MdcaCountEv @ 413 NONAME
-	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle9MdcaPointEi @ 414 NONAME
-	_ZNK41CMemSpyEngineGenericKernelObjectContainer2AtEi @ 415 NONAME
-	_ZNK41CMemSpyEngineGenericKernelObjectContainer5CountEv @ 416 NONAME
-	_ZNK41CMemSpyEngineGenericKernelObjectContainer7OutputLER23CMemSpyEngineOutputSink @ 417 NONAME
-	_ZNK41CMemSpyEngineGenericKernelObjectContainer9MdcaCountEv @ 418 NONAME
-	_ZNK41CMemSpyEngineGenericKernelObjectContainer9MdcaPointEi @ 419 NONAME
-	_ZTI23CMemSpyEngineDriveEntry @ 420 NONAME ; #<TI>#
-	_ZTI41CMemSpyEngineHelperSysMemTrackerEntryCode @ 421 NONAME ; #<TI>#
-	_ZTI41CMemSpyEngineHelperSysMemTrackerEntryHeap @ 422 NONAME ; #<TI>#
-	_ZTI42CMemSpyEngineHelperSysMemTrackerEntryChunk @ 423 NONAME ; #<TI>#
-	_ZTI42CMemSpyEngineHelperSysMemTrackerEntryStack @ 424 NONAME ; #<TI>#
-	_ZTI42CMemSpyEngineHelperSysMemTrackerGlobalData @ 425 NONAME ; #<TI>#
-	_ZTI43CMemSpyEngineHelperSysMemTrackerEntryBitmap @ 426 NONAME ; #<TI>#
-	_ZTI43CMemSpyEngineHelperSysMemTrackerEntryFbserv @ 427 NONAME ; #<TI>#
-	_ZTI45CMemSpyEngineHelperSysMemTrackerEntryOpenFile @ 428 NONAME ; #<TI>#
-	_ZTI45CMemSpyEngineHelperSysMemTrackerEntryRamDrive @ 429 NONAME ; #<TI>#
-	_ZTI46CMemSpyEngineHelperSysMemTrackerEntryDiskSpace @ 430 NONAME ; #<TI>#
-	_ZTI48CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS @ 431 NONAME ; #<TI>#
-	_ZTI50CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric @ 432 NONAME ; #<TI>#
-	_ZTI52CMemSpyEngineHelperSysMemTrackerEntryFileServerCache @ 433 NONAME ; #<TI>#
-	_ZTIN25CMemSpyThreadInfoItemBase5CItemE @ 434 NONAME ; #<TI>#
-	_ZTV23CMemSpyEngineDriveEntry @ 435 NONAME ; #<VT>#
-	_ZTV41CMemSpyEngineHelperSysMemTrackerEntryCode @ 436 NONAME ; #<VT>#
-	_ZTV41CMemSpyEngineHelperSysMemTrackerEntryHeap @ 437 NONAME ; #<VT>#
-	_ZTV42CMemSpyEngineHelperSysMemTrackerEntryChunk @ 438 NONAME ; #<VT>#
-	_ZTV42CMemSpyEngineHelperSysMemTrackerEntryStack @ 439 NONAME ; #<VT>#
-	_ZTV42CMemSpyEngineHelperSysMemTrackerGlobalData @ 440 NONAME ; #<VT>#
-	_ZTV43CMemSpyEngineHelperSysMemTrackerEntryBitmap @ 441 NONAME ; #<VT>#
-	_ZTV43CMemSpyEngineHelperSysMemTrackerEntryFbserv @ 442 NONAME ; #<VT>#
-	_ZTV45CMemSpyEngineHelperSysMemTrackerEntryOpenFile @ 443 NONAME ; #<VT>#
-	_ZTV45CMemSpyEngineHelperSysMemTrackerEntryRamDrive @ 444 NONAME ; #<VT>#
-	_ZTV46CMemSpyEngineHelperSysMemTrackerEntryDiskSpace @ 445 NONAME ; #<VT>#
-	_ZTV48CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS @ 446 NONAME ; #<VT>#
-	_ZTV50CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric @ 447 NONAME ; #<VT>#
-	_ZTV52CMemSpyEngineHelperSysMemTrackerEntryFileServerCache @ 448 NONAME ; #<VT>#
-	_ZTVN25CMemSpyThreadInfoItemBase5CItemE @ 449 NONAME ; #<VT>#
-	_ZThn16_NK14CMemSpyProcess9MdcaCountEv @ 450 NONAME ; #<thunk>#
-	_ZThn16_NK14CMemSpyProcess9MdcaPointEi @ 451 NONAME ; #<thunk>#
-	_ZThn16_NK22CMemSpyThreadInfoChunk9MdcaCountEv @ 452 NONAME ; #<thunk>#
-	_ZThn16_NK22CMemSpyThreadInfoChunk9MdcaPointEi @ 453 NONAME ; #<thunk>#
-	_ZThn16_NK24CMemSpyThreadInfoCodeSeg9MdcaCountEv @ 454 NONAME ; #<thunk>#
-	_ZThn16_NK24CMemSpyThreadInfoCodeSeg9MdcaPointEi @ 455 NONAME ; #<thunk>#
-	_ZThn16_NK25CMemSpyThreadInfoItemBase9MdcaCountEv @ 456 NONAME ; #<thunk>#
-	_ZThn16_NK25CMemSpyThreadInfoItemBase9MdcaPointEi @ 457 NONAME ; #<thunk>#
-	_ZThn16_NK26CMemSpyThreadInfoContainer9MdcaCountEv @ 458 NONAME ; #<thunk>#
-	_ZThn16_NK26CMemSpyThreadInfoContainer9MdcaPointEi @ 459 NONAME ; #<thunk>#
-	_ZThn16_NK30CMemSpyThreadInfoActiveObjects9MdcaCountEv @ 460 NONAME ; #<thunk>#
-	_ZThn16_NK30CMemSpyThreadInfoActiveObjects9MdcaPointEi @ 461 NONAME ; #<thunk>#
-	_ZThn24_N25CMemSpyEngineActiveObjectD0Ev @ 462 NONAME ; #<thunk>#
-	_ZThn24_N25CMemSpyEngineActiveObjectD1Ev @ 463 NONAME ; #<thunk>#
-	_ZThn24_N25CMemSpyEngineCodeSegEntryD0Ev @ 464 NONAME ; #<thunk>#
-	_ZThn24_N25CMemSpyEngineCodeSegEntryD1Ev @ 465 NONAME ; #<thunk>#
-	_ZThn24_N25CMemSpyEngineFbServBitmapD0Ev @ 466 NONAME ; #<thunk>#
-	_ZThn24_N25CMemSpyEngineFbServBitmapD1Ev @ 467 NONAME ; #<thunk>#
-	_ZThn28_N22CMemSpyEngineDriveListD0Ev @ 468 NONAME ; #<thunk>#
-	_ZThn28_N22CMemSpyEngineDriveListD1Ev @ 469 NONAME ; #<thunk>#
-	_ZThn28_N23CMemSpyEngineDriveEntryD0Ev @ 470 NONAME ; #<thunk>#
-	_ZThn28_N23CMemSpyEngineDriveEntryD1Ev @ 471 NONAME ; #<thunk>#
-	_ZThn28_N30CMemSpyEngineFbServBitmapArrayD0Ev @ 472 NONAME ; #<thunk>#
-	_ZThn28_N30CMemSpyEngineFbServBitmapArrayD1Ev @ 473 NONAME ; #<thunk>#
-	_ZThn28_NK22CMemSpyEngineDriveList9MdcaCountEv @ 474 NONAME ; #<thunk>#
-	_ZThn28_NK22CMemSpyEngineDriveList9MdcaPointEi @ 475 NONAME ; #<thunk>#
-	_ZThn28_NK23CMemSpyEngineDriveEntry9MdcaCountEv @ 476 NONAME ; #<thunk>#
-	_ZThn28_NK23CMemSpyEngineDriveEntry9MdcaPointEi @ 477 NONAME ; #<thunk>#
-	_ZThn28_NK30CMemSpyEngineFbServBitmapArray9MdcaCountEv @ 478 NONAME ; #<thunk>#
-	_ZThn28_NK30CMemSpyEngineFbServBitmapArray9MdcaPointEi @ 479 NONAME ; #<thunk>#
-	_ZThn4_N22CMemSpyEngineChunkListD0Ev @ 480 NONAME ; #<thunk>#
-	_ZThn4_N22CMemSpyEngineChunkListD1Ev @ 481 NONAME ; #<thunk>#
-	_ZThn4_N23CMemSpyEngineServerListD0Ev @ 482 NONAME ; #<thunk>#
-	_ZThn4_N23CMemSpyEngineServerListD1Ev @ 483 NONAME ; #<thunk>#
-	_ZThn4_N30CMemSpyEngineActiveObjectArrayD0Ev @ 484 NONAME ; #<thunk>#
-	_ZThn4_N30CMemSpyEngineActiveObjectArrayD1Ev @ 485 NONAME ; #<thunk>#
-	_ZThn4_N41CMemSpyEngineGenericKernelObjectContainerD0Ev @ 486 NONAME ; #<thunk>#
-	_ZThn4_N41CMemSpyEngineGenericKernelObjectContainerD1Ev @ 487 NONAME ; #<thunk>#
-	_ZThn4_NK22CMemSpyEngineChunkList9MdcaCountEv @ 488 NONAME ; #<thunk>#
-	_ZThn4_NK22CMemSpyEngineChunkList9MdcaPointEi @ 489 NONAME ; #<thunk>#
-	_ZThn4_NK23CMemSpyEngineChunkEntry9MdcaCountEv @ 490 NONAME ; #<thunk>#
-	_ZThn4_NK23CMemSpyEngineChunkEntry9MdcaPointEi @ 491 NONAME ; #<thunk>#
-	_ZThn4_NK23CMemSpyEngineServerList9MdcaCountEv @ 492 NONAME ; #<thunk>#
-	_ZThn4_NK23CMemSpyEngineServerList9MdcaPointEi @ 493 NONAME ; #<thunk>#
-	_ZThn4_NK25CMemSpyEngineEComCategory9MdcaCountEv @ 494 NONAME ; #<thunk>#
-	_ZThn4_NK25CMemSpyEngineEComCategory9MdcaPointEi @ 495 NONAME ; #<thunk>#
-	_ZThn4_NK26CMemSpyEngineEComInterface9MdcaCountEv @ 496 NONAME ; #<thunk>#
-	_ZThn4_NK26CMemSpyEngineEComInterface9MdcaPointEi @ 497 NONAME ; #<thunk>#
-	_ZThn4_NK28CMemSpyEngineObjectContainer9MdcaCountEv @ 498 NONAME ; #<thunk>#
-	_ZThn4_NK28CMemSpyEngineObjectContainer9MdcaPointEi @ 499 NONAME ; #<thunk>#
-	_ZThn4_NK30CMemSpyEngineActiveObjectArray9MdcaCountEv @ 500 NONAME ; #<thunk>#
-	_ZThn4_NK30CMemSpyEngineActiveObjectArray9MdcaPointEi @ 501 NONAME ; #<thunk>#
-	_ZThn4_NK31CMemSpyEngineEComImplementation9MdcaCountEv @ 502 NONAME ; #<thunk>#
-	_ZThn4_NK31CMemSpyEngineEComImplementation9MdcaPointEi @ 503 NONAME ; #<thunk>#
-	_ZThn4_NK37CMemSpyEngineHelperSysMemTrackerCycle9MdcaCountEv @ 504 NONAME ; #<thunk>#
-	_ZThn4_NK37CMemSpyEngineHelperSysMemTrackerCycle9MdcaPointEi @ 505 NONAME ; #<thunk>#
-	_ZThn4_NK41CMemSpyEngineGenericKernelObjectContainer9MdcaCountEv @ 506 NONAME ; #<thunk>#
-	_ZThn4_NK41CMemSpyEngineGenericKernelObjectContainer9MdcaPointEi @ 507 NONAME ; #<thunk>#
-	_ZThn56_NK24CMemSpyEngineCodeSegList9MdcaCountEv @ 508 NONAME ; #<thunk>#
-	_ZThn56_NK24CMemSpyEngineCodeSegList9MdcaPointEi @ 509 NONAME ; #<thunk>#
-	_ZThn8_NK23CMemSpyEngineHelperECom9MdcaCountEv @ 510 NONAME ; #<thunk>#
-	_ZThn8_NK23CMemSpyEngineHelperECom9MdcaPointEi @ 511 NONAME ; #<thunk>#
-	_ZThn8_NK32CMemSpyEngineHelperSysMemTracker9MdcaCountEv @ 512 NONAME ; #<thunk>#
-	_ZThn8_NK32CMemSpyEngineHelperSysMemTracker9MdcaPointEi @ 513 NONAME ; #<thunk>#
-	_ZN13CMemSpyEngine18HelperWindowServerEv @ 514 NONAME
-	_ZN28CMemSpyEngineWindowGroupListD0Ev @ 515 NONAME ABSENT
-	_ZN28CMemSpyEngineWindowGroupListD1Ev @ 516 NONAME ABSENT
-	_ZN28CMemSpyEngineWindowGroupListD2Ev @ 517 NONAME ABSENT
-	_ZN31CMemSpyEngineHelperWindowServer16WindowGroupListLEv @ 518 NONAME ABSENT
-	_ZN31CMemSpyEngineHelperWindowServer19GetWindowGroupListLER6RArrayI33TMemSpyEngineWindowGroupBasicInfoE @ 519 NONAME ABSENT
-	_ZN31CMemSpyEngineHelperWindowServer22GetWindowGroupDetailsLEiR31TMemSpyEngineWindowGroupDetails @ 520 NONAME ABSENT
-	_ZNK28CMemSpyEngineWindowGroupList2AtEi @ 521 NONAME ABSENT
-	_ZNK28CMemSpyEngineWindowGroupList5CountEv @ 522 NONAME ABSENT
-	_ZNK28CMemSpyEngineWindowGroupList9ItemIndexERK33TMemSpyEngineWindowGroupBasicInfo @ 523 NONAME ABSENT
-	_ZNK28CMemSpyEngineWindowGroupList9MdcaCountEv @ 524 NONAME ABSENT
-	_ZNK28CMemSpyEngineWindowGroupList9MdcaPointEi @ 525 NONAME ABSENT
-	_ZThn4_N28CMemSpyEngineWindowGroupListD0Ev @ 526 NONAME ABSENT
-	_ZThn4_N28CMemSpyEngineWindowGroupListD1Ev @ 527 NONAME ABSENT
-	_ZThn4_NK28CMemSpyEngineWindowGroupList9MdcaCountEv @ 528 NONAME ABSENT
-	_ZThn4_NK28CMemSpyEngineWindowGroupList9MdcaPointEi @ 529 NONAME ABSENT
-	_ZN31CMemSpyEngineHelperWindowServer9SwitchToLEi @ 530 NONAME ABSENT
-	_ZN13CMemSpyEngine13HelperCondVarEv @ 531 NONAME
-	_ZNK14CMemSpyProcess12CapabilitiesEv @ 532 NONAME
-	_ZNK14CMemSpyProcess4UIDsEv @ 533 NONAME
-	_ZN26CMemSpyEngineHelperCondVar27GetCondVarSuspendedThreadsLERK30TMemSpyDriverHandleInfoGenericR6RArrayI39TMemSpyDriverCondVarSuspendedThreadInfoE @ 534 NONAME
-	_ZTI49CMemSpyEngineHelperSysMemTrackerEntryWindowServer @ 535 NONAME ; #<TI>#
-	_ZTV49CMemSpyEngineHelperSysMemTrackerEntryWindowServer @ 536 NONAME ; #<VT>#
-	_ZN13CMemSpyEngine29IsHelperWindowServerSupportedEv @ 537 NONAME
-	_ZN23CMemSpyEngineHelperHeap14NewHeapRawInfoERK15TMemSpyHeapInfo @ 538 NONAME
-	_ZNK36CMemSpyEngineGenericKernelObjectList10ItemsCountEv @ 539 NONAME
-	_ZNK36CMemSpyEngineGenericKernelObjectList4SizeEv @ 540 NONAME
-	_ZNK13CMemSpyThread8PriorityEv @ 541 NONAME
-	_ZN13CMemSpyEngine4NewLER3RFsi @ 542 NONAME
-	_ZNK14CMemSpyProcess10ExitReasonEv @ 543 NONAME
-	_ZNK14CMemSpyProcess12ExitCategoryEv @ 544 NONAME
-	_ZNK14CMemSpyProcess8ExitTypeEv @ 545 NONAME
-	_ZNK14CMemSpyProcess8PriorityEv @ 546 NONAME
-	_ZNK25CMemSpyThreadInfoItemBase5ValueEi @ 547 NONAME
-	_ZNK25CMemSpyThreadInfoItemBase7CaptionEi @ 548 NONAME
-	_ZN13CMemSpyEngine16InstallFileSinkLERK7TDesC16 @ 549 NONAME
-	_ZN13CMemSpyEngine17InstallDebugSinkLEv @ 550 NONAME
-	_ZN25CMemSpyEngineSinkMetaData4NewLERK7TDesC16S2_S2_S2_ii @ 551 NONAME
-	_ZN25CMemSpyEngineSinkMetaData4NewLERK7TDesC16S2_S2_S2_iiRK5TTime @ 552 NONAME
-	_ZN32CMemSpyEngineHelperSysMemTracker19CheckForChangesNowLEv @ 553 NONAME
-	_ZN23CMemSpyEngineHelperHeap16GetHeapInfoUserLERK10TProcessIdRK9TThreadIdR15TMemSpyHeapInfoP6RArrayI21TMemSpyDriverFreeCellEi @ 554 NONAME
-
--- a/memspy/Engine/group/MemSpyEngine.config	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-/**
- * Use this file for MemSpy engine macro definitions
- */
-
--- a/memspy/Engine/group/MemSpyEngine.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +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 <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGET          memspyengine.dll
-TARGETTYPE      dll
-UID             0x1000008d 0x2002129A
-VENDORID		VID_DEFAULT
-SMPSAFE
-
-#include		"../../group/MemSpyCapabilities.mmh"
-
-SOURCEPATH      ../Source
-SOURCE          MemSpyEngine.cpp
-SOURCE          MemSpyEngineImp.cpp
-SOURCE          MemSpyEngineUtils.cpp
-SOURCE			MemSpyEngineProcessMemoryTracker.cpp
-SOURCE          MemSpyEngineTwiddlableItemArray.cpp
-
-SOURCEPATH      ../Source/DeviceWideOps
-SOURCE          MemSpyDeviceWideOperations.cpp
-
-SOURCEPATH		../Source/ClientServer
-SOURCE          MemSpyEngineServer.cpp
-
-SOURCEPATH		../Source/ThreadAndProcess
-SOURCE          MemSpyEngineObject.cpp
-SOURCE          MemSpyEngineObjectProcess.cpp
-SOURCE          MemSpyEngineObjectContainer.cpp
-SOURCE          MemSpyEngineObjectThread.cpp
-SOURCE          MemSpyEngineObjectThreadInfoContainer.cpp
-SOURCE          MemSpyEngineObjectThreadInfoObjects.cpp
-
-SOURCEPATH		../Source/Sink
-SOURCE			MemSpyEngineOutputList.cpp
-SOURCE			MemSpyEngineOutputListItem.cpp
-SOURCE          MemSpyEngineOutputSink.cpp
-SOURCE          MemSpyEngineOutputSinkDebug.cpp
-SOURCE          MemSpyEngineOutputSinkFile.cpp
-
-SOURCEPATH		../Source/Helpers
-SOURCE          MemSpyEngineHelperHeap.cpp
-SOURCE          MemSpyEngineHelperStack.cpp
-SOURCE          MemSpyEngineHelperCodeSegment.cpp
-SOURCE          MemSpyEngineHelperFbServ.cpp
-SOURCE          MemSpyEngineHelperChunk.cpp
-SOURCE          MemSpyEngineHelperThread.cpp
-SOURCE          MemSpyEngineHelperProcess.cpp
-SOURCE          MemSpyEngineHelperServer.cpp
-SOURCE          MemSpyEngineHelperActiveObject.cpp
-SOURCE          MemSpyEngineHelperKernelContainers.cpp
-SOURCE			MemSpyEngineHelperFileSystem.cpp
-SOURCE			MemSpyEngineHelperECom.cpp
-SOURCE			MemSpyEngineHelperROM.cpp
-SOURCE			MemSpyEngineHelperRAM.cpp
-SOURCE          MemSpyEngineHelperCondVar.cpp
-
-SOURCEPATH      ../Source/SysMemTracker
-SOURCE			MemSpyEngineHelperSysMemTracker.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerImp.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryManager.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerOutputFormatter.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerCycle.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerCycleChange.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntries.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryHeap.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryChunk.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryRamDrive.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryStack.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryGlobalData.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryCode.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryOpenFile.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryDiskSpace.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryBitmap.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryFbserv.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryFileServerCache.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntrySystemMemory.cpp
-SOURCE			MemSpyEngineHelperSysMemTrackerEntryWindowServer.cpp
-
-SOURCEPATH      ../Source/EventHandlers
-SOURCE          MemSpyEngineUndertaker.cpp
-SOURCE          MemSpyEngineMidwife.cpp
-SOURCE          MemSpyEngineChunkWatcher.cpp
-
-
-USERINCLUDE		../Include
-USERINCLUDE		../Include/Helpers
-USERINCLUDE		../Include/Sink
-USERINCLUDE		../Include/SysMemTracker
-USERINCLUDE		../Include/ClientServer
-USERINCLUDE		../Include/ThreadAndProcess
-USERINCLUDE		../Include/EventHandlers
-USERINCLUDE		../Include/Logger
-
-OS_LAYER_SYSTEMINCLUDE
-
-APP_LAYER_SYSTEMINCLUDE
-
-LIBRARY			euser.lib 
-LIBRARY			MemSpyDriverClient.lib hal.lib estor.lib
-LIBRARY			efsrv.lib bafl.lib fbscli.lib
-LIBRARY			ecom.lib xmlframework.lib charconv.lib
-LIBRARY			apgrfx.lib
-LIBRARY	 		ws32.lib
-
-
-#include "MemSpyEngine.config"
-
-//EXPORTUNFROZEN
-
-
--- a/memspy/Engine/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +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:
-*
-*/
-
-
-PRJ_MMPFILES
-MemSpyEngine.mmp
-	
\ No newline at end of file
--- a/memspy/MemSpyClient/bwins/MemSpyClientu.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-EXPORTS
-	?CpuUse@CMemSpyApiThread@@QBEHXZ @ 1 NONAME ; int CMemSpyApiThread::CpuUse(void) const
-	?Name@CMemSpyApiKernelObjectItem@@QBEABVTDesC8@@XZ @ 2 NONAME ; class TDesC8 const & CMemSpyApiKernelObjectItem::Name(void) const
-	?GetThreadInfoItemsL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiThreadInfoItem@@@@VTThreadId@@W4TMemSpyThreadInfoItemType@@@Z @ 3 NONAME ; void RMemSpySession::GetThreadInfoItemsL(class RArray<class CMemSpyApiThreadInfoItem *> &, class TThreadId, enum TMemSpyThreadInfoItemType)
-	?Description@TMemSpyDeviceWideOperationProgress@@QBEABVTDesC16@@XZ @ 4 NONAME ; class TDesC16 const & TMemSpyDeviceWideOperationProgress::Description(void) const
-	?TotalOverhead@CMemSpyApiHeap@@QAEHXZ @ 5 NONAME ; int CMemSpyApiHeap::TotalOverhead(void)
-	?OutputDetailedPhoneInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 6 NONAME ; void RMemSpySession::OutputDetailedPhoneInfo(class TRequestStatus &)
-	?UniqueID@CMemSpyApiKernelObjectItem@@QBEHXZ @ 7 NONAME ; int CMemSpyApiKernelObjectItem::UniqueID(void) const
-	?OutputHeapData@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 8 NONAME ; void RMemSpySession::OutputHeapData(class TRequestStatus &)
-	?SessionType@CMemSpyApiKernelObjectItem@@QBE?AW4TIpcSessionType@@XZ @ 9 NONAME ; enum TIpcSessionType CMemSpyApiKernelObjectItem::SessionType(void) const
-	?VID@CMemSpyApiThread@@QBEHXZ @ 10 NONAME ; int CMemSpyApiThread::VID(void) const
-	?OutputStackInfoL@RMemSpySession@@QAEXVTThreadId@@@Z @ 11 NONAME ; void RMemSpySession::OutputStackInfoL(class TThreadId)
-	?GetOutputSink@RMemSpySession@@QAEXW4TMemSpySinkType@@@Z @ 12 NONAME ; void RMemSpySession::GetOutputSink(enum TMemSpySinkType)
-	?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)
-	?EndThread@RMemSpySession@@QAEHVTThreadId@@W4TMemSpyEndType@@@Z @ 31 NONAME ; int RMemSpySession::EndThread(class TThreadId, enum TMemSpyEndType)
-	?AddressOfOwningProcess@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 32 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfOwningProcess(void)
-	?ExitReason@CMemSpyApiProcess@@QBEHXZ @ 33 NONAME ; int CMemSpyApiProcess::ExitReason(void) const
-	?MsgCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 34 NONAME ; int CMemSpyApiKernelObjectItem::MsgCount(void) const
-	?AllocationsCount@CMemSpyApiHeap@@QAEHXZ @ 35 NONAME ; int CMemSpyApiHeap::AllocationsCount(void)
-	?WaitCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 36 NONAME ; int CMemSpyApiKernelObjectItem::WaitCount(void) const
-	?SID@CMemSpyApiProcess@@QBEKXZ @ 37 NONAME ; unsigned long CMemSpyApiProcess::SID(void) const
-	?GetKernelObjectsL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiKernelObject@@@@@Z @ 38 NONAME ; void RMemSpySession::GetKernelObjectsL(class RArray<class CMemSpyApiKernelObject *> &)
-	?CycleNumber@CMemSpyApiMemoryTrackingCycle@@QBEHXZ @ 39 NONAME ; int CMemSpyApiMemoryTrackingCycle::CycleNumber(void) const
-	?Size@CMemSpyApiKernelObject@@QBE_JXZ @ 40 NONAME ; long long CMemSpyApiKernelObject::Size(void) const
-	?SetSwmtCategoriesL@RMemSpySession@@QAEXH@Z @ 41 NONAME ; void RMemSpySession::SetSwmtCategoriesL(int)
-	?CancelDeviceWideOperationL@RMemSpySession@@QAEXXZ @ 42 NONAME ; void RMemSpySession::CancelDeviceWideOperationL(void)
-	?TotalAllocations@CMemSpyApiHeap@@QAEHXZ @ 43 NONAME ; int CMemSpyApiHeap::TotalAllocations(void)
-	?Name@CMemSpyApiProcess@@QBEABVTDesC16@@XZ @ 44 NONAME ; class TDesC16 const & CMemSpyApiProcess::Name(void) const
-	?DumpKernelHeap@RMemSpySession@@QAEXXZ @ 45 NONAME ; void RMemSpySession::DumpKernelHeap(void)
-	?GetKernelObjects@RMemSpySession@@QAEHAAV?$RArray@PAVCMemSpyApiKernelObject@@@@@Z @ 46 NONAME ; int RMemSpySession::GetKernelObjects(class RArray<class CMemSpyApiKernelObject *> &)
-	?Priority@CMemSpyApiProcess@@QBE?AW4TProcessPriority@@XZ @ 47 NONAME ; enum TProcessPriority CMemSpyApiProcess::Priority(void) const
-	?HeaderSizeF@CMemSpyApiHeap@@QAEHXZ @ 48 NONAME ; int CMemSpyApiHeap::HeaderSizeF(void)
-	?OutputCompactStackInfoL@RMemSpySession@@QAEXXZ @ 49 NONAME ; void RMemSpySession::OutputCompactStackInfoL(void)
-	?MsgLimit@CMemSpyApiKernelObjectItem@@QBEHXZ @ 50 NONAME ; int CMemSpyApiKernelObjectItem::MsgLimit(void) const
-	?AddressOfDataBssStackChunk@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 51 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfDataBssStackChunk(void)
-	?Top@CMemSpyApiKernelObjectItem@@QBEHXZ @ 52 NONAME ; int CMemSpyApiKernelObjectItem::Top(void) const
-	?Resetting@CMemSpyApiKernelObjectItem@@QBEEXZ @ 53 NONAME ; unsigned char CMemSpyApiKernelObjectItem::Resetting(void) const
-	?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)
-	?SetSwmtConfig@RMemSpySession@@QAEXVTMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 61 NONAME ; void RMemSpySession::SetSwmtConfig(class TMemSpyEngineHelperSysMemTrackerConfig)
-	?Size@CMemSpyApiHeap@@QAEHXZ @ 62 NONAME ; int CMemSpyApiHeap::Size(void)
-	??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
-	?Caption@CMemSpyApiThreadInfoItem@@QBEABVTDesC16@@XZ @ 86 NONAME ; class TDesC16 const & CMemSpyApiThreadInfoItem::Caption(void) const
-	?DebugAllocatorLibrary@CMemSpyApiHeap@@QAEHXZ @ 87 NONAME ; int CMemSpyApiHeap::DebugAllocatorLibrary(void)
-	?Overhead@CMemSpyApiHeap@@QAEHXZ @ 88 NONAME ; int CMemSpyApiHeap::Overhead(void)
-	?ForceSwmtUpdate@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 89 NONAME ; void RMemSpySession::ForceSwmtUpdate(class TRequestStatus &)
-	?GetHeapL@RMemSpySession@@QAEPAVCMemSpyApiHeap@@XZ @ 90 NONAME ; class CMemSpyApiHeap * RMemSpySession::GetHeapL(void)
-	?OutputKernelStackData@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 91 NONAME ; void RMemSpySession::OutputKernelStackData(class TRequestStatus &)
-	?AddressOfOwningThread@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 92 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfOwningThread(void)
-	?ThreadPriority@CMemSpyApiThread@@QBE?AW4TThreadPriority@@XZ @ 93 NONAME ; enum TThreadPriority CMemSpyApiThread::ThreadPriority(void) const
-	?GetHeap@RMemSpySession@@QAEPAVCMemSpyApiHeap@@XZ @ 94 NONAME ; class CMemSpyApiHeap * RMemSpySession::GetHeap(void)
-	??1CMemSpyApiMemoryTrackingCycle@@QAE@XZ @ 95 NONAME ; CMemSpyApiMemoryTrackingCycle::~CMemSpyApiMemoryTrackingCycle(void)
-	?AccessCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 96 NONAME ; int CMemSpyApiKernelObjectItem::AccessCount(void) const
-	?OutputHeapInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 97 NONAME ; void RMemSpySession::OutputHeapInfo(class TRequestStatus &)
-	?Time@CMemSpyApiMemoryTrackingCycle@@QBEABVTTime@@XZ @ 98 NONAME ; class TTime const & CMemSpyApiMemoryTrackingCycle::Time(void) const
-	?SetSwmtTimerIntervalL@RMemSpySession@@QAEXH@Z @ 99 NONAME ; void RMemSpySession::SetSwmtTimerIntervalL(int)
-	?MaxLength@CMemSpyApiHeap@@QAEHXZ @ 100 NONAME ; int CMemSpyApiHeap::MaxLength(void)
-	?OutputKernelHeapData@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 101 NONAME ; void RMemSpySession::OutputKernelHeapData(class TRequestStatus &)
-	?AddressOfKernelOwner@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 102 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfKernelOwner(void)
-	??1CMemSpyApiThreadInfoItem@@QAE@XZ @ 103 NONAME ; CMemSpyApiThreadInfoItem::~CMemSpyApiThreadInfoItem(void)
-	?FreeCount@CMemSpyApiHeap@@QAEHXZ @ 104 NONAME ; int CMemSpyApiHeap::FreeCount(void)
-	?TotalFree@CMemSpyApiHeap@@QAEHXZ @ 105 NONAME ; int CMemSpyApiHeap::TotalFree(void)
-	?SwitchToThread@RMemSpySession@@QAEHVTThreadId@@H@Z @ 106 NONAME ; int RMemSpySession::SwitchToThread(class TThreadId, int)
-	?FreeOverhead@CMemSpyApiHeap@@QAEHXZ @ 107 NONAME ; int CMemSpyApiHeap::FreeOverhead(void)
-	?SwitchOutputToTraceL@RMemSpySession@@QAEXXZ @ 108 NONAME ; void RMemSpySession::SwitchOutputToTraceL(void)
-	?SlackFreeSpace@CMemSpyApiHeap@@QAEHXZ @ 109 NONAME ; int CMemSpyApiHeap::SlackFreeSpace(void)
-	?ForceSwmtUpdateL@RMemSpySession@@QAEXXZ @ 110 NONAME ; void RMemSpySession::ForceSwmtUpdateL(void)
-	?Priority@CMemSpyApiKernelObjectItem@@QBEHXZ @ 111 NONAME ; int CMemSpyApiKernelObjectItem::Priority(void) const
-	?ThreadCount@CMemSpyApiProcess@@QBEHXZ @ 112 NONAME ; int CMemSpyApiProcess::ThreadCount(void) const
-	?Caption@CMemSpyApiMemoryTrackingCycle@@QBEABVTDesC16@@XZ @ 113 NONAME ; class TDesC16 const & CMemSpyApiMemoryTrackingCycle::Caption(void) const
-	?RequestCount@CMemSpyApiThread@@QBEHXZ @ 114 NONAME ; int CMemSpyApiThread::RequestCount(void) const
-	?StopSwmtTimerL@RMemSpySession@@QAEXXZ @ 115 NONAME ; void RMemSpySession::StopSwmtTimerL(void)
-	??1CMemSpyApiProcess@@QAE@XZ @ 116 NONAME ; CMemSpyApiProcess::~CMemSpyApiProcess(void)
-	?MinLength@CMemSpyApiHeap@@QAEHXZ @ 117 NONAME ; int CMemSpyApiHeap::MinLength(void)
-	?ExitCategory@CMemSpyApiProcess@@QBE?AV?$TBuf@$0BA@@@XZ @ 118 NONAME ; class TBuf<16> CMemSpyApiProcess::ExitCategory(void) const
-	?Progress@TMemSpyDeviceWideOperationProgress@@QBEHXZ @ 119 NONAME ; int TMemSpyDeviceWideOperationProgress::Progress(void) const
-	?Count@CMemSpyApiKernelObject@@QBEHXZ @ 120 NONAME ; int CMemSpyApiKernelObject::Count(void) const
-	?StartPos@CMemSpyApiKernelObjectItem@@QBEHXZ @ 121 NONAME ; int CMemSpyApiKernelObjectItem::StartPos(void) const
-	?TimerState@CMemSpyApiKernelObjectItem@@QBE?AW4TMemSpyDriverTimerState@@XZ @ 122 NONAME ; enum TMemSpyDriverTimerState CMemSpyApiKernelObjectItem::TimerState(void) const
-	?BaseAddress@CMemSpyApiHeap@@QAEHXZ @ 123 NONAME ; int CMemSpyApiHeap::BaseAddress(void)
-	?ExitType@CMemSpyApiThread@@QBE?AW4TExitType@@XZ @ 124 NONAME ; enum TExitType CMemSpyApiThread::ExitType(void) const
-	?StartSwmtTimerL@RMemSpySession@@QAEXH@Z @ 125 NONAME ; void RMemSpySession::StartSwmtTimerL(int)
-	?Type@CMemSpyApiHeap@@QAEAAVTDesC16@@XZ @ 126 NONAME ; class TDesC16 & CMemSpyApiHeap::Type(void)
-	?Id@CMemSpyApiProcess@@QBE?AVTProcessId@@XZ @ 127 NONAME ; class TProcessId CMemSpyApiProcess::Id(void) const
-	?BiggestAllocation@CMemSpyApiHeap@@QAEHXZ @ 128 NONAME ; int CMemSpyApiHeap::BiggestAllocation(void)
-	??1CMemSpyApiKernelObjectItem@@QAE@XZ @ 129 NONAME ; CMemSpyApiKernelObjectItem::~CMemSpyApiKernelObjectItem(void)
-	?AllocationOverhead@CMemSpyApiHeap@@QAEHXZ @ 130 NONAME ; int CMemSpyApiHeap::AllocationOverhead(void)
-	?NameOfOwner@CMemSpyApiKernelObjectItem@@QBEABVTDesC8@@XZ @ 131 NONAME ; class TDesC8 const & CMemSpyApiKernelObjectItem::NameOfOwner(void) const
-	?OutputAllContainerContents@RMemSpySession@@QAEXXZ @ 132 NONAME ; void RMemSpySession::OutputAllContainerContents(void)
-	?OutputKernelObjectsL@RMemSpySession@@QAEXXZ @ 133 NONAME ; void RMemSpySession::OutputKernelObjectsL(void)
-	?ThreadSystemPermanentOrCritical@RMemSpySession@@QAEHVTThreadId@@H@Z @ 134 NONAME ; int RMemSpySession::ThreadSystemPermanentOrCritical(class TThreadId, int)
-	?Protection@CMemSpyApiKernelObjectItem@@QBEIXZ @ 135 NONAME ; unsigned int CMemSpyApiKernelObjectItem::Protection(void) const
-	?BiggestFree@CMemSpyApiHeap@@QAEHXZ @ 136 NONAME ; int CMemSpyApiHeap::BiggestFree(void)
-	?Attributes@CMemSpyApiThread@@QBEHXZ @ 137 NONAME ; int CMemSpyApiThread::Attributes(void) const
-	?Bottom@CMemSpyApiKernelObjectItem@@QBEHXZ @ 138 NONAME ; int CMemSpyApiKernelObjectItem::Bottom(void) const
-	?StartSwmtTimerL@RMemSpySession@@QAEXXZ @ 139 NONAME ; void RMemSpySession::StartSwmtTimerL(void)
-	?GetKernelObjectItemsL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiKernelObjectItem@@@@W4TMemSpyDriverContainerType@@@Z @ 140 NONAME ; void RMemSpySession::GetKernelObjectItemsL(class RArray<class CMemSpyApiKernelObjectItem *> &, enum TMemSpyDriverContainerType)
-	?NotifyDeviceWideOperationProgress@RMemSpySession@@QAEXAAVTMemSpyDeviceWideOperationProgress@@AAVTRequestStatus@@@Z @ 141 NONAME ; void RMemSpySession::NotifyDeviceWideOperationProgress(class TMemSpyDeviceWideOperationProgress &, class TRequestStatus &)
-	?OutputCompactHeapInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 142 NONAME ; void RMemSpySession::OutputCompactHeapInfo(class TRequestStatus &)
-	?OutputPhoneInfo@RMemSpySession@@QAEXXZ @ 143 NONAME ; void RMemSpySession::OutputPhoneInfo(void)
-	?ThreadHandles@CMemSpyApiThread@@QBEHXZ @ 144 NONAME ; int CMemSpyApiThread::ThreadHandles(void) const
-	?SvrSessionType@CMemSpyApiKernelObjectItem@@QBEEXZ @ 145 NONAME ; unsigned char CMemSpyApiKernelObjectItem::SvrSessionType(void) const
-	?SwitchOutputSinkL@RMemSpySession@@QAEXW4TMemSpySinkType@@@Z @ 146 NONAME ; void RMemSpySession::SwitchOutputSinkL(enum TMemSpySinkType)
-	?ChunkType@CMemSpyApiKernelObjectItem@@QBEIXZ @ 147 NONAME ; unsigned int CMemSpyApiKernelObjectItem::ChunkType(void) const
-	?Id@CMemSpyApiThread@@QBE?AVTThreadId@@XZ @ 148 NONAME ; class TThreadId CMemSpyApiThread::Id(void) const
-	?OutputPhoneInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 149 NONAME ; void RMemSpySession::OutputPhoneInfo(class TRequestStatus &)
-	?GetProcessIdByNameL@RMemSpySession@@QAE?AVTProcessId@@ABVTDesC16@@@Z @ 150 NONAME ; class TProcessId RMemSpySession::GetProcessIdByNameL(class TDesC16 const &)
-	?GetMemoryTrackingCyclesL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiMemoryTrackingCycle@@@@@Z @ 151 NONAME ; void RMemSpySession::GetMemoryTrackingCyclesL(class RArray<class CMemSpyApiMemoryTrackingCycle *> &)
-	?MapAttr@CMemSpyApiKernelObjectItem@@QBEIXZ @ 152 NONAME ; unsigned int CMemSpyApiKernelObjectItem::MapAttr(void) const
-	?OutputCompactStackInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 153 NONAME ; void RMemSpySession::OutputCompactStackInfo(class TRequestStatus &)
-	?VID@CMemSpyApiProcess@@QBEKXZ @ 154 NONAME ; unsigned long CMemSpyApiProcess::VID(void) const
-	?AddressOfCodeSeg@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 155 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfCodeSeg(void)
-	?GetThreadsL@RMemSpySession@@QAEXVTProcessId@@AAV?$RArray@PAVCMemSpyApiThread@@@@W4TSortType@@@Z @ 156 NONAME ; void RMemSpySession::GetThreadsL(class TProcessId, class RArray<class CMemSpyApiThread *> &, enum TSortType)
-	?ProcessId@CMemSpyApiThread@@QBE?AVTProcessId@@XZ @ 157 NONAME ; class TProcessId CMemSpyApiThread::ProcessId(void) const
-	?Type@CMemSpyApiKernelObjectItem@@QBE?AW4TMemSpyDriverContainerType@@XZ @ 158 NONAME ; enum TMemSpyDriverContainerType CMemSpyApiKernelObjectItem::Type(void) const
-	?ChunkSize@CMemSpyApiHeap@@QAEHXZ @ 159 NONAME ; int CMemSpyApiHeap::ChunkSize(void)
-	?UnitsMask@CMemSpyApiKernelObjectItem@@QBEIXZ @ 160 NONAME ; unsigned int CMemSpyApiKernelObjectItem::UnitsMask(void) const
-	?State@CMemSpyApiKernelObjectItem@@QBEEXZ @ 161 NONAME ; unsigned char CMemSpyApiKernelObjectItem::State(void) const
-	?Shared@CMemSpyApiHeap@@QAEHXZ @ 162 NONAME ; int CMemSpyApiHeap::Shared(void)
-	?SetSwmtAutoStartProcessList@RMemSpySession@@QAEXPAV?$CArrayFixFlat@VTUid@@@@@Z @ 163 NONAME ; void RMemSpySession::SetSwmtAutoStartProcessList(class CArrayFixFlat<class TUid> *)
-	?OutputCompactHeapInfoL@RMemSpySession@@QAEXXZ @ 164 NONAME ; void RMemSpySession::OutputCompactHeapInfoL(void)
-	?ProcessSystemPermanentOrCritical@RMemSpySession@@QAEHVTProcessId@@H@Z @ 165 NONAME ; int RMemSpySession::ProcessSystemPermanentOrCritical(class TProcessId, int)
-	?OutputKernelHeapDataL@RMemSpySession@@QAEXXZ @ 166 NONAME ; void RMemSpySession::OutputKernelHeapDataL(void)
-	?MapCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 167 NONAME ; int CMemSpyApiKernelObjectItem::MapCount(void) const
-	?OpenChannels@CMemSpyApiKernelObjectItem@@QAEHXZ @ 168 NONAME ; int CMemSpyApiKernelObjectItem::OpenChannels(void)
-	?EndProcess@RMemSpySession@@QAEHVTProcessId@@W4TMemSpyEndType@@@Z @ 169 NONAME ; int RMemSpySession::EndProcess(class TProcessId, enum TMemSpyEndType)
-	?ProcessPriority@CMemSpyApiThread@@QBE?AW4TProcessPriority@@XZ @ 170 NONAME ; enum TProcessPriority CMemSpyApiThread::ProcessPriority(void) const
-	?OutputAOListL@RMemSpySession@@QAEXVTThreadId@@W4TMemSpyThreadInfoItemType@@@Z @ 171 NONAME ; void RMemSpySession::OutputAOListL(class TThreadId, enum TMemSpyThreadInfoItemType)
-	?ThreadNumberUsing@CMemSpyApiThread@@QBEHXZ @ 172 NONAME ; int CMemSpyApiThread::ThreadNumberUsing(void) const
-	?OutputHeapInfoUserL@RMemSpySession@@QAEXVTThreadId@@@Z @ 173 NONAME ; void RMemSpySession::OutputHeapInfoUserL(class TThreadId)
-	?OutputThreadCellListL@RMemSpySession@@QAEXVTThreadId@@@Z @ 174 NONAME ; void RMemSpySession::OutputThreadCellListL(class TThreadId)
-	?GetThreadInfoItems@RMemSpySession@@QAEHAAV?$RArray@PAVCMemSpyApiThreadInfoItem@@@@VTThreadId@@W4TMemSpyThreadInfoItemType@@@Z @ 175 NONAME ; int RMemSpySession::GetThreadInfoItems(class RArray<class CMemSpyApiThreadInfoItem *> &, class TThreadId, enum TMemSpyThreadInfoItemType)
-	??1CMemSpyApiThread@@QAE@XZ @ 176 NONAME ; CMemSpyApiThread::~CMemSpyApiThread(void)
-	?Connect@RMemSpySession@@QAEHXZ @ 177 NONAME ; int RMemSpySession::Connect(void)
-	?SID@CMemSpyApiThread@@QBEHXZ @ 178 NONAME ; int CMemSpyApiThread::SID(void) const
-	?GetKernelObjectItems@RMemSpySession@@QAEHAAV?$RArray@PAVCMemSpyApiKernelObjectItem@@@@W4TMemSpyDriverContainerType@@@Z @ 179 NONAME ; int RMemSpySession::GetKernelObjectItems(class RArray<class CMemSpyApiKernelObjectItem *> &, enum TMemSpyDriverContainerType)
-	?ProcessHandles@CMemSpyApiThread@@QBEHXZ @ 180 NONAME ; int CMemSpyApiThread::ProcessHandles(void) const
-	?Name@CMemSpyApiThread@@QBEABVTDesC16@@XZ @ 181 NONAME ; class TDesC16 const & CMemSpyApiThread::Name(void) const
-	?IsDead@CMemSpyApiProcess@@QBEHXZ @ 182 NONAME ; int CMemSpyApiProcess::IsDead(void) const
-
--- a/memspy/MemSpyClient/eabi/MemSpyClientu.def	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-EXPORTS
-	_ZN14CMemSpyApiHeap11BaseAddressEv @ 1 NONAME
-	_ZN14CMemSpyApiHeap11BiggestFreeEv @ 2 NONAME
-	_ZN14CMemSpyApiHeap11HeaderSizeAEv @ 3 NONAME
-	_ZN14CMemSpyApiHeap11HeaderSizeFEv @ 4 NONAME
-	_ZN14CMemSpyApiHeap12FreeOverheadEv @ 5 NONAME
-	_ZN14CMemSpyApiHeap13FragmentationEv @ 6 NONAME
-	_ZN14CMemSpyApiHeap13TotalOverheadEv @ 7 NONAME
-	_ZN14CMemSpyApiHeap14SlackFreeSpaceEv @ 8 NONAME
-	_ZN14CMemSpyApiHeap16AllocationsCountEv @ 9 NONAME
-	_ZN14CMemSpyApiHeap16TotalAllocationsEv @ 10 NONAME
-	_ZN14CMemSpyApiHeap17BiggestAllocationEv @ 11 NONAME
-	_ZN14CMemSpyApiHeap18AllocationOverheadEv @ 12 NONAME
-	_ZN14CMemSpyApiHeap21DebugAllocatorLibraryEv @ 13 NONAME
-	_ZN14CMemSpyApiHeap4SizeEv @ 14 NONAME
-	_ZN14CMemSpyApiHeap4TypeEv @ 15 NONAME
-	_ZN14CMemSpyApiHeap6SharedEv @ 16 NONAME
-	_ZN14CMemSpyApiHeap8OverheadEv @ 17 NONAME
-	_ZN14CMemSpyApiHeap9ChunkSizeEv @ 18 NONAME
-	_ZN14CMemSpyApiHeap9FreeCountEv @ 19 NONAME
-	_ZN14CMemSpyApiHeap9MaxLengthEv @ 20 NONAME
-	_ZN14CMemSpyApiHeap9MinLengthEv @ 21 NONAME
-	_ZN14CMemSpyApiHeap9TotalFreeEv @ 22 NONAME
-	_ZN14CMemSpyApiHeapD1Ev @ 23 NONAME
-	_ZN14CMemSpyApiHeapD2Ev @ 24 NONAME
-	_ZN14RMemSpySession10EndProcessE10TProcessId14TMemSpyEndType @ 25 NONAME
-	_ZN14RMemSpySession11GetThreadsLE10TProcessIdR6RArrayIP16CMemSpyApiThreadE9TSortType @ 26 NONAME
-	_ZN14RMemSpySession13GetOutputSinkE15TMemSpySinkType @ 27 NONAME
-	_ZN14RMemSpySession13GetProcessesLER6RArrayIP17CMemSpyApiProcessE9TSortType @ 28 NONAME
-	_ZN14RMemSpySession13OutputAOListLE9TThreadId25TMemSpyThreadInfoItemType @ 29 NONAME
-	_ZN14RMemSpySession13SetSwmtConfigE38TMemSpyEngineHelperSysMemTrackerConfig @ 30 NONAME
-	_ZN14RMemSpySession13SetSwmtFilterERK7TDesC16 @ 31 NONAME
-	_ZN14RMemSpySession14DumpKernelHeapEv @ 32 NONAME
-	_ZN14RMemSpySession14IsSwmtRunningLEv @ 33 NONAME
-	_ZN14RMemSpySession14OutputHeapDataER14TRequestStatus @ 34 NONAME
-	_ZN14RMemSpySession14OutputHeapDataEv @ 35 NONAME
-	_ZN14RMemSpySession14OutputHeapInfoER14TRequestStatus @ 36 NONAME
-	_ZN14RMemSpySession14StopSwmtTimerLEv @ 37 NONAME
-	_ZN14RMemSpySession14SwitchToThreadE9TThreadIdi @ 38 NONAME
-	_ZN14RMemSpySession15ForceSwmtUpdateER14TRequestStatus @ 39 NONAME
-	_ZN14RMemSpySession15GetInfoItemTypeEi9TThreadIdR25TMemSpyThreadInfoItemType @ 40 NONAME
-	_ZN14RMemSpySession15OutputPhoneInfoER14TRequestStatus @ 41 NONAME
-	_ZN14RMemSpySession15OutputPhoneInfoEv @ 42 NONAME
-	_ZN14RMemSpySession15OutputStackInfoER14TRequestStatus @ 43 NONAME
-	_ZN14RMemSpySession15StartSwmtTimerLEi @ 44 NONAME
-	_ZN14RMemSpySession15StartSwmtTimerLEv @ 45 NONAME
-	_ZN14RMemSpySession15SwitchToProcessE10TProcessIdi @ 46 NONAME
-	_ZN14RMemSpySession16ForceSwmtUpdateLEv @ 47 NONAME
-	_ZN14RMemSpySession16GetKernelObjectsER6RArrayIP22CMemSpyApiKernelObjectE @ 48 NONAME
-	_ZN14RMemSpySession16OutputStackDataLE9TThreadId23TMemSpyDriverDomainType @ 49 NONAME
-	_ZN14RMemSpySession16OutputStackInfoLE9TThreadId @ 50 NONAME
-	_ZN14RMemSpySession17GetKernelObjectsLER6RArrayIP22CMemSpyApiKernelObjectE @ 51 NONAME
-	_ZN14RMemSpySession17SwitchOutputSinkLE15TMemSpySinkType @ 52 NONAME
-	_ZN14RMemSpySession17SwmtResetTrackingEv @ 53 NONAME
-	_ZN14RMemSpySession18GetThreadInfoItemsER6RArrayIP24CMemSpyApiThreadInfoItemE9TThreadId25TMemSpyThreadInfoItemType @ 54 NONAME
-	_ZN14RMemSpySession18SetSwmtCategoriesLEi @ 55 NONAME
-	_ZN14RMemSpySession18SetThreadPriorityLE9TThreadIdi @ 56 NONAME
-	_ZN14RMemSpySession19GetProcessIdByNameLERK7TDesC16 @ 57 NONAME
-	_ZN14RMemSpySession19GetThreadInfoItemsLER6RArrayIP24CMemSpyApiThreadInfoItemE9TThreadId25TMemSpyThreadInfoItemType @ 58 NONAME
-	_ZN14RMemSpySession19OutputHeapInfoUserLE9TThreadId @ 59 NONAME
-	_ZN14RMemSpySession19OutputUserStackDataER14TRequestStatus @ 60 NONAME
-	_ZN14RMemSpySession19SwitchOutputToFileLERK7TDesC16 @ 61 NONAME
-	_ZN14RMemSpySession20GetKernelObjectItemsER6RArrayIP26CMemSpyApiKernelObjectItemE26TMemSpyDriverContainerType @ 62 NONAME
-	_ZN14RMemSpySession20OutputKernelHeapDataER14TRequestStatus @ 63 NONAME
-	_ZN14RMemSpySession20OutputKernelObjectsLEv @ 64 NONAME
-	_ZN14RMemSpySession20SwitchOutputToTraceLEv @ 65 NONAME
-	_ZN14RMemSpySession21GetKernelObjectItemsLER6RArrayIP26CMemSpyApiKernelObjectItemE26TMemSpyDriverContainerType @ 66 NONAME
-	_ZN14RMemSpySession21OutputCompactHeapInfoER14TRequestStatus @ 67 NONAME
-	_ZN14RMemSpySession21OutputHeapCellListingER14TRequestStatus @ 68 NONAME
-	_ZN14RMemSpySession21OutputKernelHeapDataLEv @ 69 NONAME
-	_ZN14RMemSpySession21OutputKernelStackDataER14TRequestStatus @ 70 NONAME
-	_ZN14RMemSpySession21OutputThreadCellListLE9TThreadId @ 71 NONAME
-	_ZN14RMemSpySession21OutputThreadHeapDataLE9TThreadId @ 72 NONAME
-	_ZN14RMemSpySession21OutputThreadHeapDataLERK7TDesC16 @ 73 NONAME
-	_ZN14RMemSpySession21SetSwmtTimerIntervalLEi @ 74 NONAME
-	_ZN14RMemSpySession22OutputCompactHeapInfoLEv @ 75 NONAME
-	_ZN14RMemSpySession22OutputCompactStackInfoER14TRequestStatus @ 76 NONAME
-	_ZN14RMemSpySession23OutputCompactStackInfoLEv @ 77 NONAME
-	_ZN14RMemSpySession23OutputDetailedPhoneInfoER14TRequestStatus @ 78 NONAME
-	_ZN14RMemSpySession24GetMemoryTrackingCyclesLER6RArrayIP29CMemSpyApiMemoryTrackingCycleE @ 79 NONAME
-	_ZN14RMemSpySession24OutputThreadInfoHandlesLE9TThreadId @ 80 NONAME
-	_ZN14RMemSpySession24SetSwmtHeapDumpsEnabledLEi @ 81 NONAME
-	_ZN14RMemSpySession26CancelDeviceWideOperationLEv @ 82 NONAME
-	_ZN14RMemSpySession26OutputAllContainerContentsEv @ 83 NONAME
-	_ZN14RMemSpySession27SetSwmtAutoStartProcessListEP13CArrayFixFlatI4TUidE @ 84 NONAME
-	_ZN14RMemSpySession31ThreadSystemPermanentOrCriticalE9TThreadIdi @ 85 NONAME
-	_ZN14RMemSpySession32ProcessSystemPermanentOrCriticalE10TProcessIdi @ 86 NONAME
-	_ZN14RMemSpySession33NotifyDeviceWideOperationProgressER34TMemSpyDeviceWideOperationProgressR14TRequestStatus @ 87 NONAME
-	_ZN14RMemSpySession7ConnectEv @ 88 NONAME
-	_ZN14RMemSpySession7GetHeapEv @ 89 NONAME
-	_ZN14RMemSpySession8GetHeapLEv @ 90 NONAME
-	_ZN14RMemSpySession9EndThreadE9TThreadId14TMemSpyEndType @ 91 NONAME
-	_ZN14RMemSpySessionC1Ev @ 92 NONAME
-	_ZN14RMemSpySessionC2Ev @ 93 NONAME
-	_ZN16CMemSpyApiThreadD1Ev @ 94 NONAME
-	_ZN16CMemSpyApiThreadD2Ev @ 95 NONAME
-	_ZN17CMemSpyApiProcessD1Ev @ 96 NONAME
-	_ZN17CMemSpyApiProcessD2Ev @ 97 NONAME
-	_ZN22CMemSpyApiKernelObjectD1Ev @ 98 NONAME
-	_ZN22CMemSpyApiKernelObjectD2Ev @ 99 NONAME
-	_ZN24CMemSpyApiThreadInfoItemD1Ev @ 100 NONAME
-	_ZN24CMemSpyApiThreadInfoItemD2Ev @ 101 NONAME
-	_ZN26CMemSpyApiKernelObjectItem12OpenChannelsEv @ 102 NONAME
-	_ZN26CMemSpyApiKernelObjectItem15AddressOfServerEv @ 103 NONAME
-	_ZN26CMemSpyApiKernelObjectItem16AddressOfCodeSegEv @ 104 NONAME
-	_ZN26CMemSpyApiKernelObjectItem20AddressOfKernelOwnerEv @ 105 NONAME
-	_ZN26CMemSpyApiKernelObjectItem21AddressOfOwningThreadEv @ 106 NONAME
-	_ZN26CMemSpyApiKernelObjectItem22AddressOfOwningProcessEv @ 107 NONAME
-	_ZN26CMemSpyApiKernelObjectItem26AddressOfDataBssStackChunkEv @ 108 NONAME
-	_ZN26CMemSpyApiKernelObjectItemD1Ev @ 109 NONAME
-	_ZN26CMemSpyApiKernelObjectItemD2Ev @ 110 NONAME
-	_ZN29CMemSpyApiMemoryTrackingCycleD1Ev @ 111 NONAME
-	_ZN29CMemSpyApiMemoryTrackingCycleD2Ev @ 112 NONAME
-	_ZNK16CMemSpyApiThread10AttributesEv @ 113 NONAME
-	_ZNK16CMemSpyApiThread12RequestCountEv @ 114 NONAME
-	_ZNK16CMemSpyApiThread13ThreadHandlesEv @ 115 NONAME
-	_ZNK16CMemSpyApiThread14ProcessHandlesEv @ 116 NONAME
-	_ZNK16CMemSpyApiThread14ThreadPriorityEv @ 117 NONAME
-	_ZNK16CMemSpyApiThread15ProcessPriorityEv @ 118 NONAME
-	_ZNK16CMemSpyApiThread17ThreadNumberUsingEv @ 119 NONAME
-	_ZNK16CMemSpyApiThread18ProcessNumberUsingEv @ 120 NONAME
-	_ZNK16CMemSpyApiThread2IdEv @ 121 NONAME
-	_ZNK16CMemSpyApiThread3SIDEv @ 122 NONAME
-	_ZNK16CMemSpyApiThread3VIDEv @ 123 NONAME
-	_ZNK16CMemSpyApiThread4NameEv @ 124 NONAME
-	_ZNK16CMemSpyApiThread6CpuUseEv @ 125 NONAME
-	_ZNK16CMemSpyApiThread8ExitTypeEv @ 126 NONAME
-	_ZNK16CMemSpyApiThread9ProcessIdEv @ 127 NONAME
-	_ZNK17CMemSpyApiProcess10ExitReasonEv @ 128 NONAME
-	_ZNK17CMemSpyApiProcess11ThreadCountEv @ 129 NONAME
-	_ZNK17CMemSpyApiProcess12ExitCategoryEv @ 130 NONAME
-	_ZNK17CMemSpyApiProcess2IdEv @ 131 NONAME
-	_ZNK17CMemSpyApiProcess3SIDEv @ 132 NONAME
-	_ZNK17CMemSpyApiProcess3VIDEv @ 133 NONAME
-	_ZNK17CMemSpyApiProcess4NameEv @ 134 NONAME
-	_ZNK17CMemSpyApiProcess8ExitTypeEv @ 135 NONAME
-	_ZNK17CMemSpyApiProcess8PriorityEv @ 136 NONAME
-	_ZNK22CMemSpyApiKernelObject4NameEv @ 137 NONAME
-	_ZNK22CMemSpyApiKernelObject4SizeEv @ 138 NONAME
-	_ZNK22CMemSpyApiKernelObject4TypeEv @ 139 NONAME
-	_ZNK22CMemSpyApiKernelObject5CountEv @ 140 NONAME
-	_ZNK24CMemSpyApiThreadInfoItem5ValueEv @ 141 NONAME
-	_ZNK24CMemSpyApiThreadInfoItem7CaptionEv @ 142 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem10AttributesEv @ 143 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem10NameDetailEv @ 144 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem10ProtectionEv @ 145 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem10TimerStateEv @ 146 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem11AccessCountEv @ 147 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem11NameOfOwnerEv @ 148 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem11SessionTypeEv @ 149 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem12RestrictionsEv @ 150 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem12SecurityZoneEv @ 151 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem14SvrSessionTypeEv @ 152 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem16ControllingOwnerEv @ 153 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem16TotalAccessCountEv @ 154 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem2IdEv @ 155 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem3TopEv @ 156 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem4NameEv @ 157 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem4SizeEv @ 158 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem4TypeEv @ 159 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem5CountEv @ 160 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem5OrderEv @ 161 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem5StateEv @ 162 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem6BottomEv @ 163 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem6HandleEv @ 164 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem7ChangesEv @ 165 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem7MapAttrEv @ 166 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem7MaxSizeEv @ 167 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem7VersionEv @ 168 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8MapCountEv @ 169 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8MsgCountEv @ 170 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8MsgLimitEv @ 171 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8PriorityEv @ 172 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8StartPosEv @ 173 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8UniqueIDEv @ 174 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9ChunkTypeEv @ 175 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9CreatorIdEv @ 176 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9ParseMaskEv @ 177 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9ResettingEv @ 178 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9TimerTypeEv @ 179 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9UnitsMaskEv @ 180 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9WaitCountEv @ 181 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle10FreeMemoryEv @ 182 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle11CycleNumberEv @ 183 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle11MemoryDeltaEv @ 184 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle17PreviousCycleDiffEv @ 185 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle4TimeEv @ 186 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle7CaptionEv @ 187 NONAME
-	_ZNK34TMemSpyDeviceWideOperationProgress11DescriptionEv @ 188 NONAME
-	_ZNK34TMemSpyDeviceWideOperationProgress8ProgressEv @ 189 NONAME
-	_ZNK17CMemSpyApiProcess6IsDeadEv @ 190 NONAME
-
--- a/memspy/MemSpyClient/group/MemSpyClient.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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 <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGETTYPE dll
-TARGET MemSpyClient.dll
-UID 0 0x2002EA8E
-VENDORID	VID_DEFAULT
-SMPSAFE
-
-CAPABILITY PowerMgmt SwEvent ReadUserData WriteUserData ReadDeviceData WriteDeviceData CommDD MultimediaDD DRM TrustedUI ProtServ DiskAdmin NetworkControl AllFiles NetworkServices LocalServices Location SurroundingsDD UserEnvironment
-
-SOURCEPATH ../src
-SOURCE 		memspysession.cpp 
-SOURCE 		memspyapiprocess.cpp 
-SOURCE 		memspyapikernelobject.cpp 
-SOURCE		memspyapiheap.cpp 
-SOURCE 		memspyapikernelobjectitem.cpp 
-SOURCE		memspyapithread.cpp 
-SOURCE		memspyapithreadinfoitem.cpp
-SOURCE		memspyapimemorytrackingcycle.cpp
-
-USERINCLUDE ../inc
-
-OS_LAYER_SYSTEMINCLUDE
-
-LIBRARY 		euser.lib
-LIBRARY			ecom.lib
-LIBRARY			efsrv.lib
-LIBRARY			estor.lib
-LIBRARY			bafl.lib
-LIBRARY			ws32.lib
-LIBRARY			cone.lib
-LIBRARY			eikcore.lib
-LIBRARY			fbscli.lib 
-LIBRARY 		PlatformEnv.lib
-LIBRARY         MemSpyEngine.lib
-
-//EXPORTUNFROZEN
--- a/memspy/MemSpyClient/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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 <platform_paths.hrh>
-
-PRJ_EXPORTS
-// Public API
-../inc/memspysession.h OS_LAYER_PLATFORM_EXPORT_PATH(memspysession.h)
-../inc/memspyprocessdata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyprocessdata.h)
-../inc/memspykernelobjectdata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspykernelobjectdata.h)
-../inc/memspyheapdata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyheapdata.h)
-../inc/memspythreaddata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspythreaddata.h)
-../inc/memspythreadinfoitemdata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspythreadinfoitemdata.h)
-../inc/memspymemorytrackingcycledata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspymemorytrackingcycledata.h)
-
-../inc/memspyapiprocess.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapiprocess.h)
-../inc/memspyapikernelobject.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapikernelobject.h)
-../inc/memspyapikernelobjectitem.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapikernelobjectitem.h)
-../inc/memspyapiheap.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapiheap.h)
-../inc/memspyapithread.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapithread.h)
-../inc/memspyapithreadinfoitem.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapithreadinfoitem.h)
-../inc/memspyapimemorytrackingcycle.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapimemorytrackingcycle.h)
-
-PRJ_MMPFILES
-MemSpyClient.mmp
\ No newline at end of file
--- a/memspy/MemSpyClient/inc/memspyapiheap.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +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:
-* Contains the declaration of  CMemSpyApiHeap class 
-*/
-
-#ifndef MEMSPYAPIHEAP_H
-#define MEMSPYAPIHEAP_H
-
-// System includes
-#include <e32base.h>
-
-class TMemSpyHeapData;
-
-NONSHARABLE_CLASS( CMemSpyApiHeap ) 
-	{
-public:
-	IMPORT_C ~CMemSpyApiHeap();
-	
-	static CMemSpyApiHeap* NewL(const TMemSpyHeapData& aData);
-
-	static CMemSpyApiHeap* NewLC(const TMemSpyHeapData& aData);
-	
-public: //API
-	IMPORT_C TDesC& Type();
-	IMPORT_C TInt Size();
-	IMPORT_C TInt BaseAddress();
-	IMPORT_C TBool Shared();
-	IMPORT_C TInt ChunkSize();
-	IMPORT_C TInt AllocationsCount();
-	IMPORT_C TInt FreeCount();
-	IMPORT_C TInt BiggestAllocation();
-	IMPORT_C TInt BiggestFree();
-	IMPORT_C TInt TotalAllocations();
-	IMPORT_C TInt TotalFree();
-	IMPORT_C TInt SlackFreeSpace();
-	IMPORT_C TInt Fragmentation(); // Percentage value, iSize is 100% - value for calculation
-	IMPORT_C TInt HeaderSizeA();
-	IMPORT_C TInt HeaderSizeF();
-	IMPORT_C TInt AllocationOverhead();
-	IMPORT_C TInt FreeOverhead();
-	IMPORT_C TInt TotalOverhead();
-	IMPORT_C TInt Overhead(); //Percentage value, iSize is 100% - value for calculation
-	IMPORT_C TInt MinLength();
-	IMPORT_C TInt MaxLength();
-	IMPORT_C TBool DebugAllocatorLibrary();
-	
-private:
-	CMemSpyApiHeap();
-	
-	void ConstructL(const TMemSpyHeapData& aData);
-		
-private:
-	TMemSpyHeapData *iHeapData;
-};
-
-	
-#endif // MEMSPYAPIHEAP_H
--- a/memspy/MemSpyClient/inc/memspyapikernelobject.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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 MEMSPYAPIPKERNELOBJECT_H
-#define MEMSPYAPIPKERNELOBJECT_H
-
-// System includes
-#include <e32base.h>
-
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-class TMemSpyKernelObjectData;
-
-NONSHARABLE_CLASS( CMemSpyApiKernelObject ) 
-	{
-public:
-	IMPORT_C ~CMemSpyApiKernelObject();
-	
-	static CMemSpyApiKernelObject* NewL(const TMemSpyKernelObjectData& aData);
-
-	static CMemSpyApiKernelObject* NewLC(const TMemSpyKernelObjectData& aData);
-	
-public:
-	IMPORT_C TMemSpyDriverContainerType Type() const;
-	
-	IMPORT_C const TDesC& Name() const;	
-						
-	IMPORT_C TInt Count() const;
-		
-	IMPORT_C TInt64 Size() const;
-	
-private:
-	CMemSpyApiKernelObject();
-	
-	void ConstructL(const TMemSpyKernelObjectData& aData);
-		
-private:
-	TMemSpyKernelObjectData *iKernelObjectData;
-};
-
-	
-#endif // MEMSPYAPIPKERNELOBJECT_H
--- a/memspy/MemSpyClient/inc/memspyapikernelobjectitem.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +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:
-* Contains the declaration of  CMemSpyProcess class 
-*/
-
-#ifndef MEMSPYAPIKERNELOBJECTITEM_H
-#define MEMSPYAPIKERNELOBJECTITEM_H
-
-// System includes
-#include <e32base.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-class TMemSpyDriverHandleInfoGeneric;
-//class TMemSpyDriverContainerType;	
-//class TMemSpyDriverTimerType;
-//class TMemSpyDriverTimerState;
-
-NONSHARABLE_CLASS( CMemSpyApiKernelObjectItem ) 
-	{
-public:
-	IMPORT_C ~CMemSpyApiKernelObjectItem();
-	
-	static CMemSpyApiKernelObjectItem* NewL(const TMemSpyDriverHandleInfoGeneric& aData);
-
-	static CMemSpyApiKernelObjectItem* NewLC(const TMemSpyDriverHandleInfoGeneric& aData);
-	
-public:	
-	
-	IMPORT_C const TDesC8& Name() const;	
-	
-	IMPORT_C TAny* Handle() const;
-	
-	IMPORT_C TMemSpyDriverContainerType Type() const;
-	
-    // For Process, thread, chunk (owning process id), server (owning thread id)
-    IMPORT_C TInt Id() const;
-
-    // For Chunk, Library
-    IMPORT_C TUint32 Size() const;
-   
-    // For Semaphore, Mutex, Server
-    IMPORT_C TInt Count() const;
-
-    // For Mutex
-    IMPORT_C TInt WaitCount() const;
-
-    // For Server, Session
-    IMPORT_C TIpcSessionType SessionType() const;
-
-    // For Timer
-    IMPORT_C TMemSpyDriverTimerType TimerType() const;
-    IMPORT_C TMemSpyDriverTimerState TimerState() const;
-
-    // For Logical channel
-    IMPORT_C TInt OpenChannels();
-    
-    // For most of the object types
-    IMPORT_C const TDesC8& NameDetail() const; // Name
-    IMPORT_C TInt AccessCount() const;
-    IMPORT_C TInt UniqueID() const;
-    IMPORT_C TUint Protection() const;
-    IMPORT_C TUint8* AddressOfKernelOwner();
-    IMPORT_C TInt Priority() const;
-    IMPORT_C TUint8* AddressOfOwningProcess();
-    IMPORT_C TUint CreatorId() const;
-    IMPORT_C TUint SecurityZone() const;
-    IMPORT_C TInt Attributes() const;
-    IMPORT_C TUint8* AddressOfDataBssStackChunk();
-
-    // For Server, Session
-    IMPORT_C TUint8* AddressOfOwningThread();
-    IMPORT_C TUint8* AddressOfServer();
-    IMPORT_C TUint16 TotalAccessCount() const;
-    IMPORT_C TUint8 SvrSessionType() const;
-    IMPORT_C TInt MsgCount() const;
-    IMPORT_C TInt MsgLimit() const;
-    
-    // For chunk
-    IMPORT_C TInt MaxSize() const;
-    IMPORT_C TInt Bottom() const;
-    IMPORT_C TInt Top() const;
-    IMPORT_C TInt StartPos() const;
-    IMPORT_C TUint ControllingOwner() const;
-    IMPORT_C TUint Restrictions() const;
-    IMPORT_C TUint MapAttr() const;
-    IMPORT_C TUint ChunkType() const;
-    IMPORT_C const TDesC8& NameOfOwner() const; // chunk, server
-    
-    // For library
-    IMPORT_C TInt MapCount() const;
-    IMPORT_C TUint8 State() const;
-    IMPORT_C TUint8* AddressOfCodeSeg();
-    
-    // Semaphore, mutex, condvar
-    IMPORT_C TUint8 Resetting() const;
-    IMPORT_C TUint8 Order() const;
-    
-    // For Logical/Physical device
-    IMPORT_C TVersion Version() const;
-    IMPORT_C TUint ParseMask() const;
-    IMPORT_C TUint UnitsMask() const;
-    
-    // For change notifier
-    IMPORT_C TUint Changes() const;
-	
-private:
-	CMemSpyApiKernelObjectItem();
-	
-	void ConstructL(const TMemSpyDriverHandleInfoGeneric& aData);
-		
-private:
-	TMemSpyDriverHandleInfoGeneric *iItem;
-};
-
-	
-#endif // MEMSPYAPIKERNELOBJECTITEM_H
--- a/memspy/MemSpyClient/inc/memspyapimemorytrackingcycle.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +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 MEMSPYAPIMEMORYTRACKINGCYCLE_H_
-#define MEMSPYAPIMEMORYTRACKINGCYCLE_H_
-
-#include <e32base.h>
-
-class TMemSpyMemoryTrackingCycleData;
-
-class CMemSpyApiMemoryTrackingCycle
-	{
-public: // API
-	IMPORT_C TInt CycleNumber() const;
-	IMPORT_C const TTime& Time() const;
-	IMPORT_C const TDesC& Caption() const;
-	IMPORT_C const TInt64& FreeMemory() const;
-	IMPORT_C TInt64 MemoryDelta() const;
-	IMPORT_C TInt64 PreviousCycleDiff() const;
-	
-public:
-	IMPORT_C ~CMemSpyApiMemoryTrackingCycle();
-	
-	static CMemSpyApiMemoryTrackingCycle* NewL(const TMemSpyMemoryTrackingCycleData& aData);
-
-	static CMemSpyApiMemoryTrackingCycle* NewLC(const TMemSpyMemoryTrackingCycleData& aData);
-	
-private:
-	CMemSpyApiMemoryTrackingCycle();
-	
-	void ConstructL(const TMemSpyMemoryTrackingCycleData& aData);
-	
-private:
-	TMemSpyMemoryTrackingCycleData* iData;
-	
-	};
-
-#endif /* MEMSPYAPIMEMORYTRACKINGCYCLE_H_ */
--- a/memspy/MemSpyClient/inc/memspyapiprocess.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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:
-* Contains the declaration of  CMemSpyProcess class 
-*/
-
-#ifndef MEMSPYAPIPROCESS_H
-#define MEMSPYAPIPROCESS_H
-
-// System includes
-#include <e32base.h>
-
-class TMemSpyProcessData;
-
-NONSHARABLE_CLASS( CMemSpyApiProcess ) 
-	{
-public:
-	IMPORT_C ~CMemSpyApiProcess();
-	
-	static CMemSpyApiProcess* NewL(const TMemSpyProcessData& aData);
-
-	static CMemSpyApiProcess* NewLC(const TMemSpyProcessData& aData);
-	
-public:
-	IMPORT_C TProcessId Id() const;
-	
-	IMPORT_C const TDesC& Name() const;	
-	
-	IMPORT_C TExitCategoryName ExitCategory() const;
-	
-	IMPORT_C TInt ExitReason() const;
-	
-	IMPORT_C TExitType ExitType() const;
-	
-	IMPORT_C TInt ThreadCount() const;
-	
-	IMPORT_C TUint32 SID() const;
-	
-	IMPORT_C TUint32 VID() const;
-	
-	IMPORT_C TProcessPriority Priority() const;
-	
-	IMPORT_C TBool IsDead() const;
-	
-	
-private:
-	CMemSpyApiProcess();
-	
-	void ConstructL(const TMemSpyProcessData& aData);
-		
-private:
-	TMemSpyProcessData *iProcessData;
-};
-
-	
-#endif // MEMSPYAPIPROCESS_H
--- a/memspy/MemSpyClient/inc/memspyapithread.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +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:
-* Contains the declaration of  CMemSpyProcessWrapper class and TMemSpyProcess data class
-*/
-
-#ifndef MEMSPYAPITHREAD_H
-#define MEMSPYAPITHREAD_H
-
-// System includes
-#include <e32base.h>
-
-class TMemSpyThreadData;
-
-NONSHARABLE_CLASS( CMemSpyApiThread ) {
-
-public:
-	IMPORT_C ~CMemSpyApiThread();
-	
-	static CMemSpyApiThread* NewL(const TMemSpyThreadData& aData);
-
-	static CMemSpyApiThread* NewLC(const TMemSpyThreadData& aData);
-
-public:
-	IMPORT_C TThreadId Id() const;
-	IMPORT_C TProcessId ProcessId() const;
-	
-	IMPORT_C const TDesC& Name() const;
-		
-	IMPORT_C TInt SID() const;
-	
-	IMPORT_C TInt VID() const;
-	
-	IMPORT_C TThreadPriority ThreadPriority() const;
-	
-	IMPORT_C TProcessPriority ProcessPriority() const;
-	
-	IMPORT_C TInt RequestCount() const;
-	
-	IMPORT_C TInt ThreadHandles() const;
-	
-	IMPORT_C TInt ProcessHandles() const;
-	
-	IMPORT_C TInt ThreadNumberUsing() const;
-	
-	IMPORT_C TInt ProcessNumberUsing() const;
-	
-	IMPORT_C TInt Attributes() const;
-	
-	IMPORT_C TInt CpuUse() const;
-	
-	IMPORT_C TExitType ExitType() const;
-	
-private:
-	CMemSpyApiThread();	
-	
-	void ConstructL(const TMemSpyThreadData& aData);
-private:
-	TMemSpyThreadData* iThreadData;
-};
-
-#endif
--- a/memspy/MemSpyClient/inc/memspyapithreadinfoitem.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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:
-* Contains the declaration of  CMemSpyProcess class 
-*/
-
-#ifndef MEMSPYAPITHREADINFOITEM_H
-#define MEMSPYAPITHREADINFOITEM_H
-
-// System includes
-#include <e32base.h>
-
-class TMemSpyThreadInfoItemData;
-
-NONSHARABLE_CLASS( CMemSpyApiThreadInfoItem ) 
-	{
-public:
-	IMPORT_C ~CMemSpyApiThreadInfoItem();
-	
-	static CMemSpyApiThreadInfoItem* NewL(const TMemSpyThreadInfoItemData& aData);
-
-	static CMemSpyApiThreadInfoItem* NewLC(const TMemSpyThreadInfoItemData& aData);
-	
-public:		
-	IMPORT_C const TDesC& Caption() const;	
-	
-	IMPORT_C const TDesC& Value() const;	
-	
-private:
-	CMemSpyApiThreadInfoItem();
-	
-	void ConstructL(const TMemSpyThreadInfoItemData& aData);
-		
-private:
-	TMemSpyThreadInfoItemData *iInfoItem;
-};
-
-	
-#endif // MEMSPYAPITHREADINFOITEM_H
--- a/memspy/MemSpyClient/inc/memspyheapdata.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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:
-* Contains the declaration of  TMemSpyProcessData class
-*/
-
-#ifndef MEMSPYHEAPDATA_H
-#define MEMSPYHEAPDATA_H
-
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Constants
-const TInt KBuf = 16;
-
-// TMemSpyProcess data class holds data to be sent to the UI
-class TMemSpyHeapData 
-	{	
-public:
-	//constructor & destructor
-	inline TMemSpyHeapData()		
-	: iSize(0), iBaseAddress(0), iShared(EFalse), iChunkSize(0),
-	iAllocationsCount(0), iFreeCount(0), iBiggestAllocation(0), iBiggestFree(0), iTotalAllocations(0),
-    iTotalFree(0), iSlackFreeSpace(0), iFragmentation(0), iHeaderSizeA(0), iHeaderSizeF(0), iAllocationOverhead(0),
-    iFreeOverhead(0), iTotalOverhead(0), iOverhead(0), iMinLength(0), iMaxLength(0), iDebugAllocatorLibrary(EFalse)
-		{
-		}
-	
-public:
-	TBuf<KBuf> iType;
-	TUint iSize;
-	TLinAddr iBaseAddress;
-	TBool iShared;
-	TUint iChunkSize;
-	TUint iAllocationsCount;
-	TUint iFreeCount;
-	TUint iBiggestAllocation;
-	TUint iBiggestFree;
-    TUint iTotalAllocations;
-    TUint iTotalFree;
-    TUint iSlackFreeSpace;
-    TReal iFragmentation;
-    TUint iHeaderSizeA;
-    TUint iHeaderSizeF;
-    TUint iAllocationOverhead;
-    TUint iFreeOverhead;
-    TUint iTotalOverhead;
-    TReal iOverhead;
-    TInt iMinLength;
-    TInt iMaxLength;
-    TBool iDebugAllocatorLibrary;
-	};
-
-#endif // MEMSPYHEAPDATA_H
--- a/memspy/MemSpyClient/inc/memspykernelobjectdata.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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:
-* Contains the declaration of  TMemSpyProcessData class
-*/
-
-#ifndef MEMSPYKERNELOBJECTDATA_H
-#define MEMSPYKERNELOBJECTDATA_H
-
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// Constants
-const TInt KBufSize = 128;
-
-// TMemSpyProcess data class holds data to be sent to the UI
-class TMemSpyKernelObjectData 
-	{	
-public:
-	//constructor & destructor
-	inline TMemSpyKernelObjectData()
-		: iCount(0), iSize(0)
-		{
-		}
-	
-public:    
-    TMemSpyDriverContainerType iType;
-    TFullName iName;
-    TInt iCount;
-    TInt64 iSize;
-	};
-
-#endif // MEMSPYKERNELOBJECTDATA_H
--- a/memspy/MemSpyClient/inc/memspymemorytrackingcycledata.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +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 MEMSPYMEMORYTRACKINGCYCLEDATA_H_
-#define MEMSPYMEMORYTRACKINGCYCLEDATA_H_
-
-struct TMemSpyMemoryTrackingCycleData
-	{
-	TInt iCycleNumber;
-	TTime iTime;
-	TFullName iCaption;
-	TInt64 iFreeMemory;
-	TInt64 iMemoryDelta;
-	TInt64 iPreviousCycleDiff;
-	};
-
-#endif /* MEMSPYMEMORYTRACKINGCYCLEDATA_H_ */
--- a/memspy/MemSpyClient/inc/memspyprocessdata.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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:
-* Contains the declaration of  TMemSpyProcessData class
-*/
-
-#ifndef MEMSPYPROCESSDATA_H
-#define MEMSPYPROCESSDATA_H
-
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// TMemSpyProcess data class holds data to be sent to the UI
-class TMemSpyProcessData 
-	{	
-public:
-	//constructor & destructor
-	inline TMemSpyProcessData()
-		: iId(0), iThreadCount(0), iExitCategory(0), iExitReason(0)
-		{
-		}
-	
-public:
-    TProcessId iId;        
-    TFullName iName;
-    TProcessPriority iPriority;
-    TExitCategoryName iExitCategory;
-    TInt iExitReason;
-    TExitType iExitType;
-    TInt iThreadCount;
-    TUint32 iSID;
-    TUint32 iVID;
-    TBool iIsDead;
-	};
-
-#endif // MEMSPYPROCESSDATA_H
--- a/memspy/MemSpyClient/inc/memspysession.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +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 MEMSPYSESSION_H
-#define MEMSPYSESSION_H
-
-
-// System includes
-#include <e32base.h>
-#include <u32std.h>
-
-//user includes
-#include <memspy/api/memspyapiprocess.h>
-
-#include <memspy/api/memspyapithread.h>
-#include <memspy/api/memspyapithreadinfoitem.h>
-#include <memspy/engine/memspythreadinfoitemdata.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspydevicewideoperations.h>
-
-#include <memspy/api/memspyapikernelobject.h>
-
-#include <memspy/api/memspyapikernelobjectitem.h> //for KernelObjectItems
-
-#include <memspy/api/memspyapiheap.h>
-
-#include <memspy/api/memspyapimemorytrackingcycle.h>
-
-#include <memspyengineclientinterface.h>
-#include <memspy/engine/memspyengineoutputsinktype.h>
-
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-// Constants
-const TInt KMemSpyVersion           = 2;
-
-enum TSortType
-	{
-	ESortProcById,
-	ESortProcByName,
-	ESortProcByThreadCount,
-	ESortProcByCodeSegs,
-	ESortProcByHeapUsage,
-	ESortProcByStackUsage
-	};
-
-enum TMemSpyOutputType
-    {
-    EOutputTypeDebug = 0,
-    EOutputTypeFile
-    };
-
-class TMemSpyDeviceWideOperationProgress 
-	{
-public:
-	IMPORT_C TInt Progress() const;
-	IMPORT_C const TDesC& Description() const;
-	
-private:
-	TPckgBuf<TInt> iProgress;
-	TFullName iDescription;
-	
-friend class RMemSpySession;
-	};
-
-
-NONSHARABLE_CLASS( RMemSpySession ) : public RSessionBase
-    {
-public:
-    IMPORT_C RMemSpySession();
-    IMPORT_C TInt Connect();
-    
-public:	//API
-    //Thread speciifc operations
-    IMPORT_C void OutputKernelHeapDataL(); //EMemSpyClientServerOpHeapData
-    
-    IMPORT_C void OutputKernelHeapData(TRequestStatus& aStatus); //EMemSpyClientServerOpHeapData
-    
-    IMPORT_C void OutputThreadHeapDataL(TThreadId aThreadId); //EMemSpyClientServerOpHeapData
-    
-    IMPORT_C void OutputThreadHeapDataL(const TDesC& aThreadName); //EMemSpyClientServerOpHeapData
-    
-    IMPORT_C void OutputThreadCellListL(TThreadId aThreadId);//EMemSpyClientServerOpHeapCellListing    
-    
-    IMPORT_C void OutputHeapInfoUserL(TThreadId aThreadId);	//EMemSpyClientServerOpHeapInfo
-    
-    IMPORT_C void SwitchOutputSinkL( TMemSpySinkType aType); //EMemSpyClientServerOpSwitchOutputSinkFile / EMemSpyClientServerOpSwitchOutputSinkTrace
-    
-    IMPORT_C void SwitchOutputToTraceL(); // EMemSpyClientServerOpSwitchOutputSinkTrace
-    
-    IMPORT_C void SwitchOutputToFileL(const TDesC& aRootFolder); // EMemSpyClientServerOpSwitchOutputSinkFile
-    
-    IMPORT_C void OutputStackInfoL(TThreadId aThreadId); //EMemSpyClientServerOpStackInfo
-    
-    IMPORT_C void OutputStackDataL(TThreadId aThreadId, TMemSpyDriverDomainType aType ); //EMemSpyClientServerOpStackDataUser / EMemSpyClientServerOpStackDataKernel    
-    
-    IMPORT_C void OutputThreadInfoHandlesL(TThreadId aThreadId); //EMemSpyClientServerOpOutputInfoHandles
-    
-    IMPORT_C void OutputAOListL(TThreadId aId, TMemSpyThreadInfoItemType aType);	//EMemSpyClientServerOpOutputAOList    
-    
-    IMPORT_C void OutputKernelObjectsL();// EMemSpyClientServerOpEnumerateKernelContainerAll
-    
-    IMPORT_C void OutputCompactStackInfoL();// EMemSpyClientServerOpStackInfoCompact
-    
-    IMPORT_C void OutputCompactHeapInfoL();// EMemSpyClientServerOpHeapInfoCompact
-    
-    // Device Wide Operations
-    // Synchronous operations - for CLI
-    IMPORT_C void OutputHeapData();
-    
-    // Asynchronous operations
-    IMPORT_C void OutputPhoneInfo(TRequestStatus& aStatus);
-    
-    IMPORT_C void OutputDetailedPhoneInfo(TRequestStatus& aStatus);
-    
-    IMPORT_C void OutputHeapInfo(TRequestStatus& aStatus);
-    
-    IMPORT_C void OutputCompactHeapInfo(TRequestStatus &aStatus);
-    
-    IMPORT_C void OutputHeapCellListing(TRequestStatus& aStatus);
-    
-    IMPORT_C void OutputHeapData(TRequestStatus& aStatus);
-    
-    IMPORT_C void OutputStackInfo(TRequestStatus& aStatus);
-    
-    IMPORT_C void OutputCompactStackInfo(TRequestStatus &aStatus);
-    
-    IMPORT_C void OutputUserStackData(TRequestStatus& aStatus);
-    
-    IMPORT_C void OutputKernelStackData(TRequestStatus& aStatus);
-    
-    IMPORT_C void NotifyDeviceWideOperationProgress(TMemSpyDeviceWideOperationProgress &aProgress, TRequestStatus &aStatus);
-    
-    IMPORT_C void CancelDeviceWideOperationL();
-    
-    // Synchronous operations for MemSpyLauncher
-    IMPORT_C void OutputPhoneInfo();
-    
-    // "Ui" operations 
-    
-    IMPORT_C void GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType = ESortProcById);
-    
-    IMPORT_C TProcessId GetProcessIdByNameL(const TDesC& aProcessName);
-    
-    IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType = ESortProcById);
-    
-    IMPORT_C TInt ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue ); //aValue -> return value
-    
-    IMPORT_C void SetThreadPriorityL(TThreadId aId, TInt aPriority);
-    
-    IMPORT_C TInt EndProcess( TProcessId aId, TMemSpyEndType aType );
-    
-    IMPORT_C TInt SwitchToProcess( TProcessId aId, TBool aBrought  );
-    
-    //SWMT operations
-    
-    IMPORT_C void GetMemoryTrackingCyclesL(RArray<CMemSpyApiMemoryTrackingCycle*>& aCycles);
-    
-    IMPORT_C void SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig aConfig );    
-    
-    IMPORT_C void SetSwmtAutoStartProcessList( CArrayFixFlat<TUid>* aList );
-    
-    IMPORT_C void SetSwmtFilter( const TDesC& aFilter );            
-    
-    IMPORT_C void SetSwmtCategoriesL(TInt aCategories);
-
-    IMPORT_C void SetSwmtHeapDumpsEnabledL(TBool aEnabled);
-    
-    IMPORT_C void SwmtResetTracking();
-    
-    IMPORT_C void GetOutputSink( TMemSpySinkType aType );
-           
-    IMPORT_C TBool IsSwmtRunningL();
-    
-    IMPORT_C void StartSwmtTimerL(TInt aPeriod);
-    
-    IMPORT_C void StartSwmtTimerL(); // for CLI
-    
-    IMPORT_C void SetSwmtTimerIntervalL(TInt aPeriod); //for CLI
-    
-    IMPORT_C void StopSwmtTimerL();
-    
-    IMPORT_C void ForceSwmtUpdateL();
-    
-    IMPORT_C void ForceSwmtUpdate(TRequestStatus& aStatus);
-    
-    //Threads operations
-    /**
-     * 
-     */
-    IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiProcess*> &aThreads, TSortType aSortType = ESortProcById);
-    
-    IMPORT_C TInt ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue );
-        
-    IMPORT_C TInt EndThread( TThreadId aId, TMemSpyEndType aType );
-    
-    IMPORT_C TInt SwitchToThread( TThreadId aId, TBool aBrought );
-    
-    IMPORT_C TInt GetInfoItemType( TInt aIndex, TThreadId aId, TMemSpyThreadInfoItemType &aType );
-    
-    IMPORT_C TInt GetThreadInfoItems( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType );
-    
-    IMPORT_C void GetThreadInfoItemsL( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType );
-        
-    
-    //KernelObjects operations
-    
-    IMPORT_C void GetKernelObjectsL( RArray<CMemSpyApiKernelObject*> &aKernelObjects );
-    
-    IMPORT_C TInt GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects );
-    
-    IMPORT_C void GetKernelObjectItemsL( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer );
-    
-    IMPORT_C TInt GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer );
-    
-    IMPORT_C void OutputAllContainerContents();
-    
-    // Heap 
-    
-    IMPORT_C CMemSpyApiHeap* GetHeapL();
-    
-	IMPORT_C CMemSpyApiHeap* GetHeap();
-	
-	IMPORT_C void DumpKernelHeap();	
-	
-private:
-    TInt StartServer();       
-    
-    void SetOutputTypeL(TMemSpyOutputType aOutputType);
-    
-    };
-
-#endif // MEMSPYSESSION_H
--- a/memspy/MemSpyClient/inc/memspythreaddata.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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 MEMSPYTHREADDATA_H
-#define MEMSPYTHREADDATA_H
-
-//#include <kernel/arm/arm_types.h>
-
-class TMemSpyThreadData {
-public:
-	TMemSpyThreadData()
-	: iId(0), iPid(0), iSID(0), iVID(0), iRequestCount(0), iThreadHandles(0), iProcessHandles(0), iThreadNumberUsing(0), 
-	  iProcessNumberUsing(0), iAttributes(0), iCpuUse(0)
-		{
-		}
-	
-public:
-    TThreadId iId;
-    TProcessId iPid;    
-    TFullName iName;    //name without formatting. Formatting to be moved to the Avkon UI part
-    TInt iSID;
-    TInt iVID;
-    TThreadPriority iThreadPriority;
-    TProcessPriority iProcessPriority;
-    TInt iRequestCount;
-    TInt iThreadHandles;
-    TInt iProcessHandles;
-    TInt iThreadNumberUsing;
-    TInt iProcessNumberUsing;
-    TInt iAttributes;
-    TInt iCpuUse;        
-    TExitType iExitType;
-    RArray<TUint> iRegisters; //containts register contents of the thread (R00-R12, SP, LR, PC, Flags & DACR) - TUint for formating to HEX    
-};
-
-#endif
--- a/memspy/MemSpyClient/inc/memspythreadinfoitemdata.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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:
-* Contains the declaration of  TMemSpyProcessData class
-*/
-
-#ifndef MEMSPYTHREADINFOITEMDATA_H
-#define MEMSPYTHREADINFOITEMDATA_H
-
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// TMemSpyProcess data class holds data to be sent to the UI
-class TMemSpyThreadInfoItemData 
-	{	
-public:
-	//constructor & destructor
-	inline TMemSpyThreadInfoItemData()		
-		{
-		}
-	
-public:
-    TBuf<64> iCaption;
-    TBuf<32> iValue;
-	};
-
-#endif // MEMSPYTHREADINFOITEMDATA_H
--- a/memspy/MemSpyClient/src/memspyapiheap.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +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 <memspy/api/memspyapiheap.h>
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyheapdata.h>
-
-
-CMemSpyApiHeap::CMemSpyApiHeap() 
-	: iHeapData(0)
-	{
-	}
-
-EXPORT_C CMemSpyApiHeap::~CMemSpyApiHeap()
-	{
-	delete iHeapData;
-	}
-
-void CMemSpyApiHeap::ConstructL(const TMemSpyHeapData& aData)
-	{
-	iHeapData = new (ELeave) TMemSpyHeapData(aData);
-	}
-
-CMemSpyApiHeap* CMemSpyApiHeap::NewL(const TMemSpyHeapData& aData)
-	{
-	CMemSpyApiHeap* self = CMemSpyApiHeap::NewLC(aData);
-	CleanupStack::Pop(self);
-	return (self);
-	}
-
-CMemSpyApiHeap* CMemSpyApiHeap::NewLC(const TMemSpyHeapData& aData)
-	{
-	CMemSpyApiHeap* self = new (ELeave) CMemSpyApiHeap;
-	CleanupStack::PushL(self);
-	self->ConstructL(aData);
-	return (self);
-	}
-
-//api methods
-EXPORT_C TDesC& CMemSpyApiHeap::Type()
-	{
-	return iHeapData->iType;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::Size()
-	{
-	return iHeapData->iSize;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::BaseAddress()
-	{
-	return iHeapData->iBaseAddress;
-	}
-
-EXPORT_C TBool CMemSpyApiHeap::Shared()
-	{
-	return iHeapData->iShared;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::ChunkSize()
-	{
-	return iHeapData->iChunkSize;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::AllocationsCount()
-	{
-	return iHeapData->iAllocationsCount;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::FreeCount()
-	{
-	return iHeapData->iFreeCount;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::BiggestAllocation()
-	{
-	return iHeapData->iBiggestAllocation;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::BiggestFree()
-	{
-	return iHeapData->iBiggestFree;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::TotalAllocations()
-	{
-	return iHeapData->iTotalAllocations;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::TotalFree()
-	{
-	return iHeapData->iTotalFree;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::SlackFreeSpace()
-	{
-	return iHeapData->iSlackFreeSpace;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::Fragmentation()
-	{
-	return iHeapData->iFragmentation;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::HeaderSizeA()
-	{
-	return iHeapData->iHeaderSizeA;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::HeaderSizeF()
-	{
-	return iHeapData->iHeaderSizeF;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::AllocationOverhead()
-	{
-	return iHeapData->iAllocationOverhead;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::FreeOverhead()
-	{
-	return iHeapData->iFreeOverhead;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::TotalOverhead()
-	{
-	return iHeapData->iTotalOverhead;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::Overhead()
-	{
-	return iHeapData->iOverhead;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::MinLength()
-	{
-	return iHeapData->iMinLength;
-	}
-
-EXPORT_C TInt CMemSpyApiHeap::MaxLength()
-	{
-	return iHeapData->iMaxLength;
-	}
-
-EXPORT_C TBool CMemSpyApiHeap::DebugAllocatorLibrary()
-	{
-	return iHeapData->iDebugAllocatorLibrary;
-	}
--- a/memspy/MemSpyClient/src/memspyapikernelobject.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +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 <memspy/api/memspyapikernelobject.h>
-#include <memspy/engine/memspykernelobjectdata.h>
-//#include <memspy/engine/memspyengineobjectprocess.h>
-//#include <memspy/engine/memspyengineobjectcontainer.h>
-
-
-EXPORT_C CMemSpyApiKernelObject::~CMemSpyApiKernelObject()
-	{
-	delete iKernelObjectData;
-	}
-
-
-CMemSpyApiKernelObject::CMemSpyApiKernelObject() : iKernelObjectData(0)
-	{
-	}
-
-CMemSpyApiKernelObject* CMemSpyApiKernelObject::NewL(const TMemSpyKernelObjectData& aData)
-	{
-	CMemSpyApiKernelObject* self = CMemSpyApiKernelObject::NewLC(aData);
-	CleanupStack::Pop(self);
-	return (self);
-	}
-
-CMemSpyApiKernelObject* CMemSpyApiKernelObject::NewLC(const TMemSpyKernelObjectData& aData)
-	{
-	CMemSpyApiKernelObject* self = new (ELeave) CMemSpyApiKernelObject;
-	CleanupStack::PushL(self);
-	self->ConstructL(aData);
-	return (self);
-	}
-
-void CMemSpyApiKernelObject::ConstructL(const TMemSpyKernelObjectData& aData)
-	{
-	iKernelObjectData = new (ELeave) TMemSpyKernelObjectData(aData);
-	}
-
-EXPORT_C TMemSpyDriverContainerType CMemSpyApiKernelObject::Type() const
-	{
-	return iKernelObjectData->iType;
-	}
-
-EXPORT_C const TDesC& CMemSpyApiKernelObject::Name() const
-	{
-	return iKernelObjectData->iName;
-	}
-					
-EXPORT_C TInt CMemSpyApiKernelObject::Count() const
-	{
-	return iKernelObjectData->iCount;
-	}
-	
-EXPORT_C TInt64 CMemSpyApiKernelObject::Size() const
-	{
-	return iKernelObjectData->iSize;
-	}
--- a/memspy/MemSpyClient/src/memspyapikernelobjectitem.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,309 +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 <memspy/api/memspyapikernelobjectitem.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-EXPORT_C CMemSpyApiKernelObjectItem::~CMemSpyApiKernelObjectItem()
-	{
-	delete iItem;
-	}
-
-
-CMemSpyApiKernelObjectItem::CMemSpyApiKernelObjectItem() : iItem(0)
-	{
-	}
-
-CMemSpyApiKernelObjectItem* CMemSpyApiKernelObjectItem::NewL(const TMemSpyDriverHandleInfoGeneric& aData)
-	{
-	CMemSpyApiKernelObjectItem* self = CMemSpyApiKernelObjectItem::NewLC(aData);
-	CleanupStack::Pop(self);
-	return (self);
-	}
-
-CMemSpyApiKernelObjectItem* CMemSpyApiKernelObjectItem::NewLC(const TMemSpyDriverHandleInfoGeneric& aData)
-	{
-	CMemSpyApiKernelObjectItem* self = new (ELeave) CMemSpyApiKernelObjectItem;
-	CleanupStack::PushL(self);
-	self->ConstructL(aData);
-	return (self);
-	}
-
-void CMemSpyApiKernelObjectItem::ConstructL(const TMemSpyDriverHandleInfoGeneric& aData)
-	{
-	iItem = new (ELeave) TMemSpyDriverHandleInfoGeneric(aData);
-	}
-
-EXPORT_C const TDesC8& CMemSpyApiKernelObjectItem::Name() const
-	{
-	/*
-	TBuf<KMaxName> ret;	
-	ret.Copy( iItem->iName );
-	return ret;
-	*/
-	return iItem->iName;
-	}
-
-EXPORT_C TAny* CMemSpyApiKernelObjectItem::Handle() const
-	{	
-	return iItem->iHandle;
-	}
-
-EXPORT_C TMemSpyDriverContainerType CMemSpyApiKernelObjectItem::Type() const
-	{
-	return iItem->iType;
-	}
-
-// For Process, thread, chunk (owning process id), server (owning thread id)
-EXPORT_C TInt CMemSpyApiKernelObjectItem::Id() const
-	{
-	return iItem->iId;
-	}
-
-// For Chunk, Library
-EXPORT_C TUint32 CMemSpyApiKernelObjectItem::Size() const
-	{
-	return iItem->iSize;
-	}
-
-// For Semaphore, Mutex, Server
-EXPORT_C TInt CMemSpyApiKernelObjectItem::Count() const
-	{
-	return iItem->iCount;
-	}
-
-// For Mutex
-EXPORT_C TInt CMemSpyApiKernelObjectItem::WaitCount() const
-	{
-	return iItem->iWaitCount;
-	}
-
-// For Server, Session
-EXPORT_C TIpcSessionType CMemSpyApiKernelObjectItem::SessionType() const
-	{
-	return iItem->iSessionType;
-	}
-
-// For Timer
-EXPORT_C TMemSpyDriverTimerType CMemSpyApiKernelObjectItem::TimerType() const
-	{
-	return iItem->iTimerType;
-	}
-
-EXPORT_C TMemSpyDriverTimerState CMemSpyApiKernelObjectItem::TimerState() const
-	{
-	return iItem->iTimerState;
-	}
-
-// For Logical channel
-EXPORT_C TInt CMemSpyApiKernelObjectItem::OpenChannels()
-	{
-	return iItem->iOpenChannels;
-	}
-
-// For most of the object types
-EXPORT_C const TDesC8& CMemSpyApiKernelObjectItem::NameDetail() const
-	{
-	/*
-	TBuf<KMaxName> ret;
-	ret.Copy( iItem->iNameDetail );
-	return ret;
-	*/
-	return iItem->iNameDetail;
-	}
-
-EXPORT_C TInt CMemSpyApiKernelObjectItem::AccessCount() const
-	{
-	return iItem->iAccessCount;
-	}
-
-EXPORT_C TInt CMemSpyApiKernelObjectItem::UniqueID() const
-	{
-	return iItem->iUniqueID;
-	}
-
-EXPORT_C TUint CMemSpyApiKernelObjectItem::Protection() const
-	{
-	return iItem->iProtection;
-	}
-		
-EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfKernelOwner()
-	{
-	return iItem->iAddressOfKernelOwner;
-	}
-
-EXPORT_C TInt CMemSpyApiKernelObjectItem::Priority() const
-	{
-	return iItem->iPriority;
-	}
-
-EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfOwningProcess()
-	{
-	return iItem->iAddressOfOwningProcess;
-	}
-
-EXPORT_C TUint CMemSpyApiKernelObjectItem::CreatorId() const
-	{
-	return iItem->iCreatorId;
-	}
-
-EXPORT_C TUint CMemSpyApiKernelObjectItem::SecurityZone() const
-	{
-	return iItem->iSecurityZone;
-	}
-
-EXPORT_C TInt CMemSpyApiKernelObjectItem::Attributes() const
-	{
-	return iItem->iAttributes;
-	}
-
-EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfDataBssStackChunk()
-	{
-	return iItem->iAddressOfDataBssStackChunk;
-	}
-
-// For Server, Session
-EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfOwningThread()
-	{
-	return iItem->iAddressOfOwningThread;
-	}
-
-EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfServer()
-	{
-	return iItem->iAddressOfServer;
-	}
-
-EXPORT_C TUint16 CMemSpyApiKernelObjectItem::TotalAccessCount() const
-	{
-	return iItem->iTotalAccessCount;
-	}
-
-EXPORT_C TUint8 CMemSpyApiKernelObjectItem::SvrSessionType() const
-	{
-	return iItem->iSvrSessionType;
-	}
-
-EXPORT_C TInt CMemSpyApiKernelObjectItem::MsgCount() const
-	{
-	return iItem->iMsgCount;
-	}
-
-EXPORT_C TInt CMemSpyApiKernelObjectItem::MsgLimit() const
-	{
-	return iItem->iMsgLimit;
-	}
-
-// For chunk
-EXPORT_C TInt CMemSpyApiKernelObjectItem::MaxSize() const
-	{
-	return iItem->iMaxSize;
-	}
-
-EXPORT_C TInt CMemSpyApiKernelObjectItem::Bottom() const
-	{
-	return iItem->iBottom;
-	}
-
-EXPORT_C TInt CMemSpyApiKernelObjectItem::Top() const
-	{
-	return iItem->iTop;
-	}
-
-EXPORT_C TInt CMemSpyApiKernelObjectItem::StartPos() const
-	{
-	return iItem->iStartPos;
-	}
-
-EXPORT_C TUint CMemSpyApiKernelObjectItem::ControllingOwner() const
-	{
-	return iItem->iControllingOwner;
-	}
-
-EXPORT_C TUint CMemSpyApiKernelObjectItem::Restrictions() const
-	{
-	return iItem->iRestrictions;
-	}
-
-EXPORT_C TUint CMemSpyApiKernelObjectItem::MapAttr() const
-	{
-	return iItem->iMapAttr;
-	}
-
-EXPORT_C TUint CMemSpyApiKernelObjectItem::ChunkType() const
-	{
-	return iItem->iChunkType;
-	}
-
-EXPORT_C const TDesC8& CMemSpyApiKernelObjectItem::NameOfOwner() const
-	{
-	/*
-	TBuf<KMaxName> ret;
-	ret.Copy( iItem->iNameOfOwner );
-	return ret;
-	*/
-	return iItem->iNameOfOwner;
-	}
-
-// For library
-EXPORT_C TInt CMemSpyApiKernelObjectItem::MapCount() const
-	{
-	return iItem->iMapCount;
-	}
-
-EXPORT_C TUint8 CMemSpyApiKernelObjectItem::State() const
-	{
-	return iItem->iState;
-	}
-
-EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfCodeSeg()
-	{
-	return iItem->iAddressOfCodeSeg;
-	}
-
-// Semaphore, mutex, condvar
-EXPORT_C TUint8 CMemSpyApiKernelObjectItem::Resetting() const
-	{
-	return iItem->iResetting;
-	}
-
-EXPORT_C TUint8 CMemSpyApiKernelObjectItem::Order() const
-	{
-	return iItem->iOrder;
-	}
-
-// For Logical/Physical device
-EXPORT_C TVersion CMemSpyApiKernelObjectItem::Version() const
-	{
-	return iItem->iVersion;
-	}
-
-EXPORT_C TUint CMemSpyApiKernelObjectItem::ParseMask() const
-	{
-	return iItem->iParseMask;	
-	}
-
-EXPORT_C TUint CMemSpyApiKernelObjectItem::UnitsMask() const
-	{
-	return iItem->iUnitsMask;
-	}
-
-// For change notifier
-EXPORT_C TUint CMemSpyApiKernelObjectItem::Changes() const
-	{
-	return iItem->iChanges;
-	}
-
--- a/memspy/MemSpyClient/src/memspyapimemorytrackingcycle.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +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 <memspy/api/memspyapimemorytrackingcycle.h>
-#include <memspy/engine/memspymemorytrackingcycledata.h>
-
-EXPORT_C TInt CMemSpyApiMemoryTrackingCycle::CycleNumber() const
-	{
-	return iData->iCycleNumber;	
-	}
-
-EXPORT_C const TTime& CMemSpyApiMemoryTrackingCycle::Time() const
-	{
-	return iData->iTime;	
-	}
-
-EXPORT_C const TDesC& CMemSpyApiMemoryTrackingCycle::Caption() const
-	{
-	return iData->iCaption;	
-	}
-
-EXPORT_C const TInt64& CMemSpyApiMemoryTrackingCycle::FreeMemory() const
-	{
-	return iData->iFreeMemory;
-	}
-
-EXPORT_C TInt64 CMemSpyApiMemoryTrackingCycle::MemoryDelta() const
-	{
-	return iData->iMemoryDelta;
-	}
-
-EXPORT_C TInt64 CMemSpyApiMemoryTrackingCycle::PreviousCycleDiff() const
-	{
-	return iData->iPreviousCycleDiff;
-	}
-
-EXPORT_C CMemSpyApiMemoryTrackingCycle::~CMemSpyApiMemoryTrackingCycle()
-	{
-	delete iData;
-	}
-
-CMemSpyApiMemoryTrackingCycle* CMemSpyApiMemoryTrackingCycle::NewL(const TMemSpyMemoryTrackingCycleData& aData)
-	{
-	CMemSpyApiMemoryTrackingCycle* self = CMemSpyApiMemoryTrackingCycle::NewLC(aData);
-	CleanupStack::Pop(self);
-	return (self);
-	}
-
-CMemSpyApiMemoryTrackingCycle* CMemSpyApiMemoryTrackingCycle::NewLC(const TMemSpyMemoryTrackingCycleData& aData)
-	{
-	CMemSpyApiMemoryTrackingCycle* self = new (ELeave) CMemSpyApiMemoryTrackingCycle;
-	CleanupStack::PushL(self);
-	self->ConstructL(aData);
-	return self;
-	}
-
-CMemSpyApiMemoryTrackingCycle::CMemSpyApiMemoryTrackingCycle()
-	{
-	}
-
-void CMemSpyApiMemoryTrackingCycle::ConstructL(const TMemSpyMemoryTrackingCycleData& aData)
-	{
-	iData = new (ELeave) TMemSpyMemoryTrackingCycleData(aData);
-	}
--- a/memspy/MemSpyClient/src/memspyapiprocess.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +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 <memspy/api/memspyapiprocess.h>
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyprocessdata.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-
-
-EXPORT_C CMemSpyApiProcess::~CMemSpyApiProcess()
-	{
-	delete iProcessData;
-	}
-
-EXPORT_C TProcessId CMemSpyApiProcess::Id() const
-	{
-	return iProcessData->iId;
-	}
-
-EXPORT_C const TDesC& CMemSpyApiProcess::Name() const
-	{
-	return iProcessData->iName;
-	}
-
-EXPORT_C TExitCategoryName CMemSpyApiProcess::ExitCategory() const
-	{
-	return iProcessData->iExitCategory;
-	}
-	
-EXPORT_C TInt CMemSpyApiProcess::ExitReason() const
-	{
-	return iProcessData->iExitReason;
-	}
-	
-EXPORT_C TExitType CMemSpyApiProcess::ExitType() const
-	{
-	return iProcessData->iExitType;
-	}
-	
-EXPORT_C TInt CMemSpyApiProcess::ThreadCount() const
-	{
-	return iProcessData->iThreadCount;
-	}
-
-EXPORT_C TUint32 CMemSpyApiProcess::SID() const
-	{
-	return iProcessData->iSID;
-	}
-
-EXPORT_C TUint32 CMemSpyApiProcess::VID() const
-	{
-	return iProcessData->iSID;
-	}
-
-EXPORT_C TProcessPriority CMemSpyApiProcess::Priority() const
-	{
-	return iProcessData->iPriority;
-	}
-
-EXPORT_C TBool CMemSpyApiProcess::IsDead() const
-    {
-    return iProcessData->iIsDead;
-    }
-
-CMemSpyApiProcess::CMemSpyApiProcess() : iProcessData(0)
-	{
-	}
-
-void CMemSpyApiProcess::ConstructL(const TMemSpyProcessData& aData)
-	{
-	iProcessData = new (ELeave) TMemSpyProcessData(aData);
-	}
-
-CMemSpyApiProcess* CMemSpyApiProcess::NewL(const TMemSpyProcessData& aData)
-	{
-	CMemSpyApiProcess* self = CMemSpyApiProcess::NewLC(aData);
-	CleanupStack::Pop(self);
-	return (self);
-	}
-
-CMemSpyApiProcess* CMemSpyApiProcess::NewLC(const TMemSpyProcessData& aData)
-	{
-	CMemSpyApiProcess* self = new (ELeave) CMemSpyApiProcess;
-	CleanupStack::PushL(self);
-	self->ConstructL(aData);
-	return (self);
-	}
-
--- a/memspy/MemSpyClient/src/memspyapithread.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +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 <memspy/api/memspyapithread.h>
-#include <memspy/engine/memspythreaddata.h>
-
-
-EXPORT_C CMemSpyApiThread::~CMemSpyApiThread()
-	{
-	delete iThreadData;
-	}
-
-EXPORT_C TThreadId CMemSpyApiThread::Id() const
-	{
-	return iThreadData->iId;
-	}
-
-EXPORT_C TProcessId CMemSpyApiThread::ProcessId() const
-	{
-	return iThreadData->iPid;
-	}
-
-EXPORT_C const TDesC& CMemSpyApiThread::Name() const
-	{
-	return iThreadData->iName;
-	}
-
-EXPORT_C TInt CMemSpyApiThread::SID() const
-	{
-	return iThreadData->iSID;
-	}
-
-
-EXPORT_C TInt CMemSpyApiThread::VID() const
-	{
-	return iThreadData->iVID;
-	}
-
-EXPORT_C TThreadPriority CMemSpyApiThread::ThreadPriority() const
-	{
-	return iThreadData->iThreadPriority;
-	}
-
-EXPORT_C TProcessPriority CMemSpyApiThread::ProcessPriority() const
-	{
-	return iThreadData->iProcessPriority;
-	}
-
-EXPORT_C TInt CMemSpyApiThread::RequestCount() const
-	{
-	return iThreadData->iRequestCount;
-	}
-
-EXPORT_C TInt CMemSpyApiThread::ThreadHandles() const
-	{
-	return iThreadData->iThreadHandles;
-	}
-
-EXPORT_C TInt CMemSpyApiThread::ProcessHandles() const
-	{
-	return iThreadData->iProcessHandles;
-	}
-
-EXPORT_C TInt CMemSpyApiThread::ThreadNumberUsing() const
-	{
-	return iThreadData->iThreadNumberUsing;
-	}
-
-EXPORT_C TInt CMemSpyApiThread::ProcessNumberUsing() const
-	{
-	return iThreadData->iProcessNumberUsing;
-	}
-
-EXPORT_C TInt CMemSpyApiThread::Attributes() const
-	{
-	return iThreadData->iAttributes;
-	}
-
-EXPORT_C TInt CMemSpyApiThread::CpuUse() const
-	{
-	return iThreadData->iCpuUse;
-	}
-
-EXPORT_C TExitType CMemSpyApiThread::ExitType() const
-	{
-	return iThreadData->iExitType;
-	}
-
-CMemSpyApiThread::CMemSpyApiThread() : iThreadData(0)
-	{
-	}
-
-void CMemSpyApiThread::ConstructL(const TMemSpyThreadData& aData)
-	{
-	iThreadData = new (ELeave) TMemSpyThreadData(aData);
-	}
-
-CMemSpyApiThread* CMemSpyApiThread::NewL(const TMemSpyThreadData& aData)
-	{
-	CMemSpyApiThread* self = CMemSpyApiThread::NewLC(aData);
-	CleanupStack::Pop(self);
-	return (self);
-	}
-
-CMemSpyApiThread* CMemSpyApiThread::NewLC(const TMemSpyThreadData& aData)
-	{
-	CMemSpyApiThread* self = new (ELeave) CMemSpyApiThread;
-	CleanupStack::PushL(self);
-	self->ConstructL(aData);
-	return (self);
-	}
--- a/memspy/MemSpyClient/src/memspyapithreadinfoitem.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +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 <memspy/api/memspyapithreadinfoitem.h>
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspythreadinfoitemdata.h>
-
-EXPORT_C CMemSpyApiThreadInfoItem::~CMemSpyApiThreadInfoItem()
-	{
-	delete iInfoItem;
-	}
-
-EXPORT_C const TDesC& CMemSpyApiThreadInfoItem::Caption() const
-	{
-	return iInfoItem->iCaption;
-	}
-
-EXPORT_C const TDesC& CMemSpyApiThreadInfoItem::Value() const
-	{
-	return iInfoItem->iValue;
-	}
-
-CMemSpyApiThreadInfoItem::CMemSpyApiThreadInfoItem() : iInfoItem(0)
-	{
-	}
-
-void CMemSpyApiThreadInfoItem::ConstructL(const TMemSpyThreadInfoItemData& aData)
-	{
-	iInfoItem = new (ELeave) TMemSpyThreadInfoItemData(aData);
-	}
-
-CMemSpyApiThreadInfoItem* CMemSpyApiThreadInfoItem::NewL(const TMemSpyThreadInfoItemData& aData)
-	{
-	CMemSpyApiThreadInfoItem* self = CMemSpyApiThreadInfoItem::NewLC(aData);
-	CleanupStack::Pop(self);
-	return (self);
-	}
-
-CMemSpyApiThreadInfoItem* CMemSpyApiThreadInfoItem::NewLC(const TMemSpyThreadInfoItemData& aData)
-	{
-	CMemSpyApiThreadInfoItem* self = new (ELeave) CMemSpyApiThreadInfoItem;
-	CleanupStack::PushL(self);
-	self->ConstructL(aData);
-	return (self);
-	}
-
--- a/memspy/MemSpyClient/src/memspysession.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,706 +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 "memspysession.h"
-
-#include <memspyengineclientinterface.h>
-// API
-#include <memspy/engine/memspyprocessdata.h>
-#include <memspy/engine/memspythreaddata.h> 
-#include <memspy/engine/memspykernelobjectdata.h>
-#include <memspy/engine/memspyheapdata.h>
-#include <memspy/engine/memspymemorytrackingcycledata.h>
-//KernelObjects
-#include <memspy/driver/memspydriverenumerationsshared.h>
-// IMPLEMENTATION
-
-EXPORT_C RMemSpySession::RMemSpySession()
-    {
-    }
-
-
-EXPORT_C TInt RMemSpySession::Connect()
-    {
-	TInt error(KErrNone);
-	
-	for (TInt i=0; i<2; i++) // Two retries max
-		{
-		TInt error = CreateSession(KMemSpyServerName, TVersion(KMemSpyVersion, 0, 0));
-		
-		if (error != KErrNotFound && error != KErrServerTerminated)
-			return error;
-		
-		error = StartServer();
-		
-		if (error != KErrNone && error != KErrAlreadyExists)
-			return error;
-		}
-	
-	return error;	
-    }
-
-TInt RMemSpySession::StartServer()
-	{
-	RProcess server;
-	_LIT(KCommand, "start");
-	const TUid KServerUid3 = {0xE5883BC2};
-	TInt error = server.Create(KMemSpyServerName, KCommand);//, KServerUid3);
-	
-	if (error != KErrNone)
-		return error;
-	
-	TRequestStatus startStatus, stopStatus;
-	server.Logon(stopStatus);
-	if (stopStatus != KRequestPending)
-		{
-		User::WaitForRequest(stopStatus);
-		server.Kill(0);
-		server.Close();
-		return stopStatus.Int();
-		}
-	
-	server.Rendezvous(startStatus);
-	server.Resume();
-	User::WaitForRequest(startStatus, stopStatus);
-	if (startStatus == KRequestPending)
-		{
-		// not started yet, i.e. stopStatus was signaled
-		server.Close();
-		return stopStatus.Int();
-		}
-	
-	// Rendezvous was called - the server is ready
-	
-	// We first need to cancel Logon
-	server.LogonCancel(stopStatus);
-	// We don't need this anymore
-	server.Close();
-	// Wait for LogonCancel to complete
-	User::WaitForRequest(stopStatus);
-
-	// Everything went OK
-	return KErrNone;
-	}
-
-EXPORT_C void RMemSpySession::GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType)
-	{
-	TPckgBuf<TInt> count;
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetProcessCount, TIpcArgs(&count)));
-	
-	TInt requestedCount = count();
-	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyProcessData));
-	TPtr8 bufferPtr(buffer->Des());
-	
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetProcesses, TIpcArgs(&count, &bufferPtr)));
-	aProcesses.Reset();
-	
-	TInt receivedCount = Min(count(), requestedCount);
-	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyProcessData))
-		{
-		TPckgBuf<TMemSpyProcessData> data;
-		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyProcessData));
-		aProcesses.AppendL(CMemSpyApiProcess::NewLC(data()));
-		}
-	CleanupStack::Pop(aProcesses.Count());
-	CleanupStack::PopAndDestroy(buffer);
-	}
-
-EXPORT_C TProcessId RMemSpySession::GetProcessIdByNameL(const TDesC& aProcessName)
-	{
-	TPckgBuf<TProcessId> procId;
-	User::LeaveIfError(SendReceive(EMemSpyClienServerOpGetProcessIdByName, 
-			TIpcArgs(&aProcessName, &procId)));
-	
-	return procId();
-	}
-
-EXPORT_C TInt RMemSpySession::ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue )
-	{
-	TPckgBuf<TProcessId> arg1( aId );
-	TPckgBuf<TBool> arg2( aValue );
-	TIpcArgs args( &arg1, &arg2 );
-		
-	TInt error = SendReceive( EMemSpyClientServerOpProcessSystemPermanentOrCritical, args );
-	
-	return error;
-	}
-
-EXPORT_C TInt RMemSpySession::EndProcess( TProcessId aId, TMemSpyEndType aType )
-	{
-	TPckgBuf<TProcessId> arg1( aId );
-	TPckgBuf<TMemSpyEndType> arg2( aType );
-	TIpcArgs args( &arg1, &arg2 );
-	
-	TInt error = SendReceive( EMemSpyClientServerOpEndProcess, args );
-	
-	return error;
-	}
-
-EXPORT_C TInt RMemSpySession::SwitchToProcess( TProcessId aId, TBool aBrought )
-	{
-	TPckgBuf<TProcessId> arg1( aId );
-	TPckgBuf<TBool> arg2( aBrought );
-	TIpcArgs args( &arg1, &arg2 );
-	
-	TInt error = SendReceive( EMemSpyClientServerOpSwitchToProcess, args );
-	
-	return error;	
-	}
-
-EXPORT_C void RMemSpySession::GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType)
-	{
-	TPckgBuf<TInt> count;
-	TPckgBuf<TProcessId> pid(aProcessId);
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetThreadCount, TIpcArgs(&count, &pid)));
-	
-	TInt requestedCount = count();
-	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyThreadData));
-	TPtr8 bufferPtr(buffer->Des());
-	
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetThreads, TIpcArgs(&count, &bufferPtr, &pid)));
-	aThreads.Reset();
-	
-	TInt receivedCount = Min(count(), requestedCount);
-	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyThreadData))
-		{
-		TPckgBuf<TMemSpyThreadData> data;
-		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyThreadData));
-		aThreads.AppendL(CMemSpyApiThread::NewLC(data()));
-		}
-	CleanupStack::Pop(aThreads.Count());
-	CleanupStack::PopAndDestroy(buffer);
-	}
-
-EXPORT_C void RMemSpySession::SetThreadPriorityL(TThreadId aId, TInt aPriority)
-	{
-	TPckgBuf<TThreadId> arg1( aId );
-	TPckgBuf<TInt> arg2( aPriority );
-	
-	User::LeaveIfError(SendReceive( EMemSpyClientServerOpSetThreadPriority, TIpcArgs(&arg1, &arg2)));
-	}
-
-EXPORT_C TInt RMemSpySession::ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue )
-	{
-	TPckgBuf<TThreadId> arg1( aId );
-	TPckgBuf<TBool> arg2( aValue );
-	TIpcArgs args( &arg1, &arg2 );
-	
-	TInt error = SendReceive( EMemSpyClientServerOpThreadSystemPermanentOrCritical, args );
-	
-	return error;
-	}
-
-EXPORT_C TInt RMemSpySession::EndThread( TThreadId aId, TMemSpyEndType aType )
-	{
-	TPckgBuf<TThreadId> arg1( aId );
-	TPckgBuf<TMemSpyEndType> arg2( aType );
-	TIpcArgs args( &arg1, &arg2 );
-	
-	TInt error = SendReceive( EMemSpyClientServerOpEndThread, args );
-	
-	return error;
-	}
-
-EXPORT_C TInt RMemSpySession::SwitchToThread( TThreadId aId, TBool aBrought )
-	{
-	TPckgBuf<TThreadId> arg1( aId );
-	TPckgBuf<TBool> arg2( aBrought );
-	TIpcArgs args( &arg1, &arg2 );
-	
-	TInt error = SendReceive( EMemSpyClientServerOpSwitchToThread, args );
-	
-	return error;	
-	}
-
-EXPORT_C TInt RMemSpySession::GetInfoItemType( TInt aIndex, TThreadId aId, TMemSpyThreadInfoItemType &aType )
-	{
-	TPckgBuf<TInt> arg1( aIndex );
-	TPckgBuf<TThreadId> arg2( aId );
-	TPckgBuf<TMemSpyThreadInfoItemType> arg3;
-	TIpcArgs args( &arg1, &arg2, &arg3 );
-		
-	TInt error = SendReceive( EMemSpyClientServerOpGetInfoItemType, args );
-	
-	aType = arg3();
-	
-	return error;
-	}
-
-EXPORT_C void RMemSpySession::GetThreadInfoItemsL( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType )
-	{
-	TPckgBuf<TThreadId> id( aId );	
-	TPckgBuf<TMemSpyThreadInfoItemType> type( aType );
-	TPckgBuf<TInt> count;	
-	
-	TInt error = SendReceive( EMemSpyClientServerOpGetThreadInfoItemsCount, TIpcArgs( &id, &type, &count ) );
-	TInt itemCount = count();
-	
-	if( error == KErrNone )
-		{		
-		if( itemCount == 0 )
-			{
-			aInfoItems.Reset();
-			}
-		else
-			{
-			HBufC8* buffer = HBufC8::NewLC( itemCount * sizeof(TMemSpyThreadInfoItemData) );
-			TPtr8 bufferPtr(buffer->Des());
-			
-			TPckgBuf<TInt> requestedCount( itemCount );
-			
-			TIpcArgs args( &requestedCount, &id, &type, &bufferPtr );
-			TInt error = SendReceive( EMemSpyClientServerOpGetThreadInfoItems, args );
-			
-			aInfoItems.Reset();
-		
-			for(TInt i=0, offset = 0; i < itemCount; i++, offset+=sizeof(TMemSpyThreadInfoItemData))
-				{
-				TPckgBuf<TMemSpyThreadInfoItemData> data;
-				data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyThreadInfoItemData));
-				aInfoItems.AppendL(CMemSpyApiThreadInfoItem::NewLC(data()));
-				}
-			
-			CleanupStack::Pop(aInfoItems.Count());
-			CleanupStack::PopAndDestroy(buffer);
-			}
-		}
-	
-	User::LeaveIfError(error);
-	}
-
-EXPORT_C TInt RMemSpySession::GetThreadInfoItems( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType )
-	{
-	TRAPD(error, GetThreadInfoItemsL(aInfoItems, aId, aType));
-	return error;
-	}
-
-//Kernel Objects specific operations
-EXPORT_C void RMemSpySession::GetKernelObjectsL( RArray<CMemSpyApiKernelObject*> &aKernelObjects )
-	{		
-	TPckgBuf<TInt> count;
-	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectCount, TIpcArgs(&count) ));
-	
-	TInt requestedCount = count();
-	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyKernelObjectData));
-	TPtr8 bufferPtr(buffer->Des());
-		
-	TIpcArgs args( &count, &bufferPtr );
-	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjects, args ));
-	
-	aKernelObjects.Reset();
-	
-	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyKernelObjectData))
-		{
-		TPckgBuf<TMemSpyKernelObjectData> data;
-		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyKernelObjectData));
-		aKernelObjects.AppendL(CMemSpyApiKernelObject::NewLC(data()));
-		}
-	
-	CleanupStack::Pop(aKernelObjects.Count());
-	CleanupStack::PopAndDestroy(buffer);
-	}
-
-EXPORT_C TInt RMemSpySession::GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects )
-	{
-	TRAPD(error, GetKernelObjectsL(aKernelObjects));
-	return error;
-	}
-
-EXPORT_C void RMemSpySession::GetKernelObjectItemsL( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer )
-	{
-	TPckgBuf<TInt> count;
-	TPckgBuf<TMemSpyDriverContainerType> type(aForContainer);
-	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItemCount, TIpcArgs(&count, &type) ));
-
-	TInt requestedCount = count();
-	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyDriverHandleInfoGeneric));
-	TPtr8 bufferPtr(buffer->Des());
-	
-	TIpcArgs args( &count, &type, &bufferPtr );
-	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItems, args ));
-	
-	aKernelObjectItems.Reset();
-	
-	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyDriverHandleInfoGeneric))
-		{
-		TPckgBuf<TMemSpyDriverHandleInfoGeneric> data;
-		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyDriverHandleInfoGeneric));
-		aKernelObjectItems.AppendL( CMemSpyApiKernelObjectItem::NewLC( data() ) );
-		}
-	CleanupStack::Pop(aKernelObjectItems.Count());
-	CleanupStack::PopAndDestroy(buffer);
-	}
-
-EXPORT_C TInt RMemSpySession::GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer )
-	{
-	TRAPD(error, GetKernelObjectItemsL(aKernelObjectItems, aForContainer));
-	return error;
-	}
-
-EXPORT_C void RMemSpySession::GetMemoryTrackingCyclesL(RArray<CMemSpyApiMemoryTrackingCycle*>& aCycles)
-	{
-	TPckgBuf<TInt> count;
-	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycleCount, TIpcArgs(&count) ));
-	
-	TInt requestedCount = count();
-	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyMemoryTrackingCycleData));
-	TPtr8 bufferPtr(buffer->Des());
-		
-	TIpcArgs args( &count, &bufferPtr );
-	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycles, args ));
-	
-	aCycles.Reset();
-	
-	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyMemoryTrackingCycleData))
-		{
-		TPckgBuf<TMemSpyMemoryTrackingCycleData> data;
-		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyMemoryTrackingCycleData));
-		aCycles.AppendL(CMemSpyApiMemoryTrackingCycle::NewLC(data()));
-		}
-	
-	CleanupStack::Pop(aCycles.Count());
-	CleanupStack::PopAndDestroy(buffer);
-	}
-
-EXPORT_C void RMemSpySession::OutputAllContainerContents()
-	{
-	SendReceive( EMemSpyClientServerOpOutputAllContainerContents );
-	}
-
-
-//Heap specific operations
-
-EXPORT_C CMemSpyApiHeap* RMemSpySession::GetHeapL()
-	{
-	CMemSpyApiHeap* aHeap;
-	
-	HBufC8* buffer = HBufC8::NewLC( sizeof(TMemSpyHeapData) );
-	TPtr8 bufferPtr(buffer->Des());
-	TIpcArgs args( &bufferPtr );
-	
-	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetHeap, args ));
-	
-	TPckgBuf<TMemSpyHeapData> data;
-	data.Copy(bufferPtr.Ptr(), sizeof(TMemSpyHeapData));		
-	aHeap = CMemSpyApiHeap::NewL( data() );
-	
-	CleanupStack::PopAndDestroy(buffer);
-		
-	return aHeap;
-	}
-
-EXPORT_C CMemSpyApiHeap* RMemSpySession::GetHeap()
-	{
-	CMemSpyApiHeap *result = NULL;
-	TRAPD(error, result = GetHeapL());
-	return error == KErrNone ? result : NULL;
-	}
-
-EXPORT_C void RMemSpySession::DumpKernelHeap()
-	{
-	SendReceive( EMemSpyClientServerOpDumpKernelHeap );
-	}
-
-EXPORT_C void RMemSpySession::OutputKernelHeapDataL()
-	{		
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadId,
-			TIpcArgs(KMemSpyClientServerThreadIdKernel)));
-	
-	}
-
-EXPORT_C void RMemSpySession::OutputKernelHeapData(TRequestStatus& aStatus)
-	{
-	SendReceive(EMemSpyClientServerOpHeapData,
-		TIpcArgs(KMemSpyClientServerThreadIdKernel),
-		aStatus);
-	}
-
-EXPORT_C void RMemSpySession::OutputThreadHeapDataL( TThreadId aThreadId)
-	{			
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadId,
-			TIpcArgs(aThreadId)));
-	}
-
-EXPORT_C void RMemSpySession::OutputThreadHeapDataL(const TDesC& aThreadName)
-	{	
-	const TIpcArgs args( &aThreadName );
-	        
-	User::LeaveIfError( SendReceive( EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadName, args ));	
-	}
-
-EXPORT_C void RMemSpySession::OutputThreadCellListL(TThreadId aThreadId)
-	{	
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapCellListing | KMemSpyOpFlagsIncludesThreadId,
-			TIpcArgs(aThreadId)));
-	}
-
-EXPORT_C void RMemSpySession::OutputHeapInfoUserL(TThreadId aThreadId)
-	{
-	User::LeaveIfError(SendReceive( EMemSpyClientServerOpHeapInfo | KMemSpyOpFlagsIncludesThreadId,
-			TIpcArgs(aThreadId)));
-	}
-
-EXPORT_C void RMemSpySession::SwitchOutputSinkL( TMemSpySinkType aType )
-	{
-	TInt op;
-	if( aType == ESinkTypeFile )
-		op = EMemSpyClientServerOpSwitchOutputSinkFile;
-	else
-		op = EMemSpyClientServerOpSwitchOutputSinkTrace;
-			
-	User::LeaveIfError(SendReceive( op ));
-	}
-
-EXPORT_C void RMemSpySession::SwitchOutputToTraceL()
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSwitchOutputSinkTrace));
-	}
-    
-EXPORT_C void RMemSpySession::SwitchOutputToFileL(const TDesC& aRootFolder)
-	{
-	TIpcArgs args;
-	if (aRootFolder.Length())
-		{
-		args.Set(0, &aRootFolder);
-		}
-	
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSwitchOutputSinkFile, args));
-	}
-
-EXPORT_C void RMemSpySession::OutputStackInfoL(TThreadId aThreadId)
-	{
-	User::LeaveIfError(SendReceive( EMemSpyClientServerOpStackInfo | KMemSpyOpFlagsIncludesThreadId,
-			TIpcArgs(aThreadId)));
-	}
-
-EXPORT_C void RMemSpySession::OutputStackDataL(TThreadId aThreadId, TMemSpyDriverDomainType aType )
-	{
-	TInt op;
-	if( aType == EMemSpyDriverDomainUser )
-		op = EMemSpyClientServerOpStackDataUser;
-	else
-		op = EMemSpyClientServerOpStackDataKernel;
-	
-	User::LeaveIfError(SendReceive( op | KMemSpyOpFlagsIncludesThreadId,
-			TIpcArgs(aThreadId, aType)));
-		
-	}
-
-EXPORT_C void RMemSpySession::OutputThreadInfoHandlesL(TThreadId aThreadId)
-	{
-	TPckgBuf<TThreadId> id(aThreadId);
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpOutputInfoHandles, TIpcArgs( &id )));	
-	}
-
-EXPORT_C void RMemSpySession::OutputAOListL(TThreadId aId, TMemSpyThreadInfoItemType aType)
-	{
-	TPckgBuf<TThreadId> id(aId);
-	TPckgBuf<TMemSpyThreadInfoItemType> type(aType);
-	
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpOutputAOList, TIpcArgs( &id, &type )));
-	}
-
-EXPORT_C void RMemSpySession::OutputKernelObjectsL()
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpEnumerateKernelContainerAll));
-	}
-
-EXPORT_C void RMemSpySession::OutputCompactStackInfoL()
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpStackInfoCompact)); 
-	}
-
-EXPORT_C void RMemSpySession::OutputCompactHeapInfoL()
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapInfoCompact)); 
-	}
-// Asynchronous operations
-EXPORT_C void RMemSpySession::OutputPhoneInfo(TRequestStatus& aStatus)
-	{	
-	SendReceive(EMemSpyClientServerOpSummaryInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
-	}
-
-EXPORT_C void RMemSpySession::OutputDetailedPhoneInfo(TRequestStatus& aStatus)
-	{	
-	SendReceive(EMemSpyClientServerOpSummaryInfoDetailed | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
-	}
-
-EXPORT_C void RMemSpySession::OutputHeapInfo(TRequestStatus& aStatus)
-	{	
-	SendReceive(EMemSpyClientServerOpHeapInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
-	}
-
-EXPORT_C void RMemSpySession::OutputCompactHeapInfo(TRequestStatus& aStatus)
-	{	
-	SendReceive(EMemSpyClientServerOpHeapInfoCompact | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
-	}
-
-EXPORT_C void RMemSpySession::OutputHeapCellListing(TRequestStatus& aStatus)
-	{	
-	SendReceive(EMemSpyClientServerOpHeapCellListing | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
-	}
-
-EXPORT_C void RMemSpySession::OutputHeapData(TRequestStatus& aStatus)
-	{	
-	SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
-	}
-
-// synchronous version of the operation - for CLI
-EXPORT_C void RMemSpySession::OutputHeapData()
-	{
-	SendReceive(EMemSpyClientServerOpHeapData);
-	}
-
-EXPORT_C void RMemSpySession::OutputStackInfo(TRequestStatus& aStatus)
-	{	
-	SendReceive(EMemSpyClientServerOpStackInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
-	}
-
-EXPORT_C void RMemSpySession::OutputCompactStackInfo(TRequestStatus& aStatus)
-	{	
-	SendReceive(EMemSpyClientServerOpStackInfoCompact | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
-	}
-
-EXPORT_C void RMemSpySession::OutputUserStackData(TRequestStatus& aStatus)
-	{	
-	SendReceive(EMemSpyClientServerOpStackDataUser | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
-	}
-
-EXPORT_C void RMemSpySession::OutputKernelStackData(TRequestStatus& aStatus)
-	{	
-	SendReceive(EMemSpyClientServerOpStackDataKernel | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
-	}
-
-// Synchronous operations
-EXPORT_C void RMemSpySession::OutputPhoneInfo()
-	{	
-	SendReceive( EMemSpyClientServerOpSummaryInfo , TIpcArgs() );
-	}
-
-EXPORT_C void RMemSpySession::SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig aConfig )
-	{
-	TPckgBuf<TMemSpyEngineHelperSysMemTrackerConfig> config(aConfig);
-	TIpcArgs args( &config );
-	
-	SendReceive( EMemSpyClientServerOpSetSwmtConfig, args) ;
-	}
-
-EXPORT_C void RMemSpySession::SetSwmtAutoStartProcessList( CArrayFixFlat<TUid>* aList )
-	{
-	TInt count = aList->Count();
-	TIpcArgs args( &aList, &count );
-	
-	SendReceive( EMemSpyClientServerOpSetSwmtAutoStartProcessList, args );
-	}
-
-EXPORT_C void RMemSpySession::SwmtResetTracking()
-	{
-	SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingReset );
-	}
-
-EXPORT_C void RMemSpySession::GetOutputSink( TMemSpySinkType aType )
-	{
-	TPckgBuf<TMemSpySinkType> type( aType );
-	TIpcArgs args( &type );
-	
-	SendReceive( EMemSpyClientServerOpGetOutputSink, args );
-	}
-
-EXPORT_C void RMemSpySession::NotifyDeviceWideOperationProgress(TMemSpyDeviceWideOperationProgress &aProgress, TRequestStatus &aStatus)
-	{
-	SendReceive(EMemSpyClientServerOpNotifyDeviceWideOperationProgress | KMemSpyOpFlagsAsyncOperation,
-			TIpcArgs(&aProgress.iProgress, &aProgress.iDescription), 
-			aStatus);
-	}
-
-EXPORT_C void RMemSpySession::CancelDeviceWideOperationL()
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpCancelDeviceWideOperation));
-	}
-
-// SWMT operations
-EXPORT_C void RMemSpySession::SetSwmtCategoriesL(TInt aCategories)
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet,
-			TIpcArgs(aCategories)));
-	}
-
-EXPORT_C void RMemSpySession::SetSwmtHeapDumpsEnabledL(TBool aEnabled)
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet,
-			TIpcArgs(aEnabled)));
-	}
-
-EXPORT_C TBool RMemSpySession::IsSwmtRunningL()
-	{
-	TPckgBuf<TBool> ret;
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpIsSwmtRunning, TIpcArgs(&ret)));
-	
-	return ret();
-	}
-
-EXPORT_C void RMemSpySession::StartSwmtTimerL(TInt aPeriod)
-	{
-	SetSwmtTimerIntervalL(aPeriod);
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart));
-	}
-
-EXPORT_C void RMemSpySession::StartSwmtTimerL()
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart));
-	}
-
-EXPORT_C void RMemSpySession::SetSwmtTimerIntervalL(TInt aPeriod)
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet,
-			TIpcArgs(aPeriod)));
-	}
-
-EXPORT_C void RMemSpySession::StopSwmtTimerL()
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop));
-	}
-
-
-EXPORT_C void RMemSpySession::ForceSwmtUpdateL()
-	{
-	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate));
-	}
-
-EXPORT_C void RMemSpySession::ForceSwmtUpdate(TRequestStatus& aStatus)
-	{
-	SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate, 
-			TIpcArgs(),
-			aStatus);
-	}
-
-EXPORT_C void RMemSpySession::SetSwmtFilter( const TDesC& aFilter )
-	{	
-	TIpcArgs args( &aFilter );
-	User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet, args ) );
-	}
-
-EXPORT_C TInt TMemSpyDeviceWideOperationProgress::Progress() const 
-	{
-	return iProgress();
-	}
-
-EXPORT_C const TDesC& TMemSpyDeviceWideOperationProgress::Description() const
-	{
-	return iDescription;
-	}
--- a/memspy/MemSpyServer/Source/MemSpyServerMain.cpp	Fri Aug 27 11:37:29 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:
-* MemSpyServer Main class
-*/
-
-// System includes
-#include <e32std.h>
-#include <e32base.h>
-#include <f32file.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-
-// User includes
-//#include "MemSpyServer.h"
-
-static void RunServerL()
-    {
-    // Scheduler
-    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
-    CleanupStack::PushL( scheduler );    
-    CActiveScheduler::Install( scheduler );    
-    
-    // F32
-    RFs fsSession;
-    User::LeaveIfError(fsSession.Connect());
-    CleanupClosePushL(fsSession);
-    
-    // MemSpyEngine initialization
-    CMemSpyEngine* engine = CMemSpyEngine::NewL(fsSession);
-    CleanupStack::PushL(engine);
-    
-    // Play nicely with external processes
-    RProcess::Rendezvous( KErrNone );       
-
-    // Start wait loop.
-    CActiveScheduler::Start();
-    
-    // Tidy up
-    CleanupStack::PopAndDestroy( 3, scheduler );
-    }
-
-TInt E32Main()
-    {
-    __UHEAP_MARK;
-
-    CTrapCleanup* cleanupTrap = CTrapCleanup::New();
-    
-	TInt r = KErrNoMemory;
-	if ( cleanupTrap )
-		{
-		TRAPD(err, RunServerL());		
-		if  ( err != KErrNone )
-		        {
-		        RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MemSpyServer - error: %d"), err);
-		        }
-		delete cleanupTrap;
-		}  
-
-    __UHEAP_MARKEND;
-
-    return r;
-    }
--- a/memspy/MemSpyServer/group/MemSpyServer.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +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 <bldvariant.hrh>
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGETTYPE EXE
-TARGET MemSpyServer.exe
-UID 0 0x2002EA8D
-SECUREID     0xE5883BC2
-VENDORID	 0x101FB657 // Nokia
-
-EPOCSTACKSIZE 0x4000
-EPOCHEAPSIZE 0x100000 0x4000000
-
-
-SOURCEPATH ../Source
-SOURCE		MemSpyServerMain.cpp 
-
-USERINCLUDE ../Include
-
-CAPABILITY ReadUserData WriteUserData ReadDeviceData WriteDeviceData
-
-OS_LAYER_SYSTEMINCLUDE
-
-APP_LAYER_SYSTEMINCLUDE
-
-LIBRARY         MemSpyDriverClient.lib
-LIBRARY         MemSpyEngine.lib
-
-LIBRARY 		euser.lib
-LIBRARY			ecom.lib
-LIBRARY			efsrv.lib
-LIBRARY			estor.lib
-LIBRARY			bafl.lib
-LIBRARY			ws32.lib
-LIBRARY			cone.lib
-LIBRARY			eikcore.lib
-LIBRARY			fbscli.lib 
-LIBRARY 		PlatformEnv.lib
-LIBRARY 		flogger.lib
-LIBRARY			apgrfx.lib
-
--- a/memspy/MemSpyServer/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +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:
-*
-*/
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-MemSpyServer.mmp
--- a/memspy/group/MemSpyCapabilities.mmh	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +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:
-*
-*/
-
-
-CAPABILITY      ReadUserData WriteUserData ReadDeviceData WriteDeviceData SwEvent PowerMgmt
--- a/memspy/group/ReleaseNotes_MemSpy.txt	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-===============================================================================
-
-RELEASE NOTES - MEMSPY v2.1.0
-RELEASED 15th June 2010 
-
-SUPPORTS S60 5.0+
-
-===============================================================================
-
-Product Description:
-====================
-MemSpy is a tracing application running on an S60 device. MemSpy is typically
-used to narrow down the field of investigation. Once you know where the problem
-is (e.g. the thread or process), you can use other tools to perform more
-detailed inspection. 
-
-Main Features:
-==============
-- RAM usage of a thread or process
-- Amount of stack each thread has
-- Active objects for a given thread
-- Files that are open in a system, or files that have been opened by a thread
-- Device RAM / ROM configuration
-- Servers that are running (and their sessions)
-- Any memory chunks
-- Heap memory changes over time
-- Bitmaps loaded by the font & bitmap server
-
-===============================================================================
-
-What's New in v2.1.0
-====================
-- Feature: Folder where log files are saved can now be set in settings.
-- Feature: Introduced new Orbit based user interface.
-- Change: Servers, Ecom, Window groups, System info and Automatic Capture were
-  removed.
-- Change: Console interface was removed.
-- Change: Command line interface commands were changed to be more user 
-  friendly.
-
-===============================================================================
-
-Installation Notes:
-===================
-MemSpy is typically preinstalled on ROM. If not, it can be added to the
-ROM with the .iby file. Alternatively, a .sis file can be found under the sis-
-directory, but the user needs to sign it with their own developer certificate.
-In Nokia R&D environment, you can use directly the R&D-signed .sis file under 
-the internal\sis directory.
-
-When signing with own developer certificate, the following capabilities are
-needed:
-  TCB
-  CommDD
-  PowerMgmt
-  MultimediaDD
-  ReadDeviceData
-  WriteDeviceData
-  DRM
-  TrustedUI
-  ProtServ
-  DiskAdmin
-  NetworkControl
-  AllFiles
-  SwEvent
-  NetworkServices
-  LocalServices
-  ReadUserData
-  WriteUserData
-  Location
-  SurroundingsDD
-  UserEnvironment
-
-===============================================================================
-
-System Requirements:
-====================
-Basic Requirements:
-- Any S60 5.x device or emulator environment
-
-===============================================================================
-
-Compatibility Issues:
-=====================
-N/A
-
-===============================================================================
-
-Known Issues:
-=============
-- Following command line functions do not work: CmdUI_Background,
-  CmdUI_Foreground, CmdUI_Exit.
-- Command line function CmdSWMT_ForceUpdate does not work correctly when using
-  different category settings in sequential CmdSWMT_ForceUpdate functions.
-- Exporting FBS bitmaps does not work if E: drive is not available.
-
-===============================================================================
-
-Version History:
-================
-
-Version 1.2.0 - 27th October 2009 
----------------------------------
-- Feature: Tracking modes introduced for simplify System Wide Memory Tracking
-  settings.
-- Feature: System Wide Memory Tracking categories can now be selected.
-- Feature: Heap data captured during System Wide Memory Tracking can be
-  filtered by thread name.
-- Feature: Shared heaps can now be detected with S60 UI and trace output.
-- Feature: Batch files for running MemSpy functions can now be executed from
-  command line.
-- Change: Command line interface documented in User's Guide.
-
-Version 1.1.0 - 22nd July 2009
-------------------------------
-- Fix: Browsing chunk list resulted in a crash.
-- Feature: Details of Kernel Objects can be now displayed on S60 UI.
-- Feature: Process and Thread Kernel Objects can be now terminated and
-  switched to.
-- Feature: Window Groups view for displaying Window Group details, terminating
-  and switching to a Window Group.
-- Feature: Window Groups can be now tracked with SWMT.
-
-Version 1.0.2 - 13th May 2009
------------------------------
-- Fix: Correction for rapid insertion & removal of USB cable when viewing
-  kernel containers.
-- Fix: Prevent SWMT from locking MemSpy UI by disallowing too short SWMT
-  timer intervals.
-- Fix: Prevent saving bitmaps with zero-pixel dimensions to disk.    
-- Change: Remove dependency on TimeZoneServer
-
-Version 1.0.1 - 16th March 2009
-------------------------------
-- Feature: Client <-> Server interface now works with console UI as well as 
-  S60 UI.
-- Fix: Process memory tracking values now update correctly in S60 UI.
-- Fix: Navigating back from some views resulted in a crash.
-- Fix: Unable to obtain heap data for some threads which contain lots of 
-  free cells.
-
-Version 1.0.0 - 4th March 2009
-------------------------------
-- Initial release for Symbian Foundation
-
-===============================================================================
-
-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".
--- a/memspy/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +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 <platform_paths.hrh>
-
-// API
-#include "../memspy_plat/group/bld.inf"
-
-// Driver
-#include "../Driver/group/bld.inf"
-
-// Engine includes
-#include "../Engine/group/bld.inf"
-
-// Commandline includes
-#include "../CommandLine/group/bld.inf"
-
-// MemSpyServer
-#include "../MemSpyServer/group/bld.inf"
-
-// MemSpyClient
-#include "../MemSpyClient/group/bld.inf"
-
-PRJ_EXPORTS
-../rom/memspy.iby      CORE_IBY_EXPORT_PATH(tools,memspy.iby)
-../rom/memspy_rom.iby  CORE_IBY_EXPORT_PATH(tools/rom,memspy_rom.iby)
\ No newline at end of file
--- a/memspy/memspy_plat/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +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:
-*
-*/
-
-// MemSpy API
-#include "../memspy_api/group/bld.inf"
--- a/memspy/memspy_plat/memspy_api/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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 <platform_paths.hrh>
-
-PRJ_EXPORTS
-// Public API
-../include/MemSpyEngineClientInterface.h				                            OS_LAYER_PLATFORM_EXPORT_PATH(memspyengineclientinterface.h)
-
-// Main engine API
-../include/memspy/engine/MemSpyEngine.h									            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengine.h)
-../include/memspy/engine/MemSpyEngineImp.h								            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineimp.h)
-../include/memspy/engine/MemSpyEngineUtils.h							            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineutils.h)
-../include/memspy/engine/MemSpyEngineObserver.h							            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobserver.h)
-../include/memspy/engine/MemSpyEngineTwiddlableItemArray.h				            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginetwiddlableitemarray.h)
-../include/memspy/engine/MemSpyEngineTwiddlableItemArray.inl			            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginetwiddlableitemarray.inl)
-../include/memspy/engine/MemSpyEngineProcessMemoryTracker.h				            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineprocessmemorytracker.h)
-
-// Device wide operations
-../include/memspy/engine/DeviceWideOps/MemSpyDeviceWideOperations.h				    OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspydevicewideoperations.h)
-
-// Sink
-../include/memspy/engine/Sink/MemSpyEngineOutputSink.h					            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineoutputsink.h)
-../include/memspy/engine/Sink/MemSpyEngineOutputSinkType.h				            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineoutputsinktype.h)
-../include/memspy/engine/Sink/MemSpyEngineOutputList.h					            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineoutputlist.h)
-
-// Logger
-../include/memspy/engine/Logger/MemSpyEngineLogger.h					            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginelogger.h)
-
-// Event Handlers
-../include/memspy/engine/EventHandlers/MemSpyEngineMidwife.h			            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginemidwife.h)
-../include/memspy/engine/EventHandlers/MemSpyEngineUndertaker.h			            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineundertaker.h)
-
-// Thread and process
-../include/memspy/engine/ThreadAndProcess/MemSpyEngineObject.h						OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobject.h)
-../include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectContainer.h				OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobjectcontainer.h)
-../include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectProcess.h				OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobjectprocess.h)
-../include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThread.h				OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobjectthread.h)
-../include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoContainer.h	OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobjectthreadinfocontainer.h)
-../include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.h		OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobjectthreadinfoobjects.h)
-
-// Helpers
-../include/memspy/engine/Helpers/MemSpyEngineHelperActiveObject.h					OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperactiveobject.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperChunk.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperchunk.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperCodeSegment.h					OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpercodesegment.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperCondVar.h						OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpercondvar.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperECom.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperecom.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperFbServ.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperfbserv.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperFileSystem.h						OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperfilesystem.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperHeap.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperheap.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperKernelContainers.h				OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperkernelcontainers.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperProcess.h						OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperprocess.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperRAM.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperram.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperROM.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperrom.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperServer.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperserver.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperStack.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperstack.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperThread.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperthread.h)
-../include/memspy/engine/Helpers/MemSpyEngineHelperWindowServer.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperwindowserver.h)
-
-// SWMT
-../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTracker.h			OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtracker.h)
-../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerConfig.h		OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtrackerconfig.h)
-../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycle.h		OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtrackercycle.h)
-../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycleChange.h	OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtrackercyclechange.h)
-../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerObserver.h	OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtrackerobserver.h)
-../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerEnums.h		OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtrackerenums.h)
-
-// Driver
-../include/memspy/driver/kernel/MemSpyDriverPanics.h				                OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverpanics.h)
-
-../include/memspy/driver/shared/MemSpyDriverConstants.h					            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverconstants.h)
-../include/memspy/driver/shared/MemSpyDriverObjectsShared.h				            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverobjectsshared.h)
-../include/memspy/driver/shared/MemSpyDriverEnumerationsShared.h			        OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverenumerationsshared.h)
-../include/memspy/driver/shared/MemSpyDriverObjectsSharedRHeap.h			        OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverobjectssharedrheap.h)
-
-../include/memspy/driver/user/MemSpyDriverClient.h				                    OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverclient.h)
-../include/memspy/driver/user/MemSpyDriverStreamReader.h			                OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverstreamreader.h)
-../include/memspy/driver/user/MemSpyDriverLightweightClient.h		                OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverlightweightclient.h)
-
--- a/memspy/memspy_plat/memspy_api/include/MemSpyEngineClientInterface.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,705 +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 MEMSPYENGINECLIENTINTERFACE_H
-#define MEMSPYENGINECLIENTINTERFACE_H
-
-
-// System includes
-#include <e32base.h>
-#include <u32std.h>
-
-// Constants
-const TInt KMemSpyClientServerVersion           = 2;
-const TInt KMemSpyListInfoForAllThreads         = -1;
-
-/**
- * Special constant to be used to indicate kernel thread id
- * when performing kernel-specific thread agnostic operations.
- *
- * Note that the kernel thread is not supported for all thread-specific
- * operation types. 
- *
- * Use this value to indicate that the kernel thread is the target
- * thread when calling the thread-specific overload of PerformOperation().
- */
-const TUint32 KMemSpyClientServerThreadIdKernel = KMaxTUint32;
-
-// Internal constants
-const TInt KMemSpyOpFlagsTypeMask               = 0x0000FFFF;
-const TInt KMemSpyOpFlagsInclusionMask          = 0xFFFF0000;
-const TInt KMemSpyOpFlagsIncludesThreadId       = 0x00010000;
-const TInt KMemSpyOpFlagsIncludesThreadName     = 0x00020000;
-const TInt KMemSpyOpFlagsAsyncOperation         = 0x00040000;
-// Literal constants
-_LIT( KMemSpyServerName, "MemSpyServer" );
-_LIT( KMemSpyProcessName0, "MemSpyServer.exe" );
-_LIT( KMemSpyProcessName1, "MemSpyUI.exe" );
-//_LIT( KMemSpyProcessName2, "MemSpyConsole.exe" );
-
-//
-// Supported MemSpy operation types
-//
-// Operations which can only be applied to a specific thread are
-// prefixed by [TS] - i.e. it is permitted to use the thread-specific 
-// overload of PerformOperation() for this operation type.
-//
-// Operations that can be applied only to the entire device are
-// prefixed by [ED] - i.e. it is permitted to use the 
-// thread-agnostic overload of PerformOperation() for this operation type.
-//
-// Operations that support kernel-thread-specific requests
-// are prefixed by [KS] - i.e. it is permitted to use the 
-// thread-specific overload of PerformOperation() and the thread
-// identification parameter should correspond to KMemSpyClientServerThreadIdKernel.
-// NB: The overload of PerformOperation() which supports a descriptor cannot
-// be used.
-//
-// Operations that are not relevant to a thread are prefixed
-// by [NT] - i.e. use the thread-agnostic overload of
-// PerformOperation()
-//
-// All other op codes are deemed internal and are not to be
-// used except via provided APIs.
-//
-enum TMemSpyClientServerOp
-    {
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpMarkerFirst = 0,
-
-    /**
-     * [TS][ED]
-     * Show basic summary information about a thread/process
-     */
-    EMemSpyClientServerOpSummaryInfo = EMemSpyClientServerOpMarkerFirst,
-
-    /**
-     * [TS][ED]
-     * Show detailed summary information about a thread/process
-     */
-    EMemSpyClientServerOpSummaryInfoDetailed,
-
-    /**
-     * [TS][ED][KS]
-     * Show heap information & statistics for a user-side thread
-     */
-    EMemSpyClientServerOpHeapInfo,
-
-    /**
-     * [TS][ED]
-     * Prvide heap cell listings for a thread
-     */
-    EMemSpyClientServerOpHeapCellListing,
-
-    /**
-     * [TS][ED][KS]
-     * Dump a thread's heap
-     */
-    EMemSpyClientServerOpHeapData,
-
-    /**
-     * [TS][ED]
-     * Show summary information about a thread's stack
-     */
-    EMemSpyClientServerOpStackInfo,
-
-    /**
-     * [TS][ED]
-     * Dump a thread's user-side stack
-     */
-    EMemSpyClientServerOpStackDataUser,
-
-    /**
-     * [TS][ED]
-     * Dump a thread's kernel-side stack
-     */
-    EMemSpyClientServerOpStackDataKernel,
-
-    /**
-     * [TS][ED]
-     * List all open files in the OS or then the open files
-     * for a given thread.
-     */
-    EMemSpyClientServerOpOpenFiles,
-    
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpMarkerThreadAgnosticFirst,
-
-    /**
-     * [ED]
-     * Provide compact heap information for the entire device, which
-     * can be compared with other similar listings using Heap Analyser.
-     */
-    EMemSpyClientServerOpHeapInfoCompact = EMemSpyClientServerOpMarkerThreadAgnosticFirst,
-
-    /**
-     * [ED]
-     * Show compact stack information for the device
-     */
-    EMemSpyClientServerOpStackInfoCompact,
-
-    /**
-     * [NT]
-     * Start the system wide memory tracker (SWMT) running, so that when
-     * the timer expires, the system characteristics will be sampled
-     * and any changes notified. NB: Starting the SWMT running for the first time
-     * will cause an initial preparatory cycle to be established. Future updates
-     * will then follow when the timer tick period expires
-     */
-    EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart,
-
-    /** 
-     * [NT]
-     * Stop the system wide memory tracker. No futher automatic timer-based
-     * SWMT cycles will be performed unless "Force update" is utilised or the timer
-     * is started again.
-     */
-    EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop,
-
-    /** 
-     * [NT]
-     * Reset the SWMT so that all existing cycles are discarded (which can free
-     * quite a lot of memory). All operations are cancelled, the SWMT will be idle.
-     * 
-     * If performing manual "force updates" to the SWMT, then the SWMT should be reset
-     * before starting a new test run. For timer-based SWMT sampling, this operation
-     * is performed internally by MemSpy and therefore is redundant in that situation.
-     */
-    EMemSpyClientServerOpSystemWideMemoryTrackingReset,
-
-    /**
-     * [NT]
-     * Force the system wide memory tracker (internal to memspy) to
-     * perform a refresh
-     */
-    EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpSwitchOutputSinkFile,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpSwitchOutputSinkTrace,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpEnumerateKernelContainer,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpEnumerateKernelContainerAll,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpBitmapsSave,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpDisableAknIconCache,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpSendToBackground,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpBringToForeground,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpExit,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet,
-
-    /**
-     * [INTERNAL REQUEST]
-     */
-    EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet,
-    
-    /**
-	 * [INTERNAL REQUEST]
-	 */
-	EMemSpyClientServerOpMarkerUiFirst,
-	
-	EMemSpyClientServerOpGetProcessCount = EMemSpyClientServerOpMarkerUiFirst,
-	
-	EMemSpyClientServerOpGetProcesses,
-	
-	EMemSpyClienServerOpGetProcessIdByName,
-	
-	EMemSpyClientServerOpGetThreadCount,
-	
-	EMemSpyClientServerOpGetThreads,
-	
-	EMemSpyClientServerOpSetThreadPriority,
-	
-	EMemSpyClientServerOpProcessSystemPermanentOrCritical,
-	
-	EMemSpyClientServerOpEndProcess,
-	
-	EMemSpyClientServerOpSwitchToProcess,
-	
-	//Threads operations
-	EMemSpyClientServerOpThreadSystemPermanentOrCritical,
-	
-	EMemSpyClientServerOpEndThread,
-	
-	EMemSpyClientServerOpSwitchToThread,
-	
-	EMemSpyClientServerOpGetInfoItemType,
-	
-	EMemSpyClientServerOpGetThreadInfoItemsCount,
-	
-	EMemSpyClientServerOpGetThreadInfoItems,
-	
-	EMemSpyClientServerOpOutputInfoHandles,
-	
-	EMemSpyClientServerOpOutputAOList,
-		
-	
-	//Kernel Objects operations
-	EMemSpyClientServerOpGetKernelObjectCount,
-	
-	EMemSpyClientServerOpGetKernelObjects,
-	
-	EMemSpyClientServerOpGetKernelObjectItemCount,
-	
-	EMemSpyClientServerOpGetKernelObjectItems,
-	
-	EMemSpyClientServerOpGetHeap,
-	
-	EMemSpyClientServerOpGetMemoryTrackingCycleCount,
-	
-	EMemSpyClientServerOpGetMemoryTrackingCycles,
-	
-	/**
-	 * [INTERNAL REQUEST]
-	 * Register for notifications of device wide operation progress.
-	 */
-	EMemSpyClientServerOpNotifyDeviceWideOperationProgress,
-	
-	/**
-	 * [INTERNAL REQUEST]
-	 * Cancel current device wide operation
-	 */
-	EMemSpyClientServerOpCancelDeviceWideOperation,	
-	
-	EMemSpyClientServerOpOutputAllContainerContents,
-	    
-	EMemSpyClientServerOpDumpKernelHeap,
-	
-	EMemSpyClientServerOpSetSwmtConfig,
-	
-	EMemSpyClientServerOpSetSwmtAutoStartProcessList,
-		
-	EMemSpyClientServerOpGetOutputSink,
-	
-	/**
-	 * [INTERNAL REQUEST]
-	 * Check if system wide memory tracking timer is running.
-	 */
-	EMemSpyClientServerOpIsSwmtRunning,
-	
-	EMemSpyClientServerOpMarkerUiLast,		
-	
-	/**
-	 * [INTERNAL REQUEST]
-	 */
-    EMemSpyClientServerOpMarkerLast,
-    };
-
-
-enum TMemSpyEndType
-	{
-	ETerminate,
-	EKill,
-	EPanic
-	};
-
-
-
-
-
-NONSHARABLE_CLASS( RMemSpyEngineClientInterface ) : public RSessionBase
-    {
-public:
-    inline RMemSpyEngineClientInterface();
-    inline TInt Connect();
-    inline void Close();
-
-public: // API
-
-    /**
-     * Thread-agnostic request function. Performs the operation in the context of
-     * the entire device.
-     *
-     * I.e. can only be used for [NT] or [ED] requests.
-     */
-    inline TInt PerformOperation( TMemSpyClientServerOp aOperation );
-
-    /**
-     * Thread-specific request functions. Perform the requested operation in the context
-     * of the specified thread id, or (possibly partial) thread name.
-     *
-     * To perform the operation in the context of the current thread, invoke the
-     * function as follows:
-     *
-     *      PerformOperation( <...>, RThread().Id() );
-     *
-     * I.e. can only be used for [TS] requests.
-     */
-    inline TInt PerformOperation( TMemSpyClientServerOp aOperation, TThreadId aId );
-    inline TInt PerformOperation( TMemSpyClientServerOp aOperation, const TDesC& aThreadName );
-
-    /**
-     * General functions to switch MemSpy's output mode.
-     */
-    inline TInt SwitchOutputModeFile();
-    inline TInt SwitchOutputModeTrace();
-
-    /**
-     * Configure the system wide memory tracker timer interval (for automatic timer-based polling).
-     * Change will take effect next time SWMT is started.
-     */
-    inline TInt SystemWideMemoryTrackerTimerIntervalSet( TInt aInterval );
-
-    /**
-     * Configure the system wide memory tracker categories.
-     * Change will take effect next time SWMT is started.
-     */
-    inline TInt SystemWideMemoryTrackerCategoriesSet( TInt aCategories );
-
-    /**
-     * Configure the system wide memory tracker for filtering user heaps by thread name.
-     * Change will take effect next time SWMT is started.
-     */
-    inline TInt SystemWideMemoryTrackerThreadFilterSet( const TDesC& aFilter );
-    
-    /**
-     * Configure the system wide memory tracker for enabling/disabling Heap dumps during SWMT.
-     * Change will take effect next time SWMT is started.
-     */
-    inline TInt SystemWideMemoryTrackerHeapDumpSet( TBool aDumpEnabled );
-    
-    /**
-     * List the contents of a specific kernel container. See TObjectType for types.
-     */
-    inline TInt EnumerateKernelContainer( TObjectType aType );
-
-    /**
-     * List the contents of all kernel containers
-     */
-    inline TInt EnumerateKernelContainerAll();
-
-    /**
-     * Save bitmaps to memory card
-     */
-    inline TInt SaveAllBitmaps();
-
-    /**
-     * Disable AknIcon caching
-     */
-    inline TInt DisableAknIconCache();
-
-    /**
-     * Send MemSpy to the background/bring to foreground
-     */
-    inline TInt SendToBackground();
-    inline TInt BringToForeground();
-
-    /**
-     * Exit MemSpy
-     */
-    inline TInt Exit();
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-inline RMemSpyEngineClientInterface::RMemSpyEngineClientInterface()
-    {
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::Connect()
-    {
-    TVersion version( KMemSpyClientServerVersion, 0, 0 );
-    return CreateSession( KMemSpyServerName, version );
-    }
-
-
-inline void RMemSpyEngineClientInterface::Close()
-    {
-    RSessionBase::Close();
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::PerformOperation( TMemSpyClientServerOp aOperation )
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = aOperation;
-        const TIpcArgs args( KMemSpyListInfoForAllThreads );
-        //
-        error = SendReceive( opCode, args );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::PerformOperation( TMemSpyClientServerOp aOperation, TThreadId aId )
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = aOperation | KMemSpyOpFlagsIncludesThreadId;
-        const TIpcArgs args( aId );
-        //
-        error = SendReceive( opCode, args );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::PerformOperation( TMemSpyClientServerOp aOperation, const TDesC& aThreadName )
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = aOperation | KMemSpyOpFlagsIncludesThreadName;
-        const TIpcArgs args( &aThreadName );
-        //
-        error = SendReceive( opCode, args );
-        }
-    return error;
-    }
-
-
-
-
-
-
-inline TInt RMemSpyEngineClientInterface::SwitchOutputModeFile()
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpSwitchOutputSinkFile;
-        error = SendReceive( opCode );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::SwitchOutputModeTrace()
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpSwitchOutputSinkTrace;
-        error = SendReceive( opCode );
-        }
-    return error;
-    }
-
-
-
-
-
-
-
-
-inline TInt RMemSpyEngineClientInterface::SystemWideMemoryTrackerTimerIntervalSet( TInt aInterval )
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet;
-        const TIpcArgs args( aInterval );
-        //
-        error = SendReceive( opCode, args );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::SystemWideMemoryTrackerCategoriesSet( TInt aCategories )
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet;
-        const TIpcArgs args( aCategories );
-        //
-        error = SendReceive( opCode, args );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::SystemWideMemoryTrackerThreadFilterSet( const TDesC& aFilter )
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet;
-        TIpcArgs args( &aFilter );
-        error = SendReceive( opCode, args );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::SystemWideMemoryTrackerHeapDumpSet( TBool aDumpEnabled  )
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet;
-        const TIpcArgs args( aDumpEnabled );
-        error = SendReceive( opCode, args );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::EnumerateKernelContainer( TObjectType aType )
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpEnumerateKernelContainer;
-        const TIpcArgs args( aType );
-        //
-        error = SendReceive( opCode, args );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::EnumerateKernelContainerAll()
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpEnumerateKernelContainerAll;
-        error = SendReceive( opCode );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::SaveAllBitmaps()
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpBitmapsSave;
-        error = SendReceive( opCode );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::DisableAknIconCache()
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpDisableAknIconCache;
-        error = SendReceive( opCode );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::SendToBackground()
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpSendToBackground;
-        error = SendReceive( opCode );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::BringToForeground()
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpBringToForeground;
-        error = SendReceive( opCode );
-        }
-    return error;
-    }
-
-
-inline TInt RMemSpyEngineClientInterface::Exit()
-    {
-    TInt error = KErrNotReady;
-    if  ( Handle() != KNullHandle )
-        {
-        const TInt opCode = EMemSpyClientServerOpExit;
-        error = SendReceive( opCode );
-        }
-    return error;
-    }
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/driver/kernel/MemSpyDriverPanics.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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 MEMSPYDRIVERPANICS_H
-#define MEMSPYDRIVERPANICS_H
-
-// System includes
-#include <e32cmn.h>
-
-
-/**
- * Mem spy driver client panic category
- */
-_LIT( KMemSpyClientPanic, "MemSpyDriver" );
-
-
-/**
- * Panic codes
- */
-enum TMemSpyDriverPanic
-	{
-	EPanicBadDescriptor = 0,
-	EPanicHeapWalkPending,
-	EPanicHeapWalkNotInitialised,
-    EPanicThreadsInProcessNotSuspended,
-    EPanicWrongProcessSuspended,
-    EPanicAttemptingToSuspendMultipleProcesses,
-    EPanicAttemptingToResumeNonSuspendedProcess,
-    EPanicHeapInfoNotYetSeeded,
-    EPanicHeapChunkAlreadyCloned,
-    EPanicForcedKill,
-    EPanicForcedTerminate,
-    EPanicForcedPanic,
-    EPanicKernelHeapDataInitError,
-    EPanicKernelHeapDataFetchError,
-    EPanicHeapFreeCellStreamNotClosed,
-    EPanicHeapFreeCellStreamNotOpen
-	};
-
-
-	
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverConstants.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +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 MEMSPYDRIVERCONSTANTS_H
-#define MEMSPYDRIVERCONSTANTS_H
-
-// System includes
-#include <e32def.h>
-
-
-/**
-*
-*/
-_LIT(KMemSpyDriverDeviceName, "MEMSPYDRIVER");
-
-
-/**
- *
- */
-inline TVersion KMemSpyDriverVersion() { return TVersion(1, 0, 0); }
-
-
-/**
- * As this LDD allows to bypass platform security, we need to restrict
- * access to a few trusted clients.
- */
-const TUint32 KMemSpyUiSID = 0x2002129F;
-const TUint32 KMemSpyConsoleUiSID = 0x2002129E;
-
-
-/**
- *
- */
-const TInt KMemSpyDriverEnumerateContainerHandles = -1;
-
-
-/**
- * Used for get heap data calls when requesting the kernel heap
- * 
- */
-const TUint KMemSpyDriverGetKernelHeapDataPseudoThreadId = 0;
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverEnumerationsShared.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +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 MEMSPYDRIVERENUMERATIONSSHARED_H
-#define MEMSPYDRIVERENUMERATIONSSHARED_H
-
-// System includes
-#include <u32std.h>
-
-// Enumerations
-enum TMemSpyDriverCellType
-	{
-	EMemSpyDriverAllocatedCellMask	= 0x000000FF,
-	EMemSpyDriverFreeCellMask		= 0x0000FF00,
-	EMemSpyDriverBadCellMask		= 0xFF000000,
-
-	EMemSpyDriverHeapAllocation		= 0x00000001,
-	EMemSpyDriverDlaAllocation		= 0x00000002,
-	EMemSpyDriverPageAllocation		= 0x00000003,
-	EMemSpyDriverSlabAllocation		= 0x00000004,
-	
-	EMemSpyDriverHeapFreeCell		= 0x00000100,
-	EMemSpyDriverDlaFreeCell		= 0x00000200,
-	EMemSpyDriverSlabFreeCell		= 0x00000300, // Used to track free cells in partially-filled slabs
-	EMemSpyDriverSlabFreeSlab		= 0x00000400, // Used to track entirely empty slabs (that don't have a specific cell size)
-
-	EMemSpyDriverHeapBadFreeCellAddress			= 0x01000000,
-	EMemSpyDriverHeapBadFreeCellSize			= 0x02000000,
-	EMemSpyDriverHeapBadAllocatedCellSize		= 0x03000000,
-	EMemSpyDriverHeapBadAllocatedCellAddress	= 0x04000000,
-	};
-
-
-enum TMemSpyDriverThreadOrProcess
-    {
-    EMemSpyDriverThreadOrProcessTypeThread = EThread, // From TObjectType
-    EMemSpyDriverThreadOrProcessTypeProcess = EProcess
-    };
-
-
-enum TMemSpyDriverDomainType
-    {
-    EMemSpyDriverDomainUser = 0,
-    EMemSpyDriverDomainKernel
-    };
-
-
-enum TMemSpyDriverChunkType
-    {
-    EMemSpyDriverChunkTypeUnknown = 0,
-    EMemSpyDriverChunkTypeHeap,
-    EMemSpyDriverChunkTypeHeapKernel,
-    EMemSpyDriverChunkTypeStackAndProcessGlobalData,
-    EMemSpyDriverChunkTypeStackKernel,
-    EMemSpyDriverChunkTypeGlobalData,
-    EMemSpyDriverChunkTypeCode,
-    EMemSpyDriverChunkTypeCodeGlobal,
-    EMemSpyDriverChunkTypeCodeSelfModifiable,
-    EMemSpyDriverChunkTypeLocal,
-    EMemSpyDriverChunkTypeGlobal,
-    EMemSpyDriverChunkTypeRamDrive
-    };
-
-
-enum TMemSpyDriverContainerType
-    {
-    EMemSpyDriverContainerTypeUnknown          = -1,
-    EMemSpyDriverContainerTypeFirst            = EThread,
-	EMemSpyDriverContainerTypeThread           = EMemSpyDriverContainerTypeFirst,
-	EMemSpyDriverContainerTypeProcess          = EProcess,
-	EMemSpyDriverContainerTypeChunk            = EChunk,
-	EMemSpyDriverContainerTypeLibrary          = ELibrary,
-	EMemSpyDriverContainerTypeSemaphore        = ESemaphore,
-	EMemSpyDriverContainerTypeMutex            = EMutex,
-	EMemSpyDriverContainerTypeTimer            = ETimer,
-	EMemSpyDriverContainerTypeServer           = EServer,
-	EMemSpyDriverContainerTypeSession          = ESession,
-	EMemSpyDriverContainerTypeLogicalDevice    = ELogicalDevice,
-	EMemSpyDriverContainerTypePhysicalDevice   = EPhysicalDevice,
-	EMemSpyDriverContainerTypeLogicalChannel   = ELogicalChannel,
-	EMemSpyDriverContainerTypeChangeNotifier   = EChangeNotifier,
-	EMemSpyDriverContainerTypeUndertaker       = EUndertaker,
-	EMemSpyDriverContainerTypeMsgQueue         = EMsgQueue,
-	EMemSpyDriverContainerTypePropertyRef      = EPropertyRef,
-	EMemSpyDriverContainerTypeCondVar          = ECondVar,
-	EMemSpyDriverContainerTypeLast             = EMemSpyDriverContainerTypeCondVar
-    };
-
-
-enum TMemSpyDriverTimerType // Same as TTimer::TTimerType
-    {
-    EMemSpyDriverTimerTypeUnknown = 0,
-	EMemSpyDriverTimerTypeRelative = 1,
-    EMemSpyDriverTimerTypeAbsolute = 2,
-    EMemSpyDriverTimerTypeLocked = 4,
-    EMemSpyDriverTimerTypeHighRes = 8,
-    EMemSpyDriverTimerTypeInactivity = 16
-    };
-
-
-enum TMemSpyDriverTimerState // Same as TTimer::TTimerState
-    {
-    EMemSpyDriverTimerStateUnknown = -1,
-	EMemSpyDriverTimerStateIdle = 0,
-    EMemSpyDriverTimerStateWaiting,
-    EMemSpyDriverTimerStateWaitHighRes
-    };
-
-enum TMemSpyDriverEventType
-    {
-    EMemSpyDriverEventTypeThreadCreate = 0,
-    EMemSpyDriverEventTypeThreadKill,
-    EMemSpyDriverEventTypeProcessRemove,
-    EMemSpyDriverEventTypeProcessCreate,
-    EMemSpyDriverEventTypeChunkAdd,
-    EMemSpyDriverEventTypeChunkDestroy,
-    };
-
-enum TMemSpyMemoryModelType
-    {
-    EMemSpyMemoryModelTypeUnknown = 0,
-    EMemSpyMemoryModelTypeMoving,
-    EMemSpyMemoryModelTypeMultiple,
-    EMemSpyMemoryModelTypeEmulator
-    };
-
-enum TMemSpyChunkAttributes
-	{
-	EMemSpyChunkAttributesNormal            = 0x00,
-	EMemSpyChunkAttributesDoubleEnded	    = 0x01,
-	EMemSpyChunkAttributesDisconnected	    = 0x02,
-	EMemSpyChunkAttributesConstructed   	= 0x04,
-	EMemSpyChunkAttributesMemoryNotOwned	= 0x08
-	};
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverObjectsShared.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,470 +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 MEMSPYDRIVEROBJECTSSHARED_H
-#define MEMSPYDRIVEROBJECTSSHARED_H
-
-// System includes
-#include <u32std.h>
-
-// User includes
-#include <memspy/driver/memspydriverenumerationsshared.h>
-#include <memspy/driver/memspydriverobjectssharedrheap.h>
-
-// Classes referenced
-class CActiveScheduler;
-class CTrapCleanup;
-
-
-
-/**
- * ARM user registers.
- * Size must be multiple of 4 bytes.
- */
-class TMemSpyDriverRegSet
-	{
-public:
-	enum { KRegCount = 16 };
-	TUint32 iRn[KRegCount];
-	TUint32 iCpsr;
-	};
-
-
-/** 
- * ARM-specific exception-related data.
- * Size must be multiple of 4 bytes.
- */ 
-class TMemSpyDriverCpuExcInfo
-	{
-public:
-	enum TExcCode 
-		{ 
-		EPrefetchAbort=0,
-		EDataAbort=1,
-		EUndefinedOpcode=2,
-		};
-public:
-	TExcCode iExcCode;
-	/** Point to instruction which caused exception */
-	TUint32 iFaultPc;
-	/** 
-     Address which caused exception (System Control Coprocessor Fault
-	 Address Register)
-	*/
-	TUint32 iFaultAddress;
-	/** System Control Coprocessor Fault Status Register */
-	TUint32 iFaultStatus;
-	/** R13 supervisor mode banked register */
-	TUint32 iR13Svc;
-	/** R14 supervisor mode banked register */
-	TUint32 iR14Svc;
-	/** SPSR supervisor mode banked register */
-	TUint32 iSpsrSvc;
-	};
-
-
-
-
-
-/**
- * Stack water mark parameters
- */
-struct TMemSpyDriverStackWatermarkParams
-    {
-    TUint8* iStackDataAddress;
-    TInt iStackDataLength;
-    TRequestStatus* iStatus;
-    TLinAddr iUserStackPointer;
-    };
-
-
-
-
-/**
- * Stack information block.
- */
-class TMemSpyDriverStackInfo
-	{
-public:
-    TUint iUserStackPointer;
-	TUint32 iUserStackBase;
-	TInt iUserStackSize;
-    TUint32 iUserStackHighWatermark;
-    //
-    TUint iSupervisorStackPointer;
-	TUint32 iSupervisorStackBase;
-	TInt iSupervisorStackSize;
-    TUint32 iSupervisorStackHighWatermark;
-	};
-
-
-/**
- * Basic thread information block
- */
-class TMemSpyDriverThreadInfoBase
-	{
-public:
-    // Registers
-    TMemSpyDriverRegSet iCpu;
-    
-    // Stack
-    TMemSpyDriverStackInfo iStackInfo;
-    
-    // User thread framework
-	RAllocator* iAllocator;
-    CActiveScheduler* iScheduler;
-	};
-
-
-/**
- * Thread information block.
- */
-class TMemSpyDriverThreadInfo : public TMemSpyDriverThreadInfoBase
-	{
-public:
-	TFullName iFullName;
- 
-    // Basic properties
-	TUint iPid;
-    TThreadPriority iThreadPriority;
-
-    // Exit information
-	TInt iExitReason;
-    TExitType iExitType;
-    TExitCategoryName iExitCategory;
-	};
-
-
-/**
- * Process information block.
- */
-class TMemSpyDriverProcessInfo
-    {
-public:
-    inline TUint32 SID() const { return iSecurityInfo.iSecureId; }
-    inline TUint32 VID() const { return iSecurityInfo.iVendorId; }
-
-public:
-    TUidType iUids;
-    TUint32 iFlags;
-    TInt iGeneration;
-    TInt iPriority;
-    SSecurityInfo iSecurityInfo;
-    };
-
-
-/** 
- * Code Segment Information Block 
- */
-class TMemSpyDriverCodeSegInfo
-	{
-public:
-    inline TMemSpyDriverCodeSegInfo()
-        : iSize( 0 )
-        {
-        }
-
-public:
-    TUint32 iSize;
-    TCodeSegCreateInfo iCreateInfo;
-    TProcessMemoryInfo iMemoryInfo;
-	};
-
-
-
-
-
-/**
- * Generic object related
- */
-class TMemSpyDriverHandleInfoGeneric
-    {
-public: // Supported for all types
-	TBuf8<KMaxName> iName; // FullName
-    TAny* iHandle;
-    TMemSpyDriverContainerType iType;
-
-public: // Type-specific members
-
-    // For Process, thread, chunk (owning process id), server (owning thread id)
-    TInt iId;
-
-    // For Chunk, Library
-    TUint32 iSize;
-   
-    // For Semaphore, Mutex, Server
-    TInt iCount;
-
-    // For Mutex
-    TInt iWaitCount;
-
-    // For Server, Session
-    TIpcSessionType iSessionType;
-
-    // For Timer
-    TMemSpyDriverTimerType iTimerType;
-    TMemSpyDriverTimerState iTimerState;
-
-    // For Logical channel
-    TInt iOpenChannels;
-    
-    // For most of the object types
-	TBuf8<KMaxName> iNameDetail; // Name
-    TInt iAccessCount;
-    TInt iUniqueID;
-    TUint iProtection;
-    TUint8* iAddressOfKernelOwner;
-    TInt iPriority;
-    TUint8* iAddressOfOwningProcess;
-    TUint iCreatorId;
-    TUint iSecurityZone;
-    TInt iAttributes;
-    TUint8* iAddressOfDataBssStackChunk;
-
-    // For Server, Session
-    TUint8* iAddressOfOwningThread;
-    TUint8* iAddressOfServer;
-    TUint16 iTotalAccessCount;
-    TUint8 iSvrSessionType;
-    TInt iMsgCount;
-    TInt iMsgLimit;
-    
-    // For chunk
-    TInt iMaxSize;
-    TInt iBottom;
-    TInt iTop;
-    TInt iStartPos;
-    TUint iControllingOwner;
-    TUint iRestrictions;
-    TUint iMapAttr;
-    TUint iChunkType;
-    TBuf8<KMaxName> iNameOfOwner; // chunk, server
-    
-    // For library
-    TInt iMapCount;
-    TUint8 iState;
-    TUint8* iAddressOfCodeSeg;
-    
-    // Semaphore, mutex, condvar
-    TUint8 iResetting;
-    TUint8 iOrder;
-    
-    // For Logical/Physical device
-    TVersion iVersion;
-    TUint iParseMask;
-    TUint iUnitsMask;
-    
-    // For change notifier
-    TUint iChanges;
-    };
-
-
-
-/**
- *
- */
-class TMemSpyDriverServerSessionInfo
-    {
-public: // Enumerations
-    enum TOwnerType
-        {
-        EOwnerNone = -1,
-        EOwnerThread = 0,
-        EOwnerProcess
-        };
-
-public:
-    TInt iOwnerId;
-    TOwnerType iOwnerType;
-    TBuf8<KMaxName> iName;
-    TIpcSessionType iSessionType;
-    TUint8* iAddress;
-    };
-
-
-
-/**
- *
- */
-class TMemSpyDriverProcessInspectionInfo
-    {
-public:
-    inline TMemSpyDriverProcessInspectionInfo()
-        : iProcessId( 0 ),
-          iMemoryHeap( 0 ),
-          iMemoryStack( 0 ),
-          iMemoryGlobalData( 0 ),
-          iMemoryChunkLocal( 0 ),
-          iMemoryChunkShared( 0 )
-        {
-        }
-
-public: // API
-    inline TUint32 TotalIncShared() const
-        {
-        const TUint32 ret = TotalExcShared() + iMemoryChunkShared;
-        return ret;
-        }
-
-    inline TUint32 TotalExcShared() const
-        {
-        const TUint32 ret = iMemoryHeap + iMemoryStack + iMemoryChunkLocal + iMemoryGlobalData;
-        return ret;
-        }
-
-public:
-    TUint32 iProcessId;
-    //
-    TUint32 iMemoryHeap;
-    TUint32 iMemoryStack;
-    TUint32 iMemoryGlobalData;
-    TUint32 iMemoryChunkLocal;
-    TUint32 iMemoryChunkShared;
-    //
-    TInt64 iTime;
-    };
-
-
-
-
-
-
-class TMemSpyHeapInfo
-    {
-public: // Enumerations
-    enum THeapImplementationType
-        {
-        ETypeUnknown = 0,
-        ETypeRHeap = 1,
-		ETypeRHybridHeap = 2,
-        };
-
-public: // Constructor & destructor
-    inline TMemSpyHeapInfo()
-        {
-        }
-
-public: // API
-    inline void SetType( THeapImplementationType aType ) { iType = aType; }
-    inline THeapImplementationType Type() const { return iType; }
-    //
-    inline TMemSpyHeapInfoRHeap& AsRHeap() { return iRHeap; }
-    inline const TMemSpyHeapInfoRHeap& AsRHeap() const { return iRHeap; }
-    //
-    inline void SetTid( TUint32 aId ) { iTid = aId; }
-    inline TUint32 Tid() const { return iTid; }
-    //
-    inline void SetPid( TUint32 aId ) { iPid = aId; }
-    inline TUint32 Pid() const { return iPid; }
-
-private: // Data members
-    THeapImplementationType iType;
-    TMemSpyHeapInfoRHeap iRHeap;
-    TUint32 iPid;
-    TUint32 iTid;
-    };
-
-
-
-
-
-
-/**
- * Chunk info base class
- */
-class TMemSpyDriverChunkInfoWithoutName
-    {
-public:
-    inline TMemSpyDriverChunkInfoWithoutName()
-        : iHandle( NULL ),
-          iBaseAddress( NULL ),
-          iSize( 0 ),
-          iMaxSize( 0 ),
-          iOwnerId( 0 ),
-          iType( EMemSpyDriverChunkTypeUnknown )
-        {
-        }
-
-public:
-    TAny* iHandle;
-	TAny* iBaseAddress;
-	TUint iSize;
-	TUint iMaxSize;
-	TUint iOwnerId;
-    TMemSpyDriverChunkType iType;
-    TInt iAttributes;
-    };
-
-
-/**
- * Chunk info 
- */
-class TMemSpyDriverChunkInfo : public TMemSpyDriverChunkInfoWithoutName
-    {
-public:
-    inline TMemSpyDriverChunkInfo()
-        : TMemSpyDriverChunkInfoWithoutName(),
-          iName( KNullDesC )
-        {
-        }
-
-public:
-	TFullName iName;
-    };
-
-
-/**
- * cell information
- */
-class TMemSpyDriverFreeCell
-	{
-public:
-	TMemSpyDriverCellType iType;
-	TAny* iAddress;
-	TInt iLength;
-	};
-
-// For compatibility I can't change TMemSpyDriverCell to be the class and typdef/derive TMemSpyDriverFreeCell. Sigh...
-typedef TMemSpyDriverFreeCell TMemSpyDriverCell;
-
-
-/** 
- * P&S information
- */
-class TMemSpyDriverPAndSInfo
-    {
-public:
-    RProperty::TType iType;
-    TUint iCategory;
-    TUint iKey;
-    TInt iRefCount;
-    TUint32 iTid;
-    TUint32 iCreatorSID;
-    };
-
-
-/**
- * CondVar suspended thread information
- */
-class TMemSpyDriverCondVarSuspendedThreadInfo
-    {
-public:
-    TBuf8<KMaxName> iName;
-    TUint8* iAddress;
-    };
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverObjectsSharedRHeap.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,327 +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 MEMSPYDRIVEROBJECTSSHAREDRHEAP_H
-#define MEMSPYDRIVEROBJECTSSHAREDRHEAP_H
-
-// System includes
-#include <u32std.h>
-#ifndef __KERNEL_MODE__
-#include <e32debug.h>
-#endif
-
-// User includes
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// Defines
-//#define __CHECK_CHUNK_NAME
-
-// Classes referenced
-class CActiveScheduler;
-class CTrapCleanup;
-
-
-/**
- * Base class for MemSpy RHeap statistics
- */
-class TMemSpyHeapStatisticsRHeapBase
-    {
-public: // Type
-    enum TType
-        {
-        ETypeAllocated = 0,
-        ETypeFree
-        };
-
-public: // Constructors & destructor
-    inline TMemSpyHeapStatisticsRHeapBase( TType aType )
-        : iType( aType ), 
-          iTypeCount( 0 ), 
-          iTypeSize( 0 ),
-          iLargestCellAddress( NULL ),
-          iLargestCellSize( 0 )
-        {
-        }
-
-public: // API
-    inline TType Type() const { return iType; }
-    //
-    inline TUint TypeCount() const { return iTypeCount; }
-    inline void SetTypeCount( TUint aValue ) { iTypeCount = aValue; }
-    //
-    inline TUint TypeSize() const { return iTypeSize; }
-    inline void SetTypeSize( TUint aValue ) { iTypeSize = aValue; }
-    //
-    inline TAny* LargestCellAddress() const { return iLargestCellAddress; }
-    inline void SetLargestCellAddress( TAny* aAddress ) { iLargestCellAddress = aAddress; }
-    //
-    inline TUint LargestCellSize() const { return iLargestCellSize; }
-    inline void SetLargestCellSize( TUint aSize ) { iLargestCellSize = aSize; }
-
-private: // Data members
-    TType iType;
-    TUint iTypeCount;
-    TUint iTypeSize;
-    TAny* iLargestCellAddress;
-    TUint iLargestCellSize;
-    };
-
-
-
-
-
-/**
- * RHeap statistics for Allocated cell types
- */
-class TMemSpyHeapStatisticsRHeapAllocated : public TMemSpyHeapStatisticsRHeapBase
-    {
-public: // Constructors
-    inline TMemSpyHeapStatisticsRHeapAllocated()
-        : TMemSpyHeapStatisticsRHeapBase( TMemSpyHeapStatisticsRHeapBase::ETypeAllocated )
-        {
-        }
-
-public:
-    };
-
-
-
-
-
-
-/**
- * RHeap statistics for Free cell types
- */
-class TMemSpyHeapStatisticsRHeapFree : public TMemSpyHeapStatisticsRHeapBase
-    {
-public: // Constructors
-    inline TMemSpyHeapStatisticsRHeapFree()
-        : TMemSpyHeapStatisticsRHeapBase( TMemSpyHeapStatisticsRHeapBase::ETypeFree ),
-          iSlackSpace( 0 ), iSlackSpaceCellAddress( NULL ), iChecksum( 0 )
-        {
-        }
-
-public: // API
-    inline TUint SlackSpaceCellSize() const { return iSlackSpace; }
-    inline void SetSlackSpaceCellSize( TUint aValue ) { iSlackSpace = aValue; }
-    //
-    inline TAny* SlackSpaceCellAddress() const { return iSlackSpaceCellAddress; }
-    inline void SetSlackSpaceCellAddress( TAny* aAddress ) { iSlackSpaceCellAddress = aAddress; }
-    //
-    inline TUint32 Checksum() const { return iChecksum; }
-    inline void SetChecksum( TUint32 aValue ) { iChecksum = aValue; }
-
-public:
-    TUint iSlackSpace;
-    TAny* iSlackSpaceCellAddress;
-    TUint32 iChecksum;
-    };
-
-/**
- * RHeap statistics class
- */
-class TMemSpyHeapStatisticsRHeap
-    {
-public: // Constructors
-    inline TMemSpyHeapStatisticsRHeap()
-		: iCommittedFreeSpace(0)
-        {
-        }
-
-public: // API
-    inline TMemSpyHeapStatisticsRHeapFree& StatsFree() { return iStatisticsFree; }
-    inline const TMemSpyHeapStatisticsRHeapFree& StatsFree() const { return iStatisticsFree; }
-    //
-    inline TMemSpyHeapStatisticsRHeapAllocated& StatsAllocated() { return iStatisticsAllocated; }
-    inline const TMemSpyHeapStatisticsRHeapAllocated& StatsAllocated() const { return iStatisticsAllocated; }
-
-
-private: // Data members
-    TMemSpyHeapStatisticsRHeapFree iStatisticsFree;
-    TMemSpyHeapStatisticsRHeapAllocated iStatisticsAllocated;
-
-public: // I am fed up of all these pointless inline accessors...
-	TInt iCommittedFreeSpace; // The amount of committed memory that isn't payload data in allocated or free cells
-    };
-
-
-
-
-
-
-
-/**
- *
- */
-class TMemSpyHeapMetaDataRHeap
-    {
-public: // Constructors
-    inline TMemSpyHeapMetaDataRHeap()
-        : iChunkSize( 0 ),
-          iChunkHandle( NULL ),
-          iChunkBaseAddress( NULL ),
-          iDebugAllocator( EFalse ),
-          //iHeaderSizeFree( 0 ),
-          //iHeaderSizeAllocated( 0 ),
-          iIsUserThread( ETrue ),
-		  iVTable(0),
-          iSharedHeap( EFalse ),
-          iHeapSize(0),
-          iAllocatorAddress(NULL),
-		  iMinHeapSize(0),
-		  iMaxHeapSize(0)
-        {
-        }
-
-public: // API
-#ifndef __KERNEL_MODE__
-    inline TPtrC ChunkName() const
-        {
-        TBool alreadyExpanded = ETrue;
-
-#ifdef __CHECK_CHUNK_NAME
-        {
-        RDebug::Printf( "TMemSpyHeapMetaDataRHeap::ChunkName() - BEF - length: %d", iChunkName.Length() );
-        const TUint8* data2 = iChunkName.Ptr();
-        const TInt count = iChunkName.Length();
-        for( TInt i=0;i<count;i++)
-            {
-            RDebug::Printf( "TMemSpyHeapMetaDataRHeap::ChunkName() - BEF - data[%03d] = 0x%08x = %02x (%c)", i, data2, *data2, *data2 );
-            ++data2;
-            }
-        }
-#endif
-
-        // Check if it already has been converted to unicode
-        const TUint8* data = iChunkName.Ptr();
-        if ( iChunkName.Length() >= 1 )
-            {
-            const TUint8 highByte = *(data + 1);
-            alreadyExpanded = ( highByte == 0 ); 
-            }
-
-        // Once expanded, the descriptor is twice the length
-        TPtrC ret( (TUint16*) iChunkName.Ptr(), iChunkName.Length() / 2 );
-        //
-        if ( !alreadyExpanded )
-            {
-            const TInt halfLength = iChunkName.Length() / 2;
-            TMemSpyHeapMetaDataRHeap* self = const_cast< TMemSpyHeapMetaDataRHeap* >( this );
-            ret.Set( self->iChunkName.Expand() );
-            }
-
-#ifdef __CHECK_CHUNK_NAME
-        {
-        RDebug::Printf( "TMemSpyHeapMetaDataRHeap::ChunkName() - AFT - length: %d", iChunkName.Length() );
-        const TUint8* data2 = iChunkName.Ptr();
-        const TInt count = iChunkName.Length();
-        for( TInt i=0;i<count;i++)
-            {
-            RDebug::Printf( "TMemSpyHeapMetaDataRHeap::ChunkName() - AFT - data[%03d] = 0x%08x = %02x (%c)", i, data2, *data2, *data2 );
-            ++data2;
-            }
-        const TPtrC pNextRet( (TUint16*) iChunkName.Ptr(), iChunkName.Length() / 2 );
-        RDebug::Print( _L("TMemSpyHeapMetaDataRHeap::ChunkName() - ret: [%S], nextRet: [%S]"), &ret, &pNextRet );
-        }
-#endif
-        //
-        return ret;
-        }
-
-    inline void SetChunkName( const TDesC16& aValue )
-        {
-        iChunkName.Copy( aValue );
-        iChunkName.Collapse();
-        }
-#else
-    inline void SetChunkName( const TDesC8& aValue )
-        {
-        iChunkName.Copy( aValue );
-        }
-#endif
-    //
-    inline TUint ChunkSize() const { return iChunkSize; }
-    inline void SetChunkSize( TUint aValue ) { iChunkSize = aValue; }
-    //
-    inline TAny* ChunkHandle() const { return iChunkHandle; }
-    inline void SetChunkHandle( TAny* aValue ) { iChunkHandle = aValue; }
-    //
-    inline TAny* ChunkBaseAddress() const { return iChunkBaseAddress; }
-    inline void SetChunkBaseAddress( TAny* aValue ) { iChunkBaseAddress = aValue; }
-    //
-    inline TBool IsDebugAllocator() const { return iDebugAllocator; }
-    inline void SetDebugAllocator( TBool aValue ) { iDebugAllocator = aValue; }
-    //
-    inline TBool IsUserThread() const { return iIsUserThread; }
-    inline void SetUserThread( TBool aValue ) { iIsUserThread = aValue; }
-    //
-    inline TBool IsSharedHeap() const { return iSharedHeap; }
-    inline void SetSharedHeap( TBool aValue ) { iSharedHeap = aValue; }
-    //
-    inline TUint VTable() const { return iVTable; }
-    inline void SetVTable( TUint aValue ) { iVTable = aValue; }
-
-private: // Data members
-    TBuf8< KMaxFullName * 2 > iChunkName;
-public:
-    TUint iChunkSize;
-    TAny* iChunkHandle;
-    TAny* iChunkBaseAddress;
-    TBool iDebugAllocator;
-    TBool iSharedHeap;
-    TBool iIsUserThread;
-    TUint iVTable;
-	TUint iHeapSize; // Committed size - generally the same as iChunkSize (except maybe for kernel heap)
-	TAny* iAllocatorAddress; // replacement for things using the RHeap base address
-	TUint iMinHeapSize; // Minimum committed size
-	TUint iMaxHeapSize; // Max committed size
-    };
-
-
-/**
- *
- */
-class TMemSpyHeapInfoRHeap
-    {
-public: // Constructors
-    inline TMemSpyHeapInfoRHeap()
-        {
-        }
-
-public: // API
-    inline TMemSpyHeapMetaDataRHeap& MetaData() { return iMetaData; }
-    inline const TMemSpyHeapMetaDataRHeap& MetaData() const { return iMetaData; }
-    //
-    //inline TMemSpyHeapObjectDataRHeap& ObjectData() { return iObjectData; }
-    //inline const TMemSpyHeapObjectDataRHeap& ObjectData() const { return iObjectData; }
-    //
-    inline TMemSpyHeapStatisticsRHeap& Statistics() { return iStatistics; }
-    inline const TMemSpyHeapStatisticsRHeap& Statistics() const { return iStatistics; }
-
-	inline TInt Overhead() const { return iMetaData.iHeapSize - iStatistics.StatsAllocated().TypeSize() - iStatistics.iCommittedFreeSpace; }
-
-private: // Data members
-    TMemSpyHeapMetaDataRHeap iMetaData;
-    //TMemSpyHeapObjectDataRHeap iObjectData;
-    TMemSpyHeapStatisticsRHeap iStatistics;
-    };
-
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverClient.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,401 +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 MEMSPYDRIVERCLIENT_H
-#define MEMSPYDRIVERCLIENT_H
-
-// System includes
-#include <e32base.h>
-#include <e32std.h>
-#include <e32const.h>
-
-// User includes
-#include <memspy/driver/memspydriverstreamreader.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-
-class RMemSpyDriverClient : public RBusLogicalChannel
-	{
-public: // GENERAL API
-
-    /**
-     *
-     */
-	IMPORT_C TInt Open();
-
-    /**
-     *
-     */
-	IMPORT_C void Close();
-
-    /**
-     *
-     */
-    IMPORT_C void GetVersion( TVersion& aVersion );
-
-
-public: // RAW MEMORY
-
-    /**
-     *
-     */
-	IMPORT_C TInt ReadMemory( TUint aTid, TLinAddr aSrc, TDes8& aDest );
-
-
-public: // CODE SEGS
-
-    /**
-     *
-     */
-	IMPORT_C TInt GetCodeSegs( TAny** aHandleArray, TInt& aHandleCount, TBool aOnlyRamLoaded = EFalse );
-
-    /**
-     *
-     */
-	IMPORT_C TInt GetCodeSegs( TUint aPid, TAny** aHandleArray, TInt& aHandleCount );
-
-    /**
-     *
-     */
-	IMPORT_C TInt GetCodeSegInfo( TAny* aHandle, TUint aPid, TMemSpyDriverCodeSegInfo& aInfo );
-
-
-public: // CHUNKS
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetChunkHandles( TAny** aHandleArray, TInt& aHandleCount );
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetChunkInfo( TAny* aHandle, TMemSpyDriverChunkInfo& aInfo );
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetChunkInfo( TAny* aHandle, TMemSpyDriverChunkInfoWithoutName& aInfo );
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetChunkHandlesForProcess( TUint aPid, TAny** aHandleArray, TInt& aHandleCount );
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetChunkHandlesForThread( TUint aTid, TAny** aHandleArray, TInt& aHandleCount );
-
-
-public: // THREAD & PROCESS 
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetThreadInfo( TUint aTid, TMemSpyDriverThreadInfo& aInfo );
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetProcessInfo( TUint aPid, TMemSpyDriverProcessInfo& aInfo );
-
-    /**
-     *
-     */
-    IMPORT_C TInt ProcessThreadsSuspend( TUint aPid );
-
-    /**
-     *
-     */
-    IMPORT_C TInt ProcessThreadsResume( TUint aPid );
-
-    /**
-     *
-     */
-    IMPORT_C TInt ThreadEnd( TUint aTid, TExitType aType );
-
-    /**
-     *
-     */
-    IMPORT_C TInt OpenThread( TUint aId, RThread& aThread );
-
-    /**
-     *
-     */
-    IMPORT_C TInt OpenProcess( TUint aId, RProcess& aProcess );
-
-    /**
-     *
-     */
-    IMPORT_C void GetThreadsL( const TProcessId& aId, RArray<TThreadId>& aThreads );
-
-    /**
-     *
-     */
-    IMPORT_C TInt SetPriority( TUint aId, TThreadPriority aPriority );
-
-public: // HEAP INFO
-
-    /**
-     *
-     */
-    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 GetHeapInfoKernel( TMemSpyHeapInfo& aInfo );
-    IMPORT_C TInt GetHeapInfoKernel( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>& aFreeCells );
-
-public: // HEAP DATA
-
-    /**
-     * Get free cell data. If aFreeCellChecksum is 0, then no checksum comparison is performed.
-     */
-    IMPORT_C TInt GetHeapData( TUint aTid, TUint32 aFreeCellChecksum, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining );
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetHeapDataNext( TUint aTid, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining );
-
-    /**
-     *
-     */
-    IMPORT_C HBufC8* GetHeapDataKernelLC( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>& aFreeCells );
-
-
-public: // HEAP WALK
-
-    /**
-     *
-     */
-    IMPORT_C TInt WalkHeapInit( TUint aTid );
-
-    /**
-     *
-     */
-    IMPORT_C TInt WalkHeapNextCell( TUint aTid, TMemSpyDriverCellType& aCellType, TAny*& aCellAddress, TInt& aLength, TInt& aNestingLevel, TInt& aAllocNumber, TInt& aCellheaderSize, TAny*& aCellPayloadAddress );
-
-    /**
-     *
-     */
-    IMPORT_C TInt WalkHeapReadCellData( TAny* aCellAddress, TDes8& aDest, TInt aReadLen );
-
-    /**
-     *
-     */
-    IMPORT_C TInt WalkHeapGetCellInfo( TAny*& aCellAddress, TMemSpyDriverCellType& aCellType, TInt& aLength, TInt& aNestingLevel, TInt& aAllocNumber, TInt& aCellheaderSize, TAny*& aCellPayloadAddress );
-
-    /**
-     *
-     */
-    IMPORT_C void WalkHeapClose();
-
-
-public: // STACK RELATED
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetStackInfo( TUint aTid, TMemSpyDriverStackInfo& aInfo );
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetStackData( TUint aTid, TDes8& aDest, TUint& aAmountRemaining, TMemSpyDriverDomainType aDomain = EMemSpyDriverDomainUser, TBool aEntireStack = ETrue );
-
-    /**
-     *
-     */
-    IMPORT_C TInt GetStackDataNext( TUint aTid, TDes8& aDest, TUint& aAmountRemaining, TMemSpyDriverDomainType aDomain = EMemSpyDriverDomainUser, TBool aEntireStack = ETrue );
-
-
-public: // EVENT MONITOR
-
-    /**
-     * @returns TInt handle
-     */
-    IMPORT_C TInt EventMonitorOpen( TUint& aHandle );
-
-    /**
-     *
-     */
-    IMPORT_C TInt EventMonitorClose( TUint aHandle );
-
-    /**
-     *
-     */
-    IMPORT_C void EventMonitorNotify( TUint aHandle, TRequestStatus& aStatus, TUint& aContext );
-
-    /**
-     *
-     */
-    IMPORT_C void EventMonitorNotifyCancel( TUint aHandle );
-
-
-public: // PROCESS INSPECTION
-
-    /**
-     *
-     */
-    IMPORT_C TInt ProcessInspectionOpen( TUint aPid );
-
-    /**
-     *
-     */
-    IMPORT_C TInt ProcessInspectionClose( TUint aPid );
-
-    /**
-     *
-     */
-    IMPORT_C void ProcessInspectionRequestChanges( TUint aPid, TRequestStatus& aStatus, TMemSpyDriverProcessInspectionInfo& aInfo );
-
-    /**
-     *
-     */
-    IMPORT_C void ProcessInspectionRequestChangesCancel( TUint aPid );
-
-    /**
-     *
-     */
-    IMPORT_C void ProcessInspectionAutoStartItemsReset();
-
-    /**
-     *
-     */
-    IMPORT_C TInt ProcessInspectionAutoStartItemsAdd( TUint aSID );
-
-
-public: // Handles related
-
-    /**
-     * Get all of the handles in a specific container
-     */
-	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 );
-
-    /**
-     * Get all handles of a specific type, for a specific process. 
-     */
-	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
-     * use KMemSpyDriverEnumerateContainerHandles as the aTid parameter.
-     */
-    IMPORT_C TInt GetGenericHandleInfo( TInt aTid, TMemSpyDriverContainerType aType, TAny* aHandle, TMemSpyDriverHandleInfoGeneric& aParams );
-
-    /**
-     * Fetches the in-memory size of a specific kernel object (where possible). The size is an approximation since
-     * it doesn't take into account the size of ASSP-specific classes.
-     */
-    IMPORT_C TInt GetApproximateKernelObjectSize( TMemSpyDriverContainerType aType );
-
-    /**
-     * Use this method to identify the handles of threads & processes that happen to reference
-     * the specified thread or process.
-     *
-     * In brief, every kernel-side thread and process object contains a handle container. This container
-     * is the DObject-handles which the thread or process has open.
-     *
-     * This method can be used to search all of the other handle containers within other threads & processes
-     * 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 );
-
-    /**
-     * Get info about a P&S kernel object
-     */
-    IMPORT_C TInt GetPAndSInfo( TAny* aHandle, TMemSpyDriverPAndSInfo& aInfo );
-
-    /**
-     * Get handles to suspended threads from a CondVar
-     */
-    IMPORT_C TInt GetCondVarSuspendedThreads( TAny* aCondVarHandle, TAny** aThreadHandleArray, TInt& aThreadCount );
-
-    /**
-     * Get info about CondVar suspended thread
-     */
-    IMPORT_C TInt GetCondVarSuspendedThreadInfo( TAny* aHandle, TMemSpyDriverCondVarSuspendedThreadInfo& aInfo );
-    
-public: // CLIENT <-> SERVER
-
-    /**
-     * Gets handles of all sessions that are connected to a particular server
-     */
-	IMPORT_C TInt GetServerSessionHandles( TAny* aServerHandle, TAny** aSessionHandleArray, TInt& aSessionHandleCount );
-
-    /**
-     * Gets session information for a given session handle.
-     */
-    IMPORT_C TInt GetServerSessionInfo( TAny* aSessionHandle, TMemSpyDriverServerSessionInfo& aParams );
-
-
-public: // STREAM INTERFACE
-
-    /**
-     * Opens a MemSpy data stream for reading
-     */
-    IMPORT_C RMemSpyMemStreamReader StreamOpenL();
-
-public: // MISC
-
-    /**
-     *
-     */
-    IMPORT_C TMemSpyMemoryModelType MemoryModelType();
-
-    /**
-     *
-     */
-    IMPORT_C TBool IsDebugKernel();
-
-    /**
-     * Round value to a multiple of the current page size
-     *
-     */
-    IMPORT_C TUint32 RoundToPageSize( TUint32 aValue );
-
-    /**
-     *
-     */
-    IMPORT_C TInt Impersonate( TUint32 aValue );
-
-private: // Internal methods
-    static TUint RHeapVTable();
-    static TBool DebugEUser();
-    void ResetStreamBuffer();
-    void ReadHeapInfoFreeCellsFromXferBufferL( RArray<TMemSpyDriverFreeCell>& aFreeCells );
-
-private: // Data members
-    RBuf8 iBuffer;
-	};
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverLightweightClient.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +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 MEMSPYDRIVERLIGHTWEIGHTCLIENT_H
-#define MEMSPYDRIVERLIGHTWEIGHTCLIENT_H
-
-// System includes
-#include <e32std.h>
-
-// Structs etc
-_LIT(KMemSpyDriverDeviceName, "MEMSPYDRIVER");
-inline TVersion KMemSpyDriverVersion() { return TVersion(1, 0, 0); }
-
-enum TMemSpyDriverOpCode
-	{
-	EMemSpyDriverGetCodeSegsForProcess = 3,
-	EMemSpyDriverGetCodeSegInfo = 4
-    };
-
-struct TMemSpyDriverInternalCodeSnapshotParams
-	{
-	TUint iPid;
-	TAny** iHandles;
-	TInt* iCountPtr;
-	};
-class TMemSpyDriverCodeSegInfo
-	{
-public:
-    TCodeSegCreateInfo iCreateInfo;
-    TProcessMemoryInfo iMemoryInfo;
-	};
-struct TMemSpyDriverInternalCodeSegParams
-	{
-	TUint iPid;
-	TAny* iHandle;
-	TMemSpyDriverCodeSegInfo* iInfoPointer;
-	};
-
-
-class RMemSpyDriverLightweightClient : public RBusLogicalChannel
-	{
-public:
-
-	inline TInt Open()
-        {
-        TInt err = User::LoadLogicalDevice( KMemSpyDriverDeviceName );
-        //
-	    if  ( err == KErrNone || err == KErrAlreadyExists )
-		    {
-		    err = DoCreate( KMemSpyDriverDeviceName, KMemSpyDriverVersion(), KNullUnit, NULL, NULL, EOwnerThread );
-		    }
-        //
-	    return err;
-        }
-
-	inline TInt GetCodeSegs( TUint aPid, TAny** aHandleArray, TInt& aHandleCount )
-        {
-	    TMemSpyDriverInternalCodeSnapshotParams params;
-	    params.iPid = aPid;
-	    params.iHandles = aHandleArray;
-	    params.iCountPtr = &aHandleCount;
-	    return DoControl( EMemSpyDriverGetCodeSegsForProcess, &params, NULL );
-        }
-
-	inline TInt GetCodeSegInfo( TAny* aHandle, TUint aPid, TMemSpyDriverCodeSegInfo& aInfo )
-        {
-	    TMemSpyDriverInternalCodeSegParams params;
-	    params.iPid = aPid;
-	    params.iHandle = aHandle;
-	    params.iInfoPointer = &aInfo;
-        //
-	    const TInt r = DoControl( EMemSpyDriverGetCodeSegInfo, &params, NULL );
-	    return r;
-        }
-    };
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverStreamReader.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +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 MEMSPYDRIVERSTREAMREADER_H
-#define MEMSPYDRIVERSTREAMREADER_H
-
-// System includes
-#include <e32base.h>
-
-// Classes referenced
-class CMemSpyMemStreamReader;
-
-
-class RMemSpyMemStreamReader
-    {
-friend class RMemSpyDriverClient;
-
-public:
-    IMPORT_C void Close();
-
-private:
-    RMemSpyMemStreamReader( CMemSpyMemStreamReader* aImp );
-
-public: // API
-    IMPORT_C TInt32 ReadInt32L();
-    IMPORT_C TUint32 ReadUint32L();
-    IMPORT_C void ReadL( TDes8& aDes );
-    IMPORT_C void ReadL( TDes16& aDes );
-
-private:
-    CMemSpyMemStreamReader* iImp;
-    };
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/DeviceWideOps/MemSpyDeviceWideOperations.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +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 MEMSPYDEVICEWIDEOPERATIONS_H
-#define MEMSPYDEVICEWIDEOPERATIONS_H
-
-// System includes
-#include <e32base.h>
-
-// Classes referenced
-class CMemSpyEngine;
-
-class MMemSpyDeviceWideOperationsObserver
-    {
-public: // Enumerations
-    enum TEvent
-        {
-        // Indicates we've worked out how much work is required
-        EOperationSized = 0,
-
-        // Indicates that we are starting the requested operation
-        EOperationStarting,
-
-        // Indicates some work has been done
-        EOperationProgressStart,
-        EOperationProgressEnd,
-
-        // Indicates that the cancellation request has been acknowledged
-        EOperationCancelled,
-
-        // Indicates that we are entering the completion phase
-        EOperationCompleting,
-
-        // Indicates that the operation is complete and this object can be destroyed now
-        EOperationCompleted
-        };
-
-public: // From MMemSpyDeviceWideOperationsObserver
-    virtual void HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 ) = 0;
-    };
-
-
-NONSHARABLE_CLASS( CMemSpyDeviceWideOperations ) : public CActive
-    {
-public:
-    enum TOperation
-        {
-        // Brief overview of user thread
-        EPerEntityGeneralSummary = 0,
-
-        // Detailed information about user thread
-        EPerEntityGeneralDetailed,
-
-        // Thread handles for user thread (dumps thread info container)
-        EPerEntityGeneralHandles,
-        
-        // Heap information for user or kernel thread
-        EPerEntityHeapInfo,
-
-        // Compact heap information for entire device (kernel & user threads)
-        EEntireDeviceHeapInfoCompact,
-
-        // Heap cell listings for specific user thread
-        EPerEntityHeapCellListing,
-        
-        // Heap data for kernel or user threads
-        EPerEntityHeapData,
-        
-        // Summary stack info
-        EPerEntityStackInfo,
-
-        // Compact stack information for the entire device (user threads only)
-        EEntireDeviceStackInfoCompact,
-        
-        // User-side stack for user thread
-        EPerEntityStackDataUser,
-
-        // Supervisor-side stack for user thread
-        EPerEntityStackDataKernel,
-        };
-
-public:
-    IMPORT_C static CMemSpyDeviceWideOperations* NewL( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationsObserver& aObserver, TOperation aOperation );
-    IMPORT_C ~CMemSpyDeviceWideOperations();
-
-private:
-    CMemSpyDeviceWideOperations( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationsObserver& aObserver, TOperation aOperation );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void Cancel();
-    IMPORT_C TInt TotalOperationSize() const;
-
-private: // From CActive
-    void RunL();
-    void DoCancel();
-    TInt RunError(TInt aError);
-
-private: // Internal methods
-    void CompleteSelf( TInt aError );
-    void PerformNextStepL();
-    void PerformFinalOperationL();
-    void SetFinished();
-    TInt TotalNumberOfThreads() const;
-
-private: // Member data
-    CMemSpyEngine& iEngine;
-    MMemSpyDeviceWideOperationsObserver& iObserver;
-    TOperation iOperation;
-    TInt iProcessIndex;
-    TInt iThreadIndex;
-    TBool iOperationCancelled;
-    TInt iTotalOperationSize;
-    };
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/EventHandlers/MemSpyEngineMidwife.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +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 MEMSPYENGINEMIDWIFE_H
-#define MEMSPYENGINEMIDWIFE_H
-
-// System includes
-#include <e32base.h>
-
-// Classes referenced
-class RMemSpyDriverClient;
-
-
-class MMemSpyEngineMidwifeObserver
-	{
-public: // From MMemSpyEngineMidwifeObserver
-	virtual void ThreadIsBornL( const TThreadId& aId, const RThread& aThread ) = 0;
-	virtual void ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess ) = 0;
-	};
-
-
-NONSHARABLE_CLASS( CMemSpyEngineMidwife ) : public CActive
-    {
-public:
-	static CMemSpyEngineMidwife* NewL( RMemSpyDriverClient& aDriver, TInt aPriority = CActive::EPriorityStandard );
-	~CMemSpyEngineMidwife();
-
-private:
-	CMemSpyEngineMidwife( RMemSpyDriverClient& aDriver, TInt aPriority );
-	void ConstructL();
-
-public: // API
-    void AddObserverL( MMemSpyEngineMidwifeObserver& aObserver );
-    void RemoveObserver( MMemSpyEngineMidwifeObserver& aObserver );
-
-private: // From CActive
-	void RunL();
-	void DoCancel();
-
-private: // Internal methods
-    void Request();
-    void NotifyProcessBornL( const TProcessId& aId );
-    void NotifyThreadBornL( const TThreadId& aId );
-
-private: // Data members
-    TUint iId;
-    RMemSpyDriverClient& iDriver;
-    TUint iEventMonitorHandle;
-	RPointerArray< MMemSpyEngineMidwifeObserver > iObservers;
-    };
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/EventHandlers/MemSpyEngineUndertaker.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +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 MEMSPYENGINEUNDERTAKER_H
-#define MEMSPYENGINEUNDERTAKER_H
-
-// System includes
-#include <e32base.h>
-
-// Classes referenced
-class RMemSpyDriverClient;
-
-
-class MMemSpyEngineUndertakerObserver
-	{
-public: // From MMemSpyEngineUndertakerObserver
-	virtual void ThreadIsDeadL( const TThreadId& aId, const RThread& aThread ) = 0;         // aThread may not be initialised
-	virtual void ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess ) = 0;     // aProcess may not be initialised
-	};
-
-
-NONSHARABLE_CLASS( CMemSpyEngineUndertaker ) : public CActive
-    {
-public:
-	static CMemSpyEngineUndertaker* NewL( RMemSpyDriverClient& aDriver, TInt aPriority = CActive::EPriorityStandard );
-	~CMemSpyEngineUndertaker();
-
-private:
-	CMemSpyEngineUndertaker( RMemSpyDriverClient& aDriver, TInt aPriority );
-	void ConstructL();
-
-public: // API
-    void AddObserverL( MMemSpyEngineUndertakerObserver& aObserver );
-    void RemoveObserver( MMemSpyEngineUndertakerObserver& aObserver );
-
-private: // From CActive
-	void RunL();
-	void DoCancel();
-
-private: // Internal methods
-    void Request();
-    void NotifyProcessDeadL( const TProcessId& aId );
-    void NotifyThreadDeadL( const TThreadId& aId );
-
-private: // Data members
-    TUint iId;
-    TUint iEventMonitorHandle;
-    RMemSpyDriverClient& iDriver;
-	RPointerArray< MMemSpyEngineUndertakerObserver > iObservers;
-    };
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperActiveObject.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +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 MEMSPYENGINEHELPERACTIVEOBJECT_H
-#define MEMSPYENGINEHELPERACTIVEOBJECT_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include <memspy/engine/memspyengineobject.h>
-
-// Classes referenced
-class CMemSpyThread;
-class CMemSpyEngine;
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineActiveObject ) : public CDesCArrayFlat
-    {
-public:
-	enum TRequestStatusFlags
-		{
-		EActive				= 1,  //bit0
-		ERequestPending		= 2,  //bit1
-		};
-
-public: // Construct / destruct
-    static CMemSpyEngineActiveObject* NewLC( TAny* aAddress, TAny* aVTable, TInt aPriority, TInt aRSValue, TUint aRSFlags, TAny* aNextAOAddress, TAny* aPrevAOAddress, CMemSpyEngine& aEngine );
-    IMPORT_C ~CMemSpyEngineActiveObject();
-    
-private: // Internal construct
-    CMemSpyEngineActiveObject( TAny* aAddress, TAny* aVTable, TInt aPriority, TInt aRSValue, TUint aRSFlags, TAny* aNextAOAddress, TAny* aPrevAOAddress );
-    void ConstructL( CMemSpyEngine& aEngine );
-    
-public:
-    inline TAny* Address() const { return iAddress; }
-    inline TAny* VTable() const { return iVTable; }
-    inline TAny* NextAOAddress() const { return iNextAOAddress; }
-    inline TAny* PrevAOAddress() const { return iPrevAOAddress; }
-    inline TInt RequestStatusValue() const { return iRequestStatusValue; }
-    inline TUint RequestStatusFlags() const { return iRequestStatusFlags; }
-    inline const TDesC& Caption() const { return *iCaption; }
-    inline TInt Priority() const { return iPriority; }
-    IMPORT_C TBool IsActive() const;
-    IMPORT_C TBool IsAddedToScheduler() const;
-    IMPORT_C TBool RequestIsPending() const;
-    IMPORT_C void OutputDataL( CMemSpyEngine& aEngine ) const;
-
-public: // But not exported
-    void SetPriority( TInt aPriority );
-    void SetVTable( TAny* aVTable );
-    void SetRequestStatusValues( TInt aStatus, TUint aFlags );
-
-private: // Internal methods
-    static TPtrC YesNoValue( TBool aValue );
-
-private: // Data members
-    TAny* iAddress;
-    TAny* iVTable;
-    TInt iPriority;
-    TInt iRequestStatusValue;
-    TUint iRequestStatusFlags;
-    TAny* iNextAOAddress;
-    TAny* iPrevAOAddress;
-    //
-    HBufC* iCaption;
-    };
-
-
-
-// CActive
-
-NONSHARABLE_CLASS( CMemSpyEngineActiveObjectArray ) : public CBase, public MDesCArray
-    {
-public: // Construct/destruct
-    static CMemSpyEngineActiveObjectArray* NewLC();
-    IMPORT_C ~CMemSpyEngineActiveObjectArray();
-
-private: // Internal construction
-    CMemSpyEngineActiveObjectArray();
-    void ConstructL();
-
-public: // API
-    IMPORT_C TInt Count() const;
-    IMPORT_C CMemSpyEngineActiveObject& At( TInt aIndex );
-    IMPORT_C const CMemSpyEngineActiveObject& At( TInt aIndex ) const;
-    IMPORT_C CMemSpyEngineActiveObject& ObjectByAddressL( TAny* aAddress );
-    IMPORT_C TInt ObjectIndexByAddress( TAny* aAddress ) const;
-    IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine );
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-public: // But not exported
-    void AddItemL( CMemSpyEngineActiveObject* aItem );
-    void InsertL( CMemSpyEngineActiveObject* aItem, TInt aIndex );
-
-private: // Internal methods
-    void BuildHeaderCaptionL();
-
-private: // Data members
-    HBufC* iHeader;
-    RPointerArray< CMemSpyEngineActiveObject > iObjects;
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperActiveObject ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperActiveObject* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperActiveObject();
-
-private:
-    CMemSpyEngineHelperActiveObject( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C CMemSpyEngineActiveObjectArray* ActiveObjectListL( const CMemSpyThread& aThread );
-
-private: // Internal methods
-    HBufC8* SchedulerHeapCellDataLC( TAny*& aCellAddress, TThreadId aThreadId );
-    void ExtractActiveObjectAddressesL( TAny* aSchedulerCellAddress, const TDesC8& aSchedulerCellData, CMemSpyEngineActiveObjectArray& aArray );
-    TAny* ReadActiveObjectDataL( TAny* aCellAddress, CMemSpyEngineActiveObjectArray& aArray );
-    static void CleanupHeapWalk( TAny* aSelf );
-    TAny* ConvertAddressToRealHeapCellAddressL( TAny* aAddress );
-
-private:
-    CMemSpyEngine& iEngine;
-    TMemSpyHeapInfo iHeapInfo;
-    };
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperChunk.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +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 MEMSPYENGINEHELPERCHUNK_H
-#define MEMSPYENGINEHELPERCHUNK_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// Classes referenced
-class CMemSpyThread;
-class CMemSpyProcess;
-class CMemSpyEngine;
-class CMemSpyEngineChunkEntry;
-class CMemSpyEngineChunkList;
-class CMemSpyEngineOutputList;
-class TMemSpyDriverChunkInfo;
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperChunk ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperChunk* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperChunk();
-
-private:
-    CMemSpyEngineHelperChunk( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void OutputChunkInfoForThreadL( const CMemSpyThread& aThread );
-    IMPORT_C void OutputChunkInfoForThreadL( TThreadId aTid );
-    IMPORT_C void OutputChunkInfoForThreadL( TThreadId aTid, TDes& aLine );
-    //
-    IMPORT_C void OutputChunkInfoForProcessL( const CMemSpyProcess& aProcess );
-    IMPORT_C void OutputChunkInfoForProcessL( TProcessId aPid );
-    IMPORT_C void OutputChunkInfoForProcessL( TProcessId aPid, TDes& aLine );
-    //
-    IMPORT_C CMemSpyEngineChunkList* ListL();
-    IMPORT_C CMemSpyEngineChunkList* ListForThreadL( TThreadId aTid );
-    IMPORT_C CMemSpyEngineChunkList* ListForProcessL( TProcessId aPid );
-
-public:
-    inline CMemSpyEngine& Engine() const { return iEngine; }
-
-private: // Internal enumerations
-    enum TType
-        {
-        EThread = 0,
-        EProcess,
-        EAll
-        };
-
-private: // Internal methods
-    void DoOutputChunkInfoForObjectL( TUint aId, TDes& aLineBuffer, TType aType );
-    void GetChunkHandlesL( RArray<TAny*>& aHandles, TType aType, TUint aId = 0 );
-    CMemSpyEngineChunkList* CreateListFromHandlesL( const RArray<TAny*>& aHandles );
-
-private:
-    CMemSpyEngine& iEngine;
-    };
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineChunkList ) : public CBase, public MDesCArray
-    {
-public:
-    static CMemSpyEngineChunkList* NewLC( CMemSpyEngine& aEngine );
-    IMPORT_C ~CMemSpyEngineChunkList();
-
-private:
-    CMemSpyEngineChunkList( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C TInt Count() const;
-    IMPORT_C CMemSpyEngineChunkEntry& At( TInt aIndex );
-    IMPORT_C TInt ItemIndex( const CMemSpyEngineChunkEntry& aEntry ) const;
-    IMPORT_C TBool EntryExists( TAny* aHandle ) const;
-    IMPORT_C const CMemSpyEngineChunkEntry& At( TInt aIndex ) const;
-    IMPORT_C void SortByNameL();
-    IMPORT_C void SortBySizeL();
-    IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine );
-
-public: // But not exported
-    void AddItemL( CMemSpyEngineChunkEntry* aItem );
-    void Remove( TInt aIndex );
-    void RemoveByHandle( TAny* aChunkHandle );
-    TInt ItemIndexByProcessId( TUint aPid ) const;
-    TInt ItemIndexByProcessId( TUint aPid, TInt aStartIndex ) const;
-    TInt ItemIndexByProcessId( TUint aPid, TMemSpyDriverChunkType aType ) const;
-    TInt ItemIndexByChunkHandle( TAny* aHandle ) const;
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-private: // Internal methods
-    static TInt CompareByName( const CMemSpyEngineChunkEntry& aLeft, const CMemSpyEngineChunkEntry& aRight );
-    static TInt CompareBySize( const CMemSpyEngineChunkEntry& aLeft, const CMemSpyEngineChunkEntry& aRight );
-
-private: // Data members
-    CMemSpyEngine& iEngine;
-    RPointerArray<CMemSpyEngineChunkEntry> iItems;
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineChunkEntry ) : public CBase, public MDesCArray
-    {
-public: // Enumerations - see DChunk::TChunkAttributes
-    enum TChunkAttributes
-        {
-		ENormal			=0x00,
-		EDoubleEnded	=0x01,
-		EDisconnected	=0x02,
-		EConstructed	=0x04,
-		EMemoryNotOwned	=0x08
-        };
-
-    public:
-    static CMemSpyEngineChunkEntry* NewLC( CMemSpyEngine& aEngine, const TMemSpyDriverChunkInfo& aInfo );
-    ~CMemSpyEngineChunkEntry();
-
-private:
-    CMemSpyEngineChunkEntry( CMemSpyEngine& aEngine );
-    void ConstructL( const TMemSpyDriverChunkInfo& aInfo );
-
-public: // API
-    inline const TDesC& Caption() const { return *iCaption; }
-
-public: // API - chunk info
-    const TDesC& Name() const;
-    TAny* Handle() const;
-    TInt Size() const;
-    TInt MaxSize() const;
-    TAny* BaseAddress() const;
-    TAny* UpperAddress() const;
-    TUint OwnerId() const;
-
-public: // API
-    IMPORT_C void OwnerName( TDes& aDes ) const;
-    IMPORT_C void AppendOwnerName( TDes& aDes ) const;
-    IMPORT_C void OutputDataL( CMemSpyEngineHelperChunk& aHelper ) const;
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-public: // But not exported
-    TMemSpyDriverChunkInfo& Info();    
-    const TMemSpyDriverChunkInfo& Info() const;    
-
-private: // Member data
-    CMemSpyEngine& iEngine;
-    TMemSpyDriverChunkInfo* iInfo;
-    HBufC* iCaption;
-    CMemSpyEngineOutputList* iList;
-    };
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperCodeSegment.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +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 MEMSPYENGINEHELPERCODESEGMENT_H
-#define MEMSPYENGINEHELPERCODESEGMENT_H
-
-// System includes
-#include <e32base.h>
-#include <e32svr.h>
-#include <badesca.h>
-
-// User includes
-#include <memspy/engine/memspyenginetwiddlableitemarray.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyEngineCodeSegEntry;
-class CMemSpyEngineCodeSegList;
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperCodeSegment ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperCodeSegment* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperCodeSegment();
-
-private:
-    CMemSpyEngineHelperCodeSegment( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void OutputCodeSegmentsL( TUint aPid, TDes& aLine, const TDesC& aPrefix, TChar aSectionUnderlineCharacter = '=', TBool aLowerCaseSectionHeading = EFalse );
-    IMPORT_C CMemSpyEngineCodeSegList* CodeSegmentListL();
-    IMPORT_C CMemSpyEngineCodeSegList* CodeSegmentListL( TProcessId aProcess );
-
-public: // API - but not exported
-    CMemSpyEngineCodeSegList* CodeSegmentListRamLoadedL();
-    inline CMemSpyEngine& Engine() const { return iEngine; }
-
-private: // Internal 
-    void GetCodeSegmentHandlesL( RArray<TAny*>& aHandles, TUint* aProcessId = NULL, TBool aRamOnly = EFalse ) const;
-    CMemSpyEngineCodeSegList* ListFromHandlesLC( RArray<TAny*>& aHandles ) const;
-    static TInt SortByAddress( TAny* const& aLeft, TAny* const& aRight );
-
-private:
-    CMemSpyEngine& iEngine;
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineCodeSegList ) : public CMemSpyEngineTwiddlableItemArray<CMemSpyEngineCodeSegEntry>, public MDesCArray
-    {
-public:
-    static CMemSpyEngineCodeSegList* NewLC( CMemSpyEngine& aEngine );
-
-private:
-    CMemSpyEngineCodeSegList( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C TInt IndexByHandle( TAny* aHandle ) const;
-    IMPORT_C void SortByFileNameL();
-    IMPORT_C void SortByCodeSizeL();
-    IMPORT_C void SortByDataSizeL();
-    IMPORT_C void SortByUidsL();
-    IMPORT_C void ShowOnlyEntriesWithGlobalDataL();
-    IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine );
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-public: // API - but not exported
-    TInt IndexByName( const TDesC& aName ) const;
-
-private: // Internal methods
-    static TInt CompareByFileName( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
-    static TInt CompareByCodeSize( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
-    static TInt CompareByDataSize( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
-    static TInt CompareByUid( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
-    static TBool VisibilityFunctionGlobalData( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineCodeSegEntry ) : public CDesCArrayFlat
-    {
-public:
-    static CMemSpyEngineCodeSegEntry* NewLC( TAny* aHandle, TInt aSize, const TCodeSegCreateInfo& aCreateInfo, const TProcessMemoryInfo& aMemoryInfo );
-    IMPORT_C ~CMemSpyEngineCodeSegEntry();
-
-private:
-    CMemSpyEngineCodeSegEntry( TAny* aHandle, TInt aSize, const TCodeSegCreateInfo& aCreateInfo, const TProcessMemoryInfo& aMemoryInfo );
-    void ConstructL();
-
-public: // API
-    inline TAny* Handle() const { return iHandle; }
-    inline TInt Size() const { return iSize; }
-    inline const TDesC& Caption() const { return *iCaption; }
-    inline const TDesC& FileName() const { return *iFileName; }
-    inline const TCodeSegCreateInfo& CreateInfo() const { return iCreateInfo; }
-    inline const TProcessMemoryInfo& MemoryInfo() const { return iMemoryInfo; }
-
-public: // API
-    IMPORT_C TBool HasCapability( TCapability aCapability ) const;
-    IMPORT_C void OutputDataL( CMemSpyEngineHelperCodeSegment& aHelper ) const;
-
-private: // Internal methods
-    void AddCapabilityItemsL();
-    CDesCArray* CapabilityStringsLC() const;
-    void AddCapabilitiesL( TUint32 aCaps, TInt aCapCount, CDesCArray& aArray ) const;
-
-private: // Member data
-    TAny* iHandle;
-    TInt iSize;
-    HBufC* iCaption;
-    HBufC* iFileName;
-    TCodeSegCreateInfo iCreateInfo;
-    TProcessMemoryInfo iMemoryInfo;
-    };
-
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperCondVar.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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 MEMSPYENGINEHELPERCONDVAR_H
-#define MEMSPYENGINEHELPERCONDVAR_H
-
-// System includes
-#include <e32base.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include <memspy/engine/memspyengineobject.h>
-
-// Classes referenced
-class CMemSpyThread;
-class CMemSpyEngine;
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperCondVar ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperCondVar* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperCondVar();
-
-private:
-    CMemSpyEngineHelperCondVar( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void GetCondVarSuspendedThreadsL( const TMemSpyDriverHandleInfoGeneric& aCondVarDetails, RArray<TMemSpyDriverCondVarSuspendedThreadInfo>& aThreads );
-
-private:
-    CMemSpyEngine& iEngine;
-    };
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperECom.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +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 MEMSPYENGINEHELPERECOM_H
-#define MEMSPYENGINEHELPERECOM_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-#include <ecom/ecom.h>
-#include <xml/contenthandler.h> // MContentHandler mix in class
-#include <xml/parser.h>
-
-// Literal constants
-_LIT( KMemSpyEComInterfaceIdFileName, "MemSpyEComInterfaceIds.xml" );
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyEngineEComCategory;
-class CMemSpyEngineEComInterface;
-class CMemSpyEngineEComImplementation;
-class CCnvCharacterSetConverter;
-
-// Namespaces referenced
-using namespace Xml;
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperECom ) : public CBase, public MContentHandler, public MDesCArray
-    {
-public:
-    static CMemSpyEngineHelperECom* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperECom();
-
-private:
-    CMemSpyEngineHelperECom( CMemSpyEngine& aEngine );
-    void ConstructL();
-    void ConstructInternalL();
-    void ConstructFromFileL();
-
-public: // Internal API
-    REComSession& EComSession();
-    inline TInt Count() const { return iCategories.Count(); }
-    IMPORT_C CMemSpyEngineEComCategory& At( TInt aIndex );
-    IMPORT_C TInt IndexOf( const CMemSpyEngineEComCategory& aEntry );
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-private: // Internal methods
-    HBufC* FindEComXmlFileNameLC();
-    void ConvertL( const TDesC8& aInput, TDes16& aOutput );
-    void ParseL( const TDesC& aFileName );
-
-private: // XML helper functions
-    void OnChildSectionCategoryL( const RAttributeArray& aAttributes );
-    void OnChildSectionInterfaceL( const RAttributeArray& aAttributes );
-
-private: // From MContentHandler
-	void OnStartDocumentL( const RDocumentParameters& aDocParam, TInt aErrorCode );
-	void OnEndDocumentL( TInt aErrorCode );
-	void OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode );
-	void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode );
-	void OnContentL( const TDesC8& aBytes, TInt aErrorCode );
-	void OnStartPrefixMappingL( const RString& aPrefix, const RString& aUri, TInt aErrorCode );
-	void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode );
-	void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode );
-	void OnSkippedEntityL( const RString& aName, TInt aErrorCode );
-	void OnProcessingInstructionL( const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode );
-	void OnError( TInt aErrorCode );
-	TAny* GetExtendedInterface( const TInt32 aUid );
-
-private:
-    CMemSpyEngine& iEngine;
-    REComSession iEComSession;
-    TInt iParserErrorCode;
-    TInt iCharconvConverterState;
-    TBool iSeenMasterSection;
-    CParser* iParser;
-    CCnvCharacterSetConverter* iConverter;
-    RPointerArray<CMemSpyEngineEComCategory> iCategories;
-    };
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineEComCategory ) : public CBase, public MDesCArray
-    {
-public:
-    static CMemSpyEngineEComCategory* NewLC( CMemSpyEngineHelperECom& aHelper, const TDesC& aName );
-    ~CMemSpyEngineEComCategory();
-
-private:
-    CMemSpyEngineEComCategory( CMemSpyEngineHelperECom& aHelper );
-    void ConstructL( const TDesC& aName );
-
-public: // API
-    inline const TDesC& Name() const { return *iName; }
-    inline const TDesC& Caption() const { return *iCaption; }
-    inline REComSession& EComSession() { return iHelper.EComSession(); }
-    inline TInt Count() const { return iInterfaces.Count(); }
-    IMPORT_C CMemSpyEngineEComInterface& At( TInt aIndex );
-    IMPORT_C TInt IndexOf( const CMemSpyEngineEComInterface& aEntry );
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-public: // Iternal API
-    void CreateInterfaceL( const TDesC& aName, TUid aUid );
-    void BuildCaptionL();
-
-private:
-    CMemSpyEngineHelperECom& iHelper;
-    RPointerArray<CMemSpyEngineEComInterface> iInterfaces;
-    HBufC* iName;
-    HBufC* iCaption;
-    };
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineEComInterface ) : public CBase, public MDesCArray
-    {
-public:
-    static CMemSpyEngineEComInterface* NewLC( CMemSpyEngineEComCategory& aCategory, const TDesC& aName, TUid aUid );
-    ~CMemSpyEngineEComInterface();
-
-private:
-    CMemSpyEngineEComInterface( CMemSpyEngineEComCategory& aCategory, TUid aUid );
-    void ConstructL( const TDesC& aName );
-
-public: // API
-    inline const TDesC& Name() const { return *iName; }
-    inline const TDesC& Caption() const { return *iCaption; }
-    inline TInt Count() const { return iImplementations.Count(); }
-    inline CMemSpyEngineEComCategory& Category() const { return iCategory; }
-    IMPORT_C CMemSpyEngineEComImplementation& At( TInt aIndex );
-    IMPORT_C TInt IndexOf( const CMemSpyEngineEComImplementation& aEntry );
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-private: // Data members
-    TUid iUid;
-    CMemSpyEngineEComCategory& iCategory;
-    RPointerArray<CMemSpyEngineEComImplementation> iImplementations;
-    HBufC* iName;
-    HBufC* iCaption;
-    };
-
-
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineEComImplementation ) : public CBase, public MDesCArray
-    {
-public:
-    static CMemSpyEngineEComImplementation* NewLC( CMemSpyEngineEComInterface& aInterface, CImplementationInformation* aInfo );
-    ~CMemSpyEngineEComImplementation();
-
-private:
-    CMemSpyEngineEComImplementation( CMemSpyEngineEComInterface& aInterface );
-    void ConstructL( CImplementationInformation* aInfo );
-
-public: // API
-    inline const TDesC& Name() const { return *iName; }
-    inline const TDesC& Caption() const { return *iCaption; }
-    inline CMemSpyEngineEComInterface& Interface() const { return iInterface; }
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-private: // Internal methods
-    static HBufC* CopyAndCropLC( const TDesC8& aText );
-
-private: // Data members
-    CMemSpyEngineEComInterface& iInterface;
-    CImplementationInformation* iInfo;
-    CDesCArray* iInfoText;
-    HBufC* iName;
-    HBufC* iCaption;
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperFbServ.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +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 MEMSPYENGINEHELPERFBSERV_H
-#define MEMSPYENGINEHELPERFBSERV_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-#include <fbs.h>
-#include <bitmap.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class TMemSpyDriverChunkInfo;
-class TMemSpyEngineFBServBitmapInfo;
-
-// Constants
-const TInt KMemSpyEngineDefaultBitmapCreationBatchSize = 4; // Create 4 bitmaps (asynchronously) at a time
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperFbServ ) : public CBase
-    {
-public: // Construct/destruct
-    static CMemSpyEngineHelperFbServ* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperFbServ();
-
-private: // Internal construction
-    CMemSpyEngineHelperFbServ( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void GetArrayOfBitmapHandlesL( RArray<TInt>& aHandles );
-
-public: // API - but not exported
-    void GetArrayOfBitmapHandlesL( RArray<TInt>& aHandles, TInt& aBitmapConCount, TInt& aFontConCount );
-    static TBool IsLargeBitmapChunk( const TMemSpyDriverChunkInfo& aChunkInfo );
-    static TBool IsSharedBitmapChunk( const TMemSpyDriverChunkInfo& aChunkInfo );
-    static void GetBitmapInfoL( TInt aHandle, TMemSpyEngineFBServBitmapInfo& aInfo );
-    static CFbsBitmap* GetBitmapInfoLC( TInt aHandle, TMemSpyEngineFBServBitmapInfo& aInfo );
-
-private: // Internal structures
-    class CBitmapObject : public CObject
-        {
-    public:
-        CBitmapObject* iThisPointer;
-    public:
-        CBase* iTop; // actually CFbTop*
-        CBitwiseBitmap* iAddressPointer;
-        TInt iHandle;
-        CBitmapObject* iCleanBitmap;
-        };
-
-private: // Internal methods
-    CMemSpyThread& IdentifyFbServThreadL();
-    HBufC8* LocateCFbTopHeapCellDataLC( CMemSpyThread& aFbServThread, TAny*& aCellAddress );
-    HBufC8* LocateBitmapArrayHeapCellDataLC( TAny*& aArrayCellAddress, TInt aArrayAllocCount );
-    void ReadCObjectConInfoL( TAny* aCellAddress, RArray<TAny*>& aContainerObjects, TInt& aCount, TInt& aAllocated );
-    static void ParseCellDataAndExtractHandlesL( const TDesC8& aData, RArray<TInt>& aHandles, TInt aArrayEntryCount );
-    static TBool VerifyCorrectHeapCellL( const TDesC8& aData, TAny* aCellAddress, TAny* aPayloadAddress, TUint aHeapStartingAddress, TUint aHeapMaxSize );
-    static TUint OffsetToCObjectConBitmapCon();
-    static TUint OffsetToCObjectConFontCon();
-    static TUint OffsetToBitmapHandleArray();
-    CBitmapObject* GetBitmapObjectLC( TAny* aAddress );
-
-private: // Data members
-    CMemSpyEngine& iEngine;
-    };
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineFbServBitmap ) : public CDesCArrayFlat
-    {
-public: // Construct/destruct
-    IMPORT_C static CMemSpyEngineFbServBitmap* NewLC( TInt aHandle );
-    IMPORT_C ~CMemSpyEngineFbServBitmap();
-
-private: // Internal construction
-    CMemSpyEngineFbServBitmap();
-    void ConstructL( TInt aHandle );
-
-public: // API
-    TInt BitmapSizeInBytes() const;
-    IMPORT_C const TDesC& Caption() const;
-    IMPORT_C CFbsBitmap& Bitmap();
-    IMPORT_C const CFbsBitmap& Bitmap() const;
-    IMPORT_C TInt Handle() const;
-    IMPORT_C void OutputDataL( CMemSpyEngine& aEngine ) const;
-    IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine );
-    IMPORT_C void GetExportableFileNameL( TDes& aAppendName ) const;
-
-public: // But not exported
-    static void GetExportableFileNameL( const TMemSpyEngineFBServBitmapInfo& aInfo, TDes& aAppendName );
-
-private: // Internal
-    void PrepareItemsL();
-
-private: 
-    static void GetFileCompressionTypeAsString( TBitmapfileCompression aType, TDes& aString );
-
-private: // Data members
-    CFbsBitmap* iBitmap;
-    HBufC* iCaption;
-    };
-
-
-
-
-
-
-
-
-
-
-class MMemSpyEngineFbSerbBitmapArrayObserver
-    {
-public:
-    enum TEvent
-        {
-        EBitmapItemsCreated = 0,
-        EBitmapArrayConstructionComplete
-        };
-
-public: // From MMemSpyEngineFbSerbBitmapArrayObserver
-    virtual void HandleFbServBitmapArrayEventL( TEvent aEvent ) = 0;
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineFbServBitmapArray ) : public CActive, public MDesCArray
-    {
-public: // Construct/destruct
-    IMPORT_C static CMemSpyEngineFbServBitmapArray* NewL( const RArray<TInt>& aBitmapHandles );
-    IMPORT_C static CMemSpyEngineFbServBitmapArray* NewL( TInt aPriority, const RArray<TInt>& aBitmapHandles, MMemSpyEngineFbSerbBitmapArrayObserver& aObserver, TInt aGranularity = KMemSpyEngineDefaultBitmapCreationBatchSize );
-    IMPORT_C ~CMemSpyEngineFbServBitmapArray();
-
-private: // Internal construction
-    CMemSpyEngineFbServBitmapArray( const RArray<TInt>& aBitmapHandles );
-    CMemSpyEngineFbServBitmapArray( TInt aPriority, const RArray<TInt>& aBitmapHandles, MMemSpyEngineFbSerbBitmapArrayObserver& aObserver, TInt aGranularity );
-    void ConstructL();
-
-public: // API
-    IMPORT_C TInt Count() const;
-    IMPORT_C CMemSpyEngineFbServBitmap& At( TInt aIndex );
-    IMPORT_C const CMemSpyEngineFbServBitmap& At( TInt aIndex ) const;
-    IMPORT_C CMemSpyEngineFbServBitmap& BitmapByHandleL( TInt aHandle );
-    IMPORT_C TInt BitmapIndexByHandle( TInt aHandle ) const;
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-private: // From CActive
-    void RunL();
-    void DoCancel();
-    TInt RunError( TInt aError );
-
-private: // Internal
-    void CompleteSelf();
-    void CreateBitmapL( TInt aHandle );
-    void SortBySizeL();
-    static TInt CompareBySize( const CMemSpyEngineFbServBitmap& aLeft, const CMemSpyEngineFbServBitmap& aRight );
-
-private: // Data members
-    const RArray<TInt>& iBitmapHandles;
-    MMemSpyEngineFbSerbBitmapArrayObserver* iObserver;
-    const TInt iGranularity;
-
-    // Transient
-    TInt iIndex;
-
-    // Owned
-    RPointerArray< CMemSpyEngineFbServBitmap > iBitmaps;
-    };
-
-
-
-
-
-
-
-class TMemSpyEngineFBServBitmapInfo
-    {
-public:
-    inline TMemSpyEngineFBServBitmapInfo()
-        : iHandle( 0 ), iSizeInPixels( 0, 0 ), iCompressionType( ENoBitmapCompression ),
-        iSizeInBytes( 0 ), iDisplayMode( 0 ), iBitsPerPixel( 0 ), iFlags( TMemSpyEngineFBServBitmapInfo::EFlagsNone )
-        {}
-
-public: // Enumerations
-    enum TFlags
-        {
-        EFlagsNone = 0,
-        EFlagsIsRomBitmap = 1,
-        EFlagsIsMonochrome = 2,
-        EFlagsIsLarge = 4,
-        EFlagsIsCompressedInRam = 8,
-        };
-
-public: // Data members
-    TInt iHandle;
-    TSize iSizeInPixels;
-    TBitmapfileCompression iCompressionType;
-    TInt iSizeInBytes;
-    TInt8 iDisplayMode;
-    TInt8 iBitsPerPixel;
-    TUint16 iFlags;
-    TInt iColor;
-    };
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperFileSystem.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,306 +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 MEMSPYENGINEHELPERFILESYSTEM_H
-#define MEMSPYENGINEHELPERFILESYSTEM_H
-
-// System includes
-#include <e32base.h>
-#include <f32file.h>
-#include <badesca.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyEngineChunkList;
-class CMemSpyEngineChunkEntry;
-class CMemSpyEngineOutputList;
-class CMemSpyEngineDriveEntry;
-class CMemSpyEngineDriveList;
-class CMemSpyEngineOpenFileList;
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperFileSystem ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperFileSystem* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperFileSystem();
-
-private:
-    CMemSpyEngineHelperFileSystem( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C CMemSpyEngineDriveList* DriveListL();
-    IMPORT_C static TDriveNumber GetSystemDrive();
-    IMPORT_C void ListOpenFilesL();
-    IMPORT_C void ListOpenFilesL( const TThreadId& aThreadId );
-    inline CMemSpyEngine& Engine() const { return iEngine; }
-
-public: // API - But not exported
-    CMemSpyEngineOpenFileList* ListOpenFilesLC();
-    TProcessId FileServerProcessId() const;
-    const CMemSpyEngineChunkEntry* IdentifyCacheChunk( const CMemSpyEngineChunkList& aList, TInt& aIndex ) const;
-    static void GetDriveNumberText( TDriveNumber aDriveNumber, TDes& aText );
-
-private: // Internal methods
-    void ListOpenFilesL( const CFileList& aList, const TThreadId& aThreadId );
-
-private:
-    CMemSpyEngine& iEngine;
-    TProcessId iFileServerProcessId;
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineOpenFileListEntry ) : public CBase
-    {
-public:
-    static CMemSpyEngineOpenFileListEntry* NewLC( const TEntry& aEntry );
-    ~CMemSpyEngineOpenFileListEntry();
-
-private:
-    CMemSpyEngineOpenFileListEntry();
-    void ConstructL( const TEntry& aEntry );
-
-public:
-    IMPORT_C const TDesC& FileName() const;
-    IMPORT_C TInt Size() const;
-
-public: // But not exported
-    TInt UniqueFileId() const;
-    void SetUniqueFileId( TInt aValue );
-
-private: // Member data
-	TUint iAtt;
-    TInt iSize;
-	TTime iModified;
-	TUidType iType;
-    HBufC* iFileName;
-
-    // When enumerating the list of entries associated with a thread, some threads open
-    // the same file multiple times. To avoid duplicates, we ensure that each file
-    // has a unique identifier associated with it, so that we can distinguish instances from
-    // one another.
-    TInt iUniqueFileIdentifier;
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineOpenFileListForThread ) : public CBase
-    {
-public:
-    static CMemSpyEngineOpenFileListForThread* NewLC( const TDesC& aThreadName, const TThreadId& aThreadId, const TProcessId& aProcessId, const CFileList& aList );
-    ~CMemSpyEngineOpenFileListForThread();
-
-private:
-    CMemSpyEngineOpenFileListForThread( const TThreadId& aThreadId, const TProcessId& aProcessId );
-    void ConstructL( const TDesC& aThreadName, const CFileList& aList );
-
-public:
-    void AddL( CMemSpyEngineOpenFileListEntry* aEntry );
-    CMemSpyEngineOpenFileListEntry* EntryByFileName( const TDesC& aFileName );
-
-public:
-    IMPORT_C const TDesC& ThreadName() const;
-    IMPORT_C const TThreadId& ThreadId() const;
-    IMPORT_C const TProcessId& ProcessId() const;
-    IMPORT_C TInt Count() const;
-    IMPORT_C const CMemSpyEngineOpenFileListEntry& At( TInt aIndex ) const;
-
-private: // Member data
-    TThreadId iThreadId;
-    TProcessId iProcessId;
-    HBufC* iThreadName;
-    RPointerArray< CMemSpyEngineOpenFileListEntry > iItems;
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineOpenFileList ) : public CBase
-    {
-public:
-    static CMemSpyEngineOpenFileList* NewLC( CMemSpyEngine& aEngine );
-    IMPORT_C ~CMemSpyEngineOpenFileList();
-
-private:
-    CMemSpyEngineOpenFileList();
-    void ConstructL( CMemSpyEngine& aEngine );
-
-public: // API
-    IMPORT_C TInt Count() const;
-    IMPORT_C const CMemSpyEngineOpenFileListForThread& At( TInt aIndex ) const;
-
-private: // Data members
-    RPointerArray< CMemSpyEngineOpenFileListForThread > iItems;
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-class MMemSpyEngineDriveListObserver
-    {
-public: // From MMemSpyEngineDriveListObserver
-    virtual void HandleDriveListChangedL( const CMemSpyEngineDriveList& aList ) = 0;
-    };
-
-
-NONSHARABLE_CLASS( CMemSpyEngineDriveList ) : public CActive, public MDesCArray
-    {
-public:
-    static CMemSpyEngineDriveList* NewLC( RFs& aFsSession );
-    IMPORT_C ~CMemSpyEngineDriveList();
-
-private:
-    CMemSpyEngineDriveList( RFs& aFsSession );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void SetObserver( MMemSpyEngineDriveListObserver* aObserver );
-    IMPORT_C TInt Count() const;
-    IMPORT_C CMemSpyEngineDriveEntry& At( TInt aIndex );
-    IMPORT_C const CMemSpyEngineDriveEntry& At( TInt aIndex ) const;
-    IMPORT_C TInt ItemIndex( const CMemSpyEngineDriveEntry& aEntry ) const;
-    IMPORT_C CMemSpyEngineDriveEntry* EntryByDriveNumber( TDriveNumber aDrive );
-
-public: // But not exported
-    RFs& FsSession();
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-private: // From CActive
-    void RunL();
-    void DoCancel();
-
-private: // Internal methods
-    void NotifyListChangedL();
-
-private: // Data members
-    RFs& iFsSession;
-    RPointerArray< CMemSpyEngineDriveEntry > iItems;
-    MMemSpyEngineDriveListObserver* iObserver;
-    };
-
-
-
-
-
-
-
-
-
-
-
-class MMemSpyEngineDriveEntryObserver
-    {
-public: // From MMemSpyEngineDriveEntryObserver
-    virtual void HandleDriveEntryChangedL( const CMemSpyEngineDriveEntry& aEntry ) = 0;
-    };
-
-
-class CMemSpyEngineDriveEntry : public CActive, public MDesCArray
-    {
-public:
-    static CMemSpyEngineDriveEntry* NewLC( CMemSpyEngineDriveList& aList, TDriveNumber aDriveNumber );
-    IMPORT_C ~CMemSpyEngineDriveEntry();
-
-private:
-    CMemSpyEngineDriveEntry( CMemSpyEngineDriveList& aList, TDriveNumber aDriveNumber );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void SetObserver( MMemSpyEngineDriveEntryObserver* aObserver );
-    inline const TDesC& Caption() const { return *iCaption; }
-    inline TDriveNumber DriveNumber() const { return iDriveNumber; }
-    inline const TDriveUnit& DriveUnit() const { return iDriveUnit; }
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-private: // Internal methods
-    void RefreshL();
-    void CreateDriveAttributesL( TDes& aItemBuf );
-    void CreateMediaAttributesL( TDes& aItemBuf );
-    void AddStandardFieldsL();
-    void CreateCaptionL( const TDesC& aVolumeName, const TDesC& aMediaType );
-    static void GetMediaTypeText( TMediaType aType, TDes& aText );
-    static void GetBatteryState( TBatteryState aBatteryState, TDes& aText );
-    static TDriveNumber GetSystemDrive();
-    RFs& FsSession();
-
-private: // From CActive
-    void RunL();
-    void DoCancel();
-
-private: // Member data
-    CMemSpyEngineDriveList& iList;
-    const TDriveNumber iDriveNumber;
-    const TDriveUnit iDriveUnit;
-    TMediaSerialNumber iSerialNumber;
-    TVolumeInfo iVolumeInfo;
-    TDriveInfo iDriveInfo;
-    HBufC* iCaption;
-    CMemSpyEngineOutputList* iItems;
-    MMemSpyEngineDriveEntryObserver* iObserver;
-    };
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperHeap.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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 MEMSPYENGINEHELPERHEAP_H
-#define MEMSPYENGINEHELPERHEAP_H
-
-// System includes
-#include <e32base.h>
-#include <s32strm.h>
-#include <bamdesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// MemSpyClient includes
-#include <memspy/engine/memspyheapdata.h>
-
-// Classes referenced
-class CMemSpyThread;
-class CMemSpyEngine;
-class CMemSpyProcess;
-class CMemSpyEngineOutputList;
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperHeap ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperHeap* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperHeap();
-
-private:
-    CMemSpyEngineHelperHeap( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API - User Heap 
-    IMPORT_C void GetHeapInfoUserL( const TProcessId& aProcess, const TThreadId& aThread, TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverCell>* aCells = NULL );
-	IMPORT_C void GetHeapInfoUserL(const TProcessId& aProcess, const TThreadId& aThread, TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverCell>* aCells, TBool aCollectAllocatedCellsAsWellAsFree);
-    IMPORT_C void GetHeapInfoUserL( const CMemSpyProcess& aProcess, RArray<TMemSpyHeapInfo >& aInfos );
-    IMPORT_C void OutputHeapInfoUserL( const CMemSpyThread& aThread );
-    IMPORT_C void OutputHeapDataUserL( const CMemSpyThread& aThread );
-    IMPORT_C void OutputHeapDataUserL( const TProcessId& aPid, const TThreadId& aTid, const TDesC& aThreadName, const TMemSpyHeapInfo& aInfo, const RArray<TMemSpyDriverFreeCell>* aFreeCells = NULL );
-    IMPORT_C void OutputCellListingUserL( const CMemSpyThread& aThread );
-
-public: // API - Kernel Heap
-    IMPORT_C void GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>* aFreeCells = NULL );
-    IMPORT_C void OutputHeapInfoKernelL();
-    IMPORT_C void OutputHeapDataKernelL();
-
-public: // API - Common
-    IMPORT_C void OutputHeapInfoL( const TMemSpyHeapInfo& aInfo, const TDesC& aThreadName, const RArray<TMemSpyDriverCell>* aCells = NULL );
-    IMPORT_C void OutputHeapInfoForDeviceL( TBool aIncludeKernel = ETrue );
-    IMPORT_C CMemSpyEngineOutputList* NewHeapSummaryShortLC( const TMemSpyHeapInfo& aInfo );
-    IMPORT_C CMemSpyEngineOutputList* NewHeapSummaryExtendedLC( const TMemSpyHeapInfo& aInfo, const RArray<TMemSpyDriverCell>* aCells = NULL );
-    //cigasto    
-    IMPORT_C TMemSpyHeapData NewHeapRawInfo( const TMemSpyHeapInfo& aInfo ); //not formatted heap info
-
-public: // But not exported
-    void OutputHeapDataKernelL( TBool aCreateDataStream );
-    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 );
-
-private:
-    static TUint DescriptorAsDWORD( const TDesC8& aItem );
-    void AppendMetaDataL( const TMemSpyHeapInfo& aInfo, CMemSpyEngineOutputList& aList );
-    void AppendStatisticsL( const TMemSpyHeapInfo& aInfo, CMemSpyEngineOutputList& aList );
-	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 );
-
-private:
-    CMemSpyEngine& iEngine;
-    };
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperKernelContainers.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +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 MEMSPYENGINEHELPERKERNELCONTAINERS_H
-#define MEMSPYENGINEHELPERKERNELCONTAINERS_H
-
-// System includes
-#include <e32base.h>
-#include <u32std.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include <memspy/engine/memspyengineobject.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyEngineOutputSink;
-class CMemSpyEngineGenericKernelObjectList;
-class CMemSpyEngineGenericKernelObjectContainer;
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperKernelContainers ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperKernelContainers* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperKernelContainers();
-
-private:
-    CMemSpyEngineHelperKernelContainers( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C CMemSpyEngineGenericKernelObjectList* ObjectsForSpecificContainerL( TMemSpyDriverContainerType aForContainer );
-    IMPORT_C CMemSpyEngineGenericKernelObjectContainer* ObjectsAllL();
-    IMPORT_C void OutputL( const CMemSpyEngineGenericKernelObjectContainer& aContainer ) const;
-
-public: // But not exported
-    CMemSpyEngine& Engine() const;
-    CMemSpyEngineGenericKernelObjectContainer* ObjectsAllLightweightL();
-    static TMemSpyDriverContainerType MapToType( TObjectType aType ); 
-
-private: // Internal methods
-    void AddObjectsFromContainerL( CMemSpyEngineGenericKernelObjectList& aList, TMemSpyDriverContainerType aContainer, TBool aGetInfo = ETrue );
-
-private:
-    CMemSpyEngine& iEngine;
-    };
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineGenericKernelObjectList ) : public CBase
-    {
-public:
-    static CMemSpyEngineGenericKernelObjectList* NewLC( TMemSpyDriverContainerType aType, CMemSpyEngine& aEngine );
-    IMPORT_C ~CMemSpyEngineGenericKernelObjectList();
-
-private:
-    CMemSpyEngineGenericKernelObjectList( TMemSpyDriverContainerType aType );
-    void ConstructL( CMemSpyEngine& aEngine );
-
-public: // API
-    IMPORT_C TInt Count() const;
-    IMPORT_C const TMemSpyDriverHandleInfoGeneric& At( TInt aIndex ) const;
-    IMPORT_C TMemSpyDriverContainerType Type() const;
-    IMPORT_C static TPtrC TypeAsString( TMemSpyDriverContainerType aType );
-    IMPORT_C TPtrC Name() const;
-    IMPORT_C void OutputL( CMemSpyEngineOutputSink& aSink ) const;
-    IMPORT_C TInt Size() const;
-    IMPORT_C TInt ItemsCount() const;
-
-public: // But not exported
-    TAny* HandleAt( TInt aIndex ) const;
-    void AddItemL( TAny* aHandle );
-    void AddItemL( const TMemSpyDriverHandleInfoGeneric& aItem );
-
-private: // Internal methods
-    void UpdateNameL();
-
-private: // Data members
-    TMemSpyDriverContainerType iType;
-    RArray<TMemSpyDriverHandleInfoGeneric> iItems;
-    RPointerArray<TAny> iHandles;
-    HBufC* iName;
-    TInt iSize;
-    };
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineGenericKernelObjectContainer ) : public CBase, public MDesCArray
-    {
-public:
-    static CMemSpyEngineGenericKernelObjectContainer* NewLC();
-    IMPORT_C ~CMemSpyEngineGenericKernelObjectContainer();
-
-private:
-    CMemSpyEngineGenericKernelObjectContainer();
-    void ConstructL();
-
-public: // API
-    IMPORT_C TInt Count() const;
-    IMPORT_C const CMemSpyEngineGenericKernelObjectList& At( TInt aIndex ) const;
-    IMPORT_C void OutputL( CMemSpyEngineOutputSink& aSink ) const;
-
-public: // But not exported
-    void AddListL( CMemSpyEngineGenericKernelObjectList* aList );
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-private: // Data members
-    RPointerArray<CMemSpyEngineGenericKernelObjectList> iItems;
-    };
-
-
-
-#endif
-
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperProcess.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +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 MEMSPYENGINEHELPERPROCESS_H
-#define MEMSPYENGINEHELPERPROCESS_H
-
-// System includes
-#include <e32base.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include <memspy/engine/memspyenginemidwife.h>
-#include <memspy/engine/memspyengineundertaker.h>
-
-// Classes referenced
-class CMemSpyProcess;
-class CMemSpyEngine;
-class CMemSpyEngineProcessMemoryTracker;
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperProcess ) : public CBase, public MMemSpyEngineMidwifeObserver, MMemSpyEngineUndertakerObserver
-    {
-public:
-    static CMemSpyEngineHelperProcess* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperProcess();
-
-private:
-    CMemSpyEngineHelperProcess( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void ImpersonateL( TUint32 aSID = 0 );
-    IMPORT_C void OutputProcessInfoL( const CMemSpyProcess& aProcess );
-    IMPORT_C void OutputProcessInfoDetailedL( const CMemSpyProcess& aProcess );
-    IMPORT_C void SetMemoryTrackingAutoStartProcessListL( const RArray<TUid>& aProcessUids );
-    inline const RArray<TUid>& MemoryTrackingAutoStartProcessList() const { return iMemoryTrackerAutoStartProcessList; }
-    CMemSpyEngineProcessMemoryTracker* TrackerOrNull( const TProcessId& aId );
-    CMemSpyEngineProcessMemoryTracker& TrackerL( const TProcessId& aId );
-    CMemSpyEngineProcessMemoryTracker& TrackerL( const CMemSpyProcess& aProcess );
-
-private: // From MMemSpyEngineMidwifeObserver
-	void ThreadIsBornL( const TThreadId& aId, const RThread& aThread );
-	void ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess );
-
-private: // From MMemSpyEngineUndertakerObserver
-	void ThreadIsDeadL( const TThreadId& aId, const RThread& aThread );
-	void ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess );
-
-private: // Internal methods
-    void OutputProcessInfoL( const CMemSpyProcess& aProcess, TBool aDetailed );
-    TBool IsAutoStartupProcess( TUid aUid ) const;
-
-private:
-    CMemSpyEngine& iEngine;
-    CMemSpyEngineUndertaker* iUndertaker;
-    RArray<TUid> iMemoryTrackerAutoStartProcessList;
-    RPointerArray<CMemSpyEngineProcessMemoryTracker> iMemoryTrackers;
-    };
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperRAM.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +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 MEMSPYENGINEHELPERRAM_H
-#define MEMSPYENGINEHELPERRAM_H
-
-// System includes
-#include <e32base.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyEngineOutputList;
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperRAM ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperRAM* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperRAM();
-
-private:
-    CMemSpyEngineHelperRAM( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C TBool IsAknIconCacheConfigurable() const;
-
-    /** Returns RAM change value */
-    IMPORT_C TInt64 SetAknIconCacheStatusL( TBool aEnabled );
-
-private: // Internal methods
-    void CheckIfAknIconCacheCanBeConfiguredL();
-    TInt SetAknIconStatus( TBool aEnabled );
-
-private:
-    CMemSpyEngine& iEngine;
-    TBool iIsAknIconCacheConfigurable;
-    };
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperROM.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 MEMSPYENGINEHELPERROM_H
-#define MEMSPYENGINEHELPERROM_H
-
-// System includes
-#include <e32base.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyEngineOutputList;
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperROM ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperROM* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperROM();
-
-private:
-    CMemSpyEngineHelperROM( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void AddInfoL( CMemSpyEngineOutputList& aList );
-
-private:
-    CMemSpyEngine& iEngine;
-    HBufC* iPlatformVersion;
-    HBufC* iChecksum;
-    };
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperServer.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +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 MEMSPYENGINEHELPERSERVER_H
-#define MEMSPYENGINEHELPERSERVER_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include <memspy/engine/memspyengineobject.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyEngineServerList;
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperServer ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperServer* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperServer();
-
-private:
-    CMemSpyEngineHelperServer( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C CMemSpyEngineServerList* ServerListL();
-    IMPORT_C void GetServerSessionsL( TAny* aServerHandle, RArray<TMemSpyDriverServerSessionInfo>& aSessions );
-    IMPORT_C void GetServerSessionsL( const TMemSpyDriverHandleInfoGeneric& aServerDetails, RArray<TMemSpyDriverServerSessionInfo>& aSessions );
-    IMPORT_C void GetServerListL( RArray<TMemSpyDriverHandleInfoGeneric>& aServers );
-
-public: // But not exported
-    CMemSpyEngine& Engine() const;
-
-private:
-    CMemSpyEngine& iEngine;
-    };
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineServerEntry ) : public CBase
-    {
-public:
-    static CMemSpyEngineServerEntry* NewLC( const TMemSpyDriverHandleInfoGeneric& aInfo );
-    IMPORT_C ~CMemSpyEngineServerEntry();
-
-private:
-    CMemSpyEngineServerEntry();
-    void ConstructL( const TMemSpyDriverHandleInfoGeneric& aInfo );
-
-public:
-    inline const TDesC& Caption() const { return *iCaption; }
-    inline const TDesC& Name() const { return *iName; }
-    inline const TInt SessionCount() const { return iSessionCount; }
-    inline TInt Id() const { return iId; }
-    inline TAny* Handle() const { return iHandle; }
-    IMPORT_C void OutputDataL( CMemSpyEngineHelperServer& aHelper, TBool aClientThreadColumns ) const;
-    IMPORT_C void GetSessionsL( CMemSpyEngineHelperServer& aHelper, RArray<TMemSpyDriverServerSessionInfo>& aSessions ) const;
-
-private: // Member data
-    HBufC* iCaption;
-    HBufC* iName;
-    TInt iSessionCount;
-    TInt iId;
-    TAny* iHandle;
-    };
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineServerList ) : public CBase, public MDesCArray
-    {
-public:
-    static CMemSpyEngineServerList* NewLC();
-    IMPORT_C ~CMemSpyEngineServerList();
-
-private:
-    CMemSpyEngineServerList();
-    void ConstructL();
-
-public: // API
-    IMPORT_C TInt Count() const;
-    IMPORT_C const CMemSpyEngineServerEntry& At( TInt aIndex ) const;
-    IMPORT_C void SortByNameL();
-    IMPORT_C void SortBySessionCountL();
-    IMPORT_C TInt ItemIndex( const CMemSpyEngineServerEntry& aEntry ) const;
-    IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine, TBool aClientThreadColumns = EFalse );
-
-public: // But not exported
-    void AddItemL( CMemSpyEngineServerEntry* aItem );
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-private: // Internal methods
-    static TInt CompareByName( const CMemSpyEngineServerEntry& aLeft, const CMemSpyEngineServerEntry& aRight );
-    static TInt CompareBySessionCount( const CMemSpyEngineServerEntry& aLeft, const CMemSpyEngineServerEntry& aRight );
-
-private: // Data members
-    RPointerArray<CMemSpyEngineServerEntry> iItems;
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperStack.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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 MEMSPYENGINEHELPERSTACK_H
-#define MEMSPYENGINEHELPERSTACK_H
-
-// System includes
-#include <e32base.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// Classes referenced
-class CMemSpyThread;
-class CMemSpyEngine;
-class CMemSpyProcess;
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperStack ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperStack* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperStack();
-
-private:
-    CMemSpyEngineHelperStack( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void OutputStackInfoL( const CMemSpyThread& aThread );
-    IMPORT_C void OutputStackInfoL( TProcessId aPid, TThreadId aTid, TDes& aLineBuffer );
-    //
-    IMPORT_C void OutputStackDataL( const CMemSpyThread& aThread, TMemSpyDriverDomainType aType );
-    IMPORT_C void OutputStackDataL( const CMemSpyThread& aThread, TMemSpyDriverDomainType aType, TBool aEntireStack );
-    //
-    IMPORT_C void OutputStackInfoForDeviceL();
-    IMPORT_C TInt CalculateStackSizes( const CMemSpyProcess& aProcess );
-
-private:
-    TInt CalculateStackSizesL( const CMemSpyProcess& aProcess );
-
-private:
-    CMemSpyEngine& iEngine;
-    };
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperThread.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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 MEMSPYENGINEHELPERTHREAD_H
-#define MEMSPYENGINEHELPERTHREAD_H
-
-// System includes
-#include <e32base.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include <memspy/engine/memspyengineobject.h>
-
-// Classes referenced
-class CMemSpyThread;
-class CMemSpyEngine;
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperThread ) : public CBase
-    {
-public:
-    static CMemSpyEngineHelperThread* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperThread();
-
-private:
-    CMemSpyEngineHelperThread( CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API
-    IMPORT_C void OutputThreadInfoL( const CMemSpyThread& aThread, TBool aDetailed );
-
-private:
-    CMemSpyEngine& iEngine;
-    };
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperWindowServer.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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 MEMSPYENGINEHELPERWINDOWSERVER_H
-#define MEMSPYENGINEHELPERWINDOWSERVER_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Classes referenced
-
-
-/** 
- * WindowGroup basic info
- */
-class TMemSpyEngineWindowGroupBasicInfo
-    {
-public:
-    TInt iId;
-    TFullName iFullName;
-    TThreadId iThreadId;
-    TInt iOrdinalPosition;
-    };
-
-
-/** 
- * WindowGroup details
- */
-class TMemSpyEngineWindowGroupDetails : public TMemSpyEngineWindowGroupBasicInfo
-    {
-public:
-    TInt iPriority;
-    TInt iWindowGroupHandle;
-    TFullName iName;
-    TUid iUID;
-    TBool iIsBusy;
-    TBool iIsSystem;
-    TBool iIsHidden;
-    TFullName iCaption;
-    TFullName iDocName;
-    TBool iIsFocused;
-    };
-
-
-
-class MMemSpyEngineWindowGroupList : public MDesCArray
-    {
-public:
-    virtual ~MMemSpyEngineWindowGroupList() {};
-
-public: // API
-    virtual TInt Count() const = 0;
-    virtual const TMemSpyEngineWindowGroupBasicInfo& At( TInt aIndex ) const = 0;
-    virtual TInt ItemIndex( const TMemSpyEngineWindowGroupBasicInfo& aEntry ) const = 0;
-
-public: // But not exported
-    virtual void AddItemL( TMemSpyEngineWindowGroupBasicInfo& aItem ) = 0;
-
-public: // From MDesCArray
-    virtual TInt MdcaCount() const = 0;
-    virtual TPtrC MdcaPoint( TInt aIndex ) const = 0;
-    };
-
-
-
-
-class MMemSpyEngineHelperWindowServer
-    {
-public:
-    virtual ~MMemSpyEngineHelperWindowServer(){};
-
-public: // API
-    virtual MMemSpyEngineWindowGroupList* WindowGroupListL() = 0;
-    virtual void GetWindowGroupListL( RArray<TMemSpyEngineWindowGroupBasicInfo>& aWindowGroups ) = 0;
-    virtual void GetWindowGroupDetailsL( TInt aWindowGroupId, TMemSpyEngineWindowGroupDetails& aWindowGroupDetails ) = 0;
-    virtual void SwitchToL( TInt aWindowGroupId ) = 0;
-    };
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Logger/MemSpyEngineLogger.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +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 MEMSPYENGINELOGGER_H
-#define MEMSPYENGINELOGGER_H
-
-// System includes
-#include <e32base.h>
-#include <f32file.h>
-#include <badesca.h>
-
-#ifdef _DEBUG
-#   define TRACE( x ) x
-#else
-#   define TRACE( x )
-#endif
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngine.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +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 MEMSPYENGINE_H
-#define MEMSPYENGINE_H
-
-// System includes
-#include <e32base.h>
-#include <memspy/engine/memspyengineoutputsinktype.h>
-#include <memspy/engine/memspyenginelogger.h>
-#include <memspy/engine/memspyenginehelperwindowserver.h>
-
-// Classes referenced
-class RFs;
-class RMemSpyDriverClient;
-class MMemSpyEngineObserver;
-class CMemSpyProcess;
-class CMemSpyThread;
-class CMemSpyEngineImp;
-class CMemSpyEngineOutputSink;
-class CMemSpyEngineServer;
-class CMemSpyEngineMidwife;
-class CMemSpyEngineUndertaker;
-class CMemSpyEngineChunkWatcher;
-class CMemSpyEngineChunkWatcher;
-class CMemSpyEngineObjectContainer;
-class CMemSpyEngineHelperHeap;
-class CMemSpyEngineHelperStack;
-class CMemSpyEngineHelperCodeSegment;
-class CMemSpyEngineHelperChunk;
-class CMemSpyEngineHelperThread;
-class CMemSpyEngineHelperProcess;
-class CMemSpyEngineHelperServer;
-class CMemSpyEngineHelperActiveObject;
-class CMemSpyEngineHelperKernelContainers;
-class CMemSpyEngineHelperFileSystem;
-class CMemSpyEngineHelperECom;
-class CMemSpyEngineHelperFbServ;
-class CMemSpyEngineHelperSysMemTracker;
-class CMemSpyEngineHelperROM;
-class CMemSpyEngineHelperRAM;
-class CMemSpyEngineHelperCondVar;
-
-
-NONSHARABLE_CLASS( CMemSpyEngine ) : public CBase
-    {
-public:
-    IMPORT_C static CMemSpyEngine* NewL( RFs& aFsSession );
-    IMPORT_C static CMemSpyEngine* NewL( RFs& aFsSession, TBool aStartServer );
-    IMPORT_C ~CMemSpyEngine();
-
-private:
-    CMemSpyEngine();
-    void ConstructL( RFs& aFsSession );
-
-public: // API
-    IMPORT_C RFs& FsSession();
-    IMPORT_C CMemSpyEngineObjectContainer& Container();
-    IMPORT_C const CMemSpyEngineObjectContainer& Container() const;
-    IMPORT_C void SetObserver( MMemSpyEngineObserver* aObserver );
-
-public:
-    void NotifyContainerChangeL();
-    void NotifyClientServerOperationRequestL( TInt aType );
-
-public: // Sink related
-    IMPORT_C CMemSpyEngineOutputSink& Sink();
-    IMPORT_C TMemSpySinkType SinkType();
-    IMPORT_C void InstallSinkL( TMemSpySinkType aType );
-    IMPORT_C void InstallDebugSinkL();
-    IMPORT_C void InstallFileSinkL( const TDesC& aRootFolder );
-
-public: // Misc
-    IMPORT_C void ListOpenFilesL();
-    IMPORT_C void GetVersion( TVersion& aVersion );
-    IMPORT_C TBool IsHelperWindowServerSupported();
-
-public: 
-    IMPORT_C CMemSpyEngineHelperHeap& HelperHeap();
-    IMPORT_C CMemSpyEngineHelperStack& HelperStack();
-    IMPORT_C CMemSpyEngineHelperCodeSegment& HelperCodeSegment();
-    IMPORT_C CMemSpyEngineHelperChunk& HelperChunk();
-    IMPORT_C CMemSpyEngineHelperThread& HelperThread();
-    IMPORT_C CMemSpyEngineHelperProcess& HelperProcess();
-    IMPORT_C CMemSpyEngineHelperServer& HelperServer();
-    IMPORT_C CMemSpyEngineHelperActiveObject& HelperActiveObject();
-    IMPORT_C CMemSpyEngineHelperKernelContainers& HelperKernelContainers();
-    IMPORT_C CMemSpyEngineHelperFileSystem& HelperFileSystem();
-    IMPORT_C CMemSpyEngineHelperECom& HelperECom();
-    IMPORT_C CMemSpyEngineHelperSysMemTracker& HelperSysMemTracker();
-    IMPORT_C CMemSpyEngineHelperFbServ& HelperFbServ();
-    IMPORT_C CMemSpyEngineHelperROM& HelperROM();
-    IMPORT_C CMemSpyEngineHelperRAM& HelperRAM();
-    IMPORT_C MMemSpyEngineHelperWindowServer& HelperWindowServer();
-    IMPORT_C CMemSpyEngineHelperCondVar& HelperCondVar();
-
-public: // Driver
-    RMemSpyDriverClient& Driver();
-
-public: // Event handlers
-    CMemSpyEngineMidwife& Midwife();
-    CMemSpyEngineUndertaker& Undertaker();
-    CMemSpyEngineChunkWatcher& ChunkWatcher();
-
-public: // Process related
-    TInt ProcessSuspendAndGetErrorLC( TProcessId aId );
-    void ProcessSuspendLC( TProcessId aId );
-    void ProcessResume();
-    TProcessId SuspendedProcessId() const;
-
-private: // Data members
-    CMemSpyEngineImp* iImp;
-    };
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineImp.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +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 MEMSPYENGINEIMP_H
-#define MEMSPYENGINEIMP_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// User includes
-#include <memspy/engine/memspyenginemidwife.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineundertaker.h>
-#include <memspy/engine/memspyenginehelperwindowserver.h>
-
-// Classes referenced
-class RFs;
-class CMemSpyProcess;
-class CMemSpyThread;
-class RMemSpyDriverClient;
-class CMemSpyEngineServer;
-class MMemSpyEngineObserver;
-class CMemSpyEngineChunkWatcher;
-class CMemSpyEngineObjectContainer;
-class CMemSpyEngineHelperHeap;
-class CMemSpyEngineHelperStack;
-class CMemSpyEngineHelperCodeSegment;
-class CMemSpyEngineHelperChunk;
-class CMemSpyEngineHelperThread;
-class CMemSpyEngineHelperProcess;
-class CMemSpyEngineHelperServer;
-class CMemSpyEngineHelperActiveObject;
-class CMemSpyEngineHelperKernelContainers;
-class CMemSpyEngineHelperFileSystem;
-class CMemSpyEngineHelperECom;
-class CMemSpyEngineHelperFbServ;
-class CMemSpyEngineHelperSysMemTracker;
-class CMemSpyEngineHelperROM;
-class CMemSpyEngineHelperRAM;
-class CMemSpyEngineHelperCondVar;
-
-
-NONSHARABLE_CLASS( CMemSpyEngineImp ) : public CBase, public MMemSpyEngineUndertakerObserver, 
-                                                   public MMemSpyEngineMidwifeObserver
-    {
-public:
-    CMemSpyEngineImp( RFs& aFsSession, CMemSpyEngine& aEngine );
-    ~CMemSpyEngineImp();
-    void ConstructL();
-
-private: // Construction support
-    void ConstructHelpersL();
-
-public: // API
-    RFs& FsSession();
-    CMemSpyEngineObjectContainer& Container();
-    const CMemSpyEngineObjectContainer& Container() const;
-    void SetObserver( MMemSpyEngineObserver* aObserver );
-
-public:
-    void NotifyContainerChangeL();
-    void NotifyClientServerOperationRequestL( TInt aType );
-
-public: // Sink related
-    CMemSpyEngineOutputSink& Sink();
-    TMemSpySinkType SinkType();
-    void InstallSinkL( TMemSpySinkType aType );
-    void InstallSinkL( TMemSpySinkType aType, const TDesC& aRootFolder );
-
-public: // Misc
-    void ListOpenFilesL();
-    void GetVersion( TVersion& aVersion );
-    TBool IsHelperWindowServerSupported();
-
-public: 
-    CMemSpyEngineHelperHeap& HelperHeap();
-    CMemSpyEngineHelperStack& HelperStack();
-    CMemSpyEngineHelperCodeSegment& HelperCodeSegment();
-    CMemSpyEngineHelperChunk& HelperChunk();
-    CMemSpyEngineHelperThread& HelperThread();
-    CMemSpyEngineHelperProcess& HelperProcess();
-    CMemSpyEngineHelperServer& HelperServer();
-    CMemSpyEngineHelperActiveObject& HelperActiveObject();
-    CMemSpyEngineHelperKernelContainers& HelperKernelContainers();
-    CMemSpyEngineHelperFileSystem& HelperFileSystem();
-    CMemSpyEngineHelperECom& HelperECom();
-    CMemSpyEngineHelperSysMemTracker& HelperSysMemTracker();
-    CMemSpyEngineHelperFbServ& HelperFbServ();
-    CMemSpyEngineHelperROM& HelperROM();
-    CMemSpyEngineHelperRAM& HelperRAM();
-    MMemSpyEngineHelperWindowServer& HelperWindowServer();
-    CMemSpyEngineHelperCondVar& HelperCondVar();
-
-public: // Driver
-    RMemSpyDriverClient& Driver();
-
-public: // Event handlers
-    CMemSpyEngineMidwife& Midwife();
-    CMemSpyEngineUndertaker& Undertaker();
-    CMemSpyEngineChunkWatcher& ChunkWatcher();
-
-public: // Process related
-    TInt ProcessSuspendAndGetErrorLC( TProcessId aId );
-    void ProcessSuspendLC( TProcessId aId );
-    void ProcessResume();
-    TProcessId SuspendedProcessId() const;
-
-private: // From MMemSpyEngineUndertakerObserver
-	void ThreadIsDeadL( const TThreadId& aId, const RThread& aThread );
-	void ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess );
-
-private: // From MMemSpyEngineMidwifeObserver
-	void ThreadIsBornL( const TThreadId& aId, const RThread& aThread );
-	void ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess );
-
-private: // Internal methods
-    static void ResumeSuspendedProcess( TAny* aSelf );
-
-private: // Data members
-    RFs& iFsSession;
-    CMemSpyEngine& iEngine;
-    CMemSpyEngineObjectContainer* iContainer;
-    RMemSpyDriverClient* iMemSpyDriver;
-    MMemSpyEngineObserver* iObserver;
-    CMemSpyEngineUndertaker* iUndertaker;
-    CMemSpyEngineMidwife* iMidwife;
-    CMemSpyEngineChunkWatcher* iChunkWatcher;
-    //
-    CMemSpyEngineHelperHeap* iHelperHeap;
-    CMemSpyEngineHelperStack* iHelperStack;
-    CMemSpyEngineHelperCodeSegment* iHelperCodeSegment;
-    CMemSpyEngineHelperChunk* iHelperChunk;
-    CMemSpyEngineHelperThread* iHelperThread;
-    CMemSpyEngineHelperProcess* iHelperProcess;
-    CMemSpyEngineHelperServer* iHelperServer;
-    CMemSpyEngineHelperActiveObject* iHelperActiveObject;
-    CMemSpyEngineHelperKernelContainers* iHelperKernelContainers;
-    CMemSpyEngineHelperFileSystem* iHelperFileSystem;
-    CMemSpyEngineHelperECom* iHelperECom;
-    CMemSpyEngineHelperSysMemTracker* iHelperSysMemTracker;
-    CMemSpyEngineHelperFbServ* iHelperFbServ;
-    CMemSpyEngineHelperROM* iHelperROM;
-    CMemSpyEngineHelperRAM* iHelperRAM;
-    MMemSpyEngineHelperWindowServer* iHelperWindowServer;
-    CMemSpyEngineHelperCondVar* iHelperCondVar;
-    //
-    CMemSpyEngineServer* iServer;
-    //
-    CMemSpyEngineOutputSink* iSink;
-    TUint iSuspendedProcess;
-    RPointerArray<CMemSpyEngineObjectContainer> iContainers;
-    RLibrary iHelperWindowServerLoader;
-    };
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineObserver.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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 MEMSPYENGINEOBSERVER_H
-#define MEMSPYENGINEOBSERVER_H
-
-// System includes
-#include <e32base.h>
-
-
-
-class MMemSpyEngineObserver
-    {
-public: // Enumerations
-    enum TEvent
-        {
-        EHandleThreadsOrProcessesChanged,
-        EHandleClientServerOperationRequest
-        };
-
-public: // From MMemSpyEngineObserver
-    virtual void HandleMemSpyEngineEventL( TEvent aEvent, TAny* aContext = NULL ) = 0;
-    };
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineProcessMemoryTracker.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +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 MEMSPYENGINEPROCESSMEMORYTRACKER_H
-#define MEMSPYENGINEPROCESSMEMORYTRACKER_H
-
-// System includes
-#include <e32base.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Classes referenced
-class CMemSpyEngine;
-
-
-
-class MMemSpyEngineProcessMemoryTrackerObserver
-    {
-public: // From MMemSpyEngineProcessMemoryTrackerObserver
-    virtual void HandleMemoryTrackingStartedL() = 0;
-    virtual void HandleMemoryTrackingStoppedL() = 0;
-    virtual void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ) = 0;
-    };
-
-
-NONSHARABLE_CLASS( TMemSpyEngineProcessInspectionInfoWithPeakInfo ) : public TMemSpyDriverProcessInspectionInfo
-    {
-public:
-    inline TMemSpyEngineProcessInspectionInfoWithPeakInfo()
-        {
-        }
-
-    inline void ResetPeakFlags()
-        {
-        iPeakStack = EFalse;
-        iPeakHeap = EFalse;
-        iPeakChunkLocal = EFalse;
-        iPeakChunkShared = EFalse;
-        iPeakGlobalData = EFalse;
-        }
-
-public:
-    TBool iPeakStack;
-    TBool iPeakHeap;
-    TBool iPeakChunkLocal;
-    TBool iPeakChunkShared;
-    TBool iPeakGlobalData;
-    };
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineProcessMemoryTracker ) : public CActive
-    {
-public:
-    static CMemSpyEngineProcessMemoryTracker* NewLC( CMemSpyEngine& aEngine, const TProcessId& aProcessId );
-    ~CMemSpyEngineProcessMemoryTracker();
-
-private:
-    CMemSpyEngineProcessMemoryTracker( CMemSpyEngine& aEngine, const TProcessId& aProcessId );
-    void ConstructL();
-
-public: // API
-    IMPORT_C TBool AmTracking() const;
-    IMPORT_C void StartL();
-    IMPORT_C void Stop();
-    IMPORT_C void AddObserverL( MMemSpyEngineProcessMemoryTrackerObserver& aObserver );
-    IMPORT_C void RemoveObserver( MMemSpyEngineProcessMemoryTrackerObserver& aObserver );
-    IMPORT_C void ResetHWML();
-    //
-    inline TProcessId ProcessId() const { return iProcessId; }
-    inline const TMemSpyDriverProcessInspectionInfo& InfoCurrent() const { return iInfoCurrent; }
-    inline const TMemSpyDriverProcessInspectionInfo& InfoPeaks() const { return static_cast< const TMemSpyDriverProcessInspectionInfo& >( iInfoPeaks ); }
-    inline const TMemSpyDriverProcessInspectionInfo& InfoHWMIncShared() const { return iInfoHWMIncShared; }
-    inline const TMemSpyDriverProcessInspectionInfo& InfoHWMExcShared() const { return iInfoHWMIncShared; }
-    
-private: // From CActive
-    void RunL();
-    void DoCancel();
-
-private: // Internal methods
-    void PrintInfoL( const TMemSpyDriverProcessInspectionInfo& aInfo );
-    void UpdatePeaks( const TMemSpyDriverProcessInspectionInfo& aLatestInfo );
-    void UpdateHWMIncShared( const TMemSpyDriverProcessInspectionInfo& aLatestInfo );
-    void UpdateHWMExcShared( const TMemSpyDriverProcessInspectionInfo& aLatestInfo );
-
-private: // Data members
-    CMemSpyEngine& iEngine;
-    const TProcessId iProcessId;
-    TSecureId iSID;
-    TBool iAmTracking;
-    HBufC* iProcessName;
-    TInt iNumberOfChangesReceived;
-    RPointerArray<MMemSpyEngineProcessMemoryTrackerObserver> iObservers;
-
-    TMemSpyDriverProcessInspectionInfo iInfoCurrent;
-    TMemSpyDriverProcessInspectionInfo iInfoHWMIncShared;
-    TMemSpyDriverProcessInspectionInfo iInfoHWMExcShared;
-    TMemSpyEngineProcessInspectionInfoWithPeakInfo iInfoPeaks;
-    };
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineTwiddlableItemArray.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +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 MEMSPYENGINETWIDDLABLEITEMARRAY_H
-#define MEMSPYENGINETWIDDLABLEITEMARRAY_H
-
-// System includes
-#include <e32base.h>
-
-// Classes referenced
-class CMemSpyEngine;
-
-// Type definitions
-typedef TBool (*TMemSpyEngineGeneralVisibiltyFunction)( const TAny*&, TAny* aRune );
-
-
-
-template <class T>
-NONSHARABLE_CLASS( TMemSpyEngineVisibiltyFunction )
-	{
-public:
-    inline TMemSpyEngineVisibiltyFunction( TBool (*aFunction)( const T*&, TAny* aRune ), TAny* aRune = NULL );
-
-public: // API
-    inline operator TMemSpyEngineGeneralVisibiltyFunction() const;
-    inline TAny* Rune() const;
-
-private:
-	TMemSpyEngineGeneralVisibiltyFunction iFunction;
-    TAny* iRune;
-	};
-
-
-
-
-template <class T>
-NONSHARABLE_CLASS( CMemSpyEngineTwiddlableItemArray ) : public CBase
-    {
-public:
-    inline ~CMemSpyEngineTwiddlableItemArray();
-
-protected:
-    inline CMemSpyEngineTwiddlableItemArray( CMemSpyEngine& aEngine );
-
-public: // API
-    inline TInt Count() const;
-    inline void ShowAllL();
-    inline void HideAllL();
-    inline void ShowL( TMemSpyEngineVisibiltyFunction<T> aFunction );
-    inline void HideL( TMemSpyEngineVisibiltyFunction<T> aFunction );
-    inline void AddItemL( T* aItem );
-    inline void AddItemL( T* aItem, TMemSpyEngineVisibiltyFunction<T> aFunction );
-    //
-    inline CMemSpyEngine& Engine() const;
-    inline T& At( TInt aIndex );
-    inline const T& At( TInt aIndex ) const;
-    inline TInt ItemIndex( const T& aItem ) const;
-
-protected: // Framework methods
-    inline void Sort( TLinearOrder<T> aOrder );
-
-private: // Internal methods
-    static inline TBool ShowAllItemsVisibilityFunction( const T*& aItem, TAny* aRune );
-
-private:
-    CMemSpyEngine& iEngine;
-    RPointerArray<T> iAllEntries;
-    RPointerArray<T> iVisibleEntries;
-    };
-
-
-
-
-#include <memspy/engine/memspyenginetwiddlableitemarray.inl>
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineTwiddlableItemArray.inl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +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 MEMSPYENGINETWIDDLABLEITEMARRAY_INL
-#define MEMSPYENGINETWIDDLABLEITEMARRAY_INL
-
-//
-// TMemSpyEngineVisibiltyFunction
-//
-template <class T>
-inline TMemSpyEngineVisibiltyFunction<T>::TMemSpyEngineVisibiltyFunction( TBool (*aFunction)(const T*&, TAny* aRune), TAny* aRune )
-:   iRune( aRune )
-	{
-    iFunction = (TMemSpyEngineGeneralVisibiltyFunction) aFunction;
-    }
-
-
-template <class T>
-inline TMemSpyEngineVisibiltyFunction<T>::operator TMemSpyEngineGeneralVisibiltyFunction() const
-	{
-    return iFunction;
-    }
-
-
-template <class T>
-inline TAny* TMemSpyEngineVisibiltyFunction<T>::Rune() const
-    {
-    return iRune;
-    }
-
-
-
-
-
-
-
-//
-// CMemSpyEngineTwiddlableItemArray
-//
-template <class T>
-inline CMemSpyEngineTwiddlableItemArray<T>::CMemSpyEngineTwiddlableItemArray( CMemSpyEngine& aEngine )
-:   iEngine( aEngine )
-    {
-    }
-
-
-template <class T>
-inline CMemSpyEngineTwiddlableItemArray<T>::~CMemSpyEngineTwiddlableItemArray()
-    {
-    iAllEntries.ResetAndDestroy();
-    iAllEntries.Close();
-
-    // Doesn't own objects - just references those in the "iAllEntries" array
-    iVisibleEntries.Close();
-    }
-
-
-template <class T>
-inline TInt CMemSpyEngineTwiddlableItemArray<T>::Count() const
-    {
-    return iVisibleEntries.Count();
-    }
-
-
-template <class T>
-inline void CMemSpyEngineTwiddlableItemArray<T>::ShowAllL()
-    {
-    TMemSpyEngineVisibiltyFunction<T> function( ShowAllItemsVisibilityFunction );
-    ShowL( function );
-    }
-
-
-template <class T>
-inline void CMemSpyEngineTwiddlableItemArray<T>::HideAllL()
-    {
-    iVisibleEntries.Reset();
-    }
-
-
-template <class T>
-inline void CMemSpyEngineTwiddlableItemArray<T>::ShowL( TMemSpyEngineVisibiltyFunction<T> aFunction )
-    {
-    iVisibleEntries.Reset();
-    //
-    const TInt count = iAllEntries.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const T* entry = iAllEntries[ i ];
-        const TAny* entryPtr = (TAny*) entry;
-        //
-        if  ( (*aFunction)( entryPtr, aFunction.Rune() ) )
-            {
-            iVisibleEntries.AppendL( entry );
-            }
-        }
-    }
-
-
-template <class T>
-inline void CMemSpyEngineTwiddlableItemArray<T>::HideL( TMemSpyEngineVisibiltyFunction<T> aFunction )
-    {
-    iVisibleEntries.Reset();
-    //
-    const TInt count = iAllEntries.Count();
-    for( TInt i=0; i<count; i++ )
-        {
-        const T* entry = iAllEntries[ i ];
-        const TAny* entryPtr = (TAny*) entry;
-        //
-        if  ( (*aFunction)( entryPtr, aFunction.Rune() ) == EFalse )
-            {
-            iVisibleEntries.AppendL( entry );
-            }
-        }
-    }
-
-
-template <class T>
-inline void CMemSpyEngineTwiddlableItemArray<T>::AddItemL( T* aItem )
-    {
-    TMemSpyEngineVisibiltyFunction<T> function( ShowAllItemsVisibilityFunction );
-    AddItemL( aItem, function );
-    }
-
-
-template <class T>
-inline void CMemSpyEngineTwiddlableItemArray<T>::AddItemL( T* aItem, TMemSpyEngineVisibiltyFunction<T> aFunction )
-    {
-    iAllEntries.AppendL( aItem );
-    //
-    const TAny* entryPtr = (TAny*) aItem;
-    if  ( (*aFunction)( entryPtr, aFunction.Rune() ) )
-        {
-        iVisibleEntries.AppendL( aItem );
-        }
-    }
-
-
-template <class T>
-inline CMemSpyEngine& CMemSpyEngineTwiddlableItemArray<T>::Engine() const
-    {
-    return iEngine;
-    }
-
-
-template <class T>
-inline T& CMemSpyEngineTwiddlableItemArray<T>::At( TInt aIndex )
-    {
-    T* entry = iVisibleEntries[ aIndex ];
-    return *entry;
-    }
-
-
-template <class T>
-inline const T& CMemSpyEngineTwiddlableItemArray<T>::At( TInt aIndex ) const
-    {
-    const T* entry = iVisibleEntries[ aIndex ];
-    return *entry;
-    }
-
-
-template <class T>
-inline TInt CMemSpyEngineTwiddlableItemArray<T>::ItemIndex( const T& aItem ) const
-    {
-    const TInt index = iVisibleEntries.Find( &aItem );
-    return index;
-    }
-
-
-template <class T>
-inline TBool CMemSpyEngineTwiddlableItemArray<T>::ShowAllItemsVisibilityFunction( const T*& /*aItem*/, TAny* /*aRune*/ )
-    {
-    return ETrue;
-    }
-
-
-template <class T>
-inline void CMemSpyEngineTwiddlableItemArray<T>::Sort( TLinearOrder<T> aOrder )
-    {
-    iVisibleEntries.Sort( aOrder );
-    }
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineUtils.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +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 MEMSPYENGINEUTILS_H
-#define MEMSPYENGINEUTILS_H
-
-// Configuration defines
-#define __INCLUDE_CAPABILITY_NAMES__
-#define __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
-
-// System includes
-#include <e32base.h>
-
-// User includes
-#include <memspy/engine/memspyenginelogger.h>
-
-// Type definitions
-typedef TBuf<20> TMemSpySizeText;
-typedef TBuf<30> TMemSpyPercentText;
-typedef TBuf<60> TMemSpyTimeText;
-
-// Classes referenced
-class CMemSpyEngineSinkMetaData;
-
-// Literal constants
-_LIT( KMemSpyLogDefaultExtension, ".txt" );
-
-// Enumerations
-enum TMemSpyEnginePanic
-    {
-    EMemSpyEnginePanicInvalidContainer1 = 0,
-    EMemSpyEnginePanicInvalidContainer2 = 1,
-    EMemSpyEnginePanicSuspendRequest1 = 2,
-    EMemSpyEnginePanicSuspendRequest2 = 3,
-    EMemSpyEnginePanicProcessHandleNullWhenAttemptingToIdentifyThreads = 4,
-    EMemSpyEnginePanicEncounteredKernelUnexpectedly = 5,
-    EMemSpyEnginePanicCyclesHaveGoneCyclic = 6,
-    EMemSpyEnginePanicTrackerNull1 = 7,
-    EMemSpyEnginePanicTrackerNull2 = 8,
-    EMemSpyEnginePanicTrackerNull3 = 9,
-    EMemSpyEnginePanicTrackerNull4 = 10,
-    EMemSpyEnginePanicSinkFileEntireFileBufferNull = 11,
-    EMemSpyEnginePanicSinkFileWorkingFileBufferIsNull = 11,
-    };
-
-
-class MemSpyEngineUtils
-    {
-public:
-    IMPORT_C static void FormatTimeL( TDes& aBuf, const TInt64& aTimeVal, TBool aLocalTime = ETrue );
-    IMPORT_C static void FormatTimeL( TDes& aBuf, const TTime& aTime, TBool aLocalTime = ETrue );
-    IMPORT_C static void FormatHex( TDes& aBuf, TInt aValue );
-    IMPORT_C static TMemSpySizeText FormatSizeText( const TInt64& aValue, TInt aDecimalPlaces = 1, TBool aExtraRounding = EFalse );
-    IMPORT_C static TMemSpySizeText FormatSizeText( TInt aValue );
-    IMPORT_C static TMemSpySizeText FormatSizeTextPrecise( TInt aValue );
-    IMPORT_C static TBool IsRomAddress( TAny* aAddress );
-    IMPORT_C static void GetCapabilityName( TDes& aBuf, TCapability aCapability );
-    IMPORT_C static TBool StripText( TDes& aText, const TDesC& aStrip );
-    IMPORT_C static void TextBeforeDoubleColon( TDes& aText );
-    IMPORT_C static void TextAfterDoubleColon( TDes& aText );
-    IMPORT_C static TMemSpyPercentText FormatPercentage( TReal aOneHundredPercentValue, TReal aValue );
-    IMPORT_C static HBufC* CleanupTextLC( const TDesC& aText );
-    IMPORT_C static void GetRomInfoL( TDes& aPlatform, TDes& aChecksum );
-    IMPORT_C static void GetFolderL( RFs& aFsSession, TDes& aFolder, const CMemSpyEngineSinkMetaData& aMetaData, const TDriveNumber* aForceDrive = NULL );
-
-public: // Not exported
-    static TDriveNumber LocateSuitableDrive( RFs& aFsSession );
-    static void FormatTimeSimple( TDes& aBuf, const TTime& aTime );
-    static void FormatTimeNowL( TDes& aBuf, TBool aLocalTime = ETrue );
-    static HBufC* DataStreamFolderNameWithTimeStampLC( const TDesC& aFolderName );
-    static void GetKernelHeapThreadName( TDes& aBuf, TBool aFullName = ETrue );
-    static void GetKernelHeapThreadAndProcessNames( TDes& aThreadName, TDes& aProcessName );
-    static TUint32 Hash( const TDesC& aText );
-    static HBufC* CleanContextInfoLC( const TDesC& aContext );
-    static TProcessId IdentifyFileServerProcessIdL();
-    static TPtrC TextAfterLastDoubleColon( const TDesC& aText );
-
-public: // Panic utility
-    static void Panic( TMemSpyEnginePanic aPanic );
-    };
-
-
-
-// Utility functions & classes
-template <class T>
-class CleanupResetAndDestroy
-    {
-public:
-    inline static void PushL(T& aRef);
-
-private:
-    static void ResetAndDestroy(TAny *aPtr);
-    };
-
-template <class T>
-inline void CleanupResetAndDestroyL(T& aRef);
-
-// Template class CleanupClose
-template <class T>
-inline void CleanupResetAndDestroy<T>::PushL(T& aRef) { CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) ); }
-template <class T>
-void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr) { static_cast< T* >( aPtr )->ResetAndDestroy(); }
-template <class T>
-inline void CleanupResetAndDestroyPushL(T& aRef) { CleanupResetAndDestroy<T>::PushL(aRef); }
-
-// Overflow utility class
-class TMemSpyTruncateOverflow : public TDesOverflow
-	{
-public:
-	virtual void Overflow( TDes& ) { }
-	};
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputList.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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 MEMSPYENGINEOUTPUTLIST_H
-#define MEMSPYENGINEOUTPUTLIST_H
-
-// System includes
-#include <e32base.h>
-#include <bamdesca.h>
-
-// Classes referenced
-class CMemSpyEngineOutputSink;
-class CMemSpyEngineOutputListItem;
-
-
-NONSHARABLE_CLASS( CMemSpyEngineOutputList ) : public CBase, public MDesCArray
-    {
-public:
-    static CMemSpyEngineOutputList* NewL();
-    static CMemSpyEngineOutputList* NewLC( CMemSpyEngineOutputSink& aSink );
-    ~CMemSpyEngineOutputList();
-
-private:
-    CMemSpyEngineOutputList( CMemSpyEngineOutputSink* aSink = NULL );
-    void ConstructL();
-
-public: // From MDesCArray
-    TInt MdcaCount() const;
-    TPtrC MdcaPoint( TInt aPos ) const;
-
-public: // API - add
-    void AddItemL( const TDesC& aCaption );
-    void AddItemL( const TDesC& aCaption, const TDesC& aValue );
-    void AddItemL( const TDesC& aCaption, TInt aValue );
-    void AddItemL( const TDesC& aCaption, TUint aValue );
-    void AddItemL( const TDesC& aCaption, const TInt64& aValue );
-    void AddItemL( const TDesC& aCaption, TAny* aValue );
-    void AddItemL( const TDesC& aCaption, TUint* aValue );
-    void AddItemL( const TDesC& aCaption, TUint8* aValue );
-    void AddItemFormatL( const TDesC& aCaption, TRefByValue<const TDesC> aValueFormat, ... );
-    void AddItemFormatL( TRefByValue<const TDesC> aFormat, ... );
-    void AddItemUCL( const TDesC& aCaption, const TDesC& aValue );
-    void AddItemFormatUCL( const TDesC& aCaption, TRefByValue<const TDesC> aValueFormat, ... );
-    void AddItemFormatUCL( TRefByValue<const TDesC> aFormat, ... );
-    void AddItemHexL( const TDesC& aCaption, TUint aValue );
-    void AddItemYesNoL( const TDesC& aCaption, TBool aYes );
-    void AddItemTrueFalseL( const TDesC& aCaption, TBool aTrue );
-    void AddItemOnOffL( const TDesC& aCaption, TBool aOn );
-    void AddItemPercentageL( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue );
-    void AddBlankItemL( TInt aRepetitions = 1 );
-    void AddUnderlineForPreviousItemL( TChar aUnderlineCharacter = '=', TInt aBlankItemCount = 1 );
-
-public: // API - insert
-    void InsertItemL( TInt aPos, const TDesC& aCaption );
-    void InsertItemL( TInt aPos, const TDesC& aCaption, const TDesC& aValue );
-    void InsertItemFormatUCL( TInt aPos, TRefByValue<const TDesC> aValueFormat, ... );
-    void InsertBlankItemL( TInt aPos, TInt aRepetitions = 1 );
-    void InsertUnderlineForItemAtL( TInt aPos, TChar aUnderlineCharacter = '=', TInt aBlankItemCount = 1 );
-
-public: // API - print
-    void PrintL();
-    void PrintL( CMemSpyEngineOutputSink& aSink );
-
-public: // API - access
-    CMemSpyEngineOutputListItem& Item( TInt aPos );
-    const CMemSpyEngineOutputListItem& Item( TInt aPos ) const;
-    inline TInt Count() const { return iItems.Count(); }
-
-private: // Internal methods
-    TPtr& FormatBuffer();
-
-private: // Data members
-    CMemSpyEngineOutputSink* iSink;
-    HBufC* iFormatBuffer;
-    TPtr iFormatBufferPtr;
-    RPointerArray<CMemSpyEngineOutputListItem> iItems;
-    };
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputSink.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +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 MEMSPYENGINEOUTPUTSINK_H
-#define MEMSPYENGINEOUTPUTSINK_H
-
-// System includes
-#include <e32base.h>
-#include <bamdesca.h>
-
-// User includes
-#include <memspy/engine/memspyengineoutputsinktype.h>
-
-// Classes referenced
-class CMemSpyEngine;
-
-// Constants
-const TBool KMemSpyEngineSinkDoNotCreateOwnDataStream = EFalse;
-
-// Literal constants
-_LIT( KMemSpySinkTagClose, "/" );
-
-
-/** 
- * Context is like additional data that is appended to the file name.
- * Folder is used to formulate a subdirectory within the main memspy output folder
- * Extension is the file extension
- * aUseFileTimeStamp, if true, will cause all output files (irrespective of the folder) to include a timestamp prefix
- * aFolderTimeStamp, if specified, will cause the parent folder to also have a timestamp prepended to it
- */
-NONSHARABLE_CLASS( CMemSpyEngineSinkMetaData ) : public CBase
-    {
-public:
-    IMPORT_C static CMemSpyEngineSinkMetaData* NewL();
-    IMPORT_C static CMemSpyEngineSinkMetaData* NewL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp );
-    IMPORT_C static CMemSpyEngineSinkMetaData* NewL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp, const TTime& aFolderTimeStamp );
-    IMPORT_C static CMemSpyEngineSinkMetaData* NewL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp );
-    IMPORT_C static CMemSpyEngineSinkMetaData* NewL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp, const TTime& aFolderTimeStamp );
-    IMPORT_C ~CMemSpyEngineSinkMetaData();
-
-private:
-    CMemSpyEngineSinkMetaData( TBool aOverwrite, TBool aUseTimeStamp );
-    void ConstructL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, const TTime& aFolderTime );
-
-public: // Access
-    inline const TDesC& Root() const { return *iRoot; }
-    inline const TDesC& Context() const { return *iContext; }
-    inline const TDesC& Folder() const { return *iFolder; }
-    inline const TDesC& Extension() const { return *iExtension; }
-    inline const TDesC& FolderTimeStamp() const { return *iFolderTimeStamp; }
-    inline const TBool Overwrite() const { return iOverwrite; }
-    inline const TBool UseFileTimeStamp() const { return iUseFileTimeStamp; }
-
-private: // Data members
-    HBufC* iRoot;
-    HBufC* iContext;
-    HBufC* iFolder;
-    HBufC* iExtension;
-    HBufC* iFolderTimeStamp;
-    TBool iOverwrite;
-    TBool iUseFileTimeStamp;
-    };
-
-
-
-NONSHARABLE_CLASS( CMemSpyEngineOutputSink ) : public CBase
-    {
-protected:
-    CMemSpyEngineOutputSink( CMemSpyEngine& aEngine );
-    void BaseConstructL();
-
-public:
-    ~CMemSpyEngineOutputSink();
-
-public:
-    virtual TMemSpySinkType Type() const = 0;
-
-public:
-    IMPORT_C void DataStreamTimeStampBeginL( const TTime& aTime );
-    IMPORT_C void DataStreamTimeStampEnd();
-    IMPORT_C void DataStreamBeginL( const TDesC& aContext );
-    IMPORT_C void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder );
-    virtual void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension ) = 0;
-    virtual void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite ) = 0;
-    virtual void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseTimeStamp ) = 0;
-    virtual void DataStreamEndL() = 0;
-
-public:
-    virtual void ProcessSuspendedL( TProcessId aId );
-    virtual void ProcessResumed( TProcessId aId );
-
-public:
-    IMPORT_C void OutputPrefixSetLC( const TDesC& aPrefix );
-    IMPORT_C void OutputPrefixSetFormattedLC( TRefByValue<const TDesC> aFormat, ... );
-    IMPORT_C void OutputPrefixClear();
-
-public:
-    IMPORT_C void OutputRawL( const TDesC8& aData );
-    IMPORT_C void OutputLineL( const TDesC& aLine, TBool aIncludePrefix = ETrue );
-    IMPORT_C void OutputLineFormattedL( TRefByValue<const TDesC> aFormat, ... );
-    IMPORT_C void OutputBlankLineL();
-    IMPORT_C void OutputSectionHeadingL( const TDesC& aCaption, TChar aUnderlineCharacter );
-
-public:
-    IMPORT_C void OutputItemAndValueL( const TDesC& aItem, const TDesC& aValue );
-    IMPORT_C void OutputItemAndValueL( const TDesC& aItem, TUint aValue, TBool aHex = EFalse );
-
-public:
-    IMPORT_C void OutputBinaryDataL( const TDesC& aFormat, const TUint8* aBufferAddress, const TUint8* aDisplayStartAddress, TInt aLength );
-    IMPORT_C void OutputBinaryDataCompressedL( const TDesC& aFormat, const TUint8* aBufferAddress, const TUint8* aDisplayStartAddress, TInt aLength );
-
-public: // But not exported
-    TPtr& FormatBuffer();
-    CMemSpyEngine& Engine();
-
-protected:
-    virtual void DoOutputLineL( const TDesC& aLine ) = 0;
-    virtual void DoOutputRawL( const TDesC8& aData ) = 0;
-    virtual TBool IsPrefixAllowed( const TDesC& aPrefix );
-
-protected:
-    static void ClearPrefix( TAny* aSelf );
-    const TDesC& DataStreamTimeStamp() const;
-
-protected:
-    CMemSpyEngine& iEngine;
-
-private:
-    HBufC* iFormatBuffer;
-    HBufC* iLocalBuffer;
-    HBufC* iPrefix;
-    TPtr iFormatBufferPointer;
-    HBufC* iDataStreamTimeStampSpecifier;
-    };
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputSinkType.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +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 MEMSPYENGINEOUTPUTSINKTYPE_H
-#define MEMSPYENGINEOUTPUTSINKTYPE_H
-
-
-// Enumerations
-enum TMemSpySinkType
-    {
-    ESinkTypeDebug = 0,
-    ESinkTypeFile
-    };
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTracker.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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 MEMSPYENGINEHELPERSYSMEMTRACKER_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKER_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// User includes
-#include <memspy/engine/memspyenginehelpersysmemtrackerobserver.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyEngineHelperSysMemTrackerImp;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class MMemSpyEngineHelperSysMemTrackerObserver;
-class CMemSpyEngineHelperSysMemTrackerOutputFormatter;
-
-
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTracker ) : public CBase, public MMemSpyEngineHelperSysMemTrackerObserver, public MDesCArray
-    {
-public:
-    static CMemSpyEngineHelperSysMemTracker* NewL( CMemSpyEngine& aEngine );
-    ~CMemSpyEngineHelperSysMemTracker();
-
-private:
-    CMemSpyEngineHelperSysMemTracker();
-    void ConstructL( CMemSpyEngine& aEngine );
-
-public: // API
-    IMPORT_C TBool IsActive() const;
-    IMPORT_C void StartL();
-    IMPORT_C void StartL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
-    IMPORT_C void StopL();
-    //
-    IMPORT_C void SetConfigL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
-    IMPORT_C void GetConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
-    //
-    IMPORT_C void SetObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver );
-    IMPORT_C void RemoveObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver );
-    //
-    IMPORT_C const RPointerArray< CMemSpyEngineHelperSysMemTrackerCycle >& CompletedCycles() const;
-
-    IMPORT_C void CheckForChangesNowL();
-
-public: // But not exported
-    void Reset();
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-private: // From MMemSpyEngineHelperSysMemTrackerObserver
-    void HandleCyclesResetL();
-    void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-    void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private:
-    CMemSpyEngineHelperSysMemTrackerImp* iImp;
-    MMemSpyEngineHelperSysMemTrackerObserver* iRealObserver;
-    CMemSpyEngineHelperSysMemTrackerOutputFormatter* iOutputFormatter;
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerConfig.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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 MEMSPYENGINEHELPERSYSMEMTRACKERCONFIG_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERCONFIG_H
-
-// System includes
-#include <e32base.h>
-
-// Constants
-const TInt KMemSpySysMemTrackerConfigMinTimerPeriod = 5; // Seconds
-const TInt KMemSpySysMemTrackerConfigMaxTimerPeriod = 60; // Seconds
-
-
-NONSHARABLE_CLASS( TMemSpyEngineHelperSysMemTrackerConfig )
-    {
-public:
-    inline TMemSpyEngineHelperSysMemTrackerConfig()
-        : iTimerPeriod( KMemSpySysMemTrackerConfigMinTimerPeriod * 1000000 ),
-          iDumpData( EFalse ),
-          iEnabledCategories( EMemSpyEngineSysMemTrackerCategoryAll ),
-          iMode( MemSpyEngineSysMemTrackerModeBasic )
-        {
-        }
-
-public:
-    inline TBool DumpData() const { return iDumpData; }
-    inline const TTimeIntervalMicroSeconds32& TimerPeriod() const { return iTimerPeriod; }
-    inline const TInt EnabledCategoryCount() 
-        { 
-        TInt count(0);
-        for( TInt bit = EMemSpyEngineSysMemTrackerCategoryWindowGroups; bit > 0; bit = bit >> 1 )
-            {
-            if ( bit & iEnabledCategories )
-                {
-                count++;
-                }
-            }
-        return count;
-        }
-
-public:
-    enum TMemSpyEngineSysMemTrackerCategories
-        {
-        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,
-        EMemSpyEngineSysMemTrackerCategoryAll             = 0xffff
-        };
-    
-    enum TMemSpyEngineSysMemTrackerMode
-        {
-        MemSpyEngineSysMemTrackerModeBasic = 0,
-        MemSpyEngineSysMemTrackerModeFull,
-        MemSpyEngineSysMemTrackerModeCustom
-        };
-    
-public:
-    TTimeIntervalMicroSeconds32 iTimerPeriod;
-    TBool iDumpData;
-    TInt iEnabledCategories;
-    TName iThreadNameFilter;
-    TMemSpyEngineSysMemTrackerMode iMode;
-    };
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycle.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +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 MEMSPYENGINEHELPERSYSMEMTRACKERCYCLE_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERCYCLE_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Classes referenced
-class RFs;
-class CMemSpyEngineOutputList;
-class CMemSpyEngineOutputSink;
-class TMemSpyEngineHelperSysMemTrackerConfig;
-class CMemSpyEngineHelperSysMemTrackerCycleChange;
-
-
-
-/**
- * A cycle object represents one or more changes that have taken place 
- * in the entire OS
- *
- * The individual elements that make up the overall cycle description are
- * obtained by iterating through the various CMemSpyEngineHelperSysMemTrackerCycleChange
- * instances owned by this object.
- *
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycle ) : public CBase, public MDesCArray
-    {
-public:
-    static CMemSpyEngineHelperSysMemTrackerCycle* NewLC( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig, const CMemSpyEngineHelperSysMemTrackerCycle* aPreviousCycle = NULL );
-    ~CMemSpyEngineHelperSysMemTrackerCycle();
-
-private:
-    CMemSpyEngineHelperSysMemTrackerCycle( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig, const CMemSpyEngineHelperSysMemTrackerCycle* aPreviousCycle = NULL );
-    void ConstructL();
-
-public: // API - info about this cycle
-    IMPORT_C TInt CycleNumber() const;
-    IMPORT_C const TTime& Time() const;
-    IMPORT_C const TDesC& TimeFormatted() const;
-    IMPORT_C const TDesC& Caption() const;
-    IMPORT_C const TInt64& MemoryFree() const;
-    IMPORT_C TInt64 MemoryDelta() const;
-    IMPORT_C TInt64 MemoryFreePreviousCycle() const;
-
-public: // API - access specific changes
-    IMPORT_C TInt ChangeCount() const;
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
-
-public: // Internal API
-    void FinalizeL();
-    void AddAndPopL( CMemSpyEngineHelperSysMemTrackerCycleChange* aInfo );
-    void DiscardChanges();
-    CMemSpyEngineHelperSysMemTrackerCycleChange& ChangeAt( TInt aIndex );
-    void GetDataFolderL( RFs& aFsSession, TDes& aFolder );
-    void DataStreamBeginL( CMemSpyEngineOutputSink& aSink, const TDesC& aContext );
-    void DataStreamEndL( CMemSpyEngineOutputSink& aSink );
-
-public: // Misc
-    const TMemSpyEngineHelperSysMemTrackerConfig& Config() const;
-    //
-    void AddToMemoryUsed( TInt aValue );
-    void AddToMemoryHeapAllocs( TInt aValue );
-    void AddToMemoryHeapFrees( TInt aValue );
-    void AddToCellCountFree( TInt aValue );
-    void AddToCellCountAlloc( TInt aValue );
-    //
-    const TInt64& MemoryUsed() const;
-    const TInt64& MemoryHeapAllocs() const;
-    const TInt64& MemoryHeapFrees() const;
-    const TInt64& MemoryHeapCellCountAlloc() const;
-    const TInt64& MemoryHeapCellCountFree() const;
-
-private: // Data members
-    const TMemSpyEngineHelperSysMemTrackerConfig& iConfig;
-    const CMemSpyEngineHelperSysMemTrackerCycle* iPreviousCycle;
-    TInt iCycleNumber;
-    TTime iTime;
-    TInt64 iMemoryFree;
-    HBufC* iTimeFormatted;
-    HBufC* iCaption;
-    TInt iChangeCount;
-    CMemSpyEngineOutputList* iFixedItems;
-    RPointerArray< CMemSpyEngineHelperSysMemTrackerCycleChange > iChangeDescriptors;
-
-private: // Data members - transient
-    TInt64 iMemoryUsed;
-    TInt64 iMemoryHeapFrees;
-    TInt64 iMemoryHeapAllocs;
-    TInt64 iCellCountsFrees;
-    TInt64 iCellCountsAllocs;
-    };
-
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycleChange.h	Fri Aug 27 11:37:29 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 MEMSPYENGINEHELPERSYSMEMTRACKERCYCLECHANGE_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERCYCLECHANGE_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include <memspy/engine/memspyenginehelpersysmemtrackerenums.h> 
-
-// Classes referenced
-class CMemSpyEngineOutputSink;
-class CMemSpyEngineOutputList;
-class CMemSpyEngineHelperSysMemTrackerCycle;
-typedef TBuf<6> TMemSpySWMTTypeName;
-
-/**
- * A change descriptor object represents precisely one system-wide change that was detected
- * during any given cycle.
- *
- */
-NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChange ) : public CBase
-    {
-public:
-    ~CMemSpyEngineHelperSysMemTrackerCycleChange();
-
-protected:
-    CMemSpyEngineHelperSysMemTrackerCycleChange( TUint8 aAttributes );
-    void BaseConstructL();
-
-public: // API - framework
-    virtual TMemSpyEngineSysMemTrackerType Type() const = 0;
-    virtual void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) = 0;
-    virtual void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) = 0;
-    virtual void OutputDataL( CMemSpyEngineOutputSink& /*aSink*/, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) { };
-
-protected: // Internal methods
-    void FormatType( TMemSpySWMTTypeName& aBuffer ) const;
-    void FormatAttributes( TDes& aBuffer ) const;
-
-private: // Data members
-    const TUint8 iAttributes;
-    };
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerEnums.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +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 MEMSPYENGINEHELPERSYSMEMTRACKERENUMS_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKERENUMS_H
-
-// System includes
-#include <e32std.h>
-
-// Enumerations
-enum TMemSpyEngineSysMemTrackerType
-    {
-    EMemSpyEngineSysMemTrackerTypeHeapUser = 0,
-    EMemSpyEngineSysMemTrackerTypeHeapKernel,
-    EMemSpyEngineSysMemTrackerTypeChunk,
-    EMemSpyEngineSysMemTrackerTypeRamDrive,
-    EMemSpyEngineSysMemTrackerTypeStack,
-    EMemSpyEngineSysMemTrackerTypeGlobalData,
-    EMemSpyEngineSysMemTrackerTypeCode,
-    EMemSpyEngineSysMemTrackerTypeOpenFile,
-    EMemSpyEngineSysMemTrackerTypeDiskSpace,
-    EMemSpyEngineSysMemTrackerTypeBitmap,
-    EMemSpyEngineSysMemTrackerTypeHandleGeneric,
-    EMemSpyEngineSysMemTrackerTypeHandlePAndS,
-    EMemSpyEngineSysMemTrackerTypeFbserv,
-    EMemSpyEngineSysMemTrackerTypeFileServerCache,
-    EMemSpyEngineSysMemTrackerTypeSystemMemory,
-    EMemSpyEngineSysMemTrackerTypeWindowServer,
-    
-    //
-    EMemSpyEngineSysMemTrackerTypeCount // MARKER - must be last
-    };
-
-
-enum TMemSpyEngineSysMemTrackerEntryAttributes
-    {
-    EMemSpyEngineSysMemTrackerEntryAttributeNone = 0,
-    EMemSpyEngineSysMemTrackerEntryAttributeIsNew = 1,
-    EMemSpyEngineSysMemTrackerEntryAttributeIsAlive = 2
-    };
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerObserver.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +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 MEMSPYENGINEHELPERSYSMEMTRACKER_OBSERVER_H
-#define MEMSPYENGINEHELPERSYSMEMTRACKER_OBSERVER_H
-
-// System includes
-#include <e32base.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Classes referenced
-class CMemSpyEngineHelperSysMemTrackerCycle;
-
-
-
-class MMemSpyEngineHelperSysMemTrackerObserver
-    {
-public: // From MMemSpyEngineHelperSysMemTrackerObserver
-    virtual void HandleCyclesResetL() = 0;
-    virtual void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) = 0;
-    virtual void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) = 0;
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObject.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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 MEMSPYENGINEOBJECT_H
-#define MEMSPYENGINEOBJECT_H
-
-// System includes
-#include <e32base.h>
-
-
-NONSHARABLE_CLASS( CMemSpyEngineObject ) : public CBase
-    {
-public:
-    IMPORT_C CMemSpyEngineObject();
-    IMPORT_C CMemSpyEngineObject( CMemSpyEngineObject& aParent );
-
-protected:
-    ~CMemSpyEngineObject();
-
-public: // API
-    IMPORT_C TInt AccessCount() const;
-    IMPORT_C virtual void Close();
-    IMPORT_C virtual void Open();
-    IMPORT_C CMemSpyEngineObject* Parent() const;
-    IMPORT_C void SetParent( CMemSpyEngineObject* aParent );
-    
-protected: // Internal API
-    inline TBool OpenOrCloseInProgress() const { return iOpenOrCloseInProgress; }
-    inline void SetOpenOrCloseInProgress( TBool aOpenOrCloseInProgress ) { iOpenOrCloseInProgress = aOpenOrCloseInProgress; }
-
-private:
-    TInt iAccessCount;
-    CMemSpyEngineObject* iParent;
-    TBool iOpenOrCloseInProgress;
-    };
-
-
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectContainer.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +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 MEMSPYENGINEOBJECTCONTAINER_H
-#define MEMSPYENGINEOBJECTCONTAINER_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// User includes
-#include <memspy/engine/memspyenginemidwife.h>
-#include <memspy/engine/memspyengineundertaker.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyProcess;
-
-
-NONSHARABLE_CLASS( CMemSpyEngineObjectContainer ) : public CBase, public MDesCArray, public MMemSpyEngineUndertakerObserver, public MMemSpyEngineMidwifeObserver
-    {
-public:
-    static CMemSpyEngineObjectContainer* NewL( CMemSpyEngine& aEngine );
-    static CMemSpyEngineObjectContainer* NewL( const TDesC& aFilter, CMemSpyEngine& aEngine );
-    ~CMemSpyEngineObjectContainer();
-
-private:
-    CMemSpyEngineObjectContainer( CMemSpyEngine& aEngine );
-    void ConstructL( const TDesC& aFilter );
-
-public: // API
-    IMPORT_C TInt Count() const;
-    IMPORT_C TInt CountAll() const;
-
-public:
-    IMPORT_C void RefreshL();
-    IMPORT_C void RefreshL( const TDesC& aFilter );
-    IMPORT_C TBool IsAlive( TProcessId aPid ) const;
-    IMPORT_C TBool IsAlive( TProcessId aPid, TThreadId aTid ) const;
-    IMPORT_C CMemSpyProcess& At( TInt aIndex ) const;
-    IMPORT_C CMemSpyProcess& ProcessByIdL( TProcessId aId ) const;
-    IMPORT_C TInt ProcessIndexById( TProcessId aId ) const;
-    IMPORT_C TInt ProcessAndThreadByThreadId( TThreadId aTid, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const;
-    IMPORT_C TInt ProcessAndThreadByFullName( const TDesC& aFullName, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const;
-    IMPORT_C TInt ProcessAndThreadByPartialName( const TDesC& aPartialName, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const;
-
-public: // API - sorting
-    IMPORT_C void SortById();
-    IMPORT_C void SortByName();
-    IMPORT_C void SortByThreadCount();
-    IMPORT_C void SortByCodeSegs();
-    IMPORT_C void SortByHeapUsage();
-    IMPORT_C void SortByStackUsage();
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
-
-private: // From MMemSpyEngineUndertakerObserver
-	void ThreadIsDeadL( const TThreadId& aId, const RThread& aThread );
-	void ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess );
-
-public: // From MMemSpyEngineMidwifeObserver
-	void ThreadIsBornL( const TThreadId& aId, const RThread& aThread );
-	void ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess );
-
-private: // Internal methods
-    void Remove( CMemSpyProcess& aProcess );
-    void AppendL( CMemSpyProcess* aProcess );
-    void Resort();
-    void LocateProcessesL( const TDesC& aFilter );
-    void DestroyProcesses( RArray< CMemSpyProcess* >& aList );
-    void TryToCreateProcessAndThreadL( const TThreadId& aTid, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread );
-    void TryToCreateProcessAndThreadL( const RThread& aRThread, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread );
-    CMemSpyProcess* CreateProcessL( const TProcessId& aId );
-    TBool MoveToGarbageL( const TProcessId& aId );
-
-private: // Comparison functions
-    static TInt CompareById( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
-    static TInt CompareByName( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
-    static TInt CompareByThreadCount( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
-    static TInt CompareByCodeSegs( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
-    static TInt CompareByHeapUsage( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
-    static TInt CompareByStackUsage( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
-
-private: // Idle callback related
-    void AsyncNotifyUiOfContainerChanges();
-    static TBool NotifyUiOfContainerChanges( TAny* aSelf );
-
-private: // Enumerations
-    enum TSortType
-        {
-        ESortById = 0,
-        ESortByName,
-        ESortByThreadCount,
-        ESortByCodeSegs,
-        ESortByHeapUsage,
-        ESortByStackUsage
-        };
-        
-private:
-    CMemSpyEngine& iEngine;
-    TSortType iSortType;
-    CMemSpyEngineUndertaker* iUndertaker;
-    CMemSpyEngineMidwife* iMidwife;
-    CIdle* iIdleNotifyContainerChanged;
-    RArray< CMemSpyProcess* > iProcesses;
-    RArray< CMemSpyProcess* > iGarbage;
-    };
-
-
-#endif
\ No newline at end of file
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectProcess.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +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 MEMSPYENGINEOBJECTPROCESS_H
-#define MEMSPYENGINEOBJECTPROCESS_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// User includes
-#include <memspy/engine/memspyengineobject.h>
-
-// Classes referenced
-class CMemSpyThread;
-class CMemSpyEngine;
-class TMemSpyDriverProcessInfo;
-
-
-NONSHARABLE_CLASS( CMemSpyProcess ) : public CMemSpyEngineObject, public MDesCArray
-    {
-public:
-    IMPORT_C static CMemSpyProcess* NewL( const CMemSpyProcess& aCopyMe );
-    static CMemSpyProcess* NewL( TProcessId aId, CMemSpyEngine& aEngine );
-    static CMemSpyProcess* NewLC( TProcessId aId, CMemSpyEngine& aEngine );
-
-private:
-    ~CMemSpyProcess();
-
-public: // From CMemSpyEngineObject
-    IMPORT_C void Open();
-    IMPORT_C void Close();
-
-private:
-    CMemSpyProcess( TProcessId aId, CMemSpyEngine& aEngine );
-    void ConstructL();
-
-public: // API - access
-    inline CMemSpyEngine& Engine() const { return iEngine; }
-    inline const TDesC& NameForListBox() const { return *iName; }
-    inline TProcessId Id() const { return iId; }
-    inline TInt Count() const { return iThreads.Count(); }
-    
-public: // API - query
-    IMPORT_C TPtrC Name() const;
-    IMPORT_C CMemSpyThread& At( TInt aIndex ) const;
-    IMPORT_C TInt ThreadIndexById( TThreadId aId ) const;
-    IMPORT_C CMemSpyThread& ThreadByIdL( TThreadId aId ) const;
-    IMPORT_C TBool IsSystemPermanent() const;
-    IMPORT_C TBool IsSystemCritical() const;
-    IMPORT_C TBool IsDead() const;
-    IMPORT_C TUint32 SID() const;
-    IMPORT_C TUint32 VID() const;
-    IMPORT_C TProcessPriority Priority() const;
-    IMPORT_C TExitCategoryName ExitCategory() const;
-    IMPORT_C TInt ExitReason() const;
-    IMPORT_C TExitType ExitType() const;
-    
-public: // API - misc
-    IMPORT_C void KillL();
-    IMPORT_C void TerminateL();
-    IMPORT_C void PanicL();
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
-
-public: // New API functions:
-    IMPORT_C TUidType UIDs() const;
-    IMPORT_C SCapabilitySet Capabilities() const;
-
-public: // API - but not exported
-    void GetFileName( TFileName& aFileName );
-    void RefreshL();
-    void RefreshL( const RProcess& aProcess );
-    void SetDeadL();
-    void SetDeadL( const RProcess& aProcess );
-    void FullName( TDes& aFullName ) const;
-
-public: // API - utility functions
-    static void AppendPriority( TDes& aDes, TProcessPriority aPriority );
-
-public: // Called by process container
-    void HandleThreadIsBornL( const TThreadId& aId );
-
-private: // Internal methods
-    void LocateThreadsL( RProcess& aProcess );
-    void BuildFormattedNameL();
-    void CloseAllThreads();
-    HBufC* GetProcessNameLC( const RProcess& aProcessOrNull, TBool& aProcessNameIncludesExeSuffix ) const;
-
-private: // Internal enumerations
-    enum TFlags
-        {
-        EFlagsNone = 0,
-        EFlagsIncludedExecutableWithinName = 1
-        };
-
-private: // Data members
-    const TProcessId iId;
-    CMemSpyEngine& iEngine;
-    TProcessPriority iPriority;
-    TExitCategoryName iExitCategory;
-    TInt iExitReason;
-    TExitType iExitType;
-    HBufC* iName;
-    RArray< CMemSpyThread* > iThreads;
-    TMemSpyDriverProcessInfo* iInfo;
-    TUint32 iFlags;
-    };
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThread.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +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 MEMSPYENGINEOBJECTTHREAD_H
-#define MEMSPYENGINEOBJECTTHREAD_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// User includes
-#include <memspy/engine/memspyengineobject.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyProcess;
-class CMemSpyThreadInfoContainer;
-
-
-NONSHARABLE_CLASS( CMemSpyThread ) : public CMemSpyEngineObject
-    {
-public:
-    static CMemSpyThread* NewL( TThreadId aId, CMemSpyProcess& aProcess );
-    static CMemSpyThread* NewLC( TThreadId aId, CMemSpyProcess& aProcess );
-
-private:
-    ~CMemSpyThread();
-
-public: // From CMemSpyEngineObject
-    IMPORT_C void Open();
-    IMPORT_C void Close();
-
-private:
-    CMemSpyThread( TThreadId aId, CMemSpyProcess& aProcess );
-    void ConstructL();
-
-public: // API - query
-    IMPORT_C TPtrC Name() const;
-    IMPORT_C TFullName FullName() const;
-    IMPORT_C CMemSpyThreadInfoContainer& InfoContainerL();
-    IMPORT_C CMemSpyThreadInfoContainer& InfoContainerForceSyncronousConstructionL();
-    IMPORT_C TBool IsSystemPermanent() const;
-    IMPORT_C TBool IsSystemCritical() const;
-    IMPORT_C TBool IsDead() const;
-    IMPORT_C TThreadPriority Priority() const;
-
-public: // API - misc
-    IMPORT_C void KillL();
-    IMPORT_C void TerminateL();
-    IMPORT_C void PanicL();
-    IMPORT_C void SetPriorityL( TThreadPriority aPriority );
-
-public: // API - access
-    inline CMemSpyProcess& Process() { return *iProcess; }
-    inline const CMemSpyProcess& Process() const { return *iProcess; }
-    inline TThreadId Id() const { return iId; }
-    inline const TDesC& NameForListBox() const { return *iName; }
-    inline TBool InfoContainerReady() const { return iInfoContainer != NULL; }
-
-public: // API - but not exported
-    CMemSpyEngine& Engine() const;
-    void OpenLC( RThread& aThread );
-    TInt Open( RThread& aThread );
-    void RefreshL();
-    void RefreshL( const RThread& aThread );
-    void SetDeadL();
-    void SetDeadL( const RThread& aThread );
-    void FullName( TDes& aName ) const;
-
-public: // API - utility functions - used by process also
-    static void AppendPriority( TDes& aDes, TThreadPriority aPriority );
-    static void AppendExitType( TDes& aDes, TExitType aType );
-    static void AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory );
-
-private: // Internal methods
-    HBufC* GetThreadNameLC( const RThread& aThreadOrNull ) const;
-
-private: // Data members
-    TThreadId iId;
-    CMemSpyProcess* iProcess;
-    HBufC* iName;
-    CMemSpyThreadInfoContainer* iInfoContainer;
-
-    // RThread attributes
-    TThreadPriority iPriority;
-    TExitCategoryName iExitCategory;
-    TExitType iExitType;
-    TInt iExitReason;
-    TUint32 iFlags;
-    };
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoContainer.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +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 MEMSPYENGINETHREADINFOCONTAINER_H
-#define MEMSPYENGINETHREADINFOCONTAINER_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// User includes
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobject.h>
-
-// Classes referenced
-class CMemSpyThread;
-class CMemSpyEngine;
-
-class MMemSpyThreadInfoContainerObserver
-    {
-public: // Enumerations
-    enum TEvent
-        {
-        EInfoItemChanged = 0,
-        EInfoItemDestroyed
-        };
-
-public: // From MMemSpyThreadInfoContainerObserver
-    virtual void HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType ) = 0;
-    };
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoContainer ) : public CMemSpyEngineObject, public MDesCArray
-    {
-public:
-    static CMemSpyThreadInfoContainer* NewL( CMemSpyThread& aThread, TBool aAsync = ETrue );
-    static CMemSpyThreadInfoContainer* NewLC( CMemSpyThread& aThread, TBool aAsync = ETrue );
-    static CMemSpyThreadInfoContainer* NewLC( CMemSpyThread& aThread, TMemSpyThreadInfoItemType aSpecificType );
-
-private:
-    CMemSpyThreadInfoContainer( CMemSpyThread& aThread );
-    ~CMemSpyThreadInfoContainer();
-    void ConstructL( TBool aAsync );
-    void ConstructItemByTypeL( TBool aAsync, TMemSpyThreadInfoItemType aType );
-
-public: // From CMemSpyEngineObject
-    IMPORT_C void Open();
-    IMPORT_C void Close();
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
-
-public: // API
-    inline CMemSpyThread& Thread() { return *iThread; }
-    inline const CMemSpyThread& Thread() const { return *iThread; }
-    IMPORT_C CMemSpyEngine& Engine() const;
-    IMPORT_C CMemSpyThreadInfoItemBase& Item( TInt aIndex );
-    IMPORT_C CMemSpyThreadInfoItemBase& Item( TMemSpyThreadInfoItemType aType );
-    IMPORT_C TInt InfoItemIndexByType( TMemSpyThreadInfoItemType aType );
-    IMPORT_C void ObserverAddL( MMemSpyThreadInfoContainerObserver& aObserver );
-    IMPORT_C void ObserverRemove( MMemSpyThreadInfoContainerObserver& aObserver );
-    IMPORT_C void PrintL();
-    void AddItemL( TMemSpyThreadInfoItemType aType );
-
-public: // But not exported
-    void NotifyObserverL( MMemSpyThreadInfoContainerObserver::TEvent aEvent, TMemSpyThreadInfoItemType aType );
-
-private: // Internal methods
-    void OpenAllInfoItems();
-    void CloseAllInfoItems();
-
-private:
-    CPeriodic* iIdleResetListboxTimer;
-    CMemSpyThread* iThread;
-    RArray< CMemSpyThreadInfoItemBase* > iItems;
-    RArray< MMemSpyThreadInfoContainerObserver* > iObservers;
-    };
-
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,915 +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 MEMSPYTHREADINFOOBJECTS_H
-#define MEMSPYTHREADINFOOBJECTS_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-
-// User includes
-#include <memspy/engine/memspyengineobject.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/engine/memspyengineprocessmemorytracker.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyThread;
-class CMemSpyThreadInfoContainer;
-class CMemSpyEngineChunkList;
-class CMemSpyEngineCodeSegList;
-class CMemSpyEngineActiveObjectArray;
-
-// Enumerations
-enum TMemSpyThreadInfoItemType
-    {
-    EMemSpyThreadInfoItemTypeFirst = 0,
-    //
-    EMemSpyThreadInfoItemTypeGeneralInfo = EMemSpyThreadInfoItemTypeFirst,
-    EMemSpyThreadInfoItemTypeHeap,
-    EMemSpyThreadInfoItemTypeStack,
-    EMemSpyThreadInfoItemTypeChunk,
-    EMemSpyThreadInfoItemTypeCodeSeg,
-    EMemSpyThreadInfoItemTypeOpenFiles,
-    EMemSpyThreadInfoItemTypeActiveObject,
-    EMemSpyThreadInfoItemTypeOwnedThreadHandles,
-    EMemSpyThreadInfoItemTypeOwnedProcessHandles,
-    EMemSpyThreadInfoItemTypeServer,
-    EMemSpyThreadInfoItemTypeSession,
-    EMemSpyThreadInfoItemTypeSemaphore,
-    EMemSpyThreadInfoItemTypeOtherThreads,
-    EMemSpyThreadInfoItemTypeOtherProcesses,
-    EMemSpyThreadInfoItemTypeMutex,
-    EMemSpyThreadInfoItemTypeTimer,
-    EMemSpyThreadInfoItemTypeLogicalChannel,
-    EMemSpyThreadInfoItemTypeChangeNotifier,
-    EMemSpyThreadInfoItemTypeUndertaker,
-    EMemSpyThreadInfoItemTypeMessageQueue,
-    EMemSpyThreadInfoItemTypeConditionalVariable,
-    EMemSpyThreadInfoItemTypeLDD,
-    EMemSpyThreadInfoItemTypePDD,
-    EMemSpyThreadInfoItemTypeMemoryTracking,
-    EMemSpyThreadInfoItemTypeMemoryTrackingCurrent,
-    EMemSpyThreadInfoItemTypeMemoryTrackingHWM,
-    EMemSpyThreadInfoItemTypeMemoryTrackingPeak,
-    //
-    EMemSpyThreadInfoItemTypeLast
-    };
-
-// Constants
-const TInt KMemSpyDefaultMaxHandleCount = 128;
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoItemBase ) : public CMemSpyEngineObject, public MDesCArray
-    {
-protected:
-    CMemSpyThreadInfoItemBase( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aType, TBool aAsyncConstruction );
-    ~CMemSpyThreadInfoItemBase();
-    virtual void ConstructL() = 0;
-
-private: // Construction support
-    static TInt CallConstructL( TAny* aSelf );
-
-public: // API
-    virtual TPtrC Name() const = 0;
-    IMPORT_C TMemSpyThreadInfoItemType Type() const;
-    IMPORT_C virtual void RebuildL();
-    inline CMemSpyThreadInfoContainer& Container() { return iContainer; }
-    IMPORT_C TBool IsReady() const;
-    IMPORT_C CMemSpyEngine& Engine() const;
-    IMPORT_C void PrintL();
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
-    IMPORT_C TPtrC Caption(TInt aIndex ) const;
-    IMPORT_C TPtrC Value(TInt aIndex ) const;
-
-protected:
-    class CItem : public CBase
-        {
-        public:
-            static CItem* NewLC( const CItem& aCopyMe );
-            static CItem* NewLC( const TDesC& aCaption );
-            static CItem* NewLC( const TDesC& aCaption, const TDesC& aValue );
-            static CItem* NewHexLC( const TDesC& aCaption, TUint aValue );
-            static CItem* NewDecimalLC( const TDesC& aCaption, TInt aValue );
-            static CItem* NewLongLC( const TDesC& aCaption, const TInt64& aValue );
-            static CItem* NewYesNoLC( const TDesC& aCaption, TBool aYes );
-            static CItem* NewOnOffLC( const TDesC& aCaption, TBool aOn );
-            static CItem* NewPercentageLC( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue );
-            ~CItem();
-
-        private:
-            CItem();
-            void ConstructL( const TDesC& aCaption, const TDesC& aValue );
-
-        public: // API
-            inline const TDesC& Caption() const { return *iCaption; }
-            inline const TDesC& Value() const { return *iValue; }
-            inline const TDesC& Combined() const { return *iCombined; }
-
-        public:
-            void SetValueL( const TDesC& aValue );
-            void SetHexL( TUint aValue );
-            void SetDecimalL( TInt aValue );
-            void SetLongL( const TInt64& aValue );
-            void SetYesNoL( TBool aYes );
-            void SetOnOffL( TBool aOn );
-            void SetPercentageL( TInt aOneHundredPercentValue, TInt aValue );
-            
-        private: // Internal
-            void UpdateCombinedL();
-        
-        private:
-            HBufC* iCaption;
-            HBufC* iValue;
-            HBufC* iCombined;
-        };
-
-protected: // Internal API
-    void AddItemL( const TDesC& aCaption, const TDesC& aValue );
-    void AddItemHexL( const TDesC& aCaption, TUint aValue );
-    void AddItemDecimalL( const TDesC& aCaption, TInt aValue );
-    void AddItemLongL( const TDesC& aCaption, const TInt64& aValue );
-    void AddItemYesNoL( const TDesC& aCaption, TBool aYes );
-    void AddItemOnOffL( const TDesC& aCaption, TBool aOn );
-    void AddItemPercentageL( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue );
-    void StripProcessAndThreadNames( TDes& aText );
-    void StripProcessName( TDes& aText );
-    void StripThreadName( TDes& aText );
-    CItem& Item( TInt aIndex );
-    const CItem& Item( TInt aIndex ) const;
-    virtual void Reset();
-
-private:
-    mutable CMemSpyThreadInfoContainer& iContainer;
-    TBool iReady;
-    TBool iIsEmpty;
-    RPointerArray<CItem> iItems;
-    CAsyncCallBack iCallBack;
-    const TMemSpyThreadInfoItemType iType;
-    };
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoGeneral ) : public CMemSpyThreadInfoItemBase
-    {
-public:
-    static CMemSpyThreadInfoGeneral* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoGeneral( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // Internal methods
-    void MakeRegisterListingL( RThread& aThread );
-    };
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoHeap ) : public CMemSpyThreadInfoItemBase
-    {
-public:
-    static CMemSpyThreadInfoHeap* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoHeap( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-    };
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoOpenFiles ) : public CMemSpyThreadInfoItemBase
-    {
-public:
-    static CMemSpyThreadInfoOpenFiles* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoOpenFiles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-    };
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoActiveObjects ) : public CMemSpyThreadInfoItemBase
-    {
-public:
-    static CMemSpyThreadInfoActiveObjects* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    ~CMemSpyThreadInfoActiveObjects();
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoActiveObjects( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
-    
-public: // API
-    inline CMemSpyEngineActiveObjectArray& Array() { return *iItems; }
-
-private: // Member data
-    CMemSpyEngineActiveObjectArray* iItems;
-    };
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoStack ) : public CMemSpyThreadInfoItemBase
-    {
-public:
-    static CMemSpyThreadInfoStack* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoStack( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-    };
-
-
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoChunk ) : public CMemSpyThreadInfoItemBase
-    {
-public:
-    static CMemSpyThreadInfoChunk* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    ~CMemSpyThreadInfoChunk();
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoChunk( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
-    
-public: // API
-    inline CMemSpyEngineChunkList& List() { return *iList; }
-    inline void NullifyList() { iList = NULL; }
-
-private:
-    CMemSpyEngineChunkList* iList;
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoCodeSeg ) : public CMemSpyThreadInfoItemBase
-    {
-public:
-    static CMemSpyThreadInfoCodeSeg* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    ~CMemSpyThreadInfoCodeSeg();
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoCodeSeg( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-public: // From MDesCArray
-    IMPORT_C TInt MdcaCount() const;
-    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
-    
-public: // API
-    inline CMemSpyEngineCodeSegList& List() { return *iList; }
-    inline void NullifyList() { iList = NULL; }
-
-private: // Data members
-    CMemSpyEngineCodeSegList* iList;
-    };
-
-
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoHandleObjectBase ) : public CMemSpyThreadInfoItemBase
-    {
-public:
-    ~CMemSpyThreadInfoHandleObjectBase();
-
-protected: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoHandleObjectBase( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // New API
-    inline TMemSpyDriverContainerType ContainerType() const { return iContainerType; }
-    inline TInt DetailsCount() const { return iInfoItems.Count(); }
-    inline TMemSpyDriverHandleInfoGeneric& DetailsAt( TInt aIndex ) { return iInfoItems[ aIndex ]; }
-    inline const TMemSpyDriverHandleInfoGeneric& DetailsAt( TInt aIndex ) const { return iInfoItems[ aIndex ]; }
-    IMPORT_C TInt DetailsIndexByEntry( const TMemSpyDriverHandleInfoGeneric& aEntry ) const;
-    IMPORT_C TInt DetailsIndexByHandle( TAny* aHandle ) const;
-
-protected: // Internal class
-    class THandleWrapper
-        {
-    public:
-        inline THandleWrapper( TAny* aHandle, TMemSpyDriverContainerType aType ) : iHandle( aHandle ), iType( aType ), iRefCount( 1 ) { }
-
-    public: // API
-        static TBool Match( const THandleWrapper& aLeft, const THandleWrapper& aRight );
-
-    public: // Data members
-        TAny* iHandle;
-        TMemSpyDriverContainerType iType;
-        TInt iRefCount;
-        };
-
-protected: // Internal API
-    virtual void GetHandlesL( RArray<THandleWrapper>& aArray ) = 0;
-
-protected: // New internal framework API
-    virtual void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName ) = 0;
-    virtual void HandleAllItemsLocatedL() { }
-
-private: // Data members
-    const TMemSpyDriverContainerType iContainerType;
-    RArray< TMemSpyDriverHandleInfoGeneric > iInfoItems;
-    };
-
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoHandleByContainer ) : public CMemSpyThreadInfoHandleObjectBase
-    {
-protected: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoHandleByContainer( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction );
-
-protected: // From CMemSpyThreadInfoHandleObjectBase
-    void GetHandlesL( RArray<THandleWrapper>& aArray );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoReferencedBy ) : public CMemSpyThreadInfoHandleObjectBase
-    {
-protected: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoReferencedBy( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction );
-
-protected: // From CMemSpyThreadInfoHandleObjectBase
-    void GetHandlesL( RArray<THandleWrapper>& aArray );
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoServer ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoServer* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoServer( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-    IMPORT_C static TPtrC SessionType( TIpcSessionType aType );
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoSession ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoSession* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    ~CMemSpyThreadInfoSession();
-
-private:
-    CMemSpyThreadInfoSession( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-public: // API
-    IMPORT_C TInt ConnectionCount( const TDesC& aName ) const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    void HandleAllItemsLocatedL();
-
-protected: // From CMemSpyThreadInfoItemBase
-    void Reset();
-
-private: // Internal object
-    class CSessionInfoEntry : public CBase
-        {
-    public:
-        inline CSessionInfoEntry( HBufC* aName ) : iCount(1), iName( aName ) { }
-        inline ~CSessionInfoEntry() { delete iName; }
-
-    public:
-        TInt iCount;
-        HBufC* iName;
-        };
-
-private: // Internal methods
-    static TBool CompareEntries( const CSessionInfoEntry& aLeft, const CSessionInfoEntry& aRight );
-
-private:
-    RPointerArray<CSessionInfoEntry> iServerNames;
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoSemaphore ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoSemaphore* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoSemaphore( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoMutex ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoMutex* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoMutex( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoTimer ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoTimer* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoTimer( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-
-private: // Internal methods
-    static void GetTimerState( TMemSpyDriverTimerState aState, TDes& aBuf );
-    static void GetTimerType( TMemSpyDriverTimerType aType, TDes& aBuf );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoLDD ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoLDD* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoLDD( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoPDD ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoPDD* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoPDD( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoLogicalChannel ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoLogicalChannel* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoLogicalChannel( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoChangeNotifier ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoChangeNotifier* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoChangeNotifier( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoUndertaker ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoUndertaker* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoUndertaker( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoOwnedThreadHandles ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoOwnedThreadHandles* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoOwnedThreadHandles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoOwnedProcessHandles ) : public CMemSpyThreadInfoHandleByContainer
-    {
-public:
-    static CMemSpyThreadInfoOwnedProcessHandles* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoOwnedProcessHandles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoOtherThreads ) : public CMemSpyThreadInfoReferencedBy
-    {
-public:
-    static CMemSpyThreadInfoOtherThreads* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoOtherThreads( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoOtherProcesses ) : public CMemSpyThreadInfoReferencedBy
-    {
-public:
-    static CMemSpyThreadInfoOtherProcesses* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-private:
-    CMemSpyThreadInfoOtherProcesses( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-
-private: // From CMemSpyThreadInfoHandleByContainer
-    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
-    };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoMemoryTrackingStatisticsCurrent ) : public CMemSpyThreadInfoItemBase, public MMemSpyEngineProcessMemoryTrackerObserver
-    {
-public:
-    static CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    ~CMemSpyThreadInfoMemoryTrackingStatisticsCurrent();
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoMemoryTrackingStatisticsCurrent( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    TPtrC Name() const;
-    
-public: // API
-    void SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory );
-    inline CMemSpyEngineProcessMemoryTracker& Tracker() { return *iTracker; }
-
-private: // From MMemSpyEngineProcessMemoryTrackerObserver
-    void HandleMemoryTrackingStartedL();
-    void HandleMemoryTrackingStoppedL();
-    void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
-
-private: // Member data
-    TBool iTotalIncludesSharedMemory;
-    CMemSpyEngineProcessMemoryTracker* iTracker;
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoMemoryTrackingStatisticsPeak ) : public CMemSpyThreadInfoItemBase, public MMemSpyEngineProcessMemoryTrackerObserver
-    {
-public:
-    static CMemSpyThreadInfoMemoryTrackingStatisticsPeak* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    ~CMemSpyThreadInfoMemoryTrackingStatisticsPeak();
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoMemoryTrackingStatisticsPeak( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    TPtrC Name() const;
-    
-public: // API
-    void SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory );
-    inline CMemSpyEngineProcessMemoryTracker& Tracker() { return *iTracker; }
-
-private: // From MMemSpyEngineProcessMemoryTrackerObserver
-    void HandleMemoryTrackingStartedL();
-    void HandleMemoryTrackingStoppedL();
-    void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
-
-private: // Member data
-    TBool iTotalIncludesSharedMemory;
-    CMemSpyEngineProcessMemoryTracker* iTracker;
-    };
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoMemoryTrackingStatisticsHWM ) : public CMemSpyThreadInfoItemBase, public MMemSpyEngineProcessMemoryTrackerObserver
-    {
-public:
-    static CMemSpyThreadInfoMemoryTrackingStatisticsHWM* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    ~CMemSpyThreadInfoMemoryTrackingStatisticsHWM();
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoMemoryTrackingStatisticsHWM( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    TPtrC Name() const;
-    
-public: // API
-    void SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory );
-    inline CMemSpyEngineProcessMemoryTracker& Tracker() { return *iTracker; }
-
-private: // From MMemSpyEngineProcessMemoryTrackerObserver
-    void HandleMemoryTrackingStartedL();
-    void HandleMemoryTrackingStoppedL();
-    void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
-
-private: // Member data
-    TBool iTotalIncludesSharedMemory;
-    CMemSpyEngineProcessMemoryTracker* iTracker;
-    };
-
-
-
-
-
-NONSHARABLE_CLASS( CMemSpyThreadInfoMemoryTracking ) : public CMemSpyThreadInfoItemBase, public MMemSpyEngineProcessMemoryTrackerObserver
-    {
-public:
-    static CMemSpyThreadInfoMemoryTracking* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    ~CMemSpyThreadInfoMemoryTracking();
-
-private: // From CMemSpyThreadInfoItemBase
-    CMemSpyThreadInfoMemoryTracking( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
-    void ConstructL();
-
-public: // From CMemSpyThreadInfoItemBase
-    IMPORT_C TPtrC Name() const;
-    
-public: // API
-    IMPORT_C TBool TrackingActive() const;
-    IMPORT_C TBool TotalIncludesSharedMemory() const;
-    IMPORT_C void TrackingSetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory );
-    IMPORT_C void TrackingStartL();
-    IMPORT_C void TrackingStopL();
-    IMPORT_C void TrackingResetHWML();
-    IMPORT_C void TrackingObserverAddL( MMemSpyEngineProcessMemoryTrackerObserver& aObserver );
-    IMPORT_C void TrackingObserverRemove( MMemSpyEngineProcessMemoryTrackerObserver& aObserver );
-    IMPORT_C MDesCArray& InfoCurrent();
-    IMPORT_C MDesCArray& InfoHWM();
-    IMPORT_C MDesCArray& InfoPeak();
-    inline TBool TrackerExists() const { return iTracker != NULL; }
-
-private: // From MMemSpyEngineProcessMemoryTrackerObserver
-    void HandleMemoryTrackingStartedL();
-    void HandleMemoryTrackingStoppedL();
-    void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
-
-private: // Internal methods
-    inline CMemSpyEngineProcessMemoryTracker& Tracker() { return *iTracker; }
-    void UpdateCaptionsL();
-    void UpdateCaptionsL( const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
-
-private: // Member data
-    TBool iTotalIncludesSharedMemory;
-    CMemSpyEngineProcessMemoryTracker* iTracker;
-    CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* iInfoCurrent;
-    CMemSpyThreadInfoMemoryTrackingStatisticsHWM* iInfoHWM;
-    CMemSpyThreadInfoMemoryTrackingStatisticsPeak* iInfoPeak;
-    };
-
-
-
-
-#endif
--- a/memspy/memspy_plat/memspy_api/memspy_api.metaxml	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-<?xml version="1.0" ?>
-<api id="d6c032dbc08ddbb1c1db14ad08df1147" dataversion="2.0">
-  <name>MemSpy API</name>
-  <description>Defines the API, which is used for external client server usage and different MemSpy internal sub projects.</description>
-  <type>c++</type>
-  <collection>memspy</collection>
-  <libs>
-    <lib name="memspydriverclient.lib" />
-    <lib name="memspyengine.lib" />
-  </libs>
-  <release category="platform" sinceversion="5.1"/>
-  <attributes>
-     <!-- This indicates whether the api provides separate html documentation -->
-     <!-- or is the additional documentation generated from headers. -->
-     <!-- If you are unsure then the value is "no" -->
-     <htmldocprovided>no</htmldocprovided>
-     <adaptation>no</adaptation>
-  </attributes>
-</api>
--- a/memspy/rom/memspy.iby	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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 MEMSPY_IBY
-#define MEMSPY_IBY
-
-// Engine 
-file=ABI_DIR\BUILD_DIR\MemSpyDriverClient.dll									SHARED_LIB_DIR\MemSpyDriverClient.dll
-file=ABI_DIR\BUILD_DIR\MemSpyEngine.dll											SHARED_LIB_DIR\MemSpyEngine.dll
-
-// Client - server
-file=ABI_DIR\BUILD_DIR\MemSpyServer.exe											SHARED_LIB_DIR\MemSpyServer.exe
-file=ABI_DIR\BUILD_DIR\MemSpyClient.dll											SHARED_LIB_DIR\MemSpyClient.dll
-
-// Commandline
-file=ABI_DIR\BUILD_DIR\MemSpy.exe									            SHARED_LIB_DIR\MemSpy.exe
-
-// Console UI
-//file=ABI_DIR\BUILD_DIR\MemSpyConsole.exe										SHARED_LIB_DIR\MemSpyConsole.exe
-//data=ZPRIVATE\\2002129E\MemSpyEComInterfaceIds.xml							    \private\2002129E\MemSpyEComInterfaceIds.xml
-//data=ZPRIVATE\\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml		    \private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml
-
-#endif
--- a/memspy/rom/memspy_rom.iby	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +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 MEMSPY_ROM_IBY
-#define MEMSPY_ROM_IBY
-
-// Driver 
-device[VARID]=KERNEL_DIR\BUILD_DIR\MemSpyDriver.ldd								SHARED_LIB_DIR\MemSpyDriver.ldd
-
-#endif
--- a/memspy/symbian_version.hrh	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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: Symbian version configuration file 
-*
-*/
-
-#ifndef __SYMBIAN_VERSION_HRH
-#define __SYMBIAN_VERSION_HRH
-
-// S60 and Symbian version number enumeration definitions
-
-#define S60_30                                              30
-#define S60_31                                              31
-#define S60_32                                              32
-#define S60_50                                              50
-#define S60_51                                              91
-#define S60_52                                              92
-#define SYMBIAN_1                                           50
-#define SYMBIAN_2                                           91
-#define SYMBIAN_3                                           92
-#define SYMBIAN_4                                           101
-
-
-/**
- * Defines the S60 or Symbian version used by this component. This flag can be
- * used to variate the source code based on the SDK in use. The value of the
- * flag should be always changed to reflect the current build environment.
- */
-#define SYMBIAN_VERSION_SUPPORT                              SYMBIAN_4
-
-
-#endif  // __SYMBIAN_VERSION_HRH
--- a/memspy/techview/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +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:
-*
-*/
-
-PRJ_PLATFORMS
-
-DEFAULT 
-
-PRJ_EXPORTS
-
-../include/data_caging_paths.hrh /epoc32/include/variant/data_caging_paths.hrh
-
-PRJ_MMPFILES
-
--- a/memspy/techview/include/data_caging_paths.hrh	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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:
-*
-*/
-
-// This compatibility file can be exported on TechView builds in which
-// the data_caging_paths.hrh header is not already present. 
-
-#ifndef TECHVIEW_DATA_CAGING_PATHS_H
-#define TECHVIEW_DATA_CAGING_PATHS_H
-
-#define VID_DEFAULT 0x101FB657
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0">
+  <package id="osrndtools" name="OS R&amp;D Tools">
+    <collection id="debugsrv" name="Debug Services" level="trace">
+      <component id="runmodedebug" filter="s60" name="Run Mode Debug" purpose="development">
+        <unit bldFile="debugsrv/runmodedebug/group"/>
+      </component>
+    </collection>
+    <collection id="perfsrv" name="Performance Services" level="analysis">
+      <component id="analyzetool" filter="s60" name="AnalyzeTool" purpose="development">
+        <unit bldFile="perfsrv/analyzetool/group"/>
+      </component>
+      <component id="memspy" filter="s60" name="MemSpy" purpose="development">
+        <unit bldFile="perfsrv/memspy/group"/>
+      </component>
+      <component id="piprofiler" filter="s60" name="Performance Investigator Profiler" purpose="development">
+        <unit bldFile="perfsrv/piprofiler/group"/>
+      </component>
+    </collection>
+    <collection id="tracefw" name="Trace Services" level="trace">
+      <component id="tracecompiler" filter="s60" name="TraceCompiler" purpose="development">
+        <unit bldFile="tracefw/tracecompiler/group"/>
+      </component>
+    </collection>
+  </package>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1 @@
+<PackageMap root="sf" layer="os"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetool_plat/analyzetool_api/analyzetool_api.metaxml	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<api id="e7d1f55108565c675ad3ff377518344a" dataversion="2.0">
+  <name>AnalyzeTool API</name>
+  <description>Defines the API, which is used by application compiled with AnlayzeTool.</description>
+  <type>c++</type>
+  <collection>AnalyzeTool</collection>
+  <libs>
+    <lib name="atoolstaticlib.lib"/>
+    <lib name="atoolcleaner.lib"/>
+    <lib name="atoolmemoryhook.lib"/>
+  </libs>
+  <release category="platform" sinceversion=""/>
+  <attributes>
+    <htmldocprovided>no</htmldocprovided>
+    <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetool_plat/analyzetool_api/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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 <platform_paths.hrh>
+
+PRJ_EXPORTS
+// Analyzetool API
+../inc/analyzetool/analyzetool.h				            OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/analyzetool.h)
+../inc/analyzetool/analyzetool.inl				            OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/analyzetool.inl)
+../inc/analyzetool/analyzetoolcleaner.h				        OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/analyzetoolcleaner.h)
+../inc/analyzetool/analyzetooltraceconstants.h				OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/analyzetooltraceconstants.h)
+../inc/analyzetool/atcommon.h				                OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/atcommon.h)
+../inc/analyzetool/customuser.h				                OS_LAYER_PLATFORM_EXPORT_PATH(analyzetool/customuser.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,325 @@
+/*
+* 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:  Declaration of the class RAnalyzeTool.
+*
+*/
+
+
+#ifndef __ANALYZETOOL_H__
+#define __ANALYZETOOL_H__
+
+// INCLUDES
+#include <e32cmn.h>
+
+//Version information for command line engine.
+//Tells the version of AT core componenets.
+//ANALYZETOOL_CORE_VERSION_FOR_CLE 1.10.0
+
+// CONSTANTS
+inline TVersion KAnalyzeToolLddVersion() { return TVersion(1, 0, 1); }
+
+/* The name of the analyze tool device driver*/
+_LIT( KAnalyzeToolLddName, "AToolKernelEventHandler" );
+
+/* The priority of AnalyzeTool Dfc */
+const TInt KAnalyzeToolThreadPriority = 27;
+
+/* The name of the AnalyzeTool DFC */
+_LIT8( KAnalyzeToolThreadName, "AnalyzeToolThreadDfc" );
+
+/* The panic literal */
+_LIT( KClientPanic, "AnalyzeTool" );
+
+//const TInt KATMaxCallstackLength = 20;
+
+/* The device handler panic codes */
+enum TPanic
+	{
+	EPanicRequestPending,
+	EPanicNoRequestPending,
+	EPanicUnsupportedRequest
+	};
+
+// Size of following must be multiple of 4 bytes.
+
+class TMainThreadParams
+	{
+	public:
+		RAllocator* iAllocator;
+		TBool       iAlone;
+		TUint       iProcessId;
+	};
+typedef TPckgBuf<TMainThreadParams> TMainThreadParamsBuf;
+
+class TLibraryInfo
+	{
+	public:
+		TBuf8<KMaxLibraryName> iLibraryName;
+		TLinAddr  iRunAddress;
+		TUint32   iSize;
+		TInt      iIndex;
+		TUint     iProcessId;
+	};
+
+typedef TPckgBuf<TLibraryInfo> TLibraryInfoBuf;
+
+class TCodesegInfo
+	{
+	public:
+		TBuf8<KMaxLibraryName> iFullName;
+		TLinAddr iRunAddress;
+		TUint32  iSize;
+		TInt  iIndex;
+		TUint iProcessId;
+		TInt  iCodesegIndex; 
+		TLinAddr iFileEntryPoint;
+		TInt     iFuntionCount;
+		TLibraryFunction iFirstFunction;
+		TModuleMemoryInfo iMemoryInfo;
+	};
+
+typedef TPckgBuf<TCodesegInfo> TCodesegInfoBuf;
+
+class TThreadParams
+	{		
+	public:
+	    TLinAddr iStackAddress;
+	    TInt iStackSize;
+	    TUint iThreadId;
+	};
+
+typedef TPckgBuf<TThreadParams> TThreadParamsBuf;
+
+class TProcessIdentityParams
+	{		
+	public:
+		TBuf8<KMaxProcessName> iProcessName;
+		TInt iDynamicCount;
+		TInt iCodesegCount;
+		TUint iProcessId;
+		TUint iThreadId;
+	    TLinAddr iStackAddress;
+	    TInt iStackSize;
+	};
+
+typedef TPckgBuf<TProcessIdentityParams> TProcessIdentityParamsBuf;
+
+class TLibraryEventInfo
+	{
+	public:
+		enum TLibraryEvent
+			{ 
+			ELibraryAdded = 0, 
+			ELibraryRemoved,
+			EKillThread 
+			};
+					
+	public:
+		TUint iProcessId;
+		TBuf8<KMaxLibraryName> iLibraryName;
+		TLinAddr iRunAddress;
+		TUint32 iSize;
+		TLibraryEvent iEventType;
+		TUint iThreadId;
+	};
+
+typedef TPckgBuf<TLibraryEventInfo> TLibraryEventInfoBuf;
+
+class TProcessHandleInfo
+	{
+	public:
+		TInt     iProcessHandleCount;
+		TInt     iThreadHandleCount;
+		TInt     iIndex;
+		TInt     iThreadCount;
+		TLinAddr iUserStackRunAddress;
+		TInt     iUserStackSize;
+		TUint    iProcessId;
+	};
+
+typedef TPckgBuf<TProcessHandleInfo> TProcessHandleInfoBuf;
+
+/**
+*  A class for particular process's current handle count
+*/
+class TATProcessHandles
+    {
+    public:
+    
+        /** The ID of the process. */
+        TUint iProcessId;
+        
+        /** The number of current handles in the library. */
+        TInt iCurrentHandleCount;
+    };
+
+typedef TPckgBuf<TATProcessHandles> TATProcessHandlesBuf;
+
+class TClientCount
+    {
+    public:
+    
+        /** The count of clients */
+        TInt iClientCount;     
+    };
+
+typedef TPckgBuf<TClientCount> TClientCountBuf;
+
+class TATMemoryModel
+    {
+    public :
+        /* Memory model*/
+        TUint32 iMemoryModel;
+    };
+typedef TPckgBuf<TATMemoryModel> TATMemoryModelBuf;
+
+// CLASS DECLARATION
+
+/**
+*  The user-side handle to a logical channel which provides functions to 
+*  open a channel and to make requests to a analyze tool device driver. 
+*/
+
+class RAnalyzeTool : public RBusLogicalChannel
+	{
+	
+	public:
+		
+	/** Enumeration of supported functions */
+	enum TBasicAnalyzerControl
+		{
+		EGetProcessInfo = 0, /* The process information */
+		EGetCodesegInfo,	 /* The codesegment information */
+		EGetLibraryInfo,     /* The library information */
+		EGetDynamicInfo,	 /* The count of dynamic code in the process */
+		ELibraryEvent,       /* Subscribe events from library events */
+		ECancelLibraryEvent, /* Cancel subscribetion of library events */
+		ECurrentClientCount,  /* The count of clients in device driver */
+		EMainThreadAlloctor,
+		EThreadStack,
+		EGetProcessHandle,	/* Gets process global handles info*/
+		EGetCurrentHandles, /* Get a process's current handle count */
+		EGetMemoryModel
+		};
+			
+#ifndef __KERNEL_MODE__
+
+        /**
+        * Opens a handle to a logical channel.
+        * @return TInt Returns KErrNone, if successful or otherwise 
+        		  one of the other system-wide error codes
+        */
+		inline TInt Open();
+
+        /**
+        * Acquires process information.
+        * @param aProcessIdentityParams The process information which 
+        								is filled by the device driver
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		inline TInt GetProcessInfo( 
+				TProcessIdentityParamsBuf& aProcessIdentityParams );
+
+        /**
+        * Acquires codeseg information.
+        * @param aCodesegInfo The codeseg information which 
+        					  is filled by the device driver
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		inline TInt GetCodesegInfo( TCodesegInfoBuf& aCodesegInfo );
+		
+        /**
+        * Acquires library information.
+        * @param aLibraryInfo The library information which 
+        					  is filled by the device driver
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		inline TInt GetLibraryInfo( TLibraryInfoBuf& aLibraryInfo );
+				
+        /**
+        * Subscribes library event.
+        * @param aStatus The request status object for this request. 
+        * @param aLibraryInfo The library information which 
+        					  is filled by the device driver
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		inline void LibraryEvent( TRequestStatus& aStatus, 
+		                          TLibraryEventInfo& aLibraryInfo );
+		
+        /**
+        * Cancels subscribetion of the library event.
+        */
+		inline void CancelLibraryEvent();
+
+        /**
+        * Acquires device driver current client count.
+        * @param aClientCount A reference to TInt which is 
+        				      updated by the device driver.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		inline TInt ClientCount( TClientCountBuf& aClientCount );
+		
+        /**
+        * Acquires process main thread RAllocator
+        * @param aMainThreadParams The main thread information which 
+        					        is filled by the device driver
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */	
+		inline TInt MainThreadAlloctor( TMainThreadParamsBuf& aMainThreadParams );
+		
+		/**
+		* Acquires main thread stack address.
+		* @param aThreadStack Pointer to the TThreadParams object.
+		* @return TInt Returns KErrNone, if successful
+					   otherwise one of the other system-wide error codes
+		*/
+		inline TInt ThreadStack( TThreadParamsBuf& aThreadStack );
+
+        /**
+        * Acquires information about process global handles.
+        * @param aProcessHandleInfo Pointer to the TProcessHandleInfo object.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		inline TInt GetProcessHandleInfo( TProcessHandleInfoBuf& aProcessHandleInfo );
+
+        /**
+        * Acquires a process's current handle count.
+        * @param aProcessHandles Pointer to the TATProcessHandles object.
+        * @return TInt Returns KErrNone, if successful
+                       otherwise one of the other system-wide error codes
+        */
+        inline TInt GetCurrentHandleCount( TATProcessHandlesBuf& aProcessHandles );
+
+        /**
+         * Acquires memory model system uses.
+         * @param aMemoryModel pointer to the TATMemoryModelBuf object.
+         */
+        inline TInt GetMemoryModel( TATMemoryModelBuf& aMemoryModel );
+        
+#endif // #ifndef __KERNEL_MODE__
+	};
+
+// INLINES
+#include <analyzetool/analyzetool.inl>
+
+#endif // #ifndef __ANALYZETOOL_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.inl	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* 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:  Definitions for inline methods of the class RAnalyzeTool.
+*
+*/
+
+
+#ifndef __ANALYZETOOL_INL
+#define __ANALYZETOOL_INL
+
+#ifndef __KERNEL_MODE__
+
+// ----------------------------------------------------------------------------
+// RAnalyzeTool::Open()
+// Opens a handle to a analyze tool device driver
+// ----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeTool::Open()
+	{
+	return DoCreate( KAnalyzeToolLddName, 
+					 KAnalyzeToolLddVersion(), 
+					 KNullUnit, 
+					 NULL, 
+					 NULL, 
+					 EOwnerProcess );
+	}
+
+// ----------------------------------------------------------------------------
+// RAnalyzeTool::GetProcessInfo()
+// Acquires process information.
+// ----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeTool::GetProcessInfo( 
+		TProcessIdentityParamsBuf& aProcessIdentityParams )
+	{
+	return DoControl( EGetProcessInfo, &aProcessIdentityParams, NULL );
+	}
+
+// ----------------------------------------------------------------------------
+// RAnalyzeTool::GetCodesegInfo()
+// Acquires codeseg information.
+// ----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeTool::GetCodesegInfo( TCodesegInfoBuf& aCodesegInfo )
+	{
+	return DoControl( EGetCodesegInfo, &aCodesegInfo, NULL );
+	}
+
+// ----------------------------------------------------------------------------
+// RAnalyzeTool::GetLibraryInfo()
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeTool::GetLibraryInfo( TLibraryInfoBuf& aLibraryinfo )
+	{
+	return DoControl( EGetLibraryInfo, &aLibraryinfo, NULL );
+	}
+
+// ----------------------------------------------------------------------------
+// RAnalyzeTool::LibraryEvent()
+// Subscribes library event.
+// ----------------------------------------------------------------------------
+//
+inline void RAnalyzeTool::LibraryEvent( TRequestStatus& aStatus,
+	TLibraryEventInfo& aLibInfo )
+	{
+	return DoRequest( ELibraryEvent, aStatus, (TAny*)&aLibInfo );
+	}
+
+// ----------------------------------------------------------------------------
+// RAnalyzeTool::CancelLibraryEvent()
+// Cancels subscribetion of the library event.
+// ----------------------------------------------------------------------------
+//
+inline void RAnalyzeTool::CancelLibraryEvent()
+	{
+	DoControl( ECancelLibraryEvent, NULL, NULL);
+	}
+
+// ----------------------------------------------------------------------------
+// RAnalyzeTool::ClientCount()
+// Acquires the count of device driver current users
+// ----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeTool::ClientCount( TClientCountBuf& aClientCount )
+	{
+	return DoControl( ECurrentClientCount, &aClientCount, NULL );
+	}
+
+// ----------------------------------------------------------------------------
+// RAnalyzeTool::MainThreadAlloctor()
+// Acquires information about process main thread
+// ----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeTool::MainThreadAlloctor( 
+	        TMainThreadParamsBuf& aMainThreadParams )
+    {
+    return DoControl( EMainThreadAlloctor, &aMainThreadParams, NULL );
+    }
+
+// ----------------------------------------------------------------------------
+// RAnalyzeTool::ThreadStack()
+// Acquires main thread stack address.
+// ----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeTool::ThreadStack( TThreadParamsBuf& aThreadStack )
+    {
+    return DoControl( EThreadStack, &aThreadStack, NULL );
+    }
+
+// ----------------------------------------------------------------------------
+// RAnalyzeTool::GetProcessHandleInfo()
+// Acquires information about process handles
+// ----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeTool::GetProcessHandleInfo( 
+		    TProcessHandleInfoBuf& aProcessHandleInfo )
+    {
+    return DoControl( EGetProcessHandle, &aProcessHandleInfo, NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::GetCurrentHandleCount()
+// Acquires a process's current handle count
+// -----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeTool::GetCurrentHandleCount( 
+		    TATProcessHandlesBuf& aProcessHandles )
+    {
+    return DoControl( EGetCurrentHandles, &aProcessHandles, NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::GetMemoryModel()
+// Acquires memory model system uses.
+// -----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeTool::GetMemoryModel( 
+            TATMemoryModelBuf& aMemoryModel )
+    {
+    return DoControl( EGetMemoryModel, &aMemoryModel, NULL );
+    }
+
+#endif // #ifndef __KERNEL_MODE__
+
+#endif // __ANALYZETOOL_INL
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetoolcleaner.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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:  Definitions for the class TAnalyzeToolCleanerBase.
+*
+*/
+
+#ifndef __ANALYZETOOLCLEANER_H__
+#define __ANALYZETOOLCLEANER_H__
+
+// INCLUDES
+#include <e32std.h>
+
+// CONSTANTS
+#define ATCLEANERTABLESIZE 10
+#define ATCLEANERTABLE TFixedArray<TUint32, ATCLEANERTABLESIZE>
+_LIT( KATCleanerDllName, "atoolcleaner.dll" );
+
+// CLASS DECLARATION
+
+/**
+*  Cleaner base class
+*/
+class TAnalyzeToolCleanerBase
+    {
+public:
+    /**
+    * Cleanup function which uninstall allocator
+    */
+    virtual void Cleanup() = 0;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  Cleaner class
+*/
+class THookCleaner
+    {
+public:
+    /**
+    * C++ default constructor.
+    */
+    THookCleaner();
+    
+    /**
+    * Destructor.
+    */
+    ~THookCleaner();
+    
+    ATCLEANERTABLE iTable;
+    };
+#endif // __ANALYZETOOLCLEANER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetooltraceconstants.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* 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:  Common declarations/definitions for Analyze Tool.
+*
+*/
+
+#ifndef __ANALYZETOOLTRACECONSTANTS_H__
+#define __ANALYZETOOLTRACECONSTANTS_H__
+
+#include <analyzetool/atcommon.h>
+
+// Trace version information.
+const TUint KATTraceVersion = 0x3;
+
+// The default logging mode 
+const TATLogOption KDefaultLoggingMode = EATLogToTraceFast;
+
+// When needed, update the data file's version number directly inside
+// the _LIT8 macro. Note, if you change this string, also remember to update
+// the constant "KVersionStringLength" below.
+
+_LIT8( KDataFileVersion, "ATOOL_BINARY_FILE_VERSION 1\n" );
+_LIT( KOpenSquareBracket, "[" );
+_LIT( KCloseSquareBracket, "]" );
+_LIT( KUnderLine, "_" );
+_LIT( KLeftBracket, "(" );
+_LIT( KRightBracket, ")" );
+
+_LIT8( KSpace, " " );
+_LIT8( KUdeb, "UDEB" );
+_LIT8( KUrel, "UREL" );
+    
+// Constants for logging through debug channel
+
+// remember to change length of KTagLength when length of constants changes
+
+_LIT8( KATIdentifier, "<AT> " );
+_LIT8( KProcessStart, "PCS " );
+_LIT8( KProcessEnd, "PCE " );
+_LIT8( KVersionsInfo, "DEVINFO ");
+_LIT8( KThreadStart, "TDS " );
+_LIT8( KThreadEnd, "TDE " );
+_LIT8( KDllLoad, "DLL " );
+_LIT8( KDllUnload, "DLU " );
+_LIT8( KTestStart, "TSS " );
+_LIT8( KTestEnd, "TSE " );
+_LIT8( KHandleLeak, "HDL " );
+_LIT8( KLoggingCancelled, "LGC " );
+_LIT8( KErrorOccured, "ERR " );
+_LIT8( KMemoryAllocHeader, "ALH " );
+_LIT8( KMemoryAllocFragment, "ALF " );
+_LIT8( KMemoryFreedHeader, "FRH " );
+_LIT8( KMemoryFreedFragment, "FRF " );
+_LIT8( KMemoryReallocHeader, "RAH " );
+_LIT8( KMemoryReallocFragment, "RAF " );
+
+//to be implemented on carbide side (was logged from storage server/ carbide extension)
+//_LIT( KSubtestStart, "TEST_START " );
+//_LIT( KSubtestEnd, "TEST_END " );
+
+// File name format
+_LIT( KFormat, "%S%S%02d%S%S");// pad char="0", field width=2
+
+// A string for setting time January 1st, 1970 AD nominal Gregorian
+_LIT( KJanuaryFirst1970, "19700000:000000.000000" );
+
+
+// todo
+// Module name when it cannot be defined
+// was used in "handle leak" message - always unknown
+//_LIT8( KUnknownModule, "Unknown" );
+
+// Constant time variable used to calculate timestamps for pc side.
+const TInt64  KMicroSecondsAt1970 = 62168256000000000;
+
+// The length of the string KDataFileVersion
+const TInt KVersionStringLength = 27;
+
+// The maximum length of one word (32 bits) represented in the hexadecimal text format
+// without "0x" prefix
+const TInt KHexa32Length = 8;
+
+// The maximum length of one word (32 bits) represented in the decimal text format
+const TInt KDec32Length = 10;
+
+// The maximum length of a TInt64 represented in the hexadecimal text format without
+// "0x" prefix
+const TInt KHexa64Length = 16;
+
+// The length of one space character in text
+const TInt KSpaceLength = 1;
+
+// The length of the AT message identifier with one space character ("<AT> ")
+const TInt KATIdentifierLength = 5;
+
+// The length of the tag with one space character (e.g. "FRH ")
+const TInt KTagLength = 4;
+
+// The length of atool version string (x.x.x)
+const TInt KAtoolVersionLength = 6;
+
+// The length of api version string (x.x.x)
+const TInt KApiVersionLength = 5;
+
+// The length of sw version version string
+const TInt KSwVersionLength = 64;
+
+// The length of the combination atId+processId+msgTag (<AT> NNN PCS )
+const TInt KTraceHeaderLength = KATIdentifierLength + KHexa32Length + KSpaceLength + KTagLength;
+
+// Max length of alloc, free, realloc last item (callstack adress)
+const TInt KLastItemLength = KHexa32Length + KSpaceLength;
+
+// The maximum length of the process start (PCS) buffer
+// <<AT>> <Process ID> PCS <Process name> <Time stamp> <Udeb> <Version>
+const TInt KProcessStartBufLength = KTraceHeaderLength + 
+									KMaxProcessName + KSpaceLength + 
+									KHexa32Length + KSpaceLength + 
+									KHexa64Length + KSpaceLength +
+									KHexa32Length;
+
+// The maximum length of the versions info (VER) buffer
+// <<AT>> <Process ID> VER <AT version> <API version> <S60 version> <ROM ID>
+const TInt KVersionsInfoBufLength = KTraceHeaderLength + 
+		                            KAtoolVersionLength + KSpaceLength +
+		                            KApiVersionLength + KSpaceLength +
+									KSwVersionLength + KSpaceLength + 
+									KHexa32Length;
+
+// The maximum length of the process end PCE buffer
+// <<AT>> <Process ID> PCE
+const TInt KProcessEndBufLength = KTraceHeaderLength;
+
+// The maximum length of the load dll (DLL) buffer
+// <<AT>> <Process ID> DLL <DLL name> <Memory start address> <Memory end address>
+const TInt KDllLoadBufLength = KTraceHeaderLength +
+		                       KMaxLibraryName + KSpaceLength +
+		                       KHexa32Length + KSpaceLength + 
+		                       KHexa32Length;
+
+// The maximum length of the unload dll (DLU) buffer
+// <<AT>> <Process ID> DLU <DLL name> <Memory start address> <Memory end address>
+const TInt KDllUnloadBufLength = KTraceHeaderLength + 
+		                         KMaxLibraryName + KSpaceLength +
+		                         KHexa32Length + KSpaceLength + 
+		                         KHexa32Length;
+        
+// The maximum length of the error (ERR) buffer
+// <<AT>> <Process ID> ERR <Thread ID> <Error code> <Error message> 
+const TInt KErrOccuredBufLength = KTraceHeaderLength +
+		                          KHexa64Length + KSpaceLength +
+		                          KHexa32Length + KSpaceLength +
+		                          200; //err message length
+                                        
+// The maximum length of the alloc "ALH /ALF" buffer. 
+const TInt KMemAllocBufLength = 255;
+
+// The maximum length of the free "FRH/FRF" buffer.
+const TInt KMemFreedBufLength = 255;
+
+// The maximum length of the realloc "REH/REF" buffer.
+const TInt KMemReallocBufLength = 255;
+
+// The maximum length of the handle leak "HDL" buffer
+// <<AT>> <Process ID> HDL <Handle count>
+const TInt KHandleLeakBufLength = KTraceHeaderLength +
+                                  KHexa32Length;
+                                        
+// The maximum length of the test satart "TSS" buffer
+// <<AT>> <Process ID> TSS <Sub test name> <Handle count>
+const TInt KTestStartBufLength = KTraceHeaderLength +
+                                 KATMaxSubtestIdLength + KSpaceLength +
+                                 KHexa64Length;
+
+// The maximum length of the test end (TSE) buffer
+// <<AT>> <Process ID> TSE <Sub test name> <Handle count>
+const TInt KTestEndBufLength = KTraceHeaderLength + 
+		                       KATMaxSubtestIdLength + KSpaceLength + 
+		                       KHexa64Length;
+
+// The maximum length of the thread start (TDS) buffer.
+// <<AT>> <Process ID> TDS <Thread ID>
+const TInt KThreadStartBufLength = KTraceHeaderLength +
+                                   KHexa64Length; 
+
+
+// The maximum length of the thread end (TDE) buffer.
+// <<AT>> <Process ID> TDE <Thread ID>
+const TInt KThreadEndBufLength = KTraceHeaderLength +
+                                 KHexa64Length; 
+
+// The maximun length of the file name extension buffer.
+const TInt KExtensionLength = 50;
+
+// The maximun length of the process UID3 buffer.
+const TInt KProcessUidLength = 20;
+
+#endif // __ANALYZETOOLTRACECONSTANTS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/atcommon.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* 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:  Common declarations/definitions for Analyze Tool.
+*
+*/
+
+
+#ifndef ATCOMMON_H_
+#define ATCOMMON_H_
+
+// CONSTANTS
+const TInt KATMaxCallstackLength = 256;
+const TInt KATMaxFreeCallstackLength = 256;
+const TInt KATMaxSubtestIdLength = 256;
+
+// The following constants only limit the configuration UI.
+// The bigger the number is, the more space will be allocated run-time
+// by the client. So, change with care.
+const TInt KATMaxProcesses = 20;
+const TInt KATMaxDlls = 30;
+
+// Constants defining call stack address range in multiple memory model.
+const TInt32 KATMultipleMemoryModelLowLimit = 0x70000000;
+const TInt32 KATMultipleMemoryModelHighLimit = 0x90000000;
+
+
+// CLASS DECLARATIONS
+
+/**
+*  A class for storing process information
+*/
+class TATProcessInfo
+    {
+    public:
+    
+        /** The ID of the process. */
+        TUint iProcessId;
+        
+        /** The name of the process. */
+        TBuf8<KMaxProcessName> iProcessName;
+        
+        /** The starting time of the process. */
+        TInt64 iStartTime;
+    };
+
+
+// ENUMERATIONS
+
+/**
+*  Enumeration for different logging modes of Analyze Tool 
+*/
+enum TATLogOption
+    {
+    /** Using the default. */
+    EATUseDefault = 0,
+    
+    /** Logging to a file in S60. */
+    EATLogToFile,
+    
+    /** Logging to debug channel. */
+    EATLogToTrace,
+    
+    /** Logging to debug channel bypassing storage server. */
+    EATLogToTraceFast,
+    
+    /** Logging switched off. */
+    EATLoggingOff
+    };
+
+/**
+*  Class which supports interfacing with AnalyzeTool exported
+*  functions. Mainly meant for STIF integration.
+*/
+class AnalyzeToolInterface
+    {
+    public:
+
+        /**
+        * This function starts subtest with a given name.
+        * @param aSubtestId The name identifying this particular sub test. The length
+        *   of this descriptor must not be greater than KATMaxSubtestIdLength, or
+        *   otherwise the method raises a STSEClient: 2 panic.
+        */
+        IMPORT_C static void StartSubTest( const TDesC8& aSubtestId );
+
+        /**
+        * This function stops a subtest with a given name.
+        * @param aSubtestId The name identifying this particular sub test. The length
+        *   of this descriptor must not be greater than KATMaxSubtestIdLength, or
+        *   otherwise the method raises a STSEClient: 2 panic. 
+        */   
+        IMPORT_C static void StopSubTest( const TDesC8& aSubtestId );
+
+    };
+    
+
+#endif /*ATCOMMON_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/customuser.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,218 @@
+/*
+* 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:  Declaration of the class CustomUser containing overloaded User static functions.
+*
+*/
+
+
+#ifndef CUSTOMUSER_H
+#define CUSTOMUSER_H
+
+// INCLUDES
+#include <u32std.h>
+#include <e32svr.h>
+
+// CONSTANTS
+const TInt KATVersionLength = 20;
+const TInt KATDefaultLogOption = 0;
+const TInt KATDefaultDebug = 1;
+const TInt KATDefaultAllocCallStackSize = 40;
+const TInt KATDefaultFreeCallStackSize = 0;
+    
+// TYPEDEFS
+typedef TBuf<KATVersionLength> TATVersion;
+
+// Argument list for SetupThreadHeap function parameters. (currently not used)
+// When needed, update the argument type directly inside _LIT macro.
+_LIT( KATArgumentList, "%i%i" ); //etc. 
+
+// CLASS DECLARATION
+
+/**
+*  Class which overloads the User functions and provides access to 
+*  the overloaded functions  
+*/
+class CustomUser
+    {
+    public: // Enumerations
+        enum TATOptions
+            {
+            /** Acquiring the log filename */
+            ELogFileName = 1,   
+            /** Acquiring the version number */
+            EVersion,
+            /** Acquiring logging option */
+            ELogOption,
+            /** Acquiring UDEB/UREL information */  
+            EDebug,
+            /** Acquiring max allocation call stack size */
+            EAllocCallStackSize,
+            /** Acquiring max free call stack size */
+            EFreeCallStackSize,
+            /** Acquiring the path of logfile */
+            ELogFilePath
+            };
+        
+    public:
+
+        /**
+        * Overloaded version of User::Exit()
+        * Terminates the current thread, specifying a reason. All child 
+        * threads are terminated and all resources are cleaned up.If the 
+        * current thread is the main thread in a process, the process is
+        * also terminated.
+        * @param aReason The reason code.
+        */
+        IMPORT_C static void Exit( TInt aReason );
+
+        /**
+        * Overloaded version of User::Panic()
+        * Panics the current thread, specifying a category name and panic
+        * number. Keep the length of the category name small;
+        * a length of 16 is ideal.
+        * @param aCategory A reference to the descriptor containing the text 
+        * that defines the category for this panic.
+        * @param aReason The panic number. 
+        */   
+        IMPORT_C static void Panic( const TDesC& aCategory, TInt aReason );
+
+        /**
+        * Overloaded version of UserHeap::SetupThreadHeap()
+        * Setups the threads heap.
+        * @param aNotFirst Is this first thread using specified heap
+        * @param aInfo Specifies the thread heap properties
+        * @param aFileName The name of the log file
+        * @param aLogOption The logging option
+        * @param aIsDebug Determines whether a binary is UDEB or UREL
+        * @param aVersion Atool version number
+        * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
+        * @param aFreeCallStackSize Max number of stored callstack items when memory freed
+        * @param aFmt A descriptor containing the format string
+        * @return TInt KErrNone, if the insertion is successful, otherwise 
+        * one of the system wide error codes.
+        */   
+        IMPORT_C static TInt SetupThreadHeap( 
+                             TBool aNotFirst, 
+                             SStdEpocThreadCreateInfo& aInfo,
+                             const TFileName& aFileName,
+                             const TPath& aFilePath,
+                             TUint32 aLogOption, TUint32 aIsDebug,
+                             const TATVersion& aVersion,
+                             TUint32 aAllocCallStackSize,
+                             TUint32 aFreeCallStackSize,
+                             TRefByValue<const TDesC> aFmt, ... );
+                             
+        /**
+        * Overloaded version of UserHeap::SetCritical()
+        * Sets up or changes the effect that termination of the current 
+        * thread has, either on its owning process, or on the whole system.
+        * The precise effect of thread termination is defined by the following
+        *  specific values of the TCritical enum:
+        * ENotCritical
+        * EProcessCritical
+        * EProcessPermanent
+        * ESystemCritical
+        * ESystemPermanent
+        * Notes: The enum value EAllThreadsCritical cannot be set using this
+        * function. It is associated with a process, not a thread, and, if 
+        * appropriate, should be set using User::SetProcessCritical().
+        * The states associated with ENotCritical, EProcessCritical, 
+        * EProcessPermanent, ESystemCritical and ESystemPermanent are all 
+        * mutually exclusive, i.e. the thread can only be in one of these 
+        * states at any one time.
+        * @param aCritical The state to be set.
+        * @return TInt KErrNone, if successful; KErrArgument, if 
+        * EAllThreadsCritical is passed - this is a state associated with a 
+        * process, and you use User::SetProcessCritical() to set it.
+        */ 
+        IMPORT_C static TInt SetCritical( User::TCritical aCritical );
+        
+        /**
+        * Overloaded version of UserHeap::SetCritical()
+        * Sets up or changes the effect that termination of subsequently 
+        * created threads will have, either on the owning process, 
+        * or on the whole system. It is important to note that we are not
+        * referring to threads that have already been created, but threads
+        * that will be created subsequent to a call to this function.
+        * The precise effect of thread termination is defined by the following
+        * specific values of the TCritical enum:
+        * ENotCritical
+        * EAllThreadsCritical
+        * ESystemCritical
+        * ESystemPermanent
+        * Notes:
+        * The enum values EProcessCritical and EProcessPermanent cannot be set
+        * using this function. They are states associated with a thread, not a
+        * process, and, if appropriate, should be set using 
+        * User::SetCritical(). The states associated with ENotCritical, 
+        * EAllThreadsCritical, ESystemCritical and ESystemPermanent are all 
+        * mutually exclusive, i.e. the process can only be in one of these 
+        * states at any one time.
+        * @param aCritical The state to be set.
+        * @return TInt KErrNone, if successful; KErrArgument, if either 
+        * EProcessCritical or EProcessPermanent is passed - these are states
+        * associated with a thread, and you use User::SetCritical() 
+        * to set them.
+        */ 
+        IMPORT_C static TInt SetProcessCritical( User::TCritical aCritical );
+                
+    private: // Private functions
+        
+        /**
+        * Factory function for creating RAllocator instances.
+        * @param aNotFirst Is this first thread using specified heap
+        * @param aLogOption The logging option
+        * @param aFileName The name of the logging file
+        * @param aIsDebug Determines whether a binary is UDEB or UREL
+        * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
+        * @param aFreecallStackSize Max number of stored callstack items when memory freed
+        * @param aAtoolVersion Version of atool
+        * @param aApiVersion  Version of atool's api
+        * @return RAllocator& A reference to created allocator
+        */  
+        static RAllocator& InstallAllocator( TBool aNotFirst,
+                                             const TFileName& aFileName,
+                                             const TPath& aFilePath,
+                                             TUint32 aLogOption, TUint32 aIsDebug,
+                                             TUint32 aAllocCallStackSize,
+                                             TUint32 aFreeCallStackSize, 
+                                             const TDesC8& aAtoolVersion,
+                                             const TDesC8& aApiVersion );
+        
+		/**
+		* Check atool version
+		* @param aVersion - Atool version number.
+		* @param aToolVersion The atool version number
+		* @return KErrNone if correct version found, otherwise one of the system wide 
+		* error codes.
+		*/
+        static TInt CheckVersion( const TATVersion& aVersion, TDes& aToolVersion, TDes& aApiVersion ); 
+        
+
+        /**
+		* Function for showing incorrect version information (file or debug channel).
+		* @param aLogOption The logging option
+		* @param aFileName The name of the log file
+		* @param aToolVersion The atool version number
+		*/
+        static void ReportIncorrectVersion( const TUint32 aLogOption, 
+											const TFileName& aFileName,
+											const TPath& aFilePath,
+											const TDes& aToolVersion );
+        
+    };
+
+#endif // CUSTOMUSER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetool_plat/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +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: 
+*
+*/
+
+// Analyze Tool API
+#include "../analyzetool_api/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetoolcleaner/bwins/atoolcleaneru.def	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?GetCallBackAddress@@YAPAV?$TFixedArray@K$09@@XZ @ 1 NONAME ; class TFixedArray<unsigned long, 10> * GetCallBackAddress(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetoolcleaner/eabi/atoolcleaneru.def	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z18GetCallBackAddressv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetoolcleaner/group/analyzetoolcleaner.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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:  The .mmp file for atoolcleaner.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET			atoolcleaner.dll
+TARGETTYPE	  	dll
+UID 			0x1000008d 0x2002DC71
+CAPABILITY		ALL -TCB
+EPOCALLOWDLLDATA
+
+SMPSAFE
+
+SOURCEPATH  ../src
+SOURCE analyzetoolcleaner.cpp
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../inc
+USERINCLUDE   ../../analyzetool_plat/analyzetool_api/inc/analyzetool
+
+OS_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY flogger.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetoolcleaner/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* 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:  
+*
+*/
+
+PRJ_PLATFORMS
+ARMV5 WINSCW
+
+PRJ_MMPFILES
+analyzetoolcleaner.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/analyzetoolcleaner/src/analyzetoolcleaner.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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:  THookCleaner implementation
+*
+*/
+
+// INCLUDES
+#include "analyzetoolcleaner.h"
+#include <e32debug.h>
+#include "atlog.h"
+
+// Global cleaner object
+static THookCleaner cleaner;
+
+// ordinal 1
+EXPORT_C ATCLEANERTABLE* GetCallBackAddress()
+    {
+    LOGSTR1( "ATC GetCallBackAddress()" );
+    
+    return &( cleaner.iTable );
+    }
+
+// -----------------------------------------------------------------------------
+// THookCleaner::THookCleaner()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+THookCleaner::THookCleaner()
+    {
+    LOGSTR1( "ATC THookCleaner::THookCleaner()" );
+    
+    iTable.Reset();
+    }
+
+// -----------------------------------------------------------------------------
+// THookCleaner::~THookCleaner()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+THookCleaner::~THookCleaner()
+    {
+    LOGSTR1( "ATC THookCleaner::~THookCleaner()" );
+    
+    for ( TUint i = 0; i < ATCLEANERTABLESIZE; i++ )
+        {
+        if ( iTable.At( i ) )
+            {
+            TAnalyzeToolCleanerBase* obj =
+                    ( TAnalyzeToolCleanerBase* ) iTable.At( i );
+            obj->Cleanup();
+            }
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/group/atool.vcproj	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,387 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="atool"
+	ProjectGUID="{2C50DD86-958B-4189-8DA2-DB388C71F65F}"
+	RootNamespace="atool"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderThrough="..\inc\stdafx.h"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\lib\xerces-c_2.lib ..\lib\dbghelp.lib Version.lib"
+				OutputFile="..\install\atool.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/atool.pdb"
+				SubSystem="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="0"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\lib\xerces-c_2.lib ..\lib\dbghelp.lib Version.lib"
+				OutputFile="..\install\atool.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\src\arguments.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\atool.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\cataddr2line.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\cataddr2lineserver.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\catalloc.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\catallocs.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATBase.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATDataSaver.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATDatParser.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\catdbghelper.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\catfilereader.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATMemoryAddress.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATMmp.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATModule2.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATParseBinaryFile.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATParseTraceFile.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATParseXML.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATProject.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\catromsymbol.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\helps.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\librarychecks.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\stdafx.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\utility.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\src\version.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\inc\ATCommonDefines.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\cataddr2line.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\cataddr2lineserver.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\catalloc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\catallocs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\CATBase.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\CATDataSaver.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\CATDatParser.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\catdbghelper.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\catfilereader.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\CATMemoryAddress.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\CATMmp.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\CATModule2.h"
+				>
+			</File>
+			<File
+				RelativePath="..\src\CATParseBinaryFile.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\CATParseTraceFile.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\CATParseXML.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\CATProcessData.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\CATProject.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\catromsymbol.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\iaddresstoline.h"
+				>
+			</File>
+			<File
+				RelativePath="..\inc\stdafx.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* 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: 
+*
+*/
+
+
+PRJ_EXPORTS
+../install/atool.exe          +/tools/
+../install/addr2line.exe      +/tools/
+../install/xerces-c_2_7.dll   +/tools/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/ATCommonDefines.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,655 @@
+/*
+* 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:  Common defines for cpp files.
+*
+*/
+
+
+#ifndef __ATCOMMONDEFINES_H__
+#define __ATCOMMONDEFINES_H__
+
+#include "../inc/stdafx.h"
+
+using namespace std;
+
+#define MAIN_ID "<AT>"
+#define ALLOC_ID "ALLOC" // < V.1.6 allocation. // todo remove
+#define ALLOCH_ID "ALH" // Header of multi message allocation.
+#define ALLOCF_ID "ALF" // Fragment of multi message allocation.
+#define REALLOCH_ID "RAH" // Header of multi message reallocation.
+#define REALLOCF_ID "RAF" // Fragment of multi message reallocation.
+#define FREE_ID "FREE"
+#define FREEH_ID "FRH" // Header of multi message free.
+#define FREEF_ID "FRF" // Fragment of multi message free.
+#define HANDLE_LEAK_ID "HANDLE_LEAK"
+
+const string ERROR_OCCURED = "ERR"; // Error messages.
+const string INCORRECT_ATOOL_VERSION = "INCORRECT_ATOOL_VERSION";
+
+// if changed, change also in analyzetoolfilelog.h
+enum EMessageType{
+    EFileVersion = 0,
+	EProcessStart,
+    EProcessEnd,
+    EThreadStart,
+	EThreadEnd,
+	EDllLoad,
+	EDllUnload,
+	EAllocH,
+	EAllocF,
+	EFreeH,
+	EFreeF,
+	EReallocH,
+	EReallocF,
+	ETestStart,
+	ETestEnd,
+	EHandleLeak,
+	EDeviceInfo,
+	EError  
+    };
+
+/**
+* Invalid characters in trace file line content.
+* These will be filtered out before actuall parsing of line.
+10 = LF
+13 = CR
+124 = |
+*/
+const char cINVALID_TRACE_FILE_CHARS[] = { 10, 13, 124 };
+
+/**
+* Atool return code.
+*/
+struct AT_RETURN_CODE {
+	/**
+	* Enumeration containing all return codes used by atool.
+	* When error happens this value set as the exit code.
+	* Note! Values can be only added not modified/deleted.
+	*/
+	enum RETURN_CODE {
+		/* basic */
+		OK = 0,							/** All ok. */
+		INVALID_ARGUMENT_ERROR = 1,		/** Arguments failty. */
+		AT_LIBS_MISSING = 2,			/** Missing at libraries cannot compile hooked apps. */
+		CANNOT_FIND_EPOCROOT = 3,		/** Epocroot not set. */
+		UNHANDLED_EXCEPTION = 4,		/** General return code when unhandled exception occurs. */
+		/* compile errors */
+		MAKEFILE_ERROR = 5,				/** Cannot read/create etc makefiles sbs1/2. */
+		COMPILE_ERROR = 6,				/** Some error related to compilation of code. */
+		UNKNOWN = 7,					/** General compilation error not specific. */
+		NO_SUPPORTED_MODULES_ERROR = 8,	/** Cannot find supported modules from project. */
+		KERNEL_SIDE_MODULE_ERROR = 9,	/** Cannot find supported modules from project because kernel side. */
+		/* Analyze errors */
+		WRONG_DATA_FILE_VERSION = 10,	/** Invalid data file version in internal gathering mode. */
+		INVALID_DATA_FILE = 11,			/** Data file content invalid. */
+		ANALYZE_ERROR = 12,				/** General error in analyze part not specific. */
+		EMPTY_DATA_FILE = 13,			/** Data file is empty. */
+		SYMBOL_FILE_ERROR = 14,			/** Symbol file content invalid or do not exist. */
+		/* building&releasing errors */
+		RELEASABLES_ERROR = 20,			/** Cannot find the binaries of module. */
+		RESTORE_MODULES_ERROR = 21,		/** Error restoring mmp file to original. */
+		CREATING_TEMP_CPP_ERROR = 22,	/** Error creating temporary cpps to store variables to s60 core.*/
+		CLEANING_TEMP_ERROR = 23,		/** Error cleaning atool_temp folder from module. */
+		READ_MAKEFILE_ERROR = 24,		/** Some error when reading makefile of module / project (sbs1/2). */
+		MODIFY_MODULES_ERROR = 25,		/** Error modifying module mmp file. */
+		INVALID_MMP_DEFINED = 27,		/** Specified module does not exist in project. */
+		/* Attribute file related */
+		WRITE_ATTRIBUTES_ERROR = 30,	/** Error writing the cfg file into atool_temp folder (contains arguments).*/
+		READ_ATTRIBUTES_ERROR = 31,		/** Error reading hooking related arguments from cfg file. */
+		/* User issued exit */
+		USER_ISSUED_EXIT = 40,			/** User aborted the run of application. */
+	};
+};
+
+// Debug logging to console
+extern bool g_bDebugConsole;
+// Debug logging to windows api debug
+extern bool g_bDebugDbgView;
+// Debug (low level functions).
+extern bool g_bDebugLowLevel;
+
+// Temporary directory definition's.
+const char AT_TEMP_DIR[] = "atool_temp";
+const char AT_TEMP_LST_DIR[] = "atool_temp\\static_lsts\\";
+
+// makefile dir is used in atool.cpp to check will we use sbs2 (in analyze and clear)
+#define RAPTOR_MAKEFILE_DIR "atool_temp\\build"
+
+//part of user defined filename to be replaced by process name
+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"
+
+// Default/min/max call stack sizes
+const int AT_ALLOC_CALL_STACK_SIZE_DEFAULT = 40;
+const int AT_FREE_CALL_STACK_SIZE_DEFAULT = 0;
+const int AT_CALL_STACK_SIZE_MIN = 0;
+const int AT_CALL_STACK_SIZE_MAX = 256;
+
+// What version of data file contains timestamps in dll's.
+const int AT_DLL_TIMESTAMP_DATA_VERSION = 2;
+
+// Constant compatibility string in temporary cpp.
+// Api version ; current version.
+#define ATOOL_COMPATIBILITY_STRING "1.7.6;1.10.0"
+
+// Datafile version
+#define AT_DATA_FILE_VERSION "DATA_FILE_VERSION 12"
+
+// Latest dbghelp.dll version
+const int DBGHELP_VERSION_MAJ = 6;
+const int DBGHELP_VERSION_MIN = 3;
+const int DBGHELP_VERSION_BUILD = 0;
+const int DBGHELP_VERSION_REVIS = 0;
+const char DBGHELP_DLL_NAME[] = "dbghelp.dll";
+
+
+// Build summary constants
+const string AT_BUILD_SUMMARY_HEADER = "\n###  AnalyzeTool  ###\n### Build Summary ###\n\n";
+const string AT_BUILD_SUMMARY_INSTRUMENTED_BUILD_COMPLETE = "Instrumented build complete: ";
+const string AT_BUILD_SUMMARY_TARGET = "\tTarget: ";
+const string AT_BUILD_SUMMARY_FAILED = "Build failed: ";
+const string AT_BUILD_SUMMARY_ERRORS = "\tErrors: ";
+const string AT_BUILD_SUMMARY_DATA_FILE_NAME = "\tLog file name: ";
+const string AT_BUILD_SUMMARY_DATA_FILE_PATH = "\tLog file path: ";
+const string AT_BUILD_SUMMARY_NORMAL_BUILD_COMPLETE = "Normal build complete: ";
+const string AT_BUILD_SUMMARY_STATIC_LIBRARY = "\tModule is static library.";
+const string AT_BUILD_SUMMARY_UNSUPPORTED_TARGET_TYPE = "\tModule has unsupported target type.";
+const string AT_BUILD_SUMMARY_UNSUPPORTED_COMPILE_DEFINITION = "\tModule defined unsupported compile definition.";
+const string AT_BUILD_SUMMARY_BUILD_TYPE = "Build type: ";
+const string AT_BUILD_SUMMARY_BUILD_TARGET = "Build target: ";
+const string AT_BUILD_SUMMARY_BUILD_PLATFORM = "Build platform: ";
+const string AT_BUILD_SUMMARY_BUILD_VARIANT = "Build variant: ";
+const string AT_BUILD_SUMMARY_LOGGING_MODE = "Data gathering mode: ";
+const string AT_BUILD_SUMMARY_ALLOC_CALL_STACK_SIZE = "Allocation call stack size: ";
+const string AT_BUILD_SUMMARY_FREE_CALL_STACK_SIZE = "Free call stack size: ";
+const string AT_BUILD_SUMMARY_FILE = "log to file";
+const string AT_BUILD_SUMMARY_TRACE = "monitored external";
+const string AT_BUILD_SUMMARY_TRACE_FAST = "output to trace";
+
+const string AT_UNSUPPORTED_TARGET_TYPE = "\tModule has unsupported target type.";
+const string AT_UNSUPPORTED_COMPILE_DEFINITION = "\tModule defined unsupported compile definition.";
+
+// List of locations under epocroot where analyzetool.h can be found.
+// Add all possible to this list so core version information can be read
+// from file.
+const string AT_CORE_INCLUDE_FILE_WITH_VERSION_NUMBER[] = {
+	"epoc32\\include\\domain\\osextensions\\analyzetool\\analyzetool.h",
+	"epoc32\\include\\oem\\analyzetool\\analyzetool.h",
+	"epoc32\\include\\platform\\analyzetool\\analyzetool.h"
+};
+const string AT_CORE_VERSION_NUMBER_TAG = "ANALYZETOOL_CORE_VERSION_FOR_CLE";
+
+// Temporary cpp name
+const char AT_TEMP_CPP_LOWER_START[] = "0a1b2c3d_atool_temp_";
+const char AT_TEMP_CPP_LOWER_END[] = ".cpp";
+
+const char TAB_CHAR_VALUE = 9;
+const char SPACE_CHAR_VALUE = 32;
+
+// Bldmake error msg
+#define AT_BLDMAKE_ERROR "AnalyzeTool : bldmake bldfiles error.\n"
+
+// File copy/move/etc... message definitions
+#define AT_MSG "AnalyzeTool : "
+#define AT_MSG_SYSTEM_CALL "AnalyzeTool : System call, "
+#define AT_FILE_TO " to "
+
+// -c messages
+#define AT_CLEANING_DONE "AnalyzeTool : Cleaning done."
+#define AT_CLEANING_NOTHING_FOUND "AnalyzeTool : Nothing found to clean."
+
+// Analyzing data without process start or dll load
+#define AT_ANALYZE_INSUFFICIENT_LOGGING_DATA "Insufficient logging data to locate code lines for memory addresses.\nLogging has been started after process start."
+#define AT_ANALYZE_NO_PROCESS_START "AnalyzeTool : No processes start information found in test run data."
+#define AT_ANALYZE_NO_DLL_LOAD "AnalyzeTool : No dll load information found in test run data."
+#define AT_ANALYZE_CANNOT_PINPOINT "AnalyzeTool : Memory addresses cannot be pinpointed."
+#define AT_ANALYZE_ABNORMAL_EXIT "Abnormal process end"
+
+// Analyzing without map / lst files
+#define AT_ANALYZE_MISSING_LST_MAP_FILES "AnalyzeTool : Missing lst or map files, memory addresses shown only to module level.\n"
+//#define AT_UNINSTRUMENT_FAILED_IN_ANALYZE_MESSAGE "AnalyzeTool: Error creating map/lst files, leaks shown only to module level.\nRun atool -u to try create lst/map files again after binaries build successfully.\n"
+
+// Mmp error msg
+#define INVALID_MMP_ERROR "AnalyzeTool : Error, Specified mmp is invalid.\n"
+
+// Make error msg
+#define MAKE_ERROR "AnalyzeTool : Error, Running make.\n"
+
+#define AT_NOT_BEEN_BUILD_ERROR "AnalyzeTool : Error, project has not been build using AnalyzeTool.\n"
+
+// Makefile errors
+#define LEVEL1_MAKEFILE_ERROR "AnalyzeTool : Error, reading level 1 makefile.\n"
+#define LEVEL2_MAKEFILE_ERROR "AnalyzeTool : Error, reading level 2 makefile.\n"
+#define MAKEFILE_ERROR_TIP "AnalyzeTool : Tip, your environment might require you to use -variant [target] argument.\n";
+
+//Variant messages
+#define INVALID_VARIANT_ERROR "AnalyzeTool : Error,Specified variant is invalid.\n"
+#define USING_DEFAULT_VARIANT_MESSAGE "AnalyzeTool : Note, Using DEFAULT variant.\n"
+#define NO_DEFAULT_VARIANT_ERROR "AnalyzeTool : Error, environment does not specify DEFAULT variant (No variant support?).\n"
+
+// Variant dir is the dir where all variants are defined
+#define VARIANT_DIR "\\epoc32\\tools\\variant\\"
+
+// Variants defined extension name of the variant must equal filename
+#define VARIANT_FILE_EXTENSION ".VAR"
+
+//Max file name length
+const int MAX_FILENAME_LENGTH = 1024;
+
+//Max line length when reading lines from text file.2048 should be enought.
+const int MAX_LINE_LENGTH = 2048*8;
+
+// ATs project file name to store project attributes
+#define AT_PROJECT_ATTRIBUTES_FILE_NAME "project.cfg"
+const string AT_PROJECT_ATTRIBUTES_SEPARATOR( ":$:" );
+
+// ATs level1 makefile name
+#define AT_LEVEL_1_MAKEFILE_NAME "main.at"
+
+// ATs level2 makefiles extension
+#define AT_LEVEL_2_MAKEFILE_EXT "atm"
+
+//Default logging level
+const int DEFAULT_LOGGING_LEVEL = 3;
+
+//Minimun value of logging level 
+const int MIN_LOGGING_LEVEL = 0;
+
+//Maximun value of logging level
+const int MAX_LOGGING_LEVEL = 3;
+
+//Const char represeting dash
+const char DASH = '\\';
+
+/**
+ * Table of file extension not to delete
+ * from atools temp directory when compiling
+ * note define all in lowercase
+ */
+const string TEMP_EXTENSION_NO_DELETE[] = {
+	"xml",
+	"dat",
+	"tmp",
+	"cpp",
+	"at",
+	"atm",
+	"cfg"
+};
+
+// Allowed characters/digits, other than these will be filtered out when using CATBase FilterString
+const char CFILTERSTRING[] = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
+
+/**
+ * Table of unsupported target types
+ * (i.e. mmp file syntax targettype in makefile)
+ * List of target types which will not be hooked:
+*/
+const string UNSUPPORTED_TARGET_TYPES[] = {
+	"CTL",
+	"ECOMIIC",
+	"IMPLIB",
+	"KDLL",
+	"KEXT",
+	"KLIB",
+	"LDD",
+	/* "LIB",  currently have own vector in project.*/
+	"MDA",
+	"MDL",
+	"NONE",
+	"NOTIFIER",
+	"PDD",
+	"RDL",
+	"STDLIB",
+	"VAR"
+};
+
+/**
+* Kernel side target types
+*/
+const string KERNEL_SIDE_TARGET_TYPES[] = {
+	"VAR",
+	"LDD",
+	"PDD",
+	"KEXT"
+};
+
+// Kernel mode compile definition
+const string KERNEL_MODE_COMPILE_DEFINITION = "__KERNEL_MODE__";
+
+/**
+* MMP file changes for AT
+* Note "SOURCE            0a1b2c3d_atool_temp_TARGET.cpp" is added also.
+*/
+const string MMPFILECHANGES[] = {
+	"//*** AnalyzeTool changes start ***",
+	"SOURCEPATH        atool_temp",
+	"LIBRARY           AToolMemoryHook.lib",
+	"STATICLIBRARY     AToolStaticLib.lib",
+	"OPTION ARMCC --interleave",
+	"//*** AnalyzeTool changes end ***"
+};
+
+//MMP file changes for AT
+//For targettype Dll
+const string MMPFILECHANGES_DLL[] = {
+	"//*** AnalyzeTool changes start ***",
+	"OPTION ARMCC --interleave",
+	"//*** AnalyzeTool changes end ***"
+};
+
+// Trace file constants definitions
+#define LABEL_DATA_FILE_VERSION "DATA_FILE_VERSION"
+#define LABEL_PROCESS_START     "PCS"
+#define LABEL_DLL_LOAD          "DLL"
+#define LABEL_DLL_UNLOAD		"DLU"
+#define LABEL_MEM_LEAK          "MEM_LEAK"
+#define LABEL_PROCESS_END       "PCE"
+#define LABEL_ERROR_OCCURED     "ERR"
+#define LABEL_HANDLE_LEAK       "HDL"
+#define LABEL_TEST_START        "TSS"
+#define LABEL_TEST_END          "TSE"
+#define LABEL_THREAD_START		"TDS"
+#define LABEL_THREAD_END		"TDE"
+#define LABEL_DEVICE_INFO		"DEVINFO"
+#define LABEL_LOGGING_CANCELLED "LOGGING_CANCELLED"
+
+
+// AddressToLine related constants
+
+#define LABEL_ABNORMAL "ABNORMAL"
+const int FUNCTIONS_OFFSET_IN_MAP_FILE_ARMV5 = 0x8000;
+const int FUNCTIONS_OFFSET_IN_GCCE = 0x8000;
+const int FUNCTIONS_OFFSET_IN_MAP_FILE_WINSCW = 0x400000;
+#define TEXT_NO_HANDLE_LEAKS "No handle leaks."
+
+// Make file constant labels
+#define MAKEFILE_TARGETTYPE_STRING "# TargetType "
+#define MAKEFILE_BASIC_TARGETTYPE_STRING "# BasicTargetType "
+#define MAKEFILE_TARGET_STRING "# Target "
+#define MAKEFILE_FEATURE_VARIANT_NAME "# FeatureVariantName "
+#define MAKEFILE_FEATURE_VARIANT_UREL_LABEL "# FeatureVariantURELLabel "
+#define MAKEFILE_FEATURE_VARIANT_UDEB_LABEL "# FeatureVariantUDEBLabel "
+#define UDEB_OPTIMIZATION_LEVEL 0
+
+// Listing file contant labels
+#define LST_FILE_SOURCE_FILE_LABEL "Source file:"
+
+/**
+* Struct for saving module info from .dat file and number of leaks in module.
+*/
+struct DLL_LOAD_INFO
+{
+	string sModuleName; /** name of the code segment/binary */
+	unsigned long iStartAddress; /** start address of code segment (in memory) */
+	unsigned long iEndAddress; /** end address of code segment (in memory) */
+	int iLeaks; /** leak count in this code segment */
+	unsigned long iPID; /** process id which loaded this code segment */
+	int iSubTestStartOpenHandles; /** open handle count when sub test started */
+	int iSubTestEndOpenHandles; /** open handle count when sub test ended */
+	// Load/Unload times, note these are micro seconds from 1970 so size is huge.
+	unsigned long long iLoadTime; /** code segment load time */
+	unsigned long long iUnloadTime; /** code segment unload time */
+	/**
+	* Default constructor to set default values
+	*/
+	DLL_LOAD_INFO() {
+		iStartAddress = 0;
+		iEndAddress = 0;
+		iLeaks = 0;
+		iPID = 0;
+		iSubTestStartOpenHandles = 0;
+		iSubTestEndOpenHandles = 0;
+		iLoadTime = 0;
+		iUnloadTime = 0;
+	};
+};
+
+/**
+* Struct for saving symbol information from listing file
+*/
+struct LINE_IN_FILE
+{
+	int iLine; /** line number */
+	string sFileName; /** filename */
+	string sFunction; /** function / symbol */
+	string sMangledName; /** function / symbol name in mangled / coded form */
+	string sLstName; /** listing filename */
+};
+
+/**
+* Struct for saving symbol information from map file
+*/
+struct MAP_FUNC_INFO
+{
+	int iAddress; /** memory address (start of symbol) */
+	int iFuncLength; /** symbol length */
+	string sMangledName;/** symbol name in mangled / coded form */
+	string sWholeLine; /** whole symbol line from map file */
+	string sFunctionName; /** symbol clear name */
+};
+
+/**
+* State that represents the outcome
+* of locating memory address code line from module
+*/
+enum ADDRESS_TO_LINE_STATE {
+	no_map_data = 0, /** Map data was missing */
+	out_of_function_range, /** Could not locate it to any function */
+	mangled_symbol_name, /** symbol name but mangled / coded form */
+	only_function_name, /** Only got function name not code line */
+	succesfull /** Have line number, function, etc...*/
+};
+
+/**
+* Struct to store detail data and state when
+* locating memory addresses code lines
+*/
+struct ADDRESS_TO_LINE_ITEM {
+	ADDRESS_TO_LINE_STATE eState; /** outcome */
+	string sFileName; /** Filename of address */
+	string sFunctionName; /** Function name of address */
+	string sMangledFunctionName; /** function/Symbol name */
+	int iFunctionLineNumber; /** Functions line number */
+	int iExactLineNumber; /** Exact line number of address */
+};
+
+/**
+* Struct to store  memory leaks
+* call stack entry data
+*/
+struct CALL_STACK_ITEM {
+	string sAddress; /** Address in string */
+	int iAddress; /** Address in number (converted)*/
+	int iLocation; /** Location. i.e. corresponds m_vDllLoadModList's index*/
+	int iCalculatedLeakAddress; /** calculated address from code segment start */
+	bool bBuildUdeb; /** Optimization level */
+	string sModuleName; /** Modules name were leak is*/
+	ADDRESS_TO_LINE_ITEM addressToLine; /** Data from locating code line for memory address */
+};
+
+/**
+* Enumerations used in argument structure.
+*/
+enum MAIN_SWITCH
+{
+	SWITCH_UNKNOWN = 0, /** not defined */
+	SWITCH_ANALYZE = 1, /** analyze */
+	SWITCH_HOOK = 2, /** compile/instrument */
+	SWITCH_UNHOOK = 3, /** uninstrument */
+	SWITCH_PARSE_TRACE = 5, /** parse raw data */
+	SWITCH_CLEAN = 6, /** clean AT changes */
+	SWITCH_VERSION = 9, /** display version infromation */
+	SWITCH_HELP = 10, /** show help with syntax examples */
+	SWITCH_DBGHELP_VERSION = 11
+};
+
+/**
+* Enumeration used when hooking project.
+*/
+enum HOOK_SWITCH
+{
+	HOOK_UNKNOWN = 0, /** not defined */
+	HOOK_INTERNAL, /** monitored internal data gathering */
+	HOOK_EXTERNAL, /** monitored external data gathering */
+	HOOK_EXTERNAL_FAST, /** external data gathering */
+	HOOK_EXTENSION_INTERNAL, /** Extension call, monitored internal data gathering */
+	HOOK_EXTENSION_EXTERNAL, /** Extension call, monitored external data gathering */
+	HOOK_EXTENSION_EXTERNAL_FAST, /** Extension call, external data gathering */
+	HOOK_EXTENSION_UNINSTRUMENT, /** Extension call, uninstrument (post-build)*/
+	HOOK_EXTENSION_FAILED, /** Extension call, build failed, cleanup */
+	HOOK_OLD_EXTENSION_INSTRUMENT, /** Old extension call, instrument project */
+	HOOK_OLD_EXTENSION_UNINSTRUMENT, /** Old extension call, uninstrument project */
+	HOOK_OLD_EXTENSION_FAILED /** Old extension call, cleanup */
+};
+
+/**
+* Represents hooking parameters, these are set
+* by the user arguments from command line.
+*/
+struct ARGUMENTS_HOOK
+{
+	bool bNoBuild; /** Only intrument project? (no build) */ 
+	bool bDataFileName; /** Is internal data gathering filename defined */
+	bool bDataFilePath; /** Is internal data gathering file path defined */
+	bool bAbldTest; /** Is build only for test modules (abld test build.. */
+	string sDataFileName; /** Internal data gathering filename */
+	string sDataFilePath; /** Path to internal data gathering file */
+	int iBuildSystem; /** 1 = sbs, 2 = raptor */
+	int iLoggingMode; /** Just for old parameter parsing. 1=trace, 2=file, 0=? */
+	int iAllocCallStackSize; /** Call stack size when memory allocated */
+	int iFreeCallStackSize; /** Call stack size when memory freed */
+	string sBuildCmd; /** Original build command / user defined or given */
+	vector<string> vBuildCmd; /** Build command split in vector */
+	string sPlatform; /** Build platform */
+	string sBuildType; /** Build type (udeb/urel) */
+	string sFeatureVariant; /** Build variant defined */
+	vector<string> vTargetPrograms; /** User defined single or multiple modules from project? */
+	/**
+	* Default constructor to set default values.
+	*/
+	ARGUMENTS_HOOK()
+	{
+		bNoBuild = false;
+		bAbldTest = false;
+		bDataFileName = false;
+		bDataFilePath = false;
+		sDataFileName = "";
+		sDataFilePath = "";
+		iBuildSystem = 0;
+		iLoggingMode = 0;
+		iAllocCallStackSize = AT_ALLOC_CALL_STACK_SIZE_DEFAULT;
+		iFreeCallStackSize = AT_FREE_CALL_STACK_SIZE_DEFAULT;
+		sBuildCmd = "";
+		sPlatform = "";
+		sBuildType = "";
+		sFeatureVariant = "";
+		vTargetPrograms.clear();
+	};
+};
+
+/**
+* Represents analyze parameters, these are set
+* by the user arguments from command line.
+*/
+struct ARGUMENTS_ANALYZE
+{
+	string sDataFile; /** Data file to be analyzed */
+	string sOutputFile; /** Output file */
+	bool bSymbolFile; /** Is rom/rofs symbol file(s) defined? */
+	vector<string> vSymbolFiles; /** Collection of symbol files */
+	int iLoggingLevel; /** Logging level of report */
+	/**
+	* Default constructor to set default values.
+	*/
+	ARGUMENTS_ANALYZE()
+	{
+		sDataFile = "";
+		sOutputFile = "";
+		bSymbolFile = false;
+		iLoggingLevel = 3;
+	};
+};
+
+/**
+* Represents raw trace parsing parameters, these are set
+* by the user arguments from command line.
+*/
+struct ARGUMENTS_PARSE
+{
+	bool bDataFile; /** Is raw data file defined */
+	string sDataFile; /** Raw data file (input) */
+	bool bOutputFile; /** Is output file defined */
+	string sOutputFile; /** Output (AT specific data file)*/
+	/**
+	* Default constructor to set default values.
+	*/
+	ARGUMENTS_PARSE()
+	{
+		bDataFile = false;
+		sDataFile = "";
+		bOutputFile = false;
+		sOutputFile = "";
+	};
+};
+
+
+/**
+* Represents main parameters, these are set
+* by the user arguments from command line.
+*/
+struct ARGUMENTS
+{
+	// Base arguments.
+	MAIN_SWITCH eMainSwitch; /** mandatory/main parameter */
+	HOOK_SWITCH eHookSwitch; /** if compile/instrument its "mode" */
+	bool bHelp; /** show help? */
+	bool bDebugConsole; /** enable debug logging to console? */
+	bool bDebugDbgView; /** enable debug logging to win api? */
+	bool bDebugLowLevel; /** enable debug logging for also low level functions? */
+	bool bEnableSbs2; /** use raptor as build system? */
+	ARGUMENTS_HOOK HOOK; /** hooking/instrument/compiling attributes */
+	ARGUMENTS_ANALYZE ANALYZE; /** analyze related attributes */
+	ARGUMENTS_PARSE PARSE; /** parsing related attributes */
+	/**
+	* Default constructor to set default values.
+	*/
+	ARGUMENTS()
+	{
+		eMainSwitch = SWITCH_UNKNOWN;
+		eHookSwitch = HOOK_UNKNOWN;
+		bHelp = false;
+		bDebugConsole = false;
+		bDebugDbgView = false;
+		bEnableSbs2 = false;
+	};
+};
+
+// DEBUG MACROS
+// constant string for all beginning of all debug messages
+const char START_LOG_MESSAGE[] = "*** CLE ";
+// Log normal function entry (AAA = class::function )
+#define LOG_FUNC_ENTRY( AAA ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << "ENTRY: " << AAA << endl; OutputDebugString( strs.str().c_str() );  } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << "ENTRY: " << AAA << endl; cout << strs.str();  } }
+// Log normal function exit
+#define LOG_FUNC_EXIT( AAA ){ if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << "EXIT: " << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << "EXIT: " << AAA << endl; cout << strs.str(); } }
+// Log low level function entry
+#define LOG_LOW_FUNC_ENTRY( AAA ) { if ( g_bDebugLowLevel ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; cout << strs.str(); } } }
+// Log low level function exit
+#define LOG_LOW_FUNC_EXIT( AAA ) {  if ( g_bDebugLowLevel ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; cout << strs.str(); } } }
+// Log stringstream (string, int, etc..) i.e. string1 << int1 << "log this"
+#define LOG_STRING( AAA ) { if( g_bDebugDbgView) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; OutputDebugString( strs.str().c_str() ); } else if ( g_bDebugConsole ) { stringstream strs; strs << START_LOG_MESSAGE << AAA << endl; cout << strs.str(); } }
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATBase.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,444 @@
+/*
+* 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:  Defines CATBase "utility" class.
+*
+*/
+
+#ifndef __CATBASE_H__
+#define __CATBASE_H__
+
+#include "../inc/ATCommonDefines.h"
+
+/**
+* This class implements lot of utility type of functions used all around atool project.
+* All functions are static so they can be used without inheritance of this class. But still
+* this is a base class of almost all others.
+*/
+class CATBase
+{
+public:
+	
+	/**
+	* Constructor
+	*/
+	CATBase();
+
+	/**
+	* Destructor
+	*/
+	virtual ~CATBase(void);
+
+public:
+	
+	/**
+	* FilterExtraSpaces
+	* Filters/replaces multiple continuous spaces with single. Won't leave
+	* spaces in start or end of string.
+	* @param sString to filter.
+	* @return void.
+	*/
+	static void FilterExtraSpaces( string& sString );
+
+	/**
+	* Convert hex value in string to signed decimal.
+	* @param sHex
+	* @param iDec
+	* @return true if successful
+	*/
+	static bool hexToDec( string& sHex, int& iDec );
+
+	/**
+	* Convert hex value in string to unsigned decimal
+	* @param sHex
+	* @param iDec
+	* @return true if successful
+	*/
+	static bool hexToDec( string& sHex, unsigned int& iDec );
+
+	/**
+	* Convert hex value in string to unsigned long.
+	* @param sHex
+	* @param ulDec
+	* @return true if successful
+	*/
+	static bool hexToDec( string& sHex, unsigned long& ulDec );
+
+	/**
+	* Convert hex value in string to unsigned long long.
+	* @param sHex
+	* @param ullDec
+	* @return true if successful
+	*/
+	static bool hexToDec( string& sHex, unsigned long long& ullDec );
+
+	/**
+	* Convert hex value to integer
+	* @param value
+	* @return unsigned long
+	*/
+	static unsigned long _httoi(const TCHAR *value);
+
+	/**
+	* Convert integer to hex string.
+	* @param i
+	* @return hex string
+	*/
+	static string NumberToHexString( unsigned int i );
+
+	/**
+	* Convert long to hex string.
+	* @param i
+	* @return hex string
+	*/
+	static string NumberToHexString( unsigned long i );
+
+	/**
+	* Helper function checks is given character hex.
+	* @param value value to check.
+	* @return true if value is hex char.
+	*/
+	static bool IsHexCharacter(const TCHAR *value);
+
+	/**
+	* Parse string to vector of strings using
+	* separator. (Tokenizer with delimeter).
+	* @param sInput string to split
+	* @char separator
+	* return vector<string>
+	*/
+	static vector<string> ParseStringToVector( const string& sInput, char separator );
+
+	/**
+	* Remove spaces and tabulatures from beginning and
+	* end of given string.
+	* @param sInput String to trim.
+	*/
+	static void TrimString( string& sInput );
+
+	/**
+	* Searches files with given extension from path.
+	* @param pPathAndExt path with extension
+	* @return string filename
+	*/
+	static string GetFileNameUsingExt( const char* pPathAndExt );
+
+	/**
+	* Changes all BackSlash characters to Slash character from string.
+	* @param sInput String including backslashes.
+	* @return String without backslashes.
+	*/
+	static string ChangeSlashToBackSlash( string sInput );
+
+	/**
+	* Changes given string to uppercase
+	* @param sInput
+	*/
+	static void ChangeToUpper( string& sInput );
+
+	/**
+	* Converts any uppercase letter to lowercase.
+	*
+	* @param sInput Reference to string.
+	*/
+	static void ChangeToLower( string& sInput );
+
+	/**
+	* Filter string out of unwanted characters. The list of allowed
+	* characters is defined in CFILTERSTRING.
+	* @param sString string to filter.
+	* @return filtered string.
+	*/
+	static string FilterString( const string& sString );
+
+	/**
+	* Removes path and extension from given filename string
+	* @param sFileName
+	* @param bReverseFindExt if true extension will be looked starting from end
+	* @return string
+	*/
+	static string RemovePathAndExt( string sFileName, bool bReverseFindExt = false );
+
+	/**
+	* Returns time  stamp in microseconds parsed from start of trace message
+	* @param sLineStart
+	* @return int
+	*/
+	unsigned __int64 ParseTimeStamp( string sLineStart );
+
+	/**
+	* Check if given file exists.
+	* @param pFilename Pointer to file name.
+	* @return False If file does not exists.
+	*/
+	static bool FileExists( const char* pFilename );
+
+	/**
+	* Check if given file is flagged read only.
+	* @param pFileName pointer to file name
+	* @return true if read only flag set.
+	*/
+	static bool IsFileReadOnly( const char* pFileName );
+
+	/**
+	* Set file read only.
+	* @param pFileName Pointer to file name
+	* @return true if successful.
+	*/
+	static bool SetFileReadOnly( const char* pFileName );
+
+	/**
+	* Set file writable (remove read only flag).
+	*
+	* @param pFilename Pointer to file name.
+	* @return true if successful.
+	*/
+	static bool SetFileWritable( const char* pFileName );
+
+	/**
+	* Copy file to given path
+	* @param sFile
+	* @param sToPath
+	* @return true if successful
+	*/
+	static bool FileCopyToPath(const string& sFile, const string& sToPath);
+
+	/**
+	* Move file to given path
+	* @param sFile File to be moved
+	* @param sToPath path where to move file
+	* @return true if successful
+	*/
+	static bool FileMoveToPath(const string& sFile, const string& sToPath);
+
+	/**
+	* Delete file
+	* Note! if file does not exists no error message is displayed
+	* but function returns false
+	* @param sFile File to be deleted
+	* @param bPrint display messages or not, default true
+	* @return true if successful
+	*/
+	static bool FileDelete(const string& sFile, bool bPrint = true );
+    
+	/**
+	* Delete dir
+	* Note! if dir does not exists no error message is displayed
+	* but function returns false.
+	* This function wont delete directory if string does not contain
+	* AT_TEMP...
+	* @param sDir Directory to be deleted
+	* @param bPrint display message or not, default true
+	* @return true if successful
+	*/
+	static bool DirDelete(const string& sDir, bool bPrint = true );
+
+	/**
+	* Create dir
+	* Note! if dir cannot be created no error message is displayed
+	* but function returns false.
+	* @param sDir Directory to be deleted
+	* @param pPrint display message or not, default true
+	* @return true if successful
+	*/
+	static bool DirCreate(const string& sDir, bool pPrint = true );
+
+	/**
+	* Create temp path string for given
+	* mmpfile (full path+mmpname)
+	* @param sMmpFileWithPath
+	* @return string containing full path to
+	* AnalyzeTool temporary directory
+	*/
+	static string CreateTempPath(const string& sMmpFileWithPath);
+
+	/**
+	* Search files with extensions from given path.
+	* @param pPathAndExt path with extension definition
+	* @param bPrintErrors do print errors?
+	* @param sErrorLog errors
+	* @return true if found.
+	*/
+	static bool SearchFileWithExtension( const char* pPathAndExt, bool bPrintErrors, string& sErrorLog );
+
+	/**
+	* Helper function to parse filename or path from given string
+	* @param bFileName if true returns filename otherwise the path
+	* @param sInput string where to get path or filename
+	* @return string filename or path
+	*/
+	static string GetPathOrFileName( bool bFileName, string sInput );
+
+	/**
+	* Function returns string from begin of given string until next space,
+	* characters until next space are removed from sInput string.
+	*
+	* @param sInput Line where data is separated with spaces.
+	* @param bEraseFromInput If true characters before space will be removed.
+	* @return string String until next space.
+	*/
+	static string GetStringUntilNextSpace( string& sInput, bool bEraseFromInput = true );
+
+	/**
+	* Function returns string from begin of given string until next atool's main id <AT>,
+	* characters until next space are removed from sInput string.
+	*
+	* @param sInput Line which contains main id.
+	* @param bEraseFromInput If true characters before main id will be removed.
+	* @return string String until main id.
+	*/
+	static string GetStringUntilMainId( string& sInput, bool bEraseFromInput = true );
+
+	/**
+	* Convert unix path to windows
+	* @param sPath
+	*/
+	static void ConvertUnixPathToWin( string& sPath );
+
+	/**
+	* Create Temporary AT Cpp file
+	* @param sId unique id to add in file name
+	* @param sPath where to create
+	* @param sS60FileName of the logging file
+	* @param sS60FilePath of the logging file
+	* @param iLogOption logging mode
+	* @param iIsDebug build type
+	* @param iAllocCallStackSize
+	* @param iFreeCallStackSize
+	* @return true if successful
+	*/
+	static bool CreateTemporaryCpp( const string& sId
+								 ,const string& sPath
+								 ,const string& sS60FileName
+								 ,const string& sS60FilePath
+								 ,int iLogOption
+								 ,int iIsDebug
+								 ,int iAllocCallStackSize
+								 ,int iFreeCallStackSize );
+	/**
+	* Acquire a list of files in given directory
+	* @param sDirectory can end to \ or x but not to *
+	* @param bListDirs if true directories will be listed as well, default false
+	* @param bAddPathToFile if true given sDirectory path is added to file string, default false
+	* @return vector<string> list of files in folder
+	*/
+	static vector<string> DirList(const string& sDirectory, bool bListDirs = false, bool bAddPathToFile = false);
+
+	/**
+	* Get extension from given "file" string
+	* returns string after last . if any otherwise returns same
+	* what was given
+	* @param sString 
+	* @return string string after last '.' if no '.' returns given string
+	*/
+	static string GetExtension(const string& sString);
+
+	/**
+	* Convert TCHAR pointer to string
+	* @param charArray to convert
+	* @return string
+	*/
+	static string ConvertTCHARtoString(TCHAR* charArray);
+
+	/**
+	* if given string contains two dots '.' this will remove
+	* all characters after first '.'
+	*/
+	static void RemoveAllAfterDotIfTwoDots(string& sString);
+
+	/**
+	* checks given file is it data file
+	* @param sFile
+	* @return true if it is datafile
+	*/
+	static bool IsDataFile( string sFile );
+
+	/**
+	* checks given file is it binary log file
+	* @param sFile
+	* @return true if it is binary logfile
+	*/
+	static bool IsBinaryLogFile( string sFile );
+
+	/**
+	* Parses a path string containing ".." to a valid
+	* path without relations. If given string does
+	* not contain relations it will not be changed
+	* @param sPathString
+	* @return void
+	*/
+	static void ParseRelativePathString(string& sPathString);
+
+	/**
+	* Remove relative path ".." from string
+	* @param sString string to remove from
+	* @param iDots index of ".."
+	* @return void
+	*/
+	static void RemoveRelativePath(string& sString, size_t iDots);
+
+	/**
+	* Check if given directory exists.
+	*
+	* @param pDirname Pointer to directory name.
+	* @return False If directory does not exists.
+	*/	
+	static bool DirectoryExists( const char* pDirname );
+
+	/**
+	* Checks from constant array is this targettype
+	* unsupported by AT
+	* @param sTargetType type to check
+	* @return true if it is supported by atool
+	*/
+	static bool IsTargetTypeSupported(string sTargetType);
+
+	/**
+	* Checks from constant array is this targettype
+	* kernel side.
+	* @param sTargetType type to check
+	* @return true if it is kernel type
+	*/
+	static bool IsTargetTypeKernelSide(string sTargetType);
+
+	/**
+	* Check is given variant defined in environment.(SBS v.1)
+	* @param sEpocroot
+	* @param sVariantName
+	* @return true if it is.
+	*/
+	static bool CheckVariant( const string& sEpocroot, const string& sVariantName );
+
+	/**
+	* Check has the environment defined "DEFAULT" variant
+	* @param sEpocRoot
+	* @return true if it is
+	*/
+	static  bool IsDefaultVariant( const string& sEpocRoot );
+
+	/**
+	* Check is all character ascii
+	* @param pInput pointer to characters
+	* @param iLength length of the string
+	* @return true if all character are ascii
+	*/
+	static bool IsAscii( const char* pInput, const unsigned int iLength );
+
+	/**
+	* Get current environments epocroot.
+	* @param sEpocRoot value is stored in this if successful.
+	* @return true if successful.
+	*/
+	static bool GetEpocRoot( string& sEpocRoot );
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATDatParser.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,283 @@
+/*
+* 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:  Defines CATDatParser class and its used enumerations.
+*
+*/
+
+
+#ifndef __CATDatParser_H__
+#define __CATDatParser_H__
+
+// Includes.
+#include "ATCommonDefines.h"
+#include "CATBase.h"
+#include "CATDataSaver.h"
+
+// Forward declarations.
+class CATModule2;
+class CATMemoryAddress;
+class CATRomSymbol;
+
+/**
+* Provides the analyze feature for AnalyzeTool specific data file.
+* Is used by CATProject. Uses CATModule2 and/or CATRomSymbol to locate symbols or
+* codelines of memory addressses. Uses CATDataSaver to create report.
+*/
+class CATDatParser : public CATBase
+{
+
+public:
+	/**
+	* enumeration representing the "mode" depending on build system
+	*/
+	enum ANALYZE_MODE
+	{
+		SBS_1 = 0,
+		SBS_2 = 1
+	};
+	/**
+	* Representing current process state
+	*/
+	enum PROCESS_STATE
+	{
+		not_started = 0,
+		ongoing = 1,
+		stopped = 2
+	};
+
+	/**
+	* Constructor.
+	*/
+	CATDatParser();
+
+#ifndef MODULE_TEST
+private:
+#endif
+	/**
+	* Real constructor.
+	*/
+	void Construct();
+	
+	/**
+	* Prevent copy
+	*/
+	CATDatParser& operator =( const CATDatParser& /*other*/ ) { }
+	CATDatParser( const CATDatParser& /*other*/ ) { }
+	
+public:
+	/**
+	* Constructor for SBS2
+	* @param pModules pointer to vector containing project modules
+	*/
+	CATDatParser( vector<CATModule2*>* pModules );
+
+	/**
+	* Destructor
+	*/
+	~CATDatParser();
+
+	/**
+	* Set offset to be used with mapfiles
+	* @param iOffSet
+	*/
+	void SetOffSet( int iOffSet );
+
+	/**
+	* Get offset value
+	* @return int
+	*/
+	int GetOffSet( ) const;
+	
+	/**
+	* Analyze data file set
+	* This method includes try/catch in parsing
+	* @return int error codes specified in CATProject (0=OK)
+	*/
+	int Analyze();
+
+	/**
+	* Set log level
+	* @param iLogLevel
+	*/
+	void SetLogLevel(int iLogLevel);
+	/**
+	* Get Log level
+	* @return int
+	*/
+	int GetLogLevel() const ;
+
+	/**
+	* Set data file to be analyzed
+	* @param sInputFile
+	*/
+	void SetInputFile(const string& sInputFile);
+
+	/**
+	* Set output file
+	* @param sOutputFile
+	*/
+	void SetOutputFile(const string& sOutputFile);
+
+	/**
+	* Set rom symbol file(s).
+	* @param sRomSymbolFile
+	*/
+	void SetRomSymbolFiles(const vector<string>& vRomSymbolFile);
+
+	/**
+	* Set print flag
+	* @param pPringFlag
+	*/
+	void SetPringFlag( bool bPrintFlag );
+
+	/**
+	* Set addr2line.exe pinpoint state
+	* @param bInput
+	*/
+	void SetAddr2lineExeState( bool bInput );
+
+	/**
+	* Set project platform.
+	* @param sPlatform platform.
+	*/
+	void SetProjectPlatform( const string& sPlatform );
+
+	/**
+	* Set projects build type. Use enumeration defined in CATProject.
+	* @param eBuildType.
+	*/
+	void SetProjectBuildType( int eBuildType );
+
+#ifndef MODULE_TEST
+private:
+#endif
+
+	/**
+	* Start parsing datafile
+	* @return error codes defined in CATProject
+	*/
+	int Parse();
+	
+	/**
+	* Helper functio to print header of report
+	*/
+	void Header();
+
+	/**
+	* Helper functio to print footer of report
+	*/
+	void Footer();
+
+	/**
+	* Helper function reseting/clearing all
+	* member variables related to parsing
+	*/
+	void ClearParsingVariables();
+
+	// Helpers for data file tags
+	bool ParseProcessStart( string& sLine );
+	bool ParseDllLoad( string& sLine );
+	bool ParseDllUnload( string& sLine );
+	bool ParseMemLeak( string& sLine );
+	bool ParseProcessEnd( string& sLine );
+	bool ParseHandleLeak( string& sLine );
+	bool ParseTestStart( string& sLine );
+	bool ParseTestEnd( string& sLine );
+	bool ParseLoggingCancelled( string& sLine );
+	bool ParseErrorOccured( string& sLine );
+
+	void PrintMemLeak(const string& sTime,
+					   const string& sLeakSize,
+					   const string& sLeakAddr,
+					   const string& sModuleName);
+
+	// Utilities
+	string ConvertTimeToLocalTime( string sInputTime );
+
+	/**
+	* Create a winscw module into pModules vector.
+	* Used when we have dll load of module not in project to create them
+	* after this they are used in locating code lines.
+	* @param sBinaryName name of the binary with extension.
+	* @return true if successful.
+	*/
+	bool CreateWinscwModule( const string& sBinaryName );
+
+#ifndef MODULE_TEST
+private:
+#endif
+
+	void CleanMemoryAddresses();
+
+	// Members
+	unsigned int m_iDataVersion; // Version of data file.
+	int m_eProcess_state; // is process started, etc..
+	bool m_bProcessStartFound;
+	bool m_bDllLoadFound;
+	int m_iLogLevel; // specified logging level
+	string m_sInputFile; // input file
+	vector<string> m_vRomSymbolFiles; // Rom symbol file.
+	string m_sOutputFile; // output file
+	string m_sInputFileTemp; // temporary input file (parsed from trace)
+	ifstream m_In; // Handle to input file
+	// Datasaver
+	CATDataSaver m_DataSaver;
+
+	// Modules to be used in pinpointing
+	vector<CATModule2*>* m_pModules;
+
+	// Rom symbol file.
+	CATRomSymbol* m_pRomSymbol;
+
+	// Build type from dat.
+	int m_eBuildType;
+	// Build type from project.
+	int m_eProjectBuildType;
+	// Offset of map file.
+	int m_iOffSet;
+	// Platform of project.
+	string m_sProjectPlatform;
+
+	// Process related
+	unsigned long m_iCurrentProcessId;
+	string m_sCurrentProcessName;
+	int m_iTotalRuns;
+	int m_iSuccesfullRuns;
+	
+	// Leak counting related
+	int m_iTotalNumberOfLeaks;
+	bool m_bSubtestOnGoing;
+	int m_iPinPointedLeaks;
+	int m_iPinPointedSubTestLeaks;
+	int m_iLeakNumber;
+	
+	// Handle count related
+	int m_iSubtestStartHandleCount;
+	vector<string> m_vHandleLeaks;
+
+	// Module related
+	vector<DLL_LOAD_INFO> m_vDllLoadModList;
+	vector<DLL_LOAD_INFO> m_vDllLoadModListSubTest;
+	
+	// Sbs 1 support functions
+	int FindModuleUsingAddress( unsigned long iAddress ) const;
+	//int FindModuleUsingPID( unsigned long iPID ) const;
+	int FindModuleUsingName( const char* pModName );
+
+	// Memory addresses
+	vector<CATMemoryAddress*> m_vMemoryAddress;
+
+};
+#endif
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATDataSaver.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,214 @@
+/*
+* 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:  Defines CATDataSaver class and element type enumeration.
+*
+*/
+
+
+#ifndef __CATDATASAVER_H__
+#define __CATDATASAVER_H__
+
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/framework/LocalFileFormatTarget.hpp>
+#include "ATCommonDefines.h"
+
+/**
+* Represents element types
+*/
+enum element_types
+{
+	RESULT = 0,
+	RUN,
+	LEAK,
+	CALLSTACK,
+	ITEM,
+	RUN_END,
+	ERROR_IN_RUN,
+	MEM_LEAKS,
+	MEM_LEAK_MODULE,
+	HANDLE_LEAKS,
+	HANDLE_LEAK_MODULE,
+	TEST_START,
+	TEST_END,
+	SUBTEST_MEM_LEAKS,
+	SUBTEST_MEM_LEAK_MODULE,
+	LOGGING_CANCELLED,
+	SUBTEST_HANDLE_LEAKS
+};
+
+//#define CARBIDE_DATA 0
+#define XML_DATA     1
+#define TEXT_DATA    2
+
+/**
+* TProvides features for creating the analyze report in
+* basic text or XML formats. Uses xerces library for XML output.
+*/
+class CATDataSaver
+{
+
+public:
+
+	/**
+	* Constructor.
+	*/
+	CATDataSaver( void );
+
+	/**
+	* Destructor.
+	*/
+	~CATDataSaver(void);
+
+	/**
+	* Save all lines to file with given format.
+	* @param pFileName Pointer to file name.
+	* @param iDataToSave Format of data.
+	*/
+	void SaveLinesToFile( const char* pFileName, int iDataToSave );
+
+	/**
+	* Prints all saved lines to screen.
+	*/
+	void PrintLinesToScreen( void );
+
+	/**
+	* Adds saved line to first in database.
+	*/
+	void AddLineToFirst( void );
+
+	/**
+	* Adds saved line to last in database.
+	*/
+	void AddLineToLast();
+
+	/**
+	* Adds string to current line.
+	* @param pData string to add
+	* @param bSaveCarbideData add string to xml?
+	*/
+	void AddString( const char* pData, bool bSaveCarbideData = false );
+
+	/**
+	* Converts integer to string and adds it to current line.
+	* @param iValue integer value to add
+	* @param bSaveCarbideData add string to xml?
+	*/
+	void AddInteger( int iValue, bool bSaveCarbideData = false );
+
+	/**
+	* Sets logging level.
+	* If value is invalid DEFAULT_LOGGING_LEVEL is used
+	* value must be between MIN_LOGGING_LEVEL and MAX_LOGGING_LEVEL
+	* @param iLoggingLevel Logging level.
+	*/
+	void SetLoggingLevel( int iLoggingLevel );
+
+	/**
+	* Gets logging level.
+	* @return Logging level.
+	*/
+	int GetLoggingLevel( void );
+
+	/**
+	* Sets print immediately flag.
+	* @param bPrintImmediately
+	*/
+	void SetPrintFlag( bool bPrintImmediately );
+
+	/**
+	* Sets data header for carbide data.
+	*/
+	void SaveCarbideDataHeader( void );
+
+	/**
+	* Initializes xercer xml parser.
+	*/
+	bool InitXML( void );
+
+	/**
+	* Writes data to xml tree.
+	* @param sInput data 
+	* @param iElementType element to write
+	*/
+	void SaveXML( string sInput, int iElementType );
+
+	/**
+	* Converts char* -> wchar_t*.
+	* @param str
+	* @return LPWSTR
+	*/
+	static LPWSTR CharToWChar( const char* str );
+
+	/**
+	* Converts wchar_t* -> char*.
+	* @param sInput
+	* @param Source
+	*/
+	static void WCharToChar( string& sInput, const WCHAR* Source );
+
+	/**
+	* Set is build type debug?
+	* @param bUdebBuild true if build type debug
+	*/
+	void SetBuild( bool bUdebBuild );
+
+	/**
+	* Add xml data for extension
+	* @param sInput data
+	*/
+	void AddCarbideData( const string& sInput );
+
+	/**
+	* Convert given integer to string
+	* @param iValueToConvert
+	* @return string
+	*/
+	static string IntegerToString( int iValueToConvert );
+
+#ifndef MODULE_TEST
+private:
+#endif
+	vector<string> m_vLines;
+	string m_sLine;
+	string m_sCarbideDataLine;
+
+	string m_sCarbideDataHeader;
+
+	int m_iLoggingLevel;
+	int m_iRunNumber;
+	bool m_bPrintImmediately;
+	bool m_bXMLInitOk;
+	bool m_bUdebBuild;
+
+	xercesc::DOMDocument* m_pDomDoc;
+	xercesc::DOMElement* m_pRootElem;
+	xercesc::DOMElement* m_pCurrentLeakElem;
+	xercesc::DOMWriter* m_Serializer;
+	xercesc::DOMElement* m_pRunElement;
+	xercesc::DOMElement* m_pMemoryLeaks;
+	xercesc::DOMElement* m_pHandleLeaks;
+	xercesc::DOMElement* m_pCurrentSubTestElem;
+	xercesc::DOMElement* m_pSubtestMemoryLeaks;
+
+	/**
+	* Utility to get sub string from string using char as separator
+	* @param sInput
+	* @param cCharacter
+	* @return string
+	*/
+	string GetStringUntilNextGivenChar( string& sInput, char cCharacter );
+
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATMemoryAddress.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,202 @@
+/*
+* 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:  Defines the CATMemoryAddress class.
+*
+*/
+
+
+#ifndef __CATMEMORYADDRESS_H__
+#define __CATMEMORYADDRESS_H__
+
+#include "../inc/ATCommonDefines.h"
+
+/**
+* Represents a single memory address / call stack item.
+* State tells the "success" of locating the symbol / code line.
+* Contains some utility functions used in this feature.
+*/
+class CATMemoryAddress
+{
+public:
+	/**
+	* Enumeration representing the state of locating code lines.
+	*/
+	enum ADDRESS_TO_LINE_STATE
+	{
+		OUT_OF_PROCESS = 0, /** Not located code line.*/
+		OUT_OF_RANGE, /** Outside functions range. */
+		SYMBOL, /** Symbol/ Function located (no codeline) */
+		FUNCTION, /** Function and line number.*/
+		EXACT /** Exact code line located with all information.*/
+	};
+	/**
+	* Constructor
+	* @param sAddress
+	* @param iOffSet value used if need to use offset value
+	*/
+	CATMemoryAddress( string& sAddress, unsigned long iOffSet );
+	/**
+	* Destructor
+	*/
+	virtual ~CATMemoryAddress();
+	/**
+	* Find which binary this address belongs to.
+	* Sets also the offsetfrommodulestart.
+	* @param vDlls container of binarys to find from.
+	* @return true if found
+	*/
+	bool FindSetModuleName(vector<DLL_LOAD_INFO>* vDlls);
+	/**
+	* Get vector index to which module we found this address to belong to.
+	* @return -1 if not set.
+	*/
+	int GetDllLoadInfoIndex();
+	/**
+	* Note return value includes the set offset.
+	* So this value is not binary start - address.
+	* Instead it is.
+	* memory address - binary start address + offset
+	* @return adress
+	*/
+	unsigned long GetOffSetFromModuleStart();
+	/**
+	* Get the binary start address
+	* @return binary start address
+	*/
+	unsigned long GetModuleStartAddress() const;
+	/**
+	* Set time
+	* @param ullTime
+	*/
+	void SetTime( unsigned long long& ullTime );
+	/**
+	* Get time
+	* @return unsigned long long
+	*/
+	unsigned long long GetTime();
+	/**
+	* Set address
+	* @param sAddess
+	*/
+	void SetAddress( string& sAddress );
+	/**
+	* Get address string
+	* @return string
+	*/
+	string GetAddressString();
+	/**
+	* Set address
+	* @param iAddress
+	*/
+	void SetAddress( unsigned long iAddress );
+	/**
+	* Get Address
+	* @return unsigned long
+	*/
+	unsigned long GetAddress();
+	/**
+	* Set module name
+	* @param sModuleName
+	*/
+	void SetModuleName( string& sModuleName );
+	/**
+	* Get module name
+	* @return string
+	*/
+	string GetModuleName();
+	/**
+	* Set state of locating code line
+	* @param eState
+	*/
+	void SetAddressToLineState( ADDRESS_TO_LINE_STATE eState );
+	/**
+	* Get current state of locating code line
+	* @return int
+	*/
+	int GetAddressToLineState();
+	/**
+	* Set filename
+	* @param sFileName
+	*/
+	void SetFileName(string& sFileName);
+	/**
+	* Get filename
+	* @return string
+	*/
+	string GetFileName();
+	/**
+	* Set function name
+	* @param sFunctionName
+	*/
+	void SetFunctionName(string& sFunctionName);
+	/**
+	* Get function name
+	* @return string
+	*/
+	string GetFunctionName();
+	/**
+	* Set function line number
+	* @param iFunctionLineNumber
+	*/
+	void SetFunctionLineNumber(int iFunctionLineNumber);
+	/**
+	* Get function line number
+	* @return int
+	*/
+	int GetFunctionLineNumber();
+	/**
+	* Set exact line number
+	* @param iExactLineNumber
+	*/
+	void SetExactLineNumber(int iExactLineNumber);
+	/**
+	* Get exact line number
+	* @return int
+	*/
+	int GetExactLineNumber();
+	/**
+	* Set module start address
+	* @param iAddress
+	*/
+	void SetModuleStartAddress(unsigned long iAddress);
+
+#ifndef MODULE_TEST
+private:
+#endif
+	// Used offset to add to addresses
+	unsigned long m_iOffSet;
+	// Address related members
+	string m_sAddress;
+	unsigned long m_iAddress;
+
+	// Time (microseconds from 1970)
+	unsigned long long m_iTime;
+
+	// Module related members(if FindSetModule is successful)
+	string m_sModuleName;
+	unsigned long m_iOffSetFromModuleStart;
+	unsigned long m_iModuleStartAddress;
+
+	// Module to which address belong.
+	int m_iDllLoadinfoIndex;
+
+	// Pin pointing related members
+	int m_ePinPointState;
+	string m_sFileName;
+	string m_sFunctionName;
+
+	int m_iFunctionLineNumber;
+	int m_iExactLineNumber;
+};
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATMmp.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* 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:  Class responsible of handling mmp files.
+*
+*/
+
+
+#ifndef __CATMMP_H__
+#define __CATMMP_H__
+
+// Includes
+#include "ATCommonDefines.h"
+#include "CATBase.h"
+
+/**
+* CATMmp represents mmp file of module.
+* All mmp file related actions are done using this class.
+* @author
+*/
+class CATMmp : public CATBase
+{
+
+public:
+
+	// Constructor
+	CATMmp();
+	
+	// Destructor
+	~CATMmp();
+	
+	string m_sMmpFile; /** The mmp file with path */
+
+	/**
+	* Makes AnalyzeTool changes to given mmp file.
+	* @param sTargetType target type of module i.e. exe / dll
+	* @param sId unique identification string added to source file name
+	* @return true if editing was successful.
+	*/
+	bool EditMmpFile(const string& sTargetType, const string& sId);
+
+	/**
+	* Backups mmp file to atool_temp/file
+	* to path/atool_temp/filename.mmp.tmp.
+	* Calling this function results always to 
+	* none edited mmp & none edited backup.
+	* @return true if successful.
+	*/
+	bool BackupMmpFile();
+
+	/**
+	* Restores backup from temporary directory (replacing current).
+	* @return true if successful.
+	*/
+	bool RestoreMmpFile();
+
+	/**
+	* VerifyAndRecover mmp file.
+	* Wont change mmp if it is not edited
+	* Replaces mmp file using backup if it exists and it is
+	* not edited otherwise removes changes from mmp file.
+	* @return true if successful
+	*/
+	bool VerifyAndRecover();
+
+#ifndef MODULE_TEST
+private:
+#endif
+		/**
+	* Checks if the given mmp file is modified by AT
+	* @param bBackup if true checks backup
+	* @return bool true if it is edited
+	*/
+	bool IsMmpEdited(bool bBackup = false );
+
+	/**
+	* CreateBackupPath creates string containinig
+	* full path to backup mmp file
+	*/
+	string CreateMmpBackupPath();
+
+	/**
+	* Removes AnalyzeTool changes from given file
+	* @param bBackup if true removes changes from backup
+	* @return true if successfully removed changes
+	*/
+	bool RemoveMmpFileChanges(bool bBackup = false);
+
+	/**
+	* Removes write protections from mmp file and its backup if exists.
+	* @return true if successful.
+	*/
+	bool RemoveWriteProtections();
+
+};
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATModule2.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,563 @@
+/*
+* 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:  Class representing a module in project (sbs2).
+*
+*/
+
+
+#ifndef __CATMODULE2_H__
+#define __CATMODULE2_H__
+
+// Includes.
+#include "ATCommonDefines.h"
+#include "CATBase.h"
+#include "CATMmp.h"
+
+// Forward declarations.
+class CATMemoryAddress;
+class IAddressToLine;
+
+/**
+* CATModule2 represents a module/component (single binary) in project.
+* CATProject contains a collection of these.
+*/
+class CATModule2 : public CATBase
+{
+
+public:
+	/**
+	* Constructor.
+	*/
+	CATModule2(void);
+	
+	/**
+	* Destructor.
+	*/
+	~CATModule2(void);
+	
+	/**
+	* Read modules attributes from SBS v.1 makefile.
+	* Also copies makefile to temporary directory if successful.
+	*/
+	bool ReadMakeFile();
+
+	/**
+	* Read modules attributes from SBS v.1 makefile.
+	* From make file which is in modules temporary directory.
+	*/
+	bool ReadMakeFileFromTemp();
+
+	/**
+	* Add sources using line where source files separated by spaces.
+	* @param sSourceLine.
+	*/
+	void AddSources(string& sSourceLine);
+
+	/**
+	* Add sources by giving source file and its corresponding listing file.
+	* @param sSourceFile
+	* @param sLstFile
+	*/
+	void AddSource(const string& sSourceFile, const string& sLstFile);
+
+	/**
+	* Create AT temporary cpp file for module.
+	* @param sS60FileName.
+	* @param sS60FileName.
+	* @param eLoggingMode.
+	* @param eBuildType.
+	* @param iAllocCallStackSize.
+	* @param iFreeCallStackSize.
+	* @return true if successful.
+	*/
+	bool CreateTempCpp(const string& sS60FileName
+		, const string& sS60FilePath
+		, int eLoggingMode
+		, int eBuildType
+		, int iAllocCallStackSize
+		, int iFreeCallStackSize );
+
+	/**
+	* returns default data file name without extension in format processName.targetType
+	* @return string with default file name
+	*/
+	string GetDefaultFileName();
+
+	/**
+	* Add AT changes to modules mmp file.
+	* @return true if successful.
+	*/
+	bool ModifyMmp();
+
+	/**
+	* Restore any changes made to modules mmp file.
+	* @return true if successful.
+	*/
+	bool RestoreMmp();
+
+	/**
+	* Verify tha mmp does not contain AnalyzeTool made changes.
+	* If it does contain them will remove them manually or using backup.
+	* @return true if successful.
+	*/
+	bool VerifyAndRecoverMmp();
+
+	/**
+	* Copy modules releasables to its temporary dir.
+	* This includes map & lst files.
+	* @return true if successful.
+	*/
+	bool CopyReleasables();
+
+	/**
+	* Copy modules listing files to given directory.
+	* After copy they will be deleted.
+	* @param sDir target directory.
+	* @return true if successful.
+	*/
+	bool CopyLstFilesToDir( const string& sDir );
+
+	/**
+	* Delete modules lst files from their source
+	* directories.
+	* @return true if succesfful.
+	*/
+	bool DeleteLstFilesFromSrc();
+
+	/**
+	* Clean modules temporary directory of files,
+	* not defined in UNDELETE list.
+	* @return true if successful
+	*/
+	bool CleanTemporaryDir();
+
+	/**
+	* Delete modules temporary directory.
+	* @return true if successful.
+	*/
+	bool DeleteTemporaryDir();
+
+	/**
+	* Locate codeline of given memory address.
+	* Given address must be calculated to correspond map file addresses.
+	* @param pMemoryAddress object where to store results.
+	* @return true if successful.
+	*/
+	bool AddressToLine(CATMemoryAddress* pMemoryAddress);
+
+	/**
+	* Check does modules symbol file(s) exist.
+	* @return true if it exists.
+	*/
+	bool SymbolFileExist( void );
+
+	/**
+	* Check does modules map file(s) exists.
+	* @return true if it exists.
+	*/
+	bool MapFileExist( void );
+
+	/**
+	* Check does modules binary file(s) exist.
+	* @return true if it exists.
+	*/
+	bool BinaryFileExist( void );
+
+#ifndef MODULE_TEST
+private:
+#endif
+
+	/**
+	* Read modules attributes from make file.
+	*/
+	bool ReadMakeFilePrivate();
+
+	/**
+	* Locate codeline of given memory address (winscw platform).
+	* Given address must be calculated to correspond map file addresses.
+	* @param pMemoryAddress object where to store results.
+	* @return true if successful.
+	*/
+	bool AddressToLineWinscw(CATMemoryAddress* pMemoryAddress );
+
+	/**
+	* Locate codeline of given memory address (armv5 platform).
+	* Given address must be calculated to correspond map file addresses.
+	* @param pMemoryAddress object where to store results.
+	* @return true if successful.
+	*/
+	bool AddressToLineArmv5(CATMemoryAddress* pMemoryAddress );
+
+	/**
+	* Locate codeline of given memory address.
+	* Given address must be calculated to correspond map file addresses.
+	* @param pMemoryAddress object where to store results.
+	* @return true if successful.
+	*/
+	bool AddressToLineAddr2lineExe( CATMemoryAddress* pMemoryAddress );
+
+	/**
+	* Search map file data (symbols) using given address.
+	* @param iAddress memory address.
+	* @return index of the symbol or -1 if not found.
+	*/
+	int GetSymbolIndexUsingAddress(unsigned long iAddress) const;
+
+	/**
+	* Search listing  files data using the given symbol name.
+	* @param sSymbolName symbols name to find.
+	* @return index of the found lst data or -1 if not found.
+	*/
+	int GetLineInFileIndexUsingSymbolName(const string& sSymbolName) const;
+	
+	/**
+	* Search the exact code line from given file.
+	* @param sFileName listing file to search from.
+	* @param iLine functions line number.
+	* @param iFromFuncAddress how many bytes from functions start.
+	* @return line number or -1 if not found.
+	*/
+	int FindLeakCodeLine( string& sFileName, int iLine, unsigned long iFromFuncAddress ) const;
+
+public:
+
+	/**
+	* Set used build system (CATProject::BUILD_SYSTEM).
+	* @param eBuildSystem.
+	*/
+	void SetBuildSystem( int eBuildSystem );
+
+	/**
+	* Get defined build system.
+	* @return int CATProject::BUILD_SYSTEM
+	*/
+	int GetBuildSystem( void ) const ;
+
+	/**
+	* Set SBS v.1 makefile.
+	* @param sMakeFile
+	*/
+	void SetMakeFile( const string& sMakeFile );
+	
+	/**
+	* Get SBS v.1 makefile.
+	* @return string makefile.
+	*/
+	string GetMakeFile( void ) const;
+
+	/**
+	* Initialize module ready for locating code lines.
+	* with memory addresses (reads map and listing files).
+	* return true if successful.
+	*/
+	bool InitializeAddressToLine();
+	
+	/**
+	* Set modules mmp file.
+	* This also creates temporary dir if it is missing.
+	* @return true if successful.
+	*/
+	bool SetMmpFile(const string& sMmpFile);
+
+	/**
+	* Create modules own temporary directory.
+	* @return true if successful.
+	*/
+	bool CreateTemporaryDirectory();
+
+	/**
+	* Get modules mmp file.
+	* @return mmp file.
+	*/
+	string GetMmpFile() const;
+
+	/**
+	* Get modules atool_temp directory path.
+	* @return atool_temp directory path.
+	*/
+	string GetTempPath() const;
+
+	/**
+	* Get S60 logging file name.
+	* @return s60 logging file name.
+	*/
+	string GetS60FileName() const;
+
+	/**
+	* Set S60 logging file name.
+	* @param aFileName s60 logging file name.
+	*/
+	void SetS60FileName( const string& aFileName );
+
+	/**
+	* Set target binary name.
+	* @param sTarget binary file name.
+	*/
+	void SetTarget(const string& sTarget);
+
+	/**
+	* Get target binary name.
+	* @return modules binary file name.
+	*/
+	string GetTarget() const;
+
+	/**
+	* Set binary target type.
+	* @param sTargetType binary target type.
+	*/
+	void SetTargetType(const string& sTargetType);
+
+	/**
+	* Get binary target type.
+	* @return binary target type.
+	*/
+	string GetTargetType() const;
+
+	/**
+	* Set requested binary target file extension.
+	* @param sRequestedTargetExt binary target file extension.
+	*/
+	void SetRequestedTargetExt( const string& sRequestedTargetExt );
+
+	/**
+	* Get requested binary target file extension.
+	* @return binary target file extension.
+	*/
+	string GetRequestedTargetExt() const;
+
+	/**
+	* Get full name of modules binary.
+	* @return modules binary files full name.
+	*/
+	string GetBinaryName() const;
+
+	/**
+	* Set variant platform.
+	* @param sVariantPlatform variant platform.
+	*/
+	void SetVariantPlatform(const string& sVariantPlatform);
+
+	/**
+	* Get variant platform.
+	* @return variant platform.
+	*/
+	string GetVariantPlatform() const;
+
+	/**
+	* Set variant type.
+	* @param sVariantType variant type.
+	*/
+	void SetVariantType(const string& sVariantType);
+
+	/**
+	* Get variant type.
+	* @return variant type.
+	*/
+	string GetVariantType() const;
+
+	/**
+	* Set feature variant.
+	* @param sFeatureVariant feature variant.
+	*/
+	void SetFeatureVariant(const string& sFeatureVariant);
+
+	/**
+	* Get feature variant.
+	* @return feature variant.
+	*/
+	string GetFeatureVariant() const;
+
+	/**
+	* Set feature variant name.
+	* @param sFeatureVariantName feature variant name.
+	*/
+	void SetFeatureVariantName(const string& sFeatureVariantName);
+
+	/**
+	* Get feature variant name.
+	* @return feature variant name.
+	*/
+	string GetFeatureVariantName() const;
+
+	/**
+	* Set release path.
+	* @param sReleasePath release path.
+	*/
+	void SetReleasePath(const string& sReleasePath);
+
+	/**
+	* Get release path.
+	* @return release path.
+	*/
+	string GetReleasePath() const;
+
+	/**
+	* Set full variant path.
+	* @param sFullVariantPath full variant path.
+	*/
+	void SetFullVariantPath(const string& sFullVariantPath);
+
+	/**
+	* Get full variant path.
+	* @return full variant path.
+	*/
+	string GetFullVariantPath() const;
+
+	/**
+	* Set compile definition(s) of the module.
+	* @param sCompileDefinitions
+	*/
+	void SetCompileDefinitions( const string& sCompileDefinitions );
+
+	/**
+	* Get compile definition(s) of the module.
+	* @return compile definition(s).
+	*/
+	string GetCompileDefinitions() const;
+
+	/**
+	* Is modules target type udeb?
+	* @return true if modules target type is udeb.
+	*/
+	bool IsUDEB() const;
+
+	/**
+	* Is module build successfully?
+	* This includes check of listing and map files from temporary directory.
+	* @return true if module build successfully.
+	*/
+	bool IsMakeSuccessfull();
+
+	/**
+	* Get error string. This includes possible erros what are generated when
+	* IsMakeSuccesfull is called.
+	* @return error string.
+	*/
+	string GetErrors() const;
+
+	/**
+	* Create build complete file to modules temporary directory.
+	* @return true if build complete file created successfully.
+	*/
+	bool CreateBuildCompleteFile( void );
+
+	/**
+	* Read map file (armv5 platform).
+	* @return true if map file read successfully.
+	*/
+	bool ReadMapFileArmv5();
+
+	/**
+	* Set compile info text
+	* @param sCompileInfoText
+	*/
+	void SetCompileInfoText( string sCompileInfoText );
+
+	/**
+	* Get compile info text
+	* @return compile info text
+	*/
+	string GetCompileInfoText() const;
+
+#ifndef MODULE_TEST
+private:
+#endif
+
+	/**
+	* Struct for saving source information
+	* sCpp is source file.
+	* sLst sources corresponding lst file.
+	* bStatic true if source information from static library.
+	*/
+	struct SOURCE
+	{
+		bool bStatic;
+		string sCpp;
+		string sLst;
+		SOURCE() : bStatic(false), sCpp(""), sLst("") {}
+	};
+
+	// Build system
+	int m_eBuildSystem;
+	// Sbs v.1 makefile
+	string m_sMakeFile;
+	// Mmp file.
+	CATMmp m_Mmp;
+	// Temporary directory with path.
+	string m_sTempPath;
+	// Target.
+	string m_sTarget;
+	// Target type.
+	string m_sTargetType;
+	// True target extension.
+	string m_sRequestedTargetExt;
+	// Variant platform.
+	string m_sVariantPlatform;
+	// Variant type.
+	string m_sVariantType;
+	// Feature variant.
+	string m_sFeatureVariant;
+	// Feature variant name.
+	string m_sFeatureVariantName;
+	// Release path (releasables).
+	string m_sReleasePath;
+	// Full variant path (path to releasables).
+	string m_sFullVariantPath;
+	// String to store information of compile
+	string m_sCompileInfoText;
+	// String to store possible error messages.
+	string m_sErrors;
+	// Compile definition(s)
+	string m_sCompileDefinitions;
+	// Source files.
+	vector<SOURCE> m_vSources;
+	// Listing data.
+	vector<LINE_IN_FILE> m_vLineInFile;
+	// Modules map data (symbols).
+	vector<MAP_FUNC_INFO> m_vMapFileFuncList;
+	// File logging mode filename.
+	string m_sS60FileName;
+	// true if file name not empty and %processname% string replaced
+	bool m_bS60FileNameResolved;
+	// File logging mode file path.
+	string m_sS60FilePath;
+	// Is all data loaded for address to code line functions.
+	bool m_bAddressToLineInitialized;
+	// Read listing files (armv5 platform).
+	bool ReadListingFilesArmv5();
+	// Get listing file name of given source file.
+    string GetLstNameOfSource(string sSource) const;
+	// Copy listing files to temporary directory.
+	bool CopyLstFilesToTemp();
+	// Copy map file to temporary directory.
+	bool CopyMapFileToTemp();
+	// Get full map file name.
+	string GetMapFile() const;
+	// Get full symbol file name.
+	string GetSymbolFile() const;
+	// Get full binary file name.
+	string GetBinaryFile() const;
+	// Helper function to check is platform armv5.
+	bool IsPlatformArmv5() const;
+	// Get "unique" id of module
+	string GetUniqueId() const;
+	// Sbs v.1 variant urel label.
+	string m_sFeatureVariantURELLabel;
+	// Sbs v.1 variant udeb label.
+	string m_sFeatureVariantUDEBLabel;
+	// Object used to get codelines of memory addresses.
+	IAddressToLine* m_pAddressToLine;
+};
+#endif
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATParseBinaryFile.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* 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:  Definitions for class CATParseTrace, CProcessData and
+*               CSubTestData.
+*
+*/
+
+
+#ifndef __CATPARSEBINARYFILE_H__
+#define __CATPARSEBINARYFILE_H__
+
+#include "../inc/ATCommonDefines.h"
+#include "../inc/CATDataSaver.h"
+#include "../inc/CATBase.h"
+#include "../inc/catallocs.h"
+
+/**
+* Parses raw trace data to AnalyzeTool specific data file.
+*/
+class CATParseBinaryFile : public CATBase
+{
+public:
+	/**
+	* Constructor
+	*/
+	CATParseBinaryFile();
+
+	/**
+	* Main function to start parse.
+	*
+	* @param pFileName A trace file name
+	* @param pOutputFileName Pointer to output file name
+	*/
+	bool StartParse( const char* pFileName, const char* pOutputFileName );
+
+	/**
+	* Get data saver
+	* @return CATDataSaver*
+	*/
+	CATDataSaver* GetDataSaver(void);
+	
+	/**
+	* Gets 64bit number from input string
+	* @param cVal Input data
+	* @return Acquired number
+	*/
+	unsigned __int64 StringToNum64( unsigned char* cVal );
+
+	/**
+	* Gets 32bit number from input string
+	* @param cVal Input data
+	* @return Acquired number
+	*/
+	unsigned long StringToNum32( unsigned char* cVal );
+
+	/**
+	* Get next string from file
+	* @param pData Acquired data
+	* @param pIn Input file stream
+	* @param pStreamPos Actuall position in file
+	* @param pStreamEnd End of file
+	* @return false if no error
+	*/
+	bool GetString( unsigned char* pData, ifstream &pIn, size_t &streamPos,  size_t streamEnd );
+
+	/**
+	* Get next 8bit number from file
+	* @param pData Acquired data
+	* @param pIn Input file stream
+	* @param pStreamPos Actuall position in file
+	* @param pStreamEnd End of file
+	* @return false if no error
+	*/
+	bool GetNum8( unsigned char* pData, ifstream &pIn, size_t &pStreamPos, size_t pStreamEnd );
+
+	/**
+	* Get next 32bit number from file
+	* @param pData Acquired data
+	* @param pIn Input file stream
+	* @param pStreamPos Actuall position in file
+	* @param pStreamEnd End of file
+	* @return false if no error
+	*/
+	bool GetNum32( unsigned char* pData, ifstream &pIn, size_t &pStreamPos, size_t pStreamEnd );
+
+	/**
+	* Get next 64bit number from file
+	* @param pData Acquired data
+	* @param pIn Input file stream
+	* @param pStreamPos Actuall position in file
+	* @param pStreamEnd End of file
+	* @return false if no error
+	*/
+	bool GetNum64( unsigned char* pData, ifstream &pIn, size_t &pStreamPos, size_t pStreamEnd );
+
+#ifndef MODULE_TEST
+private:
+#endif
+	CATDataSaver m_DataSaver; /** Data saver */
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATParseTraceFile.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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:  Definitions for class CATParseTrace, CProcessData and
+*               CSubTestData.
+*
+*/
+
+
+#ifndef __CATPARSETRACEFILE_H__
+#define __CATPARSETRACEFILE_H__
+
+#include "../inc/ATCommonDefines.h"
+#include "../inc/CATDataSaver.h"
+#include "../inc/CATBase.h"
+#include "../inc/catallocs.h"
+
+/**
+* Parses raw trace data to AnalyzeTool specific data file.
+*/
+class CATParseTraceFile : public CATBase
+{
+public:
+	/**
+	* Constructor
+	*/
+	CATParseTraceFile();
+
+	/**
+	* Main function to start parse.
+	*
+	* @param pFileName A trace file name
+	* @param pOutputFileName Pointer to output file name
+	*/
+	bool StartParse( const char* pFileName, const char* pOutputFileName, const char* pCleanedTraceFile = NULL );
+
+	/**
+	* Get data saver
+	* @return CATDataSaver*
+	*/
+	CATDataSaver* GetDataSaver(void);
+	
+	/**
+	* Get time from timestamp in microseconds as string
+	* @param iTimeStamp Timestamp for current message
+	* @param iTimeSpan Timespan for current process
+	* @return string Acquired time in microseconds(as string)
+	*/
+	static string GetTimeFromTimeStamp( unsigned __int64 iTimeStamp, unsigned __int64 iTimeSpan );
+
+#ifndef MODULE_TEST
+private:
+#endif
+	CATDataSaver m_DataSaver; /** Data saver */
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATParseXML.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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:  Declarations for the class CATParseXML.
+*
+*/
+
+
+#ifndef __CATPARSEXML_H__
+#define __CATPARSEXML_H__
+
+#include "../inc/ATCommonDefines.h"
+
+/**
+* CATParseXML is used to parse xml data.
+*/
+class CATParseXML
+{
+public:
+	/**
+	* Constructor
+	*/
+	CATParseXML(void);
+	
+	/**
+    * Destructor
+    */
+	virtual ~CATParseXML(void);
+
+	/**
+	* Find epocroot path in xml file
+	* @param sourcePath Location of the xml file
+	*/
+	string GetEpocRootPathFromXML(const char* sourcePath);
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATProcessData.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* 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:  Definitions for class CATParseTrace, CProcessData and
+*               CSubTestData.
+*
+*/
+
+#ifndef __CATPROCESSDATA_H__
+#define __CATPROCESSDATA_H__
+
+/**
+* Represents data of a single subtest.
+*/
+class CSubTestData : public CATAllocs
+{
+public:
+	// Members
+
+	bool bRunning; /** Is sub test running */
+	vector<string> vData; /** data */
+	string sSubTestName; /** test name */
+	string sStartTime; /** start time */
+	string sEndTime; /** end time */
+	string sSubTestStartHandleCount; /** handle count at start */
+	string sSubTestEndHandleCount; /** handle count at end */
+};
+
+/**
+* Represents data of a single run.
+*/
+class CProcessData : public CATAllocs
+{
+public:
+	// Members
+
+	bool bProcessOnGoing; /** is process on going */
+	int iProcessID; /** process id (pid)*/
+	vector<string> vData; /** data */
+	vector<string> vHandleLeaks; /** handle leak(s) */
+	vector<CSubTestData> vSubTests; /** process sub test(s) */
+
+	// time at the start of the process - time stamp at the start of process
+	// in microseconds
+	unsigned __int64 iTimeSpan;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/CATProject.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,642 @@
+/*
+* 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:  Class representing a project.
+*
+*/
+
+
+#ifndef __CATPROJECT_H__
+#define __CATPROJECT_H__
+
+#include "ATCommonDefines.h"
+#include "CATBase.h"
+#include "../inc/CATParseBinaryFile.h"
+
+class CATModule2;
+class CATDatParser;
+
+// Raptor cmd and makefile constants used
+#define RAPTOR_CMD_BASE "sbs -b bld.inf  --makefile=atool_temp/build/make_build --config="
+#define RAPTOR_MAKEFILE "atool_temp\\build\\make_build.default"
+#define RAPTOR_MAKEFILE_LOG " --logfile=atool_temp\\build\\makefile.xml"
+#define RAPTOR_BUILD_LOG " --logfile=atool_temp\\build\\build.xml"
+#define RAPTOR_REALLYCLEAN_LOG " --logfile=atool_temp\\build\\reallyclean.xml"
+#define RAPTOR_BUILD_LOG_NAME "atool_temp\\build\\build.xml"
+#define RAPTOR_LISTING_LOG " --logfile=atool_temp\\build\\listing.xml"
+
+#define RAPTOR_NOBUILD_SWITCH " --nobuild"
+#define RAPTOR_MAKEFILE_SWITCH "--makefile=atool_temp/build/make_build"
+
+
+// Raptor makefile constant variable names
+#define RAPTOR_PROJECT_META "PROJECT_META:="
+#define RAPTOR_SOURCE "SOURCE:="
+#define RAPTOR_TARGET "TARGET:="
+#define RAPTOR_TARGETYPE "TARGETTYPE:="
+#define RAPTOR_REQUESTEDTARGETEXT "REQUESTEDTARGETEXT:="
+#define RAPTOR_VARIANTPLATFORM "VARIANTPLATFORM:="
+#define RAPTOR_VARIANTTYPE "VARIANTTYPE:="
+#define RAPTOR_FEATUREVARIANT "FEATUREVARIANT:="
+#define RAPTOR_FEATUREVARIANTNAME "FEATUREVARIANTNAME:="
+#define RAPTOR_RELEASEPATH "RELEASEPATH:="
+#define RAPTOR_FULLVARIANTPATH "FULLVARIANTPATH:="
+#define RAPTOR_COMPILE_DEFINITIONS "CDEFS:="
+
+// Sbs v.1 makefile constants.
+#define MAKEFILE_SEARCH_STRING "@perl -S checksource.pl"
+#define MMPFILE_SEARCH_STRING "PRJ_MMPFILES MMP"
+#define MMPTESTFILE_SEARCH_STRING "PRJ_TESTMMPFILES MMP"
+#define SOURCE_PATH "SOURCEPATH"
+#define SOURCE_STRING "SOURCE"
+#define TARGET_STRING "TARGET"
+
+/**
+* CATProject represents a project (collection of modules).
+* It has to be set mode in which it operates like
+* compile / analyze and necessary parameters for that.
+* Then call Run method which also returs error codes
+* defined in AT_ERROR_CODES enumeration.
+* @author
+*/
+class CATProject : public CATBase
+{
+public:
+	
+	/**
+	* Enumeration representing used build systems
+	*/
+	enum BUILD_SYSTEM {
+		SBS_V1 = 1,
+		SBS_V2 = 2
+	};
+
+	/**
+	* Enumeration representing the mode project is run.
+	*/
+	enum PROJECT_MODE {
+		COMPILE = 0,
+		INSTRUMENT = 1,
+		UNINSTRUMENT = 2,
+		UNINSTRUMENT_FAILED =3,
+		FAILED = 4,
+		CLEAN = 5,
+		ANALYZE = 6,
+		INSTRUMENT_CONSOLE = 7,
+		UNINSTRUMENT_CONSOLE = 8,
+		FAILED_CONSOLE = 9,
+		NOT_DEFINED = 10
+	};
+
+	/**
+	* Enumeration repserenting the logging mode.
+	*/
+	enum LOGGING_MODE {
+		DEFAULT = 0,
+		FILE = 1,
+		TRACE = 2,
+		TRACE_FAST = 3
+	};
+
+	/**
+	* Enumeration representing build type.
+	*/
+	enum BUILD_TYPE {
+		UREL = 0,
+		UDEB = 1
+	};
+
+public:
+
+	/**
+	* Constructor
+	*/
+	CATProject();
+
+	/**
+	* Destructor
+	*/
+	~CATProject();
+
+	CATParseBinaryFile Parser;
+
+	/**
+	* Set arguments.
+	* @param arguments.
+	* @return true if arguments ok.
+	*/
+	bool SetArguments( ARGUMENTS& arguments );
+
+	/**
+	* Set build system to be used with project.
+	* See BUILD_SYSTEM enumeration for available systems.
+	* @param eSystem system.
+	*/
+	void SetBuildSystem( BUILD_SYSTEM eSystem );
+
+	/**
+	* Set mode which to run.
+	* See PROJECT_MODE enumeration for available modes.
+	* @param eMode mode.
+	*/
+	void SetMode(PROJECT_MODE eMode);
+
+	/**
+	* Get project mode.
+	* @return mode of project.
+	*/
+	int GetMode() const;
+
+	/**
+	* Set epocroot.
+	* @param sEpocroot
+	*/
+	void SetEpocRoot( const string& sEpocRoot );
+
+	/**
+	* Set project platform.
+	* @param sPlatform platform.
+	*/
+	void SetPlatform( const string& sPlatform );
+
+	/**
+	* Set variant.
+	* @sVariant variant.
+	*/
+	void SetVariant( const string& sVariant );
+
+	/**
+	* Set logging mode. See LOGGING_MODE enumeration for available modes.
+	* @param eLogginMode logging mode.
+	*/
+	void SetLoggingMode( LOGGING_MODE eLoggingMode);
+
+	/**
+	* Set build type. See BUILD_TYPE enumeration for available types.
+	* @param eType build type.
+	*/
+	void SetBuildType( BUILD_TYPE eType );
+	
+	/**
+	* Set S60 logging filename.
+	* @param sFileName filename.
+	*/
+	void SetS60FileName( const string& sFileName);
+
+	/**
+	* Set S60 logging file path.
+	* @param sFilePath filename.
+	*/
+	void SetS60FilePath( const string& sFilePath );
+
+	/**
+	* Set target module.
+	* @param sTargetModule target module name.
+	*/
+	void SetTargetModule( const string& sTargetModule );
+
+	/**
+	* Set multiple target modules used in project.
+	* @param vTargetModules target module names.
+	*/
+	void SetTargetModules( const vector<string>& vTargetModules );
+
+	/**
+	* Set Binary target name to create analysis results to.
+	* @param sBinaryTarget binary target name.
+	*/
+	void SetBinaryTarget( const string& sBinaryTarget );
+
+	/**
+	* Set data file to analyze.
+	* @param sDataFile datafile.
+	*/
+	void SetDataFile( const string& sDataFile );
+
+	/**
+	* Set rom symbol file(s) used in analyze.
+	* @param sRomSymbolFile.
+	*/
+	void SetRomSymbolFiles(const vector<string>& vRomSymbolFiles);
+
+	/**
+	* Set the logging level of analysis report.
+	* @param iLogLevel log level.
+	*/
+	void SetLogLevel( int iLogLevel );
+
+	/**
+	* Set the size of allocation call stack to be written in temporary cpp.
+	* @param iAllocCallStackSize
+	*/
+	void SetAllocCallStackSize( int iAllocCallStackSize );
+
+	/**
+	* Set the size of free call stack to be written in temporary cpp.
+	* @param iFreeCallStackSize
+	*/
+	void SetFreeCallStackSize( int iFreeCallStackSize );
+
+	/**
+	* Set the output file name to store analyse report.
+	* @param sDataFileOutput data file name.
+	*/
+	void SetDataFileOutput( const string& sDataFileOutput );
+
+	/**
+	* Set build command used in compile phase.
+	* @param sBuildCommand build command.
+	*/
+	void SetBuildCommand( const string& sBuildCommand );
+
+	/**
+	* Run the set mode.
+	* @return error code.
+	*/
+	int Run();
+
+	/**
+	* Run recovery, used when "instatly" need to recover modules and exit.
+	*/
+	int RunRecoveryAndExit();
+
+	/**
+	* Get build type string.
+	* @param eType type from which to get correponding string.
+	* @return types corresponding string.
+	*/
+	static string GetBuildTypeString( int eType );
+
+	/**
+	* Reads projects configuration file if it exists.
+	* @return false in case the data contains information that project is uninstrumented. Otherwise returns always true.
+	*/
+	bool IsUninstrumented();
+
+#ifndef MODULE_TEST
+private:
+#endif
+	/**
+	* Run compiling in console.
+	* @return error code.
+	*/
+	int RunCompile( void );
+
+	/**
+	* Run cleaning project.
+	* @return error code.
+	*/
+	int RunClean( void );
+
+	/**
+	* Run running analyze.
+	* @return error code.
+	*/
+	int RunAnalyze( void );
+
+	/**
+    * Run instrumenting of project for Carbide extension (pre-build).
+	* @return error code.
+	*/
+	int RunInstrument( void );
+
+	/**
+	* Run uninstrumenting of project for Carbide extension (post-build).
+	* @return error code.
+	*/
+	int RunUninstrument( void );
+
+	/**
+	* Run uninstrumenting of project for Carbide extension(post-build), when build failed.
+	* @return error code.
+	*/
+	int RunUninstrumentFailed( void );
+
+	/**
+	* Run console instrumenting.
+	* @return error code.
+	*/
+	int RunInstrumentConsole( void );
+
+	/**
+	* Run Console uninstrumenting.
+	* @return error code.
+	*/
+	int RunUninstrumentConsole( void );
+
+	/**
+	* Run console uninstrumenting, when build failed.
+	* @return error code.
+	*/
+	int RunFailedConsole( void );
+
+	/**
+	* Show summary of compilation.
+	*/
+	void DisplayCompileSummary( void );
+
+	/**
+	* Show summary, build target, build type, logging mode...
+	*/
+	void DisplayBuildSummary( void );
+
+	/**
+	* Create make files.
+	* @return true if successful
+	*/
+	bool CreateMakeFile( void );
+	/**
+	* Create SBS v.1 make files.
+	* @return true if successful.
+	*/
+	bool CreateMakeFileSbs1( void );
+	/**
+	* Copy sbs1 makefile to temporary folder.
+	* @return true if successful.
+	*/
+	bool CopyMakeFileSbs1ToTemporaryFolder( void );
+	/**
+	* Run really clean in SBS v.1.
+	* @return true if successful.
+	*/
+	bool RunReallyCleanSbs1( void );
+	/**
+	* Run really clean in SBS v.2.
+	* @return true if successful.
+	*/
+	bool RunReallyCleanSbs2( void );
+	/**
+	* Run export in SBS v.1.
+	* @return true if successful.
+	*/
+	bool RunExportSbs1( void );
+	/**
+	* Create make files (level2) SBS v.1.
+	* @return true if successful.
+	*/
+	bool CreateMakeFileSbs1Level2( void );
+	/**
+	* Create makefile SBS v.2.
+	* @return true if successful.
+	*/
+	bool CreateMakeFileSbs2( void );
+	/**
+	* Read makefile.
+	* @return true if successful.
+	*/
+	bool ReadMakeFile( void );
+	/**
+	* Read SBS v.1 makefile.
+	* @return true if successful.
+	*/
+	bool ReadMakeFileSbs1( void );
+	/**
+	* Read SBS v.1 makefile (Level1).
+	* @return true if successful.
+	*/
+	bool ReadMakeFileSbs1Level1( void );
+	/**
+	* Read SBS v.2 makefiles.
+	* @return true if successful.
+	*/
+	bool ReadMakeFileSbs2( void );
+	/**
+	* Read specified SBS v.2 makefile.
+	* @param sMakeFile makefile to be read.
+	* @return true if succesful.
+	*/
+	bool ReadMakeFileSbs2( string& sMakeFile );
+
+	/**
+	* Filter unsupported and static libraries to their own vectors.
+	* Unsupported include kernel types, modules with kernel mode compile definition.
+	* @return true if successful.
+	*/
+	bool FilterModules();
+
+	/**
+	* Creates temporary directories for all modules
+	* in member vector.
+	* @return true if successful.
+	*/
+	bool CreateTemporaryDirectories();
+
+	/**
+	* Creates tempororary cpp files for all modules
+	* in member vector.
+	* @return true if successful.
+	*/
+	bool CreateTemporaryCpps();
+
+	/**
+	* Hooks all modules in member vector
+	* (modifies mmp files)
+	* @return true if successful
+	*/
+	bool ModifyModules( void );
+
+	/**
+	* Unhooks all modules in member vector
+	* (removes changes from mmp files)
+	* @return true if successful
+	*/
+	bool RestoreModules( void );
+
+	/**
+	* Verifys that member vectors modules
+	* mmp files unchanged. Restores if they are
+	* from backup or from original.
+	* @return true if successful
+	*/
+	bool VerifyAndRecoverModules( void );
+
+	/**
+	* Runs compilation.
+	* @return true if successful.
+	*/
+	bool Compile( void );
+	/**
+	* @return true if successful.
+	*/
+	bool CompileSbs1( void );
+	/**
+	* @return true if successful.
+	*/
+	bool CompileSbs2( void );
+
+	/**
+	* Runs listing creatation.
+	* @return true if successful
+	*/
+	bool CreateListings( void );
+	/**
+	* @return true if successful.
+	*/
+	bool CreateListingsSbs1( void );
+	/**
+	* @return true if successful.
+	*/
+	bool CreateListingsSbs2( void );
+	/**
+	* Copies releasables of modules including lst & map files
+	* for all modules in project to their temporary directories.
+	* @return true if successful.
+	*/
+	bool CopyReleasables( void );
+	/**
+	* Deletes all atool_temp directories
+	* of member vector modules.
+	* @return true if successful.
+	*/
+	bool DeleteTemporaryDirs( void );
+	/**
+	* Deletes files from atool_temp directory
+	* of member vector modules which extension not defined
+	* in TEMP_EXTENSION_NO_DELETE table.
+	* @return true if successful.
+	*/
+	bool CleanTemporaryDirs( void );
+	/**
+	* Writes class attributes to a file
+	* under atool_temp directory.
+	* @return true if successful.
+	*/
+	bool WriteAttributes( void ) const;
+	/**
+	* Read class attributes from a file
+	* under atool_temp directory.
+	* @return true if successful.
+	*/
+	bool ReadAttributes( void );
+
+	/**
+	* Creates atool_temp directory if it does not
+	* exist in current directory.
+	* @return true if successful.
+	*/
+	bool MakeTempDirIfNotExist( void );
+
+#ifndef MODULE_TEST
+private:
+#endif
+
+	/**
+	* Clean all module vectors.
+	*/
+	void CleanModuleVectors();
+
+	/**
+	* Get build type as string.
+	* @return buildtype string.
+	*/
+	string GetBuildTypeString();
+
+	/**
+	* Helper function to add target module(s)
+	* if any defined in class to given sbs command.
+	* @param sCmd command to add modules to.
+	*/
+	void AddTargetModuleIfDefined(string& sCmd);
+
+	/**
+	* Run given system/abld command to all defined target modules in vector.
+	* Space char (if its missing) will be added to given command + one target
+	* module at a time.
+	* @param sCommand sCommand to run.
+	* @return true if none system call sets error level other than 0.
+	*/
+	bool RunAbldCommandToAllTargets( const string& sCommand );
+
+	/**
+	* Check is target module in project.
+	* If no modules / targets defined return value is true.
+	* @return true if target module is in project.
+	*/
+	bool IsTargetModuleInProject( void ) const;
+
+	/**
+	* Initializes member make file variable with correct full path to point (epoc32/build)...
+	* @return true if successful.
+	*/
+	bool InitSbs1MakeFileWithPath();
+
+	/**
+	* Initializes member make file variable with correct full path to (atoo_temp...)
+	* @return true if successful.
+	*/
+	bool InitSbs1MakeFileWithPathToTemp();
+
+#ifndef MODULE_TEST
+private:
+#endif
+	// System current directory.
+	char m_cCurrentDir[ MAX_LINE_LENGTH ];
+	// Projects build system
+	int m_eBuildSystem;
+	// Project modules.
+	vector<CATModule2*> m_vModules;
+	// Static libraries.
+	vector<CATModule2*> m_vStaticLibraries;
+	// Unsupported project modules.
+	vector<CATModule2*> m_vUnsupportedModules;
+	// Run mode.
+	int m_eMode;
+	// Logging level (used in analyse).
+	int m_iLoggingLevel;
+	// Is project unsinstrumented.
+	bool m_bUninstrumented;
+	// Is build just for test modules
+	bool m_bAbldTest;
+	// Build command.
+	string m_sBuildCommand;
+	// Epocroot
+	string m_sEpocRoot;
+	// Platform i.e. armv5.
+	string m_sPlatform;
+	// SBS2 variant.
+	string m_sVariant;
+	// Logging mode (used in compile,instrumenting).
+	int m_eLoggingMode;
+	// Allocation call stack size
+	int m_iAllocCallStackSize;
+	// Free call stack size
+	int m_iFreeCallStackSize;
+	// Build type udeb / urel.
+	int m_eBuildType;
+	// Sbs v.1 level 1 make file
+	string m_sMakeFile;
+	// User given S60 log file name.
+	string m_sS60FileName;
+	// User given S60 log file path.
+	string m_sS60FilePath;
+	// Target module.
+	string m_sTargetModule;
+	// Target modules (used in carbide instrumenting).
+	vector<string> m_vTargetModules;
+	// Binary target (used in analyse).
+	string m_sBinaryTarget;
+	// User given datafile to analyse.
+	string m_sDataFile;
+	//
+	vector<string> m_vRomSymbolFiles;
+	// Temporary data file name if user gave trace file.
+	string m_sDataFileTemp;
+	// Temporary data file name if user gave binary log file.
+	string m_sBinaryLogFileTemp;
+	// User given output file to store analyse results.
+	string m_sDataFileOutput;
+	// Analyser object.
+	CATDatParser* m_pAnalyzer;
+};
+#endif
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/cataddr2line.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* 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:  Windows debug api implementation for IAddressToLine interface.
+*
+*/
+
+#ifndef __CATADDR2LINE_H__
+#define __CATADDR2LINE_H__
+
+#include "iaddresstoline.h"
+#include "../inc/cataddr2lineserver.h"
+
+// Allowed characters in output.
+//const char ADDR2LINEALLOWEDCHARS[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :/\\_.-";
+
+/**
+* Implements addresstoline interface using one of the GNU binutils tool called addr2line.
+* This is used on gcce platform. In release build type also map files are used.
+*/
+class CATAddr2line : public IAddressToLine
+{
+
+public:
+	
+	/**
+	* Constructor
+	*/
+	CATAddr2line();
+
+	/**
+	* Open binary.
+	* @sString Full filename with path to binary.
+	* @iLong base address of binary.
+	* @return true if successful.
+	*/
+	bool Open( const string& sString, const unsigned long iLong);
+
+	/**
+	* Get error string. In case of any method failed use this to acquire details on error.
+	* @return error string.
+	*/
+	string GetError( void );
+
+	/**
+	* Close binary.
+	* @return true if succesful.
+	*/
+	bool Close( void );
+
+	/**
+	* Locate code line and file for given address.
+	* @result
+	* @return true if successful.
+	*/
+	bool AddressToLine( CATMemoryAddress* result );
+
+#ifndef MODULE_TEST
+private:
+#endif
+
+	// Modules map data (symbols).
+	vector<MAP_FUNC_INFO> m_vMapFileFuncList;
+
+	//Map file name
+	string m_sMapFileName;
+
+	//Addr2line server class
+	CATAddr2lineServer server;
+
+	/**
+	* Get function name for given address.
+	* @iAddress Memory address as unsigned long.
+	* @return Function name as string or empty string if not found.
+	*/
+	string GetFunctionNameUsingAddress( unsigned long iAddress );
+
+	/**
+	* Read map file (armv5 platform).
+	* @return true if map file read successfully.
+	*/
+	bool ReadMapFileArmv5();
+
+	//Note: New filtering functions commented out until they are taken into use.
+	//These were part of task which would filter unwanted characters, etc.. from results.
+
+	/**
+	* Filter any char not defined in constant
+	* ADDR2LINEALLOWEDCHARS from given string.
+	* @param sString string to be filtered.
+	*/
+	//void FilterString( string &sString );
+
+	/**
+	* Find first occurence of LF/CR from string.
+	* @param sString string to find LF/CR.
+	* @return position of first occurence.
+	*/
+	//size_t FindLineFeed( const string& sString );
+
+	/**
+	* Erase all LF/CR from start of the string until other
+	* characters are found.
+	* @param sString string to erase LF/CR.
+	*/
+	//void EraseUntilNoLineFeed( string& sString );
+
+	/**
+	* Split string containing multiple lines with mixed line feeds to
+	* vector of lines.
+	* @sMultiLineString string containing multiple lines.
+	* @return vector containing one line per cell.
+	*/
+	//vector<string> SplitToStrings( string& sMultiLineString );
+	
+	//Debugging for addr2line task.
+	//ofstream debug;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/cataddr2lineserver.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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:  Defines CATAddr2lineServer class.
+*
+*/
+
+#ifndef __CATADDR2LINESERVER_H__
+#define __CATADDR2LINESERVER_H__
+
+// Includes.
+#include "ATCommonDefines.h"
+
+#define BUFSIZE 4096
+ 
+/**
+* This class "runs" the addr2line binary as a server for CATAddr2Line.
+* It redirects the pipes from the tool.
+*/
+class CATAddr2lineServer
+{
+public:
+
+	//Creator
+	CATAddr2lineServer();
+	
+	//Destructor
+	~CATAddr2lineServer();
+
+	/**
+	* Get function name for given address.
+	* @sFullPathAndBinaryName
+	* @return True if initialization succesfull.
+	*/
+	bool Initialize( const string& sFullPathAndBinaryName );
+
+	/**
+	* Write data to a pipe.
+	* @sAddress
+	*/
+	VOID WriteToPipe( const string& sAddress );
+
+	/**
+	* Read data to a pipe.
+	* @return Data from pipe.
+	*/
+	string ReadFromPipe(VOID);
+
+	/**
+	* Gets process created state.
+	* @return True if process created successfully.
+	*/
+	bool GetProcessCreatedState( void );
+
+#ifndef MODULE_TEST
+private:
+#endif
+
+	HANDLE m_hChildStdinRd, m_hChildStdinWr, m_hChildStdinWrDup, 
+	       m_hChildStdoutRd, m_hChildStdoutWr, m_hChildStdoutRdDup, 
+	       m_hChildErroutRd, m_hChildErroutWr, m_hChildErroutRdDup, 
+           m_hSaveStdin, m_hSaveStdout, m_hSaveErrout; 
+
+    SECURITY_ATTRIBUTES m_saAttr;
+    string m_sFullPathAndBinaryName;
+	bool m_bProcessCreated;
+
+	/**
+	* Creates child process for addr2line.exe.
+	* @return True if process created successfully.
+	*/
+	BOOL CreateChildProcess(VOID); 
+
+	/**
+	* Prints error and returns false.
+	* @param sInput error string.
+	* @return false.
+	*/
+	bool PrintErrorAndExit( const string sInput );
+
+
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/catalloc.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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: Defines CATAlloc class.
+*
+*/
+
+
+#ifndef __CATALLOC_H__
+#define __CATALLOC_H__
+
+#include "../inc/ATCommonDefines.h"
+
+/**
+* Class representing single memory allocation.
+*/
+class CATAlloc
+{
+public:
+	/**
+	* Constructor.
+	*/
+	CATAlloc() : m_iCSCount(0) {}
+
+	/**
+	* Destructor.
+	*/
+	~CATAlloc(){}
+
+	/**
+	* Get alloc string after address, it contains:
+	* time, size, call stack..
+	* @return string allocation string
+	*/
+	string GetAllocString();
+
+	// Members
+
+	string m_sTime; /** Allocation time */
+
+	string m_sSize; /** Allocation size */
+
+	string m_iThreadId; /** Thread id*/
+
+	unsigned long m_iCSCount; /** Call stack address count */
+
+	map<unsigned long,string> m_vCallStack; /** Call stack where packet number is key */
+	
+};
+#endif
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/catallocs.h	Mon Sep 06 15:00:47 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: Defines CATAllocs "collection" class.
+*/
+
+#ifndef __CATALLOCS_H__
+#define __CATALLOCS_H__
+
+#include "../inc/ATCommonDefines.h"
+#include "../inc/CATBase.h"
+#include "../inc/catalloc.h"
+
+/**
+* Class representing a collection of memory allocations.
+* It is used to acquire the data of memory leaks by giving all
+* data on single allocations and frees.
+*/
+class CATAllocs : public CATBase
+{
+public:
+	
+	/**
+	* "old" alloc message (prior to 1.6).
+	* @param sAllocString allocation string
+	*/
+	void Alloc( const string& sAllocString );
+
+	/*
+	* Alloc header message (multimessage call stack).
+	* @param sAllocHString allocation string
+	*/
+	void AllocH( const string& sAllocHString, const string& aTimeString );
+
+	/*
+	* Alloc fragment message (fragment of call stack in multimessage alloc).
+	* @param sAllocFString allocation string
+	*/
+	void AllocF( const string& sAllocFString, const string& aTimeString );
+
+    /*
+	* Realloc header message (multimessage call stack).
+	* @param sReallocHString allocation string
+	*/
+	void ReallocH( const string& sReallocHString, const string& aTimeString );
+
+	/*
+	* Relloc fragment message (fragment of call stack in multimessage alloc).
+	* @param sReallocFString allocation string
+	*/
+	void ReallocF( const string& sReallocFString, const string& aTimeString );
+
+	/**
+	* Free message.
+	* @param sFreeString string
+	*/
+	void Free( const string& sFreeString );
+	
+	/**
+	* Free header message.
+	* (not implemented yeat.)
+	* @param sFreeHString string
+	*/
+	void FreeH( const string& sFreeHString, const string& aTimeString );
+
+	/**
+	* Free fragment message.
+	* (not implemented yeat.)
+	* @param sFreeFString string
+	*/
+	void FreeF( const string& sFreeFString, const string& aTimeString );
+
+	/**
+	* Get "leak" list ordered by allocation time.
+	* @param vLeakList container where leaks stored
+	*/
+	void GetLeakList( vector<string>& vLeakList);
+	
+	/**
+	* Clear leaks.
+	*/
+	void ClearAllocs();
+#ifndef MODULE_TEST
+private:
+#endif
+	map<string, CATAlloc> m_vAllocs; /** Collection of allocation(s) */
+};
+#endif
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/catdbghelper.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* 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:  Defines the CATDbgHelper class.
+*
+*/
+
+
+#include "iaddresstoline.h"
+// Static variable to represent state of dbghelper api.
+static bool CDBGHELPER_OPEN = false;
+static unsigned int CDBGHELPER_CLIENTS = 0;
+
+// Used "virtual" offset for all loaded modules and addresses.
+// This is used so no module is loaded to the binary address range of atool.exe.
+const unsigned long AT_VIRTUAL_OFFSET_DBGHELPER = 0x1000000;
+
+/**
+* Provides feature to locate code lines using Windows Debug Api. This is done
+* by using dbghelper library. Implements the IAddressToLine interface.
+*/
+class CATDbgHelper : public IAddressToLine
+{
+
+public:
+	
+	/**
+	* Constructor
+	*/
+	CATDbgHelper();
+	
+	/**
+	* Destructor
+	*/
+	~CATDbgHelper();
+
+	/**
+	* Open binary.
+	* @sString Full filename with path to binary.
+	* @iLong base address of binary.
+	* @return true if successful.
+	*/
+	bool Open( const string& sString, const unsigned long iLong);
+	
+	/**
+	* Get error string. In case of any method failed use this to acquire details on error.
+	* @return error string.
+	*/
+	string GetError( void );
+
+	/**
+	* Close binary.
+	* @return true if succesful.
+	*/
+	bool Close( void );
+
+	/**
+	* Read map file for function's.
+	*/
+	void ReadMapFile( const string sMapFileName );
+
+	/**
+	* Locate code line and file for given address.
+	* @result
+	* @return true if successful.
+	*/
+	bool AddressToLine( CATMemoryAddress* result );
+
+	/**
+	* Try get function name for address (only when map is read).
+	* @result
+	* @return true if succesful.
+	*/
+	bool AddressToFunction( CATMemoryAddress* result );
+
+#ifndef MODULE_TEST
+private:
+#endif
+	// Base address used.
+	DWORD64 m_BaseAddress;
+	// Map file read?
+	bool m_bMap;
+	// Map file functions.
+	vector<MAP_FUNC_INFO> m_vMapFileFuncList;
+	// Binary in file system.
+	PSTR m_pBinaryFile;
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/catfilereader.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* 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:  Defines CATFileReader class.
+*
+*/
+
+
+#ifndef __CATFILEREADER_H__
+#define __CATFILEREADER_H__
+
+#include "ATCommonDefines.h"
+
+/**
+* Provides a feature to read a file as single block into memory and parse it
+* from there line by line (iterating). This can fail or be very slow if file
+* size is bigger than available physical memory for process.
+* But is faster when file fits in free physical memory.
+*/
+class CATFileReader
+{
+public:
+	/**
+	* Constructor.
+	*/
+	CATFileReader();
+	/**
+	* Destructor.
+	*/
+	~CATFileReader();
+#ifndef MODULE_TEST
+private:
+#endif
+	/**
+	* Prevent copy of this class.
+	*/
+	CATFileReader& operator =( const CATFileReader& /*other*/ ) { }
+	CATFileReader( const CATFileReader& /*other*/ ) { }
+public:
+	/**
+	* Open/Read file.
+	* @param cFile file to be read/opened.
+	* @return true if succesful.
+	*/
+	bool Open( const char* cFile );
+	/**
+	* Close file.
+	* @return true if succesful.
+	*/
+	bool Close( void );
+	/**
+	* Get line from file.
+	* @sLine where line content is stored.
+	* @return true if lines left.
+	*/
+	bool GetLine( string& sLine );
+	/**
+	* Set the line delimiter.
+	* @param cDelimiter char that ends the line.
+	*/
+	void SetDelimiter( char cDelimiter );
+	/**
+	* Get current line delimiter.
+	* @return char that ends the line.
+	*/
+	char GetDelimiter() const;
+#ifndef MODULE_TEST
+private:
+#endif
+	// Stream where file content is stored.
+	stringstream m_stream;
+	// Line delimiting character used.
+	char m_cDelimiter;
+};
+#endif
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/catromsymbol.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* 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:  Defines CATRomSymbol, RofsBinary classes and Symbol
+*               structure.
+*
+*/
+
+
+#ifndef __CATROMSYMBOL_H__
+#define __CATROMSYMBOL_H__
+
+#include "ATCommonDefines.h"
+#include "iaddresstoline.h"
+
+const string ROM_SYMBOL_IDENTIFY_STRING = "80";
+const string ROFS_SYMBOL_IDENTIFY_STRING = "00";
+const int IDENTIFY_MAX_LINES_READ = 20;
+
+/**
+* Represents a single symbol in a binary.
+*/
+struct Symbol
+{
+	unsigned long iStartAddress; /** Start address */
+	unsigned long iEndAddress; /** End address */
+	string sFunction; /** Function/Symbol name */
+	/**
+	* Default constructor for structure to set default values
+	*/
+	Symbol() { iStartAddress=0; iEndAddress=0; sFunction = ""; }
+	/**
+	* Empty destructor
+	*/
+	~Symbol() {}
+};
+
+
+/**
+* Represents a single binary in ROM/ROFS which
+* contains a collection of Symbols.
+*/
+class RofsBinary {
+public:
+	/**
+	* Constructor
+	*/
+	RofsBinary();
+	/**
+	* Constructor
+	* @param sbinary
+	*/
+	RofsBinary( const string& sbinary );
+	/**
+	* Destructor
+	*/
+	~RofsBinary();
+
+	// Members
+
+	string m_sBinary; /** Binary / code segment */
+	vector<Symbol*> vSymbols; /** Collection of symbols */
+};
+
+/**
+* Implements IAddressToLine interface to acquire symbol information
+* using memory addresses from rom/rofs symbol files.
+*/
+class CATRomSymbol : public IAddressToLine
+{
+public:
+	/**
+	* Constructor.
+	*/
+	CATRomSymbol();
+	/**
+	* Destructor.
+	*/
+	virtual ~CATRomSymbol();
+	bool m_bShowProgressMessages; /** "Flag" will we show progress when reading files */
+	/**
+	* Empty functions does nothing returns false always.
+	* @param sString
+	* @param iLong
+	* @return true if successful.
+	*/
+	bool Open( const string& sString, const unsigned long iLong);
+	/**
+	* Set symbol files.
+	* This also checks that files exists and identifies them as rom/rofs.
+	* @param vSymbols
+	* @return bool
+	*/
+	bool SetSymbols( const vector<string>& vSymbols);
+	/**
+	* Get error string. In case of any method failed use this to acquire details on error.
+	* @return error string.
+	*/
+	string GetError( void );
+	/**
+	* Close rom symbol file.
+	* @return true if succesful.
+	*/
+	bool Close( void );
+	/**
+	* Locates symbol and binary name for given address if found in rom.
+	* @param result memory address object.
+	* @return true if successful.
+	*/
+	bool AddressToLine( CATMemoryAddress* result );
+#ifndef MODULE_TEST
+private:
+#endif
+	/**
+	* Represents the symbol files type
+	* (content is different / format )
+	*/
+	enum SYMBOL_FILE_TYPE {
+		SYMBOL_FILE_INVALID = 0, /** not valid */
+		SYMBOL_FILE_ROM, /** rom type */
+		SYMBOL_FILE_ROFS /** rofs type */
+	};
+	/**
+	* Identify symbol file
+	* @param sFile
+	* @return int
+	*/
+	int IdentifySymbolFile( const string& sFile );
+	/**
+	* Locate symbol and binary name for given address if found in rom.
+	* @param result
+	* @return bool
+	*/
+	bool AddressToLineRom( CATMemoryAddress* result );
+	/**
+	* Locate symbol and binary name for given address if found in rofs.
+	* @param result
+	* @return bool
+	*/
+	bool AddressToLineRofs( CATMemoryAddress* result );
+	/**
+	* Reads rom files.
+	* @return bool
+	*/
+	bool ReadRomFiles();
+	/**
+	* Read specified rom file
+	* @param sFile
+	* @return bool
+	*/
+	bool ReadRomFile( const string& sFile );
+	/**
+	* Read rofs files
+	* @return bool
+	*/
+	bool ReadRofsFiles();
+	/**
+	* Read specified rofs file
+	* @param sFile
+	* @return bool
+	*/
+	bool ReadRofsFile( const string& sFile );
+	/**
+	* Parse symbol from a line in rom/rofs file.
+	* @param sLine
+	* @param pSymbol
+	*/
+	void ParseSymbolFromLine( const string& sLine, Symbol* pSymbol );
+#ifndef MODULE_TEST
+private:
+#endif
+
+	// Members
+
+	bool m_bFilesIdentified; /**  Have we identified symbol file(s) */
+	bool m_bSymbolsRead; /** Have we read symbol file(s) */
+	vector<string> m_vRomFiles; /** Rom symbol file(s) */
+	vector<Symbol*> m_vRomCache; /** Cached rom symbols */
+	vector<Symbol*> m_vRomSymbols; /** All rom symbols */
+	unsigned long m_iRomStartAddress; /** Rom start address */
+	unsigned long m_iRomEndAddress; /** Rom end address */
+	vector<string> m_vRofsFiles; /** Rofs symbol file(s) */
+	vector<RofsBinary*> m_vRofsBinaries; /** Rofs binaries */
+	string m_sErrorMessage; /** Error message */
+};
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/iaddresstoline.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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:  Interface definition for locating code lines using memory addresses.
+*
+*/
+#ifndef __IADDRESSTOLINE_H__
+#define __IADDRESSTOLINE_H__
+
+#include "ATCommonDefines.h"
+
+class CATMemoryAddress;
+
+/**
+* Codeline locating interface. Thru this interface CATModule2 locates code lines
+* using different implementations depending on platform.
+*/
+class IAddressToLine
+{
+public:
+	IAddressToLine() {};
+	virtual ~IAddressToLine() {};
+	/**
+	* Open binary.
+	* @sString
+	* @iNumber
+	* @return true if successful.
+	*/
+	virtual bool Open( const string& sString, const unsigned long iLong) = 0;
+	
+	/**
+	* Get error string. In case of any method failed use this to acquire details on error.
+	* @return error string.
+	*/
+	virtual string GetError( void ) = 0;
+
+	/**
+	* Close binary.
+	* @return true if succesful.
+	*/
+	virtual bool Close( void ) = 0;
+
+	/**
+	* Locate code line and file for given address.
+	* @result
+	* @return true if successful.
+	*/
+	virtual bool AddressToLine( CATMemoryAddress* result ) = 0;
+};
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/inc/stdafx.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 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 file for standard system include files,
+*                or project specific include files that are used frequently, but
+*                are changed infrequently.
+*  Version     : %version: 1 % 
+*
+*/
+
+
+#pragma once
+
+// MemoryLeak checking function.
+// Note! Do not comming in svn with this flag enabled.
+//#define MEM_LEAK_CHECK
+
+// Addr2line binary used.
+//#define ADDR2LINE
+
+#ifdef MEM_LEAK_CHECK
+#define _CRTDBG_MAP_ALLOC
+#include <stdlib.h>
+#include <crtdbg.h>
+#endif
+
+#include <tchar.h>
+#include <fstream>   //ifstream,ofstream
+#include <windows.h>
+#include <string>    //string
+#include <vector>    //string
+#include <sstream>   //stringstream
+#include <iostream>  // cout
+#include <map> // map
+#include <time.h>
\ No newline at end of file
Binary file perfsrv/analyzetool/commandlineengine/install/addr2line.exe has changed
Binary file perfsrv/analyzetool/commandlineengine/install/atool.exe has changed
Binary file perfsrv/analyzetool/commandlineengine/install/binutils-2.19.1-src.zip has changed
Binary file perfsrv/analyzetool/commandlineengine/install/xerces-c_2_7.dll has changed
Binary file perfsrv/analyzetool/commandlineengine/lib/xerces-c_2.lib has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/CATBase.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1434 @@
+/*
+* 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:  Definitions for the class CATBase.
+*
+*/
+
+
+#include "../inc/CATBase.h"
+#include "../inc/CATParseXML.h"
+
+// -----------------------------------------------------------------------------
+// CATBase::CATBase
+// Constructor.
+// -----------------------------------------------------------------------------
+CATBase::CATBase(void)
+{
+	LOG_FUNC_ENTRY("CATBase::CATBase");
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::~CATBase
+// Destructor.
+// -----------------------------------------------------------------------------
+CATBase::~CATBase(void)
+{
+	LOG_FUNC_ENTRY("CATBase::~CATBase");
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::ChangeToLower
+// Converts any uppercase letter to lowercase.
+// -----------------------------------------------------------------------------
+void CATBase::ChangeToLower( string& sInput )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::ChangeToLower");
+	int iLength = (int)sInput.size();
+	for( int i = 0 ; i < iLength ; i++ )
+	{
+		sInput[i] = (char)tolower( sInput[i] );
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::ChangeToUpper
+// Converts any uppercase letter to lowercase.
+// -----------------------------------------------------------------------------
+void CATBase::ChangeToUpper( string& sInput )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::ChangeToUpper");
+	int iLength = (int)sInput.size();
+	for( int i = 0 ; i < iLength ; i++ )
+	{
+		sInput[i] = (char)toupper( sInput[i] );
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::TrimString
+// Remove spaces and tabulatures from beginning and
+// end of given string.
+// -----------------------------------------------------------------------------
+void CATBase::TrimString( string& sInput )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::TrimString");
+	if( sInput.empty() )
+		return;
+	//Remove spaces and tabulatures from beginning of string
+	while( !sInput.empty() && ( sInput[0] == SPACE_CHAR_VALUE || sInput[0] == TAB_CHAR_VALUE ) )
+	{
+		sInput.erase( 0, 1 );
+	}
+	//Remove spaces and tabulatures from end of string
+	while( !sInput.empty() && ( sInput[sInput.size()-1] == SPACE_CHAR_VALUE || sInput[sInput.size()-1] == TAB_CHAR_VALUE ) )
+	{
+		sInput.erase( sInput.size()-1, 1 );
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::SearchFileWithExtension
+// Searches files with given extension from path.
+// -----------------------------------------------------------------------------
+bool CATBase::SearchFileWithExtension( const char* pPathAndExt, bool bPrintErrors, string& sErrorLog )
+{
+	LOG_FUNC_ENTRY("CATBase::SearchFileWithExtension");
+	WIN32_FIND_DATA FindFileData;
+	HANDLE hFind;
+	string sTemp( pPathAndExt );
+
+	//Find file
+	hFind = FindFirstFile( sTemp.c_str(), &FindFileData );
+	if (hFind == INVALID_HANDLE_VALUE)
+	{
+		string sErrorString( "No " );
+		//Get extension
+		string sExt( pPathAndExt );
+		sExt.erase( 0, sExt.find_last_of( "." ) );
+
+		sErrorString.append( sExt );
+		sErrorString.append( " files in directory: " );
+
+		string sWithoutExt( pPathAndExt );
+		sWithoutExt.erase( sWithoutExt.find_last_of( "." )-1, string::npos );
+		sErrorString.append( sWithoutExt );
+
+		if( bPrintErrors )
+		{
+			//string sTemp( pPathAndExt );
+			//printf( "Can not find: %s.\n", pPathAndExt );
+			printf( sErrorString.c_str() );
+		}
+		else
+		{
+			//Add line change if sErrorString not empty
+			if( !sErrorLog.empty() )
+				sErrorString.insert( 0, "\n" );
+			sErrorLog.append( sErrorString );
+		}
+		return false;
+	} 
+	else 
+	{
+		FindClose(hFind);
+		return true;
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::GetPathOrFileName
+// Returns path to file or file name.
+// -----------------------------------------------------------------------------
+string CATBase::GetPathOrFileName( bool bFileName, string sInput )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::GetPathOrFileName");
+	string sRet;
+	size_t iPos = sInput.size()-1;
+
+	sInput = ChangeSlashToBackSlash( sInput );
+
+	//Find character '\' starting from end of string
+	while( iPos > 0 && sInput[iPos] != '\\' )
+	{
+		iPos--;
+	}
+	if( iPos > 0 )
+	{
+		//Return file name
+		if( bFileName )
+		{
+			sInput.erase( 0, iPos+1 );
+			sRet = sInput;
+		}
+		else //Return file path
+		{
+			sInput.erase( iPos+1, string::npos );
+			sRet = sInput;
+		}
+	}
+	else
+	{
+		if( !bFileName )
+			return sRet;
+		sRet = sInput;
+	}
+	return sRet;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::GetFileNameUsingExt
+// Searches files with given extension from path.
+// -----------------------------------------------------------------------------
+string CATBase::GetFileNameUsingExt( const char* pPathAndExt )
+{
+	LOG_FUNC_ENTRY("CATBase::GetFileNameUsingExt");
+	WIN32_FIND_DATA FindFileData;
+	HANDLE hFind;
+	string sRet;
+
+	//Find file
+	hFind = FindFirstFile( pPathAndExt, &FindFileData );
+	if (hFind == INVALID_HANDLE_VALUE)
+	{
+		//if( bPrintErrors )
+		printf( "Can not find: %s.\n", pPathAndExt );
+		return sRet;
+	} 
+	else 
+	{
+		sRet.append( FindFileData.cFileName );
+		FindClose(hFind);
+		return sRet;
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::GetStringUntilNextSpace
+// Function returns string from begin of given string until next space,
+// characters until next space are removed from sInput string.
+// -----------------------------------------------------------------------------
+string CATBase::GetStringUntilNextSpace( string& sInput, bool bEraseFromInput )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::GetStringUntilNextSpace");
+	string sTemp( sInput );
+	size_t iSize = sTemp.find_first_of(' ');
+	if( iSize != string::npos )
+	{
+		sTemp.resize( iSize );
+		if( bEraseFromInput )
+			sInput.erase( 0, (iSize+1) );
+	}
+	else
+	{
+		if ( bEraseFromInput )
+			sInput.clear();
+	}
+	return sTemp;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::GetStringUntilMainId
+// Function returns string from begin of given string until next atool's main id <AT>,
+// characters until next main id are removed from sInput string.
+// -----------------------------------------------------------------------------
+string CATBase::GetStringUntilMainId( string& sInput, bool bEraseFromInput )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::GetStringUntilMainId");
+	string sTemp( sInput );
+	size_t iSize = sTemp.find(MAIN_ID);
+	if( iSize != string::npos )
+	{
+		sTemp.resize( iSize );
+		if( bEraseFromInput )
+			sInput.erase( 0, (iSize) );
+	}
+	else
+	{
+		if ( bEraseFromInput )
+			sInput.clear();
+	}
+	return sTemp;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::ChangeSlashToBackSlash
+// Function changes all BackSlash characters to Slash character from
+// given string.
+// -----------------------------------------------------------------------------
+string CATBase::ChangeSlashToBackSlash( string sInput )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::ChangeSlashToBackSlash");
+	for( unsigned int i = 0 ; i < sInput.length() ; i++ )
+	{
+		if( sInput[i] == '/' )
+		{
+			sInput[i] = '\\';
+		}
+	}
+	return sInput;
+}
+
+
+// -----------------------------------------------------------------------------
+// CATBase::ParseTimeStamp
+// Function returns time parsed from start of trace message
+// -----------------------------------------------------------------------------
+unsigned __int64 CATBase::ParseTimeStamp( string sLineStart )
+{
+	unsigned __int64 iTime(0);
+
+	int iHours(0), iMinutes(0), iSeconds(0), iMiliseconds(0), iMicroseconds(0);
+	int iErr(0), iRet(0);
+
+	TrimString( sLineStart );
+	string sTimeString = GetStringUntilNextSpace( sLineStart );
+
+	// Get time
+	int iPos = sTimeString.find( ":" );
+	if( iPos != string::npos ) // ':' found, this is timestamp from fastTrace/traceViewer 
+	{
+		// possible formats 
+		// hh:mm:ss - seconds (ft)
+        // hh:mm:ss:mmm - miliseconds (ft/tw)
+		// hh:mm:ss:mmmmmm - microseconds (ft/tw)
+		// hh:mm:ss:nnnnnnnnn - nanoseconds (ft) - ignore last 3digits
+
+		iRet = sscanf_s( sTimeString.c_str(), "%d:%d:%d.%3d%3d", &iHours, &iMinutes, &iSeconds, &iMiliseconds, &iMicroseconds );
+		if( iRet == 5 || iRet == 4 )
+		{
+			// get microseconds
+			iTime = ( ( ( iHours*60 + iMinutes )*60 + iSeconds )*1000 + iMiliseconds )*1000 + iMicroseconds;
+		}
+		else
+		{
+			iErr = true;
+		}
+	}
+	else if( sTimeString.find( "." ) != string::npos ) // epoc timestamp in format ssss.mmm
+	{
+		iRet = sscanf_s( sTimeString.c_str(), "%d.%d", &iSeconds, &iMiliseconds );
+		if( iRet == 2 )
+		{
+			// get microseconds
+			iTime = ( ( ( iHours*60 + iMinutes )*60 + iSeconds )*1000 + iMiliseconds )*1000 + iMicroseconds;
+		}
+		else
+		{
+			iErr = true;
+		}
+	}
+	else // timestamp in microseconds from binary log file or from ft
+	{
+		iRet = sscanf_s( sTimeString.c_str(), "%016I64x", &iTime);
+		if( iRet == 1 )
+		{
+		}
+		else
+		{
+			iErr = true;
+		}
+	}
+
+	if( iErr )
+		cout << "Error, can not read timestamp.\n";
+
+	return iTime;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::FileExists
+// Check if given file exists.
+// -----------------------------------------------------------------------------
+bool CATBase::FileExists( const char * pFilename )
+{
+	LOG_FUNC_ENTRY("CATBase::FileExists");
+	DWORD dwRet = GetFileAttributes( pFilename );
+	if( dwRet == INVALID_FILE_ATTRIBUTES )
+	{
+		return false;
+	}
+	else
+	{
+		//Is file directory?
+		if( dwRet & FILE_ATTRIBUTE_DIRECTORY )
+		{
+			return false;
+		}
+	}
+	return true;
+}
+
+bool CATBase::IsFileReadOnly( const char* pFilename )
+{
+	LOG_FUNC_ENTRY("CATBase::IsFileReadOnly");
+	DWORD dwRet = GetFileAttributes( pFilename );
+	if( dwRet == INVALID_FILE_ATTRIBUTES )
+		return false;
+	if( dwRet & FILE_ATTRIBUTE_READONLY )
+		return true;
+	return false;
+}
+
+bool CATBase::SetFileReadOnly( const char* pFileName )
+{
+	LOG_FUNC_ENTRY("CATBase::SetFileReadOnly");
+	DWORD dw = GetFileAttributes( pFileName );
+	if( dw == INVALID_FILE_ATTRIBUTES )
+		return false;
+	if( dw & FILE_ATTRIBUTE_READONLY )
+		return true;
+	dw = dw | FILE_ATTRIBUTE_READONLY ;
+	if ( SetFileAttributes( pFileName, dw ) )
+		return true;
+	return false;
+}
+bool CATBase::SetFileWritable( const char* pFileName )
+{
+	LOG_FUNC_ENTRY("CATBase::SetFileWritable");
+	DWORD dw = GetFileAttributes( pFileName );
+	if( dw == INVALID_FILE_ATTRIBUTES )
+		return false;
+	if( ! dw & FILE_ATTRIBUTE_READONLY )
+		return true;
+	dw = dw ^ FILE_ATTRIBUTE_READONLY ;
+	if ( SetFileAttributes( pFileName, dw ) )
+		return true;
+	return false;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::FileCopyToPath
+// Copies file to given path
+// -----------------------------------------------------------------------------
+bool CATBase::FileCopyToPath(const string& sFile, const string& sToPath)
+{
+	LOG_FUNC_ENTRY("CATBase::FileCopyToPath");
+	// Display message
+	cout << AT_MSG << "Copy " << sFile << AT_FILE_TO << sToPath << endl;
+	if ( sFile.empty() || sToPath.empty() )
+	{
+		LOG_FUNC_EXIT("CATBase::FileCopyToPath Error, empty parameter");
+		return false;
+	}
+	// Copy using windows api (seems not to work when relavite path ..
+	/*
+	// Full path where to copy
+	string sDestination = sToPath;
+	// Append '\' to string if not exists
+	if ( sDestination.length() > 1 )
+	{
+		const char cLastChar = sDestination[ sDestination.length() -1 ];
+		if ( cLastChar != DASH )
+			sDestination.append("\\");
+	}
+	int iRet = 0;
+	iRet = CopyFile( sFile.c_str(), sDestination.c_str(), false );
+	if ( iRet != 0 )
+	{
+		return false;
+	}
+	*/
+	string sCommand;
+	sCommand.append( "copy /Y \"");
+	sCommand.append( sFile );
+	sCommand.append( "\" \"" );
+	sCommand.append( sToPath );
+	sCommand.append( "\" > nul 2>&1" );
+	LOG_STRING( sCommand );
+	int iRet = 0;
+	iRet = (int)system( sCommand.c_str() );
+	if ( iRet != 0 )
+		return false;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::FileMoveToPath
+// Copies file to given path
+// -----------------------------------------------------------------------------
+bool CATBase::FileMoveToPath(const string& sFile, const string& sToPath)
+{
+	LOG_FUNC_ENTRY("CATBase::FileMoveToPath");
+	// Display message
+	cout << AT_MSG << "Move " << sFile << AT_FILE_TO << sToPath << endl;
+	if ( sFile.empty() || sToPath.empty() )
+	{
+		LOG_FUNC_EXIT("CATBase::FileMoveToPath Error, empty parameter");
+		return false;
+	}
+	// Move (again windows api function does not support relative path .. in it
+	/*
+	// Get filename from sFile
+	string sFileName = GetPathOrFileName( true, sFile );
+	// Full path where to copy
+	string sDestination = sToPath;
+	// Append '\' to string if not exists
+	if ( sDestination.length() > 1 )
+	{
+		const char cLastChar = sDestination[ sDestination.length() -1 ];
+		if ( cLastChar != DASH )
+			sDestination.append("\\");
+	}
+	int iRet = 0;
+	iRet = MoveFile( sFile.c_str(), sDestination.c_str());
+	if ( iRet != 0 )
+	{
+		return false;
+	}
+	*/
+	string sCommand;
+	sCommand.append( "move /Y \"");
+	sCommand.append( sFile );
+	sCommand.append( "\" \"" );
+	sCommand.append( sToPath );
+	sCommand.append( "\" > nul 2>&1" );
+	LOG_STRING( sCommand );
+	int iRet = 0;
+	iRet = (int)system( sCommand.c_str() );
+	if ( iRet != 0 )
+		return false;
+	return true;
+}
+// -----------------------------------------------------------------------------
+// CATBase::CreateTempPath
+// Creates temporary directory path for given mmp file
+// -----------------------------------------------------------------------------
+string CATBase::CreateTempPath(const string& sMmpFileWithPath)
+{
+	LOG_FUNC_ENTRY("CATBase::CreateTempPath");
+	string sTempPath = GetPathOrFileName( false, sMmpFileWithPath );
+	sTempPath.append( AT_TEMP_DIR );
+	sTempPath.append( "\\" );
+	return sTempPath;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::RemovePathAndExt
+// Removes extension from file name and returns file name without extension.
+// -----------------------------------------------------------------------------
+string CATBase::RemovePathAndExt( string sFileName, bool bReverseFindExt)
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::RemovePathAndExt");
+	string sRet;
+	sFileName = GetPathOrFileName( true, sFileName );
+	if ( bReverseFindExt )
+	{
+		// Remove extension from reverse
+		size_t iPos = sFileName.find_last_of('.');
+		if( iPos != string::npos )
+		{
+			sFileName.resize( sFileName.find_last_of('.') );
+			sRet = sFileName;
+		}
+	}
+	else
+	{
+		// Remove extension finding first .
+		size_t iPos = sFileName.find_first_of('.');
+		if( iPos != string::npos )
+		{
+			sFileName.resize( sFileName.find_first_of('.') );
+			sRet = sFileName;
+		}
+	}
+	return sRet;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::IsTargetTypeSupported
+// Checks from constant array is this target unsupported
+// -----------------------------------------------------------------------------
+bool CATBase::IsTargetTypeSupported(string sTargetType)
+{
+	LOG_FUNC_ENTRY("CATBase::IsTargetTypeSupported");
+	// compare to list
+	int iArraySize = sizeof( UNSUPPORTED_TARGET_TYPES ) / sizeof( string );
+	for ( int i=0 ; i < iArraySize ; i++ )
+	{
+		string sUnsupported = UNSUPPORTED_TARGET_TYPES[i];
+		// lowercase both
+		ChangeToLower(sTargetType);
+		ChangeToLower(sUnsupported);
+		// compare
+		if ( sUnsupported.compare( sTargetType ) == 0 )
+		{
+			return false;
+		}
+	}
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::IsTargetTypeKernelSide
+// Checks from constant array is this target type kernel side
+// -----------------------------------------------------------------------------
+bool CATBase::IsTargetTypeKernelSide(string sTargetType)
+{
+	LOG_FUNC_ENTRY("CATBase::IsTargetTypeKernelSide");
+	// compare to list
+	int iArraySize = sizeof( KERNEL_SIDE_TARGET_TYPES ) / sizeof( string );
+	for ( int i=0 ; i < iArraySize ; i++ )
+	{
+		string sUnsupported = KERNEL_SIDE_TARGET_TYPES[i];
+		// lowercase both
+		ChangeToLower(sTargetType);
+		ChangeToLower(sUnsupported);
+		// compare
+		if ( sUnsupported.compare( sTargetType ) == 0 )
+		{
+			return true;
+		}
+	}
+	return false;
+}
+
+bool CATBase::CheckVariant( const string& sEpocRoot, const string& sVariant )
+{
+	LOG_FUNC_ENTRY("CATBase::CheckVariant");
+	string sFileToCheck;
+	// Add epoc root
+	if( sEpocRoot.size() > 1 )
+		sFileToCheck.append( sEpocRoot );
+	// Add path
+	sFileToCheck.append( VARIANT_DIR ) ;
+	// Add variant
+	sFileToCheck.append( sVariant );
+	// Add extension
+	sFileToCheck.append( VARIANT_FILE_EXTENSION );
+	// check does FileExists
+	return FileExists( sFileToCheck.c_str() );
+}
+bool CATBase::IsDefaultVariant( const string& sEpocRoot )
+{
+	LOG_FUNC_ENTRY("CATBase::IsDefaultVariant");
+	string sFileToCheck;
+	// Add epoc root
+	if( sEpocRoot.size() > 1 )
+		sFileToCheck.append( sEpocRoot );
+	// Add path
+	sFileToCheck.append( VARIANT_DIR ) ;
+	// Add variant
+	sFileToCheck.append( "DEFAULT" );
+	// Add extension
+	sFileToCheck.append( VARIANT_FILE_EXTENSION );
+	// check does FileExists
+	return FileExists( sFileToCheck.c_str() );
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::FileDelete
+// FileDelete
+// -----------------------------------------------------------------------------
+bool CATBase::FileDelete(const string& sFile, bool bPrint )
+{
+	LOG_FUNC_ENTRY("CATBase::FileDelete");
+	// does file even exists
+	if ( !FileExists( sFile.c_str() ) )
+		return false;
+	// delete file
+	int iRet = _unlink( sFile.c_str() );
+	// if print on display error
+	if ( iRet  && bPrint )
+	{
+		cout << AT_MSG << "Error, deleting file " << sFile
+			<< endl;
+	}
+	// if print on display message
+	else if ( !iRet && bPrint )
+	{
+		cout << AT_MSG << "Delete " << sFile << endl;
+	}
+	// return
+	if ( iRet )
+		return false;
+	return true;
+}
+// -----------------------------------------------------------------------------
+// CATBase::DirDelete
+// Delelete directory
+// -----------------------------------------------------------------------------
+bool CATBase::DirDelete(const string& sDir, bool bPrint )
+{
+	LOG_FUNC_ENTRY("CATBase::DirDelete");
+	if ( sDir.find( AT_TEMP_DIR) == string::npos )
+		return false;
+	
+	if ( sDir.length() < 2 )
+		return false;
+
+	string sDir2;
+	if ( sDir.at(1) != ':' )
+	{
+		char cDir[MAX_LINE_LENGTH];
+		GetCurrentDirectory( MAX_LINE_LENGTH , cDir );
+		sDir2.append( cDir );
+		sDir2.append( "\\" );
+		sDir2.append( sDir );
+	}
+	else
+		sDir2.append( sDir );
+
+	// does directory exists
+	DWORD dwRet = GetFileAttributes( sDir2.c_str() );
+	if ( dwRet == INVALID_FILE_ATTRIBUTES )
+		return false;
+	else if ( ! (dwRet & FILE_ATTRIBUTE_DIRECTORY) )
+	{
+		return false;
+	}
+	// Delete dir
+	string sCmd( "rmdir /S /Q " );
+	sCmd.append( sDir2 );
+	sCmd.append( " > nul 2>&1" );
+	int iRet = (int)system( sCmd.c_str() );
+	if ( iRet && bPrint)
+	{
+		cout << AT_MSG << "Error, deleting directory " << sDir2 << endl;
+	}
+	else if ( !iRet && bPrint )
+	{
+		cout << AT_MSG << "Delete directory " << sDir2 << endl;
+	}
+	if ( iRet )
+		return false;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::DirCreate
+// Create directory
+// -----------------------------------------------------------------------------
+bool CATBase::DirCreate(const string& sDir, bool bPrint )
+{
+	LOG_FUNC_ENTRY("CATBase::DirCreate");
+
+	if ( sDir.length() < 2 )
+		return false;
+
+	string sDir2;
+	if ( sDir.at(1) != ':' )
+	{
+		char cDir[MAX_LINE_LENGTH];
+		GetCurrentDirectory( MAX_LINE_LENGTH , cDir );
+		sDir2.append( cDir );
+		sDir2.append( "\\" );
+		sDir2.append( sDir );
+	}
+	else
+		sDir2.append( sDir );
+
+	// does directory exists
+	DWORD dwRet = GetFileAttributes( sDir2.c_str() );
+	if ( dwRet != INVALID_FILE_ATTRIBUTES )
+	{
+		if( dwRet & FILE_ATTRIBUTE_DIRECTORY )
+			return false;
+	}
+	// Create dir
+	string sCmd( "mkdir " );
+	sCmd.append( sDir2 );
+	sCmd.append( " > nul 2>&1" );
+	int iRet = (int)system( sCmd.c_str() );
+	if ( iRet && bPrint)
+	{
+		cout << AT_MSG << "Error, creating directory " << sDir2 << endl;
+	}
+	else if ( !iRet && bPrint )
+	{
+		cout << AT_MSG << "Directory " << sDir2 << " created" << endl;
+	}
+	if ( iRet )
+		return false;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::ConvertTCHARtoString
+// Convert TCHAR* to std::string
+// -----------------------------------------------------------------------------
+string CATBase::ConvertTCHARtoString(TCHAR* charArray)
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::ConvertTCHARtoString");
+	// Loop char array
+	stringstream ss;
+	int iIndex = 0;
+	char c = (char) charArray[iIndex];
+	// until null termination
+	while ( c != '\0' )
+	{
+		ss << c;
+		iIndex++;
+		c = (char) charArray[iIndex];
+	}
+	// return string
+	return ss.str();
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::ConvertTCHARtoString
+// Get list of files in directory
+// -----------------------------------------------------------------------------
+vector<string> CATBase::DirList(const string& sDirectory
+								, bool bListDirs, bool bAddPathToFile)
+{
+	LOG_FUNC_ENTRY("CATBase::DirList");
+	// Create string to modify it
+	string sDir = sDirectory;
+	// Add if missing '\' & '*' to the sDirectory
+	if ( sDir.at( sDir.size()-1 ) != '\\' )
+		sDir.append( "\\" );
+	// Path to add to file string if specified
+	string sPath = sDir;
+	// Add * to for windows api to find all files
+	sDir.append( "*" );
+	// convert directory string to LPCSTR
+	LPCSTR dir( sDir.c_str() );
+	// vector to store file list
+	vector<string> vFileList;
+	// Using win32 api to find list of files in directory
+	// file data "container"
+	WIN32_FIND_DATA fileData;
+	// handle to directory
+	HANDLE hFinder = FindFirstFile( dir, &fileData );
+	if ( hFinder == INVALID_HANDLE_VALUE )
+	{
+		// no files found
+		return vFileList;
+	}
+	// loop files add to vector and return
+	while( FindNextFile(hFinder, &fileData ) )
+	{
+		DWORD dw = fileData.dwFileAttributes;
+		// skip if its directory and bListDirs not specified
+		if ( dw & FILE_ATTRIBUTE_DIRECTORY && ! bListDirs)
+			continue;
+		// add files to vector
+		string sFile = ConvertTCHARtoString( fileData.cFileName );
+		// Add given path to file string if specified
+		if ( bAddPathToFile )
+			sFile.insert( 0, sPath );
+		vFileList.push_back( sFile );
+	}
+	// Close file find handler
+	FindClose( hFinder );
+	return vFileList;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::ParseRelativePathToString
+// ParseRelative
+// -----------------------------------------------------------------------------
+void CATBase::ParseRelativePathString(string& sPathString)
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::ParseRelativePathString");
+	string sParsed;
+	// find ..
+	size_t iDots = sPathString.find( ".." );
+	while ( iDots != string::npos )
+	{
+		RemoveRelativePath( sPathString, iDots );
+		iDots = sPathString.find( ".." );
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::RemoveRelativePath
+// Remove relative path from string (using given index)
+// -----------------------------------------------------------------------------
+void CATBase::RemoveRelativePath(string& sString, size_t iDots)
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::RemoveRelativePath");
+	// Chck if accidentally given wrong parameter
+	if ( iDots == string::npos 
+		|| iDots < 1 )
+		return;
+	// Parsed string
+	string sParsed;
+	// Find position of last backslash before dots
+	size_t i = sString.rfind("\\", iDots-2 );
+	// Pickup start part (depending is the backslash at last parts first char)
+	if ( sString.at(iDots+2) != '\\' )
+		sParsed = sString.substr( 0, i+1 ) ;
+	else
+		sParsed = sString.substr( 0, i );
+	// Pick up last part
+	sParsed.append( sString.substr( iDots+2, sString.size() ) );
+	sString = sParsed;
+}
+
+// -----------------------------------------------------------------------------
+// Get extension from given string
+// -----------------------------------------------------------------------------
+string CATBase::GetExtension(const string& sString)
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::GetExtension");
+	// find last .
+	size_t iDot = sString.find_last_of( "." );
+	// return string after . if found
+	if ( iDot != string::npos )
+		return sString.substr(iDot+1, sString.length()-(iDot+1) );
+	// otherwise return given string
+	return sString;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::DirectoryExists
+// Check if given directory exists.
+// -----------------------------------------------------------------------------
+bool CATBase::DirectoryExists( const char* pDirname )
+{
+	LOG_FUNC_ENTRY("CATBase::DirectoryExists");
+	size_t iLenght = strlen( pDirname );
+	
+	if ( iLenght < 2 )
+		return false;
+
+	string sDir;
+	if ( pDirname[1] != ':' )
+	{
+		char cDir[MAX_LINE_LENGTH];
+		GetCurrentDirectory( MAX_LINE_LENGTH , cDir );
+		sDir.append( cDir );
+		sDir.append( "\\" );
+		sDir.append( pDirname );
+	}
+	else
+		sDir.append( pDirname );
+
+	DWORD dwRet = GetFileAttributes( sDir.c_str() );
+	if( dwRet == INVALID_FILE_ATTRIBUTES )
+	{
+		return false;
+	}
+	else
+	{
+		//Is file directory?
+		if( dwRet & FILE_ATTRIBUTE_DIRECTORY )
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::ConvertUnixPathToWin
+// -----------------------------------------------------------------------------
+void CATBase::ConvertUnixPathToWin( string& sPath )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::ConvertUnixPathToWin");
+	size_t iSpot = 0;
+	// convert '/' to '\'
+	iSpot = sPath.find( "/" );
+	while( iSpot != string::npos )
+	{
+		sPath.replace(iSpot,1, "\\");
+		iSpot = sPath.find( "/", iSpot+1 );
+	}
+	// convert '\\' to '\'
+	iSpot = sPath.find( "\\\\" );
+	while( iSpot != string::npos )
+	{
+		sPath.replace(iSpot,2,"\\");
+		iSpot = sPath.find( "\\\\" );
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::RemoveAllAfterDotIfTwoDots
+// Removes all after first '.'
+// if given string contains 2 '.' or more
+// -----------------------------------------------------------------------------
+void CATBase::RemoveAllAfterDotIfTwoDots(string& sModName)
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::RemoveAllAfterDotIfTwoDots");
+	// did we find variable?
+	size_t found;
+	// Find first '.'
+	found = sModName.find(".");
+	if ( found != string::npos )
+	{
+		// Try find second '.'
+		found = sModName.find(".", found+1);
+		if ( found != string::npos )
+		{
+			// Remove all after first '.'
+			sModName = sModName.substr(0, sModName.find(".")+1 );
+		}
+	}
+}
+// -----------------------------------------------------------------------------
+// CATBase::CreateTemporaryCpp
+// -----------------------------------------------------------------------------
+bool CATBase::CreateTemporaryCpp( const string& sId,
+								 const string& sPath
+								 ,const string& sS60FileName
+								 ,const string& sS60FilePath
+								 ,int iLogOption
+								 ,int iIsDebug
+								 ,int iAllocCallStackSize
+								 ,int iFreeCallStackSize )
+{
+	LOG_FUNC_ENTRY("CATBase::CreateTemporaryCpp");
+	// Add slash to path if missing
+	string sTempCpp = sPath;
+	if( sTempCpp.at( sTempCpp.length() - 1 ) != '\\' )
+		sTempCpp.append("\\");
+
+	// append temporary cpp name with id in middle
+	sTempCpp.append( AT_TEMP_CPP_LOWER_START );
+	sTempCpp.append( sId );
+	sTempCpp.append( AT_TEMP_CPP_LOWER_END );
+
+	//Open and truncate temporary cpp
+	ofstream out( sTempCpp.c_str() , ios::trunc );
+	if ( ! out.good() )
+	{
+		out.close();
+		return false;
+	}
+	// Headers
+	out << "#include <e32base.h>";
+	// Is debug
+	out << "\nconst TInt ATTempDebug(" << iIsDebug << ");";
+	// Log option
+	out << "\nconst TInt ATTempLogOption(" << iLogOption << ");";
+	// Alloc call stack
+	out << "\nconst TInt ATTempAllocCallStackSize(" << iAllocCallStackSize << ");";
+	// Free call stack
+	out << "\nconst TInt ATTempFreeCallStackSize(" << iFreeCallStackSize << ");";
+	// Log file name
+	out << "\n_LIT( ATTempLogFileName, \"" << sS60FileName << "\" );";
+	// Log file path
+	out << "\n_LIT( ATTempLogFilePath, \"" << sS60FilePath << "\" );";
+	// Version number
+	out << "\n_LIT( ATTempVersion, \"" << ATOOL_COMPATIBILITY_STRING << "\" );";
+	// Variable functions use enumeration values that are defined in memoryhook (customuser.h)
+	// We use constants here so that we don't need to include the header file, wich
+	// might cause problems.
+/* Enumeration copied to comment for notes
+        enum TATOptions
+            {
+            ELogFileName = 1,   
+            EVersion = 2 ,
+            ELogOption = 3,
+            EDebug = 4,
+            EAllocCallStackSize = 5,
+            EFreeCallStackSize = 6,
+			ELogFilePath = 7
+            };
+*/
+	out << "\nTInt GetInt( const TUint8 aType )";
+	out << "\n{";
+	out << "\nswitch( aType )";
+	out << "\n{";
+	out << "\ncase 4: return ATTempDebug; ";
+	out << "\ncase 3: return ATTempLogOption;";
+	out << "\ncase 5: return ATTempAllocCallStackSize;";
+	out << "\ncase 6: return ATTempFreeCallStackSize;";
+	out << "\ndefault: return KErrArgument;";
+	out << "\n}";
+	out << "\n}";
+	out << "\nTPtrC GetString( const TUint8 aType )";
+	out << "\n{";
+	out << "\nswitch( aType )";
+	out << "\n{";
+	out << "\ncase 1: return ATTempLogFileName();";
+	out << "\ncase 2: return ATTempVersion();";
+	out << "\ncase 7: return ATTempLogFilePath();";
+	out << "\ndefault: return KNullDesC();";
+	out << "\n}";
+	out << "\n}";
+
+	/** Todo: Old way of separate functions, these here for backup support and to ease testing. */
+	/** Unnessesary in the future, so can be removed then (1.8.2). */
+
+	out << "\n_LIT( KFileName, \"";
+	out << sS60FileName;
+	out << "\" );\n";
+
+	out << "\n_LIT( KFilePath, \"";
+	out << sS60FilePath;
+	out << "\" );\n";
+
+	// Hardcoded version number for support.
+	out << "\n/* The AnalyzeTool version number used. */";
+	out << "\n_LIT( KAtoolVersion, \"1.7.6;1.10.0\" );\n";
+
+	out << "\nconst TFileName LogFileName()";
+	out << "\n    {";
+	out << "\n    return TFileName( KFileName() );";
+	out << "\n    }";
+
+	out << "\nconst TPath LogFilePath()";
+	out << "\n    {";
+	out << "\n    return TPath( KFilePath() );";
+	out << "\n    }";
+
+	out << "\nTUint32 AllocCallStackSize()";
+	out << "\n    {";
+	out << "\n    return TUint32( ";
+	out << iAllocCallStackSize;
+	out << " );\n";
+	out << "\n    }";
+	
+	out << "\nTUint32 FreeCallStackSize()";
+	out << "\n    {";
+	out << "\n    return TUint32( ";
+	out << iFreeCallStackSize;
+	out << " );\n";
+	out << "\n    }";
+
+	out << "\nconst TFileName AtoolVersion()";
+	out << "\n    {";
+	out << "\n    return TFileName( KAtoolVersion() );";
+	out << "\n    }";
+
+	out << "\nTUint32 LogOption()";
+	out << "\n    {";
+	out << "\n    return TUint32( ";
+	out << iLogOption;
+	out << " );";
+	out << "\n    }";
+	
+	out << "\nTUint32 IsDebug()";
+	out << "\n    {";
+	out << "\n    return TUint32( ";
+	out << iIsDebug;
+	out << " );";
+	out << "\n    }";
+
+	// End of file and close
+	out << "\n\n// End of File\n";
+	out.close();
+	cout << AT_MSG << "Created " << sTempCpp << endl;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::IsDataFile
+// -----------------------------------------------------------------------------
+bool CATBase::IsDataFile( string sFile )
+{
+	LOG_FUNC_ENTRY("CATBase::IsDataFile");
+	// Check that sFile not empty
+	if ( sFile.empty() || sFile.length() < 1 )
+		return false;
+
+	// Temporary line char array.
+	char cLineFromFile[MAX_LINE_LENGTH];
+	//Open file
+	ifstream in( sFile.c_str() );
+
+	//File open ok?
+	if( !in.good() )
+		return false;
+
+	//Read all lines
+	in.getline( cLineFromFile, MAX_LINE_LENGTH );
+
+	string sLineFromFile( cLineFromFile );
+	in.close();
+	if( sLineFromFile.find( "DATA_FILE_VERSION" ) != string::npos )
+		return true;
+	else
+		return false;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::IsBinaryLogFile
+// -----------------------------------------------------------------------------
+bool CATBase::IsBinaryLogFile( string sFile )
+{
+	LOG_FUNC_ENTRY("CATBase::IsDataFile");
+	// Check that sFile not empty
+	if ( sFile.empty() || sFile.length() < 1 )
+		return false;
+
+	// Temporary line char array.
+	char cLineFromFile[MAX_LINE_LENGTH];
+	//Open file
+	ifstream in( sFile.c_str() );
+
+	//File open ok?
+	if( !in.good() )
+		return false;
+
+	//Read all lines
+	in.getline( cLineFromFile, MAX_LINE_LENGTH );
+
+	string sLineFromFile( cLineFromFile );
+	in.close();
+
+	if( sLineFromFile.find( "ATOOL_BINARY_FILE_VERSION" ) != string::npos )
+		return true;
+	else
+		return false;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::ParseStringToVector
+// -----------------------------------------------------------------------------
+vector<string> CATBase::ParseStringToVector( const string& sInput, char separator )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::ParseStringToVector");
+	string sString(sInput);
+	// Elements vector
+	vector<string> vStrings;
+	size_t iPos = sString.find( separator );
+	// If can not find it return vector with just one element
+	if ( iPos == string::npos )
+	{
+		// Don't add empty item into vector.
+		if ( sString.size() > 0 )
+			vStrings.push_back( sString );
+		return vStrings;
+	}
+	// Loop elements
+	while( iPos != string::npos )
+	{
+		string sElement = sString.substr(0, iPos);
+		vStrings.push_back( sElement );
+		sString.erase(0, iPos +1 );
+		iPos = sString.find( separator );
+	}
+	// Add last element if any
+	if ( sString.size() > 0 )
+		vStrings.push_back( sString );
+	// Return elements
+	return vStrings;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::FilterString
+// Filter string out of unwanted characters. The list of allowed
+// characters is defined in CFILTERSTRING.
+// -----------------------------------------------------------------------------
+string CATBase::FilterString( const string& sString )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::FilterString");
+	string sFiltered;
+	for( size_t i = 0 ; i < sString.length() ; i++ )
+	{
+		const char p = sString.at( i );
+		if ( strchr( CFILTERSTRING, p ) !=  0 )
+			sFiltered.push_back( p );
+	}
+	return sFiltered;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::FilterExtraSpaces
+// Replaces multiple continuous spaces with single. Won't leave
+// spaces in start or end of string.
+// -----------------------------------------------------------------------------
+void CATBase::FilterExtraSpaces( string& sString )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::FilterExtraSpaces");
+	string sFiltered;
+	// Loop thru char array.
+	for( size_t i = 0 ; i < sString.length(); i++ )
+	{
+		// Is char space?
+		if ( sString.at( i ) == ' ' )
+		{
+			// Pick up space if filtered does not contain char as last.
+			if ( sFiltered.rbegin() == sFiltered.rend() )
+				sFiltered.push_back( sString.at( i ) );
+			else if ( * ( sFiltered.rbegin() ) != ' ' )
+				sFiltered.push_back( sString.at( i ) );
+		}
+		else
+			sFiltered.push_back( sString.at( i ) );
+	}
+
+	// Remove first and/or last character if it is space.
+	if ( sFiltered.begin() != sFiltered.end() )
+	{
+		if( * ( sFiltered.begin() ) == ' ' )
+			sFiltered.erase( 0, 1 );
+	}
+	if ( sFiltered.rbegin() != sFiltered.rend() )
+	{
+		if( * ( sFiltered.rbegin() ) == ' ' )
+			sFiltered.resize( sFiltered.length()-1 );
+	}
+	sString = sFiltered;
+}
+
+
+bool CATBase::hexToDec( string& sHex, unsigned int& iDec )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::hexToDec");
+	istringstream ss( sHex );
+	ss.setf( ios::hex, ios::basefield );
+	if( ( ss >> iDec ) )
+		return true;
+	return false;
+}
+
+bool CATBase::hexToDec( string& sHex, int& iDec )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::hexToDec");
+	istringstream ss( sHex );
+	ss.setf( ios::hex, ios::basefield );
+	if( ( ss >> iDec ) )
+		return true;
+	return false;
+}
+
+bool CATBase::hexToDec( string& sHex, unsigned long& ulDec )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::hexToDec");
+	istringstream ss( sHex );
+	ss.setf( ios::hex, ios::basefield );
+	if( ( ss >> ulDec ) )
+		return true;
+	return false;
+}
+
+bool CATBase::hexToDec( string& sHex, unsigned long long& ullDec )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::hexToDec");
+	istringstream ss( sHex );
+	ss.setf( ios::hex, ios::basefield );
+	if( ( ss >> ullDec ) )
+		return true;
+	return false;
+}
+
+/**
+* Used to create array of integer & hex value pairs.
+*/
+struct CHexMap
+{
+	char chr;
+	int value;
+};
+
+// -----------------------------------------------------------------------------
+// CATBase::_httoi
+// -----------------------------------------------------------------------------
+unsigned long CATBase::_httoi(const char *value)
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::_httoi");
+	unsigned long l;
+	string s( value );
+	if ( CATBase::hexToDec( s, l ) )
+		return l;
+	return 0;
+}
+
+
+// -----------------------------------------------------------------------------
+// CATBase::NumberToHexString(int)
+// -----------------------------------------------------------------------------
+string CATBase::NumberToHexString( unsigned int i )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::IntToHexString");
+	stringstream ss;
+	ss << "0x" << hex << i;
+	string retval; retval = ss.str().c_str();
+	return retval;
+}
+// -----------------------------------------------------------------------------
+// CATBase::NumberToHexString(long)
+// -----------------------------------------------------------------------------
+string CATBase::NumberToHexString( unsigned long i )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::IntToHexString");
+	stringstream ss;
+	ss << "0x" << hex << i;
+	string retval; retval = ss.str().c_str();
+	return retval;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::IsHexCharacter
+// -----------------------------------------------------------------------------
+bool CATBase::IsHexCharacter(const TCHAR *value)
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::IsHexCharacter");
+	const int HexMapL = 22;
+	CHexMap HexMap[HexMapL] =
+	{
+	    {'0', 0}, {'1', 1},
+		{'2', 2}, {'3', 3},
+		{'4', 4}, {'5', 5},
+		{'6', 6}, {'7', 7},
+		{'8', 8}, {'9', 9},
+		{'A', 10}, {'B', 11},
+		{'C', 12}, {'D', 13},
+		{'E', 14}, {'F', 15},
+		{'a', 10}, {'b', 11},
+		{'c', 12}, {'d', 13},
+		{'e', 14}, {'f', 15}
+	};
+	bool found = false;
+	for (int i = 0; i < HexMapL; i++)
+	{
+		if(HexMap[i].chr == *value)
+		{
+			found = true;
+			break;
+		}
+	}
+	return found;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::IsAscii(const char*,const unsigned int)
+// -----------------------------------------------------------------------------
+bool CATBase::IsAscii( const char* pInput, const unsigned int iLength )
+{
+	LOG_LOW_FUNC_ENTRY("CATBase::IsAscii");
+	bool bRet = true;
+	const char* pPoint = pInput;
+	for( unsigned int i = 0 ; i < iLength ; i++)
+	{
+		if(	!__isascii(*pPoint) )
+		{
+			bRet = false;
+			break;
+		}
+		pPoint++;
+	}
+	return bRet;
+}
+
+// -----------------------------------------------------------------------------
+// CATBase::GetEpocRoot( string& sEpocRoot )
+// -----------------------------------------------------------------------------
+bool CATBase::GetEpocRoot( string& sEpocRoot )
+{
+	LOG_FUNC_ENTRY( "CATBase::GetEpocRoot" );
+	bool bRet = true;
+	//Find EPOCROOT from environment variable
+	char* pEpocRoot = getenv ("EPOCROOT");
+	if( pEpocRoot == NULL )
+	{
+		const char pDevicesPath[] = "C:\\Program Files\\Common Files\\Symbian\\devices.xml";
+		CATParseXML parser;
+		//Find EPOCROOT from devices
+		sEpocRoot = parser.GetEpocRootPathFromXML(pDevicesPath);
+		if( sEpocRoot.empty() )
+		{
+			printf("EPOCROOT not set to environment variables.\n");
+			bRet = false;
+		}
+	}
+	else
+	{
+		sEpocRoot.append( pEpocRoot );
+		LOG_STRING( "EpocRoot :" << sEpocRoot );
+	}
+	//Remove trailing slash
+	if ( sEpocRoot.size() > 1 && sEpocRoot[ sEpocRoot.length()-1 ] == '\\' )
+		sEpocRoot.resize( sEpocRoot.length()-1 );
+	return bRet;
+}
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/CATDatParser.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1549 @@
+/*
+* 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:  Class responsible to parse data files
+*
+*/
+
+
+#include "../inc/CATDatParser.h"
+#include "../inc/CATProject.h"
+#include "../inc/CATModule2.h"
+#include "../inc/CATMemoryAddress.h"
+#include "../inc/catromsymbol.h"
+
+// -----------------------------------------------------------------------------
+// CATDatParser::CATDatParser
+// Constructor only for testing!
+// (No module vector defined so no locating codelines / call stacks)
+// -----------------------------------------------------------------------------
+CATDatParser::CATDatParser()
+{
+	LOG_FUNC_ENTRY("CATDatParser::CATDatParser");
+	Construct();
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::CATDatParser
+// Constructor
+// -----------------------------------------------------------------------------
+CATDatParser::CATDatParser(vector<CATModule2*>* pModules )
+{
+	LOG_FUNC_ENTRY("CATDatParser::CATDatParser");
+	Construct();
+	m_pModules = pModules;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::Construct
+// "Real" constructor
+// -----------------------------------------------------------------------------
+void CATDatParser::Construct()
+{
+	LOG_FUNC_ENTRY("CATDatParser::Construct");
+
+	m_iDataVersion = 1; // Default version of data.
+	m_bDllLoadFound = false;
+	m_bProcessStartFound = false;
+	m_bSubtestOnGoing = false;
+
+	m_DataSaver.InitXML();
+	
+	m_eBuildType = -2;
+	m_eProcess_state = not_started;
+	m_eProjectBuildType = -1;
+
+	m_iCurrentProcessId = 0;
+	m_iLeakNumber = 0;
+	m_iLogLevel = 3;
+	m_iOffSet = 0;
+
+	m_iPinPointedLeaks = 0;
+	m_iPinPointedSubTestLeaks = 0;
+	m_iSubtestStartHandleCount = 0;
+	m_iSuccesfullRuns = 0;
+	m_iTotalNumberOfLeaks = 0;
+	m_iTotalRuns = 0;
+
+	m_pRomSymbol = 0;
+	m_pModules = 0;
+
+	m_sCurrentProcessName = "";
+	m_sInputFile = "";
+	m_sInputFileTemp = "";
+	m_sOutputFile = "";
+	m_sProjectPlatform = "";
+	m_vRomSymbolFiles.clear();
+	m_vDllLoadModList.clear();
+	m_vDllLoadModListSubTest.clear();
+	m_vHandleLeaks.clear();
+	m_vMemoryAddress.clear();
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::~CATDatParser
+// Destructor
+// -----------------------------------------------------------------------------
+CATDatParser::~CATDatParser()
+{
+	LOG_FUNC_ENTRY("CATDatParser::~CATDatParser");
+
+	if ( m_In.is_open() )
+		m_In.close();
+	// Delete temporary input file if any
+	if ( !m_sInputFileTemp.empty() )
+	{
+		if ( FileExists( m_sInputFileTemp.c_str() ) )
+			FileDelete( m_sInputFileTemp, false );
+	}
+	// Clean memory addresses if any
+	CleanMemoryAddresses();
+	// Delete rom symbol.
+	if ( m_pRomSymbol )
+	{
+        delete m_pRomSymbol;
+		m_pRomSymbol = NULL;
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::Analyze
+// Analyze given data file
+// -----------------------------------------------------------------------------
+int CATDatParser::Analyze()
+{
+	LOG_FUNC_ENTRY("CATDatParser::Analyze");
+	// Return if input file not set
+	if ( m_sInputFile.empty() )
+		return AT_RETURN_CODE::INVALID_DATA_FILE;
+	// If open close first
+	if ( m_In.is_open() )
+		m_In.close();
+	// Open file
+	m_In.open( m_sInputFile.c_str() );
+	if ( ! m_In.good() )
+		return AT_RETURN_CODE::INVALID_DATA_FILE;
+	try {
+		// If rom symbol file specified.
+		if ( ! m_vRomSymbolFiles.empty() )
+		{
+			// Create new rom symbol file "parser".
+			m_pRomSymbol = new CATRomSymbol();
+			m_pRomSymbol->m_bShowProgressMessages = true;
+			// Set symbol files.
+			if ( ! m_pRomSymbol->SetSymbols( m_vRomSymbolFiles ) )
+			{
+				cout << AT_MSG << "Rom/Rofs symbols error: " << m_pRomSymbol->GetError() << endl;
+				// If file open fails we delete it and will not use it.
+				delete m_pRomSymbol;
+				m_pRomSymbol = NULL;
+				cout << AT_MSG << "Analyze aborted." << endl;
+				return AT_RETURN_CODE::SYMBOL_FILE_ERROR;
+			}
+		}
+		// Return code
+		int iRet = 0;
+		// Clear variables
+		ClearParsingVariables();
+		// If output defined disable printing
+		if ( ! m_sOutputFile.empty() )
+			m_DataSaver.SetPrintFlag( false );
+		// Header
+		Header();
+		// Parsing
+		iRet = Parse();
+		// Footer
+		if ( iRet == AT_RETURN_CODE::OK )
+			Footer();
+		// If output defined save xml
+		if ( ! m_sOutputFile.empty() )
+			m_DataSaver.SaveLinesToFile( m_sOutputFile.c_str(), XML_DATA );
+		// Return
+		return iRet;
+	} catch ( int i )
+	{
+		cout << AT_MSG << "Error, Analyze failed. : " << i << endl;
+		return AT_RETURN_CODE::UNHANDLED_EXCEPTION;
+	}
+}
+// -----------------------------------------------------------------------------
+// CATDatParser::Header
+// Print header of report
+// -----------------------------------------------------------------------------
+void CATDatParser::Header()
+{
+	LOG_FUNC_ENTRY("CATDatParser::Header");
+	// Analyze report header
+	m_DataSaver.AddString( "Atool.exe v." );
+	m_DataSaver.AddString( ATOOL_VERSION );
+	m_DataSaver.AddString( "\n" );
+	m_DataSaver.AddString( "Analyzing memory leaks..." );
+	m_DataSaver.AddLineToLast();
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::Footer
+// Print footer of report
+// -----------------------------------------------------------------------------
+void CATDatParser::Footer()
+{
+	LOG_FUNC_ENTRY("CATDatParser::Footer");
+	m_DataSaver.AddString( "\nTotal Runs: " );
+	m_DataSaver.AddInteger( m_iTotalRuns );
+	m_DataSaver.AddLineToLast();
+
+	int iFailedRuns = m_iTotalRuns - m_iSuccesfullRuns;
+	m_DataSaver.AddString( "Failed Runs: " );
+	m_DataSaver.AddInteger( iFailedRuns );
+	m_DataSaver.AddLineToLast();
+
+	char cTemp[128];
+	string sResult( itoa( m_iTotalRuns, cTemp, 10 ) );
+	sResult.append( ";" );
+	sResult.append( itoa( iFailedRuns, cTemp, 10 ) );
+	sResult.append( ";" );
+
+	m_DataSaver.SaveXML( sResult, RESULT );
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ClearParsingVariables
+// Clear/Reset all member variables related to parsing data file
+// -----------------------------------------------------------------------------
+void CATDatParser::ClearParsingVariables()
+{
+	LOG_FUNC_ENTRY("CATDatParser::ClearParsingVariables");
+	// Clear variables related to analyze
+	m_eProcess_state = not_started;
+	m_bProcessStartFound = false;
+	m_bDllLoadFound = false;
+	m_iTotalNumberOfLeaks = 0;
+	m_iPinPointedLeaks = 0;
+	m_iLeakNumber = 0;
+	m_iTotalRuns = 0;
+	m_iSuccesfullRuns = 0;
+	m_bSubtestOnGoing = false;
+	m_iSubtestStartHandleCount = 0;
+	CleanMemoryAddresses();
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::Parse
+// Parses data file. Note! header and footer of the report are done in 
+// separate functions.
+// -----------------------------------------------------------------------------
+int CATDatParser::Parse()
+{
+	LOG_FUNC_ENTRY("CATDatParser::Parse");
+	// Read all lines
+	char cLine[MAX_LINE_LENGTH];
+	do
+	{
+		string sLine;
+		try {
+			m_In.getline( cLine, MAX_LINE_LENGTH );
+			sLine = cLine ;
+		} catch(...)
+		{
+			LOG_STRING( AT_MSG << "Unexpected error, reading data file." );
+			continue;
+		}
+		if( sLine.find( LABEL_DATA_FILE_VERSION ) != string::npos )
+		{
+			// Check data file version
+			if(  sLine.find( AT_DATA_FILE_VERSION ) == string::npos )
+			{
+				return AT_RETURN_CODE::WRONG_DATA_FILE_VERSION;
+			}
+		}
+		else if( sLine.find( LABEL_PROCESS_START ) != string::npos )
+		{
+			if ( ! ParseProcessStart( sLine ) )
+				return AT_RETURN_CODE::ANALYZE_ERROR;
+		}
+		else if( sLine.find( LABEL_DLL_LOAD ) != string::npos )
+		{
+			if ( ! ParseDllLoad( sLine ) )
+				return AT_RETURN_CODE::ANALYZE_ERROR;
+		}
+		else if( sLine.find( LABEL_DLL_UNLOAD ) != string::npos )
+		{
+			if ( ! ParseDllUnload( sLine ) )
+				return AT_RETURN_CODE::ANALYZE_ERROR;
+		}
+		else if( sLine.find( LABEL_MEM_LEAK ) != string::npos)
+		{
+			if ( ! ParseMemLeak( sLine ) )
+				return AT_RETURN_CODE::ANALYZE_ERROR;
+		}
+		else if( sLine.find( LABEL_PROCESS_END ) != string::npos )
+		{
+			if ( ! ParseProcessEnd( sLine ) )
+				return AT_RETURN_CODE::ANALYZE_ERROR;
+		}
+		else if( sLine.find( LABEL_ERROR_OCCURED ) != string::npos )
+		{
+			if ( ! ParseErrorOccured( sLine ) )
+				return AT_RETURN_CODE::ANALYZE_ERROR;
+		}
+		else if( sLine.find( LABEL_HANDLE_LEAK ) != string::npos )
+		{
+			if ( ! ParseHandleLeak( sLine ) )
+				return AT_RETURN_CODE::ANALYZE_ERROR;
+		}
+		else if( sLine.find( LABEL_TEST_START ) != string::npos )
+		{
+			if ( ! ParseTestStart( sLine ) )
+				return AT_RETURN_CODE::ANALYZE_ERROR;
+		}
+		else if( sLine.find( LABEL_TEST_END ) != string::npos )
+		{
+			if ( ! ParseTestEnd( sLine ) )
+				return AT_RETURN_CODE::ANALYZE_ERROR;
+		}
+		else if( sLine.find( LABEL_LOGGING_CANCELLED ) != string::npos )
+		{
+			if ( ! ParseLoggingCancelled( sLine ) )
+				return AT_RETURN_CODE::ANALYZE_ERROR;
+		}
+	}
+	while( m_In.good() );
+	// Message of failed run if process start was last line in data.
+	if ( m_eProcess_state == ongoing )
+	{
+		m_DataSaver.AddString( "Test run failed.\n" );
+		m_DataSaver.AddLineToLast();
+	}
+	return AT_RETURN_CODE::OK;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ParseProcessStart
+// -----------------------------------------------------------------------------
+bool CATDatParser::ParseProcessStart( string& sLine)
+{
+	LOG_FUNC_ENTRY("CATDatParser::ParseProcessStart");
+	if ( m_eProcess_state == ongoing )
+	{
+		m_DataSaver.AddString( "Test run failed.\n" );
+		m_DataSaver.AddLineToLast();
+	}
+	m_eProcess_state = ongoing;
+	m_bProcessStartFound = true;
+
+	// Clear handle leaks
+	m_vHandleLeaks.clear();
+	// Increment runs
+	m_iTotalRuns++;
+	// Clean leak count
+	m_iTotalNumberOfLeaks = 0;
+	// Clean pin pointed leaks count.
+	m_iPinPointedLeaks = 0;
+	// Clean leak number
+	m_iLeakNumber = 0;
+
+	// Clean loaded mods
+	m_vDllLoadModList.clear();
+	m_vDllLoadModListSubTest.clear();
+
+	// Skip text PROCESS_START
+	GetStringUntilNextSpace( sLine );
+	// Get process name
+	m_sCurrentProcessName = GetStringUntilNextSpace( sLine );
+	// Get Pid
+	string sPid = GetStringUntilNextSpace( sLine );
+	m_iCurrentProcessId = _httoi( sPid.c_str() );
+
+	// Header for process start
+	m_DataSaver.AddString( "\n--------------------------------\n" );
+	m_DataSaver.AddString( "Test Run start (" );
+	m_DataSaver.AddString( m_sCurrentProcessName.c_str() );
+	m_DataSaver.AddString( "): " );
+
+	// Get start time
+	string sTime = GetStringUntilNextSpace( sLine );
+	sTime = ConvertTimeToLocalTime( sTime );
+	m_DataSaver.AddString( sTime.c_str() );
+
+	// Create data for xml
+	string sData( sTime );
+	sData.append( ";" );
+	
+	// Build mode UDEB/UREL.
+	string sBuildType = GetStringUntilNextSpace( sLine );
+
+	m_DataSaver.AddString( " Build target: " );
+	if( sBuildType.compare( "0" ) == 0 )
+	{
+		m_eBuildType = CATProject::UREL;
+	}
+	else if( sBuildType.compare( "1" ) == 0 )
+	{
+		m_eBuildType = CATProject::UDEB;
+	}
+	m_DataSaver.AddString( CATProject::GetBuildTypeString( m_eBuildType ).c_str() );
+
+	// Version.
+	string sVersion = GetStringUntilNextSpace( sLine );
+	unsigned int iVer = 0;
+	if ( hexToDec( sVersion, iVer ) && iVer != 0 )
+		m_iDataVersion = iVer;
+
+	// End line in data.
+	m_DataSaver.AddLineToLast();
+	
+	// xml
+	sData.append( CATProject::GetBuildTypeString( m_eBuildType ) );
+	sData.append( ";" );
+	sData.append( m_sCurrentProcessName );
+	m_DataSaver.SaveXML( sData, RUN );
+
+	// If projects platform defined check that it is same in data. (future feature).
+	if ( ! m_sProjectPlatform.empty() )
+	{
+		// If platform info is added to data file do check here.
+	}
+	// If projects build type defined check that it is same in data.
+	if ( m_eProjectBuildType != -1 )
+	{
+		if ( m_eBuildType != m_eProjectBuildType )
+		{
+			string sError(AT_MSG);
+			sError.append( "Error, analyzed data has build type of " );
+			sError.append( CATProject::GetBuildTypeString( m_eBuildType ) );
+			sError.append( " and project has build type " );
+			sError.append( CATProject::GetBuildTypeString( m_eProjectBuildType ) );
+			sError.append( ". Pinpointed code lines are not valid." );
+			m_DataSaver.AddString( sError.c_str(), false );
+			m_DataSaver.AddLineToLast();
+		}
+	}
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ParseProcessEnd
+// -----------------------------------------------------------------------------
+bool CATDatParser::ParseProcessEnd( string& sLine )
+{
+	LOG_FUNC_ENTRY("CATDatParser::ParseProcessEnd");
+	GetStringUntilNextSpace( sLine );
+
+	// Get process id
+	string sProcessID = GetStringUntilNextSpace( sLine );
+	unsigned long iProcessID = _httoi( sProcessID.c_str() );
+
+	// Get time
+	string sTime = GetStringUntilNextSpace( sLine );
+
+	// Convert leak time
+	sTime = ConvertTimeToLocalTime( sTime );
+
+	// Process started?
+	if( iProcessID == m_iCurrentProcessId )
+	{
+		m_iSuccesfullRuns++;
+		m_DataSaver.AddLineToLast();
+		m_DataSaver.AddString( "Test Run end (" );
+		m_DataSaver.AddString( m_sCurrentProcessName.c_str() );
+		m_DataSaver.AddString( "): " );
+		m_DataSaver.AddString( sTime.c_str() );
+		m_DataSaver.AddLineToLast();
+		m_DataSaver.AddString( "Build target: " );
+		m_DataSaver.AddString( CATProject::GetBuildTypeString( m_eBuildType ).c_str() );
+		m_DataSaver.AddLineToLast();
+
+		m_eProcess_state = stopped;
+		// Number of leaks
+		if ( m_iLogLevel == 1 || m_iLogLevel == 2 )
+		{
+			if ( m_iPinPointedLeaks > 0 )
+			{
+				m_DataSaver.AddInteger( m_iPinPointedLeaks );
+				m_DataSaver.AddString( " number of pinpointed memory leak(s)." );
+				m_DataSaver.AddLineToLast();
+			}
+			m_DataSaver.AddInteger( m_iLeakNumber );
+			m_DataSaver.AddString( " total number of memory leak(s)." );
+			m_DataSaver.AddLineToLast();
+		}
+		else
+		{
+			m_DataSaver.AddInteger( m_iTotalNumberOfLeaks );
+			m_DataSaver.AddString( " memory leak(s) found." );
+			m_DataSaver.AddLineToLast();
+		}
+		
+		// xml
+		char cTemp[128];
+		m_DataSaver.SaveXML( itoa( m_iTotalNumberOfLeaks, cTemp, 10 ) , MEM_LEAKS );
+
+		// Print all modules which have leaks
+		for( size_t i = 0 ; i < m_vDllLoadModList.size() ; i++ )
+		{
+			if( m_vDllLoadModList.at(i).iLeaks > 0 )
+			{
+				m_DataSaver.AddInteger( m_vDllLoadModList.at(i).iLeaks );
+				m_DataSaver.AddString( " memory leak(s) in module: " );
+				m_DataSaver.AddString( m_vDllLoadModList.at(i).sModuleName.c_str() );
+				m_DataSaver.AddLineToLast();
+
+				// xml
+				string sModuleNameAndLeaks( m_vDllLoadModList[i].sModuleName );
+				sModuleNameAndLeaks.append(";");
+				sModuleNameAndLeaks.append( itoa( m_vDllLoadModList[i].iLeaks, cTemp, 10 ) );
+				m_DataSaver.SaveXML( sModuleNameAndLeaks , MEM_LEAK_MODULE );
+			}
+		}
+		
+		if ( m_vHandleLeaks.size() > 0 )
+		{
+			// We have handle leaks
+			bool bHandLeaksFound = false;
+			int iTotalNrOfLeaks = 0;
+			// Print handle leaks
+			for( size_t i = 0 ; i < m_vHandleLeaks.size() ; i++ )
+			{
+				string sTempHandleLeak( m_vHandleLeaks[i] );
+				// Count.
+				string sNrOfLeaks( GetStringUntilNextSpace(sTempHandleLeak) );
+
+				// Name.
+				//string sHandleLeakModule( GetStringUntilNextSpace( sTempHandleLeak ) );
+				string sHandleLeakModule( "Unknown" );
+
+				unsigned long iNrOfLeaks = _httoi( sNrOfLeaks.c_str() );
+				iTotalNrOfLeaks += iNrOfLeaks;
+				if( iNrOfLeaks )
+				{
+					if( !bHandLeaksFound )
+					{
+						m_DataSaver.SaveXML( sNrOfLeaks , HANDLE_LEAKS );
+					}
+					bHandLeaksFound = true;
+					m_DataSaver.AddInteger( iNrOfLeaks );
+					// Just print out how many leaks found.
+					// Because its always unknown.
+					m_DataSaver.AddString( " handle leak(s) found." );
+					m_DataSaver.AddLineToLast();
+
+					// xml
+					string sXMLInfo( sHandleLeakModule );
+					sXMLInfo.append( ";" ); sXMLInfo.append( sNrOfLeaks );
+					m_DataSaver.SaveXML( sXMLInfo , HANDLE_LEAK_MODULE );
+				}
+			}
+			// Update number if handle leaks
+			m_DataSaver.SaveXML( itoa( iTotalNrOfLeaks, cTemp, 10 ) , HANDLE_LEAKS );
+			if( !bHandLeaksFound )
+			{
+				//m_DataSaver.AddLineToLast();
+				m_DataSaver.AddString( TEXT_NO_HANDLE_LEAKS );
+				m_DataSaver.AddLineToLast();
+			}
+		}
+		else
+		{
+			// No handle leaks
+			m_DataSaver.AddLineToLast();
+			m_DataSaver.AddString( TEXT_NO_HANDLE_LEAKS );
+			m_DataSaver.AddLineToLast();
+		}
+
+		// Process end to xml
+		m_DataSaver.SaveXML( sTime, RUN_END );
+		// Reset current process
+		m_iCurrentProcessId = 0;
+	}
+	
+	// If no dll load or process start found
+	if ( ! m_bProcessStartFound || !m_bDllLoadFound )
+	{
+		m_DataSaver.AddLineToLast();
+		m_DataSaver.AddString( AT_ANALYZE_INSUFFICIENT_LOGGING_DATA );
+		m_DataSaver.AddLineToLast();
+	}
+	
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ParseDllLoad
+// -----------------------------------------------------------------------------
+bool CATDatParser::ParseDllLoad( string& sLine )
+{
+	LOG_FUNC_ENTRY("CATDatParser::ParseDllLoad");
+	//DLL_LOAD <DLL name> <Time stamp> <Memory start address> <Memory end address>
+	m_bDllLoadFound = true;
+	DLL_LOAD_INFO structDllInfo;
+	structDllInfo.iStartAddress = 0;
+	structDllInfo.iEndAddress = 0;
+	structDllInfo.iLeaks = 0;
+
+	// Skip "DLL_LOAD "
+	GetStringUntilNextSpace( sLine );
+
+	// Get module name
+	structDllInfo.sModuleName = GetStringUntilNextSpace( sLine );
+	ChangeToLower( structDllInfo.sModuleName );
+
+	// Create module from this if project platform emulator
+	if ( _stricmp( "winscw", m_sProjectPlatform.c_str() ) == 0 )
+		CreateWinscwModule( structDllInfo.sModuleName );
+
+	// Get dll start memory string address from line
+	// Convert string address to real memory address
+	structDllInfo.iStartAddress = 
+		_httoi( GetStringUntilNextSpace( sLine ).c_str() );
+
+	// Get dll end memory string address from line
+	// Convert string address to real memory address
+	structDllInfo.iEndAddress = 
+		_httoi( 
+		GetStringUntilNextSpace( sLine ).c_str() );
+
+	if ( m_iDataVersion >= AT_DLL_TIMESTAMP_DATA_VERSION )
+	{
+		// Pickup module loading time.
+		string sLoadTime = GetStringUntilNextSpace( sLine );
+		unsigned long long ull;
+		if ( hexToDec( sLoadTime, ull ) )
+			structDllInfo.iLoadTime = ull;
+	}
+
+	// Is module already loaded, if not add it to list.
+	bool bFound = false;
+	for( vector<DLL_LOAD_INFO>::iterator it = m_vDllLoadModList.begin();
+		it != m_vDllLoadModList.end() ; it++ )
+	{
+		if( (*it).sModuleName.compare( structDllInfo.sModuleName ) == 0 )
+		{
+			bFound = true;
+			break;
+		}
+	}
+	if( ! bFound )
+		m_vDllLoadModList.push_back( structDllInfo );
+
+	// Sub test module list.
+	bFound = false;
+	for( vector<DLL_LOAD_INFO>::iterator it = m_vDllLoadModListSubTest.begin();
+		it != m_vDllLoadModListSubTest.end() ; it++ )
+	{
+		if( (*it).sModuleName.compare( structDllInfo.sModuleName ) == 0 )
+		{
+			bFound = true;
+			break;
+		}
+	}
+	if( ! bFound )
+		m_vDllLoadModListSubTest.push_back( structDllInfo );
+
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ParseDllUnload
+// -----------------------------------------------------------------------------
+bool CATDatParser::ParseDllUnload( string& sLine )
+{
+	LOG_FUNC_ENTRY("CATDatParser::ParseDllUnload");
+
+	// Ignore unloads on older version because no timestamps.
+	if ( m_iDataVersion < AT_DLL_TIMESTAMP_DATA_VERSION )
+	{
+		return true;
+	}
+
+	// Skip "DLL_UNLOAD "
+	GetStringUntilNextSpace( sLine );
+
+	// Get module name
+	string sModuleName = GetStringUntilNextSpace( sLine );
+	ChangeToLower( sModuleName );
+
+	// skip adresses - not currently used
+	GetStringUntilNextSpace( sLine );
+	GetStringUntilNextSpace( sLine );
+
+	// Unload time
+	unsigned long long ull;
+	string sUnload = GetStringUntilNextSpace( sLine );
+	if ( ! hexToDec( sUnload, ull ) )
+		return true;
+
+	// Set module unload time.
+	vector<DLL_LOAD_INFO>::iterator it;
+	for( it = m_vDllLoadModList.begin() ; it != m_vDllLoadModList.end() ; it++ )
+	{
+		if ( sModuleName.compare( it->sModuleName ) == 0 )
+		{
+			(*it).iUnloadTime = ull;
+			break;
+		}
+	}
+	for( it = m_vDllLoadModListSubTest.begin() ; it != m_vDllLoadModListSubTest.end() ; it++ )
+	{
+		if ( sModuleName.compare( it->sModuleName ) == 0 )
+		{
+			(*it).iUnloadTime = ull;
+			break;
+		}
+	}
+	return true;
+}
+// -----------------------------------------------------------------------------
+// CATDatParser::ParseLoggingCancelled
+// -----------------------------------------------------------------------------
+bool CATDatParser::ParseLoggingCancelled( string& sLine )
+{
+	LOG_FUNC_ENTRY("CATDatParser::ParseLoggingCancelled");
+	// Skip text "LOGGING_CANCELLED"
+	GetStringUntilNextSpace( sLine );
+
+	// Get time
+	string sTime( GetStringUntilNextSpace( sLine ) );
+	sTime = ConvertTimeToLocalTime( sTime );
+	m_DataSaver.AddString( "Logging Cancelled." );
+	m_DataSaver.AddLineToLast();
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ParseHandleLeak
+// -----------------------------------------------------------------------------
+bool CATDatParser::ParseHandleLeak( string& sLine )
+{
+	LOG_FUNC_ENTRY("CATDatParser::ParseHandleLeak");
+	// Skip text "HANDLE_LEAK"
+	GetStringUntilNextSpace( sLine );
+	m_vHandleLeaks.push_back( sLine );
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ParseTestStart
+// -----------------------------------------------------------------------------
+bool CATDatParser::ParseTestStart( string& sLine )
+{
+	LOG_FUNC_ENTRY("CATDatParser::ParseTestStart");
+	m_bSubtestOnGoing = true;
+	m_iLeakNumber = 0;
+	m_iPinPointedSubTestLeaks = 0;
+
+	// Reset subtest leaked modules list
+	for( size_t i = 0 ; i < m_vDllLoadModListSubTest.size() ; i++ )
+	{
+		m_vDllLoadModListSubTest.at(i).iLeaks = 0;
+	}
+
+	// Skip text "TEST_START"
+	GetStringUntilNextSpace( sLine );
+	// Time
+	string sTime( GetStringUntilNextSpace( sLine ) );
+	sTime = ConvertTimeToLocalTime( sTime );
+	// Name
+	string sSubTestName( GetStringUntilNextSpace( sLine ) );				
+	m_DataSaver.AddLineToLast();
+
+	// Get handle count in subtest start
+	string sSubTestStartHandleCount( GetStringUntilNextSpace( sLine ) );
+	m_iSubtestStartHandleCount = atoi( sSubTestStartHandleCount.c_str() );
+
+	// Add start to report
+	m_DataSaver.AddString( "\nSub test (" );
+	m_DataSaver.AddString( sSubTestName.c_str() );
+	m_DataSaver.AddString( ") start: " );
+	m_DataSaver.AddString( sTime.c_str() );
+
+	// m_DataSaver.AddLineToLast();
+
+	// Add start to xml
+	string sResult( sSubTestName );
+	sResult.append( ";" );
+	sResult.append( sTime );
+	sResult.append( ";" );
+	m_DataSaver.SaveXML( sResult, TEST_START );
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ParseTestEnd
+// -----------------------------------------------------------------------------
+bool CATDatParser::ParseTestEnd( string& sLine )
+{
+	LOG_FUNC_ENTRY("CATDatParser::ParseTestEnd");
+	// Skip text "TEST_END"
+	GetStringUntilNextSpace( sLine );
+
+	// Time
+	string sTime( GetStringUntilNextSpace( sLine ) );
+	sTime = ConvertTimeToLocalTime( sTime );
+
+	// Name
+	string sSubTestName( GetStringUntilNextSpace( sLine ) );
+	m_DataSaver.AddLineToLast();
+
+	// Add test end info to report
+	m_DataSaver.AddString( "Sub test (" );
+	m_DataSaver.AddString( sSubTestName.c_str() );
+	m_DataSaver.AddString( ") end: " );
+	m_DataSaver.AddString( sTime.c_str() );
+	m_DataSaver.AddLineToLast();
+
+	// Leak count to report in subtest
+	if( m_iLeakNumber > 0 )
+	{
+		if ( m_iLogLevel == 1 || m_iLogLevel == 2 )
+		{
+			m_DataSaver.AddInteger( m_iPinPointedSubTestLeaks );
+			m_DataSaver.AddString( " number of pinpointed memory leaks." );
+			m_DataSaver.AddLineToLast();
+			m_DataSaver.AddInteger( m_iLeakNumber );
+			m_DataSaver.AddString( " memory leaks found." );
+		}
+		else
+		{
+			m_DataSaver.AddInteger( m_iLeakNumber );
+			m_DataSaver.AddString( " memory leaks found." );
+		}
+	}
+	else
+	{
+		m_DataSaver.AddString( "No memory leaks found." );
+	}
+	m_DataSaver.AddLineToLast();
+
+	// Use sTime to store info to xml
+	sTime.append(";");
+	char cTemp[128];
+	// Print all modules whitch have leaks
+	for( unsigned int i = 0 ; i < m_vDllLoadModListSubTest.size() ; i++ )
+	{
+		if( m_vDllLoadModListSubTest.at(i).iLeaks > 0 )
+		{
+			// Normal report
+			m_DataSaver.AddInteger( m_vDllLoadModListSubTest[i].iLeaks );
+			m_DataSaver.AddString( " memory leaks in module: " );
+			m_DataSaver.AddString( m_vDllLoadModListSubTest.at(i).sModuleName.c_str() );
+			m_DataSaver.AddLineToLast();
+			// xml
+			string sModuleNameAndLeaks( m_vDllLoadModListSubTest.at(i).sModuleName );
+			sModuleNameAndLeaks.append(";");
+			sModuleNameAndLeaks.append( itoa( m_vDllLoadModListSubTest.at(i).iLeaks, cTemp, 10 ) );
+			m_DataSaver.SaveXML( sModuleNameAndLeaks , SUBTEST_MEM_LEAK_MODULE );
+		}
+	}
+	// Handle count
+	int iEndHandleCount = atoi( GetStringUntilNextSpace( sLine ).c_str() );
+	// Is there handle leaks in subtest?
+	if( iEndHandleCount > m_iSubtestStartHandleCount )
+	{
+		// Print normal report
+		m_DataSaver.AddInteger( iEndHandleCount - m_iSubtestStartHandleCount );
+		m_DataSaver.AddString( " handle leaks in subtest: " );
+		m_DataSaver.AddString( sSubTestName.c_str() );
+		m_DataSaver.AddString( "." );
+		m_DataSaver.AddLineToLast();
+
+		// Print handle leaks to XML
+		string sNrOfHandleLeaks( itoa( iEndHandleCount - m_iSubtestStartHandleCount, cTemp, 10 ) );
+		sNrOfHandleLeaks.append( ";" );
+		m_DataSaver.SaveXML( sNrOfHandleLeaks, SUBTEST_HANDLE_LEAKS );
+	}
+	else
+	{
+		// No handle leaks
+		m_DataSaver.AddString( TEXT_NO_HANDLE_LEAKS );
+		m_DataSaver.AddLineToLast();
+	}
+	// Save xml
+	m_DataSaver.SaveXML( sTime, TEST_END );
+	// Back to normal leaks
+	m_bSubtestOnGoing = false;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ParseErrorOccured
+// -----------------------------------------------------------------------------
+bool CATDatParser::ParseErrorOccured( string& sLine )
+{
+	LOG_FUNC_ENTRY("CATDatParser::ParseErrorOccured");
+	string sTime,sError;
+
+	// Skip text "ERROR_OCCURED:"
+	GetStringUntilNextSpace( sLine );
+
+	// Get error
+	sError = GetStringUntilNextSpace( sLine );
+	// Get and convert error time
+	sTime = GetStringUntilNextSpace( sLine );
+	sTime = ConvertTimeToLocalTime( sTime );
+
+	// Print error line
+	m_DataSaver.AddLineToLast();
+	m_DataSaver.AddString( "Error occured on: " );
+	m_DataSaver.AddString( sTime.c_str() );
+	m_DataSaver.AddString( ". " );
+	m_DataSaver.AddString( "Symbian error code: " );
+	m_DataSaver.AddString( sError.c_str() );
+	m_DataSaver.AddString( "." );
+	m_DataSaver.AddLineToLast();
+
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ParseMemLeak
+// -----------------------------------------------------------------------------
+bool CATDatParser::ParseMemLeak( string& sLine )
+{
+	LOG_FUNC_ENTRY("CATDatParser::ParseMemLeak");
+	// Increment leak count
+	if ( ! m_bSubtestOnGoing )
+		m_iTotalNumberOfLeaks++;
+
+	// Increase leak number
+	m_iLeakNumber++;
+
+	// Leak data variables
+	string sModuleName;
+	string sLeakSize;
+	string sTime;
+	unsigned long long iTime = 0;
+	string sLeakAddress;
+	
+	// Skip text "MEM_LEAK"
+	GetStringUntilNextSpace( sLine );
+	// Get leak address
+	sLeakAddress = GetStringUntilNextSpace( sLine );
+	// Get time
+	sTime = GetStringUntilNextSpace( sLine );
+	// Convert time to decimal
+	hexToDec( sTime, iTime );
+	// Get memory reserve size
+	sLeakSize = GetStringUntilNextSpace( sLine );
+	// Convert leak time
+	sTime = ConvertTimeToLocalTime( sTime );
+
+	// Loop thru call stack and put memory addresses in vector
+	CleanMemoryAddresses(); // Clean memory address vector
+	CATMemoryAddress* pMemAddr = 0;
+	vector<string> vStrings = ParseStringToVector( sLine, ' ' );
+	for( size_t i = 0; i < vStrings.size() ; i++ )
+	{
+		pMemAddr = new CATMemoryAddress( vStrings.at(i), m_iOffSet );
+		// Set address time
+		pMemAddr->SetTime( iTime );
+		// Set address module name
+		if ( pMemAddr->FindSetModuleName( &m_vDllLoadModList ) )
+		{
+			// Increment leaks in module once
+			if ( sModuleName.empty() )
+			{
+				if ( m_bSubtestOnGoing )
+					m_vDllLoadModListSubTest.at( pMemAddr->GetDllLoadInfoIndex() ).iLeaks++;
+				else
+					m_vDllLoadModList.at( pMemAddr->GetDllLoadInfoIndex() ).iLeaks++;
+				// Set leak's module where it was located.
+				sModuleName = pMemAddr->GetModuleName();
+			}
+		}
+		// Add it to vector
+		m_vMemoryAddress.push_back( pMemAddr );
+	}
+	// If logging level is 0 Skip printing / locating code lines for call stack items.
+	if ( m_iLogLevel == 0 )
+		return true;
+	if ( m_pModules && vStrings.size() > 0 )
+	{
+		// Have we successfully located code line for memory address
+		bool bSuccesfullAddressToLine = false;
+		for( size_t x = 0; x < m_vMemoryAddress.size(); x++ )
+		{
+			int iIndexInDll = m_vMemoryAddress.at( x )->GetDllLoadInfoIndex();
+			if ( iIndexInDll != -1 )
+			{
+				// Dll module name from data file
+				string sDllName = m_vDllLoadModList.at( iIndexInDll ).sModuleName;
+				// Find module from project. These are read from makefiles.
+				for ( size_t y = 0; y < m_pModules->size() ; y++ )
+				{
+					// Module name from project data (makefiles)
+					string sModuleName = m_pModules->at( y )->GetBinaryName();
+					// If we find module from project ones, use it to located code line for memory address
+					// Note! dll names can be pretty messy i.e. DLL_LOAD 10281fc6.dll{000a0000}[10281fc6] 81d57b88 81e60a90
+					if ( sDllName.find( sModuleName ) != string::npos )
+					{
+						m_pModules->at( y )->AddressToLine( m_vMemoryAddress.at( x ) );
+						if ( ! bSuccesfullAddressToLine )
+						{
+							int iPPState = m_vMemoryAddress.at( x )->GetAddressToLineState();
+							if ( iPPState == CATMemoryAddress::EXACT || iPPState == CATMemoryAddress::FUNCTION )
+							{
+								bSuccesfullAddressToLine = true;
+								if ( m_bSubtestOnGoing )
+									m_iPinPointedSubTestLeaks++;
+								else
+									m_iPinPointedLeaks++;
+							}
+						}
+					}
+				}
+			}
+		}
+		// If rom/rofs specified we use it to try get binary and function names
+		// for addresses currently out of process range.
+		if ( m_pRomSymbol )
+		{
+			for( size_t x = 0; x < m_vMemoryAddress.size(); x++ )
+			{
+				if ( m_vMemoryAddress.at(x)->GetAddressToLineState() == CATMemoryAddress::OUT_OF_PROCESS
+					|| m_vMemoryAddress.at(x)->GetAddressToLineState() == CATMemoryAddress::OUT_OF_RANGE )
+				{
+					m_pRomSymbol->AddressToLine( m_vMemoryAddress.at(x) );
+				}
+			}
+		}
+	}
+	// Print leak
+	PrintMemLeak( sTime, sLeakSize, sLeakAddress, sModuleName);
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::PrintMemLeak
+// -----------------------------------------------------------------------------
+void CATDatParser::PrintMemLeak(const string& sTime,
+							   const string& sLeakSize,
+							   const string& sLeakAddr,
+							   const string& sModuleName)
+{
+	LOG_FUNC_ENTRY("CATDatParser::PrintMemLeak");
+	// Print header data of leak
+	m_DataSaver.AddString("\nMemory leak ");
+	m_DataSaver.AddInteger( m_iLeakNumber, true);
+
+	// Leak size
+	m_DataSaver.AddString( " (" );
+	m_DataSaver.AddInteger( _httoi( sLeakSize.c_str() ), true );
+	m_DataSaver.AddString( " bytes) " );
+
+	// Leak address
+	m_DataSaver.AddString("(0x");
+	m_DataSaver.AddString( sLeakAddr.c_str(), true );
+	m_DataSaver.AddString( ") " );
+
+	// Time
+	m_DataSaver.AddString( sTime.c_str(), true );
+	m_DataSaver.AddString( " " );
+	
+	// Module name
+	m_DataSaver.AddString( sModuleName.c_str(), true );
+	m_DataSaver.SaveCarbideDataHeader();
+	
+	// Add header line
+	m_DataSaver.AddLineToLast();
+
+	// Print the call stack items
+	for( size_t i = 0 ; i < m_vMemoryAddress.size() ; i++ )
+	{
+		// On log levels 1 & 2 we only print located code lines.
+		#ifndef ADDR2LINE
+		if( 
+			( m_iLogLevel == 1 || m_iLogLevel == 2 )
+			&&
+			( m_vMemoryAddress.at(i)->GetAddressToLineState() != CATMemoryAddress::EXACT
+			&& m_vMemoryAddress.at(i)->GetAddressToLineState() != CATMemoryAddress::FUNCTION )
+			)
+		{
+			// Skips to next
+			continue;
+		}
+		#endif
+		#ifdef ADDR2LINE
+		if( ( m_iLogLevel == 1 || m_iLogLevel == 2 )
+			&& m_vMemoryAddress.at(i)->GetAddressToLineState() != CATMemoryAddress::EXACT )
+		{
+			// Skips to next
+			continue;
+		}
+		#endif
+		else if ( m_vMemoryAddress.at(i)->GetAddressToLineState() == CATMemoryAddress::OUT_OF_PROCESS )
+		{
+			// Is memory address out of modules range
+			string sTemp;
+			sTemp.append( m_vMemoryAddress.at(i)->GetAddressString() );
+			sTemp.append( " Address out of process memory.");
+			m_DataSaver.AddString( sTemp.c_str(), true );
+			m_DataSaver.AddLineToLast();
+			continue;
+		}
+		
+		// Print memory address
+		m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetAddressString().c_str(), true );
+
+		// Space (only for console output)
+		m_DataSaver.AddString( " " );
+
+		m_DataSaver.AddCarbideData( 
+			NumberToHexString( m_vMemoryAddress.at(i)->GetOffSetFromModuleStart() ) );
+
+		// Module name
+		m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetModuleName().c_str(), true );
+
+		// Print call stack memory address details depending on state of memory address
+		switch( m_vMemoryAddress.at(i)->GetAddressToLineState() )
+		{
+			// Address outside of known processes
+		case CATMemoryAddress::OUT_OF_PROCESS:
+			m_DataSaver.AddLineToLast();
+			break;
+			// Address located outside of known modules symbols
+		case CATMemoryAddress::OUT_OF_RANGE:
+			m_DataSaver.AddString( " " );
+			m_DataSaver.AddString( "???", true );
+			m_DataSaver.AddLineToLast();
+			break;
+		// Symbol state is currently used when using rom symbol file.
+		// From it we get module name & function name.
+		case CATMemoryAddress::SYMBOL:
+			m_DataSaver.AddString( " " );
+			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFunctionName().c_str(), true );
+			if ( ! m_vMemoryAddress.at( i )->GetFileName().empty() )
+			{
+				m_DataSaver.AddString( " (" );
+				m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFileName().c_str(), true );
+				m_DataSaver.AddString( ")" );
+			}
+			m_DataSaver.AddLineToLast();
+			break;
+		// Lst & Map implementation
+		#ifndef ADDR2LINE
+		case CATMemoryAddress::FUNCTION:
+		case CATMemoryAddress::EXACT:
+			m_DataSaver.AddString( " " );
+			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFunctionName().c_str(), true );
+			// Small difference displaying details depending on build urel/udeb
+			if ( m_eBuildType == CATProject::UREL )
+			{
+				// UREL
+				// Set build info to data saver
+				m_DataSaver.SetBuild( false );
+				// urel = functionname: linenumber (filename)
+				m_DataSaver.AddString( ": " );
+				if (  m_vMemoryAddress.at(i)->GetFunctionLineNumber() != -1 )
+					m_DataSaver.AddInteger( m_vMemoryAddress.at(i)->GetFunctionLineNumber(), true );
+				else if (  m_vMemoryAddress.at(i)->GetExactLineNumber() != -1 )
+					m_DataSaver.AddInteger( m_vMemoryAddress.at(i)->GetExactLineNumber(), true );
+				m_DataSaver.AddString( " (" );
+				m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFileName().c_str(), true );
+				m_DataSaver.AddString( ")" );
+				m_DataSaver.AddLineToLast();
+			}
+			else
+			{
+				// UDEB
+				// udeb = functionname: (filename:linenumber)
+				m_DataSaver.AddString( " (" );
+				m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFileName().c_str(), true );
+				m_DataSaver.AddString( ":" );
+				if(  m_vMemoryAddress.at(i)->GetExactLineNumber() != -1 )
+					m_DataSaver.AddInteger( m_vMemoryAddress.at(i)->GetExactLineNumber(), true );
+				else
+					m_DataSaver.AddString( "???", true );
+				m_DataSaver.AddString( ")" );
+				m_DataSaver.AddLineToLast();
+			}
+			break;
+		#endif
+		// addr2line implementation (new).
+		#ifdef ADDR2LINE
+		case CATMemoryAddress::FUNCTION:
+			m_DataSaver.AddString( " " );
+			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFunctionName().c_str(), true );
+			m_DataSaver.AddString( " (" );
+			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFileName().c_str(), true );
+			m_DataSaver.AddString( ":" );
+			if(  m_vMemoryAddress.at(i)->GetExactLineNumber() != -1 )
+				m_DataSaver.AddInteger( m_vMemoryAddress.at(i)->GetFunctionLineNumber(), true );
+			else
+				m_DataSaver.AddString( "???", true );
+			m_DataSaver.AddString( ")" );
+			m_DataSaver.AddLineToLast();
+			break;
+		case CATMemoryAddress::EXACT:
+			m_DataSaver.AddString( " " );
+			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFunctionName().c_str(), true );
+			m_DataSaver.AddString( " (" );
+			m_DataSaver.AddString( m_vMemoryAddress.at(i)->GetFileName().c_str(), true );
+			m_DataSaver.AddString( ":" );
+			if(  m_vMemoryAddress.at(i)->GetExactLineNumber() != -1 )
+				m_DataSaver.AddInteger( m_vMemoryAddress.at(i)->GetExactLineNumber(), true );
+			else
+				m_DataSaver.AddString( "???", true );
+			m_DataSaver.AddString( ")" );
+			m_DataSaver.AddLineToLast();
+			break;
+		#endif
+		} // End switch
+		// On logging level 1 we only print one located code line
+		#ifndef ADDR2LINE
+		if ( m_iLogLevel == 1 && ( m_vMemoryAddress.at(i)->GetAddressToLineState() == CATMemoryAddress::EXACT ||
+			m_vMemoryAddress.at(i)->GetAddressToLineState() == CATMemoryAddress::FUNCTION ) )
+			break;
+		#endif
+		#ifdef ADDR2LINE
+		if ( m_iLogLevel == 1 && m_vMemoryAddress.at(i)->GetAddressToLineState() == CATMemoryAddress::EXACT )
+			break;
+		#endif
+	} // End call stack items loop
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::SetInputFile
+// -----------------------------------------------------------------------------
+void CATDatParser::SetInputFile(const string& sInputFile)
+{
+	LOG_FUNC_ENTRY("CATDatParser::SetInputFile");
+	m_sInputFile = sInputFile;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::SetOutputFile
+// -----------------------------------------------------------------------------
+void CATDatParser::SetOutputFile(const string& sOutpuFile)
+{
+	LOG_FUNC_ENTRY("CATDatParser::SetOutputFile");
+	m_sOutputFile = sOutpuFile;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::SetRomSymbolFiles
+// -----------------------------------------------------------------------------
+void CATDatParser::SetRomSymbolFiles(const vector<string>& vRomSymbolFiles)
+{
+	LOG_FUNC_ENTRY("CATDatParser::SetRomSymbolFiles");
+	m_vRomSymbolFiles = vRomSymbolFiles;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::SetLogLevel
+// -----------------------------------------------------------------------------
+void CATDatParser::SetLogLevel(int iLogLevel)
+{
+	LOG_FUNC_ENTRY("CATDatParser::SetLogLevel");
+	m_iLogLevel = iLogLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::GetLogLevel
+// -----------------------------------------------------------------------------
+int CATDatParser::GetLogLevel() const
+{
+	LOG_LOW_FUNC_ENTRY("CATDatParser::GetLogLevel");
+	return m_iLogLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::CleanMemoryAddresses
+// -----------------------------------------------------------------------------
+void CATDatParser::CleanMemoryAddresses()
+{
+	LOG_LOW_FUNC_ENTRY("CATDatParser::CleanMemoryAddresses");
+	// Cleanup memory addressses.
+	for( vector<CATMemoryAddress*>::iterator it = m_vMemoryAddress.begin(); it != m_vMemoryAddress.end(); it++ )
+	{
+		delete *it;
+	}
+	m_vMemoryAddress.clear();
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::ConvertTimeToLocalTime
+// -----------------------------------------------------------------------------
+string CATDatParser::ConvertTimeToLocalTime( string sInputTime )
+{
+	LOG_LOW_FUNC_ENTRY("CATDatParser::ConvertTimeToLocalTime");
+	//Is process end abnormal?
+	if( sInputTime.compare( LABEL_ABNORMAL ) == 0 )
+	{
+		return string( AT_ANALYZE_ABNORMAL_EXIT );
+	}
+	else
+	// Check that input time is at least 32-bit
+	if( sInputTime.length() <= 8 )
+	{
+		sInputTime.clear();
+		return sInputTime;
+	}
+
+	string sTemp = sInputTime;
+	const char* pTemp = sTemp.c_str();
+
+	// Are all characters hex
+	for( unsigned int i = 0 ; i < sTemp.size() ; i++ )
+	{
+		if( !IsHexCharacter( (pTemp + i) ) )
+		{
+			return sInputTime;
+		}
+	}
+	
+	// Get LSB bits
+	string sLsb;
+	sLsb.append( sInputTime.substr( sInputTime.length()-8, sInputTime.length() ) );
+	unsigned int iLsbTime = (unsigned int)_httoi( sLsb.c_str() );
+
+	// Get MSB bits
+    string sMsb;
+	sMsb.append( sInputTime.substr( 0, sInputTime.length()-8 ) );
+	unsigned int iMsbTime = (unsigned int)_httoi( sMsb.c_str() );
+
+	// Get time in microsecods
+	long long sdf = iMsbTime * 0x100000000 + iLsbTime;
+
+	// Get original time (starting at year 1970 )
+	long long llOrigTime = sdf;
+
+	// Get seconds
+	sdf = ( sdf )/1000000;
+		
+	// Check that sdf contains some time value
+	if( sdf <= 0)
+	{
+		// Error in time calculation
+		// Return empty string
+		sInputTime.clear();
+		return sInputTime;
+	}
+
+	// Original time after year 1970 in seconds
+	long long llOrignTimeInSeconds = sdf;
+	
+	// Calculate new time which does not include millisecods
+	long long llDiffTime = (llOrignTimeInSeconds * 1000000);
+
+	// Calculate time difference in milliseconds
+	int llDiffTimeInMilliSecods = (int)( llOrigTime - llDiffTime )/1000;
+	
+	// Convert difference time to char
+	char cDiffInMilliSeconds[20];
+    _itoa( llDiffTimeInMilliSecods, cDiffInMilliSeconds, 10 );
+
+	// Time info structure
+	struct tm *timeinfo;
+
+	// Get local time
+	timeinfo = localtime ( (time_t*) &sdf );
+
+	// Create string and append memory leak time to it
+	string sTime;
+	sTime.append( asctime( timeinfo ) );
+
+	// Remove last char of locale time string which is \n
+	sTime.resize( (int)sTime.length()-1 );
+	
+	// Get last space index
+	int iLastSpace = (int)sTime.find_last_of(" ");
+
+	// If last space index is valid
+	if( iLastSpace <= (int)sTime.length() && iLastSpace > 0)
+	{
+		string sTempTime;
+		// Append first part of original time string
+		sTempTime.append( sTime.substr( 0, iLastSpace ) );
+		
+		// Append millisecods
+		sTempTime.append( "." );
+		sTempTime.append( cDiffInMilliSeconds );
+
+		// Append the rest of the original time string part
+		sTempTime.append( sTime.substr( iLastSpace, sTime.length()));
+
+		// Clear original and append new time string which includes millisecods
+		sTime.clear();
+		sTime.append( sTempTime );
+	}
+
+	// Return memory leak time
+	return sTime.c_str();
+}
+
+bool CATDatParser::CreateWinscwModule( const string& sBinaryName )
+{
+	LOG_FUNC_ENTRY( "CATDatParser::CreateWinscwModule" );
+	// Is module already created?
+	for( vector<CATModule2*>::iterator it = m_pModules->begin(); it != m_pModules->end(); it++ )
+	{
+		if ( _stricmp( sBinaryName.c_str(), (*it)->GetBinaryName().c_str() ) == 0 )
+			return true;
+	}
+	// No create new one and set its values.
+	CATModule2* mod = new CATModule2();
+	mod->SetTarget( RemovePathAndExt( sBinaryName, true ) );
+	mod->SetRequestedTargetExt( GetExtension( sBinaryName ) );
+	mod->SetReleasePath( string( "\\epoc32\\release" ) );
+	if ( m_eBuildType == CATProject::UDEB )
+		mod->SetFullVariantPath( string( "winscw\\udeb" ) );
+	else
+		mod->SetFullVariantPath( string( "winscw\\urel" ) );
+	mod->SetVariantPlatform( string( "winscw" ) );
+	m_pModules->push_back( mod );
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::FindModuleUsingAddress
+// Function finds module using given address.
+// -----------------------------------------------------------------------------
+int CATDatParser::FindModuleUsingAddress( unsigned long iAddress ) const
+{
+	LOG_LOW_FUNC_ENTRY("CATDatParser::FindModuleUsingAddress");
+	int iRet = -1;
+	for( unsigned int i = 0 ; i < m_vDllLoadModList.size() ; i++ )
+	{
+		// Is address between start and end address?
+		if( iAddress > m_vDllLoadModList[i].iStartAddress && iAddress < m_vDllLoadModList[i].iEndAddress )
+		{
+			iRet = i;
+			break;
+		}	
+	}
+	return iRet;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::FindModuleUsingPID
+// Function finds module using module id.
+// -----------------------------------------------------------------------------
+/*
+int CATDatParser::FindModuleUsingPID( unsigned long iPID ) const
+{
+	LOG_FUNC_ENTRY("CATDatParser::FindModuleUsingPID");
+
+	int iRet = -1;
+
+	// Change module name characters to lowercase
+	for( unsigned int i = 0 ; i < m_vDllLoadModList.size() ; i++ )
+	{
+		if( m_vDllLoadModList[i].iPID == iPID )
+		{
+			iRet = i;
+			break;
+		}	
+	}
+	return iRet;
+}
+*/
+// -----------------------------------------------------------------------------
+// CATDatParser::FindModuleUsingName
+// Function finds module using module name.
+// -----------------------------------------------------------------------------
+int CATDatParser::FindModuleUsingName( const char* pModName )
+{
+	LOG_LOW_FUNC_ENTRY("CATDatParser::FindModuleUsingName");
+
+	// Mod name empty?
+	if( pModName == NULL || *pModName == 0 )
+		return -1;
+
+	int iRet = -1;
+	string sModName( pModName );
+	// Change module name characters to lowercase
+	ChangeToLower( sModName );
+	// Remove variant marks (dots)
+	RemoveAllAfterDotIfTwoDots( sModName);
+	for( unsigned int i = 0 ; i < m_vDllLoadModList.size() ; i++ )
+	{
+		string sTemp( m_vDllLoadModList[i].sModuleName );
+		ChangeToLower( sTemp );
+		// Remove variant marks (dots)
+		RemoveAllAfterDotIfTwoDots( sTemp );
+		if( sTemp.find( sModName ) != string::npos )
+		{
+			iRet = i;
+			break;
+		}	
+	}
+	return iRet;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::SetPrintFlag
+// -----------------------------------------------------------------------------
+void CATDatParser::SetPringFlag( bool bPrintFlag )
+{
+	LOG_FUNC_ENTRY("CATDatParser::SetPringFlag");
+	m_DataSaver.SetPrintFlag( bPrintFlag );
+}
+// -----------------------------------------------------------------------------
+// CATDatParser::SetOffSet
+// -----------------------------------------------------------------------------
+void CATDatParser::SetOffSet( int iOffSet )
+{
+	LOG_FUNC_ENTRY("CATDatParser::SetOffSet");
+	m_iOffSet = iOffSet;
+}
+
+// -----------------------------------------------------------------------------
+// CATDatParser::GetOffSet
+// -----------------------------------------------------------------------------
+int CATDatParser::GetOffSet( ) const
+{
+	LOG_LOW_FUNC_ENTRY("CATDatParser::GetOffSet");
+	return m_iOffSet;
+}
+
+// -----------------------------------------------------------------------------
+// Set project platform.
+// -----------------------------------------------------------------------------
+void CATDatParser::SetProjectPlatform( const string& sPlatform )
+{
+	LOG_FUNC_ENTRY("CATDatParser::SetProjectPlatform");
+	m_sProjectPlatform = sPlatform;
+
+	// Check that platform not empty before determing platform from it.
+	if ( sPlatform.empty() )
+		return;
+
+	// Set functions offset in mapfiles correct (depending on platform).
+	if ( _stricmp( sPlatform.c_str(), "armv5" ) == 0 )
+	{
+		m_iOffSet = FUNCTIONS_OFFSET_IN_MAP_FILE_ARMV5;
+	}
+	else if ( _stricmp( sPlatform.c_str(), "winscw" ) == 0 )
+	{
+		m_iOffSet = FUNCTIONS_OFFSET_IN_MAP_FILE_WINSCW;
+	}
+	else if ( _stricmp( sPlatform.c_str(), "gcce" ) == 0 )
+	{
+		m_iOffSet = FUNCTIONS_OFFSET_IN_GCCE;
+	}
+	else
+	{
+		LOG_STRING( AT_MSG << "Error, cannot set function's offset in map file, invalid platform: " << sPlatform );
+	}
+}
+
+// -----------------------------------------------------------------------------
+// Set projects build type. Use enumeration defined in CATProject.
+// -----------------------------------------------------------------------------
+void CATDatParser::SetProjectBuildType( int eBuildType )
+{
+	LOG_FUNC_ENTRY("CATDatParser::SetProjectBuildType");
+	m_eProjectBuildType = eBuildType;
+}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/CATDataSaver.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,873 @@
+/*
+* 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:  Definitions for the class CATDataSaver.
+*
+*/
+
+
+#include "../inc/catdatasaver.h"
+
+#include <xercesc/util/OutOfMemoryException.hpp>
+
+#if defined(XERCES_NEW_IOSTREAMS)
+#include <iostream>
+#else
+#include <iostream.h>
+#endif
+
+// Line feed char sequence used in XML report
+wchar_t AT_XML_LINEFEEDS[3] = L"\r\n";
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::CATDataSaver
+// Constructor.
+// -----------------------------------------------------------------------------
+CATDataSaver::CATDataSaver( void )
+{
+	LOG_FUNC_ENTRY("CATDataSaver::CATDataSaver");
+	m_iLoggingLevel = DEFAULT_LOGGING_LEVEL;
+	m_bPrintImmediately = true;
+	m_bXMLInitOk = false;
+	m_bUdebBuild = true;
+
+	m_iRunNumber = 1;
+
+	m_pDomDoc = NULL;
+	m_pRootElem = NULL;
+	m_Serializer = NULL;
+	m_pCurrentLeakElem = NULL;
+	m_pRunElement = NULL;
+	m_pMemoryLeaks = NULL;
+	m_pHandleLeaks = NULL;
+	m_pCurrentSubTestElem = NULL;
+	m_pSubtestMemoryLeaks = NULL;
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::~CATDataSaver
+// Destructor.
+// -----------------------------------------------------------------------------
+CATDataSaver::~CATDataSaver(void)
+{
+	LOG_FUNC_ENTRY("CATDataSaver::~CATDataSaver");
+	if( m_bXMLInitOk )
+	{
+		if( m_Serializer )
+			delete m_Serializer;
+
+		m_pDomDoc->release();
+		xercesc::XMLPlatformUtils::Terminate();
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::SaveLinesToFile
+// Gets logging level.
+// -----------------------------------------------------------------------------
+void CATDataSaver::SaveLinesToFile( const char* pFileName, int iDataToSave )
+{
+	LOG_FUNC_ENTRY("CATDataSaver::SaveLinesToFile");
+
+	// Nothing to print?
+	if( m_vLines.empty() )
+	{
+		printf( "No output data." );
+		return;
+	}
+	if( iDataToSave != XML_DATA )
+	{
+		ofstream out( pFileName );
+
+		if( !out.good() )
+		{
+			printf( "Can not open file: %s\n", pFileName );
+			return;
+		}
+		switch( iDataToSave )
+		{
+			case TEXT_DATA:
+				for( int i = 0 ; i < (int)m_vLines.size() ; i++ )
+				{
+					out << m_vLines[i].c_str();
+				}
+			break;
+		}
+		out.close();
+	}
+	else
+	{
+		if( m_bXMLInitOk )
+		{
+			xercesc::XMLFormatTarget* myFormTarget = NULL;
+			try
+			{
+				// Create format
+				myFormTarget = new xercesc::LocalFileFormatTarget( pFileName );
+				
+				// Set line-feeds to dom writer
+				m_Serializer->setNewLine( AT_XML_LINEFEEDS );
+				
+				// Set human-readable property. Note! Api already changed in >2.7
+				// so this will cause error/problems if linked to newer library.
+				m_Serializer->setFeature( xercesc::XMLUni::fgDOMWRTFormatPrettyPrint, true );
+				
+				// Write document
+				m_Serializer->writeNode(myFormTarget, *m_pDomDoc);
+			}
+			catch(...)
+			{
+				printf( "Can not save output file: %s.", pFileName );
+			}
+			if( myFormTarget )
+				delete myFormTarget; //lint !e118
+		}
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::PrintLinesToScreen
+// Prints all saved lines to screen.
+// -----------------------------------------------------------------------------
+void CATDataSaver::PrintLinesToScreen( void )
+{
+	LOG_FUNC_ENTRY("CATDataSaver::PrintLinesToScreen");
+	// Nothing to print?
+	if( m_vLines.empty() )
+	{
+		printf( "No output data." );
+		return;
+	}
+	for( int i = 0 ; i < (int)m_vLines.size() ; i++ )
+	{
+		printf( m_vLines[i].c_str() );	
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::AddLineToFirst
+// Adds saved line to first in database.
+// -----------------------------------------------------------------------------
+void CATDataSaver::AddLineToFirst( void )
+{
+	LOG_LOW_FUNC_ENTRY("CATDataSaver::AddLineToFirst");
+	m_sLine.append( "\n" );
+	m_vLines.insert( m_vLines.begin(), m_sLine );
+	m_sLine.clear();
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::AddLineToLast
+// Adds saved line to last in database.
+// -----------------------------------------------------------------------------
+void CATDataSaver::AddLineToLast()
+{
+	LOG_LOW_FUNC_ENTRY("CATDataSaver::AddLineToLast");
+	m_sLine.append( "\n" );
+	
+	string sTempDataLine;
+
+	m_vLines.push_back( m_sLine );
+
+	SaveXML( m_sCarbideDataLine, ITEM );
+
+	if( m_bPrintImmediately )
+	{
+		printf( m_sLine.c_str() );
+	}
+
+	m_sCarbideDataLine.clear();
+	m_sLine.clear();
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::AddString
+// Adds string to current line.
+// -----------------------------------------------------------------------------
+void CATDataSaver::AddString( const char* pData, bool bSaveCarbideData )
+{
+	LOG_LOW_FUNC_ENTRY("CATDataSaver::AddString");
+	m_sLine.append( pData );
+
+	if( bSaveCarbideData )
+	{
+		m_sCarbideDataLine.append( pData );
+		m_sCarbideDataLine.append(";");
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::AddInteger
+// Converts integer to string and adds it to current line.
+// -----------------------------------------------------------------------------
+void CATDataSaver::AddInteger( int iValue, bool bSaveCarbideData )
+{
+	LOG_LOW_FUNC_ENTRY("CATDataSaver::AddInteger");
+	char cTemp[128];
+	string sValue( itoa( iValue, cTemp, 10 ) );
+	m_sLine.append( sValue );
+
+	if( bSaveCarbideData )
+	{
+		m_sCarbideDataLine.append( sValue );
+		m_sCarbideDataLine.append(";");
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::SetLoggingLevel
+// Sets logging level.
+// -----------------------------------------------------------------------------
+void CATDataSaver::SetLoggingLevel( int iLoggingLevel )
+{
+	LOG_FUNC_ENTRY("CATDataSaver::SetLoggingLevel");
+	// Check that new logging level is valid 
+	// Acceptable values are between MIN_LOGGING_LEVEL and 
+    // MAX_LOGGING_LEVEL including them
+	if( iLoggingLevel >= MIN_LOGGING_LEVEL && iLoggingLevel <= MAX_LOGGING_LEVEL )
+	{
+		m_iLoggingLevel = iLoggingLevel;
+	}
+	else
+	{
+		// New logging level value is invalid => set default logging level
+		m_iLoggingLevel = DEFAULT_LOGGING_LEVEL;
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::GetLoggingLevel
+// Gets logging level.
+// -----------------------------------------------------------------------------
+int CATDataSaver::GetLoggingLevel( void )
+{
+	LOG_LOW_FUNC_ENTRY("CATDataSaver::GetLoggingLevel");
+	return m_iLoggingLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::SetPrintFlag
+// Sets print immediately flag.
+// -----------------------------------------------------------------------------
+void CATDataSaver::SetPrintFlag( bool bPrintImmediately )
+{
+	LOG_FUNC_ENTRY("CATDataSaver::SetPrintFlag");
+	m_bPrintImmediately = bPrintImmediately;
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::SaveCarbideDataHeader
+// Sets data header for Carbide data.
+// -----------------------------------------------------------------------------
+void CATDataSaver::SaveCarbideDataHeader( void )
+{
+	LOG_FUNC_ENTRY("CATDataSaver::SaveCarbideDataHeader");
+	SaveXML( m_sCarbideDataLine, LEAK );
+	m_sCarbideDataLine.clear();
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::InitXML
+// Initializes xerces xml parser.
+// -----------------------------------------------------------------------------
+bool CATDataSaver::InitXML( void )
+{
+	LOG_FUNC_ENTRY("CATDataSaver::InitXML");
+	try 
+	{
+		xercesc::XMLPlatformUtils::Initialize();
+	}
+	catch ( ... )//(const XMLException& toCatch) 
+	{
+		// Do your failure processing here
+		printf("XML initialization failed.\n");
+		return false;
+	}
+	// Error code.
+	int errorCode = 0;
+	// getDomIMplementation returns null if source has none.
+	xercesc::DOMImplementation* impl = xercesc::DOMImplementationRegistry::getDOMImplementation(L"Core");
+	if (impl != NULL)
+    {
+		// Create new DOMWriter.
+		m_Serializer = ((xercesc::DOMImplementationLS*)impl)->createDOMWriter();
+		// New document.
+        try
+        {
+			m_pDomDoc = impl->createDocument(
+                        0,                    // Root element namespace URI.
+                        L"results",         // Root element name
+                        0);                   // Document type object (DTD).
+
+            m_pRootElem = m_pDomDoc->getDocumentElement();
+        }
+        catch (const xercesc::OutOfMemoryException&)
+        {
+            XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl;
+            errorCode = 5;
+        }
+        catch (const xercesc::DOMException& e)
+        {
+            XERCES_STD_QUALIFIER cerr << "DOMException code is:  " << e.code << XERCES_STD_QUALIFIER endl;
+            errorCode = 2;
+        }
+        catch (...)
+        {
+            XERCES_STD_QUALIFIER cerr << "An error occurred creating the document" << XERCES_STD_QUALIFIER endl;
+            errorCode = 3;
+        }
+    }  // (inpl != NULL)
+    else
+    {
+        XERCES_STD_QUALIFIER cerr << "Requested implementation is not supported" << XERCES_STD_QUALIFIER endl;
+        errorCode = 4;
+    }
+	if( !errorCode )
+	{
+		m_bXMLInitOk = true;
+		return true;
+	}
+	else
+	{
+		return false;
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::WCharToChar
+// Converts wchar_t* -> char*.
+// -----------------------------------------------------------------------------
+void CATDataSaver::WCharToChar( string& sInput, const WCHAR* Source )
+{
+	LOG_LOW_FUNC_ENTRY("CATDataSaver::WCharToChar");
+	if( !Source )
+		return;
+    int i = 0;
+
+    while( Source[i] != '\0' )
+    {
+		char c = (CHAR)Source[i];
+		sInput.append( &c, 1 );
+        ++i;
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::CharToWChar
+// Converts char* -> wchar_t*.
+// -----------------------------------------------------------------------------
+LPWSTR CATDataSaver::CharToWChar( const char* str )
+{
+	LOG_LOW_FUNC_ENTRY("CATDataSaver::CharToWChar");
+    LPWSTR out = NULL;
+    if( str != NULL )
+    {
+        int in_len = (int)strlen( str );
+        int out_len = MultiByteToWideChar(CP_ACP, 0, str, in_len, NULL, 0) + 2;
+        out = new WCHAR[out_len];
+
+        if (out)
+        {
+            memset(out, 0x00, sizeof(WCHAR)*out_len);
+            MultiByteToWideChar(CP_ACP, 0, str, in_len, out, in_len);
+        }
+    }
+    return out;
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::SaveXML
+// Writes data to xml tree.
+// -----------------------------------------------------------------------------
+void CATDataSaver::SaveXML( string sInput, int iElementType )
+{
+	LOG_FUNC_ENTRY("CATDataSaver::SaveXML");
+	// Variables ok?
+	if( sInput.empty() || m_pDomDoc == NULL )
+	{
+		return;
+	}
+	try
+	{
+		switch( iElementType )
+		{
+			case RESULT:
+			{
+				// Print number of runs
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+				m_pRootElem->setAttribute( L"runs", (const LPWSTR)wTemp );
+
+				// Print failed runs
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( sTemp.c_str() );
+				m_pRootElem->setAttribute( L"failed", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+			}
+			break;
+			case RUN:
+			{
+				if( m_pRootElem == NULL )
+					return;
+				xercesc::DOMElement* runElem = m_pDomDoc->createElement( L"run" );
+				m_pRootElem->appendChild( runElem );
+
+				// Reset handle leaks.
+				m_pHandleLeaks = NULL;
+
+				// Print start time
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+				runElem->setAttribute( L"start_time", (const LPWSTR)wTemp );
+				runElem->setAttribute( L"end_time", NULL );
+				if( wTemp )
+					delete[] wTemp;
+
+				// Print build target
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				wTemp = CharToWChar( sTemp.c_str() );
+				runElem->setAttribute( L"build_target", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+
+				// Print process name
+				wTemp = CharToWChar( sInput.c_str() );
+				runElem->setAttribute( L"process_name", (const LPWSTR)wTemp );
+
+				m_pRunElement = runElem;
+
+				char cTemp[128];
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( itoa( m_iRunNumber, cTemp, 10 ) );
+				runElem->setAttribute( L"id", (const LPWSTR)wTemp );
+				m_iRunNumber++;
+				if( wTemp )
+					delete[] wTemp;
+			}
+			break;
+			case LEAK:
+			{
+				m_pCurrentLeakElem = m_pDomDoc->createElement( L"leak" );
+
+
+				if( m_pCurrentLeakElem == NULL || m_pRunElement == NULL )
+					return;
+
+				// Sub test?
+				if( m_pCurrentSubTestElem )
+					m_pCurrentSubTestElem->appendChild( m_pCurrentLeakElem );
+				else
+					m_pRunElement->appendChild( m_pCurrentLeakElem );
+
+				// Print leak ID
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+				m_pCurrentLeakElem->setAttribute( L"id", (const LPWSTR)wTemp );
+
+				// Print leak size
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( sTemp.c_str() );
+				m_pCurrentLeakElem->setAttribute( L"size", (const LPWSTR)wTemp );
+
+				// Print leak address
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( sTemp.c_str() );
+				m_pCurrentLeakElem->setAttribute( L"memaddress", (const LPWSTR)wTemp );
+
+				// Print leak time
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( sTemp.c_str() );
+				m_pCurrentLeakElem->setAttribute( L"time", (const LPWSTR)wTemp );
+
+				// Print leak module
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( sTemp.c_str() );
+				m_pCurrentLeakElem->setAttribute( L"module", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+			}
+			break;
+			case ITEM:
+			{
+				xercesc::DOMNode* callstackNode = NULL;
+
+				xercesc::DOMElement* callstackElem = NULL;
+
+				if( m_pCurrentLeakElem  == NULL )
+					return;
+
+				// Print module name
+				if( !m_pCurrentLeakElem->hasChildNodes() )
+				{
+					callstackElem = m_pDomDoc->createElement( L"callstack" );
+					m_pCurrentLeakElem->appendChild( callstackElem );
+					callstackNode = callstackElem;
+				}
+				else
+				{
+					callstackNode = m_pCurrentLeakElem->getFirstChild();
+				}
+
+				// Add callstack item
+				xercesc::DOMElement* itemElem = m_pDomDoc->createElement( L"item" );
+				callstackNode->appendChild( itemElem );
+
+				// Print memory address name
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+
+				itemElem->setAttribute( L"memaddress", (const LPWSTR)wTemp );
+
+				// Print calculated memory address
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( sTemp.c_str() );
+
+				itemElem->setAttribute( L"calc_addr", (const LPWSTR)wTemp );
+
+				// Print module name
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( sTemp.c_str() );
+
+				itemElem->setAttribute( L"module", (const LPWSTR)wTemp );
+
+				// Print function name
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( sTemp.c_str() );
+
+				itemElem->setAttribute( L"function", (const LPWSTR)wTemp );
+
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+
+				// Print function line from urel build
+				if( !m_bUdebBuild )
+				{
+					if( wTemp )
+						delete[] wTemp;
+					wTemp = CharToWChar( sTemp.c_str() );
+					itemElem->setAttribute( L"function_line", (const LPWSTR)wTemp );
+					sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				}
+
+				// Print file name
+				if( wTemp )
+					delete[] wTemp;
+				// Erase if path found from sTemp.
+				if ( sTemp.rfind( "/" ) != string::npos )
+				{
+					sTemp.erase(0, sTemp.rfind( "/" )+1 );
+				}
+				if ( sTemp.rfind( "\\" ) != string::npos )
+				{
+					sTemp.erase(0, sTemp.rfind( "\\" )+1 );
+				}
+				wTemp = CharToWChar( sTemp.c_str() );
+
+				itemElem->setAttribute( L"file", (const LPWSTR)wTemp );
+
+				// Print line of file
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( sTemp.c_str() );
+
+				if( m_bUdebBuild )
+					itemElem->setAttribute( L"line", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+			}
+			break;
+			case RUN_END:
+			{
+				if( m_pRunElement == NULL )
+					return;
+				const LPWSTR wTemp = CharToWChar( sInput.c_str() );
+				m_pRunElement->setAttribute( L"end_time", wTemp );
+				if( wTemp )
+					delete[] wTemp;
+			}
+			break;
+			case ERROR_IN_RUN:
+			{
+				if( m_pRunElement == NULL )
+					return;
+				// Add error item
+				xercesc::DOMElement* errorElem = m_pDomDoc->createElement( L"error" );
+				m_pRunElement->appendChild( errorElem );
+
+				// Print error code
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+				errorElem->setAttribute( L"code", (const LPWSTR)wTemp );
+
+				// Print error time
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				if( wTemp )
+					delete[] wTemp;
+				wTemp = CharToWChar( sTemp.c_str() );
+				errorElem->setAttribute( L"time", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+			}
+			break;
+			case MEM_LEAKS:
+			{
+				if( m_pRunElement == NULL )
+					return;
+				xercesc::DOMElement* memoryLeaksElement = m_pDomDoc->createElement( L"mem_leaks" );
+				m_pRunElement->appendChild( memoryLeaksElement );
+				m_pMemoryLeaks = memoryLeaksElement;
+
+				// Print number of leaks
+				LPWSTR wTemp = CharToWChar( sInput.c_str() );
+				memoryLeaksElement->setAttribute( L"count", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+			}
+			break;
+			case MEM_LEAK_MODULE:
+			{
+				if( m_pMemoryLeaks == NULL )
+					return;
+				xercesc::DOMElement* moduleElement = m_pDomDoc->createElement( L"module" );
+				m_pMemoryLeaks->appendChild( moduleElement );
+
+				// Print module name
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+				moduleElement->setAttribute( L"name", (const LPWSTR)wTemp );
+
+				if( wTemp )
+					delete[] wTemp;
+				// Print number of memory leaks
+				wTemp = CharToWChar( sInput.c_str() );
+				moduleElement->setAttribute( L"leaks", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+			}
+			break;
+			case HANDLE_LEAKS:
+			{
+				if( m_pRunElement == NULL )
+					return;
+				if( m_pHandleLeaks )
+				{
+					// Update number of leaks
+					LPWSTR wTemp = CharToWChar( sInput.c_str() );
+					m_pHandleLeaks->setAttribute( L"count", (const LPWSTR)wTemp );
+					if( wTemp )
+						delete[] wTemp;
+				}
+				else
+				{
+					xercesc::DOMElement* handleLeaksElement = m_pDomDoc->createElement( L"handle_leaks" );
+					m_pRunElement->appendChild( handleLeaksElement );
+					m_pHandleLeaks = handleLeaksElement;
+
+					// Print number of leaks
+					LPWSTR wTemp = CharToWChar( sInput.c_str() );
+					handleLeaksElement->setAttribute( L"count", (const LPWSTR)wTemp );
+					if( wTemp )
+						delete[] wTemp;
+				}
+			}
+			break;
+			case HANDLE_LEAK_MODULE:
+			{
+				if( m_pHandleLeaks == NULL )
+					return;
+				xercesc::DOMElement* moduleElement = m_pDomDoc->createElement( L"module" );
+				m_pHandleLeaks->appendChild( moduleElement );
+
+				// Print module name
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+				moduleElement->setAttribute( L"name", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+
+				// Print number of memory leaks
+				wTemp = CharToWChar( sInput.c_str() );
+				moduleElement->setAttribute( L"leaks", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+			}
+			break;
+			case TEST_START:
+			{
+				m_pCurrentSubTestElem = m_pDomDoc->createElement( L"subtest" );
+
+				if( m_pCurrentSubTestElem == NULL || m_pRunElement == NULL )
+					return;
+
+				m_pRunElement->appendChild( m_pCurrentSubTestElem );
+
+				// Print sub test name
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+				m_pCurrentSubTestElem->setAttribute( L"name", (const LPWSTR)wTemp );
+				if( wTemp )
+				{
+					delete[] wTemp;
+					wTemp = NULL;
+				}
+
+				// Print sub test time
+				sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				wTemp = CharToWChar( sTemp.c_str() );
+				m_pCurrentSubTestElem->setAttribute( L"start_time", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+				break;
+			}
+			case TEST_END:
+			{
+				if( m_pCurrentSubTestElem == NULL )
+					return;
+				// Print end time
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+				m_pCurrentSubTestElem->setAttribute( L"end_time", (const LPWSTR)wTemp );
+				m_pCurrentSubTestElem = NULL;
+				if( wTemp )
+					delete[] wTemp;
+				break;
+			}
+			case SUBTEST_MEM_LEAKS:
+			{
+				if( m_pCurrentSubTestElem == NULL )
+					return;
+				xercesc::DOMElement* memoryLeaksElement = m_pDomDoc->createElement( L"mem_leaks" );
+				m_pCurrentSubTestElem->appendChild( memoryLeaksElement );
+				m_pSubtestMemoryLeaks = memoryLeaksElement;
+
+				// Print number of leaks
+				LPWSTR wTemp = CharToWChar( sInput.c_str() );
+				memoryLeaksElement->setAttribute( L"count", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+				break;
+			}
+			case SUBTEST_MEM_LEAK_MODULE:
+			{
+				if( m_pSubtestMemoryLeaks == NULL )
+					return;
+				xercesc::DOMElement* moduleElement = m_pDomDoc->createElement( L"module" );
+				m_pSubtestMemoryLeaks->appendChild( moduleElement );
+
+				// Print module name
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+				moduleElement->setAttribute( L"name", (const LPWSTR)wTemp );
+
+				if( wTemp )
+					delete[] wTemp;
+				// Print number of memory leaks
+				wTemp = CharToWChar( sInput.c_str() );
+				moduleElement->setAttribute( L"leaks", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+				break;
+			}
+			case SUBTEST_HANDLE_LEAKS:
+			{
+				if( m_pCurrentSubTestElem == NULL )
+					return;
+				xercesc::DOMElement* handleLeaksElement = m_pDomDoc->createElement( L"handle_leaks" );
+				m_pCurrentSubTestElem->appendChild( handleLeaksElement );
+
+				//Print number of handle leaks
+				string sTemp = GetStringUntilNextGivenChar( sInput, ';' );
+				LPWSTR wTemp = CharToWChar( sTemp.c_str() );
+				handleLeaksElement->setAttribute( L"count", (const LPWSTR)wTemp );
+				if( wTemp )
+					delete[] wTemp;
+				break;
+			}
+			default:
+			break;
+		}
+	}
+	catch( ... )
+	{
+		printf( "Error when writing data to XML file." );
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::GetStringUntilNextGivenChar
+// Function returns string from begin of given string until next given char,
+// characters until given char are removed from sInput string.
+// -----------------------------------------------------------------------------
+string CATDataSaver::GetStringUntilNextGivenChar( string& sInput, char cCharacter )
+{
+	LOG_LOW_FUNC_ENTRY("CATDataSaver::GetStringUntilNextGivenChar");
+	string sRet;
+	size_t iPos = sInput.find( cCharacter );
+	if( sInput.size() > 1 && iPos != string::npos )
+	{
+		sRet = sInput.substr( 0, iPos );
+		sInput.erase( 0, (iPos + 1) );
+	}
+	return sRet;
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::SetBuild
+// Function sets build target info.
+// -----------------------------------------------------------------------------
+void CATDataSaver::SetBuild( bool bUdebBuild )
+{
+	LOG_FUNC_ENTRY("CATDataSaver::SetBuild");
+	m_bUdebBuild = bUdebBuild;
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::AddCarbideData
+// Function adds string to Carbide data.
+// -----------------------------------------------------------------------------
+void CATDataSaver::AddCarbideData( const string& sInput )
+{
+	LOG_LOW_FUNC_ENTRY("CATDataSaver::AddCarbideData");
+	m_sCarbideDataLine.append( sInput );
+	m_sCarbideDataLine.append(";");
+}
+
+// -----------------------------------------------------------------------------
+// CATDataSaver::IntegerToString
+// Converts integer to string.
+// -----------------------------------------------------------------------------
+string CATDataSaver::IntegerToString( int iValueToConvert )
+{
+	LOG_LOW_FUNC_ENTRY("CATDataSaver::IntegerToString");
+	char cTemp[128];
+	string sValue( itoa( iValueToConvert, cTemp, 10 ) );
+	return sValue;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/CATMemoryAddress.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,307 @@
+/*
+* 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:  Class representing a memory address and its details.
+*
+*/
+
+
+#include "../inc/CATMemoryAddress.h"
+#include "../inc/CATBase.h"
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::CATMemoryAddress
+// Constructor
+// -----------------------------------------------------------------------------
+CATMemoryAddress::CATMemoryAddress(string& sAddress, unsigned long iOffSet)
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::CATMemoryAddress");
+	m_sAddress = sAddress;
+	m_sFileName = "";
+	m_sFunctionName = "";
+	m_sModuleName = "";
+	m_iAddress = CATBase::_httoi( sAddress.c_str() );
+	m_iDllLoadinfoIndex = -1;
+	m_iModuleStartAddress = 0;
+	m_iOffSetFromModuleStart = 0;
+	m_iExactLineNumber = -1;
+	m_iFunctionLineNumber = -1;
+	m_ePinPointState = OUT_OF_PROCESS;
+	m_iOffSet = iOffSet;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::~CATMemoryAddress
+// Destructor.
+// -----------------------------------------------------------------------------
+CATMemoryAddress::~CATMemoryAddress()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::~CATMemoryAddress");
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::FindSetModuleName
+// Find which binary this address belongs to.
+// Sets also the offsetfrommodulestart.
+// -----------------------------------------------------------------------------
+bool CATMemoryAddress::FindSetModuleName(vector<DLL_LOAD_INFO>* vDlls)
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::FindSetModuleName");
+	vector<DLL_LOAD_INFO>::iterator it;
+	for (  it = vDlls->begin() ;
+		it != vDlls->end(); it++ )
+	{
+		// Is modules load time defined?
+		if ( (*it).iLoadTime > 0 )
+		{
+			// Check that load time is earlier or same as allocation
+			if ( m_iTime >= (*it).iLoadTime
+				&& m_iAddress >= (*it).iStartAddress 
+				&& m_iAddress < (*it).iEndAddress )
+			{
+				// Module is loaded until process end.
+				if ( (*it).iUnloadTime == 0 )
+					break;
+				// Check is allocation done before module was unloaded.
+				else if ( (*it).iUnloadTime >= m_iTime )
+					break;
+			}
+		}
+		// Module has no time defined use only code segments.
+		else
+		{
+			if ( m_iAddress >= (*it).iStartAddress 
+				&& m_iAddress < (*it).iEndAddress )
+				break;
+		}
+	}
+
+	// Did we not find module where address is?
+	if ( it == vDlls->end() )
+		return false;
+
+	m_ePinPointState = OUT_OF_RANGE;
+	m_sModuleName = (*it).sModuleName;
+	m_iModuleStartAddress = (*it).iStartAddress;
+	m_iOffSetFromModuleStart = m_iAddress - m_iModuleStartAddress;
+	m_iOffSetFromModuleStart += m_iOffSet;
+	m_iDllLoadinfoIndex = distance( vDlls->begin(), it ) ;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::SetModuleStartAddress
+// Set start address of the binary in which address resides.
+// Note, this also sets the offset from start value.
+// -----------------------------------------------------------------------------
+void CATMemoryAddress::SetModuleStartAddress(unsigned long iAddress)
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetModuleStartAddress");
+	m_iModuleStartAddress = iAddress;
+	m_iOffSetFromModuleStart = m_iAddress - m_iModuleStartAddress;
+	m_iOffSetFromModuleStart += m_iOffSet;
+}
+
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetOffSetFromModuleStart
+// Note return value includes the set offset.
+// So this value is not binary start - address.
+// Instead it is.
+// memory address - binary start address + offset
+// -----------------------------------------------------------------------------
+unsigned long CATMemoryAddress::GetOffSetFromModuleStart()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetOffSetFromModuleStart");
+	return m_iOffSetFromModuleStart;
+}
+
+int CATMemoryAddress::GetDllLoadInfoIndex()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetDllLoadInfo");
+	return m_iDllLoadinfoIndex;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::SetTime
+// -----------------------------------------------------------------------------
+void CATMemoryAddress::SetTime( unsigned long long& ullTime )
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetTime");
+	m_iTime = ullTime;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetTIme
+// -----------------------------------------------------------------------------
+unsigned long long CATMemoryAddress::GetTime()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetTime");
+	return m_iTime;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::SetAddress
+// -----------------------------------------------------------------------------
+void CATMemoryAddress::SetAddress(string& sAddress)
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetAddress");
+	m_sAddress = sAddress;
+	m_iAddress = CATBase::_httoi( sAddress.c_str() );
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetAddressString
+// -----------------------------------------------------------------------------
+string CATMemoryAddress::GetAddressString()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetAddressString");
+	return m_sAddress;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::SetAddress
+// -----------------------------------------------------------------------------
+void CATMemoryAddress::SetAddress(unsigned long iAddress)
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetAddress");
+	m_iAddress = iAddress;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetAddress
+// -----------------------------------------------------------------------------
+unsigned long CATMemoryAddress::GetAddress()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetAddress");
+	return m_iAddress;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::SetModuleName
+// -----------------------------------------------------------------------------
+void CATMemoryAddress::SetModuleName(string& sModuleName)
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetModuleName");
+	m_sModuleName = sModuleName;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetModuleName
+// -----------------------------------------------------------------------------
+string CATMemoryAddress::GetModuleName()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetModuleName");
+	return m_sModuleName;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::SetAddressToLineState
+// -----------------------------------------------------------------------------
+void CATMemoryAddress::SetAddressToLineState( ADDRESS_TO_LINE_STATE eState )
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetAddressToLineState");
+	m_ePinPointState = eState;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetAddressToLineState
+// -----------------------------------------------------------------------------
+int CATMemoryAddress::GetAddressToLineState()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetAddressToLineState");
+	return m_ePinPointState;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::SetFileName
+// -----------------------------------------------------------------------------
+void CATMemoryAddress::SetFileName(string& sFileName)
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetFileName");
+	m_sFileName = sFileName;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetFileName
+// -----------------------------------------------------------------------------
+string CATMemoryAddress::GetFileName()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetFileName");
+	return m_sFileName;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::SetFunctionName
+// -----------------------------------------------------------------------------
+void CATMemoryAddress::SetFunctionName(string& sFunctionName)
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetFunctionName");
+	m_sFunctionName = sFunctionName;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetFunctionName
+// -----------------------------------------------------------------------------
+string CATMemoryAddress::GetFunctionName()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetFunctionName");
+	return m_sFunctionName;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::SetFunctionLineNumber
+// -----------------------------------------------------------------------------
+void CATMemoryAddress::SetFunctionLineNumber(int iFunctionLineNumber)
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetFunctionLineNumber");
+	m_iFunctionLineNumber = iFunctionLineNumber;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetFunctionLineNumber
+// -----------------------------------------------------------------------------
+int CATMemoryAddress::GetFunctionLineNumber()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetFunctionLineNumber");
+	return m_iFunctionLineNumber;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::SetExactLineNumber
+// -----------------------------------------------------------------------------
+void CATMemoryAddress::SetExactLineNumber(int iExactLineNumber)
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::SetExactLineNumber");
+	m_iExactLineNumber = iExactLineNumber;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetExactLineNumber
+// -----------------------------------------------------------------------------
+int CATMemoryAddress::GetExactLineNumber()
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetExactLineNumber");
+	return m_iExactLineNumber;
+}
+
+// -----------------------------------------------------------------------------
+// CATMemoryAddress::GetModuleStartAddress
+// -----------------------------------------------------------------------------
+unsigned long CATMemoryAddress::GetModuleStartAddress() const
+{
+	LOG_LOW_FUNC_ENTRY("CATMemoryAddress::GetModuleStartAddress");
+	return m_iModuleStartAddress;
+}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/CATMmp.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,396 @@
+/*
+* 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:  Class responsible of handling mmp files.
+*
+*/
+
+
+#include "../inc/CATMmp.h"
+
+CATMmp::CATMmp()
+{
+	LOG_FUNC_ENTRY("CATMmp::CATMmp");
+}
+
+CATMmp::~CATMmp()
+{
+	LOG_FUNC_ENTRY("CATMmp::~CATMmp");
+}
+
+// -----------------------------------------------------------------------------
+// CATMmp::IsMmpEdited
+// Checks is the file edited by AT
+// -----------------------------------------------------------------------------
+bool CATMmp::IsMmpEdited( bool bBackup)
+{
+	LOG_FUNC_ENTRY("CATMmp::IsMmpEdited");
+	// Stream to read file
+	ifstream in;
+	// Temp char array to read line
+	char cTemp[MAX_LINE_LENGTH];
+	// Open file
+	if ( bBackup )
+		in.open( CreateMmpBackupPath().c_str() );
+	else
+		in.open( m_sMmpFile.c_str() );
+	// Is file open ok
+	if( ! in.good() )
+	{
+		cout << AT_MSG << "Error, can not open file "
+			<< m_sMmpFile << endl;
+		in.close();
+		return false;
+	}
+	// Search edit start line
+	bool bEdited=false;
+	const char* cFind = MMPFILECHANGES[0].c_str();
+	while( ! bEdited && in.good() )
+	{
+		// Get line
+		in.getline( cTemp, MAX_LINE_LENGTH );
+		// Compare to first line in changes
+		if ( strstr( cTemp, cFind) )
+		{
+			bEdited = true;
+			// Stop looking any further
+			break;
+		}
+	}
+	// Close file and return result
+	in.close();
+	return bEdited;
+}
+
+// -----------------------------------------------------------------------------
+// CATMmp::EditMmpFile
+// Makes AnalyzeTool changes to given mmp file
+// -----------------------------------------------------------------------------
+bool CATMmp::EditMmpFile(const string& sTargetType, const string& sId)
+{
+	LOG_FUNC_ENTRY("CATMmp::EditMmpFile");
+
+	if ( ! RemoveWriteProtections() )
+		return false;
+
+	// Stream where to add changes
+	ofstream out;
+
+	// Open mmp file for editing (append changes to the end)
+	out.open( m_sMmpFile.c_str(), ios::out | ios::app );
+
+	// File open ok?
+	if( !out.good() )
+	{
+		cout << AT_MSG << "Error, can not open file "
+			<< m_sMmpFile;
+		out.close();
+		return false;
+	}
+	
+	// Write lines to mmp file
+	if ( sTargetType.compare( "dll" ) == 0 || sTargetType.compare( "lib" ) == 0 )
+	{
+		// DLL changes
+		int size = sizeof( MMPFILECHANGES_DLL ) / sizeof( string );
+		for( int i = 0; i < size; i++ )
+		{
+			out << endl << MMPFILECHANGES_DLL[i];
+		}
+		out << endl;
+	}
+	else
+	{
+		// Other than DLL changes
+		int size = sizeof( MMPFILECHANGES ) / sizeof( string );
+		for( int i = 0; i < size; i++ )
+		{
+			// After second line of changes add also source statement
+			out << endl << MMPFILECHANGES[i];
+			if ( i == 1 )
+			{
+				out << endl
+					<< "SOURCE            "
+					<< AT_TEMP_CPP_LOWER_START
+					<< sId
+					<< AT_TEMP_CPP_LOWER_END;
+			}
+		}
+		out << endl;
+	}
+	// Close stream
+	out.close();
+
+	cout << AT_MSG << "Mmp file : " << m_sMmpFile << " edited." << endl;
+
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATMmp::BackupMmpFile
+// Backups the mmp file to path/atool_temp/filename.mmp.tmp
+// Calling this function results always to 
+// - none edited mmp
+// - none edited backup
+// - If mmp is write protected. Create writable copy from it. Backup the write
+// procted one.
+// -----------------------------------------------------------------------------
+bool CATMmp::BackupMmpFile( )
+{
+	LOG_FUNC_ENTRY("CATMmp::BackupMmpFile");
+
+	if ( ! RemoveWriteProtections() )
+		return false;
+
+	// Backup path+filename
+	string sBackup = CreateMmpBackupPath();
+
+	// Backup mmp.
+	if ( CopyFile( m_sMmpFile.c_str() , sBackup.c_str(), false ) == 0 )
+	{
+		// Log and return false if failed to copy file
+		LOG_STRING( "error copyfile " << m_sMmpFile << " to " << sBackup );
+		return false;
+	}
+
+	// If backup now edited remove changes from it.
+	if ( IsMmpEdited( true ) )
+	{
+		if ( ! RemoveMmpFileChanges( true ) )
+			return false;
+	}
+
+	return true;
+}
+// -----------------------------------------------------------------------------
+// CATMmp::RestoreMmpFile
+// Restores the mmp file from backup
+// -----------------------------------------------------------------------------
+bool CATMmp::RestoreMmpFile()
+{
+	LOG_FUNC_ENTRY("CATMmp::RestoreMmpFile");
+	
+	if ( ! RemoveWriteProtections() )
+		return false;
+
+	if ( CopyFile( CreateMmpBackupPath().c_str() , m_sMmpFile.c_str(), false ) == 0 )
+	{
+		// Log and return false if failed to copy file
+		LOG_STRING("error copyfile " << CreateMmpBackupPath() << " to " << m_sMmpFile );
+		return false;
+	}
+	else
+		cout << AT_MSG << "Mmp file : " << m_sMmpFile << " restored." << endl;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATMmp::RemoveMmpFileChanges
+// Removes AT changes from given mmp file
+// -----------------------------------------------------------------------------
+bool CATMmp::RemoveMmpFileChanges(bool bBackup)
+{
+	LOG_FUNC_ENTRY("CATMmp::RemoveMmpFileChanges");
+	
+	if ( ! RemoveWriteProtections() )
+		return false;
+
+	// File reading stream
+	ifstream in;
+	// Vector to hold file data
+	vector<string> vLines;
+	// Open file
+	if ( bBackup )
+		in.open( CreateMmpBackupPath().c_str(), ios::in );
+	else
+		in.open( m_sMmpFile.c_str(), ios::in );
+	// Check file open ok
+	if ( ! in.good() )
+	{
+		cout << AT_MSG << "Error, opening file";
+		if ( bBackup )
+			cout << CreateMmpBackupPath();
+		else
+			cout << m_sMmpFile;
+		cout << endl;
+		return false;
+	}
+	// Read file to temporary stream except AT changes
+	char cLine[MAX_LINE_LENGTH];
+	// Boolean to know read or not
+	bool bRead = true;
+	// Integer to confirm that AT changes were succefully found and
+	// not read even if they are found multiple times
+	int iSuccessfull = 0;
+	// Number of 'lines' in mmp changes
+	int iChangesSize = sizeof( MMPFILECHANGES ) / sizeof( string );
+	// First mmp changes line
+	string sFirstLine = MMPFILECHANGES[0];
+	// Last mmp changes line
+	string sLastLine = MMPFILECHANGES[iChangesSize-1];
+	while( in.good() )
+	{
+		in.getline( cLine, MAX_LINE_LENGTH );
+		// Check start of AT changes
+		if( strstr( cLine, sFirstLine.c_str() ) != 0 )
+		{
+			// Remove last linefeed
+			vector<string>::iterator it = vLines.end();
+			it--;
+			if ( it->size() == 0 ) 
+				vLines.erase( vLines.end()-1, vLines.end() );
+			// Stop reading
+			bRead = false;
+			iSuccessfull+=3;
+		}
+		// Read lines outside AT changes
+		if ( bRead )
+		{
+			// Gather all other lines except the AT edits
+			vLines.push_back( string(cLine) );
+		}
+		// Check end of AT changes
+		if( strstr( cLine, sLastLine.c_str() ) != 0 )
+		{
+			// Get empty line
+			in.getline( cLine, MAX_LINE_LENGTH );
+			// Continue reading
+			bRead = true;
+			iSuccessfull-=1;
+		}
+	}
+	// Close reading file stream
+	in.close();
+	// To check all went ok iSuccesfull%2 = 0
+	if ( iSuccessfull%2 != 0 && iSuccessfull >= 2 )
+	{
+		cout << AT_MSG << "Error, removing mmp changes from ";
+		if ( bBackup )
+			cout << CreateMmpBackupPath();
+		else
+			cout << m_sMmpFile;
+		cout << endl;
+		return false;
+	}
+	// Overwrite current mmp file
+	ofstream out;
+	// Open file (truncates old data)
+	if ( bBackup )
+		out.open( CreateMmpBackupPath().c_str(), ios::trunc );
+	else
+		out.open( m_sMmpFile.c_str(), ios::trunc );
+	// Is open ok
+	if( ! out.good() )
+	{
+		cout << AT_MSG << "Error, opening file ";
+		if ( bBackup )
+			cout << CreateMmpBackupPath();
+		else
+			cout << m_sMmpFile;
+		cout << endl;
+	}
+	// Write lines to file
+	for( vector<string>::iterator it = vLines.begin() ; it != vLines.end() ; it++ )
+	{
+		out << *it << endl;
+	}
+	// Close
+	out.close();
+	// Return true
+	return true;
+}
+// -----------------------------------------------------------------------------
+// CATMmp::VerifyAndRecover
+// Wont change mmp if it is not edited
+// Replaces mmp file using backup if it exists and it is
+// not edited otherwise removes changes from mmp file.
+// -----------------------------------------------------------------------------
+bool CATMmp::VerifyAndRecover()
+{
+	LOG_FUNC_ENTRY("CATMmp::VerifyAndRecover");
+	// Is it edited
+	if ( IsMmpEdited() )
+	{
+		string sBackup = CreateMmpBackupPath();
+		if ( FileExists( sBackup.c_str() ) )
+		{
+			// Is backup edited
+			if ( ! IsMmpEdited( true ) )
+			{
+				// Replace original with backup
+				return RestoreMmpFile();
+			}
+		}
+		// Remove changes from original
+		return RemoveMmpFileChanges();
+	}
+	// Non edited original
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATMmp::CreateMmpBackupPath
+// Creates string containing full path to backup mmp file
+// -----------------------------------------------------------------------------
+string CATMmp::CreateMmpBackupPath()
+{
+	LOG_FUNC_ENTRY("CATMmp::CreateMmpBackupPath");
+	// backup path+filename
+	string sBackup;
+	sBackup.append( GetPathOrFileName( false, m_sMmpFile ) );
+	sBackup.append( AT_TEMP_DIR );
+	sBackup.append( "\\" );
+	// Add mmp file name to it and .tmp
+	sBackup.append( GetPathOrFileName( true, m_sMmpFile ) );
+	// Add .tmp
+	sBackup.append( ".tmp" );
+	// Return it
+	return sBackup;
+}
+
+// -----------------------------------------------------------------------------
+// CATMmp::RemoveWriteProtections
+// Removes write protection of mmp file and backup if exists.
+// -----------------------------------------------------------------------------
+bool CATMmp::RemoveWriteProtections()
+{
+	LOG_LOW_FUNC_ENTRY("CATMmp::RemoveWriteProtections");
+
+	// Backup path+filename
+	string sBackup = CreateMmpBackupPath();
+
+	// Check is mmp read-only
+	if ( IsFileReadOnly( m_sMmpFile.c_str() ) )
+	{
+		if( ! SetFileWritable( m_sMmpFile.c_str() ) )
+		{
+			LOG_STRING( "error setting mmp file writable" << m_sMmpFile );
+			return false;
+		}
+	}
+
+	// Check is there a backup if is remove any write protection from it.
+	if ( FileExists( sBackup.c_str() ) )
+	{
+		if ( IsFileReadOnly( sBackup.c_str() ) )
+		{
+			if( ! SetFileWritable( sBackup.c_str() ) )
+			{
+				LOG_STRING( "error setting mmp file writable" << sBackup );
+				return false;
+			}
+		}
+	}
+	return true;
+}
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/CATModule2.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1678 @@
+/*
+* 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:  Class representing a module in project (sbs2)
+*
+*/
+
+
+#include "../inc/CATModule2.h"
+#include "../inc/CATProject.h"
+#include "../inc/CATDatParser.h"
+#include "../inc/CATMemoryAddress.h"
+#include "../inc/catdbghelper.h"
+#include "../inc/cataddr2line.h"
+
+CATModule2::CATModule2(void)
+{
+	LOG_FUNC_ENTRY("CATModule2::CATModule2");
+	m_bAddressToLineInitialized = false;
+	m_bS60FileNameResolved = false;
+	m_pAddressToLine = 0;
+	m_sErrors = "";
+	m_sMakeFile = "";
+	m_eBuildSystem = CATProject::SBS_V1;
+	m_sCompileInfoText = "";
+}
+
+CATModule2::~CATModule2(void)
+{
+	LOG_FUNC_ENTRY("CATModule2::~CATModule2");
+	if ( m_pAddressToLine )
+		m_pAddressToLine->Close();
+	delete m_pAddressToLine;
+}
+
+bool CATModule2::AddressToLine( CATMemoryAddress* pMemoryAddress )
+{
+	LOG_FUNC_ENTRY("CATModule2::AddressToLine");
+	if ( _stricmp( m_sVariantPlatform.c_str(), "winscw" ) == 0 )
+	{
+		return AddressToLineWinscw( pMemoryAddress );
+	}
+	else if ( _stricmp( m_sVariantPlatform.c_str(), "armv5" ) == 0 )
+	{
+		// addr2line exe.
+		#ifdef ADDR2LINE
+		return AddressToLineAddr2lineExe( pMemoryAddress );
+		#endif
+		// lst and map files.
+		#ifndef ADDR2LINE
+		return AddressToLineArmv5( pMemoryAddress );
+		#endif
+	}
+	else if ( _stricmp( m_sVariantPlatform.c_str(), "gcce" ) == 0 )
+	{
+		return AddressToLineAddr2lineExe( pMemoryAddress );
+	}
+	return false;
+}
+
+bool CATModule2::AddressToLineWinscw( CATMemoryAddress* pMemoryAddress )
+{
+	LOG_FUNC_ENTRY("CATModule2::AddressToLineWinscw( CATMemoryAddress* pMemoryAddress )");
+	if ( m_pAddressToLine == 0 && ! m_bAddressToLineInitialized )
+	{
+		// Use debug helper to locate codelines on winscw platform.
+		m_pAddressToLine = new CATDbgHelper();
+
+		// Create full path to binary which we open using CATDbgHelper.
+		string sFullPathToBinary = GetBinaryFile();
+
+		// If opening of binary not succesfull set return value to false.
+		if ( ! m_pAddressToLine->Open( sFullPathToBinary, pMemoryAddress->GetModuleStartAddress() ) )
+		{
+			LOG_STRING("Error, m_pAddressToLine->Open()");
+			return false;
+		}
+		m_bAddressToLineInitialized = true;
+	}
+	// Check pointer before calling.
+	if ( m_pAddressToLine == 0 )
+		return false;
+	m_pAddressToLine->AddressToLine( pMemoryAddress );
+	return true;
+}
+
+bool CATModule2::AddressToLineArmv5( CATMemoryAddress* pMemoryAddress )
+{
+	LOG_FUNC_ENTRY("CATModule2::AddressToLine( CATMemoryAddress* pMemoryAddress )");
+	if ( ! m_bAddressToLineInitialized )
+		return false;
+	// Find from map file
+	int iMapIndex = GetSymbolIndexUsingAddress( pMemoryAddress->GetOffSetFromModuleStart() );
+	if ( iMapIndex == -1 )
+	{
+		pMemoryAddress->SetAddressToLineState( CATMemoryAddress::OUT_OF_RANGE );
+		return true;
+	}
+	// Set symbol name
+	string sSymbolName = m_vMapFileFuncList.at( iMapIndex ).sFunctionName;
+
+	// Remove (... from symbol name
+	string sSymbolNameRefined( sSymbolName );
+	size_t iPos = sSymbolNameRefined.find( "(" );
+	if ( iPos != string::npos )
+		sSymbolNameRefined.resize( iPos );
+
+	// Set symbol name as function name for memory address
+	pMemoryAddress->SetFunctionName( sSymbolNameRefined );
+
+	// Set state to symbol
+	pMemoryAddress->SetAddressToLineState( CATMemoryAddress::SYMBOL );
+	
+	// Offset from function start addr
+	int iOffSetFromFuncStart = pMemoryAddress->GetOffSetFromModuleStart()
+		- m_vMapFileFuncList.at( iMapIndex ).iAddress;
+
+	// Find from lst list
+	int iLstIndex = GetLineInFileIndexUsingSymbolName( sSymbolName );
+	if ( iLstIndex == -1 )
+		return true;
+
+	// Set pinpointing
+	int iFuncLineNumber = m_vLineInFile.at( iLstIndex ).iLine;
+	string sFileName = m_vLineInFile.at( iLstIndex ).sFileName;
+	string sLstFileName = m_vLineInFile.at( iLstIndex ).sLstName;
+
+	pMemoryAddress->SetFunctionLineNumber( iFuncLineNumber );
+	pMemoryAddress->SetFileName( sFileName );
+	
+	pMemoryAddress->SetAddressToLineState( CATMemoryAddress::FUNCTION );
+
+	// In urel mode don't get exact code line
+	if ( ! IsUDEB() )
+		return true;
+
+	// Next calculate the code line inside function
+	int iExactLineNumber = FindLeakCodeLine( sLstFileName, iFuncLineNumber, iOffSetFromFuncStart );
+	pMemoryAddress->SetExactLineNumber( iExactLineNumber );
+
+	// State is now exact
+	pMemoryAddress->SetAddressToLineState( CATMemoryAddress::EXACT );
+	return true;
+}
+
+bool CATModule2::AddressToLineAddr2lineExe( CATMemoryAddress* pMemoryAddress )
+{
+	LOG_FUNC_ENTRY("CATModule2::AddressToLineAddr2lineExe( CATMemoryAddress* pMemoryAddress )");
+	if ( m_pAddressToLine == 0 && ! m_bAddressToLineInitialized )
+	{
+		// Use addr2line.exe to locate codelines on armv5 and gcce platform.
+		m_pAddressToLine = new CATAddr2line();
+
+		// Create full path to binary .sym file which we open using addr2line.exe.
+		string sFullPathToBinary = GetBinaryFile();
+
+		// If opening of binary not succesfull set return value to false.
+		if ( ! m_pAddressToLine->Open( sFullPathToBinary, pMemoryAddress->GetModuleStartAddress() ) )
+		{
+			LOG_STRING("Error, m_pAddressToLine->Open()");
+			return false;
+		}
+		m_bAddressToLineInitialized = true;
+	}
+	// Check pointer before calling.
+	if ( m_pAddressToLine == 0 )
+		return false;
+
+	m_pAddressToLine->AddressToLine( pMemoryAddress );
+	return true;
+}
+
+// Find symbol of given address
+int CATModule2::GetSymbolIndexUsingAddress( unsigned long iAddress ) const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetSymbolIndexUsingAddress");
+	for( size_t i = 0; i < m_vMapFileFuncList.size(); i++ )
+	{
+		unsigned long iStart = m_vMapFileFuncList.at( i ).iAddress;
+		unsigned long iEnd = ( m_vMapFileFuncList.at( i ).iAddress
+			+ m_vMapFileFuncList.at( i ).iFuncLength );
+
+		if ( iAddress >= iStart && iAddress < iEnd )
+			return (int) i;
+	}
+	return -1;
+}
+
+// Find index of function line in file vector of given symbolname
+int CATModule2::GetLineInFileIndexUsingSymbolName( const string& sSymbolName ) const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetLineInFileIndexUsingSymbolName");
+	for( size_t i = 0; i < m_vLineInFile.size(); i++ )
+	{
+		string sLineInFileName = m_vLineInFile.at( i ).sFunction;
+		if( sLineInFileName.find( sSymbolName ) != string::npos )
+		{
+			return (int) i;
+		}
+	}
+	return -1;
+}
+
+
+// Check does modules symbol file(s) exist.
+bool CATModule2::SymbolFileExist( void )
+{
+	LOG_FUNC_ENTRY("CATModule2::SymbolFileExist");
+	string sFullPathToSym = GetSymbolFile();
+	if ( !FileExists( sFullPathToSym.c_str() ) )
+	{
+		// Add missing symbol file to error string.
+		m_sErrors.append( "Missing symbol file: " );
+		m_sErrors.append( sFullPathToSym );
+		m_sErrors.append( "\n" );
+		return false;
+	}
+	return true;
+}
+
+// Check does modules map file(s) exists.
+bool CATModule2::MapFileExist( void )
+{
+	LOG_FUNC_ENTRY("CATModule2::MapFileExist");
+	string sFullPathToMap = GetMapFile();
+	if ( !FileExists( sFullPathToMap.c_str() ) )
+	{
+		// Add missing symbol file to error string.
+		m_sErrors.append( "Missing map file: " );
+		m_sErrors.append( sFullPathToMap );
+		m_sErrors.append( "\n" );
+		return false;
+	}
+	return true;
+}
+
+//Check does modules binary file(s) exist.
+bool CATModule2::BinaryFileExist( void )
+{
+	LOG_FUNC_ENTRY("CATModule2::BinaryFileExist");
+	string sFullPathToBinary = GetBinaryFile();
+	if ( ! FileExists( sFullPathToBinary.c_str() ) )
+	{
+		// Add missing binary to error string.
+		m_sErrors.append( "Missing binary file: " );
+		m_sErrors.append( sFullPathToBinary );
+		m_sErrors.append( "\n" );
+		return false;
+	}
+	return true;
+}
+
+void CATModule2::AddSource(const string &sSourceFile, const string& sLstFile)
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::AddSource");
+	// Parse sources which are separated by spaces
+	if( sSourceFile.length() < 1  || sLstFile.length() < 1 )
+		return;
+
+	// Skip if its temporary cpp.
+	if ( sSourceFile.find( AT_TEMP_CPP_LOWER_START) != string::npos )
+		return;
+
+	// Source structure
+	SOURCE sNew;
+	sNew.sCpp =  sSourceFile;
+	sNew.sLst = sLstFile;
+
+	// Verify paths.
+	ConvertUnixPathToWin( sNew.sCpp );
+	ConvertUnixPathToWin( sNew.sLst );
+
+	// Lower case them.
+	ChangeToLower( sNew.sCpp );
+	ChangeToLower( sNew.sLst );
+
+	// Add it
+	m_vSources.push_back( sNew );
+}
+
+void CATModule2::AddSources(string& sSource)
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::AddSources");
+	// Parse sources which are separated by spaces
+	if( sSource.length() < 1 )
+		return;
+	// Source structure
+	SOURCE sNew;
+	size_t iSpot = string::npos;
+	iSpot = sSource.find( " " );
+	while( iSpot != string::npos )
+	{
+		// Pickup source
+		sNew.sCpp = sSource.substr(0, iSpot);
+		// Convert path from Unix to Win
+		ConvertUnixPathToWin( sNew.sCpp );
+		// Lowercase it
+		ChangeToLower( sNew.sCpp );
+		// If its temp skip this
+		if ( sNew.sCpp.find( AT_TEMP_CPP_LOWER_START ) == string::npos )
+		{
+			// Get corresponding lst file for source
+			sNew.sLst = GetLstNameOfSource( sNew.sCpp );
+			m_vSources.push_back( sNew );
+			// Remove it from sSource
+			sSource.erase(0,iSpot+1);
+			// Find new one
+		}
+		iSpot = sSource.find( " " );
+	}
+	// Pickup last or only one source
+	sNew.sCpp = sSource;
+	// Convert path from unix to win
+	ConvertUnixPathToWin( sNew.sCpp );
+	// Lowercase it
+	ChangeToLower( sNew.sCpp );
+	// Lst name
+	sNew.sLst = GetLstNameOfSource( sNew.sCpp );
+	if ( sNew.sCpp.find( AT_TEMP_CPP_LOWER_START ) == string::npos )
+	{
+		// Get corresponding lst file for source
+		sNew.sLst = GetLstNameOfSource( sNew.sCpp );
+		m_vSources.push_back( sNew );
+	}
+}
+bool CATModule2::CreateTempCpp(const string& sS60FileName
+							        , const string& sS60FilePath
+									, int eLoggingMode
+									, int eBuildType
+									, int iAllocCallStackSize
+									, int iFreeCallStackSize )
+{
+	LOG_FUNC_ENTRY("CATModule2::CreateTemporaryCpp");
+
+	// Make s60 filename target.type.dat if its empty and logging mode is file
+	if ( eLoggingMode == CATProject::FILE )
+	{
+		// S60 filename
+		SetS60FileName( sS60FileName );
+		
+		// S60 filepath
+		// use double slashes in temp cpp file
+		m_sS60FilePath = sS60FilePath;
+		int iIgnore(0);
+		size_t iPos = m_sS60FilePath.find("\\", iIgnore );
+		while( iPos != string::npos )
+		{
+			m_sS60FilePath.replace( iPos, 1, "\\\\" );
+			// dont replace previously replaced slashes
+			iIgnore = iPos + 2;
+			iPos = m_sS60FilePath.find("\\", iIgnore );
+		}
+
+
+	}
+	return CreateTemporaryCpp( GetUniqueId(), m_sTempPath,
+		m_sS60FileName, m_sS60FilePath, eLoggingMode, eBuildType, iAllocCallStackSize, iFreeCallStackSize );
+}
+
+bool CATModule2::ModifyMmp()
+{
+	LOG_FUNC_ENTRY("CATModule2::ModifyMmp");
+	// Create backup
+	if ( ! m_Mmp.BackupMmpFile() )
+		return false;
+	// Hook
+	return m_Mmp.EditMmpFile( m_sTargetType, GetUniqueId() );
+}
+
+bool CATModule2::RestoreMmp()
+{
+	LOG_FUNC_ENTRY("CATModule2::RestoreMmp");
+	// Restore mmp from backup
+	return m_Mmp.RestoreMmpFile();
+}
+
+bool CATModule2::VerifyAndRecoverMmp()
+{
+	LOG_FUNC_ENTRY("CATModule2::VerifyAndRecoverMmp");
+	// Verify mmp
+	return m_Mmp.VerifyAndRecover();
+}
+
+// ----------------------------------------------------------------------------
+// Releasables Handling methos
+// ----------------------------------------------------------------------------
+bool CATModule2::CopyReleasables()
+{
+	LOG_FUNC_ENTRY("CATModule2::CopyReleasables");
+	bool bRet = true;
+	if ( ! CopyLstFilesToTemp() )
+		bRet = false;
+	if ( ! CopyMapFileToTemp() )
+		bRet = false;
+	return bRet;
+}
+
+bool CATModule2::CopyLstFilesToDir( const string& sDir )
+{
+	LOG_FUNC_ENTRY("CATModule2::CopyLstFilesToDir");
+	bool bRet = true;
+	// Copy lst files to given directory.
+	vector<SOURCE>::const_iterator source;
+	for( source = m_vSources.begin(); source != m_vSources.end() ; source++ )
+	{
+		if ( ! FileCopyToPath( source->sLst, sDir ) )
+		{
+			if ( !FileExists( source->sLst.c_str() ) )
+			{
+				m_sErrors.append( "Missing listing file: " );
+				m_sErrors.append( source->sLst );
+				m_sErrors.append( "\n" );
+			}
+			if ( !DirectoryExists( sDir.c_str() ) )
+			{
+				m_sErrors.append( "Missing folder: " );
+				m_sErrors.append( sDir );
+				m_sErrors.append( "\n" );
+			}
+			bRet = false;
+		}
+	}
+	// Return.
+	return bRet;
+}
+
+bool CATModule2::CopyLstFilesToTemp()
+{
+	LOG_FUNC_ENTRY("CATModule2::CopyLstFilesToTemp");
+	// Return boolean
+	bool bRet = true;
+	// Move all lst files except tmp cpp
+	vector<SOURCE>::iterator it = m_vSources.begin();
+	while ( it != m_vSources.end() )
+	{
+		if ( !FileCopyToPath( it->sLst, m_sTempPath ) )
+		{
+			if ( !FileExists( it->sLst.c_str() ) )
+			{
+				m_sErrors.append( "Missing listing file: " );
+				m_sErrors.append( it->sLst );
+				m_sErrors.append( "\n" );
+			}
+			if ( !DirectoryExists( m_sTempPath.c_str() ) )
+			{
+				m_sErrors.append( "Missing folder: " );
+				m_sErrors.append( m_sTempPath );
+				m_sErrors.append( "\n" );
+			}
+			bRet = false;
+		}
+		it++;
+	}
+	return bRet;
+}
+
+bool CATModule2::DeleteLstFilesFromSrc( void )
+{
+	LOG_FUNC_ENTRY("CATModule2::DeleteLstFilesFromSrc");
+	vector<SOURCE>::iterator it = m_vSources.begin();
+	bool bRet = true;
+	// Delete lst files
+	while ( it != m_vSources.end() )
+	{
+		if ( ! FileDelete( it->sLst, true ) )
+			bRet = false;
+		it++;
+	}
+	return bRet;
+}
+
+bool CATModule2::CopyMapFileToTemp()
+{
+	LOG_FUNC_ENTRY("CATModule2::CopyMapFileToTemp");
+	// Return boolean
+	bool bRet = true;
+	// Map File to copy
+	string sMapFile = GetMapFile();
+	if ( !FileCopyToPath( sMapFile, m_sTempPath ) )
+	{
+		bRet = false;
+		if ( !FileExists( sMapFile.c_str() ) )
+		{
+			// Add missing map file to error string.
+			m_sErrors.append( "Missing map file: " );
+			m_sErrors.append( sMapFile );
+			m_sErrors.append( "\n" );
+		}
+		if ( !DirectoryExists( m_sTempPath.c_str() ) )
+		{
+			// Add missing temporary folder
+			m_sErrors.append( "Missing folder: " );
+			m_sErrors.append( m_sTempPath );
+			m_sErrors.append( "\n" );
+		}
+	}
+	return bRet;
+}
+
+bool CATModule2::CleanTemporaryDir()
+{
+	LOG_FUNC_ENTRY("CATModule2::CleanTemporaryDir");
+	bool bRet = true;
+	// Verify mmp
+	if ( ! m_Mmp.VerifyAndRecover() )
+		bRet = false;
+	// Clean temporary dir
+	vector<string> vFileList = DirList( m_sTempPath, false , true );
+	vector<string>::iterator it = vFileList.begin();
+	// Size of constant table
+	int iCount = sizeof( TEMP_EXTENSION_NO_DELETE ) / sizeof( string );
+	while ( it != vFileList.end() )
+	{
+		// Get extension and compare it to list
+		bool bDelete = true;
+		string sExtension = GetExtension( *it );
+		ChangeToLower( sExtension );
+		for ( int i = 0 ; i < iCount ; i++ )
+		{
+			if( sExtension.compare( TEMP_EXTENSION_NO_DELETE[i] ) == 0 )
+			{
+				bDelete = false;
+				break;
+			}
+		}
+		if ( bDelete )
+		{
+			// Delete file
+			if ( ! FileDelete( *it, true ) )
+				bRet = false;
+		}
+		// Increment
+		it++;
+	}
+	return bRet;
+}
+
+bool CATModule2::DeleteTemporaryDir()
+{
+	LOG_FUNC_ENTRY("CATModule2::DeleteTemporaryDir");
+	bool bRet = true;
+	// Verify mmp
+	if ( ! m_Mmp.VerifyAndRecover() )
+		bRet = false;
+	// Delete temp dir
+	if ( !DirDelete( m_sTempPath, true ) )
+		bRet = false;
+	return bRet;
+}
+
+bool CATModule2::IsUDEB() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::IsUDEB");
+	// Determine from variant is this udeb
+	if ( m_sVariantType.find( "udeb" ) != string::npos )
+		return true;
+	return false;
+}
+// ----------------------------------------------------------------------------
+// Private AddressToLine related methods
+// ----------------------------------------------------------------------------
+bool CATModule2::InitializeAddressToLine()
+{
+	LOG_FUNC_ENTRY("CATModule2::InitializeAddressToLine");
+	bool bRet = true;
+	// Read in different way depending on platform
+	if ( m_sVariantPlatform.compare("armv5") == 0 )
+	{
+		// Add static library lst files to source vector,
+		// before reading them.
+		vector<string> vFiles = DirList( AT_TEMP_LST_DIR, false, true );
+		for(vector<string>::iterator it = vFiles.begin() ; it != vFiles.end() ; it ++ )
+		{
+			SOURCE source;
+			source.bStatic = true;
+			source.sLst = *it;
+			source.sCpp = *it;
+			source.sCpp = CATBase::RemovePathAndExt( source.sCpp, false );
+			source.sCpp.append( ".cpp" );
+			m_vSources.push_back( source );
+		}
+
+		if ( ! ReadListingFilesArmv5() )
+			bRet = false;
+		if ( ! ReadMapFileArmv5() )
+			bRet = false;
+
+		if ( bRet )
+			m_bAddressToLineInitialized = true;
+	}
+	return bRet;
+}
+
+
+bool CATModule2::ReadListingFilesArmv5()
+{
+	LOG_FUNC_ENTRY("CATModule2::ReadListingFilesArmv5");
+	char cTemp[MAX_LINE_LENGTH];
+	vector<SOURCE>::iterator viFileIter = m_vSources.begin();
+	int iNumberOfLstFiles = (int)m_vSources.size();
+	vector<string> vTempLines;
+	string sFileName;
+
+	// Open all .lst files
+	while( iNumberOfLstFiles > 0 )
+	{
+		// Make .lst file name
+		sFileName.clear();
+	
+		// If lst file is not from static library make path to modules temporary directory.
+		if ( viFileIter->bStatic != true )
+		{
+			// Remove path
+			if( viFileIter->sLst.find("\\") != string::npos )
+				sFileName.append(
+				viFileIter->sLst.substr( viFileIter->sLst.find_last_of( "\\" ) + 1
+				, viFileIter->sLst.size() ) );
+			else
+				sFileName.append( viFileIter->sLst );
+
+			// Add temporary dir
+			sFileName.insert( 0, m_sTempPath );
+		}
+		else
+		{
+			// Lst from static library don't change path.
+			sFileName = viFileIter->sLst;
+		}
+		// Open lst file
+		ifstream in( sFileName.c_str() );
+
+		// If file can not be opened, try to open next file
+		if( !in.good() )
+		{
+			viFileIter++;
+			iNumberOfLstFiles--;
+			continue;
+		}
+
+		string sTemp;
+		// Clear temporary lines
+		vTempLines.clear();
+		// Add all lines to temp list
+		do
+		{
+			in.getline( cTemp, MAX_LINE_LENGTH );
+			sTemp.clear();
+			sTemp.append( cTemp );
+			vTempLines.push_back( sTemp );
+		}
+		while( in.good() );
+
+		LINE_IN_FILE structLineInFile;
+		
+		bool bFindENDP = false;
+		vector<string>::iterator viLinesIter = vTempLines.begin();
+
+		// Loop throw all lines in .lst file
+		while( viLinesIter != vTempLines.end() )
+		{
+			// Find ";;;"
+			if( !bFindENDP && strstr(viLinesIter->c_str(), ";;;") != NULL )
+			{
+				bFindENDP = true;
+
+				vector<string>::iterator viLineTempIter = viLinesIter;
+
+				// Find top line of function definition
+				while( viLineTempIter->size() > 0 )
+				{
+					viLineTempIter--;
+				}
+				viLineTempIter++;
+				structLineInFile.sFunction.clear();
+				structLineInFile.sFunction.append( viLineTempIter->c_str() );
+
+				viLinesIter++;
+				// Get Line
+				sTemp.clear();
+				sTemp.append( viLinesIter->c_str() );
+				sTemp.erase(0,3);
+				size_t iSize = sTemp.find_first_of(' ');
+				if( iSize != string::npos )
+					sTemp.resize(iSize);
+				structLineInFile.iLine = atoi( sTemp.c_str() );
+
+				structLineInFile.sFileName.clear();
+				structLineInFile.sFileName.append( viFileIter->sCpp.c_str() );
+				structLineInFile.sLstName = sFileName;
+				m_vLineInFile.push_back( structLineInFile );
+			}
+			else if( strstr(viLinesIter->c_str(), "ENDP") != NULL )
+				bFindENDP = false;
+			viLinesIter++;
+		}
+		viFileIter++;
+		iNumberOfLstFiles--;
+	}
+	if( m_vLineInFile.size() > 0 )
+		return true;
+	return false;
+}
+
+bool CATModule2::ReadMapFileArmv5()
+{
+	LOG_FUNC_ENTRY("CATModule2::ReadMapFileArmv5");
+	// Map file name
+	string sMapFileName	= GetMapFile();
+	// Remove path
+	if ( sMapFileName.find("\\") != string::npos )
+		sMapFileName.erase(0, sMapFileName.find_last_of('\\')+1 );
+	// Add temp path
+	sMapFileName.insert(0, m_sTempPath );
+
+	// Open .map file
+	ifstream in( sMapFileName.c_str() );
+	
+	// File open ok?
+	if( ! in.good() )
+	{
+		in.close();
+		return false;
+	}
+	char cTemp[MAX_LINE_LENGTH];
+	bool bFirstFuncFound = false;
+	// Get all lines where is "Thumb"
+	do
+	{
+		// Load one line from .map file
+		in.getline( cTemp, MAX_LINE_LENGTH );
+		// Find _E32Startup
+		if( !bFirstFuncFound && ( strstr( cTemp, "_E32Startup" ) != NULL) )
+		{
+			bFirstFuncFound = true;
+		}
+		else if( !bFirstFuncFound && ( strstr( cTemp, "_E32Dll" ) != NULL) )
+		{
+			bFirstFuncFound = true;
+		}
+		else if( !bFirstFuncFound )
+			// Skip if _E32Startup not found
+			continue;
+
+		if( strstr( cTemp, "Thumb Code" ) != NULL || strstr( cTemp, "ARM Code" ) != NULL)
+		{
+			MAP_FUNC_INFO structMapFileLineInfo;
+			structMapFileLineInfo.sWholeLine.append( cTemp );
+
+			// Get memory string address from line
+			char* pStart = strstr( cTemp, "0x" );
+			// Check did strstr return null.
+			if( pStart == NULL )
+				continue;
+			char* pTemp = pStart;
+			char TempString[MAX_LINE_LENGTH];
+			TempString[0] = 0;
+			size_t iLength = 0;
+			while( *pTemp != ' ' )
+			{
+				TempString[iLength] = *pTemp;
+				pTemp++;
+				iLength++;
+			}
+			TempString[iLength] = 0;
+
+			structMapFileLineInfo.iAddress = CATDatParser::_httoi( TempString );
+
+			pTemp = cTemp;
+			TempString[0] = 0;
+			
+			// Get function name
+
+			// Skip spaces
+			while( *pTemp == ' ' )
+			{
+				pTemp++;
+			}
+			iLength = 0;
+			// Find end of function name
+			string sTemp( pTemp );
+
+			// Location of character ')'
+			iLength = sTemp.find_first_of(')');
+
+			// Location of character ' '
+			size_t iLength2 = sTemp.find_first_of(' ');
+			
+			// If ')' character is the last char and
+			// character ' ' is closer than ')' use location of ' '
+			if( ( iLength + 1 ) == sTemp.length() && iLength2 < iLength )
+				iLength = iLength2 - 1;
+			
+			if( iLength != string::npos )
+				sTemp.resize( (iLength + 1) );
+
+			structMapFileLineInfo.sFunctionName.append( sTemp.c_str() );
+
+			bool bARM = false;
+			// Find function length
+			pStart = strstr( cTemp, "Thumb Code" );
+			if( pStart == NULL )
+			{
+				pStart = strstr( cTemp, "ARM Code" );
+				bARM = true;
+			}
+			if( pStart != NULL )
+			{
+				if( bARM )
+					pStart += 8;
+				else
+					pStart += 10;
+				while(*pStart == ' ')
+				{
+					pStart++;
+				}
+				sTemp.clear();
+				sTemp.append( pStart );
+				size_t iSize = sTemp.find_first_of(' ');
+				if( iSize != string::npos )
+					sTemp.resize( iSize );
+			}
+
+			structMapFileLineInfo.iFuncLength = atoi( sTemp.c_str() );
+			if( bFirstFuncFound && structMapFileLineInfo.iFuncLength > 0 )
+				// Save to list
+				m_vMapFileFuncList.push_back( structMapFileLineInfo );
+		}
+	}
+	while( in.good() );
+	in.close();
+	return true;
+}
+
+int CATModule2::FindLeakCodeLine( string& sFileName, int iLine, unsigned long iFromFuncAddress ) const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::FindLeakCodeLine");
+	if ( sFileName.empty() )
+		return -1;
+	char cLineFromFile[MAX_LINE_LENGTH];
+	vector<string> vTempLines;
+	string sTemp;
+	char* pTemp = NULL;
+	char* pTempEnd = NULL;
+	int iFoundLine = -1;
+	int iRet = -1;
+	
+	// Open lst file
+	ifstream in( sFileName.c_str() );
+
+	bool bLineFound = false;
+	bool bFirstAddressInFuncFound = false;
+	unsigned long iFirstAddressInFunc = 0;
+	while( in.good() )
+	{
+		in.getline( cLineFromFile, MAX_LINE_LENGTH );
+
+		if( bLineFound )
+		{
+			vTempLines.push_back( cLineFromFile );
+			// Is first character digit
+			if( isdigit( cLineFromFile[0] ) )
+			{
+				if( !bFirstAddressInFuncFound )
+				{
+					bFirstAddressInFuncFound = true;
+					sTemp.clear();
+					sTemp.append( cLineFromFile );
+					// Get value until next space
+					sTemp.resize( sTemp.find_first_of(' ') );
+
+					iFirstAddressInFunc = CATDatParser::_httoi( sTemp.c_str() );
+
+					// Return function start line if margin 0
+					if( iFromFuncAddress == 0 )
+					{
+						iRet = iLine;
+						return iRet;
+					}
+				}
+				else
+				{
+					// Find correct line using iFromFuncAddress variable
+					sTemp.clear();
+					sTemp.append( cLineFromFile );
+					// Get value until next space
+					sTemp.resize( sTemp.find_first_of(' ') );
+
+					unsigned long iValue = CATDatParser::_httoi( sTemp.c_str() );
+
+					if( ( iValue - iFirstAddressInFunc ) >= iFromFuncAddress )
+					{
+						// If there is data in function, code line can not be found
+						if( strstr( cLineFromFile , "DCB" ) != NULL )
+						{
+							iRet = -1;
+							return iRet;
+						}
+						pTemp = strstr( cLineFromFile, ";" );
+						// Get line number
+						bool bStringNumber = true;
+						if( pTemp != NULL )
+						{
+							string sTempLine( pTemp + 1 );
+							// Are all characters numbers?
+							for( unsigned int i = 0 ; i < sTempLine .size() ; i++ )
+							{
+								if( !isdigit(sTempLine[i]) )
+								{
+									bStringNumber = false;
+									break;
+								}
+							}
+						}
+						else
+							bStringNumber = false;
+						if( bStringNumber )
+						{
+							pTemp++;
+							// Get line number
+							iRet = atoi( pTemp );
+						}
+						else
+						{
+							vector<string>::iterator sTempIter = vTempLines.end();
+
+							sTempIter--;
+
+							// Find last code line
+							while( sTempIter != vTempLines.begin() )
+							{
+								if( strstr( sTempIter->c_str() , "DCB" ) != NULL )
+								{
+									iRet = -1;
+									return iRet;
+								}
+								if( strstr( sTempIter->c_str() , ";;;" ) == NULL )
+									sTempIter--;
+								else
+									break;
+							}
+							if(sTempIter == vTempLines.begin() && strstr( sTempIter->c_str() , ";;;" ) == NULL)
+							{
+								iRet = -1;
+								return iRet;
+							}
+							sTempIter->erase( 0, 3 );
+							sTempIter->resize( sTempIter->find(' ') );
+
+							// Leak line
+							iRet = atoi( sTempIter->c_str() );
+						}
+						return iRet;
+					}
+				}
+			}
+		}
+		else // Line in file not found
+		{
+			// Find line of function
+			if( strstr( cLineFromFile, ";;;" ) != NULL )
+			{
+				pTemp = &cLineFromFile[0];
+				// Skip characters ";;;"
+				pTemp += 3;
+				pTempEnd = pTemp;
+				// Find end of line number
+				while( *pTempEnd != ' ' )
+				{
+					pTempEnd++;
+				}
+				*pTempEnd = 0;
+				iFoundLine = atoi( pTemp );
+				*pTempEnd = ' ';
+				if( iLine == iFoundLine )
+				{
+					bLineFound = true;
+				}
+			}
+		}
+	}
+	return iRet;
+}
+
+bool CATModule2::IsMakeSuccessfull()
+{
+	LOG_FUNC_ENTRY("CATModule2::IsMakeSuccessfull");
+	m_sErrors.clear();
+
+	string sSearch;
+	bool bMakeSuccess = true;
+	
+	// Lst files checked only with armv5 platform.
+	if ( IsPlatformArmv5() )
+	{
+		sSearch.append( m_sTempPath );
+		sSearch.append( "*.lst" );
+		if( !SearchFileWithExtension( sSearch.c_str(), false, m_sErrors ) )
+			bMakeSuccess = false;
+		
+		// Map
+		sSearch.clear();
+		sSearch.append( m_sTempPath );
+		sSearch.append( "*.map" );
+		if( !SearchFileWithExtension( sSearch.c_str(), false, m_sErrors ) )
+			bMakeSuccess = false;
+	}
+
+	// .tmp
+	sSearch.clear();
+	sSearch.append( m_sTempPath );
+	sSearch.append( "*.tmp" );
+	if( !SearchFileWithExtension( sSearch.c_str(), false, m_sErrors ) )
+		bMakeSuccess = false;
+
+	return bMakeSuccess;
+}
+
+bool CATModule2::CreateBuildCompleteFile()
+{
+	LOG_FUNC_ENTRY("CATModule2::CreateBuildCompleteFile");
+	// Don't create file if temp path not set cause might be anywhere
+	if ( m_sTempPath.empty() )
+		return false;
+	// Create empty file indicating this module is build
+	string sFile = m_sTempPath;
+	if( sFile.at( sFile.length() - 1 ) != '\\' )
+		sFile.append("\\");
+	sFile.append( "BuildComplete" );
+	ofstream out( sFile.c_str() );
+	out << m_sVariantPlatform << endl;
+	out << m_sVariantType << endl;
+	out.close();
+	return true;
+}
+
+bool CATModule2::ReadMakeFileFromTemp()
+{
+	LOG_FUNC_ENTRY("CATModule2::ReadMakeFileFromTemp");
+	// Set makefile to point to temporary directory.
+	string sMakeFile = m_sTempPath;
+	sMakeFile.append( RemovePathAndExt( m_Mmp.m_sMmpFile, true ) );
+	sMakeFile.append( "." );
+	sMakeFile.append( AT_LEVEL_2_MAKEFILE_EXT );
+	m_sMakeFile = sMakeFile;
+	return ReadMakeFilePrivate();
+}
+
+bool CATModule2::ReadMakeFile()
+{
+	LOG_FUNC_ENTRY("CATModule2::ReadMakeFile");
+	// Read makefile
+	if ( ReadMakeFilePrivate() )
+	{
+		// Copy makefile to temporary directory.
+		string sMakeFile = m_sTempPath;
+		sMakeFile.append( RemovePathAndExt( m_Mmp.m_sMmpFile, true ) );
+		sMakeFile.append( "." );
+		sMakeFile.append( AT_LEVEL_2_MAKEFILE_EXT );
+		FileCopyToPath( m_sMakeFile, sMakeFile );
+		return true;
+	}
+	return false;
+}
+
+bool CATModule2::ReadMakeFilePrivate()
+{
+	LOG_FUNC_ENTRY("CATModule2::ReadMakeFilePrivate");
+
+	if ( m_sMakeFile.empty() )
+		return false;
+
+	LOG_STRING( "using makefile :" << m_sMakeFile );
+
+	// Stream object to read files
+	ifstream in;
+	// Char array to read line from file
+	char cLine[MAX_LINE_LENGTH];
+	// String to use as buffer from file
+	string sLine;
+	// Open file
+	in.open( m_sMakeFile.c_str(), ios_base::in );
+	// Check that its open
+	if ( ! in.good() )
+	{
+		// Cannot open file
+		cout << AT_MSG << "Error, can not open file: " << m_sMakeFile << endl;
+		return false;
+	}
+	// Check is it wrapper makefile (starts with "%:")
+	in.getline( cLine, MAX_LINE_LENGTH );
+	if ( cLine[0] == '%' && cLine[1] == ':' )
+	{
+		LOG_STRING("Found wrapper makefile");
+		in.close();
+		// Use ".default" makefile
+		string sDefaultMakeFile = m_sMakeFile.substr( 0, m_sMakeFile.find_last_of( "." ) );
+		sDefaultMakeFile.append( ".DEFAULT" );
+		LOG_STRING( "using makefile :" << m_sMakeFile );
+		// Does default exists. If not we need to run "wrapper make"
+		if ( ! FileExists( sDefaultMakeFile.c_str() ) )
+		{
+			// Run the wrapper make to create "real" makefile
+			string sMakeFileCmd;
+			sMakeFileCmd.append("make -f \"");
+			sMakeFileCmd.append( m_sMakeFile );
+			sMakeFileCmd.append( "\"" );
+			LOG_STRING( "using makefile :" << m_sMakeFile );
+			cout << AT_MSG_SYSTEM_CALL << sMakeFileCmd << endl;
+			int iRet = (int)system( sMakeFileCmd.c_str() );
+			if ( iRet )
+			{
+				cout << MAKE_ERROR;
+				return false;
+			}
+		}
+		m_sMakeFile = sDefaultMakeFile;
+		// Open new file
+		in.open( m_sMakeFile.c_str(), ios_base::in );
+		// Check that it's open
+		if ( ! in.good() )
+		{
+			// Cannot open file
+			cout << AT_MSG << "Error, can not open makefile: " << m_sMakeFile << endl;
+			return false;
+		}
+	}
+	in.seekg( ios_base::beg );
+
+	// Number of lines to read at max for basic module information.
+	int iReadLineCount = 20;
+	// Extension from target line. to be compared with targettype.
+	string sTargetExtension;
+	// Read line at a time. Loop until we find it or eof
+	do {
+		// Read line from file to array
+		in.getline( cLine, MAX_LINE_LENGTH );
+		iReadLineCount--;
+
+		sLine.clear();
+		// Put that to string
+		sLine.append( cLine );
+		// Search target
+		if ( sLine.find( MAKEFILE_TARGET_STRING ) != string::npos )
+		{
+			// Found it. Now remove other than type from line
+			sLine.erase( 0, strlen( MAKEFILE_TARGET_STRING ) );
+			ChangeToLower( sLine );
+			sTargetExtension.clear();
+			sTargetExtension = GetExtension( sLine );
+			m_sTarget = RemovePathAndExt( sLine, true);
+			LOG_STRING("found target: " << sLine );
+		}
+		// Search targettype
+		else if ( sLine.find( MAKEFILE_TARGETTYPE_STRING ) != string::npos )
+		{
+			// Found it. Now remove other than type from line
+			sLine.erase( 0, strlen( MAKEFILE_TARGETTYPE_STRING ) );
+			ChangeToLower( sLine );
+			m_sTargetType = sLine;
+			LOG_STRING("found target type: " << m_sTargetType );
+		}
+		else if ( sLine.find( MAKEFILE_BASIC_TARGETTYPE_STRING ) != string::npos )
+		{
+			sLine.erase( 0, strlen( MAKEFILE_BASIC_TARGETTYPE_STRING ) );
+			ChangeToLower( sLine );
+			m_sRequestedTargetExt = sLine;
+			// Compare with the extension in target line if not same use target lines if its "valid".
+			if ( m_sRequestedTargetExt.compare( sTargetExtension ) != 0  && sTargetExtension.size() > 0 )
+				m_sRequestedTargetExt = sTargetExtension;
+			LOG_STRING("found requested target extension: " << m_sTargetType );		
+		}
+		// Feature variant details
+		else if ( sLine.find( MAKEFILE_FEATURE_VARIANT_NAME ) != string::npos )
+		{
+			sLine.erase( 0, strlen( MAKEFILE_FEATURE_VARIANT_NAME ) );
+			m_sFeatureVariantName = sLine;
+			LOG_STRING("found feature variant name: " << sLine );
+		}
+		else if ( sLine.find( MAKEFILE_FEATURE_VARIANT_UREL_LABEL ) != string::npos )
+		{
+			sLine.erase( 0, strlen( MAKEFILE_FEATURE_VARIANT_UREL_LABEL ) );
+			LOG_STRING("found feature variant urel label: " << sLine );
+			if ( sLine.compare("INVARIANT") != 0 )
+				m_sFeatureVariantURELLabel = sLine;
+		}
+		else if ( sLine.find( MAKEFILE_FEATURE_VARIANT_UDEB_LABEL ) != string::npos )
+		{
+			sLine.erase( 0, strlen( MAKEFILE_FEATURE_VARIANT_UDEB_LABEL ) );
+			LOG_STRING("found feature variant udeb label: " << sLine );
+			if ( sLine.compare("INVARIANT") != 0 )
+				m_sFeatureVariantUDEBLabel = sLine;
+		}
+	} while( in.good() && iReadLineCount > 0 );
+
+	// Search compile definitions
+	// CWDEFS CCDEFS ARMCCDEFS
+	do
+	{
+		in.getline( cLine, MAX_LINE_LENGTH );
+		sLine.clear();
+		sLine.append( cLine );
+		if ( sLine.substr( 0 , 6 ).compare( string("CWDEFS") ) == 0 
+			|| sLine.substr( 0 , 6 ).compare( string("CCDEFS") ) == 0 )
+		{
+			sLine.erase( 0, 8 );
+			m_sCompileDefinitions = sLine;
+			break;
+		}
+		else if( sLine.substr( 0 , 9 ).compare( string("ARMCCDEFS") ) == 0  )
+		{
+			sLine.erase( 0, 11 );
+			m_sCompileDefinitions = sLine;
+			break;
+		}
+	} while( in.good() );
+	// Move reading back to start if we could not find compile flags.
+	in.seekg( ios_base::beg );
+
+	// Search listing information (modules source files).
+	int iFindItem = 1; //1 = Source, 2 = LISTINGUDEB/UREL, 3 = lst file
+	string sCdefs;
+	string sSource;
+	string sLst;
+	do
+	{
+		in.getline( cLine, MAX_LINE_LENGTH );
+		sLine.clear();
+		sLine.append( cLine );
+
+		switch( iFindItem )
+		{
+			case 1:
+				if( sLine.find( "# Source " ) != string::npos )
+				{
+					iFindItem = 2;
+					// Remove text "# Source "
+					sLine.erase( 0, 9 );
+					sSource = sLine;
+				}
+			break;
+			case 2:
+				if( IsUDEB() )
+				{
+					if( sLine.find( "LISTINGUDEB" ) != string::npos )
+					{
+						iFindItem = 3;
+					}
+				}
+				else
+				{
+					if( sLine.find( "LISTINGUREL" ) != string::npos )
+					{
+						iFindItem = 3;
+					}
+				}
+			break;
+			case 3:
+				if( sLine.find( "perl -S ecopyfile.pl" ) != string::npos )
+				{
+					// Save lst file to list
+					sLine.erase( 0, ( sLine.find_first_of( "\\" ) ) );
+					// remove last char if '"'
+					if ( sLine.at( sLine.size()-1 ) == '"' )
+						sLine.erase( sLine.size()-1, sLine.size() );
+					sLst = sLine;
+					AddSource( sSource, sLst );
+					iFindItem = 1;
+					sSource.clear(); sLst.clear();
+					
+				}
+			break;
+		}
+	}
+	while( in.good() );
+	// close and return
+	in.close();
+	return true;
+}
+
+// ----------------------------------------------------------------------------
+// Get & Sets
+// ----------------------------------------------------------------------------
+string CATModule2::GetErrors() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetErrors");
+	return m_sErrors;
+}
+
+string CATModule2::GetS60FileName() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetS60FileName");
+	return m_sS60FileName;
+}
+
+void CATModule2::SetS60FileName( const string& aFileName  )
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::SetS60FileName");
+
+	m_sS60FileName = aFileName;
+
+	//check new m_sS60FileName and change it if needed
+	string sProcessName = "";
+	sProcessName.append( m_sTarget );
+	sProcessName.append(".");
+	sProcessName.append( m_sTargetType );
+		
+	if ( m_sS60FileName.empty() )
+	{
+		m_sS60FileName = sProcessName;
+		m_sS60FileName.append(".dat");
+	}
+	else
+	{
+		// if data file name contains %processname% string, replace it with process name
+		string sProcessnameTemp = "[";
+		sProcessnameTemp.append( sProcessName );
+		sProcessnameTemp.append( "]" );
+		size_t iSpot;
+
+		//create temp name in lowercase
+		string sS60FileNameLower = m_sS60FileName;
+		ChangeToLower( sS60FileNameLower );
+
+		// find %processname% string in lowercase name, replace it with process name in in m_sS60FileName
+		// replace it also in temp string (matching indexes)
+		while( ( iSpot = sS60FileNameLower.find( AT_PROCESSNAME_TAG ) ) != string::npos )
+		{
+			m_sS60FileName.replace( iSpot, AT_PROCESSNAME_TAG.length(), sProcessnameTemp );
+			sS60FileNameLower.replace( iSpot, AT_PROCESSNAME_TAG.length(), sProcessnameTemp );
+		}
+    }
+}
+
+string CATModule2::GetLstNameOfSource(string sSource) const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetLstNameOfSource");
+	// Find . before xtension
+	size_t iSpot = sSource.find_last_of( "." );
+	// Get sub string to there
+	string sLst = sSource.substr(0, iSpot+1);
+	if ( m_sVariantPlatform.compare( "winscw" ) != 0 )
+	{
+		// Add variant platform (i.e. armv5)
+		sLst.append( m_sVariantPlatform );
+		sLst.append( "." );
+		// Add variant type (i.e. build type liek urel)
+		sLst.append( m_sVariantType );
+		sLst.append( "." );
+		// Add target binary name
+		sLst.append( m_sTarget );
+		sLst.append( "." );
+		// Add target requested binary extension
+		sLst.append( m_sRequestedTargetExt );
+		sLst.append( "." );
+		// Add lst extension
+		sLst.append( "lst" );
+	}
+	else
+	{
+		sLst.append( "WINSCW.lst" );
+	}
+	return sLst;
+}
+
+bool CATModule2::IsPlatformArmv5() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::IsPlatformArmv5");
+	if ( _stricmp( m_sVariantPlatform.c_str(), "armv5" ) == 0 )
+		return true;
+	return false;
+}
+
+string CATModule2::GetMapFile() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetMapFile");
+	// Map file with path using variables
+	string sMapFile( m_sReleasePath );
+	if ( ! sMapFile.empty() )
+		sMapFile.append( "\\" );
+	sMapFile.append( m_sFullVariantPath );
+	if ( ! m_sFullVariantPath.empty() )
+		sMapFile.append( "\\" );
+	sMapFile.append( m_sTarget );
+	sMapFile.append( "." );
+	// Possible feature variant. Note debug might not be defined
+	// when release has got one.
+	if ( IsUDEB() && !m_sFeatureVariantUDEBLabel.empty() )
+	{
+		sMapFile.append( m_sFeatureVariantUDEBLabel );
+		sMapFile.append( "." );
+	}
+
+	if ( !IsUDEB() && !m_sFeatureVariantURELLabel.empty() )
+	{
+		sMapFile.append( m_sFeatureVariantURELLabel );
+		sMapFile.append( "." );
+	}
+	sMapFile.append( m_sRequestedTargetExt );
+	sMapFile.append( ".map" );
+	return sMapFile;
+}
+
+string CATModule2::GetSymbolFile() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetSymbolFile");
+	// Symbol file with path using variables
+	string sSymbolFile( m_sReleasePath );
+	sSymbolFile.append( "\\" );
+	sSymbolFile.append( m_sFullVariantPath );
+	sSymbolFile.append( "\\" );
+	sSymbolFile.append( m_sTarget );
+	sSymbolFile.append( "." );
+	// Possible feature variant.
+	if ( ! m_sFeatureVariantUDEBLabel.empty() || ! m_sFeatureVariantURELLabel.empty() )
+	{
+		if ( IsUDEB() )
+			sSymbolFile.append( m_sFeatureVariantUDEBLabel );
+		else
+			sSymbolFile.append( m_sFeatureVariantURELLabel );
+		sSymbolFile.append( "." );
+	}
+	
+	if ( m_eBuildSystem == CATProject::SBS_V1 )
+	{
+		sSymbolFile.append( "sym" );
+		return sSymbolFile;
+	}
+	sSymbolFile.append( m_sRequestedTargetExt );
+	sSymbolFile.append( ".sym" );
+	return sSymbolFile;
+}
+
+string CATModule2::GetBinaryFile() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetBinaryFile");
+	// Binary file with path using variables
+	string sBinaryFile( m_sReleasePath );
+	if ( ! sBinaryFile.empty() )
+		sBinaryFile.append( "\\" );
+	sBinaryFile.append( m_sFullVariantPath );
+	if ( ! m_sFullVariantPath.empty() )
+		sBinaryFile.append( "\\" );
+	sBinaryFile.append( m_sTarget );
+	sBinaryFile.append( "." );
+	// Possible feature variant.
+	if ( ! m_sFeatureVariantUDEBLabel.empty() || ! m_sFeatureVariantURELLabel.empty() )
+	{
+		if ( IsUDEB() )
+			sBinaryFile.append( m_sFeatureVariantUDEBLabel );
+		else
+			sBinaryFile.append( m_sFeatureVariantURELLabel );
+		sBinaryFile.append( "." );
+	}
+	sBinaryFile.append( m_sRequestedTargetExt );
+	return sBinaryFile;
+}
+
+bool CATModule2::SetMmpFile(const string& sMmpFile)
+{
+	LOG_FUNC_ENTRY("CATModule2::SetMmpFile");
+	// Set mmp file
+	m_Mmp.m_sMmpFile = sMmpFile;
+	// Change to lower
+	ChangeToLower( m_Mmp.m_sMmpFile );
+	// Convert
+	ConvertUnixPathToWin( m_Mmp.m_sMmpFile );
+	// Set the temporary path.
+	m_sTempPath.clear();
+	m_sTempPath = CreateTempPath( m_Mmp.m_sMmpFile );
+	return true;
+}
+
+bool CATModule2::CreateTemporaryDirectory()
+{
+	LOG_FUNC_ENTRY("CATModule2::CreateTemporaryDirectory");
+	if ( m_sTempPath.empty() )
+	{
+		LOG_STRING("Temporary path is not set.");
+		return false;
+	}
+	// Create temp dir if not exists
+	if ( ! DirectoryExists( m_sTempPath.c_str() ) )
+	{
+		if ( !CreateDirectory( m_sTempPath.c_str(), NULL ) )
+		{
+			cout << AT_MSG << "Error, can not create directory: "
+				<< m_sTempPath << endl;
+			return false;
+		}
+		cout << AT_MSG << "Directory created: " << m_sTempPath << endl;
+	}
+	return true;
+}
+
+void CATModule2::SetMakeFile( const string& sMakeFile )
+{
+	LOG_FUNC_ENTRY("CATModule2::SetMakeFile");
+	m_sMakeFile = sMakeFile;
+}
+string CATModule2::GetMakeFile() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetMakeFile");
+	return m_sMakeFile;
+}
+string CATModule2::GetMmpFile() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetMmpFile");
+	return m_Mmp.m_sMmpFile;
+}
+string CATModule2::GetTempPath() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetTempPath");
+	return m_sTempPath;
+}
+void CATModule2::SetTarget(const string& sTarget)
+{
+	LOG_FUNC_ENTRY("CATModule2::SetTarget");
+	m_sTarget = sTarget;
+	ChangeToLower( m_sTarget );
+}
+string CATModule2::GetTarget() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetTarget");
+	return m_sTarget;
+}
+string CATModule2::GetBinaryName() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetBinaryName");
+	string sBinaryName;
+	sBinaryName.append( m_sTarget );
+	sBinaryName.append( "." );
+	sBinaryName.append( m_sRequestedTargetExt );
+	return sBinaryName;
+}
+
+void CATModule2::SetTargetType(const string& sTargetType)
+{
+	LOG_FUNC_ENTRY("CATModule2::SetTargetType");
+	m_sTargetType = sTargetType;
+	ChangeToLower( m_sTargetType );
+}
+string CATModule2::GetTargetType() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetTargetType");
+	return m_sTargetType;
+}
+void CATModule2::SetRequestedTargetExt( const string& sRequestedTargetExt )
+{
+	LOG_FUNC_ENTRY("CATModule2::SetRequestedTargetExt");
+	m_sRequestedTargetExt = sRequestedTargetExt;
+	ChangeToLower( m_sRequestedTargetExt );
+}
+
+string CATModule2::GetRequestedTargetExt() const
+{
+	LOG_LOW_FUNC_ENTRY("CATmodule2::GetRequestedTargetExt");
+	return m_sRequestedTargetExt;
+}
+
+void CATModule2::SetVariantPlatform(const string& sVariantPlatform)
+{
+	LOG_FUNC_ENTRY("CATModule2::SetVariantPlatform");
+	m_sVariantPlatform = sVariantPlatform;
+	ChangeToLower( m_sVariantPlatform );
+}
+string CATModule2::GetVariantPlatform() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetVariantPlatform");
+	return m_sVariantPlatform;
+}
+void CATModule2::SetVariantType(const string& sVariantType)
+{
+	LOG_FUNC_ENTRY("CATModule2::SetVariantType");
+	m_sVariantType = sVariantType;
+	ChangeToLower( m_sVariantType );
+}
+string CATModule2::GetVariantType() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetVariantType");
+	return m_sVariantType;
+}
+void CATModule2::SetFeatureVariant(const string& sFeatureVariant)
+{
+	LOG_FUNC_ENTRY("CATModule2::SetFeatureVariant");
+	m_sFeatureVariant = sFeatureVariant;
+	ChangeToLower( m_sFeatureVariant );
+}
+string CATModule2::GetFeatureVariant() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetFeatureVariant");
+	return m_sFeatureVariant;
+}
+void CATModule2::SetFeatureVariantName(const string& sFeatureVariantName)
+{
+	LOG_FUNC_ENTRY("CATModule2::SetFeatureVariantName");
+	m_sFeatureVariantName = sFeatureVariantName;
+	ChangeToLower( m_sFeatureVariantName );
+}
+string CATModule2::GetFeatureVariantName() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetFeatureVariantName");
+	return m_sFeatureVariantName;
+}
+void CATModule2::SetReleasePath(const string& sReleasePath)
+{
+	LOG_FUNC_ENTRY("CATModule2::SetReleasePath");
+	m_sReleasePath = sReleasePath;
+	ChangeToLower( m_sReleasePath );
+	ConvertUnixPathToWin( m_sReleasePath );
+
+}
+string CATModule2::GetReleasePath() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetReleasePath");
+	return m_sReleasePath;
+}
+void CATModule2::SetFullVariantPath(const string& sFullVariantPath)
+{
+	LOG_FUNC_ENTRY("CATModule2::SetFullVariantPath");
+	m_sFullVariantPath = sFullVariantPath;
+	ChangeToLower( m_sFullVariantPath );
+	ConvertUnixPathToWin( m_sFullVariantPath );
+}
+string CATModule2::GetFullVariantPath() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetFullVariantPath");
+	return m_sFullVariantPath;
+}
+string CATModule2::GetUniqueId() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetUniqueId");
+	return FilterString( m_sTarget );
+}
+void CATModule2::SetBuildSystem( int eBuildSystem )
+{
+	LOG_FUNC_ENTRY("CATModule2::SetBuildSystem");
+	m_eBuildSystem = eBuildSystem;
+}
+
+int CATModule2::GetBuildSystem() const
+{
+	LOG_LOW_FUNC_ENTRY("CATModule2::GetBuildSystem");
+	return m_eBuildSystem;
+}
+
+void CATModule2::SetCompileDefinitions( const string& sCompileDefinitions )
+{
+	LOG_LOW_FUNC_ENTRY( "CATModule2::SetCompileDefinitions" );
+	m_sCompileDefinitions = sCompileDefinitions;
+}
+
+string CATModule2::GetCompileDefinitions() const
+{
+	LOG_LOW_FUNC_ENTRY( "CATModule2::GetCompileDefinitions" );
+	return m_sCompileDefinitions;
+}
+
+void CATModule2::SetCompileInfoText( string sCompileInfoText )
+{
+	LOG_LOW_FUNC_ENTRY( "CATModule2::SetCompileInfoText" );
+	m_sCompileInfoText = sCompileInfoText;
+}
+string CATModule2::GetCompileInfoText() const
+{
+	LOG_LOW_FUNC_ENTRY( "CATModule2::GetCompileInfoText" );
+	return m_sCompileInfoText;
+}
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/CATParseBinaryFile.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,734 @@
+/*
+* 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:  Definitions for the class CATParseTraceFile.
+*
+*/
+
+
+#include "../inc/ATCommonDefines.h"
+#include "../inc/CATParseBinaryFile.h"
+#include "../inc/catdatasaver.h"
+#include "../inc/CATDatParser.h"
+#include "../inc/CATProcessData.h"
+
+#include <time.h>
+
+
+
+// -----------------------------------------------------------------------------
+// CATParseBinaryFile::CATParseTraceFile
+// Constructor.
+// -----------------------------------------------------------------------------
+CATParseBinaryFile::CATParseBinaryFile()
+{
+	LOG_FUNC_ENTRY("CATParseTraceFile::CATParseTraceFile");
+	m_DataSaver.SetPrintFlag( false );
+}
+
+// -----------------------------------------------------------------------------
+// CATParseBinaryFile::StartParse
+// Main function to start trace parsing.
+// -----------------------------------------------------------------------------
+bool CATParseBinaryFile::StartParse( const char* pFileName, const char* pOutputFileName )
+{
+	LOG_FUNC_ENTRY("CATParseTraceFile::StartParse");
+
+	// Return value, will be changed to true if process start found.
+	bool bRet = false;
+
+	// Check pointers
+	if ( pFileName == NULL  )
+		return bRet;
+
+
+	if ( ! FileExists( pFileName ) )
+	{
+		cout << AT_MSG << "Error, input file \""
+			<< pFileName
+			<< "\" does not exist." << endl;
+		return bRet;
+	}
+
+	// Open input and output file
+	ifstream in( pFileName, ios::binary );
+	ofstream sDataToParse( pOutputFileName );
+
+	// Check file opened ok
+	if ( !in.good() )
+		return false;
+
+	// Get stream size
+	size_t streamPos = in.tellg();
+	in.seekg( 0, ios::end);
+	size_t streamEnd = in.tellg();
+	in.seekg( 0, ios::beg );
+
+	//Origianl characters (not filtered).
+
+	unsigned char cDataFromFile[MAX_LINE_LENGTH];
+
+	bool bProcessEndReached = false;
+	bool bError = false;
+
+	char messageType = 0;
+	unsigned __int64 messageTime = 0;
+
+	unsigned long iProcessId(0);
+	int iAddressCount(0);
+	string sTemp;
+
+	//first parse version info
+	GetString( cDataFromFile, in, streamPos, streamEnd );
+	//todo check if version is correct	
+
+	while( !bError && !bProcessEndReached )
+	{
+		// get time
+		if( !GetNum64( cDataFromFile, in, streamPos, streamEnd ) )
+		{
+			bError = true;
+			break;
+		}
+		messageTime = StringToNum64( cDataFromFile );
+
+		// get message type
+		if( !GetNum8( cDataFromFile, in, streamPos, streamEnd ) )
+		{
+			bError = true;
+			break;
+		}
+		messageType = (int)cDataFromFile[0];
+
+		switch (messageType)
+		{
+			case EProcessStart:
+				{
+				//temp string to store data until we get to processID
+				sTemp.clear();
+
+                //PCS MemoryLeaker.exe[edf5a8b2]0001 17b 48939b0f5c04f 1 3 1.10.0 1.7.5
+				sTemp.append( LABEL_PROCESS_START );
+				sTemp.append( " " );
+
+				// get process name
+				if( !GetString( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+
+				sTemp.append( (char *)cDataFromFile );
+				sTemp.append( " " );
+
+				//get process id
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+			    {
+					bError = true;
+					break;
+				}
+				iProcessId = StringToNum32(cDataFromFile);
+
+				// write stored data
+				sDataToParse << std::hex << messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+				sDataToParse << std::hex << iProcessId;
+				sDataToParse << " ";
+				sDataToParse << sTemp;
+				sDataToParse <<  std::hex << iProcessId;
+				sDataToParse << " ";
+
+				//write time
+				sDataToParse <<  std::hex << messageTime;
+				sDataToParse << " ";
+
+				//get udeb/urel
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::dec << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				//add trace version - TODO check
+				sDataToParse <<  std::dec << 3;
+				sDataToParse << " ";
+
+				// get atool version
+				if( !GetString( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse << (char *)cDataFromFile;
+				sDataToParse << " ";
+
+				// get api version
+				if( !GetString( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse << (char *)cDataFromFile;
+				sDataToParse << "\n";
+
+				//process start found
+				bRet = true;
+
+				}
+				break;
+
+			case EProcessEnd:
+				{
+				sDataToParse << messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+				sDataToParse << iProcessId;
+				sDataToParse << " ";
+				//PCE
+				sDataToParse << LABEL_PROCESS_END ;
+				sDataToParse << "\n";
+				bProcessEndReached = true;
+				}
+				break;
+
+			case EDllLoad:
+				{
+				sDataToParse << std::hex << messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+				sDataToParse << iProcessId;
+				sDataToParse << " ";
+				//DLL AToolMemoryLeakerDll3.dll 3ff80000 3ff92000
+				sDataToParse << LABEL_DLL_LOAD ;
+				sDataToParse << " ";
+
+				// get dll name
+				if( !GetString( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse << (char *)cDataFromFile;
+				sDataToParse << " ";
+
+				// get start address
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get end address
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << "\n";
+				}
+				break;
+			
+			case EDllUnload:
+				{
+				sDataToParse << messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+				sDataToParse << iProcessId;
+				sDataToParse << " ";
+				//DLU AToolMemoryLeakerDll3.dll 3ff80000 3ff92000
+				sDataToParse << LABEL_DLL_UNLOAD ;
+				sDataToParse << " ";
+
+				// get dll name
+				if( !GetString( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse << (char *)cDataFromFile;
+				sDataToParse << " ";
+
+				// get start address
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get end address
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << "\n";
+				}
+				break;
+
+			case EAllocH:
+				{
+				sDataToParse << messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+				sDataToParse << iProcessId;
+				sDataToParse << " ";
+				//ALH 5a7a6734 5c 17c 11 6003ded4 60010df2 40001bff 40001c39 ...
+				// no fragments in log file
+				sDataToParse << ALLOCH_ID ;
+				sDataToParse << " ";
+
+				// get mam address
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get size of allocation
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get thread id
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get address count
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				int iAddressCount = StringToNum32(cDataFromFile);
+				sDataToParse <<  std::hex << iAddressCount;
+
+				// get callstack
+				for(int i=0; i<iAddressCount; i++)
+				{
+					sDataToParse << " ";
+					if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+					{
+						bError = true;
+						break;
+					}
+				    sDataToParse <<  std::hex << StringToNum32(cDataFromFile); 
+				}
+				sDataToParse << "\n";
+				}
+				break;
+
+			case EFreeH:
+				{
+				sDataToParse << std::hex <<messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+				sDataToParse << iProcessId;
+				sDataToParse << " ";
+				//FRH 5a7a679c 17c 0 (6003ded4 60010df2 40001bff 40001c39 ...)
+				// no fragments in log file
+				sDataToParse << FREEH_ID ;
+				sDataToParse << " ";
+
+				// get mem address
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get thread id
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get address count
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				iAddressCount = StringToNum32(cDataFromFile);
+				sDataToParse <<  std::hex << iAddressCount;
+
+				// get callstack
+				for(int i=0; i<iAddressCount; i++)
+				{
+					sDataToParse << " ";
+					if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+					{
+						bError = true;
+						break;
+					}
+				    sDataToParse <<  std::hex << StringToNum32(cDataFromFile); 
+				}
+				sDataToParse << "\n";
+
+				break;
+
+			case EReallocH:
+				sDataToParse << std::hex << messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+				sDataToParse << iProcessId;
+				sDataToParse << " ";
+				// RAH 0 5a7a6f30 30 17c 17 6003e02b 60010ef8 600083e5 ...
+				// no fragments in log file
+				sDataToParse << REALLOCH_ID ;
+				sDataToParse << " ";
+
+				// get freed mem address
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get allocated mem address
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get size of allocation
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get thread id
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << " ";
+
+				// get address count
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				iAddressCount = StringToNum32(cDataFromFile);
+				sDataToParse <<  std::hex << iAddressCount;
+
+				// get callstack
+				for(int i=0; i<iAddressCount; i++)
+				{
+					sDataToParse << " ";
+					if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+					{
+						bError = true;
+						break;
+					}
+				    sDataToParse <<  std::hex << StringToNum32(cDataFromFile); 
+				}
+				sDataToParse << "\n";
+				}
+				break;
+
+			case EHandleLeak:
+				{
+				sDataToParse << std::hex << messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+				sDataToParse << iProcessId;
+				sDataToParse << " ";
+				//HDL handleLeakCount
+				sDataToParse << LABEL_HANDLE_LEAK ;
+				sDataToParse << " ";
+
+				//get handle leak count
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << "\n";
+				}
+				break;
+
+			case EThreadStart:
+				{
+				sDataToParse << std::hex << messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+				sDataToParse << iProcessId;
+				sDataToParse << " ";
+				// TDS 17c
+				sDataToParse << LABEL_THREAD_START;
+				sDataToParse << " ";
+
+				// get thread ID
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << "\n";
+				}
+				break;
+
+			case EThreadEnd:
+				{
+				sDataToParse << std::hex << messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+				sDataToParse << iProcessId;
+				sDataToParse << " ";
+				// TDE 17c
+				sDataToParse << LABEL_THREAD_END;
+				sDataToParse << " ";
+
+				// get thread ID
+				if( !GetNum32( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				sDataToParse <<  std::hex << StringToNum32(cDataFromFile);
+				sDataToParse << "\n";
+				}
+				break;
+
+			case EDeviceInfo:
+				{
+				// DEVINFO swVersion  romChecksum //both are descriptors
+				sDataToParse << std::hex << messageTime;
+				sDataToParse << " ";
+				sDataToParse << MAIN_ID;
+				sDataToParse << " ";
+
+				sDataToParse << LABEL_DEVICE_INFO;
+				sDataToParse << " ";
+
+				// get swVersion
+				if( !GetString( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}			
+				sDataToParse << (char *)cDataFromFile;
+				sDataToParse << " ";
+
+				// todo check
+				// get romChecksum
+				if( !GetString( cDataFromFile, in, streamPos, streamEnd ) )
+				{
+					bError = true;
+					break;
+				}
+				
+				sDataToParse << (char *)cDataFromFile;
+				sDataToParse << "\n";
+				}
+				break;
+
+			case EError:
+				//currently not used
+				break;
+			case ETestStart:
+			case ETestEnd:
+				// currently can not occure in bin log file, this is added from carbide in traces
+				break;
+			default:
+				bError = true;
+				break;				
+		}
+	}
+
+	// Close file.
+	in.close();
+
+	sDataToParse.close();
+	return !bError;
+}
+
+// -----------------------------------------------------------------------------
+// CATParseBinaryFile::GetDataSaver
+// Gets data saver object.
+// -----------------------------------------------------------------------------
+CATDataSaver* CATParseBinaryFile::GetDataSaver(void)	
+{
+	LOG_LOW_FUNC_ENTRY("CATParseTraceFile::GetDataSaver");
+	return &m_DataSaver;
+}
+
+// -----------------------------------------------------------------------------
+// CATParseBinaryFile::StringToNum64
+// Gets 64bit number from input string
+// -----------------------------------------------------------------------------
+unsigned __int64 CATParseBinaryFile::StringToNum64( unsigned char* cVal )
+{
+	unsigned __int64 iRetVal(0);
+
+	for(int i=7; i>=0; i--)
+		iRetVal = ( iRetVal << 8 ) + cVal[i];
+
+	return iRetVal;
+}
+
+// -----------------------------------------------------------------------------
+// CATParseBinaryFile::StringToNum32
+// Gets 32bit number from input string
+// -----------------------------------------------------------------------------
+unsigned long CATParseBinaryFile::StringToNum32( unsigned char* cVal )
+{
+	unsigned long iRetVal(0);
+
+	for(int i=4; i>=0; i--)
+		iRetVal = ( iRetVal << 8 ) + cVal[i];
+
+	return iRetVal;
+}
+
+// -----------------------------------------------------------------------------
+// CATParseBinaryFile::GetString
+// Get next string from file
+// -----------------------------------------------------------------------------
+bool CATParseBinaryFile::GetString( unsigned char* pData, ifstream &pIn, size_t &pStreamPos, size_t pStreamEnd )
+{
+	int	numOfRead = 1;
+	if(pStreamPos + numOfRead <= pStreamEnd)
+	{
+		pIn.read((char*)pData, numOfRead);
+		pStreamPos = pIn.tellg();
+	}
+	else
+	{
+		return false;
+	}
+
+	numOfRead = (int)pData[0] >> 2;
+	if(pStreamPos + numOfRead <= pStreamEnd)
+	{
+		pIn.read((char*)pData, numOfRead);
+		pStreamPos = pIn.tellg();
+		pData[numOfRead] = 0;
+	}
+	else
+	{
+		return false;
+	}
+
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATParseBinaryFile::GetNum8
+// Get next 8bit number from file
+// -----------------------------------------------------------------------------
+bool CATParseBinaryFile::GetNum8( unsigned char* pData, ifstream &pIn, size_t &pStreamPos, size_t pStreamEnd )
+{
+	int	numOfRead = 1;
+	if(pStreamPos + numOfRead <= pStreamEnd)
+	{
+		pIn.read((char*)pData, numOfRead);
+		pStreamPos = pIn.tellg();
+	}
+	else
+	{
+		return false;
+	}
+
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATParseBinaryFile::GetNum32
+// Get next 32bit number from file
+// -----------------------------------------------------------------------------
+bool CATParseBinaryFile::GetNum32( unsigned char* pData, ifstream &pIn, size_t &pStreamPos, size_t pStreamEnd )
+{
+	int	numOfRead = 4;
+	if(pStreamPos + numOfRead <= pStreamEnd)
+	{
+		pIn.read((char*)pData, numOfRead);
+		pStreamPos = pIn.tellg();
+	}
+	else
+	{
+		return false;
+	}
+
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATParseBinaryFile::GetNum64
+// Get next 64bit number from file
+// -----------------------------------------------------------------------------
+bool CATParseBinaryFile::GetNum64( unsigned char* pData, ifstream &pIn, size_t &pStreamPos, size_t pStreamEnd )
+{
+	int	numOfRead = 8;
+	if(pStreamPos + numOfRead <= pStreamEnd)
+	{
+		pIn.read((char*)pData, numOfRead);
+		pStreamPos = pIn.tellg();
+	}
+	else
+	{
+		return false;
+	}
+
+	return true;
+}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/CATParseTraceFile.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,973 @@
+/*
+* 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:  Definitions for the class CATParseTraceFile.
+*
+*/
+
+
+#include "../inc/ATCommonDefines.h"
+#include "../inc/CATParseTraceFile.h"
+#include "../inc/catdatasaver.h"
+#include "../inc/CATDatParser.h"
+#include "../inc/CATProcessData.h"
+
+#include <time.h>
+
+
+
+// -----------------------------------------------------------------------------
+// CATParseTraceFile::CATParseTraceFile
+// Constructor.
+// -----------------------------------------------------------------------------
+CATParseTraceFile::CATParseTraceFile()
+{
+	LOG_FUNC_ENTRY("CATParseTraceFile::CATParseTraceFile");
+	m_DataSaver.SetPrintFlag( false );
+}
+
+// -----------------------------------------------------------------------------
+// CATParseTraceFile::StartParse
+// Main function to start trace parsing.
+// -----------------------------------------------------------------------------
+bool CATParseTraceFile::StartParse( const char* pFileName, const char* pOutputFileName, const char* pCleanedTraceFile )
+{
+	LOG_FUNC_ENTRY("CATParseTraceFile::StartParse");
+
+	// Return value, will be changed to true if process start found.
+	bool bRet = false;
+	bool bCreateCleanedTraces = false;
+
+	// Check pointers
+	if ( pFileName == NULL  )
+		return bRet;
+
+	if( pOutputFileName == NULL )
+		return bRet;
+
+	if ( ! FileExists( pFileName ) )
+	{
+		cout << AT_MSG << "Error, input file \""
+			<< pFileName
+			<< "\" does not exist." << endl;
+		return bRet;
+	}
+
+	ofstream cleanedTraces;
+
+	// check is creation of file needed
+	if( pCleanedTraceFile != NULL )
+	{
+		// if yes open file for cleaned traces
+	    // (<AT> messages with cleaned timestamps)
+		bCreateCleanedTraces = true;
+
+		cleanedTraces.open(pCleanedTraceFile);
+
+		if( !cleanedTraces.good() )
+		{
+			printf( "Can not open file: %s\n", pCleanedTraceFile );
+			return bRet;
+		}
+	}
+
+	// Open data file
+	ifstream in( pFileName );
+
+	// Check file opened ok
+	if ( !in.good() )
+		return false;
+
+	// Get stream size
+	size_t streamPos = in.tellg();
+	in.seekg( 0, ios::end);
+	size_t streamEnd = in.tellg();
+	in.seekg( 0, ios::beg);
+
+	//Origianl characters (not filtered).
+	char cOriginalLineFromFile[MAX_LINE_LENGTH];
+
+	vector<CProcessData> vProcessList;
+	int iProcessIDinList = -1;
+
+	bool bFileVersionSaved = false;
+	// Read lines
+	while( streamPos < streamEnd )
+	{
+		// Get one line. Don't use stream flags to determinate end of file
+		// it can be found too early because trace can contain "anything".
+		in.getline( cOriginalLineFromFile, MAX_LINE_LENGTH );
+		
+		// Refresh position
+		streamPos = in.tellg();
+
+		// Check has bad bit flag raised. (i.e. device problems reading data)
+		if( in.bad() )
+		{
+			cout << AT_MSG << "Integrity error reading the trace file, reading aborted." << endl;
+			return false;
+		}
+		//Filtered characters.
+		char cLineFromFile[MAX_LINE_LENGTH];
+		char* pFiltered = cLineFromFile;
+
+		//Loop thru all characters in original line.
+		for( size_t i = 0 ; cOriginalLineFromFile[i] != 0 ; i++ )
+		{
+			//If character in line is not in invalid character array append it
+			//to filtered line.
+			if ( strchr( cINVALID_TRACE_FILE_CHARS, cOriginalLineFromFile[i] ) == 0 )
+					*pFiltered++ =  cOriginalLineFromFile[i];
+		}
+		*pFiltered++ = 0; //Add null termination to filtered line.
+
+		if( !bFileVersionSaved && *cLineFromFile != 0 )
+		{
+			bFileVersionSaved = true;
+			m_DataSaver.AddString( AT_DATA_FILE_VERSION );
+			m_DataSaver.AddLineToLast();
+		}
+
+		// Is there main ID?
+		if( strstr( cLineFromFile, MAIN_ID ) != NULL )
+		{
+			string sRestOfLine( cLineFromFile );
+			string sTemp("");
+			unsigned __int64 iTimeStamp(0);
+			string sTime("");
+			string sLineStart("");
+
+			// Get part of line before main id. This should contain time info
+			sLineStart = GetStringUntilMainId( sRestOfLine );
+			// Get message's time stamp in microseconds
+			iTimeStamp = ParseTimeStamp( sLineStart );
+			// store whole line from MAIN_ID - to be logged to cleaned traces file
+		    string sLineToCleanedFile( sRestOfLine );
+
+			// Get main ID
+			sTemp = GetStringUntilNextSpace( sRestOfLine );
+
+			// Is there more data in line?
+			if( sRestOfLine.empty() )
+			{
+				continue;
+			}
+
+			// Get next argument
+			sTemp = GetStringUntilNextSpace( sRestOfLine );
+			// This might be process id, device info message or error message
+			if ( sTemp.compare( ERROR_OCCURED ) == 0 )
+			{
+				// Api mismatch between s60 side and atool.exe
+				if ( sRestOfLine.find( INCORRECT_ATOOL_VERSION ) != string::npos )
+				{
+					cout << "Test run failed because version conflict between device binaries\nand the atool.exe version used to build the application." << endl;
+					size_t pS = sRestOfLine.find_first_of('[');
+					size_t pE =  sRestOfLine.find_first_of(']');
+					size_t pSL = sRestOfLine.find_last_of('[');
+					size_t pEL = sRestOfLine.find_last_of(']');
+					if ( pS != string::npos && pE != string::npos && pSL != string::npos && pEL != string::npos )
+					{
+						string deviceVer = sRestOfLine.substr( pS+1, pE-pS-1 );
+						string atoolVer = sRestOfLine.substr( pSL+1, pEL-pSL-1 );
+						cout << "\tdevice: " << deviceVer << endl 
+							<<  "\tatool.exe: " << atoolVer << endl;
+					}
+				}
+				else
+					cout << sRestOfLine << endl;
+				continue;
+			}
+
+			if ( sTemp.compare( LABEL_DEVICE_INFO ) == 0 ) 
+			{
+
+				if( vProcessList[iProcessIDinList].bProcessOnGoing == false )
+				continue;
+
+				// get time string from timestamp
+			    sTime = GetTimeFromTimeStamp( iTimeStamp, vProcessList[iProcessIDinList].iTimeSpan );
+
+				// device info line, 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 << LABEL_DEVICE_INFO << " "; //add Message type
+				cleanedTraces << sRestOfLine << "\n"; //add the rest of the line
+				}
+				continue;
+			}
+
+			unsigned long iProcessID = _httoi( sTemp.c_str() );
+			// todo to be removed when reallocations are implemented
+			string sProcessID = sTemp;
+
+			iProcessIDinList = -1;
+			// Find process from list
+			for( unsigned int i = 0 ; i < vProcessList.size() ; i++ )
+			{
+				if( vProcessList[i].iProcessID == iProcessID )
+				{
+					iProcessIDinList = i;
+					break;
+				}
+			}
+			// Is Process ID found from list?
+			if( iProcessIDinList == -1 )
+			{
+				CProcessData ProcessData;
+				ProcessData.bProcessOnGoing = false;
+				ProcessData.iProcessID = iProcessID;
+				vProcessList.push_back( ProcessData );
+				iProcessIDinList = (int)vProcessList.size() - 1;
+			}
+
+			// Remove spaces from end of line
+			while( sRestOfLine[sRestOfLine.size()-1] == ' ' )
+			{
+				sRestOfLine.resize( sRestOfLine.size()-1 );
+			}
+
+			string sWholeTempLine( sRestOfLine );
+
+			// Get command
+			sTemp = GetStringUntilNextSpace( sRestOfLine );
+
+			// Use c style string for easy comparisong of command.
+			const char* pCommand = sTemp.c_str();		
+
+			// Process start.
+			if( ! _stricmp( pCommand, LABEL_PROCESS_START ) )
+			{
+				bRet = true; // Set return value true we found start.
+				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
+				vProcessList[iProcessIDinList].bProcessOnGoing = true;
+
+				// remove <processName> <processID> part
+				GetStringUntilNextSpace( sRestOfLine );
+				GetStringUntilNextSpace( sRestOfLine );
+				// get time
+				sTemp = GetStringUntilNextSpace( sRestOfLine );
+				unsigned __int64 iTemp(0);
+				sscanf_s( sTemp.c_str(), "%016I64x", &iTemp);
+				//calculate span between PCS time and PCS timestamp
+				vProcessList[iProcessIDinList].iTimeSpan = iTemp - iTimeStamp;
+
+				if( bCreateCleanedTraces )
+				{
+				// add message to cleaned traces file
+				cleanedTraces << sTemp << " "; //add time
+				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
+				cleanedTraces << sProcessID << " "; //add process ID
+				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
+				}
+
+				continue;
+			}
+
+			// Check is process ongoing if not skip other tags.
+			if( vProcessList[iProcessIDinList].bProcessOnGoing == false )
+				continue;
+
+			// 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 ) )
+			{
+				// Add alloc
+				vProcessList[iProcessIDinList].Alloc( sRestOfLine );
+
+				// 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 ) )
+			{
+				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 );
+
+				// 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->AllocH( sRestOfLine, sTime );
+					}
+					viSubTestIter++;
+				}
+			}
+			// 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 );
+				
+				// Subtests running?
+				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
+				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
+				{
+					if( viSubTestIter->bRunning )
+					{
+						// Save alloc fragment also to sub test
+						viSubTestIter->AllocF( sRestOfLine, sTime );
+					}
+					viSubTestIter++;
+				}
+			}
+			else if ( ! _stricmp( pCommand, REALLOCH_ID ) )
+			{
+				// 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 );
+
+				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
+				GetStringUntilNextSpace( 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
+				}
+
+				// Subtests running?
+				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
+				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
+				{
+					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 );
+					}
+					viSubTestIter++;
+				}
+			}
+			// rellocation fragment (call stack).
+			else if ( ! _stricmp( pCommand, REALLOCF_ID ) )
+			{
+				// 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
+				}
+
+				// Add alloc fragment
+
+				// first string is for 'free' (address), lets remove it first
+				GetStringUntilNextSpace( sRestOfLine, true );
+				//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
+				}
+				
+				// Subtests running?
+				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
+				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
+				{
+					if( viSubTestIter->bRunning )
+					{
+						// Save alloc fragment also to sub test
+						// 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 );
+
+						// Add alloc fragment
+
+						// first string is for 'free' (address), lets remove it first
+						GetStringUntilNextSpace( sRestOfLine, true );
+						//add 'alloc' line
+						vProcessList[iProcessIDinList].AllocF( sRestOfLine, 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.
+			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 );
+
+				// Subtests running?
+				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
+				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
+				{
+					if( viSubTestIter->bRunning )
+					{
+						// Send free to subtest
+						viSubTestIter->FreeH( sRestOfLine, sTime );
+					}
+					viSubTestIter++;
+				}
+			
+			}
+			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
+				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;
+
+				// Save leaks
+				vector<string> vLeaks;
+				vector<string>::iterator viLeaks;
+				vProcessList[iProcessIDinList].GetLeakList( vLeaks );
+				for ( viLeaks = vLeaks.begin(); viLeaks != vLeaks.end(); viLeaks++ )
+				{
+					sTemp.clear();
+					sTemp.append( LABEL_MEM_LEAK );
+					sTemp.append( " " );
+					sTemp.append( *viLeaks );
+					vProcessList[iProcessIDinList].vData.push_back( sTemp );
+				}
+				vProcessList[iProcessIDinList].ClearAllocs();
+
+				vector<string>::iterator viHandleIter = vProcessList[iProcessIDinList].vHandleLeaks.begin();
+				// Print handle leaks
+				while( viHandleIter != vProcessList[iProcessIDinList].vHandleLeaks.end() )
+				{
+					sTemp.clear();
+					sTemp.append( viHandleIter->c_str() );
+					vProcessList[iProcessIDinList].vData.push_back( sTemp );
+					viHandleIter++;
+				}
+				// Clear handle leaks from list
+				vProcessList[iProcessIDinList].vHandleLeaks.clear();
+
+				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
+				// Print sub test leaks
+				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
+				{
+					// Print sub test start
+					string sLine( LABEL_TEST_START ); sLine.append( " " );
+					sLine.append( viSubTestIter->sStartTime ); sLine.append( " " );
+					sLine.append( viSubTestIter->sSubTestName ); sLine.append( " " );
+					sLine.append( viSubTestIter->sSubTestStartHandleCount );
+					vProcessList[iProcessIDinList].vData.push_back( sLine );
+					sLine.clear();
+
+					// DLL Loads.
+					for( vector<string>::iterator it = viSubTestIter->vData.begin();
+						it != viSubTestIter->vData.end(); it++ )
+					{
+						vProcessList[iProcessIDinList].vData.push_back( (*it) );
+					}
+
+					// Subtest leaks.
+					vector<string> vSubLeaks;
+					vector<string>::iterator viSubLeaks;
+					viSubTestIter->GetLeakList( vSubLeaks );
+					for ( viSubLeaks = vSubLeaks.begin(); viSubLeaks != vSubLeaks.end(); viSubLeaks++ )
+					{
+						sLine.append( LABEL_MEM_LEAK );
+						sLine.append( " " );
+						sLine.append( *viSubLeaks );
+						vProcessList[iProcessIDinList].vData.push_back( sLine );
+						sLine.clear();
+					}
+					viSubTestIter->ClearAllocs();
+
+					if( !viSubTestIter->sEndTime.empty() )
+					{
+						// Print sub test end
+						sLine.append( LABEL_TEST_END ); sLine.append( " " );
+						sLine.append( viSubTestIter->sEndTime ); sLine.append( " " );
+						sLine.append( viSubTestIter->sSubTestName ); sLine.append( " " );
+						sLine.append( viSubTestIter->sSubTestEndHandleCount );
+						vProcessList[iProcessIDinList].vData.push_back( sLine );
+					}
+					viSubTestIter++;
+				}
+
+				// Clear sub tests from list
+				vProcessList[iProcessIDinList].vSubTests.clear();
+				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
+			}
+			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 );
+			}
+			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
+				sWholeTempLine.append( " " );
+				sWholeTempLine.append( sTime );
+
+				// Add module load to process data.
+				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
+				// Add module load to subtest data if test running.
+				for( vector<CSubTestData>::iterator it = vProcessList[iProcessIDinList].vSubTests.begin();
+					it != vProcessList[iProcessIDinList].vSubTests.end(); it++ )
+				{
+					if( it->bRunning )
+						it->vData.push_back( sWholeTempLine );
+				}
+
+			}
+			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
+				sWholeTempLine.append( " " );
+				sWholeTempLine.append( sTime );
+
+				// Add module load to process data.
+				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
+				// Add module unload to subtest data if test running.
+				for( vector<CSubTestData>::iterator it = vProcessList[iProcessIDinList].vSubTests.begin();
+					it != vProcessList[iProcessIDinList].vSubTests.end(); it++ )
+				{
+					if( it->bRunning )
+						it->vData.push_back( sWholeTempLine );
+				}
+			}
+			else if( sTemp.find( LABEL_LOGGING_CANCELLED ) != string::npos ||
+				     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 );
+			}
+			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 );
+				// Get sub test name
+				string sSubTestName = GetStringUntilNextSpace( sRestOfLine );
+				// Get sub test start handle count
+				string sSubTestStartHandleCount = GetStringUntilNextSpace( sRestOfLine );
+
+				CSubTestData SubTestData;
+				SubTestData.bRunning = true;
+				SubTestData.sStartTime = sSubTestTime;
+				SubTestData.sSubTestName = sSubTestName;
+				SubTestData.sSubTestStartHandleCount = sSubTestStartHandleCount.c_str();
+
+				vProcessList[iProcessIDinList].vSubTests.push_back( SubTestData );
+			}
+			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
+				string sSubTestName = GetStringUntilNextSpace( sRestOfLine );
+				// Get sub test end handle count
+				string sSubTestEndHandleCount = GetStringUntilNextSpace( sRestOfLine );
+
+				// Find subtest
+				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
+				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
+				{
+					if( viSubTestIter->sSubTestName == sSubTestName && viSubTestIter->sEndTime.empty() )
+					{
+						viSubTestIter->sEndTime = sSubTestEnd;
+						viSubTestIter->bRunning = false;
+						viSubTestIter->sSubTestEndHandleCount = sSubTestEndHandleCount.c_str();
+					}
+					viSubTestIter++;
+				}
+			}
+			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
+			}
+			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
+				}
+			}
+		}
+	}
+
+	if( bCreateCleanedTraces )
+	{
+	// close stream
+	cleanedTraces.close();
+	}
+
+	// Print all saved data from processes
+	for( unsigned int i = 0 ; i < vProcessList.size() ; i++ )
+	{
+		// Print saved lines
+		for( unsigned int iDataCounter = 0 ; iDataCounter < vProcessList[i].vData.size() ; iDataCounter++ )
+		{
+			m_DataSaver.AddString( vProcessList[i].vData[iDataCounter].c_str() );
+			m_DataSaver.AddLineToLast();
+		}
+
+		string sTemp;
+
+		// Save leaks
+		vector<string> vLeaks;
+		vector<string>::iterator viLeaks;
+		vProcessList[i].GetLeakList( vLeaks );
+		for ( viLeaks = vLeaks.begin(); viLeaks != vLeaks.end(); viLeaks++ )
+		{
+			sTemp.clear();
+			sTemp.append( LABEL_MEM_LEAK );
+			sTemp.append( " " );
+			sTemp.append( *viLeaks );
+			m_DataSaver.AddString( sTemp.c_str() );
+			m_DataSaver.AddLineToLast();
+		}
+
+		vector<string>::iterator viHandleIter = vProcessList[i].vHandleLeaks.begin();
+		// Print handle leaks, if there is data left, there was no process end.
+		while( viHandleIter != vProcessList[i].vHandleLeaks.end() )
+		{
+			sTemp.clear();
+			sTemp.append( viHandleIter->c_str() );
+			m_DataSaver.AddString( sTemp.c_str() );
+			m_DataSaver.AddLineToLast();
+			viHandleIter++;
+		}
+		vector<CSubTestData>::iterator viSubTestIter = vProcessList[i].vSubTests.begin();
+		// Print sub test data, if there is data left, there was no process end.
+		while( viSubTestIter != vProcessList[i].vSubTests.end() )
+		{
+			// Print sub test start
+			string sLine( LABEL_TEST_START ); sLine.append( " " );
+			sLine.append( viSubTestIter->sStartTime ); sLine.append( " " );
+			sLine.append( viSubTestIter->sSubTestName ); sLine.append( " " );
+			sLine.append( viSubTestIter->sSubTestStartHandleCount );
+			m_DataSaver.AddString( sLine.c_str() );
+			m_DataSaver.AddLineToLast();
+			sLine.clear();
+
+			// DLL Loads.
+			for( vector<string>::iterator it = viSubTestIter->vData.begin();
+				it != viSubTestIter->vData.end(); it++ )
+			{
+				m_DataSaver.AddString( (*it).c_str() );
+				m_DataSaver.AddLineToLast();
+			}
+
+			// Subtest leaks.
+			vector<string> vSubLeaks;
+			vector<string>::iterator viSubLeaks;
+			viSubTestIter->GetLeakList( vSubLeaks );
+			for ( viSubLeaks = vSubLeaks.begin(); viSubLeaks != vSubLeaks.end(); viSubLeaks++ )
+			{
+				sLine.append( LABEL_MEM_LEAK );
+				sLine.append( " " );
+				sLine.append( *viSubLeaks );
+				m_DataSaver.AddString( sLine.c_str() );
+				m_DataSaver.AddLineToLast();
+				sLine.clear();
+			}
+
+			// Print sub test end
+			sLine.append( LABEL_TEST_END ); sLine.append( " " );
+			sLine.append( viSubTestIter->sEndTime ); sLine.append( " " );
+			sLine.append( viSubTestIter->sSubTestName ); sLine.append( " " );
+			sLine.append( viSubTestIter->sSubTestEndHandleCount );
+			m_DataSaver.AddString( sLine.c_str() );
+			m_DataSaver.AddLineToLast();
+
+			viSubTestIter++;
+		}
+	}
+	// Save lines to file.
+	m_DataSaver.SaveLinesToFile( pOutputFileName, TEXT_DATA );
+	// Close file.
+	in.close();
+	return bRet;
+}
+
+// -----------------------------------------------------------------------------
+// CATParseTraceFile::GetDataSaver
+// Gets data saver object.
+// -----------------------------------------------------------------------------
+CATDataSaver* CATParseTraceFile::GetDataSaver(void)	
+{
+	LOG_LOW_FUNC_ENTRY("CATParseTraceFile::GetDataSaver");
+	return &m_DataSaver;
+}
+
+
+// -----------------------------------------------------------------------------
+// CATBase::GetTimeFromTimeStamp
+// Gets time from timestamp in microseconds as string
+// -----------------------------------------------------------------------------
+string CATParseTraceFile::GetTimeFromTimeStamp( unsigned __int64 iTimeStamp, unsigned __int64 iTimeSpan )
+{
+	unsigned __int64 iTime = iTimeStamp + iTimeSpan;
+	stringstream ss;
+	ss <<  std::hex << iTime;
+
+    return ss.str();
+}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/CATParseXML.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* 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:  Definitions for the class CATParseXML.
+*
+*/
+
+
+#include "../inc/CATParseXML.h"
+#include "../inc/catdatasaver.h"
+#include "../inc/CATBase.h"
+
+#include <xercesc/parsers/XercesDOMParser.hpp>
+
+const char cCanNotFindEpocroot[] = "Can not find EPOCROOT from devices.xml.\n";
+const char cErrorInDeviceXml[] = "Error in devices.xml!\n";
+const char cCanNotFind[] = "Can not find file: %s.\n";
+
+CATParseXML::CATParseXML(void)
+{
+	LOG_FUNC_ENTRY("CATParseXML::CATParseXML");
+	try 
+	{
+		xercesc::XMLPlatformUtils::Initialize();
+	}
+	catch ( ... )
+	{
+		//Print error
+		printf("XML initialization failed.\n");
+	}
+}
+
+CATParseXML::~CATParseXML(void)
+{
+	LOG_FUNC_ENTRY("CATParseXML::~CATParseXML");
+}
+
+// -----------------------------------------------------------------------------
+// CATParseXML::GetEpocRootPathFromXML
+// Find epocroot path in xml file
+// -----------------------------------------------------------------------------
+string CATParseXML::GetEpocRootPathFromXML(const char* pSourcePath)
+{
+	LOG_FUNC_ENTRY("CATParseXML::GetEpocRootPathFromXML");
+	string sEpocRootPath;
+	// Check that source exists
+	if ( ! CATBase::FileExists( pSourcePath ) )
+	{
+		LOG_STRING( "Source xml not found." );
+		return sEpocRootPath;
+	}
+	try 
+	{
+		xercesc::XercesDOMParser* parser = new xercesc::XercesDOMParser();
+		xercesc::DOMDocument* pDomDoc;
+
+		// Get devices.xml document
+		parser->parse( pSourcePath );
+		pDomDoc = parser->getDocument();
+
+		// Get root element
+		xercesc::DOMElement* pRootElem = pDomDoc->getDocumentElement();
+
+		if( pRootElem )
+		{
+			// Get all "device" elements
+			LPWSTR wTemp = CATDataSaver::CharToWChar( "device" );
+			xercesc::DOMNodeList* pDeviceNodeList = pRootElem->getElementsByTagName( wTemp );
+			if( wTemp )
+				delete[] wTemp;
+
+			// Find default SDK
+
+			bool bEpocRootFound = false;
+			int iLength = pDeviceNodeList->getLength();
+			for( int i = 0 ; i < iLength ; i++ )
+			{
+				xercesc::DOMNode* pDeviceNode = pDeviceNodeList->item(i);
+
+				xercesc::DOMNamedNodeMap* pAttributeList = pDeviceNode->getAttributes();
+
+				// Find attribute "default"
+
+				int iAttribListLength = pAttributeList->getLength();
+				for( int x = 0 ; x < iAttribListLength ; x++ )
+				{
+					xercesc::DOMNode* pAttribNode = pAttributeList->item(x);
+					const LPWSTR pNodeName = (const LPWSTR)pAttribNode->getNodeName();
+
+					if( wcscmp( pNodeName, L"default" ) == 0 )
+					{
+						const LPWSTR pNodeValue = (const LPWSTR)pAttribNode->getNodeValue();
+						
+						// Find node value 'yes'
+						if( wcscmp( pNodeValue, L"yes" ) == 0 )
+						{
+							// Find <epocroot> node
+							xercesc::DOMNode* pChildNode = pDeviceNode->getFirstChild();
+							if( !pChildNode )
+								break;
+							while( !bEpocRootFound )
+							{
+								if( wcscmp( pChildNode->getNodeName() , L"epocroot" ) == 0 )
+								{
+									bEpocRootFound = true;
+
+									// Node value is child text node
+									xercesc::DOMNode* pTempTextNode = pChildNode->getFirstChild();
+									const LPWSTR pPathNodeValue = (const LPWSTR)pTempTextNode->getNodeValue();
+
+									CATDataSaver::WCharToChar( sEpocRootPath, pPathNodeValue );
+
+									break;
+								}
+								pChildNode = pChildNode->getNextSibling();
+								if( !pChildNode )
+									break;
+							}
+						} // If node value yes
+					} // If node name default
+					if( bEpocRootFound )
+						break;
+				} // for x
+				if( bEpocRootFound )
+					break;
+			} // for i
+		}
+		if(parser)
+			delete parser; //lint !e118
+ 		xercesc::XMLPlatformUtils::Terminate();
+	}
+    catch (...)
+	{
+        printf("XML parsing failed.");
+    }
+	return sEpocRootPath;
+}
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/CATProject.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,2468 @@
+/*
+* 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:  Class representing a project.
+*
+*/
+
+
+#include "../inc/CATProject.h"
+#include "../inc/CATModule2.h"
+#include "../inc/CATParseTraceFile.h"
+#include "../inc/CATParseBinaryFile.h"
+#include "../inc/CATDatParser.h"
+
+//dbghelp.dll version function.
+extern int showDbgHelpVersionInfo( bool showVersion );
+
+// ----------------------------------------------------------------------------
+// CATProject::CATProject()
+// ----------------------------------------------------------------------------
+CATProject::CATProject()
+{
+	LOG_FUNC_ENTRY("CATProject::CATProject");
+
+	m_bUninstrumented = true;
+	m_bAbldTest = false;
+
+	// Use windows api to acquire current directory info.
+	GetCurrentDirectory( MAX_LINE_LENGTH, m_cCurrentDir );
+
+	m_eBuildSystem = SBS_V1;
+	m_eBuildType = UDEB;
+	m_eLoggingMode = TRACE;
+	m_eMode = NOT_DEFINED;
+	
+	m_iLoggingLevel = 3;
+	
+	m_pAnalyzer = 0;
+
+	m_sBinaryTarget = "";
+	m_sBuildCommand = "";
+	m_sDataFile = "";
+	m_sDataFileOutput = "";
+	m_sDataFileTemp = "";
+	m_sBinaryLogFileTemp = "";
+	m_sEpocRoot = "\\";
+	m_sMakeFile = "";
+	m_sPlatform = "";
+	m_sS60FileName = "";
+	m_sS60FilePath = "";
+	m_sTargetModule = "";
+	m_sVariant = "";
+
+	m_vRomSymbolFiles.clear();
+	m_vModules.clear();
+	m_vStaticLibraries.clear();
+	m_vTargetModules.clear();
+	m_vUnsupportedModules.clear();
+}
+
+// ----------------------------------------------------------------------------
+// CATProject::~CATProject()
+// ----------------------------------------------------------------------------
+CATProject::~CATProject()
+{
+	LOG_FUNC_ENTRY("CATProject::~CATProject");
+
+	CleanModuleVectors();
+
+	// Delete analyzer
+	if ( m_pAnalyzer )
+		delete m_pAnalyzer;
+
+	// Temporary datafile
+	if ( !m_sDataFileTemp.empty() )
+	{
+		if ( FileExists( m_sDataFileTemp.c_str() ) )
+			FileDelete( m_sDataFileTemp, false );
+	}
+
+	// Temporary trace file
+	if ( !m_sBinaryLogFileTemp.empty() )
+	{
+		if ( FileExists( m_sBinaryLogFileTemp.c_str() ) )
+			FileDelete( m_sBinaryLogFileTemp, false );
+	}
+	
+}
+
+bool CATProject::SetArguments( ARGUMENTS& arguments )
+{
+	LOG_FUNC_ENTRY("CATProject::SetArguments");
+	bool bRet = true;
+
+	//Project mode.
+	if( arguments.eHookSwitch == HOOK_INTERNAL )
+	{
+		SetMode( CATProject::COMPILE );
+		SetLoggingMode( CATProject::FILE );
+	}
+	else if ( arguments.eHookSwitch == HOOK_EXTERNAL )
+	{
+		SetMode( CATProject::COMPILE );
+		SetLoggingMode( CATProject::TRACE );
+	}
+	else if ( arguments.eHookSwitch == HOOK_EXTERNAL_FAST )
+	{
+		SetMode( CATProject::COMPILE );
+		SetLoggingMode( CATProject::TRACE_FAST );
+	}
+	/* Extension*/
+	else if ( arguments.eHookSwitch == HOOK_EXTENSION_INTERNAL )
+	{
+		SetMode( CATProject::INSTRUMENT );
+		SetLoggingMode( CATProject::FILE );
+	}
+	else if ( arguments.eHookSwitch == HOOK_EXTENSION_EXTERNAL )
+	{
+		SetMode( CATProject::INSTRUMENT );
+		SetLoggingMode( CATProject::TRACE );
+	}
+	else if ( arguments.eHookSwitch == HOOK_EXTENSION_EXTERNAL_FAST )
+	{
+		SetMode( CATProject::INSTRUMENT );
+		SetLoggingMode( CATProject::TRACE_FAST );
+	}
+	else if ( arguments.eHookSwitch == HOOK_EXTENSION_UNINSTRUMENT )
+	{
+		SetMode( CATProject::UNINSTRUMENT );
+	}
+	else if ( arguments.eHookSwitch == HOOK_EXTENSION_FAILED )
+	{
+		SetMode( CATProject::UNINSTRUMENT_FAILED );
+	}
+	//Return if uninstrumenting because no other arguments are set.
+    if ( GetMode() == CATProject::UNINSTRUMENT
+		|| GetMode() == CATProject::UNINSTRUMENT_FAILED )
+	{
+		return bRet;
+	}
+
+	// No build / instrument.
+	if ( arguments.HOOK.bNoBuild )
+		SetMode( CATProject::INSTRUMENT_CONSOLE );
+
+	// Call stack sizes
+	SetAllocCallStackSize( arguments.HOOK.iAllocCallStackSize );
+	SetFreeCallStackSize( arguments.HOOK.iFreeCallStackSize );
+
+	//Build system.
+	if ( arguments.HOOK.iBuildSystem == 1 )
+		SetBuildSystem( CATProject::SBS_V1 );
+	else if ( arguments.HOOK.iBuildSystem == 2 )
+		SetBuildSystem( CATProject::SBS_V2 );
+
+	//Test module build only
+	if ( arguments.HOOK.bAbldTest == true )
+		m_bAbldTest = true;
+
+	//Platform.
+	if ( !_stricmp( arguments.HOOK.sPlatform.c_str(), "armv5" ) )
+		SetPlatform( arguments.HOOK.sPlatform );
+	else if ( !_stricmp( arguments.HOOK.sPlatform.c_str(), "gcce" ) )
+		SetPlatform( arguments.HOOK.sPlatform );
+	else if ( !_stricmp( arguments.HOOK.sPlatform.c_str(), "winscw" ) )
+		SetPlatform( arguments.HOOK.sPlatform );
+	else
+	{
+		LOG_STRING( "Error, no supported platform specified (armv5/gcce/winscw).");
+		bRet = false;
+	}
+
+	//BuildType.
+	if ( !_stricmp( arguments.HOOK.sBuildType.c_str(), "urel" ) )
+		SetBuildType( CATProject::UREL );
+	else if ( !_stricmp( arguments.HOOK.sBuildType.c_str(), "udeb" ) )
+		SetBuildType( CATProject::UDEB );
+	else
+	{
+		LOG_STRING( "Error, no build type specified.");
+		bRet = false;
+	}
+
+	//Internal data file name.
+	if ( arguments.HOOK.bDataFileName )
+		SetS60FileName( arguments.HOOK.sDataFileName );
+
+	//Internal data file path.
+	if ( arguments.HOOK.bDataFilePath )
+		SetS60FilePath( arguments.HOOK.sDataFilePath );
+
+	//Build command.
+	if ( arguments.HOOK.sBuildCmd.empty() && ( 
+		GetMode() == CATProject::COMPILE ||
+		GetMode() == CATProject::INSTRUMENT ||
+		GetMode() == CATProject::INSTRUMENT_CONSOLE
+		))
+	{
+		cout << AT_MSG << "Error, no build command specified." << endl;
+		bRet = false;
+	}
+
+	SetBuildCommand( arguments.HOOK.sBuildCmd );
+
+	//Variant.
+	SetVariant( arguments.HOOK.sFeatureVariant );
+
+	//Target programs.
+	SetTargetModules( arguments.HOOK.vTargetPrograms );
+
+	return bRet;
+}
+
+void CATProject::CleanModuleVectors()
+{
+	LOG_FUNC_ENTRY("CATProject::CleanModuleVectors");
+	// delete modules from vector.
+	for( size_t i = 0; i < m_vModules.size()  ; i++ )
+		delete m_vModules[i];
+	m_vModules.clear();
+	
+	// Delete modules from vector (unsupported).
+	for( size_t i = 0; i < m_vUnsupportedModules.size()  ; i++ )
+		delete m_vUnsupportedModules[i];
+	m_vUnsupportedModules.clear();
+
+	// Delete modules from static library vector.
+	for( size_t i = 0; i < m_vStaticLibraries.size() ; i++ )
+		delete m_vStaticLibraries[i];
+	m_vStaticLibraries.clear();
+}
+// ----------------------------------------------------------------------------
+// CATProject::Run
+// ----------------------------------------------------------------------------
+int CATProject::Run()
+{
+	LOG_FUNC_ENTRY("CATProject::Run");
+	int iReturnCode = 0;
+	switch( m_eMode )
+	{
+	case COMPILE:
+		// Run compile
+		iReturnCode = RunCompile();
+		if ( iReturnCode == AT_RETURN_CODE::READ_MAKEFILE_ERROR
+			|| iReturnCode == AT_RETURN_CODE::KERNEL_SIDE_MODULE_ERROR
+			|| iReturnCode == AT_RETURN_CODE::INVALID_MMP_DEFINED )
+		{
+			DeleteTemporaryDirs();
+			DirDelete( AT_TEMP_DIR, true );
+		}
+		else
+		{
+			DisplayCompileSummary();
+			DisplayBuildSummary();
+		}
+		break;
+	case CLEAN:
+		iReturnCode = RunClean();
+		break;
+	case ANALYZE:
+		iReturnCode = RunAnalyze();
+		break;
+	case INSTRUMENT:
+		iReturnCode = RunInstrument();
+		break;
+	case INSTRUMENT_CONSOLE:
+		iReturnCode = RunInstrumentConsole();
+		if ( iReturnCode == AT_RETURN_CODE::READ_MAKEFILE_ERROR
+			|| iReturnCode == AT_RETURN_CODE::KERNEL_SIDE_MODULE_ERROR )
+		{
+			DeleteTemporaryDirs();
+			DirDelete( AT_TEMP_DIR, true );
+		}
+		else
+		{
+			DisplayBuildSummary();
+		}
+		break;
+	case UNINSTRUMENT:
+		iReturnCode = RunUninstrument();
+		// Show summary
+		DisplayCompileSummary();
+		DisplayBuildSummary();
+		break;
+	case UNINSTRUMENT_CONSOLE:
+		iReturnCode = RunUninstrumentConsole();
+		// Show summary
+		DisplayCompileSummary();
+		DisplayBuildSummary();
+		break;
+	case UNINSTRUMENT_FAILED:
+		iReturnCode = RunUninstrumentFailed();
+		// Display message
+		cout << AT_MSG << "Build aborted, because project contains compile error(s)."
+			<< endl;
+		break;
+	default:
+		cout << AT_MSG << "Error, mode not supported / implemented." << endl;
+		break;
+	}
+	// Error messages
+	switch( iReturnCode )
+	{
+		case AT_RETURN_CODE::MAKEFILE_ERROR:
+			cout << AT_MSG << "Error, creating/reading makefiles." << endl;
+			break;
+		case AT_RETURN_CODE::COMPILE_ERROR:
+			cout << AT_MSG << "Error, compiling project." << endl;
+			break;
+		case AT_RETURN_CODE::UNKNOWN:
+			cout << AT_MSG << "Error, unknown." << endl;
+			break;
+		case AT_RETURN_CODE::WRONG_DATA_FILE_VERSION:
+			cout << AT_MSG << "unable to analyze the data file.\n";
+			cout << AT_MSG << "wrong data file version.\n";
+			break;
+		case AT_RETURN_CODE::INVALID_DATA_FILE:
+			cout << AT_MSG << "Error, invalid datafile." << endl;
+			break;
+		case AT_RETURN_CODE::RELEASABLES_ERROR:
+			cout << AT_MSG << "Error, copying releasable(s)." << endl;
+			break;
+		case AT_RETURN_CODE::RESTORE_MODULES_ERROR:
+			cout << AT_MSG << "Error, restoring mmp file(s)." << endl;
+			break;
+		case AT_RETURN_CODE::CREATING_TEMP_CPP_ERROR:
+			cout << AT_MSG << "Error, creating temporary cpp file(s)." << endl;
+			break;
+		case AT_RETURN_CODE::CLEANING_TEMP_ERROR:
+			cout << AT_MSG << "Error, cleaning temporary dir(s)." << endl;
+			break;
+		case AT_RETURN_CODE::READ_MAKEFILE_ERROR:
+			cout << AT_MSG << "Error, reading makefile." << endl;
+			break;
+		case AT_RETURN_CODE::MODIFY_MODULES_ERROR:
+			cout << AT_MSG << "Error, modifying mmp file(s)." << endl;
+			break;
+		case AT_RETURN_CODE::INVALID_MMP_DEFINED:
+			break;
+		case AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR:
+			cout << AT_MSG << "Error, writing attributes." << endl;
+			break;
+		case AT_RETURN_CODE::READ_ATTRIBUTES_ERROR:
+			cout << AT_MSG << "Error, reading project configuration. Instrument project again." << endl;
+			break;
+		case AT_RETURN_CODE::EMPTY_DATA_FILE:
+			cout << AT_MSG << "Error, no data to be analyzed." << endl;
+			break;
+		case AT_RETURN_CODE::NO_SUPPORTED_MODULES_ERROR:
+			cout << AT_MSG << "Error, no modules found with supported target type." << endl;
+			break;
+		case AT_RETURN_CODE::KERNEL_SIDE_MODULE_ERROR:
+			cout << AT_MSG << "Error, kernel side component found component. Build/instrument aborted." << endl;
+			break;
+	}	
+	return iReturnCode;
+}
+// ----------------------------------------------------------------------------
+// CATProject::RunRecoveryAndExit()
+// Restore modules quick and exit. Used when user wants to kill/end process.
+// ----------------------------------------------------------------------------
+int CATProject::RunRecoveryAndExit()
+{
+	LOG_FUNC_ENTRY("CATProject::RunRecoveryAndExit");
+	cout << AT_MSG << "Error, user requested exit." << endl;
+	VerifyAndRecoverModules();
+	DeleteTemporaryDirs();
+	DirDelete( AT_TEMP_DIR, true );
+	cout << AT_MSG << "Exit." << endl;
+	return AT_RETURN_CODE::USER_ISSUED_EXIT;
+}
+
+// ----------------------------------------------------------------------------
+// CATProject::IsUninstrumented()
+// Reads projects configuration file if it exists. 
+// Return false in case the data contains information that project is
+// uninstrumented. Otherwise returns always true.
+// ----------------------------------------------------------------------------
+bool CATProject::IsUninstrumented()
+{
+	LOG_FUNC_ENTRY("CATProject::IsUninstrumented");
+	string sCfgFile( AT_TEMP_DIR );
+	sCfgFile.append( "\\" );
+	sCfgFile.append( AT_PROJECT_ATTRIBUTES_FILE_NAME );
+	if ( ! FileExists( sCfgFile.c_str() ) )
+		return true;
+	if( !ReadAttributes() )
+	{
+		LOG_STRING( "Error, reading project.cfg file." );
+		return false;
+	}
+	return m_bUninstrumented;
+}
+
+// ----------------------------------------------------------------------------
+// CATProject::RunCompile()
+// Helper functions to run different modes.
+// ----------------------------------------------------------------------------
+int CATProject::RunCompile()
+{
+	LOG_FUNC_ENTRY("CATProject::RunCompile");
+	// Store attributes
+	if( ! MakeTempDirIfNotExist() )
+		return AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
+	if ( ! WriteAttributes() )
+		return AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
+	// Create makefile
+	if ( ! CreateMakeFile() )
+		return AT_RETURN_CODE::MAKEFILE_ERROR;
+	// Read makefile to get project attributes
+	if ( ! ReadMakeFile() )
+		return AT_RETURN_CODE::READ_MAKEFILE_ERROR;
+	// Filter unsupported
+	FilterModules();
+	// Check that we have some "valid" modules to hook
+	if ( m_vModules.size() == 0 &&(  m_vUnsupportedModules.size() > 0 || m_vStaticLibraries.size() > 0 ) )
+		return AT_RETURN_CODE::NO_SUPPORTED_MODULES_ERROR;
+	// Check is possible target module defined in project
+	if ( ! IsTargetModuleInProject() )
+		return AT_RETURN_CODE::INVALID_MMP_DEFINED;
+	// Clean temporary dirs of modules
+	if ( ! CleanTemporaryDirs() )
+		return AT_RETURN_CODE::CLEANING_TEMP_ERROR;
+	// Create temporary cpps for modulse
+	if (! CreateTemporaryCpps() )
+		return AT_RETURN_CODE::CREATING_TEMP_CPP_ERROR;
+	// Hook modules
+	if (! ModifyModules() )
+		return AT_RETURN_CODE::MODIFY_MODULES_ERROR;
+	// Compile all
+	// Return code
+	int iRetCode = AT_RETURN_CODE::OK;
+	// Compile
+	if ( ! Compile() )
+		iRetCode = AT_RETURN_CODE::COMPILE_ERROR;
+	// Listings
+	if (! CreateListings() )
+		iRetCode = AT_RETURN_CODE::COMPILE_ERROR;
+	// Releasables
+	if (! CopyReleasables() )
+		iRetCode = AT_RETURN_CODE::RELEASABLES_ERROR;
+	// Restore "unhook" modules
+	if (! RestoreModules() )
+		iRetCode = AT_RETURN_CODE::RESTORE_MODULES_ERROR;
+	// Return error code OK
+	return iRetCode;
+}
+
+int CATProject::RunClean()
+{
+	LOG_FUNC_ENTRY("CATProject::RunClean");
+	int iRetCode = AT_RETURN_CODE::OK;
+	bool bNothingFound = true;
+	// Read attributes.
+	if (  ReadAttributes() )
+	{
+		bNothingFound = false;
+		if ( m_eBuildSystem == SBS_V1 )
+			InitSbs1MakeFileWithPathToTemp();
+		// Read makefile to get project attributes
+		if( ReadMakeFile() )
+		{
+			// Filter unsupported
+			FilterModules();
+			// Restore modules to make sure no changes left
+			if( VerifyAndRecoverModules() )
+			{
+				// Run reallyclean
+				switch ( m_eBuildSystem )
+				{
+				case SBS_V1:
+					RunReallyCleanSbs1();
+					break;
+				case SBS_V2:
+					RunReallyCleanSbs2();
+					break;
+				default:
+					break;
+				}
+				// Delete temporary dirs of modules
+				if(! DeleteTemporaryDirs() )
+				{
+					
+				}
+			}
+			else
+			{
+				
+			}
+		}
+	}
+	// Projects
+	if ( ! DirDelete( AT_TEMP_DIR, true ) )
+	{
+
+	}
+	else
+		bNothingFound = false;
+
+	if ( bNothingFound )
+		cout << AT_MSG << "Nothing found to clean." << endl;
+	else
+		cout << AT_MSG << "Cleaning done." << endl;
+	return iRetCode;
+}
+
+int CATProject::RunAnalyze()
+{
+	LOG_FUNC_ENTRY("CATProject::RunAnalyze");
+
+	// Parse data file if it is not data file.
+	if ( !IsDataFile( m_sDataFile ) )
+	{
+		m_sDataFileTemp.clear();
+		m_sDataFileTemp.append( m_sDataFile );
+		m_sDataFileTemp.append( ".atool" );
+
+		// make filename for file with cleaned timestamps
+		// <m_sDataFile>.cleaned in the same place as output file
+		string sTraceFileCleaned( GetPathOrFileName( false, m_sDataFileOutput ) );
+		sTraceFileCleaned.append( GetPathOrFileName( true, m_sDataFile ) );
+		sTraceFileCleaned.append( ".cleaned" );
+
+		//check if it is binary log file
+		if( IsBinaryLogFile( m_sDataFile ) )
+		{
+			// convert binary log file to ASCII trace format
+			m_sBinaryLogFileTemp.clear();
+		    m_sBinaryLogFileTemp.append( m_sDataFile );
+		    m_sBinaryLogFileTemp.append( ".totraces" );
+
+			cout << AT_MSG << "Parsing binary data file..." << endl;
+
+			CATParseBinaryFile Parser;
+			stringstream dataToParse;
+			if ( ! Parser.StartParse( m_sDataFile.c_str(), m_sBinaryLogFileTemp.c_str() ) )
+			{
+				return AT_RETURN_CODE::EMPTY_DATA_FILE;
+			}
+			m_sDataFile = m_sBinaryLogFileTemp;
+			
+		}
+		else
+		{
+			cout << AT_MSG << "Parsing trace file..." << endl;
+		}
+
+		CATParseTraceFile Parser;
+		if ( ! Parser.StartParse( m_sDataFile.c_str(), m_sDataFileTemp.c_str(), sTraceFileCleaned.c_str() ) )
+		{
+			return AT_RETURN_CODE::EMPTY_DATA_FILE;
+		}
+		m_sDataFile = m_sDataFileTemp;
+	}
+
+	// Init makefile member for this run mode.
+	if ( m_eBuildSystem == SBS_V1 )
+		InitSbs1MakeFileWithPathToTemp();
+	// Read makefile to get project attributes
+    if( ! ReadMakeFile() )
+	{
+		cout << AT_MSG << "Error, cannot find project build with AnalyzeTool." << endl;
+	}
+	else
+		FilterModules();
+
+	#ifndef ADDR2LINE
+	// Initialize modules locating code lines.
+	for( size_t i = 0 ; i < m_vModules.size() ; i++ )
+	{
+		m_vModules.at(i)->InitializeAddressToLine();
+	}
+	#endif
+
+	// Create analyzer
+	m_pAnalyzer = new CATDatParser( &m_vModules );
+
+	// Pass some info from project if it "exists" to analyzer.
+	if ( m_vModules.size() > 0 )
+	{
+		// Pass platform.
+		m_pAnalyzer->SetProjectPlatform( m_sPlatform );
+		// Pass build type.
+		m_pAnalyzer->SetProjectBuildType( m_eBuildType );
+	}
+	
+	// Set file.
+	m_pAnalyzer->SetInputFile( m_sDataFile );
+
+	// Set rom symbol file.
+	m_pAnalyzer->SetRomSymbolFiles( m_vRomSymbolFiles );
+
+	// Set output file if specified
+	if ( ! m_sDataFileOutput.empty() )
+	{
+		m_pAnalyzer->SetOutputFile( m_sDataFileOutput );
+	}
+	// Set log level
+	m_pAnalyzer->SetLogLevel( m_iLoggingLevel );
+
+	// Analyze
+	return m_pAnalyzer->Analyze();
+}
+
+int CATProject::RunInstrument()
+{
+	LOG_FUNC_ENTRY("CATProject::RunInstrument");
+	// Store attributes
+	if( ! MakeTempDirIfNotExist() )
+		return AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
+	if ( ! WriteAttributes() )
+		return AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
+	if ( m_eBuildSystem == SBS_V1 )
+	{
+		// Initialize level 1 make file member.
+		if ( ! InitSbs1MakeFileWithPath() )
+			return AT_RETURN_CODE::MAKEFILE_ERROR;
+		// Copy it to temporary folder.
+		CopyMakeFileSbs1ToTemporaryFolder();
+		// Run export.
+		if( ! RunExportSbs1() )
+			return AT_RETURN_CODE::MAKEFILE_ERROR;
+		// Create level 2 makefiles.
+		if ( ! CreateMakeFileSbs1Level2() )
+			return AT_RETURN_CODE::MAKEFILE_ERROR;
+	}
+	else if ( m_eBuildSystem == SBS_V2 )
+	{
+		// Create makefile only when using SBS v.2
+		if ( ! CreateMakeFile() )
+			return AT_RETURN_CODE::MAKEFILE_ERROR;
+	}
+	else
+	{
+		return AT_RETURN_CODE::UNKNOWN;
+	}
+	// Read makefile to get project attributes
+	if ( ! ReadMakeFile() )
+		return AT_RETURN_CODE::READ_MAKEFILE_ERROR;
+	// Filter unsupported
+	FilterModules();
+	// Check that we have some "valid" modules to hook
+	if ( m_vModules.size() == 0 &&(  m_vUnsupportedModules.size() > 0 || m_vStaticLibraries.size() > 0 ) )
+		return AT_RETURN_CODE::NO_SUPPORTED_MODULES_ERROR;
+
+	// Clean temporary dirs of modules
+	if ( ! CleanTemporaryDirs() )
+		return AT_RETURN_CODE::CLEANING_TEMP_ERROR;
+	// Create temporary cpps for modulse
+	if (! CreateTemporaryCpps() )
+		return AT_RETURN_CODE::CREATING_TEMP_CPP_ERROR;
+	// Hook modules
+	if (! ModifyModules() )
+		return AT_RETURN_CODE::MODIFY_MODULES_ERROR;
+	return AT_RETURN_CODE::OK;
+}
+
+int CATProject::RunInstrumentConsole()
+{
+	LOG_FUNC_ENTRY("CATProject::RunInstrumentConsole");
+	if( ! MakeTempDirIfNotExist() )
+		return AT_RETURN_CODE::UNKNOWN;
+	// Store attributes
+	m_bUninstrumented = false;
+	if ( ! WriteAttributes() )
+		return AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
+	// Create makefile
+	if ( ! CreateMakeFile() )
+		return AT_RETURN_CODE::MAKEFILE_ERROR;
+	// Read makefile to get project attributes
+	if ( ! ReadMakeFile() )
+		return AT_RETURN_CODE::READ_MAKEFILE_ERROR;
+	// Filter unsupported
+	FilterModules();
+	// Check that we have some "valid" modules to hook
+	if ( m_vModules.size() == 0 &&(  m_vUnsupportedModules.size() > 0 || m_vStaticLibraries.size() > 0 ) )
+		return AT_RETURN_CODE::NO_SUPPORTED_MODULES_ERROR;
+
+	// Clean temporary dirs of modules
+	if ( ! CleanTemporaryDirs() )
+		return AT_RETURN_CODE::CLEANING_TEMP_ERROR;
+	// Create temporary cpps for modulse
+	if (! CreateTemporaryCpps() )
+		return AT_RETURN_CODE::CREATING_TEMP_CPP_ERROR;
+	// Hook modules
+	if (! ModifyModules() )
+		return AT_RETURN_CODE::MODIFY_MODULES_ERROR;
+	// Run Reallyclean when using abld.
+	if ( m_eBuildSystem == SBS_V1 )
+		RunReallyCleanSbs1();
+	return AT_RETURN_CODE::OK;
+}
+
+int CATProject::RunUninstrument()
+{
+	LOG_FUNC_ENTRY("CATProject::RunUninstrument");
+	// Read attributes.
+	if ( ! ReadAttributes() )
+		return AT_RETURN_CODE::READ_ATTRIBUTES_ERROR;
+	// Init makefile member for this run mode.
+	if ( m_eBuildSystem == SBS_V1 )
+		InitSbs1MakeFileWithPathToTemp();
+	// Read makefile to get project attributes
+	if ( ! ReadMakeFile() )
+		return AT_RETURN_CODE::READ_MAKEFILE_ERROR;
+	// Filter unsupported
+	FilterModules();
+	// Check that we have some "valid" modules to hook
+	if ( m_vModules.size() == 0 &&(  m_vUnsupportedModules.size() > 0 || m_vStaticLibraries.size() > 0 ) )
+		return AT_RETURN_CODE::NO_SUPPORTED_MODULES_ERROR;
+	// Create lst files
+    if (! CreateListings() )
+		return AT_RETURN_CODE::COMPILE_ERROR;
+	// Copy releasables of modules
+	if (! CopyReleasables() )
+		return AT_RETURN_CODE::RELEASABLES_ERROR;
+	// Restore "unhook" modules
+	if (! RestoreModules() )
+		return AT_RETURN_CODE::RESTORE_MODULES_ERROR;
+	// Return error code OK
+	return AT_RETURN_CODE::OK;
+}
+
+int CATProject::RunUninstrumentConsole()
+{
+	LOG_FUNC_ENTRY("CATProject::RunUninstrumentConsole");
+	int iErrorCode = AT_RETURN_CODE::OK;
+	// Read attributes
+	if ( ReadAttributes() )
+	{
+		// Init makefile member for this run mode.
+		if ( m_eBuildSystem == SBS_V1 )
+			InitSbs1MakeFileWithPathToTemp();
+		// Read makefile to get project attributes
+		if( ReadMakeFile() )
+		{
+			// Filter unsupported
+			FilterModules();
+			// Create lst files
+			CreateListings();
+			if (! CopyReleasables() )
+				iErrorCode = AT_RETURN_CODE::RELEASABLES_ERROR;
+		}
+		else
+			iErrorCode = AT_RETURN_CODE::READ_MAKEFILE_ERROR;
+		// Change state to uninstrumented and write status
+		m_bUninstrumented = true;
+		if ( ! WriteAttributes() )
+			iErrorCode = AT_RETURN_CODE::WRITE_ATTRIBUTES_ERROR;
+	}
+	else
+	{
+		iErrorCode = AT_RETURN_CODE::READ_ATTRIBUTES_ERROR;
+	}
+	return iErrorCode;
+}
+
+int CATProject::RunUninstrumentFailed()
+{
+	LOG_FUNC_ENTRY("CATProject::RunUninstrumentFailed");
+	// Read attributes.
+	if ( ! ReadAttributes() )
+		return AT_RETURN_CODE::READ_ATTRIBUTES_ERROR;
+	// Init makefile member for this run mode.
+	if ( m_eBuildSystem == SBS_V1 )
+		InitSbs1MakeFileWithPathToTemp();
+	// Read makefile to get project attributes
+	if( ReadMakeFile() )
+	{
+		// Filter modules
+		FilterModules();
+		// Restore modules to make sure no changes left
+		if( RestoreModules() )
+		{
+			// Delete temporary dirs of modules
+			if(! DeleteTemporaryDirs() )
+			{
+
+			}
+
+		}
+		else
+		{
+
+		}
+	}
+	else
+	{
+
+	}
+	// Projects
+	if ( ! DirDelete( AT_TEMP_DIR, true ) )
+	{
+
+	}
+	return AT_RETURN_CODE::OK;
+}
+
+// ----------------------------------------------------------------------------
+// Main Functions
+// ----------------------------------------------------------------------------
+void CATProject::DisplayCompileSummary()
+{
+	LOG_FUNC_ENTRY("CATProject::DisplayCompileSummary");
+	cout << AT_BUILD_SUMMARY_HEADER;
+	// Supported modules
+	for( size_t i = 0; i < m_vModules.size(); i++ )
+	{
+		// Successful
+		if ( m_vModules.at(i)->GetErrors().empty() )
+		{
+			// Create build complete file for Carbide xtension
+			m_vModules.at(i)->CreateBuildCompleteFile();
+			cout << AT_BUILD_SUMMARY_INSTRUMENTED_BUILD_COMPLETE
+				<< GetPathOrFileName( true, m_vModules.at(i)->GetMmpFile() )
+				<< endl
+				<< AT_BUILD_SUMMARY_TARGET
+				<< m_vModules.at(i)->GetBinaryName()
+				<< endl;
+			// Datafiles
+			// Use module data file name if project's data file not defined.
+			if ( m_eLoggingMode == CATProject::FILE 
+				&& m_vModules.at(i)->GetTargetType().compare("exe") == 0 )
+			{
+				cout << AT_BUILD_SUMMARY_DATA_FILE_NAME
+						<< m_vModules.at(i)->GetS60FileName()
+						<< endl;
+
+				// if filePath not empty, use it for log file
+				if ( !m_sS60FilePath.empty() )
+				{
+					cout << AT_BUILD_SUMMARY_DATA_FILE_PATH
+					<< m_sS60FilePath
+					<< endl;
+				}
+			}
+		}
+		else
+		{
+			// Failed
+			cout << AT_BUILD_SUMMARY_FAILED
+				<< GetPathOrFileName( true, m_vModules.at(i)->GetMmpFile() )
+				<< endl
+				<< AT_BUILD_SUMMARY_TARGET
+				<< m_vModules.at(i)->GetBinaryName()
+				<< endl;
+			// Print errors.
+			cout << AT_BUILD_SUMMARY_ERRORS
+				<< m_vModules.at(i)->GetErrors()
+				<< endl;
+		}
+	}
+
+	// Static libraries
+	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
+	{
+		if ( m_vStaticLibraries.at(i)->GetErrors().empty() )
+		{
+			cout << AT_BUILD_SUMMARY_NORMAL_BUILD_COMPLETE
+				<< GetPathOrFileName( true, m_vStaticLibraries.at(i)->GetMmpFile())
+				<< endl
+				<< AT_BUILD_SUMMARY_TARGET
+				<< m_vStaticLibraries.at(i)->GetBinaryName()
+				<< endl
+				<< AT_BUILD_SUMMARY_STATIC_LIBRARY
+				<< endl;
+				
+		}
+		else
+		{
+			// Failed
+			cout << AT_BUILD_SUMMARY_FAILED
+				<< GetPathOrFileName( true, m_vStaticLibraries.at(i)->GetMmpFile() )
+				<< endl
+				<< AT_BUILD_SUMMARY_TARGET
+				<< m_vStaticLibraries.at(i)->GetBinaryName()
+				<< endl;
+			// Print errors.
+			cout << AT_BUILD_SUMMARY_ERRORS
+				<< m_vStaticLibraries.at(i)->GetErrors()
+				<< endl;
+		}
+	}
+
+	// Unsupported modules
+	for( size_t i = 0; i < m_vUnsupportedModules.size(); i++ )
+	{
+		cout << AT_BUILD_SUMMARY_NORMAL_BUILD_COMPLETE
+			<< GetPathOrFileName( true, m_vUnsupportedModules.at(i)->GetMmpFile() )
+			<< endl
+			<< AT_BUILD_SUMMARY_TARGET
+			<< m_vUnsupportedModules.at(i)->GetBinaryName()
+			<< endl;
+		cout << m_vUnsupportedModules.at(i)->GetCompileInfoText() << endl;
+	}
+}
+
+void CATProject::DisplayBuildSummary( void )
+{
+	LOG_FUNC_ENTRY("CATProject::DisplayBuildSummary");
+	cout << endl;
+	// Build information
+	cout << AT_BUILD_SUMMARY_BUILD_TYPE << GetBuildTypeString() << endl;
+	// Platform
+	cout << AT_BUILD_SUMMARY_BUILD_PLATFORM << m_sPlatform << endl;
+	// Possible variant
+	if ( ! m_sVariant.empty() )
+		cout << AT_BUILD_SUMMARY_BUILD_VARIANT << m_sVariant << endl;
+	// Logging mode
+	cout << AT_BUILD_SUMMARY_LOGGING_MODE;
+	if ( m_eLoggingMode == FILE )
+		cout  << AT_BUILD_SUMMARY_FILE;
+	else if ( m_eLoggingMode == TRACE )
+		cout << AT_BUILD_SUMMARY_TRACE;
+	else if ( m_eLoggingMode == TRACE_FAST )
+		cout << AT_BUILD_SUMMARY_TRACE_FAST;
+	cout << endl;
+	// Call stack sizes
+	cout << AT_BUILD_SUMMARY_ALLOC_CALL_STACK_SIZE
+		<< m_iAllocCallStackSize
+		<< endl;
+	cout << AT_BUILD_SUMMARY_FREE_CALL_STACK_SIZE
+		<< m_iFreeCallStackSize
+		<< endl;
+
+	if(!_stricmp(m_sPlatform.c_str(), ("winscw")))
+	{
+		//print version info only when version is not up-to-date
+		cout << endl;
+		showDbgHelpVersionInfo( false );
+	}
+}
+
+bool CATProject::CreateMakeFile()
+{
+	switch ( m_eBuildSystem )
+	{
+	case SBS_V1:
+		if( ! CreateMakeFileSbs1() )
+			return false;
+		// Copy main make file.
+		if( ! CopyMakeFileSbs1ToTemporaryFolder() )
+			return false;
+		// Run export.
+		if( ! RunExportSbs1() )
+			return false;
+		// Create level 2 makefiles.
+		if( ! CreateMakeFileSbs1Level2() )
+			return false;
+		return true;
+	case SBS_V2:
+		return CreateMakeFileSbs2();
+	default:
+		return false;
+	}
+}
+
+bool CATProject::CreateMakeFileSbs1()
+{
+	LOG_FUNC_ENTRY("CATProject::CreateMakeFileSbs1");
+
+	// If variant defined check does it exist.
+	if( ! m_sVariant.empty() )
+	{
+		if ( ! CheckVariant( m_sEpocRoot, m_sVariant ) )
+		{
+			cout << INVALID_VARIANT_ERROR;
+			if ( IsDefaultVariant( m_sEpocRoot ) )
+			{
+				m_sVariant = "default";
+				cout << USING_DEFAULT_VARIANT_MESSAGE;
+				if ( ! WriteAttributes() )
+					return false;
+			}
+			else
+			{
+				cout << NO_DEFAULT_VARIANT_ERROR;
+				return false;
+			}
+		}
+	}
+
+	// Create level 1 make file.
+	string sCmd( "bldmake bldfiles " );
+	sCmd.append( m_sPlatform );
+	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
+	(void)system( sCmd.c_str() );
+	return InitSbs1MakeFileWithPath();
+}
+
+bool CATProject::CopyMakeFileSbs1ToTemporaryFolder()
+{
+	LOG_FUNC_ENTRY("CATProject::CopyMakeFileSbs1ToTemporaryFolder");
+	// Check that temporary dir exists if not create it.
+	if ( ! MakeTempDirIfNotExist() )
+		return false;
+	// Copy makefile to temporary directory
+	string sMakeFileInTemp( AT_TEMP_DIR );
+	sMakeFileInTemp.append( "\\" );
+	sMakeFileInTemp.append( AT_LEVEL_1_MAKEFILE_NAME );
+	if ( ! FileCopyToPath( m_sMakeFile, sMakeFileInTemp ) )
+		return false;
+	return true;
+
+}
+
+bool CATProject::RunReallyCleanSbs1()
+{
+	LOG_FUNC_ENTRY("CATProject::RunReallyCleanSbs1");
+	// Check that abld.bat has been made.
+	if ( ! FileExists( "abld.bat" ) )
+		return false;
+	// Run reallyclean.
+	string sCmd;
+	if ( m_bAbldTest )
+		sCmd = "abld test reallyclean ";
+	else
+		sCmd = "abld reallyclean ";
+	sCmd.append( m_sPlatform );
+	if ( ! m_sVariant.empty() )
+	{
+		sCmd.append( "." );
+		sCmd.append( m_sVariant );
+	}
+	sCmd.append( " " );
+	sCmd.append( GetBuildTypeString() );
+	if ( m_vTargetModules.size() > 1 )
+	{
+		RunAbldCommandToAllTargets( sCmd );
+	}
+	else
+	{
+		AddTargetModuleIfDefined( sCmd );
+		cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
+		(void) system( sCmd.c_str() );
+	}
+	return true;
+}
+
+bool CATProject::RunReallyCleanSbs2()
+{
+	LOG_FUNC_ENTRY("CATProject::RunReallyCleanSbs2");
+	string sCmd("");
+	if ( m_sBuildCommand.empty() )
+	{
+		// If no build command defined (not found in project.cfg).
+		sCmd.append( RAPTOR_CMD_BASE );;
+		sCmd.append( m_sPlatform );
+		sCmd.append( "_" );
+		sCmd.append( GetBuildTypeString() );
+		if ( ! m_sVariant.empty() )
+		{
+			sCmd.append( "." );
+			sCmd.append( m_sVariant );
+		}
+		sCmd.append( RAPTOR_REALLYCLEAN_LOG );
+		AddTargetModuleIfDefined( sCmd );
+		sCmd.append( " REALLYCLEAN" );
+	}
+	else
+	{
+		// When build command set use it.
+		sCmd.append( m_sBuildCommand );
+		sCmd.append( RAPTOR_REALLYCLEAN_LOG );
+		sCmd.append( " REALLYCLEAN" );
+	}
+	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
+	int iRet = (int)system( sCmd.c_str() );
+	if ( iRet == 0 )
+		return true;
+	return false;
+}
+
+bool CATProject::RunExportSbs1()
+{
+	LOG_FUNC_ENTRY("CATProject::RunExportSbs1");
+	// Run export.
+	string sCmd;
+	if ( m_bAbldTest )
+		sCmd = "abld test export";
+	else
+		sCmd = "abld export";
+	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
+	(void) system( sCmd.c_str() );
+	return true;
+}
+
+bool CATProject::CreateMakeFileSbs1Level2()
+{
+	LOG_FUNC_ENTRY("CATProject::CreateMakeFileSbs1Level2");
+	// Create level 2 makefiles.
+	
+	string sCmd;
+	
+	if ( m_bAbldTest )
+		sCmd ="abld test makefile ";
+	else
+		sCmd ="abld makefile ";
+
+	sCmd.append( m_sPlatform );
+	if ( ! m_sVariant.empty() )
+	{
+		sCmd.append( "." );
+		sCmd.append( m_sVariant );
+	}
+	
+	// Check if multiple targets defined and sbs 1.
+	if ( m_vTargetModules.size() > 1 )
+	{
+		RunAbldCommandToAllTargets( sCmd );
+	}
+	else
+	{
+		AddTargetModuleIfDefined( sCmd );
+		cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
+		(void) system( sCmd.c_str() );
+	}
+	return true;
+}
+
+bool CATProject::CreateMakeFileSbs2()
+{
+	LOG_FUNC_ENTRY("CATProject::CreateMakeFileSbs2");
+	// Delete build directory if it exists before creating new makefiles.
+	if ( DirectoryExists( "atool_temp\\build" ) )
+		DirDelete( "atool_temp\\build", true );
+	// Create command to create makefiles.
+	string sCmd( m_sBuildCommand );
+	sCmd.append( " " );
+	sCmd.append( RAPTOR_MAKEFILE_SWITCH );
+	sCmd.append( " " );
+	sCmd.append( RAPTOR_NOBUILD_SWITCH );
+	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
+	int iRet = (int)system( sCmd.c_str() );
+	if ( iRet == 0 )
+		return true;
+	return false;
+}
+
+bool CATProject::ReadMakeFile()
+{
+	// Clean modules before reading.
+	CleanModuleVectors();
+	if ( m_eBuildSystem == SBS_V1 )
+	{
+		// Read level 1 makefile which contains module name and makefiles.
+		if( ! ReadMakeFileSbs1Level1() )
+			return false;
+		// Read level 2 makefiles.
+		vector<CATModule2*>::iterator it;
+		// If we are compiling or etc... we need to create temporary directories.
+		if ( m_eMode == COMPILE || m_eMode == INSTRUMENT || m_eMode == INSTRUMENT_CONSOLE )
+		{
+			// Read make makefiles from /epoc32/build... and create temporary directory.
+			bool bLevel2 = true;
+			for( it = m_vModules.begin(); it != m_vModules.end() ; it ++ )
+			{
+				if( ! (*it)->CreateTemporaryDirectory() )
+					return false;
+				if( ! (*it)->ReadMakeFile() )
+				{
+					bLevel2 = false;
+					break;
+				}
+			}
+			// If failed reading modules from level 2 makefiles.
+			if ( ! bLevel2 )
+			{
+				// Clean modules.
+				CleanModuleVectors();
+				// Try use default variant if it exists.
+				if ( CheckVariant( m_sEpocRoot, "default" ) )
+				{
+					m_sVariant = "default";
+					cout << USING_DEFAULT_VARIANT_MESSAGE;
+					if ( ! WriteAttributes() )
+						return false;
+					if ( ! InitSbs1MakeFileWithPath() )
+						return false;
+					if ( ! ReadMakeFileSbs1Level1() )
+						return false;
+					for( it = m_vModules.begin(); it != m_vModules.end() ; it ++ )
+					{
+						if( ! (*it)->CreateTemporaryDirectory() )
+							return false;
+						if( ! (*it)->ReadMakeFile() )
+							return false;
+					}
+
+				}
+			}
+		}
+		else
+		{
+			// Read make files from temporary directories.
+			for( it = m_vModules.begin(); it != m_vModules.end() ; it ++ )
+			{
+				if ( ! (*it)->ReadMakeFileFromTemp() )
+					return false;
+			}
+		}
+		return true;
+	}
+	else if ( m_eBuildSystem == SBS_V2 )
+	{
+		// Read make file.
+		if( ! ReadMakeFileSbs2() )
+			return false;
+		// Create module temporary directories if we are compiling or etc...
+		if ( m_eMode == COMPILE || m_eMode == INSTRUMENT || m_eMode == INSTRUMENT_CONSOLE )
+			{
+			for( vector<CATModule2*>::iterator it = m_vModules.begin(); it < m_vModules.end(); it++ )
+				(*it)->CreateTemporaryDirectory();
+			for( vector<CATModule2*>::iterator it = m_vStaticLibraries.begin(); it < m_vStaticLibraries.end(); it++ )
+				(*it)->CreateTemporaryDirectory();
+			}
+	}
+	return true;
+}
+
+bool CATProject::ReadMakeFileSbs1Level1()
+{
+	LOG_FUNC_ENTRY("CATProject::ReadMakeFileSbs1Level1");
+
+	bool bRet = false;
+
+	//Try to open makefile
+	ifstream in;
+	in.open( m_sMakeFile.c_str() );
+
+	//File open ok?
+	if( !in.good() )
+	{
+		printf( "Can not open file: %s\n", m_sMakeFile.c_str() );
+		in.close();
+		return bRet;
+	}
+
+	// Add also these so "compatible with sbs2".
+	// Releasables path (binaries).
+	string sReleasePath( m_sEpocRoot );
+	// add trailing '\' if root path is missing it
+	if ( sReleasePath.size() < 1 )
+		sReleasePath.append( "\\" );
+	else if ( sReleasePath.at( sReleasePath.length() -1 ) != '\\' )
+		sReleasePath.append( "\\" );
+	sReleasePath.append( "epoc32\\release" );
+	string sFullVariantPath( m_sPlatform );
+	sFullVariantPath.append( "\\" );
+	sFullVariantPath.append( GetBuildTypeString() );
+
+	char cTemp[MAX_LINE_LENGTH];
+	bool bContinueSearch = true;
+	bool bMmpInfoFound = false;
+	CATModule2* pModule = 0;
+	string sTempLineFromFile;
+	string sMmpFileSearchString;
+	if ( m_bAbldTest )
+		sMmpFileSearchString = MMPTESTFILE_SEARCH_STRING;
+	else
+		sMmpFileSearchString = MMPFILE_SEARCH_STRING;
+	do
+	{
+		// get line from file
+		in.getline( cTemp, MAX_LINE_LENGTH );
+		sTempLineFromFile.clear();
+		sTempLineFromFile.append( cTemp );
+
+		//Search makefile string
+		if( sTempLineFromFile.find( MAKEFILE_SEARCH_STRING ) != string::npos )
+		{
+			bMmpInfoFound = true;
+			if( sTempLineFromFile.find( sMmpFileSearchString ) != string::npos )
+			{
+				bRet = true;
+				//Parse mmp path + mmp filename
+				sTempLineFromFile.erase( 0, sTempLineFromFile.find_first_of("\"") );
+				sTempLineFromFile.erase( 0, 1 );
+
+				string sPath = sTempLineFromFile.substr(0, sTempLineFromFile.find_first_of("\"") );
+
+				sPath = ChangeSlashToBackSlash( sPath );
+				//Remove text "bld.inf"
+				sPath.erase( (sPath.find_last_of( "\\" ) + 1) , string::npos );
+
+				string sFileName = sTempLineFromFile.substr( (sTempLineFromFile.find( sMmpFileSearchString ) + sMmpFileSearchString.length() + 3), string::npos );
+				sFileName = ChangeSlashToBackSlash( sFileName );
+				sFileName = sFileName.substr( 0, sFileName.find_first_of("\"") );
+
+				// Append .mmp to filename if it does not exist
+				if ( sFileName.find(".mmp") == string::npos )
+					sFileName.append(".mmp");
+
+				//Insert drive letter
+				sPath.insert(0, string( m_cCurrentDir).substr(0,2) );
+		
+				//Insert mmp file to the end
+				sPath.append( sFileName );
+
+				ChangeToLower( sPath );
+				
+				// If target programs defined find from those or do not
+				// add module to vector.
+				bool bAddToVector = true;
+				if ( m_vTargetModules.size() > 0 )
+				{
+					bAddToVector = false;
+					vector<string>::iterator it;
+					for( it = m_vTargetModules.begin() ; it != m_vTargetModules.end() ; it++ )
+					{
+						string sFind( *it );
+						sFind.insert( 0, "\\" );
+						if ( sPath.find( sFind ) != string::npos )
+						{
+							bAddToVector = true;
+							break;
+						}
+					}	
+				}
+
+				if ( bAddToVector )
+				{
+					pModule = new CATModule2();
+					pModule->SetMmpFile( sPath );
+					pModule->SetVariantType( GetBuildTypeString() );
+					pModule->SetVariantPlatform( m_sPlatform );
+					pModule->SetReleasePath( sReleasePath );
+					pModule->SetFullVariantPath( sFullVariantPath );
+					pModule->SetBuildSystem( SBS_V1 );
+					m_vModules.push_back( pModule );
+				}
+			}
+		}
+		else if( bMmpInfoFound )
+			//Do not continue search if mmp info lines are all handled
+			bContinueSearch = false;
+		if( !in.good() )
+			bContinueSearch = false;
+	}
+	while( bContinueSearch );
+
+	bContinueSearch = true;
+
+	//Search MAKEFILES for invidual modules
+	do
+	{
+		in.getline( cTemp, MAX_LINE_LENGTH );
+		sTempLineFromFile.clear();
+		sTempLineFromFile.append( cTemp );
+		// find the lines 'MAKEFILE[modulename]_FILES'
+		if( (sTempLineFromFile.find( "MAKEFILE" ) == 0) && (sTempLineFromFile.find( "_FILES" ) != string::npos) )
+		{
+			//Math the makefile line with one of our modules
+			for( size_t i = 0 ; i < m_vModules.size() ; i++ )
+			{
+				//Create name
+				string sMakeFile( "MAKEFILE" );
+				string sTempMmpFile( RemovePathAndExt( m_vModules.at(i)->GetMmpFile(), true ) );
+				ChangeToUpper( sTempMmpFile );
+				sMakeFile.append( sTempMmpFile );
+				sMakeFile.append( "_FILES" );
+				// matched
+				if( sTempLineFromFile.find( sMakeFile ) != string::npos )
+				{
+					//parse the makefile name from line
+					in.getline( cTemp, MAX_LINE_LENGTH );
+					sTempLineFromFile.clear();
+					sTempLineFromFile.append( cTemp );
+					//Remove character "\""
+					sTempLineFromFile.erase( 0, ( sTempLineFromFile.find_first_of("\"") + 1 ) );
+					// in winscw last part is '" \' and on armd '"' so remove all after last '"'
+					sTempLineFromFile.erase( sTempLineFromFile.find_last_of("\""), sTempLineFromFile.size() );
+					// Set correct makefile for module
+					m_vModules.at( i )->SetMakeFile( sTempLineFromFile );
+					// break 
+					break;
+				} // If mathed to mmp
+			} // End of mmp file loop
+		} // found lines 'MAKEFILE[modulename]_FILES'
+		if( !in.good() )
+			bContinueSearch = false;
+	}
+	while( bContinueSearch );
+	in.close();
+	return bRet;
+}
+
+bool CATProject::ReadMakeFileSbs2( void )
+{
+	LOG_FUNC_ENTRY("CATProject::ReadMakeFileSbs2(void)");
+	// File is by default named make_build.default but when building specific layer
+	// make_build_LAYERNAME.default is produced by Raptor.
+	// So find makefile(s) and read them.
+	vector<string> vMakeFiles = DirList( "atool_temp\\build\\", false, true );
+	bool bRet = true;
+	for( vector<string>::iterator it = vMakeFiles.begin(); it != vMakeFiles.end() ; it++ )
+	{
+		// Recognize multiple makefiles.
+		if ( it->find("make_build_") != string::npos && it->find(".default") != string::npos )
+		{
+			if ( ! ReadMakeFileSbs2( *it ) )
+				bRet = false;
+		}
+		// Single makefile.
+		else if ( it->find( "make_build.default" ) != string::npos )
+		{
+			if ( ! ReadMakeFileSbs2( *it ) )
+				bRet = false;
+		}
+	}
+	// We got some modules?
+	if ( m_vModules.size() == 0 )
+		bRet = false;
+	return bRet;
+}
+
+bool CATProject::ReadMakeFileSbs2( string& sMakeFile )
+{
+	LOG_FUNC_ENTRY("CATProject::ReadMakeFileSbs2(string)");
+	try {
+		// Open file
+		ifstream in;
+		in.open( sMakeFile.c_str() , ios_base::in );
+		// Check that open ok
+		if ( ! in.good() )
+		{
+			cout << AT_MSG << "Error, opening file "
+				<< RAPTOR_MAKEFILE << endl;
+			in.close();
+			return false;
+		}
+		// Source line from file
+		string sSourceLine;
+		// Module pointer
+		CATModule2* pModule = 0;
+		// Are we looking for module attributes
+		bool bFindAttributes = false;
+		// Until end of file
+		while( in.good() )
+		{
+			// Get new line from file
+			string sLine;
+			getline(in, sLine);
+			// New module
+			if ( sLine.find( RAPTOR_PROJECT_META ) == 0 )
+			{
+				// Remove project_meta from line
+				sLine.erase(0, strlen( RAPTOR_PROJECT_META ) );
+				LOG_STRING("Found module: " << sLine );
+				// Check is name empty
+				// This seems to happen when sbs2 "wraps" i.e. mifconv to a module type item
+				if ( sLine.empty() )
+				{
+					LOG_STRING("skipping empty module");
+					// Skip it
+					continue;
+				}
+				// If module add it to vector
+				if ( pModule )
+				{
+					// Add sources,
+					pModule->AddSources( sSourceLine );
+					// Build system.
+					pModule->SetBuildSystem( SBS_V1 );
+					// Push to vector.
+					m_vModules.push_back( pModule );
+				}
+				// New module
+				pModule = new CATModule2();
+				// Clear sourceline
+				sSourceLine.clear();
+				// Set modules mmp with path
+
+				if ( ! pModule->SetMmpFile( sLine ) )
+				{
+					// Fatal error setting mmp file
+					in.close();
+					return false;
+				}
+				// Find attributes on
+				bFindAttributes = true;
+				// Get new line from file
+				getline(in, sLine);
+			}
+			// If attribute finding on
+			if ( bFindAttributes )
+			{
+				// Pickup modules attributes
+				if ( sLine.find ( RAPTOR_SOURCE ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_SOURCE ) );
+					sSourceLine = sLine;
+				}
+				else if ( sLine.find ( RAPTOR_TARGET ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_TARGET ) );
+					pModule->SetTarget( sLine );
+				}
+				else if ( sLine.find ( RAPTOR_TARGETYPE ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_TARGETYPE ));
+					pModule->SetTargetType( sLine );
+				}
+				else if ( sLine.find( RAPTOR_REQUESTEDTARGETEXT ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_REQUESTEDTARGETEXT ) );
+					pModule->SetRequestedTargetExt( sLine );
+				}
+				else if ( sLine.find ( RAPTOR_VARIANTPLATFORM ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_VARIANTPLATFORM ));
+					pModule->SetVariantPlatform( sLine );
+				}
+				else if ( sLine.find ( RAPTOR_VARIANTTYPE ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_VARIANTTYPE ));
+					pModule->SetVariantType( sLine );
+				}
+				else if ( sLine.find ( RAPTOR_FEATUREVARIANT ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_FEATUREVARIANT ));
+					pModule->SetFeatureVariant( sLine );
+				}
+				else if ( sLine.find ( RAPTOR_FEATUREVARIANTNAME ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_FEATUREVARIANTNAME ));
+					pModule->SetFeatureVariantName( sLine );
+				}
+				else if ( sLine.find ( RAPTOR_RELEASEPATH ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_RELEASEPATH ));
+					pModule->SetReleasePath( sLine );
+				}
+				else if ( sLine.find ( RAPTOR_FULLVARIANTPATH ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_FULLVARIANTPATH ));
+					pModule->SetFullVariantPath( sLine );
+				}
+				else if ( sLine.find ( RAPTOR_COMPILE_DEFINITIONS ) == 0 )
+				{
+					sLine.erase(0, strlen( RAPTOR_COMPILE_DEFINITIONS ) );
+					pModule->SetCompileDefinitions( sLine );
+				}
+			}
+		} // while in.good()
+		// Add last module if n number of modules found
+		if ( pModule )
+		{
+			if ( ! pModule->GetTarget().empty() )
+			{
+				// Add sources
+				pModule->AddSources( sSourceLine );
+				// Build system.
+				pModule->SetBuildSystem( SBS_V1 );
+				// Push back to vector
+				m_vModules.push_back( pModule );
+			}
+		}
+		// Close file
+		in.close();
+		return true;
+	} // try.
+	catch(...)
+	{
+		LOG_STRING("Unexpected exception reading sbs 2 makefile");
+		return false;
+	}
+}
+bool CATProject::CreateTemporaryDirectories()
+{
+	LOG_FUNC_ENTRY("CATProject::CreateTemporaryDirectories");
+	bool bRet = true;
+	for( size_t i = 0 ; i < m_vModules.size(); i++)
+	{
+		if( ! m_vModules.at(i)->CreateTemporaryDirectory() )
+			bRet = false;
+	}
+	for( size_t i = 0 ; i < m_vStaticLibraries.size(); i++)
+	{
+		if( ! m_vStaticLibraries.at(i)->CreateTemporaryDirectory() )
+			bRet = false;
+	}
+	return bRet;
+
+}
+
+bool CATProject::CreateTemporaryCpps()
+{
+	LOG_FUNC_ENTRY("CATProject::CreateTemporaryCpps");
+	bool bRet = true;
+	for( size_t i = 0 ; i < m_vModules.size(); i++)
+	{
+		if( ! m_vModules.at(i)->CreateTempCpp(
+			m_sS60FileName, m_sS60FilePath, m_eLoggingMode, m_eBuildType, m_iAllocCallStackSize, m_iFreeCallStackSize ) )
+			bRet = false;
+	}
+	return bRet;
+}
+
+bool CATProject::FilterModules()
+{
+	LOG_FUNC_ENTRY("CATProject::FilterModules");
+	vector<CATModule2*>::iterator it;
+	// Loop thru modules.
+	it = m_vModules.begin();
+	while( it != m_vModules.end() )
+	{
+		// Get target type of module to separate string (will be modified).
+		string sTargetType = (*it)->GetTargetType();
+		// Modules compile definitions.
+		string sCompileDefinition = (*it)->GetCompileDefinitions();
+		// Check is it supported.
+		if ( !IsTargetTypeSupported( sTargetType) )
+		{
+			(*it)->SetCompileInfoText( AT_UNSUPPORTED_TARGET_TYPE );
+			// Not supported add to not supported vector.
+			m_vUnsupportedModules.push_back( *it );
+			// Erase cell.
+			it = m_vModules.erase( it );
+		}
+		// Check if its static library
+		else if ( _stricmp( sTargetType.c_str(), "lib" ) == 0 )
+		{
+			// Static librarie move to their vector.
+			m_vStaticLibraries.push_back( *it );
+			// Erase cell.
+			it = m_vModules.erase( it );
+		
+		}
+		else if ( sCompileDefinition.find( KERNEL_MODE_COMPILE_DEFINITION ) != string::npos )
+		{
+			(*it)->SetCompileInfoText( AT_UNSUPPORTED_COMPILE_DEFINITION );
+			// Not supported add to not supported vector.
+			m_vUnsupportedModules.push_back( *it );
+			// Erase cell.
+			it = m_vModules.erase( it );
+		}
+		else
+			it++;
+	}
+	return true;
+}
+
+bool CATProject::ModifyModules()
+{
+	LOG_FUNC_ENTRY("CATProject::ModifyModules");
+	bool bRet = true;
+	for( size_t i = 0; i < m_vModules.size(); i++ )
+	{
+		if (! m_vModules.at(i)->ModifyMmp() )
+			bRet = false;
+	}
+	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
+	{
+		if (! m_vStaticLibraries.at(i)->ModifyMmp() )
+			bRet = false;
+	}
+	return bRet;
+}
+
+bool CATProject::RestoreModules()
+{
+	LOG_FUNC_ENTRY("CATProject::RestoreModules");
+	bool bRet = true;
+	for( size_t i = 0; i < m_vModules.size(); i++ )
+	{
+		if (! m_vModules.at(i)->RestoreMmp() )
+			bRet = false;
+	}
+	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
+	{
+		if (! m_vStaticLibraries.at(i)->RestoreMmp() )
+			bRet = false;
+	}
+	return bRet;
+}
+
+bool CATProject::VerifyAndRecoverModules()
+{
+	LOG_FUNC_ENTRY("CATProject::VerifyAndRecoverModules");
+	bool bRet = true;
+	for( size_t i = 0; i < m_vModules.size(); i++ )
+	{
+		if (! m_vModules.at(i)->VerifyAndRecoverMmp() )
+			bRet = false;
+	}
+	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
+	{
+		if (! m_vStaticLibraries.at(i)->VerifyAndRecoverMmp() )
+			bRet = false;
+	}
+	return bRet;
+}
+bool CATProject::Compile()
+{
+	switch ( m_eBuildSystem )
+	{
+	case SBS_V1:
+		// Run Reallyclean.
+		if( ! RunReallyCleanSbs1() )
+			return false;
+		return CompileSbs1();
+	case SBS_V2:
+		return CompileSbs2();
+	default:
+		return false;
+	}
+}
+
+bool CATProject::CompileSbs1()
+{
+	LOG_FUNC_ENTRY("CATProject::CompileSbs1");
+	string sCommand("");
+	if ( m_sBuildCommand.empty() )
+	{
+		sCommand = "abld build";
+		// -debug if urel
+		if ( m_eBuildType == UREL )
+			sCommand.append( " -debug" );
+
+		// No variant
+		if ( m_sVariant.empty() )
+		{
+			sCommand.append( " " );
+			sCommand.append( m_sPlatform );
+		}
+		else
+		{
+			// Add variant
+			sCommand.append( " " );
+			sCommand.append( m_sPlatform );
+			sCommand.append( "." );
+			sCommand.append( m_sVariant );
+		}
+
+		// urel vs udeb
+		sCommand.append( " " );
+		sCommand.append( GetBuildTypeString() );
+
+		// Possible target module
+		AddTargetModuleIfDefined( sCommand );
+	}
+	// Check that build command contains -debug switch if sbs v.1 used
+	else if ( ! m_sBuildCommand.empty() 
+		&& m_eBuildType == UREL 
+		&& m_eBuildSystem == SBS_V1 
+		&& m_sBuildCommand.find( "-debug" ) == string::npos )
+	{
+		// Find correct index to insert -debug switch
+		size_t iPos = m_sBuildCommand.find( "build" );
+		if ( iPos != string::npos )
+		{
+			sCommand = m_sBuildCommand;
+			sCommand.insert( iPos+5, " -debug" );
+		}
+		else
+		{
+			LOG_STRING("Overwriting given build command to add -debug switch. Original command is: " << m_sBuildCommand );
+			if ( m_bAbldTest )
+				sCommand = "abld test build -debug ";
+			else
+				sCommand = "abld build -debug ";
+			// No variant
+			if ( m_sVariant.empty() )
+			{
+				sCommand.append( m_sPlatform );
+			}
+			else
+			{
+				// Add variant
+				sCommand.append( m_sPlatform );
+				sCommand.append( "." );
+				sCommand.append( m_sVariant );
+			}
+
+			// urel vs udeb
+			sCommand.append( " " );
+			sCommand.append( GetBuildTypeString() );
+			// Possible target module
+			AddTargetModuleIfDefined( sCommand );
+		}
+	}
+	else
+		sCommand = m_sBuildCommand;
+	// Run command
+	cout << AT_MSG_SYSTEM_CALL << sCommand << endl;
+	(void)system( sCommand.c_str() );
+	return true;
+}
+
+bool CATProject::CompileSbs2()
+{
+	LOG_FUNC_ENTRY("CATProject::CompileSbs2");
+	// Create command to compile with raptor
+	string sCmd( m_sBuildCommand );
+	sCmd.append( RAPTOR_BUILD_LOG );
+	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
+	int iRet = (int)system( sCmd.c_str() );
+	if ( iRet == 0 )
+		return true;
+	return false;
+}
+
+bool CATProject::CreateListings()
+{
+	// Create listings if no addr2line defined
+	#ifndef ADDR2LINE
+	if ( _stricmp( m_sPlatform.c_str(), "armv5" ) == 0 )
+	{
+		switch ( m_eBuildSystem )
+		{
+		case SBS_V1:
+			return CreateListingsSbs1();
+		case SBS_V2:
+			return CreateListingsSbs2();
+		default:
+			return false;
+		}
+	}
+	#endif
+	return true;
+}
+
+bool CATProject::CreateListingsSbs1()
+{
+	LOG_FUNC_ENTRY("CATProject::CreateListingsSbs1");
+	string sCommand;
+	if ( m_bAbldTest )
+		sCommand = "abld test listing ";
+	else
+		sCommand = "abld listing ";
+
+	// Listing
+	if ( m_sVariant.empty() )
+	{
+		// No variant
+		sCommand.append( m_sPlatform );
+	}
+	else
+	{
+		// Use specified variant
+		sCommand.append( m_sPlatform );
+		sCommand.append( "." );
+		sCommand.append( m_sVariant );
+	}
+	// udeb vs urel
+	sCommand.append( " " );
+	sCommand.append( GetBuildTypeString() );
+
+	if ( m_vTargetModules.size() > 1 )
+	{
+		RunAbldCommandToAllTargets( sCommand );
+	}
+	else
+	{
+		AddTargetModuleIfDefined( sCommand ); 
+		cout << AT_MSG_SYSTEM_CALL << sCommand << endl;
+		(void)system( sCommand.c_str() );
+	}
+	return true;
+}
+
+bool CATProject::CreateListingsSbs2()
+{
+	LOG_FUNC_ENTRY("CATProject::CreateListingsSbs2");
+	string sCmd( m_sBuildCommand );
+	sCmd.append( RAPTOR_LISTING_LOG );
+	sCmd.append( " LISTING");
+	cout << AT_MSG_SYSTEM_CALL << sCmd << endl;
+	int iRet = (int)system( sCmd.c_str() );
+	if ( iRet == 0 )
+		return true;
+	return false;
+}
+
+bool CATProject::CopyReleasables()
+{
+	bool bRet = true;
+	LOG_FUNC_ENTRY("CATProject::CopyReleasables");
+	// Only copy releasables on armv5 platform and no addr2line defined.
+	#ifndef ADDR2LINE
+	if ( _stricmp( m_sPlatform.c_str(), "armv5" ) == 0 ) 
+	{
+		for( size_t i = 0; i < m_vModules.size(); i++ )
+		{
+			if ( ! m_vModules.at(i)->CopyReleasables() )
+				bRet = false;
+		}
+		// Static libraries lst files.
+		// First create directory for them (delete old one if exists).
+		if ( ! DirectoryExists( AT_TEMP_LST_DIR ) )
+		{
+			DirCreate( AT_TEMP_LST_DIR, true );
+		}
+		else
+		{
+			DirDelete( AT_TEMP_LST_DIR, true );
+			DirCreate( AT_TEMP_LST_DIR, true );
+		}
+		for ( size_t i = 0 ; i < m_vStaticLibraries.size(); i ++ )
+		{
+			if( ! m_vStaticLibraries.at(i)->CopyLstFilesToDir( AT_TEMP_LST_DIR ) )
+				bRet = false;
+		}
+
+		// Delete lst files from all type of modules in project.
+		// Ignoring errors because different modules might use same source/lst files.
+		for( size_t i = 0; i < m_vModules.size(); i++ )
+			m_vModules.at(i)->DeleteLstFilesFromSrc();
+		for ( size_t i = 0 ; i < m_vUnsupportedModules.size(); i ++ )
+			m_vUnsupportedModules.at(i)->DeleteLstFilesFromSrc();
+		for ( size_t i = 0 ; i < m_vStaticLibraries.size(); i ++ )
+			m_vStaticLibraries.at(i)->DeleteLstFilesFromSrc();
+		
+		return bRet;
+	}
+	#endif
+	// When addr2line defined and used we use symbol and map file(s).
+	#ifdef ADDR2LINE
+	if ( _stricmp( m_sPlatform.c_str(), "armv5" ) == 0 )
+	{
+		// Verify that module(s) symbol file(s) exist
+		for( size_t i = 0; i < m_vModules.size(); i++ )
+		{
+			// Check symbol file.
+			if ( ! m_vModules.at(i)->SymbolFileExist() )
+				bRet = false;
+			// Check map  file.
+			if ( ! m_vModules.at(i)->MapFileExist() )
+				bRet = false;
+		}
+	}
+	#endif
+	// Platform winscw.
+	else if ( _stricmp( m_sPlatform.c_str(), "winscw" ) == 0 )
+	{
+		// Verify that module(s) binaries exist
+		for( size_t i = 0; i < m_vModules.size(); i++ )
+		{
+			if ( ! m_vModules.at(i)->BinaryFileExist() )
+				bRet = false;
+		}
+		// For static libraries binary/target is same as their library.
+		for ( size_t i = 0 ; i < m_vStaticLibraries.size(); i ++ )
+			if ( ! m_vStaticLibraries.at(i)->BinaryFileExist() )
+				bRet = false;
+	}
+	// Platform gcce.
+	else if ( _stricmp( m_sPlatform.c_str(), "gcce" ) == 0 )
+	{
+		// Verify that module(s) symbol file(s) exist
+		for( size_t i = 0; i < m_vModules.size(); i++ )
+		{
+			// Check symbol file.
+			if ( ! m_vModules.at(i)->SymbolFileExist() )
+				bRet = false;
+		}
+	}
+	return bRet;
+}
+
+// ----------------------------------------------------------------------------
+// Write project's (user) attributes to a file under temp folder
+// ----------------------------------------------------------------------------
+bool CATProject::WriteAttributes() const
+{
+	LOG_FUNC_ENTRY("CATProject::WriteAttributes");
+	// File to write to
+	string sOutFile( AT_TEMP_DIR );
+	sOutFile.append( "\\" );
+	sOutFile.append( AT_PROJECT_ATTRIBUTES_FILE_NAME );
+	// Open file truncate if exists
+	ofstream out( sOutFile.c_str(), ios_base::trunc );
+	// Check file opened successfully
+	if ( ! out.good() )
+		return false;
+	// Write attributes line by line
+	out << m_bUninstrumented << endl; // Is project instrumented
+	// Sbs version
+	if ( m_eBuildSystem == CATProject::SBS_V2 )
+		out << "SBS_2" << endl; 
+	else
+		out << "SBS_1" << endl;
+	out << endl; // Reserved for possible binary data
+	out << m_sPlatform << endl;
+	out << m_sVariant << endl;
+	out << m_eLoggingMode << endl;
+	out << m_eBuildType << endl;
+	out << m_sS60FileName << endl;
+	out << m_iAllocCallStackSize << endl;
+	out << m_iFreeCallStackSize << endl;
+	for ( size_t i = 0 ; i < m_vTargetModules.size() ; i++ )
+		out << m_vTargetModules.at(i) << AT_PROJECT_ATTRIBUTES_SEPARATOR;
+	out << endl;
+	out << m_sBuildCommand << endl;
+	out << m_sS60FilePath << endl;
+	out.close();
+	return true;
+}
+// ----------------------------------------------------------------------------
+// Reads project's (user) attributes to a file under temp folder
+// ----------------------------------------------------------------------------
+bool CATProject::ReadAttributes()
+{
+	LOG_FUNC_ENTRY("CATProject::ReadAttributes");
+	// File to read on
+	string sInFile( AT_TEMP_DIR );
+	sInFile.append( "\\" );
+	sInFile.append( AT_PROJECT_ATTRIBUTES_FILE_NAME );
+	// Open file
+	ifstream in( sInFile.c_str() );
+	// Check file opened successfully
+	if ( ! in.good() )
+		return false;
+	// Read attributes
+	char cLine[ MAX_LINE_LENGTH ];
+	string sLine;
+	in.getline( cLine, MAX_LINE_LENGTH );
+	int iValue = atoi( cLine );
+	if ( iValue == 1 )
+		m_bUninstrumented = true;
+	else
+		m_bUninstrumented = false;
+	// Sbs version
+	in.getline( cLine, MAX_LINE_LENGTH ); string sBuildSystem = string( cLine );
+	if ( sBuildSystem.compare( "SBS_1" ) == 0 )
+		m_eBuildSystem = CATProject::SBS_V1;
+	else if ( sBuildSystem.compare( "SBS_2" ) == 0 )
+		m_eBuildSystem = CATProject::SBS_V2;
+	else {
+		LOG_STRING("Error invalid build system defined in project.cfg");
+		m_eBuildSystem = CATProject::SBS_V1;
+	}
+	in.getline( cLine, MAX_LINE_LENGTH ); // reserverd for possible binary timestamp or similar
+	in.getline( cLine, MAX_LINE_LENGTH ); m_sPlatform = string( cLine );
+	in.getline( cLine, MAX_LINE_LENGTH ); m_sVariant = string( cLine );
+	in.getline( cLine, MAX_LINE_LENGTH ); m_eLoggingMode = atoi( cLine );
+	in.getline( cLine, MAX_LINE_LENGTH ); m_eBuildType = atoi( cLine );
+	in.getline( cLine, MAX_LINE_LENGTH ); m_sS60FileName = string( cLine );
+	in.getline( cLine, MAX_LINE_LENGTH ); m_iAllocCallStackSize = atoi( cLine );
+	in.getline( cLine, MAX_LINE_LENGTH ); m_iFreeCallStackSize = atoi( cLine );
+	in.getline( cLine, MAX_LINE_LENGTH ); sLine = cLine;
+	size_t iSpot = sLine.find( AT_PROJECT_ATTRIBUTES_SEPARATOR );
+	while ( iSpot != string::npos )
+	{
+		string sTarget = sLine.substr(0, iSpot );
+		m_vTargetModules.push_back( sTarget );
+		sLine.erase(0, iSpot + AT_PROJECT_ATTRIBUTES_SEPARATOR.size() );
+		iSpot = sLine.find( AT_PROJECT_ATTRIBUTES_SEPARATOR );
+	}
+	in.getline( cLine, MAX_LINE_LENGTH ); m_sBuildCommand = cLine;
+	in.getline( cLine, MAX_LINE_LENGTH ); m_sS60FilePath = string( cLine );
+	in.close();
+	return true;
+}
+
+// ----------------------------------------------------------------------------
+// Creates atool_temp directory to current folder if does not exist
+// ----------------------------------------------------------------------------
+bool CATProject::MakeTempDirIfNotExist()
+{
+	LOG_FUNC_ENTRY("CATProject::MakeTempDirIfNotExist");
+	if ( ! DirectoryExists( AT_TEMP_DIR ) )
+	{
+		if( !CreateDirectory( AT_TEMP_DIR , NULL ) )
+		{
+			return false;
+		}
+	}
+	return true;
+}
+// ----------------------------------------------------------------------------
+// Utilities
+// ----------------------------------------------------------------------------
+
+bool CATProject::RunAbldCommandToAllTargets( const string& sCommand )
+{
+	LOG_FUNC_ENTRY("CATProject::RunAbldCommandToAllTargets");
+
+	// Check for space at the commands end.
+	string sSystemCall( sCommand );
+	if ( *(sSystemCall.rbegin()) != ' ' )
+		sSystemCall.append( " " );
+
+	// Loop calls.
+	bool bRet = true;
+	for ( vector<string>::iterator it = m_vTargetModules.begin(); it < m_vTargetModules.end(); it++ )
+	{
+		string sCall( sSystemCall );
+		sCall.append( RemovePathAndExt( *it, true ) );
+		cout << AT_MSG_SYSTEM_CALL << sCall << endl;
+		if ( (int) system( sCall.c_str() ) != 0 )
+			bRet = false;
+	}
+	return bRet;
+}
+
+void CATProject::AddTargetModuleIfDefined( string& sCmd )
+{
+	LOG_FUNC_ENTRY("CATProject::AddTargetModuleIfDefined");
+	// Do we have target modules defined
+	if ( m_vTargetModules.size() > 0 )
+	{
+		switch( m_eBuildSystem )
+		{
+		case SBS_V1:
+			// Add first target modules name without extension to build cmd.
+			sCmd.append( " " );
+			sCmd.append( RemovePathAndExt( m_vTargetModules.at( 0 ), true ) );
+			break;
+		case SBS_V2:
+			// Add all target modules to build command using raptor switch '-p'.
+			for( size_t i = 0 ; i < m_vTargetModules.size() ; i++ )
+			{
+				LOG_STRING("Adding :" << m_vTargetModules.at( i ) );
+				sCmd.append( " -p " );
+				sCmd.append( m_vTargetModules.at( i ) );
+			}
+			break;
+		}
+	}
+}
+
+bool CATProject::IsTargetModuleInProject() const
+{
+	LOG_FUNC_ENTRY("CATProject::IsTargetModuleInProject");
+	vector<CATModule2*>::const_iterator modules;
+	vector<CATModule2*>::const_iterator staticModules;
+	vector<string>::const_iterator targets;
+	bool bRet = true;
+	// Do we have target modules defined
+	if ( m_vTargetModules.size() > 0 )
+	{
+		// Sbs version 1 support only single target module.
+		if ( m_eBuildSystem == SBS_V1 )
+		{
+			// Try to find module from project.
+			bRet = false;
+			string sTarget = m_vTargetModules.at(0);
+			for( modules = m_vModules.begin() ; modules != m_vModules.end() ; modules++ )
+			{
+				if( (*modules)->GetMmpFile().find( sTarget ) != string::npos )
+				{
+					// Found it return true.
+					bRet = true;
+					break;
+				}
+			}
+			for( staticModules = m_vStaticLibraries.begin(); staticModules != m_vStaticLibraries.end(); staticModules++ )
+			{
+				if( (*staticModules)->GetMmpFile().find( sTarget ) != string::npos )
+				{
+					bRet = true;
+					break;
+				}
+			}
+			if ( ! bRet )
+			{
+				// Not found display error message.
+				cout << AT_MSG << "Error, " << sTarget << " not defined in project." << endl;
+			}
+		}
+		// Sbs version 2 supports multiple target modules.
+		else if ( m_eBuildSystem == SBS_V2 )
+		{
+			// Check that all targets are defined in project.
+			for( targets = m_vTargetModules.begin(); targets != m_vTargetModules.end() ; targets++ )
+			{
+				// Found iterated target?
+				bool bFound = false;
+				for ( modules = m_vModules.begin() ; modules != m_vModules.end() ; modules++ )
+				{
+					if( (*modules)->GetMmpFile().find( *targets ) != string::npos )
+					{
+						// yes.
+						bFound = true;
+						break;
+					}
+				}
+				for( staticModules = m_vStaticLibraries.begin(); staticModules != m_vStaticLibraries.end(); staticModules++ )
+				{
+					if( (*staticModules)->GetMmpFile().find( *targets ) != string::npos )
+					{
+						bFound = true;
+						break;
+					}
+				}
+				if ( ! bFound )
+				{
+					// Display error when not found and set return value false.
+					bRet = false;
+					cout << AT_MSG << "Error, " << targets->c_str() << " not defined in project." << endl;
+				}
+			}
+		}
+	}
+	return bRet;
+}
+
+string CATProject::GetBuildTypeString()
+{
+	LOG_LOW_FUNC_ENTRY("CATProject::GetBuildTypeString");
+	// Return build type as lowercase string
+	switch( m_eBuildType )
+	{
+	case UDEB:
+		return string("udeb");
+	case UREL:
+		return string("urel");
+	default:
+		return "";
+	}
+}
+
+string CATProject::GetBuildTypeString( int eType )
+{
+	LOG_LOW_FUNC_ENTRY("CATProject::GetBuildTypeString( int eType )");
+	// Return build type as lowercase string
+	switch( eType )
+	{
+	case UDEB:
+		return string("udeb");
+	case UREL:
+		return string("urel");
+	default:
+		return string("unknown");
+	}
+}
+
+bool CATProject::CleanTemporaryDirs()
+{
+	LOG_FUNC_ENTRY("CATProject::CleanTemporaryDirs");
+	bool bRet = true;
+	// Modules
+	for( size_t i = 0; i < m_vModules.size(); i++ )
+	{
+		if ( ! m_vModules.at(i)->CleanTemporaryDir() )
+			bRet = false;
+	}
+	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
+	{
+		if ( ! m_vStaticLibraries.at(i)->CleanTemporaryDir() )
+			bRet = false;
+	}
+	// Projects
+	vector<string> vFileList = DirList( AT_TEMP_DIR, false , true );
+	vector<string>::iterator it2 = vFileList.begin();
+	// Size of constant table
+	int iCount = sizeof( TEMP_EXTENSION_NO_DELETE ) / sizeof( string );
+	while ( it2 != vFileList.end() )
+	{
+		// Get extension and compare it to list
+		bool bDelete = true;
+		string sExtension = GetExtension( *it2 );
+		ChangeToLower( sExtension );
+		for ( int i = 0 ; i < iCount ; i++ )
+		{
+			if( sExtension.compare( TEMP_EXTENSION_NO_DELETE[i] ) == 0 )
+			{
+				bDelete = false;
+				break;
+			}
+		}
+		if ( bDelete )
+		{
+			// Delete file
+			if ( ! FileDelete( *it2, true ) )
+				bRet = false;
+		}
+		// Increment
+		it2++;
+	}
+	return bRet;
+}
+
+bool CATProject::DeleteTemporaryDirs()
+{
+	LOG_FUNC_ENTRY("CATProject::DeleteTemporaryDirs");
+	bool bRet = true;
+	// Modules
+	for( size_t i = 0; i < m_vModules.size(); i++ )
+	{
+		if (! m_vModules.at(i)->DeleteTemporaryDir() )
+			bRet = false;
+	}
+	for( size_t i = 0; i < m_vStaticLibraries.size(); i++ )
+	{
+		if (! m_vStaticLibraries.at(i)->DeleteTemporaryDir() )
+			bRet = false;
+	}
+	return bRet;
+}
+
+bool CATProject::InitSbs1MakeFileWithPathToTemp()
+{
+	LOG_FUNC_ENTRY("CATProject::InitSbs1MakeFileWithPathToTemp");
+	// Use temporary folder
+	m_sMakeFile.clear();
+	m_sMakeFile.append( AT_TEMP_DIR );
+	m_sMakeFile.append( "\\" );
+	m_sMakeFile.append( AT_LEVEL_1_MAKEFILE_NAME );
+	// At end check does it exist, return the result.
+	return FileExists( m_sMakeFile.c_str() );
+}
+
+bool CATProject::InitSbs1MakeFileWithPath()
+{
+	LOG_FUNC_ENTRY("CATProject::InitMakeFileWithPath");
+	if ( m_sEpocRoot.empty() )
+	{
+		LOG_STRING("Error, epocroot is not set.");
+		return false;
+	}
+	m_sMakeFile.clear();
+	m_sMakeFile.append( m_sEpocRoot );
+	if( *m_sMakeFile.rbegin() != '\\' )
+		m_sMakeFile.append( "\\" );
+	m_sMakeFile.append( "epoc32\\build\\" );
+	// Add current directory to path (first remove driveletter).
+	string sCurrentDir( m_cCurrentDir );
+	if ( sCurrentDir.length() < 3 )
+	{
+		LOG_STRING("Error, current dir invalid.");
+		return false;
+	}
+	sCurrentDir.erase(0,3);
+	m_sMakeFile.append( sCurrentDir );
+	m_sMakeFile.append( "\\" );
+	// Platform
+	string sPlatInUpper( m_sPlatform);
+	ChangeToUpper( sPlatInUpper );
+	m_sMakeFile.append( sPlatInUpper );
+	// Possible variant
+	if ( m_sVariant.empty() )
+	{
+		// Test modules only?
+		if ( m_bAbldTest )
+			m_sMakeFile.append( "TEST" );
+		m_sMakeFile.append( "." );
+		m_sMakeFile.append( "MAKE" );
+	}
+	else
+	{
+		m_sMakeFile.append( "." );
+		m_sMakeFile.append( m_sVariant );
+		// Test modules only?
+		if ( m_bAbldTest )
+			m_sMakeFile.append( "TEST" );
+		m_sMakeFile.append( ".MAKE" );
+	}
+	// At end check does it exist, return the result.
+	return FileExists( m_sMakeFile.c_str() );
+}
+
+// ----------------------------------------------------------------------------
+// Get & Sets
+// ----------------------------------------------------------------------------
+void CATProject::SetBuildSystem( BUILD_SYSTEM eSystem )
+{
+	LOG_FUNC_ENTRY("CATProject::SetBuildSystem");
+	m_eBuildSystem = eSystem;
+}
+void CATProject::SetMode( PROJECT_MODE eMode )
+{
+	LOG_FUNC_ENTRY("CATProject::SetMode");
+	m_eMode = eMode;
+}
+int CATProject::GetMode() const
+{
+	LOG_LOW_FUNC_ENTRY("CATProject::GetMode");
+	return m_eMode;
+}
+void CATProject::SetEpocRoot( const string& sEpocRoot )
+{
+	LOG_FUNC_ENTRY("CATProject::SetEpocRoot");
+	m_sEpocRoot = sEpocRoot;
+}
+void CATProject::SetPlatform( const string& sPlatform )
+{
+	LOG_FUNC_ENTRY("CATProject::SetPlatform");
+	m_sPlatform = sPlatform;
+}
+void CATProject::SetVariant( const string& sVariant )
+{
+	LOG_FUNC_ENTRY("CATProject::SetVariant");
+	m_sVariant = sVariant;
+}
+void CATProject::SetLoggingMode( LOGGING_MODE eLoggingMode)
+{
+	LOG_FUNC_ENTRY("CATProject::SetLoggingMode");
+	m_eLoggingMode = eLoggingMode;
+}
+void CATProject::SetAllocCallStackSize( int iAllocCallStackSize )
+{
+	m_iAllocCallStackSize = iAllocCallStackSize;
+}
+void CATProject::SetFreeCallStackSize( int iFreeCallStackSize )
+{
+	m_iFreeCallStackSize = iFreeCallStackSize;
+}
+void CATProject::SetBuildType( BUILD_TYPE eType )
+{
+	LOG_FUNC_ENTRY("CATProject::SetBuildType");
+	m_eBuildType = eType;
+}
+void CATProject::SetS60FileName( const string& sFileName)
+{
+	LOG_FUNC_ENTRY("CATProject::SetS60FileName");
+	m_sS60FileName = sFileName;
+}
+void CATProject::SetS60FilePath( const string& sFilePath)
+{
+	LOG_FUNC_ENTRY("CATProject::SetS60FilePath");
+	m_sS60FilePath = sFilePath;
+}
+void CATProject::SetRomSymbolFiles(const vector<string>& vRomSymbolFiles)
+{
+	LOG_FUNC_ENTRY("CATProject::SetRomSymbolFiles");
+	m_vRomSymbolFiles = vRomSymbolFiles;
+}
+void CATProject::SetTargetModule(const string& sTargetModule)
+{
+	LOG_FUNC_ENTRY("CATProject::SetTargetModule");
+	m_sTargetModule = sTargetModule;
+	ChangeToLower( m_sTargetModule);
+}
+void CATProject::SetBinaryTarget(const string& sBinaryTarget)
+{
+	LOG_FUNC_ENTRY("CATProject::SetBinaryTarget");
+	m_sBinaryTarget = sBinaryTarget;
+	ChangeToLower( m_sBinaryTarget );
+}
+void CATProject::SetDataFile( const string& sDataFile )
+{
+	LOG_FUNC_ENTRY("CATProject::SetDataFile");
+	m_sDataFile = sDataFile;
+}
+void CATProject::SetLogLevel( int iLogLevel )
+{
+	LOG_FUNC_ENTRY("CATProject::SetLogLevel");
+	m_iLoggingLevel = iLogLevel;
+}
+void CATProject::SetDataFileOutput( const string& sDataFileOutput )
+{
+	LOG_FUNC_ENTRY("CATProject::SetDataFileOutput");
+	m_sDataFileOutput = sDataFileOutput;
+}
+void CATProject::SetTargetModules( const vector<string>& vTargetModules )
+{
+	LOG_FUNC_ENTRY("CATProject::SetTargetModules");
+	m_vTargetModules = vTargetModules;
+}
+void CATProject::SetBuildCommand( const string& sBuildCommand )
+{
+	LOG_FUNC_ENTRY("CATProject::SetBuildCommand");
+	m_sBuildCommand = sBuildCommand;
+}
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/arguments.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,872 @@
+/*
+* 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:  Argument parsing functions.
+*/
+#include "../inc/ATCommonDefines.h"
+#include "../inc/CATBase.h"
+
+//Forward declarations.
+bool parseBaseArguments( vector<string>& vArgs, ARGUMENTS& args );
+bool parseHookArguments( vector<string>& vArgs, ARGUMENTS& args );
+bool parseAnalyzeArguments( vector<string>& vArgs, ARGUMENTS& args );
+bool parseParseArguments( vector<string>& vArgs, ARGUMENTS& args );
+bool checkDataFileName( string& sFileName );
+bool checkDataFilePath( string& sFilePath );
+bool parseSbsConfiguration( string& sConfiguration, ARGUMENTS& args );
+
+// Constants for old "hooking" parameter parsing.
+#define INVALID_PARAMETER "AnalyzeTool : Error, invalid parameter: "
+const char DATAFILENAME_INVALID_CHARS[] = " &^+-@$*()|\\/[]{}<>?;:,\"'";
+const char DATAFILEPATH_INVALID_CHARS[] = " &^+-@$%*()|/[]{}<>?;,\"'";
+
+/**
+* Check datafile name for invalid characters.
+* @return true if file name ok.
+*/
+bool checkDataFileName( string& sFileName )
+{
+	for ( size_t i = 0; i < sFileName.length(); i++ )
+	{
+		const char c = sFileName.at( i );
+		if( strchr( DATAFILENAME_INVALID_CHARS, c ) != 0 )
+			return false;
+	}
+	return true;
+}
+
+/**
+* Check datafile path for invalid characters and correct format.
+* @return true if file path ok.
+*/
+bool checkDataFilePath( string& sFilePath )
+{
+	for ( size_t i = 0; i < sFilePath.length(); i++ )
+	{
+		char c = sFilePath.at( i );
+		if( strchr( DATAFILEPATH_INVALID_CHARS, c ) != 0 )
+			return false;
+		// first char must be drive letter a-z
+		if( i == 0 && ( c = tolower( c ) < 'a' || c > 'z' ) )
+			return false;
+		// if last char is not '\', add it
+		if( i == sFilePath.length()-1 &&  c != '\\' )
+			sFilePath.append( "\\" );
+	}
+
+	// ':\' after drive letter
+	if( sFilePath.find( ":\\" ) != 1 )
+		return false;
+
+	// there can be only one ':' on pos 1
+	if( sFilePath.find( ":", 2 ) != string::npos )
+		return false;
+
+	//check double slashes
+	if( sFilePath.find( "\\\\" ) != string::npos )
+		return false;
+
+	return true;
+}
+
+/**
+* Parse base arguments from given vector of strings.
+* Removes debug / help arguments from vector.
+*/
+bool parseBaseArguments( vector<string>& vArgs, ARGUMENTS& args )
+{
+	// Iterator used in this function.
+	vector<string>::iterator it;
+	// If no arguments set show help true.
+ 	if ( vArgs.size() == 0 )
+	{
+		args.eMainSwitch = SWITCH_UNKNOWN;
+		args.bHelp = true;
+	}
+	//Try find help and debug switches.
+	//Note: -help is main switch what shows syntax examples.
+	for(it = vArgs.begin(); it != vArgs.end(); it++ )
+	{
+		//Help switches.
+		if ( ! _stricmp( (*it).c_str(), "-?" ) )
+		{
+			args.bHelp = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "--?" ) )
+		{
+			args.bHelp = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "--help" ) )
+		{
+			args.bHelp = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "/?" ) )
+		{
+			args.bHelp = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		//Debug switches.
+		else if ( ! _stricmp( (*it).c_str(), "-show_debug" ) )
+		{
+			args.bDebugConsole = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "--show_debug" ) )
+		{
+			args.bDebugConsole = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-show_debug_all" ) )
+		{
+			args.bDebugConsole = true;
+			args.bDebugLowLevel = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "--show_debug_all" ) )
+		{
+			args.bDebugConsole = true;
+			args.bDebugLowLevel = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-show_dbgview" ) )
+		{
+			args.bDebugDbgView = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "--show_dbgview" ) )
+		{
+			args.bDebugDbgView = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-show_dbgview_all" ) )
+		{
+			args.bDebugDbgView = true;
+			args.bDebugLowLevel = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "--show_dbgview_all" ) )
+		{
+			args.bDebugDbgView = true;
+			args.bDebugLowLevel = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+		//Raptor switch.
+		else if ( ! _stricmp( (*it).c_str(), "-sbs2" ) )
+		{
+			args.bEnableSbs2 = true;
+			it = vArgs.erase( it );
+			if ( it == vArgs.end() )
+				break;
+		}
+	}
+	if ( vArgs.size() > 0 )
+	{
+		//Pick up main switch.
+		it = vArgs.begin();
+		if ( ! _stricmp( (*it).c_str(), "-a" ) )
+			args.eMainSwitch = SWITCH_ANALYZE;
+		else if ( ! _stricmp( (*it).c_str(), "-p" ) )
+			args.eMainSwitch = SWITCH_PARSE_TRACE;
+		else if ( ! _stricmp( (*it).c_str(), "-c" ) )
+			args.eMainSwitch = SWITCH_CLEAN;
+		else if ( ! _stricmp( (*it).c_str(), "-v" ) )
+			args.eMainSwitch = SWITCH_VERSION;
+		else if ( ! _stricmp( (*it).c_str(), "-vdbghelp" ) )
+			args.eMainSwitch = SWITCH_DBGHELP_VERSION;
+		else if ( ! _stricmp( (*it).c_str(), "-help" ) )
+			args.eMainSwitch = SWITCH_HELP;
+		else if ( ! _stricmp( (*it).c_str(), "-me" ) )
+		{
+			cout << AT_MSG << "This feature is no longer supported. You can use -tr parameter for output to trace. \n" << endl;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-e" ) ||  ! _stricmp( (*it).c_str(), "-tr" ) )
+		{
+			args.eMainSwitch = SWITCH_HOOK;
+			args.eHookSwitch = HOOK_EXTERNAL_FAST;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-mi" ) )
+		{
+			cout << AT_MSG << "This feature is no longer supported. You can use -lf parameter for logging to file. \n" << endl;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-lf" ) )
+		{
+			args.eMainSwitch = SWITCH_HOOK;
+			args.eHookSwitch = HOOK_INTERNAL;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-instrument_i" ) )
+		{
+			args.eMainSwitch = SWITCH_HOOK;
+			args.eHookSwitch = HOOK_EXTENSION_INTERNAL;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-instrument_e" ) )
+		{
+			args.eMainSwitch = SWITCH_HOOK;
+			args.eHookSwitch = HOOK_EXTENSION_EXTERNAL;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-instrument_ef" ) )
+		{
+			args.eMainSwitch = SWITCH_HOOK;
+			args.eHookSwitch = HOOK_EXTENSION_EXTERNAL_FAST;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-uninstrument" ) )
+		{
+			args.eMainSwitch = SWITCH_UNHOOK;
+			args.eHookSwitch = HOOK_EXTENSION_UNINSTRUMENT;
+		}
+		else if ( ! _stricmp( (*it).c_str(), "-uninstrument_failed" ) )
+		{
+			args.eMainSwitch = SWITCH_UNHOOK;
+			args.eHookSwitch = HOOK_EXTENSION_FAILED;
+		}
+	}
+	return true;
+}
+
+/**
+* Parse analyze related arguments from given vector of strings.
+*/
+bool parseAnalyzeArguments( vector<string>& vArgs, ARGUMENTS& args )
+{
+	bool bRet = true;
+	if ( vArgs.size() < 2 )
+	{
+		cout << AT_MSG << "Error, missing datafile." << endl;
+		return false;
+	}
+	// Iterator used in this function.
+	vector<string>::const_iterator it;
+	for(it = vArgs.begin()+1; it != vArgs.end(); it++ )
+	{
+		if ( it->find("-l") != string::npos )
+		{
+			if ( it->length() == 3 )
+			{
+				// Create char array for atoi function
+				char level[2];
+				level[0] = it->at(2);
+				level[1] = 0; // null terminate
+				// check that its digit first
+				if ( isdigit(level[0]) )
+				{
+					// pass array to atoi
+					int iLoggingLevel = atoi( level );
+					if ( iLoggingLevel >= 0 && iLoggingLevel <= 3 )
+					{
+						// log level ok
+						args.ANALYZE.iLoggingLevel = iLoggingLevel;
+						continue;
+					}
+				}
+				bRet = false;
+				cout << AT_MSG << "Invalid logging level specified (0-3)." << endl;
+				args.ANALYZE.iLoggingLevel = -1;
+			}
+		}
+		// No else here because logging level check is done to all args in list.
+		// Rom symbol file
+		if( _stricmp( it->c_str(), "-s" ) == 0 )
+		{
+			it++;
+			if ( it == vArgs.end() )
+			{
+				bRet = false;
+				cout << AT_MSG << "Missing symbol file." << endl;
+				break; // Leave for loop.
+			}
+			else
+			{
+				args.ANALYZE.bSymbolFile = true;
+				args.ANALYZE.vSymbolFiles.push_back( *it );
+				continue;
+			}
+		}
+		else 
+		{
+			// If we got datafile we must assume this is output
+			if( ! args.ANALYZE.sDataFile.empty() )
+			{
+				if ( args.ANALYZE.sOutputFile.empty() )
+					args.ANALYZE.sOutputFile = *it;
+				else
+				{
+					bRet = false;
+					cout << AT_MSG << "Invalid parameter: " << *it << endl;
+				}
+			}
+			// If this is file we assume datafile
+			else if( CATBase::FileExists( it->c_str() ) )
+			{
+				args.ANALYZE.sDataFile = *it;
+			}
+			else
+			{
+				bRet = false;
+				cout << AT_MSG << "Specified datafile does not exist." << endl;
+			}
+		}
+	}
+	if ( args.ANALYZE.sDataFile.empty() )
+		bRet = false;
+	return bRet;
+}
+
+
+/**
+* Parse hooking related arguments from given vector of strings.
+*/
+bool parseHookArguments( vector<string>& vArgs, ARGUMENTS& args )
+{
+	bool bRet = true;
+	try {
+		// Iterator used in this function.
+		vector<string>::const_iterator it;
+
+		// Check that we have some arguments except main switch.
+		if ( vArgs.size() < 2 )
+		{
+			if ( args.eHookSwitch == HOOK_EXTENSION_UNINSTRUMENT
+				|| args.eHookSwitch == HOOK_EXTENSION_FAILED
+				)
+				return bRet;
+			cout << AT_MSG << "Error, Missing build command." << endl;
+			bRet = false;
+		}
+		bool bBuildFound = false;
+		for(it = vArgs.begin()+1; it != vArgs.end(); it++ )
+		{
+			// If's to pickup atool options
+			// no build switch
+			if ( _stricmp( it->c_str(), "-nobuild" ) == 0 )
+			{
+				args.HOOK.bNoBuild = true;
+			}
+			// call stack size(s)
+			else if ( _stricmp( it->c_str(), "-acs" ) == 0 || _stricmp( it->c_str(), "-fcs" ) == 0 )
+			{
+				// Free vs Alloc
+				bool bAlloc = true;
+				if ( _stricmp( it->c_str(), "-fcs" ) == 0 )
+					bAlloc = false;
+				// Value
+				it++;
+				if ( it== vArgs.end() )
+				{
+					bRet = false;
+					cout << AT_MSG << "Error, missing call stack size parameter." << endl;
+					break;
+				}
+				else if ( ! _stricmp( it->c_str(), "sbs" ) 
+					|| ! _stricmp( it->c_str(), "abld" )
+					|| ! _stricmp( it->c_str(), "-f" )
+					|| ! _stricmp( it->c_str(), "-fp" ) )
+				{
+					bRet = false;
+					cout << AT_MSG << "Error, missing call stack size parameter." << endl;
+					break;
+				}
+				else
+				{
+					int i;
+					// Try to parse integer value using stream.
+					istringstream ss( *it );
+					if ( ss>>i )
+					{
+						// Value parsed ok now check bounds.
+						if ( i < AT_CALL_STACK_SIZE_MIN  )
+						{
+							bRet = false;
+							cout << AT_MSG << "Error, specified call stack size value too small." << endl;
+							break;
+						}
+						else if ( i > AT_CALL_STACK_SIZE_MAX )
+						{
+							bRet = false;
+							cout << AT_MSG << "Error, specified call stack size value too big." << endl;
+							break;
+						}
+						else
+						{
+							// Value valid.
+							if ( bAlloc )
+								args.HOOK.iAllocCallStackSize = i;
+							else
+								args.HOOK.iFreeCallStackSize = i;
+						}
+					}
+					else
+					{
+						// Error parsing value using stream.
+						bRet = false;
+						cout << AT_MSG << "Error, specified call stack size value invalid." << endl;
+						break;
+					}
+
+				}
+			}
+			// Data file name.
+			else if ( _stricmp( it->c_str(), "-f" ) == 0 )
+			{
+				it++;
+				if ( it == vArgs.end() )
+				{
+					bRet = false;
+					cout << AT_MSG << "Error, missing log file name." << endl;
+					break;
+				}
+				else if ( ! _stricmp( it->c_str(), "sbs" ) || ! _stricmp( it->c_str(), "abld" ) )
+				{
+					bRet = false;
+					cout << AT_MSG << "Error, missing log file name." << endl;
+					break;
+				}
+				else
+				{
+					if ( checkDataFileName( string( *it ) ) )
+					{
+						// Pickup filename.
+						args.HOOK.bDataFileName = true;
+						args.HOOK.sDataFileName = *it;
+					}
+					else
+					{
+						bRet = false;
+						cout << AT_MSG << "Error, specified log file name contains invalid character(s)." << endl;
+						break;
+					}
+				}
+			}
+			// Data file path.
+			else if ( _stricmp( it->c_str(), "-fp" ) == 0 )
+			{
+				it++;
+				if ( it == vArgs.end() )
+				{
+					bRet = false;
+					cout << AT_MSG << "Error, missing path for log file." << endl;
+					break;
+				}
+				else if ( ! _stricmp( it->c_str(), "sbs" ) || ! _stricmp( it->c_str(), "abld" ) )
+				{
+					bRet = false;
+					cout << AT_MSG << "Error, missing path for log file." << endl;
+					break;
+				}
+				else
+				{
+					string sFormattedPath = string(*it);
+					if ( checkDataFilePath( sFormattedPath ) )
+					{
+						// Pickup filename.
+						args.HOOK.bDataFilePath = true;
+						args.HOOK.sDataFilePath = sFormattedPath;
+					}
+					else
+					{
+						bRet = false;
+						cout << AT_MSG << "Error, specified log file path contains invalid character(s) "
+							<< "or is in wrong format. Please, check help for correct format," << endl;
+						break;
+					}
+				}
+			}
+			// Build command parsing.
+			else if ( _stricmp( it->c_str(), "sbs" ) == 0 )
+			{
+				// By default sbs command is not valid.
+				bRet = false;
+				// By default build found
+				bBuildFound = true;
+				// Use raptor build system, pickup all rest arguments to sbs commmand.
+				bool bFoundConfig = false; // Is configuration defined.
+				args.HOOK.iBuildSystem = 2;
+				vector<string>::const_iterator itC = it;
+				args.HOOK.sBuildCmd.clear();
+				for ( ; itC != vArgs.end() ; itC++ )
+				{
+					args.HOOK.sBuildCmd.append( *itC );
+					args.HOOK.sBuildCmd.append( " " );
+					args.HOOK.vBuildCmd.push_back( *itC );
+				}
+				// Remove last space
+				if ( args.HOOK.vBuildCmd.size() > 1 )
+					args.HOOK.sBuildCmd.erase( args.HOOK.sBuildCmd.size()-1 );
+
+				// Parse needed variables from sbs command.
+				vector<string>::iterator itSbs;
+				for( itSbs = args.HOOK.vBuildCmd.begin(); itSbs != args.HOOK.vBuildCmd.end() ; itSbs++ )
+				{
+					// Program(s).
+					if ( _stricmp( itSbs->c_str(), "-p" ) == 0 )
+					{
+						// Next is program.
+						itSbs++;
+						args.HOOK.vTargetPrograms.push_back( *itSbs );
+					}
+					else if ( itSbs->find( "--project=" ) != string::npos )
+					{
+						itSbs->erase(0, 10 );
+						args.HOOK.vTargetPrograms.push_back( *itSbs );
+					}
+					// platform & build type ( configuration )
+					else if ( _stricmp( itSbs->c_str(), "-c" ) == 0 || itSbs->find( "--config=" ) != string::npos )
+					{
+						// Error message if config found more than once.
+						if ( bFoundConfig )
+						{
+							cout << AT_MSG << "Error, no support defining more than one configuration." << endl;
+							bRet = false;
+							continue;
+						}
+
+						if (_stricmp( itSbs->c_str(), "-c" ) == 0 )
+						{
+							// Next is the configuration
+							itSbs++;
+							// Check that iterator is valid.
+							if ( itSbs == args.HOOK.vBuildCmd.end() )
+								break;
+						}
+						else
+						{
+							// Remove the "--config=".
+							itSbs->erase( 0, 9 );
+							// Check its not empty.
+							if ( itSbs->size() == 0 )
+								break;
+						}
+						
+						// Identify configuration, if successful set sbs command as valid.
+						if ( parseSbsConfiguration( *itSbs, args ) )
+							bRet = true;
+						// Set we encountered one configuration.
+						bFoundConfig = true;
+					}
+				}
+				// Error message if command is missing configuration.
+				if ( !bFoundConfig )
+					cout << AT_MSG << "Error, missing configuration definition from sbs cmd." << endl;
+			}
+			else if ( _stricmp( it->c_str(), "abld" ) == 0 )
+			{
+				bBuildFound = true;
+				// Use abld build system, pickup all rest argumenst as abld options.
+				args.HOOK.iBuildSystem = 1;
+				
+				vector<string>::const_iterator itC = it;
+				args.HOOK.sBuildCmd.clear();
+				for ( ; itC != vArgs.end() ; itC++ )
+				{
+					args.HOOK.sBuildCmd.append( *itC );
+					args.HOOK.sBuildCmd.append( " " );
+					args.HOOK.vBuildCmd.push_back( *itC );
+				}
+				
+				string sCmd( args.HOOK.sBuildCmd ); // build command to lower case here.
+				for( size_t i = 0 ; i < sCmd.size(); i++ )
+					sCmd.at(i) = tolower( sCmd.at(i) );
+
+				// Remove all until platform
+				if ( sCmd.find("build ") != string::npos )
+				{
+					// Check is test defined
+					if ( sCmd.substr(0, sCmd.find("build ")).find("test") != string::npos )
+						args.HOOK.bAbldTest = true;
+					sCmd.erase( 0, sCmd.find("build")+6 );
+				}
+				else
+					return false;
+				
+				//Is -debug switch in command?
+				if( sCmd.find( "-debug " ) != string::npos )
+				{
+					sCmd.erase( sCmd.find( "-debug " ), 7 );
+				}
+
+				// Parse needed "variables" from command.
+				bool bOk = false;
+
+				// Find platform
+				if ( sCmd.find( "armv5" ) != string::npos )
+				{
+					bOk = true;
+					args.HOOK.sPlatform = "armv5";
+					sCmd.erase( sCmd.find( "armv5" ), 5 );
+				}
+				else if ( sCmd.find( "winscw" ) != string::npos )
+				{
+					bOk = true;
+					args.HOOK.sPlatform = "winscw";
+					sCmd.erase( sCmd.find( "winscw" ), 6 );
+				}
+				else if ( sCmd.find( "gcce" ) != string::npos )
+				{
+					bOk = true;
+					args.HOOK.sPlatform = "gcce";
+					sCmd.erase( sCmd.find( "gcce" ), 4 );
+				}
+				if ( bOk )
+				{
+					// Feature variant.
+					if ( sCmd.at(0 ) == '.' )
+					{
+						sCmd.erase(0,1);
+						args.HOOK.sFeatureVariant = sCmd.substr( 0, sCmd.find_first_of(' ') );
+						sCmd.erase(0, sCmd.find_first_of(' ')+1 );
+					}
+				}
+				else
+				{
+					// not platform specified.
+					cout << AT_MSG << "Error, no supported platform found in abld parameters (armv5/winscw/gcce)." << endl;
+					bRet = false;
+				}
+				
+				// find build type
+				bOk = false;
+				if (  sCmd.find( "urel" ) != string::npos )
+				{
+					bOk = true;
+					args.HOOK.sBuildType = "urel";
+					sCmd.erase( sCmd.find( "urel" ), 4 );
+				}
+
+				else if ( sCmd.find( "udeb" ) != string::npos )
+				{
+					bOk = true;
+					args.HOOK.sBuildType = "udeb";
+					sCmd.erase( sCmd.find( "udeb" ), 4 );
+				}
+				if( !bOk )
+				{
+					// no build type specified.
+					cout << AT_MSG << "Error, no build type specified in abld parameters (udeb/urel)." << endl;
+					bRet = false;
+				}
+		
+				// Is there multiple programs (only should be used from extension).
+				if ( sCmd.find(" -p") != string::npos )
+				{
+					sCmd.erase( sCmd.find(" -p" ), sCmd.size() - sCmd.find(" -p" ) );
+					// Loop thru all parameters and pick up programs.
+					vector<string>::iterator it;
+					for( it = args.HOOK.vBuildCmd.begin(); it != args.HOOK.vBuildCmd.end(); it++ )
+					{
+						if ( _stricmp( it->c_str(), "-p" ) == 0 )
+						{
+							// Next is program.
+							it++;
+							string sProgram = *it;
+							// Make sure program name ends with ".mmp".
+							CATBase::ChangeToLower( sProgram );
+							if ( sProgram.length() >= 4 )
+							{
+                                string sEnd = sProgram.substr( sProgram.length()-4, 4 );
+								if ( sEnd.compare( ".mmp" ) != 0 )
+									sProgram.append( ".mmp" );
+							}
+							else
+								sProgram.append( ".mmp" );
+							args.HOOK.vTargetPrograms.push_back( sProgram );
+						}
+					}
+				}
+				else {
+					// find single defined program.
+					if ( sCmd.find_first_not_of(' ') != string::npos )
+					{
+						size_t iS = sCmd.find_first_not_of(' ');
+						size_t iE = sCmd.find_first_of(' ', iS );
+						string sProgram;
+						if ( iE == string::npos )
+							sProgram = sCmd.substr( iS, sCmd.size()-iS );
+						else
+							sProgram =  sCmd.substr( iS, iE-iS);
+						// Make sure program name ends with ".mmp".
+						CATBase::ChangeToLower( sProgram );
+						if ( sProgram.length() >= 4 )
+						{
+                            string sEnd = sProgram.substr( sProgram.length()-4, 4 );
+							if ( sEnd.compare( ".mmp" ) != 0 )
+								sProgram.append( ".mmp" );
+						}
+						else
+							sProgram.append( ".mmp" );
+						args.HOOK.vTargetPrograms.push_back( sProgram );
+					}
+				}
+			}
+			else
+			{
+				if ( ! bBuildFound )
+				{
+					bRet = false;
+					cout << AT_MSG << "Error, invalid parameter :" << *it << endl;
+					break;
+				}
+			}
+		}
+	}
+	catch(...)
+	{
+		bRet = false;
+		cout << AT_MSG << "Error parsing arguments." << endl;
+	}
+	return bRet;
+}
+
+
+/**
+* Parse trace parsing related arguments from given vector of strings.
+*/
+bool parseParseArguments( vector<string>& vArgs, ARGUMENTS& args )
+{
+	// Iterator used in this function.
+	vector<string>::const_iterator it = vArgs.begin();
+
+	if ( it == vArgs.end() )
+		return false;
+
+	it++;
+
+	if ( it == vArgs.end() )
+	{
+		cout << AT_MSG << "Error, input file not defined (raw data file)." << endl;
+		return false;
+	}
+
+	//Input.
+	args.PARSE.bDataFile = true;
+	args.PARSE.sDataFile = *it;
+	
+	it++;
+	if ( it == vArgs.end() )
+	{
+	
+		cout << AT_MSG << "Error, output file not defined (device data file)." << endl;
+		return false;
+	}
+
+	//Output.
+	args.PARSE.bOutputFile = true;
+	args.PARSE.sOutputFile = *it;
+	return true;
+}
+
+/**
+* Identifies/parses the configuration string when raptor used (-c / --config= ).
+*/
+bool parseSbsConfiguration( string& sConfiguration, ARGUMENTS& args )
+{
+	CATBase::ChangeToLower( sConfiguration );
+	vector<string> tokens = CATBase::ParseStringToVector( sConfiguration, '.' );
+	
+	//we check if winscw/armv5 and udeb/urel is used
+	//rest of the "." are variants which we all support by default.
+
+	//first we check if some of aliases is used
+	if ( tokens.at(0).compare("armv5_urel") == 0 )
+	{
+		args.HOOK.sPlatform = "armv5";
+		args.HOOK.sBuildType = "urel";
+		return true;
+	}
+	else if ( tokens.at(0).compare("armv5_udeb") == 0 )
+	{
+		args.HOOK.sPlatform = "armv5";
+		args.HOOK.sBuildType = "udeb";
+		return true;
+	}
+	else if ( tokens.at(0).compare("winscw_udeb") == 0)
+	{
+		args.HOOK.sPlatform = "winscw";
+		args.HOOK.sBuildType = "udeb";
+		return true;
+	}
+	else if ( tokens.at(0).compare("winscw_urel") == 0 )
+	{
+		args.HOOK.sPlatform = "winscw";
+		args.HOOK.sBuildType = "urel";
+		return true;
+	}
+	//if 1st token is not an alias, lets try dot configurations
+	else if ( tokens.at(0).compare("arm") == 0 )
+	{
+		// check we have atleast 3 tokens. i.e arm v5 debug x ...
+		if ( tokens.size() >= 3 )
+		{
+			// Next configuration is arm version, we only support v5.
+			if ( tokens.at(1).compare( "v5" ) == 0)
+			{
+				args.HOOK.sPlatform = "armv5";
+
+				// Check next configuration part is debug or release
+				if ( tokens.at(2).compare( "udeb" ) == 0)
+				{
+					args.HOOK.sBuildType = "udeb";
+					return true;
+				}
+				else if ( tokens.at(2).compare( "urel" ) == 0 )
+				{
+					args.HOOK.sBuildType = "urel";
+					return true;
+				}
+				else
+				{
+					cout << AT_MSG << "Error in sbs configuration part: " << tokens.at(2) << endl;
+				    cout << AT_MSG << "Supported are: udeb,urel." << endl;
+				    return false;
+				}
+			}
+			else
+			{
+				cout << AT_MSG << "Error in sbs configuration part: " << tokens.at(1) << endl;
+				cout << AT_MSG << "Supported are: v5." << endl;
+				return false;
+			}
+		}
+	}
+	
+	cout << AT_MSG << "Error in sbs configuration part: " << tokens.at(0) << endl;
+	cout << AT_MSG << "Supported are: arm, armv5_urel, armv5_udeb, winscw_udeb, winscw_urel." << endl;
+	return false;
+
+}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/atool.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,242 @@
+/*
+* 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:  Defines the entry point for the console application.
+*
+*/
+
+// Includes.
+#include "../inc/ATCommonDefines.h"
+#include "../inc/CATDatParser.h"
+#include "../inc/CATParseTraceFile.h"
+#include "../inc/CATProject.h"
+
+//Debug logging parameters
+//To enable debugging as argument to atool.exe use:
+//--show_debug / -show_debug : Normal logging in console.
+//--show_debug_all / -show_debug_all : Log all (low level functions also) to console.
+//--show_dbgview / -show_dbgview : Normal logging to windows debug messages.
+//--show_dbgview_all / -show_dbgview_all : Log all (low level functions also) to windows debug messages.
+
+//Return codes (errorlevel) defined in AT_RETURN_CODE structure see ATCommonDefines.h.
+
+extern bool g_bDebugConsole = false;
+extern bool g_bDebugDbgView = false;
+extern bool g_bDebugLowLevel = false;
+
+//Argument parsing.
+extern bool parseBaseArguments( vector<string>& vArgs, ARGUMENTS& args );
+extern bool parseHookArguments( vector<string>& vArgs, ARGUMENTS& args );
+extern bool parseAnalyzeArguments( vector<string>& vArgs, ARGUMENTS& args );
+extern bool parseParseArguments( vector<string>& vArgs, ARGUMENTS& args );
+
+//Helps.
+extern void print_help( void );
+extern void print_syntax_examples( void );
+
+//AT Library check functions
+extern bool CheckATLibrariesArmv5( string sEpocRoot );
+extern bool CheckATLibrariesArmv5Abiv2( string sEpocRoot );
+extern bool CheckATLibrariesWinscw( string sEpocRoot );
+
+//CLE version functions.
+extern int showVersionInfo( void );
+
+//dbghelp.dll version function.
+extern int showDbgHelpVersionInfo( bool showVersion );
+
+//Miscelllanaeous functions.
+extern bool CheckSBS2Folder( void );
+
+const char DEBUG_PARAMETER_CONSOLE[] = "-debug";
+const char DEBUG_PARAMETER_DBGVIEW[] = "-dbgview";
+const char SBS2_PARAMETER[] = "-sbs2";
+char g_cCurrentDir[MAX_LINE_LENGTH];
+
+//Global compile class objects are neededif ctrl+c is pressed mmp file must be restored.
+CATProject project_module;
+
+//Parse object.
+CATParseTraceFile Parser;
+
+/**
+* Handle process control signals.
+*/
+BOOL WINAPI HandlerRoutine( DWORD dwCtrlType )
+{
+	//Run recovery and exit for project if user presses ctrl+c
+	//or close signal is received.
+	if( dwCtrlType == CTRL_C_EVENT || dwCtrlType == CTRL_CLOSE_EVENT )
+	{
+		int iMode = project_module.GetMode();
+		if ( iMode == CATProject::COMPILE
+			|| iMode == CATProject::INSTRUMENT
+			|| iMode == CATProject::INSTRUMENT_CONSOLE )
+			project_module.RunRecoveryAndExit();
+	}
+	//Return false so program execution is stopped.
+	return false;
+}
+// TESTING
+int _tmain( int argc, _TCHAR* argv[] )
+{
+	#ifdef MEM_LEAK_CHECK
+	_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
+	#endif
+	try {
+		//Set function to handle process control signals.
+		SetConsoleCtrlHandler( HandlerRoutine, true );
+		vector<string> vArguments;
+		for( int i = 1 ; i < argc ; i++ )
+		{
+			vArguments.push_back( argv[i] );
+		}
+		//Help variables.
+		string sEpocRoot("");
+		//Parse base arguments.
+		ARGUMENTS args;
+		parseBaseArguments( vArguments, args );
+
+		// Debugging messages.
+		if ( args.bDebugConsole == true )
+			g_bDebugConsole = true;
+		if ( args.bDebugDbgView == true )
+			g_bDebugDbgView = true;
+		if ( args.bDebugLowLevel == true )
+			g_bDebugLowLevel = true;
+
+		//According to main switch parse rest arguments.
+		switch( args.eMainSwitch )
+		{
+		case SWITCH_UNKNOWN:
+			print_help();
+			return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
+		case SWITCH_ANALYZE:
+			if ( ! parseAnalyzeArguments( vArguments, args ) )
+				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
+			// Get epocroot
+			if( ! CATBase::GetEpocRoot( sEpocRoot ) )
+				return AT_RETURN_CODE::CANNOT_FIND_EPOCROOT;
+			project_module.SetEpocRoot( sEpocRoot );
+			// project not uninstrumented run it first.
+			if ( ! project_module.IsUninstrumented() )
+			{
+				project_module.SetMode( CATProject::UNINSTRUMENT_CONSOLE );
+				project_module.Run();
+			}
+			// Set mode.
+			project_module.SetMode( CATProject::ANALYZE );
+			project_module.SetLogLevel( args.ANALYZE.iLoggingLevel );
+			project_module.SetDataFile( args.ANALYZE.sDataFile );
+			if ( args.ANALYZE.bSymbolFile )
+				project_module.SetRomSymbolFiles( args.ANALYZE.vSymbolFiles );
+			project_module.SetDataFileOutput( args.ANALYZE.sOutputFile);
+			return project_module.Run();
+		case SWITCH_HOOK:
+			// Parse arguments related to hooking.
+			if ( ! parseHookArguments( vArguments, args ) )
+				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
+			// Set variables for project.
+			if ( ! project_module.SetArguments( args ) )
+				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
+			// Get epocroot
+			if( ! CATBase::GetEpocRoot( sEpocRoot ) )
+				return AT_RETURN_CODE::CANNOT_FIND_EPOCROOT;
+			project_module.SetEpocRoot( sEpocRoot );
+			// Check AnalyzeTool libraries
+			if ( _stricmp( args.HOOK.sPlatform.c_str(), "winscw") == 0 )
+			{
+				// Emulator winscw platform
+				if ( ! CheckATLibrariesWinscw(sEpocRoot) )
+					return AT_RETURN_CODE::AT_LIBS_MISSING;
+			}
+			else
+			{
+				// Armv5
+				if ( args.HOOK.iBuildSystem == 2 )
+				{
+					// Abiv2
+					if ( ! CheckATLibrariesArmv5Abiv2(sEpocRoot) )
+						return AT_RETURN_CODE::AT_LIBS_MISSING;
+				}
+				else
+				{
+					// Abiv1
+					if( ! CheckATLibrariesArmv5(sEpocRoot) )
+						return AT_RETURN_CODE::AT_LIBS_MISSING;
+				}
+			}
+			// Run hooking.
+			return project_module.Run();
+			//Uninstrument
+		case SWITCH_UNHOOK:
+			// Set variables for project.
+			if ( ! project_module.SetArguments( args ) )
+				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
+			// Get epocroot
+			if( ! CATBase::GetEpocRoot( sEpocRoot ) )
+				return AT_RETURN_CODE::CANNOT_FIND_EPOCROOT;
+			project_module.SetEpocRoot( sEpocRoot );
+			return project_module.Run();
+		case SWITCH_VERSION:
+			return showVersionInfo();
+		case SWITCH_DBGHELP_VERSION:
+			return showDbgHelpVersionInfo( true );
+		case SWITCH_CLEAN:
+			project_module.SetMode( CATProject::CLEAN );
+			if ( CheckSBS2Folder() )
+				project_module.SetBuildSystem( CATProject::SBS_V2 );
+			else
+				project_module.SetBuildSystem( CATProject::SBS_V1 );
+			return project_module.Run();
+		case SWITCH_PARSE_TRACE:
+			if ( ! parseParseArguments( vArguments, args ) )
+				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
+			if (  CATBase::IsDataFile( args.PARSE.sDataFile ) )
+			{
+				cout << AT_MSG << "Error, " << args.PARSE.sDataFile << " is already parsed." << endl;
+				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
+			}
+			else if( CATBase::IsBinaryLogFile( args.PARSE.sDataFile ) )
+			{
+				cout << AT_MSG << "Error, " << args.PARSE.sDataFile << " is binary log file." << endl;
+				return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
+			}
+
+			if ( args.PARSE.bOutputFile )
+			{
+				//Save data with name in arguments[3]
+				Parser.StartParse( args.PARSE.sDataFile.c_str(), args.PARSE.sOutputFile.c_str() );
+			}
+			else
+			{
+				Parser.StartParse( args.PARSE.sDataFile.c_str(), NULL );
+			}
+			return AT_RETURN_CODE::OK;
+		case SWITCH_HELP:
+			print_help();
+			print_syntax_examples();
+			return AT_RETURN_CODE::OK;
+		default:
+			cout << AT_MSG << "Invalid parameters." << endl;
+			return AT_RETURN_CODE::INVALID_ARGUMENT_ERROR;
+		}
+
+	} catch(...)
+	{
+		cout << AT_MSG << "Error, unhandled exception." << endl;
+		return AT_RETURN_CODE::UNHANDLED_EXCEPTION;
+	}
+}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/cataddr2line.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,388 @@
+/*
+* 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:  Main module for addr2line pinpointing.
+*
+*/
+
+#include "../inc/cataddr2line.h"
+#include "../inc/CATMemoryAddress.h"
+#include "../inc/CATBase.h"
+#include "../inc/CATDatParser.h"
+
+#define ASCII_CHAR_CARRIAGE_RETURN 0x0D
+
+CATAddr2line::CATAddr2line()
+{
+	LOG_FUNC_ENTRY("CATAddr2line::CATAddr2line");
+}
+
+bool CATAddr2line::Open( const string& sParameter, const unsigned long /* iLong */ )
+{
+	LOG_FUNC_ENTRY("CATAddr2line::Open");
+	//Debugging for addr2line task.
+	//debug.open( "addr2line-lines.txt", ios_base::trunc );
+
+	m_sMapFileName.clear();
+	// Add .map extendsion
+	m_sMapFileName.append( sParameter );
+	m_sMapFileName.append( ".map" );
+
+	ReadMapFileArmv5();
+
+	//Make symfile path+name
+	string sFullPathToSymFile(sParameter);
+	sFullPathToSymFile.erase( sFullPathToSymFile.find_last_of( "." ), string::npos );
+	sFullPathToSymFile.append( ".sym" );
+
+	// Check with extension + .sym also.
+	if ( ! CATBase::FileExists( sFullPathToSymFile.c_str() ) )
+	{
+		sFullPathToSymFile.clear();
+		sFullPathToSymFile.append( sParameter );
+		sFullPathToSymFile.append( ".sym" );
+	}
+
+	return server.Initialize( sFullPathToSymFile );
+}
+
+string CATAddr2line::GetError( void )
+{
+	LOG_FUNC_ENTRY("CATAddr2line::GetError");
+	string s;
+	return s;
+}
+
+bool CATAddr2line::Close( void )
+{
+	LOG_FUNC_ENTRY("CATAddr2line::Close");
+	//Debugging for addr2line task.
+	//debug.close();
+	return true;
+}
+
+bool CATAddr2line::AddressToLine( CATMemoryAddress* result )
+{
+	LOG_FUNC_ENTRY("CATAddr2line::AddressToLine");
+	
+	result->SetAddressToLineState( CATMemoryAddress::OUT_OF_RANGE);
+
+	if( !server.GetProcessCreatedState() )
+		return false;
+	//Count address
+	ULONG uStartA = result->GetModuleStartAddress();
+	ULONG uMemoryA = result->GetAddress();
+	ULONG uCountedA = uMemoryA - uStartA;
+	uCountedA += FUNCTIONS_OFFSET_IN_GCCE;
+
+	string sTemp = CATBase::NumberToHexString( uCountedA );
+    //Remove "0x"
+    size_t iCounter = sTemp.find_first_of('x');
+    if( iCounter != string::npos )
+    {
+		sTemp.erase( 0, (int)iCounter+1 );
+    }
+	// Write to pipe that is the standard input for a child process.
+	server.WriteToPipe( sTemp ); 
+ 
+	// Read from pipe that is the standard output for child process.
+    string s = server.ReadFromPipe();
+
+	//If output not empty, parse output
+	if( !s.empty() )
+	{
+		//Debugging code for addr2line task.
+		//debug.write( "##########\n", 12 );
+		//debug.write( s.c_str(), s.size() );
+		result->SetAddressToLineState( CATMemoryAddress::EXACT );
+
+		string s2;
+		size_t iLocation = s.find_first_of( ASCII_CHAR_CARRIAGE_RETURN );
+
+		bool bFunctionNameFoundUsingAddr2line = false;
+
+		//Function name
+		
+		if(iLocation != string::npos )
+		{
+			s2 = s.substr( 0, iLocation );
+			//All characters ascii?
+			if( CATBase::IsAscii( s2.c_str(), (int)s2.length() ) )
+			{
+				//addr2line returns $x if function name not found
+				//length must over 2 to be real function name
+				if( s2.length() > 2 )
+				{
+					bFunctionNameFoundUsingAddr2line = true;
+					result->SetFunctionName( s2 );
+					s.erase( 0, iLocation+2 );
+				}
+			}
+		}
+		//If function name not found using addr2line find it from map file
+		if( !bFunctionNameFoundUsingAddr2line )
+		{
+			string sFuncName( GetFunctionNameUsingAddress( uCountedA ) );
+			//If function name empty, print "???"
+			if( sFuncName.empty() )
+			{
+				s2 = "???";
+				result->SetFunctionName( s2 );
+				if(iLocation != string::npos )
+				{
+					s.erase( 0, iLocation+2 );
+				}
+			}
+			else
+				result->SetFunctionName( sFuncName );
+		}
+		iLocation = s.find_first_of( ':' );
+
+		//Filename and location
+
+		if(iLocation != string::npos )
+		{
+			s2 = s.substr( 0, iLocation );
+			result->SetFileName( s2 );
+			s.erase( 0, iLocation+1 );
+		}
+
+		//Exact line number
+
+		s2 = s.substr( 0, s.find_first_of( ASCII_CHAR_CARRIAGE_RETURN ) );
+		result->SetExactLineNumber( atoi( s2.c_str() ) );
+	}
+	return true;
+}
+
+bool CATAddr2line::ReadMapFileArmv5()
+{
+	LOG_FUNC_ENTRY("CATModule2::ReadMapFileArmv5");
+	// Open .map file
+	ifstream in( m_sMapFileName.c_str() );
+	// File open ok?
+	if( ! in.good() )
+	{
+		in.close();
+		return false;
+	}
+	char cTemp[MAX_LINE_LENGTH];
+	bool bFirstFuncFound = false;
+	bool bFirstLine = true;
+	// Get all lines where is "Thumb"
+	do
+	{
+		// Load one line from .map file
+		in.getline( cTemp, MAX_LINE_LENGTH );
+		if( bFirstLine )
+		{
+			bFirstLine = false;
+			if( strstr( cTemp, "ARM Linker" ) == NULL )
+				return false;
+		}
+		// Find _E32Startup
+		if( !bFirstFuncFound && ( strstr( cTemp, "_E32Startup" ) != NULL) )
+		{
+			bFirstFuncFound = true;
+		}
+		else if( !bFirstFuncFound && ( strstr( cTemp, "_E32Dll" ) != NULL) )
+		{
+			bFirstFuncFound = true;
+		}
+		else if( !bFirstFuncFound )
+			// Skip if _E32Startup not found
+			continue;
+
+		if( strstr( cTemp, "Thumb Code" ) != NULL || strstr( cTemp, "ARM Code" ) != NULL)
+		{
+			MAP_FUNC_INFO structMapFileLineInfo;
+			structMapFileLineInfo.sWholeLine.append( cTemp );
+
+			// Get memory string address from line
+			char* pStart = strstr( cTemp, "0x" );
+			// Check did strstr return null.
+			if ( pStart == NULL )
+				continue;
+			char* pTemp = pStart;
+			char TempString[MAX_LINE_LENGTH];
+			TempString[0] = 0;
+			size_t iLength = 0;
+			while( *pTemp != ' ' )
+			{
+				TempString[iLength] = *pTemp;
+				pTemp++;
+				iLength++;
+			}
+			TempString[iLength] = 0;
+
+			structMapFileLineInfo.iAddress = CATDatParser::_httoi( TempString );
+
+			pTemp = cTemp;
+			TempString[0] = 0;
+			
+			// Get function name
+
+			// Skip spaces
+			while( *pTemp == ' ' )
+			{
+				pTemp++;
+			}
+			iLength = 0;
+			// Find end of function name
+			string sTemp( pTemp );
+
+			// Location of character ')'
+			iLength = sTemp.find_first_of(')');
+
+			// Location of character ' '
+			size_t iLength2 = sTemp.find_first_of(' ');
+			
+			// If ')' character is the last char and
+			// character ' ' is closer than ')' use location of ' '
+			if( ( iLength + 1 ) == sTemp.length() && iLength2 < iLength )
+				iLength = iLength2 - 1;
+			
+			if( iLength != string::npos )
+				sTemp.resize( (iLength + 1) );
+
+			structMapFileLineInfo.sFunctionName.append( sTemp.c_str() );
+
+			bool bARM = false;
+			// Find function length
+			pStart = strstr( cTemp, "Thumb Code" );
+			if( pStart == NULL )
+			{
+				pStart = strstr( cTemp, "ARM Code" );
+				bARM = true;
+			}
+			if( pStart != NULL )
+			{
+				if( bARM )
+					pStart += 8;
+				else
+					pStart += 10;
+				while(*pStart == ' ')
+				{
+					pStart++;
+				}
+				sTemp.clear();
+				sTemp.append( pStart );
+				size_t iSize = sTemp.find_first_of(' ');
+				if( iSize != string::npos )
+					sTemp.resize( iSize );
+			}
+
+			structMapFileLineInfo.iFuncLength = atoi( sTemp.c_str() );
+			if( bFirstFuncFound && structMapFileLineInfo.iFuncLength > 0 )
+				// Save to list
+				m_vMapFileFuncList.push_back( structMapFileLineInfo );
+		}
+	}
+	while( in.good() );
+	in.close();
+	return true;
+}
+
+// Find function name of given address
+string CATAddr2line::GetFunctionNameUsingAddress( unsigned long iAddress )
+{
+	LOG_LOW_FUNC_ENTRY("CATAddr2line::GetSymbolIndexUsingAddress");
+	string sRet;
+	for( size_t i = 0; i < m_vMapFileFuncList.size(); i++ )
+	{
+		unsigned long iStart = m_vMapFileFuncList.at( i ).iAddress;
+		unsigned long iEnd = ( m_vMapFileFuncList.at( i ).iAddress
+			+ m_vMapFileFuncList.at( i ).iFuncLength );
+
+		if ( iAddress >= iStart && iAddress < iEnd )
+			return m_vMapFileFuncList.at( i ).sFunctionName;
+	}
+	return sRet;
+}
+
+//Note: New filtering functions commented out until they are taken into use.
+/**
+* Filter string out of unwanted characters.
+*/
+/*
+void CATAddr2line::FilterString( string &sString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAddr2line::FilterString");
+	string sFiltered("");
+	for( size_t i = 0 ; i < sString.length() ; i++ )
+	{
+		const char p = sString.at( i );
+		if ( p != 0 && strchr( ADDR2LINEALLOWEDCHARS, p ) != 0 )
+			sFiltered.push_back( p );
+	}
+	sString = sFiltered;
+}
+*/
+/**
+* Find line feed position from string.
+*/
+/*
+size_t CATAddr2line::FindLineFeed( const string& sString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAddr2line::FindLineFeed");
+	size_t iLineFeed1 = sString.find( 12 );
+	size_t iLineFeed2 = sString.find( 15 );
+	if ( iLineFeed1 < iLineFeed2 && iLineFeed1 != string::npos )
+		return iLineFeed1;
+	else if ( iLineFeed2 != string::npos )
+		return iLineFeed2;
+	else
+		return string::npos;
+}
+*/
+/**
+* Erase characters from start of the string until other char than linefeed found.
+*/
+/*
+void CATAddr2line::EraseUntilNoLineFeed( string& sString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAddr2line::EraseUntilNoLineFeed");
+	for ( size_t i = 0 ; i < sString.length() ; i++ )
+	{
+		if ( sString.at( i ) != 15 && sString.at( i ) != 12 )
+			break;
+	}
+	sString.erase( 0, i );
+}
+*/
+/**
+* Split multiple line string with unexpected line feeds to vector of strings.
+*/
+/*
+vector<string> CATAddr2line::SplitToStrings( string& sMultiLineString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAddr2line::SplitToStrings");
+    vector<string> vLines;
+	while ( 1 )
+	{
+		size_t iLineFeed = FindLineFeed( sMultiLineString );
+		if ( iLineFeed == string::npos )
+			break;
+		string sCell = sMultiLineString.substr(0, iLineFeed );
+		sMultiLineString.erase(0, iLineFeed );
+		EraseUntilNoLineFeed( sMultiLineString );
+		FilterString( sCell );
+		vLines.push_back( sCell );
+	}
+	// If no lines were found set single one.
+	if ( vLines.size() == 0 )
+		vLines.push_back( sMultiLineString );
+	return vLines;
+}
+*/
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/cataddr2lineserver.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,286 @@
+/*
+* 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:  Class representing a server that uses addr2line.exe.
+*
+*/
+
+#include "../inc/cataddr2lineserver.h"
+#include "../inc/CATBase.h"
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+CATAddr2lineServer::CATAddr2lineServer()
+{
+	LOG_FUNC_ENTRY("CATAddr2lineServer::CATAddr2lineServer");
+	m_bProcessCreated = false;
+
+	// Pipe handles.
+	m_hChildErroutRd = 0;
+	m_hChildErroutRdDup = 0;
+	m_hChildErroutWr = 0;
+	m_hChildStdinRd = 0;
+	m_hChildStdinWr = 0;
+	m_hChildStdinWrDup = 0;
+	m_hChildStdoutRd = 0;
+	m_hChildStdoutWr = 0;
+	m_hChildStdoutRdDup = 0;
+	
+	m_hSaveErrout = 0;
+	m_hSaveStdin = 0;
+	m_hSaveStdout = 0;
+
+    // Set the bInheritHandle flag so pipe handles are inherited.
+    m_saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
+    m_saAttr.bInheritHandle = TRUE;
+    m_saAttr.lpSecurityDescriptor = NULL;
+
+	// Symbol file.
+	m_sFullPathAndBinaryName = "";
+}
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+CATAddr2lineServer::~CATAddr2lineServer()
+{
+	LOG_FUNC_ENTRY("CATAddr2lineServer::~CATAddr2lineServer");
+	// Close the pipe handle so the child process stops reading.
+    CloseHandle(m_hChildStdinWrDup);
+    // Close the write end of the pipe
+    CloseHandle(m_hChildStdoutWr);
+    // Close the write end of the error pipe
+	CloseHandle(m_hChildErroutWr);
+}
+bool CATAddr2lineServer::Initialize( const string& sFullPathAndBinaryName )
+{
+    LOG_FUNC_ENTRY("CATAddr2lineServer::Initialize");
+	BOOL fSuccess;
+	m_sFullPathAndBinaryName = sFullPathAndBinaryName;
+
+    // The steps for redirecting child process's STDOUT:
+    //     1. Save current STDOUT, to be restored later.
+    //     2. Create anonymous pipe to be STDOUT for child process.
+    //     3. Set STDOUT of the parent process to be write handle to
+    //        the pipe, so it is inherited by the child process.
+    //     4. Create a noninheritable duplicate of the read handle and
+    //        close the inheritable read handle.
+ 
+    // Save the handle to the current STDOUT. 
+    m_hSaveStdout = GetStdHandle(STD_OUTPUT_HANDLE); 
+
+    // Create a pipe for the child process's STDOUT.
+    if (! CreatePipe(&m_hChildStdoutRd, &m_hChildStdoutWr, &m_saAttr, 0))
+		return PrintErrorAndExit( "Stdout pipe creation failed\n" );
+
+    // Set a write handle to the pipe to be STDOUT.
+   if (! SetStdHandle(STD_OUTPUT_HANDLE, m_hChildStdoutWr))
+		return PrintErrorAndExit( "Redirecting STDOUT failed\n" );
+
+    // Create noninheritable read handle and close the inheritable read
+    // handle.
+    fSuccess = DuplicateHandle(GetCurrentProcess(), m_hChildStdoutRd,
+        GetCurrentProcess(), &m_hChildStdoutRdDup , 0,
+        FALSE,
+        DUPLICATE_SAME_ACCESS);
+    if( !fSuccess )
+		return PrintErrorAndExit( "DuplicateHandle failed" );
+    CloseHandle(m_hChildStdoutRd);
+
+    // The steps for redirecting child process's STDIN:
+    //     1.  Save current STDIN, to be restored later.
+    //     2.  Create anonymous pipe to be STDIN for child process.
+    //     3.  Set STDIN of the parent to be the read handle to the
+    //         pipe, so it is inherited by the child process.
+    //     4.  Create a noninheritable duplicate of the write handle,
+    //         and close the inheritable write handle.
+ 
+    // Save the handle to the current STDIN.
+    m_hSaveStdin = GetStdHandle(STD_INPUT_HANDLE);
+
+    // Create a pipe for the child process's STDIN.
+    if (! CreatePipe(&m_hChildStdinRd, &m_hChildStdinWr, &m_saAttr, 0))
+		return PrintErrorAndExit( "Stdin pipe creation failed\n" );
+ 
+    // Set a read handle to the pipe to be STDIN. 
+    if (! SetStdHandle(STD_INPUT_HANDLE, m_hChildStdinRd)) 
+		return PrintErrorAndExit( "Redirecting Stdin failed\n" ); 
+ 
+    // Duplicate the write handle to the pipe so it is not inherited. 
+	
+    fSuccess = DuplicateHandle(GetCurrentProcess(), m_hChildStdinWr, 
+        GetCurrentProcess(), &m_hChildStdinWrDup, 0, 
+        FALSE,                  // not inherited 
+        DUPLICATE_SAME_ACCESS); 
+    if (! fSuccess) 
+		return PrintErrorAndExit( "DuplicateHandle failed\n" );
+
+    CloseHandle(m_hChildStdinWr);
+ 
+    // The steps for redirecting child process's ERROUT:
+    //     1. Save current STDOUT, to be restored later.
+    //     2. Create anonymous pipe to be STDOUT for child process.
+    //     3. Set STDOUT of the parent process to be write handle to
+    //        the pipe, so it is inherited by the child process.
+    //     4. Create a noninheritable duplicate of the read handle and
+    //        close the inheritable read handle.
+ 
+    // Save the handle to the current STDOUT. 
+    m_hSaveErrout = GetStdHandle( STD_ERROR_HANDLE ); 
+
+    // Create a pipe for the child process's ERROUT.
+    if (! CreatePipe(&m_hChildErroutRd, &m_hChildErroutWr, &m_saAttr, 0))
+		return PrintErrorAndExit( "Errout pipe creation failed\n" );
+
+    // Set a write handle to the pipe to be ERROUT.
+   if (! SetStdHandle(STD_ERROR_HANDLE, m_hChildErroutWr))
+		return PrintErrorAndExit( "Redirecting ERROUT failed\n" );
+
+    // Create noninheritable read handle and close the inheritable read
+    // handle.
+   
+    fSuccess = DuplicateHandle(GetCurrentProcess(), m_hChildErroutRd,
+        GetCurrentProcess(), &m_hChildErroutRdDup , 0,
+        FALSE,
+        DUPLICATE_SAME_ACCESS);
+    if( !fSuccess )
+		return PrintErrorAndExit( "DuplicateHandle failed" );
+    
+	CloseHandle(m_hChildErroutRd);
+	CloseHandle(m_hChildErroutRdDup);
+	
+	// Now create the child process. 
+    fSuccess = CreateChildProcess();
+    if (!fSuccess )
+		return PrintErrorAndExit( "Create process failed\n" );
+ 
+    // After process creation, restore the saved STDIN and STDOUT.
+	if (! SetStdHandle(STD_INPUT_HANDLE, m_hSaveStdin))
+        return PrintErrorAndExit( "Re-redirecting Stdin failed\n" );
+
+	if (! SetStdHandle(STD_OUTPUT_HANDLE, m_hSaveStdout))
+       return PrintErrorAndExit( "Re-redirecting Stdout failed\n" );
+
+	if (! SetStdHandle(STD_ERROR_HANDLE, m_hSaveErrout))
+       return PrintErrorAndExit( "Re-redirecting Stderrout failed\n" );
+
+	m_bProcessCreated = true;
+    return true;
+}
+BOOL CATAddr2lineServer::CreateChildProcess() 
+{ 
+    LOG_FUNC_ENTRY("CATAddr2lineServer::CreateChildProcess");
+    PROCESS_INFORMATION piProcInfo; 
+    STARTUPINFO siStartInfo;
+    BOOL bFuncRetn = FALSE; 
+ 
+    // Set up members of the PROCESS_INFORMATION structure.
+    ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) );
+ 
+	// Set up members of the STARTUPINFO structure.
+    ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) );
+    siStartInfo.cb = sizeof(STARTUPINFO); 
+ 
+	//atool.exe:s path + filename
+	char buffer[MAX_PATH];
+
+	GetModuleFileName( NULL, buffer, MAX_PATH );
+
+	string sCommand( buffer );
+
+	//Remove 'atool.exe'
+	size_t tPos = sCommand.rfind( "\\" );
+	if ( tPos != string::npos )
+		sCommand.resize( sCommand.rfind( "\\" )+1 );
+	else
+		sCommand.clear();
+
+	sCommand.append( "addr2line.exe" );
+
+	//addr2line file exists
+	if( !CATBase::FileExists( sCommand.c_str() ) )
+		return PrintErrorAndExit( "File not found addr2line.exe\n" );
+
+	//Sym file exists
+	if( !CATBase::FileExists( m_sFullPathAndBinaryName.c_str() ) )
+	{
+		string sTemp( "File not found " );
+		sTemp.append( m_sFullPathAndBinaryName );
+		sTemp.append( "\n" );
+		return PrintErrorAndExit( sTemp );
+	}
+
+	sCommand.append(" -f -C -e ");
+	sCommand.append( m_sFullPathAndBinaryName );
+
+	// Create the child process. 
+    bFuncRetn = CreateProcess(NULL,
+		(LPSTR)sCommand.c_str(), // command line
+        NULL,          // process security attributes
+        NULL,          // primary thread security attributes
+        TRUE,          // handles are inherited
+        0,             // creation flags
+        NULL,          // use parent's environment
+        NULL,          // use parent's current directory
+        &siStartInfo,  // STARTUPINFO pointer
+        &piProcInfo);  // receives PROCESS_INFORMATION
+
+    if (bFuncRetn == 0)
+    {
+       //CreateProcess failed
+       return false;
+    }
+    else
+    {
+       CloseHandle(piProcInfo.hProcess);
+       CloseHandle(piProcInfo.hThread);
+       return bFuncRetn;
+    }
+}
+VOID CATAddr2lineServer::WriteToPipe( const string& sAddress ) 
+{ 
+	LOG_LOW_FUNC_ENTRY("CATAddr2lineServer::WriteToPipe");
+    DWORD dwRead, dwWritten;
+    CHAR chBuf[2]; //This is for enter key
+
+    //Write data to a pipe. 
+    dwRead = (DWORD)sAddress.length();
+	WriteFile(m_hChildStdinWrDup, sAddress.c_str(), dwRead, &dwWritten, NULL);
+
+	chBuf[0] = 0x0A; //Enter
+	chBuf[1] = 0; //NULL
+	//Write enter key to a pipe
+	WriteFile(m_hChildStdinWrDup, chBuf, 1, &dwWritten, NULL);
+} 
+string CATAddr2lineServer::ReadFromPipe(VOID) 
+{
+	LOG_LOW_FUNC_ENTRY("CATAddr2lineServer::ReadFromPipe");
+	string s;
+	DWORD dwRead;
+    CHAR chBuf[BUFSIZE];
+    // Read output from the child process, and save data to string.
+    ReadFile( m_hChildStdoutRdDup, chBuf, BUFSIZE, &dwRead, NULL);
+	s.append( chBuf );
+    return s;
+}
+bool CATAddr2lineServer::GetProcessCreatedState( void )
+{
+	LOG_LOW_FUNC_ENTRY("CATAddr2lineServer::GetProcessCreatedState");
+	return m_bProcessCreated;
+}
+bool CATAddr2lineServer::PrintErrorAndExit( const string sInput )
+{
+	LOG_FUNC_ENTRY("CATAddr2lineServer::PrintErrorAndExit");
+	cout << AT_MSG << sInput;
+	return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/catalloc.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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 "../inc/ATCommonDefines.h"
+#include "../inc/catalloc.h"
+
+string CATAlloc::GetAllocString( void )
+{
+	LOG_LOW_FUNC_ENTRY("CATAlloc::GetAllocString");
+	// Create alloc string
+	string sLine("");
+	sLine.append( m_sTime ); sLine.append(" " );
+	sLine.append( m_sSize );
+
+	// Add all call stack fragments to line.
+	string sCallStack;
+	map<unsigned long, string>::iterator it;
+	for( it = m_vCallStack.begin() ; it != m_vCallStack.end() ; it++ )
+	{
+		sCallStack.append( (*it).second );
+		sCallStack.append( " " );
+	}
+	// Remove the last space
+	if ( sCallStack.size() > 0 )
+		sCallStack.erase( sCallStack.size()-1, 1 );
+	
+	if ( m_iCSCount != 0 )
+	{
+		// Check integrity (calculate number of spaces in call stack)
+		unsigned long iCount = 0;
+		size_t pos = 0;
+		while ( pos != string::npos )
+		{
+			iCount++;
+			pos = sCallStack.find_first_of( ' ', pos+1 );
+		}
+		if ( iCount != m_iCSCount )
+			cout << AT_MSG << "Error, integrity check failed in alloc." << endl;
+	}
+
+	// Add call stack to line.
+	if ( sCallStack.size() > 0 )
+	{
+		sLine.append(" " );
+		sLine.append( sCallStack );
+	}
+
+	// return alloc line.
+	return sLine;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/catallocs.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,229 @@
+/*
+* 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 "../inc/ATCommonDefines.h"
+#include "../inc/catallocs.h"
+
+void CATAllocs::Alloc( const string& sAllocString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAllocs::Alloc");
+	string sAlloc( sAllocString );
+	CATAlloc alloc;
+	string sAddress = GetStringUntilNextSpace( sAlloc, true );
+	alloc.m_sTime = GetStringUntilNextSpace( sAlloc, true );
+	alloc.m_sSize = GetStringUntilNextSpace( sAlloc, true );
+	alloc.m_vCallStack.insert( pair<unsigned long,string>(1, sAlloc) );
+	// Add allocation
+	pair< map<string,CATAlloc>::iterator, bool> ret;
+	ret = m_vAllocs.insert( pair<string, CATAlloc>( sAddress, alloc ) );
+	if( ret.second == false )
+	{
+		// Allocation to this memory address was already added.
+		LOG_STRING( "CATAllocs: Allocating same address again, address: " << sAddress );
+	}
+}
+
+void CATAllocs::AllocH( const string& sAllocHString, const string& aTimeString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAllocs::AllocH");
+	string sAllocH( sAllocHString );
+	// Parse alloc & create new allocation.
+	CATAlloc alloc;
+	alloc.m_sTime = aTimeString;
+	string sAddress = GetStringUntilNextSpace( sAllocH, true );
+	alloc.m_sSize = GetStringUntilNextSpace( sAllocH, true );
+	alloc.m_iThreadId = GetStringUntilNextSpace ( sAllocH, true );
+	alloc.m_iCSCount = _httoi( string( GetStringUntilNextSpace( sAllocH, true ) ).c_str() );
+	// Insert call stack fragment as "first" 1 because we are header.
+	if ( alloc.m_iCSCount > 0 )
+		alloc.m_vCallStack.insert( pair<unsigned long,string>( 0, sAllocH ) );
+	// Add allocation
+	pair< map<string,CATAlloc>::iterator, bool> ret;
+	ret = m_vAllocs.insert( pair<string, CATAlloc>( sAddress, alloc ) );
+	if( ret.second == false )
+	{
+		// Allocation to this memory address was already added.
+		LOG_STRING( "CATAllocs: Allocating same address again, address: " << sAddress );
+	}
+}
+
+void CATAllocs::AllocF( const string& sAllocFString, const string& aTimeString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAllocs::AllocF");
+	string sAllocF( sAllocFString );
+	string sAddress = GetStringUntilNextSpace( sAllocF, true );
+	string sTime = aTimeString;
+	unsigned long iNumber = _httoi( string( GetStringUntilNextSpace( sAllocF, true ) ).c_str() );
+	string sCallSstack = sAllocF;
+	// Find correct allocation into which add call stack fragment.
+	map<string, CATAlloc>::iterator it;
+	it = m_vAllocs.find( sAddress );
+	// TODO: If cannot find, create new in cache.
+	if ( it == m_vAllocs.end() )
+	{
+		LOG_STRING( "CATAllocs: Allocate fragment without header: " << sAddress );
+		return;
+	}
+	pair< map<unsigned long,string>::iterator, bool> ret;
+	// Add call stack to it.
+	ret = it->second.m_vCallStack.insert( pair<unsigned long,string>( iNumber, sCallSstack ) );
+	if( ret.second == false )
+	{
+		LOG_STRING( "CATAllocs: Same allocation fragment again: " << sAddress );
+	}
+}
+
+// ReallocH.
+void CATAllocs::ReallocH( const string& sReallocHString, const string& aTimeString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAllocs::ReallocH");
+	string sAllocH( sReallocHString );
+	// Parse alloc & create new allocation.
+	CATAlloc alloc;
+	string sAddress = GetStringUntilNextSpace( sAllocH, true );
+	alloc.m_sTime = aTimeString;
+	alloc.m_sSize = GetStringUntilNextSpace( sAllocH, true );
+	alloc.m_iCSCount = _httoi( string( GetStringUntilNextSpace( sAllocH, true ) ).c_str() );
+	// Insert call stack fragment as "first" 1 because we are header.
+	if ( alloc.m_iCSCount > 0 )
+		alloc.m_vCallStack.insert( pair<unsigned long,string>( 0, sAllocH ) );
+	// Add allocation
+	pair< map<string,CATAlloc>::iterator, bool> ret;
+	ret = m_vAllocs.insert( pair<string, CATAlloc>( sAddress, alloc ) );
+	if( ret.second == false )
+	{
+		// Allocation to this memory address was already added.
+		LOG_STRING( "CATAllocs: Allocating same address again, address: " << sAddress );
+	}
+}
+
+// ReallocF.
+void CATAllocs::ReallocF( const string& sReallocFString, const string& aTimeString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAllocs::ReallocF");
+	string sAllocF( sReallocFString );
+	string sAddress = GetStringUntilNextSpace( sAllocF, true );
+	string sTime = aTimeString;
+	unsigned long iNumber = _httoi( string( GetStringUntilNextSpace( sAllocF, true ) ).c_str() );
+	string sCallSstack = sAllocF;
+	// Find correct allocation into which add call stack fragment.
+	map<string, CATAlloc>::iterator it;
+	it = m_vAllocs.find( sAddress );
+	// TODO: If cannot find, create new in cache.
+	if ( it == m_vAllocs.end() )
+	{
+		LOG_STRING( "CATAllocs: Allocate fragment without header: " << sAddress );
+		return;
+	}
+	pair< map<unsigned long,string>::iterator, bool> ret;
+	// Add call stack to it.
+	ret = it->second.m_vCallStack.insert( pair<unsigned long,string>( iNumber, sCallSstack ) );
+	if( ret.second == false )
+	{
+		LOG_STRING( "CATAllocs: Same allocation fragment again: " << sAddress );
+	}
+}
+
+// Free message.
+void CATAllocs::Free( const string& sFreeString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAllocs::Free");
+	string sFree( sFreeString );
+	string sKey = GetStringUntilNextSpace( sFree );
+	// Find related allocation.
+	map<string, CATAlloc>::iterator it;
+	it = m_vAllocs.find( sKey );
+	if ( it == m_vAllocs.end() )
+	{
+		LOG_STRING( "CATAllocs: Free message which has no alloc pair: " << sKey );
+		return;
+	}
+	// Delete it.
+	m_vAllocs.erase( it );
+}
+
+// FreeH.
+void CATAllocs::FreeH( const string& sFreeH, const string& aTimeString )
+{
+	LOG_LOW_FUNC_ENTRY("CATAllocs::FreeH");
+	// Current implementation does not use call stack of
+	// free message to anything.
+	string sFree( sFreeH );
+	string sKey = GetStringUntilNextSpace( sFree );
+	// Time stamp. (not used currently)
+	// Thread ID. (not used currently)
+	// Call stack count. (not used currently)
+	// Call stack data. (not used currently)
+
+	// Find related allocation.
+	map<string, CATAlloc>::iterator it;
+	it = m_vAllocs.find( sKey );
+	if ( it == m_vAllocs.end() )
+	{
+		LOG_STRING( "CATAllocs: FreeH message which has no alloc pair: " << sKey );
+		return;
+	}
+	// Delete it.
+	m_vAllocs.erase( it );
+}
+
+// FreeF.
+void CATAllocs::FreeF( const string& /* sFreeF */, const string& /* aTimeString */ )
+{
+	LOG_LOW_FUNC_ENTRY("CATAllocs::FreeF");
+	// Fragments are currently ignored.
+	// Memory address. (not used currently)
+	// Time stamp. (not used currently)
+	// Packet number. (not used currently)
+	// Call stack data. (not used currently)
+}
+
+// Get "leak" list ordered by allocation time.
+void CATAllocs::GetLeakList( vector<string>& vLeakList )
+{
+	LOG_LOW_FUNC_ENTRY("CATAllocs::GetLeakList");
+
+	// Create multimap where key is timestamp.
+	// Add allocations there so they will go ascending order.
+	multimap<string,string> mmap;
+	multimap<string,string>::iterator itMmap;
+	
+	map<string, CATAlloc>::iterator it;
+	for( it = m_vAllocs.begin(); it != m_vAllocs.end() ; it++ )
+	{
+		string sTime = it->second.m_sTime;
+		
+		string sLine = it->first;
+		sLine.append(" ");
+		sLine.append( it->second.GetAllocString() );
+
+		mmap.insert( pair<string,string>( sTime, sLine ) );
+	}
+	
+	// Iterate list to parameter vector.
+	vLeakList.clear();
+	for ( itMmap = mmap.begin(); itMmap != mmap.end(); itMmap++ )
+		vLeakList.push_back( itMmap->second );
+}
+
+// Clear alloc data.
+void CATAllocs::ClearAllocs( void )
+{
+	LOG_LOW_FUNC_ENTRY("CATAllocs::ClearAllocs");
+	m_vAllocs.clear();
+}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/catdbghelper.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,314 @@
+/*
+* 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:  Windows debug api implementation for IAddressToLine interface.
+*
+*/
+
+#include "../inc/catdbghelper.h"
+#include "../inc/CATBase.h"
+#include "../inc/CATMemoryAddress.h"
+#include <dbghelp.h>
+
+/**
+* Notes on version number of api functions.
+* 5.1	Windows XP
+* 5.2	Windows Server 2003
+* 6.8	Debugging Tools for Windows 6.8
+* SymSetOptions			DbgHelp.dll 5.1 or later
+* SymSetSearchPath		DbgHelp.dll 5.1 or later
+* SymLoadModuleEx			Versions 5.2 and 6.0
+* SymLoadModule64			DbgHelp.dll 5.1 or later
+* SymFromAddr				Versions 4.0 and 5.1
+* SymGetLineFromAddr64	DbgHelp.dll 5.1 or later
+*/
+
+// Wrapper class for symbol information package.
+struct CSymbolInfo : public SYMBOL_INFO_PACKAGE
+{
+	CSymbolInfo()
+	{
+		si.SizeOfStruct = sizeof( SYMBOL_INFO );
+		si.MaxNameLen = sizeof( name );
+	}
+};
+
+// Wrapper class for line information container.
+struct CLineInfo : public IMAGEHLP_LINE64
+{
+	CLineInfo()
+	{
+		SizeOfStruct = sizeof( IMAGEHLP_LINE64 );
+	}
+};
+
+CATDbgHelper::CATDbgHelper()
+{
+	LOG_FUNC_ENTRY("CATDbgHelper::CDbgHelper");
+	// Set the some "default" base address.
+	m_BaseAddress = 0x2;
+	m_bMap = false;
+	m_pBinaryFile = NULL;
+}
+
+CATDbgHelper::~CATDbgHelper()
+{
+	LOG_FUNC_ENTRY("CATDbgHelper::~CDbgHelper");
+	// Close dbghelper only once.
+	if ( CDBGHELPER_OPEN )
+	{
+		Close();
+	}
+	if ( m_pBinaryFile )
+	{
+		delete[] m_pBinaryFile;
+		m_pBinaryFile = NULL;
+	}
+}
+
+bool CATDbgHelper::Open( const string& sParameter, const unsigned long iLong )
+{
+	LOG_FUNC_ENTRY("CATDbgHelper::Open");
+	// Verify that file exits. Version 5.1.2600.5512 of dbghelp.dll does not correctly
+	// return error code if missing image file. This can lead upto applicaton crash.
+	if ( ! CATBase::FileExists( sParameter.c_str() ) )
+	{
+		LOG_STRING( "Missing image file: " << sParameter );
+		return false;
+	}
+
+	// Is it urel try read map?
+	if ( sParameter.find( "\\urel\\" ) != string::npos )
+	{
+		string sMapFile = sParameter;
+		sMapFile.append( ".map" );
+		ReadMapFile( sMapFile );
+	}
+
+	// Set base address used
+	m_BaseAddress = iLong + AT_VIRTUAL_OFFSET_DBGHELPER;
+	// Binary file (also referred as symbol).
+	size_t length = sParameter.length();
+	if ( length == 0 )
+	{
+		LOG_STRING("DbgHelp:Invalid binary parameter.");
+		return false;
+	}
+
+	char* pChar = new char[ sParameter.length()+1 ];
+	strcpy( pChar, sParameter.c_str() );
+	// Have to be casted to PSTR before using dbg api. Even tho its typedef same.
+	// This will avoid access violations bug.
+	// Note pChar is not deleted because its the member pointer just casted its
+	// memory allocation freed in destructor.
+	if ( m_pBinaryFile )
+		delete[] m_pBinaryFile;
+
+	m_pBinaryFile = (PSTR) pChar;
+
+	// Initialize dbghelper if not done only once.
+	if ( ! CDBGHELPER_OPEN )
+	{
+		// Set symbol options
+		SymSetOptions( SYMOPT_LOAD_LINES | SYMOPT_DEBUG | SYMOPT_UNDNAME | SYMOPT_LOAD_ANYTHING );
+		if ( !SymInitialize( GetCurrentProcess(), NULL, TRUE ) )
+		{
+			LOG_STRING("DbgHelp:Error initializing dbghelper " << (int) GetLastError());
+			return false;
+		}
+		LOG_STRING("DbgHelp:dbghelper opened.");
+		CDBGHELPER_OPEN = true;
+	}
+
+	// Set symbol search path.
+	if ( !SymSetSearchPath( GetCurrentProcess(), NULL ) )
+	{
+		LOG_STRING("DbgHelp:Error setting symbol search path " << (int) GetLastError());
+		return false;
+	}
+
+	// Load module.
+	DWORD64 ret;
+	ret = SymLoadModule64( GetCurrentProcess(), NULL, m_pBinaryFile, NULL, m_BaseAddress, NULL ); // 5.1 api version.
+	if ( ret != m_BaseAddress  && ret != 0)
+	{
+		LOG_STRING("Dbghelp:Module load failed " << (int) GetLastError());
+		return false;
+	}
+	CDBGHELPER_CLIENTS++;
+	return true;
+}
+
+string CATDbgHelper::GetError( void )
+{
+	LOG_FUNC_ENTRY("CATDbgHelper::GetError");
+	return string("not implemented.");
+}
+
+bool CATDbgHelper::Close( void )
+{
+	LOG_FUNC_ENTRY("CATDbgHelper::Close");
+	if ( ! SymUnloadModule64( GetCurrentProcess(), m_BaseAddress ) )
+	{
+		LOG_STRING("Dbghelp:Module unload failed.");
+	}
+	CDBGHELPER_CLIENTS--;
+	if ( CDBGHELPER_OPEN && CDBGHELPER_CLIENTS == 0)
+	{
+		// Cleanup dbghelper.
+		if ( ! SymCleanup( GetCurrentProcess() ) )
+		{
+			LOG_STRING("dbghelper cleanup failed.");
+			return false;
+		}
+		LOG_STRING("dbghelper closed.");
+		// Set state not opened.
+		CDBGHELPER_OPEN = false;
+	}
+	return true;
+}
+
+bool CATDbgHelper::AddressToLine( CATMemoryAddress* result )
+{
+	LOG_FUNC_ENTRY("CATDbgHelper::AddressToLine");
+	
+	// Set state out of range
+	result->SetAddressToLineState( CATMemoryAddress::OUT_OF_RANGE );
+
+	// check that dbghelper has been initialized successfully.
+	if ( ! CDBGHELPER_OPEN )
+		return false;
+
+	// Check has binary been moved, if so unload and load to new base address.
+	if ( result->GetModuleStartAddress() + AT_VIRTUAL_OFFSET_DBGHELPER != m_BaseAddress )
+	{
+		// Unload.
+		if ( SymUnloadModule64( GetCurrentProcess(), m_BaseAddress ) )
+		{
+			// Set new base address.
+			m_BaseAddress = result->GetModuleStartAddress() + AT_VIRTUAL_OFFSET_DBGHELPER;
+			// (Re)load.
+			DWORD64 loading = SymLoadModule64( GetCurrentProcess(), NULL, m_pBinaryFile, NULL, m_BaseAddress, NULL );
+			if ( loading != m_BaseAddress  && loading != 0)	
+			{
+				LOG_STRING("Dbghelp:Module load failed " << (int) GetLastError());
+				return false;
+			}
+		}
+		else
+			LOG_STRING("Dbghelp:Module unload failed " << (int) GetLastError() );
+	}
+	// Address to find (offset+given address).
+	unsigned long iAddressToFind = result->GetAddress() + AT_VIRTUAL_OFFSET_DBGHELPER;
+	// Displacements of line/symbol information.
+	DWORD64 displacementSymbol;
+	DWORD displacementLine;
+	// Structure to get symbol information.
+	CSymbolInfo symbol;
+	// Structure to get line information.
+	CLineInfo line;
+	// Find Symbol for given address 
+	if( ! SymFromAddr( GetCurrentProcess(), iAddressToFind , &displacementSymbol, &symbol.si ) )
+	{
+		LOG_STRING("Failed to find symbol information for given line.");
+		return AddressToFunction( result );
+	}
+	// Find line information
+	if( ! SymGetLineFromAddr64( GetCurrentProcess(), iAddressToFind, &displacementLine, &line ) )
+	{
+		// If it fails get symbol line information
+		LOG_STRING("Dbghelp:Failed to find line information for address, trying for symbol of address.");
+		if( ! SymGetLineFromAddr64( GetCurrentProcess(), symbol.si.Address, &displacementLine, &line ) )
+		{
+			LOG_STRING("Dbghelp:Failed to find line information for symbol address.");
+			return AddressToFunction( result );
+		}
+	}
+	// Set the results.
+	result->SetFileName( string( line.FileName ) );
+	result->SetFunctionName( string( symbol.si.Name ) );
+	result->SetExactLineNumber( (int) line.LineNumber );
+	result->SetAddressToLineState( CATMemoryAddress::EXACT );
+	// Return.
+	return true;
+}
+
+bool CATDbgHelper::AddressToFunction( CATMemoryAddress* result )
+{
+	LOG_FUNC_ENTRY("CATDbgHelper::AddressToFunction");
+	bool bFound = false;
+	// If map file read use it and return.
+	if ( m_bMap )
+	{
+		ULONG uCountedA = result->GetOffSetFromModuleStart();
+		for ( vector<MAP_FUNC_INFO>::iterator it = m_vMapFileFuncList.begin() ; it != m_vMapFileFuncList.end() ; it++ )
+		{
+			// Check is this the symbol where address is.
+			unsigned long iStart = it->iAddress;
+			unsigned long iEnd = it->iAddress + it->iFuncLength;
+			if ( uCountedA >= iStart 
+				&& uCountedA < iEnd )
+			{
+				result->SetAddressToLineState( CATMemoryAddress::SYMBOL );
+				result->SetFunctionName( it->sMangledName );
+				bFound = true;
+				break;
+			}
+		}
+	}
+	return bFound;
+}
+
+void CATDbgHelper::ReadMapFile( const string sMapFileName )
+{
+	LOG_FUNC_ENTRY("CATDbgHelper::ReadMapFile");
+	try {
+		ifstream in( sMapFileName.c_str() );
+		if ( ! in.good() )
+		{
+			in.close();
+			return;
+		}
+		char cLine[MAX_LINE_LENGTH];
+		do {
+			in.getline( cLine, MAX_LINE_LENGTH );
+			// Search pattern for 'image ro' symbols is ".text"
+			string sLine( cLine );
+			if ( sLine.find( ".text" ) != string::npos )
+			{
+				MAP_FUNC_INFO symbol;
+				// Pickup symbol attributes
+				// Address
+				string sAddress = CATBase::GetStringUntilNextSpace( sLine, true );
+				symbol.iAddress = CATBase::_httoi( sAddress.c_str() );
+				// Lenght
+				string sLength = CATBase::GetStringUntilNextSpace( sLine, true );
+				symbol.iFuncLength = CATBase::_httoi( sLength.c_str() );
+				// Name
+				size_t iStart = sLine.find_first_of( '(' );
+				size_t iEnd = sLine.find_last_of( ')' );
+				if ( iStart != string::npos && iEnd != string::npos )
+				{
+					symbol.sMangledName = sLine.substr( iStart+1, iEnd-iStart-1 );
+					// Add symbol to vector
+					m_vMapFileFuncList.push_back( symbol );
+				}
+			}
+		} while ( in.good() );
+		in.close();
+		m_bMap = true;
+	} catch (...) {
+		m_bMap = false;
+		LOG_STRING("DbgHelp: Error reading map file.");
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/catfilereader.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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:  Class for reading ascii files in AnalyzeTool.
+*
+*/
+
+#include "../inc/ATCommonDefines.h"
+#include "../inc/catfilereader.h"
+
+// -----------------------------------------------------------------------------
+// CATFileReader::CATFileReader
+// Constructor.
+// -----------------------------------------------------------------------------
+CATFileReader::CATFileReader()
+{
+	LOG_FUNC_ENTRY("CATFileReader::CATFileReader");
+	m_cDelimiter = '\r'; // default line delimeter
+}
+
+// -----------------------------------------------------------------------------
+// CATFileReader::~CATFileReader
+// Destructor.
+// -----------------------------------------------------------------------------
+CATFileReader::~CATFileReader()
+{
+	LOG_FUNC_ENTRY("CATFileReader::~CATFileReader");
+}
+
+// -----------------------------------------------------------------------------
+// CATFileReader::Open
+// Open / Read file.
+// -----------------------------------------------------------------------------
+bool CATFileReader::Open( const char* cFile )
+{
+	LOG_FUNC_ENTRY("CATFileReader::Open");
+	if ( strlen( cFile ) < 1 )
+	{
+		LOG_STRING("CATFileReader::Open empty file argument.");
+		return false;
+	}
+	try {
+		ifstream in;
+		in.open( cFile, ios::binary );
+		if ( ! in.good() )
+			return false;
+		m_stream << in.rdbuf();
+		in.close();
+	}
+	catch(...)
+	{
+		LOG_STRING("CATFileReader::Open unhandled exception.");
+		return false;
+	}
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATFileReader::Close
+// Close file.
+// -----------------------------------------------------------------------------
+bool CATFileReader::Close( void )
+{
+	LOG_FUNC_ENTRY("CATFileReader::Close");
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATFileReader::GetLine
+// Get line from file.
+// -----------------------------------------------------------------------------
+bool CATFileReader::GetLine( string& sLine )
+{
+	//LOG_FUNC_ENTRY("CATFileReader::GetLine");
+	char cLine[MAX_LINE_LENGTH];
+	if ( !m_stream.good() )
+		return false;
+	m_stream.getline( cLine, MAX_LINE_LENGTH, m_cDelimiter ); m_stream.get();
+	sLine = cLine;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATFileReader::SetDelimiter
+// Set line delimiting character.
+// -----------------------------------------------------------------------------
+void CATFileReader::SetDelimiter( char cDelimiter )
+{
+	LOG_FUNC_ENTRY("CATFileReader::SetDelimiter");
+	m_cDelimiter = cDelimiter;
+}
+
+// -----------------------------------------------------------------------------
+// CATFileReader::GetDelimiter
+// Get current line delimiting character.
+// -----------------------------------------------------------------------------
+char CATFileReader::GetDelimiter() const
+{
+	LOG_FUNC_ENTRY("CATFileReader::GetDelimiter()");
+	return m_cDelimiter;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/catromsymbol.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,656 @@
+/*
+* 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:  Reads rom symbol file and provides interface to acquire
+*               binary and function information using memory addresss.
+*
+*/
+
+#include "../inc/ATCommonDefines.h"
+#include "../inc/catromsymbol.h"
+#include "../inc/catfilereader.h"
+#include "../inc/CATBase.h"
+#include "../inc/CATMemoryAddress.h"
+
+// -----------------------------------------------------------------------------
+// RofsBinary::RofsBinary
+// Default construcor
+// -----------------------------------------------------------------------------
+RofsBinary::RofsBinary()
+{
+	LOG_LOW_FUNC_ENTRY("RofsBinary::RofsBinary");
+	m_sBinary = "";
+	vSymbols.clear();
+}
+
+// -----------------------------------------------------------------------------
+// RofsBinary::RofsBinary
+// Construcor
+// -----------------------------------------------------------------------------
+RofsBinary::RofsBinary( const string& sBinary )
+{
+	LOG_LOW_FUNC_ENTRY("RofsBinary::RofsBinary");
+	m_sBinary = sBinary;
+	vSymbols.clear();
+}
+
+// -----------------------------------------------------------------------------
+// RofsBinary::~RofsBinary
+// Destructor
+// -----------------------------------------------------------------------------
+RofsBinary::~RofsBinary()
+{
+	LOG_LOW_FUNC_ENTRY("RofsBinary::~RofsBinary");
+	for ( vector<Symbol*>::iterator it = vSymbols.begin() ; it != vSymbols.end() ; it++ )
+		delete *it;
+	vSymbols.clear();
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::CATRomSymbol
+// Constructor.
+// -----------------------------------------------------------------------------
+CATRomSymbol::CATRomSymbol()
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::CATRomSymbol");
+	m_bSymbolsRead = false;
+	m_iRomEndAddress = 0;
+	m_iRomStartAddress = 0;
+	m_vRomFiles.clear();
+	m_sErrorMessage = "";
+	m_vRomCache.clear();
+	m_vRomSymbols.clear();
+	m_bShowProgressMessages = false;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::~CATRomSymbol
+// Destructor.
+// -----------------------------------------------------------------------------
+CATRomSymbol::~CATRomSymbol()
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::~CATRomSymbol");
+	// Rom
+	for ( vector<Symbol*>::iterator it = m_vRomSymbols.begin() ; it != m_vRomSymbols.end() ; it++ )
+	{
+		delete *it;
+	}
+	m_vRomSymbols.clear();
+	// Rofs
+	for ( vector<RofsBinary*>::iterator it = m_vRofsBinaries.begin() ; it != m_vRofsBinaries.end() ; it++ )
+	{
+		delete *it;
+	}
+	m_vRofsBinaries.clear();
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::Open
+// This funtion should not be used anymore since
+// we support multiple rom/rofs files.
+// -----------------------------------------------------------------------------
+bool CATRomSymbol::Open( const string& /*sString*/, const unsigned long /*iLong*/)
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::Open");
+	return false;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::SetSymbols
+// Set symbol file(s) to be used.
+// This also checks that files exists and identifies them as rom/rofs.
+// -----------------------------------------------------------------------------
+bool CATRomSymbol::SetSymbols( const vector<string>& vSymbols )
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::SetSymbols");
+	bool ok = true;
+	// Check no same symbol defined twice.
+	for( vector<string>::const_iterator it = vSymbols.begin() ;
+		it != vSymbols.end(); it++ )
+	{
+		for( vector<string>::const_iterator it2 = vSymbols.begin() ;
+			it2 != vSymbols.end(); it2++ )
+		{
+			if ( it == it2 )
+				continue;
+			if ( _stricmp( (*it).c_str(), (*it2).c_str() ) == 0 )
+			{
+				m_sErrorMessage.append( "Same symbol file defined twice (" );
+				m_sErrorMessage.append( (*it) );
+				m_sErrorMessage.append( ")\n" );
+				return false;
+			}
+		}
+	}
+	// Loop given symbol files.
+	for( vector<string>::const_iterator it = vSymbols.begin() ;
+		it != vSymbols.end(); it++ )
+	{
+		// Symbol file exists?
+		if ( ! CATBase::FileExists( (*it).c_str() ) )
+		{
+			ok = false;
+			m_sErrorMessage.append( "Symbol file does not exists (" );
+			m_sErrorMessage.append( *it );
+			m_sErrorMessage.append( ").\n");
+			continue;
+		}
+		// Identify symbol file.
+		int type = IdentifySymbolFile( *it );
+		// Depending on type move it correct vector.
+		switch( type )
+		{
+		case SYMBOL_FILE_INVALID:
+			ok = false;
+			m_sErrorMessage.append( "Symbol file with invalid content (" );
+			m_sErrorMessage.append( *it );
+			m_sErrorMessage.append( ").\n");
+			break;
+		case SYMBOL_FILE_ROM:
+			m_vRomFiles.push_back( *it );
+			break;
+		case SYMBOL_FILE_ROFS:
+			m_vRofsFiles.push_back( *it );
+			break;
+		default:
+			ok = false;
+			LOG_STRING("IdentifySymbolFile returned unknown type.");
+			break;
+		}
+	}
+	if ( ok )
+	{
+		// Read symbols.
+		if ( m_vRomFiles.size() > 0 )
+		{
+			if ( ! ReadRomFiles() )
+				ok = false;
+			else
+				m_bSymbolsRead = true;
+		}
+		if ( m_vRofsFiles.size() > 0 )
+		{
+			if ( ! ReadRofsFiles() )
+				ok = false;
+			else
+				m_bSymbolsRead = true;
+		}
+	}
+	return ok;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::IdentifySymbolFile
+// Identify given file is it rom / rofs.
+// -----------------------------------------------------------------------------
+int CATRomSymbol::IdentifySymbolFile( const string& sFile )
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::IdentifySymbolFile");
+	// Set type as invalid.
+	int iType = SYMBOL_FILE_INVALID;
+	// Line counter.
+	int iLineCount = 0;
+	// Minimun line length to identify it.
+	size_t iLineMinLength = MAX_LINE_LENGTH;
+	if ( ROFS_SYMBOL_IDENTIFY_STRING.length() > ROM_SYMBOL_IDENTIFY_STRING.length() )
+		iLineMinLength = ROFS_SYMBOL_IDENTIFY_STRING.length();
+	else
+		iLineMinLength = ROM_SYMBOL_IDENTIFY_STRING.length();
+	try {
+		ifstream in;
+		in.open( sFile.c_str(), ios::in );
+		if ( ! in.good() )
+			return SYMBOL_FILE_INVALID;
+		char cLine[MAX_LINE_LENGTH];
+		do {
+			// Dont read too many lines. (File might be contain invalid data).
+			iLineCount++;
+			if ( iLineCount > IDENTIFY_MAX_LINES_READ )
+				break;
+
+			// Get line -> string.
+			in.getline( cLine, MAX_LINE_LENGTH );
+			string sLine(cLine);
+			
+			// Check its not too short.
+			if( sLine.length() < iLineMinLength )
+				continue;
+
+			// Take substring from start of line to identify it to rofs/rom.
+			if ( ! sLine.substr( 0, ROFS_SYMBOL_IDENTIFY_STRING.length() ).compare( ROFS_SYMBOL_IDENTIFY_STRING ) )
+			{
+				iType = SYMBOL_FILE_ROFS;
+				break;
+			}
+			else if ( ! sLine.substr( 0, ROM_SYMBOL_IDENTIFY_STRING.length() ).compare( ROM_SYMBOL_IDENTIFY_STRING ) )
+			{
+				iType = SYMBOL_FILE_ROM;
+				break;
+			}
+		} while ( in.good() );
+		in.close();
+	}
+	catch(...)
+	{
+		LOG_STRING("CATRomSymbol::IdentifySymbolFile unhandled exception.");
+	}
+	return iType;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::ReadRomFiles
+// Reads rom file(s) and creates symbols to vector.
+// -----------------------------------------------------------------------------
+bool CATRomSymbol::ReadRomFiles()
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::ReadRomFile");
+
+	// Clear symbols.
+	for ( vector<Symbol*>::iterator it = m_vRomSymbols.begin() ; it != m_vRomSymbols.end() ; it++ )
+	{
+		delete *it;
+	}
+	m_vRomSymbols.clear();
+	
+	// Clear cache. note cache is just pointers dont delete them.
+	m_vRomCache.clear();
+
+	// Any errors?
+	bool ok = true;
+
+	for( vector<string>::iterator it = m_vRomFiles.begin();
+		it != m_vRomFiles.end() ; it++ )
+		ok = ReadRomFile( *it );
+	
+	// If size smaller than 1 it is not good rom file(s).
+	if ( m_vRomSymbols.size() < 1  || ok != true)
+		return false;
+
+	// Rom start and end addresses.
+	m_iRomStartAddress = (*m_vRomSymbols.begin())->iStartAddress;
+	m_iRomEndAddress = (*m_vRomSymbols.rbegin())->iEndAddress;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::ReadRofsFiles
+// Read rofs files.
+// -----------------------------------------------------------------------------
+bool CATRomSymbol::ReadRofsFiles()
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::ReadRofsFiles");
+	// Clear.
+	for ( vector<RofsBinary*>::iterator it = m_vRofsBinaries.begin() ; it != m_vRofsBinaries.end() ; it++ )
+	{
+		delete *it;
+	}
+	m_vRofsBinaries.clear();
+	
+	// Any errors?
+	bool ok = true;
+
+	for( vector<string>::iterator it = m_vRofsFiles.begin();
+		it != m_vRofsFiles.end() ; it++ )
+		ok = ReadRofsFile( *it );
+	
+	// If size smaller than 1 it is not good rofs file(s).
+	if ( m_vRofsBinaries.size() < 1  || ok != true)
+		return false;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::ReadRomFile
+// Read given rom file
+// -----------------------------------------------------------------------------
+bool CATRomSymbol::ReadRomFile( const string& sFile )
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::ReadRomfile");
+	// Open rom file.
+	CATFileReader* reader = new CATFileReader();
+	// Show progress message if flag set.
+	if ( m_bShowProgressMessages )
+		cout << AT_MSG << "Reading rom symbol file: " << sFile << "..." << endl;
+	if ( ! reader->Open( sFile.c_str() ) )
+	{
+		reader->Close();
+		delete reader;
+		return false;
+	}
+
+	// Show progress message if flag set.
+	if ( m_bShowProgressMessages )
+		cout << AT_MSG << "Parsing rom symbol file: " << sFile << "..." << endl;
+
+	// Loop thrue lines.
+	string sLine("");
+	string sBinary("");
+	while( reader->GetLine( sLine ) )
+	{
+		// From rom we just read symbols that have lenght, no need to separate them into diff binaries.
+		try {
+			if ( sLine.size() < 2 )
+			{
+				continue;
+			}
+			else if ( sLine.at(0) == '8' )
+			{
+				// Create new item.
+				Symbol* symbol = new Symbol();
+				ParseSymbolFromLine( sLine, symbol);
+				// Ignore symbols which have same start & end address (zero length).
+				if ( symbol->iStartAddress != symbol->iEndAddress )
+					m_vRomSymbols.push_back( symbol );
+				else
+					delete symbol;
+			}
+		} catch(...)
+		{
+			// Catch all possible exception here so analyze will succeed even rom file invalid.
+			m_sErrorMessage.append( "Unhandled exception parsing rom symbol file.\n" );
+			// Close and delete reader.
+			reader->Close();
+			delete reader;
+			return false;
+		}
+	}
+	// Close and delete reader.
+	reader->Close();
+	delete reader;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::ReadRofsFile
+// Read given rofs file
+// -----------------------------------------------------------------------------
+bool CATRomSymbol::ReadRofsFile( const string& sFile )
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::ReadRofsFile");
+	// open/read rofs file.
+	CATFileReader* reader = new CATFileReader();
+	// Show progress message if flag set.
+	if ( m_bShowProgressMessages )
+		cout << AT_MSG << "Reading rofs symbol file: " << sFile << "..." << endl;
+	if ( ! reader->Open( sFile.c_str() ) )
+	{
+		reader->Close();
+		delete reader;
+		return false;
+	}
+
+	// Show progress message if flag set.
+	if ( m_bShowProgressMessages )
+		cout << AT_MSG << "Parsing rofs symbol file: " << sFile << "..." << endl;
+
+	// Loop thrue lines.
+	string sLine("");
+	string sBinary("");
+	RofsBinary* rb = NULL;
+	while( reader->GetLine( sLine ) )
+	{
+		try {
+			if ( sLine.size() < 2 )
+			{
+				continue;
+			}
+			else if ( sLine.at(0) == 'F' )
+			{
+				if ( rb != NULL )
+				{
+					// Check last binary if no symbols in it dont add it.
+					if ( rb->vSymbols.size() == 0 )
+					{
+						delete rb;
+						rb = NULL;
+					}
+					else
+						m_vRofsBinaries.push_back( rb );
+				}
+				// new binary name.
+				size_t i = sLine.rfind("\\");
+				sLine.erase(0, i+1);
+				rb = new RofsBinary( sLine );
+
+			}
+			else if ( sLine.at(0) == '0' )
+			{
+				// Cannot pickup symbols if no binary defined.
+				if ( rb == NULL )
+					continue;
+				// Create new item.
+				Symbol* symbol = new Symbol();
+				ParseSymbolFromLine( sLine, symbol);
+				// Ignore symbols which have same start & end address (zero length).
+				if ( symbol->iStartAddress != symbol->iEndAddress )
+					rb->vSymbols.push_back( symbol );
+				else
+					delete symbol;
+			}
+		} catch(...)
+		{
+			// Catch all possible exception here so analyze will succeed even rofs file invalid.
+			m_sErrorMessage.append( "Unhandled exception parsing rofs symbol file.\n" );
+			// Close and delete reader.
+			reader->Close();
+			delete reader;
+			return false;
+		}
+	}
+	// Last added binary.
+	if ( rb != NULL )
+	{
+		if ( rb->vSymbols.size() == 0 )
+		{
+			delete rb;
+			rb = NULL;
+		}
+		else
+			m_vRofsBinaries.push_back( rb );
+	}
+	// Close and delete reader.
+	reader->Close();
+	delete reader;
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::ParseSymbolFromLine
+// Parses given line into given symbol.
+// -----------------------------------------------------------------------------
+void CATRomSymbol::ParseSymbolFromLine( const string& sLine, Symbol* pSymbol )
+{
+	LOG_LOW_FUNC_ENTRY("CATRomSymbol::ParseSymbolFromLine");
+	if ( pSymbol == NULL )
+		return;
+	size_t s,x;
+	string temp;
+	// address.
+	x = sLine.find( ' ' );
+	temp = sLine.substr( 0, x );
+	pSymbol->iStartAddress = CATBase::_httoi( temp.c_str() );
+	// "Erase spaces" move starting point.
+	s = x;
+	s = sLine.find_first_not_of( ' ', s );
+	// length.
+	x = sLine.find( ' ', s );
+	temp = sLine.substr(s,x-s);
+	unsigned long length = CATBase::_httoi( temp.c_str() );
+	pSymbol->iEndAddress = pSymbol->iStartAddress + length;
+	// "Erase spaces" move starting point.
+	s = x;
+	s = sLine.find_first_not_of( ' ', s);
+	// function. Function might have spaces so we find 2 spaces which indicates end of it.
+	x = sLine.find( "  ", s );
+	temp = sLine.substr( s, x-s );
+	pSymbol->sFunction = temp;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::GetError
+// Get error string if error occured in other methods.
+// -----------------------------------------------------------------------------
+string CATRomSymbol::GetError( void )
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::GetError");
+	return m_sErrorMessage;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::Close
+// Close (stop using).
+// -----------------------------------------------------------------------------
+bool CATRomSymbol::Close( void )
+{
+	LOG_FUNC_ENTRY("CATRomSymbol::Close");
+	return true;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::AddressToLine
+// Try locate binary and function name for given memory address.
+// -----------------------------------------------------------------------------
+bool CATRomSymbol::AddressToLine( CATMemoryAddress* result )
+{
+	LOG_LOW_FUNC_ENTRY("CATRomSymbol::AddressToLine");
+	// Have symbols been read.
+	if ( ! m_bSymbolsRead )
+		return false;
+	// check that its lenght > 2
+	if ( result->GetAddressString().size() < 2 )
+		return false;
+	/* Check first is address in range of rom */
+	if ( result->GetAddress() < m_iRomStartAddress
+		|| result->GetAddress() > m_iRomEndAddress )
+	{
+		return AddressToLineRofs( result );		
+	}
+	return AddressToLineRom( result );
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::AddressToLineRom
+// Locate function from rom address range.
+// -----------------------------------------------------------------------------
+bool CATRomSymbol::AddressToLineRom( CATMemoryAddress* result )
+{
+	LOG_LOW_FUNC_ENTRY( "CATRomSymbol::AddressToLineRom" );
+	// Address to find in integer & string.
+	unsigned long iAddressToFind = result->GetAddress();
+	string sAddressToFind = result->GetAddressString();
+	
+	// Find symbol.
+	Symbol* pFound = NULL;
+
+	// Check from cache first.
+	vector<Symbol*>::iterator it;
+	for ( it = m_vRomCache.begin(); it != m_vRomCache.end(); it++ )
+	{
+		if ( iAddressToFind >= (*it)->iStartAddress
+			&& (*it)->iEndAddress > iAddressToFind )
+		{
+			pFound = *it;
+			break;
+		}
+	}
+	
+	if ( pFound == NULL )
+	{
+		// From all symbols.
+		bool reverse = false;
+		int offSetFromStart = iAddressToFind - m_iRomStartAddress;
+		int offSetFromEnd = m_iRomEndAddress - iAddressToFind;
+		if ( offSetFromEnd < offSetFromStart ) 
+			reverse = true;
+		
+		if ( reverse )
+		{
+			// Iterate vector in reverse.
+			vector<Symbol*>::reverse_iterator it;
+			for ( it = m_vRomSymbols.rbegin(); it != m_vRomSymbols.rend(); ++it )
+			{
+				if ( iAddressToFind >= (*it)->iStartAddress
+					&& (*it)->iEndAddress > iAddressToFind )
+				{
+					pFound = *it;
+					break;
+				}
+			}
+		}
+		else
+		{
+			// Iterate vector normal direction.
+			vector<Symbol*>::iterator it;
+			for ( it = m_vRomSymbols.begin(); it != m_vRomSymbols.end(); it++ )
+			{
+				if ( iAddressToFind >= (*it)->iStartAddress
+					&& (*it)->iEndAddress > iAddressToFind )
+				{
+					pFound = *it;
+					break;
+				}
+			}
+		}
+	}
+
+	// Set result if found.
+	if ( pFound != NULL )
+	{
+		result->SetFunctionName( pFound->sFunction );
+		result->SetAddressToLineState( CATMemoryAddress::SYMBOL );
+		// Add found symbols pointer to cache.
+		m_vRomCache.push_back( pFound );
+		return true;
+	}
+	return false;
+}
+
+// -----------------------------------------------------------------------------
+// CATRomSymbol::AddressToLineRofs
+// Locate function from rofs address range.
+// -----------------------------------------------------------------------------
+bool CATRomSymbol::AddressToLineRofs( CATMemoryAddress* result)
+{
+	LOG_LOW_FUNC_ENTRY("CATRomSymbol::AddressToLineRofs");
+	// Check that binary name is defined in memory address.
+	string sBinary = result->GetModuleName();
+	if ( sBinary.empty() )
+		return false;
+	// Try find that named module.
+	vector<RofsBinary*>::iterator rofs = m_vRofsBinaries.begin();
+	while( rofs != m_vRofsBinaries.end() )
+	{
+		if ( (*rofs)->m_sBinary.compare( sBinary ) == 0 )
+			break;
+		rofs++;
+	}
+	if ( rofs == m_vRofsBinaries.end() )
+		return false;
+
+	// Offset what we are looking from binary
+	unsigned long offSet = result->GetAddress();
+	offSet -= result->GetModuleStartAddress();
+	for( vector<Symbol*>::iterator it = (*rofs)->vSymbols.begin() ;
+		it != (*rofs)->vSymbols.end(); it++ )
+	{
+		if ( (*it)->iStartAddress <= offSet && offSet < (*it)->iEndAddress )
+		{
+			result->SetFunctionName( (*it)->sFunction );
+			result->SetAddressToLineState( CATMemoryAddress::SYMBOL );
+			return true;
+		}
+	}
+	return false;
+}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/helps.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* 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 help texts for CLE.
+*
+*/
+#include "../inc/ATCommonDefines.h"
+
+//Function declarations
+void print_help( void );
+void print_syntax_examples( void );
+
+/**
+* Print help info.
+*/
+void print_help( void )
+{
+	cout<< "AnalyzeTool v";
+	cout<< ATOOL_VERSION;
+	cout<< " - ";
+	cout<< ATOOL_DATE;
+	cout<< "\n";
+	cout<< "Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).\nAll rights reserved.\n\n";
+	cout<< "Usage:\n";
+	cout<< "atool -tr [optional parameters] abld [abld parameters]\n";
+	cout<< "      -lf [optional parameters] abld [abld parameters]\n";
+	cout<< "      -a data-file [output-file] [-s symbol-file] [-l#]\n";
+	cout<< "      -p data-file output-file\n";
+	cout<< "      -c\n";
+	cout<< "      -v\n";
+	cout<< "      -help\n";
+	cout<< "\n";
+	cout<< "Mandatory parameter to choose:\n";
+	cout<< " -tr             Build project for analysis using output to trace.\n";
+	cout<< " -lf             Build project for analysis using logging to file.\n";
+	cout<< " abld...         Use SBS v.1 build system with defined build command,\n";
+	cout<< "                 which includes supported platform and build type.\n";
+	cout<< " sbs...          Use SBS v.2 (Raptor) build system with defined sbs build\n";
+	cout<< "                 command, which includes supported platform and build type.\n";
+	cout<< " -a              Analyze report file.\n";
+	cout<< " -c              Clear AnalyzeTool changes, temporary files and releasable(s).\n";
+	cout<< " -p              Parse trace file to data file.\n";
+	cout<< " -help           Show full help including syntax examples.\n";
+	cout<< " -v              Print version info.\n";
+	cout<< "\n";
+
+	cout<< "Optional parameters:\n";
+	cout<< " -acs size       Specifies the call stack size gathered when memory\n";
+	cout<< "                 is allocated. Size can be between 0-256.\n";
+	cout<< " -fcs size       Specifies the call stack size gathered when memory is freed.\n";
+	cout<< "                 Size can be between 0-256.\n";
+	cout<< " -f data file    Specifies the filename for logging to file.\n";
+	cout<< "                 (50 chars max). Cannot contain path.\n";
+	cout<< " -fp file path   Specifies the path of log file.\n";
+	cout<< "                 (in format <driveLetter>:\\<dir1>\\<dir2>\\...\\<dirN>\\)\n";
+	cout<< " output-file     Specifies the results data file name.\n";
+	cout<< " -l              Logging level of analyze report(0,1,2,3), default 3.\n";
+	cout<< " -s symbol-file  Specifies rom/rofs symbol file(s) to be used in analyze.\n";
+	cout<< "                 Multiple -s options can be given.\n";
+	cout<< " -nobuild        Instruments the project.\n";
+	//cout<< "  -show_debug       Print debug messages to console.\n";
+	//cout<< "  -show_debug_all	  Print debug messages to console (all).\n";
+	//cout<< "  -show_dbgview     Print debug messages to windows debug api.\n";
+	//cout<< "  -show_dbgview_all Print debug messages to windows debug api (all).\n";
+
+	/*
+	* Old style parameters, just for notes.
+	printf("Usage:\n");
+	printf("atool -m [mmp-file] [mode] [data-file] [-variant variant-name] [build] [-sbs2] [-e]\n");
+	printf("      -i [mmp-file] [mode] [data-file] [-variant variant-name] [build] [-sbs2] [-e]\n");
+	printf("      -a [mmp-file | target-name] data-file [-s symbol-file]\n");
+	printf("         [output-file] [-l#]\n");
+	printf("      -p data-file [output-file]\n");
+	printf("      -c\n");
+	//printf("      -u\n");
+	printf("      -v\n");
+	printf("      -help\n");
+	printf("\n");
+	printf("Mandatory option to choose:\n");
+	printf("  -m           Build project for analysis.\n");
+	printf("  -i           Instrument project.\n");
+	printf("  -a           Analyze report file.\n");
+	//printf("  -u           Create listing & map files.\n");
+	printf("  -c           Clear AnalyzeTool changes and temporary files.\n");
+	printf("  -p           Parse trace file.\n");
+	printf("  -help        Show full help including syntax examples.\n");
+	printf("\n");
+
+	printf("Optional options:\n");
+	printf("  mmp-file     Specifies one of the component from bld.inf which is used.\n");
+	printf("  target-name  Specifies the target name of binary to which create\n");
+	printf("               analyze report.\n");
+	printf("  mode         Logging mode (trace or S60), default trace.\n");
+	printf("  data-file    Specifies the user defined data file name (50 chars max).\n");
+	printf("  build        Build target (udeb or urel), default udeb.\n");
+	printf("  output-file  Specifies the results data file name.\n");
+	printf("  -l           Logging level of analyze report(0,1,2,3), default 3.\n");
+	printf("  -variant     Specifies Symbian binary variant to be used.\n");
+	printf("  variant-name Specifies the variant name to be used.\n");
+	printf("  -s           Specifies rom symbol file be used in analyze.\n");
+	printf("  symbol-file  Full path to rom symbol file used in analyze.\n");
+	printf("  -sbs2        Use Symbian Build System v.2.\n");
+	printf("  -winscw      Build project for emulator (winscw platform).\n");
+	printf("  -v           Print version info.\n");
+	*/
+}
+
+void print_syntax_examples( void )
+{
+//Helper line showing width of 80 chars.
+//80cout<< "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
+	cout<< endl;
+	cout<< "Building syntax examples:" << endl;
+	cout<< "Cmd   Description" << endl;
+	
+	cout<< "atool -tr abld build armv5 udeb" << endl;
+	cout<< "      Hooks every component from bld.inf. Using output to trace," << endl;
+	cout<< "      udeb build type and armv5 platform." << endl;
+
+	cout<< "atool -lf -acs 5 sbs -c winscw_udeb" << endl;
+	cout<< "      Hooks every component from bld.inf. Using Symbian Build System v.2" << endl;
+	cout<< "      Using loging to data file, call stack size of 5" << endl;
+	cout<< "      in allocations, udeb build type and winscw platform." << endl;
+	
+	cout<< "atool -tr abld build armv5 udeb foobar" << endl;
+	cout<< "      Hooks only foobar.mmp component from bld.inf. Using " << endl;
+	cout<< "      output to trace, udeb build type and armv5 platform." << endl;
+	
+	cout<< "atool -lf -acs 0 -fcs 0 abld build armv5.default udeb" << endl;
+	cout<< "      Hooks every component from bld.inf. Using default binary variant," << endl;
+	cout<< "      output to trace, 0 sized callstacks in allocation(s)/free(s)," << endl;
+	cout<< "      udeb build type and armv5 platform." << endl;
+	
+	cout<< "atool -tr sbs -b bld.inf -c armv5_udeb" << endl;
+	cout<< "      Hooks every component from bld.inf. Using Symbian Build System v.2" << endl;
+	cout<< "      , output to trace, udeb build type and armv5 platform." << endl;
+	
+	cout<< "atool -tr sbs -s system.xml --config=winscw_udeb" << endl;
+	cout<< "      Hooks every layer defined in system.xml system model. Using Symbian Build" << endl;
+	cout<< "      System v.2, output to trace, udeb build type and winscw platform." << endl;
+
+	cout<< endl;
+	cout<< "Instrumenting syntax examples:" << endl;
+	cout<< "Cmd   Description" << endl;
+	cout<< "atool -tr -nobuild abld build winscw udeb" << endl;
+	cout<< "      Instruments every component from bld.inf. Using output to trace,"<<endl;
+	cout<< "      udeb build target and winscw platform." << endl;
+    cout<< "   After project is instrumented, it needs to compiled using same platform and" << endl;
+	cout<< "   build type as given to instrumenting. Use -c parameter to remove changes." << endl;
+
+	cout<< endl;
+	cout<< "Analyzing syntax examples:" << endl;
+	cout<< "Cmd   Description" << endl;
+	cout<< "atool -a foo.dat" << endl;
+	cout<< "      Create analyze report from foo.dat device data file." << endl;
+	cout<< "atool -a foo.trace" << endl;
+	cout<< "      Create analyze report from foo.trace raw data file." << endl;
+	cout<< "atool -a foo.dat -s my_rom.symbol -s my_rofs1.symbol" << endl;
+	cout<< "      Create analyze report from foo.dat using also rom and rofs symbol files." << endl;
+	
+	cout<< endl;
+	cout<< "Parsing syntax examples:" << endl;
+	cout<< "Cmd   Description" << endl;
+	cout<< "atool -p foo.trace foo.dat" << endl;
+	cout<< "      Parse foo.trace raw data file to foo.dat device data file." << endl;
+	}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/librarychecks.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,193 @@
+/*
+* 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 functions to check AT libraries.
+*
+*/
+#include "../inc/ATCommonDefines.h"
+#include "../inc/CATBase.h"
+
+// Function declarations
+bool CheckATLibrariesArmv5( string sEpocRoot );
+bool CheckATLibrariesArmv5Abiv2( string sEpocRoot );
+bool CheckATLibrariesWinscw( string sEpocRoot );
+
+// Error msg to user if missing lib
+const char cMissingAToolLibs[] = "\nCan not find AnalyzeTool libraries from current SDK\n\nInstall libraries first\n";
+
+// List of libraries what AnalyzeTool needs when compiled applications on armv5 platform
+const string cAToolLibsArmv5[] = {
+	"epoc32\\RELEASE\\armv5\\LIB\\AToolMemoryHook.lib",
+	"epoc32\\RELEASE\\armv5\\udeb\\AtoolStaticLib.lib",
+	"epoc32\\RELEASE\\armv5\\urel\\AtoolStaticLib.lib"
+};
+
+// List of libraries what AnalyzeTool needs when compiled applications on armv5 platform (using sbs2 / ABIV2 binaries)
+const string cAToolLibsArmv5Abiv2[] = {
+	"epoc32\\RELEASE\\armv5\\LIB\\AToolMemoryHook.dso",
+	"epoc32\\RELEASE\\armv5\\udeb\\AtoolStaticLib.lib",
+	"epoc32\\RELEASE\\armv5\\urel\\AtoolStaticLib.lib"
+};
+
+// List of libraries what AnalyzeTool needs when compiled applications on winscw platform
+const string cAToolLibsWinscw[] = {
+	"epoc32\\RELEASE\\winscw\\udeb\\AToolMemoryHook.lib",
+	"epoc32\\RELEASE\\winscw\\udeb\\AtoolStaticLib.lib",
+	"epoc32\\RELEASE\\winscw\\urel\\AtoolStaticLib.lib"
+};
+
+/**
+* CheckATLibrariesArmv5
+* Checks that armv5 libraries are in sEpocRoot
+* @param sEpocRoot, epoc root where to search libs
+* @return bool true if they are found otherwise false
+*/
+bool CheckATLibrariesArmv5(string sEpocRoot )
+{
+	LOG_FUNC_ENTRY("CheckATLibrariesArmv5");
+
+	// check that epocroot is set
+	if ( sEpocRoot.length() <= 0 )
+	{
+		LOG_FUNC_EXIT("CheckATLibrariesArmv5 Error, EpocRoot not set");
+		return false;
+	}
+
+	// add trailing '\' if root path is missing it
+	if ( sEpocRoot.at( sEpocRoot.length() -1 ) != '\\' )
+		sEpocRoot.append( "\\" );
+
+	// return boolean value
+	bool bReturn = true;
+
+	int arraySize = sizeof( cAToolLibsArmv5 ) / sizeof( string );
+	for ( int i=0 ; i < arraySize ; i++ )
+	{
+		// append epocroot to file
+		string sFileToCheck = sEpocRoot;
+		sFileToCheck.append( cAToolLibsArmv5[i] );
+		// check does it exists
+		if ( ! CATBase::FileExists( sFileToCheck.c_str() ) )
+		{
+			bReturn = false;
+			cout << AT_MSG << "Missing library file: " << sFileToCheck << endl;
+			LOG_STRING("Missing library file: " << sFileToCheck);
+		}
+	}
+
+	if ( ! bReturn )
+	{
+		// print error msg to user
+		cout << cMissingAToolLibs;
+
+	}
+	return bReturn;
+}
+
+/**
+* CheckATLibrariesArmv5Abiv2
+* Checks that armv5 abiv2 libraries are in sEpocRoot
+* @param sEpocRoot, epoc root where to search libs
+* @return bool true if they are found otherwise false
+*/
+bool CheckATLibrariesArmv5Abiv2(string sEpocRoot )
+{
+	LOG_FUNC_ENTRY("CheckATLibrariesArmv5Abiv2");
+
+	// check that epocroot is set
+	if ( sEpocRoot.length() <= 0 )
+	{
+		LOG_FUNC_EXIT("CheckATLibrariesArmv5Abiv2 Error, EpocRoot not set");
+		return false;
+	}
+
+	// add trailing '\' if root path is missing it
+	if ( sEpocRoot.at( sEpocRoot.length() -1 ) != '\\' )
+		sEpocRoot.append( "\\" );
+
+	// return boolean value
+	bool bReturn = true;
+
+	int arraySize = sizeof( cAToolLibsArmv5Abiv2 ) / sizeof( string );
+	for ( int i=0 ; i < arraySize ; i++ )
+	{
+		// append epocroot to file
+		string sFileToCheck = sEpocRoot;
+		sFileToCheck.append( cAToolLibsArmv5Abiv2[i] );
+		// check does it exists
+		if ( ! CATBase::FileExists( sFileToCheck.c_str() ) )
+		{
+			bReturn = false;
+			cout << AT_MSG << "Missing library file: " << sFileToCheck << endl;
+			LOG_STRING("Missing library file: " << sFileToCheck);
+		}
+	}
+
+	if ( ! bReturn )
+	{
+		// print error msg to user
+		cout << cMissingAToolLibs;
+
+	}
+	return bReturn;
+}
+
+/**
+* CheckATLibrariesWinscw
+* Checks that winscw libraries are in sEpocRoot
+* @param sEpocRoot, epoc root where to search libs
+* @return bool true if they are found otherwise false
+*/
+bool CheckATLibrariesWinscw(string sEpocRoot )
+{
+	LOG_FUNC_ENTRY("CheckATLibrariesWinscw");
+
+	// check that epocroot is set
+	if ( sEpocRoot.length() <= 0 )
+	{
+		LOG_FUNC_EXIT("CheckATLibrariesArmv5Abiv2 Error, EpocRoot not set");
+		return false;
+	}
+
+	// add trailing '\' if root path is missing it
+	if ( sEpocRoot.at( sEpocRoot.length() -1 ) != '\\' )
+		sEpocRoot.append( "\\" );
+
+	// return boolean value
+	bool bReturn = true;
+
+	int arraySize = sizeof( cAToolLibsWinscw ) / sizeof( string );
+	for ( int i=0 ; i < arraySize ; i++ )
+	{
+		// append epocroot to file
+		string sFileToCheck = sEpocRoot;
+		sFileToCheck.append( cAToolLibsWinscw[i] );
+		// check does it exists
+		if ( ! CATBase::FileExists( sFileToCheck.c_str() ) )
+		{
+			bReturn = false;
+			cout << AT_MSG << "Missing library file: " << sFileToCheck << endl;
+			LOG_STRING("Missing library file: " << sFileToCheck);
+		}
+	}
+
+	if ( ! bReturn )
+	{
+		// print error msg to user
+		cout << cMissingAToolLibs;
+
+	}
+	return bReturn;
+}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/stdafx.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* 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 "../inc/stdafx.h"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/utility.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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:  Miscellaneous utility functions.
+*
+*/
+#include "../inc/ATCommonDefines.h"
+#include "../inc/CATBase.h"
+#include "../inc/CATProject.h"
+
+//Analyze report logging level.
+#define MAX_LOG_LEVEL 3
+
+//Function declarations.
+bool CheckSBS2Folder( void );
+
+/**
+* Helper function which checks does current dir contain atool_temp\build folder which
+* is used in sbs2 support
+*/
+bool CheckSBS2Folder( void )
+{
+	LOG_FUNC_ENTRY("CheckSBS2Folder");
+	if ( CATBase::DirectoryExists( RAPTOR_MAKEFILE_DIR ) )
+		return true;
+	return false;
+}
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/commandlineengine/src/version.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,258 @@
+/*
+* 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:  Show / Check atool version.
+*
+*/
+#include "../inc/ATCommonDefines.h"
+#include "../inc/CATBase.h"
+
+//Function declarations.
+int showVersionInfo( void );
+int showCoreVersionInfo( void );
+bool readCoreVersionInfo( const string& sFile, string& sVersion );
+string findAnalyzeToolHeader( void );
+int showDbgHelpVersionInfo( bool showVersion );
+int getDllVersion( LPCTSTR libName, WORD *majorVersion, WORD *minorVersion, WORD *buildNumber, WORD *revisionNumber );
+
+//External GetEpocRoot function
+extern bool GetEpocRoot( string &sEpocRoot );
+
+void convertWriteTimeToLocalTime( FILETIME ftWrite, LPSTR lpszString );
+
+int showCoreVersionInfo( void )
+{
+	LOG_FUNC_ENTRY( "version.cpp::showCoreVersionInfo" );
+	// Try find header from environment where to locate version info.
+	string sHeaderFile = findAnalyzeToolHeader();
+	if ( sHeaderFile.empty() )
+		return 0;
+	string sVersion("");
+	if ( readCoreVersionInfo( sHeaderFile, sVersion ) )
+	{
+		cout << "AnalyzeTool SDK binaries version: " 
+			<< sVersion
+			<< endl;
+	}
+	return 0;
+}
+
+
+/**
+* Find analyzetool.h header file
+* @return string containing full path to file or empty string if not found.
+*/
+string findAnalyzeToolHeader( void )
+{
+	LOG_FUNC_ENTRY( "version.cpp::findAnalyzeToolHeader" );
+	string sEpocRoot;
+	if ( ! CATBase::GetEpocRoot( sEpocRoot ) )
+		return string("");
+	int iC = sizeof( AT_CORE_INCLUDE_FILE_WITH_VERSION_NUMBER ) / sizeof ( string );
+	for( int i = 0 ; i < iC ; i++ )
+	{
+		string sCheck( sEpocRoot );
+		sCheck.append( AT_CORE_INCLUDE_FILE_WITH_VERSION_NUMBER[i] );
+		if ( CATBase::FileExists( sCheck.c_str() ) )
+			return sCheck;
+	}
+	return string("");
+}
+/**
+* Read core version string.
+* @param sVersion string will contain version info if funtion returns true.
+* @return true if successful.
+*/
+bool readCoreVersionInfo( const string& sFile, string& sVersion )
+{
+	LOG_FUNC_ENTRY( "version.cpp::readCoreVersionInfo" );
+	try {
+		ifstream in;
+		in.open( sFile.c_str() );
+		if ( ! in.good() )
+			return false;
+		char cBuff[MAX_LINE_LENGTH];
+		while ( in.good() )
+		{
+			in.getline( cBuff, MAX_LINE_LENGTH );
+			string s( cBuff );
+			if ( s.find( AT_CORE_VERSION_NUMBER_TAG ) != string::npos )
+			{
+				// Find spot after first space (ignore first 3 chars).
+				size_t t =  s.find_first_of( ' ', 3 )+1;
+				sVersion = s.substr( t, s.size()-t );
+				return true;
+			}
+		}
+	}
+	catch(...)
+	{
+		LOG_STRING(AT_MSG << "Exception reading core version info.");
+	}
+	return false;
+}
+
+/**
+* Print version information of atool.exe binary.
+*/
+int showVersionInfo( void )
+{
+	LOG_FUNC_ENTRY( "version.cpp::showVersionInfo" );
+	string sTemp( "Version: " );
+	sTemp.append( ATOOL_VERSION );
+	sTemp.append( "\n" );
+	//Print atool version
+	printf( sTemp.c_str() );
+
+	//atool.exe:s path + filename
+	char buffer[MAX_PATH];
+
+	GetModuleFileName( NULL, buffer, MAX_PATH );
+
+	printf( "Path: %s\n", buffer );
+
+	WIN32_FIND_DATA FindFileData;
+	HANDLE hFind;
+	//Get file handle
+	hFind = FindFirstFile( buffer, &FindFileData );
+
+	if( hFind == INVALID_HANDLE_VALUE )
+	{
+		printf( "Can not find file:%s", buffer );
+		return 0;
+	}
+
+	convertWriteTimeToLocalTime( FindFileData.ftLastWriteTime , buffer );
+	printf( "Modified: %s\n", buffer );
+
+	// Show core version information.
+	showCoreVersionInfo();
+	return 0;
+}
+
+// Convert the last-write time to local time.
+void convertWriteTimeToLocalTime( FILETIME ftWrite, LPSTR lpszString )
+{
+	LOG_FUNC_ENTRY( "version.cpp::convertWriteTimeToLocalTime" );
+	SYSTEMTIME stUTC, stLocal;
+    // Convert the last-write time to local time.
+    FileTimeToSystemTime(&ftWrite, &stUTC);
+    SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
+
+    // Build a string showing the date and time.
+    wsprintf(lpszString, "%02d/%02d/%d %02d:%02d:%02d",
+        stLocal.wDay, stLocal.wMonth, stLocal.wYear,
+        stLocal.wHour, stLocal.wMinute, stLocal.wSecond);
+}
+
+/**
+* Print version information of dbghelp.dll.
+*/
+int showDbgHelpVersionInfo( bool showVersion )
+{
+	LOG_FUNC_ENTRY( "version.cpp::showDbgHelpVersionInfo" );
+
+	WORD majorVersion;
+	WORD minorVersion;
+	WORD buildNumber;
+	WORD revisionNumber;
+
+	if(getDllVersion( _T(DBGHELP_DLL_NAME), &majorVersion, &minorVersion, &buildNumber, &revisionNumber))
+	{
+		//Check if current dll version is lower than latest version
+		if((majorVersion < DBGHELP_VERSION_MAJ) ||
+			(majorVersion == DBGHELP_VERSION_MAJ && minorVersion < DBGHELP_VERSION_MIN) ||
+			(majorVersion == DBGHELP_VERSION_MAJ && minorVersion == DBGHELP_VERSION_MIN && buildNumber < DBGHELP_VERSION_BUILD) ||
+			(majorVersion == DBGHELP_VERSION_MAJ && minorVersion == DBGHELP_VERSION_MIN && buildNumber == DBGHELP_VERSION_BUILD && revisionNumber < DBGHELP_VERSION_REVIS))
+		{
+			cout << "WARNING: Version of your dbghelp.dll is "
+					<< majorVersion << "."
+					<< minorVersion << "."
+					<< buildNumber << "."
+					<< revisionNumber << ".\n";
+
+			cout << "Source code pinpointing for winscw may not work properly with this version."
+				<< endl
+				<< "Please, update it to at least version "
+				<< DBGHELP_VERSION_MAJ << "." 
+				<< DBGHELP_VERSION_MIN << "." 
+				<< DBGHELP_VERSION_BUILD << "." 
+				<< DBGHELP_VERSION_REVIS << ".\n"
+				<< "dbghelp.dll file is included in Debugging Tools from Microsoft. "
+				<< "You can download and install it from\n"
+				<< "http://www.microsoft.com/whdc/devtools/debugging/\n";
+
+			return 1;
+		}
+		else
+		{
+			if( showVersion )
+			{
+				cout << "Version of your dbghelp.dll is "
+					<< majorVersion << "."
+				    << minorVersion << "."
+				    << buildNumber << "."
+				    << revisionNumber << "."
+				    << endl;
+				cout << "No need for update.\n";
+			}
+		}
+	}
+
+	return 0;
+}
+
+/**
+* Get dll version.
+* @param libName library name.
+* @param majorVersion will contain major version if funtion returns true.
+* @param minorVersion will contain minor version if funtion returns true.
+* @param buildNumber will contain build number if funtion returns true.
+* @param revisionNumber will contain revision number if funtion returns true.
+* @return true if successful.
+*/
+int getDllVersion( LPCTSTR  libName, WORD *majorVersion, WORD *minorVersion, WORD *buildNumber, WORD *revisionNumber ) 
+{
+	LOG_FUNC_ENTRY( "version.cpp::getDllVersion" );
+
+	DWORD dwHandle, dwLen;
+	UINT BufLen;
+	LPTSTR lpData;
+	VS_FIXEDFILEINFO *pFileInfo;
+	dwLen = GetFileVersionInfoSize( libName, &dwHandle );
+	if (!dwLen)
+		return 0;
+	
+	lpData = (LPTSTR) malloc (dwLen);
+	if (!lpData)
+		return 0;
+	
+	if( !GetFileVersionInfo( libName, dwHandle, dwLen, lpData ) )
+	{
+		free (lpData);
+		return 0;
+	}
+	
+	if( VerQueryValue( lpData, _T("\\"), (LPVOID *) &pFileInfo, (PUINT)&BufLen ) )
+	{
+		*majorVersion = HIWORD(pFileInfo->dwFileVersionMS);
+		*minorVersion = LOWORD(pFileInfo->dwFileVersionMS);
+		*buildNumber = HIWORD(pFileInfo->dwFileVersionLS);
+		*revisionNumber = LOWORD(pFileInfo->dwFileVersionLS);
+		return 1;
+	 }
+	free (lpData);
+	return 0;
+}
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/bwins/atoolmemoryhooku.def	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,10 @@
+EXPORTS
+	?Alloc@RAnalyzeToolAllocator@@UAEPAXH@Z @ 1 NONAME ; void * RAnalyzeToolAllocator::Alloc(int)
+	?SetupThreadHeap@CustomUser@@SAHHAAUSStdEpocThreadCreateInfo@@ABV?$TBuf@$0BAA@@@1KKABV?$TBuf@$0BE@@@KKV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 2 NONAME ; int CustomUser::SetupThreadHeap(int, struct SStdEpocThreadCreateInfo &, class TBuf<256> const &, class TBuf<256> const &, unsigned long, unsigned long, class TBuf<20> const &, unsigned long, unsigned long, class TRefByValue<class TDesC16 const >, ...)
+	?SetCritical@CustomUser@@SAHW4TCritical@User@@@Z @ 3 NONAME ; int CustomUser::SetCritical(enum User::TCritical)
+	?Exit@CustomUser@@SAXH@Z @ 4 NONAME ; void CustomUser::Exit(int)
+	?SetProcessCritical@CustomUser@@SAHW4TCritical@User@@@Z @ 5 NONAME ; int CustomUser::SetProcessCritical(enum User::TCritical)
+	?InstallAllocator@CustomUser@@CAAAVRAllocator@@HABV?$TBuf@$0BAA@@@0KKKKABVTDesC8@@1@Z @ 6 NONAME ; class RAllocator & CustomUser::InstallAllocator(int, class TBuf<256> const &, class TBuf<256> const &, unsigned long, unsigned long, unsigned long, unsigned long, class TDesC8 const &, class TDesC8 const &)
+	?Panic@CustomUser@@SAXABVTDesC16@@H@Z @ 7 NONAME ; void CustomUser::Panic(class TDesC16 const &, int)
+	?Alloc@RAnalyzeToolMainAllocator@@UAEPAXH@Z @ 8 NONAME ; void * RAnalyzeToolMainAllocator::Alloc(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/eabi/atoolmemoryhooku.def	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,18 @@
+EXPORTS
+	_ZN10CustomUser11SetCriticalEN4User9TCriticalE @ 1 NONAME
+	_ZN10CustomUser15SetupThreadHeapEiR24SStdEpocThreadCreateInfoRK4TBufILi256EES5_mmRKS2_ILi20EEmm11TRefByValueIK7TDesC16Ez @ 2 NONAME
+	_ZN10CustomUser16InstallAllocatorEiRK4TBufILi256EES3_mmmmRK6TDesC8S6_ @ 3 NONAME
+	_ZN10CustomUser18SetProcessCriticalEN4User9TCriticalE @ 4 NONAME
+	_ZN10CustomUser4ExitEi @ 5 NONAME
+	_ZN10CustomUser5PanicERK7TDesC16i @ 6 NONAME
+	_ZTI10RATFileLog @ 7 NONAME
+	_ZTI20CLibraryEventHandler @ 8 NONAME
+	_ZTI21RAnalyzeToolAllocator @ 9 NONAME
+	_ZTI25RAnalyzeToolMainAllocator @ 10 NONAME
+	_ZTI27RAnalyzeToolMemoryAllocator @ 11 NONAME
+	_ZTV10RATFileLog @ 12 NONAME
+	_ZTV20CLibraryEventHandler @ 13 NONAME
+	_ZTV21RAnalyzeToolAllocator @ 14 NONAME
+	_ZTV25RAnalyzeToolMainAllocator @ 15 NONAME
+	_ZTV27RAnalyzeToolMemoryAllocator @ 16 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/group/atoolmemoryhook.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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:  The .mmp file for AToolMemoryHook.
+*
+*/
+
+#include <platform_paths.hrh>
+#include "../../symbian_version.hrh"
+
+TARGET        atoolmemoryhook.dll
+TARGETTYPE    dll
+UID           0x1000008d 0x2001242F
+CAPABILITY    ALL -TCB
+
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
+EPOCALLOWDLLDATA
+#endif
+
+SMPSAFE
+
+SOURCEPATH    ../src
+
+SOURCE        analyzetooleventhandler.cpp
+SOURCE        codeblock.cpp
+SOURCE        threadstack.cpp
+SOURCE        customuser.cpp
+SOURCE        analyzetoolmemoryallocator.cpp
+SOURCE        analyzetoolmainallocator.cpp
+SOURCE        analyzetoolallocator.cpp
+SOURCE        analyzetoolfastlog.cpp
+SOURCE        atdriveinfo.cpp
+SOURCE        analyzetoolfilelog.cpp
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../inc
+USERINCLUDE   ../../analyzetool_plat/analyzetool_api/inc/analyzetool
+
+#ifdef WINSCW
+APP_LAYER_SYSTEMINCLUDE
+#endif
+
+OS_LAYER_SYSTEMINCLUDE
+
+LIBRARY       efsrv.lib 
+LIBRARY       euser.lib
+LIBRARY       flogger.lib
+LIBRARY       charconv.lib 
+LIBRARY       platformenv.lib
+LIBRARY       sysutil.lib 
+LIBRARY       estor.lib 
+#ifdef WINSCW
+LIBRARY        cone.lib
+#endif
+
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
+MACRO	USE_CLEANER_DLL
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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:  
+*
+*/
+
+PRJ_PLATFORMS
+ARMV5 WINSCW
+
+PRJ_MMPFILES
+atoolmemoryhook.mmp
+
+PRJ_TESTMMPFILES
+../internal/tsrc/group/analyzetoolmemoryhooktest.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolallocator.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,239 @@
+/*
+* 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:  Declaration of the class RAnalyzeToolAllocator.
+*
+*/
+
+
+#ifndef ANALYZETOOLALLOCATOR_H
+#define ANALYZETOOLALLOCATOR_H
+
+// INCLUDES
+#include <u32std.h>
+#include "codeblock.h"
+#include "threadstack.h"
+#include "analyzetoolmemoryallocator.h"
+#include <analyzetool/analyzetool.h>
+#include <analyzetool/atcommon.h>
+#include "analyzetoolfilelog.h"
+
+// CLASS DECLARATION
+
+/**
+*  Class which overloads the RAlloctor functions and provides access to 
+*  the overloaded functions  
+*/
+class RAnalyzeToolAllocator : public RAnalyzeToolMemoryAllocator
+    {
+
+    public:
+
+        /**
+        * C++ default constructor.
+        * @param aNotFirst Is this first thread using this heap
+        * @param aCodeblocks A reference to array of code segments
+        * @param aMutex A reference to mutex for schedule access to the 
+        *                   shared resources
+        * @param aProcessId A reference to the observed process id
+        * @param aAnalyzeTool Reference to device driver
+        * @param aLogOption The logging option
+        * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
+        * @param aFreeCallStackSize Max number of stored callstack items when memory freed
+        */
+        RAnalyzeToolAllocator( TBool aNotFirst,
+                               RArray<TCodeblock>& aCodeblocks, 
+                               RMutex& aMutex, 
+                               TUint aProcessId,
+                               RAnalyzeTool& aAnalyzeTool,
+                               TUint32 aLogOption,
+                               TUint32 aAllocCallStackSize,
+                               TUint32 aFreeCallStackSize,
+                               RATFileLog& iLogFile );
+        /**
+        * Destructor.
+        */                     
+        ~RAnalyzeToolAllocator();
+
+        /**
+        * Allocates a cell of specified size from the heap.
+        * @param aSize The size of the cell to be allocated from the heap. 
+        * @return TAny* A pointer to the allocated cell.
+        */
+        TAny* Alloc( TInt aSize );
+
+        /**
+        * Frees the specified cell and returns it to the heap.
+        * @param aPtr A pointer to a cell to be freed.
+        */
+        void Free( TAny* aPtr );
+
+        /**
+        * Increases or decreases the size of an existing cell.
+        * @param aPtr A pointer to the cell to be reallocated.
+        * @param aSize The new size of the cell. This may be bigger 
+        *              or smaller than the size of the original cell.
+        * @param aMode Flags controlling the reallocation.
+        * @return TAny* A pointer to the reallocated cell. This may be the 
+        *               same as the original pointer supplied through aCell.
+        */
+        //lint --e{1735} suppress "Virtual function has default parameter"
+        TAny* ReAlloc( TAny* aPtr, TInt aSize, TInt aMode = 0 );
+        
+        /**
+        * Gets the length of the available space in the specified 
+        * allocated cell.
+        * @param aCell A pointer to the allocated cell.
+        * @return TInt The length of the available space in the allocated cell.
+        */
+        TInt AllocLen( const TAny* aCell ) const;
+
+    #ifndef __KERNEL_MODE__
+
+        /**
+        * Opens this heap for shared access. Opening the heap increases 
+        * the heap's access count by one.
+        */
+        TInt Open();
+        
+        /**
+        * Closes this shared heap. Closing the heap decreases the heap's 
+        * access count by one.
+        */
+        void Close();
+
+        /**
+        * The function frees excess committed space from the top of the heap.
+        * The size of the heap is never reduced below the minimum size 
+        * specified during creation of the heap.
+        * @return TInt The space reclaimed. If no space can be reclaimed, 
+                       then this value is zero.
+        */
+        TInt Compress();
+
+        /**
+        * Frees all allocated cells on this heap. 
+        */
+        void Reset();
+
+        /**
+        * Gets the number of cells allocated on this heap, and 
+        * the total space allocated to them.
+        * @param aTotalAllocSize On return, contains the total 
+        *                        space allocated to the cells.
+        * @return TInt The number of cells allocated on this heap.
+        */
+        TInt AllocSize( TInt& aTotalAllocSize ) const;
+        
+        /**
+        * Gets the total free space currently available on the heap and the 
+        * space available in the largest free block. The space available 
+        * represents the total space which can be allocated. Note that 
+        * compressing the heap may reduce the total free space available 
+        * and the space available in the largest free block.
+        * @param aBiggestBlock On return, contains the space available 
+        *                      in the largest free block on the heap.
+ 
+        * @return TInt The total free space currently available on the heap.
+
+        */
+        TInt Available( TInt& aBiggestBlock ) const;
+        
+    #endif
+
+        /**
+        * Invocates specified debug funtionality.
+        * @param aFunc The debug function
+        * @param a1 Debug function specific paramenter.
+        * @param a2 Debug function specific paramenter.
+        * @return TInt Returns KErrNone, if successful otherwise one 
+        *              of the other system-wide error codes.
+        */
+        //lint --e{1735} suppress "Virtual function has default parameter"
+        TInt DebugFunction( TInt aFunc, TAny* a1 = NULL, TAny* a2 = NULL );
+
+    protected:
+
+        /**
+        * Extension function
+        * @param aExtensionId The extension id
+        * @param a0 Extension specific paramenter.
+        * @param a1 Extension specific paramenter.
+        * @return TInt Returns KErrNone, if successful otherwise one 
+        *              of the other system-wide error codes. 
+        */
+        TInt Extension_( TUint aExtensionId, TAny*& a0, TAny* a1 );
+
+    public: // from RAnalyzeToolMemoryAllocator
+        
+        /**
+        * Installs the RTraceAllocator allocator
+        */
+        void Uninstall();
+        
+        /**
+        * Shares the heap
+        */
+        void ShareHeap();
+
+    private:
+    
+        /**
+        * Find the current thread which is using the heap
+        * @param aStackStart A reference where the stack start is stored
+        * @return TBool ETrue if a thread can be found, EFalse otherwise
+        */
+        TBool FindCurrentThreadStack( TUint32& aStackStart );
+
+    private: 
+    
+        /* A reference to codeblocks of the observed process */            
+        RArray<TCodeblock>& iCodeblocks;
+
+        /* The mutex for serializing access to the shared resources */
+        RMutex& iMutex;
+
+        /* The process id */
+        TUint iProcessId;
+
+        /* Array for storing the callstack */
+        TFixedArray<TUint32, KATMaxCallstackLength> iCallStack;
+
+        /* Array for storing the reallocation callstack */
+        TFixedArray <TUint32, KATMaxCallstackLength> iReCallStack;
+
+        /* Array for storing the reallocation callstack */	
+        TFixedArray<TUint32, KATMaxFreeCallstackLength> iFreeCallStack;
+                
+        /* Array of threads using this heap */
+        RArray<TThreadStack> iThreadArray;
+
+        RAnalyzeTool& iAnalyzeTool;
+
+        /* Log option */
+        TUint32 iLogOption;
+        
+        /* Max items on stored call stack when memory allocated */
+        TUint32 iAllocMaxCallStack;
+        
+        /* Max items on stored call stack when memory freed */
+        TUint32 iFreeMaxCallStack;
+        
+        /* Binary log file */
+        RATFileLog& iLogFile;
+        
+    };
+
+#endif // ANALYZETOOLALLOCATOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetooleventhandler.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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:  Declaration of the class CLibraryEventHandler.
+*
+*/
+
+
+#ifndef ANALYZETOOLEVENTHANDLER_H
+#define ANALYZETOOLEVENTHANDLER_H
+
+// INCLUDES
+#include <e32cmn.h>
+#include <e32base.h>
+#include "codeblock.h"
+#include <analyzetool/analyzetool.h>
+#include "analyzetoolfilelog.h"
+
+// FORWARD DECLARATIONS
+class MAnalyzeToolEventhandlerNotifier;
+
+// CLASS DECLARATION
+
+/**
+*  Class for receiving library load/unlaod events from the kernel   
+*/
+class CLibraryEventHandler : public CActive
+    {
+    
+    public: 
+
+        /**
+        * C++ default constructor.
+        * @param aAnalyzeTool A reference to the <code>RAnalyzeTool</code> 
+                 which is used to observe kernel events 
+        * @param aCodeblocks A reference to array of code segments
+        * @param aProcessId A reference to the observed process id
+        * @param aMutex A reference to mutex to schedule access to the 
+        *                   shared resources
+        * @param aNotifier A reference to notifier object which is used to 
+        * 					inform killed threads
+        * @param aLogOption Current used log option on allocator.
+        */
+        CLibraryEventHandler( RAnalyzeTool& aAnalyzeTool, 
+                RArray<TCodeblock>& aCodeblocks,
+                TUint aProcessId,
+                RMutex& aMutex,
+                MAnalyzeToolEventhandlerNotifier& aNotifier,
+                TUint32 aLogOption,
+                RATFileLog& iLogFile );
+
+        /**
+        * Destructor.
+        */
+        ~CLibraryEventHandler();
+
+        /* Start receiving events from the kernel */
+        void Start();
+        
+        /**
+        * Returns eventhandler's state.
+        * @return TBool ETrue if eventhandler is started, EFalse otherwise
+        */
+        TBool IsStarted();
+
+    protected: // Functions from base classes
+        
+        /**
+        * Process active object's task
+        */
+        void RunL();
+
+        /**
+        * Cancels active object's task
+        */
+        void DoCancel();
+ 
+    private: // Member variables
+
+        /* Handle to the analyze tool device driver*/
+        RAnalyzeTool& iAnalyzeTool; 
+
+        /* A reference to codeblocks of the observed process */
+        RArray<TCodeblock>& iCodeblocks;
+
+        /* The observered process id */ 
+        TUint iProcessId;
+
+        /* The library info */
+        TLibraryEventInfo iLibraryInfo;
+
+        /* The mutex for serializing access to the shared resources */
+        RMutex& iMutex;
+        
+        /* Inform if handler is started */
+        TBool iStarted;
+        
+        /* A reference to event handler notifier */
+        MAnalyzeToolEventhandlerNotifier& iNotifier;
+
+        /* Current used log option */
+        TUint32 iLogOption;
+        
+        // TODO comment
+		/* */
+		RATFileLog& iLogFile;
+    };
+
+#endif // ANALYZETOOLEVENTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetooleventhandlernotifier.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* 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:  Declaration of the class MAnalyzeToolEventhandlerNotifier
+*
+*/
+
+
+#ifndef ANALYZETOOLEVENTHANDLERNOTIFIER_H
+#define ANALYZETOOLEVENTHANDLERNOTIFIER_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+*  MAnalyzeToolEventhandlerNotifier class
+*  An interface class for informing killed thread.
+*/
+class MAnalyzeToolEventhandlerNotifier
+    {
+    public: // New functions
+           
+        /**
+        * Inform when thread killed.
+        * @param aThreadId - Killed thread Id.
+        */
+        virtual void RemoveKilledThread( const TUint aThreadId ) = 0;
+
+    };
+
+#endif // ANALYZETOOLEVENTHANDLERNOTIFIER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolfastlog.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* 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 __ANALYZETOOLFASTLOG_H__
+#define __ANALYZETOOLFASTLOG_H__
+
+// INCLUDES
+#include    <e32base.h>
+#include    <analyzetool/atcommon.h>
+#include    <analyzetool/analyzetooltraceconstants.h>
+
+// Function prototypes.
+
+/**
+ * TBD
+ * @param aProcessName The name of the new process started. The length of this
+ *   descriptor must not be greater than KMaxProcessName.
+ * @param aProcessId The ID of the process started.
+ * @param aIsDebug Determines whether a binary is UDEB or UREL
+ * @return KErrNone.
+*/
+GLREF_C TInt ATFastLogProcessStarted( const TDesC8& aProcessName,
+                                 TUint aProcessId,
+                                 TUint32 aIsDebug,
+                                 const TDesC8& aAtoolVersion,
+                                 const TDesC8& aApiVersion );
+
+/**
+ * TBD 
+ * @param aProcessId The ID number of the process ended.
+ * @param aHandleLeakCount Number of handles open.
+ * @return KErrNone, if successful; otherwise one of the other
+ *   system-wide error codes.
+ */
+GLREF_C TInt ATFastLogProcessEnded( TUint aProcessId, 
+                                TUint aHandleLeakCount );
+
+/**
+ * TBD
+ * @param aProcessId The ID number of the process ended.
+ * @param aDllName The name of the new DLL loaded. The length of this descriptor
+ *   must not be greater than KMaxLibraryName.
+ * @param aStartAddress The start address of the DLL loaded.
+ * @param aEndAddress The end address of the DLL loaded.
+ * @return KErrNone.
+*/
+GLREF_C TInt ATFastLogDllLoaded( TUint aProcessId, const TDesC8& aDllName, TUint32 aStartAddress,
+                                TUint32 aEndAddress );
+
+/**
+ * TBD
+ * @param aProcessId The ID number of the process ended.
+ * @param aDllName The name of the DLL to be unloaded. The length of this
+ *   descriptor must not be greater than KMaxLibraryName.
+ * @param aStartAddress The start address of the DLL to be unloaded.
+ * @param aEndAddress The end address of the DLL to be unloaded.
+ * @return KErrNone.
+*/
+GLREF_C TInt ATFastLogDllUnloaded( TUint aProcessId, const TDesC8& aDllName, TUint32 aStartAddress,
+                                       TUint32 aEndAddress );
+
+/**
+ * TBD
+ * @param aProcessId The ID number of the process ended.
+ * @param aMemAddress The memory location where memory has been allocated.
+ * @param aCallstack An array including the current call stack.
+ * @param aSize The size of the newly allocated memory chunk.
+ * @param aThreadId ID of the thread
+ * @return KErrNone.
+*/
+GLREF_C TInt ATFastLogMemoryAllocated( TUint aProcessId, TUint32 aMemAddress,
+                                  TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
+                                  TInt aSize,  TUint aThreadId  );
+        
+/**
+ * TBD
+ * @param aProcessId The ID number of the process ended.
+ * @param aMemAddress The memory location where memory has been deallocated.
+ * @param aFreeCallstack An array including the current call stack.
+ * @param aThreadId ID of the thread
+ * @return KErrNone.
+*/
+GLREF_C TInt ATFastLogMemoryFreed( TUint aProcessId, TUint32 aMemAddress, 
+                              TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack,
+                              TUint aThreadId );
+
+/**
+ * TBD
+ * @param aProcessId The ID number of the process ended.
+ * @param aMemAddressFree The memory location where memory has been deallocated.
+ * @param aMemAddressAlloc The memory location where memory has been allocated.
+ * @param aFreeCallstack An array including the current call stack.
+ * @param aThreadId ID of the thread
+ * @return KErrNone.
+*/
+GLREF_C TInt ATFastLogMemoryReallocated( TUint aProcessId, TUint32 aMemAddressFree,  TUint32 aMemAddressAlloc,
+                                  TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
+                                  TInt aSize,  TUint aThreadId  );
+
+/**
+ * TBD
+ * @param aProcessId The ID number of the process ended.
+ * @param aThreadID An ID of the new thread started
+ * @return KErrNone.
+*/
+GLREF_C TInt ATFastLogThreadStarted( TUint aProcessId, TUint aThreadId );
+
+/**
+ * TBD
+ * @param aProcessId The ID number of the process ended.
+ * @param aThreadID An ID of the thread ended
+ * @return KErrNone.
+*/
+GLREF_C TInt ATFastLogThreadEnded( TUint aProcessId, TUint64 aThreadId );
+
+/**
+ * TBD
+ * @param aS60Version S60 version
+ * @aChecksum ROM checksum
+ * @return KErrNone.
+*/
+TInt ATFastLogDeviceInfo( const TDesC8& aS60Version, const TDesC8& aChecksum);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolfilelog.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2010 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:  Declaration of the class TATDriveInfo.
+*
+*/
+
+#ifndef ANALYZETOOLFILELOG_H_
+#define ANALYZETOOLFILELOG_H_
+
+#include <e32base.h>
+#include <s32file.h> //RFileWriteStream 
+#include <f32file.h> //RFs
+#include <analyzetool/atcommon.h>
+
+class RATFileLog : public CBase
+	{
+    enum EMessageType{
+        EFileVersion = 0,
+        		EProcessStart,
+                EProcessEnd,
+                EThreadStart,
+                EThreadEnd,
+                EDllLoad,
+                EDllUnload,
+                EAllocH,
+                EAllocF,
+                EFreeH,
+                EFreeF,
+                EReallocH,
+                EReallocF,
+                ETestStart,
+                ETestEnd,
+                EHandleLeak,
+                EDeviceInfo,
+                EError  
+	    };
+    
+public:
+    
+    RATFileLog();
+	virtual ~RATFileLog();
+
+/**
+ * TBD
+ * @return KErrNone.
+*/
+	
+TInt ATFileLogVersion();
+
+/**
+ * TBD
+ * @param aProcessName The name of the new process started. The length of this
+ *   descriptor must not be greater than KMaxProcessName.
+ * @param aIsDebug Determines whether a binary is UDEB or UREL
+ * @return KErrNone.
+*/
+
+TInt ATFileLogProcessStarted( const TDesC8& aProcessName,
+                                      TUint aProcessId,
+                                      TUint32 aIsDebug,
+                                      const TDesC8& aAtoolVersion,
+                                      const TDesC8& aApiVersion );
+
+/**
+ * TBD 
+ * @param aProcessId The ID number of the process ended.
+ * @param aHandleLeakCount Number of handles open.
+ * @return KErrNone, if successful; otherwise one of the other
+ *   system-wide error codes.
+ */
+TInt ATFileLogProcessEnded( TUint aHandleLeakCount );
+
+/**
+ * TBD
+ * @param aDllName The name of the new DLL loaded. The length of this descriptor
+ *   must not be greater than KMaxLibraryName.
+ * @param aStartAddress The start address of the DLL loaded.
+ * @param aEndAddress The end address of the DLL loaded.
+ * @return KErrNone.
+*/
+TInt ATFileLogDllLoaded( const TDesC8& aDllName, TUint32 aStartAddress,
+                                TUint32 aEndAddress );
+
+/**
+ * TBD
+ * @param aDllName The name of the DLL to be unloaded. The length of this
+ *   descriptor must not be greater than KMaxLibraryName.
+ * @param aStartAddress The start address of the DLL to be unloaded.
+ * @param aEndAddress The end address of the DLL to be unloaded.
+ * @return KErrNone.
+*/
+TInt ATFileLogDllUnloaded( const TDesC8& aDllName, TUint32 aStartAddress,
+                                       TUint32 aEndAddress );
+
+/**
+ * TBD
+ * @param aMemAddress The memory location where memory has been allocated.
+ * @param aCallstack An array including the current call stack.
+ * @param aSize The size of the newly allocated memory chunk.
+ * @param aThreadId ID of the thread
+ * @return KErrNone.
+*/
+TInt ATFileLogMemoryAllocated( TUint32 aMemAddress,
+                                  TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
+                                  TInt aSize,  TUint aThreadId  );
+        
+/**
+ * TBD
+ * @param aMemAddress The memory location where memory has been deallocated.
+ * @param aFreeCallstack An array including the current call stack.
+ * @param aThreadId ID of the thread
+ * @return KErrNone.
+*/
+TInt ATFileLogMemoryFreed( TUint32 aMemAddress, 
+		                      TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack,
+                              TUint aThreadId );
+
+/**
+ * TBD
+ * @param aMemAddressFree The memory location where memory has been deallocated.
+ * @param aMemAddressAlloc The memory location where memory has been allocated.
+ * @param aFreeCallstack An array including the current call stack.
+ * @param aThreadId ID of the thread
+ * @return KErrNone.
+*/
+TInt ATFileLogMemoryReallocated( TUint32 aMemAddressFree,  TUint32 aMemAddressAlloc,
+                                  TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
+                                  TInt aSize,  TUint aThreadId  );
+
+/**
+ * TBD
+ * @param aThreadID An ID of the new thread started
+ * @return KErrNone.
+*/
+TInt ATFileLogThreadStarted( TUint aThreadId );
+
+/**
+ * TBD
+ * @param aThreadID An ID of the thread ended
+ * @return KErrNone.
+*/
+TInt ATFileLogThreadEnded( TUint64 aThreadId );
+
+/**
+ * TBD
+ * @param aS60Version S60 version
+ * @aChecksum ROM checksum
+ * @return KErrNone.
+*/
+TInt ATFileLogDeviceInfo( const TDesC8& aS60Version, const TDesC8& aChecksum);
+
+/**
+* Opens a file server session and a file with the name specified.
+* @param aFileName The name of the file into which to log.
+* @param aProcessName Current process name.
+* @return KErrNone, if successful; otherwise one of the other system wide
+*   error codes.
+*/
+TInt OpenFsAndFile( const TDesC& aFileName, const TDesC& aFilePath, const TDesC8& aProcessName );
+
+/**
+* Method is used to parse file name extension.
+* @param aFileName The name of the file into which to log.
+* @param aExtension Parsed file extension. 
+*/
+void ParseExtension( TDes& aFileName, TDes& aExtension );
+
+/**
+* Called internally when need generate new file name.
+* @param aFileName The name of the file into which to log.
+* @param aProcessName Current process name.
+*/
+void GenerateNewFileName( TDes& aFileName, const TDesC8& aProcessName );
+
+/**
+* Method is used to check that file exists and is valid.
+* @param aFileName The name of the file into which to log.
+*/
+void CheckIfFileAlreadyExist( const TDes& aFileName );
+
+/**
+* Closes the handles to the file server session and to the file (if currently open).
+*/
+void CloseFsAndFile();
+
+// Local time function.
+TInt64 CurrentTime();
+
+
+
+/**
+* A variable telling the number of microseconds from January 1st, 0 AD
+* nominal Gregorian to January 1st, 1970 AD nominal Gregorian. 
+*/
+TInt64 iMicroSecondsAt1970;
+
+/** A handle to a file server */
+RFs iFileServer;
+
+/** A handle to a file write stream */
+RFileWriteStream iFile;
+
+/** The logging file of this process */
+TBuf8<KMaxFileName> iLogFile;
+
+/** A member variable for storing results of server function calls. */ 
+TInt iError;
+
+
+};
+
+#endif /* ANALYZETOOLFILELOG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolmainallocator.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,332 @@
+/*
+* 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:  Declaration of the class RAnalyzeToolMainAllocator.
+*
+*/
+
+
+#ifndef ANALYZETOOLMAINALLOCATOR_H
+#define ANALYZETOOLMAINALLOCATOR_H
+
+// INCLUDES
+#include <u32std.h>
+#include "codeblock.h"
+#include <analyzetool/analyzetool.h>
+#include <analyzetool/atcommon.h>
+#include "analyzetoolmemoryallocator.h"
+#include "analyzetooleventhandlernotifier.h"
+#include "analyzetoolfilelog.h"
+
+// FORWARD DECLARATIONS
+class CLibraryEventHandler;
+
+// CLASS DECLARATION
+
+/**
+*  Class which overloads the RAlloctor functions and provides access to 
+*  the overloaded functions  
+*/
+class RAnalyzeToolMainAllocator : public RAnalyzeToolMemoryAllocator, 
+								  public MAnalyzeToolEventhandlerNotifier
+    {
+
+    public:
+
+        /**
+        * C++ default constructor.
+        * @param aNotFirst Is this first thread using this heap
+        * @param aFileName The name of the log file
+        * @param aLogOption The logging option
+        * @param aIsDebug Determines whether a binary is UDEB or UREL
+        * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
+        * @param aFreeCallStackSize Max number of stored callstack items when memory freed
+        * @param aAtoolVersion Version of atool
+        * @param aApiVersion Version of api
+        */
+        RAnalyzeToolMainAllocator( TBool aNotFirst,
+                const TFileName& aFileName,
+                const TPath& aFilePath,
+                TUint32 aLogOption, TUint32 aIsDebug,
+                TUint32 aAllocCallStackSize,
+                TUint32 aFreeCallStackSize,
+                const TDesC8& aAtoolVersion,
+                const TDesC8& aApiVersion );
+
+        /**
+        * Destructor.
+        */
+        ~RAnalyzeToolMainAllocator();
+
+        /**
+        * Allocates a cell of specified size from the heap.
+        * @param aSize The size of the cell to be allocated from the heap. 
+        * @return TAny* A pointer to the allocated cell.
+        */
+        TAny* Alloc( TInt aSize );
+
+        /**
+        * Frees the specified cell and returns it to the heap.
+        * @param aPtr A pointer to a cell to be freed.
+        */
+        void Free( TAny* aPtr );
+
+        /**
+        * Increases or decreases the size of an existing cell.
+        * @param aPtr A pointer to the cell to be reallocated.
+        * @param aSize The new size of the cell. This may be bigger 
+        *              or smaller than the size of the original cell.
+        * @param aMode Flags controlling the reallocation.
+        * @return TAny* A pointer to the reallocated cell. This may be the 
+        *               same as the original pointer supplied through aCell.
+        */
+        TAny* ReAlloc( TAny* aPtr, TInt aSize, TInt aMode = 0 );
+        
+        /**
+        * Gets the length of the available space in the specified 
+        * allocated cell.
+        * @param aCell A pointer to the allocated cell.
+        * @return TInt The length of the available space in the allocated cell.
+        */
+        TInt AllocLen(const TAny* aCell) const;
+
+    #ifndef __KERNEL_MODE__
+
+        /**	
+        * Opens this heap for shared access. Opening the heap increases 
+        * the heap's access count by one.
+        */
+        TInt Open();
+        
+        /**
+        * Closes this shared heap. Closing the heap decreases the heap's 
+        * access count by one.
+        */  	
+        void Close();
+
+        /**
+        * The function frees excess committed space from the top of the heap.
+        * The size of the heap is never reduced below the minimum size 
+        * specified during creation of the heap.
+        * @return TInt The space reclaimed. If no space can be reclaimed, 
+                       then this value is zero.
+        */
+        TInt Compress();
+
+        /**
+        * Frees all allocated cells on this heap. 
+        */
+        void Reset();
+
+        /**
+        * Gets the number of cells allocated on this heap, and 
+        * the total space allocated to them.
+        * @param aTotalAllocSize On return, contains the total 
+        *						 space allocated to the cells.
+        * @return TInt The number of cells allocated on this heap.
+        */
+        TInt AllocSize( TInt& aTotalAllocSize ) const;
+        
+        /**
+        * Gets the total free space currently available on the heap and the 
+        * space available in the largest free block. The space available 
+        * represents the total space which can be allocated. Note that 
+        * compressing the heap may reduce the total free space available 
+        * and the space available in the largest free block.
+        * @param aBiggestBlock On return, contains the space available 
+        *                      in the largest free block on the heap.
+ 
+        * @return TInt The total free space currently available on the heap.
+
+        */
+        TInt Available( TInt& aBiggestBlock ) const;
+
+	#endif
+        
+        /**
+        * Invocates specified debug funtionality.
+        * @param aFunc The debug function
+        * @param a1 Debug function specific paramenter.
+        * @param a2 Debug function specific paramenter.
+        * @return TInt Returns KErrNone, if successful otherwise one 
+        *              of the other system-wide error codes.
+        */
+        TInt DebugFunction( TInt aFunc, TAny* a1 = NULL, TAny* a2 = NULL );
+        
+        // From MAnalyzeToolEventhandlerNotifier
+        
+        /**
+		* Remove killed thread from threads array.
+		* @param aThreadId - Thread Id
+		*/
+		void RemoveKilledThread( const TUint aThreadId );
+		
+    protected:
+
+        /**
+        * Extension function
+        * @param aExtensionId The extension id
+        * @param a0 Extension specific paramenter.
+        * @param a1 Extension specific paramenter.
+        * @return TInt Returns KErrNone, if successful otherwise one 
+        *              of the other system-wide error codes. 
+        */
+        TInt Extension_( TUint aExtensionId, TAny*& a0, TAny* a1 );
+
+    public: // from RAnalyzeToolMemoryAllocator
+        
+        /**
+        * Installs the RTraceAllocator allocator
+        */
+        void Uninstall();
+        
+        /**
+        * Shares the heap
+        */
+        void ShareHeap();
+
+    public: // inlines
+            
+        /**
+        * Acquires the codeblocks of the process
+        * @return RArray<TCodeblock>& The process codeblocks
+        */
+        inline RArray<TCodeblock>& Codeblocks();
+        
+        /**
+        * Acquires the mutex used to access shared objects
+        * @return RMutex& A reference to open mutex
+        */
+        inline RMutex& Mutex();
+        
+        /**
+        * Acquires the current process id
+        * @return TInt The process id
+        */
+        inline TInt ProcessId();
+
+        /**
+		* Acquires the logical channel handle
+		* @return RAnalyzeTool A reference to logical channel
+		*/
+        inline RAnalyzeTool& AnalyzeTool();
+                
+        /**
+        * Acquires the log option type 
+        * @return TUint32 iLogOption
+        */        
+        inline TUint32 LogOption();
+        
+        /**
+        * Acquires the max size of call stack when memory allocated
+        * @return TUint32 iAllocMaxCallStack
+        */        
+        inline TUint32 AllocMaxCallStack();
+        
+        /**
+         * Acquires the max size of call stack when memory freed
+         * @return TUint32 iFreeMaxCallStack
+         */
+        inline TUint32 FreeMaxCallStack();
+        
+        /**
+         * Acquires handle to lig file
+         * @return RATFileLog iLogFile
+         */
+        inline RATFileLog& LogFile();
+
+    private: // private functions
+
+        /**
+        * Log the process initial information
+        * @param aFileName The name of the log file
+        * @param aLogOption The logging option
+        * @param aIsDebug Determines whether a binary is UDEB or UREL
+        */
+        void LogProcessInformation( const TFileName& aFileName,  const TPath& aFilePath,  TUint32 aLogOption,
+        		TUint32 aIsDebug, const TDesC8& aAtoolVersion, const TDesC8& aApiVersion );
+
+        /**
+        * Find the current thread which is using the heap
+        * @param aStackStart A reference where the stack start is stored
+        * @return TBool ETrue if a thread can be found, EFalse otherwise
+        */
+        TBool FindCurrentThreadStack( TUint32& aStackStart );
+        
+        /**
+        * Installs the eventhandler, if possible
+        */
+        void InstallEventHandler();
+        
+        /**
+        * Logs version of ATApp, ATApi, S60 version and ROM checksum 
+        * at the startup of hooked application
+        */
+        void LogDeviceInfo();
+
+    private: // member variables
+
+        /* Handle to the RAnalyzeTool */		
+        RAnalyzeTool iAnalyzeTool;           
+        
+        /* A flag for indicating that the RAnalyzeTool is open */
+        TBool iAnalyzeToolOpen;
+
+        /* A flag for indicating that the device driver is loaded */
+        TBool iDeviceDriverLoaded;
+        
+        /* The codeblocks of the process */
+        RArray<TCodeblock> iCodeblocks;
+
+        /* The handler for kerner events */
+        CLibraryEventHandler* iEventHandler;
+
+        /* The mutex for serializing access to the shared resources */
+        mutable RMutex iMutex;	
+        	
+        /* Array for storing the callstack */	
+        TFixedArray <TUint32, KATMaxCallstackLength> iCallStack;
+
+        /* Array for storing the reallocation callstack */	
+        TFixedArray <TUint32, KATMaxCallstackLength> iReCallStack;
+
+        /* Array for storing the reallocation callstack */	
+        TFixedArray<TUint32, KATMaxFreeCallstackLength> iFreeCallStack;
+                
+        /* Array of threads using this heap */
+        RArray<TThreadStack> iThreadArray;
+        
+        /* Log option */
+        TUint32 iLogOption;
+
+        /* The process id */
+        TUint iProcessId;	
+        
+        /* Max items on stored call stack when memory allocated */
+        TUint32 iAllocMaxCallStack;
+        
+        /* Max items on stored call stack when memory freed */
+        TUint32 iFreeMaxCallStack;
+        
+        /* Binary log file */
+        RATFileLog iLogFile;
+       
+        
+    };
+
+// INLINES
+#include "analyzetoolmainallocator.inl"
+
+#endif // ANALYZETOOLMAINALLOCATOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolmainallocator.inl	Mon Sep 06 15:00:47 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:  Definition for the inline functions of RAnalyzeToolMainAllocator.
+*
+*/
+
+
+#include "analyzetoolmemoryallocator.h"
+  
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Codeblocks()
+// Acquires reference to process used codeblocks
+// -----------------------------------------------------------------------------
+//  
+inline RArray<TCodeblock>& RAnalyzeToolMainAllocator::Codeblocks()
+    {
+    return iCodeblocks;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Mutex()
+// Acquires reference to mutex which is used to share resources
+// -----------------------------------------------------------------------------
+//  
+inline RMutex& RAnalyzeToolMainAllocator::Mutex()
+    {
+    return iMutex;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::ProcessId()
+// Acquires the process id
+// -----------------------------------------------------------------------------
+//
+inline TInt RAnalyzeToolMainAllocator::ProcessId()
+    {
+    return iProcessId;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::AnalyzeTool()
+// Acquires the logical channel handle
+// -----------------------------------------------------------------------------
+//
+inline RAnalyzeTool& RAnalyzeToolMainAllocator::AnalyzeTool()
+    {
+    return iAnalyzeTool;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::LogOption()
+// Acquires the iLogOption variable
+// -----------------------------------------------------------------------------
+//
+inline TUint32 RAnalyzeToolMainAllocator::LogOption()
+    {
+    return iLogOption;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::AllocMaxCallStack()
+// Acquires the iAllocMaxCallStack variable
+// -----------------------------------------------------------------------------
+//
+inline TUint32 RAnalyzeToolMainAllocator::AllocMaxCallStack()
+    {
+    return iAllocMaxCallStack;
+    }
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::FreeMaxCallStack()
+// Acquires the iFreeMaxCallStack variable
+// -----------------------------------------------------------------------------
+//
+inline TUint32 RAnalyzeToolMainAllocator::FreeMaxCallStack()
+    {
+    return iFreeMaxCallStack;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::LogFile()
+// Acquires the iLogFile variable
+// -----------------------------------------------------------------------------
+//
+inline RATFileLog& RAnalyzeToolMainAllocator::LogFile()
+	{
+	return iLogFile;
+	}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolmemoryallocator.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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:  Declaration of the class RAnalyzeToolMemoryAllocator.
+*
+*/
+
+
+#ifndef ANALYZETOOLMEMORYALLOCATOR_H
+#define ANALYZETOOLMEMORYALLOCATOR_H
+
+// INCLUDES
+#include <u32std.h>
+#include "threadstack.h"
+#include "../../symbian_version.hrh"
+
+// CONSTANTS
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
+    #ifndef __WINS__
+    const TInt KDummyHandle = -1000;
+    #endif
+#endif
+
+// CLASS DECLARATION
+
+/**
+*  Abstract class for basic RAnalyzeToolMemoryAllocator funtions
+*/
+class RAnalyzeToolMemoryAllocator : public RAllocator
+    {
+    public:
+    
+        /**
+        * C++ default constructor.
+        * @param aNotFirst Is this first thread using this heap
+        */   
+        RAnalyzeToolMemoryAllocator( TBool aNotFirst );
+        
+        /**
+        * Destructor.
+        */  
+        //lint -e{1510} suppress "base class 'RAllocator' has no destructor"    
+        virtual ~RAnalyzeToolMemoryAllocator();
+        
+        /**
+        * Uninstall the RAnalyzeToolMemoryAllocator
+        */
+        virtual void Uninstall() = 0;
+        
+        /**
+        * Shares the heap for another thread
+        */
+        virtual void ShareHeap() = 0;
+
+    protected:
+
+        /**
+         * Switch original allocator in use.
+         * Switches original allocator in use if not already.
+         */
+        void SwitchOriginalAllocator();
+        
+        /**
+         * Checks is the given address in loaded code memory area.
+         */
+        inline bool IsAddressLoadedCode( TUint32& aAddress );
+        
+        /* The original thread RAllocator */
+        RAllocator* iAllocator;
+        
+        /* Is this the first thread using this heap */
+        TBool iNotFirst;   
+
+        /* Memorymodel */
+        TUint32 iMemoryModel;
+        
+    };
+
+// INLINES
+#include "analyzetoolmemoryallocator.inl"
+
+#endif // ANALYZETOOLMEMORYALLOCATOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolmemoryallocator.inl	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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:  Definition for the inline functions of RAnalyzeToolMemoryAllocator.
+*
+*/
+
+
+
+#include <analyzetool/atcommon.h>
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMemoryAllocator::IsAddressLoadedCode()
+// Checks is the given address in loaded code memory area.
+// -----------------------------------------------------------------------------
+//
+inline bool RAnalyzeToolMemoryAllocator::IsAddressLoadedCode( TUint32& aAddress )
+    {
+    // Debug log strings in this function are not used because
+    // this is called so many times.
+    /*
+     * TMemModelAttributes models.
+     * EMemModelTypeDirect      // direct memory model on hardware
+     * EMemModelTypeMoving=1    // moving memory model on hardware
+     * EMemModelTypeMultiple=2  // multiple memory model on hardware
+     * EMemModelTypeEmul=3      // emulation using single host process
+     * Flexible ?
+     */
+    switch( iMemoryModel )
+        {
+        case EMemModelTypeMultiple:
+            // Use low & high limits which define rofs loading->rom area
+            // in multiple memory model.
+            if ( aAddress < KATMultipleMemoryModelLowLimit 
+              || aAddress > KATMultipleMemoryModelHighLimit )
+                return false;
+            return true;
+        default:
+            return true;
+        }
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/analyzetoolpanics.pan	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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:  Panic codes and definition of a panic function for the Memory Hook
+*
+*/
+
+
+#ifndef ANALYZETOOLPANICS_PAN_H
+#define ANALYZETOOLPANICS_PAN_H
+
+_LIT( KAnalyzeToolName, "AnalyzeTool" );
+
+/** AnalyzeTool application panic codes */
+enum TAnalyzeToolPanics
+    {
+    ENoMemory = 1,
+    EFailedToCreateHeap,
+    ECantOpenHandle,
+    ECantLoadDevice,
+    ECantAppendToTheArray,
+    ECantFindRightThread,
+    ECantCreateMutex,
+    ECantLoadDeviceDriver,
+    ECantConnectDeviceDriver
+    // add further panics here
+    };
+
+inline void AssertPanic(TAnalyzeToolPanics aReason)
+    {
+    User::Panic( KAnalyzeToolName, aReason );
+    }
+
+#endif // ANALYZETOOLPANICS_PAN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/atdriveinfo.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* 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:  Declaration of the class TATDriveInfo.
+*
+*/
+
+
+
+#ifndef ATDRIVEINFO_H
+#define ATDRIVEINFO_H
+
+#include <f32file.h>
+
+// The path of the storage file
+#ifdef __WINS__
+_LIT( KATDataFilePath, ":\\logs\\analyzetool\\" );
+#else
+_LIT( KATDataFilePath, ":\\analyzetool\\" );
+_LIT( KATDataFilePath2, ":\\data\\analyzetool\\" );
+#endif
+
+/**
+*  Check what drives exists and creates file full path.
+*/
+class TATDriveInfo
+    {    
+    public: // Constructors
+        
+        /**
+        * C++ default constructor.
+        */
+        TATDriveInfo();
+
+    public: // New functions
+
+        /**
+        * Create the file full path.
+        * @param aPath Full path.
+        * @param aFileName Filename.
+        * @param aFs A handle to a file server.
+        * @return KErrNone or KErrAlreadyExists, if successful; 
+        *   Otherwise one of the other system wide error codes.
+        */
+        static TInt CreatePath( TDes& aPath, const TDesC& aFileName, const TDesC& aFilePath, RFs& aFs );   
+    
+    private: // New functions
+    
+        /**
+        * Get the available drive character.
+        * @param aDrive The drive letter.
+        * @param aDriveNumber The drive number.
+        * @param aFs A handle to a file server.
+        * @param aDriveType Drive type.
+        * @return KErrNone, if successful; otherwise KErrNotFound
+        */
+        static TInt GetDrive( TChar& aDrive, TInt& aDriveNumber, 
+                RFs& aFs, const TUint aDriveType );  
+        
+    };
+
+#endif // ATDRIVEINFO_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/codeblock.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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:  Declaration of the class TCodeblock.
+*
+*/
+
+
+#ifndef CODEBLOCK_H
+#define CODEBLOCK_H
+
+// INCLUDES
+#include <u32std.h>
+
+/**
+*  Stores information of process loaded code segments
+*/
+class TCodeblock
+    {
+    
+    public: // Constructors
+        
+        /**
+        * C++ default constructor.
+        * @param aRunAddress Start address of the memory block. 
+        * @param aSize The size of the memory block.
+        * @param aName The name of the library
+        */
+        TCodeblock( TLinAddr aRunAddress, TUint32 aSize, TBuf8<KMaxLibraryName>& aName );
+
+    public: // New functions
+
+        /**
+        * Checks if the given address is in this memory block area
+        * @param aAddress A address to be checked. 
+        * @return TBool Returns ETrue if the given address is in this
+        *               memory block area, EFalse otherwise
+        */
+        TBool CheckAddress( TUint32 aAddress );
+
+        /**
+        * Matches if the given parameters represents this memory block 
+        * @param aName The name of the library
+        * @return TBool Returns ETrue if the given parameters represents
+        *               this memory block, EFalse otherwise
+        */
+        TBool Match( TBuf8<KMaxLibraryName>& aName );
+        
+    private: // Member variables
+
+        /* Start address of the memory block */
+        TLinAddr iStartAddress;
+
+        /* End address of the memory block */
+        TLinAddr iEndAddress;
+
+        /* End address of the memory block */
+        TBuf8<KMaxLibraryName> iName;
+    };
+
+#endif // CODEBLOCK_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/inc/threadstack.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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:  Declaration of the class TThreadStack.
+*
+*/
+
+
+#ifndef THREADSTACK_H
+#define THREADSTACK_H
+
+// INCLUDES
+#include <u32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Stores thread id and the start of the thread's callstack
+*/
+class TThreadStack
+    {
+    public:
+    
+        /**
+        * C++ default constructor.
+        * @param aId The thread id
+        * @param aStackStart The start of thread's stack
+        */
+        TThreadStack( TThreadId aId, TUint32 aStackStart );
+        
+        /**
+        * Checks if this is the current thread and if this is the current
+        * thread assings value to the given parameter
+        * @param aStackStart& A reference to stack start
+        * @return TBool The start of thread's stack
+        */
+        TBool ThreadStackStart( TUint32& aStackStart );
+       
+        /**
+        * Checks if this the the current thread
+        * @param aThreadId A thread id
+        * @return TBool ETrue it this is the current thread, EFalse otherwise
+        */ 
+        TBool Match( const TUint aThreadId = 0 );
+        
+    private: // Member variables
+    
+        /* The id of the thread */
+        TThreadId iId;
+        
+        /* The start addess of this thread */
+        TUint32 iStackStart;
+    };
+
+
+#endif // THREADSTACK_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/sis/analyzetoolmemoryhook.pkg	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,34 @@
+;
+; 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:
+;
+
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"AnalyzeToolMemoryHook"},(0xEDF5A8B1),1,8,1
+
+;Localised Vendor name
+%{"Vendor-EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+;Supports Series 60 v 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; 1 File to install
+"\epoc32\release\armv5\urel\atoolmemoryhook.dll"-"!:\sys\bin\atoolmemoryhook.dll"
+"\epoc32\release\armv5\urel\atoolcleaner.dll"   -"!:\sys\bin\atoolcleaner.dll"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolallocator.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,901 @@
+/*
+* 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:  Definitions for the class RAnalyzeToolAllocator.
+*
+*/
+
+
+#include "analyzetoolallocator.h"
+#include "analyzetoolmemoryallocator.h"
+#include "atlog.h"
+#include "analyzetoolpanics.pan"
+#include "analyzetoolfastlog.h"
+#include <e32svr.h>
+
+// CONSTANTS
+
+// Length of the callstack address
+const TUint32 KAddressLength = 4;
+
+// Thread count
+const TInt KThreadCount = 1;
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::RAnalyzeToolAllocator()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RAnalyzeToolAllocator::RAnalyzeToolAllocator( TBool aNotFirst,
+                                              RArray<TCodeblock>& aCodeblocks, 
+                                              RMutex& aMutex,
+                                              TUint aProcessId,
+                                              RAnalyzeTool& aAnalyzeTool,
+                                              TUint32 aLogOption,
+                                              TUint32 aAllocCallStackSize,
+                                              TUint32 aFreeCallStackSize,
+                                              RATFileLog& aLogFile ) :
+    RAnalyzeToolMemoryAllocator( aNotFirst ),
+    iCodeblocks( aCodeblocks ), 
+    iMutex( aMutex ),
+    iProcessId( aProcessId ),
+    iThreadArray( KATMaxCallstackLength ),
+    iAnalyzeTool( aAnalyzeTool ),
+    iLogOption( aLogOption ),
+    iAllocMaxCallStack( aAllocCallStackSize ),
+    iFreeMaxCallStack( aFreeCallStackSize ),
+    iLogFile ( aLogFile )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::RAnalyzeToolAllocator()" );
+    
+    // Append thread to array of the users of this allocator
+    TThreadParamsBuf params;
+    params().iThreadId = RThread().Id().operator TUint();
+    TInt error = iAnalyzeTool.ThreadStack( params );
+    if ( KErrNone == error )
+        {
+        LOGSTR2( "ATMH Thread stack address: %x", params().iStackAddress );
+        LOGSTR2( "ATMH Thread stack size:    %x", params().iStackSize );
+        error = iThreadArray.Append( TThreadStack( RThread().Id(), 
+                             params().iStackAddress + params().iStackSize ) );
+
+        if ( iLogOption == EATLogToTraceFast )
+        	{
+            // log thread added
+            ATFastLogThreadStarted( aProcessId, RThread().Id().operator TUint() ); 
+        	}
+        else if ( iLogOption == EATLogToFile )
+        	{
+            iLogFile.ATFileLogThreadStarted( RThread().Id().operator TUint() );
+        	}
+        }
+    
+    __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantAppendToTheArray ) ); 
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::~RAnalyzeToolAllocator()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+RAnalyzeToolAllocator::~RAnalyzeToolAllocator()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::~RAnalyzeToolAllocator()" );
+    
+    for( TInt i=0; i<iThreadArray.Count(); i++)
+    	{
+        // log thread removed
+        if ( iLogOption == EATLogToTraceFast )
+        	{
+            ATFastLogThreadEnded( RProcess().Id().operator TUint(), RThread().Id().operator TUint() ); 
+            }
+        else if ( iLogOption == EATLogToFile )
+        	{
+            iLogFile.ATFileLogThreadEnded( RThread().Id().operator TUint() );
+        	}
+         }
+    
+    
+    // Close the thread array 
+    iThreadArray.Close();
+    }
+    
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::Uninstall()
+// Uninstalls the current allocator
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolAllocator::Uninstall()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::Uninstall()" );
+
+    // Switch back to the original allocator
+    SwitchOriginalAllocator();
+    
+    // Check if this is shared allocator between threads
+    if ( iThreadArray.Count() > KThreadCount )
+        {
+        // Close the shared allocator
+        Close();
+        return;
+        }
+
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
+    #ifndef __WINS__ 
+    // Remove dummy Tls handle
+    UserSvr::DllFreeTls( KDummyHandle );
+    #endif
+#endif
+    
+    // Since this is the last thread using this allocator it can be deleted
+    delete this;
+    }
+
+#ifdef __WINS__
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::Alloc() WINS version
+// Allocates a cell of specified size from the heap.
+// -----------------------------------------------------------------------------
+//
+UEXPORT_C TAny* RAnalyzeToolAllocator::Alloc( TInt aSize )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::Alloc()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // get thread ID
+    TUint threadId = RThread().Id();
+    // Alloc memory from the original allocator
+    TAny* p = iAllocator->Alloc( aSize );
+    
+    LOGSTR3( "ATMH RAnalyzeToolAllocator::Alloc() - aSize: %i, address: %x", 
+             aSize,  (TUint32) p );
+    
+	// Reset the callstack
+	iCallStack.Reset();
+
+	// Find the current thread callstack start address
+	TUint32 stackstart( 0 );
+	TBool found( FindCurrentThreadStack( stackstart ) );
+	LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
+	
+	TUint32 _sp;
+	__asm
+		{
+		mov [_sp], esp
+		}
+	
+	// Get codeblocks count
+	TInt blocksCount( iCodeblocks.Count() );
+	TInt error( KErrNone );
+	TUint arrayCounter = 0;
+	
+	for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
+		{
+		TUint32 addr = (TUint32) *( (TUint32*) i );
+		if ( ! IsAddressLoadedCode( addr ) )
+			continue;
+		for ( TInt j = 0; j < blocksCount; j++ )
+			{
+			if ( iCodeblocks[j].CheckAddress( addr ) )
+				{
+				// To avoid recursive call to ReAlloc specifying granularity
+				// Add address to the callstack
+				iCallStack[arrayCounter] = ( addr );
+				arrayCounter++;
+				break;
+				}
+			}
+		if ( arrayCounter == KATMaxCallstackLength ||
+			 arrayCounter == iAllocMaxCallStack )
+			{
+			LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
+			break;
+			}
+		}
+	// Log the memory allocation information
+	if ( iLogOption == EATLogToTraceFast )
+		{
+		// Using fast mode.
+		ATFastLogMemoryAllocated( iProcessId, (TUint32) p, iCallStack, aSize, threadId );
+		}
+	else if ( iLogOption == EATLogToFile )
+		{
+		iLogFile.ATFileLogMemoryAllocated( (TUint32) p, iCallStack, aSize, threadId );
+		}
+   
+    // Release the mutex
+    iMutex.Signal();
+    
+    return p;
+    }
+#else
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::Alloc() ARMV5 version
+// Allocates a cell of specified size from the heap.
+// -----------------------------------------------------------------------------
+//
+TAny* RAnalyzeToolAllocator::Alloc( TInt aSize )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::Alloc()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // get thread ID
+    TUint threadId = RThread().Id();
+        
+    // Alloc memory from the original allocator
+    TAny* p = iAllocator->Alloc( aSize );
+        
+
+	// Reset the callstack
+	iCallStack.Reset(); 
+	
+	// Find the current thread callstack start address
+	TUint32 stackstart( 0 );
+	TBool found( FindCurrentThreadStack( stackstart ) );
+	LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
+	
+	// Get codeblocks count
+	TInt blocksCount( iCodeblocks.Count() );
+	TUint arrayCounter = 0;
+	
+	for ( TUint32 i = __current_sp(); i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
+		{
+		TUint32 addr = (TUint32) *( (TUint32*) i );
+		if ( ! IsAddressLoadedCode( addr ) )
+			continue;
+		for ( TInt j = 0; j < blocksCount; j++ )
+			{
+			if ( iCodeblocks[j].CheckAddress( addr ) )
+				{
+				// To avoid recursive call to ReAlloc specifying granularity
+				// Add address to the callstack
+				iCallStack[arrayCounter] = ( addr );
+				arrayCounter++;
+				break;
+				}
+			}
+		if ( arrayCounter == KATMaxCallstackLength ||
+			 arrayCounter == iAllocMaxCallStack )
+			{
+			LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
+			break;
+			}
+		}
+	// Log the memory allocation information
+	if ( iLogOption == EATLogToTraceFast )
+		{
+		// Fast mode.
+		ATFastLogMemoryAllocated( iProcessId, (TUint32) p, iCallStack, aSize, threadId );
+		} 
+	else if ( iLogOption == EATLogToFile )
+		{
+	    iLogFile.ATFileLogMemoryAllocated( (TUint32) p, iCallStack, aSize, threadId );
+		}
+
+ 
+    // Release the mutex
+    iMutex.Signal(); 
+    
+    // Return the allocatated memory
+    return p;
+    }
+#endif // __WINS__
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::Free()
+// Frees the allocated memory
+// -----------------------------------------------------------------------------
+//
+TAny RAnalyzeToolAllocator::Free( TAny* aPtr )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::Free()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // get thread ID
+    TUint threadId = RThread().Id();
+    
+	// Reset the callstack
+	iFreeCallStack.Reset();
+	
+	if ( iFreeMaxCallStack > 0 )
+		{
+		// Find the current thread callstack start address
+		TUint32 stackstart( 0 );
+		TBool found( FindCurrentThreadStack( stackstart ) );
+		LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
+		TUint32 _sp;
+		
+		#ifdef __WINS__
+			__asm
+				{
+				mov [_sp], esp
+				}
+		#else
+			_sp = __current_sp();
+		#endif
+		
+		// Get codeblocks count
+		TInt blocksCount( iCodeblocks.Count() );
+		TUint arrayCounter = 0;
+	
+		for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
+			{
+			TUint32 addr = (TUint32) *( (TUint32*) i );
+			if ( ! IsAddressLoadedCode( addr ) )
+				continue;
+			for ( TInt j = 0; j < blocksCount; j++ )
+				{
+				if ( iCodeblocks[j].CheckAddress( addr ) )
+					{
+					// To avoid recursive call to ReAlloc specifying granularity
+					// Add address to the callstack
+					iFreeCallStack[arrayCounter] = addr;
+					arrayCounter++;
+					break;
+					}
+				}
+			if ( arrayCounter == KATMaxFreeCallstackLength ||
+				 arrayCounter == iFreeMaxCallStack )
+				{
+				break;
+				}
+			}
+		LOGSTR2( "ATMH > iFreeCallStack count ( %i )", arrayCounter );
+		}
+	
+	// Log freed memory.
+	if ( iLogOption == EATLogToTraceFast )
+		{
+		// Using fast mode.
+		ATFastLogMemoryFreed( iProcessId, (TUint32) aPtr, iFreeCallStack, threadId );
+		} 
+	else if ( iLogOption == EATLogToFile )
+		{
+		iLogFile.ATFileLogMemoryFreed( (TUint32) aPtr, iFreeCallStack, threadId );
+		}
+    
+    // Free the memory using original allocator
+    iAllocator->Free( aPtr ); 
+    
+    LOGSTR2( "ATMH RAnalyzeToolAllocator::Free() - aPtr: %x", (TUint32)aPtr );
+    
+    // Release the mutex
+    iMutex.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::Open()
+// Opens this heap for shared access. Opening the heap increases 
+// the heap's access count by one.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolAllocator::Open()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::Open()");
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Share the memory using original allocator
+    TInt error = iAllocator->Open();
+    
+    // If everything is OK add thread to the array which use this allocator
+    if ( KErrNone == error )
+        {
+        TThreadParamsBuf params;
+        params().iThreadId = RThread().Id().operator TUint();
+        error = iAnalyzeTool.ThreadStack( params );
+
+        __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantAppendToTheArray ) );
+
+        if ( KErrNone == error )
+            {
+            LOGSTR2( "ATMH Thread stack address: %x", params().iStackAddress );
+            LOGSTR2( "ATMH Thread stack size:    %x", params().iStackSize );
+            iThreadArray.Append( TThreadStack( RThread().Id(), 
+                    params().iStackAddress + params().iStackSize ) );
+            if ( iLogOption == EATLogToTraceFast )
+            	{
+                // log thread added
+                ATFastLogThreadStarted( RProcess().Id().operator TUint(), RThread().Id().operator TUint()); 
+            	}
+            else if ( iLogOption == EATLogToFile )
+				{
+				iLogFile.ATFileLogThreadStarted( RThread().Id().operator TUint() );
+				}
+            }
+        }
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return the error code
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::Close()
+// Closes this shared heap. Closing the heap decreases the heap's 
+// access count by one.
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolAllocator::Close()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::Close()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Close the memory using original allocator
+    iAllocator->Close();
+    
+    TInt count = iThreadArray.Count();
+    
+    // Iterate through array of threads to remove current thread
+    for ( TInt i = 0; i < count; i++ )
+        {
+        // Check if this is current thread
+        if ( iThreadArray[ i ].Match() )
+            {
+            // Remove the thread
+            iThreadArray.Remove( i );
+            if ( iLogOption == EATLogToTraceFast )
+            	{
+                // log thread removed
+                ATFastLogThreadEnded( RProcess().Id().operator TUint(), RThread().Id().operator TUint() ); 
+            	}
+            else if ( iLogOption == EATLogToFile )
+				{
+				iLogFile.ATFileLogThreadEnded( RThread().Id().operator TUint() );
+				}
+            
+            break;
+            }
+        }
+    
+    // Release the mutex
+    iMutex.Signal();
+    }
+
+#ifdef __WINS__
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::ReAlloc()
+// Increases or decreases the size of an existing cell.
+// -----------------------------------------------------------------------------
+//
+TAny* RAnalyzeToolAllocator::ReAlloc( TAny* aPtr, TInt aSize, TInt aMode )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::ReAlloc()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // get thread ID
+    TUint threadId = RThread().Id();
+
+    // Realloc the memory using original allocator
+    TAny* ptr = iAllocator->ReAlloc( aPtr, aSize, aMode );
+    
+    // NULL addresses are not in a process under test
+    if ( ptr && !( aMode & ENeverMove ) )
+        {
+        LOGSTR3( "ATMH RAnalyzeToolAllocator::ReAlloc() - aPtr: %x, ptr: %x", 
+                (TUint32)aPtr, (TUint32)ptr );
+        LOGSTR3( "ATMH RAnalyzeToolAllocator::ReAlloc() - aSize: %i, aMode: %i", 
+                aSize, aMode );
+
+
+		// Reset the callstack
+		iReCallStack.Reset(); 
+
+		// Find the current thread callstack start address
+		TUint32 stackstart( 0 ); 
+		TBool found( FindCurrentThreadStack( stackstart ) );
+		LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
+		
+		// Get current sp
+		TUint32 _sp( 0 );
+		__asm
+			{
+			mov [_sp], esp
+			}
+		
+		// Get codeblocks count
+		TInt blocksCount( iCodeblocks.Count() );
+		TInt error( KErrNone );
+		TUint arrayCounter = 0;
+		
+		for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
+			{
+			TUint32 addr = (TUint32) *( (TUint32*) i );
+			if ( ! IsAddressLoadedCode( addr ) )
+				continue;
+			for ( TInt j = 0; j < blocksCount; j++ )
+				{
+				if ( iCodeblocks[j].CheckAddress( addr ) )
+					{
+					// To avoid recursive call to ReAlloc specifying granularity
+					// Add address to the callstack
+					iReCallStack[arrayCounter] = addr;
+					arrayCounter++;
+					break;
+					}
+				}
+			if ( arrayCounter == KATMaxCallstackLength || 
+				 arrayCounter == iAllocMaxCallStack )
+				{
+				LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
+				break;
+				}
+			}
+
+		if ( iLogOption == EATLogToTraceFast )
+			{
+			// Using fast logging mode.
+			ATFastLogMemoryReallocated( iProcessId, (TUint32) aPtr, (TUint32) ptr, iReCallStack, aSize, threadId );
+			}
+		else if ( iLogOption == EATLogToFile )
+			{
+			iLogFile.ATFileLogMemoryReallocated( (TUint32) aPtr, (TUint32) ptr, iReCallStack, aSize, threadId );
+			}	
+		}
+    
+    // Release the mutex
+    iMutex.Signal();
+
+    // Return pointer to the reallocated cell
+    return ptr; 
+    }
+
+#else
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::ReAlloc()
+// Increases or decreases the size of an existing cell.
+// -----------------------------------------------------------------------------
+//
+TAny* RAnalyzeToolAllocator::ReAlloc( TAny* aPtr, TInt aSize, TInt aMode )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::ReAlloc()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // get thread ID
+    TUint threadId = RThread().Id();
+
+    // Realloc the memory using original allocator
+    TAny* ptr = iAllocator->ReAlloc( aPtr, aSize, aMode );
+
+    // NULL addresses are not in a process under test
+    if ( ptr && !( aMode & ENeverMove ) )
+        {
+        LOGSTR3( "ATMH RAnalyzeToolAllocator::ReAlloc() - aPtr: %x, ptr: %x", 
+                (TUint32)aPtr, (TUint32)ptr );
+        LOGSTR3( "ATMH RAnalyzeToolAllocator::ReAlloc() - aSize: %i, aMode: %i", 
+                aSize, aMode );
+
+		// Reset the callstack
+		iReCallStack.Reset(); 
+
+		// Find the current thread callstack start address
+		TUint32 stackstart( 0 ); 
+		TBool found( FindCurrentThreadStack( stackstart ) );
+		LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
+		
+		// Get codeblocks count
+		TInt blocksCount( iCodeblocks.Count() );
+
+		TUint arrayCounter = 0;
+		
+		for ( TUint32 i = __current_sp(); i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
+			{
+			TUint32 addr = (TUint32) *( (TUint32*) i );
+			if ( ! IsAddressLoadedCode( addr ) )
+				continue;
+			for ( TInt j = 0; j < blocksCount; j++ )
+				{
+				if ( iCodeblocks[j].CheckAddress( addr ) )
+					{
+					// To avoid recursive call to ReAlloc specifying granularity
+					// Add address to the callstack
+					iReCallStack[arrayCounter] = ( addr );
+					arrayCounter++;
+					break;
+					}
+				}
+			if ( arrayCounter == KATMaxCallstackLength || 
+				 arrayCounter == iAllocMaxCallStack )
+				{
+				LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
+				break;
+				}
+			}
+
+		if ( iLogOption == EATLogToTraceFast )
+			{
+			// Using fast logging mode.
+			ATFastLogMemoryReallocated( iProcessId, (TUint32) aPtr, (TUint32) ptr, iReCallStack, aSize, threadId );
+			}
+		else if ( iLogOption == EATLogToFile )
+			{
+			iLogFile.ATFileLogMemoryReallocated( (TUint32) aPtr, (TUint32) ptr, iReCallStack, aSize, threadId );
+			}
+		
+		
+		}
+
+    // Release the mutex
+    iMutex.Signal();
+
+    // Return pointer to the reallocated cell
+    return ptr; 
+    }
+
+#endif // __WINS__
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::Compress()
+// The function frees excess committed space from the top of the heap.
+// The size of the heap is never reduced below the minimum size 
+// specified during creation of the heap.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolAllocator::Compress()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::Compress()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+
+    // Compress the memory using original allocator
+    TInt compress = iAllocator->Compress();
+
+    // Release the mutex
+    iMutex.Signal();
+
+    // Return the space reclaimed
+    return compress;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::Reset()
+// Frees all allocated cells on this heap. 
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolAllocator::Reset()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::Reset()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+
+    // Reset the memory using original allocator
+    iAllocator->Reset();
+
+    // Release the mutex
+    iMutex.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::AllocSize()
+// Gets the number of cells allocated on this heap, and 
+// the total space allocated to them.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolAllocator::AllocSize( TInt& aTotalAllocSize ) const
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::AllocSize()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Acquire the memory information using original allocator
+    TInt size = iAllocator->AllocSize( aTotalAllocSize );
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return the number of cells allocated on this heap.
+    return size;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::Available()
+// Gets the total free space currently available on the heap and the 
+// space available in the largest free block. The space available 
+// represents the total space which can be allocated. Note that 
+// compressing the heap may reduce the total free space available 
+// and the space available in the largest free block.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolAllocator::Available( TInt& aBiggestBlock ) const
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::Available()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Acquire the memory information using original allocator
+    TInt available = iAllocator->Available( aBiggestBlock );
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return the total free space currently available on the heap
+    return available;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::AllocLen()
+// Gets the length of the available space in the specified 
+// allocated cell.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolAllocator::AllocLen( const TAny* aCell ) const
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::AllocLen()" ); 
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Acquire the memory information using original allocator
+    TInt len = iAllocator->AllocLen( aCell );
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return the length of the available space in the allocated cell.
+    return len;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::DebugFunction()
+// Invocates specified debug funtionality.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolAllocator::DebugFunction( TInt aFunc, TAny* a1, TAny* a2 )
+    {
+    LOGSTR2( "ATMH RAnalyzeToolAllocator::DebugFunction() %i", aFunc );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Invocate debug funtion using original allocator
+    TInt debug = iAllocator->DebugFunction( aFunc, a1, a2 );
+    
+    switch( aFunc )
+		{  
+		case EMarkEnd:
+			{
+			// Disables the __UHEAP_MARKEND macro
+			LOGSTR1( "ATMH __UHEAP_MARKEND macro called" );
+			if ( debug > 0 )
+				{
+				LOGSTR2( "ATMH __UHEAP_MARKEND detects leaks: %d", debug );
+				// Because there is leaks the alloc panic will occur but
+				// lets return a zero to pretend that everything is OK
+				debug = 0;
+				}
+			}
+		break;
+		
+		default:
+			{
+			}
+		break;
+		}
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return information of the debug function success
+    return debug;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::Extension_()
+// Extension function
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolAllocator::Extension_( TUint aExtensionId, TAny*& a0, 
+    TAny* a1 ) 
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::Extension_()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Invocate extension funtion using original allocator
+    TInt ext = RAllocator::Extension_( aExtensionId, a0, a1 );
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return information of the extension function success
+    return ext;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::ShareHeap()
+// Share heap with other thread
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolAllocator::ShareHeap()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolAllocator::ShareHeap()" );
+    
+    // Call the overwrited Open function
+    Open();
+    }
+    
+// -----------------------------------------------------------------------------
+// RAnalyzeToolAllocator::FindCurrentThreadStack()
+// Find the current thread which is using the heap
+// -----------------------------------------------------------------------------
+//
+TBool RAnalyzeToolAllocator::FindCurrentThreadStack( TUint32& aStackStart )
+    {
+    LOGSTR2( "ATMH RAnalyzeToolAllocator::FindCurrentThreadStack(), count( %i )", 
+            iThreadArray.Count() );
+    
+    // Flag for indicating that right thread has been found
+    TBool found( EFalse );
+    // If threre is only one thread it must be the right thread
+    if ( iThreadArray.Count() == KThreadCount )
+        {
+        if ( !iThreadArray[ 0 ].ThreadStackStart( aStackStart ) )
+            {
+            // This MUST BE the right thread
+            //__ASSERT_ALWAYS( EFalse, AssertPanic( ECantFindRightThread ) );
+            }
+        else if ( iThreadArray[ 0 ].ThreadStackStart( aStackStart ) )
+            {
+            found = ETrue;
+            }
+        }
+    else
+        {
+        // Iterate through array to find right thread
+        TInt count( iThreadArray.Count() );
+        
+        for ( TInt i = 0; i < count; i++ )
+            {
+            // Check if this is the right thread
+            if ( iThreadArray[ i ].ThreadStackStart( aStackStart ) )
+                {
+                // Right thread found. Mark the flag
+                found = ETrue;
+                break;
+                }
+            }
+        // If right thread was not found the panic must be raised
+        if ( !found )
+            {
+            //__ASSERT_ALWAYS( EFalse, AssertPanic( ECantFindRightThread ) );
+            }
+        }
+    return found;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/analyzetooleventhandler.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,218 @@
+/*
+* 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:  Definitions for the class CLibraryEventHandler.
+*
+*/
+
+
+// INCLUDE FILES
+#include "atlog.h"
+#include "analyzetooleventhandler.h"
+#include "analyzetooleventhandlernotifier.h"
+#include "analyzetoolmemoryallocator.h"
+#include "analyzetoolfastlog.h"
+
+// -----------------------------------------------------------------------------
+// CLibraryEventHandler::~CLibraryEventHandler()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CLibraryEventHandler::~CLibraryEventHandler()
+    {
+    LOGSTR1( "ATMH CLibraryEventHandler::~CLibraryEventHandler()" );
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CLibraryEventHandler::RunL()
+// Process active object's task
+// -----------------------------------------------------------------------------
+//
+void CLibraryEventHandler::RunL()
+    {
+    LOGSTR1( "ATMH CLibraryEventHandler::RunL()" );
+
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOGSTR2( "ATMH RunL error: %i",  iStatus.Int() );
+        return;
+        }
+    // Acquire the mutex
+    iMutex.Wait();
+
+    // Check that this is observed process 
+    if ( iLibraryInfo.iEventType == TLibraryEventInfo::ELibraryAdded )
+        {
+        LOGSTR1( "ATMH CLibraryEventHandler::RunL() - TLibraryEventInfo::ELibraryAdded" );
+        if ( iLibraryInfo.iProcessId == iProcessId )
+            {
+            TInt error( KErrNone );
+
+            // Log library load event.
+            if ( iLogOption == EATLogToTraceFast )
+                {
+                LOGSTR1( "ATMH CLibraryEventHandler::RunL() - ATFastLog.LogDllLoaded() " );
+                ATFastLogDllLoaded( iProcessId,
+                        iLibraryInfo.iLibraryName, 
+                        iLibraryInfo.iRunAddress,
+                        iLibraryInfo.iRunAddress + iLibraryInfo.iSize );
+                }
+            else if( iLogOption == EATLogToFile )
+            	{
+				iLogFile.ATFileLogDllLoaded( iLibraryInfo.iLibraryName, 
+						iLibraryInfo.iRunAddress,
+						iLibraryInfo.iRunAddress + iLibraryInfo.iSize );
+            	}
+            
+            if ( KErrNone == error )
+                {
+                iCodeblocks.Append( TCodeblock( iLibraryInfo.iRunAddress, 
+                        iLibraryInfo.iSize, 
+                        iLibraryInfo.iLibraryName ) );
+                }
+            }
+        }
+    else if ( iLibraryInfo.iEventType == TLibraryEventInfo::ELibraryRemoved )
+        {
+        LOGSTR1( "ATMH CLibraryEventHandler::RunL() - TLibraryEventInfo::ELibraryRemoved " );
+        TInt count = iCodeblocks.Count();
+        LOGSTR2( "ATMH count of code blocks: %i",  count );
+        for ( TInt i = 0; i < count; i++ )
+            {
+            if ( iCodeblocks[ i ].Match( iLibraryInfo.iLibraryName ) )
+                {
+                TBuf8<KMaxLibraryName> libraryName;
+                libraryName.Copy( iLibraryInfo.iLibraryName );
+                
+                // Log library unloaded event
+                if ( iLogOption == EATLogToTraceFast )
+                    {
+                    LOGSTR1( "ATMH CLibraryEventHandler::RunL() - ATFastLogDllUnloaded() " );
+                    ATFastLogDllUnloaded( iProcessId,
+                            libraryName,
+                            iLibraryInfo.iRunAddress, 
+                            iLibraryInfo.iRunAddress + iLibraryInfo.iSize );
+                    }
+                else if( iLogOption == EATLogToFile )
+					{
+					iLogFile.ATFileLogDllUnloaded( iLibraryInfo.iLibraryName, 
+							iLibraryInfo.iRunAddress,
+							iLibraryInfo.iRunAddress + iLibraryInfo.iSize );
+					}
+                iCodeblocks.Remove( i );
+                break;
+                }
+            }
+        }
+    else if ( iLibraryInfo.iEventType == TLibraryEventInfo::EKillThread )
+		{
+		LOGSTR1( "ATMH CLibraryEventHandler::RunL() - TLibraryEventInfo::EKillThread" );
+	  
+		iNotifier.RemoveKilledThread( iLibraryInfo.iThreadId );
+    	}
+    
+    Start();
+    
+    // Release the mutex
+    iMutex.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// CLibraryEventHandler::DoCancel()
+// Cancels active object's task
+// -----------------------------------------------------------------------------
+//
+void CLibraryEventHandler::DoCancel()
+    {
+    LOGSTR1( "ATMH CLibraryEventHandler::DoCancel()" );
+    // Cancel the subscription of the library events
+    if ( IsActive() )
+        {
+        iStarted = EFalse;
+        
+        iAnalyzeTool.CancelLibraryEvent();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CLibraryEventHandler::Start()
+// Creates CActiveScheduler and variables for the child thread
+// -----------------------------------------------------------------------------
+//
+void CLibraryEventHandler::Start()
+    {
+    LOGSTR1( "ATMH CLibraryEventHandler::Start()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+
+    if ( !IsAdded() )
+        {
+        CActiveScheduler::Add( this );
+        }
+
+    // Cancel current subscribetion
+    if ( IsActive() )
+        {
+        iStarted = EFalse;
+        Cancel();
+        }
+
+    iStatus = KErrNone;
+    iAnalyzeTool.LibraryEvent( iStatus, iLibraryInfo );
+    SetActive();
+    
+    iStarted = ETrue;
+    // Release the mutex
+    iMutex.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// CLibraryEventHandler::CLibraryEventHandler()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CLibraryEventHandler::CLibraryEventHandler( RAnalyzeTool& aAnalyzeTool, 
+	RArray<TCodeblock>& aCodeblocks,
+	TUint aProcessId, RMutex& aMutex, 
+	MAnalyzeToolEventhandlerNotifier& aNotifier,
+	TUint32 aLogOption,
+	RATFileLog& aFileLog ) 
+ :	CActive( EPriorityNormal ),
+    iAnalyzeTool( aAnalyzeTool ),
+    iCodeblocks( aCodeblocks ),
+    iProcessId( aProcessId ),
+    iMutex( aMutex ),
+    iStarted( EFalse ),
+    iNotifier( aNotifier ),
+    iLogOption( aLogOption ),
+    iLogFile( aFileLog )
+    {
+    LOGSTR1( "ATMH CLibraryEventHandler::CLibraryEventHandler()" );
+    }
+
+// -----------------------------------------------------------------------------
+// CLibraryEventHandler::IsStarted()
+// Returns eventhandler's state.
+// -----------------------------------------------------------------------------
+//
+TBool CLibraryEventHandler::IsStarted()
+    {
+    LOGSTR2( "ATMH CLibraryEventHandler::IsStarted(%i)", iStarted );
+    
+    return iStarted;
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolfastlog.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,549 @@
+/*
+* 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 <e32debug.h> // RDebug
+#include <analyzetool/analyzetooltraceconstants.h>
+#include "analyzetoolfastlog.h"
+#include "atlog.h"
+
+// Local time function.
+TInt64 CurrentTime()
+    {
+    LOGSTR1( "ATFL CurrentTime()" );
+    TTime time;
+    time.UniversalTime();
+    return time.Int64() - KMicroSecondsAt1970;
+    }
+
+TInt ATFastLogProcessStarted( const TDesC8& aProcessName,
+                                 TUint aProcessId,
+                                 TUint32 aIsDebug,
+                                 const TDesC8& aAtoolVersion,
+                                 const TDesC8& aApiVersion )
+    {
+    LOGSTR1( "ATFL ATFastLogProcessStarted()" );
+    
+    // PCS <Process name> <Process ID> <Time stamp> <Udeb> <Version>
+
+    //Buffer to trace
+    TBuf8<KProcessStartBufLength> buffer;
+    
+    // AT indentifier
+    buffer.Append( KATIdentifier );
+    // process id
+    buffer.AppendNum( aProcessId, EHex );
+    buffer.Append( KSpace );
+    
+    // PCS
+    buffer.Append( KProcessStart );
+    // process name
+    buffer.Append( aProcessName );
+    buffer.Append( KSpace );
+    // process id
+    buffer.AppendNum( aProcessId, EHex );
+    buffer.Append( KSpace );
+    // time stamp
+    buffer.AppendNum( CurrentTime(), EHex ) ;
+    buffer.Append( KSpace );
+    // urel/udeb
+    buffer.AppendNum( aIsDebug, EHex );
+    buffer.Append( KSpace );
+    // version
+    buffer.AppendNum( KATTraceVersion, EHex );
+    buffer.Append( KSpace );    
+    // atool version
+    buffer.Append( aAtoolVersion );
+    buffer.Append( KSpace );
+    // ATAPI version
+    buffer.Append( aApiVersion );
+
+
+
+
+    RDebug::RawPrint( buffer );
+       
+    return KErrNone;
+    }
+
+TInt ATFastLogProcessEnded( TUint aProcessId, 
+                            TUint aHandleLeakCount )
+    {
+    LOGSTR1( "ATFL ATFastLogProcessEnded()" );
+    
+    // PCE
+    
+    if ( aHandleLeakCount > 0 )
+    	{
+        // HDL <Handle count>
+    
+        // Buffer to trace.
+        TBuf8<KHandleLeakBufLength> buffer2;
+        
+        // AT indentifier
+        buffer2.Append( KATIdentifier );
+        // process id
+        buffer2.AppendNum( aProcessId, EHex );
+        buffer2.Append( KSpace );
+        
+        // HDL
+        buffer2.Append( KHandleLeak );
+        // leak count
+        buffer2.AppendNum( aHandleLeakCount );
+
+        RDebug::RawPrint( buffer2 );
+    	}
+    
+    // Buffer to trace.
+    TBuf8<KProcessEndBufLength> buffer;
+    
+    // AT indentifier
+    buffer.Append( KATIdentifier );
+    // process id
+    buffer.AppendNum( aProcessId, EHex );
+    buffer.Append( KSpace );
+    
+    // PCE
+    buffer.Append( KProcessEnd );
+    RDebug::RawPrint( buffer );
+    
+        
+    return KErrNone;
+    }
+
+TInt ATFastLogDllLoaded( TUint aProcessId, 
+                                        const TDesC8& aDllName,
+                                        TUint32 aStartAddress,
+                                        TUint32 aEndAddress )
+    {
+    LOGSTR1( "ATFL ATFastLogDllLoaded()" );
+    
+    // DLL <DLL name> <Memory start address> <Memory end address>
+    
+    // Buffer to trace.
+    TBuf8<KDllLoadBufLength> buffer;
+    
+    // AT indentifier
+    buffer.Append( KATIdentifier );
+    // process id
+    buffer.AppendNum( aProcessId, EHex  );
+    buffer.Append( KSpace );
+    
+    // DLL
+    buffer.Append( KDllLoad );
+    // dll name
+    buffer.Append( aDllName );
+    buffer.Append( KSpace );
+    // start adress
+    buffer.AppendNum( aStartAddress, EHex );
+    buffer.Append( KSpace );   
+    //end adress
+    buffer.AppendNum( aEndAddress, EHex );
+    
+    RDebug::RawPrint( buffer );
+    
+    return KErrNone;
+    }
+
+TInt ATFastLogDllUnloaded( TUint aProcessId, const TDesC8& aDllName, TUint32 aStartAddress,
+                                       TUint32 aEndAddress )
+    {
+    LOGSTR1( "ATFL ATFastLogDllUnloaded()" );
+    
+    // DLU <DLL name> <Memory start address> <Memory end address>
+    
+    // Buffer to trace.
+    TBuf8<KDllUnloadBufLength> buffer;
+    
+    // AT indentifier
+    buffer.Append( KATIdentifier );
+    // process id
+    buffer.AppendNum( aProcessId, EHex  );
+    buffer.Append( KSpace );
+    
+    // DLU
+    buffer.Append( KDllUnload );
+    // dll name
+    buffer.Append( aDllName );
+    buffer.Append( KSpace );
+    // start adress
+    buffer.AppendNum( aStartAddress, EHex );
+    buffer.Append( KSpace );   
+    //end adress
+    buffer.AppendNum( aEndAddress, EHex );
+    
+    RDebug::RawPrint( buffer );
+
+    return KErrNone;
+    }
+
+TInt ATFastLogMemoryAllocated( TUint aProcessId, TUint32 aMemAddress,
+                                  TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
+                                  TInt aSize, TUint aThreadId )
+    {
+    LOGSTR1( "ATFL ATFastLogMemoryAllocated()" );
+    
+    // ALH <Memory address> <Allocation size> <Thread ID> 
+    // <Call stack address count> <Call stack address> <Call stack address> ...
+        
+    // Buffer to trace.
+    TBuf8<KMemAllocBufLength> buffer;
+    
+    // AT indentifier
+    buffer.Append( KATIdentifier );
+    // process id
+    buffer.AppendNum( aProcessId, EHex  );
+    buffer.Append( KSpace );
+    
+    // ALH
+    buffer.Append( KMemoryAllocHeader );
+    // memory adress
+    buffer.AppendNum( aMemAddress, EHex );
+    buffer.Append( KSpace );
+    // allocation size
+    buffer.AppendNum( aSize, EHex );
+    buffer.Append( KSpace ); 
+    // thread ID
+    buffer.AppendNum( aThreadId, EHex );
+    buffer.Append( KSpace );
+
+    // Search call stack for address count.
+	TInt addrCount(0);
+	for ( TInt j = 0; j < aCallstack.Count() ; j++ )
+		{
+		if ( aCallstack.At(j) == 0 )
+			break;
+		addrCount++;
+		}
+	// Current position in call stack.
+	TInt addrPos( 0 );
+    
+    // address count
+    buffer.AppendNum( addrCount, EHex );
+    
+    TUint packetNumber( 1 );
+    
+    // Go through all call stack's memory addresses associated with
+    // this memory allocation 
+    for ( TInt j = 0; j < addrCount; j++ )
+        {
+        // ALF <Memory address> <Packet number> <Call stack address> <Call stack address> ...
+        if ( buffer.Length() <= 0 )
+            {
+            // AT indentifier
+            buffer.Append( KATIdentifier );
+            // process id
+            buffer.AppendNum( aProcessId, EHex  );
+            buffer.Append( KSpace ); 
+            
+            // Create alloc fragment message header
+            buffer.Append( KMemoryAllocFragment );
+            buffer.AppendNum( aMemAddress, EHex );
+            buffer.Append( KSpace );     
+            buffer.AppendNum( packetNumber, EHex );
+            // Increase packet number
+            packetNumber++;
+            }
+      
+        // Append call stack address.
+        buffer.Append( KSpace );
+        buffer.AppendNum( aCallstack.At( addrPos ), EHex );
+        
+        // Move the call stack position.
+        addrPos++;
+        
+        // Check if buffer max length exceed
+        if ( KLastItemLength + buffer.Length() >= KMemAllocBufLength )
+            {
+            // Log through debug channel 
+            RDebug::RawPrint( buffer );
+            // Empty trace buffer
+            buffer.Delete( 0, buffer.MaxLength() );
+            }
+        }
+    // Send last message if exists.
+    if ( buffer.Length() > 0 )
+        {
+        RDebug::RawPrint( buffer );
+        }
+ 
+    return KErrNone;
+    }
+
+
+TInt ATFastLogMemoryFreed( TUint aProcessId, TUint32 aMemAddress, 
+                              TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack,
+                              TUint aThreadId )
+    {
+    LOGSTR1( "ATFL ATFastLogMemoryFreed()" );
+
+	// FRH <Memory address> <Thread ID> <Call stack address count> 
+	// <Call stack address> <Call stack address> ...
+	
+	// Buffer to trace.
+	TBuf8<KMemFreedBufLength> buffer;
+
+	// AT indentifier
+	buffer.Append( KATIdentifier );
+	// process id
+	buffer.AppendNum( aProcessId, EHex  );
+	buffer.Append( KSpace );
+	
+	// FRH
+	buffer.Append( KMemoryFreedHeader );
+	
+	// Append the start address of this allocation in the 32-bit (max 8 characters)
+	// hexadecimal text format.
+	buffer.AppendNum( aMemAddress, EHex );
+	buffer.Append( KSpace );
+	
+	// thread ID
+	buffer.AppendNum( aThreadId, EHex );
+	buffer.Append( KSpace );
+	
+	// Search call stack for address count.
+	TInt addrCount(0);
+	for ( TInt j = 0; j < aFreeCallstack.Count() ; j++ )
+		{
+		if ( aFreeCallstack.At(j) == 0 )
+			break;
+		addrCount++;
+		}
+	// Current position in call stack.
+	TInt addrPos( 0 );
+	
+	// address count.
+	buffer.AppendNum( addrCount, EHex );
+	
+	TUint packetNumber( 1 );
+	
+	// Go through all call stack's memory addresses associated with
+	// this memory allocation 
+	for ( TInt j = 0; j < addrCount; j++ )
+		{
+		// FRF <Memory address> <Packet number> 
+		// <Call stack address> <Call stack address> ...
+		if ( buffer.Length() <= 0 )
+			{               
+			// Create alloc fragment message header
+			buffer.Append( KMemoryFreedFragment );
+			buffer.AppendNum( aMemAddress, EHex );
+			buffer.Append( KSpace );
+			buffer.AppendNum( packetNumber, EHex );
+			// Increase packet number
+			packetNumber++;
+			}
+	  
+		// Append call stack address.
+		buffer.Append( KSpace );
+		buffer.AppendNum( aFreeCallstack.At( addrPos ), EHex );
+		
+		// Move the call stack position.
+		addrPos++;
+		
+		// Check if buffer max length exceed
+		if ( KLastItemLength + buffer.Length() >= KMemFreedBufLength )
+			{
+			// Log through debug channel 
+			RDebug::RawPrint( buffer );
+			// Empty trace buffer
+			buffer.Delete( 0, buffer.MaxLength() );
+			}
+		}
+	// Send last message if exists.
+	if ( buffer.Length() > 0 )
+		{
+		RDebug::RawPrint( buffer );
+		}
+		
+    return KErrNone;   
+    }
+
+TInt ATFastLogMemoryReallocated( TUint aProcessId, TUint32 aMemAddressFree,  TUint32 aMemAddressAlloc,
+                                  TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
+                                  TInt aSize, TUint aThreadId )
+    {
+    LOGSTR1( "ATFL ATFastLogMemoryReallocated()" );    
+    
+    // RAH <Freed memory address> <Allocated memory address> <Allocation size> <Thread ID>
+    // <Call stack address count> <Call stack address> <Call stack address> ...
+        
+    // Buffer to trace.
+    TBuf8<KMemReallocBufLength> buffer;
+    
+    // AT indentifier
+    buffer.Append( KATIdentifier );
+    // process id
+    buffer.AppendNum( aProcessId, EHex  );
+    buffer.Append( KSpace );
+    
+    // RAH
+    buffer.Append( KMemoryReallocHeader );
+    // memory adress freed
+    buffer.AppendNum( aMemAddressFree, EHex );
+    buffer.Append( KSpace );
+    // memory adress allocated
+    buffer.AppendNum( aMemAddressAlloc, EHex );
+    buffer.Append( KSpace );
+    // allocation size
+    buffer.AppendNum( aSize, EHex );
+    buffer.Append( KSpace ); 
+    // thread ID
+    buffer.AppendNum( aThreadId, EHex );
+    buffer.Append( KSpace );
+
+    // Search call stack for address count.
+	TInt addrCount(0);
+	for ( TInt j = 0; j < aCallstack.Count() ; j++ )
+		{
+		if ( aCallstack.At(j) == 0 )
+			break;
+		addrCount++;
+		}
+	// Current position in call stack.
+	TInt addrPos( 0 );
+    
+    // address count
+    buffer.AppendNum( addrCount, EHex );
+        
+    TUint packetNumber( 1 );
+    
+    // Go through all call stack's memory addresses associated with
+    // this memory allocation 
+    for ( TInt j = 0; j < addrCount; j++ )
+        {
+        // RAF <Freed memory address> <Allocated memory address> <Packet number>
+        // <Call stack address> <Call stack address> ...
+        if ( buffer.Length() <= 0 )
+            {
+            // AT indentifier
+            buffer.Append( KATIdentifier );
+            // process id
+            buffer.AppendNum( aProcessId, EHex  );
+            buffer.Append( KSpace ); 
+            
+            // Create alloc fragment message header
+            buffer.Append( KMemoryReallocFragment );
+            // memory adress freed
+            buffer.AppendNum( aMemAddressFree, EHex );
+            buffer.Append( KSpace );
+            // memory adress allocated
+            buffer.AppendNum( aMemAddressAlloc, EHex );
+            buffer.Append( KSpace );
+            // packet number
+            buffer.AppendNum( packetNumber, EHex );
+            // Increase packet number
+            packetNumber++;
+            }
+      
+        // Append call stack address.
+        buffer.Append( KSpace );
+        buffer.AppendNum( aCallstack.At( addrPos ), EHex );
+        
+        // Move the call stack position.
+        addrPos++;
+        
+        // Check if buffer max length exceed
+        if ( KLastItemLength + buffer.Length() >= KMemAllocBufLength )
+            {
+            // Log through debug channel 
+            RDebug::RawPrint( buffer );
+            // Empty trace buffer
+            buffer.Delete( 0, buffer.MaxLength() );
+            }
+        }
+    // Send last message if exists.
+    if ( buffer.Length() > 0 )
+        {
+        RDebug::RawPrint( buffer);
+        }
+      
+    return KErrNone;
+    }
+
+TInt ATFastLogThreadStarted( TUint aProcessId, TUint aThreadId )
+    {
+    LOGSTR1( "ATFL ATFastLogThreadStarted()" );
+    
+    // TDS <Thread ID>
+
+    //Buffer to trace
+    TBuf8<KThreadStartBufLength> buffer;
+    
+    // AT indentifier
+    buffer.Append( KATIdentifier );
+    // process id
+    buffer.AppendNum( aProcessId, EHex  );
+    buffer.Append( KSpace );
+    
+    // TDS
+    buffer.Append( KThreadStart );
+    // thread ID
+    buffer.AppendNum( aThreadId, EHex );
+
+    RDebug::RawPrint( buffer );
+       
+    return KErrNone;
+    }
+
+TInt ATFastLogThreadEnded( TUint aProcessId, TUint64 aThreadId )
+    {
+    LOGSTR1( "ATFL ATFastLogThreadEnded()" );
+    
+    // TDE <Thread ID>
+
+    //Buffer to trace
+    TBuf8<KThreadEndBufLength> buffer;
+    
+    // AT indentifier
+    buffer.Append( KATIdentifier );
+    // process id
+    buffer.AppendNum( aProcessId, EHex  );
+    buffer.Append( KSpace );
+    
+    // TDE
+    buffer.Append( KThreadEnd );
+    // thread ID
+    buffer.AppendNum( aThreadId, EHex );
+
+    RDebug::RawPrint( buffer );
+       
+    return KErrNone;
+    }
+
+TInt ATFastLogDeviceInfo( const TDesC8& aS60Version, const TDesC8& aChecksum)
+    {
+    LOGSTR1( "ATFL ATFastLogVersionsInfo()" );
+    
+    //Buffer to trace
+    TBuf8<KVersionsInfoBufLength> buffer;
+    
+    // AT indentifier
+    buffer.Append( KATIdentifier );
+    
+    // VER
+    buffer.Append( KVersionsInfo );
+    
+    // sw version
+    buffer.Append(aS60Version);
+    buffer.Append(KSpace);
+    // rom checksum
+    buffer.Append(aChecksum);
+
+    RDebug::RawPrint( buffer );
+    
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolfilelog.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,603 @@
+/*
+* Copyright (c) 2010 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:  Declaration of the class TATDriveInfo.
+*
+*/
+
+#include "analyzetoolfilelog.h"
+#include "atdriveinfo.h"
+#include "atlog.h"
+#include <analyzetool/customuser.h>
+#include <analyzetool/analyzetooltraceconstants.h>
+#include <f32file.h> //RFs
+#include <utf.h>
+
+// New file name start and end index.
+const TInt KNameIndexStart = 1;
+const TInt KNameIndexEnd = 100;
+
+RATFileLog::RATFileLog()
+	{
+
+    // Initialize iMicroSecondsAt1970
+    TTime time( KJanuaryFirst1970 );
+    iMicroSecondsAt1970 = time.Int64();
+    iError = KErrNone;
+	}
+
+RATFileLog::~RATFileLog()
+	{
+	// Auto-generated destructor stub
+	}
+
+
+// Local time function.
+TInt64 RATFileLog::CurrentTime()
+    {
+    LOGSTR1( "ATFL void CATStorageServerSession::GetTime()" );
+    
+    // Get the current universal time
+    TTime time;
+    time.UniversalTime();
+        
+    // Change the time format that tells the number of microseconds from January First,
+    // 0 AD nominal Gregorian, into a format that tells the number of microseconds from
+    // January First, 1970 AD nominal Gregorian. This is a more generic format and
+    // can be directly exploited by the PC code parsing the data file that this
+    // server generates.        
+    return ( time.Int64() - iMicroSecondsAt1970 );        
+    }
+
+TInt RATFileLog::ATFileLogVersion()
+{
+    LOGSTR1( "ATFL CATFileLog::ATFileLogVersion()" );
+    
+    iFile << KDataFileVersion;
+
+    iFile.CommitL();   
+    return KErrNone;
+}
+
+TInt RATFileLog::ATFileLogProcessStarted( const TDesC8& aProcessName,
+                                          TUint aProcessId,
+                                          TUint32 aIsDebug,
+                                          const TDesC8& aAtoolVersion,
+                                          const TDesC8& aApiVersion )
+{
+    LOGSTR1( "ATFL CATFileLog::ATFileLogProcessStarted()" );
+ 
+    // log the current time
+    iFile << this->CurrentTime();
+    
+    // <Time stamp> PCS <Process name> <Process ID> <Udeb> <Version>
+    iFile << (TUint8)EProcessStart;
+    iFile << aProcessName;
+    iFile << (TUint32)aProcessId;
+    iFile << aIsDebug;
+    iFile << aAtoolVersion;
+    iFile << aApiVersion;
+    
+    // ensure that any buffered data is written to the stream
+    iFile.CommitL();
+    
+    return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+// RATFileLog::ATFileLogProcessEnded
+// 
+// -----------------------------------------------------------------------------
+// 
+TInt RATFileLog::ATFileLogProcessEnded( TUint aHandleLeakCount )
+{
+	LOGSTR1( "ATFL CATFileLog::ATFileLogProcessEnded()" );
+	   
+	if ( aHandleLeakCount > 0 )
+	{
+		// HDL <Handle count>
+		iFile << this->CurrentTime();
+        iFile << (TUint8)EHandleLeak;
+        iFile << (TUint32)aHandleLeakCount;	
+	}
+
+	// log the current time
+    iFile << this->CurrentTime();
+	
+	// PCE
+	iFile << (TUint8)EProcessEnd;
+	
+    // ensure that any buffered data is written to the stream
+    iFile.CommitL();
+	
+	return KErrNone;	
+}
+
+
+// -----------------------------------------------------------------------------
+// RATFileLog::ATFileLogDllLoaded
+// 
+// -----------------------------------------------------------------------------
+// 
+TInt RATFileLog::ATFileLogDllLoaded( const TDesC8& aDllName, TUint32 aStartAddress,
+                                TUint32 aEndAddress )
+{
+	LOGSTR1( "ATFL CATFileLog::ATFileLogDllLoaded()" );
+	    
+	// log the current time
+	iFile << this->CurrentTime();
+	
+	// DLL <DLL name> <Memory start address> <Memory end address>
+
+	// DLL
+	iFile << (TUint8)EDllLoad;
+	// dll name
+	iFile << aDllName;
+	// start adress
+	iFile << aStartAddress;
+	//end adress
+	iFile << aEndAddress;
+	
+	// ensure that any buffered data is written to the stream
+	iFile.CommitL();
+	
+	return KErrNone;
+}
+
+
+
+// -----------------------------------------------------------------------------
+// RATFileLog::ATFileLogDllUnloaded
+// 
+// -----------------------------------------------------------------------------
+// 
+TInt RATFileLog::ATFileLogDllUnloaded( const TDesC8& aDllName, TUint32 aStartAddress,
+                                       TUint32 aEndAddress )
+{
+    LOGSTR1( "ATFL CATFileLog::ATFileLogDllUnloaded()" );
+
+    // log the current time
+    iFile << this->CurrentTime();
+    
+    // DLU <DLL name> <Memory start address> <Memory end address>
+    
+    // DLU
+    iFile << (TUint8)EDllUnload;
+    // dll name
+    iFile << aDllName;
+    // start adress
+    iFile << aStartAddress;
+    //end adress
+    iFile << aEndAddress;
+    
+    // ensure that any buffered data is written to the stream
+    iFile.CommitL();
+	
+	return KErrNone;
+		
+}
+
+
+// -----------------------------------------------------------------------------
+// RATFileLog::ATFileLogMemoryAllocated
+// 
+// -----------------------------------------------------------------------------
+// 
+TInt RATFileLog::ATFileLogMemoryAllocated( TUint32 aMemAddress,
+                                  TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
+                                  TInt aSize,  TUint aThreadId  )
+{
+	LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryAllocated()" );
+	
+	// ALH <Memory address> <Allocation size> <Thread ID> 
+	// <Call stack address count> <Call stack address> <Call stack address> ...
+	
+	// log the current time
+	iFile << this->CurrentTime();
+
+	// ALH
+	iFile << (TUint8)EAllocH;
+	// memory adress
+	iFile << aMemAddress;
+	// allocation size
+	iFile << (TUint32)aSize;
+	// thread ID
+	iFile << (TUint32)aThreadId;
+
+	// Search call stack for address count.
+	TInt addrCount(0);
+	for ( TInt j = 0; j < aCallstack.Count() ; j++ )
+		{
+		if ( aCallstack.At(j) == 0 )
+			break;
+		addrCount++;
+		}
+	
+	// address count
+    iFile << (TUint32)addrCount;
+		
+	// Go through all call stack's memory addresses associated with
+	// this memory allocation 
+	for ( TInt addrPos = 0; addrPos < addrCount; addrPos++ )
+		{
+	    iFile <<  aCallstack.At( addrPos );
+		}
+
+	// ensure that any buffered data is written to the stream
+	iFile.CommitL();
+
+	return KErrNone;	
+}
+
+
+// -----------------------------------------------------------------------------
+// RATFileLog::ATFileLogMemoryFreed
+// 
+// -----------------------------------------------------------------------------
+// 
+TInt RATFileLog::ATFileLogMemoryFreed( TUint32 aMemAddress, 
+		                                  TFixedArray<TUint32, KATMaxFreeCallstackLength>& aFreeCallstack, 
+		                                  TUint aThreadId )
+{
+    LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryFreed()" );
+	
+	// FRH <Memory address> <Thread ID> <Call stack address count> 
+	// <Call stack address> <Call stack address> ...
+
+	// log the current time
+	iFile << this->CurrentTime();
+
+	// FRH
+	iFile << (TUint8)EFreeH;
+	
+	// Append the start address of this allocation in the 32-bit (max 8 characters)
+	// hexadecimal text format.
+	iFile << aMemAddress;
+
+	// thread ID
+	iFile << (TUint32)aThreadId;
+	
+	// Search call stack for address count.
+	TInt addrCount(0);
+	for ( TInt j = 0; j < aFreeCallstack.Count() ; j++ )
+		{
+		if ( aFreeCallstack.At(j) == 0 )
+			break;
+		addrCount++;
+		}
+	
+	// address count.
+	iFile << (TUint32)addrCount;
+
+	// Go through all call stack's memory addresses associated with
+	// this memory allocation 
+	for ( TInt addrPos = 0; addrPos < addrCount; addrPos++ )
+		{
+		iFile << aFreeCallstack.At( addrPos );
+		}
+
+	// ensure that any buffered data is written to the stream
+	iFile.CommitL();
+
+	return KErrNone;		
+}
+
+
+// -----------------------------------------------------------------------------
+// RATFileLog::ATFileLogMemoryReallocated
+// 
+// -----------------------------------------------------------------------------
+// 
+TInt RATFileLog::ATFileLogMemoryReallocated( TUint32 aMemAddressFree,  TUint32 aMemAddressAlloc,
+                                  TFixedArray<TUint32, KATMaxCallstackLength>& aCallstack,
+                                  TInt aSize,  TUint aThreadId  )
+{
+	LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryReallocated()" );    
+	    
+	// RAH <Freed memory address> <Allocated memory address> <Allocation size> <Thread ID>
+	// <Call stack address count> <Call stack address> <Call stack address> ...
+	        
+    // log the current time
+    iFile << this->CurrentTime();
+	
+	// RAH
+    iFile <<  (TUint8)EReallocH;
+	// memory adress freed
+    iFile << aMemAddressFree;
+	// memory adress allocated
+    iFile << aMemAddressAlloc;
+	// allocation size
+    iFile << (TUint32)aSize;
+	// thread ID
+    iFile << (TUint32)aThreadId;
+
+	// Search call stack for address count.
+	TInt addrCount(0);
+	for ( TInt j = 0; j < aCallstack.Count() ; j++ )
+		{
+		if ( aCallstack.At(j) == 0 )
+			break;
+		addrCount++;
+		}
+	
+	// address count
+	iFile << (TUint32)addrCount;
+		
+	// Go through all call stack's memory addresses associated with
+	// this memory allocation 
+	for ( TInt addrPos = 0; addrPos < addrCount; addrPos++ )
+		{	  
+		// Append call stack address.
+		iFile << aCallstack.At( addrPos );
+		}
+
+	// ensure that any buffered data is written to the stream
+	iFile.CommitL();
+
+	return KErrNone;	
+}
+
+
+// -----------------------------------------------------------------------------
+// RATFileLog::ATFileLogThreadStarted
+// 
+// -----------------------------------------------------------------------------
+// 
+TInt RATFileLog::ATFileLogThreadStarted( TUint aThreadId )
+{
+	LOGSTR1( "ATFL CATFileLog::ATFileLogThreadStarted()" );
+
+	// log the current time
+	iFile << this->CurrentTime();
+	
+	// TDS <Thread ID>
+
+	// TDS
+	iFile << (TUint8)EThreadStart;
+	// thread ID
+	iFile << (TUint32)aThreadId;
+    
+    // ensure that any buffered data is written to the stream
+    iFile.CommitL();
+
+	return KErrNone;
+}
+
+
+// -----------------------------------------------------------------------------
+// RATFileLog::ATFileLogThreadEnded
+// 
+// -----------------------------------------------------------------------------
+// 
+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;
+}
+
+
+// -----------------------------------------------------------------------------
+// RATFileLog::ATFileLogDeviceInfo
+// 
+// -----------------------------------------------------------------------------
+// 
+TInt RATFileLog::ATFileLogDeviceInfo( const TDesC8& aS60Version, const TDesC8& aChecksum)
+
+{
+    LOGSTR1( "ATFL CATFileLog::ATFileLogVersionsInfo()" );
+
+    // log the current time
+    iFile << this->CurrentTime();
+
+    // VER
+    iFile << (TUint8)EDeviceInfo;
+    // sw version
+    iFile << aS60Version;
+    // rom checksum
+    iFile << aChecksum;
+
+    // ensure that any buffered data is written to the stream
+    iFile.CommitL();
+
+	return KErrNone;	
+}
+
+
+
+// -----------------------------------------------------------------------------
+// RATFileLog::OpenFsAndFile
+// Internally used for opening a handle to the file server and a file
+// -----------------------------------------------------------------------------
+// 
+TInt RATFileLog::OpenFsAndFile( const TDesC& aFileName, const TDesC& aFilePath, 
+    const TDesC8& aProcessName )
+    {
+    LOGSTR1( "ATFL TInt CATFileLog::OpenFsAndFile()" );
+    
+    // Connect file server, return if error occured
+    iError = iFileServer.Connect();
+    if ( iError )
+        {
+        iFileServer.Close();
+        return iError;
+        }
+    
+    iError = iFileServer.ShareAuto();
+    if( iError )
+    	{
+		iFileServer.Close();
+		return iError;
+    	}
+
+    // Open a file
+    TBuf<KMaxFileName> fileNameBuf;  
+    
+    iError = TATDriveInfo::CreatePath( fileNameBuf, aFileName, aFilePath, iFileServer );
+                        
+    // Return, if an error occured, and it
+    // is not KErrAlreadyExists
+    if ( iError && iError != KErrAlreadyExists )
+        {
+        iFileServer.Close();
+        return iError;
+        }
+
+    // if file already exist, generat new filename with index
+    GenerateNewFileName( fileNameBuf, aProcessName );
+    
+    // Save the file name for this session
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( iLogFile, fileNameBuf );
+    
+    LOGSTR2( "ATFL > iError(%i)", iError );
+        
+    // If the file does not exist, create it. Write also the version number of
+    // the file at the beginning of the new file
+    if ( iError == KErrNotFound )
+        {
+        iError = iFile.Create( iFileServer, fileNameBuf, EFileWrite | EFileShareAny );
+        if ( !iError )
+            {
+        	// todo
+            }
+        }
+       
+    if ( iError )
+        {
+        iFile.Close();
+        iFileServer.Close();
+        return iError;
+        }
+
+    return iError;
+    }
+
+// -----------------------------------------------------------------------------
+// RATFileLog::GenerateNewFileName
+// Called internally when need generate new file name.
+// -----------------------------------------------------------------------------
+//                     
+void RATFileLog::GenerateNewFileName( TDes& aFileName,
+    const TDesC8& aProcessName )
+    {    
+    LOGSTR1( "ATFL void CATFileLog::GenerateNewFileName()" );
+        
+    // Extension
+    TBuf<KExtensionLength> extension;
+        
+	// Check if file already exist
+	CheckIfFileAlreadyExist( aFileName );
+	if ( iError == KErrNotFound )
+		{
+	    // If not we can use filename without indexing
+		return;
+		}
+	
+	// File with aFileName already exist, let's add index
+	
+	// Parse file extension if exists.
+	ParseExtension( aFileName, extension );
+	
+	// Temp file name
+	TBuf<KMaxFileName> tempName;
+	
+	for ( TInt i = KNameIndexStart; i < KNameIndexEnd; i++ )
+		{
+		tempName.Delete( 0, tempName.MaxLength() );
+		tempName.Format( KFormat, &aFileName, &KLeftBracket, i, &KRightBracket, &extension );
+		LOGSTR2( "ATFL > tempName(%S)", &tempName );
+		// Try to open file
+		CheckIfFileAlreadyExist( tempName );
+		// File does not exist, this index can be used
+		if ( iError == KErrNotFound )
+			{
+			aFileName.Copy( tempName );
+			break;
+			}
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// RATFileLog::ParseExtension
+// Method is used to parse file name extension.
+// -----------------------------------------------------------------------------
+//                     
+void RATFileLog::ParseExtension( 
+    TDes& aFileName, TDes& aExtension )
+    {    
+    LOGSTR2( "ATFL void CATFileLog::ParseExtension(%S)", 
+            &aFileName );
+
+    // Parse current file name
+    TParse parse;
+    // Set up the TParse object 
+    parse.Set( aFileName, NULL, NULL );
+
+    // Tests whether an extension is present.
+    if ( parse.ExtPresent() )
+        {
+        // Gets the extension
+        aExtension.Copy( parse.Ext() );
+        // Remove extension from file name
+        TInt pos( aFileName.Find( aExtension ) );
+        aFileName.Delete( pos, aFileName.Length() );
+        LOGSTR3( "ATFL > aFileName(%S), aExtension(%S)", 
+                &aFileName, &aExtension );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RATFileLog::CheckIfFileAlreadyExist
+// Method is used to check that file exists and is valid.
+// -----------------------------------------------------------------------------
+//                     
+void RATFileLog::CheckIfFileAlreadyExist( 
+    const TDes& aFileName )
+    {    
+    LOGSTR2( "ATFL void CATFileLog::CheckIfFileAlreadyExist(%S)", 
+            &aFileName );
+    
+    iError = iFile.Open( iFileServer, aFileName, EFileWrite );
+    LOGSTR2( "ATFL > iError(%i)", iError );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RATFileLog::CloseFsAndFile
+// Internally used for closing a handle to the file server and a file
+// -----------------------------------------------------------------------------
+// 
+void RATFileLog::CloseFsAndFile()
+    {
+    LOGSTR1( "ATFL void CATFileLog::CloseFsAndFile()" );
+    
+    // Close the file    
+    iFile.Close();
+                 
+    // Close the server session and return the error code   
+    iFileServer.Close();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolmainallocator.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1381 @@
+/*
+* 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:  Definitions for the class RAnalyzeToolMainAllocator.
+*
+*/
+
+
+#include "analyzetoolmainallocator.h"
+#include "atlog.h"
+#include "analyzetooleventhandler.h"
+#include "analyzetoolmemoryallocator.h"
+#include "analyzetoolpanics.pan"
+#include "analyzetoolfastlog.h"
+#include "analyzetoolfilelog.h"
+#include <e32svr.h>
+#ifndef __WINSCW__ 
+#include <e32rom.h>
+#endif
+#include <sysutil.h>
+
+
+// CONSTANTS
+
+// The name of the memoryhook dll
+_LIT8( KMemoryHook, "AToolMemoryHook.dll" );
+
+// Length of the callstack address
+const TUint32 KAddressLength = 4;
+
+// Thread count
+const TInt KThreadCount = 1;
+
+// separator that replaces \n character in sw version
+_LIT( KSeparator, "@" );
+// new line character
+_LIT( KNewLine16, "\n" );
+_LIT( KSpace16, " " );
+
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::RAnalyzeToolMainAllocator()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RAnalyzeToolMainAllocator::RAnalyzeToolMainAllocator( TBool aNotFirst, 
+    const TFileName& aFileName, const TPath& aFilePath, TUint32 aLogOption, TUint32 aIsDebug,
+    TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize,
+    const TDesC8& aAtoolVersion, const TDesC8& aApiVersion ) :
+    RAnalyzeToolMemoryAllocator( aNotFirst ),
+    iAnalyzeToolOpen( EFalse ),
+    iDeviceDriverLoaded( EFalse ),
+    iCodeblocks( KATMaxCallstackLength ),
+    iThreadArray( KATMaxCallstackLength ),
+    iLogOption( aLogOption ),
+    iProcessId( RProcess().Id().operator TUint() ),
+    iAllocMaxCallStack( aAllocCallStackSize ),
+    iFreeMaxCallStack( aFreeCallStackSize )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::RAnalyzeToolMainAllocator()" );
+
+    // Basic error variable used in method.
+    TInt error( KErrNone );
+        
+    // Create mutex for schedule access to shared resources
+    error = iMutex.CreateLocal();
+
+    __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantCreateMutex ) );
+
+    LOGSTR2( "ATMH Creating mutex error %i", error );
+
+    // Load the kernel side device driver
+    error = User::LoadLogicalDevice( KAnalyzeToolLddName );
+
+    if ( error != KErrNone && error != KErrAlreadyExists )
+        {
+        __ASSERT_ALWAYS( EFalse, AssertPanic( ECantLoadDeviceDriver ) );
+        }
+    else
+        {
+        iDeviceDriverLoaded = ETrue;
+        }
+
+    LOGSTR2( "ATMH Loading device driver error %i", error );
+
+    // Open handle to the kernel sidedevice driver
+    error = iAnalyzeTool.Open();
+
+    __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantConnectDeviceDriver ) );
+
+    if ( KErrNone == error )
+        {
+        iAnalyzeToolOpen = ETrue;
+        }
+
+    LOGSTR2( "ATMH Opening RAnalyzeTool handle %i error", error );
+
+    // Set memory model by asking kernel side device driver
+    if ( iAnalyzeToolOpen )
+        {
+        TATMemoryModelBuf model;
+        if ( KErrNone == iAnalyzeTool.GetMemoryModel( model ) )
+            {
+            iMemoryModel = model().iMemoryModel;
+            LOGSTR2( "ATMH AnalyzeTool MemoryModel: %i", iMemoryModel );
+            }
+        else
+            LOGSTR2( "ATMH AnalyzeTool GetMemoryModel error: %i", error );
+        }
+    
+    // Retrieve the initial process information
+    LogProcessInformation( aFileName, aFilePath, aLogOption, aIsDebug, aAtoolVersion, aApiVersion );
+
+    // log version of ATApp, ATApi, S60 version and ROM checksum
+    LogDeviceInfo();
+
+    // Create handler for receiving kernel events
+    iEventHandler = new CLibraryEventHandler( iAnalyzeTool,
+                                              iCodeblocks,
+                                              iProcessId,
+                                              iMutex, 
+                                              *this,
+                                              aLogOption,
+                                              iLogFile );
+
+    __ASSERT_ALWAYS( iEventHandler != NULL, AssertPanic( ENoMemory ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::~RAnalyzeToolMainAllocator()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+RAnalyzeToolMainAllocator::~RAnalyzeToolMainAllocator()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::~RAnalyzeToolMainAllocator()" );
+
+    TUint handleLeakCount( 0 );
+    if ( iAnalyzeToolOpen && iThreadArray.Count() > 0 )
+        {
+        TProcessHandleInfoBuf params;
+        params().iProcessId = iProcessId;
+        TInt error( iAnalyzeTool.GetProcessHandleInfo( params ) );
+        handleLeakCount = params().iThreadHandleCount;
+        }
+
+    // Close handle for process memory blocks
+    iCodeblocks.Close();
+
+    // Delete the eventhandler
+    delete iEventHandler;
+
+    // The count of device driver users
+    TClientCountBuf count;
+
+    // Check the flag
+    if ( iAnalyzeToolOpen )
+        {
+        TInt error  = iAnalyzeTool.ClientCount( count );
+        LOGSTR2( "ATMH closing analyze tool handle error: %i", error );
+        iAnalyzeTool.Close();
+        }
+
+    // Check the flag
+    if ( iDeviceDriverLoaded )
+        {
+        LOGSTR2( "ATMH device driver client count: %i", count().iClientCount );
+
+        // Check if there is another user for device driver
+        if ( count().iClientCount <= 1 )
+            {
+            // There was no other users -> unload the device driver
+            TInt error = User::FreeLogicalDevice( KAnalyzeToolLddName );
+            LOGSTR2( "ATMH Unloading ldd error: %i", error );
+            }
+        }
+    for( TInt i=0; i<iThreadArray.Count(); i++)
+    	{
+        // log thread removed
+		if ( iLogOption == EATLogToTraceFast )
+			{
+			ATFastLogThreadEnded( RProcess().Id().operator TUint(), RThread().Id().operator TUint() ); 
+			}
+		else if ( iLogOption == EATLogToFile )
+			{
+		    iLogFile.ATFileLogThreadEnded( RThread().Id().operator TUint() );		
+			}
+    	}
+
+    // Close the thread array
+    iThreadArray.Close();
+
+    if ( iLogOption == EATLogToTraceFast )
+        {
+        LOGSTR1( "ATMH ATFastLogProcessEnded()" );
+        ATFastLogProcessEnded( iProcessId, handleLeakCount );
+        }
+    else if ( iLogOption == EATLogToFile )
+    	{
+        iLogFile.ATFileLogProcessEnded( handleLeakCount );
+    	}
+    
+
+    // Close the mutex
+    iMutex.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::ShareHeap()
+// Share heap with other thread
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolMainAllocator::ShareHeap()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::ShareHeap()" );
+
+    // Call the overwrited Open function
+    Open();
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Uninstall()
+// Uninstalls the current allocator
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolMainAllocator::Uninstall()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Uninstall()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    TMainThreadParamsBuf params;
+    params().iProcessId = iProcessId;
+    iAnalyzeTool.MainThreadAlloctor( params );
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Check if this is shared allocator between threads
+    if ( iThreadArray.Count() > KThreadCount && !params().iAlone )
+        {
+        // Close the shared allocator
+        Close();
+        LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Uninstall() - Close called" );
+        return;
+        }
+
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
+    #ifndef __WINS__ 
+    // Remove dummy Tls handle
+    UserSvr::DllFreeTls( KDummyHandle );
+    #endif
+#endif
+    
+    // Since this is the last thread using this allocator it can be deleted
+    delete this;
+    }
+
+#ifdef __WINS__
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Alloc() WINS version
+// Allocates a cell of specified size from the heap.
+// -----------------------------------------------------------------------------
+//
+UEXPORT_C TAny* RAnalyzeToolMainAllocator::Alloc( TInt aSize )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Alloc()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // get thread ID
+    TUint threadId = RThread().Id();
+
+    // Alloc memory from the original allocator
+    TAny* p = iAllocator->Alloc( aSize );
+
+    LOGSTR3( "ATMH RAnalyzeToolMainAllocator::Alloc() - aSize: %i, address: %x", 
+            aSize,  (TUint32) p );
+
+
+	TInt error( KErrNone );
+			
+	// Check if eventhandler is started already
+	if ( !iEventHandler->IsStarted() )
+		{
+		// Install the eventhandler if needed
+		InstallEventHandler();
+		}
+	
+	// Reset the callstack
+	iCallStack.Reset();
+
+	// If we don't want any call stack to be saved skip the next part
+	if( iAllocMaxCallStack > 0 )
+		{
+		// Find the current thread callstack start address
+		TUint32 stackstart( 0 );
+		TBool found( FindCurrentThreadStack( stackstart ) );
+		LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
+					
+		// Returns the value of the stack pointer at the 
+		// current point in your program.
+		TUint32 _sp;
+		__asm
+			{
+			mov [_sp], esp
+			}
+		
+		// Get process loaded code segments count
+		TInt blocksCount( iCodeblocks.Count() );
+		TUint arrayCounter = 0;
+		
+		// Iterate through callstack to find wanted callstack addresses
+		// - Start: current stack address
+		// - Stop: stack start address(Run-address of user stack)
+		// - Add: address length(The word size in the current system is 32 bits, which is 4 bytes)
+		for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
+			{
+			TUint32 addr = (TUint32) *( (TUint32*) i );
+			
+			// Checks is the given address in loaded code memory area.
+			if ( !IsAddressLoadedCode( addr ) )
+				continue;
+			
+			// Iterate through array of code blocks to check if address is in code segment area 
+			for ( TInt j = 0; j < blocksCount; j++ )
+				{
+				// Checks if the given address is in this memory block area
+				if ( iCodeblocks[j].CheckAddress( addr ) )
+					{
+					// To avoid recursive call to ReAlloc specifying granularity
+					// Add address to the callstack
+					iCallStack[arrayCounter] = ( addr );
+					arrayCounter++;
+					break;
+					}
+				}
+			
+			// Checks if the wanted callstack items are gathered
+			if ( arrayCounter == KATMaxCallstackLength ||
+				 arrayCounter == iAllocMaxCallStack )
+				{
+				LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
+				break;
+				}
+			} 
+		}
+
+	// Log the memory allocation information
+	if ( iLogOption == EATLogToTraceFast )
+		{
+		// Using fast mode.
+		ATFastLogMemoryAllocated( iProcessId, (TUint32) p , iCallStack, aSize, threadId );
+		} 
+	else if ( iLogOption == EATLogToFile )
+		{
+		iLogFile.ATFileLogMemoryAllocated( (TUint32) p , iCallStack, aSize, threadId );
+		}
+	
+    // Release the mutex
+    iMutex.Signal();
+
+    return p;
+    }
+#else
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Alloc() ARMV5 version
+// Allocates a cell of specified size from the heap.
+// -----------------------------------------------------------------------------
+//
+TAny* RAnalyzeToolMainAllocator::Alloc( TInt aSize )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Alloc()"  );
+
+    // acquire the mutex
+    iMutex.Wait();
+    
+    // get thread ID
+    TUint threadId = RThread().Id();
+
+    // Alloc memory from the original allocator
+    TAny* p = iAllocator->Alloc( aSize );
+
+    LOGSTR3( "ATMH RAnalyzeToolMainAllocator::Alloc() - aSize: %i, address: %x", 
+            aSize,  (TUint32) p );
+
+
+	// Check if eventhandler is active already
+	// IsActive might return false value if a tested software has created many
+	// threads which install own CActiveScheduler.
+	if ( !iEventHandler->IsStarted() )
+		{
+		// Install the eventhandler if needed
+		InstallEventHandler();
+		}
+	
+	// Reset the callstack
+	iCallStack.Reset();
+	
+	// If we don't want any call stack to be saved skip the next part
+	if( iAllocMaxCallStack > 0 )
+		{
+		// Find the current thread callstack start address
+		TUint32 stackstart( 0 );
+		TBool found( FindCurrentThreadStack( stackstart ) );
+		LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
+		
+		// Get process loaded code segments count
+		TInt blocksCount( iCodeblocks.Count() );            
+		TUint arrayCounter = 0;
+		
+		// Iterate through callstack to find wanted callstack addresses
+		// - Start: current stack address(__current_sp(): Returns the value of the 
+		//      stack pointer at the current point in your program.)
+		// - Stop: stack start address(Run-address of user stack)
+		// - Add: address length(The word size in the current system is 32 bits, which is 4 bytes)
+		for ( TUint32 i = __current_sp(); i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
+			{
+			TUint32 addr = (TUint32) *( (TUint32*) i );
+			
+			// Checks is the given address in loaded code memory area.
+			if ( !IsAddressLoadedCode( addr ) )
+				continue;
+			
+			// Iterate through array of code blocks to check if address is in code segment area 
+			for ( TInt j = 0; j < blocksCount; j++ )
+				{
+				// Checks if the given address is in this memory block area
+				if ( iCodeblocks[j].CheckAddress( addr ) )
+					{
+					// To avoid recursive call to ReAlloc specifying granularity
+					// Add address to the callstack
+					iCallStack[arrayCounter] = ( addr );
+					arrayCounter++;
+					break;
+					}
+				}
+			
+			// Checks if the wanted callstack items are gathered
+			if ( arrayCounter == KATMaxCallstackLength ||
+				 arrayCounter == iAllocMaxCallStack )
+				{
+				LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
+				break;
+				}
+			}
+		}
+	// Log the memory allocation information
+	if ( iLogOption == EATLogToTraceFast )
+		{
+		// Using fast mode.
+		ATFastLogMemoryAllocated( iProcessId, (TUint32) p, iCallStack, aSize, threadId );
+		}
+	else if ( iLogOption == EATLogToFile )
+		{
+		iLogFile.ATFileLogMemoryAllocated( (TUint32) p , iCallStack, aSize, threadId );
+		}
+    
+    // Release the mutex
+    iMutex.Signal();
+
+    // Return the allocatated memory
+    return p;
+    }
+#endif // __WINS__
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Free()
+// Frees the allocated memory
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolMainAllocator::Free( TAny* aPtr )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Free()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // get thread ID
+    TUint threadId = RThread().Id();
+
+	// Reset the callstack
+	iFreeCallStack.Reset();
+	
+	// Check if trace logging mode
+	// Also if we don't want any call stack to be stored skip the next part
+	if ( iFreeMaxCallStack > 0 )
+		{
+		// Find the current thread callstack start address
+		TUint32 stackstart( 0 );
+		TBool found( FindCurrentThreadStack( stackstart ) );
+		LOGSTR3( "ATMH > stackstart: %x , found = %i", stackstart, found );
+		TUint32 _sp;
+		
+		// Returns the value of the stack pointer at the 
+		// current point in your program.
+		#ifdef __WINS__
+			__asm
+				{
+				mov [_sp], esp
+				}
+		#else
+			_sp = __current_sp();
+		#endif
+		
+		// Get process loaded code segments count
+		TInt blocksCount( iCodeblocks.Count() );
+		TUint arrayCounter = 0;
+		
+		// Iterate through callstack to find wanted callstack addresses
+		// - Start: current stack address
+		// - Stop: stack start address(Run-address of user stack)
+		// - Add: address length(The word size in the current system is 32 bits, which is 4 bytes)            
+		for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
+			{
+			TUint32 addr = (TUint32) *( (TUint32*) i );
+			// Checks is the given address in loaded code memory area.
+			if ( ! IsAddressLoadedCode( addr ) )
+				continue;
+			
+			// Iterate through array of code blocks to check if address is in code segment area 
+			for ( TInt j = 0; j < blocksCount; j++ )
+				{
+				// Checks if the given address is in this memory block area
+				if ( iCodeblocks[j].CheckAddress( addr ) )
+					{
+					// To avoid recursive call to ReAlloc specifying granularity
+					// Add address to the callstack
+					iFreeCallStack[arrayCounter] = addr;
+					arrayCounter++;
+					break;
+					}
+				}
+			// Checks if the wanted callstack items are gathered
+			if ( arrayCounter == KATMaxFreeCallstackLength ||
+				 arrayCounter == iFreeMaxCallStack )
+				{
+				break;
+				}
+			}
+		LOGSTR2( "ATMH > iFreeCallStack count ( %i )", arrayCounter );
+		}
+	// Log the memory free information.
+	if ( iLogOption == EATLogToTraceFast )
+		{
+		// Using fast mode.
+		ATFastLogMemoryFreed( iProcessId, (TUint32) aPtr, iFreeCallStack, threadId );
+		}
+    else if ( iLogOption == EATLogToFile )
+    	{
+        iLogFile.ATFileLogMemoryFreed( (TUint32) aPtr, iFreeCallStack, threadId );
+    	}
+     
+    // Free the memory using original allocator
+    iAllocator->Free( aPtr );
+
+    LOGSTR2( "ATMH RAnalyzeToolMainAllocator::Free() - aPtr: %x", (TUint32)aPtr );
+
+    // Release the mutex
+    iMutex.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Open()
+// Opens this heap for shared access. Opening the heap increases
+// the heap's access count by one.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolMainAllocator::Open()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Open() " );
+
+    // Acquire the mutex
+    iMutex.Wait();
+
+    // Share the memory using original allocator
+    TInt error = iAllocator->Open();
+
+    // If everything is OK add thread to the array which use this allocator
+    if ( KErrNone == error )
+        {
+        TThreadParamsBuf params;
+        params().iThreadId = RThread().Id().operator TUint();
+        error = iAnalyzeTool.ThreadStack( params );
+
+        __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantAppendToTheArray ) );
+
+        if ( KErrNone == error )
+            {
+            LOGSTR2( "ATMH Thread stack address: %x", params().iStackAddress );
+            LOGSTR2( "ATMH Thread stack size:    %x", params().iStackSize );
+            iThreadArray.Append( TThreadStack( RThread().Id(),
+                    params().iStackAddress + params().iStackSize ) );
+            if ( iLogOption == EATLogToTraceFast )
+            	{
+                // log thread added
+                ATFastLogThreadStarted( RProcess().Id().operator TUint() , RThread().Id().operator TUint() ); 
+            	}
+            else if ( iLogOption == EATLogToFile )
+            	{
+                iLogFile.ATFileLogThreadStarted( RThread().Id().operator TUint() );
+            	}
+            }
+        }
+
+    // Release the mutex
+    iMutex.Signal();
+
+    // Return the error code
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Close()
+// Closes this shared heap. Closing the heap decreases the heap's
+// access count by one.
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolMainAllocator::Close()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Close()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+
+    // Close the memory using original allocator
+    iAllocator->Close();
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Close() - allocator closed" );
+    TInt count = iThreadArray.Count();
+
+    // Iterate through array of threads to remove current thread
+    for ( TInt i = 0; i < count; i++ )
+        {
+        // Check if this is current thread
+        if ( iThreadArray[ i ].Match() )
+            {
+            // Remove the thread
+            iThreadArray.Remove( i );
+            if ( iLogOption == EATLogToTraceFast )
+            	{
+                // log thread removed
+                ATFastLogThreadEnded( RProcess().Id().operator TUint(), RThread().Id().operator TUint() ); 
+            	}
+            else if ( iLogOption == EATLogToFile )
+            	{
+                iLogFile.ATFileLogThreadEnded( RThread().Id().operator TUint() );
+            	}
+            LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Close() - thread removed" );
+            break;
+            }
+        }
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Close() - about to mutex signal" );
+    // Release the mutex
+    iMutex.Signal();
+    }
+
+#ifdef __WINS__
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::ReAlloc()
+// Increases or decreases the size of an existing cell.
+// -----------------------------------------------------------------------------
+//
+TAny* RAnalyzeToolMainAllocator::ReAlloc( TAny* aPtr, TInt aSize, TInt aMode )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::ReAlloc()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // get thread ID
+    TUint threadId = RThread().Id();
+
+    // Realloc the memory using original allocator
+    TAny* ptr = iAllocator->ReAlloc( aPtr, aSize, aMode );
+    
+    // NULL addresses are not in a process under test
+    if ( ptr && !( aMode & ENeverMove ) )
+        {
+        LOGSTR3( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - aPtr: %x, ptr: %x", 
+                (TUint32)aPtr, (TUint32)ptr );
+        LOGSTR3( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - aSize: %i, aMode: %i", 
+                aSize, aMode );
+      
+
+	TInt error( KErrNone );
+	TUint arrayCounter = 0;
+	
+	// Reset the callstack
+	iReCallStack.Reset();
+	
+	// If we don't want any call stack to be saved skip the next part
+	if( iAllocMaxCallStack > 0 )
+		{
+		// Find the current thread callstack start address
+		TUint32 stackstart( 0 );
+		TBool found( FindCurrentThreadStack( stackstart ) );
+		LOGSTR3( "ATMH > stackstart: %x , find = %i", stackstart, found );
+
+		// Returns the value of the stack pointer at the 
+		// current point in your program.
+		TUint32 _sp( 0 );
+		__asm
+			{
+			mov [_sp], esp
+			}
+		
+		// Get process loaded code segments count
+		TInt blocksCount( iCodeblocks.Count() );
+		
+		// Iterate through callstack to find wanted callstack addresses
+		// - Start: current stack address
+		// - Stop: stack start address(Run-address of user stack)
+		// - Add: address length(The word size in the current system is 32 bits, which is 4 bytes)                
+		for ( TUint32 i = _sp; i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
+			{
+			TUint32 addr = (TUint32) *( (TUint32*) i );
+			// Checks is the given address in loaded code memory area.
+			if ( ! IsAddressLoadedCode( addr ) )
+				continue;
+			
+			// Iterate through array of code blocks to check if address is in code segment area 
+			for ( TInt j = 0; j < blocksCount; j++ )
+				{
+				// Checks if the given address is in this memory block area
+				if ( iCodeblocks[j].CheckAddress( addr ) )
+					{
+					// To avoid recursive call to ReAlloc specifying granularity
+					// Add address to the callstack
+					iReCallStack[arrayCounter] = addr;
+					arrayCounter++;
+					break;
+					}
+				}
+			// Checks if the wanted callstack items are gathered
+			if ( arrayCounter == KATMaxCallstackLength || 
+				 arrayCounter == iAllocMaxCallStack )
+				{
+				LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
+				break;
+				}
+			}
+		}
+	
+	
+	// Log the memory reallocation information
+	if ( iLogOption == EATLogToTraceFast )
+		{
+		// Using fast logging mode.
+		ATFastLogMemoryReallocated( iProcessId, (TUint32) aPtr, (TUint32) ptr, iReCallStack, aSize, threadId );
+		}
+	else if ( iLogOption == EATLogToFile )
+		{
+		iLogFile.ATFileLogMemoryReallocated( (TUint32) aPtr, (TUint32) ptr, iReCallStack, aSize, threadId );
+		}
+       
+        }
+    
+    // Release the mutex
+    iMutex.Signal();
+
+    // Return pointer to the reallocated cell
+    return ptr;
+    }
+
+#else
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::ReAlloc()
+// Increases or decreases the size of an existing cell.
+// -----------------------------------------------------------------------------
+//
+TAny* RAnalyzeToolMainAllocator::ReAlloc( TAny* aPtr, TInt aSize, TInt aMode )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::ReAlloc()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+
+    // get thread ID
+    TUint threadId = RThread().Id();
+    
+    // Realloc the memory using original allocator
+    TAny* ptr = iAllocator->ReAlloc( aPtr, aSize, aMode );
+    
+    TUint arrayCounter = 0;
+    
+    // NULL addresses are not in a process under test
+    if ( ptr && !( aMode & ENeverMove ) )
+        {
+        LOGSTR3( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - aPtr: %x, ptr: %x", 
+                (TUint32)aPtr, (TUint32)ptr );
+        LOGSTR3( "ATMH RAnalyzeToolMainAllocator::ReAlloc() - aSize: %i, aMode: %i", 
+                aSize, aMode );
+ 
+		// Reset the callstack
+		iReCallStack.Reset();
+		
+		// If we don't want any call stack to be saved skip the next part
+		if( iAllocMaxCallStack > 0 )
+			{
+			// Find the current thread callstack start address
+			TUint32 stackstart( 0 );
+			TBool found( FindCurrentThreadStack( stackstart ) );
+			LOGSTR3( "ATMH > stackstart: %x , find = %i", stackstart, found );
+			
+			// Get process loaded code segments count
+			TInt blocksCount( iCodeblocks.Count() );
+			
+			// Iterate through callstack to find wanted callstack addresses
+			// - Start: current stack address(__current_sp(): Returns the value of the 
+			//      stack pointer at the current point in your program.)
+			// - Stop: stack start address(Run-address of user stack)
+			// - Add: address length(The word size in the current system is 32 bits, which is 4 bytes)
+			for ( TUint32 i = __current_sp(); i < stackstart; i = i + KAddressLength )//lint !e1055 !e526 !e628 !e348
+				{
+				TUint32 addr = (TUint32) *( (TUint32*) i );
+				
+				// Checks is the given address in loaded code memory area.
+				if ( !IsAddressLoadedCode( addr ) )
+					continue;
+							
+				// Iterate through array of code blocks to check if address is in code segment area 
+				for ( TInt j = 0; j < blocksCount; j++ )
+					{
+					// Checks if the given address is in this memory block area
+					if ( iCodeblocks[j].CheckAddress( addr ) )
+						{
+						// To avoid recursive call to ReAlloc specifying granularity
+						// Add address to the callstack
+						iReCallStack[arrayCounter] = ( addr );
+						arrayCounter++;
+						break;
+						}
+					}
+				// Checks if the wanted callstack items are gathered
+				if ( arrayCounter == KATMaxCallstackLength || 
+					 arrayCounter == iAllocMaxCallStack )
+					{
+					LOGSTR2( "ATMH > Wanted CallStack items ready( %i )", arrayCounter );
+					break;
+					}
+				}
+			}
+		
+		if ( iLogOption == EATLogToTraceFast )
+			{
+			// Using fast logging mode.
+			ATFastLogMemoryReallocated( iProcessId, (TUint32) aPtr, (TUint32) ptr, iReCallStack, aSize, threadId );
+			}
+		else if ( iLogOption == EATLogToFile )
+			{
+			iLogFile.ATFileLogMemoryReallocated( (TUint32) aPtr, (TUint32) ptr, iReCallStack, aSize, threadId );
+			} 
+        }
+
+    // Release the mutex
+    iMutex.Signal();
+
+    // Return pointer to the reallocated cell
+    return ptr;
+    }
+
+#endif // __WINS__
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Compress()
+// The function frees excess committed space from the top of the heap.
+// The size of the heap is never reduced below the minimum size
+// specified during creation of the heap.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolMainAllocator::Compress()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Compress()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+
+    // Compress the memory using original allocator
+    TInt compress = iAllocator->Compress();
+
+    // Release the mutex
+    iMutex.Signal();
+
+    // Return the space reclaimed
+    return compress;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Reset()
+// Frees all allocated cells on this heap.
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolMainAllocator::Reset()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Reset()" );
+
+    // Acquire the mutex
+    iMutex.Wait();
+
+    // Reset the memory using original allocator
+    iAllocator->Reset();
+
+    // Release the mutex
+    iMutex.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::AllocSize()
+// Gets the number of cells allocated on this heap, and
+// the total space allocated to them.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolMainAllocator::AllocSize( TInt& aTotalAllocSize ) const
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::AllocSize()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Acquire the memory information using original allocator
+    TInt size = iAllocator->AllocSize( aTotalAllocSize );
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return the number of cells allocated on this heap.
+    return size;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Available()
+// Gets the total free space currently available on the heap and the
+// space available in the largest free block. The space available
+// represents the total space which can be allocated. Note that
+// compressing the heap may reduce the total free space available
+// and the space available in the largest free block.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolMainAllocator::Available( TInt& aBiggestBlock ) const
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Available()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Acquire the memory information using original allocator
+    TInt available = iAllocator->Available( aBiggestBlock );
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return the total free space currently available on the heap
+    return available;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::AllocLen()
+// Gets the length of the available space in the specified
+// allocated cell.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolMainAllocator::AllocLen( const TAny* aCell ) const
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::AllocLen()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Acquire the memory information using original allocator
+    TInt len = iAllocator->AllocLen( aCell );
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return the length of the available space in the allocated cell.
+    return len;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::DebugFunction()
+// Invocates specified debug funtionality.
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolMainAllocator::DebugFunction( TInt aFunc, TAny* a1, TAny* a2 )
+    {
+    LOGSTR2( "ATMH RAnalyzeToolMainAllocator::DebugFunction() %i", aFunc );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Invocate debug funtion using original allocator
+    TInt debug = iAllocator->DebugFunction( aFunc, a1, a2 );
+    
+    switch( aFunc )
+        {  
+        case EMarkEnd:
+            {
+            // Disables the __UHEAP_MARKEND macro
+            LOGSTR1( "ATMH __UHEAP_MARKEND macro called" );
+            if ( debug > 0 )
+                {
+                LOGSTR2( "ATMH __UHEAP_MARKEND detects leaks: %d", debug );
+                // Because there is leaks the alloc panic will occur but
+                // lets return a zero to pretend that everything is OK
+                debug = 0;
+                }
+            }
+        break;
+        
+        default:
+            {
+            }
+        break;
+        }
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return information of the debug function success
+    return debug;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::RemoveKilledThread()
+// Remove killed thread from threads array.
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolMainAllocator::RemoveKilledThread( const TUint aThreadId  )
+    {
+    LOGSTR2( "ATMH RAnalyzeToolMainAllocator::RemoveKilledThread(%i)", 
+            aThreadId );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Iterate through array of threads to remove current thread
+    TInt count( iThreadArray.Count() );
+    LOGSTR2( "ATMH > iThreadArray.Count() %i", count );
+    
+    for ( TInt i = 0; i < count; i++ )
+        {
+        // Check if this is current thread
+        if ( iThreadArray[ i ].Match( aThreadId ) )
+            {
+            // Remove the thread
+            iThreadArray.Remove( i );
+            if ( iLogOption == EATLogToTraceFast )
+            	{
+                // log thread removed
+                ATFastLogThreadEnded( RProcess().Id().operator TUint(), aThreadId ); 
+            	}
+            else if ( iLogOption == EATLogToFile )
+				{
+                iLogFile.ATFileLogThreadEnded( aThreadId );
+				}
+            LOGSTR1( "ATMH > thread removed" );
+            break;
+            }
+        }
+
+    // Release the mutex
+    iMutex.Signal();
+    }
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::Extension_()
+// Extension function
+// -----------------------------------------------------------------------------
+//
+TInt RAnalyzeToolMainAllocator::Extension_( TUint aExtensionId, TAny*& a0,
+    TAny* a1)
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::Extension_()" );
+    
+    // Acquire the mutex
+    iMutex.Wait();
+    
+    // Invocate extension funtion using original allocator
+    TInt ext = RAllocator::Extension_( aExtensionId, a0, a1 );
+    
+    // Release the mutex
+    iMutex.Signal();
+    
+    // Return information of the extension function success
+    return ext;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::LogProcessInformation()
+// Retrieve and log the process initial information
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolMainAllocator::LogProcessInformation( const TFileName& aFileName, const TPath& aFilePath,
+    TUint32 aLogOption, TUint32 aIsDebug, const TDesC8& aAtoolVersion, const TDesC8& aApiVersion )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation()" );
+    
+    // Create local variable and retrieve the process information
+    TProcessIdentityParamsBuf params;
+    params().iProcessId = iProcessId;
+    params().iThreadId = RThread().Id().operator TUint();
+    TInt error = iAnalyzeTool.GetProcessInfo( params );
+    
+    LOGSTR2( "ATMH GetProcessInfo %i error", error );
+    
+    if ( KErrNone == error )
+        {
+        LOGSTR2( "ATMH Process %i", iProcessId );
+
+        // Store stack start address
+        LOGSTR2( "ATMH Thread stack address: %x", params().iStackAddress );
+        LOGSTR2( "ATMH Thread stack size:    %x", params().iStackSize );
+
+        // Append thread to array of the users of this allocator
+        error = iThreadArray.Append(
+        TThreadStack( RThread().Id(), params().iStackAddress + params().iStackSize) );
+        
+
+        __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantAppendToTheArray ) );
+        
+        // Using fast logging mode.
+        if ( iLogOption == EATLogToTraceFast )
+            {          
+            LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation() - ATFastLogProcessStarted() #1" );
+            // Log process information
+            ATFastLogProcessStarted( params().iProcessName, iProcessId, aIsDebug, aAtoolVersion, aApiVersion );    
+            // log thread added
+            ATFastLogThreadStarted( iProcessId, RThread().Id().operator TUint() );
+            }
+        else if ( iLogOption == EATLogToFile )
+            {
+            // Open a file server session and a file.
+            error = iLogFile.OpenFsAndFile( aFileName, aFilePath, params().iProcessName );
+
+            // Return without logging, if an error occured
+            if ( error != KErrNone )
+                {
+                // TODO
+                }
+            
+            //if everything is ok, add file version in the begining of file
+            iLogFile.ATFileLogVersion();
+            //log process start
+            iLogFile.ATFileLogProcessStarted( params().iProcessName, iProcessId, aIsDebug, aAtoolVersion, aApiVersion ); 
+            // log thread added
+            iLogFile.ATFileLogThreadStarted( RThread().Id().operator TUint() );
+            }
+                      
+        LOGSTR2( "ATMH LogProcessStarted error %i", error );
+
+        // Iterate through process codesegments
+        for( TInt i = 0; i < params().iCodesegCount; i++ )
+            {
+            // Create local variable and retrieve codesegment info
+            TCodesegInfoBuf codeinfo;
+            codeinfo().iProcessId = iProcessId;
+            codeinfo().iIndex = i;
+            error = iAnalyzeTool.GetCodesegInfo( codeinfo );
+
+            LOGSTR2( "ATMH GetCodesegInfo error %i", error );
+            if ( KErrNone == error )
+                {
+                // Don't log AnalyzeTool libraries
+                if ( 0 != codeinfo().iFullName.CompareC( KMemoryHook ) )
+                    {
+                    // Log the loaded codesegment(s)
+
+                    if ( iLogOption == EATLogToTraceFast )
+                        {
+                        // Using fast logging mode.
+                        LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation() - ATFastLogDllLoaded() #2" );
+                        ATFastLogDllLoaded( iProcessId,
+                                codeinfo().iFullName,
+                                codeinfo().iRunAddress,
+                                codeinfo().iRunAddress + codeinfo().iSize );
+                        }
+                    else if ( iLogOption == EATLogToFile )
+						{
+                        iLogFile.ATFileLogDllLoaded( 
+								codeinfo().iFullName,
+                                codeinfo().iRunAddress,
+                                codeinfo().iRunAddress + codeinfo().iSize );
+						}
+                    
+
+                    LOGSTR2( "ATMH LogDllLoaded error %i", error );
+
+                    // Check that everything is OK
+                    if ( KErrNone == error )
+                        {
+                        // Append the codesegment to the array
+                        error = iCodeblocks.Append(
+                                        TCodeblock( codeinfo().iRunAddress,
+                                        codeinfo().iSize,
+                                        codeinfo().iFullName ) );
+                        LOGSTR2( "ATMH Append error %i", error );
+                        }
+                    }
+                }
+            }
+
+        // Iterate through process dynamic codesegments
+        for ( TInt i = 0; i < params().iDynamicCount; i++ )
+            {
+            // Create local variable and retrieve codesegment info
+            TLibraryInfoBuf info;
+            info().iProcessId = iProcessId;
+            info().iIndex = i;
+            error = iAnalyzeTool.GetLibraryInfo( info );
+            LOGSTR2( "ATMH GetLibraryInfo error %i", error );
+            if ( KErrNone == error )
+                {
+                // Log the loaded dynamic codesegment(s)
+
+                if ( iLogOption == EATLogToTraceFast )
+                    {
+                    // Using fast logging mode.
+                    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::LogProcessInformation() - - ATFastLogDllLoaded()#3" );
+                    ATFastLogDllLoaded( iProcessId,
+                            info().iLibraryName,
+                            info().iRunAddress,
+                            info().iRunAddress + info().iSize );
+                    }
+                else if ( iLogOption == EATLogToFile )
+                	{
+                	iLogFile.ATFileLogDllLoaded( 
+                			info().iLibraryName,
+                			info().iRunAddress,
+                			info().iRunAddress + info().iSize );
+                	}
+     
+                LOGSTR2( "ATMH LogDllLoaded error %i", error );
+
+                if ( KErrNone == error )
+                    {
+                    // Append the codesegment to the array
+                    error = iCodeblocks.Append(
+                            TCodeblock( info().iRunAddress, 
+                                        info().iSize, info().iLibraryName ) );
+                    LOGSTR2( "ATMH Append error %i", error );
+                    }
+                }
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::FindCurrentThreadStack()
+// Find the current thread which is using the heap
+// -----------------------------------------------------------------------------
+//
+TBool RAnalyzeToolMainAllocator::FindCurrentThreadStack( TUint32& aStackStart )
+    {
+    LOGSTR2( "ATMH RAnalyzeToolMainAllocator::FindCurrentThreadStack(), count( %i )",
+            iThreadArray.Count() );
+    
+    // Flag for indicating that right thread has been found
+    TBool found( EFalse );
+    // If threre is only one thread it must be the right thread
+    if ( iThreadArray.Count() == KThreadCount )
+        {
+        if ( !iThreadArray[ 0 ].ThreadStackStart( aStackStart ) )
+            {
+            // This MUST BE the right thread
+            //__ASSERT_ALWAYS( EFalse, AssertPanic( ECantFindRightThread ) );
+            }
+        else if ( iThreadArray[ 0 ].ThreadStackStart( aStackStart ) )
+            {
+            found = ETrue;
+            }
+        }
+    else
+        {
+        // Iterate through array to find right thread
+        TInt count = iThreadArray.Count();
+
+        for ( TInt i = 0; i < count; i++ )
+            {
+            // Check if this is the right thread
+            if ( iThreadArray[ i ].ThreadStackStart( aStackStart ) )
+                {
+                // Right thread found. Mark the flag
+                found = ETrue;
+                break;
+                }
+            }
+        // If right thread was not found the panic must be raised
+        if ( !found )
+            {
+            //__ASSERT_ALWAYS( EFalse, AssertPanic( ECantFindRightThread ) );
+            }
+        }
+    return found;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::InstallEventHandler()
+// Installs the eventhandler, if possible
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolMainAllocator::InstallEventHandler()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMainAllocator::InstallEventHandler()" );
+    
+    // Active eventhalder is not active, trying to start it
+    if ( NULL != CActiveScheduler::Current() )
+        {
+        iEventHandler->Start();
+        }
+      }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMainAllocator::LogDeviceInfo()
+// Logs iversion of ATApp, ATApi, S60 version and ROM checksum 
+// at the startup of hooked application
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolMainAllocator::LogDeviceInfo()
+    {
+    //get s60 version
+    TBuf<KSysUtilVersionTextLength> bufS60;
+    if (SysUtil::GetSWVersion(bufS60) == KErrNone)
+        {
+        TInt index(0);
+        //replace newlines in string with '@'
+        //while ((index = bufS60.Find(KNewLine)) != KSysUtilVersionTextLength && index != KErrNotFound)
+        while ( (index = bufS60.Find(KNewLine16)) != KErrNotFound)
+            {
+            bufS60.Replace(index, 1, KSeparator);
+            }
+        while ( (index = bufS60.Find(KSpace16)) != KErrNotFound)
+			{
+			bufS60.Replace(index, 1, KSeparator);
+			}
+        }
+
+    TBuf<KHexa32Length> bufChecksum;
+    
+#ifndef __WINSCW__
+    TRomHeader* romHeader = (TRomHeader*) UserSvr::RomHeaderAddress();
+    if (romHeader)
+        {
+        bufChecksum.Format(_L("%08x"), romHeader->iCheckSum);
+        }
+#endif
+    
+    TBuf8<KSysUtilVersionTextLength> s60Version;
+    s60Version.Copy(bufS60);
+    
+    TBuf8<KHexa32Length> romChecksum;
+    romChecksum.Copy(bufChecksum);
+    
+    //only fastlog implementation
+    if (iLogOption == EATLogToTraceFast)
+    	{  
+        ATFastLogDeviceInfo(s60Version, romChecksum);
+        }
+    else if ( iLogOption == EATLogToFile )
+    	{
+        iLogFile.ATFileLogDeviceInfo( s60Version, romChecksum );
+    	}
+    
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolmemoryallocator.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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:  Definitions for the class RAnalyzeToolMemoryAllocator.
+*
+*/
+
+
+#include "analyzetoolmemoryallocator.h"
+#include "analyzetoolpanics.pan"
+#include "atlog.h"
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMemoryAllocator::RAnalyzeToolMemoryAllocator()
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+RAnalyzeToolMemoryAllocator::RAnalyzeToolMemoryAllocator( TBool aNotFirst ) :
+    RAllocator(),
+    iNotFirst( aNotFirst )
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMemoryAllocator::RAnalyzeToolMemoryAllocator()" );
+    
+    // Acquire the original allocator
+    iAllocator = &User::Allocator(); 
+    
+    // Set memory model zero
+    iMemoryModel = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMemoryAllocator::~RAnalyzeToolMemoryAllocator()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+RAnalyzeToolMemoryAllocator::~RAnalyzeToolMemoryAllocator()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMemoryAllocator::~RAnalyzeToolMemoryAllocator()" );
+    
+    // Call switching orinigal allocator back.
+    // Just in case, if uninstall was not called.
+    SwitchOriginalAllocator();
+    }
+    
+// -----------------------------------------------------------------------------
+// RAnalyzeToolMemoryAllocator::SwitchOriginalAllocator()
+// Switches original allocator in use if not already.
+// -----------------------------------------------------------------------------
+//
+void RAnalyzeToolMemoryAllocator::SwitchOriginalAllocator()
+    {
+    LOGSTR1( "ATMH RAnalyzeToolMemoryAllocator::SwitchOriginalAllocator()" );
+    
+    if ( iAllocator != &User::Allocator() )
+        {
+        User::SwitchAllocator( iAllocator );
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/atdriveinfo.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,216 @@
+/*
+* 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:  Definitions for the class TATDriveInfo.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <driveinfo.h>
+#include "atdriveinfo.h"
+#include "atlog.h"
+
+// -----------------------------------------------------------------------------
+// TATDriveInfo::TATDriveInfo
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+TATDriveInfo::TATDriveInfo()
+    {
+    LOGSTR1( "TATD TATDriveInfo::TATDriveInfo()" );
+    }
+
+// -----------------------------------------------------------------------------
+// TATDriveInfo::CreatePath()
+// -----------------------------------------------------------------------------
+//    
+TInt TATDriveInfo::CreatePath( TDes& aPath, 
+    const TDesC& aFileName, const TDesC& aFilePath, RFs& aFs )
+    {
+    LOGSTR1( "TATD TInt TATDriveInfo::CreatePath()" );
+    TInt err( KErrNotFound );
+    
+    // first try to create user defined directory
+    if( aFilePath.Length()>0 )
+    	{
+		err = aFs.MkDir( aFilePath );
+		LOGSTR2( "STSE > defined path aFs.MkDir err = %i", err );
+		
+		if ( !err || err == KErrAlreadyExists )
+			{
+			//directory was succesfully created or exists
+			aPath.Copy( aFilePath );
+			if ( aFileName.Length() != 0 && 
+				 ( ( aPath.MaxLength() - aPath.Length() ) > aFileName.Length() ) )
+				{
+				aPath.Append( aFileName );
+				}
+			return err;
+			}
+		else if( err == KErrBadName )
+			{
+			// TODO bad path, log error
+			// log default name in the end of function
+			}
+    	}
+	
+
+
+	//error when trying to create user defined directory, lets use default paths
+    
+    // Drive letter    
+    TChar driveLetter;
+    // Drive number
+    TInt dNumber( EDriveZ );     
+    TBool found( EFalse );
+    // Drive type
+    TUint driveType( KDriveAttRemovable );    
+    
+    
+    while ( !found )
+        {
+        // Get drive letter
+        if ( GetDrive( driveLetter, dNumber, aFs, driveType ) == KErrNotFound )
+        	{
+        	if ( driveType == KDriveAttInternal )
+        		{
+                return KErrNotFound;
+        		}       	
+            driveType = KDriveAttInternal;
+        	dNumber = EDriveZ;
+        	}       
+        else
+        	{
+			// Create path
+			aPath.Delete( 0, aPath.MaxLength() );
+			aPath.Append( driveLetter );
+		  
+		            
+		#ifdef __WINS__
+            // For emulator the data file is stored to different location
+            aPath.Append( KATDataFilePath );       
+		#else
+		    TDriveInfo driveInfo;
+		    aFs.Drive( driveInfo, dNumber );      
+            // The drive is removable( memory card ) so we can log inside of root folder
+            if ( driveInfo.iDriveAtt & KDriveAttRemovable )
+                {
+                aPath.Append( KATDataFilePath );       
+                }
+            // The drive is internal user can only access data folder so log into that
+            else
+                {
+                aPath.Append( KATDataFilePath2 );       
+                }
+		#endif
+						
+			// Make a directory for logging data file
+			err = aFs.MkDir( aPath );
+			LOGSTR2( "STSE > aFs.MkDir err = %i", err );
+			
+			if ( !err || err == KErrAlreadyExists )
+				{                
+                if ( aFileName.Length() != 0 && 
+                     ( ( aPath.MaxLength() - aPath.Length() ) > aFileName.Length() ) )
+                    {
+                    aPath.Append( aFileName );
+                    }
+				found = ETrue;
+				}
+        	}
+        }        
+    return err;        
+    }
+
+// -----------------------------------------------------------------------------
+// TATDriveInfo::GetDrive()
+// -----------------------------------------------------------------------------
+//    
+TInt TATDriveInfo::GetDrive( TChar& aDrive, TInt& aDriveNumber, RFs& aFs, 
+	const TUint aDriveType )
+    {
+    LOGSTR1( "TATD TInt TATDriveInfo::GetDrive()" );
+       
+    // Contains drive information.
+    TDriveInfo driveInfo; 
+    
+    for ( TInt i = aDriveNumber; i >= (TInt)EDriveA; i-- )
+        {
+        // Gets information about a drive and the medium mounted on it.
+        // If error occured then skip to next drive.
+        if ( aFs.Drive( driveInfo, i ) != KErrNone )
+            continue;
+                
+        // Test whether drive is available. If not, skip to next drive.
+        if ( driveInfo.iDriveAtt & KDriveAbsent || i == (TInt)EDriveD ||
+             driveInfo.iDriveAtt & KDriveAttRom || 
+             driveInfo.iMediaAtt & KMediaAttWriteProtected ||
+             driveInfo.iDriveAtt & KDriveFileSysROFS )
+            continue;
+        
+        // Maps a drive number to the corresponding character.
+        if ( aFs.DriveToChar( i, aDrive ) != KErrNone )
+            continue;                
+        
+        if ( driveInfo.iDriveAtt & aDriveType &&
+             driveInfo.iType != EMediaNotPresent &&
+             driveInfo.iType != EMediaCdRom )
+            {
+            TUint status( 0 );
+            
+            switch ( aDriveType )
+                {
+                case KDriveAttRemovable:
+                    {
+                    // Get the drive status of the default removable mass storage.                    
+                    if ( DriveInfo::GetDriveStatus( aFs, i, status ) == KErrNone )
+                        {
+                        // To indicate that the drive is physically removable.
+                        if ( status & DriveInfo::EDriveRemovable &&
+                             !( status & DriveInfo::EDriveCorrupt ) )
+                            {
+                            aDriveNumber = --i;
+                            return KErrNone;
+                            }
+                        }
+                    }
+                    break;
+                case KDriveAttInternal:
+                    {
+                    // Get the drive status of the default removable mass storage.
+                    if ( DriveInfo::GetDriveStatus( aFs, i, status ) == KErrNone )
+                        {
+                        // To indicate that the drive is internal and 
+                        // cannot be physically removed.
+                        if ( status & DriveInfo::EDriveInternal &&
+                             !( status & DriveInfo::EDriveExternallyMountable ) )
+                            {
+                            aDriveNumber = --i;
+                            return KErrNone;
+                            }
+                        }
+                    }
+                    break;
+                    
+                default:
+                    break;
+                }
+            }
+        }
+    return KErrNotFound;
+    }
+ 
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/codeblock.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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:  Definitions for the class TCodeblock.
+*
+*/
+
+
+#include "codeblock.h"
+#include "atlog.h"
+
+// -----------------------------------------------------------------------------
+// TCodeblock::TCodeblock
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+TCodeblock::TCodeblock( TLinAddr aRunAddress, 
+                        TUint32 aSize, 
+                        TBuf8<KMaxLibraryName>& aName ) :
+                        iStartAddress( aRunAddress ),
+                        iEndAddress( aRunAddress + aSize )
+    {
+    LOGSTR3( "ATMH TCodeblock::TCodeblock() %x - %x", iStartAddress, iEndAddress );
+    iName.Copy( aName );
+    }
+
+// -----------------------------------------------------------------------------
+// TCodeblock::CheckAddress
+// Checks if the given address is in this memory block area
+// -----------------------------------------------------------------------------
+//
+TBool TCodeblock::CheckAddress( TUint32 aAddress )
+    {
+    if ( iStartAddress <= aAddress && aAddress <= iEndAddress )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// TCodeblock::Match
+// Matches if the given parameters represents this memory block 
+// -----------------------------------------------------------------------------
+//
+TBool TCodeblock::Match( TBuf8<KMaxLibraryName>& aName )
+    {
+    LOGSTR1( "ATMH TCodeblock::Match()" );
+    return ( 0 == iName.CompareF( aName ) ) ? ETrue : EFalse;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/customuser.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,529 @@
+/*
+* 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:  Definitions for the class CustomUser.
+*
+*/
+
+#include <f32file.h>
+#include <utf.h>
+#include "customuser.h"
+#include "analyzetoolmainallocator.h"
+#include "analyzetoolallocator.h"
+#include "atlog.h"
+#include "analyzetoolmemoryallocator.h"
+#include "analyzetoolpanics.pan"
+#include "atdriveinfo.h"
+#include <analyzetool/analyzetooltraceconstants.h>
+#include "analyzetoolfastlog.h"
+
+#ifdef USE_CLEANER_DLL
+// Global variable to detect dll attach & detach in process.
+// Note! This is initialized after SetupThreadHeap so its not usable there.
+// This is used to store the main thread id and track when the process ends
+// to load the cleaner dll with call back feature to cleanup allocator at the
+// last possible phase.
+#include <analyzetool/analyzetoolcleaner.h>
+
+// CONSTANTS
+const TInt KAToolCleanerOrdinal = 1;
+
+class TAnalyzeToolGlobalTracker : public TAnalyzeToolCleanerBase
+    {
+public:
+    /* Main thread id */
+    TThreadId iMainId;
+    
+    /* Inform if panic occured */
+    TBool iPanic;
+    
+    // -----------------------------------------------------------------------------
+    // TAnalyzeToolGlobalTracker::TAnalyzeToolGlobalTracker()
+    // C++ default constructor 
+    // -----------------------------------------------------------------------------
+    //
+    TAnalyzeToolGlobalTracker()
+        {
+        LOGSTR1( "ATMH TAnalyzeToolGlobalTracker::TAnalyzeToolGlobalTracker()" );
+        
+        iPanic = EFalse; // no panic occured
+        iMainId = RThread().Id(); // set main thread id
+        LOGSTR2( "ATMH TAnalyzeToolGlobalTracker() > Main id set: %d", 
+                iMainId.operator TUint() );
+        }
+    
+    // -----------------------------------------------------------------------------
+    // TAnalyzeToolGlobalTracker::~TAnalyzeToolGlobalTracker()
+    // Destructor.
+    // -----------------------------------------------------------------------------
+    //
+    ~TAnalyzeToolGlobalTracker()
+        {
+        LOGSTR1( "ATMH TAnalyzeToolGlobalTracker::~TAnalyzeToolGlobalTracker()" );
+        
+        // We dont load dll if panic has happened (uninstallation has been done).
+        if ( iPanic )
+            {
+            LOGSTR1( "ATMH ~TAnalyzeToolGlobalTracker > Panic set not loading cleaner dll." );
+            return;
+            }
+        
+        LOGSTR1( "ATMH ~TAnalyzeToolGlobalTracker > about to load cleaner dll" );
+        // Load cleaner library and set a call back to our cleanup
+        RLibrary lib;
+        TInt error( lib.Load( KATCleanerDllName ) );
+        if ( error == KErrNone )
+            {
+            // Set address to point to ourself
+            TLibraryFunction func = lib.Lookup( KAToolCleanerOrdinal ); // Ordinal 1 of the dll
+            ATCLEANERTABLE* cleaner = (ATCLEANERTABLE*) func(); // Use function to get address
+            cleaner->At( 0 ) = (TUint32) this; // Set address
+            LOGSTR1( "ATMH ~TAnalyzeToolGlobalTracker() > cleaner dll loaded and call back set" );
+            }
+        else
+            {
+            // Error loading cleanup dll
+            LOGSTR2( "ATMH ~TAnalyzeToolGlobalTracker() > cleaner dll load error(%i) uninstalling allocator now!", 
+                    error );
+            Cleanup();
+            }
+        }
+    
+    // -----------------------------------------------------------------------------
+    // TAnalyzeToolGlobalTracker::Cleanup()
+    // 
+    // -----------------------------------------------------------------------------
+    //
+    void Cleanup()
+        {
+        LOGSTR1( "ATMH TAnalyzeToolGlobalTracker::Cleanup() - allocator uninstall" );
+        
+        // Uninstall allocator
+        ( (RAnalyzeToolMemoryAllocator&) User::Allocator() ).Uninstall();
+        }
+    
+    };
+
+// Global variable definition.
+TAnalyzeToolGlobalTracker gGlobalTracker;
+#endif
+
+// CONSTANTS
+// When needed, update the version number directly inside _LIT macro.
+// Constant for the atool API(staticlib) version.
+_LIT( KAtoolApiVersion, "1.7.6" );
+
+// Version number buffer length
+const TInt KAtoolVersionNumberLength = 10;
+
+// Wrong version error code
+const TInt KAtoolVersionError = -1999;
+
+// Version number separator
+_LIT( KVersionSeparator, ";" );
+
+// Incorrect version error strings 
+_LIT( KIncorrectText, "ERR INCORRECT_ATOOL_VERSION [API v.%S][ATOOL v.%S]" );
+_LIT( KIncorrectTextTrace, "<AT> " );
+
+// -----------------------------------------------------------------------------
+// CustomUser::Panic()
+// Overloaded User::Panic() function
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CustomUser::Panic( const TDesC& aCategory, TInt aReason )
+    {
+    LOGSTR3( "ATMH CustomUser::Panic() %S %i", &aCategory, aReason );
+    
+#ifdef USE_CLEANER_DLL
+    // Set global tracker that panic has happened.
+    gGlobalTracker.iPanic = ETrue;
+#endif
+    
+    // Uninstall thread's RAllocator
+    ( (RAnalyzeToolMemoryAllocator&) User::Allocator() ).Uninstall();
+       
+    // Call the "real" User::Panic()
+    User::Panic( aCategory, aReason );
+    }
+
+// -----------------------------------------------------------------------------
+// CustomUser::Exit()
+// Overloaded User::Exit() function
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CustomUser::Exit( TInt aReason )
+    {
+    LOGSTR3( "ATMH CustomUser::Exit() %i %i", aReason, RThread().Id().Id() );
+    
+    if ( aReason != KAtoolVersionError )
+    	{
+#ifdef USE_CLEANER_DLL
+        // Only uninstall allocator if its not the process main/first thread.
+        LOGSTR3( "ATMH CustomUser::Exit() - Thread id: %d - Main Id: %d",
+                RThread().Id().operator TUint(), gGlobalTracker.iMainId.operator TUint() );
+        
+        if ( RThread().Id() != gGlobalTracker.iMainId )
+            {
+            LOGSTR2("ATMH CustomUser::Exit() - Calling allocator uninstall in thread: %d" , RThread().Id().operator TUint() );
+            ( (RAnalyzeToolMemoryAllocator&) User::Allocator() ).Uninstall();
+            }
+#else
+    	// Uninstall thread's RAllocator
+    	( (RAnalyzeToolMemoryAllocator&) User::Allocator() ).Uninstall();
+    	LOGSTR1( "ATMH CustomUser::Exit() - about to User::Exit" );
+#endif
+    	}
+    
+    // Call the "real" User::Exit()
+    User::Exit( aReason );
+    }
+
+// -----------------------------------------------------------------------------
+// CustomUser::SetCritical()
+// Overloaded User::SetCritical() function which returns
+// KErrNone, if successful; KErrArgument, if EAllThreadsCritical is 
+// passed - this is a state associated with a process, and you use 
+// User::SetProcessCritical() to set it.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CustomUser::SetCritical( User::TCritical aCritical )
+    {
+    LOGSTR1( "ATMH CustomUser::SetCritical()" );
+    // Check the given User::TCritical type
+    if ( aCritical == User::EAllThreadsCritical )
+        {
+        return KErrArgument;
+        }
+    else
+        {
+        return KErrNone;
+        }
+    }
+  
+// -----------------------------------------------------------------------------
+// CustomUser::SetProcessCritical()
+// Overloaded User::SetProcessCritical() function
+// KErrNone, if successful; KErrArgument, if either EProcessCritical or 
+// EProcessPermanent is passed - these are states associated with a 
+// thread, and you use User::SetCritical() to set them.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CustomUser::SetProcessCritical( User::TCritical aCritical )
+    {
+    LOGSTR1( "ATMH CustomUser::SetProcessCritical()" );
+     // Check the given User::TCritical type 
+    if ( aCritical == User::EProcessCritical || 
+         User::EProcessPermanent == aCritical )
+        {
+        return KErrArgument;
+        }
+    else
+        {
+        return KErrNone;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CustomUser::SetupThreadHeap()
+// Overloaded UserHeap::SetupThreadHeap function
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CustomUser::SetupThreadHeap( TBool aNotFirst, 
+    SStdEpocThreadCreateInfo& aInfo, const TFileName& aFileName, const TPath& aFilePath,
+    TUint32 aLogOption, TUint32 aIsDebug, const TATVersion& aVersion,
+    TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize,
+    TRefByValue<const TDesC> aFmt, ... )
+    {
+    LOGSTR1( "ATMH CustomUser::SetupThreadHeap()" );
+    LOGSTR2( "ATMH > Thread id(%d)", RThread().Id().operator TUint() );
+    
+    // Add handling of the argument list here.
+        
+    TInt ret( KErrNone ); 
+    
+    // Check version number
+    TBuf<KAtoolVersionNumberLength> atoolVer;
+    TBuf<KApiVersionLength> apiVer;
+    TInt err( KErrNone );
+    err = CheckVersion( aVersion, atoolVer, apiVer );
+    
+    if ( err )
+    	{
+    	LOGSTR1( "ATMH > Wrong API version > Inform user and Exit." );
+    	ReportIncorrectVersion( aLogOption, aFileName, aFilePath, atoolVer );
+    	return KAtoolVersionError;
+    	}
+    
+    // Check is this shared heap
+    if ( aInfo.iAllocator == NULL )
+        {
+        LOGSTR1( "ATMH creating a new heap" );
+        // RAllocator is NULL so heap is not shared, creating a new heap
+        ret = UserHeap::SetupThreadHeap( aNotFirst, aInfo );
+        __ASSERT_ALWAYS( KErrNone == ret, AssertPanic( EFailedToCreateHeap ) );
+        
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
+    #ifndef __WINS__
+        // Set dummy Tls value
+        TAny* dummyPtr( NULL );
+        TInt setErr( UserSvr::DllSetTls( KDummyHandle, dummyPtr ) );
+        LOGSTR2( "ATMH > Set Tls err(%i)", setErr );
+    #endif
+#endif
+        // Install the RAllocator
+        TBuf8<KAtoolVersionLength> atoolVer8;
+        atoolVer8.Copy(atoolVer);
+        TBuf8<KApiVersionLength> apiVer8;
+        apiVer8.Copy(apiVer);
+        aInfo.iAllocator = &InstallAllocator( aNotFirst, aFileName, aFilePath, aLogOption, aIsDebug,
+                aAllocCallStackSize, aFreeCallStackSize, atoolVer8, apiVer8 );
+        }
+    else
+        {
+        LOGSTR1( "ATMH sharing the heap" );
+        // The heap is shared. Acquire pointer to the original heap
+        RAnalyzeToolMemoryAllocator* allocator = 
+			(RAnalyzeToolMemoryAllocator*) aInfo.iAllocator;
+        // Share the heap
+        allocator->ShareHeap();
+        // Switch thread heap 
+        User::SwitchAllocator( allocator );
+        }
+    
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CustomUser::InstallAllocator
+// Installs the RAllocator
+// -----------------------------------------------------------------------------
+//
+//lint -e{429} suppress "Custodial pointer 'allocator' has not been freed or returned"
+EXPORT_C RAllocator& CustomUser::InstallAllocator( TBool aNotFirst, 
+	const TFileName& aFileName,  const TPath& aFilePath, TUint32 aLogOption, TUint32 aIsDebug,
+	TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize, const TDesC8& aAtoolVersion, const TDesC8& aApiVersion )
+    {
+    LOGSTR1( "ATMH CustomUser::InstallAllocator()" );
+    
+    // Open handle to the device driver
+    RAnalyzeTool analyzetool;
+    TInt error = analyzetool.Open();
+    
+    // Check if the device driver has already loaded
+    if ( KErrNone == error )
+        {
+        LOGSTR1( "ATMH CustomUser::InstallAllocator() - analyzetool.Open() returned KErrNone" );
+        // The device driver has already loaded
+        // Get pointer to the main thread allocator
+        TMainThreadParamsBuf params;
+        params().iProcessId = RProcess().Id().operator TUint();
+        error = analyzetool.MainThreadAlloctor( params );
+
+        __ASSERT_ALWAYS( KErrNone == error, AssertPanic( ECantOpenHandle ) );
+        
+        // Close handle to the device driver
+        analyzetool.Close();
+        
+        // Is this the first thread of the program
+        if ( params().iAlone )
+            {
+            LOGSTR1( "ATMH CustomUser::InstallAllocator() - first thread of the program" );
+            // Only one thread in the program. Must be main thread
+            RAnalyzeToolMainAllocator* allocator = 
+				new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aFilePath, aLogOption,
+				                               aIsDebug, aAllocCallStackSize, aFreeCallStackSize, 
+				                               aAtoolVersion, aApiVersion );
+            
+            __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) );
+            
+            // Change threads allocator
+            User::SwitchAllocator( allocator );
+            
+            // Return reference to the RAllocator
+            return *allocator;
+            }
+        // This is not the first thread. A new thread with a new heap created
+        else
+            {
+            LOGSTR1( "ATMH CustomUser::InstallAllocator() - create a new allocator for the new thread" );
+            // Create new RAllocator with handles from the main thread
+            RAnalyzeToolAllocator* allocator = new RAnalyzeToolAllocator( 
+                    aNotFirst,
+                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->Codeblocks(), 
+                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->Mutex(), 
+                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->ProcessId(), 
+                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->AnalyzeTool(),
+                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->LogOption(),
+                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->AllocMaxCallStack(),
+                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->FreeMaxCallStack(),
+                    ((RAnalyzeToolMainAllocator*)params().iAllocator)->LogFile() );
+
+            __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) );
+            
+            // Change threads allocator
+            User::SwitchAllocator( allocator );
+            
+            // Return reference to the RAllocator
+            return *allocator;
+            }
+        }
+    // The device driver does not exists so this must be the first thread
+    else
+        {
+        LOGSTR1( "ATMH CustomUser::InstallAllocator() - analyzetool.Open() returned error, creating DD" );
+        RAnalyzeToolMainAllocator* allocator = 
+			new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aFilePath, aLogOption, aIsDebug,
+			        aAllocCallStackSize, aFreeCallStackSize, aAtoolVersion, aApiVersion );
+        
+        __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) );
+        
+        // Change threads allocator
+        User::SwitchAllocator( allocator );
+
+        // Return reference to the RAllocator
+        return *allocator;
+        }
+    } 
+    
+// -----------------------------------------------------------------------------
+// CustomUser::CheckVersion
+// Check atool version
+// -----------------------------------------------------------------------------
+//
+TInt CustomUser::CheckVersion( const TATVersion& aVersion, TDes& aToolVersion, TDes& aApiVersion )
+    { 
+    LOGSTR2( "ATMH CustomUser::CheckVersion(), aVersion( %S )", &aVersion );
+    
+    TFileName version;
+    version.Copy( aVersion );
+    TBuf<KAtoolVersionNumberLength> apiVer;
+    	
+    // Find separator place
+    TInt findplace( version.Find( KVersionSeparator() ) );
+    // Parse API version first [x.x.x;x.x.x]
+    if ( findplace >= 0 && findplace <= aApiVersion.MaxLength() )
+		{
+        aApiVersion.Copy( version.Mid( 0, findplace ) ); 
+		version.Delete( 0, findplace + KVersionSeparator().Length() );
+		}
+ 
+    if ( version.Length() <= aToolVersion.MaxLength() )
+    	{
+    	aToolVersion.Copy( version );
+    	if ( aToolVersion.Compare( KAtoolApiVersion ) == KErrNone &&
+    	     aApiVersion.Length() == 0 )
+    		{
+    		// Support 1.5.0 version (Version info: [1.5.0])
+    	    aApiVersion.Copy( version );
+    		}
+    	}
+    
+    LOGSTR3( "ATMH > API version( %S ), ATOOL version( %S )", 
+    		&aApiVersion, &aToolVersion );
+        
+    // Check version numbers 
+    if ( aApiVersion.Compare( KAtoolApiVersion ) == KErrNone )
+    	{
+    	return KErrNone;
+    	}
+    return KErrCancel;    
+    }
+
+// -----------------------------------------------------------------------------
+// CustomUser::ReportIncorrectVersion
+// Function for showing incorrect version information
+// -----------------------------------------------------------------------------
+//
+void CustomUser::ReportIncorrectVersion( const TUint32 aLogOption,
+	const TFileName& aFileName, const TPath& aFilePath, const TDes& aToolVersion )
+	{
+	LOGSTR2( "ATMH CustomUser::ReportIncorrectVersion(), aFileName( %S )", 
+			&aFileName );
+
+	switch ( aLogOption )
+		{
+		case EATLogToFile:
+			{
+			LOGSTR1( "ATMH ReportIncorrectVersion > EATLogToFile" );			
+			
+			// A handle to a file server session.
+			RFs fs;
+			// Creates and opens a file, 
+			// and performs all operations on a single open file.
+			RFile file;	
+			// Create full path buffer
+			TBuf<KMaxFileName> logFileBuf;
+			// Connects a client to the file server.
+			TInt err( fs.Connect() );
+			
+			if ( !err )
+				{				
+                err = TATDriveInfo::CreatePath( logFileBuf, aFileName, aFilePath, fs );
+			    
+				// Replace file if exists
+				if ( err && err != KErrAlreadyExists )
+					{
+					LOGSTR2( "ATMH > TATDriveInfo::CreatePath() err( %i )", err );
+					return;
+					}
+				
+				// Replace file if exists (drive C)
+				err = file.Replace( fs, logFileBuf, EFileWrite );
+										
+				// Write to file
+				if ( !err )
+					{
+					err = file.Write( KDataFileVersion );
+					// Error msg buffer
+					TBuf8<KMaxFileName> msg;				     
+					// Write the error code to the buffer  
+					logFileBuf.Format( KIncorrectText, &KAtoolApiVersion, &aToolVersion );	
+					CnvUtfConverter::ConvertFromUnicodeToUtf8( msg, logFileBuf );
+					err = file.Write( msg );
+					}
+				// Closes the file.
+				file.Close();
+				}
+			
+			LOGSTR2( "ATMH > File err( %i )", err );			
+			// Closes the handle.
+			fs.Close();
+			}
+			break;
+			
+		case EATUseDefault:
+		case EATLogToTraceFast:
+			{
+			LOGSTR1( "ATMH > ReportIncorrectVersion > EATLogToTraceFast" );
+			// Error msg buffer
+			TBuf<KMaxFileName> msg;	
+			msg.Copy( KIncorrectTextTrace );
+			msg.Append( KIncorrectText );
+			TBuf<KMaxFileName> traceMsg;	
+			// Write the error code to the buffer  
+			traceMsg.Format( msg, &KAtoolApiVersion, &aToolVersion );
+			RDebug::Print( traceMsg );
+			}
+			break;
+		
+		default:
+			{
+			LOGSTR1( "ATMH > ReportIncorrectVersion > default" );
+			}
+			break;
+		}	
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/threadstack.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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:  Definitions for the class TThreadStack.
+*
+*/
+
+
+#include "threadstack.h"
+#include "atlog.h"
+
+// -----------------------------------------------------------------------------
+// TThreadStack::TThreadStack()
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+TThreadStack::TThreadStack( TThreadId aId, TUint32 aStackStart ) :
+    iId( aId ),
+    iStackStart( aStackStart )
+    {
+    LOGSTR2( "ATMH TThreadStack::TThreadStack() aStackStart: %i", aStackStart );
+    }
+
+// -----------------------------------------------------------------------------
+// TThreadStack::ThreadStackStart()
+// Checks if this is the current thread and if this is the current
+// thread assings value to the given parameter
+// -----------------------------------------------------------------------------
+//
+TBool TThreadStack::ThreadStackStart( TUint32& aStackStart )
+    {
+    LOGSTR1( "ATMH TThreadStack::ThreadStackStart");
+    
+    if ( RThread().Id() == iId )
+        {
+        aStackStart = iStackStart;
+        return ETrue;
+        }
+    else
+        {
+        aStackStart = 0;
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TThreadStack::Match()
+// Checks if this is the the current thread.
+// -----------------------------------------------------------------------------
+//
+TBool TThreadStack::Match( const TUint aThreadId )
+    {
+    LOGSTR2( "ATMH TThreadStack::Match( %d )", aThreadId );
+    
+    if ( aThreadId != 0 )
+    	{
+    	LOGSTR2( "ATMH > iId.operator TUint() = %d", iId.operator TUint() );
+    	return ( aThreadId == iId.operator TUint() ) ? ETrue : EFalse;
+    	}
+    else
+    	{
+    	return ( RThread().Id() == iId ) ? ETrue : EFalse;
+    	}
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/envpatcher/EnvPatcher.pl	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,544 @@
+#
+# 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:
+# Environment Patcher - Patches older S60 SDKs for supporting
+# tricks in newer platforms
+#
+
+
+require v5.6.1;	
+
+use File::Copy;
+use strict;
+
+# check amount of commandline options is valid
+if (@ARGV != 1)
+{
+    print "Usage: EnvPatcher <EPOCROOT>\n";
+    exit 1;
+}
+
+
+# get epocroot and convert, convert \ -> /
+(my $epocroot = $ARGV[0]) =~ s{\\}{/}g;
+
+# remove any trailing forward slashes
+$epocroot =~ s/\/$//;
+
+
+# create variables for paths
+my $e32toolsdir = $epocroot."/epoc32/tools";
+my $e32includedir = $epocroot."/epoc32/include";
+my $e32includeoemdir = $e32includedir."/oem";
+my $platformpathspath = $e32includedir."/platform_paths.hrh";
+my $domainplatformpathspath = $e32includedir."/domain/osextensions/platform_paths.hrh";
+my $mmppmpath = $e32toolsdir."/mmp.pm";
+my $pathutlpmpath = $e32toolsdir."/pathutl.pm";
+my $prepfilepmpath = $e32toolsdir."/prepfile.pm";
+
+# variables for hacked content
+my $dependshack = "\t\t\tif (/^DEPENDS\$/o) {\r\n\t\t\t\tnext LINE;  # Ignore DEPENDS keyword, not needed by ABLD\r\n\t\t\t}\r\n";
+my $smpsafehack = "\t\tif (/^SMPSAFE\$/o) {\r\n\t\t\tnext LINE;  # Ignore SMPSAFE keyword, not needed by older environments\r\n\t\t}\r\n";
+my $forwardslashhack = "\t\t# EnvPatcher forwardslash hack begins\r\n\t\t\$_=~s{/}{\\\\}g;   # convert all forward slashes to backslashes\r\n\t\t# EnvPatcher forwardslash hack ends\r\n\r\n";
+my $coreibyexportsupport = "\r\n// Following definition is used for exporting tools and stubs IBY files to\r\n// Core image.\r\n#define CORE_IBY_EXPORT_PATH(path,exported)  /epoc32/rom/include/##exported\r\n";
+
+
+# check epoc32\tools exists
+unless (-d $e32toolsdir)
+{
+    print "$e32toolsdir not found, please check valid epocroot has been given!\n";
+    exit 1;
+}
+
+# check epoc32\include exists
+unless (-d $e32includedir)
+{
+    print "$e32includedir not found, please check valid epocroot has been given!\n";
+    exit 1;
+}
+
+
+# create epoc32\include\oem if it does not exist
+unless (-d $e32includeoemdir)
+{
+    mkdir $e32includeoemdir or die;
+    print "Missing directory $e32includeoemdir created succesfully.\n";
+}
+
+
+# check if epoc32\include\domain\osextensions\platform_paths.hrh exists
+if (-e $domainplatformpathspath)
+{
+    # show an error if the file does not have any platform macros
+    unless (string_exists_in_file($domainplatformpathspath, "OS_LAYER_SYSTEMINCLUDE"))
+    {
+        print "ERROR: $domainplatformpathspath does not have SF macros.\n";
+        print "Please check your environment, if you have S60 3.2 OEM or newer, please get the latest version!\n";
+        exit 2;
+    }
+}
+
+
+# check if epoc32\include\platform_paths.hrh exists
+if (-e $platformpathspath)
+{
+    print "$platformpathspath already exists, not checking it.\n";    
+}
+else
+{
+    # create the file missing file
+    create_default_platform_paths_hrh();
+    print "Missing file $platformpathspath created succesfully.\n";    
+}
+
+
+# check if CORE_IBY_EXPORT_PATH macro exist in the platform_paths.hrh
+unless (string_exists_in_file($platformpathspath, "CORE_IBY_EXPORT_PATH"))
+{
+    # read content of the platform_paths.hrh
+    my @filecontent = read_file_to_array($platformpathspath);  
+
+    my $match_found = 0;
+    my $i = 0;
+    my $match_found_pos = 0;
+    
+    # find the position where the include guards start (this should be a safe position)
+    foreach (@filecontent)
+    {
+        if ($_ =~ /#define PLATFORM_PATHS_HRH/)
+        {
+            $match_found = 1;
+            $match_found_pos = $i;
+            last;
+        } 
+
+        $i++;
+    }
+    
+    if ($match_found)
+    {
+        # insert the patched content to the file
+        splice(@filecontent, $match_found_pos+1, 0, $coreibyexportsupport);
+        
+        # write the modified array to the file
+        write_file_from_array($platformpathspath, @filecontent);
+    
+        print "Platform_paths.hrh updated to support CORE_IBY_EXPORT_PATH macro.\n";
+    }
+    else
+    {
+        print "WARNING: $platformpathspath is corrupted or not supported!\n";    
+    }
+}
+ 
+    
+# check if epoc32\tools\mmp.pm exists
+if (-e $mmppmpath)
+{
+    # check if DEPENDS keyword already exists in the file
+    if (string_exists_in_file($mmppmpath, "DEPENDS"))
+    {
+        print "The SDK can already handle DEPENDS keyword in a MMP file.\n";        
+    }
+    else
+    {
+        # read content of the mmp.pm file
+        my @filecontent = read_file_to_array($mmppmpath);
+        
+        my $match_found = 0;
+        my $i = 0;
+        my $match_found_pos = 0;
+        
+        # loop through the array to find the correct place
+        foreach (@filecontent)
+        {
+            if ($_ =~ /Unrecognised Resource Keyword/)
+            {
+                $match_found = 1;
+                $match_found_pos = $i;
+                last;
+            } 
+
+            $i++;
+        }
+        
+        if ($match_found)
+        {
+            # insert the patched content to the file
+            splice(@filecontent, $match_found_pos-1, 0, $dependshack);
+            
+            # write the modified array to the file
+            write_file_from_array($mmppmpath, @filecontent);
+        
+            print "Mmp.pm patched with DEPENDS keyword hack.\n";
+        }
+        else
+        {
+            print "ERROR: Unable to find correct place from $mmppmpath for patching!\n";
+            print "Your SDK environment probably is not supported by this script!\n";
+            exit(2);    
+        }
+    }
+
+    # check if SMPSAFE keyword already exists in the file
+    if (string_exists_in_file($mmppmpath, "SMPSAFE"))
+    {
+        print "The SDK can already handle SMPSAFE keyword in a MMP file.\n";        
+    }
+    else
+    {
+        # read content of the mmp.pm file
+        my @filecontent = read_file_to_array($mmppmpath);
+        
+        my $match_found = 0;
+        my $i = 0;
+        my $match_found_pos = 0;
+        
+        # loop through the array to find the correct place
+        foreach (@filecontent)
+        {
+            if ($_ =~ /Unrecognised Keyword/)
+            {
+                $match_found = 1;
+                $match_found_pos = $i;
+                last;
+            } 
+
+            $i++;
+        }
+        
+        if ($match_found)
+        {
+            # insert the patched content to the file
+            splice(@filecontent, $match_found_pos, 0, $smpsafehack);
+            
+            # write the modified array to the file
+            write_file_from_array($mmppmpath, @filecontent);
+        
+            print "Mmp.pm patched with SMPSAFE keyword hack.\n";
+        }
+        else
+        {
+            print "ERROR: Unable to find correct place from $mmppmpath for patching!\n";
+            print "Your SDK environment probably is not supported by this script!\n";
+            exit(2);    
+        }
+    }
+}
+else
+{
+    print "WARNING: $mmppmpath not found, this environment is not supported!\n";
+}
+
+
+# check if epoc32\tools\pathutl.pm exists
+if (-e $pathutlpmpath)
+{
+    # check if "sub Path_Norm" already exists in the pathutil.pm file
+    # if it does not exists, then we need to patch prepfile.pm
+    if (string_exists_in_file($pathutlpmpath, "sub Path_Norm"))
+    {
+        print "The SDK is non Symbian OS 9.1, no need to add forward slash hack.\n";        
+    }
+    else
+    {
+        # check if prepfile.pm has already been patched
+        if (string_exists_in_file($prepfilepmpath, "EnvPatcher forwardslash hack"))
+        {        
+            print "The SDK has already been patched with forwardslash hack.\n";         
+        }
+        else
+        {    
+            # read content of the prepfile.pm file
+            my @filecontent = read_file_to_array($prepfilepmpath);  
+    
+            my $match_found = 0;
+            my $i = 0;
+            my $match_found_pos = 0;
+            
+            # loop through the array to find the correct place
+            foreach (@filecontent)
+            {
+                if ($_ =~ /# skip blank lines/)
+                {
+                    $match_found = 1;
+                    $match_found_pos = $i;
+                    last;
+                } 
+    
+                $i++;
+            }
+            
+            if ($match_found)
+            {
+                # insert the patched content to the file
+                splice(@filecontent, $match_found_pos+6, 0, $forwardslashhack);
+                
+                # write the modified array to the file
+                write_file_from_array($prepfilepmpath, @filecontent);
+            
+                print "Prepfile.pm patched with forward slash hack.\n";
+            }
+            else
+            {
+                print "ERROR: Unable to find correct place from $prepfilepmpath for patching!\n";
+                print "Your SDK environment probably is not supported by this script!\n";
+                exit(2);    
+            }
+        }
+    }    
+}
+else
+{
+    print "WARNING: $pathutlpmpath not found, this environment is not supported!\n";
+}
+ 
+ 
+ 
+# checks if string exists in the file    
+sub string_exists_in_file
+{
+    my $filepath = $_[0];
+    my $findstring = $_[1];
+    my $match_found = 0;     
+
+    open(FILE, "<", $filepath) or die "Failed to open $filepath for reading!";
+
+    # loop through the file for occurances
+    while (<FILE>)
+    {
+        if ($_ =~ /$findstring/)
+        {
+            $match_found = 1;
+            last;
+        } 
+    }
+
+    close FILE;
+    
+    return $match_found;
+}
+
+
+# reads lines from a file to an array    
+sub read_file_to_array
+{
+    my $filepath = $_[0];
+
+    open(FILE, "<", $filepath) or die "Failed to open $filepath for reading!";
+    my @data = <FILE>;
+    close FILE;
+    
+    return(@data);
+}
+
+
+# writes lines from an array to a file
+sub write_file_from_array
+{
+    my ($filepath, @data) = @_;
+    
+    # take a backup of the file
+    copy ($filepath, $filepath."EnvPatcher") or die "Cannot take backup of $filepath to $filepath.EnvPatcher";
+        
+    open(FILE, ">", $filepath) or die "Failed to open $filepath for writing!";
+
+    # write the array to file
+    foreach my $line (@data)
+    {
+        print FILE "$line";
+    }
+
+    close FILE;
+}
+
+sub create_default_platform_paths_hrh
+{
+    # the file does not exist, so create the missing file
+    open(FILE, ">", $platformpathspath) or die "Failed to open $platformpathspath for writing!\n";
+    
+    print FILE <<ENDOFTHEFILE;
+#ifndef PLATFORM_PATHS_HRH
+#define PLATFORM_PATHS_HRH
+
+/**
+* ---------------------------------------
+* Location, where the applications layer specific public headers should be exported
+* See usage on top of this hrh-file.
+* ---------------------------------------
+*/
+#define APP_LAYER_SDK_EXPORT_PATH(exported) /epoc32/include/##exported
+#define APP_LAYER_PUBLIC_EXPORT_PATH(exported) /epoc32/include/##exported
+
+/**
+* ---------------------------------------
+* Location, where the applications layer specific platform headers should be exported
+* See usage on top of this hrh-file.
+* ---------------------------------------
+*/
+#define APP_LAYER_DOMAIN_EXPORT_PATH(exported) /epoc32/include/##exported
+#define APP_LAYER_PLATFORM_EXPORT_PATH(exported) /epoc32/include/##exported
+
+/**
+* ---------------------------------------
+* Location, where the middleware layer specific public headers should be exported
+* See usage on top of this hrh-file.
+* ---------------------------------------
+*/
+#define MW_LAYER_SDK_EXPORT_PATH(exported) /epoc32/include/##exported
+#define MW_LAYER_PUBLIC_EXPORT_PATH(exported) /epoc32/include/##exported
+
+/**
+* ---------------------------------------
+* Location, where the middleware layer specific platform headers should be exported
+* ---------------------------------------
+*/
+#define MW_LAYER_DOMAIN_EXPORT_PATH(exported) /epoc32/include/##exported
+#define MW_LAYER_PLATFORM_EXPORT_PATH(exported) /epoc32/include/##exported
+
+/**
+* ---------------------------------------
+* Location, where the os layer specific public headers should be exported
+* ---------------------------------------
+*/
+#define  OSEXT_LAYER_SDK_EXPORT_PATH(exported) /epoc32/include/##exported
+#define  OS_LAYER_PUBLIC_EXPORT_PATH(exported) /epoc32/include/##exported
+
+/**
+* ---------------------------------------
+* Location, where the os specific platform headers should be exported
+* ---------------------------------------
+*/
+#define OSEXT_LAYER_DOMAIN_EXPORT_PATH(exported) /epoc32/include/##exported
+#define OS_LAYER_PLATFORM_EXPORT_PATH(exported) /epoc32/include/##exported
+
+/**
+* ---------------------------------------
+* Location, where the  cenrep excel sheets should be exported
+* Deprecated: should no longer be used. Kept for compability.
+* ---------------------------------------
+*/
+#define CENREP_XLS_EXPORT_PATH(exported) /epoc32/tools/cenrep/data/src/##exported
+
+/**
+* This define statements defines the SYSTEMINCLUDE-line, which is intended to be 
+* used in the mmp-files that are part of the applications-layer. It includes all 
+* the needed directories from the /epoc32/include, that are valid ones for the 
+* application-layer components. 
+*
+* Applications layer is the last one in the list, since most likely the most of 
+* the headers come from middleware or os-layer  => thus they are first.
+*/
+#define APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem
+ 
+/**
+* This define statements defines the SYSTEMINCLUDE-line, which is intended to be
+* used in the mmp-files that are part of the middleware-layer. It includes all 
+* the needed directories from the /epoc32/include, that are valid ones for the 
+* middleware-layer components. 
+*/
+#define MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem
+
+/**
+* This define statements defines the SYSTEMINCLUDE-line, which is intended to be
+* used in the mmp-files that are part of the  osextensions-layer. It includes all
+* the needed directories from the /epoc32/include, that are valid ones for the
+* os-layer components. 
+*/
+#define OS_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem
+
+
+// Below statement is Deprecated and the OS_LAYER_SYSTEMINCLUDE-macro has to be
+// used.
+#define OSEXT_LAYER_SYSTEMINCLUDE OS_LAYER_SYSTEMINCLUDE
+
+/**
+* This define statements defines the SYSTEMINCLUDE-line, which is intended to be
+* used in the mmp-files that are part of the os-layer. This is intended 
+* to be only used by those components which need to use in their mmp-file either
+* kern_ext.mmh or nkern_ext.mmh. Reason is that those
+* 2 files already contain the /epoc32/include  as system include path.
+* 
+*/
+#define OS_LAYER_KERNEL_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/oem
+
+
+// Below statement is Deprecated and the OS_LAYER_KERNEL_SYSTEMINCLUDE-macro 
+// has to be used.
+#define OSEXT_LAYER_KERNEL_SYSTEMINCLUDE OS_LAYER_KERNEL_SYSTEMINCLUDE
+
+/**
+****************************************************************************
+* Definitions that also define the paths to the layer specific source directories.
+****************************************************************************
+*/
+/**
+* The below 3 macros define the paths to the layer-specific source dirs.
+* See usage on top of this hrh-file, these are used the same way as 
+* for instance the OS_LAYER_DOMAIN_EXPORT_PATH
+* Deprecated: is not allowed to be using in Symbian Foundation
+*/
+#define APP_LAYER_SOURCE_PATH(rest)    /s60/app/##rest
+#define MW_LAYER_SOURCE_PATH(rest)     /s60/mw/##rest
+#define OSEXT_LAYER_SOURCE_PATH(rest)  /s60/osext/##rest
+
+/**
+****************************************************************************
+* Definitions to export IBY files to different folders where they will be taken 
+* to ROM image
+****************************************************************************
+*/
+// Following definition is used for exporting tools and stubs IBY files to 
+// Core image.
+#define CORE_IBY_EXPORT_PATH(path,exported)  /epoc32/rom/include/##exported
+
+/**
+* ---------------------------------------
+* Macros for Configuration tool migration. 
+* The below macros define the location under epoc32, where the confml 
+* (Configuration Markup Language) and crml (Central Repository Markup Language) 
+* files should be exported.
+* ---------------------------------------
+*/
+#define CONFML_EXPORT_PATH(file,category)           /epoc32/rom/config/confml_data/##category##/##file
+#define CRML_EXPORT_PATH(file,category)             /epoc32/rom/config/confml_data/##category##/##file
+#define GCFML_EXPORT_PATH(file,category)            /epoc32/rom/config/confml_data/##category##/##file
+#define CONFML_CONFIG_EXPORT_PATH(file,category)    /epoc32/rom/config/confml_data/##category##/config/##file
+
+#define APP_LAYER_CONFML(exported) 	                CONFML_EXPORT_PATH(exported,s60)
+#define APP_LAYER_CRML(exported)                    CRML_EXPORT_PATH(exported,s60)
+#define APP_LAYER_GCFML(exported)                   GCFML_EXPORT_PATH(exported,s60)
+#define APP_LAYER_CONFML_CONFIG(exported)           CONFML_CONFIG_EXPORT_PATH(exported,s60)
+                                                    
+#define MW_LAYER_CONFML(exported)                   CONFML_EXPORT_PATH(exported,s60)
+#define MW_LAYER_CRML(exported)                     CRML_EXPORT_PATH(exported,s60)
+#define MW_LAYER_GCFML(exported)                    GCFML_EXPORT_PATH(exported,s60)
+#define MW_LAYER_CONFML_CONFIG(exported)            CONFML_CONFIG_EXPORT_PATH(exported,s60)
+       
+// Deprecate: Use the OS_LAYER_* macros instead of OSEXT_LAYER_*                                             
+#define OSEXT_LAYER_CONFML(exported)                CONFML_EXPORT_PATH(exported,s60)
+#define OSEXT_LAYER_CRML(exported)                  CRML_EXPORT_PATH(exported,s60)
+#define OSEXT_LAYER_GCFML(exported)                 GCFML_EXPORT_PATH(exported,s60)
+#define OSEXT_LAYER_CONFML_CONFIG(exported)         CONFML_CONFIG_EXPORT_PATH(exported,s60)
+#define OS_LAYER_CONFML(exported)                   CONFML_EXPORT_PATH(exported,s60)
+#define OS_LAYER_CRML(exported)                     CRML_EXPORT_PATH(exported,s60)
+#define OS_LAYER_GCFML(exported)                    GCFML_EXPORT_PATH(exported,s60)
+#define OS_LAYER_CONFML_CONFIG(exported)            CONFML_CONFIG_EXPORT_PATH(exported,s60)
+
+#endif  // end of PLATFORM_PATHS_HRH
+
+ENDOFTHEFILE
+
+    close FILE;    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/envpatcher/ReadMe.txt	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,46 @@
+Environment Patcher v1.0.1
+==========================
+
+Updated: 12th November 2009
+
+
+Introduction:
+-------------
+This tool can be used to patch your S60 SDK environment so that the tricks and
+macros introduced in the latest SDKs can be used in a public SDK and older
+OEM releases.
+
+This tool can perform the following tasks:
+- Adds support for forward slashes in paths in bld.inf/.mmp files in S60 3.0 
+- Removes an unncessary warning about DEPENDS and SMPSAFE resource keywords in
+  an .mmp file
+- Creates a missing epoc32\include\platform_paths.hrh file for supporting
+  platform macros introduced since S60 3.2 OEM and Symbian Foundation releases
+- Modifies epoc32\include\platform_paths.hrh for missing macros   
+- Creates a missing epoc32\include\oem directory to suppress a possible warning
+
+
+Usage:
+------
+EnvPatcher.pl <EPOCROOT>
+
+Where EPOCROOT is the path to the root of the SDK, for example:
+  EnvPatcher.pl c:\Symbian\9.1\S60_3rd_MR
+  EnvPatcher.pl z:\
+
+
+Requirements:
+-------------
+- S60 SDK (public or OEM), version 3.0 or newer
+- Perl 5.6.1 or newer
+
+
+
+
+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".
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/group/ReleaseNotes_AnalyzeTool.txt	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,141 @@
+===============================================================================
+
+RELEASE NOTES - ANALYZETOOL v1.10.0
+RELEASED 2nd July 2010
+
+SUPPORTS SYMBIAN^1+
+
+===============================================================================
+
+Product Description:
+====================
+AnalyzeTool is a dynamic test tool that is used for testing Symbian software
+for memory and resource leaks and pinpointing the leaks from the source code.
+
+Main Features:
+==============
+- Pinpoints memoryleaks from target hardware and emulator to source code lines
+- Discovers resource leaks from processes
+- Command line interface and Carbide.c++ Extension
+
+===============================================================================
+
+
+What's New in v1.10.0
+====================
+  
+- Change: Storage server was removed
+- Change: New trace format
+- Change: Logging to binary file added
+- Change: Capture of reallocations implemented
+
+===============================================================================
+
+Installation Notes:
+===================
+AnalyzeTool is typically preinstalled on ROM. If not, it can be added to the
+ROM with the .iby file. Alternatively, the .sis file can be found under the sis-
+directory, but the user need to sign it with their own developer certificate.
+In Nokia R&D environment, you can use directly the R&D-signed .sis file under the
+internal\sis directory.
+
+When signing with own developer certificate, the following capabilities are
+needed:
+  ReadDeviceData
+  WriteDeviceData
+  DiskAdmin
+  AllFiles
+  SwEvent
+  NetworkServices
+  LocalServices
+  ReadUserData
+  WriteUserData
+  Location
+  UserEnvironment
+  CommDD
+  PowerMgmt
+  MultimediaDD
+  DRM
+  TrustedUI
+  ProtServ
+  NetworkControl
+  SurroundingsDD
+  TCB
+
+When builing AnalyzeTool against S60 3.0 or 3.1, you may need to patch your SDK
+environment first with some fixes. For more information, please refer to the
+instructions under the "envpatcher" directory.
+
+===============================================================================
+
+System Requirements:
+====================
+Basic Requirements:
+- Any S60 3.x device or emulator environment
+
+===============================================================================
+
+Compatibility Issues:
+=====================
+N/A
+
+===============================================================================
+
+Known Issues:
+=============
+- Kernel analysis are not supported.
+
+- Switch allocator. AnalyzeTool change the application memory allocator to
+  AnalyzeTool own memory allocator and using the User::SwitchAllocator function
+  can lead to situation where the tested application does not work properly.
+  
+- AnalyzeTool hooked QT applications becomes too slow to run. Use small size
+  call stack(s) and new logging mode (external -tr). 
+
+- Stif test case with AnalyzeTool can inform wrong memory leak alert.
+
+- AnalyzeTool overwrites functions TInt User::ProcessCritical(TCritical
+  aCritical) and TInt User::SetProcessCritical(TCritical aCritical), but this
+  works only when the function is called from hooked exe application. So if
+  setting critical is done from DLL (even if it's hooked with AnalyzeTool) the
+  overwriting does not work and the process stays set critical during the
+  testing.
+
+- If hooked application is closed by calling User::Exit() from DLL instead of
+  .exe application AnalyzeTool reports "abnormal process end" and can't report
+  proper memory leaks.
+ 
+===============================================================================
+
+Version History:
+================
+
+Version 1.9.1 - 29th April 2010
+==============================
+- Change: Removed Avkon and Console UI's to simplify the maintenance of the
+  tool
+- Change: Middleware layer dependencies removed so AnalyzeTool can be now used
+  also in OS layer builds
+- Fix: Move all binaries to ROM instead of ROFS to avoid ROM build
+  dependencies issues in hooked components
+
+===============================================================================
+
+Version 1.9.0 - 8th April 2010
+==============================
+- Feature: Remove false positive memory leaks with better handling of global
+  variables
+- Feature: Automatic check of correct version of dbghelp.dll for better
+  emulator support
+- Change: HTI support removed
+- Fix: SBSVS variant compilation didn't work
+
+===============================================================================
+
+Copyright (c) 2010 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".
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/group/atool_stub_sis.mk	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,57 @@
+#
+# 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:  Stub sis makefile for Configuration UI.
+#
+
+TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install
+
+SISNAME=analyzeTool_stub
+PKGNAME=analyzeTool_stub
+
+$(TARGETDIR) :
+	@perl -S emkdir.pl "$(TARGETDIR)"
+
+do_nothing :
+	rem do_nothing
+
+SISFILE=$(TARGETDIR)\$(SISNAME).sis
+
+$(SISFILE) : ..\sis\$(PKGNAME).pkg
+	makesis -s $? $@ 
+
+#
+# The targets invoked by bld...
+#
+
+MAKMAKE : do_nothing
+
+RESOURCE : do_nothing
+
+SAVESPACE : do_nothing
+
+BLD : do_nothing
+
+FREEZE : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+FINAL : $(TARGETDIR) $(SISFILE)
+
+CLEAN : 
+	-erase $(SISFILE)
+
+RELEASABLES : 
+	@echo $(SISFILE)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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 <platform_paths.hrh>
+
+#include "../analyzetool_plat/group/bld.inf"
+#include "../commandlineengine/group/bld.inf"
+#include "../staticlib/group/bld.inf"
+#include "../kerneleventhandler/group/bld.inf"
+#include "../analyzetoolcleaner/group/bld.inf"
+#include "../dynamicmemoryhook/group/bld.inf"
+
+PRJ_EXPORTS
+//../rom/analyzetool.iby                          CORE_IBY_EXPORT_PATH(tools,analyzetool.iby)
+../rom/analyzetool_rom.iby                      CORE_IBY_EXPORT_PATH(tools/rom,analyzetool_rom.iby)
+
+/*
+PRJ_MMPFILES
+#ifndef SBSV2
+  #ifdef MARM
+    gnumakefile atool_stub_sis.mk
+  #endif
+#endif
+
+PRJ_EXTENSIONS
+#ifdef SBSV2
+  #ifdef MARM
+     START EXTENSION app-services/buildstubsis
+     OPTION SRCDIR ../sis
+     OPTION SISNAME analyzeTool_stub
+     END
+  #endif
+#endif
+*/  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/inc/atlog.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* 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:  Definitions of logging macros for Analyze Tool S60 modules.
+*
+*/
+
+#ifndef __ATLOG_H__
+#define __ATLOG_H__
+
+#ifdef _DEBUG
+//To enable/disable logging uncomment/comment the next line
+// #define LOGGING_ENABLED  //Enable logging
+//Uncomment next to enable logging only LOGSTR1 lines
+// #define LOGGING_ENABLED_FAST //Logging only function names
+
+//Disable next to use file logging
+ #define USE_RDEBUG
+#endif
+
+//Do not alter the code below this
+
+#ifdef __KERNEL_MODE__
+
+ #ifdef LOGGING_ENABLED
+  #include <kernel.h> 
+  #define LOGSTR1( AAA ) 			{ Kern::Printf( AAA ); }
+  #define LOGSTR2( AAA, BBB ) 			{ Kern::Printf( AAA, BBB ); }
+ #else
+  #define LOGSTR1( AAA )
+  #define LOGSTR2( AAA, BBB )
+ #endif
+
+#else // #ifdef __KERNEL_MODE__
+
+ #ifdef LOGGING_ENABLED
+
+//  INCLUDES
+  #include <flogger.h>
+  #ifdef USE_RDEBUG
+   #include <e32svr.h>
+  #endif
+
+// CONSTANTS
+  _LIT( KAtLoggingFolder, "atlog" );
+  _LIT( KAtLoggingFile  , "LOG.TXT" );
+  #define ONE_SPACE_MARGIN	_S(" ")
+
+// ---------------------------------------------------------------------------------
+// Internal MACROS. Do not call these directly, use the External MACROS instead
+// ---------------------------------------------------------------------------------
+
+  #ifdef LOGGING_ENABLED_FAST
+
+   #ifdef USE_RDEBUG
+    #define INTERNAL_LOGSTR1( AAA )				{ _LIT( logdes, AAA ); RDebug::Print( logdes() ); }
+   #else  // RFileLogger is used
+    #define INTERNAL_LOGSTR1( AAA )				{ _LIT( logdes, AAA ); RFileLogger::Write( KAtLoggingFolder(), KAtLoggingFile(), EFileLoggingModeAppend, logdes() ); }
+   #endif // USE_RDEBUG
+   #define INTERNAL_LOGSTR2( AAA, BBB )
+   #define INTERNAL_LOGSTR3( AAA, BBB, CCC )
+   #define INTERNAL_LOGMEM
+   #define INTERNAL_LOG( AAA )
+
+  #else
+  
+   #ifdef USE_RDEBUG
+    #define INTERNAL_LOGDESC8( AAA )				{ TBuf<100> tmp; if( sizeof( AAA ) < 100 ) tmp.Copy( AAA ); RDebug::Print( tmp );}
+    #define INTERNAL_LOGSTR1( AAA )				{ _LIT( logdes, AAA ); RDebug::Print( logdes() ); }
+    #define INTERNAL_LOGSTR2( AAA, BBB )			{ _LIT( logdes, AAA ); RDebug::Print( TRefByValue<const TDesC>( logdes()), BBB ); }
+    #define INTERNAL_LOGSTR3( AAA, BBB, CCC )	{ _LIT( logdes, AAA ); RDebug::Print( TRefByValue<const TDesC>(logdes()), BBB, CCC ); }
+    #define INTERNAL_LOGMEM						{ _LIT( logdes, "Heap size: %i" );  TBuf<50> buf; TInt a; User::AllocSize( a ); buf.Format( logdes, a ); RDebug::Print( buf ); }
+    #define INTERNAL_LOG( AAA )					AAA
+   #else  // RFileLogger is used
+    #define INTERNAL_LOGSTR1( AAA )				{ _LIT( logdes, AAA ); RFileLogger::Write( KAtLoggingFolder(), KAtLoggingFile(), EFileLoggingModeAppend, logdes() ); }
+    #define INTERNAL_LOGSTR2( AAA, BBB ) 		{ _LIT( logdes, AAA ); RFileLogger::WriteFormat( KAtLoggingFolder(), KAtLoggingFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( logdes()), BBB ); }
+    #define INTERNAL_LOGSTR3( AAA, BBB, CCC) 	{ _LIT( logdes, AAA ); RFileLogger::WriteFormat( KAtLoggingFolder(), KAtLoggingFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>(logdes()), BBB, CCC ); }
+    #define INTERNAL_LOGMEM 					{ _LIT( logdes, "Heap size: %i" ); TMemoryInfoV1Buf info; UserHal::MemoryInfo(info); TInt freeMemory = info().iFreeRamInBytes; TBuf<50> buf; buf.Format( logdes, freeMemory ); RFileLogger::WriteFormat( KAtLoggingFolder(), KAtLoggingFile(), EFileLoggingModeAppend, buf ); }
+    #define INTERNAL_LOG( AAA )					AAA
+   #endif // USE_RDEBUG
+
+  #endif
+
+ #else
+
+  #define INTERNAL_LOGSTR1( AAA )
+  #define INTERNAL_LOGSTR2( AAA, BBB )
+  #define INTERNAL_LOGSTR3( AAA, BBB, CCC )
+  #define INTERNAL_LOGMEM
+  #define INTERNAL_LOG( AAA )
+
+ #endif
+
+// ---------------------------------------------------------------------------------
+// External MACROS. Use these in code
+// ---------------------------------------------------------------------------------
+// Logging of string
+// i.e.: LOGSTR1( "Whoo-haa!" );
+ #define LOGSTR1( AAA ) { INTERNAL_LOGSTR1( AAA ); }
+
+// Logging of string + integer value
+// i.e.: LOGSTR2( "CHttpd status %i:", iStatus );
+ #define LOGSTR2( AAA, BBB ) { INTERNAL_LOGSTR2( AAA, BBB ); }
+
+// Logging of descriptor + 2 integers
+// i.e.: LOGSTR3( "Jippii %i %i", val1, val2 );
+ #define LOGSTR3( AAA, BBB, CCC ) { INTERNAL_LOGSTR3( AAA, BBB, CCC ); }
+
+// Log heap size
+ #define LOGMEM         { INTERNAL_LOGMEM }
+
+// Logging variable operations  
+ #define LOG( AAA )     INTERNAL_LOG( AAA )
+
+#endif // #ifdef __KERNEL_MODE__
+
+#endif // __ATLOG_H__
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/kerneleventhandler/group/atoolkerneleventhandler.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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:  The .mmp file for the AToolKernelEventHandler
+*
+*/
+
+#include <platform_paths.hrh>
+#include <kernel/kern_ext.mmh>
+#include "../../symbian_version.hrh"
+
+TARGET	     	atoolkerneleventhandler.ldd
+TARGETTYPE   	ldd
+CAPABILITY		ALL
+
+SMPSAFE
+
+USERINCLUDE   	../inc
+USERINCLUDE   	../../inc
+
+OS_LAYER_KERNEL_SYSTEMINCLUDE
+
+SOURCEPATH    ../src
+
+SOURCE        analyzetoolchannel.cpp
+SOURCE        analyzetooldevice.cpp
+SOURCE        analyzetooleventhandler.cpp
+
+LIBRARY       flogger.lib
+#ifdef WINSCW
+LIBRARY       emulator.lib
+	start wins
+	win32_headers
+	end
+#endif // WINSCW
+
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 ) || defined(BSW_FLEXIBLE_MEMORY_MODEL)
+MACRO	MCL_ROBJECTIX
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/kerneleventhandler/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* 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 <platform_paths.hrh>
+
+PRJ_PLATFORMS
+ARMV5 WINSCW
+
+PRJ_MMPFILES
+atoolkerneleventhandler.mmp
+
+PRJ_TESTMMPFILES
+../internal/tsrc/group/analyzetooldevicedrivertest.mmp
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/kerneleventhandler/inc/analyzetoolchannel.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,213 @@
+/*
+* 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:  Declaration of the class DAnalyzeToolChannel
+*
+*/
+
+
+#ifndef __ANALYZETOOLCHANNEL_H__
+#define __ANALYZETOOLCHANNEL_H__
+
+// INCLUDES
+#include <analyzetool/analyzetool.h>
+#include <kernel/kernel.h>
+#ifdef __WINSCW__
+#include <memmodel/emul/win32/memmodel.h>
+#endif // __WINSCW__
+
+// FORWARD DECLARATIONS
+class DAnalyzeToolEventHandler;
+
+// CLASS DECLARATION
+
+/**
+* The implementation of the abstract base class for a logical channel.
+*/
+class DAnalyzeToolChannel : public DLogicalChannel
+	{
+	public:
+		
+        /**
+        * C++ default constructor.
+        */
+		DAnalyzeToolChannel();
+		
+        /**
+        * Destructor.
+        */
+		~DAnalyzeToolChannel();
+		
+	protected: // from DLogicalChannel
+		
+        /**
+        * Creates the logical channel.
+        * @param aUnit A unit of the device.
+        * @param anInfo A pointer to an explicit 8-bit descriptor containing 
+        			    extra information for the physical device
+        * @param aVer The required version of the logical device
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		virtual TInt DoCreate( TInt aUnit, 
+							   const TDesC8* anInfo, 
+							   const TVersion &aVer );
+    
+        /**
+        * Handles a client request.
+        * @param aFunction The requested function.
+        * @param a1 A 32-bit value passed to the kernel-side. Its meaning 
+        			  depends on the device driver requirements
+        * @param a2 A 32-bit value passed to the kernel-side. Its meaning
+        			  depends on the device driver requirements
+        * @param aMessage Reference to received thread message.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		virtual TInt DoControl( TInt aFunction, TAny* a1, TAny* a2, TThreadMessage& aMessage );	
+		
+		/**
+		* Processes a message for this logical channel.
+		* This function is called in the context of a DFC thread.
+		* @param aMsg  The message to process.
+		*/
+		virtual void HandleMsg( TMessageBase* aMsg );
+		
+        /**
+        * Handles a client asynchronous request.
+        * @param aFunction The requested function.
+        * @param aStatus Pointer to client TRequestStatus.
+        * @param a1 A 32-bit value passed to the kernel-side. Its meaning 
+        			  depends on the device driver requirements
+        * @param a2 A 32-bit value passed to the kernel-side. Its meaning
+        			  depends on the device driver requirements
+        * @param aMessage Reference to received thread message.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		virtual TInt DoRequest( TInt aFunction, 
+								TRequestStatus* aStatus, 
+								TAny* a1, 
+								TAny* a2, 
+								TThreadMessage& aMessage );
+		
+        /**
+        * Cancels outstanding asynchronous request.
+        */
+		virtual void DoCancel();
+
+	private:
+		
+        /**
+        * Acquires current process information
+        * @param aProcessInfo Pointer to the TProcessIdentityParams object.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		TInt GetProcessInfo( TAny* aProcessInfo, TThreadMessage& aMessage );
+		
+        /**
+        * Acquires codeseg information.
+        * @param aCodesegInfo Pointer to the TCodesegInfo object.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		TInt GetCodesegInfo( TAny* aCodesegInfo, TThreadMessage& aMessage );
+		
+        /**
+        * Acquires library information.
+        * @param aLibraryInfo Pointer to the TLibraryInfo object.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		TInt GetLibraryInfo( TAny* aLibraryInfo, TThreadMessage& aMessage );
+	
+        /**
+        * Acquires information about process main thread RAllocator.
+        * @param aMainThreadParams Pointer to the TMainThreadParams object.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		TInt MainThreadAllocator( TAny* aMainThreadParams, 
+								  TThreadMessage& aMessage );
+		
+		/**
+		* Acquires main thread stack address.
+		* @param aThreadStack Pointer to the TThreadParams object.
+		* @return TInt Returns KErrNone, if successful
+					   otherwise one of the other system-wide error codes
+		*/
+		TInt ThreadStack( TAny* aThreadStack, 
+						  TThreadMessage& aMessage );
+
+        /**
+        * Acquires information about process global handles.
+        * @param aProcessHandleInfo Pointer to the TProcessHandleInfo object.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		TInt GetProcessHandleInfo( TAny* aProcessHandleInfo, 
+								   TThreadMessage& aMessage );
+
+        /**
+        * Acquires a process's current handle count.
+        * @param aProcessHandles Pointer to the TATProcessHandles object.
+        * @return TInt Returns KErrNone, if successful
+                       otherwise one of the other system-wide error codes
+        */
+        TInt GetCurrentHandleCount( TAny* aProcessHandles, 
+									TThreadMessage& aMessage );
+        
+        /**
+		* Acquires the count of current device driver users.
+		* @param aClientCount A reference to TInt variable
+		* @return TInt Returns KErrNone, if successful
+        *               otherwise one of the other system-wide error codes
+		*/			
+        TInt ClientCount( TAny* aClientCount, 
+						  TThreadMessage& aMessage );
+		
+        /**
+         * Acquires memory model system uses.
+         * @return TInt Returns KErrNone, if successful
+         *              otherwise one of the other system-wide error codes
+         */
+        TInt GetMemoryModel( TAny* aMemoryModel,
+                            TThreadMessage& aMessage );
+        
+        #ifdef __WINSCW__
+        /**
+		* Gets module dependencies
+		* @param aModule Module handle
+		*/
+        void GetModuleDependencies( HMODULE aModule );
+        #endif // __WINSCW__
+        
+	private: //Member variables
+		
+		/* Handler which receives kernel events */
+		DAnalyzeToolEventHandler* iEventHandler;
+		
+		#ifdef __WINSCW__
+		/* Code segment array */
+		RArray<TCodesegInfo> iCodeSeg;
+		#endif // __WINSCW__
+		
+		/* A DFC queue for communication */
+		TDynamicDfcQue* iOwnDfcQ;
+
+	};
+
+#endif // #ifndef __ANALYZETOOLCHANNEL_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/kerneleventhandler/inc/analyzetooldevice.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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:  Declaration of the class DAnalyzeToolDevice.
+*
+*/
+
+
+#ifndef __ANALYZETOOLEVICE_H__
+#define __ANALYZETOOLEVICE_H__
+
+// INCLUDES
+#include <analyzetool/analyzetool.h>
+#include <kernel/kernel.h>
+
+// CLASS DECLARATION
+
+/**
+* The implementation of the abstract base class for an LDD factory object.
+*/
+
+class DAnalyzeToolDevice : public DLogicalDevice
+	{
+	public:
+	
+        /**
+        * C++ default constructor.
+        */
+		DAnalyzeToolDevice();
+		
+	public: // from DLogicalDevice
+	
+        /**
+        * Second stage constructor.
+        @return KErrNone or standard error code.
+        */
+		virtual TInt Install();
+	
+        /**
+        * Gets the driver's capabilities.
+        @param aDes A user-side descriptor into which capabilities 
+        			information is to be written.
+        */
+		virtual void GetCaps( TDes8& aDes ) const;
+		
+        /**
+        * Called by the kernel's device driver framework to 
+        * create a Logical Channel.
+        @param aChannel Set to point to the created Logical Channel
+        @return KErrNone or standard error code.
+        */
+		virtual TInt Create( DLogicalChannelBase*& aChannel );
+	};
+
+
+#endif // __ANALYZETOOLEVICE_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/kerneleventhandler/inc/analyzetooleventhandler.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* 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:  Declaration of the class DAnalyzeToolEventHandler.
+*
+*/
+
+
+#ifndef __ANALYZETOOLEVENTHANDLER_H__
+#define __ANALYZETOOLEVENTHANDLER_H__
+
+// INCLUDES
+#include <analyzetool/analyzetool.h>
+#include "atlog.h"
+#include <kernel/kernel.h>
+
+// CLASS DECLARATION
+
+/**
+* Callback class for kernel events
+*/
+
+class DAnalyzeToolEventHandler : public DKernelEventHandler
+	{
+	public:
+	
+        /**
+        * C++ default constructor.
+        */
+		inline DAnalyzeToolEventHandler( TDfcQue* aDfcQ );
+		
+        /**
+        * Destructor.
+        */ 
+		~DAnalyzeToolEventHandler();
+		
+        /**
+        * Second stage constructor.
+        * @param aDevice A pointer to device where the event handler belongs.
+        * @param aProcessId Owner process id.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		TInt Create( DLogicalDevice* aDevice, const TUint aProcessId );
+		
+        /**
+        * Subscribes library event.
+        * @param aStatus The request status object for this request. 
+        * @param aLibraryInfo The library information which 
+        					  is filled by the device driver
+        * @param aMessage Reference to received thread message.
+        * @return TInt Returns KErrNone, if successful
+        			   otherwise one of the other system-wide error codes
+        */
+		void InformLibraryEvent( TRequestStatus* aStatus, 
+								 TAny* aLibraryInfo,
+								 TThreadMessage& aMessage );
+        
+        /**
+        * Cancels subscribetion of the library event.
+        */
+		void CancelInformLibraryEvent();
+
+        /**
+        * Static function for DFC events.
+        * @param aPtr Pointer to DAnalyzeToolEventHandler object. 
+        */
+	    static void EventDfc( TAny* aPtr );
+		
+	private:
+	
+        /**
+        * Pointer to  callback function called when an event occurs.
+        * @param aEvent Designates what event is dispatched.
+        * @param a1 Event-specific paramenter.
+        * @param a2 Event-specific paramenter.
+        * @param aThis A pointer to the event handler
+        * @return TUint Bitmask returned by callback function.
+        */
+		static TUint EventHandler( TKernelEvent aEvent, 
+								   TAny* a1, 
+								   TAny* a2, 
+								   TAny* aThis );
+	
+	private:
+	
+        /**
+        * Handles the EEventAddLibrary and EEventRemoveLibrary events
+        * @param aLib* A pointer to added/removed library.
+        * @param aThread* A pointer to thread where the libary is.
+        * @param aInfo* A reference class to be written to the client
+        */	
+		void HandleLibraryEvent( DLibrary* aLib, 
+								 DThread* aThread, 
+								 TLibraryEventInfo& aInfo );
+		
+		/**
+		* Handles the EEventKillThread events
+		* @param aThread* A pointer to the thread being terminated. 
+		* @param aInfo* A reference class
+		*/	
+		void HandleKillThreadEvent( DThread* aThread, 
+									TLibraryEventInfo& aInfo );
+		
+		/**
+		* Informs client about the occured event
+		*/	
+	    void DoEventComplete();
+					
+	private:
+	
+		/* Mutex for serializing access to event handler */
+		DMutex* iHandlerMutex;
+		
+		/* Mutex fof serializing access to event handler variables */
+		DMutex* iDataMutex;		
+		
+		/* If the client is a RAM-loaded LDD (or PDD), it is possible for the DLL to
+		be unloaded while the handler is still in use.  This would result in an
+		exception.  To avoid this, the handler must open a reference to the
+		DLogicalDevice (or DPhysicalDevice) and close it in its d'tor. */
+		DLogicalDevice* iDevice;    
+				
+		/* Owner process ID */
+		TUint iProcessId;
+		
+		/* Event array */
+		RArray<TLibraryEventInfo> iEventArray;
+				
+		/* Pointer to client's TRequestStatus */ 
+		TRequestStatus* iClientRequestStatus;
+		
+		/* Pointer to client's thread */ 
+		DThread* iClientThread;
+
+		/* Pointer to client's TLibraryEventInfo */ 
+		TAny* iClientInfo;
+		
+		/* DFC for informing events to the client */ 
+		TDfc iEventDfc;
+	};
+	
+// ----------------------------------------------------------------------------
+// DAnalyzeToolEventHandler::DAnalyzeToolEventHandler()
+// C++ default constructor.
+// ----------------------------------------------------------------------------
+//
+inline DAnalyzeToolEventHandler::DAnalyzeToolEventHandler( TDfcQue* aDfcQ ) :	
+	DKernelEventHandler( EventHandler, this ),
+	iEventDfc( EventDfc, this, 1 )
+	{
+	LOGSTR1( "ATDD DAnalyzeToolEventHandler::DAnalyzeToolEventHandler()" );
+	iEventDfc.SetDfcQ( aDfcQ );
+	}
+
+#endif // __ANALYZETOOLEVENTHANDLER_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/kerneleventhandler/sis/analyzetooldevicedriver.pkg	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,33 @@
+;
+; 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:
+;
+
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"AnalyzeToolDeviceDriver"},(0xEDF5A8A1),1,8,1
+
+;Localised Vendor name
+%{"Vendor-EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+;Supports Series 60 v 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; 1 File to install
+"\epoc32\release\armv5\urel\atoolkerneleventhandler.ldd"-"!:\sys\bin\atoolkerneleventhandler.ldd"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/kerneleventhandler/src/analyzetoolchannel.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1019 @@
+/*
+* 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:  Definitions for the class DAnalyzeToolChannel.
+*
+*/
+
+
+// INCLUDE FILES
+#include "analyzetoolchannel.h"
+#include "analyzetooldevice.h"
+#include "analyzetooleventhandler.h"
+
+#include <kernel/kern_priv.h>
+#ifdef __WINSCW__
+#include <emulator.h>
+#endif // __WINSCW__
+
+#include "atlog.h"
+
+// ================= MEMBER FUNCTIONS =========================================
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::DoCreate()
+// Creates the logical channel.
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::DoCreate( TInt /*aUnit*/, 
+    const TDesC8* /*aInfo*/, const TVersion &aVer )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::DoCreate()" );
+
+    // Check client version.
+    if ( !Kern::QueryVersionSupported( KAnalyzeToolLddVersion(), aVer ) )
+        {
+        return KErrNotSupported;
+        }
+     
+    TInt error = Kern::DynamicDfcQCreate( iOwnDfcQ, 
+                                          KAnalyzeToolThreadPriority, 
+                                          KAnalyzeToolThreadName );
+
+    if ( KErrNone != error )
+        {
+        return error;
+        }
+
+    SetDfcQ( iOwnDfcQ );
+    
+    iMsgQ.Receive();
+   
+    // Create the event handler
+    iEventHandler = new DAnalyzeToolEventHandler( iOwnDfcQ );
+
+    // Check that everything is OK
+    if ( !iEventHandler )
+        {
+        return KErrNoMemory;
+        }
+    
+    // 2nd stage constructor for event handler
+    return iEventHandler->Create( iDevice, Kern::CurrentProcess().iId );
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::DAnalyzeToolChannel()
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+DAnalyzeToolChannel::DAnalyzeToolChannel()
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::DAnalyzeToolChannel()" );
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::~DAnalyzeToolChannel()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+DAnalyzeToolChannel::~DAnalyzeToolChannel()
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::~DAnalyzeToolChannel()" );
+    
+    if ( iEventHandler )
+        {
+        // Cancel all processing that we may be doing
+        DoCancel();
+        
+        // Client code should use Close() instead the operator delete 
+        // to destroy the event handler. 
+        TInt error( iEventHandler->Close() );
+        if ( KErrNone != error )
+            {
+            LOGSTR2( "ATDD iEventHandler->Close(%d)", error );
+            }
+        }
+    #ifdef __WINSCW__
+        iCodeSeg.Close();
+    #endif // __WINSCW__
+    
+    // Destroy the queqe
+    if ( iOwnDfcQ )
+        {
+        iOwnDfcQ->Destroy();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::DoControl()
+// Handles a client request.
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::DoControl( TInt aFunction, 
+                                     TAny* a1, 
+                                     TAny* /*a2*/, 
+                                     TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::Request()" );
+    
+    TInt ret( KErrNone );
+
+    // Check the requested function
+    switch (aFunction)
+        {
+        case RAnalyzeTool::EGetProcessInfo:
+            ret = GetProcessInfo( a1, aMessage );
+            break;
+            
+        case RAnalyzeTool::EGetCodesegInfo:
+            ret = GetCodesegInfo( a1, aMessage );
+            break;
+
+        case RAnalyzeTool::EGetLibraryInfo:
+            ret = GetLibraryInfo( a1, aMessage );
+            break;
+            
+        case RAnalyzeTool::ECancelLibraryEvent:
+            iEventHandler->CancelInformLibraryEvent();
+            break;
+            
+        case RAnalyzeTool::ECurrentClientCount:
+            ret = ClientCount( a1, aMessage );
+            break;
+
+        case RAnalyzeTool::EMainThreadAlloctor:
+            ret = MainThreadAllocator( a1, aMessage );
+            break;
+        
+        case RAnalyzeTool::EThreadStack:
+             ret = ThreadStack( a1, aMessage );
+             break;
+             
+        case RAnalyzeTool::EGetProcessHandle:
+            ret = GetProcessHandleInfo( a1, aMessage );
+            break;
+        
+        case RAnalyzeTool::EGetCurrentHandles:
+            ret = GetCurrentHandleCount( a1, aMessage );
+            break;
+        case RAnalyzeTool::EGetMemoryModel:
+            ret = GetMemoryModel( a1, aMessage );
+            break;
+            
+        // Unsupported function. Panic
+        default:
+            Kern::PanicCurrentThread( KClientPanic, EPanicUnsupportedRequest );
+            break;
+        }
+        
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::DoRequest()
+// Handles a client asynchronous request.
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::DoRequest( TInt aFunction, 
+                                     TRequestStatus* aStatus, 
+                                     TAny* a1, 
+                                     TAny* /*a2*/,
+                                     TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::DoRequest()" );
+    
+    // Check the requested function
+    switch (aFunction)
+        {
+        case RAnalyzeTool::ELibraryEvent:
+            iEventHandler->InformLibraryEvent( aStatus, a1, aMessage );
+            break;
+            
+        // Unsupported function. Panic
+        default:
+            aMessage.PanicClient( KClientPanic, EPanicUnsupportedRequest );
+            break;
+        }
+        
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::DoCancel()
+// Cancels outstanding asynchronous request.
+// -----------------------------------------------------------------------------
+//
+void DAnalyzeToolChannel::DoCancel()
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::DoCancel()" );
+    
+    iEventHandler->CancelInformLibraryEvent();
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::HandleMsg()
+// Processes a message for this logical channel.
+// -----------------------------------------------------------------------------
+//
+void DAnalyzeToolChannel::HandleMsg(TMessageBase* aMsg)
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::HandleMsg()" );
+
+    TThreadMessage& message = *(TThreadMessage*)aMsg;
+
+    // Get message type
+    TInt id = message.iValue;
+
+    // Decode the message type and dispatch it to the relevent handler function...
+    if ( id == (TInt) ECloseMsg )
+        {
+        // Channel Close
+        DoCancel();
+        message.Complete( KErrNone, EFalse );
+        }
+    else if ( id == KMaxTInt )
+        {
+        // DoCancel
+        DoCancel();
+        message.Complete( KErrNone, ETrue );
+        }
+    else if ( id < 0 )
+        {
+        // DoRequest
+        TRequestStatus* status = (TRequestStatus*) message.Ptr0();
+        TInt error = DoRequest( ~id, status, message.Ptr1(), message.Ptr2(), message );
+        if ( KErrNone != error )
+            {
+            Kern::RequestComplete( message.Client(), status, error);
+            }
+        message.Complete(KErrNone, ETrue );
+        }
+    else
+        {
+        // DoControl
+        TInt ret = DoControl( id, message.Ptr0(), message.Ptr1(), message );
+        message.Complete( ret, ETrue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::GetProcessInfo()
+// Acquires current process information
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::GetProcessInfo( TAny* aProcessInfo, 
+                                          TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::GetProcessInfo()" );
+
+    // Variable for reading parameters from user side
+    TProcessIdentityParamsBuf params;
+    
+    // Reads a descriptor from a thread's process.
+    TInt error = Kern::ThreadDesRead( aMessage.Client(), aProcessInfo, params, 0 );  
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesRead error %d", error );
+        return error;
+        } 
+
+    // Gets the current process
+    Kern::Containers()[ EProcess ]->Wait();
+    DProcess& process = *Kern::ProcessFromId( params().iProcessId );  
+    Kern::Containers()[ EProcess ]->Signal();
+    
+    if ( NULL == &process )
+        {        
+        return KErrNotFound;
+        }
+    
+    // Temporary variable for collecting information from the process
+    TProcessIdentityParamsBuf info;
+    
+    // Collect needed information from the process
+    process.AppendName( info().iProcessName );//lint !e64 !e1514
+    
+    // Gets the current thread
+    Kern::Containers()[ EThread ]->Wait(); 
+    DThread& thread = *Kern::ThreadFromId( params().iThreadId );
+    Kern::Containers()[ EThread ]->Signal();
+   
+    if ( NULL == &thread )
+        {
+        return KErrNotFound;
+        }     
+    
+    // Stack address of the main thread
+    info().iStackAddress = thread.iUserStackRunAddress;
+    info().iStackSize    = thread.iUserStackSize;  
+    
+    // Enters thread critical section and acquires code segment mutex.
+    Kern::AccessCode();
+        
+    // Collect needed information from the process
+    info().iDynamicCount = process.iDynamicCode.Count();
+
+    // Temporary queue for acquiring the count of codesegments
+    SDblQue queue;
+
+    // Acquire the count of codesegments
+    TInt codesegCount = process.TraverseCodeSegs( &queue, 
+                                                  NULL, 
+                                                  DCodeSeg::EMarkDebug, 
+                                                  DProcess::ETraverseFlagAdd );
+    
+    #ifndef __WINSCW__
+        info().iCodesegCount = codesegCount;    
+    #else
+    // Reset codesegment array
+    iCodeSeg.Reset();
+    
+    if ( codesegCount > 0 )
+        {
+        SDblQueLink* link = queue.iA.iNext;
+        TCodesegInfo codeinfo;
+        // Iterate through codesegments
+        for ( TInt i = 0; i < codesegCount; ++i, link = link->iNext )
+            {
+            DWin32CodeSeg* codeseg = 
+                (DWin32CodeSeg*)_LOFF( link, DCodeSeg, iTempLink );
+
+            // Aqcuire codeseg information
+            codeinfo.iFileEntryPoint = codeseg->iFileEntryPoint;
+            codeinfo.iSize = codeseg->iSize;
+            codeinfo.iFullName.Copy( codeseg->iRootName );
+            codeinfo.iRunAddress = codeseg->iRunAddress;
+            iCodeSeg.Append( codeinfo );
+            }
+        }
+    
+    // Add dependency codesegments
+    DWin32CodeSeg* pcodeSeg = (DWin32CodeSeg*)process.iCodeSeg;
+    
+    // Get dependency codesegments
+    GetModuleDependencies( pcodeSeg->iModuleHandle );
+    
+    // Set codesegment count
+    info().iCodesegCount = iCodeSeg.Count();
+    #endif
+    
+    // Removes all code segments from a queue and clear specified mark(s)
+    DCodeSeg::EmptyQueue( queue, DCodeSeg::EMarkDebug );
+
+    // Exits thread critical section and releases code segment mutex.
+    Kern::EndAccessCode();
+
+    // Writes a descriptor to a thread's process.
+    error = Kern::ThreadDesWrite( aMessage.Client(), aProcessInfo, info, 0 );  
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
+        return error;
+        } 
+   
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::GetCodesegInfo()
+// Acquires codeseg information.
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::GetCodesegInfo( TAny* aCodesegInfo, 
+                                          TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::GetCodesegInfo()" );
+
+    // Temporary variable for collecting information from the codeseg
+    TCodesegInfoBuf params;
+
+    TInt error( KErrArgument );
+    
+    // Reads a descriptor from a thread's process.
+    error = Kern::ThreadDesRead( aMessage.Client(), aCodesegInfo, params, 0 );  
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesRead error %d", error );
+        return error;
+        } 
+
+    if ( params().iIndex < 0 )
+        {
+        return KErrArgument;
+        }
+    
+    // Gets the current process
+    Kern::Containers()[ EProcess ]->Wait();
+    DProcess& process = *Kern::ProcessFromId( params().iProcessId );
+    Kern::Containers()[ EProcess ]->Signal();
+    
+    if ( NULL == &process )
+        {
+        return KErrNotFound;
+        }
+    
+    // Temporary variable for collecting information 
+    TCodesegInfoBuf output;
+
+    // Enters thread critical section and acquires code segment mutex.
+    Kern::AccessCode();
+
+    #ifndef __WINSCW__
+    // Temporary queue for acquiring the codesegments
+    SDblQue queue;
+    
+    // Acquire the codesegments
+    TInt actcount = process.TraverseCodeSegs( &queue, 
+                                              NULL, 
+                                              DCodeSeg::EMarkDebug, 
+                                              DProcess::ETraverseFlagAdd );
+    if ( actcount >= params().iIndex )
+        {
+        LOGSTR1( "ATDD DAnalyzeToolChannel::GetCodesegInfo() - actcount >= params.iIndex" );
+        SDblQueLink* link = queue.iA.iNext;
+        
+        // Iterate through codesegments
+        for (TInt i = 0; i < actcount; ++i, link = link->iNext)
+            {
+            DCodeSeg* codeseg = _LOFF( link, DCodeSeg, iTempLink );
+
+            // Is the codesegments which information client wants
+            if ( i == params().iIndex )
+                {
+                // Aqcuire codeseg information
+                output().iFileEntryPoint = codeseg->iFileEntryPoint;
+                output().iSize = codeseg->iSize;
+                output().iFullName.Copy( codeseg->iRootName );
+                output().iRunAddress = codeseg->iRunAddress;
+                error = codeseg->GetMemoryInfo( output().iMemoryInfo, &process );
+                
+                if ( KErrNone == error )
+                    {
+                    // Writes a descriptor to a thread's process.
+                    error = Kern::ThreadDesWrite( aMessage.Client(), 
+                                                  aCodesegInfo, 
+                                                  output, 
+                                                  0 );   
+                    if ( KErrNone != error )
+                        {
+                        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
+                        } 
+                    }
+                break;
+                }
+            }
+        }
+    // Removes all code segments from a queue and clear specified mark(s).
+    DCodeSeg::EmptyQueue( queue, DCodeSeg::EMarkDebug );
+    
+    // Exits thread critical section and releases code segment mutex.
+    Kern::EndAccessCode();
+    
+    return error;
+    #else // WINSCW
+    
+    if ( iCodeSeg.Count() > params().iIndex )
+        {
+        // Aqcuire codeseg information
+        output().iSize = iCodeSeg[params().iIndex].iSize;
+        output().iFullName.Copy( iCodeSeg[params().iIndex].iFullName );
+        output().iRunAddress = iCodeSeg[params().iIndex].iRunAddress;
+        
+        // Writes a descriptor to a thread's process.
+        error = Kern::ThreadDesWrite( aMessage.Client(), aCodesegInfo, output, 0 ); 
+        
+        if ( KErrNone != error )
+            {
+            LOGSTR2( "ATDD ThreadDesWrite error %d", error );
+            }
+        }
+    
+    // Exits thread critical section and releases code segment mutex.
+    Kern::EndAccessCode();
+    
+    return error;
+    #endif
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::GetLibraryInfo()
+// Acquires library information.
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::GetLibraryInfo( TAny* aLibraryInfo, 
+                                          TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::GetLibraryInfo()" );
+
+    // Temporary variable for reading informationfrom the user side
+    TLibraryInfoBuf params;
+
+    // Reads a descriptor from a thread's process.
+    TInt error = Kern::ThreadDesRead( aMessage.Client(), aLibraryInfo, params, 0 );  
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesRead error %d", error );
+        return error;
+        } 
+
+    if ( params().iIndex < 0 )
+        {
+        return KErrArgument;
+        }
+   
+    // Gets the current process
+    Kern::Containers()[ EProcess ]->Wait();
+    DProcess& process = *Kern::ProcessFromId( params().iProcessId );
+    Kern::Containers()[ EProcess ]->Signal();
+    
+    if ( NULL == &process )
+        {
+        return KErrNotFound;
+        }
+    
+    // Temporary variable for collecting information from the library
+    TLibraryInfoBuf output;
+        
+    // Enters thread critical section and acquires code segment mutex.
+    Kern::AccessCode();
+
+    // Iterate to find the right library
+    if ( params().iIndex < process.iDynamicCode.Count() )
+        {
+        // Acquire entry to the codeseg
+        SCodeSegEntry entry = process.iDynamicCode[ params().iIndex ];
+        
+        // Acquire library information
+        entry.iLib->AppendName( output().iLibraryName );//lint !e64 !e1514
+        output().iRunAddress = entry.iSeg->iRunAddress;
+        output().iSize = entry.iSeg->iSize;
+        
+        // Writes a descriptor to a thread's process.
+        error = Kern::ThreadDesWrite( aMessage.Client(), aLibraryInfo, output, 0 ); 
+        
+        if ( KErrNone != error )
+            {
+            LOGSTR2( "ATDD ThreadDesWrite error %d", error );
+            } 
+        
+        // Exits thread critical section and releases code segment mutex.
+        Kern::EndAccessCode();
+        
+        return error;
+        }
+    else
+        {
+        // Exits thread critical section and releases code segment mutex.
+        Kern::EndAccessCode();
+        
+        return KErrArgument;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::MainThreadAllocator()
+// Acquires information about process main thread RAllocator
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::MainThreadAllocator( TAny* aMainThreadParams, 
+                                               TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::MainThreadAllocator()" );
+
+    // Temporary variable for reading client side parameters
+    TMainThreadParamsBuf params;
+
+    // Reads a descriptor from a thread's process.
+    TInt error = Kern::ThreadDesRead( aMessage.Client(), 
+                                      aMainThreadParams, 
+                                      params, 
+                                      0 );  
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesRead error %d", error );
+        return error;
+        } 
+    
+    // Gets the current process
+    Kern::Containers()[ EProcess ]->Wait();
+    DProcess& process = *Kern::ProcessFromId( params().iProcessId );
+    Kern::Containers()[ EProcess ]->Signal();
+    
+    if ( NULL == &process )
+        {
+        return KErrNotFound;
+        }
+
+    // Gets the current process
+    Kern::AccessCode();
+
+    // Temporary variable for collecting information from the RAllocator
+    TMainThreadParamsBuf output;
+
+    // Aqcuire a reference to the main thread RAllocator
+    output().iAllocator = process.FirstThread()->iAllocator;
+
+    // Is this only thread in the process
+    output().iAlone = process.iThreadQ.First()->Alone();
+
+    // Exits thread critical section and releases code segment mutex.
+    Kern::EndAccessCode();
+
+    // Writes a descriptor to a thread's process.
+    error = Kern::ThreadDesWrite( aMessage.Client(), 
+                                  aMainThreadParams, 
+                                  output, 
+                                  0 ); 
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
+        } 
+
+    return error;
+    }    
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::ThreadStack()
+// Acquires main thread stack address
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::ThreadStack( TAny* aThreadStack, 
+                                       TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::ThreadStack()" );
+
+    // Temporary variable for reading client side parameters
+    TThreadParamsBuf params;
+
+    // Reads a descriptor from a thread's process.
+    TInt error = Kern::ThreadDesRead( aMessage.Client(), 
+                                      aThreadStack, 
+                                      params, 
+                                      0 );  
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesRead error %d", error );
+        return error;
+        } 
+    
+    // Gets the current process
+    Kern::Containers()[ EThread ]->Wait();
+    DThread& thread = *Kern::ThreadFromId( params().iThreadId );
+    Kern::Containers()[ EThread ]->Signal();
+    
+    if ( NULL == &thread )
+        {
+        return KErrNotFound;
+        }
+    
+    // Gets the current process
+    Kern::AccessCode();
+
+    // Temporary variable for collecting information from the RAllocator
+    TThreadParamsBuf output;
+
+    // Stack address of the main thread
+    output().iStackAddress = thread.iUserStackRunAddress;
+    output().iStackSize    = thread.iUserStackSize;
+
+    // Exits thread critical section and releases code segment mutex.
+    Kern::EndAccessCode();
+
+    // Writes a descriptor to a thread's process.
+    error = Kern::ThreadDesWrite( aMessage.Client(), 
+                                  aThreadStack, 
+                                  output, 
+                                  0 ); 
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
+        } 
+    
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::GetProcessHandleInfo()
+// Acquires information about process global handles
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::GetProcessHandleInfo( TAny* aProcessHandleInfo,
+                                                TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::GetProcessHandleInfo()" );
+
+    // Temporary variable for collecting information from the codeseg
+    TProcessHandleInfoBuf params;
+
+    // Reads a descriptor from a thread's process.
+    TInt error = Kern::ThreadDesRead( aMessage.Client(), 
+                                      aProcessHandleInfo, 
+                                      params, 
+                                      0 );  
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesRead error %d", error );
+        return error;
+        } 
+
+    // Gets the current process
+    Kern::Containers()[ EProcess ]->Wait();
+    DProcess& process = *Kern::ProcessFromId( params().iProcessId );
+    Kern::Containers()[ EProcess ]->Signal();
+    
+    if ( NULL == &process )
+        {
+        return KErrNotFound;
+        }
+    
+    // Variable holding wanted information
+    TProcessHandleInfoBuf output;
+
+    // Enters thread critical section and acquires code segment mutex.
+    Kern::AccessCode();
+
+    // Get the process thread queue.
+    SDblQue queue = process.iThreadQ;
+    error = KErrNotFound;
+        
+    // Tests whether this doubly linked list is empty.
+    if ( !queue.IsEmpty() )
+        {
+        // Gets a pointer to the first item in this doubly linked list.
+        SDblQueLink* link = queue.First();
+        DThread* thread = _LOFF( link, DThread, iProcessLink );
+
+        if ( thread )
+            {
+            
+#ifdef MCL_ROBJECTIX
+            TInt threadHandles( thread->iHandles.ActiveCount() );
+#else
+            TInt threadHandles( thread->iHandles->ActiveCount() );
+#endif
+            
+            // Aqcuire thread information
+            //thread->AppendName( output.iThreadName );
+            output().iUserStackRunAddress = thread->iUserStackRunAddress;
+            output().iUserStackSize = thread->iUserStackSize;
+            output().iThreadHandleCount = threadHandles;
+            
+#ifdef MCL_ROBJECTIX
+            RObjectIx objectIx = process.iHandles;
+            output().iProcessHandleCount = objectIx.ActiveCount();
+#else
+            DObjectIx* objectIx = process.iHandles;
+            output().iProcessHandleCount = objectIx->ActiveCount();
+#endif
+                        
+            // Writes a descriptor to a thread's process.
+            error = Kern::ThreadDesWrite( aMessage.Client(), 
+                                          aProcessHandleInfo, 
+                                          output, 
+                                          0 ); 
+            
+            if ( KErrNone != error )
+                {
+                LOGSTR2( "ATDD ThreadDesWrite error %d", error );
+                } 
+            }
+        }
+
+    // Exits thread critical section and releases code segment mutex.
+    Kern::EndAccessCode();
+    
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::GetCurrentHandleCount()
+// Acquires a process's current handle count
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::GetCurrentHandleCount( TAny* aProcessHandles,
+                                                 TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::GetCurrentHandleCount()" );
+
+    // Temporary variable for collecting information from the codeseg
+    TATProcessHandlesBuf params;
+    
+    // Reads a descriptor from a thread's process.
+    TInt error = Kern::ThreadDesRead( aMessage.Client(), 
+                                      aProcessHandles, 
+                                      params, 
+                                      0 );
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesRead error %d", error );
+        return error;
+        } 
+    
+    // Gets the current process
+    Kern::Containers()[ EProcess ]->Wait();
+    DProcess* process = Kern::ProcessFromId( params().iProcessId );
+    Kern::Containers()[ EProcess ]->Signal();
+    
+    if ( NULL == process )
+        {
+        return KErrNotFound;
+        }
+
+    // Variable holding wanted information
+    TATProcessHandlesBuf output;
+    
+    // Enters thread critical section and acquires code segment mutex.
+    Kern::AccessCode();
+    
+    SDblQue queue = process->iThreadQ;
+    SDblQueLink* link = queue.First();
+    TInt threadHandles( 0 );
+    
+    // Iterate through current processes's threads
+    while ( link != queue.Last() )
+        {
+        DThread* thread = _LOFF( link, DThread, iProcessLink );
+        
+#ifdef MCL_ROBJECTIX
+        threadHandles += thread->iHandles.ActiveCount();
+#else
+        threadHandles += thread->iHandles->ActiveCount();
+#endif
+        
+        link = link->iNext;
+        }
+
+    if ( link == queue.Last() )
+        {
+        DThread* thread = _LOFF( link, DThread, iProcessLink );
+
+#ifdef MCL_ROBJECTIX
+        threadHandles += thread->iHandles.ActiveCount();
+#else
+        threadHandles += thread->iHandles->ActiveCount();
+#endif
+        }
+    
+    output().iCurrentHandleCount = threadHandles;
+    
+    // Writes a descriptor to a thread's process.
+    error = Kern::ThreadDesWrite( aMessage.Client(), 
+                                  aProcessHandles, 
+                                  output, 
+                                  0 ); 
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
+        } 
+    
+    // Exits thread critical section and releases code segment mutex.
+    Kern::EndAccessCode();
+    
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::ClientCount()
+// Acquires the count of current device driver users.
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::ClientCount( TAny* aClientCount,
+                                       TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::ClientCount()" );
+    
+    // Enters thread critical section and acquires code segment mutex.
+    Kern::AccessCode();
+    
+    // Variable holding wanted information
+    TClientCountBuf output;
+    
+    // Get the number of DLogicalChannelBase objects currently in existence which
+    // have been created from this LDD.
+    output().iClientCount = DLogicalChannelBase::iDevice->iOpenChannels;
+    LOGSTR2( "ATDD > iOpenChannels count: %d", output().iClientCount ); 
+    
+    // Writes a descriptor to a thread's process.
+    TInt error = Kern::ThreadDesWrite( aMessage.Client(), 
+                                       aClientCount, 
+                                       output, 
+                                       0 ); 
+    
+    if ( KErrNone != error )
+        {
+        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
+        } 
+    
+    // Exits thread critical section and releases code segment mutex.
+    Kern::EndAccessCode();
+    
+    return error;
+    }
+
+#ifdef __WINSCW__
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::GetModuleDependencies()
+// Get module dependencies
+// -----------------------------------------------------------------------------
+//
+void DAnalyzeToolChannel::GetModuleDependencies( HMODULE aModule )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::GetModuleDependencies()" );
+
+    Emulator::TModule etm( aModule );
+    TUint32 dllSize( 0 );
+    // Temporary variable for collecting information from the codeseg
+    TCodesegInfo info;
+    TBool found( EFalse );
+    
+    const IMAGE_IMPORT_DESCRIPTOR* imports = etm.Imports();
+    while( imports->Characteristics != 0 )
+        {
+        // Reset flag
+        found = EFalse;
+        
+        // Get dll name
+        const TUint8* nameAddr = ( const TUint8* )( imports->Name + ( TInt )etm.iBase );
+        TPtrC8 namePtr( nameAddr );     
+        
+        // Get dll run address
+        Emulator::TModule imp_etm( ( PCSTR )etm.Translate( imports->Name ) );        
+        const TUint8* runAddr = ( const TUint8* )imp_etm.iBase;
+        
+        // Get dll size
+        const IMAGE_NT_HEADERS32* ntHeader = imp_etm.NtHeader();
+        dllSize = ntHeader->OptionalHeader.SizeOfImage;       
+        
+        // Check if DLL already exists in codesegment list
+        for( TInt i = 0; i < iCodeSeg.Count(); i++ )
+            {
+            if ( iCodeSeg[i].iFullName.Compare( namePtr ) == KErrNone )
+                {
+                found = ETrue;
+                break;
+                }
+            }
+        
+        if ( !found )
+            {
+            info.iSize = dllSize;
+            info.iFullName.Copy( namePtr );
+            info.iRunAddress = (TUint32) runAddr;  
+            // Append codesegment to array
+            iCodeSeg.Append( info );
+            }
+        imports++;
+        }
+    }
+  
+#endif // __WINSCW__
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolChannel::GetMemoryModel()
+// Acquires memory model system uses.
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolChannel::GetMemoryModel(TAny* aMemoryModel,
+                                        TThreadMessage& aMessage)
+    {
+    LOGSTR1( "ATDD DAnalyzeToolChannel::GetMemoryModel()" );
+   
+    // Model buffer.
+    TATMemoryModelBuf model;
+    // Get current model.
+    model().iMemoryModel = (TUint32) Kern::HalFunction( EHalGroupKernel, EKernelHalMemModelInfo, NULL, NULL );
+    model().iMemoryModel &= EMemModelTypeMask; // Mask out other stuff.
+    // Write it to client side.
+    TInt error = Kern::ThreadDesWrite( aMessage.Client(),
+                                        aMemoryModel,
+                                        model,
+                                        0);
+    if ( error != KErrNone )
+        {
+        LOGSTR2( "ATDD ThreadDesWrite error %d", error );
+        }
+    return error;
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/kerneleventhandler/src/analyzetooldevice.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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:  Definitions for the class DAnalyzeToolDevice.
+*
+*/
+
+
+// INCLUDE FILES
+#include "analyzetooldevice.h"
+#include "analyzetoolchannel.h"
+#include "atlog.h"
+
+// ================= MEMBER FUNCTIONS =========================================
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolDevice::DAnalyzeToolDevice()
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+DAnalyzeToolDevice::DAnalyzeToolDevice()
+    {
+    LOGSTR1( "ATDD DAnalyzeToolDevice::DAnalyzeToolDevice()" );
+    // Set version number
+    iVersion = KAnalyzeToolLddVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolDevice::Install()
+// Second stage constructor.
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolDevice::Install()
+    {
+    LOGSTR1( "ATDD DAnalyzeToolDevice::Install()" );
+    // Set device name
+    return SetName( &KAnalyzeToolLddName );
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolDevice::GetCaps()
+// Gets the driver's capabilities.
+// -----------------------------------------------------------------------------
+//
+void DAnalyzeToolDevice::GetCaps( TDes8& /*aDes*/ ) const
+    {
+    LOGSTR1( "ATDD DAnalyzeToolDevice::GetCaps()" );
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolDevice::Create()
+// Creates the logical channel.
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolDevice::Create( DLogicalChannelBase*& aChannel )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolDevice::Create()" );
+
+    // create new channel
+    aChannel = new DAnalyzeToolChannel;
+
+    // check that everything is OK
+    return ( aChannel != NULL ) ? KErrNone : KErrNoMemory;
+    }
+
+// -----------------------------------------------------------------------------
+// DECLARE_STANDARD_LDD
+// Defines the entry point for a standard logical device driver (LDD),
+// and declares the ordinal 1 export function for creating 
+// the LDD factory object
+// -----------------------------------------------------------------------------
+//
+DECLARE_STANDARD_LDD()
+    {
+    LOGSTR1( "ATDD DECLARE_STANDARD_LDD()" );
+    return new DAnalyzeToolDevice;
+    }
+    
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/kerneleventhandler/src/analyzetooleventhandler.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,427 @@
+/*
+* 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:  Definitions for the class DAnalyzeToolEventHandler.
+*
+*/
+
+
+// INCLUDE FILES
+#include "analyzetooleventhandler.h"
+#include <kernel/kern_priv.h>
+
+// CONSTANTS
+
+// The handler mutex literal
+_LIT( KHandlerMutexName, "AnalyzeToolHandlerMutex" );
+
+// The handle data mutex literal
+_LIT( KDataMutexName, "AnalyzeToolDataMutex" );
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolEventHandler::Create()
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+TInt DAnalyzeToolEventHandler::Create( DLogicalDevice* aDevice,
+    const TUint aProcessId )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolEventHandler::Create()" );
+    TInt ret( KErrNone );
+    
+    // Store owner process ID
+    iProcessId = aProcessId;
+    LOGSTR2( "ATDD DAnalyzeToolEventHandler::Create > iProcessId %d", 
+            iProcessId );
+    
+    // Open the device
+    ret = aDevice->Open();
+    if ( ret != KErrNone )
+        return ret;
+    iDevice = aDevice;
+
+    // Create mutex for the handler
+    ret = Kern::MutexCreate( iHandlerMutex, KHandlerMutexName, KMutexOrdDebug );
+    if ( ret != KErrNone )
+        return ret;
+    // Create mutex for the data
+    ret = Kern::MutexCreate( iDataMutex, KDataMutexName, KMutexOrdDebug-1 );
+    if ( ret != KErrNone )
+        return ret;
+
+    // Add handler to the handler queue
+    return Add();
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolEventHandler::~DAnalyzeToolEventHandler()
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+DAnalyzeToolEventHandler::~DAnalyzeToolEventHandler()
+    {
+    LOGSTR1( "ATDD DAnalyzeToolEventHandler::~DAnalyzeToolEventHandler()" );
+    
+    CancelInformLibraryEvent();
+    
+    // Close the data mutex
+    if ( iDataMutex )
+        {
+        iDataMutex->Close( NULL );
+        }
+
+    // Close the handler mutex
+    if ( iHandlerMutex )
+        {
+        iHandlerMutex->Close( NULL );
+        }
+
+    // Close the device mutex
+    if ( iDevice )
+        {
+        iDevice->Close( NULL );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolEventHandler::EventHandler()
+// Function for receiving kernel events
+// -----------------------------------------------------------------------------
+//
+TUint DAnalyzeToolEventHandler::EventHandler( TKernelEvent aEvent, 
+    TAny* a1, TAny* a2, TAny* aThis )
+    {
+    
+    // Clarify the event type
+    switch ( aEvent)
+        {
+        case EEventRemoveLibrary:
+            {
+            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventRemoveLibrary" );
+            // Cast the pointer to the handler
+            DAnalyzeToolEventHandler* handler = 
+            ( ( DAnalyzeToolEventHandler* ) aThis );
+            // Create variable for library information
+            TLibraryEventInfo info;
+            // Set as library remove event
+            info.iEventType = TLibraryEventInfo::ELibraryRemoved;
+            // Handle the event
+            handler->HandleLibraryEvent( ( DLibrary* ) a1, ( DThread* ) a2, info );
+            break;
+            }
+        case EEventAddLibrary:
+            {
+            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventAddLibrary" );
+            // Cast the pointer to the handler
+            DAnalyzeToolEventHandler* handler = 
+            ( ( DAnalyzeToolEventHandler* ) aThis );
+            // Create variable for library information
+            TLibraryEventInfo info;
+            // Set as library remove event
+            info.iEventType = TLibraryEventInfo::ELibraryAdded;
+            // Handle the event
+            handler->HandleLibraryEvent( ( DLibrary* ) a1, ( DThread* ) a2, info );
+            break;
+            }
+        case EEventHwExc:
+            {
+            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventHwExc" );
+            break;
+            }
+        case EEventSwExc:
+            {
+            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventSwExc" );
+            break;
+            }
+        case EEventRemoveThread:
+            {
+            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventRemoveThread" );
+            break;
+            }
+        case EEventKillThread:
+            {
+            LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventHandler() - EEventKillThread" );
+            
+            // Cast the pointer to the handler
+            DAnalyzeToolEventHandler* handler = 
+                ( ( DAnalyzeToolEventHandler* ) aThis );
+            
+            // Create variable for library information
+            TLibraryEventInfo info;
+            
+            // Set as kill thread event
+            info.iEventType = TLibraryEventInfo::EKillThread;
+            // Handle the event
+            handler->HandleKillThreadEvent( ( DThread* ) a1, info );
+            break;
+            }
+        default:
+            {
+            }
+            break;
+        }  
+    return ERunNext;
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolEventHandler::HandleLibraryEvent()
+// Handles the EEventAddLibrary and EEventRemoveLibrary events.
+// -----------------------------------------------------------------------------
+//
+void DAnalyzeToolEventHandler::HandleLibraryEvent( DLibrary* aLib, 
+    DThread* aThread, TLibraryEventInfo& aInfo )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolEventHandler::HandleLibraryEvent()" );
+    
+    // Aqcuire the handler mutex
+    Kern::MutexWait( *iHandlerMutex );
+
+    // Aqcuire the data mutex
+    Kern::MutexWait( *iDataMutex );
+    
+    TBool addInfo( EFalse );
+    
+    // Check the library event type
+    if ( aInfo.iEventType == TLibraryEventInfo::ELibraryAdded )
+        {
+        if ( aThread != NULL )
+            {
+            if ( iProcessId == aThread->iOwningProcess->iId )
+                {
+                LOGSTR1( "ATDD > Process id match" );
+                aInfo.iProcessId = aThread->iOwningProcess->iId;
+                addInfo = ETrue;
+                }
+            }
+        }
+    else if ( aInfo.iEventType == TLibraryEventInfo::ELibraryRemoved )
+        {
+        if ( aThread != NULL )
+            {
+            aInfo.iProcessId = aThread->iOwningProcess->iId;
+            }
+        else
+            {
+            aInfo.iProcessId = 0;
+            }
+        addInfo = ETrue;
+        }
+    
+    if ( addInfo )
+        {
+        // Store lib info
+        aLib->AppendName( aInfo.iLibraryName );//lint !e64 !e1514
+        aInfo.iSize = aLib->iCodeSeg->iSize;
+        aInfo.iRunAddress = aLib->iCodeSeg->iRunAddress;
+        // Store library event info to the array
+        iEventArray.Append( aInfo );
+        LOGSTR2( "ATDD > iEventArray.Count() = %d", iEventArray.Count() );
+        
+        // if client has subscribed the event it is queued
+        if ( iClientThread != NULL )
+            {
+            iEventDfc.Enque();
+            }
+        }
+     
+    // Release the data mutex
+    Kern::MutexSignal( *iDataMutex );
+
+    // Release the handler mutex
+    Kern::MutexSignal( *iHandlerMutex );
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolEventHandler::InformLibraryEvent()
+// Subscribes library event.
+// -----------------------------------------------------------------------------
+//
+void DAnalyzeToolEventHandler::InformLibraryEvent( TRequestStatus* aStatus, 
+                                                   TAny* aLibraryInfo,
+                                                   TThreadMessage& aMessage )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolEventHandler::InformLibraryEvent()" );
+
+    // Aqcuire the data mutex
+    Kern::MutexWait( *iDataMutex );  
+    
+    // Check if request from client which is already pending
+    DThread* current = aMessage.Client();
+    
+    LOGSTR2( "ATDD > Current Thread ID = %d", current->iId );
+ 
+    // Ensure that client doesn't subscribe service when there is a pending
+    // subscription
+    if ( NULL != iClientThread )
+        {
+        aMessage.PanicClient( KClientPanic, EPanicRequestPending );
+        }
+    else
+        {
+        // Store the client variable pointers
+        iClientThread         = current;
+        iClientRequestStatus  = aStatus;
+        iClientInfo           = aLibraryInfo;
+        }
+    
+    // Release the data mutex
+    Kern::MutexSignal( *iDataMutex );
+    
+    // Queue the event since now the client has subscribed it
+    iEventDfc.Enque();
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolEventHandler::CancelInformLibraryEvent
+// Cancels subscription of the library event.
+// -----------------------------------------------------------------------------
+//
+void DAnalyzeToolEventHandler::CancelInformLibraryEvent()
+    {
+    LOGSTR1( "ATDD DAnalyzeToolEventHandler::CancelInformLibraryEvent()" );
+    
+    iEventDfc.Cancel();
+    
+    // Aqcuire the data mutex
+    Kern::MutexWait( *iDataMutex );
+
+    if ( NULL != iClientThread && iEventArray.Count() > 0 )
+        {
+        // Signal the request as complete
+        Kern::RequestComplete( iClientThread, 
+                               iClientRequestStatus, 
+                               KErrCancel );
+        
+        iClientThread         = NULL;
+        iClientRequestStatus  = NULL;
+        iClientInfo           = NULL;
+
+        // Reset the event array
+        iEventArray.Reset();
+        }
+   
+    // Release the data mutex
+    Kern::MutexSignal( *iDataMutex );
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolEventHandler::HandleKillThreadEvent()
+// Handles the EEventKillThread events.
+// -----------------------------------------------------------------------------
+//
+void DAnalyzeToolEventHandler::HandleKillThreadEvent( DThread* aThread, 
+                                                      TLibraryEventInfo& aInfo )
+    {
+    LOGSTR1( "ATDD DAnalyzeToolEventHandler::HandleKillThreadEvent()" );
+    
+    // Aqcuire the handler mutex
+    Kern::MutexWait( *iHandlerMutex );
+
+    // 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 )
+            {
+            // Set current Thread id
+            LOGSTR2( "ATDD > Thread ID = %d", aThread->iId );
+            aInfo.iThreadId = aThread->iId;
+            // Append event to array (beginning of the array)
+            iEventArray.Insert( aInfo, 0 );
+            
+            // if client has subscribed the event it is queued
+            if ( iClientThread != NULL )
+                {
+                iEventDfc.Enque();
+                }
+            }
+        }
+    
+    // Release the data mutex
+    Kern::MutexSignal( *iDataMutex );
+
+    // Release the handler mutex
+    Kern::MutexSignal( *iHandlerMutex );
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolEventHandler::DoEventComplete()
+// Informs client about the occured event.
+// -----------------------------------------------------------------------------
+//
+void DAnalyzeToolEventHandler::DoEventComplete()
+    {
+    LOGSTR1( "ATDD DAnalyzeToolEventHandler::DoEventComplete()" );
+    
+    // Aqcuire the handler mutex
+    Kern::MutexWait( *iHandlerMutex );
+
+    // Aqcuire the data mutex
+    Kern::MutexWait( *iDataMutex );
+    
+    if ( NULL != iClientThread && iEventArray.Count() > 0 )
+        {
+        TInt ret = Kern::ThreadRawWrite( iClientThread, 
+                                         iClientInfo, 
+                                         &iEventArray[0],
+                                         sizeof( iEventArray[0] ) );
+        
+        LOGSTR2( "ATDD > ThreadRawWrite err = %d", ret );
+        
+        // Signal the request as complete
+        Kern::RequestComplete( iClientThread, 
+                               iClientRequestStatus, 
+                               ret );
+        
+        // Remove first item to array
+        iEventArray.Remove( 0 );
+        
+        // Compresses the array down to a minimum
+        iEventArray.Compress();
+        
+        // Ensure that pointers are set to NULL
+        iClientThread         = NULL;
+        iClientRequestStatus  = NULL;
+        iClientInfo           = NULL;
+        
+        LOGSTR2( "ATDD > iEventArray = %d", iEventArray.Count() );
+        }
+    
+    // Release the data mutex
+    Kern::MutexSignal( *iDataMutex );
+
+    // Release the handler mutex
+    Kern::MutexSignal( *iHandlerMutex );
+    }
+
+// -----------------------------------------------------------------------------
+// DAnalyzeToolEventHandler::EventDfc()
+// Static function for DFC events.
+// -----------------------------------------------------------------------------
+//
+void DAnalyzeToolEventHandler::EventDfc(TAny* aPtr)
+    {
+    LOGSTR1( "ATDD DAnalyzeToolEventHandler::EventDfc()" ); 
+    ( (DAnalyzeToolEventHandler*) aPtr )->DoEventComplete();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/rom/analyzetool.iby	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2008 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 __ANALYZETOOL_IBY__
+#define __ANALYZETOOL_IBY__
+
+// Stub
+data=ZSYSTEM\Install\analyzetool_stub.sis                   \system\install\analyzetool_stub.sis
+
+#endif // __ANALYZETOOL_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/rom/analyzetool_rom.iby	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2008 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 __ANALYZETOOL_ROM_IBY__
+#define __ANALYZETOOL_ROM_IBY__
+
+
+// Kernel event handler
+device[VARID]=ABI_DIR\BUILD_DIR\atoolkerneleventhandler.ldd     SHARED_LIB_DIR\atoolkerneleventhandler.ldd
+
+// Memory hook
+file=ABI_DIR\BUILD_DIR\atoolmemoryhook.dll                      SHARED_LIB_DIR\atoolmemoryhook.dll
+
+// Cleaner
+file=ABI_DIR\BUILD_DIR\atoolcleaner.dll           	            SHARED_LIB_DIR\atoolcleaner.dll
+
+
+#endif // __ANALYZETOOL_ROM_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/sis/AnalyzeTool.pkg	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,40 @@
+;
+; 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:
+;
+
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"AnalyzeTool"},(0x20012432),1,10,0,TYPE=SA, RU
+
+;Localised Vendor name
+%{"Nokia Corporation"}
+
+;Unique Vendor name
+:"Nokia Corporation"
+
+;Supports Series 60 v 3.1
+[0x102032BE], 0, 0, 0, {"Series60ProductID"}
+
+;Supports S60 release 5.0
+[0x1028315F], 0, 0, 0, {"Series60ProductID"}
+
+"\epoc32\release\armv5\urel\atoolkerneleventhandler.ldd"            -"!:\sys\bin\atoolkerneleventhandler.ldd"
+"\epoc32\release\armv5\urel\atoolmemoryhook.dll"                    -"!:\sys\bin\atoolmemoryhook.dll"
+"\epoc32\release\armv5\urel\atoolcleaner.dll"                 		-"!:\sys\bin\atoolcleaner.dll"
+
+; Install console application
+"\epoc32\release\armv5\urel\atool.exe"-"!:\sys\bin\atool.exe"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/sis/AnalyzeTool_udeb.pkg	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,40 @@
+;
+; 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:
+;
+
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"AnalyzeTool"},(0x20012432),1,10,0,TYPE=SA, RU
+
+;Localised Vendor name
+%{"Nokia Corporation"}
+
+;Unique Vendor name
+:"Nokia Corporation"
+
+;Supports Series 60 v 3.1
+[0x102032BE], 0, 0, 0, {"Series60ProductID"}
+
+;Supports S60 release 5.0
+[0x1028315F], 0, 0, 0, {"Series60ProductID"}
+
+"\epoc32\release\armv5\udeb\atoolkerneleventhandler.ldd"            -"!:\sys\bin\atoolkerneleventhandler.ldd"
+"\epoc32\release\armv5\udeb\atoolmemoryhook.dll"                    -"!:\sys\bin\atoolmemoryhook.dll"
+"\epoc32\release\armv5\urel\atoolcleaner.dll"                 		-"!:\sys\bin\atoolcleaner.dll"
+
+; Install console application
+"\epoc32\release\armv5\udeb\atool.exe"-"!:\sys\bin\atool.exe"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/sis/analyzeTool_stub.pkg	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,34 @@
+;
+; 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:
+;
+
+;Languages
+&EN
+
+;Header
+#{"AnalyzeTool"}, (0x20012432), 1,10,0
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+; Localised vendor names
+%{"Nokia Corporation"}
+
+; AnalyzeTool binaries
+""-"z:\sys\bin\atoolkerneleventhandler.ldd"
+""-"z:\sys\bin\atoolmemoryhook.dll"
+""-"z:\sys\bin\atoolcleaner.dll"
+
+""-"z:\sys\bin\atool.exe"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/staticlib/group/atoolstaticlib.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* 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:  The .mmp file for AToolStaticLib.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET        atoolstaticlib.lib
+TARGETTYPE    lib
+UID           0x1000008d 0x20018421//0x02DF7F96
+CAPABILITY    ALL -TCB
+
+SMPSAFE
+
+USERINCLUDE   ../../inc
+SOURCEPATH    ../src
+SOURCE        atoolstaticlib.cpp
+
+OS_LAYER_SYSTEMINCLUDE
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/staticlib/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 <platform_paths.hrh>
+
+PRJ_PLATFORMS
+ARMV5 WINSCW
+
+PRJ_MMPFILES
+atoolstaticlib.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/staticlib/src/atoolstaticlib.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* 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:  The file contains declarations of extern methods and definitions
+*                of overloaded User methods.
+*
+*/
+
+
+#include <analyzetool/customuser.h>
+#include "atlog.h"
+
+// -----------------------------------------------------------------------------
+// GetInt()
+// Extern function for acquiring all integer values
+// -----------------------------------------------------------------------------
+// 
+GLREF_C TInt GetInt( const TUint8 aType );
+
+// -----------------------------------------------------------------------------
+// GetString()
+// Extern function for acquiring all string values
+// -----------------------------------------------------------------------------
+//
+GLREF_C TPtrC GetString( const TUint8 aType );
+
+// -----------------------------------------------------------------------------
+// User::Exit()
+// Overloaded User::Exit() function
+// -----------------------------------------------------------------------------
+// 
+void User::Exit( TInt aReason )
+    {   
+    LOGSTR2( "ATMH User::Exit %i", aReason ); 
+    CustomUser::Exit( aReason );
+    }
+
+// -----------------------------------------------------------------------------
+// User::Panic()
+// Overloaded User::Panic() function
+// -----------------------------------------------------------------------------
+//
+void User::Panic( const TDesC& aCategory, TInt aReason )
+    {
+    LOGSTR3( "ATMH User::Panic() %S %i", &aCategory, aReason );
+    CustomUser::Panic( aCategory, aReason );
+    }
+ 
+// -----------------------------------------------------------------------------
+// User::SetCritical()
+// Overloaded User::SetCritical() function which returns
+// KErrNone, if successful; KErrArgument, if EAllThreadsCritical is 
+// passed - this is a state associated with a process, and you use 
+// User::SetProcessCritical() to set it.
+// -----------------------------------------------------------------------------
+// 
+TInt User::SetCritical( TCritical aCritical )
+    {
+    LOGSTR2( "ATMH User::SetCritical() %i", aCritical );
+    return CustomUser::SetCritical( aCritical );
+    }
+
+// -----------------------------------------------------------------------------
+// User::SetProcessCritical()
+// Overloaded User::SetProcessCritical() function
+// KErrNone, if successful; KErrArgument, if either EProcessCritical or 
+// EProcessPermanent is passed - these are states associated with a 
+// thread, and you use User::SetCritical() to set them.
+// -----------------------------------------------------------------------------
+// 
+TInt User::SetProcessCritical( TCritical aCritical )
+    {
+    LOGSTR2( "ATMH User::SetProcessCritical() %i", aCritical );
+    return CustomUser::SetProcessCritical( aCritical );
+    }
+    
+// -----------------------------------------------------------------------------
+// UserHeap::SetupThreadHeap()
+// Overloaded UserHeap::SetupThreadHeap function
+// -----------------------------------------------------------------------------
+//  
+TInt UserHeap::SetupThreadHeap( TBool aNotFirst, 
+                                SStdEpocThreadCreateInfo& aInfo )
+    {
+    LOGSTR1( "ATMH UserHeap::SetupThreadHeap()" );
+        
+    // Check validity of parameters 
+    TInt logOption( GetInt( (TUint8) CustomUser::ELogOption ) );
+    if ( logOption < 0 )
+        logOption = KATDefaultLogOption;
+    
+    TInt debug( GetInt( (TUint8) CustomUser::EDebug ) );
+    if ( debug < 0 )
+        debug = KATDefaultDebug;
+    
+    TInt allocCallStack( GetInt( (TUint8) CustomUser::EAllocCallStackSize ) );
+    if ( allocCallStack < 0 )
+        allocCallStack = KATDefaultAllocCallStackSize;
+    
+    TInt freeCallStack( GetInt( (TUint8) CustomUser::EFreeCallStackSize ) );
+    if ( freeCallStack < 0 )
+        freeCallStack = KATDefaultFreeCallStackSize;
+        
+    return CustomUser::SetupThreadHeap( aNotFirst, aInfo, 
+            GetString( (TUint8) CustomUser::ELogFileName ),
+            GetString( (TUint8) CustomUser::ELogFilePath ),
+            (TUint32) logOption, (TUint32) debug,
+            GetString( (TUint8) CustomUser::EVersion ),
+            (TUint32) allocCallStack, (TUint32) freeCallStack,
+            KATArgumentList );
+    }
+  
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/analyzetool/symbian_version.hrh	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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: Symbian version configuration file 
+*
+*/
+
+#ifndef __SYMBIAN_VERSION_HRH
+#define __SYMBIAN_VERSION_HRH
+
+// S60 and Symbian version number enumeration definitions
+
+#define S60_30                                              30
+#define S60_31                                              31
+#define S60_32                                              32
+#define S60_50                                              50
+#define S60_51                                              91
+#define S60_52                                              92
+#define SYMBIAN_1                                           50
+#define SYMBIAN_2                                           91
+#define SYMBIAN_3                                           92
+#define SYMBIAN_4                                           101
+
+
+/**
+ * Defines the S60 or Symbian version used by this component. This flag can be
+ * used to variate the source code based on the SDK in use. The value of the
+ * flag should be always changed to reflect the current build environment.
+ */
+#define SYMBIAN_VERSION_SUPPORT                              SYMBIAN_4
+
+
+#endif  // __SYMBIAN_VERSION_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/CommandLine/Include/MemSpyCommandLine.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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 MEMSPYCOMMANDLINE_H
+#define MEMSPYCOMMANDLINE_H
+
+// System includes
+#include <e32base.h>
+#include <f32file.h>
+#include <badesca.h>
+#include <e32cons.h>
+
+#include "MemSpyCommands.h"
+
+#ifdef _DEBUG
+#   define TRACE( x ) x
+#else
+#   define TRACE( x )
+#endif
+
+// Constants
+const TInt KMemSpyCommandLineMaxLength = 128;
+
+// Classes referenced
+class RFs;
+class CCommandLineArguments;
+class RMemSpyEngineClientInterface;
+class CConsoleBase;
+class RMemSpySession;
+
+class CMemSpyCommandLine :  public CActive
+    {
+public:
+    //static CMemSpyCommandLine* NewLC();
+	static CMemSpyCommandLine* NewLC( CConsoleBase& aConsole );
+    ~CMemSpyCommandLine();
+
+private:
+    //CMemSpyCommandLine();
+    CMemSpyCommandLine( CConsoleBase& aConsole );
+    void ConstructL();
+
+public: // API
+    //void PerformBatchL( const TDesC& aFileName ); 	//support of the batch files removed 
+    void PerformOpL( const CCommandLineArguments& aCommandLine );
+    void PerformSingleOpL( const TDesC& aCommand, const CDesCArray& aParameters );
+    //
+    //AO request method
+    void WaitForInput();
+
+private: // Internal methods
+    void ConnectToMemSpyL();
+    void LaunchMemSpyL();
+    CDesCArray* ReadLinesL( RFile& aFile );
+    void ParseSWMTParametersL( const CDesCArray& aParameters, TInt& aCategories, TDes& aFilter );
+    TInt FindBatchFile( TDes &aFileName );
+    TInt FindFile( TDes &aFileName, const TDesC &aDirPath );
+
+private: // Console write methods
+    void RedrawInputPrompt();
+    void RedrawStatusMessage();
+    void RedrawStatusMessage( const TDesC& aMessage );
+    void ProcessCommandBufferL();
+    void RunL(); // from CActive
+    TInt RunError( TInt aError );
+    void DoCancel();
+    
+private: // Data members
+    RFs iFsSession;
+    RMemSpyEngineClientInterface* iMemSpy;
+    RMemSpySession* iMemSpySession;
+    TBool iIsBatch; // For avoiding recursion
+    
+private: // Data members - console - write status messages
+    CConsoleBase& iConsole;
+    TPoint iCommandPromptPos;
+    TPoint iStatusMessagePos;
+    TBuf<KMemSpyMaxInputBufferLength> iCommandBuffer;
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/CommandLine/Include/MemSpyCommands.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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 MEMSPYCOMMANDS_H
+#define MEMSPYCOMMANDS_H
+
+// Literal constants
+_LIT( KMemSpyCLINewLine, "\r\n" );
+_LIT( KMemSpyCLIName, "MemSpy CommandLineInterpreter" );
+_LIT( KMemSpyCLIInputPrompt, " > %S" );
+_LIT( KMemSpyCLIWildcardCharacter, "*" );
+
+// Numerical constants
+const TInt KMemSpyMaxDisplayLengthThreadName = 48;
+const TInt KMemSpyMaxDisplayLengthSizeText = 14;
+const TInt KMemSpyMaxInputBufferLength = 200;
+
+// Key constants (S60)
+const TInt KMemSpyUiS60KeyCodeButtonOk = 2000;
+const TInt KMemSpyUiS60KeyCodeButtonCancel = 2001;
+const TInt KMemSpyUiS60KeyCodeRockerEnter = 63557;
+
+// Status messages
+_LIT( KOutputChangeMessage, "Change output mode opetarion in progress" );
+_LIT( KHeapDumpMessage, "Heap dump opetarion in progress" );
+_LIT( KSWMTMessage, "System Wide Memory Tracking opetarion in progress" );
+
+// Help text
+_LIT( KHelpMessage, "=== MemSpy CommandLineInterpreter Help ===\r\n" );
+_LIT( KHelpOutputCommand, "Change output mode to trace: 'memspy output trace'\r\n" );
+_LIT( KHelpOutputToFileCommand, "Change output mode to trace: 'memspy output file'\r\n" );
+_LIT( KHelpHeapDumpCommand, "Heap dump: 'memspy heapdup <all | kernel | user heap filter >'\r\n" );
+_LIT( KHelpSwmtCommand, "SWMT: 'memspy swmt <starttimer <value in seconds> | stop timer | dumpnow > <categories>'\r\n" );
+_LIT( KHelpKillServerCommand, "Kill server: 'memspy killserver'\r\n" );
+_LIT( KHelpCommand, "Press 'c' to continue" );
+
+//new commands
+
+//HELP
+_LIT( KMemSpyCmdHelp1, "-?" );
+_LIT( KMemSpyCmdHelp2, "-h" );
+_LIT( KMemSpyCmdHelp3, "-help" );
+_LIT( KMemSpyCmdHelp4, "--help" );
+
+//OUTPUT
+_LIT( KMemSpyCmdOutput, "output" );
+_LIT( KMemSpyCmdOutputParameterTrace, "trace" );
+_LIT( KMemSpyCmdOutputParameterFile, "file" );
+//<directory> //parameter to be parsed
+
+//HEAP DUMP
+_LIT( KMemSpyCmdHeapDump, "heapdump" );
+_LIT( KMemSpyCmdHeapDumpParameterAll, "all" ); //default
+_LIT( KMemSpyCmdHeapDumpParameterKernel, "kernel" ); //kernel heap dump
+
+//SWMT
+_LIT( KMemSpyCmdSwmt, "swmt" );
+_LIT( KMemSpyCmdSwmtParameterStarttimer, "starttimer" ); //<value in seconds> optionaly
+_LIT( KMemSpyCmdSwmtParameterStoptimer, "stoptimer" );
+_LIT( KMemSpyCmdSwmtParameterDumpnow, "dumpnow" );
+
+//KILL SERVER
+_LIT( KMemSpyCmdKillServer, "killserver"); //kills the server in case of it is running
+
+//SWMT CATEGORIES (TYPES)
+_LIT( KMemSpyCmdSWMTTypeHeap,                    "heap" );
+_LIT( KMemSpyCmdSWMTTypeChunk,                   "chnk" );
+_LIT( KMemSpyCmdSWMTTypeCode,                    "code" );
+_LIT( KMemSpyCmdSWMTTypeStack,                   "stak" );
+_LIT( KMemSpyCmdSWMTTypeGlobalData,              "glob" );
+_LIT( KMemSpyCmdSWMTTypeRamDrive,                "ramd" );
+_LIT( KMemSpyCmdSWMTTypeOpenFile,                "file" );
+_LIT( KMemSpyCmdSWMTTypeDiskSpace,               "disk" );
+_LIT( KMemSpyCmdSWMTTypeHandleGeneric,           "hgen" );
+_LIT( KMemSpyCmdSWMTTypeFbserv,                  "fabs" );
+_LIT( KMemSpyCmdSWMTTypeFileServerCache,         "f32c" );
+_LIT( KMemSpyCmdSWMTTypeSystemMemory,            "sysm" );
+_LIT( KMemSpyCmdSWMTTypeWindowGroup,             "wndg" );
+_LIT( KMemSpyCmdSWMTTypeAll,					 "all"	); //default value, dumps all categories expect heap dumps	
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/CommandLine/Source/MemSpyCommandLine.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,698 @@
+/*
+* 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"
+
+// System includes
+#include <bacline.h>
+#include <bautils.h>
+#include <memspyengineclientinterface.h>
+#include <memspysession.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+// User includes
+#include "MemSpyCommands.h"
+
+/*
+CMemSpyCommandLine::CMemSpyCommandLine()
+    {	
+    }
+*/
+
+CMemSpyCommandLine::CMemSpyCommandLine( CConsoleBase& aConsole )
+	: CActive( EPriorityHigh ), iConsole( aConsole )
+    {	
+	CActiveScheduler::Add( this );
+    }
+
+CMemSpyCommandLine::~CMemSpyCommandLine()
+    {
+	Cancel();
+	
+    if ( iMemSpySession )
+        {
+        iMemSpySession->Close();
+        }
+    delete iMemSpySession;
+    iFsSession.Close();
+    }
+
+
+void CMemSpyCommandLine::ConstructL()
+    {
+    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;
+    }
+
+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();
+
+        // 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 );
+
+        // 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();
+
+#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 ) );
+        }
+#else
+    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 );
+
+	    // 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( paramCount == 2 )
+					{
+					TBuf<KMaxFileName> directory;
+					directory.Copy( aParameters[1] );
+					iMemSpySession->SwitchOutputToFileL( directory );
+					}
+				else
+					{
+					iMemSpySession->SwitchOutputToFileL( KNullDesC );
+					}
+				}
+			else if( aParameters[0].CompareF( KMemSpyCmdOutputParameterTrace ) == 0)
+				{
+				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 ) );			
+			// Dump heap data for all threads - Thread agnostic operation					
+			iMemSpySession->OutputHeapData();
+			// Dump kernel heap data
+			iMemSpySession->OutputThreadHeapDataL( KMemSpyClientServerThreadIdKernel );					
+			}
+		else if( paramCount >= 1)
+			{
+			if( aParameters[0].CompareF( KMemSpyCmdHeapDumpParameterAll ) == 0 )
+				{
+				iMemSpySession->OutputHeapData();				
+				iMemSpySession->OutputThreadHeapDataL( KMemSpyClientServerThreadIdKernel );				
+				}
+			else if( aParameters[0].CompareF( KMemSpyCmdHeapDumpParameterKernel ) == 0 )
+				{
+				TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_DumpKernel", this ) );
+				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 );
+				}
+  			}
+		}
+    
+    // --- 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
+			{
+			TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - dumpnow command", this ) );
+			TInt category = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
+			iMemSpySession->SetSwmtCategoriesL( category );			
+			iMemSpySession->ForceSwmtUpdateL();			
+			}
+		else if( paramCount >= 1)
+			{
+			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
+				    	{
+						if( result >= KMemSpySysMemTrackerConfigMinTimerPeriod && result <= KMemSpySysMemTrackerConfigMaxTimerPeriod )
+							{
+							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();									
+				//	}	
+				}
+			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)
+				{
+				categories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
+				if( paramCount >= 2 ) // user gave some optional parameters - <categories>
+					{
+					TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) );
+					}				
+																
+				if( !err )
+					{
+					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
+				{
+				TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) );
+				if( !err )
+					{
+					iMemSpySession->SetSwmtCategoriesL( categories );
+					if( threadNameFilter.Length() > 0 )
+						{
+						iMemSpySession->SetSwmtFilter( threadNameFilter );
+						}
+					}								
+					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 ) );
+
+    // 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() );
+        }
+
+    // Spacer
+    RDebug::Printf( " " );
+    }
+
+
+void CMemSpyCommandLine::ConnectToMemSpyL()
+    {
+    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 ) );
+
+    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 ) );
+        }
+
+    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 ) );
+
+    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.Resume();
+
+		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - MemSpy resumed, waiting for Rendezvous... - this: 0x%08x", this ) );
+
+		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 )
+			{
+			TFullName 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.Resume();
+	
+			TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - MemSpy resumed, waiting for Rendezvous... - this: 0x%08x", this ) );
+			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() - 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 );
+
+    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 );
+        }
+
+    // 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 );
+
+    // 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 );
+            }
+        }
+
+    // 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 ) );
+
+    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;
+    }
+
+
+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;
+    }
+
+
+//CLI status messages methods
+void CMemSpyCommandLine::RedrawInputPrompt()
+    {
+    iConsole.SetCursorPosAbs( iCommandPromptPos );
+    iConsole.ClearToEndOfLine();
+    iConsole.Printf( KMemSpyCLIInputPrompt, &iCommandBuffer );
+    }
+
+
+void CMemSpyCommandLine::RedrawStatusMessage()
+    {
+    RedrawStatusMessage( KNullDesC );
+    }
+
+
+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();
+    }
+
+void CMemSpyCommandLine::DoCancel()
+    {
+    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 ) );
+                }
+
+            RedrawInputPrompt();
+            }
+        }
+
+    WaitForInput();
+    }
+
+TInt CMemSpyCommandLine::RunError( TInt aError )
+	{	
+	return KErrNone;
+	}
+
+void CMemSpyCommandLine::ProcessCommandBufferL()
+    {
+    iCommandBuffer.Trim();
+    //
+#ifdef _DEBUG
+    RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - cmd: [%S]"), &iCommandBuffer );
+#endif
+    //
+    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();
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/CommandLine/Source/MemSpyCommandLineMain.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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:
+*
+*/
+
+// System includes
+#include <e32std.h>
+#include <f32file.h>
+#include <e32base.h>
+#include <e32cons.h>
+#include <f32file.h>
+#include <bacline.h>
+
+// User includes
+#include "MemSpyCommandLine.h"
+#include "MemSpyCommands.h"
+
+// ---------------------------------------------------------------------------
+// DoMainL()
+// 
+// 
+// ---------------------------------------------------------------------------
+static void DoMainL()
+    {
+    // Scheduler
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
+    CActiveScheduler::Install( scheduler );
+    CleanupStack::PushL( scheduler );
+    
+    // Get command line 
+    CCommandLineArguments* args = CCommandLineArguments::NewLC();
+    
+    //--
+    CConsoleBase* console = Console::NewL( KMemSpyCLIName, TSize( KConsFullScreen, KConsFullScreen ) );
+    CleanupStack::PushL( console );
+    //--
+    
+    // Command line manager
+    CMemSpyCommandLine* commandLineMgr = CMemSpyCommandLine::NewLC( *console );
+
+    // Play nicely with external processes
+    RProcess::Rendezvous( KErrNone );
+
+    // Perform op
+    commandLineMgr->PerformOpL( *args );  
+        
+    // Tidy up
+    //CleanupStack::PopAndDestroy( 3, scheduler ); // scheduler, args, commandLineMgr
+    CleanupStack::PopAndDestroy( 4 ); // scheduler, args,  console, commandLineMgr
+    }
+   
+
+
+// ---------------------------------------------------------------------------
+// E32Main()
+// 
+// 
+// ---------------------------------------------------------------------------
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+
+#ifdef _DEBUG
+    RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - Thread %d is STARTING"), (TUint) RThread().Id() );
+#endif
+
+    CTrapCleanup* cleanupTrap = CTrapCleanup::New();
+    TRAPD(err, DoMainL());  
+    if  ( err != KErrNone )
+        {
+        RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - error: %d"), err);
+        }
+    delete cleanupTrap; 
+
+    __UHEAP_MARKEND;
+
+#ifdef _DEBUG
+    RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - Thread %d is ENDING"), (TUint) RThread().Id() );
+#endif
+
+    return err;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/CommandLine/group/MemSpyCommandLine.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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 <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          MemSpy.exe
+TARGETTYPE      exe
+UID             0x1000008d 0x2002129D
+VENDORID		VID_DEFAULT
+SMPSAFE
+
+CAPABILITY		WriteDeviceData
+
+SOURCEPATH      ../Source
+SOURCE          MemSpyCommandLine.cpp
+SOURCE          MemSpyCommandLineMain.cpp
+
+
+USERINCLUDE     ../Include
+
+
+OS_LAYER_SYSTEMINCLUDE
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         MemSpyClient.lib
+
+LIBRARY					euser.lib 
+LIBRARY 				efsrv.lib 
+LIBRARY 				bafl.lib 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/CommandLine/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+MemSpyCommandLine.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/Include/ConsoleConstants.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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 CONSOLE_CONSTANTS_H
+#define CONSOLE_CONSTANTS_H
+
+// System includes
+#include <e32std.h>
+
+// Literal constants
+_LIT( KMemSpyConsoleNewLine, "\r\n" );
+_LIT( KMemSpyConsoleName, "MemSpy Console" );
+_LIT( KMemSpyConsoleInputPrompt, " > %S" );
+_LIT( KMemSpyConsoleWildcardCharacter, "*" );
+
+// Numerical constants
+const TInt KMemSpyMaxDisplayLengthThreadName = 48;
+const TInt KMemSpyMaxDisplayLengthSizeText = 14;
+const TInt KMemSpyMaxInputBufferLength = 200;
+
+// Key constants (S60)
+const TInt KMemSpyUiS60KeyCodeButtonOk = 2000;
+const TInt KMemSpyUiS60KeyCodeButtonCancel = 2001;
+const TInt KMemSpyUiS60KeyCodeRockerEnter = 63557;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/Include/ConsoleDWOperation.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 CONSOLEDWOPERATION_H
+#define CONSOLEDWOPERATION_H
+
+// Engine includes
+#include <memspy/engine/memspydevicewideoperations.h>
+
+// Classes referenced
+class CMemSpyEngine;
+
+
+class CMemSpyDeviceWideOperationWaiter : public CBase, public MMemSpyDeviceWideOperationsObserver
+    {
+public:
+    static void ExecuteLD( CMemSpyEngine& aEngine, CMemSpyDeviceWideOperations::TOperation aOperation );
+    ~CMemSpyDeviceWideOperationWaiter();
+
+private:
+    CMemSpyDeviceWideOperationWaiter( CMemSpyEngine& aEngine );
+    void ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation );
+
+private: // From MMemSpyDeviceWideOperationsObserver
+    void HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 );
+
+private: // Internal 
+    void StopWait();
+
+private: // Member data
+    CMemSpyEngine& iEngine;
+    CActiveSchedulerWait* iWaiter;
+    CMemSpyDeviceWideOperations* iOperation;
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/Include/ConsoleMenu.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* 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 CONSOLEMENU_H
+#define CONSOLEMENU_H
+
+// System includes
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32hashtab.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobserver.h>
+#include <memspysession.h>
+// User includes
+#include "ConsoleConstants.h"
+
+// Classes referenced
+class CConsoleBase;
+class RMemSpySession;
+
+class CMemSpyConsoleMenu : public CActive, public MMemSpyEngineObserver
+    {
+public:
+    static CMemSpyConsoleMenu* NewLC( RMemSpySession& aSession, CConsoleBase& aConsole );
+    ~CMemSpyConsoleMenu();
+
+private:
+    CMemSpyConsoleMenu( RMemSpySession& aEngine, CConsoleBase& aConsole );
+    void ConstructL();
+
+public: // API
+    void DrawMenuL();
+    void WaitForInput();
+
+private: // From CActive
+    void RunL();
+    void DoCancel();
+
+private: // From MMemSpyEngineObserver
+    void HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext );
+
+private: // Command handlers
+    void OnCmdSinkTypeToggleL();
+    void OnCmdKernelObjectListingL();
+    void OnCmdHeapDataKernelL();
+    void OnCmdHeapDataUserL();
+    void OnCmdCSVListingHeapL();
+    void OnCmdCSVListingStackL();
+    void OnCmdHeapCellListUserL();
+
+private: // Internal methods
+    void ClearCommandBuffer();
+    void ProcessCommandBufferL();
+    void RedrawInputPrompt();
+    void RedrawStatusMessage();
+    void RedrawStatusMessage( const TDesC& aMessage );
+    void GetProcessName();
+    void InitiateMemSpyClientServerOperationL( TInt aOpCode );
+
+private: // Data members
+    RMemSpySession& iSession;
+    CConsoleBase& iConsole;
+    
+    TMemSpyOutputType iOutputType;
+    //
+    TBuf<KMemSpyMaxInputBufferLength> iCommandBuffer;
+    TPoint iCommandPromptPos;
+    TPoint iStatusMessagePos;
+    TBool iRunningDeviceWideOperation;
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/Source/ConsoleDWOperation.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* 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 "ConsoleDWOperation.h"
+
+// System includes
+#include <e32debug.h>
+
+
+CMemSpyDeviceWideOperationWaiter::CMemSpyDeviceWideOperationWaiter( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+
+CMemSpyDeviceWideOperationWaiter::~CMemSpyDeviceWideOperationWaiter()
+    {
+#ifdef _DEBUG
+    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::~CMemSpyDeviceWideOperationWaiter() - START" );
+#endif
+
+#ifdef _DEBUG
+    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::~CMemSpyDeviceWideOperationWaiter() - deleting operation...: 0x%08x", iOperation );
+#endif
+    delete iOperation;
+
+#ifdef _DEBUG
+    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::~CMemSpyDeviceWideOperationWaiter() - deleting waiter...: 0x%08x", iWaiter );
+#endif
+    delete iWaiter;
+
+#ifdef _DEBUG
+    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::~CMemSpyDeviceWideOperationWaiter() - END" );
+#endif
+    }
+
+
+void CMemSpyDeviceWideOperationWaiter::ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation )
+    {
+#ifdef _DEBUG
+    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::ExecuteL() - START" );
+#endif
+
+    iWaiter = new(ELeave) CActiveSchedulerWait();
+    //iOperation = CMemSpyDeviceWideOperations::NewL( iEngine, *this, aOperation );
+
+#ifdef _DEBUG
+    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::ExecuteL() - starting scheduler wait..." );
+#endif
+
+    iWaiter->Start();
+
+#ifdef _DEBUG
+    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::ExecuteL() - END" );
+#endif
+    }
+
+void CMemSpyDeviceWideOperationWaiter::ExecuteLD( CMemSpyEngine& aEngine, CMemSpyDeviceWideOperations::TOperation aOperation )
+    {
+    CMemSpyDeviceWideOperationWaiter* self = new(ELeave) CMemSpyDeviceWideOperationWaiter( aEngine );
+    CleanupStack::PushL( self );
+    self->ExecuteL( aOperation );
+    CleanupStack::PopAndDestroy( self );
+    }
+
+
+void CMemSpyDeviceWideOperationWaiter::StopWait()
+    {
+#ifdef _DEBUG
+    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::StopWait() - START - iOperation: 0x%08x", iOperation );
+#endif
+
+    if  ( iWaiter->IsStarted() )
+        {
+        iWaiter->AsyncStop();
+        }
+
+#ifdef _DEBUG
+    RDebug::Printf("[MCon] CMemSpyDeviceWideOperationWaiter::StopWait() - END" );
+#endif
+    }
+
+
+void CMemSpyDeviceWideOperationWaiter::HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 )
+    {
+#ifdef _DEBUG
+    RDebug::Print( _L("[MCon] CMemSpyDeviceWideOperationWaiter::HandleDeviceWideOperationEvent() - START - aEvent: %d, aParam1: %d, aParam2: %S"), aEvent, aParam1, &aParam2 );
+#else
+    (void) aParam1;
+    (void) aParam2;
+#endif
+
+    switch( aEvent )
+        {
+    case MMemSpyDeviceWideOperationsObserver::EOperationCompleted:
+        StopWait();
+        break;
+    default:
+    case MMemSpyDeviceWideOperationsObserver::EOperationSized:
+    case MMemSpyDeviceWideOperationsObserver::EOperationStarting:
+    case MMemSpyDeviceWideOperationsObserver::EOperationProgressStart:
+    case MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd:
+    case MMemSpyDeviceWideOperationsObserver::EOperationCancelled:
+    case MMemSpyDeviceWideOperationsObserver::EOperationCompleting:
+        break;
+        }
+
+#ifdef _DEBUG
+    RDebug::Print( _L("[MCon] CMemSpyDeviceWideOperationWaiter::HandleDeviceWideOperationEvent() - END - aEvent: %d, aParam1: %d, aParam2: %S"), aEvent, aParam1, &aParam2 );
+#endif
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/Source/ConsoleMain.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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:
+*
+*/
+
+// System includes
+#include <e32std.h>
+#include <e32test.h>
+#include <f32file.h>
+#include <e32base.h>
+#include <e32cons.h>
+#include <f32file.h>
+#include <bacline.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspysession.h>
+
+// User includes
+#include "ConsoleMenu.h"
+#include "ConsoleConstants.h"
+
+
+// ---------------------------------------------------------------------------
+// DoMainL()
+// 
+// 
+// ---------------------------------------------------------------------------
+static void DoMainL()
+    {
+    // Scheduler
+    CActiveScheduler* scheduler = new CActiveScheduler();
+    CActiveScheduler::Install( scheduler );
+    CleanupStack::PushL( scheduler );
+
+    // F32
+    RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() );
+    CleanupClosePushL( fsSession );
+    
+    // Console
+	CConsoleBase* console = Console::NewL( KMemSpyConsoleName, TSize( KConsFullScreen, KConsFullScreen ) );
+	CleanupStack::PushL( console );
+
+    // Engine
+    RMemSpySession session;
+    User::LeaveIfError(session.Connect());
+    CleanupClosePushL(session);
+
+    // Menu & event handler AO
+    CMemSpyConsoleMenu::NewLC( session, *console );
+
+    // Play nicely with external processes
+    RProcess::Rendezvous( KErrNone );
+
+    // Start wait loop - console will stop it when done.
+    CActiveScheduler::Start();
+
+    // Tidy up
+    CleanupStack::PopAndDestroy( 5, scheduler );
+    }
+   
+
+
+// ---------------------------------------------------------------------------
+// E32Main()
+// 
+// 
+// ---------------------------------------------------------------------------
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+    RDebug::Print(_L("[MCon] E32Main() - MEMSPY CONSOLE"));
+
+    CTrapCleanup* cleanupTrap = CTrapCleanup::New();
+    TRAPD(err, DoMainL());  
+    if  ( err != KErrNone )
+        {
+        RDebug::Printf( " " );
+        RDebug::Printf( " " );
+        RDebug::Print(_L("[MCon] E32Main() - MEMSPY CONSOLE - error: %d"), err);
+        if ( err == KErrAlreadyExists )
+            {
+            RDebug::Printf( "\t\t [MCon] NB: MemSpy and MemSpyConsoleUi cannot run simultaneously!", err);
+            RDebug::Printf( " " );
+            RDebug::Printf( " " );
+            }
+        }
+    delete cleanupTrap; 
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/Source/ConsoleMenu.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,649 @@
+/*
+* 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 "ConsoleMenu.h"
+
+// System includes
+#include <e32debug.h>
+
+// Engine includes
+#include <memspyengineclientinterface.h>
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyenginehelperstack.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspydevicewideoperations.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperkernelcontainers.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+
+// User includes
+#include "ConsoleConstants.h"
+#include "ConsoleDWOperation.h"
+
+
+CMemSpyConsoleMenu::CMemSpyConsoleMenu( RMemSpySession& aSession, CConsoleBase& aConsole )
+:   CActive( EPriorityHigh ), iSession( aSession ), iConsole( aConsole ), iOutputType(EOutputTypeDebug)
+    {
+    CActiveScheduler::Add( this );
+    // TODO: iEngine.SetObserver( this );
+    }
+
+
+CMemSpyConsoleMenu::~CMemSpyConsoleMenu()
+    {
+    Cancel();
+    }
+
+
+void CMemSpyConsoleMenu::ConstructL()
+    {
+    DrawMenuL();
+    WaitForInput();
+    }
+
+
+CMemSpyConsoleMenu* CMemSpyConsoleMenu::NewLC( RMemSpySession& aSession, CConsoleBase& aConsole )
+    {
+    CMemSpyConsoleMenu* self = new(ELeave) CMemSpyConsoleMenu( aSession, aConsole );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+void CMemSpyConsoleMenu::DrawMenuL()
+    {
+    iConsole.ClearScreen();
+   
+    // First line - sink type (defaults to file)
+    _LIT( KLine1, "1 or T. Toggle output mode between file or trace [%S]" );
+    if  ( iOutputType == EOutputTypeDebug )
+        {
+        _LIT( KLine1Trace, "Trace" );
+        iConsole.Printf( KLine1, &KLine1Trace );
+        }
+    else
+        {
+        _LIT( KLine1File, "File" );
+        iConsole.Printf( KLine1, &KLine1File );
+        }
+    iConsole.Write( KMemSpyConsoleNewLine );
+
+    // Kernel heap dump
+    _LIT( KLine2, "2 or K. Dump kernel heap data" );
+    iConsole.Write( KLine2 );
+    iConsole.Write( KMemSpyConsoleNewLine );
+
+    // Kernel heap dump
+    _LIT( KLine3, "3 or O. Dump kernel object listing" );
+    iConsole.Write( KLine3 );
+    iConsole.Write( KMemSpyConsoleNewLine );
+
+    // Heap (CSV) listing
+    _LIT( KLine4, "4 or H. Heap CSV-information (for all threads)" );
+    iConsole.Write( KLine4 );
+    iConsole.Write( KMemSpyConsoleNewLine );
+
+    // Stack (CSV) listing
+    _LIT( KLine5, "5 or S. Stack CSV-information (for all threads)" );
+    iConsole.Write( KLine5 );
+    iConsole.Write( KMemSpyConsoleNewLine );
+
+    // Heap data
+    _LIT( KLine6, "6 or D. Get heap data for a user-thread" );
+    iConsole.Write( KLine6 );
+    iConsole.Write( KMemSpyConsoleNewLine );
+
+    // Heap cell listing
+    _LIT( KLine7, "7 or L. Get heap cell list for a user-thread" );
+    iConsole.Write( KLine7 );
+    iConsole.Write( KMemSpyConsoleNewLine );
+
+    // Exit key
+    _LIT( KLine8, "8 or X. Exit" );
+    iConsole.Write( KLine8 );
+    iConsole.Write( KMemSpyConsoleNewLine );
+
+    // Spacer
+    iConsole.Write( KMemSpyConsoleNewLine );
+    iConsole.Write( KMemSpyConsoleNewLine );
+
+    // Status message
+    iStatusMessagePos = iConsole.CursorPos();
+    RedrawStatusMessage();
+
+    // Spacer
+    iConsole.Write( KMemSpyConsoleNewLine );
+
+    // Show input prompt.
+    iCommandPromptPos = iConsole.CursorPos();
+    RedrawInputPrompt();
+    }
+
+
+void CMemSpyConsoleMenu::WaitForInput()
+    {
+    ASSERT( !IsActive() );
+    iConsole.Read( iStatus );
+    SetActive();
+    }
+
+
+void CMemSpyConsoleMenu::RunL()
+    {
+    TKeyCode key = iConsole.KeyCode();
+    //
+#ifdef _DEBUG
+    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::RunL() - START - key = %d", key );
+#endif
+    //
+    if  ( key == EKeyEnter || key == KMemSpyUiS60KeyCodeButtonOk || key == KMemSpyUiS60KeyCodeRockerEnter )
+        {
+        TRAP_IGNORE( ProcessCommandBufferL() );
+        }
+    else if ( key == EKeyEscape || key == KMemSpyUiS60KeyCodeButtonCancel )
+        {
+        ClearCommandBuffer();
+        RedrawInputPrompt();
+        }   
+    else if ( key == EKeyBackspace )
+        {
+        const TInt cmdBufLength = iCommandBuffer.Length();
+        if  ( cmdBufLength > 0 )
+            {
+            iCommandBuffer.SetLength( cmdBufLength - 1 );
+            RedrawInputPrompt();
+            }
+        }
+    else
+        {
+        TChar character( key );
+        if  ( character.IsPrint() )
+            {
+            if  ( iCommandBuffer.Length() < iCommandBuffer.MaxLength() )
+                {
+                iCommandBuffer.Append( TChar( key ) );
+                }
+
+            RedrawInputPrompt();
+            }
+        }
+
+    WaitForInput();
+
+#ifdef _DEBUG
+    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::RunL() - END" );
+#endif
+    }
+
+
+void CMemSpyConsoleMenu::DoCancel()
+    {
+    iConsole.ReadCancel();
+    }
+
+
+void CMemSpyConsoleMenu::OnCmdSinkTypeToggleL()
+    {
+	iOutputType = iOutputType == EOutputTypeFile ? EOutputTypeDebug : EOutputTypeFile;
+    }
+
+
+void CMemSpyConsoleMenu::OnCmdHeapDataKernelL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataKernelL() - START" );
+#endif
+
+    _LIT( KMsg, "Ouputting Kernel data..." );
+    RedrawStatusMessage( KMsg );
+
+    iSession.OutputKernelHeapDataL( iOutputType );
+
+    RedrawStatusMessage( KNullDesC );
+    }
+
+
+void CMemSpyConsoleMenu::OnCmdKernelObjectListingL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdKernelObjectListingL() - START" );
+#endif
+
+    _LIT( KMsg, "Ouputting Kernel Object listing..." );
+    RedrawStatusMessage( KMsg );
+    //
+    iSession.OutputKernelObjectsL( iOutputType );
+
+    RedrawStatusMessage( KNullDesC );
+    }
+
+
+void CMemSpyConsoleMenu::OnCmdCSVListingStackL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdCSVListingStackL() - START" );
+#endif
+
+    iSession.OutputCompactStackInfoL( iOutputType );
+    }
+
+
+void CMemSpyConsoleMenu::OnCmdCSVListingHeapL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdCSVListingHeapL() - START" );
+#endif
+
+    iSession.OutputCompactHeapInfoL( iOutputType );
+    }
+
+
+void CMemSpyConsoleMenu::OnCmdHeapDataUserL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - START" );
+#endif
+
+    GetProcessName();
+
+    // Work out what to do.
+    iCommandBuffer.Trim();
+
+#ifdef _DEBUG
+    RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - requested dump heap for proc: %S"), &iCommandBuffer );
+#endif
+
+    if  ( iCommandBuffer.Length() > 0 )
+        {
+        iConsole.Write( KMemSpyConsoleNewLine );
+        iConsole.Write( KMemSpyConsoleNewLine );
+        //
+        HBufC* cmdBuf = HBufC::NewLC( KMemSpyMaxInputBufferLength + 10 );
+        TPtr pCmdBuf( cmdBuf->Des() );
+        pCmdBuf.Copy( iCommandBuffer );
+        pCmdBuf.Append( KMemSpyConsoleWildcardCharacter );
+        
+        TInt err;
+        TProcessId procId;
+        TRAP(err, procId = iSession.GetProcessIdByNameL(pCmdBuf));
+        //
+        if (err == KErrNone) 
+        	{
+        	RArray<CMemSpyApiThread*> threads;
+        	
+        	TRAP(err, iSession.GetThreadsL(procId, threads));
+        	if (err == KErrNone)
+        		{
+				_LIT( KProcessingRequest, "** Dumping Heap Data for thread: %S" );     	
+				TFullName fullThreadName;
+				
+                for( TInt i=0; i<threads.Count(); i++ )
+                    {
+                    CMemSpyApiThread* thread = threads[i];
+                    //
+                    fullThreadName = thread->Name();
+                    iConsole.Printf( KProcessingRequest, &fullThreadName );
+                    iConsole.Write( KMemSpyConsoleNewLine );
+                    //
+                    TRAP_IGNORE( iSession.OutputThreadHeapDataL(iOutputType, thread->Id()) );
+                    
+                    delete thread;
+                    }
+                }
+            }
+
+        CleanupStack::PopAndDestroy( cmdBuf );
+        DrawMenuL();
+        }
+    else
+        {
+        // Bad user data entry
+        DrawMenuL();
+        _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
+        RedrawStatusMessage( KInvalidEntry );
+        RedrawInputPrompt();
+        }
+    }
+
+
+void CMemSpyConsoleMenu::OnCmdHeapCellListUserL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapCellListUserL() - START" );
+#endif
+
+    GetProcessName();
+
+    // Work out what to do.
+    iCommandBuffer.Trim();
+    if  ( iCommandBuffer.Length() > 0 )
+        {
+        iConsole.Write( KMemSpyConsoleNewLine );
+        iConsole.Write( KMemSpyConsoleNewLine );
+        //
+        HBufC* cmdBuf = HBufC::NewLC( KMemSpyMaxInputBufferLength + 10 );
+        TPtr pCmdBuf( cmdBuf->Des() );
+        pCmdBuf.Copy( iCommandBuffer );
+        pCmdBuf.Append( KMemSpyConsoleWildcardCharacter );
+        
+        TInt err;
+		TProcessId procId;
+		TRAP(err, procId = iSession.GetProcessIdByNameL(pCmdBuf));
+		//
+		if (err == KErrNone) 
+			{
+			RArray<CMemSpyApiThread*> threads;
+			
+			TRAP(err, iSession.GetThreadsL(procId, threads));
+			if (err == KErrNone)
+				{
+				_LIT( KProcessingRequest, "** Dumping Heap Cell List for thread: %S" );     	
+				TFullName fullThreadName;
+				
+				for( TInt i=0; i<threads.Count(); i++ )
+					{
+					CMemSpyApiThread* thread = threads[i];
+					//
+					fullThreadName = thread->Name();
+					iConsole.Printf( KProcessingRequest, &fullThreadName );
+					iConsole.Write( KMemSpyConsoleNewLine );
+					//
+					TRAP_IGNORE( iSession.OutputThreadCellListL(iOutputType, thread->Id()) );
+					
+					delete thread;
+					}
+				}
+			}
+        
+        CleanupStack::PopAndDestroy( cmdBuf );
+        DrawMenuL();
+        }
+    else
+        {
+        // Bad user data entry
+        DrawMenuL();
+        _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
+        RedrawStatusMessage( KInvalidEntry );
+        RedrawInputPrompt();
+        }
+    }
+
+
+void CMemSpyConsoleMenu::ClearCommandBuffer()
+    {
+    iCommandBuffer.Zero();
+    }
+
+
+void CMemSpyConsoleMenu::ProcessCommandBufferL()
+    {
+    iCommandBuffer.Trim();
+    //
+#ifdef _DEBUG
+    RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - cmd: [%S]"), &iCommandBuffer );
+#endif
+    //
+    TBool validCommand = EFalse;
+    if  ( iCommandBuffer.Length() == 1 )
+        {
+        // Reset if not recognised...
+        validCommand = ETrue;
+
+        const TChar cmd = iCommandBuffer[ 0 ]; 
+        switch( cmd )
+            {
+        case '1':
+        case 't':
+        case 'T':
+            OnCmdSinkTypeToggleL();
+            break;
+        case '2':
+        case 'k':
+        case 'K':
+            OnCmdHeapDataKernelL();
+            break;
+        case '3':
+        case 'o':
+        case 'O':
+            OnCmdKernelObjectListingL();
+            break;
+        case '4':
+        case 'h':
+        case 'H':
+            OnCmdCSVListingHeapL();
+            break;
+        case '5':
+        case 's':
+        case 'S':
+            OnCmdCSVListingStackL();
+            break;
+        case '6':
+        case 'd':
+        case 'D':
+            OnCmdHeapDataUserL();
+            break;
+        case '7':
+        case 'l':
+        case 'L':
+            OnCmdHeapCellListUserL();
+            break;
+        case '8':
+        case 'x':
+        case 'X':
+            CActiveScheduler::Stop();
+            return; // NB: avoid redrawing menu when exiting
+
+        default:
+            validCommand = EFalse;
+            break;
+            }
+        }
+    //
+    ClearCommandBuffer();
+    //
+    if  ( !validCommand )
+        {
+        _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
+        RedrawStatusMessage( KInvalidEntry );
+        RedrawInputPrompt();
+        }
+    else
+        {
+        DrawMenuL();
+        }
+
+#ifdef _DEBUG
+    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - END" );
+#endif
+    }
+
+
+void CMemSpyConsoleMenu::RedrawInputPrompt()
+    {
+    iConsole.SetCursorPosAbs( iCommandPromptPos );
+    iConsole.ClearToEndOfLine();
+    iConsole.Printf( KMemSpyConsoleInputPrompt, &iCommandBuffer );
+    }
+
+
+void CMemSpyConsoleMenu::RedrawStatusMessage()
+    {
+    RedrawStatusMessage( KNullDesC );
+    }
+
+
+void CMemSpyConsoleMenu::RedrawStatusMessage( const TDesC& aMessage )
+    {
+    iConsole.SetCursorPosAbs( iStatusMessagePos );
+    iConsole.ClearToEndOfLine();
+    iConsole.Write( aMessage );
+    iConsole.Write( KMemSpyConsoleNewLine );
+    }
+
+
+void CMemSpyConsoleMenu::GetProcessName()
+    {
+    iConsole.ClearScreen();
+
+    _LIT( KPromptMessage1, "Enter the full or partial process name" );
+    iConsole.Write( KPromptMessage1 );
+    iConsole.Write( KMemSpyConsoleNewLine );
+    _LIT( KPromptMessage2, "of the process that you are interested in." );
+    iConsole.Write( KPromptMessage2 );
+    iConsole.Write( KMemSpyConsoleNewLine );
+    _LIT( KPromptMessage3, "Press \'enter\' when done." );
+    iConsole.Write( KPromptMessage3 );
+    iConsole.Write( KMemSpyConsoleNewLine );
+    //
+    ClearCommandBuffer();
+    iConsole.Write( KMemSpyConsoleNewLine );
+    iCommandPromptPos = iConsole.CursorPos();
+    RedrawInputPrompt();
+    //
+    TBool done = EFalse;
+    while( !done )
+        {
+        // Get a key
+        const TKeyCode key = iConsole.Getch();
+
+        // Process it
+#ifdef _DEBUG
+        RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - START - key = %d", key );
+#endif
+        //
+        if  ( key == EKeyEnter || key == KMemSpyUiS60KeyCodeButtonOk || key == KMemSpyUiS60KeyCodeRockerEnter )
+            {
+            done = ETrue;
+            }
+        else if ( key == EKeyEscape || key == KMemSpyUiS60KeyCodeButtonCancel )
+            {
+            ClearCommandBuffer();
+            done = ETrue;
+            }   
+        else if ( key == EKeyBackspace )
+            {
+            const TInt cmdBufLength = iCommandBuffer.Length();
+            if  ( cmdBufLength > 0 )
+                {
+                iCommandBuffer.SetLength( cmdBufLength - 1 );
+                RedrawInputPrompt();
+                }
+            }
+        else
+            {
+            TChar character( key );
+            if  ( character.IsPrint() )
+                {
+                if  ( iCommandBuffer.Length() < iCommandBuffer.MaxLength() )
+                    {
+                    iCommandBuffer.Append( TChar( key ) );
+                    }
+
+                RedrawInputPrompt();
+                }
+            }
+        }
+    }
+
+
+void CMemSpyConsoleMenu::HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext )
+    {
+    if  ( aEvent == MMemSpyEngineObserver::EHandleClientServerOperationRequest )
+        {
+        const TInt function = reinterpret_cast< TInt >( aContext );
+        InitiateMemSpyClientServerOperationL( function );
+        }
+    }
+
+
+void CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL( TInt aOpCode )
+    {
+	// TODO: ....
+//#ifdef _DEBUG
+//    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL() - START - aOpCode: %d, iRunningDeviceWideOperation: %d", aOpCode, iRunningDeviceWideOperation );
+//#endif
+//    //
+//    if ( aOpCode == EMemSpyClientServerOpExit )
+//        {
+//        // Exit console app UI
+//        CActiveScheduler::Stop();
+//        }
+//    else
+//        {
+//        CMemSpyDeviceWideOperations::TOperation op = CMemSpyDeviceWideOperations::EPerEntityGeneralSummary;
+//        switch( aOpCode )
+//            {
+//        case EMemSpyClientServerOpSummaryInfo:
+//            op = CMemSpyDeviceWideOperations::EPerEntityGeneralSummary;
+//            break;
+//        case EMemSpyClientServerOpSummaryInfoDetailed:
+//            op = CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed;
+//            break;
+//        //
+//        case EMemSpyClientServerOpHeapInfo:
+//            op = CMemSpyDeviceWideOperations::EPerEntityHeapInfo;
+//            break;
+//        case EMemSpyClientServerOpHeapCellListing:
+//            op = CMemSpyDeviceWideOperations::EPerEntityHeapCellListing;
+//            break;
+//        case EMemSpyClientServerOpHeapData:
+//            op = CMemSpyDeviceWideOperations::EPerEntityHeapData;
+//            break;
+//        //
+//        case EMemSpyClientServerOpStackInfo:
+//            op = CMemSpyDeviceWideOperations::EPerEntityStackInfo;
+//            break;
+//        case EMemSpyClientServerOpStackDataUser:
+//            op = CMemSpyDeviceWideOperations::EPerEntityStackDataUser;
+//            break;
+//        case EMemSpyClientServerOpStackDataKernel:
+//            op = CMemSpyDeviceWideOperations::EPerEntityStackDataKernel;
+//            break;
+//        
+//        // These are not supported by the console UI
+//        default:
+//        case EMemSpyClientServerOpBitmapsSave:
+//        case EMemSpyClientServerOpSendToBackground:
+//        case EMemSpyClientServerOpBringToForeground:
+//            User::Leave( KErrNotSupported );
+//            break;
+//            }
+//
+//        if  ( iRunningDeviceWideOperation )
+//            {
+//            User::Leave( KErrInUse );
+//            }
+//        else
+//            {
+//            iRunningDeviceWideOperation = ETrue;
+//            TRAP_IGNORE( CMemSpyDeviceWideOperationWaiter::ExecuteLD( iEngine, op ) );
+//            iRunningDeviceWideOperation = EFalse;
+//            }
+//        }
+//
+//#ifdef _DEBUG
+//    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL() - END - aOpCode: %d", aOpCode );
+//#endif
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/data/MemSpyEComInterfaceIds.xml	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,18 @@
+<?xml version="1.0" standalone="yes"?>
+<memspy_ecom_sections>
+
+    <category name="Messaging">
+		<interface uid="0xABCD1234" name="Watchers" />
+    </category>
+
+    <category name="App-Protocols">
+		<interface uid="0x101F446D" name="HTTP Filters" />
+		<interface uid="0x1000A449" name="HTTP Protocol" />
+    </category>
+
+    <category name="S60 AIW">
+		<interface uid="0x101F8650" name="AIW Class Base" />
+		<interface uid="0x101F8652" name="AIW Class Menu" />
+    </category>
+
+</memspy_ecom_sections>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/data/MemSpyProcessMemoryTrackingAutoStartConfig.xml	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" standalone="yes"?>
+<memspy_process_memory_tracking>
+
+    <process sid="0x100058EC"/>
+	<process sid="0x1000484B"/>
+
+</memspy_process_memory_tracking>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/data/backup_registration.xml	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,17 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration>
+
+    <passive_backup>
+        <include_directory name="\"/>
+        <exclude name="MemSpy_Passive_Excluded.txt"/>
+    </passive_backup>
+
+    <system_backup/>
+
+    <public_backup>
+        <include_directory name="C:\Data\Others\MemSpy\"/>
+    </public_backup>
+
+    <restore requires_reboot = "no"/>
+
+</backup_registration>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/group/MemSpyConsole.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* 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 <platform_paths.hrh>
+
+TARGET          memspyconsole.exe
+UID             0x10000000 0x2002129E
+TARGETTYPE      exe
+SMPSAFE
+
+#include		"../../group/MemSpyCapabilities.mmh"
+
+//EPOCSTACKSIZE   0x4000
+//EPOCHEAPSIZE	0x100000 0x4000000
+
+
+SOURCEPATH      ../Source
+SOURCE          ConsoleMain.cpp
+SOURCE          ConsoleMenu.cpp
+SOURCE          ConsoleDWOperation.cpp
+
+USERINCLUDE     ../Include
+
+OS_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib 
+
+LIBRARY		MemSpyClient.lib
+LIBRARY     MemSpyEngine.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Console/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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:
+*
+*/
+
+
+PRJ_EXPORTS
+../data/MemSpyEComInterfaceIds.xml									z:/private/2002129E/memspyecominterfaceids.xml
+../data/MemSpyProcessMemoryTrackingAutoStartConfig.xml				z:/private/2002129E/memspyprocessmemorytrackingautostartconfig.xml
+../data/backup_registration.xml										z:/private/2002129E/backup_registration.xml
+
+
+PRJ_MMPFILES
+//MemSpyConsole.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/BWINS/memspydriverclientu.def	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,71 @@
+EXPORTS
+	?Close@RMemSpyDriverClient@@QAEXXZ @ 1 NONAME ; void RMemSpyDriverClient::Close(void)
+	?Close@RMemSpyMemStreamReader@@QAEXXZ @ 2 NONAME ; void RMemSpyMemStreamReader::Close(void)
+	?EventMonitorClose@RMemSpyDriverClient@@QAEHI@Z @ 3 NONAME ; int RMemSpyDriverClient::EventMonitorClose(unsigned int)
+	?EventMonitorNotify@RMemSpyDriverClient@@QAEXIAAVTRequestStatus@@AAI@Z @ 4 NONAME ; void RMemSpyDriverClient::EventMonitorNotify(unsigned int, class TRequestStatus &, unsigned int &)
+	?EventMonitorNotifyCancel@RMemSpyDriverClient@@QAEXI@Z @ 5 NONAME ; void RMemSpyDriverClient::EventMonitorNotifyCancel(unsigned int)
+	?EventMonitorOpen@RMemSpyDriverClient@@QAEHAAI@Z @ 6 NONAME ; int RMemSpyDriverClient::EventMonitorOpen(unsigned int &)
+	?GetApproximateKernelObjectSize@RMemSpyDriverClient@@QAEHW4TMemSpyDriverContainerType@@@Z @ 7 NONAME ; int RMemSpyDriverClient::GetApproximateKernelObjectSize(enum TMemSpyDriverContainerType)
+	?GetChunkHandles@RMemSpyDriverClient@@QAEHPAPAXAAH@Z @ 8 NONAME ; int RMemSpyDriverClient::GetChunkHandles(void * *, int &)
+	?GetChunkHandlesForProcess@RMemSpyDriverClient@@QAEHIPAPAXAAH@Z @ 9 NONAME ; int RMemSpyDriverClient::GetChunkHandlesForProcess(unsigned int, void * *, int &)
+	?GetChunkHandlesForThread@RMemSpyDriverClient@@QAEHIPAPAXAAH@Z @ 10 NONAME ; int RMemSpyDriverClient::GetChunkHandlesForThread(unsigned int, void * *, int &)
+	?GetChunkInfo@RMemSpyDriverClient@@QAEHPAXAAVTMemSpyDriverChunkInfo@@@Z @ 11 NONAME ; int RMemSpyDriverClient::GetChunkInfo(void *, class TMemSpyDriverChunkInfo &)
+	?GetChunkInfo@RMemSpyDriverClient@@QAEHPAXAAVTMemSpyDriverChunkInfoWithoutName@@@Z @ 12 NONAME ; int RMemSpyDriverClient::GetChunkInfo(void *, class TMemSpyDriverChunkInfoWithoutName &)
+	?GetCodeSegInfo@RMemSpyDriverClient@@QAEHPAXIAAVTMemSpyDriverCodeSegInfo@@@Z @ 13 NONAME ; int RMemSpyDriverClient::GetCodeSegInfo(void *, unsigned int, class TMemSpyDriverCodeSegInfo &)
+	?GetCodeSegs@RMemSpyDriverClient@@QAEHIPAPAXAAH@Z @ 14 NONAME ; int RMemSpyDriverClient::GetCodeSegs(unsigned int, void * *, int &)
+	?GetCodeSegs@RMemSpyDriverClient@@QAEHPAPAXAAHH@Z @ 15 NONAME ; int RMemSpyDriverClient::GetCodeSegs(void * *, int &, int)
+	?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> &)
+	?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> &)
+	?GetHeapInfoUser@RMemSpyDriverClient@@QAEHAAVTMemSpyHeapInfo@@I@Z @ 23 NONAME ; int RMemSpyDriverClient::GetHeapInfoUser(class TMemSpyHeapInfo &, unsigned int)
+	?GetHeapInfoUser@RMemSpyDriverClient@@QAEHAAVTMemSpyHeapInfo@@IAAV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 24 NONAME ; int RMemSpyDriverClient::GetHeapInfoUser(class TMemSpyHeapInfo &, unsigned int, class RArray<class TMemSpyDriverFreeCell> &)
+	?GetPAndSInfo@RMemSpyDriverClient@@QAEHPAXAAVTMemSpyDriverPAndSInfo@@@Z @ 25 NONAME ; int RMemSpyDriverClient::GetPAndSInfo(void *, class TMemSpyDriverPAndSInfo &)
+	?GetProcessHandlesByType@RMemSpyDriverClient@@QAEHHW4TMemSpyDriverContainerType@@PAPAXAAH@Z @ 26 NONAME ; int RMemSpyDriverClient::GetProcessHandlesByType(int, enum TMemSpyDriverContainerType, void * *, int &)
+	?GetProcessInfo@RMemSpyDriverClient@@QAEHIAAVTMemSpyDriverProcessInfo@@@Z @ 27 NONAME ; int RMemSpyDriverClient::GetProcessInfo(unsigned int, class TMemSpyDriverProcessInfo &)
+	?GetReferencesToMyProcess@RMemSpyDriverClient@@QAEHI@Z @ 28 NONAME ; int RMemSpyDriverClient::GetReferencesToMyProcess(unsigned int)
+	?GetReferencesToMyThread@RMemSpyDriverClient@@QAEHI@Z @ 29 NONAME ; int RMemSpyDriverClient::GetReferencesToMyThread(unsigned int)
+	?GetServerSessionHandles@RMemSpyDriverClient@@QAEHPAXPAPAXAAH@Z @ 30 NONAME ; int RMemSpyDriverClient::GetServerSessionHandles(void *, void * *, int &)
+	?GetServerSessionInfo@RMemSpyDriverClient@@QAEHPAXAAVTMemSpyDriverServerSessionInfo@@@Z @ 31 NONAME ; int RMemSpyDriverClient::GetServerSessionInfo(void *, class TMemSpyDriverServerSessionInfo &)
+	?GetStackData@RMemSpyDriverClient@@QAEHIAAVTDes8@@AAIW4TMemSpyDriverDomainType@@H@Z @ 32 NONAME ; int RMemSpyDriverClient::GetStackData(unsigned int, class TDes8 &, unsigned int &, enum TMemSpyDriverDomainType, int)
+	?GetStackDataNext@RMemSpyDriverClient@@QAEHIAAVTDes8@@AAIW4TMemSpyDriverDomainType@@H@Z @ 33 NONAME ; int RMemSpyDriverClient::GetStackDataNext(unsigned int, class TDes8 &, unsigned int &, enum TMemSpyDriverDomainType, int)
+	?GetStackInfo@RMemSpyDriverClient@@QAEHIAAVTMemSpyDriverStackInfo@@@Z @ 34 NONAME ; int RMemSpyDriverClient::GetStackInfo(unsigned int, class TMemSpyDriverStackInfo &)
+	?GetThreadHandlesByType@RMemSpyDriverClient@@QAEHHW4TMemSpyDriverContainerType@@PAPAXAAH@Z @ 35 NONAME ; int RMemSpyDriverClient::GetThreadHandlesByType(int, enum TMemSpyDriverContainerType, void * *, int &)
+	?GetThreadInfo@RMemSpyDriverClient@@QAEHIAAVTMemSpyDriverThreadInfo@@@Z @ 36 NONAME ; int RMemSpyDriverClient::GetThreadInfo(unsigned int, class TMemSpyDriverThreadInfo &)
+	?GetThreadsL@RMemSpyDriverClient@@QAEXABVTProcessId@@AAV?$RArray@VTThreadId@@@@@Z @ 37 NONAME ; void RMemSpyDriverClient::GetThreadsL(class TProcessId const &, class RArray<class TThreadId> &)
+	?GetVersion@RMemSpyDriverClient@@QAEXAAVTVersion@@@Z @ 38 NONAME ; void RMemSpyDriverClient::GetVersion(class TVersion &)
+	?Impersonate@RMemSpyDriverClient@@QAEHK@Z @ 39 NONAME ; int RMemSpyDriverClient::Impersonate(unsigned long)
+	?IsDebugKernel@RMemSpyDriverClient@@QAEHXZ @ 40 NONAME ; int RMemSpyDriverClient::IsDebugKernel(void)
+	?MemoryModelType@RMemSpyDriverClient@@QAE?AW4TMemSpyMemoryModelType@@XZ @ 41 NONAME ; enum TMemSpyMemoryModelType RMemSpyDriverClient::MemoryModelType(void)
+	?Open@RMemSpyDriverClient@@QAEHXZ @ 42 NONAME ; int RMemSpyDriverClient::Open(void)
+	?OpenProcess@RMemSpyDriverClient@@QAEHIAAVRProcess@@@Z @ 43 NONAME ; int RMemSpyDriverClient::OpenProcess(unsigned int, class RProcess &)
+	?OpenThread@RMemSpyDriverClient@@QAEHIAAVRThread@@@Z @ 44 NONAME ; int RMemSpyDriverClient::OpenThread(unsigned int, class RThread &)
+	?ProcessInspectionAutoStartItemsAdd@RMemSpyDriverClient@@QAEHI@Z @ 45 NONAME ; int RMemSpyDriverClient::ProcessInspectionAutoStartItemsAdd(unsigned int)
+	?ProcessInspectionAutoStartItemsReset@RMemSpyDriverClient@@QAEXXZ @ 46 NONAME ; void RMemSpyDriverClient::ProcessInspectionAutoStartItemsReset(void)
+	?ProcessInspectionClose@RMemSpyDriverClient@@QAEHI@Z @ 47 NONAME ; int RMemSpyDriverClient::ProcessInspectionClose(unsigned int)
+	?ProcessInspectionOpen@RMemSpyDriverClient@@QAEHI@Z @ 48 NONAME ; int RMemSpyDriverClient::ProcessInspectionOpen(unsigned int)
+	?ProcessInspectionRequestChanges@RMemSpyDriverClient@@QAEXIAAVTRequestStatus@@AAVTMemSpyDriverProcessInspectionInfo@@@Z @ 49 NONAME ; void RMemSpyDriverClient::ProcessInspectionRequestChanges(unsigned int, class TRequestStatus &, class TMemSpyDriverProcessInspectionInfo &)
+	?ProcessInspectionRequestChangesCancel@RMemSpyDriverClient@@QAEXI@Z @ 50 NONAME ; void RMemSpyDriverClient::ProcessInspectionRequestChangesCancel(unsigned int)
+	?ProcessThreadsResume@RMemSpyDriverClient@@QAEHI@Z @ 51 NONAME ; int RMemSpyDriverClient::ProcessThreadsResume(unsigned int)
+	?ProcessThreadsSuspend@RMemSpyDriverClient@@QAEHI@Z @ 52 NONAME ; int RMemSpyDriverClient::ProcessThreadsSuspend(unsigned int)
+	?ReadInt32L@RMemSpyMemStreamReader@@QAEJXZ @ 53 NONAME ; long RMemSpyMemStreamReader::ReadInt32L(void)
+	?ReadL@RMemSpyMemStreamReader@@QAEXAAVTDes16@@@Z @ 54 NONAME ; void RMemSpyMemStreamReader::ReadL(class TDes16 &)
+	?ReadL@RMemSpyMemStreamReader@@QAEXAAVTDes8@@@Z @ 55 NONAME ; void RMemSpyMemStreamReader::ReadL(class TDes8 &)
+	?ReadMemory@RMemSpyDriverClient@@QAEHIKAAVTDes8@@@Z @ 56 NONAME ; int RMemSpyDriverClient::ReadMemory(unsigned int, unsigned long, class TDes8 &)
+	?ReadUint32L@RMemSpyMemStreamReader@@QAEKXZ @ 57 NONAME ; unsigned long RMemSpyMemStreamReader::ReadUint32L(void)
+	?RoundToPageSize@RMemSpyDriverClient@@QAEKK@Z @ 58 NONAME ; unsigned long RMemSpyDriverClient::RoundToPageSize(unsigned long)
+	?SetPriority@RMemSpyDriverClient@@QAEHIW4TThreadPriority@@@Z @ 59 NONAME ; int RMemSpyDriverClient::SetPriority(unsigned int, enum TThreadPriority)
+	?StreamOpenL@RMemSpyDriverClient@@QAE?AVRMemSpyMemStreamReader@@XZ @ 60 NONAME ; class RMemSpyMemStreamReader RMemSpyDriverClient::StreamOpenL(void)
+	?ThreadEnd@RMemSpyDriverClient@@QAEHIW4TExitType@@@Z @ 61 NONAME ; int RMemSpyDriverClient::ThreadEnd(unsigned int, enum TExitType)
+	?WalkHeapClose@RMemSpyDriverClient@@QAEXXZ @ 62 NONAME ; void RMemSpyDriverClient::WalkHeapClose(void)
+	?WalkHeapGetCellInfo@RMemSpyDriverClient@@QAEHAAPAXAAW4TMemSpyDriverCellType@@AAH2220@Z @ 63 NONAME ; int RMemSpyDriverClient::WalkHeapGetCellInfo(void * &, enum TMemSpyDriverCellType &, int &, int &, int &, int &, void * &)
+	?WalkHeapInit@RMemSpyDriverClient@@QAEHI@Z @ 64 NONAME ; int RMemSpyDriverClient::WalkHeapInit(unsigned int)
+	?WalkHeapNextCell@RMemSpyDriverClient@@QAEHIAAW4TMemSpyDriverCellType@@AAPAXAAH2221@Z @ 65 NONAME ; int RMemSpyDriverClient::WalkHeapNextCell(unsigned int, enum TMemSpyDriverCellType &, void * &, int &, int &, int &, int &, void * &)
+	?WalkHeapReadCellData@RMemSpyDriverClient@@QAEHPAXAAVTDes8@@H@Z @ 66 NONAME ; int RMemSpyDriverClient::WalkHeapReadCellData(void *, class TDes8 &, int)
+	?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)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverDevice.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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 MEMSPYDRIVERDEVICE_H
+#define MEMSPYDRIVERDEVICE_H
+
+// System includes
+#include <kernel.h>
+
+// Classes referenced
+class DMemSpyEventMonitor;
+class DMemSpyDriverOSAdaption;
+class DMemSpySuspensionManager;
+class DMemSpyInspectedProcessManager;
+
+class DMemSpyDriverDevice : public DLogicalDevice
+	{
+public:
+	DMemSpyDriverDevice();
+    ~DMemSpyDriverDevice();
+
+public: // from DLogicalDevice
+	TInt Install();
+	void GetCaps( TDes8& aDes ) const;
+	TInt Create( DLogicalChannelBase*& aChannel );
+
+public: // API
+    void Cleanup();
+    //
+    inline TUint32 RHeapVTable() const { return iRHeapVTable; }
+    inline void SetRHeapVTable( TUint32 aVTable ) { iRHeapVTable = aVTable; }
+    //
+    inline DMemSpyEventMonitor& EventMonitor() { return *iEventMonitor; }
+    inline DMemSpyDriverOSAdaption& OSAdaption() { return *iOSAdaption; }
+    inline DMemSpySuspensionManager& SuspensionManager() const { return *iSuspensionManager; }
+    inline DMemSpyInspectedProcessManager& ProcessInspectionManager() { return *iProcessManager; }
+
+private: // Data members
+    TUint32 iRHeapVTable;
+    DMemSpyEventMonitor* iEventMonitor;
+    DMemSpyDriverOSAdaption* iOSAdaption;
+    DMemSpySuspensionManager* iSuspensionManager;
+    DMemSpyInspectedProcessManager* iProcessManager;
+	};
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverEventMonitor.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* 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 MEMSPYEVENTMONITOR_H
+#define MEMSPYEVENTMONITOR_H
+
+// System includes
+#include <kernel.h>
+#include <kern_priv.h>
+
+// Classes referenced
+class DMemSpyDriverDevice;
+
+// For EMTypeMask
+enum TMemSpyEventMonitorEvent
+    {
+    EMemSpyEventNull                = 0x0000,
+    //
+    EMemSpyEventThreadAdd           = 0x0001,
+    EMemSpyEventThreadRemove        = 0x0002,
+    EMemSpyEventThreadKill          = 0x0004,
+    //
+    EMemSpyEventProcessAdd          = 0x0008,
+    EMemSpyEventProcessUpdate       = 0x0010,
+    EMemSpyEventProcessRemove       = 0x0020,
+    //
+    EMemSpyEventChunkAdd            = 0x0040,
+    EMemSpyEventChunkUpdate         = 0x0080,
+    EMemSpyEventChunkDelete         = 0x0100,
+    };
+
+
+class MMemSpyEventMonitorObserver
+	{
+public: // From MMemSpyEventMonitorObserver
+    virtual TUint EMTypeMask() const = 0;
+    //
+    virtual void EMHandleProcessAdd( DProcess& /*aProcess*/ ) { }
+    virtual void EMHandleProcessUpdated( DProcess& /*aProcess*/ ) { }
+    virtual void EMHandleProcessRemoved( DProcess& /*aProcess*/ ) { }
+    //
+    virtual void EMHandleThreadAdd( DThread& /*aThread*/ ) { }
+    virtual void EMHandleThreadRemoved( DThread& /*aThread*/ ) { }
+    virtual void EMHandleThreadKilled( DThread& /*aThread*/ ) { }
+    //
+    virtual void EMHandleChunkAdd( DChunk& /*aChunk*/ ) { }
+    virtual void EMHandleChunkUpdated( DChunk& /*aChunk*/ ) { }
+    virtual void EMHandleChunkDeleted( DChunk& /*aChunk*/ ) { }
+
+public: // Nasty, but I don't care...
+    SDblQueLink __iEMLink;
+    };
+
+
+
+class DMemSpyEventMonitor : public DKernelEventHandler
+	{
+public:
+	DMemSpyEventMonitor();
+	~DMemSpyEventMonitor();
+
+public: // Device API
+    TInt Create( DMemSpyDriverDevice* aDevice );
+	TInt Start();
+	TInt Stop();
+	
+public: // API
+    TInt RequestEvents( MMemSpyEventMonitorObserver& aObserver );
+    TInt RequestEventsCancel( MMemSpyEventMonitorObserver& aObserver );
+
+private: // Handle kernel event callbacks
+	static TUint EventHandler( TKernelEvent aEvent, TAny* a1, TAny* a2, TAny* aThis );
+	TUint HandleEvent( TKernelEvent aType, TAny* a1, TAny* a2 );
+    //
+	void EventProcessAdd( DProcess* aProcess );
+	void EventProcessUpdate( DProcess* aProcess );
+	void EventProcessRemoved( DProcess* aProcess );
+	//
+	void EventThreadAdd( DThread* aThread );
+	void EventThreadRemoved( DThread* aThread );
+	void EventThreadKilled( DThread* aThread );
+    //
+	void EventChunkAdd( DChunk* aChunk );
+	void EventChunkUpdate( DChunk* aChunk );
+	void EventChunkDelete( DChunk* aChunk );
+
+private: // Internal methods
+    TBool IsObserving( MMemSpyEventMonitorObserver& aObserver ); 
+
+private:
+	/** Lock serialising calls to event handler */
+	DMutex* iLock;
+
+    /** open reference to LDD for avoiding lifetime issues */
+	DLogicalDevice* iDevice;
+
+    // List of observers
+	SDblQue iObservers;
+	
+	// Whether we are tracking or not
+	TBool iTracking;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeap.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* 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 MEMSPYDRIVERHEAP_H
+#define MEMSPYDRIVERHEAP_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// User includes
+#include "MemSpyDriverObjectsInternal.h"
+
+// Constants
+// We shouldn't be using any of these any more! -Tomsci
+const TUint KRHeapObjectSize = 0x74;
+const TUint KRAllocatorAndRHeapMemberDataOffset = 4; // 4 bytes past start of allocator address, i.e. skipping the vtable
+const TUint KRHeapMemberDataSize = KRHeapObjectSize - KRAllocatorAndRHeapMemberDataOffset;
+
+// Classes referenced
+class DMemSpyDriverOSAdaption;
+namespace LtkUtils
+	{
+	class RAllocatorHelper;
+	}
+
+/**
+ * Essentially a mirror of RAllocator and RHeap's layout.
+ */
+class RMemSpyDriverRHeapBase
+	{
+protected:
+    RMemSpyDriverRHeapBase();
+
+public: // API
+    void PrintInfo();
+	LtkUtils::RAllocatorHelper* Helper();
+	TMemSpyHeapInfo::THeapImplementationType GetTypeFromHelper() const;
+
+public: // Virtual API
+    virtual void Reset();
+	virtual void Close();
+    virtual DChunk& Chunk() = 0;
+    virtual const DChunk& Chunk() 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:
+    RMemSpyDriverRHeapUser( DMemSpyDriverOSAdaption& aOSAdaption );
+	TInt OpenUserHeap(DThread& aThread, TBool aEuserUdeb);
+
+	DChunk& Chunk() { return *iChunk; }
+	const DChunk& Chunk() const { return *iChunk; }
+
+private:
+    inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; }
+
+private:
+    DMemSpyDriverOSAdaption& iOSAdaption;
+	DChunk* iChunk;
+    };
+
+
+
+class RMemSpyDriverRHeapKernelFromCopy : public RMemSpyDriverRHeapReadFromCopy
+    {
+public:
+    RMemSpyDriverRHeapKernelFromCopy( DMemSpyDriverOSAdaption& aOSAdaption );
+    
+public: // API
+    void SetKernelHeap( RHeapK& aKernelHeap );
+
+public: // From RMemSpyDriverRHeapBase
+    //void DisassociateWithKernelChunk();
+	void Close();
+
+private:
+    RHeapK* iKernelHeap;
+    };
+
+
+
+class RMemSpyDriverRHeapKernelInPlace : public RMemSpyDriverRHeapBase
+    {
+public:
+    RMemSpyDriverRHeapKernelInPlace();
+	TInt OpenKernelHeap();
+    
+
+public: // From RMemSpyDriverRHeapBase
+    void Close();
+
+    DChunk& Chunk();
+    const DChunk& Chunk() const;
+
+	// Only important member data is the base class's RAllocatorHelper
+	// We do cache the chunk though
+private:
+	DChunk* iChunk;
+    };
+
+	
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeapStatistics.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* 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 MEMSPYDRIVERHEAPSTATISTICS_H
+#define MEMSPYDRIVERHEAPSTATISTICS_H
+
+// System includes
+#include <e32cmn.h>
+
+
+class TMemSpyHeapWalkStatistics
+    {
+public:
+
+    // Total number of cells enumerated
+    TInt iNumberOfWalkedCells;
+
+    // The type of the last cell
+    TMemSpyDriverCellType iLastCellType;
+
+    // The address of the last cell
+    TLinAddr iLastCellAddress;
+
+public: // Free cell related
+
+    // The address of the first free heap cell
+    TLinAddr iFirstFreeCellAddress;
+    
+    // The length of the first free heap cell
+    TUint iFirstFreeCellLength;
+
+    // Whether the last cell in the entire heap was a free cell
+    // (i.e. slack space)
+    TBool iLastCellWasFreeCell;
+
+    // The length of the last free cell in the heap
+    TUint iLastFreeCellLength;
+
+    // The total amount of free space in the heap
+    TUint iTotalFreeSpace;
+
+    // The number of free heap cells
+    TUint iFreeCellCount;
+
+    // The size of the largest free cell
+    TUint iLargestCellSizeFree;
+
+    // The previous largest free cell size
+    TUint iLargestCellSizeFreePrevious;
+
+    // The address of the largest free cell
+    TLinAddr iLargestCellAddressFree;
+
+    // The previous address of the largest free cell
+    TUint iLargestCellAddressFreePrevious;
+
+    // The overhead associated with a free cell (header length)
+    //TUint iFreeCellOverheadHeaderLength;
+	TUint iReserved1;
+
+    // The slace space at the end of the heap
+    TUint iSlackSpace;
+
+    // The address of the slack space cell
+    TLinAddr iSpackSpaceCellAddress;
+
+    // A very simple XOR checksum of all the free cell addresses that were
+    // detected during the heap navigation
+    TUint32 iFreeCellCRC;
+
+public: // Alloc cell related
+
+    // The number of allocated heap cells
+    TUint iAllocCellCount;
+
+    // The size of the largest allocated cell
+    TUint iLargestCellSizeAlloc;
+
+    // The address of the largest allocated cell
+    TLinAddr iLargestCellAddressAlloc;
+   
+    // The overhead associated with an allocated cell (header length)
+    //TUint iAllocCellOverheadHeaderLength;
+	TUint iReserved2;
+
+public: // Common
+
+    // The total amount of allocated space in the heap
+    TUint iTotalAllocSpace;
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeapWalker.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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 MEMSPYDRIVERHEAPWALKER_H
+#define MEMSPYDRIVERHEAPWALKER_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// Shared includes
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// User includes
+#include "MemSpyDriverHeap.h"
+#include "MemSpyDriverHeapStatistics.h"
+
+#include "heaputils.h"
+using namespace LtkUtils;
+
+// Heap walker observer interface - can be used to make a record of each cell
+class MMemSpyHeapWalkerObserver
+    {
+public:
+    virtual TBool HandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber) = 0;
+    virtual void HandleHeapWalkInit() = 0;
+    };
+
+
+// Heap walker - allows in-place walking of any heap
+class RMemSpyDriverHeapWalker
+    {
+public:
+	RMemSpyDriverHeapWalker(RMemSpyDriverRHeapBase& aHeap, MMemSpyHeapWalkerObserver* aObserver=NULL);
+		
+public: // API
+    TInt Traverse();
+    void CopyStatsTo( TMemSpyHeapStatisticsRHeap& aStats );
+    void SetObserver( MMemSpyHeapWalkerObserver* aObserver );
+    inline void SetPrintDebug() { iPrintDebug = ETrue; }
+    inline const TMemSpyHeapWalkStatistics& Stats() const { return iStats; }
+
+private: // Internal methods
+	static TBool CellCallback(RAllocatorHelper& aHelper, TAny* aContext, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellAddress, TInt aLength);
+	TBool DoCellCallback(RAllocatorHelper& aHelper, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellAddress, TInt aLength);
+    TBool NotifyCell( TMemSpyDriverCellType aType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel = -1, TInt aAllocNumber = -1 );
+    //
+    void UpdateStats( TMemSpyDriverCellType aType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber );
+    void InitialiseStats();
+    void FinaliseStats();
+    void PrintStats();
+    //
+    inline TBool PrintDebug() const { return iPrintDebug; }
+
+private:
+    RMemSpyDriverRHeapBase& iHeap;
+    TBool iPrintDebug;
+    MMemSpyHeapWalkerObserver* iObserver;
+    TMemSpyHeapWalkStatistics iStats;
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverInspectedProcess.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,181 @@
+/*
+* 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 MEMSPYINSPECTEDPROCESS_H
+#define MEMSPYINSPECTEDPROCESS_H
+
+// System includes
+#include <kern_priv.h>
+
+// Shared includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverEventMonitor.h"
+
+// Classes referenced
+class DMemSpyInspectedProcessManager;
+class TMemSpyDriverProcessInspectionInfo;
+
+
+
+class TMemSpyTrackedChunk
+	{
+public:
+    enum TType
+        {
+        ETypeNotRelevant = -1,
+        //
+        ETypeChunkHeap = 0,
+        ETypeChunkLocal,
+        ETypeChunkGlobalData,
+        ETypeChunkProcessGlobalDataAndUserStack,
+        ETypeChunkShared
+        };
+
+public:
+	TMemSpyTrackedChunk( DChunk* aChunk, TType aType );
+
+public: // API
+    void SetSize( TInt aSize );
+    TInt Size() const { return iSize; }
+    //
+    void SetUnused( TBool aUnused );
+    TBool Unused() const { return iUnused; }
+    //
+    TAny* Handle() const { return iChunk; }
+    //
+    inline TType Type() const { return iType; }
+    inline void SetType( TType aType ) { iType = aType; }
+
+public: // Data members
+	SDblQueLink iLink;
+    DChunk* iChunk;
+    TType iType;
+    TInt iSize;
+    TBool iUnused;
+	};
+
+
+class TMemSpyTrackedChunkChangeInfo
+    {
+public: // Data members
+    TMemSpyDriverProcessInspectionInfo iInfo;
+	SDblQueLink iLink;
+    };
+
+
+
+
+
+class DMemSpyInspectedProcess : public DBase, public MMemSpyEventMonitorObserver
+    {
+public: // Construct / destruct
+	DMemSpyInspectedProcess( DMemSpyDriverDevice& aDevice );
+	~DMemSpyInspectedProcess();
+
+public: // API
+    TInt Open( DProcess* aProcess );
+    inline TUint ProcessId() const { return iProcessId; }
+
+public: // Change notification API
+	TInt NotifyOnChange( DThread* aThread, TRequestStatus* aRequestStatus, TMemSpyDriverProcessInspectionInfo* aInfo );
+	TInt NotifyOnChangeCancel();
+    TBool NotifyOnChangeQueued() const;
+
+public: // Queue link
+	SDblQueLink iLink;
+
+public: // From MMemSpyEventMonitorObserver
+    TUint EMTypeMask() const;
+    void EMHandleProcessUpdated( DProcess& aProcess );
+    void EMHandleProcessRemoved( DProcess& aProcess );
+    void EMHandleThreadAdd( DThread& aThread );
+    void EMHandleThreadRemoved( DThread& aThread );
+    void EMHandleThreadKilled( DThread& aThread );
+    void EMHandleChunkAdd( DChunk& aChunk );
+    void EMHandleChunkUpdated( DChunk& aChunk );
+    void EMHandleChunkDeleted( DChunk& aChunk );
+
+    // Internal helper
+    void EMHandleThreadChanged( DThread& aThread );
+
+private: // Tracked item management
+    void ResetTrackedList();
+    void SetTrackedListUnused();
+    void SetTrackedListUnusedStatusByType( TMemSpyTrackedChunk::TType aType, TBool aUnusedStatus );
+    void DiscardUnusedTrackListItems();
+    void AddTrackedChunk( DChunk* aChunk, TMemSpyTrackedChunk::TType aType );
+    TMemSpyTrackedChunk* TrackedChunkByHandle( TAny* aHandle );
+
+private: // Internal methods
+    DMemSpyInspectedProcessManager& PManager();
+    DMemSpyEventMonitor& EventMonitor();
+    TMemSpyTrackedChunk::TType ChunkType( DObject* aObject ) const;
+    TBool IsHeapChunk( DChunk& aChunk, const TName& aName ) const;
+    static TUint32 TotalStatistics( const TMemSpyDriverProcessInspectionInfo& aStats, TBool aIncludeShared = ETrue );
+    static TBool IsEqual( const TMemSpyDriverProcessInspectionInfo& aLeft, const TMemSpyDriverProcessInspectionInfo& aRight );
+    void ResetStatistics( TMemSpyDriverProcessInspectionInfo& aStats );
+    TBool UpdateStatistics();
+    void CompleteClientsRequest( TInt aCompletionCode, TMemSpyDriverProcessInspectionInfo* aInfo = NULL );
+    void FindChunks( DProcess& aProcess );
+    TInt StackSize( DProcess& aProcess );
+    void ResetPendingChanges();
+    void PrintChunkInfo( DChunk& aChunk ) const;
+    TBool IsChunkRelevantToOurProcess( DChunk& aChunk ) const;
+	void Lock() const;
+	void Unlock() const;
+
+public: // Queue link for process manager
+	SDblQueLink iPMLink;
+
+private: // Data members
+    DMemSpyDriverDevice& iDevice;
+	DMutex* iLock;
+    TUint iProcessId;
+    DProcess* iProcess;
+    TBool iAmDead;
+
+    // This differs from the 'inspection info' iMemoryStack field
+    // because it just contains the size of all user-thread stacks
+    // within the process.
+    TInt iUserThreadStackSize;
+
+    // Tracking chunks mapped into process
+	SDblQue iTrackedChunks;
+	
+	// Changes that have occurred whilst the client was AWOL
+	SDblQue iPendingChanges;
+
+    // Tracking totals
+    TMemSpyDriverProcessInspectionInfo iInfoLast;
+    TMemSpyDriverProcessInspectionInfo iInfoCurrent;
+    TMemSpyDriverProcessInspectionInfo iInfoPeaks;
+    TMemSpyDriverProcessInspectionInfo iInfoHWMIncShared;
+    TMemSpyDriverProcessInspectionInfo iInfoHWMExcShared;
+
+    // For change notification
+    TInt iChangeDeliveryCounter;
+	DThread* iChangeObserverThread;
+	TRequestStatus* iChangeObserverRS;
+    TMemSpyDriverProcessInspectionInfo* iChangeObserverInfo;
+    TBool iEventReceivedWhilstObserverWasAWOL;
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverInspectedProcessManager.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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 MEMSPYDRIVERINSPECTEDPROCESSMANAGER_H
+#define MEMSPYDRIVERINSPECTEDPROCESSMANAGER_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverEventMonitor.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class DMemSpyInspectedProcess;
+
+
+class DMemSpyInspectedProcessManager : public DObject, public MMemSpyEventMonitorObserver
+	{
+public:
+	DMemSpyInspectedProcessManager();
+	~DMemSpyInspectedProcessManager();
+    TInt Create( DMemSpyDriverDevice* aDevice );
+
+public: // API
+    TInt ProcessOpen( DProcess* aProcess );
+    TInt ProcessClose( DProcess* aProcess );
+    TInt ProcessCount() const;
+    //
+    DMemSpyInspectedProcess* InspectedProcessByProcessId( TUint aProcessId );
+    void AutoStartListReset();
+    TInt AutoStartListAdd( TUint aSID );
+
+private: // Event handler queue methods
+    void FreeAllInspectedProcesses();
+    DMemSpyEventMonitor& EventMonitor();
+
+private: // From MMemSpyEventMonitorObserver
+    TUint EMTypeMask() const;
+    void EMHandleProcessAdd( DProcess& aProcess );
+
+private:
+    DMemSpyDriverDevice* iDevice;
+	SDblQue iMonitoredProcesses;
+	
+	// So that MemSpy can be informed when one of the observed processes changed
+	DThread* iObserverThread;
+	TRequestStatus* iObserverRS;
+    RArray<TUint> iAutoStartSIDs;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverLog.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* 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 MEMSPYDRIVERLOG_H
+#define MEMSPYDRIVERLOG_H
+
+// System includes
+#include <kernel.h>
+
+// Uncomment this line to enable minimal op code tracing
+//#define TRACE_TYPE_OPCODES
+
+// Uncomment this line to enable driver tracing
+//#define TRACE_TYPE_GENERAL
+
+// Uncomment this line to dump raw binary data - usually heaps & stacks.
+//#define TRACE_TYPE_DATA 
+
+// Uncomment this line to trace heap walking etc
+//#define TRACE_TYPE_USERHEAP
+
+// Uncomment this line to trace chunks
+//#define TRACE_TYPE_CHUNK
+
+// Uncomment this line to trace event monitor functionality
+//#define TRACE_TYPE_EVENTMONITOR
+
+// Uncomment this line to trace kernel heap operations
+//#define TRACE_TYPE_KERNELHEAP
+
+// Uncomment this line to trace heap walking
+//#define TRACE_TYPE_HEAPWALK
+
+// This block switches on basic tracing in UDEB HW builds
+#if (defined(_DEBUG) && !defined(__WINS__))
+#   define TRACE_TYPE_OPCODES 
+#   define TRACE_TYPE_GENERAL
+//#   define TRACE_TYPE_HEAPWALK
+#   define TRACE_TYPE_CHUNK
+//#   define TRACE_TYPE_EVENTMONITOR
+//#   define TRACE_TYPE_DATA
+//#   define TRACE_TYPE_USERHEAP
+#   define TRACE_TYPE_KERNELHEAP
+#endif
+
+
+#if defined(TRACE_TYPE_OPCODES)
+#   define TRACE_OP( x ) x
+#else
+#   define TRACE_OP( x ) 
+#endif
+
+
+
+#if defined(TRACE_TYPE_GENERAL)
+#   define TRACE( x ) x
+#else
+#   define TRACE( x ) 
+#endif
+
+
+
+#if defined(TRACE_TYPE_USERHEAP)
+#   define TRACE_HEAP( x ) x
+#else
+#   define TRACE_HEAP( x ) 
+#endif
+
+
+
+#if defined(TRACE_TYPE_KERNELHEAP)
+#   define TRACE_KH( x ) x
+#else
+#   define TRACE_KH( x ) 
+#endif
+
+
+
+#if defined(TRACE_TYPE_HEAPWALK )
+#   define TRACE_HEAPWALK( x ) x
+#else
+#   define TRACE_HEAPWALK( x ) 
+#endif
+
+
+
+#if defined(TRACE_TYPE_EVENTMONITOR)
+#   define TRACE_EM( x ) x
+#else
+#   define TRACE_EM( x ) 
+#endif
+
+
+
+#if defined(TRACE_TYPE_DATA)
+#   define TRACE_DATA( x ) x
+#else
+#   define TRACE_DATA( x )
+#endif
+
+
+#if defined(TRACE_TYPE_CHUNK)
+#   define TRACE_CHUNK( x ) x
+#else
+#   define TRACE_CHUNK( x )
+#endif
+
+#define LOG(args...) TRACE(Kern::Printf(args))
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverLogicalChannel.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANNEL_H
+#define MEMSPYDRIVERLOGICALCHANNEL_H
+
+// System includes
+#include <e32cmn.h>
+#include <kernel.h>
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class DMemSpyDriverLogChanBase;
+
+
+class DMemSpyDriverLogicalChannel : public DLogicalChannelBase
+	{
+public:
+	DMemSpyDriverLogicalChannel();
+	~DMemSpyDriverLogicalChannel();
+
+private: // from DLogicalChannelBase
+	TInt DoCreate( TInt aUnit, const TDesC8* anInfo, const TVersion& aVer );
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+
+private: // Channel operation handlers
+    TInt SubChannelsRegister();
+    TInt SubChannelConstructAndSave( DMemSpyDriverLogChanBase*& aSubChannel );
+    void SubChannelsDestroy();
+    DMemSpyDriverLogChanBase* SubChannelForFunction( TInt aFunction );
+
+private: // Internal methods
+    DMemSpyDriverDevice& MemSpyDevice();
+
+private: // Data members
+	DThread* iClientThread;
+    RPointerArray<DMemSpyDriverLogChanBase> iSubChannels;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverOSAdaption.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,505 @@
+/*
+* 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 MEMSPYDRIVEROSADAPTION_H
+#define MEMSPYDRIVEROSADAPTION_H
+
+// System includes
+#include <kernel.h>
+#include <e32const.h>
+
+// User includes
+#include "MemSpyDriverObjectIx.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class DMemSpyPropertyRef;
+class DMemSpyDriverOSAdaption;
+
+
+
+class DMemSpyDriverOSAdaptionDObject : public DBase
+    {
+protected:
+    DMemSpyDriverOSAdaptionDObject( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TUint8 GetContainerID( DObject& aObject ) const;
+    TObjectType GetObjectType( DObject& aObject ) const;
+    DObject* GetOwner( DObject& aObject ) const;
+    DObject* GetOwner( DObject& aObject, TUint8 aExpectedContainerId ) const;
+    TInt GetAccessCount( DObject& aObject ) const;
+    TInt GetUniqueID( DObject& aObject ) const;
+    TUint GetProtection( DObject& aObject ) const;
+    TUint8* GetAddressOfKernelOwner( DObject& aObject ) const;
+
+protected:
+    DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; }
+
+private: // Data members
+    DMemSpyDriverOSAdaption& iOSAdaption;
+    };
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDThread : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDThread( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    NThread* GetNThread( DThread& aObject ) const;
+    TExitType GetExitType( DThread& aObject ) const;
+    TUint32 GetSupervisorStackBase( DThread& aObject ) const;
+    TInt GetSupervisorStackSize( DThread& aObject ) const;
+    RAllocator* GetAllocator( DThread& aObject ) const;
+    CActiveScheduler* GetActiveScheduler( DThread& aObject ) const;
+    TUint32 GetUserStackBase( DThread& aObject ) const;
+    TInt GetUserStackSize( DThread& aObject ) const;
+    DProcess* GetOwningProcess( DThread& aObject ) const;
+    TUint GetId( DThread& aObject ) const;
+    MemSpyObjectIx* GetHandles( DThread& aObject ) const;
+    TUint GetOwningProcessId( DThread& aObject ) const;
+    TInt GetPriority( DThread& aObject ) const;    
+    TUint8* GetAddressOfOwningProcess( DThread& aObject ) const;    
+    void GetNameOfOwningProcess( DThread& aObject, TDes& aName ) const;
+    TBool IsHandleIndexValid( DThread& aObject ) const;
+
+private: // Internal methods
+    RAllocator* GetAllocatorAndStackAddress( DThread& aObject, TUint32& aStackAddress ) const;
+
+private: // Data members
+    TUint32 iOffset_NThread;
+    TUint32 iOffset_ExitType;
+    TUint32 iOffset_SupervisorStackBase;
+    TUint32 iOffset_SupervisorStackSize;
+    };
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDProcess : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDProcess( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TUint GetId( DProcess& aObject ) const;
+    MemSpyObjectIx* GetHandles( DProcess& aObject ) const;
+    TExitType GetExitType( DProcess& aObject ) const;
+    DThread* OpenFirstThread( DProcess& aObject ) const;
+    TUint32 GetSID( DProcess& aObject ) const;
+    TUint GetSecurityZone( DProcess& aObject ) const;
+    SSecurityInfo& GetSecurityInfo( DProcess& aObject ) const;
+    TInt GetFlags( DProcess& aObject ) const;
+    TInt GetGeneration( DProcess& aObject ) const;
+    SDblQue& GetThreadQueue( DProcess& aObject ) const;
+    DThread* GetThread( SDblQueLink* aLink ) const;
+    void SetSID( DProcess& aObject, TUint32 aSID ) const;
+    void SetSecurityZone( DProcess& aObject, TUint aSecurityZone ) const;
+    TUint GetCreatorId( DProcess& aObject ) const;
+    TInt GetAttributes( DProcess& aObject ) const;
+    TInt GetPriority( DProcess& aObject ) const;
+    TUint8* GetAddressOfOwningProcess( DProcess& aObject ) const;
+    TUint8* GetAddressOfDataBssStackChunk( DProcess& aObject ) const;
+    TBool IsHandleIndexValid( DProcess& aObject ) const;
+	TBool IsKernProcess(DProcess& aProcess) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDChunk : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDChunk( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TInt GetSize( DChunk& aObject ) const;
+    TInt GetMaxSize( DChunk& aObject ) const;
+    TUint8* GetBase( DChunk& aObject ) const;
+    DProcess* GetOwningProcess( DChunk& aObject ) const;
+    TUint GetOwningProcessId( DChunk& aObject ) const;
+    TUint GetControllingOwnerId( DChunk& aObject ) const;
+    TChunkType GetType( DChunk& aObject ) const;
+    TInt GetAttributes( DChunk& aObject ) const;
+    TUint8* GetAddressOfOwningProcess( DChunk& aObject ) const;
+    TInt GetBottom( DChunk& aObject ) const;
+    TInt GetTop( DChunk& aObject ) const;
+    TInt GetStartPos( DChunk& aObject ) const;
+    TUint GetRestrictions( DChunk& aObject ) const;
+    TUint GetMapAttr( DChunk& aObject ) const;
+    void GetNameOfOwningProcess( DChunk& aObject, TDes& aName ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDServer : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDServer( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    SDblQue& GetSessionQueue( DServer& aObject ) const;
+    DSession* GetSession( SDblQueLink* aLink ) const;
+    TInt GetSessionCount( DServer& aObject ) const;
+    DThread* GetOwningThread( DServer& aObject ) const;
+    TUint GetOwningThreadId( DServer& aObject ) const;
+    TIpcSessionType GetSessionType( DServer& aObject ) const;
+    TUint8* GetAddressOfOwningThread( DServer& aObject ) const;
+    void GetNameOfOwningThread( DServer& aObject, TDes& aName ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDSession : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDSession( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TIpcSessionType GetSessionType( DSession& aObject ) const;
+    DServer* GetServer( DSession& aObject ) const;
+    TUint8* GetAddressOfServer( DSession& aObject ) const;
+    TUint16 GetTotalAccessCount( DSession& aObject ) const;
+    TUint8 GetSrvSessionType( DSession& aObject ) const;
+    TInt GetMsgCount( DSession& aObject ) const;
+    TInt GetMsgLimit( DSession& aObject ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDCodeSeg : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDCodeSeg( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    DCodeSeg* GetCodeSeg( SDblQueLink* aLink ) const;
+    DCodeSeg* GetCodeSeg( DLibrary& aLibrary ) const;
+    DCodeSeg* GetCodeSegFromHandle( TAny* aHandle ) const;
+    TBool GetIsXIP( DCodeSeg& aCodeSeg ) const;
+    TInt GetCodeSegQueue( DProcess& aObject, SDblQue& aQueue ) const;
+    void EmptyCodeSegQueue( SDblQue& aQueue ) const;
+    TUint32 GetSize( DCodeSeg& aCodeSeg ) const;
+    void GetCreateInfo( DCodeSeg& aCodeSeg, TCodeSegCreateInfo& aInfo ) const;
+    TUint8 GetState( DLibrary& aLibrary ) const;
+    TInt GetMapCount( DLibrary& aLibrary ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDSemaphore : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDSemaphore( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TInt GetCount( DSemaphore& aObject ) const;
+    TUint8 GetResetting( DSemaphore& aObject ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDMutex : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDMutex( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TInt GetHoldCount( DMutex& aObject ) const;
+    TInt GetWaitCount( DMutex& aObject ) const;
+    TUint8 GetResetting( DMutex& aObject ) const;
+    TUint8 GetOrder( DMutex& aObject ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDLogicalDevice : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDLogicalDevice( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TInt GetOpenChannels( DLogicalDevice& aObject ) const;
+    TVersion GetVersion( DLogicalDevice& aObject ) const;
+    TUint GetParseMask( DLogicalDevice& aObject ) const;
+    TUint GetUnitsMask( DLogicalDevice& aObject ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDPhysicalDevice : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDPhysicalDevice( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TVersion GetVersion( DPhysicalDevice& aObject ) const;
+    TUint GetUnitsMask( DPhysicalDevice& aObject ) const;
+    TUint8* GetAddressOfCodeSeg( DPhysicalDevice& aObject ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDChangeNotifier : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDChangeNotifier( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TUint GetChanges( DChangeNotifier& aObject ) const;
+    TUint8* GetAddressOfOwningThread( DChangeNotifier& aObject ) const;
+    void GetNameOfOwningThread( DChangeNotifier& aObject, TDes& aName ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDUndertaker : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDUndertaker( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TUint8* GetAddressOfOwningThread( DUndertaker& aObject ) const;
+    void GetNameOfOwningThread( DUndertaker& aObject, TDes& aName ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDCondVar : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDCondVar( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TUint8 GetResetting( DCondVar& aObject ) const;
+    TUint8* GetAddressOfMutex( DCondVar& aObject ) const;
+    void GetNameOfMutex( DCondVar& aObject, TDes& aName ) const;
+    TInt GetWaitCount( DCondVar& aObject ) const;
+    SDblQue& GetSuspendedQ( DCondVar& aObject ) const;
+    DThread* GetThread( SDblQueLink* aLink ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDTimer : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDTimer( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TTimer::TTimerType GetType( DTimer& aObject ) const;
+    TTimer::TTimerState GetState( DTimer& aObject ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+class DMemSpyDriverOSAdaptionDPropertyRef : public DMemSpyDriverOSAdaptionDObject
+    {
+public:
+    DMemSpyDriverOSAdaptionDPropertyRef( DMemSpyDriverOSAdaption& aOSAdaption );
+
+public:
+    TBool GetIsReady( DObject& aObject ) const;
+    RProperty::TType GetType( DObject& aObject ) const;
+    TUint GetCategory( DObject& aObject ) const;
+    TUint GetKey( DObject& aObject ) const;
+    TInt GetRefCount( DObject& aObject ) const;
+    TUint GetThreadId( DObject& aObject ) const;
+    TUint32 GetCreatorSID( DObject& aObject ) const;
+
+private: // Internal methods
+    DMemSpyPropertyRef* GetPropertyRef( DObject& aObject ) const;
+
+private: // Data members
+    };
+
+
+
+
+
+
+class DMemSpyDriverOSAdaption : public DBase
+	{
+public:
+    DMemSpyDriverOSAdaption( DMemSpyDriverDevice& aDevice );
+    ~DMemSpyDriverOSAdaption();
+    TInt Construct();
+
+public: // API
+    inline DMemSpyDriverDevice& Device() { return iDevice; }
+    inline DMemSpyDriverOSAdaptionDProcess& DProcess() { return *iDProcess; }
+    inline DMemSpyDriverOSAdaptionDThread& DThread() { return *iDThread; }
+    inline DMemSpyDriverOSAdaptionDChunk& DChunk() { return *iDChunk; }
+    inline DMemSpyDriverOSAdaptionDServer& DServer() { return *iDServer; }
+    inline DMemSpyDriverOSAdaptionDSession& DSession() { return *iDSession; }
+    inline DMemSpyDriverOSAdaptionDCodeSeg& DCodeSeg() { return *iDCodeSeg; }
+    inline DMemSpyDriverOSAdaptionDSemaphore& DSemaphore() { return *iDSemaphore; }
+    inline DMemSpyDriverOSAdaptionDMutex& DMutex() { return *iDMutex; }
+    inline DMemSpyDriverOSAdaptionDLogicalDevice& DLogicalDevice() { return *iDLogicalDevice; }
+    inline DMemSpyDriverOSAdaptionDPhysicalDevice& DPhysicalDevice() { return *iDPhysicalDevice; }
+    inline DMemSpyDriverOSAdaptionDChangeNotifier& DChangeNotifier() { return *iDChangeNotifier; }
+    inline DMemSpyDriverOSAdaptionDUndertaker& DUndertaker() { return *iDUndertaker; }
+    inline DMemSpyDriverOSAdaptionDCondVar& DCondVar() { return *iDCondVar; }
+    inline DMemSpyDriverOSAdaptionDTimer& DTimer() { return *iDTimer; }
+    inline DMemSpyDriverOSAdaptionDPropertyRef& DPropertyRef() { return *iDPropertyRef; }
+
+private: // Data members
+    DMemSpyDriverDevice& iDevice;
+    DMemSpyDriverOSAdaptionDThread* iDThread;
+    DMemSpyDriverOSAdaptionDProcess* iDProcess;
+    DMemSpyDriverOSAdaptionDChunk* iDChunk;
+    DMemSpyDriverOSAdaptionDServer* iDServer;
+    DMemSpyDriverOSAdaptionDSession* iDSession;
+    DMemSpyDriverOSAdaptionDCodeSeg* iDCodeSeg;
+    DMemSpyDriverOSAdaptionDSemaphore* iDSemaphore;
+    DMemSpyDriverOSAdaptionDMutex* iDMutex;
+    DMemSpyDriverOSAdaptionDLogicalDevice* iDLogicalDevice;
+    DMemSpyDriverOSAdaptionDPhysicalDevice* iDPhysicalDevice;
+    DMemSpyDriverOSAdaptionDChangeNotifier* iDChangeNotifier;
+    DMemSpyDriverOSAdaptionDUndertaker* iDUndertaker;
+    DMemSpyDriverOSAdaptionDCondVar* iDCondVar;
+    DMemSpyDriverOSAdaptionDTimer* iDTimer;
+    DMemSpyDriverOSAdaptionDPropertyRef* iDPropertyRef;
+    };
+
+
+// KNOWN OMISSIONS:
+//
+// + kernel container listing & query interface
+// + event handler (events: process, threads, code segs, chunks, ... )
+// + kernel heap information
+// + end thread / process
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverObjectIx.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,237 @@
+/*
+* 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 MEMSPYDRIVEROBJECTIX_H
+#define MEMSPYDRIVEROBJECTIX_H
+
+// System includes
+#include <kernel.h>
+#include <kern_priv.h>
+
+#if MCL_ROBJECTIX_DUPLICATION
+
+class RMemSpyObjectIx
+	{
+public:
+	enum {ENoClose=KHandleNoClose,ELocalHandle=0x40000000};
+	enum {EReserved=0x80000000u, EAttributeMask=0xfffu};
+	enum {EMinSlots=8, EMaxSlots=32768};
+public:
+	enum {ENumFreeQ=6, EModCount=4, EBitMapSize=128, EMaxLockedIter=8};
+private:
+	// queue numbers
+	enum {EQFree=-6, EQAltFree=-5, EQTempFree=-4, EQRsvd=-3, EQAltRsvd=-2, EQTempRsvd=-1};
+	// iObjR, iRsvd fields
+	enum {EObjROccupied=4u, EObjRObjMask=0xfffffffcu, EObjRRsvd=1u};
+	// states
+	enum {ENormal=0u, ETidying=1u, EFindingLast=2u, ECounting=3u, ESearching=4u, ETerminated=5u};
+	struct	SSlotQLink
+		{
+		TInt16		iNext;	// pointer to next free slot, -n if no next
+		TInt16		iPrev;	// pointer to previous free slot, -n if no previous
+		};
+	struct	SFreeSlot : public SSlotQLink
+		{
+		TUint32		iRsvd;	// 0 for normal, 1 for reserved slot
+		};
+	struct	SUsedSlot
+		{
+		TUint32		iAttr;	// bits 0-13 = instance (nonzero), bits 14-19 = object type, bits 20-31 = handle attributes
+		TUint32		iObjR;	// pointer to object (nonzero), bit 0=1 if reserved slot
+		};
+	union SSlot
+		{
+		SFreeSlot	iFree;
+		SUsedSlot	iUsed;
+		};
+	struct SMonitorObj
+		{
+		DObject*	iObj;
+		TInt		iBoundary;
+		TInt		iResult;
+		};
+	union SModList
+		{
+		TInt16		iIndex[EModCount];
+		TUint32		iBitMap[EBitMapSize/32];
+		SMonitorObj	iMonitor;
+		};
+private:
+#ifdef __HANDLES_USE_RW_SPIN_LOCK__
+// Beginning of support for spinlock-only protection (i.e. not requiring the system lock)
+// for access to handles.  Requires changes everywhere objects returned from handles are
+// used, and some additional work in the handle lookup code in cutils.cia.
+#error "spinlocks for handle lookup not supported"
+	inline void AcquireReadLock()
+		{ __SPIN_LOCK_IRQ_R(iRWL); }
+	inline void ReleaseReadLock()
+		{ __SPIN_UNLOCK_IRQ_R(iRWL); }
+	inline void AcquireWriteLock()
+		{ __SPIN_LOCK_IRQ_W(iRWL); }
+	inline void ReleaseWriteLock()
+		{ __SPIN_UNLOCK_IRQ_W(iRWL); }
+#else
+	/* Places which use a read lock would already have the system lock held */
+	inline void AcquireReadLock()
+		{ __ASSERT_SYSTEM_LOCK; }
+	inline void ReleaseReadLock()
+		{  }
+	inline void AcquireWriteLock()
+		{ NKern::LockSystem(); }
+	inline void ReleaseWriteLock()
+		{ NKern::UnlockSystem(); }
+#endif
+private:
+	static inline DObject* Occupant(SSlot* aS)
+		{ return (DObject*)(aS->iUsed.iObjR & EObjRObjMask); }
+	static inline TBool IsReserved(SSlot* aS)
+		{ return aS->iUsed.iObjR & EObjRRsvd; }
+	static inline TBool IsFreeReserved(SSlot* aS)
+		{ return (aS->iUsed.iObjR & EObjRRsvd) && (aS->iUsed.iObjR<EObjROccupied); }
+    /*
+	void Empty(TInt aQueue);
+	SSlot* Dequeue(TInt aSlotIndex);
+	void AddHead(TInt aQueue, TInt aSlotIndex);
+	void AddTail(TInt aQueue, TInt aSlotIndex);
+	void AddBefore(TInt aBase, TInt aSlotIndex);
+	void AddAfter(TInt aBase, TInt aSlotIndex);
+	void AppendList(TInt aSrcQ, TInt aDestQ);
+	void PrependList(TInt aSrcQ, TInt aDestQ);
+	TInt DoAdd(DObject* aObj, TUint32 aAttr, SSlot* aSlot);	// add aObj using an existing slot (don't grow)
+	TInt DoRemove(TInt aHandle, DObject*& aObject, TUint32& aAttr);	// remove a handle (don't shrink)
+	void MarkModified(TInt aSlotIndex);
+	static TUint32 GetNextInstanceValue();
+	TInt UnReserveSlots(TInt aCount, TBool aAmortize);
+	TInt ReserveSlots(TInt aCount);
+	TInt Grow(TInt aReserve, SSlot* aSlotData);
+	void TidyAndCompact();
+	inline SSlotQLink* Link(TInt aIndex)
+		{ return (aIndex<0) ? (iFreeQ+ENumFreeQ+aIndex) : &(iSlots+aIndex)->iFree; }
+        */
+public:
+	// common operations
+    RMemSpyObjectIx();
+
+    //static void Wait();
+	//static void Signal();
+
+    inline TInt Count()
+		{ return iCount; }
+	inline TInt ActiveCount()
+		{ return iActiveCount; }
+
+public:
+	// uncommon operations
+	DObject* operator[](TInt aIndex);
+	TBool Find(DObject* aObject);
+
+private:
+	TRWSpinLock		iRWL;
+	TInt			iAllocated;			// Max entries before realloc needed
+	volatile TInt	iCount;				// Points to at least 1 above the highest occupied slot or unoccupied reserved slot
+	volatile TInt	iActiveCount;		// Number of occupied entries in the index (reserved or normal)
+	volatile TInt	iReservedFree;		// Number of unoccupied reserved slots
+	volatile TInt	iReservedTotal;		// Number of reserved slots (occupied or unoccupied)
+	volatile TInt	iReservedFreeHWM;	// Points to at least 1 above the last unoccupied reserved slot
+	SSlotQLink		iFreeQ[ENumFreeQ];	// queues of free slots
+	SSlot*			iSlots;				// array of handle slots
+	TInt			iAmortize;			// Number of handle removals before we see if we can shrink
+	TUint8			iState;
+	TUint8			iModCount;			// 255=not in use, 0...EModCount->use iModList.iIndex[], EModCount+1->use iModList.iBitMap
+	TUint8			iModListShift;
+	TUint8			iSpare1;
+	SModList		iModList;			// Entries modified while array moving
+
+public:
+	static volatile TUint32 NextInstance;
+	static DMutex* HandleMutex;
+	};
+
+#elif MCL_DOBJECTIX_DUPLICATION
+
+class DMemSpyObjectIx : public DBase
+	{
+public:
+    inline DMemSpyObjectIx() { }
+
+public:
+	DObject* At(TInt aHandle,TInt aUniqueID);
+	DObject* At(TInt aHandle);
+	TBool Find(DObject* aObject);
+	TInt Count(DObject* aObject);
+	DObject* operator[](TInt aIndex);
+	//static void Wait( DMemSpyObjectIx* aObjectIndex );
+	//static void Signal( DMemSpyObjectIx* aObjectIndex );
+	inline TInt Count();
+	inline TInt ActiveCount();
+
+private:
+	TInt iNextInstance;
+	TInt iAllocated;		// Max entries before realloc needed
+	TInt iCount;			// Points to at least 1 above the highest active index
+	TInt iActiveCount;		// Number of actual entries in the index
+	SDObjectIxRec* iObjects;
+	TAny* iPtr;
+	TInt iFree;				// The index of the first free slot or -1.
+	TInt iUpdateDisabled;   // If >0, disables: iCount update, reorder of the free list and memory shrinking.
+
+public:
+	static DMutex* HandleMutex;
+	};
+
+inline TInt DMemSpyObjectIx::Count()
+	{return iCount;}
+
+inline TInt DMemSpyObjectIx::ActiveCount()
+	{return iActiveCount;}
+
+#endif
+
+
+
+#if MCL_ROBJECTIX_DUPLICATION
+
+    #define MemSpyObjectIx                                          RMemSpyObjectIx
+    //#define MemSpyObjectIx_Wait( IX )                               RMemSpyObjectIx::Wait()
+    //#define MemSpyObjectIx_Signal( IX )                             RMemSpyObjectIx::Signal()
+    #define MemSpyObjectIx_GetHandlePointer_Thread( DTHREAD )       reinterpret_cast< MemSpyObjectIx* >( &DTHREAD.iHandles )
+    #define MemSpyObjectIx_GetHandlePointer_Process( DPROCESS )     reinterpret_cast< MemSpyObjectIx* >( &DPROCESS.iHandles )
+
+#elif MCL_DOBJECTIX_DUPLICATION
+
+    #define MemSpyObjectIx                                          DMemSpyObjectIx
+    //#define MemSpyObjectIx_Wait( IX )                               DMemSpyObjectIx::Wait( IX )
+    //#define MemSpyObjectIx_Signal( IX )                             DMemSpyObjectIx::Signal( IX )
+    #define MemSpyObjectIx_GetHandlePointer_Thread( DTHREAD )       reinterpret_cast< MemSpyObjectIx* >( DTHREAD.iHandles )
+    #define MemSpyObjectIx_GetHandlePointer_Process( DPROCESS )     reinterpret_cast< MemSpyObjectIx* >( DPROCESS.iHandles )
+
+#else
+
+    #define MemSpyObjectIx                  DObjectIx
+    //#define MemSpyObjectIx_Wait( IX )       
+    //#define MemSpyObjectIx_Signal( IX )     
+    #define MemSpyObjectIx_IsValid_Thread( DTHREAD )    ( DTHREAD.iHandles != NULL )
+    #define MemSpyObjectIx_IsValid_Process( DPROCESS )  ( DPROCESS.iHandles != NULL )
+    #define MemSpyObjectIx_GetHandlePointer_Thread( DTHREAD )       reinterpret_cast< MemSpyObjectIx* >( DTHREAD.iHandles )
+    #define MemSpyObjectIx_GetHandlePointer_Process( DPROCESS )     reinterpret_cast< MemSpyObjectIx* >( DPROCESS.iHandles )
+
+#endif
+
+#define MemSpyObjectIx_HandleLookupLock()							NKern::LockSystem()
+#define MemSpyObjectIx_HandleLookupUnlock()							NKern::UnlockSystem()
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverPAndS.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* 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 MEMSPYDRIVERPANDS_H
+#define MEMSPYDRIVERPANDS_H
+
+// System includes
+#include <e32property.h>
+#include <kernel.h>
+#include <kern_priv.h>
+#include <sproperty.h>
+
+// User includes
+#include "MemSpyDriverLog.h"
+#include <memspy/driver/memspydriverpanics.h>
+
+
+/** 
+ * Spoof TProperty, the kernel-side object that encapsulates all P&S keys
+ */
+class TMemSpyProperty 
+	{
+public:
+	// The property attributes.
+	// Meaningful for defined properties only (ie. iType != RProperty::ETypeLimit)
+	// Constant while the property is defined
+	inline TUint32 Owner() { return iOwner; }
+
+public:
+	const TUint		iCategory;
+	const TUint		iKey;
+
+public:
+	// iType == RProperty::ETypeLimit means not defined
+	TUint8	iType;	// updates require the system lock AND the feature lock 
+					// reads require only one of them
+	// The property attributes.
+	// Meaningful for defined properties only (ie. iType != RProperty::ETypeLimit)
+	// Constant while the property is defined
+	TUint8	iAttr;
+	TCompiledSecurityPolicy iReadPolicy;
+	TCompiledSecurityPolicy iWritePolicy;
+	TUint32	iOwner;
+
+	TUint		iRefCount;	// protected by the feature lock
+	TProperty*	iNext;		// hash table collision list link -
+							//		protected by the feature lock
+
+	class TBuf
+		{ // Viraiable-size buffer for  byte array property values
+	public:
+		static TBuf* New(TInt aSize);
+
+		TUint16	iBufSize;		// buffer size - constant
+		TUint16	iSize;			// actual property size - protected by the system lock
+		TUint8	iBytes[1];		// byte array - protected by the system lock
+		};
+
+	// The property value
+	// Meaningful for defined properties only (ie. iType != RProperty::ETypeLimit)
+	union	// the value (ie. iValue or iBuf->iBytes) is protected by the system lock
+		{ 
+		TBuf*	iBuf;   // pointer updates of a defined property (eg. buffer 
+						//   reallocation) require the system AND the feature locks;
+						// pointer reads (eg to get/set byte values) require any of them
+		TInt	iValue;
+		};
+
+	// Called with system or feature locked
+	TInt Size()
+		{
+		return iBuf ? iBuf->iSize : 0;
+		}
+
+	// Called with system or feature locked
+	TUint8* Buf()
+		{
+		return iBuf ? iBuf->iBytes : NULL;
+		}
+
+	SDblQue	iPendingQue;	// pending subscriptions - protected by the system lock
+	};
+
+
+
+/**
+ * Spoof of DPropertyRef - the kernel-side object that represents user-side P&S property keys
+ */
+class DMemSpyPropertyRef : public DObject
+	{
+public:
+	TMemSpyProperty*		iProp;
+	TRequestStatus*			iStatus;
+	DThread*				iClient;
+	TPropertySubsRequest	iSubs;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverStreamWriter.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* 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 MEMSPYDRIVERSTREAMWRITER_H
+#define MEMSPYDRIVERSTREAMWRITER_H
+
+// System includes
+#include <e32cmn.h>
+#include <kernel.h>
+
+// Classes referenced
+class DMemSpyDriverXferBuffer;
+
+
+class RMemSpyMemStreamWriter
+    {
+public:
+    RMemSpyMemStreamWriter();
+    RMemSpyMemStreamWriter( DMemSpyDriverXferBuffer& aBuffer );
+
+public: // API - closure
+    void Close();
+    TInt WriteAndClose( TDes8* aDestinationPointer );
+
+public: // API - writing
+    TInt32* WriteInt32( TInt32 aValue );
+    TUint32* WriteUint32( TUint32 aValue );
+
+public: // API - positioning
+    TUint8* Current() const;
+    void Seek( TInt aPosition );
+    TUint32 Remaining() const;
+
+public: // API - marking
+    void MarkSet();
+    void MarkResume();
+
+public: // API - misc
+    TBool IsFull() const;
+    TBool IsOpen() const;
+
+public: // API - operators
+    RMemSpyMemStreamWriter& operator=( const RMemSpyMemStreamWriter& aCopy );
+
+private: // Internal methods
+    void IncrementPos( TInt aAmount );
+
+private:
+    DMemSpyDriverXferBuffer* iBuffer;
+    TUint8* iCurrent;
+    TUint8* iMax;
+    TUint8* iMark;
+    TInt iCommitted;
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverSuspensionManager.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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 MEMSPYDRIVERSUSPENSIONMANAGER_H
+#define MEMSPYDRIVERSUSPENSIONMANAGER_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// Classes referenced
+class DMemSpyDriverDevice;
+
+
+class DMemSpySuspensionManager : public DBase
+	{
+public: // Construct & destruct
+	DMemSpySuspensionManager( DMemSpyDriverDevice& aDevice );
+	~DMemSpySuspensionManager();
+	TInt Construct();
+
+public: // API
+    TBool IsSuspended( TUint aPid ) const;
+    TBool IsSuspended( DThread& aThread ) const;
+    TBool IsSuspended( DProcess& aProcess ) const;
+    TInt SuspendAllThreadsInProcess( TUint aPid, DThread& aClientThread );
+    TInt ResumeAllThreadsInProcess( TUint aPid, DThread& aClientThread );
+
+private: // Internal methods
+    TInt DoSuspendAllThreadsInProcess( TUint aPid, DThread* aClientThread = NULL );
+    TInt DoResumeAllThreadsInProcess( TUint aPid, DThread* aClientThread = NULL );
+    TBool IsProcessTheClientThread( TUint aPid, DThread& aClientThread ) const;
+    TBool CheckProcessSuspended( TUint aExpectedPid, DThread& aClientThread ) const;
+	TInt OpenTempObject(TUint aId, TObjectType aType );
+	void CloseTempObject();
+
+private: // Data members
+    DMemSpyDriverDevice& iDevice;
+	DObject* iTempObj;
+    TBool iAlreadySuspended;
+	TUint iSuspendedProcessId;
+	TInt iSuspendCount;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverUserEventMonitor.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* 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 MEMSPYDRIVERUSEREVENTMONITOR_H
+#define MEMSPYDRIVERUSEREVENTMONITOR_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+#ifdef __MARM__
+#include <arm.h>
+#endif
+
+// User includes
+#include "MemSpyDriverEventMonitor.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class DMemSpyDriverClientEM;
+
+
+class DMemSpyDriverClientEMManager : public DBase
+    {
+public:
+    DMemSpyDriverClientEMManager( DMemSpyDriverDevice& aDevice );
+    ~DMemSpyDriverClientEMManager();
+    TInt Create();
+    
+public: // API
+    DMemSpyDriverClientEM* EMOpen();
+    TInt EMClose( TUint aHandle );
+    DMemSpyDriverClientEM* EMInstance( TUint aHandle );
+
+private: // Internal methods
+    void FreeAllInstances();
+
+private:
+    DMemSpyDriverDevice& iDevice;
+    TUint iNextHandle;
+	SDblQue iEMInstances;
+    };
+
+
+/**
+ * This class represents a client-originated Event Monitor request
+ */
+class DMemSpyDriverClientEM : public DBase, public MMemSpyEventMonitorObserver
+	{
+public:
+	DMemSpyDriverClientEM( DMemSpyDriverDevice& aDevice, TUint aHandle );
+	~DMemSpyDriverClientEM();
+    TInt Create();
+
+public: // API
+    inline TUint Handle() const { return iHandle; }
+    //
+	TInt NotifyChanges( DThread* aClientThread, TRequestStatus* aClientRS, TAny* aClientContext );
+	TInt NotifyChangesCancel();
+
+public: // From MMemSpyEventMonitorObserver
+    TUint EMTypeMask() const;
+    void EMHandleProcessAdd( DProcess& aProcess );
+    void EMHandleProcessRemoved( DProcess& aProcess );
+    void EMHandleThreadAdd( DThread& aThread );
+    void EMHandleThreadKilled( DThread& aThread );
+    void EMHandleChunkAdd( DChunk& aChunk );
+    void EMHandleChunkDeleted( DChunk& aChunk );
+
+private: // Internal methods
+    void ResetPendingChanges();
+    void CompleteClientsRequest( TInt aCompletionCode, TUint aContext = 0 );
+
+private: // Internal objects
+
+    class TChange
+        {
+    public:
+        inline TChange( TInt aCompletionCode, TUint aContext )
+        :   iCompletionCode( aCompletionCode ), iContext( aContext )
+            {
+            }
+
+    public: // Data members
+        TInt iCompletionCode;
+    	TUint iContext;
+    	SDblQueLink iLink;
+        };
+
+private:
+    DMemSpyDriverDevice& iDevice;
+	DMutex* iLock;
+    const TUint iHandle;
+	SDblQue iPendingChanges;
+
+    // Transient: client-originated
+    DThread* iClientThread;
+    TRequestStatus* iClientRS;
+    TAny* iClientContext;
+
+public:
+    SDblQueLink iLink;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverUtils.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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 MEMSPYDRIVERUTILS_H
+#define MEMSPYDRIVERUTILS_H
+
+// System includes
+#include <kernel.h>
+#include <memspy/driver/memspydriverpanics.h>
+
+// User includes
+#include "MemSpyDriverLog.h"
+
+// Classes referenced
+class TMemSpyDriverRegSet;
+class DMemSpyDriverOSAdaption;
+
+
+class MemSpyDriverUtils
+	{
+public:
+    static void DataDump( const char* aFmt, const TUint8* aAddress, TInt aLength, TInt aMaxLength);
+    static void PanicThread( DThread& aThread, TMemSpyDriverPanic aPanicType );
+    static void Fault( TInt aReason );
+    static void GetThreadRegisters( NThread* aThread, TMemSpyDriverRegSet& aInfo );
+    static TThreadPriority MapToUserThreadPriority( TInt aPriority );
+    static TInt MapToAbsoluteThreadPriority( TThreadPriority aPriority );
+    static void PrintChunkInfo( DChunk& aChunk, DMemSpyDriverOSAdaption& aOSAdaption );
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverXferBuffer.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* 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 MEMSPYDRIVERXFERBUFFER_H
+#define MEMSPYDRIVERXFERBUFFER_H
+
+// System includes
+#include <e32cmn.h>
+#include <kernel.h>
+
+// Classes referenced
+class DMemSpyDriverDevice;
+
+
+class DMemSpyDriverXferBuffer : public DBase
+	{
+    friend class RMemSpyMemStreamWriter;
+
+public:
+	DMemSpyDriverXferBuffer( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverXferBuffer();
+    TInt Construct( TInt aSize );
+
+public: // API
+    TInt Size() const;
+    TInt GrowBy( TInt aSize );
+    TInt EnsureCapacity( TInt aSize );
+    void Reset();
+
+private: // Internal methods
+    TInt WriteToClient( TDes8* aDestinationPointer, TInt aLength );
+    DThread& ClientThread();
+    TUint8* Ptr();
+
+private: // Data members
+    DMemSpyDriverDevice& iDevice;
+	DThread& iClientThread;
+    TInt iSize;
+    TAny* iBuffer;
+	};
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanBase.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* 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 MEMSPYDRIVERLOGCHANBASE_H
+#define MEMSPYDRIVERLOGCHANBASE_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+#ifdef __MARM__
+#include <arm.h>
+#endif
+
+// User includes
+#include "MemSpyDriverStreamWriter.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class DMemSpyDriverXferBuffer;
+class DMemSpyDriverOSAdaption;
+class DMemSpySuspensionManager;
+
+class DMemSpyDriverLogChanBase : public DBase
+	{
+public:
+	~DMemSpyDriverLogChanBase();
+
+protected: // Internal construction
+	DMemSpyDriverLogChanBase( DMemSpyDriverDevice& aDevice, DThread& aThread );
+    TInt BaseConstruct( TInt aTransferBufferSize = 0 );
+
+public: // API
+    /**
+     * Finish construction of the channel object
+     */
+    virtual TInt Construct();
+
+    /**
+     * Request a channel function - this function implementation (in this class)
+     * is able to perform general policing, e.g. SID, capability etc.
+     *
+     * Currently this always returns KErrNone, but none the less, derived classes
+     * should call this implementation and handle return value appropriately.
+     */
+    virtual TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+
+    /**
+     * Sub channel should return ETrue if it can handle the specified function
+     * request.
+     */
+    virtual TBool IsHandler( TInt aFunction ) const = 0;
+
+protected: // Internal access
+    DMemSpyDriverDevice& MemSpyDevice();
+    DMemSpySuspensionManager& SuspensionManager();
+
+protected: // Internal methods
+	TInt OpenTempObject( TUint aId, TObjectType aType, TBool aAllowDeadObjects = EFalse );
+	void CloseTempObject();
+    DThread& TempObjectAsThread();
+    DProcess& TempObjectAsProcess();
+
+protected: // Transfer buffer
+    RMemSpyMemStreamWriter OpenXferStream();
+    TInt OpenXferStream( RMemSpyMemStreamWriter& aWriter, TInt aRequiredSize );
+
+protected: // Internal access
+    DMemSpyDriverOSAdaption& OSAdaption();
+    inline DObject* TempObject() { return iTempObj; }
+    inline const DObject* TempObject() const { return iTempObj; }
+    //
+    inline DThread& ClientThread() { return iClientThread; }
+
+private: // Data members
+    DMemSpyDriverDevice& iDevice;
+	DThread& iClientThread;
+	DObject* iTempObj;
+    DMemSpyDriverXferBuffer* iXferBuffer;
+	};
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanChunks.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANCHUNKS_H
+#define MEMSPYDRIVERLOGICALCHANCHUNKS_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// User includes
+#include "MemSpyDriverLogChanBase.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class TMemSpyDriverInternalChunkInfoParams;
+class TMemSpyDriverInternalChunkHandleParams;
+
+
+class DMemSpyDriverLogChanChunks : public DMemSpyDriverLogChanBase
+	{
+public:
+	DMemSpyDriverLogChanChunks( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanChunks();
+
+public: // From DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt GetChunkInfo( TMemSpyDriverInternalChunkInfoParams* aParams );
+    TInt GetChunkHandles( TMemSpyDriverInternalChunkHandleParams* aParams );
+
+private: // Internal methods
+    void PrintChunkInfo( DChunk& aChunk );
+    TMemSpyDriverChunkType IdentifyChunkType( DChunk& aChunk );
+    TBool IsHeapChunk( DChunk& aChunk, const TName& aName );
+    TBool DoesChunkRelateToProcess( DChunk& aChunk, DProcess& aProcess );
+
+private: // Data members
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanClientServer.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANCLIENTSERVER_H
+#define MEMSPYDRIVERLOGICALCHANCLIENTSERVER_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverLogChanContainerBase.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class TMemSpyDriverServerSessionInfo;
+class TMemSpyDriverInternalServerSessionHandleParams;
+
+
+
+class DMemSpyDriverLogChanClientServer : public DMemSpyDriverLogChanContainerBase
+	{
+public:
+	DMemSpyDriverLogChanClientServer( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanClientServer();
+
+public: // From DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt GetServerSessionHandles( TMemSpyDriverInternalServerSessionHandleParams* aParams );
+    TInt GetServerSessionInfo( TAny* aSessionHandle, TMemSpyDriverServerSessionInfo* aParams );
+
+private: // Internal methods
+
+private: // Data members
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanCodeSegs.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANCODESEGS_H
+#define MEMSPYDRIVERLOGICALCHANCODESEGS_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverLogChanBase.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class TMemSpyDriverInternalCodeSegParams;
+class TMemSpyDriverInternalCodeSnapshotParams;
+
+
+class DMemSpyDriverLogChanCodeSegs : public DMemSpyDriverLogChanBase
+	{
+public:
+	DMemSpyDriverLogChanCodeSegs( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanCodeSegs();
+
+public: // From DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt GetCodeSegs( TMemSpyDriverInternalCodeSnapshotParams* aParams );
+	TInt GetCodeSegsForProcess( TMemSpyDriverInternalCodeSnapshotParams* aParams );
+	TInt GetCodeSegInfo( TMemSpyDriverInternalCodeSegParams* aParams );
+
+private: // Data members
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanContainerBase.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANCONTAINERBASE_H
+#define MEMSPYDRIVERLOGICALCHANCONTAINERBASE_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverLogChanBase.h"
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// Classes referenced
+class DMemSpyDriverDevice;
+
+// Constants
+const TInt KMemSpyDriverMaxHandles = 1024 * 2;
+
+
+class DMemSpyDriverLogChanContainerBase : public DMemSpyDriverLogChanBase
+	{
+public:
+	DMemSpyDriverLogChanContainerBase( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanContainerBase();
+
+protected: // Internal methods
+    static TObjectType ObjectTypeFromMemSpyContainerType( TMemSpyDriverContainerType aType );
+
+	// Must be in critical section to call
+	DObject* CheckedOpen(TMemSpyDriverContainerType aContainerType, DObject* aObject, TBool aQuick=EFalse);
+
+protected: // Internal methods
+    void ResetTempHandles();
+    void AddTempHandle( TAny* aHandle);
+    TAny* TempHandleAt( TInt aIndex ) const;
+    TInt TempHandleCount() const;
+    TInt WriteToClient( TAny** aHandlePtr, TInt* aCountPtr, TInt aMaxCount );
+
+private: // Data members
+	TInt iTempHandleCount;
+	TAny* iTempHandles[ KMemSpyDriverMaxHandles ];
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanContainers.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANCONTAINERS_H
+#define MEMSPYDRIVERLOGICALCHANCONTAINERS_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverLogChanContainerBase.h"
+
+// Classes referenced
+class TMemSpyDriverPAndSInfo;
+class DMemSpyDriverDevice;
+class TMemSpyDriverHandleInfoGeneric;
+class TMemSpyDriverInternalContainerHandleParams;
+class TMemSpyDriverInternalRefsToThreadOrProcess;
+class TMemSpyDriverInternalCondVarSuspendedThreadParams;
+class TMemSpyDriverCondVarSuspendedThreadInfo;
+
+
+class DMemSpyDriverLogChanContainers : public DMemSpyDriverLogChanContainerBase
+	{
+public:
+	DMemSpyDriverLogChanContainers( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanContainers();
+    TInt Construct();
+
+public: // From DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt GetContainerHandles( TMemSpyDriverInternalContainerHandleParams* aParams );
+    TInt GetKernelObjectSizeApproximation( TMemSpyDriverContainerType aType, TInt* aSize );
+    TInt GetGenericHandleInfo( TInt aTid, TMemSpyDriverHandleInfoGeneric* aParams );
+    TInt GetReferencesToMyThread( TUint aTid, TDes8* aBufferSink );
+    TInt GetReferencesToMyProcess( TUint aTid, TDes8* aBufferSink );
+    TInt GetPAndSInfo( DObject* aHandle, TMemSpyDriverPAndSInfo* aInfo );
+    TInt GetCondVarSuspendedThreads( TMemSpyDriverInternalCondVarSuspendedThreadParams* aParams );
+    TInt GetCondVarSuspendedThreadInfo( TAny* aThreadHandle, TMemSpyDriverCondVarSuspendedThreadInfo* aParams );
+
+    
+private: // Internal methods
+    TInt SearchThreadsFor( DObject* aHandleToLookFor, RMemSpyMemStreamWriter& aStream );
+    TInt SearchProcessFor( DObject* aHandleToLookFor, RMemSpyMemStreamWriter& aStream );
+    static TMemSpyDriverTimerState MapToMemSpyTimerState( TTimer::TTimerState aState );
+    static TMemSpyDriverTimerType MapToMemSpyTimerType( TTimer::TTimerType aType );
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapBase.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANHEAPBASE_H
+#define MEMSPYDRIVERLOGICALCHANHEAPBASE_H
+
+// System includes
+#include <kern_priv.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// User includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverLogChanBase.h"
+#include "MemSpyDriverObjectsInternal.h"
+#include "MemSpyDriverHeapWalker.h"
+#include "MemSpyDriverEnumerationsInternal.h"
+
+// Classes referenced
+class TMemSpyHeapInfo;
+class DMemSpyDriverDevice;
+class RMemSpyDriverRHeapUser;
+class RMemSpyMemStreamWriter;
+class RMemSpyDriverRHeapKernelInPlace;
+class RMemSpyDriverRHeapKernelFromCopy;
+
+
+class DMemSpyDriverLogChanHeapBase : public DMemSpyDriverLogChanBase, public MMemSpyHeapWalkerObserver
+	{
+public:
+    enum TDrmMatchType
+        {
+        EMatchTypeNone = 0,
+        EMatchTypeName,
+        EMatchTypeUid
+        };
+public:
+	~DMemSpyDriverLogChanHeapBase();
+
+protected:
+	DMemSpyDriverLogChanHeapBase( DMemSpyDriverDevice& aDevice, DThread& aThread );
+    TInt Construct();
+
+protected: // From DMemSpyDriverLogChanBase
+    TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+
+protected: // Capability checks for heap access
+    TDrmMatchType IsDrmThread( DThread& aThread );
+
+protected: // From MHeapWalkerObserver
+    void HandleHeapWalkInit();
+    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
+
+    // Points to stack-based object whilst walking in progress
+    RMemSpyMemStreamWriter* iStackStream;
+    TInt iFreeCellCount;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapData.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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/MemSpyDriverLogChanHeapInfo.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapWalk.h	Mon Sep 06 15:00:47 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 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/MemSpyDriverLogChanMisc.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANMISC_H
+#define MEMSPYDRIVERLOGICALCHANMISC_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverLogChanBase.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+
+
+class DMemSpyDriverLogChanMisc : public DMemSpyDriverLogChanBase
+	{
+public:
+	DMemSpyDriverLogChanMisc( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanMisc();
+
+public: // From DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt SetRHeapVTable( TAny* aRHeapVTable );
+    TInt GetMemoryModelType();
+    TInt GetRoundToPageSize( TUint32* aValue );
+    TInt Impersonate( TUint32 aValue );
+
+private: // Data members
+    TUint32 iSID;
+    TUint32 iSecurityZone;
+    TBool iClientIsMemSpy;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanProcessInspection.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANPROCESSINSPECTION_H
+#define MEMSPYDRIVERLOGICALCHANPROCESSINSPECTION_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverLogChanBase.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class TMemSpyDriverProcessInspectionInfo;
+
+
+class DMemSpyDriverLogChanProcessInspection : public DMemSpyDriverLogChanBase
+	{
+public:
+	DMemSpyDriverLogChanProcessInspection( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanProcessInspection();
+
+public: // From DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt ProcessInspectionOpen( TUint aPid );
+    TInt ProcessInspectionClose( TUint aPid );
+    TInt ProcessInspectionRequestChanges( TRequestStatus* aStatus, TMemSpyDriverProcessInspectionInfo* aInfo );
+    TInt ProcessInspectionRequestChangesCancel( TUint aPid );
+    TInt ProcessInspectionAutoStartItemsClear();
+    TInt ProcessInspectionAutoStartItemsAdd( TUint aSID );
+
+private: // Data members
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanRawMemory.h	Mon Sep 06 15:00:47 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 MEMSPYDRIVERLOGICALCHANRAWMEMORY_H
+#define MEMSPYDRIVERLOGICALCHANRAWMEMORY_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverLogChanBase.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class TMemSpyDriverInternalReadMemParams;
+
+
+class DMemSpyDriverLogChanRawMemory : public DMemSpyDriverLogChanBase
+	{
+public:
+	DMemSpyDriverLogChanRawMemory( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanRawMemory();
+
+public: // From DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+	TInt ReadMem( TMemSpyDriverInternalReadMemParams* aParams );
+
+private: // Data members
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanStack.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANSTACK_H
+#define MEMSPYDRIVERLOGICALCHANSTACK_H
+
+// System includes
+#include <e32cmn.h>
+#include <kernel.h>
+
+// Shared includes
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// User includes
+#include "MemSpyDriverLogChanBase.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class TMemSpyDriverStackInfo;
+class TMemSpyDriverInternalStackDataParams;
+
+
+
+class DMemSpyDriverLogChanStack : public DMemSpyDriverLogChanBase
+	{
+public:
+	DMemSpyDriverLogChanStack( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanStack();
+
+public: // From DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt GetStackData( TMemSpyDriverInternalStackDataParams* aParams );
+    TInt GetStackInfo( TUint aTid, TMemSpyDriverStackInfo* aParams );
+
+private: // Internal methods
+    void GetStackPointers( DThread* aThread, TUint& aSupSP, TUint& aUsrSP );
+    TInt GetStackHighWatermark( DThread& aThread, TLinAddr& aHighWaterMark, TMemSpyDriverDomainType aDomain, TUint aRune );
+    TInt ReadStackData( DThread& aThread, TDes8& aDestination, TUint8*& aReadAddress, TMemSpyDriverDomainType aDomain );
+    TLinAddr GetStackPointerByDomain( DThread* aThread, TMemSpyDriverDomainType aDomainType );
+
+private: // Data members
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanThreadAndProcess.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANTHREADANDPROCESS_H
+#define MEMSPYDRIVERLOGICALCHANTHREADANDPROCESS_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverLogChanBase.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class TMemSpyDriverProcessInfo;
+class TMemSpyDriverInternalThreadInfoParams;
+
+
+class DMemSpyDriverLogChanThreadAndProcess : public DMemSpyDriverLogChanBase
+	{
+public:
+	DMemSpyDriverLogChanThreadAndProcess( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanThreadAndProcess();
+    TInt Construct();
+
+public: // From DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+	TInt GetInfoThread(TUint aTid, TMemSpyDriverInternalThreadInfoParams* aParams );
+	TInt GetInfoProcess(TUint aTid, TMemSpyDriverProcessInfo* aParams );
+    TInt EndThread( TUint aId, TExitType aType );
+    TInt OpenThread( TUint aId );
+    TInt OpenProcess( TUint aId );
+    TInt SuspendAllThreadsInProcess( TUint aPid );
+    TInt ResumeAllThreadsInProcess( TUint aPid );
+    TInt GetThreadsForProcess( TUint aPid, TDes8* aBufferSink );
+    TInt SetPriority( TUint aTid, TThreadPriority aPriority );
+
+private: // Internal methods
+    static TInt MapToMemSpyExitReason( TExitType aType );
+
+private: // Data members
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanUserEventMonitor.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 MEMSPYDRIVERLOGICALCHANUSEREVENTMONITOR_H
+#define MEMSPYDRIVERLOGICALCHANUSEREVENTMONITOR_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverLogChanBase.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class DMemSpyDriverClientEMManager;
+class TMemSpyDriverInternalEventMonitorParams;
+
+
+class DMemSpyDriverLogChanUserEventMonitor : public DMemSpyDriverLogChanBase
+	{
+public:
+	DMemSpyDriverLogChanUserEventMonitor( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanUserEventMonitor();
+
+public: // From DMemSpyDriverLogChanBase
+    TInt Construct();
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt EventMonitorOpen( TAny* aHandle );
+    TInt EventMonitorClose( TUint aHandle );
+    TInt EventMonitorNotify( TMemSpyDriverInternalEventMonitorParams* aParams );
+    TInt EventMonitorNotifyCancel( TUint aHandle );
+
+private: // Data members
+    DMemSpyDriverClientEMManager* iEventMonitorManager;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverDevice.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,220 @@
+/*
+* 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 "MemSpyDriverDevice.h"
+
+// System includes
+#include <memspy/driver/memspydriverconstants.h>
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverEventMonitor.h"
+#include "MemSpyDriverLogicalChannel.h"
+#include "MemSpyDriverSuspensionManager.h"
+#include "MemSpyDriverInspectedProcessManager.h"
+
+
+
+DMemSpyDriverDevice::DMemSpyDriverDevice()
+	{
+	iVersion = KMemSpyDriverVersion();
+	}
+
+
+DMemSpyDriverDevice::~DMemSpyDriverDevice()
+    {
+	TRACE( Kern::Printf("DMemSpyDriverDevice::~DMemSpyDriverDevice() - START"));
+
+    Cleanup();
+    
+    TRACE( Kern::Printf("DMemSpyDriverDevice::~DMemSpyDriverDevice() - END"));
+    }
+
+
+TInt DMemSpyDriverDevice::Install()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - START"));
+    TInt error = KErrNone;
+    //
+	TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - creating event monitor..."));
+	iEventMonitor = new DMemSpyEventMonitor();
+	//
+	if	( iEventMonitor != NULL )
+    	{
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - constructing event monitor..."));
+		error = iEventMonitor->Create( this );
+		//
+		if	( error == KErrNone )
+			{
+	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - starting event monitor..."));
+			error = iEventMonitor->Start();
+			//
+			if	( error == KErrNone )
+				{
+	            TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - creating process manager..."));
+                iProcessManager = new DMemSpyInspectedProcessManager();
+                //
+                if  ( iProcessManager != NULL )
+                    {
+	                TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - constructing process manager..."));
+                    error = iProcessManager->Create( this );
+                    //
+                    if  ( error == KErrNone )
+                        {
+	                    TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - creating process manager..."));
+                        iSuspensionManager = new DMemSpySuspensionManager( *this );
+                        //
+                        if  ( iSuspensionManager != NULL )
+                            {
+	                        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - constructing process manager..."));
+                            error = iSuspensionManager->Construct();
+                            //
+                            if  ( error == KErrNone )
+                                {
+	                            TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - creating os adaption..."));
+                                iOSAdaption = new DMemSpyDriverOSAdaption( *this );
+                                //
+                                if  ( iOSAdaption != NULL )
+                                    {
+	                                TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - constructing os adaption..."));
+                                    error = iOSAdaption->Construct();
+                                    //
+                                    if  ( error == KErrNone )
+                                        {
+                                        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - setting name..."));
+				                        error = SetName( &KMemSpyDriverDeviceName );
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+				}
+			}
+        }
+    
+    // Handle errors
+    if  ( error != KErrNone )
+        {
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - error: %d", error ));
+        if  ( iProcessManager )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - closing PM" ));
+            iProcessManager->Close( NULL );
+            iProcessManager = NULL;
+            }
+        if  ( iEventMonitor )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - stopping EM" ));
+            iEventMonitor->Stop();
+	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - closing EM" ));
+            iEventMonitor->Close();
+	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - deleting EM" ));
+            iEventMonitor = NULL;
+            }
+        if  ( iSuspensionManager )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - deleting SM" ));
+            delete iSuspensionManager;
+            iSuspensionManager = NULL;
+            }
+        }
+    //
+	TRACE( Kern::Printf("DMemSpyDriverDevice::Install() - END - error: %d", error ));
+	return error;
+	}
+
+
+void DMemSpyDriverDevice::GetCaps( TDes8& /*aDes*/ ) const
+	{
+	}
+
+
+TInt DMemSpyDriverDevice::Create( DLogicalChannelBase*& aChannel )
+	{
+    TRACE( Kern::Printf("DMemSpyDriverDevice::Create() - START"));
+    TInt r = KErrNoMemory;
+    //
+	aChannel = new DMemSpyDriverLogicalChannel;
+    //
+    if  ( aChannel )
+        {
+        if  ( iProcessManager == NULL && iEventMonitor == NULL && iSuspensionManager == NULL )
+            {
+            TRACE( Kern::Printf("DMemSpyDriverDevice::Create() - need to re-create objects, calling Install()"));
+            r = Install();
+            TRACE( Kern::Printf("DMemSpyDriverDevice::Create() - called Install()"));
+            }
+        else
+            {
+            r = KErrNone;
+            }
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverDevice::Create() - END - r: %d", r ));
+	return r;
+	}
+
+
+void DMemSpyDriverDevice::Cleanup()
+    {
+
+    NKern::ThreadEnterCS();
+    if  ( iProcessManager )
+        {
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - destroying process manager..."));
+        iProcessManager->Close( NULL );
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - process manager destroyed"));
+        iProcessManager = NULL;
+        }
+    
+    if  ( iEventMonitor )
+        {
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - destroying event monitor..."));
+        iEventMonitor->Stop();
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - stopped event monitor..."));
+        iEventMonitor->Close();
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - closed event monitor..."));
+        iEventMonitor = NULL;
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - event monitor destroyed"));
+        }
+    
+    if  ( iSuspensionManager )
+        {
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - destroying suspension manager..."));
+        delete iSuspensionManager;
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - suspension manager destroyed"));
+        iSuspensionManager = NULL;
+        }
+
+    if  ( iOSAdaption )
+        {
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - destroying os adaption..."));
+        delete iOSAdaption;
+	    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - suspension os adaption destroyed"));
+        iOSAdaption = NULL;
+        }
+
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverDevice::Cleanup() - END"));
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverEntryPoint.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 "MemSpyDriverDevice.h"
+
+// System includes
+#include <kernel.h>
+
+DECLARE_STANDARD_LDD()
+	{
+	return new DMemSpyDriverDevice();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverEventMonitor.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,450 @@
+/*
+* 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 "MemSpyDriverEventMonitor.h"
+
+// System includes
+#include <kern_priv.h>
+#include <nk_trace.h>
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+
+#ifdef __MARM__
+#include "kdebug.h"
+#endif //__MARM__
+
+_LIT( KMemSpyEventMonitorMutexName, "MemSpyEventMonitor");
+
+
+DMemSpyEventMonitor::DMemSpyEventMonitor()
+:	DKernelEventHandler( EventHandler, this )
+	{
+	}
+
+
+DMemSpyEventMonitor::~DMemSpyEventMonitor()
+	{
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::~DMemSpyEventMonitor() - START" ));
+
+	if  ( iLock )
+		{
+        TRACE_EM( Kern::Printf("DMemSpyEventMonitor::~DMemSpyEventMonitor() - closing iLock mutex" ));
+		iLock->Close(NULL);
+		}
+
+	if  ( iDevice )
+		{
+        TRACE_EM( Kern::Printf("DMemSpyEventMonitor::~DMemSpyEventMonitor() - closing iDevice" ));
+		iDevice->Close(NULL);
+		}
+
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::~DMemSpyEventMonitor() - END" ));
+	}
+
+
+TInt DMemSpyEventMonitor::Create( DMemSpyDriverDevice* aDevice )
+	{
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Create() - START - aDevice: 0x%08x", aDevice ));
+    TInt err = aDevice->Open();
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Create() - device open err: %d", err ));
+    //
+    if (err == KErrNone )
+	    {
+        iDevice = aDevice;
+        //
+        err = Kern::MutexCreate( iLock, KMemSpyEventMonitorMutexName, KMutexOrdNone );
+        TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Create() - mutex create error: %d", err ));
+        //
+        if (!err)
+	        {
+	        err = Add();
+	        }
+        }
+    //	
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Create() - END - err: %d", err ));
+	return err;
+	}
+
+
+TInt DMemSpyEventMonitor::Start()
+	{
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Start() - START"));
+
+	NKern::ThreadEnterCS();
+	Kern::MutexWait( *iLock );
+
+    iTracking = ETrue;
+
+	Kern::MutexSignal( *iLock );
+	NKern::ThreadLeaveCS();
+
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Start() - END") );
+	return KErrNone;
+	}
+
+
+TInt DMemSpyEventMonitor::Stop()
+	{
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Stop() - START") );
+
+    NKern::ThreadEnterCS();
+	Kern::MutexWait( *iLock );
+
+	iTracking = EFalse;
+
+	Kern::MutexSignal( *iLock );
+	NKern::ThreadLeaveCS();
+
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::Stop() - END") );
+    return KErrNone;
+    }
+    
+    
+TInt DMemSpyEventMonitor::RequestEvents( MMemSpyEventMonitorObserver& aObserver )
+    {
+    NKern::ThreadEnterCS();
+	Kern::MutexWait( *iLock );
+
+    TInt error = KErrAlreadyExists;
+    //
+    if  ( IsObserving( aObserver ) == EFalse )
+        {
+        iObservers.Add( &aObserver.__iEMLink );
+        error = KErrNone;
+        }
+    //
+	Kern::MutexSignal( *iLock );
+	NKern::ThreadLeaveCS();
+    //
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::RequestEvents() - END - error: %d", error) );
+    return error;
+    }
+
+
+TInt DMemSpyEventMonitor::RequestEventsCancel( MMemSpyEventMonitorObserver& aObserver )
+    {
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::RequestEventsCancel() - START - aObserver: 0x%08x", &aObserver) );
+    NKern::ThreadEnterCS();
+	Kern::MutexWait( *iLock );
+
+    const TBool isObserving = IsObserving( aObserver );
+    if  ( isObserving )
+        {
+        TRACE_EM( Kern::Printf("DMemSpyEventMonitor::RequestEventsCancel() - dequing observer...") );
+        aObserver.__iEMLink.Deque();
+        TRACE_EM( Kern::Printf("DMemSpyEventMonitor::RequestEventsCancel() - observer dequeued") );
+        }
+
+	Kern::MutexSignal( *iLock );
+	NKern::ThreadLeaveCS();
+    //
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::RequestEventsCancel() - END") );
+    return KErrNone;
+    }
+
+
+TUint DMemSpyEventMonitor::EventHandler( TKernelEvent aType, TAny* a1, TAny* a2, TAny* aSelf )
+	{
+    DMemSpyEventMonitor* self = (DMemSpyEventMonitor*) aSelf;
+	const TUint ret = self->HandleEvent( aType, a1, a2 );
+    return ret;
+	}
+
+
+TUint DMemSpyEventMonitor::HandleEvent( TKernelEvent aType, TAny* a1, TAny* /*a2*/ )
+	{ 
+	// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - PRE WAIT"));
+	NKern::ThreadEnterCS();
+	Kern::MutexWait(*iLock);
+	// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - POST WAIT"));
+
+	if  ( iTracking )
+		{
+		switch( aType )
+			{
+        //////////////////////////////////
+        // THREAD HANDLING
+        //////////////////////////////////
+		case EEventAddThread:
+			{
+			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventAddThread"));
+			EventThreadAdd( (DThread*) a1 );
+			break;
+			}
+		case EEventRemoveThread:
+			{
+			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventRemoveThread"));
+			EventThreadRemoved( (DThread*) a1 );
+			break;
+			}
+		case EEventKillThread:
+			{
+			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventKillThread"));
+			EventThreadKilled( (DThread*) a1 );
+			break;
+			}
+
+        //////////////////////////////////
+        // PROCESS HANDLING
+        //////////////////////////////////
+	    case EEventAddProcess:
+			{
+			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventAddProcess"));
+			EventProcessAdd( (DProcess*) a1 );
+			break;
+			}
+	    case EEventUpdateProcess:
+			{
+			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventUpdateProcess"));
+			EventProcessUpdate( (DProcess*) a1 );
+			break;
+			}
+	    case EEventRemoveProcess:
+			{
+			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventRemoveProcess"));
+			EventProcessRemoved( (DProcess*) a1 );
+			break;
+			}
+			
+        //////////////////////////////////
+        // CHUNK HANDLING
+        //////////////////////////////////
+	    case EEventNewChunk:
+			{
+			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventNewChunk"));
+			EventChunkAdd( (DChunk*) a1 );
+			break;
+			}
+	    case EEventUpdateChunk:
+			{
+			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventUpdateChunk"));
+			EventChunkUpdate( (DChunk*) a1 );
+			break;
+			}
+		case EEventDeleteChunk:
+			{
+			// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - EEventDeleteChunk"));
+			EventChunkDelete( (DChunk*) a1 );
+			break;
+			}
+
+        default:
+			break;
+			}
+		}
+
+	// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - PRE SIGNAL "));
+	Kern::MutexSignal( *iLock );
+	NKern::ThreadLeaveCS();
+	// TRACE_EM( Kern::Printf("DMemSpyEventMonitor::HandleEvent() - POST SIGNAL "));
+
+	// Allow other handlers to see this event
+	return DKernelEventHandler::ERunNext;
+	}
+
+
+void DMemSpyEventMonitor::EventProcessAdd( DProcess* aProcess )
+    {
+	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventProcessAdd() - aProcess: 0x%08x [%d] (%O)", aProcess, aProcess->iId, aProcess ));
+    //
+    const SDblQueLink* const anchor = &iObservers.iA;
+	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
+		{
+		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
+        const TInt typeMask = observer->EMTypeMask();
+        //
+        if ( typeMask & EMemSpyEventProcessAdd )
+			{
+            observer->EMHandleProcessAdd( *aProcess );
+			}
+        }
+    }
+
+
+void DMemSpyEventMonitor::EventProcessUpdate( DProcess* aProcess )
+    {
+	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventProcessUpdate() - aProcess: 0x%08x [%d] (%O)", aProcess, aProcess->iId, aProcess ));
+    //
+	const SDblQueLink* const anchor = &iObservers.iA;
+	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
+		{
+		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
+        const TInt typeMask = observer->EMTypeMask();
+        //
+        if ( typeMask & EMemSpyEventProcessUpdate )
+			{
+            observer->EMHandleProcessUpdated( *aProcess );
+			}
+        }
+    }
+
+
+void DMemSpyEventMonitor::EventProcessRemoved( DProcess* aProcess )
+    {
+	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventProcessRemoved() - aProcess: 0x%08x [%d] (%O)", aProcess, aProcess->iId, aProcess ));
+    //
+	const SDblQueLink* const anchor = &iObservers.iA;
+	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
+		{
+		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
+        const TInt typeMask = observer->EMTypeMask();
+        //
+        if ( typeMask & EMemSpyEventProcessRemove )
+			{
+            observer->EMHandleProcessRemoved( *aProcess );
+			}
+        }
+    }
+
+
+void DMemSpyEventMonitor::EventThreadAdd( DThread* aThread )
+    {
+	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventThreadAdd() - aThread: 0x%08x [%4d] (%O)", aThread, aThread->iId, aThread ));
+    //
+	const SDblQueLink* const anchor = &iObservers.iA;
+	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
+		{
+		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
+        const TInt typeMask = observer->EMTypeMask();
+        //
+        if ( typeMask & EMemSpyEventThreadAdd )
+			{
+            observer->EMHandleThreadAdd( *aThread );
+			}
+        }
+    }
+
+
+void DMemSpyEventMonitor::EventThreadRemoved( DThread* aThread )
+    {
+	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventThreadRemoved() - aThread: 0x%08x [%4d] (%O)", aThread, aThread->iId, aThread ));
+    //
+	const SDblQueLink* const anchor = &iObservers.iA;
+	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
+		{
+		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
+        const TInt typeMask = observer->EMTypeMask();
+        //
+        if ( typeMask & EMemSpyEventThreadRemove )
+			{
+            observer->EMHandleThreadRemoved( *aThread );
+			}
+        }
+    }
+
+
+void DMemSpyEventMonitor::EventThreadKilled( DThread* aThread )
+    {
+	TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventThreadKilled() - aThread: 0x%08x [%4d] (%O)", aThread, aThread->iId, aThread ));
+    //
+	const SDblQueLink* const anchor = &iObservers.iA;
+	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
+		{
+		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
+        const TInt typeMask = observer->EMTypeMask();
+        //
+        if ( typeMask & EMemSpyEventThreadKill )
+			{
+            observer->EMHandleThreadKilled( *aThread );
+			}
+        }
+    }
+
+
+void DMemSpyEventMonitor::EventChunkAdd( DChunk* aChunk )
+    {
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventChunkAdd() - aChunk: 0x%08x [%10d] {OP: %4d, CO: %4d} (%O)", aChunk, aChunk->Size(), ( aChunk->iOwningProcess ? aChunk->iOwningProcess->iId : 0 ), aChunk->iControllingOwner, aChunk ));
+    //
+	const SDblQueLink* const anchor = &iObservers.iA;
+	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
+		{
+		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
+        const TInt typeMask = observer->EMTypeMask();
+        //
+        if ( typeMask & EMemSpyEventChunkAdd )
+			{
+            observer->EMHandleChunkAdd( *aChunk );
+			}
+        }
+    }
+
+
+void DMemSpyEventMonitor::EventChunkUpdate( DChunk* aChunk )
+    {
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventChunkUpdate() - aChunk: 0x%08x [%10d] {OP: %4d, CO: %4d} (%O)", aChunk, aChunk->Size(), ( aChunk->iOwningProcess ? aChunk->iOwningProcess->iId : 0 ), aChunk->iControllingOwner, aChunk ));
+    //
+	const SDblQueLink* const anchor = &iObservers.iA;
+	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
+		{
+		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
+        const TInt typeMask = observer->EMTypeMask();
+        //
+        if ( typeMask & EMemSpyEventChunkUpdate )
+			{
+            observer->EMHandleChunkUpdated( *aChunk );
+			}
+        }
+    }
+
+
+void DMemSpyEventMonitor::EventChunkDelete( DChunk* aChunk )
+    {
+    TRACE_EM( Kern::Printf("DMemSpyEventMonitor::EventChunkDelete() - aChunk: 0x%08x [%10d] {OP: %4d, CO: %4d} (%O)", aChunk, aChunk->Size(), ( aChunk->iOwningProcess ? aChunk->iOwningProcess->iId : 0 ), aChunk->iControllingOwner, aChunk ));
+    //
+	const SDblQueLink* const anchor = &iObservers.iA;
+	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
+		{
+		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
+        const TInt typeMask = observer->EMTypeMask();
+        //
+        if ( typeMask & EMemSpyEventChunkDelete )
+			{
+            observer->EMHandleChunkDeleted( *aChunk );
+			}
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+TBool DMemSpyEventMonitor::IsObserving( MMemSpyEventMonitorObserver& aObserver )
+    {
+    TBool ret = EFalse;
+	const SDblQueLink* const anchor = &iObservers.iA;
+	
+	for (SDblQueLink* link = iObservers.First(); link != anchor; link = link->iNext)
+		{
+		MMemSpyEventMonitorObserver* const observer = _LOFF(link, MMemSpyEventMonitorObserver, __iEMLink);
+
+		if  ( observer == &aObserver )
+			{
+			ret = ETrue;
+            break;
+			}
+		}
+
+	return ret;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverHeap.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,323 @@
+/*
+* 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 "MemSpyDriverHeap.h"
+
+// System includes
+#include <kern_priv.h>
+
+// User includes
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverUtils.h"
+#include "heaputils.h"
+
+
+
+RMemSpyDriverRHeapBase::RMemSpyDriverRHeapBase()
+	: iHelper(NULL)
+    {
+    Reset();
+    }
+
+LtkUtils::RAllocatorHelper* RMemSpyDriverRHeapBase::Helper()
+	{
+	return iHelper;
+	}
+
+TMemSpyHeapInfo::THeapImplementationType RMemSpyDriverRHeapBase::GetTypeFromHelper() const
+	{
+	if (iHelper)
+		{
+		LtkUtils::RAllocatorHelper::TType type = iHelper->GetType();
+		switch (type)
+			{
+			case LtkUtils::RAllocatorHelper::ETypeRHeap:
+				return TMemSpyHeapInfo::ETypeRHeap;
+			case LtkUtils::RAllocatorHelper::ETypeRHybridHeap:
+				return TMemSpyHeapInfo::ETypeRHybridHeap;
+			case LtkUtils::RAllocatorHelper::ETypeUnknown:
+			default:
+				return TMemSpyHeapInfo::ETypeUnknown;
+			}
+		}
+	return TMemSpyHeapInfo::ETypeUnknown;
+	}
+
+void RMemSpyDriverRHeapBase::Reset()
+    {
+	Close();
+	}
+
+void RMemSpyDriverRHeapBase::Close()
+	{
+	if (iHelper)
+		{
+	    NKern::ThreadEnterCS();
+		iHelper->Close();
+		delete iHelper;
+		iHelper = NULL;
+		NKern::ThreadLeaveCS();
+		}
+    }
+
+void RMemSpyDriverRHeapBase::PrintInfo()
+    {
+	/* TOMSCI TODO replace with tracing based on latest struct info. See DMemSpyDriverLogChanHeapBase::PrintHeapInfo
+	 * Alternatively just call DMemSpyDriverLogChanHeapBase::PrintHeapInfo() somehow?
+	 
+#if defined(TRACE_TYPE_KERNELHEAP) || defined(TRACE_TYPE_USERHEAP)
+    Kern::Printf(" " );
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iAccessCount:    0x%08x", iAccessCount );
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iHandleCount:    0x%08x", iHandleCount );
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iHandles:        0x%08x", iHandles );
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iFlags:          0x%08x", iFlags );
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iCellCount:      0x%08x", iCellCount );
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RAllocator - iTotalAllocSize: 0x%08x", iTotalAllocSize );
+
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iMinLength:      0x%08x", iMinLength );
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iMaxLength:      0x%08x", iMaxLength );
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iOffset:         0x%08x", iOffset);
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iGrowBy:         0x%08x", iGrowBy);
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iChunkHandle:    0x%08x", iChunkHandle);
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iBase:           0x%08x", Base());
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iTop:            0x%08x", iTop );
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iAlign:          0x%08x", iAlign);
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iMinCell:        0x%08x", iMinCell);
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iPageSize:       0x%08x", iPageSize);
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iFree len:       0x%08x", iFree.len);
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iFree next:      0x%08x", iFree.next);
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iNestingLevel:   0x%08x", iNestingLevel);
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      iAllocCount:     0x%08x", iAllocCount);
+    Kern::Printf("RMemSpyDriverRHeapBase::PrintInfo - RHeap -      size:              %8d",  Size() );
+    Kern::Printf(" " );
+    Kern::Printf(" " );
+#endif
+	*/
+    }
+
+RMemSpyDriverRHeapReadFromCopy::RMemSpyDriverRHeapReadFromCopy( DMemSpyDriverOSAdaption& aOSAdaption )
+:   iOSAdaption( aOSAdaption ), iChunk( NULL ), iChunkAddress( 0 ), iChunkMappingAttributes( 0 ) /*, iClientToKernelDelta( 0 )*/
+    {
+    }
+
+
+void RMemSpyDriverRHeapReadFromCopy::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()
+    {
+    TRACE_HEAP( Kern::Printf("RMemSpyDriverRHeapReadFromCopy::DisassociateWithKernelChunk() - START - iChunk: 0x%08x", iChunk ) );
+
+    NKern::ThreadEnterCS();
+    if  ( iChunk != NULL )
+        {
+        Kern::ChunkClose( iChunk );
+        iChunk = NULL;
+        }
+    NKern::ThreadLeaveCS();
+
+    TRACE_HEAP( Kern::Printf("RMemSpyDriverRHeapReadFromCopy::DisassociateWithKernelChunk() - END") );
+    }
+*/
+
+DChunk& RMemSpyDriverRHeapReadFromCopy::Chunk()
+    {
+    return *iChunk;
+    }
+
+
+const DChunk& RMemSpyDriverRHeapReadFromCopy::Chunk() const
+    {
+    return *iChunk;
+    }
+
+
+/*TLinAddr RMemSpyDriverRHeapReadFromCopy::ChunkKernelAddress() const
+    {
+    return iChunkAddress;
+    }
+
+
+TBool RMemSpyDriverRHeapReadFromCopy::ChunkIsInitialised() const
+    {
+    return iChunk != NULL;
+    }
+
+TUint RMemSpyDriverRHeapReadFromCopy::ClientToKernelDelta() const
+    {
+    return iClientToKernelDelta;
+    }
+*/
+
+
+
+
+
+RMemSpyDriverRHeapUser::RMemSpyDriverRHeapUser( DMemSpyDriverOSAdaption& aOSAdaption )
+	: RMemSpyDriverRHeapBase(), iOSAdaption(aOSAdaption)
+    {
+    }
+
+
+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
+	}
+
+RMemSpyDriverRHeapKernelInPlace::RMemSpyDriverRHeapKernelInPlace()
+	: iChunk(NULL)
+    {
+    }
+
+TInt RMemSpyDriverRHeapKernelInPlace::OpenKernelHeap()
+	{
+	NKern::ThreadEnterCS();
+	LtkUtils::RAllocatorHelper* helper = new LtkUtils::RAllocatorHelper;
+	if (!helper)
+		{
+		NKern::ThreadLeaveCS();
+		return KErrNoMemory;
+		}
+	TInt err = helper->OpenKernelHeap();
+	if (!err)
+		{
+		iChunk = helper->OpenUnderlyingChunk();
+		if (!iChunk) err = KErrNotFound;
+		}
+
+	if (err)
+		{
+		delete helper;
+		}
+	else
+		{
+		iHelper = helper;
+		}
+	NKern::ThreadLeaveCS();
+	return err;
+	}
+
+void RMemSpyDriverRHeapKernelInPlace::Close()
+    {
+	NKern::ThreadEnterCS();
+	iChunk->Close(NULL);
+	iChunk = NULL;
+	RMemSpyDriverRHeapBase::Close();
+	NKern::ThreadLeaveCS();
+    }
+
+DChunk& RMemSpyDriverRHeapKernelInPlace::Chunk()
+    {
+    return *iChunk;
+    }
+
+
+const DChunk& RMemSpyDriverRHeapKernelInPlace::Chunk() const
+    {
+    return *iChunk;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverHeapWalker.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,287 @@
+/*
+* 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 "MemSpyDriverHeapWalker.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+
+// Defines
+#define PRINTDEBUG( a ) { if ( PrintDebug() ) a; }
+
+
+RMemSpyDriverHeapWalker::RMemSpyDriverHeapWalker(RMemSpyDriverRHeapBase& aHeap, MMemSpyHeapWalkerObserver* aObserver)
+	: iHeap(aHeap), iPrintDebug(EFalse), iObserver(aObserver)
+	{
+	InitialiseStats();
+	}
+
+
+TInt RMemSpyDriverHeapWalker::Traverse()
+//
+// Walk the heap calling the info function.
+//
+	{
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - START"));
+    InitialiseStats();
+    if  ( iObserver )
+        {
+        PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - heap walk init..." ));
+        iObserver->HandleHeapWalkInit();
+        }
+
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - heap walk init complete" ));
+
+	TInt err = iHeap.Helper()->Walk(&CellCallback, this);
+    FinaliseStats();
+    //PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - END - pF: 0x%08x, pC: 0x%08x, heapBase: 0x%08x, heapTop: 0x%08x", pF, pC, heapBase, heapTop));
+	return err;
+	}
+
+TBool RMemSpyDriverHeapWalker::CellCallback(RAllocatorHelper& aHelper, TAny* aContext, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellAddress, TInt aLength)
+	{
+	return static_cast<RMemSpyDriverHeapWalker*>(aContext)->DoCellCallback(aHelper, aCellType, aCellAddress, aLength);
+	}
+
+TBool RMemSpyDriverHeapWalker::DoCellCallback(RAllocatorHelper& aHelper, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellAddress, TInt aLength)
+	{
+	TAny* cellAddress = (TAny*)aCellAddress;
+	TMemSpyDriverCellType memspyCellType = (TMemSpyDriverCellType)aCellType; // We make sure these use the same values
+	switch (aCellType)
+		{
+		case RAllocatorHelper::EHeapBadFreeCellAddress:
+			PRINTDEBUG(Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EBadFreeCellAddress: 0x%08x", cellAddress));
+			NotifyCell(memspyCellType, cellAddress, 0);
+			return EFalse;
+		case RAllocatorHelper::EHeapBadFreeCellSize:
+			PRINTDEBUG(Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EBadFreeCellSize: 0x%08x", cellAddress));
+			NotifyCell(memspyCellType, cellAddress, aLength);
+			return EFalse;
+		case RAllocatorHelper::EHeapBadAllocatedCellSize:
+			PRINTDEBUG(Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EBadAllocatedCellSize: 0x%08x", cellAddress));
+			NotifyCell(memspyCellType, cellAddress, aLength);
+			return EFalse;
+		case RAllocatorHelper::EHeapBadAllocatedCellAddress:
+			PRINTDEBUG(Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EBadAllocatedCellAddress: 0x%08x", cellAddress));
+			NotifyCell(memspyCellType, cellAddress, aLength);
+			return EFalse;
+		default:
+			break;
+		}
+
+	if (aCellType & RAllocatorHelper::EAllocationMask)
+		{
+		PRINTDEBUG(Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EGoodAllocatedCell: 0x%08x", cellAddress));
+		TInt nestingLevel = -1;
+		aHelper.GetCellNestingLevel(cellAddress, nestingLevel);
+		TInt allocCount = aHelper.AllocCountForCell(cellAddress);
+		if (allocCount < 0) allocCount = -1; // This is what NotifyCell expects
+		return NotifyCell(memspyCellType, cellAddress, aLength, nestingLevel, allocCount);
+		}
+	else if (aCellType & RAllocatorHelper::EFreeMask)
+		{
+		PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::Traverse() - EGoodFreeCell: 0x%08x", cellAddress));
+		return NotifyCell(memspyCellType, cellAddress, aLength);
+		}
+	else if (aCellType & RAllocatorHelper::EBadnessMask)
+		{
+		NotifyCell(memspyCellType, cellAddress, aLength);
+		return EFalse;
+		}
+	return ETrue; // For any new types that get added
+	}
+
+
+void RMemSpyDriverHeapWalker::CopyStatsTo( TMemSpyHeapStatisticsRHeap& aStats )
+    {
+	PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::CopyStatsTo() - START"));
+
+    // Copy free cell info
+    TMemSpyHeapStatisticsRHeapFree& free = aStats.StatsFree();
+    free.SetTypeCount( iStats.iFreeCellCount );
+    free.SetTypeSize( iStats.iTotalFreeSpace );
+
+    // If the last cell was a free cell, and it was also the largest cell
+    // then we use the prior largest free cell instead. This is because
+    // slack space is already reported separately.
+    TAny* largestFreeCellAddress = (TAny*) iStats.iLargestCellAddressFree;
+    TUint largestFreeCellSize = iStats.iLargestCellSizeFree;
+    if ( iStats.iLastCellWasFreeCell && iStats.iLargestCellSizeFree == iStats.iSlackSpace && iStats.iSpackSpaceCellAddress == iStats.iLargestCellAddressFree )
+        {
+	    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::CopyStatsTo() - using previous max free cell stats, since largest free cell is slack cell at end of heap..."));
+        largestFreeCellAddress = (TAny*) iStats.iLargestCellAddressFreePrevious;
+        largestFreeCellSize = iStats.iLargestCellSizeFreePrevious;
+        }
+
+    free.SetLargestCellAddress( largestFreeCellAddress );
+    free.SetLargestCellSize( largestFreeCellSize );
+    free.SetSlackSpaceCellSize( iStats.iSlackSpace );
+    free.SetSlackSpaceCellAddress( (TAny*) iStats.iSpackSpaceCellAddress );
+    free.SetChecksum( iStats.iFreeCellCRC );
+
+    // Copy allocated cell info
+    TMemSpyHeapStatisticsRHeapAllocated& alloc = aStats.StatsAllocated();
+    alloc.SetTypeCount( iStats.iAllocCellCount );
+    alloc.SetTypeSize( iStats.iTotalAllocSpace );
+    alloc.SetLargestCellAddress( (TAny*) iStats.iLargestCellAddressAlloc );
+    alloc.SetLargestCellSize( iStats.iLargestCellSizeAlloc );
+
+	aStats.iCommittedFreeSpace = iHeap.Helper()->CommittedFreeSpace();
+
+	PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::CopyStatsTo() - END"));
+    }
+
+
+void RMemSpyDriverHeapWalker::SetObserver( MMemSpyHeapWalkerObserver* aObserver )
+    {
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::SetObserver() - aObserver: 0x%08x", aObserver ));
+    iObserver = aObserver;
+    }
+
+TBool RMemSpyDriverHeapWalker::NotifyCell( TMemSpyDriverCellType aType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber )
+    {
+    // Update stats first
+    UpdateStats( aType, aCellAddress, aLength, aNestingLevel, aAllocNumber );
+	
+    // Notify observer
+    TBool continueTraversal = ETrue;
+    if  ( iObserver )
+        {
+        continueTraversal = iObserver->HandleHeapCell( aType, aCellAddress, aLength, aNestingLevel, aAllocNumber );
+        }
+    //
+    return continueTraversal;
+    }
+
+
+void RMemSpyDriverHeapWalker::UpdateStats( TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber )
+    {
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::UpdateStats - type: %d address: 0x%08x, len: %8d, nestingLev: %8d, allocNum: %8d", aCellType, aCellAddress, aLength, aNestingLevel, aAllocNumber ));
+
+    if (aCellType & EMemSpyDriverFreeCellMask)
+        {
+        // Update checksum
+        iStats.iFreeCellCRC = iStats.iFreeCellCRC ^ reinterpret_cast<TUint32>( aCellAddress );
+
+        // Track cell counts and length
+        ++iStats.iFreeCellCount;
+        iStats.iTotalFreeSpace += aLength;
+        iStats.iLastFreeCellLength = aLength;
+
+        PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::UpdateStats - WAS FREE CELL - iFreeCellCRC: 0x%08x, iFreeCellCount: %d, iTotalFreeSpace: %d, iLastFreeCellLength: %d", iStats.iFreeCellCRC, iStats.iFreeCellCount, iStats.iTotalFreeSpace, iStats.iLastFreeCellLength));
+        
+        // Identify biggest cell
+        if  ( (TUint) aLength > iStats.iLargestCellSizeFree )
+            {
+            PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::UpdateStats - this cell (%d bytes big) is bigger than previous largested FREE cell (%d bytes) => making it the new largest FREE cell", aLength, iStats.iLargestCellSizeFree));
+            iStats.iLargestCellSizeFreePrevious = iStats.iLargestCellSizeFree;
+            iStats.iLargestCellSizeFree = aLength;
+            iStats.iLargestCellAddressFreePrevious = iStats.iLargestCellAddressFree;
+            iStats.iLargestCellAddressFree = (TLinAddr) aCellAddress;
+            }
+
+        // Identify first cell
+        if  ( iStats.iFirstFreeCellAddress == 0 )
+            {
+            iStats.iFirstFreeCellLength = aLength;
+            iStats.iFirstFreeCellAddress = (TLinAddr) aCellAddress;
+            }
+        }
+    else if (aCellType & EMemSpyDriverAllocatedCellMask)
+        {
+        // Track cell counts and length
+        ++iStats.iAllocCellCount;
+        iStats.iTotalAllocSpace += aLength;
+        iStats.iLastFreeCellLength = 0; 
+
+        PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::UpdateStats - WAS ALLOC CELL - iAllocCellCount: %d, iTotalAllocSpace: %d", iStats.iAllocCellCount, iStats.iTotalAllocSpace));
+
+        // Identify biggest cell
+        if  ( (TUint) aLength > iStats.iLargestCellSizeAlloc )
+            {
+            PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::UpdateStats - this cell (%d bytes big) is bigger than previous largested ALLOC cell (%d bytes) => making it the new largest ALLOC cell", aLength, iStats.iLargestCellSizeAlloc));
+            iStats.iLargestCellSizeAlloc = aLength;
+            iStats.iLargestCellAddressAlloc = (TLinAddr) aCellAddress;
+            }
+        }
+
+    iStats.iLastCellType = aCellType;
+    iStats.iLastCellAddress = (TLinAddr) aCellAddress;
+    iStats.iLastCellWasFreeCell = (aCellType & EMemSpyDriverFreeCellMask);
+    ++iStats.iNumberOfWalkedCells;
+    }
+
+
+void RMemSpyDriverHeapWalker::InitialiseStats()
+    {
+    iStats.iFreeCellCRC = 0;
+    iStats.iNumberOfWalkedCells = 0;
+    iStats.iFirstFreeCellAddress = 0;
+    iStats.iFirstFreeCellLength = 0;
+    iStats.iLastCellType = EMemSpyDriverAllocatedCellMask;
+    iStats.iLastCellWasFreeCell = EFalse;
+    iStats.iLastFreeCellLength = 0;
+    iStats.iTotalFreeSpace = 0;
+    iStats.iTotalAllocSpace = 0;
+    iStats.iSlackSpace = 0;
+    iStats.iFreeCellCount = 0;
+    iStats.iAllocCellCount = 0;
+    iStats.iLargestCellSizeFree = 0;
+    iStats.iLargestCellSizeAlloc = 0;
+    iStats.iLargestCellAddressFree = 0;
+    iStats.iLargestCellAddressAlloc = 0;
+    iStats.iLargestCellSizeFreePrevious = 0;
+    iStats.iLargestCellAddressFreePrevious = 0;
+    iStats.iSpackSpaceCellAddress = 0;
+    iStats.iLastCellAddress = 0;
+    }
+
+
+void RMemSpyDriverHeapWalker::FinaliseStats()
+    {
+    if  ( iStats.iLastCellWasFreeCell )
+        {
+        iStats.iSlackSpace = iStats.iLastFreeCellLength;
+        iStats.iSpackSpaceCellAddress = iStats.iLastCellAddress;
+        }
+
+    PrintStats();
+    }
+
+
+void RMemSpyDriverHeapWalker::PrintStats()
+    {
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - HEAP SUMMARY FOR THREAD:" ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - ------------------------------------------------------------" ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iNumberOfWalkedCells         : %10d", iStats.iNumberOfWalkedCells ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iFirstFreeCellAddress        : 0x%08x", iStats.iFirstFreeCellAddress ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iFirstFreeCellLength         : %10d", iStats.iFirstFreeCellLength ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLastCellWasFreeCell         : %10d", iStats.iLastCellWasFreeCell ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLastCellType                : %10d", iStats.iLastCellType ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLastFreeCellLength          : %10d", iStats.iLastFreeCellLength ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iTotalFreeSpace              : %10d", iStats.iTotalFreeSpace ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iTotalAllocSpace             : %10d", iStats.iTotalAllocSpace ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iSlackSpace                  : %10d", iStats.iSlackSpace ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iFreeCellCount               : %10d", iStats.iFreeCellCount ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iAllocCellCount              : %10d", iStats.iAllocCellCount ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLargestCellSizeFree         : %10d", iStats.iLargestCellSizeFree ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLastFreeCellLength          : %10d", iStats.iLastFreeCellLength ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLargestCellSizeAlloc        : %10d", iStats.iLargestCellSizeAlloc ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLargestCellAddressFree      : 0x%08x", iStats.iLargestCellAddressFree ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iLargestCellAddressAlloc     : 0x%08x", iStats.iLargestCellAddressAlloc ) );
+    PRINTDEBUG( Kern::Printf("RMemSpyDriverHeapWalker::PrintStats - iFreeCellCRC                 : 0x%08x", iStats.iFreeCellCRC ) );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverInspectedProcess.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1268 @@
+/*
+* 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 "MemSpyDriverInspectedProcess.h"
+
+// System includes
+#include <kern_priv.h>
+#include <nk_trace.h>
+#include <u32hal.h>
+
+#ifdef __MARM__
+#include "kdebug.h"
+#endif //__MARM__
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverInspectedProcessManager.h"
+
+// Constants
+_LIT8( KMemSpyLitDollarHeap, "$HEAP" );
+_LIT8( KMemSpyLitDollarDllData, "DLL$DATA" );
+_LIT8( KMemSpyLitDollarDat, "$DAT" );
+_LIT( KMemSpyInspectedProcessMutexName, "MemSpyInspectedProcess_0x" );
+
+
+DMemSpyInspectedProcess::DMemSpyInspectedProcess( DMemSpyDriverDevice& aDevice )
+:   iDevice( aDevice )
+	{
+	}
+
+
+DMemSpyInspectedProcess::~DMemSpyInspectedProcess()
+	{
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - START - this: 0x%08x, %O", this, iProcess ));
+	EventMonitor().RequestEventsCancel( *this );
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - calling NotifyOnChangeCancel..." ) );
+    NotifyOnChangeCancel();
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - calling ResetTrackedList..." ) );
+    ResetTrackedList();
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - calling ResetPendingChanges..." ) );
+    ResetPendingChanges();
+
+	if  ( iLock )
+		{
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - closing mutex..." ) );
+		iLock->Close(NULL);
+		}
+
+    if  ( iProcess )
+        {
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - closing process..." ) );
+	    Kern::SafeClose( (DObject*&) iProcess, NULL );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - closed process!" ) );
+        }
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::~DMemSpyInspectedProcess() - END - this: 0x%08x", this ) );
+	}
+
+
+TInt DMemSpyInspectedProcess::Open( DProcess* aProcess )
+    {
+	__ASSERT_CRITICAL;
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::Open() - START - this: 0x%08x, aProcess: 0x%08x (%O)", this, aProcess, aProcess ));
+
+    TInt error = KErrNone;
+    //
+    iProcess = aProcess;
+    error = iProcess->Open();
+    //
+    if  ( error == KErrNone )
+        {
+        iProcessId = iDevice.OSAdaption().DProcess().GetId( *aProcess );
+
+        // Create mutex
+        TName name( KMemSpyInspectedProcessMutexName );
+        name.AppendNumFixedWidth( (TUint) this, EHex, 8 );
+        error = Kern::MutexCreate( iLock, name, KMutexOrdNone );
+        //
+        if  ( error == KErrNone )
+            {
+            // Get size of all stacks (user & supervsior) for process. Also
+            // updates iUserThreadStackSize with the current size of just
+            // the user-side thread stacks.
+            iInfoCurrent.iMemoryStack = StackSize( *aProcess );
+        
+            // Request events
+            EventMonitor().RequestEvents( *this );
+        
+            // Find initial chunks that are mapped into process
+            FindChunks( *aProcess );
+        
+            // Indicate that we have data waiting for client. This will
+            // cause the client's RS to be completed as soon as it 
+            // registers with us...
+            UpdateStatistics();
+            CompleteClientsRequest( KErrNone, &iInfoCurrent );
+            }
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::Open() - END - this: 0x%08x, error: %d", this, error ));
+    return error;
+    }
+
+
+
+
+
+
+
+
+TInt DMemSpyInspectedProcess::NotifyOnChange( DThread* aThread, TRequestStatus* aRequestStatus, TMemSpyDriverProcessInspectionInfo* aInfo )
+    {
+	Lock();
+
+    TInt err = KErrInUse;
+    const TBool notificationQueued = NotifyOnChangeQueued();
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChange() - START - this: 0x%08x, iAmDead: %d, aRequestStatus: 0x%08x, notificationQueued: %d, iChangeObserverThread: 0x%08x (%O)", this, iAmDead, aRequestStatus, notificationQueued, iChangeObserverThread, iChangeObserverThread ) );
+    //
+    if  ( notificationQueued == EFalse )
+        {
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChange() - Saving client RS..." ) );
+        iChangeObserverThread = aThread;
+        iChangeObserverRS = aRequestStatus;
+        iChangeObserverInfo = aInfo;
+        
+        // Whilst we still have items in the buffer, we let the client drain them fully.
+        // However, if the process is now marked as dead and the buffer is exhausted,
+        // we indicate this via KErrDied completion which will cause the client to
+        // stop requesting any more changes.
+        if	( !iPendingChanges.IsEmpty() )
+			{
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChange() - Have buffered changes - SENDING TO CLIENT IMMEDIATELY..." ) );
+			
+            // We have something in the pending buffer so we can
+			// give it back to the client immediately.
+	        TMemSpyTrackedChunkChangeInfo* cachedChange = _LOFF( iPendingChanges.First(), TMemSpyTrackedChunkChangeInfo, iLink );
+			cachedChange->iLink.Deque();
+			
+            // Notify about change			
+			CompleteClientsRequest( KErrNone, &cachedChange->iInfo );
+			
+			// Discard cached entry
+			delete cachedChange;
+			}
+        else if ( iAmDead )
+            {
+            // We must stop listening outside of an event monitor callback...
+    	    EventMonitor().RequestEventsCancel( *this );
+			CompleteClientsRequest( KErrDied );
+            }
+        //
+		err = KErrNone;
+        }
+	//
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChange() - END - this: 0x%08x, err: %d", this, err ) );
+
+	Unlock();
+    return err;
+    }
+
+
+TInt DMemSpyInspectedProcess::NotifyOnChangeCancel()
+    {
+	Lock();
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChangeCancel() - START - this: 0x%08x, queued: %d, iChangeObserverThread: 0x%08x, iChangeObserverRS: 0x%08x", this, NotifyOnChangeQueued(), iChangeObserverThread, iChangeObserverRS ) );
+    //
+    if  ( NotifyOnChangeQueued() )
+        {
+        TRACE( Kern::Printf( "DMemSpyInspectedProcess::NotifyOnChangeCancel() - this: 0x%08x, iChangeObserverRS: 0x%08x, iProcessId: %d (0x%04x)", this, iChangeObserverRS, iProcessId, iProcessId ) );
+		Kern::RequestComplete( iChangeObserverThread, iChangeObserverRS, KErrCancel );
+        iChangeObserverThread = NULL;
+        iChangeObserverRS = NULL;
+        iChangeObserverInfo = NULL;
+        }
+	//
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChangeCancel() - END - this: 0x%08x", this ) );
+	Unlock();
+
+    return KErrNone;
+    }
+
+
+TBool DMemSpyInspectedProcess::NotifyOnChangeQueued() const
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChangeQueued() - START - this: 0x%08x", this ) );
+    //
+	Lock();
+    const TBool queued = ( iChangeObserverRS != NULL );
+	Unlock();
+    //
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::NotifyOnChangeQueued() - END - this: 0x%08x, queued: %d", this, queued ) );
+    return queued;
+    }
+
+
+
+
+
+
+
+
+
+void DMemSpyInspectedProcess::CompleteClientsRequest( TInt aCompletionCode, TMemSpyDriverProcessInspectionInfo* aInfo )
+    {
+    const TBool notificationQueued = NotifyOnChangeQueued();
+    TRACE( Kern::Printf( "DMemSpyInspectedProcess::CompleteClientsRequest() - START - this: 0x%08x, iChangeObserverThread: 0x%08x, iChangeObserverRS: 0x%08x, iChangeObserverInfo: 0x%08x, notificationQueued: %d", this, iChangeObserverThread, iChangeObserverRS, iChangeObserverInfo, notificationQueued ) );
+    TRACE( Kern::Printf( "DMemSpyInspectedProcess::CompleteClientsRequest() - iAmDead: %d, buffer is empty: %d, aCompletionCode: %d, iProcessId: %d (0x%04x), aInfo: 0x%08x, iChangeDeliveryCounter: %d", iAmDead, iPendingChanges.IsEmpty(), aCompletionCode, iProcessId, iProcessId, aInfo, iChangeDeliveryCounter ) );
+
+    if  ( notificationQueued )
+        {
+        ++iChangeDeliveryCounter;
+        TInt completionCode = aCompletionCode;
+        
+        // Write them to client...
+        if ( aInfo != NULL )
+            {
+            const TInt writeErr = Kern::ThreadRawWrite( iChangeObserverThread, iChangeObserverInfo, aInfo, sizeof(TMemSpyDriverProcessInspectionInfo) );
+    		if  ( writeErr != KErrNone )
+    		    {
+                completionCode = writeErr;
+    		    }
+            }
+
+        // Complete client's async request
+        DThread* changeThread = iChangeObserverThread;
+        TRequestStatus* changeRS = iChangeObserverRS;
+
+        // Zero these out first to avoid race condition
+        iChangeObserverThread = NULL;
+        iChangeObserverRS = NULL;
+        iChangeObserverInfo = NULL;
+
+        // ...and then tell client.
+        TRACE( Kern::Printf( "DMemSpyInspectedProcess::CompleteClientsRequest() - SENDING CHANGE [%4d] TO CLIENT [err: %d]", iChangeDeliveryCounter, completionCode ) );
+		Kern::RequestComplete( changeThread, changeRS, completionCode );
+        }
+	else if ( aInfo )
+		{
+		// Buffer the change for next time around...
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::CompleteClientsRequest() - BUFFERING change event whilst client is AWOL...", this ) );
+        NKern::ThreadEnterCS();
+        
+        TMemSpyTrackedChunkChangeInfo* changeInfo = new TMemSpyTrackedChunkChangeInfo();
+        if ( changeInfo )
+            {
+            changeInfo->iInfo = *aInfo;
+            iPendingChanges.Add( &changeInfo->iLink );
+            }
+        //
+        NKern::ThreadLeaveCS();
+		}
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::CompleteClientsRequest() - END - this: 0x%08x", this ) );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+void DMemSpyInspectedProcess::ResetTrackedList()
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetTrackedList() - START - this: 0x%08x", this ) );
+    NKern::ThreadEnterCS();
+    //
+    SDblQueLink* link = iTrackedChunks.GetFirst();
+	while( link )
+		{
+		TMemSpyTrackedChunk* object = _LOFF( link, TMemSpyTrackedChunk, iLink );
+        delete object;
+        link = iTrackedChunks.GetFirst();
+		}
+    //
+    NKern::ThreadLeaveCS();
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetTrackedList() - END - this: 0x%08x", this ) );
+    }
+
+
+void DMemSpyInspectedProcess::SetTrackedListUnused()
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::SetTrackedListUnused() - START - this: 0x%08x", this ) );
+	SDblQueLink* anchor = &iTrackedChunks.iA;
+	for (SDblQueLink* link = iTrackedChunks.First(); link != anchor; link = link->iNext)
+		{
+		TMemSpyTrackedChunk* trackedChunk = _LOFF( link, TMemSpyTrackedChunk, iLink );
+        trackedChunk->SetUnused( ETrue );
+		}
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::SetTrackedListUnused() - END - this: 0x%08x", this ) );
+    }
+
+
+void DMemSpyInspectedProcess::SetTrackedListUnusedStatusByType( TMemSpyTrackedChunk::TType aType, TBool aUnusedStatus )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::SetTrackedListUnusedStatusByType() - START - this: 0x%08x", this ) );
+	SDblQueLink* anchor = &iTrackedChunks.iA;
+	for (SDblQueLink* link = iTrackedChunks.First(); link != anchor; link = link->iNext)
+		{
+		TMemSpyTrackedChunk* trackedChunk = _LOFF( link, TMemSpyTrackedChunk, iLink );
+		if ( trackedChunk->Type() == aType )
+		    {
+            trackedChunk->SetUnused( aUnusedStatus );
+		    }
+		}
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::SetTrackedListUnusedStatusByType() - END - this: 0x%08x", this ) );
+    }
+
+
+void DMemSpyInspectedProcess::DiscardUnusedTrackListItems()
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::DiscardUnusedTrackListItems() - START - this: 0x%08x", this ) );
+    NKern::ThreadEnterCS();
+	const SDblQueLink* const anchor = &iTrackedChunks.iA;
+    //	
+	SDblQueLink* link = iTrackedChunks.First();
+	while( link && link != anchor )
+		{
+		TMemSpyTrackedChunk* trackedChunk = _LOFF( link, TMemSpyTrackedChunk, iLink );
+        const TBool unused = trackedChunk->iUnused;
+        //
+        link = link->iNext;
+        //
+        if  ( unused )
+            {
+    		trackedChunk->iLink.Deque();
+            delete trackedChunk;
+            }
+        else
+            {
+            trackedChunk->SetUnused( EFalse );
+            }
+		}
+    //
+    NKern::ThreadLeaveCS();
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::DiscardUnusedTrackListItems() - END - this: 0x%08x", this ) );
+    }
+
+
+void DMemSpyInspectedProcess::AddTrackedChunk( DChunk* aChunk, TMemSpyTrackedChunk::TType aType )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::AddTrackedChunk() - START - this: 0x%08x, aChunk: 0x%08x (%O)", this, aChunk, aChunk ) );
+    NKern::ThreadEnterCS();
+    //
+    TMemSpyTrackedChunk* wrapper = new TMemSpyTrackedChunk( aChunk, aType );
+    if ( wrapper )
+        {
+        DMemSpyDriverOSAdaptionDChunk& chunkAdaption = iDevice.OSAdaption().DChunk();
+        const TInt cSize = chunkAdaption.GetSize( *aChunk );
+        wrapper->SetSize( cSize );
+        iTrackedChunks.Add( &wrapper->iLink );
+        }
+    //
+    NKern::ThreadLeaveCS();
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::AddTrackedChunk() - END - this: 0x%08x", this ) );
+    }
+
+
+TMemSpyTrackedChunk* DMemSpyInspectedProcess::TrackedChunkByHandle( TAny* aHandle )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::TrackedChunkByHandle() - START - this: 0x%08x", this ) );
+    TMemSpyTrackedChunk* ret = NULL;
+    //
+	const SDblQueLink* const anchor = &iTrackedChunks.iA;
+	for (SDblQueLink* link = iTrackedChunks.First(); link != anchor; link = link->iNext)
+		{
+		TMemSpyTrackedChunk* const trackedChunk = _LOFF( link, TMemSpyTrackedChunk, iLink );
+
+		if  ( trackedChunk && trackedChunk->Handle() == aHandle )
+			{
+			ret = trackedChunk;
+            break;
+			}
+		}
+    //
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::TrackedChunkByHandle() - END - this: 0x%08x, entry: 0x%08x (%O)", this, ret, ret ? ret->iChunk : NULL ) );
+	return ret;
+    }
+
+
+
+
+
+
+
+
+    
+
+
+DMemSpyInspectedProcessManager& DMemSpyInspectedProcess::PManager()
+    {
+    return iDevice.ProcessInspectionManager();
+    }
+
+
+DMemSpyEventMonitor& DMemSpyInspectedProcess::EventMonitor()
+    {
+    return iDevice.EventMonitor();
+    }
+
+
+
+
+
+
+
+TUint DMemSpyInspectedProcess::EMTypeMask() const
+    {
+    TUint ret = EMemSpyEventThreadAdd     | EMemSpyEventThreadRemove  | EMemSpyEventThreadKill |
+                EMemSpyEventProcessUpdate | EMemSpyEventProcessRemove | 
+                EMemSpyEventChunkAdd      | EMemSpyEventChunkUpdate   | EMemSpyEventChunkDelete;
+
+    if  ( iAmDead )
+        {
+        // Not interested anymore...
+        ret = 0;
+        }
+
+    return ret;
+    }
+
+
+void DMemSpyInspectedProcess::EMHandleProcessUpdated( DProcess& aProcess )
+    {
+    const TUint procId = iDevice.OSAdaption().DProcess().GetId( aProcess );
+    if  ( procId == iProcessId )
+        {
+	    Lock();
+
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleProcessUpdated() - START - this: 0x%08x, iProcess: 0x%08x (%O)", this, iProcess, iProcess ) );
+
+        // Mark all tracked chunks as dirty whilst we work out
+        // what is and isn't mapped into the process
+        SetTrackedListUnused();
+        SetTrackedListUnusedStatusByType( TMemSpyTrackedChunk::ETypeChunkGlobalData, EFalse /* global data chunks are still in use */ );
+
+        // Locate any suitable chunks, tagging existing entries as
+        // 'in use' so that we can easily spot ones which are no longer
+        // mapped into the process.
+        FindChunks( *iProcess );
+
+        // Throw away and tracked chunks which aren't mapped into the 
+        // process anymore.
+        DiscardUnusedTrackListItems();
+
+        // Calculate latest statistics...
+        const TBool changeDetected = UpdateStatistics();
+        if  ( changeDetected )
+            {
+            // Inform observer about new results.
+            CompleteClientsRequest( KErrNone, &iInfoCurrent );
+            }
+
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleProcessUpdated() - END - this: 0x%08x", this ) );
+
+        Unlock();
+        }
+    }
+
+
+void DMemSpyInspectedProcess::EMHandleProcessRemoved( DProcess& aProcess )
+    {
+    DMemSpyDriverOSAdaptionDProcess& dProcessAdaption = iDevice.OSAdaption().DProcess();
+    const TUint pid = dProcessAdaption.GetId( aProcess );
+
+    if  ( pid == iProcessId )
+        {
+	    Lock();
+
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleProcessRemoved() - START - this: 0x%08x", this ) );
+
+        // We will implement a multi phased approach to the process being removed.
+        //
+        // The first notification we will send will show that the process heap and
+        // local chunks have been removed, leaving shared chunk sizes intact.
+        //
+        // We will then send another change, this time setting everything to zero...
+        SetTrackedListUnused();
+        SetTrackedListUnusedStatusByType( TMemSpyTrackedChunk::ETypeChunkShared, EFalse /* shared chunks are still in use */ );
+        SetTrackedListUnusedStatusByType( TMemSpyTrackedChunk::ETypeChunkGlobalData, EFalse /* global data chunks are still in use */ );
+        DiscardUnusedTrackListItems();
+        const TBool changeDetected1 = UpdateStatistics();
+        if  ( changeDetected1 )
+            {
+            // Inform observer about new results.
+            CompleteClientsRequest( KErrNone, &iInfoCurrent );
+            }
+
+        // Now repeat the exercise, this time removing everything.
+        ResetTrackedList();
+    
+        // ... including stack
+        iInfoCurrent.iMemoryStack = 0;
+        
+        const TBool changeDetected2 = UpdateStatistics();
+        if  ( changeDetected2 )
+            {
+            // Inform observer about new results.
+            CompleteClientsRequest( KErrNone, &iInfoCurrent );
+            }
+
+        // Stop listening to events since we've drained everything now...
+        iAmDead = ETrue;
+
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleProcessRemoved() - END - this: 0x%08x", this ) );
+
+        Unlock();
+        }
+    }
+
+
+void DMemSpyInspectedProcess::EMHandleThreadAdd( DThread& aThread )
+    {
+    DMemSpyDriverOSAdaptionDThread& dThreadAdaption = iDevice.OSAdaption().DThread();
+    DMemSpyDriverOSAdaptionDProcess& dProcessAdaption = iDevice.OSAdaption().DProcess();
+    //
+    DProcess* owningProcess = dThreadAdaption.GetOwningProcess( aThread );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleThreadAdd() - this: 0x%08x, aThread: 0x%08x, owningProcess: 0x%08x", this, &aThread, owningProcess ) );
+    if ( owningProcess )
+        {
+        const TUint owningProcessId = dProcessAdaption.GetId( *owningProcess );
+        const TUint myId = dProcessAdaption.GetId( *iProcess );
+        //
+        if ( myId == owningProcessId )
+            {
+            EMHandleThreadChanged( aThread );
+            }
+        }
+    }
+
+
+void DMemSpyInspectedProcess::EMHandleThreadRemoved( DThread& aThread )
+    {
+    DMemSpyDriverOSAdaptionDThread& dThreadAdaption = iDevice.OSAdaption().DThread();
+    DMemSpyDriverOSAdaptionDProcess& dProcessAdaption = iDevice.OSAdaption().DProcess();
+    //
+    DProcess* owningProcess = dThreadAdaption.GetOwningProcess( aThread );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleThreadRemoved() - this: 0x%08x, aThread: 0x%08x, owningProcess: 0x%08x", this, &aThread, owningProcess ) );
+    if ( owningProcess )
+        {
+        const TUint owningProcessId = dProcessAdaption.GetId( *owningProcess );
+        const TUint myId = dProcessAdaption.GetId( *iProcess );
+        //
+        if ( myId == owningProcessId )
+            {
+            EMHandleThreadChanged( aThread );
+            }
+        }
+    }
+
+
+void DMemSpyInspectedProcess::EMHandleThreadKilled( DThread& aThread )
+    {
+    //
+    DMemSpyDriverOSAdaptionDThread& dThreadAdaption = iDevice.OSAdaption().DThread();
+    DMemSpyDriverOSAdaptionDProcess& dProcessAdaption = iDevice.OSAdaption().DProcess();
+    //
+    DProcess* owningProcess = dThreadAdaption.GetOwningProcess( aThread );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleThreadKilled() - this: 0x%08x, aThread: 0x%08x, owningProcess: 0x%08x", this, &aThread, owningProcess ) );
+    if ( owningProcess )
+        {
+        const TUint owningProcessId = dProcessAdaption.GetId( *owningProcess );
+        const TUint myId = dProcessAdaption.GetId( *iProcess );
+        //
+        if ( myId == owningProcessId )
+            {
+            EMHandleThreadChanged( aThread );
+            }
+        }
+    }
+
+
+void DMemSpyInspectedProcess::EMHandleThreadChanged( DThread& /*aThread*/ )
+    {
+	Lock();
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleThreadChanged() - START - this: 0x%08x", this ) );
+
+    // This is called when a thread is added, changed, or terminated/killed.
+    // We must be careful to only access the members of aThread that still
+    // exist as if it is being destroyed, the object may be in an intermediate
+    // state.
+
+    // All we are really interested in is recalculating the stack usage
+    // for the process... 
+    iInfoCurrent.iMemoryStack = StackSize( *iProcess );
+
+    // Always inform observer about new results.
+    CompleteClientsRequest( KErrNone, &iInfoCurrent );
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleThreadChanged() - END - this: 0x%08x", this ) );
+
+    Unlock();
+    }
+
+
+void DMemSpyInspectedProcess::EMHandleChunkAdd( DChunk& aChunk )
+    {
+	Lock();
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - START - this: 0x%08x, aChunk: 0x%08x (%O)", this, &aChunk, &aChunk ) );
+
+    // Is this chunk related to our process somehow?
+    if  ( IsChunkRelevantToOurProcess( aChunk ) )
+        {
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - processes match, checking chunk type..." ) );
+
+        const TMemSpyTrackedChunk::TType type = ChunkType( &aChunk );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - chunkType: %d", type ) );
+
+        if  ( type != TMemSpyTrackedChunk::ETypeNotRelevant )
+            {
+            // It's a new entry in our process
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - this: 0x%08x, creating new entry for chunk: 0x%08x", this, &aChunk ) );
+
+            AddTrackedChunk( &aChunk, type );
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - added chunk..." ));
+
+            const TBool changeDetected = UpdateStatistics();
+            if  ( changeDetected )
+                {
+                // Inform observer about new results.
+                CompleteClientsRequest( KErrNone, &iInfoCurrent );
+                }
+            }
+        }
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkAdd() - END - this: 0x%08x", this ) );
+
+    Unlock();
+    }
+
+
+void DMemSpyInspectedProcess::EMHandleChunkUpdated( DChunk& aChunk )
+    {
+	Lock();
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkUpdated() - START - this: 0x%08x, aChunk: 0x%08x [S: %8d] (%O)", this, &aChunk, aChunk.Size(), &aChunk ) );
+
+    // Is this chunk mapped into our process?
+    TMemSpyTrackedChunk* trackedEntry = TrackedChunkByHandle( &aChunk );
+    if  ( trackedEntry != NULL )
+        {
+        const TInt oldSize = trackedEntry->Size();
+        const TInt newSize = iDevice.OSAdaption().DChunk().GetSize( aChunk );
+
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkUpdated() - was tracked entry [0x%08x, size; %10d, type: %d] vs new size: %d", trackedEntry, oldSize, trackedEntry->Type(), newSize ) );
+        
+        // If the existing entry had a size of 0 and the new size is non-zero
+        // then we may have enough data such that we can validate type information.
+        // For example, any secondary heap chunk that is created within the process will
+        // most likely have a Local-NNNNNN style name, and this chunk will be created with
+        // an initial size of zero.
+        //
+        // We can only identify it's type once the chunk has been updated with some data
+        // that supports vTable verification. Hence the type may fluctuate...
+        if  ( oldSize == 0 && newSize > 0 )
+            {
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkUpdated() - checking type again as chunk size was zero..." ) );
+
+            PrintChunkInfo( aChunk );
+            const TMemSpyTrackedChunk::TType type = ChunkType( &aChunk );
+            if  ( type != trackedEntry->Type() )
+                {
+                // Type has changed
+                TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkUpdated() - type has transitioned from: %d to %d", trackedEntry->Type(), type ) );
+                trackedEntry->SetType( type );
+                }
+            }
+
+        // Update our record with new chunk size
+        trackedEntry->SetSize( newSize );
+
+        const TBool changeDetected = UpdateStatistics();
+        if  ( changeDetected )
+            {
+            // Inform observer about new results.
+            CompleteClientsRequest( KErrNone, &iInfoCurrent );
+            }
+        }
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkUpdated() - END - this: 0x%08x", this ) );
+
+    Unlock();
+    }
+
+
+void DMemSpyInspectedProcess::EMHandleChunkDeleted( DChunk& aChunk )
+    {
+	Lock();
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkDeleted() - START - this: 0x%08x", this ) );
+
+    // Is this chunk mapped into our process?
+    TMemSpyTrackedChunk* trackedEntry = TrackedChunkByHandle( &aChunk );
+    if ( trackedEntry != NULL )
+        {
+        // Delete entry
+		trackedEntry->iLink.Deque();
+        delete trackedEntry;
+
+        const TBool changeDetected = UpdateStatistics();
+        if  ( changeDetected )
+            {
+            // Inform observer about new results.
+            CompleteClientsRequest( KErrNone, &iInfoCurrent );
+            }
+        }
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::EMHandleChunkDeleted() - END - this: 0x%08x", this ) );
+
+    Unlock();
+    }
+
+
+void DMemSpyInspectedProcess::PrintChunkInfo( DChunk& aChunk ) const
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::PrintChunkInfo() - iProcess*:           0x%08x", iProcess ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::PrintChunkInfo() - iProcess id:         0x%04x", iProcessId ) );
+    MemSpyDriverUtils::PrintChunkInfo( aChunk, iDevice.OSAdaption() );
+    }
+
+
+TBool DMemSpyInspectedProcess::IsChunkRelevantToOurProcess( DChunk& aChunk ) const
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsChunkRelevantToOurProcess() - START - this: 0x%08x, iProcess: 0x%08x (%4d), aChunk: 0x%08x (%O)", this, iProcess, iProcessId, &aChunk, &aChunk) );
+
+    TBool relevant = EFalse;
+    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = iDevice.OSAdaption().DChunk();
+    //
+    PrintChunkInfo( aChunk );
+    //
+    DProcess* chunkProc = chunkAdaption.GetOwningProcess( aChunk );
+    if  ( chunkProc )
+        {
+        const TUint procId = iDevice.OSAdaption().DProcess().GetId( *chunkProc );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::IsChunkRelevantToOurProcess() - [Owning Process] Comparing chunk pid: 0x%04x with procPid: 0x%04x", this, procId, iProcessId ) );
+        relevant = ( procId == iProcessId );
+        }
+    else if ( chunkAdaption.GetOwner( aChunk ) == iProcess )
+        {
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::IsChunkRelevantToOurProcess() - [Owner Match]" ) );
+        relevant = ETrue;
+        }
+    else
+        {
+        const TUint controllingOwnerPid = chunkAdaption.GetControllingOwnerId( aChunk );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::IsChunkRelevantToOurProcess() - [Controlling Owner] Comparing chunk owner: 0x%04x with procPid: 0x%04x", this, controllingOwnerPid, iProcessId ) );
+        relevant = ( controllingOwnerPid == iProcessId );
+        }
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsChunkRelevantToOurProcess() - END - this: 0x%08x, relevant: %d", this, relevant ) );
+    return relevant;
+    }
+
+
+TMemSpyTrackedChunk::TType DMemSpyInspectedProcess::ChunkType( DObject* aObject ) const
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - START - this: 0x%08x, iProcess: 0x%08x, aObject: 0x%08x (%O)", this, iProcess, aObject, aObject ) );
+    TMemSpyTrackedChunk::TType ret = TMemSpyTrackedChunk::ETypeNotRelevant;
+
+    // Firstly, check if it's actually held within the chunk container.
+    if  ( aObject )
+        {
+        DMemSpyDriverOSAdaptionDChunk& chunkAdaption = iDevice.OSAdaption().DChunk();
+        const TObjectType objectType = chunkAdaption.GetObjectType( *aObject );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - objectType: %d vs EChunk (%d)", objectType, EChunk ) );
+
+        if  ( objectType == EChunk )
+            {
+            DChunk* chunk = (DChunk*) aObject;
+            //
+            if  ( IsChunkRelevantToOurProcess( *chunk ) )
+                {
+                TName name;
+                TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - getting chunk name..." ) );
+                chunk->Name( name );
+                TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - name: %S", &name ) );
+
+                // It is definitely owned by this process. That means that
+                // it could be a heap, or then it's a just some other kind
+                // of data chunk which our process happens to have created.
+                //
+                // The main thread within a process results in the creation
+                // of a heap called $HEAP, but that isn't the case for other
+                // secondary (etc) threads.
+                //
+                // Only way I can think to identify these is via vTables.
+                if  ( name == KMemSpyLitDollarDllData )
+                    {
+                    // This chunk contains Dll Global Data for the process
+                    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - TMemSpyTrackedChunk::ETypeChunkGlobalData" ) );
+                    ret = TMemSpyTrackedChunk::ETypeChunkGlobalData;
+                    }
+                else if ( name == KMemSpyLitDollarDat )
+                    {
+                    // This chunk contains process global data as well as user-side stacks for
+                    // the process. However, we calculate the stacks independently, so we must 
+                    // adjust this later on to remove stack overhead.
+                    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - TMemSpyTrackedChunk::ETypeChunkProcessGlobalDataAndUserStack" ) );
+                    ret = TMemSpyTrackedChunk::ETypeChunkProcessGlobalDataAndUserStack;
+                    }
+                else if ( IsHeapChunk( *chunk, name ) )
+                    {
+                    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - TMemSpyTrackedChunk::ETypeChunkHeap" ) );
+                    ret = TMemSpyTrackedChunk::ETypeChunkHeap;
+                    }
+                else
+                    {
+                    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - TMemSpyTrackedChunk::ETypeChunkLocal" ) );
+                    ret = TMemSpyTrackedChunk::ETypeChunkLocal;
+                    }
+                }
+            else
+                {
+                // It's a chunk that is mapped into our process,
+                // but isn't owned by us. Therefore it is shared by some
+                // other process.
+                TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - TMemSpyTrackedChunk::ETypeChunkShared" ) );
+                ret = TMemSpyTrackedChunk::ETypeChunkShared;
+                }
+            }
+        }
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::ChunkType() - END - this: 0x%08x, ret: %d", this, ret ) );
+    return ret;
+    }
+
+
+TBool DMemSpyInspectedProcess::IsHeapChunk( DChunk& aChunk, const TName& aName ) const
+    {
+    const TUint rHeapVTable = iDevice.RHeapVTable();
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - START - this: 0x%08x, aChunk: 0x%08x, RHeapVTable: 0x%08x, iProcess: 0x%08x, aName: %S, (%O)", this, &aChunk, rHeapVTable, iProcess, &aName, &aChunk ) );
+    
+    // The first 4 bytes of every chunk correspond to the allocator VTable (For heap chunks).
+    // If it matches RHeap's vtable, we'll treat it as a heap.
+    TBool isHeap = EFalse;
+
+    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = iDevice.OSAdaption().DChunk();
+    TUint8* base = chunkAdaption.GetBase( aChunk );
+    const TInt size = chunkAdaption.GetSize( aChunk );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - base: 0x%08x, size: %d", base, size ) );
+
+    if  ( iProcess && size >= 4 )
+        {
+        // Chunks are mapped into entire process so any thread within the process is enough...
+        DThread* firstThread = iProcess->FirstThread();
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - firstThread: 0x%08x (%O)", firstThread, firstThread ) );
+        if  ( firstThread != NULL )
+            {
+			NKern::ThreadEnterCS();
+            TInt err = firstThread->Open();
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - firstThread open result: %d", err ) );
+
+            if  ( err == KErrNone )
+                {
+                TBuf8<4> allocatorVTableBuffer;
+                err = Kern::ThreadRawRead( firstThread, base, (TUint8*) allocatorVTableBuffer.Ptr(), allocatorVTableBuffer.MaxLength() );
+                TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk - read result of vtable data from requested thread is: %d", err ));
+                //
+                if  ( err == KErrNone )
+                    {
+                    TRACE( MemSpyDriverUtils::DataDump("possible chunk vtable data - %lS", allocatorVTableBuffer.Ptr(), allocatorVTableBuffer.MaxLength(), allocatorVTableBuffer.MaxLength() ) );
+                    allocatorVTableBuffer.SetLength( allocatorVTableBuffer.MaxLength() );
+                    
+                    const TUint32 vtable =   allocatorVTableBuffer[0] +
+                                            (allocatorVTableBuffer[1] << 8) + 
+                                            (allocatorVTableBuffer[2] << 16) + 
+                                            (allocatorVTableBuffer[3] << 24);
+                    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk - [possible] vTable within chunk is: 0x%08x", vtable) );
+
+                    // Check the v-table to work out if it really is an RHeap
+                    isHeap = ( vtable == rHeapVTable );
+                    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - isHeap: %d", isHeap ) );
+                    }
+
+                TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - closing first thread..." ) );
+            	Kern::SafeClose( (DObject*&) firstThread, NULL );
+                }
+			NKern::ThreadLeaveCS();
+            }
+        }
+    //
+    if  ( !isHeap && aName == KMemSpyLitDollarHeap )
+        {
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - is standard Symbian OS initial heap chunk - $HEAP" ) );
+        isHeap = ETrue;
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::IsHeapChunk() - END - this: 0x%08x, isHeap: %d", this, isHeap ) );
+    return isHeap;
+    }
+
+
+TUint32 DMemSpyInspectedProcess::TotalStatistics( const TMemSpyDriverProcessInspectionInfo& aStats, TBool aIncludeShared )
+    {
+    TUint32 total = aStats.iMemoryStack + 
+                    aStats.iMemoryHeap +
+                    aStats.iMemoryChunkLocal + 
+                    aStats.iMemoryGlobalData;
+    //
+    if ( aIncludeShared )
+        {
+        total += aStats.iMemoryChunkShared;
+        }
+    //
+    return total;
+    }
+
+
+TBool DMemSpyInspectedProcess::IsEqual( const TMemSpyDriverProcessInspectionInfo& aLeft, const TMemSpyDriverProcessInspectionInfo& aRight )
+    {
+    const TBool equal = ( aLeft.iMemoryStack == aRight.iMemoryStack &&
+                          aLeft.iMemoryHeap == aRight.iMemoryHeap &&
+                          aLeft.iMemoryChunkLocal == aRight.iMemoryChunkLocal &&
+                          aLeft.iMemoryChunkShared == aRight.iMemoryChunkShared &&
+                          aLeft.iMemoryGlobalData == aRight.iMemoryGlobalData 
+                        );
+    return equal;
+    }
+
+
+void DMemSpyInspectedProcess::ResetStatistics( TMemSpyDriverProcessInspectionInfo& aStats )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetStatistics() - START - this: 0x%08x", this ) );
+    aStats.iProcessId = iProcessId;
+    aStats.iMemoryHeap = 0;
+    aStats.iMemoryChunkLocal = 0;
+    aStats.iMemoryChunkShared = 0;
+    aStats.iMemoryGlobalData = 0;
+    aStats.iTime = Kern::SystemTime();
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetStatistics() - END - this: 0x%08x", this ) );
+    }
+
+
+TBool DMemSpyInspectedProcess::UpdateStatistics()
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - START - this: 0x%08x, iChangeDeliveryCounter: %04d, iProcess: 0x%08x %O", this, iChangeDeliveryCounter, iProcess, iProcess ) );
+
+    // Preserve last stats so we can identify if something really changed...
+    iInfoLast = iInfoCurrent;
+
+    // Reset current stats ready for updating. This doesn't wipe the stack field, since
+    // that only changes when some kind of thread event occurs...
+    ResetStatistics( iInfoCurrent );
+    
+    // Go through all tracked chunks and update our stats based upon
+    // their current values...
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() CHUNK ENTRIES:" ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+	const SDblQueLink* const anchor = &iTrackedChunks.iA;
+	for (SDblQueLink* link = iTrackedChunks.First(); link != anchor; link = link->iNext)
+		{
+		TMemSpyTrackedChunk* const trackedChunk = _LOFF( link, TMemSpyTrackedChunk, iLink );
+        //
+        switch( trackedChunk->Type() )
+            {
+        case TMemSpyTrackedChunk::ETypeChunkHeap:
+            iInfoCurrent.iMemoryHeap += trackedChunk->Size();
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - [0x%08x] TMemSpyTrackedChunk::ETypeChunkHeap       - %12d (0x%08x, %O)", trackedChunk, trackedChunk->Size(), trackedChunk->iChunk, trackedChunk->iChunk ) );
+            break;
+        case TMemSpyTrackedChunk::ETypeChunkLocal:
+            iInfoCurrent.iMemoryChunkLocal += trackedChunk->Size();
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - [0x%08x] TMemSpyTrackedChunk::ETypeChunkLocal      - %12d (0x%08x, %O)", trackedChunk, trackedChunk->Size(), trackedChunk->iChunk, trackedChunk->iChunk ) );
+            break;
+        case TMemSpyTrackedChunk::ETypeChunkShared:
+            iInfoCurrent.iMemoryChunkShared += trackedChunk->Size();
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - [0x%08x] TMemSpyTrackedChunk::ETypeChunkShared     - %12d (0x%08x, %O)", trackedChunk, trackedChunk->Size(), trackedChunk->iChunk, trackedChunk->iChunk ) );
+            break;
+        case TMemSpyTrackedChunk::ETypeChunkGlobalData:
+            iInfoCurrent.iMemoryGlobalData += trackedChunk->Size();
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - [0x%08x] TMemSpyTrackedChunk::ETypeChunkGlobalData - %12d (0x%08x, %O)", trackedChunk, trackedChunk->Size(), trackedChunk->iChunk, trackedChunk->iChunk ) );
+            break;
+        case TMemSpyTrackedChunk::ETypeChunkProcessGlobalDataAndUserStack:
+            break;
+
+        default:
+        case TMemSpyTrackedChunk::ETypeNotRelevant:
+            break;
+            }
+		}
+
+    const TUint32 totalLastIncShared = TotalStatistics( iInfoLast );
+    const TUint32 totalLastExcShared = TotalStatistics( iInfoLast, EFalse );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() LAST:" ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast.iMemoryStack:                   %12d", iInfoLast.iMemoryStack ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast.iMemoryHeap:                    %12d", iInfoLast.iMemoryHeap ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast.iMemoryChunkLocal:              %12d", iInfoLast.iMemoryChunkLocal ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast.iMemoryChunkShared:             %12d", iInfoLast.iMemoryChunkShared ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast.iMemoryGlobalData:              %12d", iInfoLast.iMemoryGlobalData ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - --------------------------------------------------------------------------" ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoLast total:                          %12d / %12d", totalLastIncShared, totalLastExcShared ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+
+
+    const TUint32 totalCurrentIncShared = TotalStatistics( iInfoCurrent );
+    const TUint32 totalCurrentExcShared = TotalStatistics( iInfoCurrent, EFalse );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() CURRENT:" ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent.iMemoryStack:                %12d", iInfoCurrent.iMemoryStack ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent.iMemoryHeap:                 %12d", iInfoCurrent.iMemoryHeap ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent.iMemoryChunkLocal:           %12d", iInfoCurrent.iMemoryChunkLocal ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent.iMemoryChunkShared:          %12d", iInfoCurrent.iMemoryChunkShared ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent.iMemoryGlobalData:           %12d", iInfoCurrent.iMemoryGlobalData ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - --------------------------------------------------------------------------" ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoCurrent total:                       %12d / %12d", totalCurrentIncShared, totalCurrentExcShared ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+
+    // Update peaks, i.e. how large each individual element reached
+    const TUint32 totalPeaks = TotalStatistics( iInfoPeaks );
+    iInfoPeaks.iMemoryStack = Max( iInfoPeaks.iMemoryStack, iInfoCurrent.iMemoryStack );
+    iInfoPeaks.iMemoryHeap = Max( iInfoPeaks.iMemoryHeap, iInfoCurrent.iMemoryHeap );
+    iInfoPeaks.iMemoryChunkLocal = Max( iInfoPeaks.iMemoryChunkLocal, iInfoCurrent.iMemoryChunkLocal );
+    iInfoPeaks.iMemoryChunkShared = Max( iInfoPeaks.iMemoryChunkShared, iInfoCurrent.iMemoryChunkShared );
+    iInfoPeaks.iMemoryGlobalData = Max( iInfoPeaks.iMemoryGlobalData, iInfoCurrent.iMemoryGlobalData );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() PEAK:" ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks.iMemoryStack:                  %12d", iInfoPeaks.iMemoryStack ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks.iMemoryHeap:                   %12d", iInfoPeaks.iMemoryHeap ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks.iMemoryChunkLocal:             %12d", iInfoPeaks.iMemoryChunkLocal ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks.iMemoryChunkShared:            %12d", iInfoPeaks.iMemoryChunkShared ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks.iMemoryGlobalData:             %12d", iInfoPeaks.iMemoryGlobalData ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - -----------------------------------------------------" ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoPeaks total:                         %12d", totalPeaks ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+
+    // Update HWM, i.e. the largest total so far.
+    const TUint32 totalHWMIncShared = TotalStatistics( iInfoHWMIncShared );
+    const TUint32 totalHWMExcShared = TotalStatistics( iInfoHWMIncShared, EFalse );
+    if  ( totalCurrentIncShared > totalHWMIncShared )
+        {
+        iInfoHWMIncShared = iInfoCurrent;
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() HWM INC SHARED:" ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared.iMemoryStack:           %12d", iInfoHWMIncShared.iMemoryStack ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared.iMemoryHeap:            %12d", iInfoHWMIncShared.iMemoryHeap ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared.iMemoryChunkLocal:      %12d", iInfoHWMIncShared.iMemoryChunkLocal ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared.iMemoryChunkShared:     %12d", iInfoHWMIncShared.iMemoryChunkShared ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared.iMemoryGlobalData:      %12d", iInfoHWMIncShared.iMemoryGlobalData ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - -----------------------------------------------------" ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMIncShared total:                  %12d", totalHWMIncShared ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+        }
+    if  ( totalCurrentExcShared > totalHWMExcShared )
+        {
+        iInfoHWMExcShared = iInfoCurrent;
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() HWM EXC SHARED:" ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared.iMemoryStack:           %12d", iInfoHWMExcShared.iMemoryStack ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared.iMemoryHeap:            %12d", iInfoHWMExcShared.iMemoryHeap ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared.iMemoryChunkLocal:      %12d", iInfoHWMExcShared.iMemoryChunkLocal ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared.iMemoryChunkShared:     %12d", iInfoHWMExcShared.iMemoryChunkShared ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared.iMemoryGlobalData:      %12d", iInfoHWMExcShared.iMemoryGlobalData ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - -----------------------------------------------------" ) );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - iInfoHWMExcShared total:                  %12d", totalHWMExcShared ) );
+        }
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() " ) );
+
+    // Work out if something changed...
+    const TBool statsChanged = !IsEqual( iInfoLast, iInfoCurrent );
+    if  ( statsChanged )
+        {
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - STATS CHANGED!" ) );
+        }
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::UpdateStatistics() - END - this: 0x%08x, statsChanged: %d, iChangeDeliveryCounter: %04d, iProcess: 0x%08x %O", this, statsChanged, iChangeDeliveryCounter, iProcess, iProcess ) );
+    return statsChanged;
+    }
+
+
+void DMemSpyInspectedProcess::FindChunks( DProcess& aProcess )
+    {
+	__ASSERT_CRITICAL;
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - START - this: 0x%08x", this ) );
+  
+    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = iDevice.OSAdaption().DChunk();
+    DMemSpyDriverOSAdaptionDProcess& processAdaption = iDevice.OSAdaption().DProcess();
+
+    // Iterate through each handle in the process
+    if  ( processAdaption.IsHandleIndexValid( aProcess ) )
+        {
+	    MemSpyObjectIx* processHandles = processAdaption.GetHandles( aProcess );
+		
+		MemSpyObjectIx_HandleLookupLock();
+        const TInt count = processHandles->Count();
+		MemSpyObjectIx_HandleLookupUnlock();
+
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - got: %d handles...", count ) );
+
+	    for( TInt i=0; i<count; i++ )
+    	    {
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - checking handle index: %2d", i ) );
+
+    	    // Get a handle from the process container...
+            MemSpyObjectIx_HandleLookupLock();
+			if (i >= processHandles->Count()) break; // Count may have changed in the meantime
+    	    DObject* object = (*processHandles)[ i ];
+			if (object && object->Open() != KErrNone) object = NULL;
+			MemSpyObjectIx_HandleLookupUnlock();
+
+            const TObjectType objectType = ( object ? chunkAdaption.GetObjectType( *object ) : EObjectTypeAny );
+            TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - object: 0x%08x, type: %2d (%O)", object, objectType, object ) );
+
+            // Is it a chunk that is already mapped into our process?
+            // See if we're already aware of this chunk...
+            if  ( object != NULL && objectType == EChunk )
+                {
+                TMemSpyTrackedChunk* existingEntry = TrackedChunkByHandle( object );
+                TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - found a chunk, existing lookup entry: 0x%08x", existingEntry ) );
+
+                if  ( existingEntry != NULL )
+                    {
+                    const TInt cSize = chunkAdaption.GetSize( *existingEntry->iChunk );
+                    TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - setting existing entry size to: %d", cSize ) );
+
+                    // It must be a chunk then... Update size
+                    existingEntry->SetSize( cSize );
+
+                    // This item is in use, i.e. it is not unused
+                    existingEntry->SetUnused( EFalse );
+                    }
+                else
+                    {
+                    DChunk* chunk = (DChunk*) object;
+                    TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - chunk not known, checking type..." ) );
+
+                    // We have no record of this item so far. Is it really a chunk?
+                    const TMemSpyTrackedChunk::TType type = ChunkType( object );
+                    TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - type is: %d", type ) );
+
+                    if  ( type != TMemSpyTrackedChunk::ETypeNotRelevant )
+                        {
+                        // It's a new entry
+                        TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - this: 0x%08x, creating new entry for chunk: 0x%08x", this, chunk ) );
+
+                        AddTrackedChunk( chunk, type );
+                        TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - added chunk..." ));
+                        }
+                    }
+                }
+			if (object) object->Close(NULL);
+    	    }
+        }
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::FindChunks() - END - this: 0x%08x", this ) );
+    }
+    
+    
+TInt DMemSpyInspectedProcess::StackSize( DProcess& aProcess )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::StackSize() - START - this: 0x%08x", this ) );
+    TInt ret = 0;
+    //
+    DMemSpyDriverOSAdaptionDThread& dThreadAdaption = iDevice.OSAdaption().DThread();
+
+    iUserThreadStackSize = 0;
+    //
+	SDblQueLink* pLink = aProcess.iThreadQ.First();
+	while(pLink != &aProcess.iThreadQ.iA)
+		{
+		DThread* pT = _LOFF( pLink, DThread, iProcessLink );
+        //
+        const TUint32 userStackSize = dThreadAdaption.GetUserStackSize( *pT );
+        const TUint32 suprStackSize = dThreadAdaption.GetSupervisorStackSize( *pT );
+        TRACE( Kern::Printf("DMemSpyInspectedProcess::StackSize() - thread: 0x%08x, userStack: %8d, suprStack: %8d, total: %8d %O", pT, userStackSize, suprStackSize, userStackSize + suprStackSize, pT ));
+        //
+        iUserThreadStackSize += userStackSize;
+		ret += userStackSize + suprStackSize;
+        //
+		pLink = pLink->iNext;
+		}
+	//
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::StackSize() - END - this: 0x%08x, total stack size for process: %8d, iUserThreadStackSize: %8d", this, ret, iUserThreadStackSize ) );
+	return ret;
+    }
+
+
+void DMemSpyInspectedProcess::ResetPendingChanges()
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetPendingChanges() - START - this: 0x%08x", this ) );
+    NKern::ThreadEnterCS();
+    //
+    SDblQueLink* link = iPendingChanges.GetFirst();
+	while( link )
+		{
+        TMemSpyTrackedChunkChangeInfo* cachedChange = _LOFF( link, TMemSpyTrackedChunkChangeInfo, iLink );
+        delete cachedChange;
+        link = iPendingChanges.GetFirst();
+		}
+    //
+    NKern::ThreadLeaveCS();
+    TRACE( Kern::Printf("DMemSpyInspectedProcess::ResetPendingChanges() - END - this: 0x%08x", this ) );
+    }
+
+
+void DMemSpyInspectedProcess::Lock() const
+	{
+	NKern::ThreadEnterCS();
+	Kern::MutexWait(*iLock);
+	}
+
+void DMemSpyInspectedProcess::Unlock() const
+	{
+	Kern::MutexSignal(*iLock);
+	NKern::ThreadLeaveCS();
+	}
+
+
+
+
+
+
+
+
+
+
+TMemSpyTrackedChunk::TMemSpyTrackedChunk( DChunk* aChunk, TType aType )
+:   iChunk( aChunk ), iType( aType ), iSize( 0 ), iUnused( EFalse )
+    {
+    }
+
+
+void TMemSpyTrackedChunk::SetSize( TInt aSize )
+    {
+    iSize = aSize;
+    }
+
+
+void TMemSpyTrackedChunk::SetUnused( TBool aUnused )
+    {
+    iUnused = aUnused;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverInspectedProcessManager.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,263 @@
+/*
+* 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 "MemSpyDriverInspectedProcessManager.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverInspectedProcess.h"
+
+
+DMemSpyInspectedProcessManager::DMemSpyInspectedProcessManager()
+    {
+    }
+
+
+DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager()
+	{
+	TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - START"));
+    NKern::ThreadEnterCS();
+
+	TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - cancelling event monitor..."));
+    EventMonitor().RequestEventsCancel( *this );
+
+	TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - freeing all inspected processes..."));
+    FreeAllInspectedProcesses();
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - closing auto-start SID list..."));
+    iAutoStartSIDs.Close();
+
+    if  ( iDevice )
+		{
+        TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - closing iDevice" ));
+		iDevice->Close(NULL);
+		}
+
+    NKern::ThreadLeaveCS();
+	TRACE( Kern::Printf("DMemSpyInspectedProcessManager::~DMemSpyInspectedProcessManager() - END"));
+	}
+
+
+TInt DMemSpyInspectedProcessManager::Create( DMemSpyDriverDevice* aDevice )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::Create() - START" ) );
+    //
+    TInt error = aDevice->Open();
+    if  ( error == KErrNone )
+        {
+        iDevice = aDevice;
+
+        TRACE( Kern::Printf("DMemSpyInspectedProcessManager::Create() - requesting events..." ) );
+        EventMonitor().RequestEvents( *this );
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::Create() - END - error: %d", error ) );
+    return error;
+    }
+
+
+TInt DMemSpyInspectedProcessManager::ProcessOpen( DProcess* aProcess )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessOpen() - START - aProcess: 0x%08x (%O)", aProcess, aProcess ) );
+    NKern::ThreadEnterCS();
+    TInt error = KErrNotFound;
+    //
+    DMemSpyInspectedProcess* object = InspectedProcessByProcessId( aProcess->iId );
+    if  ( object == NULL )
+        {
+        object = new DMemSpyInspectedProcess( *iDevice );
+        //
+        if ( object == NULL )
+            {
+            error = KErrNoMemory;
+            }
+        else
+            {
+            error = object->Open( aProcess );
+            //
+            if  ( error == KErrNone )
+                {
+                iMonitoredProcesses.Add( &object->iPMLink );
+                }
+            else
+                {
+                delete object;
+                }
+            }
+        }
+    else
+        {
+        error = KErrNone;
+        }
+    //
+    NKern::ThreadLeaveCS();
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessOpen() - END - aProcess: 0x%08x, error: %d", aProcess, error ) );
+    return error;
+    }
+
+
+TInt DMemSpyInspectedProcessManager::ProcessClose( DProcess* aProcess )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessClose() - START - aProcess: 0x%08x (%O)", aProcess, aProcess ) );
+    TInt error = KErrNotFound;
+    //
+    DMemSpyInspectedProcess* object = InspectedProcessByProcessId( aProcess->iId );
+    if  ( object != NULL )
+        {
+        NKern::ThreadEnterCS();
+        object->iPMLink.Deque();
+        delete object;
+        NKern::ThreadLeaveCS();
+        error = KErrNone;
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessClose() - END - aProcess: 0x%08x, error: %d", aProcess, error ) );
+    return error;
+    }
+
+
+TInt DMemSpyInspectedProcessManager::ProcessCount() const
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessCount() - START" ) );
+    TInt ret = 0;
+    //
+	const SDblQueLink* const anchor = &iMonitoredProcesses.iA;
+	for (SDblQueLink* link = iMonitoredProcesses.First(); link != anchor; link = link->iNext )
+		{
+        ++ret;
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::ProcessCount() - END - count: %d", ret ) );
+    return ret;
+    }
+
+
+DMemSpyInspectedProcess* DMemSpyInspectedProcessManager::InspectedProcessByProcessId( TUint aProcessId )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::InspectedProcessByProcessId() - START - aProcessId: 0x%08x", aProcessId ) );
+    DMemSpyInspectedProcess* ret = 0;
+    //
+	const SDblQueLink* const anchor = &iMonitoredProcesses.iA;
+	for (SDblQueLink* link = iMonitoredProcesses.First(); link != anchor; link = link->iNext )
+		{
+		DMemSpyInspectedProcess* object = _LOFF( link, DMemSpyInspectedProcess, iPMLink );
+        //
+        if  ( object->ProcessId() == aProcessId )
+            {
+            ret = object;
+            break;
+            }
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::InspectedProcessByProcessId() - END - aProcessId: 0x%08x, ret: 0x%08x", aProcessId, ret ) );
+    return ret;
+    }
+
+
+void DMemSpyInspectedProcessManager::AutoStartListReset()
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::AutoStartListReset() - START") );
+    NKern::ThreadEnterCS();
+
+    iAutoStartSIDs.Reset();
+
+    NKern::ThreadLeaveCS();
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::AutoStartListReset() - END") );
+    }
+
+
+TInt DMemSpyInspectedProcessManager::AutoStartListAdd( TUint aSID )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::AutoStartListAdd() - START - aSID: 0x%08x", aSID ) );
+    //
+    NKern::ThreadEnterCS();
+    const TInt error = iAutoStartSIDs.Append( aSID );
+    NKern::ThreadLeaveCS();
+    //
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::AutoStartListAdd() - END - error: %d", error ) );
+    return error;
+    }
+
+
+
+
+
+
+void DMemSpyInspectedProcessManager::FreeAllInspectedProcesses()
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::FreeAllInspectedProcesses() - START") );
+	
+    SDblQueLink* link = iMonitoredProcesses.GetFirst();
+	while( link )
+		{
+		DMemSpyInspectedProcess* object = _LOFF( link, DMemSpyInspectedProcess, iPMLink );
+        if  ( object )
+            {
+            delete object;
+            }
+
+        link = iMonitoredProcesses.GetFirst();
+		}
+
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::FreeAllInspectedProcesses() - END") );
+    }
+
+
+DMemSpyEventMonitor& DMemSpyInspectedProcessManager::EventMonitor()
+    {
+    return iDevice->EventMonitor();
+    }
+
+
+TUint DMemSpyInspectedProcessManager::EMTypeMask() const
+    {
+    return EMemSpyEventProcessAdd;
+    }
+
+
+void DMemSpyInspectedProcessManager::EMHandleProcessAdd( DProcess& aProcess )
+    {
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::EMHandleProcessAdd() - START - aProcess: 0x%08x %O", &aProcess, &aProcess ) );
+ 
+    const TUint uid3 = aProcess.iUids.iUid[ 2 ].iUid;
+    const TInt findResult = iAutoStartSIDs.Find( uid3 );
+
+#ifdef _DEBUG
+    const TUint uid1 = aProcess.iUids.iUid[ 0 ].iUid;
+    const TUint uid2 = aProcess.iUids.iUid[ 1 ].iUid;
+    Kern::Printf("DMemSpyInspectedProcessManager::EMHandleProcessAdd() - uids[ 0x%08x / 0x%08x / 0x%08x ], findResult: %d", uid1, uid2, uid3, findResult );
+#endif
+    //
+    if  ( findResult != KErrNotFound )
+        {
+        TRACE( Kern::Printf("DMemSpyInspectedProcessManager::EMHandleProcessAdd() - AUTO-START FOR PROCESS %O DETECTED", &aProcess ) );
+        const TInt error = ProcessOpen( &aProcess );
+        (void) error;
+        TRACE( Kern::Printf("DMemSpyInspectedProcessManager::EMHandleProcessAdd() - auto-start error: %d", error ) );
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyInspectedProcessManager::EMHandleProcessAdd() - END" ) );
+    }
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverLogicalChannel.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,325 @@
+/*
+* 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 "MemSpyDriverLogicalChannel.h"
+
+// System includes
+#include <u32hal.h>
+#include <e32rom.h>
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include <memspy/driver/memspydriverconstants.h>
+#include "MemSpyDriverLogChanChunks.h"
+#include "MemSpyDriverLogChanClientServer.h"
+#include "MemSpyDriverLogChanCodeSegs.h"
+#include "MemSpyDriverLogChanContainers.h"
+#include "MemSpyDriverLogChanHeapData.h"
+#include "MemSpyDriverLogChanHeapWalk.h"
+#include "MemSpyDriverLogChanHeapInfo.h"
+#include "MemSpyDriverLogChanMisc.h"
+#include "MemSpyDriverLogChanProcessInspection.h"
+#include "MemSpyDriverLogChanStack.h"
+#include "MemSpyDriverLogChanRawMemory.h"
+#include "MemSpyDriverLogChanUserEventMonitor.h"
+#include "MemSpyDriverLogChanThreadAndProcess.h"
+
+
+DMemSpyDriverLogicalChannel::DMemSpyDriverLogicalChannel()
+    {
+    }
+
+
+DMemSpyDriverLogicalChannel::~DMemSpyDriverLogicalChannel()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::~DMemSpyDriverLogicalChannel() - START"));
+
+    NKern::ThreadEnterCS();
+    SubChannelsDestroy();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::~DMemSpyDriverLogicalChannel() - closing client thread..."));
+    Kern::SafeClose( (DObject*&) iClientThread, NULL );
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::~DMemSpyDriverLogicalChannel() - calling device to cleanup..."));
+    MemSpyDevice().Cleanup();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::~DMemSpyDriverLogicalChannel() - END"));
+	}
+
+
+TInt DMemSpyDriverLogicalChannel::DoCreate( TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& aVer )
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::DoCreate() - START - heldFM: %d, device: 0x%08x", Kern::CurrentThread().iNThread.iHeldFastMutex != NULL, &MemSpyDevice() ) );
+
+    TInt error = KErrNone;
+    //
+    if  ( !Kern::QueryVersionSupported( KMemSpyDriverVersion(), aVer ) )
+        {
+        error = KErrNotSupported;
+        }
+    else
+        {
+        // Try to get the memory model type
+        
+    	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::DoCreate - opening client thread..."));
+
+        iClientThread = &Kern::CurrentThread();
+	    error = iClientThread->Open();
+        TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::DoCreate - client thread open error: %d", error ));
+
+        if  ( error == KErrNone )
+            {
+            TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::DoCreate - creating sub channels error: %d", error ));
+            error = SubChannelsRegister();
+            }
+        }
+    //
+	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::DoCreate() - END - heldFM: %d", Kern::CurrentThread().iNThread.iHeldFastMutex != NULL ) );
+    return error;
+	}
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogicalChannel::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TRACE( Kern::Printf(" " ) );
+	TRACE( Kern::Printf(" " ) );
+	TRACE( Kern::Printf("--------------------------------------------------------------------------------------------------------------------- " ) );
+	TRACE_OP( Kern::Printf("DMemSpyDriverLogicalChannel::Request() - START - fn: %3d, a1: 0x%08x, a2: 0x%08x, heldFM: %d", aFunction, a1, a2, iClientThread->iNThread.iHeldFastMutex != NULL ) );
+	TRACE( Kern::Printf("--------------------------------------------------------------------------------------------------------------------- " ) );
+	//
+    TInt r = KErrNotSupported;
+    //
+    DMemSpyDriverLogChanBase* handler = SubChannelForFunction( aFunction );
+    if  ( handler )
+        {
+        r = handler->Request( aFunction, a1, a2 );
+        }
+    //
+#ifdef _DEBUG
+    if  ( r < 0 && r != KErrEof )
+        {
+	    Kern::Printf( "DMemSpyDriverLogicalChannel::Request() - END - fn: %3d, a1: 0x%08x, a2: 0x%08x, heldFM: %d, r: %d", aFunction, a1, a2, iClientThread->iNThread.iHeldFastMutex != NULL, r );
+        }
+#endif
+	TRACE( Kern::Printf(" " ) );
+	TRACE( Kern::Printf(" " ) );
+    //
+    return r;
+	}
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogicalChannel::SubChannelsRegister()
+    {
+    TInt r = KErrNone;
+    DMemSpyDriverDevice& device = MemSpyDevice();
+    DMemSpyDriverLogChanBase* subChan = NULL;
+    //
+    subChan = new DMemSpyDriverLogChanChunks( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanClientServer( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanCodeSegs( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanContainers( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanHeapData( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanHeapInfo( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanHeapWalk( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanMisc( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanProcessInspection( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanRawMemory( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanStack( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanThreadAndProcess( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    subChan = new DMemSpyDriverLogChanUserEventMonitor( device, *iClientThread );
+    r = SubChannelConstructAndSave( subChan );
+    if ( r != KErrNone )
+        {
+        return r;
+        }
+    //
+    return r;
+    }
+
+
+TInt DMemSpyDriverLogicalChannel::SubChannelConstructAndSave( DMemSpyDriverLogChanBase*& aSubChannel )
+    {
+    TInt r = KErrNoMemory;
+    //
+    if ( aSubChannel )
+        {
+        NKern::ThreadEnterCS();
+        r = aSubChannel->Construct();
+        //
+        if  ( r == KErrNone )
+            {
+            r = iSubChannels.Append( aSubChannel );
+            if  ( r != KErrNone )
+                {
+                delete aSubChannel;
+                }
+            }
+        else
+            {
+            delete aSubChannel;
+            }
+        //
+        NKern::ThreadLeaveCS();
+        }
+    //
+    aSubChannel = NULL;
+    return r;
+    }
+
+
+void DMemSpyDriverLogicalChannel::SubChannelsDestroy()
+    {
+    const TInt count = iSubChannels.Count();
+	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::SubChannelsDestroy() - START - count: %d", count ) );
+    //
+    NKern::ThreadEnterCS();
+    for( TInt i=0; i<count; i++ )
+        {
+        DMemSpyDriverLogChanBase* subChan = iSubChannels[ i ];
+	    TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::SubChannelsDestroy() - deleting subChannel: 0x%08x", subChan ) );
+        delete subChan;
+        }
+    //
+    iSubChannels.Reset();
+    NKern::ThreadLeaveCS();
+    //
+	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::SubChannelsDestroy() - END" ) );
+    }
+
+
+DMemSpyDriverLogChanBase* DMemSpyDriverLogicalChannel::SubChannelForFunction( TInt aFunction )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::SubChannelForFunction() - START - aFunction: %d", aFunction ) );
+    //
+    DMemSpyDriverLogChanBase* ret = NULL;
+    const TInt count = iSubChannels.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        DMemSpyDriverLogChanBase* subChan = iSubChannels[ i ];
+        if  ( subChan->IsHandler( aFunction ) )
+            {
+            ret = subChan;
+            break;
+            }
+        }
+    //
+	TRACE( Kern::Printf("DMemSpyDriverLogicalChannel::SubChannelForFunction() - END - aFunction: %d, subChannel: 0x%08x", aFunction, ret ) );
+    return ret;
+    }
+
+
+DMemSpyDriverDevice& DMemSpyDriverLogicalChannel::MemSpyDevice()
+    {
+    DMemSpyDriverDevice& device = *((DMemSpyDriverDevice*) iDevice);
+    return device;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverOSAdaption.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1525 @@
+/*
+* 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 "MemSpyDriverOSAdaption.h"
+
+// System includes
+#include <kern_priv.h>
+#include <nkern.h>
+#include <nk_plat.h>
+
+#ifdef __MARM__
+#include <arm.h>
+#endif
+
+// I've removed UNALIGNED_DATA_MEMBER in preference for just using memcpy to get round the potential unaligned access. -TomS
+
+// User includes
+#include "MemSpyDriverLog.h"
+#include "MemSpyDriverPAndS.h"
+#include "MemSpyDriverDevice.h"
+
+// Internal constants
+const TInt KMemSpyLocalThreadDataSizeEstimate = 0x80; // The amount of user stack that MemSpy attempts to scan for the RHeap vTable
+
+
+
+DMemSpyDriverOSAdaptionDObject::DMemSpyDriverOSAdaptionDObject( DMemSpyDriverOSAdaption& aOSAdaption )
+:   iOSAdaption( aOSAdaption )
+    {
+    }
+
+
+TUint8 DMemSpyDriverOSAdaptionDObject::GetContainerID( DObject& aObject ) const
+    {
+    return aObject.iContainerID;
+    }
+
+
+TObjectType DMemSpyDriverOSAdaptionDObject::GetObjectType( DObject& aObject ) const
+    {
+    const TUint8 containerId = GetContainerID( aObject );
+    const TObjectType ret = static_cast< TObjectType >( containerId - 1 );
+    return ret;
+    }
+
+
+DObject* DMemSpyDriverOSAdaptionDObject::GetOwner( DObject& aObject ) const
+    {
+    return aObject.iOwner;
+    }
+
+
+DObject* DMemSpyDriverOSAdaptionDObject::GetOwner( DObject& aObject, TUint8 aExpectedContainerId ) const
+    {
+    DObject* owner = GetOwner( aObject );
+    //
+    const TUint8 containerId = GetContainerID( aObject ) - 1;
+    if ( containerId != aExpectedContainerId )
+        {
+        owner = NULL;
+        }
+    //
+    return owner;
+    }
+
+TInt DMemSpyDriverOSAdaptionDObject::GetAccessCount( DObject& aObject ) const
+    {
+    return aObject.AccessCount();
+    }
+
+TInt DMemSpyDriverOSAdaptionDObject::GetUniqueID( DObject& aObject ) const
+    {
+    return aObject.UniqueID();
+    }
+
+TUint DMemSpyDriverOSAdaptionDObject::GetProtection( DObject& aObject ) const
+    {
+    return aObject.Protection();
+    }
+
+TUint8* DMemSpyDriverOSAdaptionDObject::GetAddressOfKernelOwner( DObject& aObject ) const
+    {
+    return (TUint8*)aObject.Owner();
+    }
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDThread::DMemSpyDriverOSAdaptionDThread( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    // Get current NThread and map it on to DThread
+    NThread* nThread = NKern::CurrentThread();
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - nThread: 0x%08x", nThread ) );
+    DThread* dThread = Kern::NThreadToDThread( nThread );
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - dThread: 0x%08x", dThread ) );
+
+    // At this point, it should be possible to work out the offset of the NThread within DThread.
+    iOffset_NThread = reinterpret_cast<TUint32>( nThread ) - reinterpret_cast<TUint32>( dThread );
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - difference: 0x%08x", iOffset_NThread ) );
+
+    // Work out the delta between compile time and run time
+    TInt delta = iOffset_NThread - _FOFF( DThread, iNThread );
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - compile time vs run time offset delta: %d", delta ));
+
+    // iNThread
+    TRACE( Kern::Printf( "OSA - [DThread::iNThread]              compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iNThread), iOffset_NThread ));
+
+    // iExitType
+    iOffset_ExitType = _FOFF( DThread, iExitType ) + delta;
+    TRACE( Kern::Printf( "OSA - [DThread::iExitType]             compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iExitType), iOffset_ExitType ));
+
+    // iSupervisorStack
+    iOffset_SupervisorStackBase = _FOFF( DThread, iSupervisorStack ) + delta;
+    TRACE( Kern::Printf( "OSA - [DThread::iSupervisorStack]      compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iSupervisorStack), iOffset_SupervisorStackBase ));
+
+    // iSupervisorStackSize
+    iOffset_SupervisorStackSize = _FOFF( DThread, iSupervisorStackSize ) + delta;
+    TRACE( Kern::Printf( "OSA - [DThread::iSupervisorStackSize]  compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iSupervisorStackSize), iOffset_SupervisorStackSize ));
+    }
+
+
+NThread* DMemSpyDriverOSAdaptionDThread::GetNThread( DThread& aObject ) const
+    {
+    DThread* dThread = &aObject;
+    TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_NThread;
+    NThread* pRet = reinterpret_cast< NThread* >( pTarget );
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetNThread() - aObject: 0x%08x, ret: 0x%08x", &aObject, pRet ) );
+    return pRet;
+    }
+
+
+TExitType DMemSpyDriverOSAdaptionDThread::GetExitType( DThread& aObject ) const
+    {
+    DThread* dThread = &aObject;
+    TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_ExitType;
+	TUint8 exitType = *reinterpret_cast<TUint8*>(pTarget);
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetExitType() - aObject: 0x%08x, ret: %d", &aObject, (TInt)exitType ) );
+    return (TExitType)exitType;
+    }
+
+
+TUint32 DMemSpyDriverOSAdaptionDThread::GetSupervisorStackBase( DThread& aObject ) const
+    {
+    DThread* dThread = &aObject;
+    TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_SupervisorStackBase;
+
+	TUint32 ret;
+	memcpy(&ret, (const TAny*)pTarget, sizeof(TUint32));
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetSupervisorStackBase() - aObject: 0x%08x, ret: 0x%08x", &aObject, ret ) );
+    return ret;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDThread::GetSupervisorStackSize( DThread& aObject ) const
+    {
+    DThread* dThread = &aObject;
+    TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_SupervisorStackSize;
+	
+	TInt ret;
+	memcpy(&ret, (const TAny*)pTarget, sizeof(TInt));
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetSupervisorStackSize() - aObject: 0x%08x, ret: %d", &aObject, ret ) );
+    return ret;
+    }
+
+
+RAllocator* DMemSpyDriverOSAdaptionDThread::GetAllocator( DThread& aObject ) const
+    {
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocator() - START" ) );
+    //
+    RAllocator* ret = aObject.iAllocator;
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocator() - allocator: 0x%08x", ret ) );
+    //
+    if  ( ret == NULL )
+        {
+        TUint32 stackAddress = 0;
+        ret = GetAllocatorAndStackAddress( aObject, stackAddress );
+        }
+    //
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocator() - END - ret: 0x%08x", ret ) );
+    return ret;
+    }
+
+
+// TODO try to rework this without inspecting the stack!
+CActiveScheduler* DMemSpyDriverOSAdaptionDThread::GetActiveScheduler( DThread& aObject ) const
+    {
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - START" ) );
+    CActiveScheduler* ret = aObject.iScheduler;
+    //
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - scheduler: 0x%08x", ret ) );
+    if  ( ret == NULL )
+        {
+        // We need the stack address of the heap in order to locate the active scheduler.
+        // Implicitly this means that MemSpy can only list active scheduler contents for threads
+        // that use a default RHeap. This has always been the case, so this is not a functional break.
+        //
+        // Assumed stack layout is something like this:
+        // 
+        // stack[0x00403ffc] 0x00000000, vTable: 0x00000000 (offset: 0004)
+        // stack[0x00403ff8] 0x00000000, vTable: 0x00000000 (offset: 0008)
+        // stack[0x00403ff4] 0x00000002, vTable: 0x00000000 (offset: 0012)
+        // stack[0x00403ff0] 0x00000002, vTable: 0x00000000 (offset: 0016)
+        // stack[0x00403fec] 0x00000000, vTable: 0x00000000 (offset: 0020)
+        // stack[0x00403fe8] 0x0000000c, vTable: 0x00000000 (offset: 0024)
+        // stack[0x00403fe4] 0x00600078, vTable: 0x80228938 (offset: 0028)
+        // stack[0x00403fe0] 0x00000001, vTable: 0x00000000 (offset: 0032)
+        // stack[0x00403fdc] 0x00600000, vTable: 0x80268430 (offset: 0036)		TLocalThreadData::iTlsHeap       RAllocator*		  80268428    0034    vtable for RHeap
+        // stack[0x00403fd8] 0x0060009c, vTable: 0x80268394 (offset: 0040)		TLocalThreadData::iTrapHandler   TTrapHandler		  8026838c    0014    vtable for TCleanupTrapHandler
+        // stack[0x00403fd4] 0x00600110, vTable: 0x802682ec (offset: 0044)		TLocalThreadData::iScheduler     CActiveScheduler*	  802682e4    002c    vtable for CActiveScheduler
+        // stack[0x00403fd0] 0x00600000, vTable: 0x80268430 (offset: 0048)      TLocalThreadData::iHeap          RAllocator*          80268428    0034    vtable for RHeap
+        // stack[0x00403fcc] 0x00000000, vTable: 0x00000000 (offset: 0052)
+        // stack[0x00403fc8] 0x00100000, vTable: 0x00000000 (offset: 0056)
+        //
+        // GetAllocatorAndStackAddress() will return the first RHeap* it finds, so this will be iTlsHeap, which
+        // is actually no bad thing as it will hopefully be initialised using an RHeap pointer.
+        // CActiveScheduler* is 8 bytes further on from that.
+        //
+        const TUint32 KOffsetToCActiveScheduler = 8;
+        // 
+        TUint32 stackAddress = 0;
+        RAllocator* allocator = GetAllocatorAndStackAddress( aObject, stackAddress );
+        TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - allocator: 0x%08x, stackAddress: 0x%08x", allocator, stackAddress ) );
+
+        // This assumes the layout of the thread local data structure, i.e. that the four bytes that follow the
+        // allocator pointer are always the active scheduler pointer.
+        if  ( allocator != NULL && stackAddress > 0 )
+            {
+            TUint32* ptr = reinterpret_cast< TUint32* >( stackAddress - KOffsetToCActiveScheduler );
+            const TInt r = Kern::ThreadRawRead( &aObject, ptr, &ret, sizeof( ret ) );
+            TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - stack address containing scheduler pointer: 0x%08x, read result: %d, CActiveScheduler*: 0x%08x", ptr, r, ret ) );
+            if  ( r != KErrNone )
+                {
+                ret = NULL;
+                }
+            }
+        }
+    //
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - END - ret: 0x%08x", ret ) );
+    return ret;
+    }
+
+
+TUint32 DMemSpyDriverOSAdaptionDThread::GetUserStackBase( DThread& aObject ) const
+    {
+    return aObject.iUserStackRunAddress;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDThread::GetUserStackSize( DThread& aObject ) const
+    {
+    return aObject.iUserStackSize;
+    }
+
+
+DProcess* DMemSpyDriverOSAdaptionDThread::GetOwningProcess( DThread& aObject ) const
+    {
+    return aObject.iOwningProcess;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDThread::GetId( DThread& aObject ) const
+    {
+    return aObject.iId;
+    }
+
+
+MemSpyObjectIx* DMemSpyDriverOSAdaptionDThread::GetHandles( DThread& aObject ) const
+    {
+    MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Thread( aObject );
+    return handles;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDThread::GetOwningProcessId( DThread& aObject ) const
+    {
+    DProcess* process = GetOwningProcess( aObject );
+    TUint ret = 0;
+    //
+    if  ( process )
+        {
+        ret = OSAdaption().DProcess().GetId( *process );
+        }
+    //
+    return ret;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDThread::GetPriority( DThread& aObject ) const
+    {
+    return aObject.iThreadPriority;
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDThread::GetAddressOfOwningProcess( DThread& aObject ) const
+    {
+    return (TUint8*)aObject.iOwningProcess;
+    }
+
+
+void DMemSpyDriverOSAdaptionDThread::GetNameOfOwningProcess( DThread& aObject, TDes& aName ) const
+    {
+    if  ( aObject.iOwningProcess )
+        {
+        aObject.iOwningProcess->FullName( aName );
+        }
+    }
+
+// TODO re-work this without inspecting the stack.
+// In particular we can get the allocator from the DThread object's iAllocator object
+RAllocator* DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress( DThread& aThread, TUint32& aStackAddress ) const
+    {
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - START for aThread 0x%08x with ID %d", &aThread, aThread.iId ) );
+    //
+    aStackAddress = 0;
+    RAllocator* ret = NULL;
+
+    // We will assume the thread is running and that the user-side stack has been set up
+    // accordingly.
+    const TUint32 base = GetUserStackBase( aThread );
+    const TInt size = GetUserStackSize( aThread );
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - base: 0x%08x, size: %d, KMemSpyLocalThreadDataSizeEstimate: %d", base, size, KMemSpyLocalThreadDataSizeEstimate ) );
+    const TUint32 top = base + size;
+
+    // This is the RHeap vtable we are looking for
+    const TUint32 rHeapVTable = OSAdaption().Device().RHeapVTable();
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - rHeapVTable: 0x%08x", rHeapVTable ) );
+    //
+    TInt r = KErrNone;
+
+#ifdef TRACE_TYPE_GENERAL 
+    for( TUint32 addr = top - 4; addr >= top - KMemSpyLocalThreadDataSizeEstimate; addr -= 4 )
+        {
+        TUint32 value = 0;
+        TUint32 possibleVTable = 0;
+        //
+        TUint32* ptr = reinterpret_cast< TUint32* >( addr );
+        //
+        r = Kern::ThreadRawRead( &aThread, ptr, &value, sizeof( value ) );
+        if  ( r == KErrNone )
+            {
+            r = Kern::ThreadRawRead( &aThread, reinterpret_cast< const TAny* >( value ), &possibleVTable, sizeof( possibleVTable ) );
+            }
+
+        if ( r == KErrNone )
+            {
+            TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - stack[0x%08x] 0x%08x, vTable: 0x%08x (offset: %04d)", addr, value, possibleVTable, top - addr ) );
+            }
+        else
+            {
+            TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - stack[0x%08x] 0x%08x, (offset: %04d) read failed: %d", addr, value, top - addr, r ) );
+            }
+        }
+#endif
+
+    for( TUint32 addr = top - 4; addr >= top - KMemSpyLocalThreadDataSizeEstimate; addr -= 4 )
+        {
+        TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - addr to read from: 0x%08x", addr ) );
+        TUint32 value = 0;
+        //
+        TUint32* ptr = reinterpret_cast< TUint32* >( addr );
+        //
+        r = Kern::ThreadRawRead( &aThread, ptr, &value, sizeof( value ) );
+        TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - read from: 0x%08x, result: %d, value: 0x%08x", addr, r, value ) );
+        //
+        if  ( r == KErrNone )
+            {
+            // Try and read from the address which is now stored within 'value'. We must do this because 
+            // the TLD class holds an RAllocator* and we need to ascertain the vTable of the RAllocator* matches the
+            // only supported vTable that MemSpy understands (RHeap*).
+            TUint32 possibleVTable = 0;
+            r = Kern::ThreadRawRead( &aThread, reinterpret_cast< const TAny* >( value ), &possibleVTable, sizeof( possibleVTable ) );
+            TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - possible vtable read from: 0x%08x, result: %d, possibleVTable: 0x%08x", value, r, possibleVTable ) );
+            if  ( r == KErrNone && possibleVTable == rHeapVTable )
+                {
+                aStackAddress = addr;
+                ret = reinterpret_cast< RAllocator* >( value );
+                break;
+                }
+            }
+        }
+    //
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - END - ret: 0x%08x, aStackAddress: 0x%08x", ret, aStackAddress ) );
+    return ret;
+    }    
+
+
+TBool DMemSpyDriverOSAdaptionDThread::IsHandleIndexValid( DThread& aObject ) const
+    {
+    MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Thread( aObject );
+    return ( handles != NULL );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDProcess::DMemSpyDriverOSAdaptionDProcess( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDProcess::GetId( DProcess& aObject ) const
+    {
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDProcess::GetId() - value: %d", aObject.iId ) );
+    return aObject.iId;
+    }
+
+
+MemSpyObjectIx* DMemSpyDriverOSAdaptionDProcess::GetHandles( DProcess& aObject ) const
+    {
+    MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Process( aObject );
+    return handles;
+    }
+
+
+TExitType DMemSpyDriverOSAdaptionDProcess::GetExitType( DProcess& aObject ) const
+    {
+    return static_cast< TExitType >( aObject.iExitType );
+    }
+
+
+DThread* DMemSpyDriverOSAdaptionDProcess::OpenFirstThread( DProcess& aProcess ) const
+    {
+	// It appears that the system lock needs to be held while manipulating the iThreadQ
+	DThread* result = NULL;
+	NKern::LockSystem();
+	// We don't use DProcess::FirstThread() as that doesn't appear to do any checking of whether the list is empty, ie if there are no threads at all
+	SDblQueLink* threadLink = aProcess.iThreadQ.First();
+	if (threadLink != NULL && threadLink != &aProcess.iThreadQ.iA)
+		{
+		result = _LOFF(threadLink,DThread,iProcessLink);
+		if (result->Open() != KErrNone)
+			{
+			result = NULL;
+			}
+		}
+	NKern::UnlockSystem();
+    return result;
+    }
+
+
+TUint32 DMemSpyDriverOSAdaptionDProcess::GetSID( DProcess& aObject ) const
+    {
+    return GetSecurityInfo( aObject ).iSecureId;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDProcess::GetSecurityZone( DProcess& aObject ) const
+    {
+    return aObject.iSecurityZone;
+    }
+
+
+SSecurityInfo& DMemSpyDriverOSAdaptionDProcess::GetSecurityInfo( DProcess& aObject ) const
+    {
+    return aObject.iS;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDProcess::GetFlags( DProcess& aObject ) const
+    {
+    return aObject.iFlags;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDProcess::GetGeneration( DProcess& aObject ) const
+    {
+    return aObject.iGeneration;
+    }
+
+
+SDblQue& DMemSpyDriverOSAdaptionDProcess::GetThreadQueue( DProcess& aObject ) const
+    {
+    return aObject.iThreadQ;
+    }
+
+
+DThread* DMemSpyDriverOSAdaptionDProcess::GetThread( SDblQueLink* aLink ) const
+    {
+	DThread* ret = _LOFF( aLink, DThread, iProcessLink );
+    return ret;
+    }
+
+
+void DMemSpyDriverOSAdaptionDProcess::SetSID( DProcess& aObject, TUint32 aSID ) const
+    {
+    GetSecurityInfo( aObject ).iSecureId = aSID;
+    }
+
+
+void DMemSpyDriverOSAdaptionDProcess::SetSecurityZone( DProcess& aObject, TUint aSecurityZone ) const
+    {
+    aObject.iSecurityZone = aSecurityZone;
+    }
+
+
+TBool DMemSpyDriverOSAdaptionDProcess::IsHandleIndexValid( DProcess& aObject ) const
+    {
+    MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Process( aObject );
+    return ( handles != NULL );
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDProcess::GetCreatorId( DProcess& aObject ) const
+    {
+    return aObject.iCreatorId;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDProcess::GetAttributes( DProcess& aObject ) const
+    {
+    return aObject.iAttributes;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDProcess::GetPriority( DProcess& aObject ) const
+    {
+    return aObject.iPriority;
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDProcess::GetAddressOfOwningProcess( DProcess& aObject ) const
+    {
+    return (TUint8*)aObject.iOwningProcess;
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDProcess::GetAddressOfDataBssStackChunk( DProcess& aObject ) const
+    {
+    return (TUint8*)aObject.iDataBssStackChunk;
+    }
+
+TBool DMemSpyDriverOSAdaptionDProcess::IsKernProcess(DProcess& aProcess) const
+	{
+	// The kernel process always has pid 1
+	return GetId(aProcess) == 1;
+	}
+
+
+
+DMemSpyDriverOSAdaptionDChunk::DMemSpyDriverOSAdaptionDChunk( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDChunk::GetSize( DChunk& aObject ) const
+    {
+    return aObject.Size();
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDChunk::GetMaxSize( DChunk& aObject ) const
+    {
+    return aObject.MaxSize();
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDChunk::GetBase( DChunk& aChunk ) const
+    {
+    TUint8* base = aChunk.Base();
+	if (base == 0)
+		{
+		// Under flexible memory model, DChunk::Base() will return NULL (for non-fixed chunks anyway, and that means most of them)
+		// A more useful thing to return is the base address in the owning process
+		DProcess* proc = GetOwningProcess(aChunk);
+		NKern::ThreadEnterCS();
+		if (proc && proc->Open() == KErrNone)
+			{
+			// Probably shouldn't call ChunkUserBase for a non-user-owned chunk
+			if (!OSAdaption().DProcess().IsKernProcess(*proc))
+				{
+				DThread* firstThread = OSAdaption().DProcess().OpenFirstThread(*proc);
+				if (firstThread)
+					{
+					base = Kern::ChunkUserBase(&aChunk, firstThread);
+					firstThread->Close(NULL);
+					}
+				}
+			proc->Close(NULL);
+			}
+		NKern::ThreadLeaveCS();
+		}
+	return base; 
+    }
+
+
+DProcess* DMemSpyDriverOSAdaptionDChunk::GetOwningProcess( DChunk& aObject ) const
+    {
+    return aObject.OwningProcess();
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDChunk::GetOwningProcessId( DChunk& aObject ) const
+    {
+    TUint ret = 0;
+    //
+    DProcess* process = GetOwningProcess( aObject );
+    if  ( process )
+        {
+        ret = OSAdaption().DProcess().GetId( *process );
+        }
+    //
+    return ret;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDChunk::GetControllingOwnerId( DChunk& aObject ) const
+    {
+    return aObject.iControllingOwner;
+    }
+
+
+TChunkType DMemSpyDriverOSAdaptionDChunk::GetType( DChunk& aObject ) const
+    {
+    return aObject.iChunkType;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDChunk::GetAttributes( DChunk& aObject ) const
+    {
+    return aObject.iAttributes;
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDChunk::GetAddressOfOwningProcess( DChunk& aObject ) const
+    {
+    return (TUint8*)aObject.iOwningProcess;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDChunk::GetBottom( DChunk& aObject ) const
+    {
+    return aObject.Bottom();
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDChunk::GetTop( DChunk& aObject ) const
+    {
+    return aObject.Top();
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDChunk::GetStartPos( DChunk& aObject ) const
+    {
+    return aObject.iStartPos;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDChunk::GetRestrictions( DChunk& aObject ) const
+    {
+    return aObject.iRestrictions;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDChunk::GetMapAttr( DChunk& aObject ) const
+    {
+    return aObject.iMapAttr;
+    }
+
+
+void DMemSpyDriverOSAdaptionDChunk::GetNameOfOwningProcess( DChunk& aObject, TDes& aName ) const
+    {
+    if ( aObject.OwningProcess() )
+        {
+         aObject.OwningProcess()->FullName( aName );
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDServer::DMemSpyDriverOSAdaptionDServer( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+SDblQue& DMemSpyDriverOSAdaptionDServer::GetSessionQueue( DServer& aObject ) const
+    {
+    return aObject.iSessionQ;
+    }
+
+
+DSession* DMemSpyDriverOSAdaptionDServer::GetSession( SDblQueLink* aLink ) const
+    {
+	DSession* session = _LOFF( aLink, DSession, iServerLink );
+    return session;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDServer::GetSessionCount( DServer& aObject ) const
+    {
+    TInt ret = 0;
+    //
+    SDblQueLink* anchor = &aObject.iSessionQ.iA;
+    SDblQueLink* link = aObject.iSessionQ.First();
+    //
+    while( link != anchor)
+	    {
+ 	    ++ret;
+	    link = link->iNext;
+	    }
+    //
+    return ret;
+    }
+
+
+DThread* DMemSpyDriverOSAdaptionDServer::GetOwningThread( DServer& aObject ) const
+    {
+    return aObject.iOwningThread;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDServer::GetOwningThreadId( DServer& aObject ) const
+    {
+    TUint ret = 0;
+    //
+    DThread* thread = GetOwningThread( aObject );
+    if  ( thread )
+        {
+        ret = OSAdaption().DThread().GetId( *thread );
+        }
+    //
+    return ret;
+    }
+
+
+TIpcSessionType DMemSpyDriverOSAdaptionDServer::GetSessionType( DServer& aObject ) const
+    {
+    return static_cast< TIpcSessionType >( aObject.iSessionType );
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDServer::GetAddressOfOwningThread( DServer& aObject ) const
+    {
+    return (TUint8*)aObject.iOwningThread;
+    }
+
+
+void DMemSpyDriverOSAdaptionDServer::GetNameOfOwningThread( DServer& aObject, TDes& aName ) const
+    {
+    if ( aObject.iOwningThread )
+        {
+         aObject.iOwningThread->FullName( aName );
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDSession::DMemSpyDriverOSAdaptionDSession( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TIpcSessionType DMemSpyDriverOSAdaptionDSession::GetSessionType( DSession& aObject ) const
+    {
+    return static_cast< TIpcSessionType >( aObject.iSessionType );
+    }
+
+
+DServer* DMemSpyDriverOSAdaptionDSession::GetServer( DSession& aObject ) const
+    {
+    return aObject.iServer;
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDSession::GetAddressOfServer( DSession& aObject ) const
+    {
+    return (TUint8*)aObject.iServer;
+    }
+
+
+TUint16 DMemSpyDriverOSAdaptionDSession::GetTotalAccessCount( DSession& aObject ) const
+    {
+    return aObject.iTotalAccessCount;
+    }
+
+
+TUint8 DMemSpyDriverOSAdaptionDSession::GetSrvSessionType( DSession& aObject ) const
+    {
+    return aObject.iSvrSessionType;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDSession::GetMsgCount( DSession& aObject ) const
+    {
+    return aObject.iMsgCount;
+    }
+    
+
+TInt DMemSpyDriverOSAdaptionDSession::GetMsgLimit( DSession& aObject ) const
+    {
+    return aObject.iMsgLimit;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDCodeSeg::DMemSpyDriverOSAdaptionDCodeSeg( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+DCodeSeg* DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSeg( SDblQueLink* aLink ) const
+    {
+    DCodeSeg* ret = _LOFF( aLink, DCodeSeg, iTempLink );
+    return ret;
+    }
+
+
+DCodeSeg* DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSeg( DLibrary& aLibrary ) const
+    {
+    return aLibrary.iCodeSeg;
+    }
+
+
+DCodeSeg* DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSegFromHandle( TAny* aHandle ) const
+    {
+    DCodeSeg* ret = DCodeSeg::VerifyHandle( aHandle );
+    return ret;
+    }
+
+
+TBool DMemSpyDriverOSAdaptionDCodeSeg::GetIsXIP( DCodeSeg& aCodeSeg ) const
+    {
+    TBool ret = ETrue;
+    //
+#ifdef __WINS__
+    (void) aCodeSeg;
+#else
+    DEpocCodeSeg& epocCodeSegment = static_cast< DEpocCodeSeg& >( aCodeSeg );
+    ret = ( epocCodeSegment.iXIP != 0 );
+#endif
+    //
+    return ret;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSegQueue( DProcess& aObject, SDblQue& aQueue ) const
+    {
+	const TInt count = aObject.TraverseCodeSegs( &aQueue, NULL, DCodeSeg::EMarkDebug, DProcess::ETraverseFlagAdd );
+    return count;
+    }
+
+
+void DMemSpyDriverOSAdaptionDCodeSeg::EmptyCodeSegQueue( SDblQue& aQueue ) const
+    {
+	DCodeSeg::EmptyQueue( aQueue, DCodeSeg::EMarkDebug );
+    }
+
+
+TUint32 DMemSpyDriverOSAdaptionDCodeSeg::GetSize( DCodeSeg& aCodeSeg ) const
+    {
+    return aCodeSeg.iSize;
+    }
+
+
+void DMemSpyDriverOSAdaptionDCodeSeg::GetCreateInfo( DCodeSeg& aCodeSeg, TCodeSegCreateInfo& aInfo ) const
+    {
+    aCodeSeg.Info( aInfo );
+    }
+
+
+TUint8 DMemSpyDriverOSAdaptionDCodeSeg::GetState( DLibrary& aLibrary ) const
+    {
+    return aLibrary.iState;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDCodeSeg::GetMapCount( DLibrary& aLibrary ) const
+    {
+    return aLibrary.iMapCount;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDSemaphore::DMemSpyDriverOSAdaptionDSemaphore( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDSemaphore::GetCount( DSemaphore& aObject ) const
+    {
+    return aObject.iCount;
+    }
+
+
+TUint8 DMemSpyDriverOSAdaptionDSemaphore::GetResetting( DSemaphore& aObject ) const
+    {
+    return aObject.iResetting;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDMutex::DMemSpyDriverOSAdaptionDMutex( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDMutex::GetHoldCount( DMutex& aObject ) const
+    {
+    return aObject.iHoldCount;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDMutex::GetWaitCount( DMutex& aObject ) const
+    {
+    return aObject.iWaitCount;
+    }
+
+
+TUint8 DMemSpyDriverOSAdaptionDMutex::GetResetting( DMutex& aObject ) const
+    {
+    return aObject.iResetting;
+    }
+
+
+TUint8 DMemSpyDriverOSAdaptionDMutex::GetOrder( DMutex& aObject ) const
+    {
+    return aObject.iOrder;
+    }
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDLogicalDevice::DMemSpyDriverOSAdaptionDLogicalDevice( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDLogicalDevice::GetOpenChannels( DLogicalDevice& aObject ) const
+    {
+    return aObject.iOpenChannels;
+    }
+
+
+TVersion DMemSpyDriverOSAdaptionDLogicalDevice::GetVersion( DLogicalDevice& aObject ) const
+    {
+    return aObject.iVersion;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDLogicalDevice::GetParseMask( DLogicalDevice& aObject ) const
+    {
+    return aObject.iParseMask;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDLogicalDevice::GetUnitsMask( DLogicalDevice& aObject ) const
+    {
+    return aObject.iUnitsMask;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDPhysicalDevice::DMemSpyDriverOSAdaptionDPhysicalDevice( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TVersion DMemSpyDriverOSAdaptionDPhysicalDevice::GetVersion( DPhysicalDevice& aObject ) const
+    {
+    return aObject.iVersion;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDPhysicalDevice::GetUnitsMask( DPhysicalDevice& aObject ) const
+    {
+    return aObject.iUnitsMask;
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDPhysicalDevice::GetAddressOfCodeSeg( DPhysicalDevice& aObject ) const
+    {
+    return (TUint8*)aObject.iCodeSeg;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDChangeNotifier::DMemSpyDriverOSAdaptionDChangeNotifier( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDChangeNotifier::GetChanges( DChangeNotifier& aObject ) const
+    {
+    return aObject.iChanges;
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDChangeNotifier::GetAddressOfOwningThread( DChangeNotifier& aObject ) const
+    {
+    return (TUint8*)aObject.iThread;
+    }
+
+
+void DMemSpyDriverOSAdaptionDChangeNotifier::GetNameOfOwningThread( DChangeNotifier& aObject, TDes& aName ) const
+    {
+    if ( aObject.iThread )
+        {
+         aObject.iThread->FullName( aName );
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDUndertaker::DMemSpyDriverOSAdaptionDUndertaker( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDUndertaker::GetAddressOfOwningThread( DUndertaker& aObject ) const
+    {
+    return (TUint8*)aObject.iOwningThread;
+    }
+
+
+void DMemSpyDriverOSAdaptionDUndertaker::GetNameOfOwningThread( DUndertaker& aObject, TDes& aName ) const
+    {
+    if ( aObject.iOwningThread )
+        {
+         aObject.iOwningThread->FullName( aName );
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDCondVar::DMemSpyDriverOSAdaptionDCondVar( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TUint8 DMemSpyDriverOSAdaptionDCondVar::GetResetting( DCondVar& aObject ) const
+    {
+    return aObject.iResetting;
+    }
+
+
+TUint8* DMemSpyDriverOSAdaptionDCondVar::GetAddressOfMutex( DCondVar& aObject ) const
+    {
+    return (TUint8*)aObject.iMutex;
+    }
+
+
+void DMemSpyDriverOSAdaptionDCondVar::GetNameOfMutex( DCondVar& aObject, TDes& aName ) const
+    {
+    if ( aObject.iMutex )
+        {
+         aObject.iMutex->FullName( aName );
+        }
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDCondVar::GetWaitCount( DCondVar& aObject ) const
+    {
+    return aObject.iWaitCount;
+    }
+
+
+SDblQue& DMemSpyDriverOSAdaptionDCondVar::GetSuspendedQ( DCondVar& aObject ) const
+    {
+    return aObject.iSuspendedQ;
+    }
+
+
+DThread* DMemSpyDriverOSAdaptionDCondVar::GetThread( SDblQueLink* aLink ) const
+    {
+    DThread* thread = _LOFF( aLink, DThread, iWaitLink );
+    return thread;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDTimer::DMemSpyDriverOSAdaptionDTimer( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TTimer::TTimerType DMemSpyDriverOSAdaptionDTimer::GetType( DTimer& aObject ) const
+    {
+    const TTimer::TTimerType ret = aObject.iTimer.Type();
+    return ret;
+    }
+
+
+TTimer::TTimerState DMemSpyDriverOSAdaptionDTimer::GetState( DTimer& aObject ) const
+    {
+    const TTimer::TTimerState ret = static_cast<TTimer::TTimerState>( aObject.iTimer.iState );
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaptionDPropertyRef::DMemSpyDriverOSAdaptionDPropertyRef( DMemSpyDriverOSAdaption& aOSAdaption )
+:   DMemSpyDriverOSAdaptionDObject( aOSAdaption )
+    {
+    }
+
+
+TBool DMemSpyDriverOSAdaptionDPropertyRef::GetIsReady( DObject& aObject ) const
+    {
+    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
+    return ( prop != NULL );
+    }
+
+
+RProperty::TType DMemSpyDriverOSAdaptionDPropertyRef::GetType( DObject& aObject ) const
+    {
+    RProperty::TType ret = RProperty::EInt;
+    //
+    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
+    if  ( prop )
+        {
+        ret = (RProperty::TType) prop->iProp->iType;
+        }
+    //
+    return ret;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDPropertyRef::GetCategory( DObject& aObject ) const
+    {
+    TUint ret = 0;
+    //
+    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
+    if  ( prop )
+        {
+        ret = prop->iProp->iCategory;
+        }
+    //
+    return ret;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDPropertyRef::GetKey( DObject& aObject ) const
+    {
+    TUint ret = 0;
+    //
+    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
+    if  ( prop )
+        {
+        ret = prop->iProp->iKey;
+        }
+    //
+    return ret;
+    }
+
+
+TInt DMemSpyDriverOSAdaptionDPropertyRef::GetRefCount( DObject& aObject ) const
+    {
+    TInt ret = 0;
+    //
+    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
+    if  ( prop )
+        {
+        ret = prop->iProp->iRefCount;
+        }
+    //
+    return ret;
+    }
+
+
+TUint DMemSpyDriverOSAdaptionDPropertyRef::GetThreadId( DObject& aObject ) const
+    {
+    TUint ret = 0;
+    //
+    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
+    if  ( prop )
+        {
+        DThread* thread = prop->iClient;
+        if  ( thread )
+            {
+            ret = OSAdaption().DThread().GetId( *thread );
+            }
+        }
+    //
+    return ret;
+    }
+
+
+TUint32 DMemSpyDriverOSAdaptionDPropertyRef::GetCreatorSID( DObject& aObject ) const
+    {
+    TUint32 ret = 0;
+    //
+    DMemSpyPropertyRef* prop = GetPropertyRef( aObject );
+    if  ( prop )
+        {
+        ret = prop->iProp->iOwner;
+        }
+    //
+    return ret;
+    }
+
+
+DMemSpyPropertyRef* DMemSpyDriverOSAdaptionDPropertyRef::GetPropertyRef( DObject& aObject ) const
+    {
+    DMemSpyPropertyRef* ret = NULL;
+    //
+    const TUint8 containerId = GetContainerID( aObject ) - 1;
+    if ( containerId == EPropertyRef )
+        {
+        DMemSpyPropertyRef* prop = reinterpret_cast< DMemSpyPropertyRef* >( &aObject );
+        if ( prop->iProp && prop->iClient )
+            {
+            ret = prop;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverOSAdaption::DMemSpyDriverOSAdaption( DMemSpyDriverDevice& aDevice )
+:   iDevice( aDevice )
+    {
+    }
+
+
+DMemSpyDriverOSAdaption::~DMemSpyDriverOSAdaption()
+    {
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::~DMemSpyDriverOSAdaption() - START"));
+    NKern::ThreadEnterCS();
+    //
+    delete iDThread;
+    delete iDProcess;
+    delete iDChunk;
+    delete iDServer;
+    delete iDSession;
+    delete iDCodeSeg;
+    delete iDSemaphore;
+    delete iDMutex;
+    delete iDLogicalDevice;
+    delete iDPhysicalDevice;
+    delete iDChangeNotifier;
+    delete iDUndertaker;
+    delete iDCondVar;
+    delete iDTimer;
+    delete iDPropertyRef;
+    //
+    NKern::ThreadLeaveCS();
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::~DMemSpyDriverOSAdaption() - END"));
+    }
+
+
+TInt DMemSpyDriverOSAdaption::Construct()
+    {
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::Construct() - START" ) );
+    //
+    NKern::ThreadEnterCS();
+    //
+    TInt error = KErrNoMemory;
+    //
+    iDThread = new DMemSpyDriverOSAdaptionDThread( *this );
+    if  ( iDThread )
+        {
+        iDProcess = new DMemSpyDriverOSAdaptionDProcess( *this );
+        if  ( iDProcess )
+            {
+            iDChunk = new DMemSpyDriverOSAdaptionDChunk( *this );
+            if  ( iDChunk )
+                {
+                iDServer = new DMemSpyDriverOSAdaptionDServer( *this );
+                if  ( iDServer )
+                    {
+                    iDSession = new DMemSpyDriverOSAdaptionDSession( *this );
+                    if  ( iDSession )
+                        {
+                        iDCodeSeg = new DMemSpyDriverOSAdaptionDCodeSeg( *this );
+                        if  ( iDCodeSeg )
+                            {
+                            iDSemaphore = new DMemSpyDriverOSAdaptionDSemaphore( *this );
+                            if  ( iDSemaphore )
+                                {
+                                iDMutex = new DMemSpyDriverOSAdaptionDMutex( *this );
+                                if  ( iDMutex )
+                                    {
+                                    iDLogicalDevice = new DMemSpyDriverOSAdaptionDLogicalDevice( *this );
+                                    if  ( iDLogicalDevice )
+                                        {
+                                        iDPhysicalDevice = new DMemSpyDriverOSAdaptionDPhysicalDevice( *this );
+                                        if  ( iDPhysicalDevice )
+                                            {
+                                            iDChangeNotifier = new DMemSpyDriverOSAdaptionDChangeNotifier( *this );
+                                            if  ( iDChangeNotifier )
+                                                {
+                                                iDUndertaker = new DMemSpyDriverOSAdaptionDUndertaker( *this );
+                                                if ( iDUndertaker )
+                                                    {
+                                                    iDCondVar = new DMemSpyDriverOSAdaptionDCondVar( *this );
+                                                    if ( iDCondVar )
+                                                        {
+                                                        iDTimer = new DMemSpyDriverOSAdaptionDTimer( *this );
+                                                        if  ( iDTimer )
+                                                            {
+                                                            iDPropertyRef = new DMemSpyDriverOSAdaptionDPropertyRef( *this );
+                                                            if  ( iDPropertyRef )
+                                                                {
+                                                                error = KErrNone;
+                                                                }
+                                                            }
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    //
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::Construct() - END - error: %d", error ) );
+    return error;
+    }
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverObjectIx.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,228 @@
+/*
+* 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 "MemSpyDriverObjectIx.h"
+
+// System includes
+#include <kern_priv.h>
+//#include <dobject.h>
+
+//const TInt KObjectIxGranularity=8;
+const TInt KObjectIndexMask=0x7fff;
+//const TInt KObjectMaxIndex=0x7fff;
+const TInt KObjectInstanceShift=16;
+const TInt KObjectInstanceMask=0x3fff;
+//const TInt KObjectIxMaxHandles=0x8000;
+
+inline TInt index(TInt aHandle)
+	{return(aHandle&KObjectIndexMask);}
+inline TInt instance(TInt aHandle)
+	{return((aHandle>>KObjectInstanceShift)&KObjectInstanceMask);}
+inline TInt instanceLimit(TInt& aCount)
+	{return ((aCount&KObjectInstanceMask)==0) ? ((++aCount)&KObjectInstanceMask) : aCount&KObjectInstanceMask;}
+inline TInt makeHandle(TInt aIndex, TInt aInstance)
+	{return((TInt)((aInstance<<KObjectInstanceShift)|aIndex));}
+
+enum TDObjectPanic
+	{
+	EObjObjectStillReferenced,
+	EObjNegativeAccessCount,
+	EObjRemoveObjectNotFound,
+	EObjRemoveContainerNotFound,
+	EObjRemoveBadHandle,
+	EObjFindBadHandle,
+	EObjFindIndexOutOfRange,
+	EDObjectConDestroyed,
+	EArrayIndexOutOfRange,
+	EObjInconsistent,
+	};
+
+inline void Panic(TDObjectPanic aPanic)
+	{ Kern::Fault("DOBJECT",aPanic); }
+	
+
+TBool MemSpyObjectIx::Find(DObject* aObj)
+	{
+	//Check preconditions(debug build only)
+	__ASSERT_CRITICAL;
+	__ASSERT_NO_FAST_MUTEX;
+
+	// I don't like the implementation of At() that was here before, it wasn't safe at all without HandleMutex. So I'm replacing it with a simpler
+	// version based on operator[] that only does what we need and does it safely.
+
+	TBool found = EFalse;
+	MemSpyObjectIx_HandleLookupLock();
+	const TInt count = Count();
+	for (TInt i = 0; i < count; i++)
+		{
+		if ((*this)[i] == aObj)
+			{
+			found = ETrue;
+			break;
+			}
+		}
+	MemSpyObjectIx_HandleLookupUnlock();
+	return found;
+	}
+
+#if MCL_ROBJECTIX_DUPLICATION
+
+#define asserta(x)	do { if (!(x)) { __crash(); } } while(0)
+
+RMemSpyObjectIx::RMemSpyObjectIx()
+  : iRWL(TSpinLock::EOrderGenericIrqLow3)
+    {
+    }
+
+
+/*
+void RMemSpyObjectIx::Wait()
+	{
+	Kern::MutexWait(*HandleMutex);
+	} // RObjectIx::Wait
+
+
+void RMemSpyObjectIx::Signal()
+	{
+	Kern::MutexSignal(*HandleMutex);
+	} // RObjectIx::Signal
+*/
+
+DObject* RMemSpyObjectIx::operator[](TInt aIndex)
+	{
+	DObject* obj = 0;
+	AcquireReadLock();
+	asserta(TUint(aIndex)<TUint(iCount));
+	SSlot* slot = iSlots + aIndex;
+	obj = Occupant(slot);
+	ReleaseReadLock();
+	return obj;
+	} // RObjectIx::operator[]
+
+
+#elif MCL_DOBJECTIX_DUPLICATION
+
+/*
+void DMemSpyObjectIx::Wait( DMemSpyObjectIx* aObjectIndex )
+	{
+//	Kern::MutexWait(*aObjectIndex->HandleMutex);
+	}
+
+void DMemSpyObjectIx::Signal( DMemSpyObjectIx* aObjectIndex )
+	{
+//	Kern::MutexSignal(*aObjectIndex->HandleMutex);
+	}
+*/
+
+/** Counts the number of times an object appears in this index.
+
+	@param	aObject	Object whose occurrences are to be counted.
+
+	@return	Number of times aObject appears in the index.
+
+    @pre    Calling thread must be in a critical section.
+    @pre    No fast mutex can be held.
+	@pre	Call in a thread context.
+	@pre	DObject::HandleMutex held
+ */
+TInt DMemSpyObjectIx::Count(DObject* aObject)
+	{
+	//Check preconditions(debug build only)
+	__ASSERT_CRITICAL;
+	__ASSERT_NO_FAST_MUTEX;
+
+	TInt c=0;
+	if (iCount)
+		{
+		SDObjectIxRec* pS=iObjects;
+		SDObjectIxRec* pE=pS+iCount;
+		do
+			{
+			if (pS->obj==aObject)
+				c++;
+			} while (++pS<pE);
+		}
+	return c;
+	}
+
+
+/**	Looks up an object in the index by handle.
+	
+	The object must be of a specified type (specified by container ID)
+
+	@param	aHandle		Handle to look up.
+	@param	aUniqueID	Unique ID (container ID) that object should have.
+	
+	@return	Pointer to object or NULL if handle invalid.
+
+	@pre	Call in a thread context.
+	@pre    System lock must be held.
+ */
+DObject* DMemSpyObjectIx::At(TInt aHandle, TInt aUniqueID)
+	{
+	__ASSERT_SYSTEM_LOCK; //Check preconditions (debug build only)
+	TInt i=index(aHandle);
+	if (i>=iCount)
+		return(NULL);
+	SDObjectIxRec *pS=iObjects+i;
+	if (pS->str.instance!=instance(aHandle) || pS->str.uniqueID!=aUniqueID)
+		return(NULL);
+	return(pS->obj);
+	}
+
+
+/**	Looks up an object in the index by handle.
+
+	The object may be of any type.
+
+	@param	aHandle		Handle to look up.
+	
+	@return	Pointer to object or NULL if handle invalid.
+
+	@pre	Call in a thread context.
+	@pre    System lock must be held.
+ */
+DObject* DMemSpyObjectIx::At(TInt aHandle)
+	{
+	__ASSERT_SYSTEM_LOCK; //Check preconditions (debug build only)
+	TInt i=index(aHandle);
+	if (i>=iCount)
+		return NULL;
+	SDObjectIxRec *pS=iObjects+i;
+	if (pS->str.instance!=instance(aHandle))
+		return NULL;
+	return pS->obj;
+	}
+
+/** Finds the object at a specific position in the index array.
+
+	@param	aIndex	Index into array.
+	
+	@return	Pointer to the object at that position (could be NULL).
+
+	@pre	Call in a thread context. 
+    @pre    System lock must be held.
+ */
+DObject* DMemSpyObjectIx::operator[](TInt aIndex)
+	{
+	__ASSERT_SYSTEM_LOCK; //Check preconditions (debug build only)
+	__ASSERT_ALWAYS(aIndex>=0 && aIndex<iCount,Panic(EArrayIndexOutOfRange));
+	return iObjects[aIndex].obj;
+	}
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverStreamWriter.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,180 @@
+/*
+* 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 "MemSpyDriverStreamWriter.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverXferBuffer.h"
+
+
+
+RMemSpyMemStreamWriter::RMemSpyMemStreamWriter()
+:   iBuffer( NULL ), iCurrent( NULL ), iMax( 0 ), iMark( NULL ), iCommitted( 0 )
+    {
+    }
+
+
+RMemSpyMemStreamWriter::RMemSpyMemStreamWriter( DMemSpyDriverXferBuffer& aBuffer )
+:   iBuffer( &aBuffer ), iMark( NULL ), iCommitted( 0 )
+    {
+    iCurrent = iBuffer->Ptr();
+    iMax = iCurrent + iBuffer->Size();
+    TRACE( Kern::Printf("RMemSpyMemStreamWriter::RMemSpyMemStreamWriter() - current: 0x%08x, max: 0x%08x, size: %d", iCurrent, iMax, iBuffer->Size() ) );
+    }
+
+
+void RMemSpyMemStreamWriter::Close()
+    {
+    iBuffer = NULL;
+    iMark = NULL;
+    }
+
+
+TInt RMemSpyMemStreamWriter::WriteAndClose( TDes8* aDestinationPointer )
+    {
+    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
+    //
+    const TInt ret = iBuffer->WriteToClient( aDestinationPointer, iCommitted );
+    Close();
+    //
+    return ret;
+    }
+
+
+TInt32* RMemSpyMemStreamWriter::WriteInt32( TInt32 aValue )
+    {
+    TInt32* ret = NULL;
+    //
+    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
+    if  ( !IsFull() )
+        {
+        ret = (TInt32*) iCurrent;
+        *ret = aValue;
+        IncrementPos( sizeof( TInt32 ) );
+        }
+    else
+        {
+        //TRACE( Kern::Printf( "RMemSpyMemStreamWriter::WriteInt32() - asked to write: 0x%08x from fn: 0x%08x BUT AM FULL", aValue, __return_address() ) );
+        }
+    //
+    return ret;
+    }
+
+
+TUint32* RMemSpyMemStreamWriter::WriteUint32( TUint32 aValue )
+    {
+    TUint32* ret = NULL;
+    //
+    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
+    if  ( !IsFull() )
+        {
+        ret = (TUint32*) iCurrent;
+        *ret = aValue;
+        IncrementPos( sizeof( TUint32 ) );
+        }
+    else
+        {
+        //TRACE( Kern::Printf( "RMemSpyMemStreamWriter::WriteUint32() - asked to write: 0x%08x from fn: 0x%08x BUT AM FULL", aValue, __return_address() ) );
+        }
+    //
+    return ret;
+    }
+
+
+TUint8* RMemSpyMemStreamWriter::Current() const
+    {
+    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
+    return iCurrent;
+    }
+
+
+void RMemSpyMemStreamWriter::Seek( TInt aPosition )
+    {
+    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
+    TUint8* pos = iBuffer->Ptr() + aPosition;
+    __ASSERT_ALWAYS( pos < iMax, MemSpyDriverUtils::Fault( __LINE__ ) );
+    iCurrent = pos;
+    }
+
+
+TUint32 RMemSpyMemStreamWriter::Remaining() const
+    {
+    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
+    const TUint32 max = reinterpret_cast< TUint32 >( iMax );
+    const TUint32 cur = reinterpret_cast< TUint32 >( iCurrent );
+    TRACE( Kern::Printf("RMemSpyMemStreamWriter::Remaining() - current: 0x%08x, max: 0x%08x, ret: %d", cur, max, ( max - cur ) ) );
+    return ( max - cur );
+    }
+
+
+void RMemSpyMemStreamWriter::MarkSet()
+    {
+    __ASSERT_ALWAYS( iMark == NULL, MemSpyDriverUtils::Fault( __LINE__ ) );
+    iMark = iCurrent;
+    }
+
+
+void RMemSpyMemStreamWriter::MarkResume()
+    {
+    __ASSERT_ALWAYS( iMark != NULL, MemSpyDriverUtils::Fault( __LINE__ ) );
+    iCurrent = iMark;
+    iMark = NULL;
+    }
+
+
+TBool RMemSpyMemStreamWriter::IsFull() const
+    {
+    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
+    const TBool ret = ( iCurrent >= iMax );
+    return ret;
+    }
+
+
+TBool RMemSpyMemStreamWriter::IsOpen() const
+    {
+    const TBool ret = ( iBuffer && iCurrent && iMax );
+    return ret;
+    }
+
+
+RMemSpyMemStreamWriter& RMemSpyMemStreamWriter::operator=( const RMemSpyMemStreamWriter& aCopy )
+    {
+    iBuffer = aCopy.iBuffer;
+    iMark = aCopy.iMark;
+    iCommitted = aCopy.iCommitted;
+    iCurrent = aCopy.iCurrent;
+    iMax = aCopy.iMax;
+    //
+    return *this;
+    }
+
+
+void RMemSpyMemStreamWriter::IncrementPos( TInt aAmount )
+    {
+    __ASSERT_ALWAYS( IsOpen(), MemSpyDriverUtils::Fault( __LINE__ ) );
+    if  ( iCurrent + aAmount > iMax )
+        {
+        Kern::Printf("RMemSpyMemStreamWriter::IncrementPos() - OVERFLOW - current: 0x%08x, max: 0x%08x, aAmount: %d", iCurrent, iMax, aAmount );
+        }
+
+    iCurrent += aAmount;
+    iCommitted += aAmount;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverSuspensionManager.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,508 @@
+/*
+* 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 "MemSpyDriverSuspensionManager.h"
+
+// System includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverOSAdaption.h"
+
+// Constants
+const TInt KSuspendResumeCount = 1;
+
+
+
+DMemSpySuspensionManager::DMemSpySuspensionManager( DMemSpyDriverDevice& aDevice )
+:   iDevice( aDevice )
+    {
+    }
+
+
+DMemSpySuspensionManager::~DMemSpySuspensionManager()
+	{
+	TRACE( Kern::Printf("DMemSpySuspensionManager::~DMemSpySuspensionManager() - START"));
+
+    if  ( iAlreadySuspended )
+        {
+        TRACE( Kern::Printf("DMemSpySuspensionManager::~DMemSpySuspensionManager() - resuming threads in process with id: %d", iSuspendedProcessId ));
+        DoResumeAllThreadsInProcess( iSuspendedProcessId );
+        }
+    if  ( iTempObj != NULL )
+        {
+    	Kern::SafeClose( iTempObj, NULL );
+        }
+
+    TRACE( Kern::Printf("DMemSpySuspensionManager::~DMemSpySuspensionManager() - END"));
+    }
+
+
+TInt DMemSpySuspensionManager::Construct()
+    {
+    return KErrNone;
+    }
+
+
+
+
+
+
+
+ 
+
+
+
+TBool DMemSpySuspensionManager::IsSuspended( TUint aPid ) const
+    {
+    TBool ret = iAlreadySuspended;
+    //
+    if  ( ret )
+        {
+        ret = ( aPid == iSuspendedProcessId );
+        }
+    //
+    TRACE( Kern::Printf("DMemSpySuspensionManager::IsSuspended() - iAlreadySuspended: %d, iSuspendedProcessId: %d, aPid: %d, ret: %d", iAlreadySuspended, iSuspendedProcessId, aPid, ret ) );
+    return ret;
+    }
+
+
+TBool DMemSpySuspensionManager::IsSuspended( DThread& aThread ) const
+    {
+    TBool ret = EFalse;
+    //
+    const TUint tid = iDevice.OSAdaption().DThread().GetId( aThread );
+    DProcess* process = iDevice.OSAdaption().DThread().GetOwningProcess( aThread );
+    TRACE( Kern::Printf("DMemSpySuspensionManager::IsSuspended() - START - iSuspendedProcessId: %d, aThread: (%d) %O, process: 0x%08x", iSuspendedProcessId, tid, &aThread, process ) );
+    //
+    if ( process )
+        {
+        ret = IsSuspended( *process );
+        }
+    //
+    TRACE( Kern::Printf("DMemSpySuspensionManager::IsSuspended() - END - ret: %d", ret ) );
+    return ret;
+    }
+
+
+TBool DMemSpySuspensionManager::IsSuspended( DProcess& aProcess ) const
+    {
+    const TUint pid = iDevice.OSAdaption().DProcess().GetId( aProcess );
+    TRACE( Kern::Printf("DMemSpySuspensionManager::IsSuspended() - START - iSuspendedProcessId: %d, aProcess: (%d / %d) %O", iSuspendedProcessId, pid, aProcess.iId, &aProcess ) );
+    //
+    const TBool ret = IsSuspended( pid );
+    //
+    TRACE( Kern::Printf("DMemSpySuspensionManager::IsSuspended() - END - ret: %d", ret ) );
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpySuspensionManager::SuspendAllThreadsInProcess( TUint aPid, DThread& aClientThread )
+    {
+	// Suspend all threads in the process
+	TRACE( Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess() - START - id: %8d, iSuspendedProcessId: %8d, iAlreadySuspended: %d", aPid, iSuspendedProcessId, iAlreadySuspended ));
+    if  ( iAlreadySuspended && aPid != iSuspendedProcessId )
+        {
+		Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess() - END - trying to suspend multiple processes!");
+        MemSpyDriverUtils::PanicThread( aClientThread, EPanicAttemptingToSuspendMultipleProcesses );
+        return KErrNone;
+        }
+    else if ( IsProcessTheClientThread( aPid, aClientThread ) )
+        {
+		Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess() - END - trying to suspend client thread! - request ignored");
+        return KErrLocked;
+        }
+    
+	TInt r = KErrNone;
+	TRACE( Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess - iAlreadySuspended: %d", iAlreadySuspended));
+	if  ( !iAlreadySuspended ) 
+    	{
+    	r = DoSuspendAllThreadsInProcess( aPid, &aClientThread );
+    	if (r != KErrNone)
+    		{
+    		TRACE( Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess() - END - process not found") );
+    		return r;
+    		}
+
+        // To ensure we clean up in case of user-side problem...
+        iSuspendedProcessId = aPid;	
+        iAlreadySuspended = ETrue;
+    	iSuspendCount = 1;
+    	}
+	else
+    	{
+    	// Just increment the count
+    	++iSuspendCount;
+    	}
+
+    TRACE( Kern::Printf("DMemSpySuspensionManager::SuspendAllThreadsInProcess() - END - iSuspendCount: %d, iSuspendedProcessId: %d", iSuspendCount, iSuspendedProcessId ));
+	return iSuspendCount;
+    }
+
+
+TInt DMemSpySuspensionManager::ResumeAllThreadsInProcess( TUint aPid, DThread& aClientThread )
+    {
+	TRACE( Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - START - id: %8d, iSuspendedProcessId: %8d, iAlreadySuspended: %d", aPid, iSuspendedProcessId, iAlreadySuspended));
+	if  ( !iAlreadySuspended )
+    	{
+    	// Nothing suspended - don't panic
+     	TRACE( Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - END - nothing suspended, ignoring client request"));
+       	return KErrNone;
+    	}
+    else if  ( iAlreadySuspended && aPid != iSuspendedProcessId )
+        {
+		Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - END - trying to resume incorrect process!");
+        MemSpyDriverUtils::PanicThread( aClientThread, EPanicAttemptingToResumeNonSuspendedProcess );
+        return KErrNone;
+        }
+    else if  ( IsProcessTheClientThread( aPid, aClientThread ) )
+        {
+		Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - END - trying to resume client thread! - request ignored");
+        return KErrLocked;
+        }
+    
+    TRACE( Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess"));
+
+    TInt r = KErrNone;
+    if  ( --iSuspendCount <= 0 )
+        {
+    	r = DoResumeAllThreadsInProcess( aPid, &aClientThread );
+    	if (r != KErrNone)
+    		{
+    		Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - END - process not found");
+    		return r;
+    		}
+
+        // No longer need to clean up
+        iAlreadySuspended = EFalse;
+        iSuspendedProcessId = 0;
+        iSuspendCount = 0;
+        }
+    else
+        {
+    	// No action needed - we've already decremented the counter
+    	}
+
+	TRACE( Kern::Printf("DMemSpySuspensionManager::ResumeAllThreadsInProcess() - END - iSuspendCount: %d", iSuspendCount));
+	return iSuspendCount;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpySuspensionManager::DoSuspendAllThreadsInProcess( TUint aPid, DThread* /*aClientThread*/ )
+    {
+	TRACE( Kern::Printf("DMemSpySuspensionManager::DoSuspendAllThreadsInProcess() - START - aPid: %d", aPid));
+    TInt r = OpenTempObject( aPid, EProcess );
+    if  (r == KErrNone)
+    	{
+        DProcess* process = (DProcess*) iTempObj;
+        TFullName processName;
+        process->FullName( processName );
+        processName.Append('*');
+    
+        DObjectCon* container = Kern::Containers()[EThread];
+        NKern::ThreadEnterCS();
+        container->Wait();
+        //
+        TFullName result;
+#ifdef MCL_FIND_HANDLES
+        TFindHandle findHandle;
+#else
+        TInt findHandle = 0;
+#endif
+        r = container->FindByFullName( findHandle, processName, result );
+        while( r == KErrNone )
+            {
+            DThread* thread = (DThread*) container->At( findHandle );
+            if  ( thread )
+                {
+                const TUint tid = iDevice.OSAdaption().DThread().GetId( *thread );
+                TRACE( Kern::Printf("DMemSpySuspensionManager::DoSuspendAllThreadsInProcess - suspending thread: (%d), %O", tid, thread ));
+                //
+                Kern::ThreadSuspend( *thread, KSuspendResumeCount );
+                }
+            //
+            r = container->FindByFullName( findHandle, processName, result );
+            }
+        //
+        container->Signal();
+        NKern::ThreadLeaveCS();
+    
+        CloseTempObject();
+        r = KErrNone;
+    	}
+
+    TRACE( Kern::Printf("DMemSpySuspensionManager::DoSuspendAllThreadsInProcess() - END - ret: %d", r));
+    return r;
+    }
+
+
+TInt DMemSpySuspensionManager::DoResumeAllThreadsInProcess( TUint aPid, DThread* aClientThread )
+    {
+	TRACE( Kern::Printf("DMemSpySuspensionManager::DoResumeAllThreadsInProcess() - START - aPid: %d", aPid));
+    TInt r = OpenTempObject( aPid, EProcess );
+    if  (r == KErrNone)
+    	{
+        // Check that this process is suspended
+        DProcess* process = (DProcess*) iTempObj;
+        const TUint pid = iDevice.OSAdaption().DProcess().GetId( *process );
+        if  ( !aClientThread  || ( aClientThread && CheckProcessSuspended( pid, *aClientThread ) ) )
+            {
+            // Resume all threads in the process
+            TFullName processName;
+            process->FullName( processName );
+            processName.Append('*');
+    
+            DObjectCon* container = Kern::Containers()[EThread];
+            NKern::ThreadEnterCS();
+            container->Wait();
+            //
+            TFullName result;
+    #ifdef MCL_FIND_HANDLES
+            TFindHandle findHandle;
+    #else
+            TInt findHandle = 0;
+    #endif
+            r = container->FindByFullName( findHandle, processName, result );
+            while( r == KErrNone )
+                {
+                DThread* thread = (DThread*) container->At( findHandle );
+                TRACE( Kern::Printf("DMemSpySuspensionManager::DoResumeAllThreadsInProcess - resuming thread: %lS", &result));
+                //
+                Kern::ThreadResume(*thread);
+                r = container->FindByFullName( findHandle, processName, result );
+                }
+            //
+            container->Signal();
+            NKern::ThreadLeaveCS();
+    
+            r = KErrNone;
+            }
+        else
+            {
+            TRACE( Kern::Printf("DMemSpySuspensionManager::DoResumeAllThreadsInProcess - parent process not suspended => KErrAccessDenied"));
+            r = KErrAccessDenied;
+            }
+
+        CloseTempObject();
+        }
+
+    TRACE( Kern::Printf("DMemSpySuspensionManager::DoResumeAllThreadsInProcess() - END - ret: %d", r));
+    return r;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TBool DMemSpySuspensionManager::IsProcessTheClientThread( TUint aPid, DThread& aClientThread ) const
+    {
+    TBool ret = EFalse;
+    DProcess& clientProcess = *iDevice.OSAdaption().DThread().GetOwningProcess( aClientThread );
+    const TUint pid = iDevice.OSAdaption().DProcess().GetId( clientProcess );
+    if  ( pid == aPid )
+        {
+        ret = ETrue;
+        }
+    //
+    return ret;
+    }
+    
+
+TBool DMemSpySuspensionManager::CheckProcessSuspended( TUint aExpectedPid, DThread& aClientThread ) const
+    {
+    TBool suspended = ETrue;
+    //
+    if  ( !iAlreadySuspended )
+        {
+        MemSpyDriverUtils::PanicThread( aClientThread, EPanicThreadsInProcessNotSuspended );
+        }
+    else if ( aExpectedPid != iSuspendedProcessId )
+        {
+        MemSpyDriverUtils::PanicThread( aClientThread, EPanicWrongProcessSuspended );
+        }
+    //
+    return suspended;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpySuspensionManager::OpenTempObject(TUint aId, TObjectType aType)
+	{
+	__ASSERT_DEBUG( aType == EProcess || aType == EThread, MemSpyDriverUtils::Fault( __LINE__ ) );
+	__ASSERT_DEBUG( !iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
+
+	TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - START - aId: %d, aType: %d", aId, aType ));
+	DObjectCon* pC = Kern::Containers()[aType];
+	NKern::ThreadEnterCS();
+	pC->Wait();
+	iTempObj = (aType == EProcess) ? (DObject*)Kern::ProcessFromId(aId) : (DObject*)Kern::ThreadFromId(aId);
+	TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - kernel obj from id returned: 0x%08x %O", iTempObj, iTempObj ));
+    //
+    TBool openedOkay = EFalse;
+    TInt r = KErrNone;
+    //
+	if ( iTempObj )
+        {
+		r = iTempObj->Open();
+	    TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - open returned: %d", r ));
+		//
+        if  ( r == KErrNone )
+            {
+            openedOkay = ETrue;
+            if  ( aType == EProcess )
+                {
+                // Check the process is still alive
+                DProcess* process = (DProcess*) iTempObj;
+                const TExitType exitType = iDevice.OSAdaption().DProcess().GetExitType( *process );
+                if  ( exitType != EExitPending )
+					{
+                    r = KErrDied;
+	                TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - PROCESS IS DEAD!" ));
+					}
+                }
+            else if (aType == EThread )
+                {
+                // Check the thread is still alive
+                DThread* thread = (DThread*) iTempObj;
+                const TExitType exitType = iDevice.OSAdaption().DThread().GetExitType( *thread );
+                if  ( exitType != EExitPending )
+                    {
+                    r = KErrDied;
+	                TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - THREAD IS DEAD!" ));
+                    }
+                }
+            }
+
+        }
+    else if ( ! iTempObj )
+        {
+        r = KErrNotFound;
+	    TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - ENTITY NOT FOUND!" ));
+        }
+    //
+	pC->Signal();
+	TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - signalled container..." ));
+	NKern::ThreadLeaveCS();
+	TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - left CS..." ));
+    //
+    if  ( r != KErrNone && iTempObj )
+        {
+	    TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - ERROR CASE - closing temp object (r: %d, openedOkay: %d)...", r, openedOkay ));
+        //
+        if ( openedOkay )
+            {
+            CloseTempObject();
+            }
+        else
+            {
+            NKern::SafeSwap( NULL, (TAny*&) iTempObj );
+            }
+        //
+	    TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - ERROR CASE - closed temp object" ));
+        }
+    //
+	TRACE( Kern::Printf("DMemSpySuspensionManager::OpenTempObject() - END - r: %d", r ));
+	return r;
+	}
+
+
+void DMemSpySuspensionManager::CloseTempObject()
+	{
+	TRACE( Kern::Printf("DMemSpySuspensionManager::CloseTempObject() - START - iTempObj: 0x%08x %O", iTempObj, iTempObj ));
+
+	__ASSERT_DEBUG( iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
+    if  ( iTempObj )
+        {
+		NKern::ThreadEnterCS();
+	    Kern::SafeClose( iTempObj, NULL );
+		NKern::ThreadLeaveCS();
+        }
+
+    TRACE( Kern::Printf("DMemSpySuspensionManager::CloseTempObject() - END" ));
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverUserEventMonitor.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,429 @@
+/*
+* 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 "MemSpyDriverUserEventMonitor.h"
+
+// System includes
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverEventMonitor.h"
+
+// Literal constants
+_LIT( KMemSpyDriverClientEMMutexName, "MemSpyDriverClientEM_0x" );
+
+
+
+
+DMemSpyDriverClientEMManager::DMemSpyDriverClientEMManager( DMemSpyDriverDevice& aDevice )
+:   iDevice( aDevice )
+    {
+    }
+
+
+DMemSpyDriverClientEMManager::~DMemSpyDriverClientEMManager()
+	{
+	TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::~DMemSpyDriverClientEMManager() - START"));
+
+    NKern::ThreadEnterCS();
+    FreeAllInstances();
+    NKern::ThreadLeaveCS();
+
+	TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::~DMemSpyDriverClientEMManager() - END"));
+	}
+
+
+TInt DMemSpyDriverClientEMManager::Create()
+    {
+    return KErrNone;
+    }
+
+
+DMemSpyDriverClientEM* DMemSpyDriverClientEMManager::EMOpen()
+    {
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMOpen() - START - iNextHandle: %d, iDevice: 0x%08x", iNextHandle+1, &iDevice ) );
+    NKern::ThreadEnterCS();
+    //
+    DMemSpyDriverClientEM* object = new DMemSpyDriverClientEM( iDevice, ++iNextHandle );
+    if  ( object != NULL )
+        {
+        TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMOpen() - calling create..." ) );
+        const TInt error = object->Create();
+        if ( error != KErrNone )
+            {
+            TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMOpen() - creation error: %d", error ) );
+            delete object;
+            object = NULL;
+            }
+        else
+            {
+            iEMInstances.Add( &object->iLink );
+            }
+        }
+    //
+    NKern::ThreadLeaveCS();
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMOpen() - END - object: 0x%08x", object ) );
+    //
+    return object;
+    }
+
+
+TInt DMemSpyDriverClientEMManager::EMClose( TUint aHandle )
+    {
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMClose() - START - aHandle: 0x%08x", aHandle ) );
+    TInt error = KErrNotFound;
+    //
+    DMemSpyDriverClientEM* object = EMInstance( aHandle );
+    if  ( object != NULL )
+        {
+        NKern::ThreadEnterCS();
+        object->iLink.Deque();
+        delete object;
+        NKern::ThreadLeaveCS();
+        error = KErrNone;
+        }
+    //
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMClose() - END - error: %d", error ) );
+    return error;
+    }
+
+
+DMemSpyDriverClientEM* DMemSpyDriverClientEMManager::EMInstance( TUint aHandle )
+    {
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMInstance() - START - aHandle: 0x%08x", aHandle ) );
+    DMemSpyDriverClientEM* ret = NULL;
+    //
+	const SDblQueLink* const anchor = &iEMInstances.iA;
+	for (SDblQueLink* link = iEMInstances.First(); link != anchor; link = link->iNext )
+		{
+		DMemSpyDriverClientEM* object = _LOFF( link, DMemSpyDriverClientEM, iLink );
+        //
+        if  ( object->Handle() == aHandle )
+            {
+            ret = object;
+            break;
+            }
+        }
+    //
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::EMInstance() - END - aHandle: 0x%08x, ret: 0x%08x", aHandle, ret ) );
+    return ret;
+    }
+
+
+void DMemSpyDriverClientEMManager::FreeAllInstances()
+    {
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::FreeAllInstances() - START") );
+	
+    SDblQueLink* link = iEMInstances.GetFirst();
+	while( link )
+		{
+		DMemSpyDriverClientEM* object = _LOFF( link, DMemSpyDriverClientEM, iLink );
+        delete object;
+        link = iEMInstances.GetFirst();
+		}
+
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEMManager::FreeAllInstances() - END") );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverClientEM::DMemSpyDriverClientEM( DMemSpyDriverDevice& aDevice, TUint aHandle )
+:   iDevice( aDevice ), iHandle( aHandle )
+    {
+    }
+
+
+DMemSpyDriverClientEM::~DMemSpyDriverClientEM()
+    {
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::~DMemSpyDriverClientEM() - START - this: 0x%08x", this ));
+	iDevice.EventMonitor().RequestEventsCancel( *this );
+
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::~DMemSpyDriverClientEM() - calling NotifyChangesCancel..." ) );
+    NotifyChangesCancel();
+    
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::~DMemSpyDriverClientEM() - calling ResetPendingChanges..." ) );
+    ResetPendingChanges();
+
+	if  ( iLock )
+		{
+        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::~DMemSpyDriverClientEM() - closing mutex..." ) );
+		iLock->Close(NULL);
+		}
+
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::~DMemSpyDriverClientEM() - END - this: 0x%08x" ));
+    }
+
+
+TInt DMemSpyDriverClientEM::Create()
+    {
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::Create() - START - handle: 0x%08x", Handle() ) );
+
+    // Create mutex
+    TName name( KMemSpyDriverClientEMMutexName );
+    name.AppendNumFixedWidth( (TUint) this, EHex, 8 );
+    TInt error = Kern::MutexCreate( iLock, name, KMutexOrdNone );
+    //
+    if  ( error == KErrNone )
+        {
+        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::Create() - calling global device driver event monitor...") );
+        iDevice.EventMonitor().RequestEvents( *this );
+        }
+    //
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::Create() - END - handle: 0x%08x, err: %d", Handle(), error ) );
+    return error;
+    }
+
+
+TInt DMemSpyDriverClientEM::NotifyChanges( DThread* aClientThread, TRequestStatus* aClientRS, TAny* aClientContext )
+    {
+	Kern::MutexWait( *iLock );
+
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChanges() - START - handle: 0x%08x", Handle() ) );
+    TInt r = KErrInUse;
+    //
+    if  ( iClientRS == NULL )
+        {
+        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChanges() - saving client's request...") );
+        iClientThread = aClientThread;
+        iClientRS = aClientRS;
+        iClientContext = aClientContext;
+        //
+        if	( !iPendingChanges.IsEmpty() )
+			{
+            TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyOnChange() - Have buffered changes - SENDING TO CLIENT IMMEDIATELY..." ) );
+			
+            // We have something in the pending buffer so we can
+			// give it back to the client immediately.
+	        DMemSpyDriverClientEM::TChange* cachedChange = _LOFF( iPendingChanges.First(), DMemSpyDriverClientEM::TChange, iLink );
+			cachedChange->iLink.Deque();
+			
+            // Notify about change			
+			CompleteClientsRequest( cachedChange->iCompletionCode, cachedChange->iContext );
+			
+			// Discard cached entry
+            NKern::ThreadEnterCS();
+			delete cachedChange;
+            NKern::ThreadLeaveCS();
+			}
+        //
+        r = KErrNone;
+        }
+    //
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChanges() - END - handle: 0x%08x, error: %d", Handle(), r ) );
+	Kern::MutexSignal( *iLock );
+    return r;
+    }
+
+
+TInt DMemSpyDriverClientEM::NotifyChangesCancel()
+    {
+	Kern::MutexWait( *iLock );
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChangesCancel() - START - handle: 0x%08x, iClientThread: 0x%08x, iClientRS: 0x%08x", Handle(), iClientThread, iClientRS ) );
+    //
+    TInt r = KErrNotReady;
+    //
+    if  ( iClientRS != NULL )
+        {
+        DThread* clientThread = iClientThread;
+        TRequestStatus* clientRS = iClientRS;
+        //
+        iClientThread = NULL;
+        iClientRS = NULL;
+        iClientContext = NULL;
+        //
+        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChangesCancel() - doing final request complete...") );
+		Kern::RequestComplete( clientThread, clientRS, KErrCancel );
+        r = KErrNone;
+        }
+    //
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::NotifyChangesCancel() - END - handle: 0x%08x, error: %d", Handle(), r ) );
+	Kern::MutexSignal( *iLock );
+    return r;
+    }
+
+
+TUint DMemSpyDriverClientEM::EMTypeMask() const
+    {
+    const TUint ret = EMemSpyEventThreadAdd  | EMemSpyEventThreadKill |
+                      EMemSpyEventProcessAdd | EMemSpyEventProcessRemove | 
+                      EMemSpyEventChunkAdd   | EMemSpyEventChunkDelete;
+    return ret;
+    }
+
+
+void DMemSpyDriverClientEM::EMHandleProcessAdd( DProcess& aProcess )
+    {
+    const TUint pid = iDevice.OSAdaption().DProcess().GetId( aProcess );
+    //
+	Kern::MutexWait( *iLock );
+    CompleteClientsRequest( EMemSpyDriverEventTypeProcessCreate, pid );
+	Kern::MutexSignal( *iLock );
+    }
+
+
+void DMemSpyDriverClientEM::EMHandleProcessRemoved( DProcess& aProcess )
+    {
+    const TUint pid = iDevice.OSAdaption().DProcess().GetId( aProcess );
+    //
+	Kern::MutexWait( *iLock );
+    CompleteClientsRequest( EMemSpyDriverEventTypeProcessRemove, pid );
+	Kern::MutexSignal( *iLock );
+    }
+
+
+void DMemSpyDriverClientEM::EMHandleThreadAdd( DThread& aThread )
+    {
+    const TUint tid = iDevice.OSAdaption().DThread().GetId( aThread );
+    //
+	Kern::MutexWait( *iLock );
+    CompleteClientsRequest( EMemSpyDriverEventTypeThreadCreate, tid );
+	Kern::MutexSignal( *iLock );
+    }
+
+
+void DMemSpyDriverClientEM::EMHandleThreadKilled( DThread& aThread )
+    {
+    const TUint tid = iDevice.OSAdaption().DThread().GetId( aThread );
+    //
+	Kern::MutexWait( *iLock );
+    CompleteClientsRequest( EMemSpyDriverEventTypeThreadKill, tid );
+	Kern::MutexSignal( *iLock );
+    }
+
+
+void DMemSpyDriverClientEM::EMHandleChunkAdd( DChunk& aChunk ) 
+    {
+	Kern::MutexWait( *iLock );
+    CompleteClientsRequest( EMemSpyDriverEventTypeChunkAdd, (TUint) &aChunk );
+	Kern::MutexSignal( *iLock );
+    }
+
+
+void DMemSpyDriverClientEM::EMHandleChunkDeleted( DChunk& aChunk )
+    {
+	Kern::MutexWait( *iLock );
+    CompleteClientsRequest( EMemSpyDriverEventTypeChunkDestroy, (TUint) &aChunk );
+	Kern::MutexSignal( *iLock );
+    }
+
+
+void DMemSpyDriverClientEM::CompleteClientsRequest( TInt aCompletionCode, TUint aContext )
+    {
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - START - handle: 0x%08x, iClientThread: 0x%08x, iClientRS: 0x%08x, iClientContext: 0x%08x, aCompletionCode: %d, aContext: %d, changesPending: %d", Handle(), iClientThread, iClientRS, iClientContext, aCompletionCode, aContext, !iPendingChanges.IsEmpty() ) );
+    //
+    if  ( iClientRS != NULL )
+        {
+        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - attempting to complete client's request...") );
+
+        // First write context info
+        const TInt writeErr = Kern::ThreadRawWrite( iClientThread, iClientContext, &aContext, sizeof(TUint) );
+		if  ( writeErr != KErrNone )
+		    {
+            TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - write error: %d", writeErr ) );
+            aCompletionCode = writeErr;
+		    }
+
+        // Now complete event - avoiding race conditions!
+        DThread* clientThread = iClientThread;
+        TRequestStatus* clientRS = iClientRS;
+        //
+        iClientThread = NULL;
+        iClientRS = NULL;
+        iClientContext = NULL;
+        //
+        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - doing final request complete...") );
+		Kern::RequestComplete( clientThread, clientRS, aCompletionCode );
+        }
+    else
+        {
+		// Buffer the change for next time around...
+        TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - BUFFERING change event whilst client is AWOL...", this ) );
+        NKern::ThreadEnterCS();
+        
+        DMemSpyDriverClientEM::TChange* cachedChange = new DMemSpyDriverClientEM::TChange( aCompletionCode, aContext );
+        if  ( cachedChange )
+            {
+            iPendingChanges.Add( &cachedChange->iLink );
+            }
+        //
+        NKern::ThreadLeaveCS();
+        }
+    //
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::CompleteClientsRequest() - END - handle: 0x%08x", Handle() ) );
+    }
+
+
+void DMemSpyDriverClientEM::ResetPendingChanges()
+    {
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::ResetPendingChanges() - START - this: 0x%08x", this ) );
+    NKern::ThreadEnterCS();
+    //
+    SDblQueLink* link = iPendingChanges.GetFirst();
+	while( link )
+		{
+        DMemSpyDriverClientEM::TChange* cachedChange = _LOFF( link, DMemSpyDriverClientEM::TChange, iLink );
+        delete cachedChange;
+        link = iPendingChanges.GetFirst();
+		}
+    //
+    NKern::ThreadLeaveCS();
+    TRACE_EM( Kern::Printf("DMemSpyDriverClientEM::ResetPendingChanges() - END - this: 0x%08x", this ) );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverUtils.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,314 @@
+/*
+* 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 "MemSpyDriverUtils.h"
+
+// System includes
+#include <kern_priv.h>
+#include <nk_plat.h>
+#ifdef __MARM__
+#include <arm.h>
+#endif
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyDriverOSAdaption.h"
+
+// Constants
+static const char KFault[] = "MemSpy-Bug";
+
+
+
+void MemSpyDriverUtils::DataDump( const char* aFmt, const TUint8* aAddress, TInt aLength, TInt aMaxLength)
+    {
+    const TInt maxLen = aMaxLength;
+    TInt len = aLength;
+    const TUint8* pDataAddr = aAddress;
+
+	TBuf8<81> out;
+	TBuf8<20> ascii;
+	TInt offset = 0;
+	const TUint8* a = pDataAddr;
+    //
+	while(len>0)
+		{
+		out.Zero();
+		ascii.Zero();
+		out.AppendNumFixedWidth((TUint) a, EHex, 8);
+		out.Append(_L(": "));
+
+        TUint b;
+		for (b=0; b<16; b++)
+			{
+            TUint8 c = ' ';
+            if	((pDataAddr + offset + b) < pDataAddr + maxLen)
+	            {
+	            c = *(pDataAddr + offset + b);
+				out.AppendNumFixedWidth(c, EHex, 2);
+	            }
+            else
+	            {
+				out.Append(_L("  "));
+	            }
+			out.Append(' ');
+			if (c<=0x20 || c == 0x27 || c>=0x7f || c=='%')
+				c=0x2e;
+			ascii.Append(TChar(c));
+			}
+		out.Append(ascii);
+        out.Append(TChar(0));
+
+        Kern::Printf(aFmt, &out);
+
+        a += 16;
+		offset += 16;
+		len -= 16;
+        }
+    }
+
+
+void MemSpyDriverUtils::PanicThread( DThread& aThread, TMemSpyDriverPanic aPanicType )
+    {
+    Kern::ThreadKill( &aThread, EExitPanic, aPanicType, KMemSpyClientPanic );
+    }
+
+
+void MemSpyDriverUtils::Fault( TInt aReason )
+    {
+    Kern::Fault( KFault, aReason );
+    }
+
+
+void MemSpyDriverUtils::GetThreadRegisters( NThread* aThread, TMemSpyDriverRegSet& aInfo )
+	{
+    DThread* dThread = Kern::NThreadToDThread( aThread );
+    TRACE( Kern::Printf( "MemSpyDriverUtils::GetThreadRegisters() - START - aThread: %O", dThread ));
+    memclr( &aInfo, sizeof( TMemSpyDriverRegSet ) );
+	TRACE( Kern::Printf( "MemSpyDriverUtils::GetThreadRegisters() - cleared" ));
+
+#ifdef __MARM__
+    if  ( aThread != NULL )
+        {
+	    TArmRegSet regSet;
+        memclr( &regSet, sizeof(TArmRegSet) );
+        //
+	    TUint32 unused;
+	    TRACE( Kern::Printf( "MemSpyDriverUtils::GetThreadRegisters() - getting user context..." ));
+	    NKern::ThreadGetUserContext( aThread, &regSet, unused);
+	    TRACE( Kern::Printf( "MemSpyDriverUtils::GetThreadRegisters() - got user context" ));
+        //
+	    aInfo.iRn[ 0] = regSet.iR0;
+	    aInfo.iRn[ 1] = regSet.iR1;
+	    aInfo.iRn[ 2] = regSet.iR2;
+	    aInfo.iRn[ 3] = regSet.iR3;
+	    aInfo.iRn[ 4] = regSet.iR4;
+	    aInfo.iRn[ 5] = regSet.iR5;
+	    aInfo.iRn[ 6] = regSet.iR6;
+	    aInfo.iRn[ 7] = regSet.iR7;
+	    aInfo.iRn[ 8] = regSet.iR8;
+	    aInfo.iRn[ 9] = regSet.iR9;
+	    aInfo.iRn[10] = regSet.iR10;
+	    aInfo.iRn[11] = regSet.iR11;
+	    aInfo.iRn[12] = regSet.iR12;
+	    aInfo.iRn[13] = regSet.iR13;
+	    aInfo.iRn[14] = regSet.iR14;
+	    aInfo.iRn[15] = regSet.iR15;
+        //
+	    aInfo.iCpsr = regSet.iFlags;
+        }
+#else
+    (void) aThread;
+#endif
+
+    TRACE( Kern::Printf( "MemSpyDriverUtils::GetThreadRegisters() - END" ));
+	}
+
+
+TThreadPriority MemSpyDriverUtils::MapToUserThreadPriority( TInt aPriority )
+    {
+    TThreadPriority tp = EPriorityNormal;
+    //
+	switch(aPriority)
+		{
+	case EThrdPriorityMuchLess:
+        tp=EPriorityMuchLess;
+        break;
+	case EThrdPriorityLess:
+        tp=EPriorityLess;
+        break;
+	default:
+	case EThrdPriorityNormal:
+        tp=EPriorityNormal;
+        break;
+	case EThrdPriorityMore:
+        tp=EPriorityMore;
+        break;
+	case EThrdPriorityMuchMore:
+        tp=EPriorityMuchMore;
+        break;
+	case EThrdPriorityRealTime:
+        tp=EPriorityRealTime;
+        break;
+	case EThrdPriorityAbsoluteVeryLow:
+        tp=EPriorityAbsoluteVeryLow;
+        break;
+	case EThrdPriorityAbsoluteLow:
+        tp=EPriorityAbsoluteLow;
+        break;
+	case EThrdPriorityAbsoluteBackground:
+        tp=EPriorityAbsoluteBackground;
+        break;
+	case EThrdPriorityAbsoluteForeground:
+        tp=EPriorityAbsoluteForeground;
+        break;
+	case EThrdPriorityAbsoluteHigh:
+        tp=EPriorityAbsoluteHigh;
+        break;
+    	}
+    //
+    return tp;
+    }
+
+
+TInt MemSpyDriverUtils::MapToAbsoluteThreadPriority( TThreadPriority aPriority )
+    {
+	TInt tp = KErrNotSupported;
+    switch( aPriority )
+        {
+	case EPriorityAbsoluteVeryLow:
+        tp=EThrdPriorityAbsoluteVeryLow; break;
+	case EPriorityAbsoluteLowNormal:
+        tp=EThrdPriorityAbsoluteLowNormal; break;
+	case EPriorityAbsoluteLow:
+        tp=EThrdPriorityAbsoluteLow; break;
+	case EPriorityAbsoluteBackgroundNormal:
+        tp=EThrdPriorityAbsoluteBackgroundNormal; break;
+	case EPriorityAbsoluteBackground:
+        tp=EThrdPriorityAbsoluteBackground; break;
+	case EPriorityAbsoluteForegroundNormal:
+        tp=EThrdPriorityAbsoluteForegroundNormal; break;
+	case EPriorityAbsoluteForeground:
+        tp=EThrdPriorityAbsoluteForeground; break;
+	case EPriorityAbsoluteHighNormal:
+        tp=EThrdPriorityAbsoluteHighNormal; break;
+	case EPriorityAbsoluteHigh:
+        tp=EThrdPriorityAbsoluteHigh; break;
+	case EPriorityAbsoluteRealTime1:
+        tp=EThrdPriorityAbsoluteRealTime1; break;
+	case EPriorityAbsoluteRealTime2:
+        tp=EThrdPriorityAbsoluteRealTime2; break;
+	case EPriorityAbsoluteRealTime3:
+        tp=EThrdPriorityAbsoluteRealTime3; break;
+	case EPriorityAbsoluteRealTime4:
+        tp=EThrdPriorityAbsoluteRealTime4; break;
+	case EPriorityAbsoluteRealTime5:
+        tp=EThrdPriorityAbsoluteRealTime5; break;
+	case EPriorityAbsoluteRealTime6:
+        tp=EThrdPriorityAbsoluteRealTime6; break;
+	case EPriorityAbsoluteRealTime7:
+        tp=EThrdPriorityAbsoluteRealTime7; break;
+	case EPriorityAbsoluteRealTime8:
+        tp=EThrdPriorityAbsoluteRealTime8; break;
+	default:
+		break;
+        }
+
+    return tp;
+    }
+
+
+void MemSpyDriverUtils::PrintChunkInfo( DChunk& aChunk, DMemSpyDriverOSAdaption& aOSAdaption )
+    {
+    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = aOSAdaption.DChunk();
+    //
+    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk->Name:        %O", &aChunk ) );
+    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - sizeof(DChunk):      %d", sizeof(DChunk) ) );
+    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk*:             0x%08x", &aChunk ) );
+
+    DObject* owner = chunkAdaption.GetOwner( aChunk );
+    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk->Owner():     0x%08x", owner ) );
+
+    if  ( owner )
+        {
+        const TObjectType objectType = chunkAdaption.GetObjectType( *owner );
+        if ( objectType == EProcess )
+            {
+            DProcess* ownerProc = (DProcess*) owner;
+            const TUint pid = aOSAdaption.DProcess().GetId( *ownerProc );
+            TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk->Owner()->Id: %d (%O)", pid, ownerProc ) );
+            }
+        }
+
+    DProcess* owningProcess = chunkAdaption.GetOwningProcess( aChunk );
+    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - iOwningProcess:      0x%08x (%O)", owningProcess, owningProcess ) );
+
+    const TUint controllingOwner = chunkAdaption.GetControllingOwnerId( aChunk );
+    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - iControllingOwner:   %d", controllingOwner ) );
+
+    const TInt attribs = chunkAdaption.GetAttributes( aChunk );
+    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - iAttributes:         0x%08x", attribs ) );
+
+    const TChunkType type = chunkAdaption.GetType( aChunk );
+    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - iChunkType:          %d", type ) );
+
+    const TUint8* base = chunkAdaption.GetBase( aChunk );
+    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk->Base:        0x%08x", base ) );
+
+    const TInt size = chunkAdaption.GetSize( aChunk );
+    TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - aChunk->Size:        0x%08x", size ) );
+    //
+    const TInt mapType = attribs & 0x00c00000; // DMemModelChunk::EMapTypeMask
+    switch( mapType )
+        {
+    case 0x00000000: // EMapTypeLocal
+        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - map type:            DMemModelChunk::EMapTypeLocal" ) );
+        break;
+    case 0x00400000: // EMapTypeGlobal
+        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - map type:            DMemModelChunk::EMapTypeGlobal" ) );
+        break;
+    case 0x00800000: // EMapTypeShared
+        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - map type:            DMemModelChunk::EMapTypeShared" ) );
+        break;
+    default:
+        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - map type:            UNKNOWN!" ) );
+        break;
+        }
+    //
+	const TInt addressRange = ( attribs & 0x0f000000 ); // EAddressRangeMask
+	switch (addressRange)
+		{
+    case 0x00000000: //EAddressLocal
+        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       DMemModelChunk::EAddressLocal" ) );
+        break;
+	case 0x01000000: //EAddressShared
+        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       DMemModelChunk::EAddressShared" ) );
+        break;
+	case 0x02000000: //EAddressUserGlobal
+        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       DMemModelChunk::EAddressUserGlobal" ) );
+        break;
+	case 0x03000000: //EAddressKernel
+        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       DMemModelChunk::EAddressKernel" ) );
+        break;
+	case 0x04000000: //EAddressFixed
+        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       DMemModelChunk::EAddressFixed" ) );
+        break;
+    default:
+        TRACE( Kern::Printf( "MemSpyDriverUtils::PrintChunkInfo() - address range:       UNKNOWN!" ) );
+        break;
+		}
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverXferBuffer.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,189 @@
+/*
+* 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 "MemSpyDriverXferBuffer.h"
+
+// System includes
+#include <u32hal.h>
+
+// Shared includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+
+
+
+DMemSpyDriverXferBuffer::DMemSpyDriverXferBuffer( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   iDevice( aDevice ), iClientThread( aThread )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverXferBuffer::DMemSpyDriverXferBuffer() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverXferBuffer::~DMemSpyDriverXferBuffer()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverXferBuffer::~DMemSpyDriverXferBuffer() - START - this: 0x%08x", this ));
+
+    NKern::ThreadEnterCS();
+    delete iBuffer;
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::~DMemSpyDriverXferBuffer() - END - this: 0x%08x", this ));
+	}
+
+
+TInt DMemSpyDriverXferBuffer::Construct( TInt aSize )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::Construct() - START - this: 0x%08x, newSize: %d, iSize: %d", this, aSize, iSize ));
+    TInt ret = KErrNone;
+    //
+    iBuffer = Kern::AllocZ( aSize );
+    if  ( iBuffer == NULL )
+        {
+        ret = KErrNoMemory;
+        }
+    else
+        {
+        iSize = aSize;
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::Construct() - END - this: 0x%08x, newSize: %d, iSize: %d", this, aSize, iSize ));
+    return ret;
+    }
+
+
+
+TInt DMemSpyDriverXferBuffer::Size() const
+    {
+    return iSize;
+    }
+
+
+TInt DMemSpyDriverXferBuffer::GrowBy( TInt aSize )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::GrowBy() - START - this: 0x%08x, newSize: %d, iSize: %d", this, iSize + aSize, iSize ));
+    //
+    TInt ret = KErrNone;
+    const TInt newSize = iSize + aSize;
+    if  ( newSize > iSize )
+        {
+        NKern::ThreadEnterCS();
+        ret = Kern::SafeReAlloc( iBuffer, iSize, newSize );
+        if  ( ret == KErrNone )
+            {
+            iSize = newSize;
+            }
+	    NKern::ThreadLeaveCS();
+        }
+    else
+        {
+        TRACE( Kern::Printf("DMemSpyDriverXferBuffer::GrowBy() - WARNING - new size would shrink buffer (or have no effect)!" ));
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::GrowBy() - END - this: 0x%08x, err: %d, iSize: %d", this, ret, iSize ));
+    return ret;
+    }
+
+
+TInt DMemSpyDriverXferBuffer::EnsureCapacity( TInt aSize )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::EnsureCapacity() - START - this: 0x%08x, aSize: %d, iSize: %d", this, aSize, iSize ));
+    //
+    TInt ret = KErrNone;
+    if  ( aSize > iSize )
+        {
+        const TInt newSize = aSize;
+        //
+        NKern::ThreadEnterCS();
+        ret = Kern::SafeReAlloc( iBuffer, iSize, newSize );
+        if  ( ret == KErrNone )
+            {
+            iSize = newSize;
+            }
+	    NKern::ThreadLeaveCS();
+        }
+    else
+        {
+        TRACE( Kern::Printf("DMemSpyDriverXferBuffer::EnsureCapacity() - WARNING - new size would shrink buffer (or have no effect)!" ));
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverXferBuffer::EnsureCapacity() - END - this: 0x%08x, err: %d, iSize: %d", this, ret, iSize ));
+    return ret;
+    }
+
+
+void DMemSpyDriverXferBuffer::Reset()
+    {
+    memclr( iBuffer, iSize );
+    }
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverXferBuffer::WriteToClient( TDes8* aDestinationPointer, TInt aLength )
+    {
+    // Check the client has enough space
+    TInt err = Kern::ThreadGetDesMaxLength( &iClientThread, aDestinationPointer );
+    if  ( err >= 0 )
+        {
+        if  ( aLength > err )
+            {
+            Kern::Printf("DMemSpyDriverXferBuffer::WriteToClient() - client descriptor max len: %d, amount to write: %d => KErrOverflow", err, aLength );
+            err = KErrOverflow;
+            }
+        else
+            {
+            const TPtrC8 pData( (const TUint8*) iBuffer, aLength );
+            err = Kern::ThreadDesWrite( &iClientThread, aDestinationPointer, pData, 0, KChunkShiftBy0 | KTruncateToMaxLength, &iClientThread );
+            }
+        }
+
+    // Check for bad descriptor and panic the client
+    if  ( err == KErrBadDescriptor )
+        {
+        MemSpyDriverUtils::PanicThread( iClientThread, EPanicBadDescriptor );
+        }
+    //
+    return err;
+    }
+
+
+DThread& DMemSpyDriverXferBuffer::ClientThread()
+    {
+    return iClientThread;
+    }
+
+
+TUint8* DMemSpyDriverXferBuffer::Ptr()
+    {
+    return (TUint8*) iBuffer;
+    }
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanBase.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,306 @@
+/*
+* 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 "MemSpyDriverLogChanBase.h"
+
+// System includes
+#include <u32hal.h>
+#include <kernel.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverXferBuffer.h"
+
+
+
+DMemSpyDriverLogChanBase::DMemSpyDriverLogChanBase( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   iDevice( aDevice ), iClientThread( aThread )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::DMemSpyDriverLogChanBase() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanBase::~DMemSpyDriverLogChanBase()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::~DMemSpyDriverLogChanBase() - START - this: 0x%08x", this ));
+
+    NKern::ThreadEnterCS();
+
+    if  ( iTempObj != NULL )
+        {
+    	Kern::SafeClose( iTempObj, NULL );
+        }
+
+    delete iXferBuffer;
+	
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::~DMemSpyDriverLogChanBase() - END - this: 0x%08x", this ));
+	}
+
+
+TInt DMemSpyDriverLogChanBase::BaseConstruct( TInt aTransferBufferSize )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::BaseConstruct() - START - this: 0x%08x, aTransferBufferSize: %d", this, aTransferBufferSize ));
+    TInt ret = KErrNone;
+    //
+    if  ( aTransferBufferSize != 0 )
+        {
+        iXferBuffer = new DMemSpyDriverXferBuffer( iDevice, iClientThread );
+        if  ( !iXferBuffer )
+            {
+            ret = KErrNoMemory;
+            }
+        else
+            {
+            ret = iXferBuffer->Construct( aTransferBufferSize );
+            if  ( ret != KErrNone )
+                {
+                delete iXferBuffer;
+                iXferBuffer = NULL;
+                }
+            }
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::BaseConstruct() - END - this: 0x%08x, aTransferBufferSize: %d, size: %d", this, aTransferBufferSize, iXferBuffer ? iXferBuffer->Size() : 0 ));
+    return ret;
+    }
+
+
+TInt DMemSpyDriverLogChanBase::Construct()
+    {
+    const TInt baseErr = BaseConstruct();
+    return baseErr;
+    }
+
+
+TInt DMemSpyDriverLogChanBase::Request( TInt /*aFunction*/, TAny* /*a1*/, TAny* /*a2*/ )
+    {
+    return KErrNone;
+    }
+
+
+
+
+
+
+
+DMemSpyDriverDevice& DMemSpyDriverLogChanBase::MemSpyDevice()
+    {
+    return iDevice;
+    }
+
+
+DMemSpySuspensionManager& DMemSpyDriverLogChanBase::SuspensionManager()
+    {
+    return MemSpyDevice().SuspensionManager();
+    }
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanBase::OpenTempObject( TUint aId, TObjectType aType, TBool aAllowDeadObjects )
+	{
+	__ASSERT_DEBUG( aType == EProcess || aType == EThread, MemSpyDriverUtils::Fault( __LINE__ ) );
+	__ASSERT_DEBUG( !iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - START - aId: %d, aType: %d, aAllowDeadObjects: %d", aId, aType, aAllowDeadObjects ));
+	DObjectCon* pC = Kern::Containers()[ aType ];
+	NKern::ThreadEnterCS();
+	pC->Wait();
+	iTempObj = (aType == EProcess) ? (DObject*) Kern::ProcessFromId( aId ) : (DObject*) Kern::ThreadFromId( aId );
+	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - kernel obj from id returned: 0x%08x %O", iTempObj, iTempObj ));
+    //
+    TBool openedOkay = EFalse;
+    TInt r = KErrNone;
+    //
+	if ( iTempObj )
+        {
+		r = iTempObj->Open();
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - open returned: %d", r ));
+		//
+        if  ( r == KErrNone )
+            {
+            openedOkay = ETrue;
+            if  ( aType == EProcess )
+                {
+                // Check the process is still alive
+                DProcess* process = (DProcess*) iTempObj;
+                const TExitType exitType = OSAdaption().DProcess().GetExitType( *process );
+                TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - process exitType: %d", exitType ));
+
+                if  ( !aAllowDeadObjects && exitType != EExitPending )
+					{
+                    r = KErrDied;
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - PROCESS IS DEAD!" ));
+					}
+                }
+            else if ( aType == EThread )
+                {
+                // Check the thread is still alive
+                DThread* thread = (DThread*) iTempObj;
+                const TExitType exitType = OSAdaption().DThread().GetExitType( *thread );
+                TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - thread exitType: %d", exitType ));
+
+                if  ( !aAllowDeadObjects && exitType != EExitPending )
+                    {
+                    r = KErrDied;
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - THREAD IS DEAD!" ));
+                    }
+                }
+            }
+
+        }
+    else if ( !iTempObj )
+        {
+        r = KErrNotFound;
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - ENTITY NOT FOUND!" ));
+        }
+    //
+	pC->Signal();
+	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - signalled container..." ));
+	NKern::ThreadLeaveCS();
+	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - left CS..." ));
+    //
+    if  ( r != KErrNone && iTempObj )
+        {
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - ERROR CASE - closing temp object (r: %d, openedOkay: %d)...", r, openedOkay ));
+        //
+        if ( openedOkay )
+            {
+            CloseTempObject();
+            }
+        else
+            {
+            NKern::SafeSwap( NULL, (TAny*&) iTempObj );
+            }
+        //
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - ERROR CASE - closed temp object" ));
+        }
+    //
+	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenTempObject() - END - r: %d", r ));
+	return r;
+	}
+
+
+void DMemSpyDriverLogChanBase::CloseTempObject()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanBase::CloseTempObject() - START - iTempObj: 0x%08x %O", iTempObj, iTempObj ));
+
+	__ASSERT_DEBUG( iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
+    if  ( iTempObj )
+        {
+	    NKern::ThreadEnterCS();
+        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::CloseTempObject() - in CS..." ));
+        //
+	    Kern::SafeClose( iTempObj, NULL );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::CloseTempObject() - done safe close..." ));
+        //
+	    NKern::ThreadLeaveCS();
+        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::CloseTempObject() - left CS" ));
+        }
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::CloseTempObject() - END" ));
+	}
+
+
+DThread& DMemSpyDriverLogChanBase::TempObjectAsThread()
+    {
+	__ASSERT_DEBUG( iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
+    DThread* ret = (DThread*) iTempObj;
+    return *ret;
+    }
+
+
+DProcess& DMemSpyDriverLogChanBase::TempObjectAsProcess()
+    {
+	__ASSERT_DEBUG( iTempObj, MemSpyDriverUtils::Fault( __LINE__ ) );
+    DProcess* ret = (DProcess*) iTempObj;
+    return *ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+RMemSpyMemStreamWriter DMemSpyDriverLogChanBase::OpenXferStream()
+    {
+	__ASSERT_ALWAYS( iXferBuffer, MemSpyDriverUtils::Fault( __LINE__ ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - this: 0x%08x, xferSize: %d", this, iXferBuffer->Size() ) );
+    RMemSpyMemStreamWriter ret( *iXferBuffer );
+    return ret;
+    }
+
+
+TInt DMemSpyDriverLogChanBase::OpenXferStream( RMemSpyMemStreamWriter& aWriter, TInt aRequiredSize )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - START - this: 0x%08x, xferSize: %d, aRequiredSize: %d", this, iXferBuffer->Size(), aRequiredSize ) );
+    __ASSERT_ALWAYS( iXferBuffer, MemSpyDriverUtils::Fault( __LINE__ ) );
+    
+    TInt err = KErrNone;
+    
+    // Never make the buffer smaller - but we will make it bigger if needs be.
+    if  ( aRequiredSize > iXferBuffer->Size() )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - Need to grow Xfer buffer..." ));
+        err = iXferBuffer->EnsureCapacity( aRequiredSize );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - grow result: %d", err ));
+        }
+    //
+    if  ( err == KErrNone )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - creating writer... with xfer buffer size: %d", iXferBuffer->Size() ));
+        aWriter = RMemSpyMemStreamWriter( *iXferBuffer );
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanBase::OpenXferStream() - END - this: 0x%08x, xferSize: %d, aRequiredSize: %d", this, iXferBuffer->Size(), aRequiredSize ) );
+    return err;
+    }
+
+
+
+
+
+DMemSpyDriverOSAdaption& DMemSpyDriverLogChanBase::OSAdaption()
+    {
+    return iDevice.OSAdaption();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanChunks.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,557 @@
+/*
+* 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 "MemSpyDriverLogChanChunks.h"
+
+// System includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverOSAdaption.h"
+
+// Constants
+_LIT8( KMemSpyLitDllDollarData, "DLL$DATA" );
+_LIT8( KMemSpyLitDollarDat, "$DAT" );
+_LIT8( KMemSpyLitDollarCode, "$CODE" );
+_LIT8( KMemSpyLitDollarGlobalCode, "GLOBAL$CODE" );
+_LIT8( KMemSpyLitLocalObject, "Local-" );
+
+
+DMemSpyDriverLogChanChunks::DMemSpyDriverLogChanChunks( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanBase( aDevice, aThread )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::DMemSpyDriverLogChanChunks() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanChunks::~DMemSpyDriverLogChanChunks()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::~DMemSpyDriverLogChanChunks() - START - this: 0x%08x", this ));
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::~DMemSpyDriverLogChanChunks() - END - this: 0x%08x", this ));
+	}
+
+
+
+TInt DMemSpyDriverLogChanChunks::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+        case EMemSpyDriverOpCodeChunkGetHandles:
+            r = GetChunkHandles( (TMemSpyDriverInternalChunkHandleParams*) a1 );
+            break;
+        case EMemSpyDriverOpCodeChunkGetInfo:
+            r = GetChunkInfo( (TMemSpyDriverInternalChunkInfoParams*) a1 );
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+    		}
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanChunks::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeChunkBase && aFunction < EMemSpyDriverOpCodeChunkEnd );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanChunks::GetChunkHandles( TMemSpyDriverInternalChunkHandleParams* aParams )
+    {
+	TMemSpyDriverInternalChunkHandleParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalChunkHandleParams) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkHandles() - END - params read error: %d", r));
+        return r;
+        }
+
+	const TInt maxCount = params.iMaxCount;
+	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkHandles() - START - id: %d,  maxCount: %d, type: %d", params.iId, maxCount, params.iType));
+
+    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
+    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
+
+
+    // This variable holds the number of handles that we have already
+    // written to the client-side.
+    TInt currentWriteIndex = 0;
+	
+    if  ( params.iType == EMemSpyDriverPrivateObjectTypeProcess || params.iType == EMemSpyDriverPrivateObjectTypeThread )
+        {
+        if  ( params.iType == EMemSpyDriverPrivateObjectTypeThread )
+    	    {
+	        r = OpenTempObject( params.iId, EThread );
+            if  ( r == KErrNone )
+                {
+                // Open the owning process instead, so that we can see which chunks are mapped
+                // into the thread.
+                DThread* thread = (DThread*) TempObject();
+                DProcess* process = threadAdaption.GetOwningProcess( *thread );
+                if  ( process )
+                    {
+                    const TUint parentProcessId = processAdaption.GetId( *process );
+                    CloseTempObject();
+                    r = OpenTempObject( parentProcessId, EProcess );
+                    }
+                else
+                    {
+                    CloseTempObject();
+                    r = KErrNotFound;
+                    }
+                }
+       	    }
+        else
+            {
+	        r = OpenTempObject( params.iId, EProcess );
+            }
+
+        // Handle error opening correct process
+        if (r != KErrNone)
+    	    {
+    	    Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkHandles() - END - parent process not found");
+    	    return r;
+    	    }
+   
+        DProcess* process = (DProcess*) TempObject();
+	    NKern::ThreadEnterCS();
+
+	    // Iterate through each handle in the process
+	    MemSpyObjectIx* processHandles = processAdaption.GetHandles( *process );
+		MemSpyObjectIx_HandleLookupLock();
+        const TInt processHandleCount = processHandles->Count();
+		MemSpyObjectIx_HandleLookupUnlock();
+
+	    for( TInt processHandleIndex = 0; processHandleIndex<processHandleCount && r == KErrNone && currentWriteIndex < maxCount; processHandleIndex++ )
+    	    {
+    	    // Get a handle from the process container...
+            MemSpyObjectIx_HandleLookupLock();
+			if (processHandleIndex >= processHandles->Count()) break; // Count may have changed in the meantime
+    	    DObject* object = (*processHandles)[ processHandleIndex ];
+			if (object && object->Open() != KErrNone) object = NULL;
+			MemSpyObjectIx_HandleLookupUnlock();
+            
+            if  ( object )
+                {
+                const TObjectType objectType = processAdaption.GetObjectType( *object );
+                if ( objectType == EChunk )
+                    {
+                    DChunk* chunk = (DChunk*) object;
+                    TAny* handle = (TAny*) chunk;
+                    r = Kern::ThreadRawWrite( &ClientThread(), params.iHandles + currentWriteIndex, &handle, sizeof(TAny*) );
+                    if  ( r == KErrNone )
+                        {
+                        ++currentWriteIndex;
+                        }
+                    }
+				object->Close(NULL);
+                }
+    	    }
+
+        // If we were asked for process-related chunks, also check the chunk container
+        // for entries which we don't have handles to, but do refer to our process
+        // Need a listing of all chunks in the system. Let client filter duplicates.
+        DObjectCon* container = Kern::Containers()[ EChunk ];
+        container->Wait();
+        //
+        const TInt count = container->Count();
+        for( TInt i=0; i<count && r == KErrNone && currentWriteIndex < maxCount; i++ )
+            {
+            DChunk* chunk= (DChunk*) (*container)[ i ];
+            //
+            const TBool isRelated = DoesChunkRelateToProcess( *chunk, TempObjectAsProcess() );
+            if  ( isRelated )
+                {
+                r = Kern::ThreadRawWrite( &ClientThread(), params.iHandles + currentWriteIndex, &chunk, sizeof(TAny*) );
+                if  ( r == KErrNone )
+                    {
+                    ++currentWriteIndex;
+                    }
+                }
+            }
+        //
+        container->Signal();
+        NKern::ThreadLeaveCS();
+
+        CloseTempObject();
+        }
+    else
+        {
+        // Need a listing of all chunks in the system. Let client filter duplicates.
+        DObjectCon* container = Kern::Containers()[ EChunk ];
+        NKern::ThreadEnterCS();
+        container->Wait();
+        //
+        const TInt count = container->Count();
+        for( TInt i=0; i<count && r == KErrNone && currentWriteIndex < maxCount; i++ )
+            {
+            DChunk* chunk= (DChunk*) (*container)[ i ];
+            //
+            r = Kern::ThreadRawWrite( &ClientThread(), params.iHandles + currentWriteIndex, &chunk, sizeof(TAny*) );
+            if  (r == KErrNone)
+                {
+                ++currentWriteIndex;
+                }
+            }
+        //
+        container->Signal();
+        NKern::ThreadLeaveCS();
+        }
+	
+	if  ( r == KErrBadDescriptor )
+        {
+        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
+        }
+    else
+        {
+        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), params.iCountPtr, &currentWriteIndex, sizeof(TInt) );
+        if  ( r == KErrNone )
+            {
+            r = finalWrite;
+            }
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkHandles() - END - number of handles written to client: %d, ret: %d", currentWriteIndex, r));
+	return r;
+    }
+
+
+TInt DMemSpyDriverLogChanChunks::GetChunkInfo( TMemSpyDriverInternalChunkInfoParams* aParams )
+    {
+	TMemSpyDriverInternalChunkInfoParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalChunkInfoParams) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkInfo() - END - params read error: %d", r));
+        return r;
+        }
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkInfo() - START - handle: 0x%08x", params.iHandle));
+		
+	DObjectCon* container = Kern::Containers()[EChunk];
+	NKern::ThreadEnterCS();
+
+    container->Wait();
+    const TInt count = container->Count();
+
+    DChunk* foundChunk = NULL;
+    
+    for(TInt i=0; i<count; i++)
+        {
+        DChunk* chunk = (DChunk*) (*container)[i];
+        if  ( chunk == params.iHandle )
+            {
+            foundChunk = chunk;
+            TRACE( PrintChunkInfo( *chunk ) );
+			r = foundChunk->Open();
+            break;
+            }
+        }
+
+    container->Signal();
+
+    if  ( foundChunk == NULL )
+        {
+    	Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkInfo() - END - KErrNotFound - couldnt find chunk");
+		NKern::ThreadLeaveCS();
+        return KErrNotFound;
+        }
+	if (r)
+		{
+		Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkInfo() - END - %d - Failed to open chunk", r);
+		NKern::ThreadLeaveCS();
+		return r;
+		}
+
+    // Prepare return data
+    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
+    //
+    params.iBaseAddress = chunkAdaption.GetBase( *foundChunk );
+    params.iSize = chunkAdaption.GetSize( *foundChunk );
+    params.iMaxSize = chunkAdaption.GetMaxSize( *foundChunk );
+    foundChunk->FullName( params.iName );
+
+    // Mirror the process memory tracker
+    DProcess* owner = chunkAdaption.GetOwningProcess( *foundChunk );
+    if  ( owner )
+        {
+        params.iOwnerId = OSAdaption().DProcess().GetId( *owner );
+        }
+    else
+        {
+        owner = static_cast< DProcess* >( chunkAdaption.GetOwner( *foundChunk, EProcess ) );
+        if  ( owner )
+            {
+            params.iOwnerId = OSAdaption().DProcess().GetId( *owner );
+            }
+        else
+            {
+            params.iOwnerId = chunkAdaption.GetControllingOwnerId( *foundChunk );
+            }
+        }
+
+    // Get type & attribs
+    params.iType = IdentifyChunkType( *foundChunk );
+    params.iAttributes = chunkAdaption.GetAttributes( *foundChunk );
+
+	// Finished with foundChunk
+	foundChunk->Close(NULL);
+	NKern::ThreadLeaveCS();
+    
+    // Write back to client
+    r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalChunkInfoParams) );
+	if  ( r == KErrBadDescriptor )
+        {
+        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::GetChunkInfo() - END - handle: 0x%08x, params.iOwnerId: %d, r: %d", params.iHandle, params.iOwnerId, r ));
+    return r;
+    }
+
+
+void DMemSpyDriverLogChanChunks::PrintChunkInfo( DChunk& aChunk )
+    {
+    MemSpyDriverUtils::PrintChunkInfo( aChunk, OSAdaption() );
+    }
+
+
+TMemSpyDriverChunkType DMemSpyDriverLogChanChunks::IdentifyChunkType( DChunk& aChunk )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - START" ) );
+
+    TMemSpyDriverChunkType ret = EMemSpyDriverChunkTypeUnknown;
+
+    TName name;
+    aChunk.Name( name );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - name: %S", &name ) );
+
+    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
+    const TChunkType type = chunkAdaption.GetType( aChunk );
+
+    if  ( name == KMemSpyLitDllDollarData )
+        {
+        // This chunk contains Dll Global Data for the process
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeGlobalData" ) );
+        ret = EMemSpyDriverChunkTypeGlobalData;
+        }
+    else if ( type == ERamDrive )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeRamDrive" ) );
+        ret = EMemSpyDriverChunkTypeRamDrive;
+        }
+    else if ( type == EKernelStack )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeStackKernel" ) );
+        ret = EMemSpyDriverChunkTypeStackKernel;
+        }
+    else if ( name == KMemSpyLitDollarDat )
+        {
+        // This chunk contains process global data as well as user-side stacks for
+        // the process. 
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeStackAndProcessGlobalData" ) );
+        ret = EMemSpyDriverChunkTypeStackAndProcessGlobalData;
+        }
+    else if ( name == KMemSpyLitDollarGlobalCode && type == EDll )
+        {
+        // GLOBAL$CODE is used for RAM loaded code which is globally visible. This
+        // basically means locale DLLs - these must be visible to every process, even
+        // those which haven't loaded them.        
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeCodeGlobal" ) );
+        ret = EMemSpyDriverChunkTypeCodeGlobal;
+        }
+    else if ( name == KMemSpyLitDollarCode || type == EKernelCode || type == EDll || type == EUserCode )
+        {
+        // RAM-loaded code, which on the multiple memory model at least means that the code chunk is eseentially just a mapping
+        // artifact. The RAM itself is owned by the code segment, therefore counting the size of these CODE elements may result
+        // in inaccurate results if the code is shared amongst multiple processes.
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeCode" ) );
+        ret = EMemSpyDriverChunkTypeCode;
+        }
+    else if ( type == EUserSelfModCode )
+        {
+        // Dynamically create code chunk
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeCodeSelfModifiable" ) );
+        ret = EMemSpyDriverChunkTypeCodeSelfModifiable;
+        }
+    else if ( IsHeapChunk( aChunk, name ) )
+        {
+        // Catch kernel heap too
+        if  ( type == EKernelData )
+            {
+            TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeHeapKernel" ) );
+            ret = EMemSpyDriverChunkTypeHeapKernel;
+            }
+        else
+            {
+            TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeHeap" ) );
+            ret = EMemSpyDriverChunkTypeHeap;
+            }
+        }
+    else if ( type == EUserData && chunkAdaption.GetOwningProcess( aChunk ) == NULL )
+        {
+        // Global shared chunks match this pattern. Of course, we could check the memory model mapping attributes
+        // as that would give us the info in a heartbeat, but it's too specific.
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeGlobal" ) );
+        ret = EMemSpyDriverChunkTypeGlobal;
+        }
+    else if ( type == EUserData && chunkAdaption.GetOwner( aChunk ) != NULL && name.Length() > KMemSpyLitLocalObject().Length() && name.Left( KMemSpyLitLocalObject().Length() ) == KMemSpyLitLocalObject )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeLocal" ) );
+        ret = EMemSpyDriverChunkTypeLocal;
+        }
+    else
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeUnknown" ) );
+        TRACE( PrintChunkInfo( aChunk ) );
+        ret = EMemSpyDriverChunkTypeUnknown;
+        }
+
+    return ret;
+    }
+
+
+TBool DMemSpyDriverLogChanChunks::IsHeapChunk( DChunk& aChunk, const TName& aName )
+    {
+    (void) aName; // UREL warning
+    const TUint rHeapVTable = MemSpyDevice().RHeapVTable();
+    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - START - this: 0x%08x, aChunk: 0x%08x, RHeapVTable: 0x%08x, aName: %S, [%O]", this, &aChunk, rHeapVTable, &aName, &aChunk ) );
+
+    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
+    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
+    
+    // The first 4 bytes of every chunk correspond to the allocator VTable (For heap chunks).
+    // If it matches RHeap's vtable, we'll treat it as a heap.
+    TBool isHeap = EFalse;
+
+    // There must be an owning process or else it's definitely not a heap chunk.
+    DProcess* process = chunkAdaption.GetOwningProcess( aChunk );
+    TUint8* base = chunkAdaption.GetBase( aChunk );
+    const TInt size = chunkAdaption.GetSize( aChunk );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - base: 0x%08x, size: %d, process: 0x%08x (%O)", base, size, process, process ) );
+
+    if  ( process && size >= 4 )
+        {
+		NKern::ThreadEnterCS();
+        // Chunks are mapped into entire process so any thread within the process is enough...
+        DThread* firstThread = processAdaption.OpenFirstThread( *process );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - firstThread: 0x%08x (%O)", firstThread, firstThread ) );
+        if  ( firstThread != NULL )
+            {
+            TBuf8<4> allocatorVTableBuffer;
+            TInt err = Kern::ThreadRawRead( firstThread, base, (TUint8*) allocatorVTableBuffer.Ptr(), allocatorVTableBuffer.MaxLength() );
+            TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk - read result of vtable data from requested thread is: %d", err ));
+            //
+            if  ( err == KErrNone )
+                {
+                TRACE( MemSpyDriverUtils::DataDump("possible chunk vtable data - %lS", allocatorVTableBuffer.Ptr(), allocatorVTableBuffer.MaxLength(), allocatorVTableBuffer.MaxLength() ) );
+                allocatorVTableBuffer.SetLength( allocatorVTableBuffer.MaxLength() );
+                
+                const TUint32 vtable =   allocatorVTableBuffer[0] +
+                                        (allocatorVTableBuffer[1] << 8) + 
+                                        (allocatorVTableBuffer[2] << 16) + 
+                                        (allocatorVTableBuffer[3] << 24);
+                TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk - [possible] vTable within chunk is: 0x%08x", vtable) );
+
+                // Check the v-table to work out if it really is an RHeap
+                isHeap = ( vtable == rHeapVTable );
+                TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - isHeap: %d", isHeap ) );
+                }
+
+            TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - closing first thread..." ) );
+            Kern::SafeClose( (DObject*&) firstThread, NULL );
+            }
+		NKern::ThreadLeaveCS();
+        }
+
+    /* We only want RHeap's at the moment
+    if  ( !isHeap && aName == KMemSpyLitDollarHeap )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - its called $HEAP, but its not an RHeap... we\'ll let it through though..." ) );
+        isHeap = ETrue;
+        }
+    */
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IsHeapChunk() - END - this: 0x%08x, isHeap: %d", this, isHeap ) );
+    return isHeap;
+    }
+
+
+TBool DMemSpyDriverLogChanChunks::DoesChunkRelateToProcess( DChunk& aChunk, DProcess& aProcess )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::DoesChunkRelateToProcess() - START - this: 0x%08x, chunk: 0x%08x (%O), process: 0x%08x (%O)", this, &aChunk, &aChunk, &aProcess, &aProcess ) );
+    TBool ret = EFalse;
+    //
+    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
+    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
+    //
+    const TUint pid = processAdaption.GetId( aProcess );
+    DProcess* process = chunkAdaption.GetOwningProcess( aChunk );
+    if  ( process )
+        {
+        ret = ( pid == processAdaption.GetId( *process ) );
+        }
+    else
+        {
+        DObject* owner = chunkAdaption.GetOwner( aChunk, EProcess );
+        if  ( owner )
+            {
+            process = (DProcess*) owner;
+            ret = ( pid == processAdaption.GetId( *process ) );
+            }
+        else
+            {
+            ret = ( pid == chunkAdaption.GetControllingOwnerId( aChunk ) );
+            }
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::DoesChunkRelateToProcess() - END - this: 0x%08x, chunk: 0x%08x (%O), process: 0x%08x (%O), ret: %d", this, &aChunk, &aChunk, &aProcess, &aProcess, ret ) );
+    return ret;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanClientServer.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,228 @@
+/*
+* 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 "MemSpyDriverLogChanClientServer.h"
+
+// System includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverOSAdaption.h"
+
+
+
+DMemSpyDriverLogChanClientServer::DMemSpyDriverLogChanClientServer( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanContainerBase( aDevice, aThread )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::DMemSpyDriverLogChanChunks() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanClientServer::~DMemSpyDriverLogChanClientServer()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::~DMemSpyDriverLogChanClientServer() - START - this: 0x%08x", this ));
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::~DMemSpyDriverLogChanClientServer() - END - this: 0x%08x", this ));
+	}
+
+
+
+TInt DMemSpyDriverLogChanClientServer::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanContainerBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+	    case EMemSpyDriverOpCodeClientServerGetServerSessionHandles:
+            r = GetServerSessionHandles( (TMemSpyDriverInternalServerSessionHandleParams*) a1 );
+            break;
+	    case EMemSpyDriverOpCodeClientServerGetServerSessionInfo:
+            r = GetServerSessionInfo( a1, (TMemSpyDriverServerSessionInfo*) a2 );
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+		    }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanClientServer::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeClientServerBase && aFunction < EMemSpyDriverOpCodeClientServerEnd );
+    }
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanClientServer::GetServerSessionHandles( TMemSpyDriverInternalServerSessionHandleParams* aParams )
+	{
+    TMemSpyDriverInternalServerSessionHandleParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalServerSessionHandleParams) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionHandles() - END - params read error: %d", r));
+        return r;
+        }
+
+    DMemSpyDriverOSAdaptionDServer& serverAdaption = OSAdaption().DServer();
+
+	const TInt maxCount = params.iMaxCount;
+    NKern::ThreadEnterCS();
+
+    DObject* serverHandle = (DObject*) params.iServerHandle;
+    DServer* server = static_cast<DServer*>(CheckedOpen(EMemSpyDriverContainerTypeServer, serverHandle));
+    if (server == NULL)
+        {
+    	Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionHandles() - END - server not found");
+        NKern::ThreadLeaveCS();
+        return KErrNotFound;
+        }
+
+	ResetTempHandles();
+
+    NKern::LockSystem(); // Iterating session queue requires system lock
+    // Iterate through this server's sessions, writing back session pointer (handle)
+    // to client
+    SDblQue& serverQueue = serverAdaption.GetSessionQueue( *server );
+    SDblQueLink* anchor = &serverQueue.iA;
+    SDblQueLink* link = serverQueue.First();
+    while( link != anchor )
+        {
+		DSession* session = serverAdaption.GetSession( link );
+
+        // Found a match in the specified container. Write the object's handle (aka the object address)
+        // back to the client address space
+        if  ( session )
+            {
+            AddTempHandle( session );
+            }
+
+        // Get next item
+        link = link->iNext;
+        }
+    NKern::UnlockSystem();
+	server->Close(NULL);
+	NKern::ThreadLeaveCS();
+
+    // This variable holds the number of handles that we have already
+	// written to the client-side.
+	TInt currentWriteIndex = 0;
+	const TInt handleCount = TempHandleCount();
+    TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionHandles - writing %d handles to client...", handleCount ) );
+    for( ; currentWriteIndex<handleCount && r == KErrNone && currentWriteIndex < maxCount; )
+        {
+        TAny* handle = TempHandleAt( currentWriteIndex );
+        r = Kern::ThreadRawWrite( &ClientThread(), params.iSessionHandles + currentWriteIndex, &handle, sizeof(TAny*) );
+        if  (r == KErrNone)
+            {
+            ++currentWriteIndex;
+            }
+        }
+
+	if  ( r == KErrBadDescriptor )
+        {
+        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
+        }
+    else
+        {
+        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), params.iSessionCountPtr, &currentWriteIndex, sizeof(TInt) );
+        if  ( r == KErrNone )
+            {
+            r = finalWrite;
+            }
+        }
+
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionHandles() - END - r: %d", r));
+	return r;
+    }
+
+
+TInt DMemSpyDriverLogChanClientServer::GetServerSessionInfo( TAny* aSessionHandle, TMemSpyDriverServerSessionInfo* aParams )
+    {
+    TMemSpyDriverServerSessionInfo params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverServerSessionInfo) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionInfo() - END - params read error: %d", r));
+        return r;
+        }
+
+    DMemSpyDriverOSAdaptionDSession& sessionAdaption = OSAdaption().DSession();
+    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
+
+	NKern::ThreadEnterCS();
+
+    DSession* session = (DSession*)CheckedOpen(EMemSpyDriverContainerTypeSession, (DObject*)aSessionHandle);
+    if (session == NULL )
+        {
+    	Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionInfo() - END - session not found");
+        NKern::ThreadLeaveCS();
+        return KErrNotFound;
+        }
+
+    session->FullName( params.iName );
+
+    // Get owner type and id
+    DObject* sessionOwner = sessionAdaption.GetOwner( *session );
+    if  ( sessionOwner )
+        {
+        const TObjectType objectType = sessionAdaption.GetObjectType( *sessionOwner );
+        if  ( objectType == EProcess )
+            {
+            DProcess* sessionProcess = (DProcess*) sessionOwner;
+            //
+            params.iOwnerId = processAdaption.GetId( *sessionProcess );
+            params.iOwnerType = TMemSpyDriverServerSessionInfo::EOwnerProcess;
+            }
+        else if ( objectType == EThread )
+            {
+            DThread* sessionThread = (DThread*) sessionOwner;
+            //
+            params.iOwnerId = threadAdaption.GetId( *sessionThread );
+            params.iOwnerType = TMemSpyDriverServerSessionInfo::EOwnerThread;
+            }
+        }
+    else
+        {
+        params.iOwnerId = -1;
+        params.iOwnerType = TMemSpyDriverServerSessionInfo::EOwnerNone;
+        }
+
+    // Other attributes
+    params.iSessionType = sessionAdaption.GetSessionType( *session );
+    params.iAddress = (TUint8*)session;
+	session->Close(NULL);
+	NKern::ThreadLeaveCS();
+    r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverServerSessionInfo) );
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanClientServer::GetServerSessionInfo() - END - r: %d", r));
+	return r;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanCodeSegs.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,336 @@
+/*
+* 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 "MemSpyDriverLogChanCodeSegs.h"
+
+// System includes
+#include <plat_priv.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverOSAdaption.h"
+
+
+
+DMemSpyDriverLogChanCodeSegs::DMemSpyDriverLogChanCodeSegs( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanBase( aDevice, aThread )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::DMemSpyDriverLogChanCodeSegs() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanCodeSegs::~DMemSpyDriverLogChanCodeSegs()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::~DMemSpyDriverLogChanCodeSegs() - START - this: 0x%08x", this ));
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::~DMemSpyDriverLogChanCodeSegs() - END - this: 0x%08x", this ));
+	}
+
+
+
+TInt DMemSpyDriverLogChanCodeSegs::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+	    case EMemSpyDriverOpCodeCodeSegsGetAll:
+		    r = GetCodeSegs( (TMemSpyDriverInternalCodeSnapshotParams*) a1 );
+		    break;
+	    case EMemSpyDriverOpCodeCodeSegsGetCodeSegsForProcess:
+		    r = GetCodeSegsForProcess( (TMemSpyDriverInternalCodeSnapshotParams*) a1 );
+		    break;
+	    case EMemSpyDriverOpCodeCodeSegsGetCodeSegInfo:
+		    r = GetCodeSegInfo( (TMemSpyDriverInternalCodeSegParams*) a1 );
+		    break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+		    }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanCodeSegs::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeCodeSegsBase && aFunction < EMemSpyDriverOpCodeCodeSegsEnd );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanCodeSegs::GetCodeSegs( TMemSpyDriverInternalCodeSnapshotParams* aParams )
+	{
+    TMemSpyDriverInternalCodeSnapshotParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalCodeSnapshotParams) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - END - params read error: %d", r));
+        return r;
+        }
+
+    DMemSpyDriverOSAdaptionDCodeSeg& codeSegAdaption = OSAdaption().DCodeSeg();
+
+	const TInt maxCount = params.iMaxCount;
+	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - START - RAM-only: %d, maxCount: %d", params.iFilter, maxCount));
+	
+    // This is the number of items we have written to the client
+    TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs() - START - maxCount: %d", maxCount));
+    TInt clientWriteCount = 0;
+
+    // Need to get the code segs for each process. We'll let the client worry about filtering
+    // duplicates.
+    DObjectCon* container = Kern::Containers()[ EProcess ];
+	Kern::AccessCode();
+    container->Wait();
+	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 1"));
+    //
+    TFullName name;
+    const TInt count = container->Count();
+	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 2, count: %d", count));
+    for(TInt i=0; i<count && r == KErrNone; i++)
+        {
+        DProcess* process = (DProcess*) (*container)[ i ];
+        process->Name( name );
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 3, proc: %O", process));
+
+        SDblQue queue;
+        //
+        const TInt clientSpaceRemaining = maxCount - clientWriteCount;
+        const TInt numberOfCodeSegs = codeSegAdaption.GetCodeSegQueue( *process, queue );
+        const TInt numberOfCodeSegsToWriteToClient = Min( numberOfCodeSegs, clientSpaceRemaining );
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 4, clientSpaceRemaining: %d", clientSpaceRemaining));
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 5, numberOfCodeSegs: %d", numberOfCodeSegs));
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 6, numberOfCodeSegsToWriteToClient: %d", numberOfCodeSegsToWriteToClient));
+        //
+	    SDblQueLink* link = queue.iA.iNext;
+	    r = KErrNone;
+        //
+	    for( TInt j=0; j<numberOfCodeSegsToWriteToClient && r == KErrNone; ++j, link = link->iNext )
+		    {
+		    DCodeSeg* codeSegment = codeSegAdaption.GetCodeSeg( link );
+
+            // If the client only wants RAM-loaded codesegs, then ignore XIP.
+            TBool writeEntryToClient = ETrue;
+            if  ( params.iFilter )
+                {
+                const TBool isXIP = codeSegAdaption.GetIsXIP( *codeSegment );
+                writeEntryToClient = ( !isXIP );
+                }
+
+            // Now write
+            if  ( writeEntryToClient )
+                {
+                r = Kern::ThreadRawWrite( &ClientThread(), params.iHandles + clientWriteCount, &codeSegment, sizeof(TAny*) );
+    	        TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 7, codeSegment: 0x%08x to client: %d", codeSegment, r));
+                if  ( r == KErrNone )
+                    {
+                    ++clientWriteCount;
+                    }
+                }
+		    }
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 8"));
+        codeSegAdaption.EmptyCodeSegQueue( queue );
+
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 9"));
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 10"));
+    container->Signal();
+	Kern::EndAccessCode();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs - 11 - r: %d", r));
+    if  ( r == KErrBadDescriptor )
+        {
+        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
+        }
+    else
+        {
+        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), params.iCountPtr, &clientWriteCount, sizeof(TInt) );
+        if  ( r == KErrNone )
+            {
+            r = finalWrite;
+            }
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegs() - END - wrote %d handles to client, r: %d", clientWriteCount, r));
+	return r;
+	}
+
+
+TInt DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess( TMemSpyDriverInternalCodeSnapshotParams* aParams )
+	{
+    TMemSpyDriverInternalCodeSnapshotParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalCodeSnapshotParams) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - END - params read error: %d", r));
+        return r;
+        }
+
+    DMemSpyDriverOSAdaptionDCodeSeg& codeSegAdaption = OSAdaption().DCodeSeg();
+
+    const TInt maxCount = params.iMaxCount;
+	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - START - pid: %d, maxCount: %d", params.iFilter, maxCount));
+	
+	r = OpenTempObject( params.iFilter, EProcess );
+	if (r != KErrNone)
+		{
+		Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - END - process not found");
+		return r;
+		}
+		
+	DProcess* pP = (DProcess*) TempObject();
+
+	SDblQue q;
+
+    Kern::AccessCode();
+    const TInt actcount = codeSegAdaption.GetCodeSegQueue( *pP, q );
+
+    CloseTempObject();
+
+	TInt n = Min(actcount, maxCount);
+	SDblQueLink* pL = q.iA.iNext;
+	r = KErrNone;
+    //
+	for (TInt i=0; i<n; ++i, pL = pL->iNext)
+		{
+	    DCodeSeg* pS = codeSegAdaption.GetCodeSeg( pL );
+		
+        r = Kern::ThreadRawWrite( &ClientThread(), params.iHandles + i, &pS, sizeof(TAny*) );
+		if  ( r != KErrNone )
+            {
+			break;
+            }
+		}
+    codeSegAdaption.EmptyCodeSegQueue( q );
+	Kern::EndAccessCode();
+
+	if  (r == KErrBadDescriptor)
+        {
+        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
+        }
+    else
+        {
+        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), params.iCountPtr, &actcount, sizeof(TInt) );
+        if  ( r == KErrNone )
+            {
+            r = finalWrite;
+            }
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegsForProcess() - END - act count: %d, r: %d", actcount, r));
+	return r;
+	}
+
+
+TInt DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo( TMemSpyDriverInternalCodeSegParams* aParams )
+	{
+    TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - START"));
+	TMemSpyDriverInternalCodeSegParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalCodeSegParams) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - END - params read error: %d", r));
+        return r;
+        }
+
+    TMemSpyDriverCodeSegInfo codeSegInfo;
+    codeSegInfo.iSize = 0;
+    
+    // Create info
+    codeSegInfo.iCreateInfo.iFileName.Zero();
+    codeSegInfo.iCreateInfo.iCodeSize = 0;
+    codeSegInfo.iCreateInfo.iTextSize = 0;
+    codeSegInfo.iCreateInfo.iDataSize = 0;
+    codeSegInfo.iCreateInfo.iBssSize = 0;
+    codeSegInfo.iCreateInfo.iTotalDataSize = 0;
+  
+    // Memory Info
+    codeSegInfo.iMemoryInfo.iCodeBase = 0;
+    codeSegInfo.iMemoryInfo.iCodeSize = 0;
+    codeSegInfo.iMemoryInfo.iConstDataBase = 0;
+    codeSegInfo.iMemoryInfo.iConstDataSize = 0;
+    codeSegInfo.iMemoryInfo.iInitialisedDataBase = 0;
+    codeSegInfo.iMemoryInfo.iInitialisedDataSize = 0;
+    codeSegInfo.iMemoryInfo.iUninitialisedDataBase = 0;
+    codeSegInfo.iMemoryInfo.iUninitialisedDataSize = 0;
+
+	DProcess* process = NULL;
+    DMemSpyDriverOSAdaptionDCodeSeg& codeSegAdaption = OSAdaption().DCodeSeg();
+
+	r = KErrNotFound;
+	Kern::AccessCode();
+	DCodeSeg* codeSeg = codeSegAdaption.GetCodeSegFromHandle( params.iHandle );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - codeSeg: 0x%08x, handle: 0x%08x", codeSeg, params.iHandle ));
+
+    if  ( codeSeg != NULL )
+		{
+#ifdef __EPOC32__
+        TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - calling Kern::CodeSegGetMemoryInfo for code seg: %C...", codeSeg ) );
+        Kern::CodeSegGetMemoryInfo( *codeSeg, codeSegInfo.iMemoryInfo, process );
+        r = KErrNone;
+        TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - called Kern::CodeSegGetMemoryInfo, r: %d", r ) );
+#else
+        r = KErrNone;
+#endif
+        //
+		if  ( r == KErrNone )
+			{
+            TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - calling Info...") );
+            codeSegAdaption.GetCreateInfo( *codeSeg, codeSegInfo.iCreateInfo );
+            TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - called info" ) );
+            
+            TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - codeSegInfo.iMemoryInfo.iCodeBase: 0x%08x, codeSegInfo.iMemoryInfo.iCodeSize: %8d", codeSegInfo.iMemoryInfo.iCodeBase, codeSegInfo.iMemoryInfo.iCodeSize ) );
+            codeSegInfo.iSize = codeSegAdaption.GetSize( *codeSeg );
+
+            TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - doing write to user land..." ) );
+            r = Kern::ThreadRawWrite( &ClientThread(), params.iInfoPointer, &codeSegInfo, sizeof(TMemSpyDriverCodeSegInfo) );
+            TRACE( Kern::Printf("DMemSpyDriverLogChanCodeSegs::GetCodeSegInfo() - done write to user-land, r: %d", r ) );
+			}
+		}
+	Kern::EndAccessCode();
+    //
+	if  ( r == KErrBadDescriptor )
+        {
+        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
+        }
+    //
+	return r;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanContainerBase.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,278 @@
+/*
+* 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 "MemSpyDriverLogChanContainerBase.h"
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverOSAdaption.h"
+
+
+DMemSpyDriverLogChanContainerBase::DMemSpyDriverLogChanContainerBase( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanBase( aDevice, aThread )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::DMemSpyDriverLogChanContainerBase() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanContainerBase::~DMemSpyDriverLogChanContainerBase()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::~DMemSpyDriverLogChanContainerBase() - START - this: 0x%08x", this ));
+
+    ResetTempHandles();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::~DMemSpyDriverLogChanContainerBase() - END - this: 0x%08x", this ));
+	}
+
+
+
+
+
+
+DObject* DMemSpyDriverLogChanContainerBase::CheckedOpen(TMemSpyDriverContainerType aContainerType, DObject* aObject, TBool aQuick)
+	{
+	__ASSERT_CRITICAL;
+	__ASSERT_DEBUG(aObject != NULL, MemSpyDriverUtils::Fault( __LINE__ ));
+    const TObjectType expectedType = ObjectTypeFromMemSpyContainerType(aContainerType);
+
+    // Quick mode means we just check container ids and we trust that the object will exist.
+	// [TomS: not entirely convinced we can ever be certain of that]
+    TInt err = KErrNotFound;
+    if (aQuick)
+        {
+		LOG("quick CheckedOpen of %08x", aObject);
+        const TObjectType objectType = OSAdaption().DThread().GetObjectType(*aObject);
+        if (objectType == expectedType)
+            {
+            err = aObject->Open();
+            }
+        }
+	else
+		{
+        DObjectCon* container = Kern::Containers()[expectedType];
+        container->Wait();
+        const TInt count = container->Count();
+        for (TInt i = 0; i < count; i++)
+            {
+            DObject* object = (*container)[i];
+            if (object == aObject)
+                {
+                err = aObject->Open();
+				break;
+				}
+			}
+		container->Signal();
+		}
+
+	LOG("CheckedOpen(%d, 0x%08x, quick=%d) returned error %d", aContainerType, aObject, aQuick, err);
+	return (err == KErrNone) ? aObject : NULL;
+	}
+
+
+
+TObjectType DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType( TMemSpyDriverContainerType aType )
+    {
+    // Map type
+    TObjectType type = EObjectTypeAny;
+    switch( aType )
+        {
+    case EMemSpyDriverContainerTypeThread:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeThread" ));
+        type = EThread;
+        break;
+    case EMemSpyDriverContainerTypeProcess:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeProcess" ));
+        type = EProcess;
+        break;
+    case EMemSpyDriverContainerTypeChunk:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeChunk" ));
+        type = EChunk;
+        break;
+    case EMemSpyDriverContainerTypeLibrary:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeLibrary" ));
+        type = ELibrary;
+        break;
+    case EMemSpyDriverContainerTypeSemaphore:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeSemaphore" ));
+        type = ESemaphore;
+        break;
+    case EMemSpyDriverContainerTypeMutex:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeMutex" ));
+        type = EMutex;
+        break;
+    case EMemSpyDriverContainerTypeTimer:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeTimer" ));
+        type = ETimer;
+        break;
+    case EMemSpyDriverContainerTypeServer:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeServer" ));
+        type = EServer;
+        break;
+    case EMemSpyDriverContainerTypeSession:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeSession" ));
+        type = ESession;
+        break;
+    case EMemSpyDriverContainerTypeLogicalDevice:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeLogicalDevice" ));
+        type = ELogicalDevice;
+        break;
+    case EMemSpyDriverContainerTypePhysicalDevice:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypePhysicalDevice" ));
+        type = EPhysicalDevice;
+        break;
+    case EMemSpyDriverContainerTypeLogicalChannel:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeLogicalChannel" ));
+        type = ELogicalChannel;
+        break;
+    case EMemSpyDriverContainerTypeChangeNotifier:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeChangeNotifier" ));
+        type = EChangeNotifier;
+        break;
+    case EMemSpyDriverContainerTypeUndertaker:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeUndertaker" ));
+        type = EUndertaker;
+        break;
+    case EMemSpyDriverContainerTypeMsgQueue:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeMsgQueue" ));
+        type = EMsgQueue;
+        break;
+    case EMemSpyDriverContainerTypePropertyRef:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypePropertyRef" ));
+        type = EPropertyRef;
+        break;
+    case EMemSpyDriverContainerTypeCondVar:
+ 	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType() - EMemSpyDriverContainerTypeCondVar" ));
+        type = ECondVar;
+        break;
+    default:
+        Kern::Printf("DMemSpyDriverLogChanContainerBase::ObjectTypeFromMemSpyContainerType - unsupported container type: %d", aType);
+        break;
+        }
+    //
+    return type;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    
+
+void DMemSpyDriverLogChanContainerBase::ResetTempHandles()
+    {
+    iTempHandleCount = 0;
+    }
+
+
+void DMemSpyDriverLogChanContainerBase::AddTempHandle( TAny* aHandle )
+    {
+    __ASSERT_ALWAYS( iTempHandleCount >= 0, MemSpyDriverUtils::Fault( __LINE__) );
+    if  ( iTempHandleCount < KMemSpyDriverMaxHandles )
+        {
+        iTempHandles[ iTempHandleCount++ ] = aHandle;
+        }
+    }
+
+
+TAny* DMemSpyDriverLogChanContainerBase::TempHandleAt( TInt aIndex ) const
+    {
+    __ASSERT_ALWAYS( aIndex >= 0 && aIndex < KMemSpyDriverMaxHandles, MemSpyDriverUtils::Fault(__LINE__) );
+    __ASSERT_ALWAYS( aIndex < iTempHandleCount, MemSpyDriverUtils::Fault(__LINE__) );
+    return iTempHandles[ aIndex ];
+    }
+
+
+TInt DMemSpyDriverLogChanContainerBase::TempHandleCount() const
+    {
+    TRACE( Kern::Printf( "DMemSpyDriverLogChanContainerBase::TempHandleCount() - END - count is: %d", iTempHandleCount ));
+    return iTempHandleCount;
+    }
+
+
+TInt DMemSpyDriverLogChanContainerBase::WriteToClient( TAny** aHandlePtr, TInt* aCountPtr, TInt aMaxCount )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::WriteToClient() - START - iTempHandleCount: %d", iTempHandleCount ));
+
+    TInt r = KErrNone;
+
+    // This variable holds the number of handles that we have already
+	// written to the client-side.
+	TInt currentWriteIndex = 0;
+
+    // If the client passed a bad descriptor then we panic it. Otherwise, we always update the amount
+    // of handles we have found (even if there was an error - i.e. we set the value to zero) or else
+    // the client will attempt to index through its huge stack-based handle array.
+	NKern::ThreadEnterCS();
+    TInt tempHandleCount = TempHandleCount();
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::GetContainerHandles - trying to write %d handles to client...", tempHandleCount ));
+
+    for( ; currentWriteIndex<tempHandleCount && r == KErrNone && currentWriteIndex < aMaxCount; )
+        {
+        TAny* handle = TempHandleAt( currentWriteIndex );
+        r = Kern::ThreadRawWrite( &ClientThread(), aHandlePtr + currentWriteIndex, &handle, sizeof(TAny*) );
+        if  (r == KErrNone)
+            {
+            ++currentWriteIndex;
+            }
+        }
+
+	if  ( r == KErrBadDescriptor )
+        {
+        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
+        }
+    else
+        {
+        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), aCountPtr, &currentWriteIndex, sizeof(TInt) );
+        if  ( r == KErrNone )
+            {
+            r = finalWrite;
+            }
+        }
+	NKern::ThreadLeaveCS();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainerBase::GetContainerHandles() - END - r: %d", r));
+	return r;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanContainers.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1076 @@
+/*
+* 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 "MemSpyDriverLogChanContainers.h"
+
+// System includes
+#include <memspy/driver/memspydriverconstants.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverUserEventMonitor.h"
+#include "MemSpyDriverSuspensionManager.h"
+#include "MemSpyDriverOSAdaption.h"
+
+// Constants
+const TInt KMemSpyDriverLogChanContainersXferBufferSize = 1024 * 4;
+
+
+DMemSpyDriverLogChanContainers::DMemSpyDriverLogChanContainers( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanContainerBase( aDevice, aThread )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::DMemSpyDriverLogChanContainers() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanContainers::~DMemSpyDriverLogChanContainers()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::~DMemSpyDriverLogChanContainers() - START - this: 0x%08x", this ));
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::~DMemSpyDriverLogChanContainers() - END - this: 0x%08x", this ));
+	}
+
+
+TInt DMemSpyDriverLogChanContainers::Construct()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::Construct() - START - this: 0x%08x", this ));
+    
+    const TInt ret = BaseConstruct( KMemSpyDriverLogChanContainersXferBufferSize );
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::Construct() - END - this: 0x%08x, err: %d", this, ret ));
+    return ret;
+	}
+
+
+TInt DMemSpyDriverLogChanContainers::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanContainerBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+	    case EMemSpyDriverOpCodeContainersGetHandles:
+            r = GetContainerHandles( (TMemSpyDriverInternalContainerHandleParams*) a1 );
+            break;
+	    case EMemSpyDriverOpCodeContainersGetHandleInfo:
+            r = GetGenericHandleInfo( (TInt) a1, (TMemSpyDriverHandleInfoGeneric*) a2 );
+            break;
+        case EMemSpyDriverOpCodeContainersGetApproxSize:
+            r = GetKernelObjectSizeApproximation( (TMemSpyDriverContainerType) ((TInt) a1), (TInt*) a2 );
+            break;
+        case EMemSpyDriverOpCodeContainersGetReferencesToMyThread:
+            r = GetReferencesToMyThread( (TUint) a1, (TDes8*) a2 );
+            break;
+        case EMemSpyDriverOpCodeContainersGetReferencesToMyProcess:
+            r = GetReferencesToMyProcess( (TUint) a1, (TDes8*) a2 );
+            break;
+        case EMemSpyDriverOpCodeContainersGetPAndSInfo:
+            r = GetPAndSInfo( (DObject*) a1, (TMemSpyDriverPAndSInfo*) a2 );
+            break;
+        case EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreads:
+            r = GetCondVarSuspendedThreads( (TMemSpyDriverInternalCondVarSuspendedThreadParams*)a1 );
+            break;
+        case EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreadInfo:
+            r = GetCondVarSuspendedThreadInfo( a1, (TMemSpyDriverCondVarSuspendedThreadInfo*)a2 );
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+		    }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanContainers::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeContainersBase && aFunction < EMemSpyDriverOpCodeContainersEnd );
+    }
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanContainers::GetContainerHandles( TMemSpyDriverInternalContainerHandleParams* aParams )
+	{
+    TMemSpyDriverInternalContainerHandleParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalContainerHandleParams) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles() - END - params read error: %d", r));
+        return r;
+        }
+
+	const TInt maxCount = params.iMaxCount;
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles() - START - tid or pid: %d, maxCount: %d, container: %d, handleSource: %d", params.iTidOrPid, maxCount, params.iContainer, params.iHandleSource ));
+
+    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
+
+    ResetTempHandles();
+
+    if  ( params.iTidOrPid == KMemSpyDriverEnumerateContainerHandles )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - enumerating container handles... " ));
+	    NKern::ThreadEnterCS();
+
+        // We are enumerating an entire container - not a thread-specific request
+        const TObjectType type = ObjectTypeFromMemSpyContainerType( params.iContainer );
+
+        DObjectCon* container = Kern::Containers()[type];
+        container->Wait();
+
+        const TInt count = container->Count();
+        for(TInt i=0; i<count; i++)
+            {
+            DObject* object = (*container)[ i ];
+            if  ( object != NULL )
+                {
+                AddTempHandle( object );
+                }
+            }
+
+        container->Signal();
+    	NKern::ThreadLeaveCS();
+        }
+    else
+        {
+        // Are we dealing with threads or processes?
+        const TObjectType sourceContainerType = (TObjectType) params.iHandleSource;
+        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - sourceContainerType: %d", sourceContainerType ));
+
+        // We need to open the process or thread in order to get its handle
+        r = OpenTempObject( params.iTidOrPid, sourceContainerType );
+        if  ( r == KErrNone )
+		    {
+            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - handle source object: %O", TempObject() ));
+
+            // This is the source for the handles we want to check. Its either the process or thread's handle index...
+            MemSpyObjectIx* handles = NULL;
+
+            // Check that the process' thread's are suspended and get handle index
+            if  ( params.iHandleSource == EMemSpyDriverThreadOrProcessTypeThread )
+                {
+                DThread* thread = (DThread*) TempObject();
+                if  ( !SuspensionManager().IsSuspended( *thread ) )
+                    {
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - parent process not suspended => KErrAccessDenied"));
+                    r = KErrAccessDenied;
+                    }
+                else
+                    {
+                    handles = threadAdaption.GetHandles( *thread );
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - checking handles for thread: %O", thread ));
+                    }
+                }
+            else if ( params.iHandleSource == EMemSpyDriverThreadOrProcessTypeProcess )
+                {
+                DProcess* process = (DProcess*) TempObject();
+                if  ( !SuspensionManager().IsSuspended( *process ) )
+                    {
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - process not suspended => KErrAccessDenied"));
+                    r =KErrAccessDenied;
+                    }
+                else
+                    {
+                    handles = processAdaption.GetHandles( *process );
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - checking handles for process: %O", process ));
+                    }
+                }
+
+            if  ( handles )
+                {
+	            NKern::ThreadEnterCS();
+
+                // Iterate through each handle in the thread/process and add it to the temp handles container if
+                // the handle is of the correct type.
+
+				MemSpyObjectIx_HandleLookupLock();
+				const TInt handleCount = handles->Count();
+				MemSpyObjectIx_HandleLookupUnlock();
+                TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - %d handles in index...", handleCount ));
+
+                for( TInt handleIndex=0; handleIndex<handleCount; handleIndex++ )
+    	            {
+    	            // Get a handle from the container...
+					MemSpyObjectIx_HandleLookupLock();
+					if (handleIndex >= handles->Count()) break; // Count may have changed in the meantime
+    				DObject* objectToSearchFor = (*handles)[ handleIndex ];
+					if (objectToSearchFor && objectToSearchFor->Open() != KErrNone) objectToSearchFor = NULL;
+					MemSpyObjectIx_HandleLookupUnlock();
+        
+                    if (objectToSearchFor && OSAdaption().DThread().GetObjectType(*objectToSearchFor) == ObjectTypeFromMemSpyContainerType(params.iContainer))
+                        {
+                        // Found a match in the specified container. Write the object's handle (aka the object address)
+                        // back to the client address space
+                        AddTempHandle( objectToSearchFor );
+                        }
+					if (objectToSearchFor) objectToSearchFor->Close(NULL);
+    	            }
+
+                NKern::ThreadLeaveCS();
+                }
+
+            // Done with this now.
+            CloseTempObject();
+            }
+        else
+		    {
+    	    Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - thread / process not found");
+		    }
+        }
+
+    // Write back handles to client
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - trying to write %d handles to client...", TempHandleCount() ));
+    r = WriteToClient( params.iHandles, params.iCountPtr, maxCount );
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles() - END - r: %d", r));
+	return r;
+    }
+
+
+TInt DMemSpyDriverLogChanContainers::GetGenericHandleInfo( TInt aTid, TMemSpyDriverHandleInfoGeneric* aParams )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - START" ));
+
+    TMemSpyDriverHandleInfoGeneric params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverHandleInfoGeneric) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - END - params read error: %d", r));
+        return r;
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo  - tid: %d, handle: 0x%08x", aTid, params.iHandle ));
+    
+    if  ( aTid == KMemSpyDriverEnumerateContainerHandles )
+        {
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - getting info for non-thread specific handle..."));
+        }
+    else
+        {
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - thread-specific request..."));
+
+        r = OpenTempObject( aTid, EThread );
+	    if (r != KErrNone)
+		    {
+    	    Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - END - thread not found");
+		    return r;
+		    }
+    
+        // Check that the process' thread's are suspended
+        DThread* thread = (DThread*) TempObject();
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - opened thread: %O", thread));
+        if  ( !SuspensionManager().IsSuspended( *thread ) )
+            {
+            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - END - parent process not suspended => KErrAccessDenied"));
+            CloseTempObject();
+            return KErrAccessDenied;
+            }
+        }
+
+	NKern::ThreadEnterCS();
+
+    // First, locate the specific DObject in question. Cast the handle, but don't use the object...
+    DObject* handleAsObject = (DObject*) params.iHandle;
+    handleAsObject = CheckedOpen(params.iType, handleAsObject);
+    if  ( handleAsObject != NULL )
+        {
+        // We found the right object. First get generic info.
+        handleAsObject->FullName( params.iName );
+        handleAsObject->Name( params.iNameDetail );
+        
+        // Using threadAddaption to fetch generic info.
+        // Implementations of following get functions are actually in DMemSpyDriverOSAdaptionDObject
+        // so it does not matter what adaption to use for generic info.
+        DMemSpyDriverOSAdaptionDThread& threadAddaption = OSAdaption().DThread();
+        params.iAccessCount = threadAddaption.GetAccessCount( *handleAsObject );
+        params.iUniqueID = threadAddaption.GetUniqueID( *handleAsObject );
+        params.iProtection = threadAddaption.GetProtection( *handleAsObject );
+        params.iAddressOfKernelOwner = threadAddaption.GetAddressOfKernelOwner( *handleAsObject );
+        
+        // Get type-specific info.
+        if  ( params.iType == EMemSpyDriverContainerTypeThread )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeThread" ));
+
+            DThread* object = (DThread*) handleAsObject;
+            DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+            //
+            params.iId = threadAdaption.GetId( *object );
+            params.iPriority = threadAdaption.GetPriority( *object );
+            params.iAddressOfOwningProcess = threadAdaption.GetAddressOfOwningProcess( *object );
+            threadAdaption.GetNameOfOwningProcess( *object, params.iNameOfOwner );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeProcess )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeProcess" ));
+
+            DProcess* object = (DProcess*) handleAsObject;
+            DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
+            //
+            params.iId = processAdaption.GetId( *object );
+            //
+            params.iPriority = processAdaption.GetPriority( *object );
+            params.iAddressOfOwningProcess = processAdaption.GetAddressOfOwningProcess( *object );
+            params.iCreatorId = processAdaption.GetCreatorId( *object );
+            params.iSecurityZone = processAdaption.GetSecurityZone( *object );
+            params.iAttributes = processAdaption.GetAttributes( *object );
+            params.iAddressOfDataBssStackChunk = processAdaption.GetAddressOfDataBssStackChunk( *object );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeChunk )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChunk" ));
+
+            DChunk* object = (DChunk*) handleAsObject;
+            DMemSpyDriverOSAdaptionDChunk& ca = OSAdaption().DChunk();
+            //
+            params.iSize = ca.GetSize( *object );
+            params.iId = ca.GetOwningProcessId( *object );
+            params.iAddressOfOwningProcess = ca.GetAddressOfOwningProcess( *object );
+            params.iMaxSize = ca.GetMaxSize( *object );
+            params.iBottom = ca.GetBottom( *object );
+            params.iTop = ca.GetTop( *object );
+            params.iAttributes = ca.GetAttributes( *object );
+            params.iStartPos = ca.GetStartPos( *object );
+            params.iControllingOwner = ca.GetControllingOwnerId( *object );
+            params.iRestrictions = ca.GetRestrictions( *object );
+            params.iMapAttr = ca.GetMapAttr( *object );
+            params.iChunkType = ca.GetType( *object );
+            ca.GetNameOfOwningProcess( *object, params.iNameOfOwner );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeLibrary )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLibrary" ));
+
+	        Kern::AccessCode();
+            //
+            DLibrary* object = (DLibrary*) handleAsObject;
+            DMemSpyDriverOSAdaptionDCodeSeg& csa = OSAdaption().DCodeSeg();
+            DCodeSeg* codeSeg = csa.GetCodeSeg( *object );
+            params.iAddressOfCodeSeg = (TUint8*)codeSeg;
+            params.iMapCount = csa.GetMapCount( *object );
+            params.iState = csa.GetState( *object );
+            //
+            if  ( codeSeg )
+                {
+                params.iSize = csa.GetSize( *codeSeg );
+                }
+            else
+                {
+                r = KErrNotFound;
+                }
+            //
+	        Kern::EndAccessCode();
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeSemaphore )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSemaphore" ));
+
+            DSemaphore* object = (DSemaphore*) handleAsObject;
+            DMemSpyDriverOSAdaptionDSemaphore& sa = OSAdaption().DSemaphore();
+            params.iCount = sa.GetCount( *object );
+            params.iResetting = sa.GetResetting( *object );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeMutex )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMutex" ));
+
+            DMutex* object = (DMutex*) handleAsObject;
+            DMemSpyDriverOSAdaptionDMutex& ma = OSAdaption().DMutex();
+            //
+            params.iCount = ma.GetHoldCount( *object );
+            params.iWaitCount = ma.GetWaitCount( *object );
+            params.iResetting = ma.GetResetting( *object );
+            params.iOrder = ma.GetOrder( *object );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeTimer )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeTimer" ));
+
+            // Get timer properties
+            DTimer* object = (DTimer*) handleAsObject;
+            DMemSpyDriverOSAdaptionDTimer& ta = OSAdaption().DTimer();
+            //
+            params.iTimerType = MapToMemSpyTimerType( ta.GetType( *object ) );
+            params.iTimerState = MapToMemSpyTimerState( ta.GetState( *object ) );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeServer )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeServer" ));
+
+            DServer* object = (DServer*) handleAsObject;
+            DMemSpyDriverOSAdaptionDServer& sa = OSAdaption().DServer();
+            //
+            params.iCount = sa.GetSessionCount( *object );
+            params.iId = sa.GetOwningThreadId( *object );
+            params.iSessionType = sa.GetSessionType( *object );
+            params.iAddressOfOwningThread = sa.GetAddressOfOwningThread( *object );
+            sa.GetNameOfOwningThread( *object, params.iNameOfOwner );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeSession )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSession" ));
+
+            DSession* object = (DSession*) handleAsObject;
+            DMemSpyDriverOSAdaptionDServer& serverAdaption = OSAdaption().DServer();
+            DMemSpyDriverOSAdaptionDSession& sessionAdaption = OSAdaption().DSession();
+
+            params.iName.Zero();
+
+            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting session type..." ));
+            params.iSessionType = sessionAdaption.GetSessionType( *object );
+            params.iAddressOfServer = sessionAdaption.GetAddressOfServer( *object );
+            params.iTotalAccessCount = sessionAdaption.GetTotalAccessCount( *object );
+            params.iSvrSessionType = sessionAdaption.GetSessionType( *object );
+            params.iMsgCount = sessionAdaption.GetMsgCount( *object );
+            params.iMsgLimit = sessionAdaption.GetMsgLimit( *object );
+            
+            // Its more useful in this instance, if the name object
+            // points to the server which the session is connected to
+            // (rather than displaying a process-local name).
+            DServer* server = (DServer*)CheckedOpen(EMemSpyDriverContainerTypeServer, sessionAdaption.GetServer( *object ));
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting full name, server: 0x%08x", server ));
+            //
+            if  ( server )
+                {
+                server->FullName( params.iName );
+
+                // Continue as normal for other items
+	            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - server: 0x%08x, server->iOwningThread: 0x%08x", server, server->iOwningThread ));
+                DThread* owningThread = serverAdaption.GetOwningThread( *server );
+                if  ( owningThread )
+                    {
+	                TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting server thread id..." ));
+                    params.iId = serverAdaption.GetOwningThreadId( *server );
+                    }
+
+                server->Close(NULL);
+                }
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeLogicalDevice )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalDevice" ));
+
+            DLogicalDevice* object = (DLogicalDevice*) handleAsObject;
+            DMemSpyDriverOSAdaptionDLogicalDevice& lda = OSAdaption().DLogicalDevice();
+            params.iOpenChannels = lda.GetOpenChannels( *object );
+            params.iVersion = lda.GetVersion( *object );
+            params.iParseMask = lda.GetParseMask( *object );
+            params.iUnitsMask = lda.GetUnitsMask( *object );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypePhysicalDevice )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypePhysicalDevice" ));
+	        
+	        DPhysicalDevice* object = (DPhysicalDevice*) handleAsObject;
+            DMemSpyDriverOSAdaptionDPhysicalDevice& pda = OSAdaption().DPhysicalDevice();
+            params.iVersion = pda.GetVersion( *object );
+            params.iUnitsMask = pda.GetUnitsMask( *object );
+            params.iAddressOfCodeSeg = pda.GetAddressOfCodeSeg( *object );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeLogicalChannel )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalChannel" ));
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeChangeNotifier )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChangeNotifier" ));
+
+	        DChangeNotifier* object = (DChangeNotifier*) handleAsObject;
+            DMemSpyDriverOSAdaptionDChangeNotifier& cna = OSAdaption().DChangeNotifier();
+            params.iChanges = cna.GetChanges( *object );
+            params.iAddressOfOwningThread = cna.GetAddressOfOwningThread( *object );
+            cna.GetNameOfOwningThread( *object, params.iNameOfOwner );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeUndertaker )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeUndertaker" ));
+	        
+            DUndertaker* object = (DUndertaker*) handleAsObject;
+            DMemSpyDriverOSAdaptionDUndertaker& uta = OSAdaption().DUndertaker();
+            params.iAddressOfOwningThread = uta.GetAddressOfOwningThread( *object );
+            uta.GetNameOfOwningThread( *object, params.iNameOfOwner );
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeMsgQueue )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMsgQueue" ));
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypePropertyRef )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypePropertyRef" ));
+            }
+        else if ( params.iType == EMemSpyDriverContainerTypeCondVar )
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeCondVar" ));
+	        
+            DCondVar* object = (DCondVar*) handleAsObject;
+            DMemSpyDriverOSAdaptionDCondVar& cva = OSAdaption().DCondVar();
+            params.iResetting = cva.GetResetting( *object );
+            params.iAddressOfOwningThread = cva.GetAddressOfMutex( *object );
+            cva.GetNameOfMutex( *object, params.iNameOfOwner );
+            params.iWaitCount = cva.GetWaitCount( *object );
+            }
+        else
+            {
+	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - KErrNotSupported" ));
+            r = KErrNotSupported;
+            }
+		handleAsObject->Close(NULL);
+        }
+    else
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - couldn not find object => KErrNotFound"));
+        r = KErrNotFound;
+        }
+
+	NKern::ThreadLeaveCS();
+
+    if  ( r == KErrNone )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - writing back to client thread..."));
+        r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverHandleInfoGeneric) );
+        }
+    if  ( TempObject() != NULL )
+        {
+    	CloseTempObject();
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - END - r: %d", r));
+	return r;
+    }
+
+
+TInt DMemSpyDriverLogChanContainers::GetKernelObjectSizeApproximation( TMemSpyDriverContainerType aType, TInt* aSize )
+    {
+    TInt r = KErrNone;
+    //
+	TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetKernelObjectSizeApproximation() - START - aType: %d", aType));
+    const TObjectType objectType = ObjectTypeFromMemSpyContainerType( aType );
+    //
+    TInt size = 0;
+    //
+    switch( objectType )
+        {
+    case EThread:
+        size = sizeof(DThread);
+        break;
+    case EProcess:
+        size = sizeof(DProcess);
+        break;
+    case EChunk:
+        size = sizeof(DChunk);
+        break;
+    case ELibrary:
+        size = sizeof(DLibrary);
+        break;
+    case ESemaphore:
+        size = sizeof(DSemaphore);
+        break;
+    case EMutex:
+        size = sizeof(DMutex);
+        break;
+    case ETimer:
+        size = sizeof(DTimer);
+        break;
+    case EServer:
+        size = sizeof(DServer);
+        break;
+    case ESession:
+        size = sizeof(DSession);
+        break;
+    case ELogicalDevice:
+        size = sizeof(DLogicalDevice);
+        break;
+    case EPhysicalDevice:
+        size = sizeof(DPhysicalDevice);
+        break;
+    case ELogicalChannel:
+        size = sizeof(DLogicalChannel);
+        break;
+    case EChangeNotifier:
+        size = sizeof(DChangeNotifier);
+        break;
+    case EUndertaker:
+        size = sizeof(DUndertaker);
+        break;
+    case EMsgQueue:
+        size = sizeof(DObject); // best we can do!
+        break;
+    case EPropertyRef:
+        size = sizeof(DObject); // best we can do!
+        break;
+    case ECondVar:
+        size = sizeof(DCondVar);
+        break;
+    default:
+        break;
+        }
+    //
+    NKern::ThreadEnterCS();
+    r = Kern::ThreadRawWrite( &ClientThread(), aSize, &size, sizeof(TInt) );
+	NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetKernelObjectSizeApproximation() - END - r: %d, size; %d", r, size));
+	return r;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanContainers::GetReferencesToMyThread( TUint aTid, TDes8* aBufferSink )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetReferencesToMyThread() - START - aTid: %d", aTid ));
+
+    // We open the source thread or process, just to ensure it doesn't die underneath us...
+    TInt r = OpenTempObject( aTid, EThread );
+    if  ( r == KErrNone )
+		{
+		TInt count = 0;
+		
+        // Open stream
+        RMemSpyMemStreamWriter stream = OpenXferStream();
+
+        // Get references to this thread by searching the handles of other threads
+        TInt32* pCountMarkerThread = stream.WriteInt32( 0 );
+        count = SearchThreadsFor( TempObject(), stream );
+        *pCountMarkerThread = count;
+
+        // Get references to this thread by searching the handles of other processes
+        TInt32* pCountMarkerProcess = stream.WriteInt32( 0 );
+        count = SearchProcessFor( TempObject(), stream );
+        *pCountMarkerProcess = count;
+
+        // Tidy up
+        r = stream.WriteAndClose( aBufferSink );
+
+        CloseTempObject();
+        }
+                
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetReferencesToMyThread() - END - r: %d", r));
+	return r;
+    }
+
+
+TInt DMemSpyDriverLogChanContainers::GetReferencesToMyProcess( TUint aPid, TDes8* aBufferSink )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetReferencesToMyProcess() - START - aPid: %d", aPid ));
+
+    // We open the source thread or process, just to ensure it doesn't die underneath us...
+    TInt r = OpenTempObject( aPid, EProcess );
+    if  ( r == KErrNone )
+		{
+		TInt count = 0;
+		
+        // Open stream
+        RMemSpyMemStreamWriter stream = OpenXferStream();
+
+        // Get references to this thread by searching the handles of other threads
+        TInt32* pCountMarkerThread = stream.WriteInt32( 0 );
+        count = SearchThreadsFor( TempObject(), stream );
+        *pCountMarkerThread = count;
+
+        // Get references to this thread by searching the handles of other processes
+        TInt32* pCountMarkerProcess = stream.WriteInt32( 0 );
+        count = SearchProcessFor( TempObject(), stream );
+        *pCountMarkerProcess = count;
+
+        // Tidy up
+        r = stream.WriteAndClose( aBufferSink );
+
+        CloseTempObject();
+        }
+                
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetReferencesToMyProcess() - END - r: %d", r));
+	return r;
+    }
+
+
+TInt DMemSpyDriverLogChanContainers::GetPAndSInfo( DObject* aHandle, TMemSpyDriverPAndSInfo* aInfo )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - START - aHandle: 0x%08x", aHandle ));
+
+    TInt r = KErrNotFound;
+	NKern::ThreadEnterCS();
+
+    // First, locate the specific DObject in question. Cast the handle, but don't use the object...
+    DObject* object = CheckedOpen(EMemSpyDriverContainerTypePropertyRef, aHandle);
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - handle search returned: 0x%08x", object ));
+
+    if  ( object != NULL )
+        {
+        NKern::LockSystem(); // Keep this, the DPropertyRef APIs use it -TomS
+
+        DMemSpyDriverOSAdaptionDPropertyRef& pra = OSAdaption().DPropertyRef();
+        const TBool isReady = pra.GetIsReady( *object );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - isReady: %d", isReady ));
+
+        if  ( isReady )
+            {
+            TMemSpyDriverPAndSInfo params;
+            //
+            params.iType = pra.GetType( *object );
+            params.iCategory = pra.GetCategory( *object );
+            params.iKey = pra.GetKey( *object );
+            params.iRefCount = pra.GetRefCount( *object );
+            params.iTid = pra.GetThreadId( *object );
+            params.iCreatorSID = pra.GetCreatorSID( *object );
+            //
+            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo - writing back to client thread..."));
+            r = Kern::ThreadRawWrite( &ClientThread(), aInfo, &params, sizeof( TMemSpyDriverPAndSInfo ) );
+            }
+        else
+            {
+            r = KErrNotReady;
+            }
+
+        NKern::UnlockSystem();
+		object->Close(NULL);
+        }
+
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - END - r: %d", r));
+    return r;
+    }
+
+
+TInt DMemSpyDriverLogChanContainers::GetCondVarSuspendedThreads( TMemSpyDriverInternalCondVarSuspendedThreadParams* aParams )
+    {
+    
+    TMemSpyDriverInternalCondVarSuspendedThreadParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalCondVarSuspendedThreadParams) );
+    if  ( r != KErrNone )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - params read error: %d", r));
+        return r;
+        }
+    
+    DMemSpyDriverOSAdaptionDCondVar& condVarAdaption = OSAdaption().DCondVar();
+    
+    const TInt maxCount = params.iMaxCount;
+    NKern::ThreadEnterCS();
+    
+    DObject* condVarHandle = (DObject*) params.iCondVarHandle;
+    condVarHandle = CheckedOpen(EMemSpyDriverContainerTypeCondVar, condVarHandle);
+    if  ( condVarHandle == NULL )
+        {
+        Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - condVar not found");
+        NKern::ThreadLeaveCS();
+        return KErrNotFound;
+        }
+    
+    ResetTempHandles();
+        
+    DCondVar* condVar = (DCondVar*) condVarHandle;
+    
+    NKern::LockSystem(); // Keep this, needed for iterating suspended queue -TomS
+
+    // Iterate through suspended threads, writing back thread pointer (handle)
+    // to client
+    SDblQue& suspQueue = condVarAdaption.GetSuspendedQ( *condVar );
+    SDblQueLink* anchor = &suspQueue.iA;
+    SDblQueLink* link = suspQueue.First();
+    while( link != anchor )
+        {
+        DThread* thread = condVarAdaption.GetThread( link );
+
+        // Found a match in the specified container. Write the object's handle (aka the object address)
+        // back to the client address space
+        if  ( thread )
+            {
+            AddTempHandle( thread );
+            }
+
+        // Get next item
+        link = link->iNext;
+        }
+
+    NKern::UnlockSystem();
+
+    // This variable holds the number of handles that we have already
+    // written to the client-side.
+    TInt currentWriteIndex = 0;
+    const TInt handleCount = TempHandleCount();
+    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs - writing %d handles to client...", handleCount ) );
+    for( ; currentWriteIndex<handleCount && r == KErrNone && currentWriteIndex < maxCount; )
+        {
+        TAny* handle = TempHandleAt( currentWriteIndex );
+        r = Kern::ThreadRawWrite( &ClientThread(), params.iThrHandles + currentWriteIndex, &handle, sizeof(TAny*) );
+        if  (r == KErrNone)
+            {
+            ++currentWriteIndex;
+            }
+        }
+
+    if  ( r == KErrBadDescriptor )
+        {
+        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
+        }
+    else
+        {
+        const TInt finalWrite = Kern::ThreadRawWrite( &ClientThread(), params.iThrCountPtr, &currentWriteIndex, sizeof(TInt) );
+        if  ( r == KErrNone )
+            {
+            r = finalWrite;
+            }
+        }
+
+	condVarHandle->Close(NULL);
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - r: %d", r));
+    return r;
+    }
+
+
+TInt DMemSpyDriverLogChanContainers::GetCondVarSuspendedThreadInfo( TAny* aThreadHandle, TMemSpyDriverCondVarSuspendedThreadInfo* aParams )
+    {
+    TMemSpyDriverCondVarSuspendedThreadInfo params;
+    
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverCondVarSuspendedThreadInfo) );
+    if  ( r != KErrNone )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - params read error: %d", r));
+        return r;
+        }
+    
+    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+
+    NKern::ThreadEnterCS();
+
+    DObject* threadHandle = (DObject*) aThreadHandle;
+    threadHandle = CheckedOpen(EMemSpyDriverContainerTypeThread, threadHandle);
+    if  ( threadHandle == NULL )
+        {
+        Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - thread not found");
+        NKern::ThreadLeaveCS();
+        return KErrNotFound;
+        }
+
+    DThread* thread = (DThread*) threadHandle;
+    thread->FullName( params.iName );
+    params.iAddress = (TUint8*)thread;
+
+    if  ( r == KErrNone )
+        {
+        r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverCondVarSuspendedThreadInfo) );
+        }
+    
+	threadHandle->Close(NULL);
+    NKern::ThreadLeaveCS();
+    
+    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - r: %d", r));
+    return r;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanContainers::SearchThreadsFor( DObject* aHandleToLookFor, RMemSpyMemStreamWriter& aStream )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor() - START" ) );
+
+    TInt matches = 0;
+    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+   
+    DObjectCon* container = Kern::Containers()[ EThread ];
+    NKern::ThreadEnterCS();
+    container->Wait();
+
+    const TInt containerEntryCount = container->Count();
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - containerEntryCount: %d", containerEntryCount ));
+
+    for( TInt i=0; i<containerEntryCount && !aStream.IsFull(); i++ )
+        {
+        DThread* thread = (DThread*) (*container)[ i ];
+        MemSpyObjectIx* handles = threadAdaption.GetHandles( *thread );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - handles: 0x%08x", handles ));
+
+        if  ( handles != NULL )
+            {
+            TBool found = handles->Find( aHandleToLookFor );
+	        if (found)
+		        {
+                TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - found handle match in [%O]", thread ));
+                aStream.WriteUint32( (TUint32) thread );
+                ++matches;
+		        }
+            }
+        }
+
+    // Finished with thread/process container.
+    container->Signal();
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor() - END" ) );
+    return matches;
+    }
+
+
+TInt DMemSpyDriverLogChanContainers::SearchProcessFor( DObject* aHandleToLookFor, RMemSpyMemStreamWriter& aStream )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor() - START" ) );
+
+    TInt matches = 0;
+    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
+  
+    DObjectCon* container = Kern::Containers()[ EProcess ];
+    NKern::ThreadEnterCS();
+    container->Wait();
+
+    const TInt containerEntryCount = container->Count();
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - containerEntryCount: %d", containerEntryCount ));
+
+    for( TInt i=0; i<containerEntryCount && !aStream.IsFull(); i++ )
+        {
+        DProcess* process = (DProcess*) (*container)[ i ];
+        MemSpyObjectIx* handles = processAdaption.GetHandles( *process );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - handles: 0x%08x", handles ));
+
+        if  ( handles != NULL )
+            {
+            TBool found = handles->Find( aHandleToLookFor );
+	        if  ( found )
+		        {
+                TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - found handle match in [%O]", process ));
+                aStream.WriteUint32( (TUint32) process );
+                ++matches;
+		        }
+            }
+        }
+
+    // Finished with thread/process container.
+    container->Signal();
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor() - END" ) );
+    return matches;
+    }    
+
+
+TMemSpyDriverTimerState DMemSpyDriverLogChanContainers::MapToMemSpyTimerState( TTimer::TTimerState aState )
+    {
+    TMemSpyDriverTimerState ret = EMemSpyDriverTimerStateUnknown;
+    //
+    switch( aState )
+        {
+    case TTimer::EIdle:
+        ret = EMemSpyDriverTimerStateIdle;
+        break;
+    case TTimer::EWaiting:
+        ret = EMemSpyDriverTimerStateWaiting;
+        break;
+    case TTimer::EWaitHighRes:
+        ret = EMemSpyDriverTimerStateWaitHighRes;
+        break;
+    default:
+        break;
+        }
+    //
+    return ret;
+    }
+
+ 
+TMemSpyDriverTimerType DMemSpyDriverLogChanContainers::MapToMemSpyTimerType( TTimer::TTimerType aType )
+    {
+    TMemSpyDriverTimerType ret = EMemSpyDriverTimerTypeUnknown;
+    //
+    switch( aType )
+        {
+    case TTimer::ERelative:
+    case TTimer::ELocked:
+        ret = EMemSpyDriverTimerTypeRelative;
+        break;
+    case TTimer::EAbsolute:
+        ret = EMemSpyDriverTimerTypeAbsolute;
+        break;
+    case TTimer::EHighRes:
+        ret = EMemSpyDriverTimerTypeHighRes;
+        break;
+    case TTimer::EInactivity:
+        ret = EMemSpyDriverTimerTypeInactivity;
+        break;
+    default:
+        break;
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapBase.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,567 @@
+/*
+* 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 "MemSpyDriverLogChanHeapBase.h"
+
+// System includes
+#include <u32hal.h>
+#include <e32rom.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"
+
+// Constants
+const TInt KMemSpyDriverLogChanHeapBaseXferBufferSize = 1024 * 16;
+
+
+
+
+DMemSpyDriverLogChanHeapBase::DMemSpyDriverLogChanHeapBase( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:	DMemSpyDriverLogChanBase( aDevice, aThread )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::DMemSpyDriverLogChanHeapBase() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanHeapBase::~DMemSpyDriverLogChanHeapBase()
+	{
+	}
+
+
+TInt DMemSpyDriverLogChanHeapBase::Construct()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::Construct() - START - this: 0x%08x", this ));
+    
+    const TInt ret = BaseConstruct( KMemSpyDriverLogChanHeapBaseXferBufferSize );
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::Construct() - END - this: 0x%08x, err: %d", this, ret ));
+    return ret;
+	}
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanHeapBase::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	const TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
+    return r;
+	}
+
+
+
+
+
+
+
+
+
+
+
+
+
+DMemSpyDriverLogChanHeapBase::TDrmMatchType DMemSpyDriverLogChanHeapBase::IsDrmThread( DThread& aThread )
+    {
+    TDrmMatchType ret = EMatchTypeNone;
+    //
+    const TUid procUid = aThread.iOwningProcess->iUids.iUid[ 2 ];
+    TRACE( Kern::Printf( "DMemSpyDriverLogChanHeapBase::IsDrmThread() - START - aThread: %O, process uid: 0x%08x", &aThread, procUid.iUid ));
+
+    // Some more rudimentary checks based upon process name and
+    // known uids.
+    TFullName fullName;
+    aThread.FullName( fullName );
+
+    // Exclude threads containing "DRM"
+    _LIT( KDrmThreadMatchText, "*DRM*" );
+    const TInt matchPos = fullName.MatchF( KDrmThreadMatchText );
+    if ( matchPos >= 0 )
+        {
+        TRACE( Kern::Printf( "DMemSpyDriverLogChanHeapBase::IsDrmThread() - found \'DRM\' at pos: %d (%S)", matchPos, &fullName ));
+        ret = EMatchTypeName;
+        }
+    else
+        {
+        // Some known DRM related process UIDs
+        switch( procUid.iUid )
+            {
+        case 0x10005A22: // DRMEncryptor.exe
+        case 0x01105901: // DRMEncryptor.exe
+        case 0x101F85C7: // DRMRightsManager.exe
+        case 0x10205CA8: // DcfRepSrv.exe
+        case 0x101F51F2: // RightsServer.exe
+        case 0x101F6DC5: // DRMHelperServer.exe
+        case 0x10282F1B: // wmdrmserver.exe
+            ret = EMatchTypeUid;
+            break;
+        default:
+            ret = EMatchTypeNone;
+            break;
+            }
+        }
+
+    TRACE( Kern::Printf( "DMemSpyDriverLogChanHeapBase::IsDrmThread() - END - procUid: 0x%08x, matchType: %d", procUid.iUid, ret ));
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+void DMemSpyDriverLogChanHeapBase::PrintHeapInfo( const TMemSpyHeapInfo& aInfo )
+    {
+    const TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
+    //const TMemSpyHeapObjectDataRHeap& rHeapObjectData = rHeapInfo.ObjectData();
+    const TMemSpyHeapStatisticsRHeap& rHeapStats = rHeapInfo.Statistics();
+    const TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - Stats (Free)                                    -" ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell count:                     %d", rHeapStats.StatsFree().TypeCount() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell size:                      %d", rHeapStats.StatsFree().TypeSize() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell largest:                   0x%08x", rHeapStats.StatsFree().LargestCellAddress() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell largest size:              %d", rHeapStats.StatsFree().LargestCellSize() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - slack:                          0x%08x", rHeapStats.StatsFree().SlackSpaceCellAddress() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - slack size:                     %d", rHeapStats.StatsFree().SlackSpaceCellSize() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - checksum:                       0x%08x", rHeapStats.StatsFree().Checksum() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - " ) );
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - Stats (Alloc)                                   -" ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell count:                     %d", rHeapStats.StatsAllocated().TypeCount() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell size:                      %d", rHeapStats.StatsAllocated().TypeSize() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell largest:                   0x%08x", rHeapStats.StatsAllocated().LargestCellAddress() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell largest size:              %d", rHeapStats.StatsAllocated().LargestCellSize() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - " ) );
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - Misc. Info                                      -" ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() ---------------------------------------------------" ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - chunk size:                     %d", rHeapMetaData.ChunkSize() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - chunk handle:                   0x%08x", rHeapMetaData.ChunkHandle() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - chunk base address:             0x%08x", rHeapMetaData.ChunkBaseAddress() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - debug allocator:                %d", rHeapMetaData.IsDebugAllocator() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - shared heap:                    %d", rHeapMetaData.IsSharedHeap() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - user thread:                    %d", rHeapMetaData.IsUserThread() ) );
+    //TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell header size (free):        %d", rHeapMetaData.HeaderSizeFree() ) );
+    //TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - cell header size (alloc):       %d", rHeapMetaData.HeaderSizeAllocated() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - heap vTable:                    0x%08x", rHeapMetaData.VTable() ) );
+    //TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - heap object size:               %d", rHeapMetaData.ClassSize() ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - heap size:                      %d", rHeapMetaData.iHeapSize ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - allocator address:              0x%08x", rHeapMetaData.iAllocatorAddress ) );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - min heap size:                  %d", rHeapMetaData.iMinHeapSize ) );
+    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;
+    }
+
+
+
+
+
+
+
+
+
+
+    
+
+
+
+
+
+
+TBool DMemSpyDriverLogChanHeapBase::HandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt /*aNestingLevel*/, TInt /*aAllocNumber*/)
+    {
+    TInt error = KErrNone;
+    //
+    if  (aCellType & EMemSpyDriverFreeCellMask)
+        {
+        if  ( iStackStream )
+            {
+            if  ( !iStackStream->IsFull() )
+                {
+                ++iFreeCellCount;
+                TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::HandleHeapCell - writing free cell %d @ 0x%08x, space left: %u", iFreeCellCount, aCellAddress, iStackStream->Remaining() ));
+                //
+                iStackStream->WriteInt32( aCellType );
+                iStackStream->WriteUint32( reinterpret_cast<TUint32>( aCellAddress ) );
+                iStackStream->WriteInt32( aLength );
+                }
+            else
+                {
+                Kern::Printf( "DMemSpyDriverLogChanHeapBase::HandleHeapCell - Kernel Free Cell stack stream IS FULL!" );
+                error = KErrAbort;
+                }
+            }
+       }
+    //
+    return ( error == KErrNone );
+    }
+
+
+void DMemSpyDriverLogChanHeapBase::HandleHeapWalkInit()
+	{
+	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;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapData.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,425 @@
+/*
+* 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/MemSpyDriverLogChanHeapInfo.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,418 @@
+/*
+* 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()
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapWalk.cpp	Mon Sep 06 15:00:47 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 "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/MemSpyDriverLogChanMisc.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,223 @@
+/*
+* 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 "MemSpyDriverLogChanMisc.h"
+
+// System includes
+#include <memspy/driver/memspydriverconstants.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"
+
+
+
+DMemSpyDriverLogChanMisc::DMemSpyDriverLogChanMisc( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanBase( aDevice, aThread )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::DMemSpyDriverLogChanMisc() - START - this: 0x%08x", this ));
+
+    DProcess* process = OSAdaption().DThread().GetOwningProcess( aThread );
+    if  ( process )
+        {
+        DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
+        //
+        iSID = processAdaption.GetSID( *process );
+        iSecurityZone = processAdaption.GetSecurityZone( *process );
+        //
+        iClientIsMemSpy = ( iSID == KMemSpyUiSID || iSID == KMemSpyConsoleUiSID );
+        }
+    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::DMemSpyDriverLogChanMisc() - END - sid: 0x%08x, sz: 0x%08x, isMemSpy: %d", iSID, iSecurityZone, iClientIsMemSpy ));
+    }
+
+
+DMemSpyDriverLogChanMisc::~DMemSpyDriverLogChanMisc()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::~DMemSpyDriverLogChanMisc() - START - this: 0x%08x", this ));
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::~DMemSpyDriverLogChanMisc() - END - this: 0x%08x", this ));
+	}
+
+
+
+TInt DMemSpyDriverLogChanMisc::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+        case EMemSpyDriverOpCodeMiscSetRHeapVTable:
+            r = SetRHeapVTable( a1 );
+            break;
+        case EMemSpyDriverOpCodeMiscGetMemoryModelType:
+            r = GetMemoryModelType();
+            break;
+        case EMemSpyDriverOpCodeMiscGetRoundToPageSize:
+            r = GetRoundToPageSize( (TUint32*) a1 );
+            break;
+        case EMemSpyDriverOpCodeMiscImpersonate:
+            r = Impersonate( (TUint32) a1 );
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+		    }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanMisc::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeMiscBase && aFunction < EMemSpyDriverOpCodeMiscEnd );
+    }
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanMisc::SetRHeapVTable( TAny* aRHeapVTable )
+    {
+    const TUint32 vTable = (TUint32) aRHeapVTable;
+    MemSpyDevice().SetRHeapVTable( vTable );
+    return KErrNone;
+    }
+
+
+
+
+
+TInt DMemSpyDriverLogChanMisc::GetMemoryModelType()
+    {
+    TInt ret = EMemSpyMemoryModelTypeUnknown;
+    //
+  	const TUint32 memModelAttrib = (TUint32) Kern::HalFunction( EHalGroupKernel, EKernelHalMemModelInfo, NULL, NULL );	
+    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetMemoryModelType() - memModelAttrib: 0x%08x", memModelAttrib));
+    //
+    if  ( (memModelAttrib & EMemModelTypeMask ) == EMemModelTypeMultiple )
+        {
+        ret = EMemSpyMemoryModelTypeMultiple;
+        }
+    else if ( (memModelAttrib & EMemModelTypeMask ) == EMemModelTypeMoving )
+        {
+        ret = EMemSpyMemoryModelTypeMoving;
+        }
+    else if ( (memModelAttrib & EMemModelTypeMask ) == EMemModelTypeEmul )
+        {
+        ret = EMemSpyMemoryModelTypeEmulator;
+        }
+    //
+    return ret;
+    }
+
+
+TInt DMemSpyDriverLogChanMisc::GetRoundToPageSize( TUint32* aValue )
+    {
+    // We should probably do this user side... I think the HAL contains the page size.
+    TUint32 value = 0;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aValue, &value, sizeof(TUint32) );
+    //
+    if  ( r == KErrNone )
+        {
+        value = Kern::RoundToPageSize( value );
+        r = Kern::ThreadRawWrite( &ClientThread(), aValue, &value, sizeof(TUint32) );
+        }
+    //
+    return r;
+    }
+
+
+TInt DMemSpyDriverLogChanMisc::Impersonate( TUint32 aValue )
+    {
+    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+    DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
+    //
+    TInt r = KErrNotFound;
+    //
+    TUint32 sid = iSID;
+    TUint32 sz = iSecurityZone;
+    //
+    if  ( aValue != 0 )
+        {
+        // Must impersonate a SID:
+	    NKern::ThreadEnterCS();
+
+        DObjectCon* container = Kern::Containers()[ EProcess ];
+        container->Wait();
+
+        const TInt count = container->Count();
+        for(TInt i=0; i<count; i++)
+            {
+            DObject* object = (*container)[ i ];
+            if  ( object != NULL )
+                {
+                DProcess* proc = (DProcess*) object;
+
+                const TUint32 processSID = processAdaption.GetSID( *proc );
+                if  ( processSID == aValue )
+                    {
+                    sid = processSID;
+                    sz = processAdaption.GetSecurityZone( *proc );
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::Impersonate() - MemSpy impersonates - pid: %d, sid: 0x%08x, sz: %d", proc->iId, sid, sz ));
+                    break;
+                    }
+
+                }
+            }
+
+        container->Signal();
+    	NKern::ThreadLeaveCS();
+        }
+
+    DThread& thread = ClientThread();
+    DProcess* myOwningProcess = threadAdaption.GetOwningProcess( thread );
+    //
+    if  ( myOwningProcess )
+        {
+        if  ( iClientIsMemSpy )
+            {
+            processAdaption.SetSID( *myOwningProcess, sid );
+            processAdaption.SetSecurityZone( *myOwningProcess, sz);
+            //
+            r = KErrNone;
+            }
+        else
+            {
+            r = KErrAccessDenied;
+            }
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::Impersonate() - MemSpy is now: 0x%08x", sid ));
+    return r;
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanProcessInspection.cpp	Mon Sep 06 15:00:47 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 "MemSpyDriverLogChanProcessInspection.h"
+
+// System includes
+#include <u32hal.h>
+#include <e32rom.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverInspectedProcess.h"
+#include "MemSpyDriverInspectedProcessManager.h"
+
+
+DMemSpyDriverLogChanProcessInspection::DMemSpyDriverLogChanProcessInspection( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanBase( aDevice, aThread )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::DMemSpyDriverLogChanProcessInspection() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanProcessInspection::~DMemSpyDriverLogChanProcessInspection()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::~DMemSpyDriverLogChanProcessInspection() - START - this: 0x%08x", this ));
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::~DMemSpyDriverLogChanProcessInspection() - END - this: 0x%08x", this ));
+	}
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanProcessInspection::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+        case EMemSpyDriverOpCodeProcessInspectOpen:
+            r = ProcessInspectionOpen( (TUint) a1 );
+            break;
+        case EMemSpyDriverOpCodeProcessInspectClose:
+            r = ProcessInspectionClose( (TUint) a1 );
+            break;
+        case EMemSpyDriverOpCodeProcessInspectRequestChanges:
+            r = ProcessInspectionRequestChanges( (TRequestStatus*) a1, (TMemSpyDriverProcessInspectionInfo*) a2 );
+            break;
+        case EMemSpyDriverOpCodeProcessInspectRequestChangesCancel:
+            r = ProcessInspectionRequestChangesCancel( (TUint) a1 );
+            break;
+        case EMemSpyDriverOpCodeProcessInspectAutoStartListReset:
+            r = ProcessInspectionAutoStartItemsClear();
+            break;
+        case EMemSpyDriverOpCodeProcessInspectAutoStartListAdd:
+            r = ProcessInspectionAutoStartItemsAdd( (TUint) a1 );
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+		    }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanProcessInspection::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeProcessInspectBase && aFunction < EMemSpyDriverOpCodeProcessInspectEnd );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionOpen( TUint aPid )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionOpen() - START"));
+    NKern::ThreadEnterCS();
+    
+    TInt error = OpenTempObject( aPid, EProcess );
+    if  ( error == KErrNone )
+    	{
+        DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
+        error = pidManager.ProcessOpen( (DProcess*) TempObject() );
+	    CloseTempObject();
+    	}
+    //
+    NKern::ThreadLeaveCS();
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionOpen() - END - error: %d", error ));
+    return error;
+    }
+
+
+TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionClose( TUint aPid )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionClose() - START"));
+    NKern::ThreadEnterCS();
+
+    TInt error = OpenTempObject( aPid, EProcess );
+    if  ( error == KErrNone )
+    	{
+        DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
+        error = pidManager.ProcessClose( (DProcess*) TempObject() );
+	    CloseTempObject();
+    	}
+    
+    NKern::ThreadLeaveCS();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionClose() - END - error: %d", error ));
+    return error;
+    }
+
+
+TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChanges( TRequestStatus* aStatus, TMemSpyDriverProcessInspectionInfo* aInfo )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChanges() - START"));
+    NKern::ThreadEnterCS();
+
+    // Read client info
+    TMemSpyDriverProcessInspectionInfo info;
+	TInt error = Kern::ThreadRawRead( &ClientThread(), aInfo, &info, sizeof(TMemSpyDriverProcessInspectionInfo) );
+    //
+    if  ( error == KErrNone )
+        {
+        DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
+        DMemSpyInspectedProcess* pid = pidManager.InspectedProcessByProcessId( info.iProcessId );
+        //
+        if ( pid != NULL )
+            {
+            error = pid->NotifyOnChange( &ClientThread(), aStatus, aInfo );
+            }
+        else
+            {
+            error = KErrNotFound;
+            }
+        }
+
+    // NB: Let client take care of completing request in error situations
+    NKern::ThreadLeaveCS();
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChanges() - END - error: %d", error ));
+    return error;
+    }
+
+
+TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChangesCancel( TUint aPid )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChangesCancel() - START"));
+    NKern::ThreadEnterCS();
+
+    TInt error = KErrNotFound;
+
+    DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
+    DMemSpyInspectedProcess* pid = pidManager.InspectedProcessByProcessId( aPid );
+    //
+    if ( pid != NULL )
+        {
+        error = pid->NotifyOnChangeCancel();
+        }
+
+    NKern::ThreadLeaveCS();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionRequestChangesCancel() - END - error: %d", error ));
+    return error;
+    }
+
+
+TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsClear()
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsClear() - START"));
+
+    NKern::ThreadEnterCS();
+
+    DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
+    pidManager.AutoStartListReset();
+
+    NKern::ThreadLeaveCS();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsClear() - END" ));
+    return KErrNone;
+    }
+
+
+TInt DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsAdd( TUint aSID )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsAdd() - START - aSID: 0x%08x", aSID ));
+
+    NKern::ThreadEnterCS();
+    DMemSpyInspectedProcessManager& pidManager = MemSpyDevice().ProcessInspectionManager();
+    const TInt error = pidManager.AutoStartListAdd( aSID );
+    NKern::ThreadLeaveCS();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanProcessInspection::ProcessInspectionAutoStartItemsAdd() - END - error: %d", error ));
+    return error;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanRawMemory.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* 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 "MemSpyDriverLogChanRawMemory.h"
+
+// System includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+
+
+
+DMemSpyDriverLogChanRawMemory::DMemSpyDriverLogChanRawMemory( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanBase( aDevice, aThread )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanRawMemory::DMemSpyDriverLogChanRawMemory() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanRawMemory::~DMemSpyDriverLogChanRawMemory()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanRawMemory::~DMemSpyDriverLogChanRawMemory() - START - this: 0x%08x", this ));
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanRawMemory::~DMemSpyDriverLogChanRawMemory() - END - this: 0x%08x", this ));
+	}
+
+
+
+TInt DMemSpyDriverLogChanRawMemory::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+	    case EMemSpyDriverOpCodeRawMemoryRead:
+		    r = ReadMem( (TMemSpyDriverInternalReadMemParams*) a1);
+		    break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+		    }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanRawMemory::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeRawMemoryBase && aFunction < EMemSpyDriverOpCodeRawMemoryEnd );
+    }
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanRawMemory::ReadMem( TMemSpyDriverInternalReadMemParams* aParams )
+	{
+    TRACE( Kern::Printf("DMemSpyDriverLogChanRawMemory::ReadMem() - START"));
+	TMemSpyDriverInternalReadMemParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof( TMemSpyDriverInternalReadMemParams ) );
+    //
+    if  ( r == KErrNone )
+        {
+        NKern::ThreadEnterCS();
+
+        // 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("DMemSpyDriverLogChanRawMemory::ReadMem - user side descriptor: 0x%08x (0x%08x), len: %8d, maxLen: %8d, r: %d", params.iDes, destPtr, destLen, destMax, r ));
+        //
+        r = OpenTempObject( params.iTid, EThread );
+        //
+	    if  ( r == KErrNone )
+		    {
+		    r = Kern::ThreadRawRead( (DThread*) TempObject(), (TAny*) params.iAddr, destPtr, destMax );
+            //
+		    if  ( r == KErrNone )
+                {
+                r = destMax;
+                }
+            else
+                {
+        	    Kern::Printf( "DMemSpyDriverLogChanRawMemory::ReadMem - could not xfer memory" );
+                }
+            //
+		    CloseTempObject();
+		    }
+        else
+            {
+        	Kern::Printf( "DMemSpyDriverLogChanRawMemory::ReadMem - could not open thread: %d", params.iTid );
+            }
+        //
+	    NKern::ThreadLeaveCS();
+        }
+    else
+        {
+    	Kern::Printf( "DMemSpyDriverLogChanRawMemory::ReadMem - params read error" );
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanRawMemory::ReadMem() - END - r: %d", r));
+	return r;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanStack.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,519 @@
+/*
+* 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 "MemSpyDriverLogChanStack.h"
+
+// System includes
+#include <u32hal.h>
+#include <e32rom.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverSuspensionManager.h"
+
+// Constants
+const TUint32 KMemSpyStackFillPatternUser = 0x29292929;
+const TUint32 KMemSpyStackFillPatternSupervisor = 0xeeeeeeee;
+
+
+DMemSpyDriverLogChanStack::DMemSpyDriverLogChanStack( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanBase( aDevice, aThread )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::DMemSpyDriverLogChanStack() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanStack::~DMemSpyDriverLogChanStack()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::~DMemSpyDriverLogChanStack() - START - this: 0x%08x", this ));
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::~DMemSpyDriverLogChanStack() - END - this: 0x%08x", this ));
+	}
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanStack::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+	    case EMemSpyDriverOpCodeStackGetInfo:
+            r = GetStackInfo( (TUint) a1, (TMemSpyDriverStackInfo*) a2 );
+            break;
+	    case EMemSpyDriverOpCodeStackGetData:
+            r = GetStackData( (TMemSpyDriverInternalStackDataParams*) a1 );
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+		    }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanStack::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeStackBase && aFunction < EMemSpyDriverOpCodeStackEnd );
+    }
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanStack::GetStackInfo( TUint aTid, TMemSpyDriverStackInfo* aParams )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackInfo() - START - thread id: %d", aTid));
+
+    TMemSpyDriverStackInfo params;
+	TInt r = OpenTempObject( aTid, EThread );
+	if  ( r == KErrNone )
+		{
+        DThread* thread = (DThread*) TempObject();
+
+        // Check the threads in the process are suspended
+        if  ( SuspensionManager().IsSuspended( *thread ) )
+            {
+            DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+            //
+            GetStackPointers( thread, params.iSupervisorStackPointer, params.iUserStackPointer );
+            //
+            params.iUserStackBase = threadAdaption.GetUserStackBase( *thread );
+            params.iUserStackSize = threadAdaption.GetUserStackSize( *thread );
+            params.iSupervisorStackBase = threadAdaption.GetSupervisorStackBase( *thread );
+            params.iSupervisorStackSize = threadAdaption.GetSupervisorStackSize( *thread );
+
+            // Try to get watermarks
+            GetStackHighWatermark( *thread, params.iUserStackHighWatermark, EMemSpyDriverDomainUser, KMemSpyStackFillPatternUser );
+            GetStackHighWatermark( *thread, params.iSupervisorStackHighWatermark, EMemSpyDriverDomainKernel, KMemSpyStackFillPatternSupervisor ) ;
+        
+    #ifdef __WINS__
+            params.iUserStackPointer = params.iUserStackBase;
+            params.iUserStackHighWatermark = params.iUserStackBase;
+            params.iSupervisorStackPointer = params.iSupervisorStackBase;
+            params.iSupervisorStackHighWatermark = params.iSupervisorStackBase;
+    #endif
+
+            // Write data to user-side
+            r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverStackInfo) );
+            }
+        else
+            {
+            TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackInfo - parent process not suspended => KErrAccessDenied"));
+            r = KErrAccessDenied;
+            }
+
+        CloseTempObject();
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackInfo() - END - ret: %d", r));
+    return r;
+    }
+
+
+TInt DMemSpyDriverLogChanStack::GetStackData( TMemSpyDriverInternalStackDataParams* aParams )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData() - START"));
+	TMemSpyDriverInternalStackDataParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalStackDataParams) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData() - END - params read error: %d", r));
+        return r;
+        }
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - thread id: %d, remaining: %8d", params.iTid, params.iRemaining));
+
+    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+
+    r = OpenTempObject( params.iTid, EThread );
+	if  ( r == KErrNone )
+		{
+        // Find the correct thread...
+        DThread* thread = (DThread*) TempObject();
+        DProcess* process = threadAdaption.GetOwningProcess( *thread );
+	    TFullName fullName;
+        thread->FullName( fullName );
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - thread: %lS", &fullName));
+
+        // Check the threads in the process are suspended
+        const TBool isSuspended = SuspensionManager().IsSuspended( *process );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData() - isSuspended: %d", isSuspended ));
+        if  ( isSuspended )
+            {
+            TInt stackSize = 0;
+            TUint32 stackBase = 0;
+            TBool stackAvailable = EFalse;
+            //
+            if  ( params.iDomain == EMemSpyDriverDomainUser )
+                {
+                stackSize = threadAdaption.GetUserStackSize( *thread );
+                stackBase = threadAdaption.GetUserStackBase( *thread );
+                }
+            else if ( params.iDomain == EMemSpyDriverDomainKernel )
+                {
+                stackSize = threadAdaption.GetSupervisorStackSize( *thread );
+                stackBase = threadAdaption.GetSupervisorStackBase( *thread );
+                }
+            TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData() - stackAvailable: %d", stackAvailable ));
+            //           
+            if  ( stackAvailable )
+		        {
+                // 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("DMemSpyDriverLogChanStack::GetStackData - user side descriptor: 0x%08x (0x%08x), len: %8d, maxLen: %8d, r: %d", params.iDes, destPtr, destLen, destMax, r ));
+
+                if  ( r == KErrNone )
+                    {
+                    // Calculate stack starting address. If we want to get the entire stack data
+                    // then we use the information from DThread. If we only want the data from
+                    // the current SP onwards, then we use GetStackPointerByDomain to return
+                    // the current SP value. If we are only fetching a portion of the stack, then
+                    // the amount of data we will have to read is obviously reduced.
+                    TUint32 stackStartingAddress = 0;
+                    if  ( params.iEntireStack )
+                        {
+                        stackStartingAddress = stackBase;
+                        }
+                    else
+                        {
+                        stackStartingAddress = GetStackPointerByDomain( thread, params.iDomain ); 
+                        }
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - stackStartingAddress:  0x%08x", stackStartingAddress));
+                    __ASSERT_ALWAYS( stackStartingAddress != 0, MemSpyDriverUtils::Fault( __LINE__ ) );
+
+                    // Calculate how much data (maximum) there is to read, depending on whether the
+                    // client asked for all or just the active part of the stack.
+                    TUint stackDataSize = 0;
+                    if  ( params.iEntireStack )
+                        {
+                        stackDataSize = stackSize;
+                        }
+                    else
+                        {
+                        stackDataSize = stackBase + stackSize - stackStartingAddress;
+                        }
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - stackDataSize:           %8d", stackDataSize ));
+
+                    // Deal with the initial case - i.e. whereby the client is requesting stack
+                    // data for the first time. In this situation, the magic rune for "first
+                    // request" is a remaining value of -1.
+                    if  ( params.iRemaining < 0 )
+                        {
+                        params.iRemaining = stackDataSize;
+                        }
+
+                    // The remaining number of bytes should allow us to calculate the position
+                    // to read from.
+                    const TInt amountToRead = Min( params.iRemaining, destMax );
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - amountToRead:            %8d", amountToRead));
+                    const TInt readOffset = ( stackDataSize - params.iRemaining );
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - readOffset:              %8d", readOffset));
+                    const TAny* readAddress = (const TAny*) ( stackStartingAddress + readOffset );
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - readAddress:           0x%08x", readAddress));
+        
+                    // Do the read into user-space
+            #ifndef __WINS__
+                    if  ( params.iDomain == EMemSpyDriverDomainKernel )
+                        {
+                        const TPtrC8 pData( (TUint8*) readAddress, amountToRead );
+                        r = Kern::ThreadDesWrite( &Kern::CurrentThread(), params.iDes, pData, 0 );
+                        }
+                    else
+                        {
+                        r = Kern::ThreadRawRead( thread, readAddress, destPtr, amountToRead );
+                        }
+
+                    // Update user-side
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - mem. operation result: %d", r));
+                    if  ( r == KErrNone )
+                        {
+                        // Update remaining bytes and write back to user address space
+                        params.iRemaining -= amountToRead;
+                        r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalStackDataParams) );
+
+                        if  ( r == KErrNone )
+                            {
+                            // Client takes care of updating descriptor length.
+                            r = amountToRead;
+                            }
+                        }
+                    else if ( r == KErrBadDescriptor )
+                        {
+                        MemSpyDriverUtils::PanicThread( ClientThread(), EPanicBadDescriptor );
+                        }
+            #else
+                    (void) destPtr;
+                    params.iRemaining -= amountToRead;
+                    r = amountToRead;
+                    Kern::Printf( "DMemSpyDriverLogChanStack::GetStackData - not reading data on WINS" );
+            #endif
+                    }
+                else
+                    {
+                    Kern::Printf( "DMemSpyDriverLogChanStack::GetStackData - error getting client descriptor info" );
+                    }
+                }
+	        else
+                {
+    	        Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - stack address or stack length is invalid");
+                r = KErrArgument;
+                }
+            }
+        else
+            {
+            TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - parent process not suspended => KErrAccessDenied"));
+            r = KErrAccessDenied;
+            }
+
+	    CloseTempObject();
+        }
+    else
+        {
+    	Kern::Printf("DMemSpyDriverLogChanStack::GetStackData - thread not found");
+		}
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackData() - END - ret: %d", r));
+    return r;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#ifdef __MARM__
+
+#define __INCLUDE_REG_OFFSETS__  // for SP_R13U in nk_plat.h
+#include "nk_plat.h"
+#include "arm.h"
+
+void DMemSpyDriverLogChanStack::GetStackPointers( DThread* aThread, TUint& aSupSP, TUint& aUsrSP )
+	{
+    __ASSERT_ALWAYS( aThread != &Kern::CurrentThread(), MemSpyDriverUtils::Fault( __LINE__ ) );
+
+    // Get NThread associated with DThread
+    NThread* nThread = OSAdaption().DThread().GetNThread( *aThread );
+
+    TMemSpyDriverRegSet regs;
+    MemSpyDriverUtils::GetThreadRegisters( nThread, regs );
+    //
+    aSupSP = aThread->iNThread.iSavedSP;
+    aUsrSP = regs.iRn[13];
+    //
+	TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackPointers() - usr: 0x%08x [0x%08x-0x%08x], svc: 0x%08x [0x%08x-0x%08x]", aUsrSP, aThread->iUserStackRunAddress, (TUint) aThread->iUserStackRunAddress + (TUint) aThread->iUserStackSize, aSupSP, aThread->iSupervisorStack, (TUint) aThread->iSupervisorStack + (TUint) aThread->iSupervisorStackSize ));
+	}
+
+
+TLinAddr DMemSpyDriverLogChanStack::GetStackPointerByDomain( DThread* aThread, TMemSpyDriverDomainType aDomainType )
+    {
+    TUint stackPointer = 0;
+    //
+    if  ( aDomainType == EMemSpyDriverDomainUser )
+        {
+        // Get NThread associated with DThread
+        NThread* nThread = OSAdaption().DThread().GetNThread( *aThread );
+ 
+        TMemSpyDriverRegSet regSet;
+        MemSpyDriverUtils::GetThreadRegisters( nThread, regSet );
+        stackPointer = regSet.iRn[13];
+        }
+    else if ( aDomainType == EMemSpyDriverDomainKernel )
+        {
+        TUint userSPNotUsed = 0;
+        GetStackPointers( aThread, stackPointer, userSPNotUsed );
+        }
+    //
+    return TLinAddr( stackPointer );
+    }
+
+#else
+
+void DMemSpyDriverLogChanStack::GetStackPointers( DThread* /*aThread*/, TUint& aSupSP, TUint& aUsrSP )
+	{
+    aSupSP = 0;
+    aUsrSP = 0;
+	}
+
+
+TLinAddr DMemSpyDriverLogChanStack::GetStackPointerByDomain( DThread* aThread, TMemSpyDriverDomainType aDomainType )
+    {
+    // Just return the base address in WINS
+    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+    TUint32 stackPointer = 0;
+    //
+    if  ( aDomainType == EMemSpyDriverDomainUser )
+        {
+        stackPointer = threadAdaption.GetUserStackBase( *aThread );
+        }
+    else if ( aDomainType == EMemSpyDriverDomainKernel )
+        {
+        stackPointer = threadAdaption.GetSupervisorStackBase( *aThread );
+        }
+    //
+    return TLinAddr( stackPointer );
+    }
+
+#endif
+
+
+TInt DMemSpyDriverLogChanStack::GetStackHighWatermark( DThread& aThread, TLinAddr& aHighWatermark, TMemSpyDriverDomainType aDomain, TUint aRune )
+    {
+    aHighWatermark = 0;
+    const TInt KStackPageSize = 512;
+    
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark() - START - domain: %d, rune: 0x%08x", aDomain, aRune ));
+
+    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+   
+    const TUint32 baseAddress = aDomain == EMemSpyDriverDomainUser ? threadAdaption.GetUserStackBase( aThread ) : threadAdaption.GetSupervisorStackBase( aThread );
+    const TInt size           = aDomain == EMemSpyDriverDomainUser ? threadAdaption.GetUserStackSize( aThread ) : threadAdaption.GetSupervisorStackSize( aThread );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - baseAddress: 0x%08x, size: %8d", baseAddress, size));
+
+    TInt r = KErrNone;
+    //
+	if  ( baseAddress && size )
+		{
+        aHighWatermark = baseAddress;
+        TBuf8<KStackPageSize> stackBuf;
+        TUint8* readAddress = NULL;
+        //
+        while( r == KErrNone )
+            {
+            // Read a chunk of data
+            r = ReadStackData( aThread, stackBuf, readAddress, aDomain );
+
+            // Process the data, looking for the first bytes that aren't 0x29292929
+            if  ( r == KErrNone )
+                {
+                const TInt readLength = stackBuf.Length();
+                TRACE_DATA( MemSpyDriverUtils::DataDump("stackdata - %lS", stackBuf.Ptr(), readLength, readLength ) );
+
+                TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - readLength: %d", readLength));
+
+                for( TInt readPos = 0; readPos < readLength && ((readLength - readPos) >= 4); readPos += 4, aHighWatermark += 4 )
+                    {
+                    const TUint dword =  stackBuf[ readPos ] +
+                                        (stackBuf[ readPos + 1 ] <<  8) + 
+                                        (stackBuf[ readPos + 2 ] << 16) + 
+                                        (stackBuf[ readPos + 3 ] << 24);
+                    //
+                    if  ( dword != aRune )
+                        {
+                        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - found end of uninit. stack!"));
+                        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - dword:          0x%08x", dword));
+                        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - readPos:          %8d", readPos));
+                        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark - aHighWatermark: 0x%08x", aHighWatermark));
+                        TRACE( Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark() - END"));
+                        return KErrNone;
+                        }
+                    }
+                }
+            }
+        }
+    //
+    aHighWatermark = 0;
+    Kern::Printf("DMemSpyDriverLogChanStack::GetStackHighWatermark() - END - error: %d", r);
+    return r;
+    }
+
+
+TInt DMemSpyDriverLogChanStack::ReadStackData( DThread& aThread, TDes8& aDestination, TUint8*& aReadAddress, TMemSpyDriverDomainType aDomain )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData() - START - domain: %d", aDomain ));
+
+    DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
+
+    const TUint32 baseAddress = aDomain == EMemSpyDriverDomainUser ? threadAdaption.GetUserStackBase( aThread ) : threadAdaption.GetSupervisorStackBase( aThread );
+    const TInt size           = aDomain == EMemSpyDriverDomainUser ? threadAdaption.GetUserStackSize( aThread ) : threadAdaption.GetSupervisorStackSize( aThread );
+    const TUint32 topAddress  = ( baseAddress + size );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - baseAddress:   0x%08x", baseAddress));
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - size:          0x%08x", size));
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - topAddress:    0x%08x", topAddress));
+    //
+    if  ( aReadAddress == NULL )
+        {
+        aReadAddress = (TUint8*) baseAddress; 
+        }
+
+    // Work out how much we should read
+    TInt readLen = Min( aDestination.MaxLength(), topAddress - (TLinAddr) aReadAddress );
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - aReadAddress:  0x%08x", aReadAddress));
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - readLen:         %8d", readLen));
+
+    TInt r = KErrNotSupported;
+    aDestination.Zero();
+
+#ifndef __WINS__
+    if  ( aDomain == EMemSpyDriverDomainKernel )
+        {
+        const TPtrC8 pData( (TUint8*) aReadAddress, readLen );
+        aDestination.Copy( pData );
+        r = KErrNone;
+        readLen = aDestination.Length();
+        }
+    else
+        {
+        r = Kern::ThreadRawRead( &aThread, aReadAddress, (TAny*) aDestination.Ptr(), readLen );
+        }
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - read result: %d", r));
+    if  (r == KErrNone)
+        {
+        aDestination.SetLength( readLen );
+        aReadAddress += aDestination.Length();
+        }
+#else
+    Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData - not reading data on WINS");
+#endif
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanStack::ReadStackData() - END - ret: %d", r));
+    return r;
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanThreadAndProcess.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,511 @@
+/*
+* 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 "MemSpyDriverLogChanThreadAndProcess.h"
+
+// System includes
+#include <platform.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include <memspy/driver/memspydriverpanics.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverSuspensionManager.h"
+
+// Constants
+const TBool KMemSpyDriverAllowDeadOpenRequests = ETrue;
+const TInt KMemSpyDriverLogChanThreadAndProcessXferBufferSize = 512;
+
+
+DMemSpyDriverLogChanThreadAndProcess::DMemSpyDriverLogChanThreadAndProcess( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanBase( aDevice, aThread )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::DMemSpyDriverLogChanThreadAndProcess() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanThreadAndProcess::~DMemSpyDriverLogChanThreadAndProcess()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::~DMemSpyDriverLogChanThreadAndProcess() - START - this: 0x%08x", this ));
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::~DMemSpyDriverLogChanThreadAndProcess() - END - this: 0x%08x", this ));
+	}
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::Construct()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::Construct() - START - this: 0x%08x", this ));
+    
+    const TInt ret = BaseConstruct( KMemSpyDriverLogChanThreadAndProcessXferBufferSize );
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::Construct() - END - this: 0x%08x, err: %d", this, ret ));
+    return ret;
+	}
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+	    case EMemSpyDriverOpCodeThreadAndProcessGetInfoThread:
+		    r = GetInfoThread( (TUint)a1, (TMemSpyDriverInternalThreadInfoParams*) a2);
+		    break;
+	    case EMemSpyDriverOpCodeThreadAndProcessGetInfoProcess:
+		    r = GetInfoProcess( (TUint)a1, (TMemSpyDriverProcessInfo*) a2);
+		    break;
+        case EMemSpyDriverOpCodeThreadAndProcessEndThread:
+            r = EndThread( (TUint) a1, (TExitType) ((TUint) a2) );
+            break;
+        case EMemSpyDriverOpCodeThreadAndProcessOpenThread:
+            r = OpenThread( (TUint) a1 );
+            break;
+        case EMemSpyDriverOpCodeThreadAndProcessOpenProcess:
+            r = OpenProcess( (TUint) a1 );
+            break;
+        case EMemSpyDriverOpCodeThreadAndProcessSuspendAllThreads:
+            r = SuspendAllThreadsInProcess( (TUint) a1 );
+            break;
+        case EMemSpyDriverOpCodeThreadAndProcessResumeAllThreads:
+            r = ResumeAllThreadsInProcess( (TUint) a1 );
+            break;
+        case EMemSpyDriverOpCodeThreadAndProcessGetThreads:
+            r = GetThreadsForProcess( (TUint) a1, (TDes8*) a2 );
+            break;
+        case EMemSpyDriverOpCodeThreadAndProcessSetPriorityThread:
+            r = SetPriority( (TUint) a1, (TThreadPriority) ((TUint) a2) );
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+		    }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanThreadAndProcess::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeThreadAndProcessBase && aFunction < EMemSpyDriverOpCodeThreadAndProcessEnd );
+    }
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::GetInfoThread( TUint aTid, TMemSpyDriverInternalThreadInfoParams* aParams )
+	{
+    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - START"));
+
+    TMemSpyDriverInternalThreadInfoParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalThreadInfoParams) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - END - params read error: %d", r));
+        return r;
+        }
+
+	r = OpenTempObject( aTid, EThread );
+	if  ( r == KErrNone )
+		{
+		DThread* dThread = (DThread*) TempObject();
+  	    NKern::ThreadEnterCS();
+
+        // Get DThread adaptor. This is a means of querying DThread internals
+        // without accessing them directly. Takes into account possible differences
+        // between compile time and run time
+        DMemSpyDriverOSAdaptionDThread& dThreadAdaptor = OSAdaption().DThread();
+
+        // Saved CPU registers for thread. Need to get NThread to do this.
+        NThread* nThread = dThreadAdaptor.GetNThread( *dThread );
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting regs..." ));
+        MemSpyDriverUtils::GetThreadRegisters( nThread, params.iCpu );
+		
+        // Name
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting full name..." ));
+		dThread->FullName( params.iFullName );
+
+        // User framework
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting allocator..." ));
+        params.iAllocator = dThreadAdaptor.GetAllocator( *dThread );
+
+        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting scheduler..." ));
+        params.iScheduler = dThreadAdaptor.GetActiveScheduler( *dThread );
+
+        // User stack information - rest comes from user side API calls
+        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting user stack pointer..." ));
+        params.iStackInfo.iUserStackPointer = params.iCpu.iRn[ 12 ];
+
+        // Supervisor stack information
+        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - getting supervisor stack..." ));
+        params.iStackInfo.iSupervisorStackPointer = 0;
+        params.iStackInfo.iSupervisorStackHighWatermark = 0;
+        params.iStackInfo.iSupervisorStackBase = dThreadAdaptor.GetSupervisorStackBase( *dThread );
+        params.iStackInfo.iSupervisorStackSize = dThreadAdaptor.GetSupervisorStackSize( *dThread );
+ 
+        // Write back to user-side
+        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - writing to user side..." ));
+        r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalThreadInfoParams) );
+	    NKern::ThreadLeaveCS();
+		CloseTempObject();
+		}
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoThread() - END - ret: %d", r));
+    return r;
+	}
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::GetInfoProcess( TUint aPid, TMemSpyDriverProcessInfo* aParams )
+	{
+    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoProcess() - START"));
+
+    TMemSpyDriverProcessInfo params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverProcessInfo) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoProcess() - END - params read error: %d", r));
+        return r;
+        }
+
+	r = OpenTempObject( aPid, EProcess );
+	if  ( r == KErrNone )
+		{
+        DMemSpyDriverOSAdaptionDProcess& processAdaptor = OSAdaption().DProcess();
+  
+        DProcess* process = (DProcess*) TempObject();
+  	    NKern::ThreadEnterCS();
+		//
+        params.iFlags = processAdaptor.GetFlags( *process );
+        params.iGeneration = processAdaptor.GetGeneration( *process );
+        params.iSecurityInfo = processAdaptor.GetSecurityInfo( *process );
+
+        // Write back to user-side
+        r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverProcessInfo) );
+	    NKern::ThreadLeaveCS();
+		CloseTempObject();
+		}
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::GetInfoProcess() - END - ret: %d", r));
+    return r;
+	}
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::EndThread( TUint aId, TExitType aType )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::EndThread() - START - aId: %d, aType: %d", aId, aType ));
+
+	TInt r = OpenTempObject( aId, EThread );
+	if  ( r == KErrNone )
+		{
+        DThread* thread = (DThread*) TempObject();
+        //
+        const TInt reason = MapToMemSpyExitReason( aType );
+        Kern::ThreadKill( thread, aType, reason, KMemSpyClientPanic );
+        //
+	    CloseTempObject();
+        }
+    else
+        {
+        r = KErrNotFound;
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::EndThread() - END - r: %d", r));
+	return r;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::OpenThread( TUint aId )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - START - aId: %d", aId));
+
+	TInt r = OpenTempObject( aId, EThread, KMemSpyDriverAllowDeadOpenRequests );
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - done open temp object, r: %d", r ));
+	if  ( r == KErrNone )
+		{
+        NKern::ThreadEnterCS();
+        DThread* threadToOpen = (DThread*) TempObject();
+        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - thread exit type: %d", threadToOpen->iExitType ));
+
+        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - making handle..." ));
+        r = Kern::MakeHandleAndOpen( &ClientThread(), threadToOpen );
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - handle: %d",r ));
+    	NKern::ThreadLeaveCS();
+
+        // Balance reference count, handle is still open and mapped into our process since we opened
+        // it above via MakeHandleAndOpen
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - closing temp object..." ));
+	    CloseTempObject();
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - closed temp object" ));
+        }
+    else
+        {
+        r = KErrNotFound;
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenThread() - END - r: %d", r));
+	return r;
+    }
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::OpenProcess( TUint aId )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenProcess() - START - aId: %d", aId));
+
+	TInt r = OpenTempObject( aId, EProcess, KMemSpyDriverAllowDeadOpenRequests );
+	if  ( r == KErrNone )
+		{
+        NKern::ThreadEnterCS();
+        DProcess* processToOpen = (DProcess*) TempObject();
+        r = Kern::MakeHandleAndOpen( &ClientThread(), processToOpen );
+    	NKern::ThreadLeaveCS();
+
+        // Balance reference count, handle is still open and mapped into our process since we opened
+        // it above via MakeHandleAndOpen
+	    CloseTempObject();
+        }
+    else
+        {
+        r = KErrNotFound;
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::OpenProcess() - END - r: %d", r));
+	return r;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::SuspendAllThreadsInProcess( TUint aPid )
+    {
+	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::SuspendAllThreadsInProcess() - START - aPid: %d", aPid ));
+
+    DMemSpySuspensionManager& susMan = SuspensionManager();
+    const TInt err = susMan.SuspendAllThreadsInProcess( aPid, ClientThread() );
+
+	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::SuspendAllThreadsInProcess() - END - aPid: %d, err: %d", aPid, err ));
+	return err;
+    }
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::ResumeAllThreadsInProcess( TUint aPid )
+    {
+	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::ResumeAllThreadsInProcess() - START - aPid: %d", aPid ));
+
+    DMemSpySuspensionManager& susMan = SuspensionManager();
+    const TInt err = susMan.ResumeAllThreadsInProcess( aPid, ClientThread() );
+
+	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::ResumeAllThreadsInProcess() - END - aPid: %d, err: %d", aPid, err ));
+	return err;
+    }
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess( TUint aPid, TDes8* aBufferSink )
+    {
+	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - START - aPid: %d", aPid ) );
+
+    // We open the source thread or process, just to ensure it doesn't die underneath us...
+    TInt r = OpenTempObject( aPid, EProcess );
+    if  ( r == KErrNone )
+		{
+		DProcess& process = TempObjectAsProcess();
+
+        // Open stream
+        RMemSpyMemStreamWriter stream = OpenXferStream();
+        TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - stream remaining: %d", stream.Remaining() ) ); 
+
+        // Save marker pos for the thread count - we'll update it after the loop
+        TInt count = 0;
+        TInt32* pCountMarkerThread = stream.WriteInt32( 0 );
+
+        DMemSpyDriverOSAdaptionDProcess& processAdaptor = OSAdaption().DProcess();
+        SDblQue& threadQueue = processAdaptor.GetThreadQueue( process );
+        SDblQueLink* pLink = threadQueue.First();
+		while( pLink != & threadQueue.iA && !stream.IsFull() )
+			{
+			DThread* pT = processAdaptor.GetThread( pLink );
+            //
+            if  ( pT )
+                {
+                const TUint tid = OSAdaption().DThread().GetId( *pT );
+                TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - id: %d (0x%04x)", tid, tid ) );
+                stream.WriteUint32( tid );
+                }
+
+            pLink = pLink->iNext;
+			++count;
+            }
+ 
+        if  ( stream.IsFull() )
+            {
+            Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - STREAM FULL - id: %d (0x%04x), thread: %O", process.iId, process.iId, &process );
+            }
+
+        // Now write the count
+        *pCountMarkerThread = count;
+
+        // Tidy up
+        r = stream.WriteAndClose( aBufferSink );
+        TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - r: %d, count: %d", r, count ));
+
+        CloseTempObject();
+        }
+
+	TRACE( Kern::Printf( "DMemSpyDriverLogChanThreadAndProcess::GetThreadsForProcess() - END - aPid: %d, err: %d", aPid, r ));
+	return r;
+    }
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::SetPriority( TUint aId, TThreadPriority aPriority )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::SetPriority(T) - START - aId: %d, aPriority: %d", aId, aPriority ));
+
+	TInt r = OpenTempObject( aId, EThread );
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::SetPriority(T) - done open temp object, r: %d", r ));
+	if  ( r == KErrNone )
+		{
+        // Map user side thread priority to kernel-side absolute thread priority (typically 0-63)
+        const TInt kernelThreadPri = MemSpyDriverUtils::MapToAbsoluteThreadPriority( aPriority );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::SetPriority(T) - user: %d, kernel absolute: %d", aPriority, kernelThreadPri ));
+
+        if  ( kernelThreadPri > 0 && kernelThreadPri < KNumPriorities )
+            {
+            NKern::ThreadEnterCS();
+            DThread& thread = TempObjectAsThread();
+            r = Kern::SetThreadPriority( kernelThreadPri, &thread );
+            TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::SetPriority(T) - Kern::SetThreadPriority() returned: %d", r ));
+    	    NKern::ThreadLeaveCS();
+            }
+        else
+            {
+            // Error
+            r = kernelThreadPri;
+            }
+
+        CloseTempObject();
+        }
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::SetPriority(T) - END - r: %d", r));
+	return r;
+    }
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanThreadAndProcess::MapToMemSpyExitReason( TExitType aType )
+    {
+    TInt ret = 0;
+    //
+    switch( aType )
+        {
+    default:
+    case EExitKill:
+        ret = EPanicForcedKill;
+        break;
+    case EExitTerminate:
+        ret = EPanicForcedTerminate;
+        break;
+    case EExitPanic:
+        ret = EPanicForcedPanic;
+        break;
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanUserEventMonitor.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,219 @@
+/*
+* 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 "MemSpyDriverLogChanUserEventMonitor.h"
+
+// System includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverUserEventMonitor.h"
+
+
+
+DMemSpyDriverLogChanUserEventMonitor::DMemSpyDriverLogChanUserEventMonitor( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanBase( aDevice, aThread )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::DMemSpyDriverLogChanThreadAndProcess() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanUserEventMonitor::~DMemSpyDriverLogChanUserEventMonitor()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::~DMemSpyDriverLogChanThreadAndProcess() - START - this: 0x%08x", this ));
+
+    NKern::ThreadEnterCS();
+    delete iEventMonitorManager;
+    NKern::ThreadLeaveCS();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanThreadAndProcess::~DMemSpyDriverLogChanThreadAndProcess() - END - this: 0x%08x", this ));
+	}
+
+
+TInt DMemSpyDriverLogChanUserEventMonitor::Construct()
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::Construct() - START"));
+    //
+    TInt error = BaseConstruct();
+    //
+    if  ( error == KErrNone )
+        {
+        iEventMonitorManager = new DMemSpyDriverClientEMManager( MemSpyDevice() );
+
+        if  ( iEventMonitorManager )
+            {
+            TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::DoCreate - creating event monitor" ));
+
+            error = iEventMonitorManager->Create();
+
+            TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::DoCreate - event monitor create error: %d", error ));
+            }
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::Construct() - END - error: %d", error ));
+    return error;
+    }
+
+
+
+TInt DMemSpyDriverLogChanUserEventMonitor::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+        case EMemSpyDriverOpCodeEventMonitorOpen:
+            r = EventMonitorOpen( a1 );
+            break;
+        case EMemSpyDriverOpCodeEventMonitorClose:
+            r = EventMonitorClose( (TUint) a1 );
+            break;
+        case EMemSpyDriverOpCodeEventMonitorNotify:
+            r = EventMonitorNotify( (TMemSpyDriverInternalEventMonitorParams*) a1 );
+            break;
+        case EMemSpyDriverOpCodeEventMonitorNotifyCancel:
+            r = EventMonitorNotifyCancel( (TUint) a1 );
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+		    }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanUserEventMonitor::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeEventMonitorBase && aFunction < EMemSpyDriverOpCodeEventMonitorEnd );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanUserEventMonitor::EventMonitorOpen( TAny* aHandle )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorOpen() - START") );
+    NKern::ThreadEnterCS();
+    
+    DMemSpyDriverClientEM* monitor = iEventMonitorManager->EMOpen();
+    TInt error = ( monitor != NULL )? KErrNone : KErrNoMemory;
+    const TUint handle = ( monitor != NULL )? monitor->Handle() : KNullHandle;
+    
+    // Write handle back
+    const TInt writeErr = Kern::ThreadRawWrite( &ClientThread(), aHandle, &handle, sizeof(TUint) );
+	if  ( writeErr != KErrNone )
+		{
+        TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorOpen() - write error: %d", writeErr ) );
+        error = writeErr;
+		}
+    //
+    NKern::ThreadLeaveCS();
+	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorOpen() - END - handle: 0x%08x, error: %d", handle, error ));
+    return error;
+    }
+
+
+TInt DMemSpyDriverLogChanUserEventMonitor::EventMonitorClose( TUint aHandle )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorClose() - START - aHandle: 0x%08x", aHandle));
+
+    NKern::ThreadEnterCS();
+    const TInt error = iEventMonitorManager->EMClose( aHandle );
+    NKern::ThreadLeaveCS();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorClose() - END - error: %d", error ));
+    return error;
+    }
+
+
+TInt DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotify( TMemSpyDriverInternalEventMonitorParams* aParams )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotify() - START"));
+    NKern::ThreadEnterCS();
+
+    // Read client info
+    TMemSpyDriverInternalEventMonitorParams params;
+	TInt error = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalEventMonitorParams) );
+    //
+    if  ( error == KErrNone )
+        {
+        DMemSpyDriverClientEM* monitor = iEventMonitorManager->EMInstance( params.iHandle );
+        //
+        if  ( monitor != NULL )
+            {
+            error = monitor->NotifyChanges( &ClientThread(), params.iStatus, params.iContext );
+            }
+        else
+            {
+            error = KErrNotFound;
+            }
+        }
+
+    // NB: Let client take care of completing request in error situations
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotify() - END - error: %d", error ));
+    return error;
+    }
+
+
+TInt DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotifyCancel( TUint aHandle )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotifyCancel() - START - aHandle: 0x%08x", aHandle));
+    NKern::ThreadEnterCS();
+
+    TInt error = KErrNotFound;
+    DMemSpyDriverClientEM* monitor = iEventMonitorManager->EMInstance( aHandle );
+    //
+    if  ( monitor != NULL )
+        {
+        error = monitor->NotifyChangesCancel();
+        }
+
+    NKern::ThreadLeaveCS();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanUserEventMonitor::EventMonitorNotifyCancel() - END - error: %d", error ));
+    return error;
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Shared/MemSpyDriverEnumerationsInternal.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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 MEMSPYDRIVERENUMERATIONSINTERNAL_H
+#define MEMSPYDRIVERENUMERATIONSINTERNAL_H
+
+
+enum TMemSpyDriverPrivateObjectType
+    {
+    EMemSpyDriverPrivateObjectTypeAll = 0,
+    EMemSpyDriverPrivateObjectTypeProcess,
+    EMemSpyDriverPrivateObjectTypeThread
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Shared/MemSpyDriverObjectsInternal.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,298 @@
+/*
+* 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 MEMSPYDRIVEROBJECTSINTERNAL_H
+#define MEMSPYDRIVEROBJECTSINTERNAL_H
+
+// System includes
+#include <e32cmn.h>
+
+// User includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+#include "MemSpyDriverEnumerationsInternal.h"
+
+
+
+
+class TMemSpyDriverInternalHeapRequestParameters
+    {
+public:
+    inline TMemSpyDriverInternalHeapRequestParameters()
+        : iTid(0), iRHeapVTable(0), iBuildFreeCellList(EFalse), iBuildAllocCellList(EFalse), iDebugAllocator(EFalse), iMasterInfo(NULL)
+        {
+        }
+
+public: // Params IN
+    TUint iTid;
+    TUint32 iRHeapVTable;
+    TBool iBuildFreeCellList;
+	TBool iBuildAllocCellList;
+
+public: // Params IN or OUT (IN in User heap requests, OUT in Kernel heap requests)
+    TBool iDebugAllocator;
+
+public: // Params IN and OUT
+    TMemSpyHeapInfo* iMasterInfo;
+    };
+
+
+
+
+
+	
+
+
+
+/**
+ * Parameters for User & Kernel heap data fetch
+ */
+struct TMemSpyDriverInternalHeapDataParams
+    {
+    TUint iTid;
+    TUint iRHeapVTable;
+    TDes8* iDes; // Not used during kernel heap fetch
+    TInt iRemaining; // Not used during kernel heap fetch
+    TUint iReadAddress;
+    TUint32 iChecksum;
+    TBool iDebugAllocator;
+    };
+
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalStackDataParams
+    {
+    TUint iTid;
+    TDes8* iDes;
+    TMemSpyDriverDomainType iDomain;
+    TBool iEntireStack;
+    TInt iRemaining;
+    };
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalChunkHandleParams
+	{
+	TUint iId;
+	TMemSpyDriverPrivateObjectType iType;
+	TAny** iHandles;
+	TInt* iCountPtr;
+    TInt iMaxCount;
+	};
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalChunkInfoParams
+	{
+	TAny* iHandle;
+	TAny* iBaseAddress;
+	TInt iSize;
+	TInt iMaxSize;
+	TUint iOwnerId;
+	TBuf8<KMaxFullName> iName;
+    TMemSpyDriverChunkType iType;
+    TInt iAttributes;
+	};
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalCodeSnapshotParams
+	{
+	TUint iFilter;
+	TAny** iHandles;
+	TInt* iCountPtr;
+    TInt iMaxCount;
+	};
+
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalCodeSegParams
+	{
+	TUint iPid;
+	TAny* iHandle;
+	TMemSpyDriverCodeSegInfo* iInfoPointer;
+	};
+
+
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalContainerHandleParams
+	{
+    TInt iTidOrPid;
+    TMemSpyDriverThreadOrProcess iHandleSource;
+    TMemSpyDriverContainerType iContainer;
+	TAny** iHandles;
+	TInt* iCountPtr;
+    TInt iMaxCount;
+	};
+
+
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalServerSessionHandleParams
+	{
+    TAny* iServerHandle;
+	TAny** iSessionHandles;
+	TInt* iSessionCountPtr;
+    TInt iMaxCount;
+	};
+
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalContainerObjectParams
+	{
+    TUint iTid;
+	TAny* iHandle;
+	TBuf8<KMaxFullName> iFullName;
+	};
+
+
+
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalReadMemParams
+	{
+	TUint iTid;
+	TLinAddr iAddr;
+	TDes8* iDes;
+	};
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalThreadInfoParams : public TMemSpyDriverThreadInfoBase
+	{
+    // In:
+    TUint iRHeapVTable;
+	TBool iDebugAllocator;
+
+    // Out:
+	TBuf8<KMaxFullName> iFullName;
+
+    /*
+	TUint iPid;
+	TLinAddr iStackBase;
+	TInt iStackSize;
+	TMemSpyDriverRegSet iCpu;
+	TLinAddr iSupervisorStackBase;
+	TInt iSupervisorStackSize;
+    CActiveScheduler* iScheduler;
+	RAllocator* iAllocator;
+
+	TBuf8<KMaxExitCategoryName> iExitCategory;
+	TInt iExitReason;
+    TThreadPriority iThreadPriority;
+    TInt iDefaultPriority;
+    TExitType iExitType;
+    TInt iIpcCount;
+	RAllocator* iCreatedAllocator;
+    TInt iThreadType;
+    TInt iLeaveDepth;
+    TUint32 iFlags;
+    */
+	};
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalWalkHeapParamsInit
+	{
+	TUint iTid;
+	TUint iRHeapVTable;
+	TBool iDebugAllocator;
+	};
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalWalkHeapParamsCell
+	{
+	TInt iCellType;
+	TAny* iCellAddress;
+	TInt iLength;
+	TInt iNestingLevel;
+	TInt iAllocNumber;
+	};
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalWalkHeapCellDataReadParams
+    {
+    TAny* iCellAddress;
+    TInt iReadLen;
+    TDes8* iDes;
+    };
+
+
+
+
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalEventMonitorParams
+	{
+	TUint iHandle;
+	TRequestStatus* iStatus;
+	TAny* iContext;
+	};
+
+
+
+
+/**
+ *
+ */
+struct TMemSpyDriverInternalCondVarSuspendedThreadParams
+    {
+    TAny* iCondVarHandle;
+    TAny** iThrHandles;
+    TInt* iThrCountPtr;
+    TInt iMaxCount;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Shared/MemSpyDriverOpCodes.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* 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 MEMSPYDRIVEROPCODES_H
+#define MEMSPYDRIVEROPCODES_H
+
+enum TMemSpyDriverOpCode
+	{
+    // RAW MEMORY
+    EMemSpyDriverOpCodeRawMemoryBase = 100,
+    EMemSpyDriverOpCodeRawMemoryRead,
+    EMemSpyDriverOpCodeRawMemoryEnd,
+
+    // THREAD & PROCESS
+	EMemSpyDriverOpCodeThreadAndProcessBase = 120,
+	EMemSpyDriverOpCodeThreadAndProcessGetInfoThread,
+	EMemSpyDriverOpCodeThreadAndProcessGetInfoProcess,
+    EMemSpyDriverOpCodeThreadAndProcessEndThread,
+    EMemSpyDriverOpCodeThreadAndProcessOpenThread,
+    EMemSpyDriverOpCodeThreadAndProcessOpenProcess,
+    EMemSpyDriverOpCodeThreadAndProcessSuspendAllThreads,
+    EMemSpyDriverOpCodeThreadAndProcessResumeAllThreads,
+	EMemSpyDriverOpCodeThreadAndProcessGetThreads,
+    EMemSpyDriverOpCodeThreadAndProcessSetPriorityThread,
+	EMemSpyDriverOpCodeThreadAndProcessEnd,
+
+    // CODE SEGS
+	EMemSpyDriverOpCodeCodeSegsBase = 140,
+	EMemSpyDriverOpCodeCodeSegsGetAll,
+	EMemSpyDriverOpCodeCodeSegsGetCodeSegsForProcess,
+	EMemSpyDriverOpCodeCodeSegsGetCodeSegInfo,
+	EMemSpyDriverOpCodeCodeSegsEnd,
+
+    // CHUNKS
+	EMemSpyDriverOpCodeChunkBase = 160,
+    EMemSpyDriverOpCodeChunkGetHandles,
+    EMemSpyDriverOpCodeChunkGetInfo,
+	EMemSpyDriverOpCodeChunkEnd,
+
+    // HEAP INFO
+    EMemSpyDriverOpCodeHeapInfoBase = 180,
+	EMemSpyDriverOpCodeHeapInfoGetUser,
+	EMemSpyDriverOpCodeHeapInfoGetKernel,
+    EMemSpyDriverOpCodeHeapInfoGetIsDebugKernel,
+    EMemSpyDriverOpCodeHeapInfoFetchCellList,
+    EMemSpyDriverOpCodeHeapInfoEnd,
+
+    // HEAP DATA
+    EMemSpyDriverOpCodeHeapDataBase = 200,
+    EMemSpyDriverOpCodeHeapDataGetUser,
+    EMemSpyDriverOpCodeHeapDataGetKernelInit,
+    EMemSpyDriverOpCodeHeapDataGetKernelFetch,
+    EMemSpyDriverOpCodeHeapDataEnd,
+
+    // HEAP WALK
+    EMemSpyDriverOpCodeWalkHeapBase = 220,
+    EMemSpyDriverOpCodeWalkHeapInit,
+    EMemSpyDriverOpCodeWalkHeapGetCellInfo,
+    EMemSpyDriverOpCodeWalkHeapReadCellData,
+    EMemSpyDriverOpCodeWalkHeapNextCell,
+    EMemSpyDriverOpCodeWalkHeapClose,
+    EMemSpyDriverOpCodeWalkHeapEnd,
+
+    // STACK
+    EMemSpyDriverOpCodeStackBase = 240,
+    EMemSpyDriverOpCodeStackGetInfo,
+    EMemSpyDriverOpCodeStackGetData,
+    EMemSpyDriverOpCodeStackEnd,
+
+    // CONTAINERS
+    EMemSpyDriverOpCodeContainersBase = 260,
+    EMemSpyDriverOpCodeContainersGetHandles,
+    EMemSpyDriverOpCodeContainersGetHandleInfo,
+    EMemSpyDriverOpCodeContainersGetApproxSize,
+    EMemSpyDriverOpCodeContainersGetReferencesToMyThread,
+    EMemSpyDriverOpCodeContainersGetReferencesToMyProcess,
+    EMemSpyDriverOpCodeContainersGetPAndSInfo,
+    EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreads,
+    EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreadInfo,
+    EMemSpyDriverOpCodeContainersEnd,
+
+    // CLIENT SERVER
+    EMemSpyDriverOpCodeClientServerBase = 280,
+    EMemSpyDriverOpCodeClientServerGetServerSessionHandles,
+    EMemSpyDriverOpCodeClientServerGetServerSessionInfo,
+    EMemSpyDriverOpCodeClientServerEnd,
+    
+    // PROCESS INSPECTION
+    EMemSpyDriverOpCodeProcessInspectBase = 300,
+    EMemSpyDriverOpCodeProcessInspectOpen,
+    EMemSpyDriverOpCodeProcessInspectClose,
+    EMemSpyDriverOpCodeProcessInspectRequestChanges,
+    EMemSpyDriverOpCodeProcessInspectRequestChangesCancel,
+    EMemSpyDriverOpCodeProcessInspectAutoStartListReset,
+    EMemSpyDriverOpCodeProcessInspectAutoStartListAdd,
+    EMemSpyDriverOpCodeProcessInspectEnd,
+
+    // EVENT MONITOR
+    EMemSpyDriverOpCodeEventMonitorBase = 320,
+    EMemSpyDriverOpCodeEventMonitorOpen,
+    EMemSpyDriverOpCodeEventMonitorClose,
+    EMemSpyDriverOpCodeEventMonitorNotify,
+    EMemSpyDriverOpCodeEventMonitorNotifyCancel,
+    EMemSpyDriverOpCodeEventMonitorEnd,
+
+    // MISC
+    EMemSpyDriverOpCodeMiscBase = 340,
+    EMemSpyDriverOpCodeMiscSetRHeapVTable,
+    EMemSpyDriverOpCodeMiscGetMemoryModelType,
+    EMemSpyDriverOpCodeMiscGetRoundToPageSize,
+    EMemSpyDriverOpCodeMiscImpersonate,
+    EMemSpyDriverOpCodeMiscEnd,
+	};
+	
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Shared/heaputils.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1684 @@
+// heaputils.cpp
+// 
+// Copyright (c) 2010 Accenture. All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the "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:
+// Accenture - Initial contribution
+//
+#ifdef TEST_HYBRIDHEAP_ASSERTS
+#define private public
+#include <e32def.h>
+#include "slab.h"
+#include "page_alloc.h"
+#include "heap_hybrid.h"
+#endif
+
+#include "heaputils.h"
+
+#ifdef __KERNEL_MODE__
+
+#include <kern_priv.h>
+#define MEM Kern
+__ASSERT_COMPILE(sizeof(LtkUtils::RKernelSideAllocatorHelper) == 10*4);
+#define KERN_ENTER_CS() NKern::ThreadEnterCS()
+#define KERN_LEAVE_CS() NKern::ThreadLeaveCS()
+#define LOG(args...)
+#define HUEXPORT_C
+#else
+
+#include <e32std.h>
+#define MEM User
+#define KERN_ENTER_CS()
+#define KERN_LEAVE_CS()
+//#include <e32debug.h>
+//#define LOG(args...) RDebug::Printf(args)
+#define LOG(args...)
+
+#ifdef STANDALONE_ALLOCHELPER
+#define HUEXPORT_C
+#else
+#define HUEXPORT_C EXPORT_C
+#endif
+
+#endif // __KERNEL_MODE__
+
+using LtkUtils::RAllocatorHelper;
+const TUint KPageSize = 4096;
+__ASSERT_COMPILE(sizeof(RAllocatorHelper) == 9*4);
+
+// RAllocatorHelper
+
+HUEXPORT_C RAllocatorHelper::RAllocatorHelper()
+	: iAllocatorAddress(0), iAllocatorType(EUnknown), iInfo(NULL), iValidInfo(0), iTempSlabBitmap(NULL), iPageCache(NULL), iPageCacheAddr(0)
+#ifdef __KERNEL_MODE__
+	, iChunk(NULL)
+#endif
+	{
+	}
+
+namespace LtkUtils
+	{
+	class THeapInfo
+		{
+	public:
+		THeapInfo()
+			{
+			ClearStats();
+			}
+
+		void ClearStats()
+			{
+			memclr(this, sizeof(THeapInfo));
+			}
+
+		TInt iAllocatedSize; // number of bytes in allocated cells (excludes free cells, cell header overhead)
+		TInt iCommittedSize; // amount of memory actually committed (includes cell header overhead, gaps smaller than an MMU page)
+		TInt iAllocationCount; // number of allocations currently
+		TInt iMaxCommittedSize; // or thereabouts
+		TInt iMinCommittedSize;
+		TInt iUnusedPages;
+		TInt iCommittedFreeSpace;
+		// Heap-only stats
+		TInt iHeapFreeCellCount;
+		// Hybrid-only stats
+		TInt iDlaAllocsSize;
+		TInt iDlaAllocsCount;
+		TInt iDlaFreeSize;
+		TInt iDlaFreeCount;
+		TInt iSlabAllocsSize;
+		TInt iSlabAllocsCount;
+		TInt iPageAllocsSize;
+		TInt iPageAllocsCount;
+		TInt iSlabFreeCellSize;
+		TInt iSlabFreeCellCount;
+		TInt iSlabFreeSlabSize;
+		TInt iSlabFreeSlabCount;
+		};
+	}
+
+const TInt KTempBitmapSize = 256; // KMaxSlabPayload / mincellsize, technically. Close enough.
+
+#ifdef __KERNEL_MODE__
+
+TInt RAllocatorHelper::OpenKernelHeap()
+	{
+	_LIT(KName, "SvHeap");
+	NKern::ThreadEnterCS();
+	DObjectCon* chunkContainer = Kern::Containers()[EChunk];
+	chunkContainer->Wait();
+	const TInt chunkCount = chunkContainer->Count();
+	DChunk* foundChunk = NULL;
+	for(TInt i=0; i<chunkCount; i++)
+		{
+		DChunk* chunk = (DChunk*)(*chunkContainer)[i];
+		if (chunk->NameBuf() && chunk->NameBuf()->Find(KName) != KErrNotFound)
+			{
+			// Found it. No need to open it, we can be fairly confident the kernel heap isn't going to disappear from under us
+			foundChunk = chunk;
+			break;
+			}
+		}
+	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.
+
+#endif
+	if (!err) err = FinishConstruction();
+	NKern::ThreadLeaveCS();
+	return err;
+	}
+
+#else
+
+HUEXPORT_C TInt RAllocatorHelper::Open(RAllocator* aAllocator)
+	{
+	iAllocatorAddress = (TLinAddr)aAllocator;
+	TInt udeb = EuserIsUdeb();
+	if (udeb < 0) return udeb; // error
+
+	TInt err = IdentifyAllocatorType(udeb);
+	if (!err)
+		{
+		err = FinishConstruction(); // Allocate everything up front
+		}
+	if (!err)
+		{
+		// We always stealth our own allocations, again to avoid tripping up allocator checks
+		SetCellNestingLevel(iInfo, -1);
+		SetCellNestingLevel(iTempSlabBitmap, -1);
+		SetCellNestingLevel(iPageCache, -1);
+		}
+	return err;
+	}
+
+#endif
+
+TInt RAllocatorHelper::FinishConstruction()
+	{
+	TInt err = KErrNone;
+	KERN_ENTER_CS();
+	if (!iInfo)
+		{
+		iInfo = new THeapInfo;
+		if (!iInfo) err = KErrNoMemory;
+		}
+	if (!err && !iTempSlabBitmap)
+		{
+		iTempSlabBitmap = (TUint8*)MEM::Alloc(KTempBitmapSize);
+		if (!iTempSlabBitmap) err = KErrNoMemory;
+		}
+	if (!err && !iPageCache)
+		{
+		iPageCache = MEM::Alloc(KPageSize);
+		if (!iPageCache) err = KErrNoMemory;
+		}
+
+	if (err)
+		{
+		delete iInfo;
+		iInfo = NULL;
+		MEM::Free(iTempSlabBitmap);
+		iTempSlabBitmap = NULL;
+		MEM::Free(iPageCache);
+		iPageCache = NULL;
+		}
+	KERN_LEAVE_CS();
+	return err;
+	}
+
+TInt RAllocatorHelper::ReadWord(TLinAddr aLocation, TUint32& aResult) const
+	{
+	// Check if we can satisfy the read from the cache
+	if (aLocation >= iPageCacheAddr)
+		{
+		TUint offset = aLocation - iPageCacheAddr;
+		if (offset < KPageSize)
+			{
+			aResult = ((TUint32*)iPageCache)[offset >> 2];
+			return KErrNone;
+			}
+		}
+
+	// If we reach here, not in page cache. Try and read in the new page
+	if (iPageCache)
+		{
+		TLinAddr pageAddr = aLocation & ~(KPageSize-1);
+		TInt err = ReadData(pageAddr, iPageCache, KPageSize);
+		if (!err)
+			{
+			iPageCacheAddr = pageAddr;
+			aResult = ((TUint32*)iPageCache)[(aLocation - iPageCacheAddr) >> 2];
+			return KErrNone;
+			}
+		}
+
+	// All else fails, try just reading it uncached
+	return ReadData(aLocation, &aResult, sizeof(TUint32));
+	}
+
+TInt RAllocatorHelper::ReadByte(TLinAddr aLocation, TUint8& aResult) const
+	{
+	// Like ReadWord but 8-bit
+
+	// Check if we can satisfy the read from the cache
+	if (aLocation >= iPageCacheAddr)
+		{
+		TUint offset = aLocation - iPageCacheAddr;
+		if (offset < KPageSize)
+			{
+			aResult = ((TUint8*)iPageCache)[offset];
+			return KErrNone;
+			}
+		}
+
+	// If we reach here, not in page cache. Try and read in the new page
+	if (iPageCache)
+		{
+		TLinAddr pageAddr = aLocation & ~(KPageSize-1);
+		TInt err = ReadData(pageAddr, iPageCache, KPageSize);
+		if (!err)
+			{
+			iPageCacheAddr = pageAddr;
+			aResult = ((TUint8*)iPageCache)[(aLocation - iPageCacheAddr)];
+			return KErrNone;
+			}
+		}
+
+	// All else fails, try just reading it uncached
+	return ReadData(aLocation, &aResult, sizeof(TUint8));
+	}
+
+
+TInt RAllocatorHelper::WriteWord(TLinAddr aLocation, TUint32 aWord)
+	{
+	// Invalidate the page cache if necessary
+	if (aLocation >= iPageCacheAddr && aLocation - iPageCacheAddr < KPageSize)
+		{
+		iPageCacheAddr = 0;
+		}
+
+	return WriteData(aLocation, &aWord, sizeof(TUint32));
+	}
+
+TInt RAllocatorHelper::ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const
+	{
+	// RAllocatorHelper base class impl is for allocators in same address space, so just copy it
+	memcpy(aResult, (const TAny*)aLocation, aSize);
+	return KErrNone;
+	}
+
+TInt RAllocatorHelper::WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize)
+	{
+	memcpy((TAny*)aLocation, aData, aSize);
+	return KErrNone;
+	}
+
+#ifdef __KERNEL_MODE__
+
+LtkUtils::RKernelSideAllocatorHelper::RKernelSideAllocatorHelper()
+	: iThread(NULL)
+	{}
+
+void LtkUtils::RKernelSideAllocatorHelper::Close()
+	{
+	NKern::ThreadEnterCS();
+	if (iThread)
+		{
+		iThread->Close(NULL);
+		}
+	iThread = NULL;
+	RAllocatorHelper::Close();
+	NKern::ThreadLeaveCS();
+	}
+
+TInt LtkUtils::RKernelSideAllocatorHelper::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)
+	{
+	return Kern::ThreadRawWrite(iThread, (TAny*)aLocation, aData, aSize);
+	}
+
+TInt LtkUtils::RKernelSideAllocatorHelper::TryLock()
+	{
+	return KErrNotSupported;
+	}
+
+void LtkUtils::RKernelSideAllocatorHelper::TryUnlock()
+	{
+	// Not supported
+	}
+
+TInt LtkUtils::RKernelSideAllocatorHelper::OpenUserHeap(TUint aThreadId, TLinAddr aAllocatorAddress, TBool aEuserIsUdeb)
+	{
+	NKern::ThreadEnterCS();
+	DObjectCon* threads = Kern::Containers()[EThread];
+	threads->Wait();
+	iThread = Kern::ThreadFromId(aThreadId);
+	if (iThread && iThread->Open() != KErrNone)
+		{
+		// Failed to open
+		iThread = NULL;
+		}
+	threads->Signal();
+	NKern::ThreadLeaveCS();
+	if (!iThread) return KErrNotFound;
+	iAllocatorAddress = aAllocatorAddress;
+	TInt err = IdentifyAllocatorType(aEuserIsUdeb);
+	if (err) Close();
+	return err;
+	}
+
+#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.
+	TInt udeb = EFalse; // We can't figure this out until after we've got the heap
+	TBool isTheKernelHeap = ETrue;
+#else
+	// Assumes the chunk isn't the kernel heap. It's not a good idea to try messing with the kernel heap from user side...
+	TInt udeb = EuserIsUdeb();
+	if (udeb < 0) return udeb; // error
+    TBool isTheKernelHeap = EFalse;
+#endif
+
+	TInt err = IdentifyAllocatorType(udeb, isTheKernelHeap);
+	if (err == KErrNone && iAllocatorType == EAllocator)
+		{
+		// We've no reason to assume it's an allocator because we don't know the iAllocatorAddress actually is an RAllocator*
+		err = KErrNotFound;
+		}
+	if (err && aChunkMaxSize > 0)
+		{
+		TInt oldErr = err;
+		TAllocatorType oldType = iAllocatorType;
+		// Try middle of chunk, in case it's an RHybridHeap
+		iAllocatorAddress += aChunkMaxSize / 2;
+		err = IdentifyAllocatorType(udeb, isTheKernelHeap);
+		if (err || iAllocatorType == EAllocator)
+			{
+			// No better than before
+			iAllocatorAddress = aChunkBase;
+			iAllocatorType = oldType;
+			err = oldErr;
+			}
+		}
+#ifdef __KERNEL_MODE__
+	if (err == KErrNone)
+		{
+		// Now we know the allocator, we can figure out the udeb-ness
+		RAllocator* kernelAllocator = reinterpret_cast<RAllocator*>(iAllocatorAddress);
+		kernelAllocator->DebugFunction(RAllocator::ESetFail, (TAny*)9999, (TAny*)0); // Use an invalid fail reason - this should have no effect on the operation of the heap
+		TInt err = kernelAllocator->DebugFunction(7, NULL, NULL); // 7 is RAllocator::TAllocDebugOp::EGetFail
+		if (err == 9999)
+			{
+			// udeb new hybrid heap
+			udeb = ETrue;
+			}
+		else if (err == KErrNotSupported)
+			{
+			// Old heap - fall back to slightly nasty non-thread-safe method
+			kernelAllocator->DebugFunction(RAllocator::ESetFail, (TAny*)RAllocator::EFailNext, (TAny*)1);
+			TAny* res = Kern::Alloc(4);
+			if (!res) udeb = ETrue;
+			Kern::Free(res);
+			}
+		else
+			{
+			// it's new urel
+			}
+
+		// Put everything back
+		kernelAllocator->DebugFunction(RAllocator::ESetFail, (TAny*)RAllocator::ENone, (TAny*)0);
+		// And update the type now we know the udeb-ness for certain
+		err = IdentifyAllocatorType(udeb, isTheKernelHeap);
+		}
+#endif
+	return err;
+	}
+
+
+// The guts of RAllocatorHelper
+
+enum TWhatToGet
+	{
+	ECommitted = 1,
+	EAllocated = 2,
+	ECount = 4,
+	EMaxSize = 8,
+	EUnusedPages = 16,
+	ECommittedFreeSpace = 32,
+	EMinSize = 64,
+	EHybridStats = 128,
+	};
+
+class RHackAllocator : public RAllocator
+	{
+public:
+	using RAllocator::iHandles;
+	using RAllocator::iTotalAllocSize;
+	using RAllocator::iCellCount;
+	};
+
+class RHackHeap : public RHeap
+	{
+public:
+	// Careful, only allowed to use things that are still in the new RHeap, and are still in the same place
+	using RHeap::iMaxLength;
+	using RHeap::iChunkHandle;
+	using RHeap::iLock;
+	using RHeap::iBase;
+	using RHeap::iAlign;
+	using RHeap::iTop;
+	};
+
+const TInt KChunkSizeOffset = 30*4;
+const TInt KPageMapOffset = 141*4;
+//const TInt KDlOnlyOffset = 33*4;
+const TInt KMallocStateOffset = 34*4;
+const TInt KMallocStateTopSizeOffset = 3*4;
+const TInt KMallocStateTopOffset = 5*4;
+const TInt KMallocStateSegOffset = 105*4;
+const TInt KUserHybridHeapSize = 186*4;
+const TInt KSparePageOffset = 167*4;
+const TInt KPartialPageOffset = 165*4;
+const TInt KFullSlabOffset = 166*4;
+const TInt KSlabAllocOffset = 172*4;
+const TInt KSlabParentOffset = 1*4;
+const TInt KSlabChild1Offset = 2*4;
+const TInt KSlabChild2Offset = 3*4;
+const TInt KSlabPayloadOffset = 4*4;
+const TInt KSlabsetSize = 4;
+
+#ifdef TEST_HYBRIDHEAP_ASSERTS
+__ASSERT_COMPILE(_FOFF(RHybridHeap, iChunkSize) == KChunkSizeOffset);
+__ASSERT_COMPILE(_FOFF(RHybridHeap, iPageMap) == KPageMapOffset);
+__ASSERT_COMPILE(_FOFF(RHybridHeap, iGlobalMallocState) == KMallocStateOffset);
+__ASSERT_COMPILE(sizeof(malloc_state) == 107*4);
+__ASSERT_COMPILE(_FOFF(malloc_state, iTopSize) == KMallocStateTopSizeOffset);
+__ASSERT_COMPILE(_FOFF(malloc_state, iTop) == KMallocStateTopOffset);
+__ASSERT_COMPILE(_FOFF(malloc_state, iSeg) == KMallocStateSegOffset);
+__ASSERT_COMPILE(sizeof(RHybridHeap) == KUserHybridHeapSize);
+__ASSERT_COMPILE(_FOFF(RHybridHeap, iSparePage) == KSparePageOffset);
+__ASSERT_COMPILE(_FOFF(RHybridHeap, iPartialPage) == KPartialPageOffset);
+__ASSERT_COMPILE(_FOFF(RHybridHeap, iSlabAlloc) == KSlabAllocOffset);
+__ASSERT_COMPILE(_FOFF(slab, iParent) == KSlabParentOffset);
+__ASSERT_COMPILE(_FOFF(slab, iChild1) == KSlabChild1Offset);
+__ASSERT_COMPILE(_FOFF(slab, iChild2) == KSlabChild2Offset);
+__ASSERT_COMPILE(_FOFF(slab, iPayload) == KSlabPayloadOffset);
+__ASSERT_COMPILE(sizeof(slabset) == KSlabsetSize);
+#endif
+
+TInt RAllocatorHelper::TryLock()
+	{
+#ifdef __KERNEL_MODE__
+	NKern::ThreadEnterCS();
+	DMutex* m = *(DMutex**)(iAllocatorAddress + _FOFF(RHackHeap, iLock));
+	if (m) Kern::MutexWait(*m);
+	return KErrNone;
+#else
+	if (iAllocatorType != EUnknown && iAllocatorType != EAllocator)
+		{
+		RFastLock& lock = *reinterpret_cast<RFastLock*>(iAllocatorAddress + _FOFF(RHackHeap, iLock));
+		lock.Wait();
+		return KErrNone;
+		}
+	return KErrNotSupported;
+#endif
+	}
+
+void RAllocatorHelper::TryUnlock()
+	{
+#ifdef __KERNEL_MODE__
+	DMutex* m = *(DMutex**)(iAllocatorAddress + _FOFF(RHackHeap, iLock));
+	if (m) Kern::MutexSignal(*m);
+	NKern::ThreadLeaveCS();
+#else
+	if (iAllocatorType != EUnknown && iAllocatorType != EAllocator)
+		{
+		RFastLock& lock = *reinterpret_cast<RFastLock*>(iAllocatorAddress + _FOFF(RHackHeap, iLock));
+		lock.Signal();
+		}
+#endif
+	}
+
+HUEXPORT_C void RAllocatorHelper::Close()
+	{
+	KERN_ENTER_CS();
+	iAllocatorType = EUnknown;
+	iAllocatorAddress = 0;
+	delete iInfo;
+	iInfo = NULL;
+	iValidInfo = 0;
+	MEM::Free(iTempSlabBitmap);
+	iTempSlabBitmap = NULL;
+	MEM::Free(iPageCache);
+	iPageCache = NULL;
+	iPageCacheAddr = 0;
+	KERN_LEAVE_CS();
+	}
+
+TInt RAllocatorHelper::IdentifyAllocatorType(TBool aAllocatorIsUdeb, TBool aIsTheKernelHeap)
+	{
+	iAllocatorType = EUnknown;
+
+	TUint32 handlesPtr = 0;
+	TInt err = ReadWord(iAllocatorAddress + _FOFF(RHackAllocator, iHandles), handlesPtr);
+
+	if (err) return err;
+	if (aIsTheKernelHeap || 
+	    handlesPtr == iAllocatorAddress + _FOFF(RHackHeap, iChunkHandle) || 
+	    handlesPtr == iAllocatorAddress + _FOFF(RHackHeap, iLock))
+		{
+		// It's an RHeap of some kind - I doubt any other RAllocator subclass will use iHandles in this way
+		TUint32 base = 0;
+		err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iBase), base);
+		if (err) return err;
+		TInt objsize = (TInt)base - (TInt)iAllocatorAddress;
+		if (objsize <= 32*4)
+			{
+			// Old RHeap
+			iAllocatorType = aAllocatorIsUdeb ? EUdebOldRHeap : EUrelOldRHeap;
+			}
+		else
+			{
+			// new hybrid heap - bigger than the old one. Likewise figure out if udeb or urel.
+			iAllocatorType = aAllocatorIsUdeb ? EUdebHybridHeap : EUrelHybridHeap;
+			}
+		}
+	else
+		{
+		iAllocatorType = EAllocator;
+		}
+	return KErrNone;
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::SetCellNestingLevel(TAny* aCell, TInt aNestingLevel)
+	{
+	TInt err = KErrNone;
+
+	switch (iAllocatorType)
+		{
+		case EUdebOldRHeap:
+		case EUdebHybridHeap:
+			// By this reckoning, they're in the same place amazingly
+			{
+			TLinAddr nestingAddr = (TLinAddr)aCell - 8;
+			err = WriteWord(nestingAddr, aNestingLevel);
+			break;
+			}
+		default:
+			break;
+		}
+	return err;
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::GetCellNestingLevel(TAny* aCell, TInt& aNestingLevel)
+	{
+	switch (iAllocatorType)
+		{
+		case EUdebOldRHeap:
+		case EUdebHybridHeap:
+			// By this reckoning, they're in the same place amazingly
+			{
+			TLinAddr nestingAddr = (TLinAddr)aCell - 8;
+			return ReadWord(nestingAddr, (TUint32&)aNestingLevel);
+			}
+		default:
+			return KErrNotSupported;
+		}
+	}
+
+TInt RAllocatorHelper::RefreshDetails(TUint aMask)
+	{
+	TInt err = FinishConstruction();
+	if (err) return err;
+
+	// Invalidate the page cache
+	iPageCacheAddr = 0;
+
+	TryLock();
+	err = DoRefreshDetails(aMask);
+	TryUnlock();
+	return err;
+	}
+
+const TInt KHeapWalkStatsForOldHeap = (EUnusedPages|ECommittedFreeSpace);
+const TInt KHeapWalkStatsForNewHeap = (EAllocated|ECount|EUnusedPages|ECommittedFreeSpace|EHybridStats);
+
+TInt RAllocatorHelper::DoRefreshDetails(TUint aMask)
+	{
+	TInt err = KErrNotSupported;
+	switch (iAllocatorType)
+		{
+		case EUrelOldRHeap:
+		case EUdebOldRHeap:
+			{
+			if (aMask & ECommitted)
+				{
+				// The old RHeap::Size() used to use iTop - iBase, which was effectively chunkSize - sizeof(RHeap)
+				// I think that for CommittedSize we should include the size of the heap object, just as it includes
+				// the size of heap cell metadata and overhead. Plus it makes sure the committedsize is a multiple of the page size
+				TUint32 top = 0;
+				//TUint32 base = 0;
+				//err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iBase), base);
+				//if (err) return err;
+				err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iTop), top);
+				if (err) return err;
+
+				//iInfo->iCommittedSize = top - base;
+				iInfo->iCommittedSize = top - iAllocatorAddress;
+				iValidInfo |= ECommitted;
+				}
+			if (aMask & EAllocated)
+				{
+				TUint32 allocSize = 0;
+				err = ReadWord(iAllocatorAddress + _FOFF(RHackAllocator, iTotalAllocSize), allocSize);
+				if (err) return err;
+				iInfo->iAllocatedSize = allocSize;
+				iValidInfo |= EAllocated;
+				}
+			if (aMask & ECount)
+				{
+				TUint32 count = 0;
+				err = ReadWord(iAllocatorAddress + _FOFF(RHackAllocator, iCellCount), count);
+				if (err) return err;
+				iInfo->iAllocationCount = count;
+				iValidInfo |= ECount;
+				}
+			if (aMask & EMaxSize)
+				{
+				TUint32 maxlen = 0;
+				err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iMaxLength), maxlen);
+				if (err) return err;
+				iInfo->iMaxCommittedSize = maxlen;
+				iValidInfo |= EMaxSize;
+				}
+			if (aMask & EMinSize)
+				{
+				TUint32 minlen = 0;
+				err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iMaxLength) - 4, minlen); // This isn't a typo! iMinLength is 4 bytes before iMaxLength, on old heap ONLY
+				if (err) return err;
+				iInfo->iMinCommittedSize = minlen;
+				iValidInfo |= EMinSize;
+				}
+			if (aMask & KHeapWalkStatsForOldHeap)
+				{
+				// Need a heap walk
+				iInfo->ClearStats();
+				iValidInfo = 0;
+				err = DoWalk(&WalkForStats, NULL);
+				if (err == KErrNone) iValidInfo |= KHeapWalkStatsForOldHeap;
+				}
+			return err;
+			}
+		case EUrelHybridHeap:
+		case EUdebHybridHeap:
+			{
+			TBool needWalk = EFalse;
+			if (aMask & ECommitted)
+				{
+				// RAllocator::Size uses iChunkSize - sizeof(RHybridHeap);
+				// We can't do exactly the same, because we can't calculate sizeof(RHybridHeap), only ROUND_UP(sizeof(RHybridHeap), iAlign)
+				// And if fact we don't bother and just use iChunkSize
+				TUint32 chunkSize = 0;
+				err = ReadWord(iAllocatorAddress + KChunkSizeOffset, chunkSize);
+				if (err) return err;
+				//TUint32 baseAddr = 0;
+				//err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iBase), baseAddr);
+				//if (err) return err;
+				iInfo->iCommittedSize = chunkSize; // - (baseAddr - iAllocatorAddress);
+				iValidInfo |= ECommitted;
+				}
+			if (aMask & (EAllocated|ECount))
+				{
+				if (iAllocatorType == EUdebHybridHeap)
+					{
+					// Easy, just get them from the counter
+					TUint32 totalAlloc = 0;
+					err = ReadWord(iAllocatorAddress + _FOFF(RHackAllocator, iTotalAllocSize), totalAlloc);
+					if (err) return err;
+					iInfo->iAllocatedSize = totalAlloc;
+					iValidInfo |= EAllocated;
+
+					TUint32 cellCount = 0;
+					err = ReadWord(iAllocatorAddress + _FOFF(RHackAllocator, iCellCount), cellCount);
+					if (err) return err;
+					iInfo->iAllocationCount = cellCount;
+					iValidInfo |= ECount;
+					}
+				else
+					{
+					// A heap walk is needed
+					needWalk = ETrue;
+					}
+				}
+			if (aMask & EMaxSize)
+				{
+				TUint32 maxlen = 0;
+				err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iMaxLength), maxlen);
+				if (err) return err;
+				iInfo->iMaxCommittedSize = maxlen;
+				iValidInfo |= EMaxSize;
+				}
+			if (aMask & EMinSize)
+				{
+				TUint32 minlen = 0;
+				err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iAlign) + 4*4, minlen); // iMinLength is in different place to old RHeap
+				if (err) return err;
+				iInfo->iMinCommittedSize = minlen;
+				iValidInfo |= EMinSize;
+				}
+			if (aMask & (EUnusedPages|ECommittedFreeSpace|EHybridStats))
+				{
+				// EAllocated and ECount have already been taken care of above
+				needWalk = ETrue;
+				}
+
+			if (needWalk)
+				{
+				iInfo->ClearStats();
+				iValidInfo = 0;
+				err = DoWalk(&WalkForStats, NULL);
+				if (err == KErrNone) iValidInfo |= KHeapWalkStatsForNewHeap;
+				}
+			return err;
+			}
+		default:
+			return KErrNotSupported;
+		}
+	}
+
+TInt RAllocatorHelper::CheckValid(TUint aMask)
+	{
+	if ((iValidInfo & aMask) == aMask)
+		{
+		return KErrNone;
+		}
+	else
+		{
+		return RefreshDetails(aMask);
+		}
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::CommittedSize()
+	{
+	TInt err = CheckValid(ECommitted);
+	if (err) return err;
+	return iInfo->iCommittedSize;
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::AllocatedSize()
+	{
+	TInt err = CheckValid(EAllocated);
+	if (err) return err;
+	return iInfo->iAllocatedSize;
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::AllocationCount()
+	{
+	TInt err = CheckValid(ECount);
+	if (err) return err;
+	return iInfo->iAllocationCount;
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::RefreshDetails()
+	{
+	return RefreshDetails(iValidInfo);
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::MaxCommittedSize()
+	{
+	TInt err = CheckValid(EMaxSize);
+	if (err) return err;
+	return iInfo->iMaxCommittedSize;
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::MinCommittedSize()
+	{
+	TInt err = CheckValid(EMinSize);
+	if (err) return err;
+	return iInfo->iMinCommittedSize;
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::AllocCountForCell(TAny* aCell) const
+	{
+	TUint32 allocCount = 0;
+	switch (iAllocatorType)
+		{
+		case EUdebOldRHeap:
+		case EUdebHybridHeap: // Both are in the same place, amazingly
+			{
+			TLinAddr allocCountAddr = (TLinAddr)aCell - 4;
+			TInt err = ReadWord(allocCountAddr, allocCount);
+			if (err) return err;
+			return (TInt)allocCount;
+			}
+		default:
+			return KErrNotSupported;
+		}
+	}
+
+struct SContext3
+	{
+	RAllocatorHelper::TWalkFunc3 iOrigWalkFn;
+	TAny* iOrigContext;
+	};
+
+TBool RAllocatorHelper::DispatchClientWalkCallback(RAllocatorHelper& aHelper, TAny* aContext, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellPtr, TInt aCellLength)
+	{
+	WalkForStats(aHelper, NULL, aCellType, aCellPtr, aCellLength);
+	SContext3* context = static_cast<SContext3*>(aContext);
+	return (*context->iOrigWalkFn)(aHelper, context->iOrigContext, aCellType, aCellPtr, aCellLength);
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::Walk(TWalkFunc3 aCallbackFn, TAny* aContext)
+	{
+	// Might as well take the opportunity of updating our stats at the same time as walking the heap for the client
+	SContext3 context = { aCallbackFn, aContext };
+
+	TInt err = FinishConstruction(); // In case this hasn't been done yet
+	if (err) return err;
+
+	TryLock();
+	err = DoWalk(&DispatchClientWalkCallback, &context);
+	TryUnlock();
+	return err;
+	}
+
+TInt RAllocatorHelper::DoWalk(TWalkFunc3 aCallbackFn, TAny* aContext)
+	{
+	TInt err = KErrNotSupported;
+	switch (iAllocatorType)
+		{
+		case EUdebOldRHeap:
+		case EUrelOldRHeap:
+			err = OldSkoolWalk(aCallbackFn, aContext);
+			break;
+		case EUrelHybridHeap:
+		case EUdebHybridHeap:
+			err = NewHotnessWalk(aCallbackFn, aContext);
+			break;
+		default:
+			err = KErrNotSupported;
+			break;
+		}
+	return err;
+	}
+
+struct SContext
+	{
+	RAllocatorHelper::TWalkFunc iOrigWalkFn;
+	TAny* iOrigContext;
+	};
+
+struct SContext2
+	{
+	RAllocatorHelper::TWalkFunc2 iOrigWalkFn;
+	TAny* iOrigContext;
+	};
+
+#define New2Old(aNew) (((aNew)&RAllocatorHelper::EAllocationMask) ? RAllocatorHelper::EAllocation : ((aNew)&RAllocatorHelper::EFreeMask) ? RAllocatorHelper::EFreeSpace : RAllocatorHelper::EBadness)
+
+TBool DispatchOldTWalkFuncCallback(RAllocatorHelper& /*aHelper*/, TAny* aContext, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellPtr, TInt aCellLength)
+	{
+	SContext* context = static_cast<SContext*>(aContext);
+	return (*context->iOrigWalkFn)(context->iOrigContext, New2Old(aCellType), aCellPtr, aCellLength);
+	}
+
+TBool DispatchOldTWalk2FuncCallback(RAllocatorHelper& aHelper, TAny* aContext, RAllocatorHelper::TExtendedCellType aCellType, TLinAddr aCellPtr, TInt aCellLength)
+	{
+	SContext2* context = static_cast<SContext2*>(aContext);
+	return (*context->iOrigWalkFn)(aHelper, context->iOrigContext, New2Old(aCellType), aCellPtr, aCellLength);
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::Walk(TWalkFunc aCallbackFn, TAny* aContext)
+	{
+	// For backwards compatability insert a compatability callback to map between the different types of callback that clients requested
+	SContext context = { aCallbackFn, aContext };
+	return Walk(&DispatchOldTWalkFuncCallback, &context);
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::Walk(TWalkFunc2 aCallbackFn, TAny* aContext)
+	{
+	SContext2 context = { aCallbackFn, aContext };
+	return Walk(&DispatchOldTWalk2FuncCallback, &context);
+	}
+
+
+TInt RAllocatorHelper::OldSkoolWalk(TWalkFunc3 aCallbackFn, TAny* aContext)
+	{
+	TLinAddr pC = 0;
+	TInt err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iBase), pC); // pC = iBase; // allocated cells
+	if (err) return err;
+	TLinAddr pF = iAllocatorAddress + _FOFF(RHackHeap, iAlign) + 3*4; // pF = &iFree; // free cells
+
+	TLinAddr top = 0;
+	err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iTop), top);
+	if (err) return err;
+	const TInt KAllocatedCellHeaderSize = iAllocatorType == EUdebOldRHeap ? 12 : 4;
+	TInt minCell = 0;
+	err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iAlign) + 4, (TUint32&)minCell);
+	if (err) return err;
+	TInt align = 0;
+	err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iAlign), (TUint32&)align);
+	if (err) return err;
+
+	FOREVER
+		{
+		err = ReadWord(pF+4, pF); // pF = pF->next; // next free cell
+		if (err) return err;
+		TLinAddr pFnext = 0;
+		if (pF) err = ReadWord(pF + 4, pFnext);
+		if (err) return err;
+
+		if (!pF)
+			{
+			pF = top; // to make size checking work
+			}
+		else if (pF>=top || (pFnext && pFnext<=pF) )
+			{
+			// free cell pointer off the end or going backwards
+			//Unlock();
+			(*aCallbackFn)(*this, aContext, EHeapBadFreeCellAddress, pF, 0);
+			return KErrCorrupt;
+			}
+		else
+			{
+			TInt l; // = pF->len
+			err = ReadWord(pF, (TUint32&)l);
+			if (err) return err;
+			if (l<minCell || (l & (align-1)))
+				{
+				// free cell length invalid
+				//Unlock();
+				(*aCallbackFn)(*this, aContext, EHeapBadFreeCellSize, pF, l);
+				return KErrCorrupt;
+				}
+			}
+		
+		while (pC!=pF)				// walk allocated cells up to next free cell
+			{
+			TInt l; // pC->len;
+			err = ReadWord(pC, (TUint32&)l);
+			if (err) return err;
+			if (l<minCell || (l & (align-1)))
+				{
+				// allocated cell length invalid
+				//Unlock();
+				(*aCallbackFn)(*this, aContext, EHeapBadAllocatedCellSize, pC, l);
+				return KErrCorrupt;
+				}
+			TBool shouldContinue = (*aCallbackFn)(*this, aContext, EHeapAllocation, pC + KAllocatedCellHeaderSize, l - KAllocatedCellHeaderSize);
+			if (!shouldContinue) return KErrNone;
+			
+			//SCell* pN = __NEXT_CELL(pC);
+			TLinAddr pN = pC + l;
+			if (pN > pF)
+				{
+				// cell overlaps next free cell
+				//Unlock();
+				(*aCallbackFn)(*this, aContext, EHeapBadAllocatedCellAddress, pC, l);
+				return KErrCorrupt;
+				}
+			pC = pN;
+			}
+		if (pF == top)
+			break;		// reached end of heap
+		TInt pFlen = 0;
+		err = ReadWord(pF, (TUint32&)pFlen);
+		if (err) return err;
+		pC = pF + pFlen; // pC = __NEXT_CELL(pF);	// step to next allocated cell
+		TBool shouldContinue = (*aCallbackFn)(*this, aContext, EHeapFreeCell, pF, pFlen);
+		if (!shouldContinue) return KErrNone;
+		}
+	return KErrNone;
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::CountUnusedPages()
+	{
+	TInt err = CheckValid(EUnusedPages);
+	if (err) return err;
+	return iInfo->iUnusedPages;
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::CommittedFreeSpace()
+	{
+	TInt err = CheckValid(ECommittedFreeSpace);
+	if (err) return err;
+	return iInfo->iCommittedFreeSpace;
+	}
+
+#define ROUND_DOWN(val, pow2) ((val) & ~((pow2)-1))
+#define ROUND_UP(val, pow2) ROUND_DOWN((val) + (pow2) - 1, (pow2))
+
+HUEXPORT_C TLinAddr RAllocatorHelper::AllocatorAddress() const
+	{
+	return iAllocatorAddress;
+	}
+
+TBool RAllocatorHelper::WalkForStats(RAllocatorHelper& aSelf, TAny* /*aContext*/, TExtendedCellType aType, TLinAddr aCellPtr, TInt aCellLength)
+	{
+	//ASSERT(aCellLength >= 0);
+	THeapInfo& info = *aSelf.iInfo;
+
+	TInt pagesSpanned = 0; // The number of pages that fit entirely inside the payload of this cell
+	if ((TUint)aCellLength > KPageSize)
+		{
+		TLinAddr nextPageAlignedAddr = ROUND_UP(aCellPtr, KPageSize);
+		pagesSpanned = ROUND_DOWN(aCellPtr + aCellLength - nextPageAlignedAddr, KPageSize) / KPageSize;
+		}
+
+	if (aSelf.iAllocatorType == EUrelOldRHeap || aSelf.iAllocatorType == EUdebOldRHeap)
+		{
+		if (aType & EFreeMask)
+			{
+			info.iUnusedPages += pagesSpanned;
+			info.iCommittedFreeSpace += aCellLength;
+			info.iHeapFreeCellCount++;
+			}
+		}
+	else
+		{
+		if (aType & EAllocationMask)
+			{
+			info.iAllocatedSize += aCellLength;
+			info.iAllocationCount++;
+			}
+		else if (aType & EFreeMask)
+			{
+			// I *think* that DLA will decommit pages from inside free cells...
+			TInt committedLen = aCellLength - (pagesSpanned * KPageSize);
+			info.iCommittedFreeSpace += committedLen;
+			}
+
+		switch (aType)
+			{
+			case EDlaAllocation:
+				info.iDlaAllocsSize += aCellLength;
+				info.iDlaAllocsCount++;
+				break;
+			case EPageAllocation:
+				info.iPageAllocsSize += aCellLength;
+				info.iPageAllocsCount++;
+				break;
+			case ESlabAllocation:
+				info.iSlabAllocsSize += aCellLength;
+				info.iSlabAllocsCount++;
+				break;
+			case EDlaFreeCell:
+				info.iDlaFreeSize += aCellLength;
+				info.iDlaFreeCount++;
+				break;
+			case ESlabFreeCell:
+				info.iSlabFreeCellSize += aCellLength;
+				info.iSlabFreeCellCount++;
+				break;
+			case ESlabFreeSlab:
+				info.iSlabFreeSlabSize += aCellLength;
+				info.iSlabFreeSlabCount++;
+				break;
+			default:
+				break;
+			}
+		}
+
+	return ETrue;
+	}
+
+#define PAGESHIFT 12
+
+TUint RAllocatorHelper::PageMapOperatorBrackets(unsigned ix, TInt& err) const
+	{
+	//return 1U&(iBase[ix>>3] >> (ix&7));
+	TUint32 basePtr = 0;
+	err = ReadWord(iAllocatorAddress + KPageMapOffset, basePtr);
+	if (err) return 0;
+
+	TUint8 res = 0;
+	err = ReadByte(basePtr + (ix >> 3), res);
+	if (err) return 0;
+
+	return 1U&(res >> (ix&7));
+	}
+
+
+TInt RAllocatorHelper::PageMapFind(TUint start, TUint bit, TInt& err)
+	{
+	TUint32 iNbits = 0;
+	err = ReadWord(iAllocatorAddress + KPageMapOffset + 4, iNbits);
+	if (err) return 0;
+
+	if (start<iNbits) do
+		{
+		//if ((*this)[start]==bit)
+		if (PageMapOperatorBrackets(start, err) == bit || err)
+			return start;
+		} while (++start<iNbits);
+	return -1;
+	}
+
+TUint RAllocatorHelper::PagedDecode(TUint pos, TInt& err)
+	{
+	unsigned bits = PageMapBits(pos,2,err);
+	if (err) return 0;
+	bits >>= 1;
+	if (bits == 0)
+		return 1;
+	bits = PageMapBits(pos+2,2,err);
+	if (err) return 0;
+	if ((bits & 1) == 0)
+		return 2 + (bits>>1);
+	else if ((bits>>1) == 0)
+		{
+		return PageMapBits(pos+4, 4,err);
+		}
+	else
+		{
+		return PageMapBits(pos+4, 18,err);
+		}
+	}
+
+TUint RAllocatorHelper::PageMapBits(unsigned ix, unsigned len, TInt& err)
+	{
+	int l=len;
+	unsigned val=0;
+	unsigned bit=0;
+	while (--l>=0)
+		{
+		//val |= (*this)[ix++]<<bit++;
+		val |= PageMapOperatorBrackets(ix++, err) << bit++;
+		if (err) return 0;
+		}
+	return val;
+	}
+
+enum TSlabType { ESlabFullInfo, ESlabPartialInfo, ESlabEmptyInfo };
+
+#ifndef TEST_HYBRIDHEAP_ASSERTS
+#define MAXSLABSIZE		56
+#define	SLABSHIFT		10
+#define	SLABSIZE		(1 << SLABSHIFT)
+const TInt KMaxSlabPayload = SLABSIZE - KSlabPayloadOffset;
+#endif
+
+TInt RAllocatorHelper::NewHotnessWalk(TWalkFunc3 aCallbackFn, TAny* aContext)
+	{
+	// RHybridHeap does paged, slab then DLA, so that's what we do too
+	// Remember Kernel RHybridHeaps don't even have the page and slab members
+
+	TUint32 basePtr;
+	TInt err = ReadWord(iAllocatorAddress + _FOFF(RHackHeap, iBase), basePtr);
+	if (err) return err;
+	if (basePtr < iAllocatorAddress + KUserHybridHeapSize)
+		{
+		// Must be a kernel one - don't do page and slab
+		}
+	else
+		{
+		// Paged
+		TUint32 membase = 0;
+		err = ReadWord(iAllocatorAddress + KPageMapOffset + 8, membase);
+		if (err) return err;
+
+		TBool shouldContinue = ETrue;
+		for (int ix = 0;(ix = PageMapFind(ix,1,err)) >= 0 && err == KErrNone;)
+			{
+			int npage = PagedDecode(ix, err);
+			if (err) return err;
+			// Introduce paged buffer to the walk function 
+			TLinAddr bfr = membase + (1 << (PAGESHIFT-1))*ix;
+			int len = npage << PAGESHIFT;
+			if ( (TUint)len > KPageSize )
+				{ // If buffer is not larger than one page it must be a slab page mapped into bitmap
+				if (iAllocatorType == EUdebHybridHeap)
+					{
+					bfr += 8;
+					len -= 8;
+					}
+				shouldContinue = (*aCallbackFn)(*this, aContext, EPageAllocation, bfr, len);
+				if (!shouldContinue) return KErrNone;
+				}
+			ix += (npage<<1);
+			}
+		if (err) return err;
+
+		// Slab
+		TUint32 sparePage = 0;
+		err = ReadWord(iAllocatorAddress + KSparePageOffset, sparePage);
+		if (err) return err;
+		if (sparePage)
+			{
+			//Walk(wi, iSparePage, iPageSize, EGoodFreeCell, ESlabSpare); // Introduce Slab spare page to the walk function 
+			// This counts as 4 spare slabs
+			for (TInt i = 0; i < 4; i++)
+				{
+				shouldContinue = (*aCallbackFn)(*this, aContext, ESlabFreeSlab, sparePage + SLABSIZE*i, SLABSIZE);
+				if (!shouldContinue) return KErrNone;
+				}
+			}
+
+		//TreeWalk(&iFullSlab, &SlabFullInfo, i, wi);
+		TInt err = TreeWalk(iAllocatorAddress + KFullSlabOffset, ESlabFullInfo, aCallbackFn, aContext, shouldContinue);
+		if (err || !shouldContinue) return err;
+		for (int ix = 0; ix < (MAXSLABSIZE>>2); ++ix)
+			{
+			TUint32 partialAddr = iAllocatorAddress + KSlabAllocOffset + ix*KSlabsetSize;
+			//TreeWalk(&iSlabAlloc[ix].iPartial, &SlabPartialInfo, i, wi);
+			err = TreeWalk(partialAddr, ESlabPartialInfo, aCallbackFn, aContext, shouldContinue);
+			if (err || !shouldContinue) return err;
+			}
+		//TreeWalk(&iPartialPage, &SlabEmptyInfo, i, wi);
+		TreeWalk(iAllocatorAddress + KPartialPageOffset, ESlabEmptyInfo, aCallbackFn, aContext, shouldContinue);
+		}
+
+	// DLA
+#define CHUNK_OVERHEAD (sizeof(TUint))
+#define CHUNK_ALIGN_MASK (7) 
+#define CHUNK2MEM(p)        ((TLinAddr)(p) + 8)
+#define MEM2CHUNK(mem)      ((TLinAddr)(p) - 8)
+/* chunk associated with aligned address A */
+#define ALIGN_OFFSET(A)\
+	((((TLinAddr)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
+	((8 - ((TLinAddr)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))
+#define ALIGN_AS_CHUNK(A)   ((A) + ALIGN_OFFSET(CHUNK2MEM(A)))
+#define CINUSE_BIT 2
+#define INUSE_BITS 3
+
+	TUint32 topSize = 0;
+	err = ReadWord(iAllocatorAddress + KMallocStateOffset + KMallocStateTopSizeOffset, topSize);
+	if (err) return err;
+
+	TUint32 top = 0;
+	err = ReadWord(iAllocatorAddress + KMallocStateOffset + KMallocStateTopOffset, top);
+	if (err) return err;
+
+	TInt max = ((topSize-1) & ~CHUNK_ALIGN_MASK) - CHUNK_OVERHEAD;
+	if ( max < 0 )
+		max = 0;
+	
+	TBool shouldContinue = (*aCallbackFn)(*this, aContext, EDlaFreeCell, top, max);
+	if (!shouldContinue) return KErrNone;
+	
+	TUint32 mallocStateSegBase = 0;
+	err = ReadWord(iAllocatorAddress + KMallocStateOffset + KMallocStateSegOffset, mallocStateSegBase);
+	if (err) return err;
+
+	for (TLinAddr q = ALIGN_AS_CHUNK(mallocStateSegBase); q != top; /*q = NEXT_CHUNK(q)*/)
+		{
+		TUint32 qhead = 0;
+		err = ReadWord(q + 4, qhead);
+		if (err) return err;
+		//TInt sz = CHUNKSIZE(q);
+		TInt sz = qhead & ~(INUSE_BITS);
+		if (!(qhead & CINUSE_BIT))
+			{
+			//Walk(wi, CHUNK2MEM(q), sz, EGoodFreeCell, EDougLeaAllocator); // Introduce DL free buffer to the walk function 
+			shouldContinue = (*aCallbackFn)(*this, aContext, EDlaFreeCell, CHUNK2MEM(q), sz);
+			if (!shouldContinue) return KErrNone;
+			}
+		else
+			{
+			//Walk(wi, CHUNK2MEM(q), (sz- CHUNK_OVERHEAD), EGoodAllocatedCell, EDougLeaAllocator); // Introduce DL allocated buffer to the walk function 
+			TLinAddr addr = CHUNK2MEM(q);
+			TInt size = sz - CHUNK_OVERHEAD;
+			if (iAllocatorType == EUdebHybridHeap)
+				{
+				size -= 8;
+				addr += 8;
+				}
+			shouldContinue = (*aCallbackFn)(*this, aContext, EDlaAllocation, addr, size);
+			if (!shouldContinue) return KErrNone;
+			}
+		// This is q = NEXT_CHUNK(q) expanded
+		q = q + sz;
+		}
+	return KErrNone;
+	}
+
+TInt RAllocatorHelper::TreeWalk(TUint32 aSlabRoot, TInt aSlabType, TWalkFunc3 aCallbackFn, TAny* aContext, TBool& shouldContinue)
+	{
+	const TSlabType type = (TSlabType)aSlabType;
+
+	TUint32 s = 0;
+	TInt err = ReadWord(aSlabRoot, s);
+	if (err) return err;
+	//slab* s = *root;
+	if (!s)
+		return KErrNone;
+	
+	for (;;)
+		{
+		//slab* c;
+		//while ((c = s->iChild1) != 0)
+		//	s = c;		// walk down left side to end
+		TUint32 c;
+		for(;;)
+			{
+			err = ReadWord(s + KSlabChild1Offset, c);
+			if (err) return err;
+			if (c == 0) break;
+			else s = c;
+			}
+		for (;;)
+			{
+			//TODOf(s, i, wi);
+			//TODO __HEAP_CORRUPTED_TEST_STATIC
+			TUint32 h;
+			err = ReadWord(s, h); // = aSlab->iHeader;
+			if (err) return err;
+			TUint32 size = (h&0x0003f000)>>12; //SlabHeaderSize(h);
+			TUint debugheadersize = 0;
+			if (iAllocatorType == EUdebHybridHeap) debugheadersize = 8;
+			TUint32 usedCount = (((h&0x0ffc0000)>>18) + 4) / size; // (SlabHeaderUsedm4(h) + 4) / size;
+			switch (type)
+				{
+				case ESlabFullInfo:
+					{
+					TUint32 count = usedCount;
+					TUint32 i = 0;
+					while ( i < count )
+						{
+						TUint32 addr = s + KSlabPayloadOffset + i*size; //&aSlab->iPayload[i*size];
+						shouldContinue = (*aCallbackFn)(*this, aContext, ESlabAllocation, addr + debugheadersize, size - debugheadersize);
+						if (!shouldContinue) return KErrNone;
+						i++;
+						}
+					break;
+					}
+				case ESlabPartialInfo:
+					{
+					//TODO __HEAP_CORRUPTED_TEST_STATIC
+					TUint32 count = KMaxSlabPayload / size;
+					TUint32 freeOffset = (h & 0xff) << 2;
+					if (freeOffset == 0)
+						{
+						// TODO Shouldn't happen for a slab on the partial list
+						}
+					memset(iTempSlabBitmap, 1, KTempBitmapSize); // Everything defaults to in use
+					TUint wildernessCount = count - usedCount;
+					while (freeOffset)
+						{
+						wildernessCount--;
+						TInt idx = (freeOffset-KSlabPayloadOffset)/size;
+						LOG("iTempSlabBitmap freeOffset %d index %d", freeOffset, idx);
+						iTempSlabBitmap[idx] = 0; // Mark it as free
+
+						TUint32 addr = s + freeOffset;
+						TUint8 nextCell = 0;
+						err = ReadByte(addr, nextCell);
+						if (err) return err;
+						freeOffset = ((TUint32)nextCell) << 2;
+						}
+					memset(iTempSlabBitmap + count - wildernessCount, 0, wildernessCount); // Mark the wilderness as free
+					for (TInt i = 0; i < count; i++)
+						{
+						TLinAddr addr = s + KSlabPayloadOffset + i*size;
+						if (iTempSlabBitmap[i])
+							{
+							// In use
+							shouldContinue = (*aCallbackFn)(*this, aContext, ESlabAllocation, addr + debugheadersize, size - debugheadersize);
+							}
+						else
+							{
+							// Free
+							shouldContinue = (*aCallbackFn)(*this, aContext, ESlabFreeCell, addr, size);
+							}
+						if (!shouldContinue) return KErrNone;
+						}
+					break;
+					}
+				case ESlabEmptyInfo:
+					{
+					// Check which slabs of this page are empty
+					TUint32 pageAddr = ROUND_DOWN(s, KPageSize);
+					TUint32 headerForPage = 0;
+					err = ReadWord(pageAddr, headerForPage);
+					if (err) return err;
+					TUint32 slabHeaderPageMap = (headerForPage & 0x00000f00)>>8; // SlabHeaderPagemap(unsigned h)
+					for (TInt slabIdx = 0; slabIdx < 4; slabIdx++)
+						{
+						if (slabHeaderPageMap & (1<<slabIdx))
+							{
+							TUint32 addr = pageAddr + SLABSIZE*slabIdx + KSlabPayloadOffset; //&aSlab->iPayload[i*size];
+							shouldContinue = (*aCallbackFn)(*this, aContext, ESlabFreeSlab, addr, KMaxSlabPayload);
+							if (!shouldContinue) return KErrNone;
+							}
+						}
+					break;
+					}
+				}
+
+			//c = s->iChild2;
+			err = ReadWord(s + KSlabChild2Offset, c);
+			if (err) return err;
+
+			if (c)
+				{	// one step down right side, now try and walk down left
+				s = c;
+				break;
+				}
+			for (;;)
+				{	// loop to walk up right side
+				TUint32 pp = 0;
+				err = ReadWord(s + KSlabParentOffset, pp);
+				if (err) return err;
+				//slab** pp = s->iParent;
+				if (pp == aSlabRoot)
+					return KErrNone;
+#define SlabFor(x) ROUND_DOWN(x, SLABSIZE)
+				s = SlabFor(pp);
+				//if (pp == &s->iChild1)
+				if (pp == s + KSlabChild1Offset)
+					break;
+				}
+			}
+		}
+	}
+
+// Really should be called TotalSizeForCellType(...)
+HUEXPORT_C TInt RAllocatorHelper::SizeForCellType(TExtendedCellType aType)
+	{
+	if (aType & EBadnessMask) return KErrArgument;
+	if (aType == EAllocationMask) return AllocatedSize();
+
+	if (iAllocatorType == EUdebOldRHeap || iAllocatorType == EUrelOldRHeap)
+		{
+		switch (aType)
+			{
+			case EHeapAllocation:
+				return AllocatedSize();
+			case EHeapFreeCell:
+			case EFreeMask:
+				return CommittedFreeSpace();
+			default:
+				return KErrNotSupported;
+			}
+		}
+	else if (iAllocatorType == EUrelHybridHeap || iAllocatorType == EUdebHybridHeap)
+		{
+		TInt err = CheckValid(EHybridStats);
+		if (err) return err;
+
+		switch (aType)
+			{
+			case EHeapAllocation:
+			case EHeapFreeCell:
+				return KErrNotSupported;
+			case EDlaAllocation:
+				return iInfo->iDlaAllocsSize;
+			case EPageAllocation:
+				return iInfo->iPageAllocsSize;
+			case ESlabAllocation:
+				return iInfo->iSlabAllocsSize;
+			case EDlaFreeCell:
+				return iInfo->iDlaFreeSize;
+			case ESlabFreeCell:
+				return iInfo->iSlabFreeCellSize;
+			case ESlabFreeSlab:
+				return iInfo->iSlabFreeSlabSize;
+			case EFreeMask:
+				// Note this isn't the same as asking for CommittedFreeSpace(). SizeForCellType(EFreeMask) may include decommitted pages that lie inside a free cell
+				return iInfo->iDlaFreeSize + iInfo->iSlabFreeCellSize + iInfo->iSlabFreeSlabSize;
+			default:
+				return KErrNotSupported;
+			}
+		}
+	else
+		{
+		return KErrNotSupported;
+		}
+	}
+
+HUEXPORT_C TInt RAllocatorHelper::CountForCellType(TExtendedCellType aType)
+	{
+	if (aType & EBadnessMask) return KErrArgument;
+	if (aType == EAllocationMask) return AllocationCount();
+
+	if (iAllocatorType == EUdebOldRHeap || iAllocatorType == EUrelOldRHeap)
+		{
+		switch (aType)
+			{
+			case EHeapAllocation:
+				return AllocationCount();
+			case EHeapFreeCell:
+			case EFreeMask:
+				{
+				TInt err = CheckValid(ECommittedFreeSpace);
+				if (err) return err;
+				return iInfo->iHeapFreeCellCount;
+				}
+			default:
+				return KErrNotSupported;
+			}
+		}
+	else if (iAllocatorType == EUrelHybridHeap || iAllocatorType == EUdebHybridHeap)
+		{
+		TInt err = CheckValid(EHybridStats);
+		if (err) return err;
+
+		switch (aType)
+			{
+			case EHeapAllocation:
+			case EHeapFreeCell:
+				return KErrNotSupported;
+			case EDlaAllocation:
+				return iInfo->iDlaAllocsCount;
+			case EPageAllocation:
+				return iInfo->iPageAllocsCount;
+			case ESlabAllocation:
+				return iInfo->iSlabAllocsCount;
+			case EDlaFreeCell:
+				return iInfo->iDlaFreeCount;
+			case ESlabFreeCell:
+				return iInfo->iSlabFreeCellCount;
+			case ESlabFreeSlab:
+				return iInfo->iSlabFreeSlabCount;
+			case EFreeMask:
+				// This isn't a hugely meaningful value, but if that's what they asked for...
+				return iInfo->iDlaFreeCount + iInfo->iSlabFreeCellCount + iInfo->iSlabFreeSlabCount;
+			default:
+				return KErrNotSupported;
+			}
+		}
+	else
+		{
+		return KErrNotSupported;
+		}
+	}
+
+HUEXPORT_C TBool LtkUtils::RAllocatorHelper::AllocatorIsUdeb() const
+	{
+	return iAllocatorType == EUdebOldRHeap || iAllocatorType == EUdebHybridHeap;
+	}
+
+
+HUEXPORT_C const TDesC& LtkUtils::RAllocatorHelper::Description() const
+	{
+	_LIT(KRHeap, "RHeap");
+	_LIT(KRHybridHeap, "RHybridHeap");
+	_LIT(KUnknown, "Unknown");
+	switch (iAllocatorType)
+		{
+		case EUrelOldRHeap:
+		case EUdebOldRHeap:
+			return KRHeap;
+		case EUrelHybridHeap:
+		case EUdebHybridHeap:
+			return KRHybridHeap;
+		case EAllocator:
+		case EUnknown:
+		default:
+			return KUnknown;
+		}
+	}
+
+#ifdef __KERNEL_MODE__
+
+DChunk* LtkUtils::RAllocatorHelper::OpenUnderlyingChunk()
+	{
+	// Enter and leave in CS and with no locks held. On exit the returned DChunk has been Open()ed.
+	TInt err = iChunk->Open();
+	if (err) return NULL;
+	return iChunk;
+	}
+
+DChunk* LtkUtils::RKernelSideAllocatorHelper::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.
+	// It is for this reason that iChunk is private, to remove temptation
+	
+	// Enter and leave in CS and with no locks held. On exit the returned DChunk has been Open()ed.
+	TUint32 chunkHandle = 0;
+	TInt err = ReadData(iAllocatorAddress + _FOFF(RHackHeap, iChunkHandle), &chunkHandle, sizeof(TUint32));
+	if (err) return NULL;
+
+	NKern::LockSystem();
+	DChunk* result = (DChunk*)Kern::ObjectFromHandle(iThread, chunkHandle, EChunk);
+	if (result && result->Open() != KErrNone)
+		{
+		result = NULL;
+		}
+	NKern::UnlockSystem();
+	return result;
+	}
+
+LtkUtils::RAllocatorHelper::TType LtkUtils::RAllocatorHelper::GetType() const
+	{
+	switch (iAllocatorType)
+		{
+		case EUrelOldRHeap:
+		case EUdebOldRHeap:
+			return ETypeRHeap;
+		case EUrelHybridHeap:
+		case EUdebHybridHeap:
+			return ETypeRHybridHeap;
+		case EAllocator:
+		case EUnknown:
+		default:
+			return ETypeUnknown;
+		}
+	}
+
+#else
+
+TInt LtkUtils::RAllocatorHelper::EuserIsUdeb()
+	{
+	TAny* buf = User::Alloc(4096);
+	if (!buf) return KErrNoMemory;
+	RAllocator* dummyHeap = UserHeap::FixedHeap(buf, 4096, 4, ETrue);
+	if (!dummyHeap) return KErrNoMemory; // Don't think this can happen
+
+	dummyHeap->__DbgSetAllocFail(RAllocator::EFailNext, 1);
+	TAny* ptr = dummyHeap->Alloc(4);
+	// Because we specified singleThreaded=ETrue we can allow dummyHeap to just go out of scope here
+	User::Free(buf);
+
+	if (ptr)
+		{
+		// Clearly the __DbgSetAllocFail had no effect so we must be urel
+		// We don't need to free ptr because it came from the dummy heap
+		return EFalse;
+		}
+	else
+		{
+		return ETrue;
+		}
+	}
+
+#ifndef STANDALONE_ALLOCHELPER
+
+#include <fshell/ltkutils.h>
+HUEXPORT_C void LtkUtils::MakeHeapCellInvisible(TAny* aCell)
+	{
+	RAllocatorHelper helper;
+	TInt err = helper.Open(&User::Allocator());
+	if (err == KErrNone)
+		{
+		helper.SetCellNestingLevel(aCell, -1);
+		helper.Close();
+		}
+	}
+#endif // STANDALONE_ALLOCHELPER
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Shared/heaputils.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,216 @@
+// heaputils.h
+// 
+// Copyright (c) 2010 Accenture. All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the "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:
+// Accenture - Initial contribution
+//
+
+
+#ifndef FSHELL_HEAP_UTILS_H
+#define FSHELL_HEAP_UTILS_H
+
+#include <e32cmn.h>
+
+#ifdef __KERNEL_MODE__
+class DThread;
+class DChunk;
+#else
+class RMemoryAccess;
+#endif // __KERNEL_MODE__
+
+#if defined(STANDALONE_ALLOCHELPER) || defined(__KERNEL_MODE__)
+#define HUIMPORT_C
+#define HUCLASS(x) NONSHARABLE_CLASS(x)
+#else
+#define HUIMPORT_C IMPORT_C
+#define HUCLASS(x) class x
+#endif
+
+namespace LtkUtils
+	{
+
+class THeapInfo;
+	
+HUCLASS(RAllocatorHelper) // class RAllocatorHelper
+	{
+public:
+	HUIMPORT_C RAllocatorHelper();
+#ifdef __KERNEL_MODE__
+	TInt OpenKernelHeap();
+#else
+	HUIMPORT_C TInt Open(RAllocator* aAllocator);
+#endif
+	HUIMPORT_C TInt SetCellNestingLevel(TAny* aCell, TInt aNestingLevel);
+	HUIMPORT_C TInt GetCellNestingLevel(TAny* aCell, TInt& aNestingLevel);
+	HUIMPORT_C TInt AllocCountForCell(TAny* aCell) const;
+	HUIMPORT_C TLinAddr AllocatorAddress() const;
+	HUIMPORT_C TInt RefreshDetails();
+	
+	HUIMPORT_C TInt CommittedSize();
+	HUIMPORT_C TInt AllocatedSize();
+	HUIMPORT_C TInt AllocationCount();
+	HUIMPORT_C TInt MaxCommittedSize();
+	HUIMPORT_C TInt MinCommittedSize();
+	HUIMPORT_C TInt CountUnusedPages();
+	HUIMPORT_C TInt CommittedFreeSpace();
+
+	enum TCellType
+		{
+		EAllocation, EFreeSpace, EBadness
+		};
+
+	enum TExtendedCellType
+		{
+		EAllocationMask = 0xFF,
+		EFreeMask = 0xFF00,
+		EBadnessMask = 0xFF000000,
+
+		EHeapAllocation = 1,
+		EDlaAllocation = 2,
+		EPageAllocation = 3,
+		ESlabAllocation = 4,
+		
+		EHeapFreeCell = 0x0100,
+		EDlaFreeCell = 0x0200,
+		// There is nothing 'free' in the page allocator
+		ESlabFreeCell = 0x0300, // Used to track free cells in partially-filled slabs
+		ESlabFreeSlab = 0x0400, // Used to track entirely empty slabs (that don't have a specific cell size)
+
+		EHeapBadFreeCellAddress = 0x01000000,
+		EHeapBadFreeCellSize = 0x02000000,
+		EHeapBadAllocatedCellSize = 0x03000000,
+		EHeapBadAllocatedCellAddress = 0x04000000,
+		};
+			
+	// TBool WalkFunc(TAny* aContext, TCellType aCellType, TLinAddr aCellPtr, TInt aCellLength)
+	// aCellPtr points to the start of the cell payload for allocated cells (unlike RHeap's walker, which points to the cell header)
+	// aCellLength is the payload length, ie what AllocLen(aCellPtr) would return
+	// return ETrue to continue walking, EFalse to stop the walk
+	typedef TBool (*TWalkFunc)(TAny*, TCellType, TLinAddr, TInt);
+	typedef TBool (*TWalkFunc2)(RAllocatorHelper&, TAny*, TCellType, TLinAddr, TInt);
+	typedef TBool (*TWalkFunc3)(RAllocatorHelper&, TAny*, TExtendedCellType, TLinAddr, TInt);
+	HUIMPORT_C TInt Walk(TWalkFunc aCallbackFn, TAny* aContext);
+	HUIMPORT_C TInt Walk(TWalkFunc2 aCallbackFn, TAny* aContext); // Like the other but the walk func gives you the RAllocatorHelper pointer too
+	HUIMPORT_C TInt Walk(TWalkFunc3 aCallbackFn, TAny* aContext); // Like the other but the walk func gives you more details about the allocation type
+	HUIMPORT_C TInt SizeForCellType(TExtendedCellType aType);
+	HUIMPORT_C TInt CountForCellType(TExtendedCellType aType);
+	HUIMPORT_C TBool AllocatorIsUdeb() const;
+	HUIMPORT_C const TDesC& Description() const;
+	HUIMPORT_C virtual void Close();
+
+#ifdef __KERNEL_MODE__
+	virtual DChunk* OpenUnderlyingChunk(); // Must be in CS
+	enum TType
+		{
+		ETypeUnknown,
+		ETypeRHeap,
+		ETypeRHybridHeap,
+		};
+	TType GetType() const; // This is for information only, nothing should care about the return value
+#endif
+
+protected:
+	TInt FinishConstruction();
+	TInt IdentifyAllocatorType(TBool aAllocatorIsUdeb, TBool aIsTheKernelHeap=EFalse);
+	TInt OpenChunkHeap(TLinAddr aChunkBase, TInt aChunkMaxSize);
+#ifndef __KERNEL_MODE__
+	static TInt EuserIsUdeb();
+#endif
+	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:
+	TInt ReadWord(TLinAddr aLocation, TUint32& aResult) const;
+	TInt ReadByte(TLinAddr aLocation, TUint8& aResult) const;
+	TInt WriteWord(TLinAddr aLocation, TUint32 aWord);
+	TInt RefreshDetails(TUint aMask);
+	TInt DoRefreshDetails(TUint aMask);
+	TInt CheckValid(TUint aMask);
+	TInt DoWalk(TWalkFunc3 aCallbackFn, TAny* aContext);
+	TInt OldSkoolWalk(TWalkFunc3 aCallbackFn, TAny* aContext);
+	TInt NewHotnessWalk(TWalkFunc3 aCallbackFn, TAny* aContext);
+	static TBool DispatchClientWalkCallback(RAllocatorHelper& aHelper, TAny* aContext, TExtendedCellType aCellType, TLinAddr aCellPtr, TInt aCellLength);
+	static TBool WalkForStats(RAllocatorHelper& aSelf, TAny* aContext, TExtendedCellType aType, TLinAddr aCellPtr, TInt aCellLength);
+	TUint PageMapOperatorBrackets(unsigned ix, TInt& err) const;
+	TInt PageMapFind(TUint start, TUint bit, TInt& err);
+	TUint PageMapBits(unsigned ix, unsigned len, TInt& err);
+	TUint PagedDecode(TUint pos, TInt& err);
+	TInt TreeWalk(TUint32 aSlabRoot, TInt aSlabType, TWalkFunc3 aCallbackFn, TAny* aContext, TBool& shouldContinue);
+protected:
+	TLinAddr iAllocatorAddress;
+	enum TAllocatorType
+		{
+		EUnknown,
+		EAllocator,
+		EUrelOldRHeap,
+		EUdebOldRHeap,
+		EUrelHybridHeap,
+		EUdebHybridHeap,
+		};
+	TAllocatorType iAllocatorType;
+private:
+	THeapInfo* iInfo;
+	TUint iValidInfo;
+	TUint8* iTempSlabBitmap;
+	mutable TAny* iPageCache;
+	mutable TLinAddr iPageCacheAddr;
+#ifdef __KERNEL_MODE__
+	DChunk* iChunk;
+	//TUint iSpare[0];
+#else
+	TUint iSpare[1];
+#endif
+	};
+
+#ifdef __KERNEL_MODE__
+
+class RKernelSideAllocatorHelper : public RAllocatorHelper
+	{
+public:
+	RKernelSideAllocatorHelper();
+	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();
+private:
+	DThread* iThread;
+	};
+
+#else
+
+class RProxyAllocatorHelper : public RAllocatorHelper
+	{
+public:
+	HUIMPORT_C RProxyAllocatorHelper();
+	HUIMPORT_C TInt Open(RMemoryAccess& aMem, TUint aThreadId);
+	HUIMPORT_C TInt OpenChunkHeap(RMemoryAccess& aMem, TAny* aDChunkPtr);
+	HUIMPORT_C 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:
+	RMemoryAccess* iMemoryAccess;
+	TUint iThreadId;
+	};
+
+#endif // __KERNEL_MODE__
+
+	} // namespace LtkUtils
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/User/Include/MemSpyDriverStreamReaderImp.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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 MEMSPYDRIVERSTREAMREADERIMP_H
+#define MEMSPYDRIVERSTREAMREADERIMP_H
+
+// System includes
+#include <e32base.h>
+
+// Classes referenced
+
+
+class CMemSpyMemStreamReader : public CBase
+    {
+public:
+    CMemSpyMemStreamReader( const TDesC8& aData );
+    void ConstructL();
+    
+public: // API
+    TInt32 ReadInt32L();
+    TUint32 ReadUint32L();
+    void ReadL( TDes8& aDes );
+    void ReadL( TDes16& aDes );
+
+private: // Internal methods
+    void IsAvailableL( TInt aRequired ) const;
+    void IncrementPos( TInt aAmount );
+
+private: // Data members
+    const TUint8* iCurrent;
+    const TUint8* iMax;
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/User/Source/MemSpyDriverClient.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1557 @@
+/*
+* 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 <memspy/driver/memspydriverclient.h>
+
+// System includes
+#include <e32svr.h>
+
+// User includes
+#include "MemSpyDriverOpCodes.h"
+#include <memspy/driver/memspydriverconstants.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include "MemSpyDriverStreamReaderImp.h"
+#include "MemSpyDriverObjectsInternal.h"
+#include "heaputils.h"
+
+// Constants
+const TInt KMemSpyClientBufferGrowSize = 0x1000 * 8; // 32kb
+
+// Forward declarations
+static void PrintHeapInfo( const TMemSpyHeapInfo& aInfo );
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::Open()
+	{
+    TInt err = iBuffer.Create( KMemSpyClientBufferGrowSize );
+    if  ( err == KErrNone )
+        {
+        err = User::LoadLogicalDevice( KMemSpyDriverDeviceName );
+        if  ( err == KErrNone || err == KErrAlreadyExists )
+		    {
+		    err = DoCreate( KMemSpyDriverDeviceName, KMemSpyDriverVersion(), KNullUnit, NULL, NULL, EOwnerThread );
+            if  ( err == KErrNone )
+                {
+                TUint heapVTable = RHeapVTable();
+ 	            err = DoControl( EMemSpyDriverOpCodeMiscSetRHeapVTable, (TAny*) heapVTable );
+                }
+		    }
+        }
+    //
+    if ( err != KErrNone )
+        {
+        RDebug::Printf( "[MemSpy] RMemSpyDriverClient::Open() - END - err: %d", err );
+        }
+    //
+	return err;
+	}
+
+
+
+EXPORT_C void RMemSpyDriverClient::Close()
+	{
+    RBusLogicalChannel::Close();
+    const TInt err = User::FreeLogicalDevice( KMemSpyDriverDeviceName );
+    //
+    if ( err != KErrNone )
+        {
+        RDebug::Printf( "[MemSpy] RMemSpyDriverClient::Close() - free logical device error: %d", err );
+        }
+    //
+    iBuffer.Close();
+    (void) err;
+	}
+
+
+EXPORT_C void RMemSpyDriverClient::GetVersion( TVersion& aVersion )
+    {
+    TVersion v = KMemSpyDriverVersion();
+    Mem::Copy( (TAny*)&aVersion, (TAny*)&v, sizeof( TVersion ) );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::ReadMemory( TUint aTid, TLinAddr aSrc, TDes8& aDest )
+	{
+	TMemSpyDriverInternalReadMemParams params;
+	params.iTid = aTid;
+	params.iAddr = aSrc;
+	params.iDes = &aDest;
+    aDest.Zero();
+    //
+	TInt r = DoControl( EMemSpyDriverOpCodeRawMemoryRead, &params, NULL );
+    if  ( r >= KErrNone )
+        {
+        aDest.SetLength( r );
+        r = KErrNone;
+        }
+    //
+    return r;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetCodeSegs( TAny** aHandleArray, TInt& aHandleCount, TBool aOnlyRamLoaded )
+    {
+	TMemSpyDriverInternalCodeSnapshotParams params;
+	params.iFilter = aOnlyRamLoaded;
+	params.iHandles = aHandleArray;
+	params.iCountPtr = &aHandleCount;
+	params.iMaxCount = aHandleCount;
+    //
+    aHandleCount = 0;
+    //
+	return DoControl( EMemSpyDriverOpCodeCodeSegsGetAll, &params, NULL );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetCodeSegs( TUint aPid, TAny** aHandleArray, TInt& aHandleCount )
+	{
+	TMemSpyDriverInternalCodeSnapshotParams params;
+	params.iFilter = aPid;
+	params.iHandles = aHandleArray;
+	params.iCountPtr = &aHandleCount;
+	params.iMaxCount = aHandleCount;
+    //
+    aHandleCount = 0;
+    //
+	return DoControl( EMemSpyDriverOpCodeCodeSegsGetCodeSegsForProcess, &params, NULL );
+	}
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetCodeSegInfo( TAny* aHandle, TUint aPid, TMemSpyDriverCodeSegInfo& aInfo )
+	{
+	TMemSpyDriverInternalCodeSegParams params;
+	params.iPid = aPid;
+	params.iHandle = aHandle;
+	params.iInfoPointer = &aInfo;
+    //
+	const TInt r = DoControl( EMemSpyDriverOpCodeCodeSegsGetCodeSegInfo, &params, NULL );
+	return r;
+	}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetChunkHandles( TAny** aHandleArray, TInt& aHandleCount )
+    {
+	TMemSpyDriverInternalChunkHandleParams params;
+	params.iId = 0;
+	params.iType = EMemSpyDriverPrivateObjectTypeAll;
+	params.iHandles = aHandleArray;
+	params.iCountPtr = &aHandleCount;
+    params.iMaxCount = aHandleCount;
+    //
+    aHandleCount = 0;
+	//
+	const TInt err = DoControl( EMemSpyDriverOpCodeChunkGetHandles, &params, NULL );
+    return err;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetChunkInfo( TAny* aHandle, TMemSpyDriverChunkInfo& aInfo )
+    {
+	TMemSpyDriverInternalChunkInfoParams params;
+	TBuf8<KMaxFullName> name;
+	params.iHandle = aHandle;
+	const TInt r = DoControl( EMemSpyDriverOpCodeChunkGetInfo, &params, NULL );
+	//
+	if  ( r == KErrNone )
+		{
+        aInfo.iHandle = aHandle;
+		aInfo.iBaseAddress = params.iBaseAddress;
+		aInfo.iSize = params.iSize;
+		aInfo.iMaxSize = params.iMaxSize;
+		aInfo.iOwnerId = params.iOwnerId;
+        aInfo.iType = params.iType;
+        aInfo.iAttributes = params.iAttributes;
+		aInfo.iName.Copy( params.iName );
+		}
+	//
+	return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetChunkInfo( TAny* aHandle, TMemSpyDriverChunkInfoWithoutName& aInfo )
+    {
+    TMemSpyDriverChunkInfo info;
+    //
+    const TInt r = GetChunkInfo( aHandle, info );
+    if  ( r == KErrNone )
+        {
+        aInfo = info;
+        }
+    //
+    return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetChunkHandlesForProcess( TUint aPid, TAny** aHandleArray, TInt& aHandleCount )
+    {
+	TMemSpyDriverInternalChunkHandleParams params;
+	params.iId = aPid;
+	params.iType = EMemSpyDriverPrivateObjectTypeProcess;
+	params.iHandles = aHandleArray;
+	params.iCountPtr = &aHandleCount;
+	params.iMaxCount = aHandleCount;
+	//
+    aHandleCount = 0;
+    //
+	return DoControl( EMemSpyDriverOpCodeChunkGetHandles, &params, NULL );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetChunkHandlesForThread( TUint aTid, TAny** aHandleArray, TInt& aHandleCount )
+    {
+	TMemSpyDriverInternalChunkHandleParams params;
+	params.iId = aTid;
+	params.iType = EMemSpyDriverPrivateObjectTypeThread;
+	params.iHandles = aHandleArray;
+	params.iCountPtr = &aHandleCount;
+	params.iMaxCount = aHandleCount;
+	//
+    aHandleCount = 0;
+    //
+	return DoControl( EMemSpyDriverOpCodeChunkGetHandles, &params, NULL );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetThreadInfo( TUint aTid, TMemSpyDriverThreadInfo& aInfo )
+	{
+	TMemSpyDriverInternalThreadInfoParams params;
+    params.iRHeapVTable = RHeapVTable();
+    params.iDebugAllocator = DebugEUser();
+    //
+	TInt r = DoControl( EMemSpyDriverOpCodeThreadAndProcessGetInfoThread, (TAny*)aTid, &params);
+	//
+	if  ( r == KErrNone )
+		{
+        // Copy common properties
+        Mem::Copy( &aInfo, &params, sizeof( TMemSpyDriverThreadInfoBase ) );
+
+        // Copy name
+        aInfo.iFullName.Copy( params.iFullName );
+
+        // Get other basic properties via RThread
+        RThread thread;
+        r = OpenThread( aTid, thread );
+        if ( r == KErrNone )
+            {
+            RProcess process;
+            r = thread.Process( process );
+            if ( r == KErrNone )
+                {
+	            aInfo.iPid = process.Id();
+                process.Close();
+                }
+
+            aInfo.iThreadPriority = thread.Priority();
+            aInfo.iExitReason = thread.ExitReason();
+            aInfo.iExitType = thread.ExitType();
+            aInfo.iExitCategory = thread.ExitCategory();
+
+            thread.Close();
+            }
+        }
+
+    return r;
+	}
+
+EXPORT_C TInt RMemSpyDriverClient::GetProcessInfo( TUint aPid, TMemSpyDriverProcessInfo& aInfo )
+    {
+	TInt r = DoControl( EMemSpyDriverOpCodeThreadAndProcessGetInfoProcess, (TAny*)aPid, &aInfo);
+    
+    // Get other properties via RProcess.
+    if  ( r == KErrNone )
+        {
+        RProcess process;
+        r = OpenProcess( aPid, process );
+        if  ( r == KErrNone )
+            {
+            aInfo.iUids = process.Type();
+            aInfo.iPriority = process.Priority();
+            //
+            process.Close();
+            }
+        }
+
+    return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::ProcessThreadsSuspend( TUint aPid )
+    {
+	return DoControl( EMemSpyDriverOpCodeThreadAndProcessSuspendAllThreads, (TAny*) aPid, NULL );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::ProcessThreadsResume( TUint aPid )
+    {
+	return DoControl( EMemSpyDriverOpCodeThreadAndProcessResumeAllThreads, (TAny*) aPid, NULL );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::ThreadEnd( TUint aId, TExitType aType )
+    {
+    TInt err = KErrNone;
+    //
+    if  ( aType == EExitPending )
+        {
+        err = KErrArgument;
+        }
+    else
+        {
+        err = DoControl( EMemSpyDriverOpCodeThreadAndProcessEndThread, (TAny*) aId, (TAny*) aType );
+        }
+    //
+    return err;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::OpenThread( TUint aId, RThread& aThread )
+    {
+    TInt ret = KErrNone;
+    aThread.Close();
+    //
+    const TInt err = DoControl( EMemSpyDriverOpCodeThreadAndProcessOpenThread, (TAny*) aId );
+    if  ( err > 0 )
+        {
+        aThread.SetHandle( err );
+        ret = KErrNone;
+        }
+    else
+        {
+        ret = err;
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::OpenProcess( TUint aId, RProcess& aProcess )
+    {
+    TInt ret = KErrNone;
+    aProcess.Close();
+    //
+    const TInt err = DoControl( EMemSpyDriverOpCodeThreadAndProcessOpenProcess, (TAny*) aId );
+    if  ( err > 0 )
+        {
+        aProcess.SetHandle( err );
+        ret = KErrNone;
+        }
+    else
+        {
+        ret = err;
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C void RMemSpyDriverClient::GetThreadsL( const TProcessId& aId, RArray<TThreadId>& aThreads )
+    {
+	aThreads.Reset();
+    //
+    ResetStreamBuffer();
+    const TInt err = DoControl( EMemSpyDriverOpCodeThreadAndProcessGetThreads, (TAny*) (TUint) aId, (TAny*) &iBuffer );
+    User::LeaveIfError( err );
+
+    // Open stream
+    RMemSpyMemStreamReader stream = StreamOpenL();
+    CleanupClosePushL( stream );
+        
+    // Extract thread ids
+    const TInt threadCount = stream.ReadInt32L();
+    for( TInt i=0; i<threadCount; i++ )
+        {
+        const TThreadId id( stream.ReadUint32L() );
+        aThreads.AppendL( id );
+        }
+        
+    // Tidy up
+    CleanupStack::PopAndDestroy( &stream );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::SetPriority( TUint aId, TThreadPriority aPriority )
+    {
+    // The kernel side API to set thread priority expects a value in the range of 0-63, i.e. an absolute
+    // NThread priority. In order to support process-relative thread priorities, we'd need to duplicate
+    // the kernel priority mapping tables - not a good idea - therefore we'll only support absolute values.
+    TInt err = KErrNone;
+    if  ( aPriority < EPriorityAbsoluteVeryLow )
+        {
+        err = KErrArgument;
+        }
+    else
+        {
+        err = DoControl( EMemSpyDriverOpCodeThreadAndProcessSetPriorityThread, (TAny*) aId, (TAny*) aPriority );
+        }
+    //
+    return err;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoUser( TMemSpyHeapInfo& aInfo, TUint aTid )
+    {
+    TMemSpyDriverInternalHeapRequestParameters params;
+    //
+    params.iTid = aTid;
+    params.iRHeapVTable = RHeapVTable();
+    params.iDebugAllocator = DebugEUser();
+    params.iMasterInfo = &aInfo;
+    //
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetUser, &params, NULL );
+	//
+	if  ( r == KErrNone )
+    	{
+        PrintHeapInfo( aInfo );
+        
+        // Need to do this on the user-side
+        if  ( aInfo.Type() == TMemSpyHeapInfo::ETypeRHeap )
+            {
+            TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
+            TMemSpyHeapMetaDataRHeap& metaData = rHeapInfo.MetaData();
+            metaData.SetVTable( RHeapVTable() );
+            //metaData.SetClassSize( sizeof( RHeap ) );
+            }
+        }
+    else if ( r == KErrNotSupported )
+        {
+        aInfo.SetType( TMemSpyHeapInfo::ETypeUnknown );
+        r = KErrNone;
+        }
+	//
+	return r;
+    }
+
+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)
+	{
+    TMemSpyDriverInternalHeapRequestParameters params;
+    //
+    params.iTid = aTid;
+    params.iRHeapVTable = RHeapVTable();
+    params.iDebugAllocator = DebugEUser();
+    params.iMasterInfo = &aInfo;
+    params.iBuildFreeCellList = ETrue;
+	params.iBuildAllocCellList = aCollectAllocatedCellsAsWellAsFree;
+
+    //
+    aCells.Reset();
+    ResetStreamBuffer();
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetUser, &params );
+	//
+	if  ( r >= KErrNone )
+    	{
+        PrintHeapInfo( aInfo );
+        
+        // Need to do this on the user-side
+        if  ( aInfo.Type() == TMemSpyHeapInfo::ETypeRHeap )
+            {
+            TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
+            TMemSpyHeapMetaDataRHeap& metaData = rHeapInfo.MetaData();
+            metaData.SetVTable( RHeapVTable() );
+            //metaData.SetClassSize( sizeof( RHeap ) );
+            }
+
+        // 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( EMemSpyDriverOpCodeHeapInfoFetchCellList, &iBuffer );
+            if  ( r == KErrNone )
+                {
+                TRAP( r, ReadHeapInfoFreeCellsFromXferBufferL( aCells ) );
+                }
+            }
+        }
+    else if ( r == KErrNotSupported )
+        {
+        aInfo.SetType( TMemSpyHeapInfo::ETypeUnknown );
+        r = KErrNone;
+        }
+	//
+	return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoKernel( TMemSpyHeapInfo& aInfo )
+    {
+    TMemSpyDriverInternalHeapRequestParameters params;
+    params.iTid = KMemSpyDriverGetKernelHeapDataPseudoThreadId;
+    params.iRHeapVTable = NULL;
+    params.iMasterInfo = &aInfo;
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetKernel, &params, NULL );
+	//
+	if  ( r == KErrNone )
+    	{
+        PrintHeapInfo( aInfo );
+        }
+    else if ( r == KErrNotSupported )
+        {
+        aInfo.SetType( TMemSpyHeapInfo::ETypeUnknown );
+        r = KErrNone;
+        }
+	//
+	return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoKernel( TMemSpyHeapInfo& aInfo, RArray< TMemSpyDriverFreeCell >& aFreeCells )
+    {
+    TMemSpyDriverInternalHeapRequestParameters params;
+    params.iTid = KMemSpyDriverGetKernelHeapDataPseudoThreadId;
+    params.iRHeapVTable = NULL;
+    params.iMasterInfo = &aInfo;
+    //
+    aFreeCells.Reset();
+    ResetStreamBuffer();
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetKernel, &params, (TAny*) &iBuffer );
+	//
+	if  ( r == KErrNone )
+    	{
+        PrintHeapInfo( aInfo );
+        TRAP( r, ReadHeapInfoFreeCellsFromXferBufferL( aFreeCells ) );
+        }
+    else if ( r == KErrNotSupported )
+        {
+        aInfo.SetType( TMemSpyHeapInfo::ETypeUnknown );
+        r = KErrNone;
+        }
+	//
+	return r;
+    }
+
+
+EXPORT_C TBool RMemSpyDriverClient::IsDebugKernel()
+    {
+    TBool isDebugKernel = EFalse;
+    DoControl( EMemSpyDriverOpCodeHeapInfoGetIsDebugKernel, (TAny*) &isDebugKernel );
+    return isDebugKernel;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetHeapData( TUint aTid, TUint32 aFreeCellChecksum, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining )
+    {
+    TMemSpyDriverInternalHeapDataParams params;
+    params.iTid = aTid;
+    params.iRHeapVTable = RHeapVTable();
+    params.iDebugAllocator = DebugEUser();
+    params.iDes = &aDest;
+    params.iChecksum = aFreeCellChecksum;
+    params.iRemaining = -1;
+	params.iReadAddress = 0;
+    aDest.Zero();
+    //
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapDataGetUser, &params, NULL );
+	//
+	if  ( r >= KErrNone )
+    	{
+        aDest.SetLength( r );
+        aReadAddress = params.iReadAddress;
+    	aAmountRemaining = params.iRemaining;
+        r = KErrNone;
+    	}
+	//
+	return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetHeapDataNext( 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( EMemSpyDriverOpCodeHeapDataGetUser, &params, NULL );
+	//
+	if  ( r >= KErrNone )
+    	{
+        aDest.SetLength( r );
+        aReadAddress = params.iReadAddress;
+    	aAmountRemaining = params.iRemaining;
+        r = KErrNone;
+    	}
+	//
+    return r;
+    }
+
+
+
+EXPORT_C HBufC8* RMemSpyDriverClient::GetHeapDataKernelLC( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>& aFreeCells )
+    {
+    HBufC8* data = NULL;
+
+    // Going to fetch free cells via stream buffer...
+    ResetStreamBuffer();
+
+    // 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 );
+            }
+        }
+
+    User::LeaveIfError( sizeOrError );
+    return data;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::WalkHeapInit( TUint aTid )
+    {
+    TMemSpyDriverInternalWalkHeapParamsInit params;
+    params.iTid = aTid;
+    params.iRHeapVTable = RHeapVTable();
+    params.iDebugAllocator = DebugEUser();
+    //
+	const TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapInit, &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 )
+    {
+    aCellType = EMemSpyDriverBadCellMask;
+    aCellAddress = NULL;
+    aLength = 0;
+    aNestingLevel = 0;
+    aAllocNumber = 0;
+    aCellHeaderSize = 0;
+    aCellPayloadAddress = NULL;
+    //
+    TMemSpyDriverInternalWalkHeapParamsCell params;
+	const TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapNextCell, (TAny*) aTid, &params );
+    //
+	if  ( r == KErrNone )
+	    {
+        aCellType = (TMemSpyDriverCellType) params.iCellType;
+        aCellAddress = params.iCellAddress;
+        aLength = params.iLength;
+        aNestingLevel = params.iNestingLevel;
+        aAllocNumber = params.iAllocNumber;
+        aCellPayloadAddress = ((TUint8*) aCellAddress) + aCellHeaderSize;
+        }
+    //
+   	return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::WalkHeapReadCellData( TAny* aCellAddress, TDes8& aDest, TInt aReadLen )
+    {
+    TMemSpyDriverInternalWalkHeapCellDataReadParams params;
+    params.iCellAddress = aCellAddress;
+    params.iReadLen = aReadLen;
+    params.iDes = &aDest;
+    aDest.Zero();
+    //
+	TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapReadCellData, &params, NULL );
+    if  ( r >= KErrNone )
+        {
+        aDest.SetLength( r );
+        r = KErrNone;
+        }
+    //
+	return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::WalkHeapGetCellInfo( TAny*& aCellAddress, TMemSpyDriverCellType& aCellType, TInt& aLength, TInt& aNestingLevel, TInt& aAllocNumber, TInt& aCellHeaderSize, TAny*& aCellPayloadAddress )
+    {
+    aCellType = EMemSpyDriverBadCellMask;
+    aLength = 0;
+    aNestingLevel = 0;
+    aAllocNumber = 0;
+    aCellHeaderSize = 0;
+    aCellPayloadAddress = NULL;
+    //
+    TMemSpyDriverInternalWalkHeapParamsCell params;
+	const TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapGetCellInfo, aCellAddress, &params );
+    //
+	if  ( r == KErrNone )
+	    {
+        aCellAddress = params.iCellAddress;
+        aCellType = (TMemSpyDriverCellType) params.iCellType;
+        aLength = params.iLength;
+        aNestingLevel = params.iNestingLevel;
+        aAllocNumber = params.iAllocNumber;
+        aCellPayloadAddress = ((TUint8*) aCellAddress) + aCellHeaderSize;
+        }
+    //
+   	return r;
+    }
+
+
+EXPORT_C void RMemSpyDriverClient::WalkHeapClose()
+    {
+	DoControl( EMemSpyDriverOpCodeWalkHeapClose, NULL, NULL );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetStackInfo( TUint aTid, TMemSpyDriverStackInfo& aInfo )
+    {
+    TMemSpyDriverStackInfo params;
+	const TInt r = DoControl( EMemSpyDriverOpCodeStackGetInfo, (TAny*)aTid, &params );
+	if  (r==KErrNone)
+		{
+		aInfo.iUserStackPointer = params.iUserStackPointer;
+		aInfo.iUserStackBase = params.iUserStackBase;
+		aInfo.iUserStackSize = params.iUserStackSize;
+		aInfo.iUserStackHighWatermark = params.iUserStackHighWatermark;
+		aInfo.iSupervisorStackPointer = params.iSupervisorStackPointer;
+		aInfo.iSupervisorStackBase = params.iSupervisorStackBase;
+		aInfo.iSupervisorStackSize = params.iSupervisorStackSize;
+		aInfo.iSupervisorStackHighWatermark = params.iSupervisorStackHighWatermark;
+		}
+	//
+	return r;
+    }    
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetStackData( TUint aTid, TDes8& aDest, TUint& aAmountRemaining, TMemSpyDriverDomainType aDomain, TBool aEntireStack )
+    {
+    TMemSpyDriverInternalStackDataParams params;
+    params.iTid = aTid;
+    params.iDes = &aDest;
+    params.iDomain = aDomain;
+    params.iEntireStack = aEntireStack;
+    params.iRemaining = -1;
+    aDest.Zero();
+    //
+	TInt r = DoControl( EMemSpyDriverOpCodeStackGetData, &params, NULL );
+	//
+	if  ( r >= KErrNone )
+    	{
+        aDest.SetLength( r );
+    	aAmountRemaining = params.iRemaining;
+        r = KErrNone;
+    	}
+	//
+	return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetStackDataNext( TUint aTid, TDes8& aDest, TUint& aAmountRemaining, TMemSpyDriverDomainType aDomain, TBool aEntireStack )
+    {
+    TMemSpyDriverInternalStackDataParams params;
+    params.iTid = aTid;
+    params.iDes = &aDest;
+    params.iDomain = aDomain;
+    params.iEntireStack = aEntireStack;
+    params.iRemaining = aAmountRemaining;
+    //
+	TInt r = DoControl( EMemSpyDriverOpCodeStackGetData, &params, NULL );
+	//
+	if  ( r >= KErrNone )
+    	{
+        aDest.SetLength( r );
+    	aAmountRemaining = params.iRemaining;
+        r = KErrNone;
+    	}
+	//
+    return r;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::EventMonitorOpen( TUint& aHandle )
+    {
+    const TInt error = DoControl( EMemSpyDriverOpCodeEventMonitorOpen, (TAny*) &aHandle );
+    return error;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::EventMonitorClose( TUint aHandle )
+    {
+    const TInt error = DoControl( EMemSpyDriverOpCodeEventMonitorClose, (TAny*) aHandle );
+    return error;
+    }
+
+
+EXPORT_C void RMemSpyDriverClient::EventMonitorNotify( TUint aHandle, TRequestStatus& aStatus, TUint& aContext )
+    {
+    aStatus = KRequestPending;
+    //
+    TMemSpyDriverInternalEventMonitorParams params;
+    params.iHandle = aHandle;
+    params.iStatus = &aStatus;
+    params.iContext = (TAny*) &aContext;
+    //
+    const TInt err = DoControl( EMemSpyDriverOpCodeEventMonitorNotify, (TAny*) &params );
+    if  ( err != KErrNone )
+        {
+        TRequestStatus* status = &aStatus;
+        User::RequestComplete( status, err );
+        }
+    }
+
+
+EXPORT_C void RMemSpyDriverClient::EventMonitorNotifyCancel( TUint aHandle )
+    {
+    const TInt error = DoControl( EMemSpyDriverOpCodeEventMonitorNotifyCancel, (TAny*) aHandle );
+    (void) error;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::ProcessInspectionOpen( TUint aPid )
+    {
+    const TInt error = DoControl( EMemSpyDriverOpCodeProcessInspectOpen, (TAny*) aPid );
+    return error;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::ProcessInspectionClose( TUint aPid )
+    {
+    const TInt error = DoControl( EMemSpyDriverOpCodeProcessInspectClose, (TAny*) aPid );
+    return error;
+    }
+
+
+EXPORT_C void RMemSpyDriverClient::ProcessInspectionRequestChanges( TUint aPid, TRequestStatus& aStatus, TMemSpyDriverProcessInspectionInfo& aInfo )
+    {
+    aInfo.iProcessId = aPid;
+    aStatus = KRequestPending;
+    const TInt err = DoControl( EMemSpyDriverOpCodeProcessInspectRequestChanges, (TAny*) &aStatus, (TAny*) &aInfo );
+    if  ( err != KErrNone )
+        {
+        TRequestStatus* status = &aStatus;
+        User::RequestComplete( status, err );
+        }
+    }
+
+
+EXPORT_C void RMemSpyDriverClient::ProcessInspectionRequestChangesCancel( TUint aPid )
+    {
+    const TInt error = DoControl( EMemSpyDriverOpCodeProcessInspectRequestChangesCancel, (TAny*) aPid );
+    (void) error;
+    }
+
+
+EXPORT_C void RMemSpyDriverClient::ProcessInspectionAutoStartItemsReset()
+    {
+    const TInt error = DoControl( EMemSpyDriverOpCodeProcessInspectAutoStartListReset );
+    (void) error;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::ProcessInspectionAutoStartItemsAdd( TUint aSID )
+    {
+    const TInt error = DoControl( EMemSpyDriverOpCodeProcessInspectAutoStartListAdd, (TAny*) aSID );
+    return error;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetContainerHandles( TMemSpyDriverContainerType aContainer, TAny** aHandleArray, TInt& aHandleCount )
+    {
+	TMemSpyDriverInternalContainerHandleParams params;
+	params.iTidOrPid = KMemSpyDriverEnumerateContainerHandles;
+	params.iContainer = aContainer;
+	params.iHandles = aHandleArray;
+	params.iCountPtr = &aHandleCount;
+    params.iMaxCount = aHandleCount;
+    params.iHandleSource = EMemSpyDriverThreadOrProcessTypeThread; // Not used
+    //
+    aHandleCount = 0;
+	//
+	return DoControl( EMemSpyDriverOpCodeContainersGetHandles, &params, NULL );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetThreadHandlesByType( TInt aTid, TMemSpyDriverContainerType aType, TAny** aHandleArray, TInt& aHandleCount )
+    {
+	TMemSpyDriverInternalContainerHandleParams params;
+	params.iTidOrPid = aTid;
+	params.iContainer = aType;
+	params.iHandles = aHandleArray;
+	params.iCountPtr = &aHandleCount;
+    params.iMaxCount = aHandleCount;
+    params.iHandleSource = EMemSpyDriverThreadOrProcessTypeThread;
+	//
+    aHandleCount = 0;
+    //
+	return DoControl( EMemSpyDriverOpCodeContainersGetHandles, &params, NULL );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetProcessHandlesByType( TInt aPid, TMemSpyDriverContainerType aType, TAny** aHandleArray, TInt& aHandleCount )
+    {
+	TMemSpyDriverInternalContainerHandleParams params;
+	params.iTidOrPid = aPid;
+	params.iContainer = aType;
+	params.iHandles = aHandleArray;
+	params.iCountPtr = &aHandleCount;
+    params.iMaxCount = aHandleCount;
+    params.iHandleSource = EMemSpyDriverThreadOrProcessTypeProcess;
+	//
+    aHandleCount = 0;
+    //
+	return DoControl( EMemSpyDriverOpCodeContainersGetHandles, &params, NULL );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetGenericHandleInfo( TInt aTid, TMemSpyDriverContainerType aType, TAny* aHandle, TMemSpyDriverHandleInfoGeneric& aParams )
+    {
+    aParams.iType = aType;
+    aParams.iHandle = aHandle;
+    //
+    const TInt r = DoControl( EMemSpyDriverOpCodeContainersGetHandleInfo, (TAny*) aTid, &aParams );
+    return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetApproximateKernelObjectSize( TMemSpyDriverContainerType aType )
+    {
+    TInt size = 0;
+    const TInt error = DoControl( EMemSpyDriverOpCodeContainersGetApproxSize, (TAny*) aType, (TAny*) &size );
+    (void) error;
+    //
+    return size;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetReferencesToMyThread( TUint aTid )
+    {
+    ResetStreamBuffer();
+	return DoControl( EMemSpyDriverOpCodeContainersGetReferencesToMyThread, (TAny*) aTid, (TAny*) &iBuffer );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetReferencesToMyProcess( TUint aPid )
+    {
+    ResetStreamBuffer();
+	return DoControl( EMemSpyDriverOpCodeContainersGetReferencesToMyProcess, (TAny*) aPid, (TAny*) &iBuffer );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetPAndSInfo( TAny* aHandle, TMemSpyDriverPAndSInfo& aInfo )
+    {
+    const TInt r = DoControl( EMemSpyDriverOpCodeContainersGetPAndSInfo, (TAny*) aHandle, &aInfo );
+    return r;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetCondVarSuspendedThreads( TAny* aCondVarHandle, TAny** aThreadHandleArray, TInt& aThreadCount )
+    {
+    TMemSpyDriverInternalCondVarSuspendedThreadParams params;
+    params.iCondVarHandle = aCondVarHandle;
+    params.iThrHandles = aThreadHandleArray;
+    params.iThrCountPtr = &aThreadCount;
+    params.iMaxCount = aThreadCount;
+    //
+    aThreadCount = 0;
+    //
+    return DoControl( EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreads, &params, NULL );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetCondVarSuspendedThreadInfo( TAny* aHandle, TMemSpyDriverCondVarSuspendedThreadInfo& aParams )
+    {
+    return DoControl( EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreadInfo, aHandle, &aParams );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetServerSessionHandles( TAny* aServerHandle, TAny** aSessionHandleArray, TInt& aSessionHandleCount )
+    {
+	TMemSpyDriverInternalServerSessionHandleParams params;
+	params.iServerHandle = aServerHandle;
+	params.iSessionHandles = aSessionHandleArray;
+	params.iSessionCountPtr = &aSessionHandleCount;
+    params.iMaxCount = aSessionHandleCount;
+    //
+    aSessionHandleCount = 0;
+	//
+	return DoControl( EMemSpyDriverOpCodeClientServerGetServerSessionHandles, &params, NULL );
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::GetServerSessionInfo( TAny* aSessionHandle, TMemSpyDriverServerSessionInfo& aParams )
+    {
+    return DoControl( EMemSpyDriverOpCodeClientServerGetServerSessionInfo, aSessionHandle, &aParams );
+    }
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C RMemSpyMemStreamReader RMemSpyDriverClient::StreamOpenL()
+    {
+    CMemSpyMemStreamReader* imp = new(ELeave) CMemSpyMemStreamReader( iBuffer );
+    RMemSpyMemStreamReader ret( imp );
+    CleanupClosePushL( ret ); 
+    imp->ConstructL();
+    CleanupStack::Pop( &ret );
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C TMemSpyMemoryModelType RMemSpyDriverClient::MemoryModelType()
+    {
+    TMemSpyMemoryModelType ret = EMemSpyMemoryModelTypeUnknown;
+    //
+    const TInt err = DoControl( EMemSpyDriverOpCodeMiscGetMemoryModelType );
+    switch( err )
+        {
+    default:
+    case EMemSpyMemoryModelTypeUnknown:
+        ret = EMemSpyMemoryModelTypeUnknown;
+        break;
+    case EMemSpyMemoryModelTypeMoving:
+        ret = EMemSpyMemoryModelTypeMoving;
+        break;
+    case EMemSpyMemoryModelTypeMultiple:
+        ret = EMemSpyMemoryModelTypeMultiple;
+        break;
+    case EMemSpyMemoryModelTypeEmulator:
+        ret = EMemSpyMemoryModelTypeEmulator;
+        break;
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C TUint32 RMemSpyDriverClient::RoundToPageSize( TUint32 aValue )
+    {
+    TUint32 temp = aValue;
+    TAny* pValue = (TAny*) &temp;
+    DoControl( EMemSpyDriverOpCodeMiscGetRoundToPageSize, pValue );
+    return temp;
+    }
+
+
+EXPORT_C TInt RMemSpyDriverClient::Impersonate( TUint32 aValue )
+    {
+    return DoControl( EMemSpyDriverOpCodeMiscImpersonate, (TAny*) aValue );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TUint RMemSpyDriverClient::RHeapVTable()
+    {
+    RHeap* heap = (RHeap*) &User::Allocator();
+    //
+    TUint* pHeap = (TUint*) heap;
+    const TUint heapVTable = *pHeap;
+    //
+    ////RDebug::Printf( "[MemSpy] RMemSpyDriverClient::RHeapVTable() - ret: 0x%08x", heapVTable );
+    return heapVTable;
+    }
+
+
+TBool RMemSpyDriverClient::DebugEUser()
+    {
+	LtkUtils::RAllocatorHelper allocHelper;
+	TBool result = EFalse;
+	TInt err = allocHelper.Open(&User::Allocator());
+	if (!err)
+		{
+		result = allocHelper.AllocatorIsUdeb();
+		allocHelper.Close();
+		}
+	return result;
+    }
+
+
+void RMemSpyDriverClient::ResetStreamBuffer()
+    {
+    iBuffer.Zero();
+    }
+
+
+void RMemSpyDriverClient::ReadHeapInfoFreeCellsFromXferBufferL( RArray<TMemSpyDriverFreeCell>& aFreeCells )
+    {
+    aFreeCells.Reset();
+
+#ifdef _DEBUG
+    RDebug::Printf( "[MemSpy] RMemSpyDriverClient::ReadHeapInfoFreeCellsFromXferBufferL() - buf len: %d", iBuffer.Length() );
+#endif
+
+    if  ( iBuffer.Length() )
+        {
+        RMemSpyMemStreamReader stream = StreamOpenL();
+        CleanupClosePushL( stream );
+
+        const TInt count = stream.ReadInt32L();
+#ifdef _DEBUG
+        RDebug::Printf( "[MemSpy] RMemSpyDriverClient::ReadHeapInfoFreeCellsFromXferBufferL() - count: %d", count );
+#endif
+
+        for( TInt i=0; i<count; i++ )
+            {
+            TMemSpyDriverFreeCell entry;
+            entry.iType = (TMemSpyDriverCellType)stream.ReadInt32L();
+            entry.iAddress = reinterpret_cast< TAny* >( stream.ReadUint32L() );
+            entry.iLength = stream.ReadInt32L();
+            aFreeCells.AppendL( entry );
+            }
+
+        CleanupStack::PopAndDestroy( &stream );
+        }
+
+    ResetStreamBuffer();
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+static void PrintHeapInfo( const TMemSpyHeapInfo& aInfo )
+    {
+#if defined( _DEBUG ) && !defined( __WINS__ )
+    const TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
+    //const TMemSpyHeapObjectDataRHeap& rHeapObjectData = rHeapInfo.ObjectData();
+    const TMemSpyHeapStatisticsRHeap& rHeapStats = rHeapInfo.Statistics();
+    const TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
+
+	/*
+	 * TODO update to reflect new memory allocator structs etc
+	 * 
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator                                      -");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iAccessCount:       %d", rHeapObjectData.iAccessCount);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iHandleCount:       %d", rHeapObjectData.iHandleCount);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iHandles:           0x%08x", rHeapObjectData.iHandles);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iFlags:             0x%08x", rHeapObjectData.iFlags);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iCellCount:         %d", rHeapObjectData.iCellCount);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RAllocator::iTotalAllocSize:    %d", rHeapObjectData.iTotalAllocSize);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - ");
+
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap                                           -");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iMinLength:              %d", rHeapObjectData.iMinLength);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iMaxLength:              %d", rHeapObjectData.iMaxLength);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iOffset:                 %d", rHeapObjectData.iOffset);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iGrowBy:                 %d", rHeapObjectData.iGrowBy);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iChunkHandle:            0x%08x", rHeapObjectData.iChunkHandle);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iBase:                   0x%08x", rHeapObjectData.iBase);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iTop:                    0x%08x", rHeapObjectData.iTop);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iAlign:                  %d", rHeapObjectData.iAlign);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iMinCell:                %d", rHeapObjectData.iAlign);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iPageSize:               %d", rHeapObjectData.iAlign);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFree.next:              0x%08x", rHeapObjectData.iFree.next);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFree.len:               %d", rHeapObjectData.iFree.len);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iNestingLevel:           %d", rHeapObjectData.iNestingLevel);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iAllocCount:             %d", rHeapObjectData.iAllocCount);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFailType:               %d", rHeapObjectData.iFailType);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFailRate:               %d", rHeapObjectData.iFailRate);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFailed:                 %d", rHeapObjectData.iFailed);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iFailAllocCount:         %d", rHeapObjectData.iFailAllocCount);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iRand:                   %d", rHeapObjectData.iRand);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - RHeap::iTestData:               0x%08x", rHeapObjectData.iTestData);
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - ");
+	*/
+
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - Stats (Free)                                    -");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell count:                     %d", rHeapStats.StatsFree().TypeCount());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell size:                      %d", rHeapStats.StatsFree().TypeSize());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell largest:                   0x%08x", rHeapStats.StatsFree().LargestCellAddress());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell largest size:              %d", rHeapStats.StatsFree().LargestCellSize());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - slack:                          0x%08x", rHeapStats.StatsFree().SlackSpaceCellAddress());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - slack size:                     %d", rHeapStats.StatsFree().SlackSpaceCellSize());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - checksum:                       0x%08x", rHeapStats.StatsFree().Checksum());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - ");
+
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - Stats (Alloc)                                   -");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell count:                     %d", rHeapStats.StatsAllocated().TypeCount());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell size:                      %d", rHeapStats.StatsAllocated().TypeSize());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell largest:                   0x%08x", rHeapStats.StatsAllocated().LargestCellAddress());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell largest size:              %d", rHeapStats.StatsAllocated().LargestCellSize());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - ");
+
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - Misc. Info                                      -");
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() ---------------------------------------------------");
+    const TPtrC chunkName( rHeapMetaData.ChunkName() );
+    RDebug::Print(_L("RMemSpyDriverClient::PrintHeapInfo() - chunk name:                     [%S]"), &chunkName );
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - chunk size:                     %d", rHeapMetaData.ChunkSize());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - chunk handle:                   0x%08x", rHeapMetaData.ChunkHandle());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - chunk base address:             0x%08x", rHeapMetaData.ChunkBaseAddress());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - debug allocator:                %d", rHeapMetaData.IsDebugAllocator());
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - shared heap:                    %d", rHeapMetaData.IsSharedHeap() );
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - user thread:                    %d", rHeapMetaData.IsUserThread() );
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - thread id:                      %d", aInfo.Tid() );
+    RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - process id:                     %d", aInfo.Pid() );
+    //RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell header size (free):        %d", rHeapMetaData.HeaderSizeFree());
+    //RDebug::Printf("RMemSpyDriverClient::PrintHeapInfo() - cell header size (alloc):       %d", rHeapMetaData.HeaderSizeAllocated());
+#else
+    (void) aInfo;
+#endif
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/User/Source/MemSpyDriverStreamReader.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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 <memspy/driver/memspydriverstreamreader.h>
+
+// User includes
+#include "MemSpyDriverStreamReaderImp.h"
+
+
+
+
+RMemSpyMemStreamReader::RMemSpyMemStreamReader( CMemSpyMemStreamReader* aImp )
+:   iImp( aImp )
+    {
+    ASSERT( iImp );
+    }
+
+
+EXPORT_C void RMemSpyMemStreamReader::Close()
+    {
+    delete iImp;
+    iImp = NULL; // To pacify code scanner
+    }
+
+
+EXPORT_C TInt32 RMemSpyMemStreamReader::ReadInt32L()
+    {
+    return iImp->ReadInt32L();
+    }
+
+
+EXPORT_C TUint32 RMemSpyMemStreamReader::ReadUint32L()
+    {
+    return iImp->ReadUint32L();
+    }
+
+
+EXPORT_C void RMemSpyMemStreamReader::ReadL( TDes8& aDes )
+    {
+    iImp->ReadL( aDes );
+    }
+
+
+EXPORT_C void RMemSpyMemStreamReader::ReadL( TDes16& aDes )
+    {
+    iImp->ReadL( aDes );
+    }
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/User/Source/MemSpyDriverStreamReaderImp.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* 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 "MemSpyDriverStreamReaderImp.h"
+
+
+
+
+CMemSpyMemStreamReader::CMemSpyMemStreamReader( const TDesC8& aData )
+    {
+    iCurrent = aData.Ptr();
+    iMax = iCurrent + aData.Length();
+    }
+
+
+void CMemSpyMemStreamReader::ConstructL()
+    {
+    }
+
+
+TInt32 CMemSpyMemStreamReader::ReadInt32L()
+    {
+    TInt32 ret = 0;
+    //
+    const TInt size = sizeof( TInt32 );
+    IsAvailableL( size );
+    Mem::Copy( (TAny*) &ret, iCurrent, size );
+    IncrementPos( size );
+    //
+    return ret;
+    }
+
+
+TUint32 CMemSpyMemStreamReader::ReadUint32L()
+    {
+    TUint32 ret = 0;
+    //
+    const TInt size = sizeof( TUint32 );
+    IsAvailableL( size );
+    Mem::Copy( (TAny*) &ret, iCurrent, size );
+    IncrementPos( size );
+    //
+    return ret;
+    }
+
+
+void CMemSpyMemStreamReader::ReadL( TDes8& aDes )
+    {
+    const TInt length = ReadInt32L();
+
+    // Need to check the remaining text is actually present...
+    IsAvailableL( length );
+
+    // Now read into client descriptor
+    aDes.SetLength( length );
+    if  ( length > 0 ) 
+        {
+        TUint8* dest = const_cast< TUint8* >( aDes.Ptr() );
+        Mem::Copy( dest, iCurrent, length );
+        }
+    //
+    IncrementPos( length );
+    }
+
+
+void CMemSpyMemStreamReader::ReadL( TDes16& aDes )
+    {
+    // The kernel driver only ever writes narrow descriptors.
+    // However, we can expand them to be UCS2
+    const TInt length = ReadInt32L();
+
+    // Need to check the remaining text is actually present...
+    IsAvailableL( length );
+
+    // Set final length in descriptor
+    aDes.SetLength( length );
+
+    // Read each char
+    TUint16* dest = const_cast< TUint16* >( aDes.Ptr() );
+    for( TInt i=0; i<length; i++ )
+        {
+        *dest++ = *iCurrent++;
+        }
+    }
+
+
+void CMemSpyMemStreamReader::IsAvailableL( TInt aRequired ) const
+    {
+    const TUint8* endPos = iCurrent + aRequired;
+    if  ( endPos > iMax )
+        {
+        User::Leave( KErrOverflow );
+        }
+    }
+
+
+void CMemSpyMemStreamReader::IncrementPos( TInt aAmount )
+    {
+    iCurrent += aAmount;
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/eabi/memspydriverclientu.def	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,71 @@
+EXPORTS
+	_ZN19RMemSpyDriverClient10GetVersionER8TVersion @ 1 NONAME
+	_ZN19RMemSpyDriverClient10OpenThreadEjR7RThread @ 2 NONAME
+	_ZN19RMemSpyDriverClient10ReadMemoryEjmR5TDes8 @ 3 NONAME
+	_ZN19RMemSpyDriverClient11GetCodeSegsEPPvRii @ 4 NONAME
+	_ZN19RMemSpyDriverClient11GetCodeSegsEjPPvRi @ 5 NONAME
+	_ZN19RMemSpyDriverClient11GetHeapDataEjmR5TDes8RjS2_ @ 6 NONAME
+	_ZN19RMemSpyDriverClient11GetThreadsLERK10TProcessIdR6RArrayI9TThreadIdE @ 7 NONAME
+	_ZN19RMemSpyDriverClient11ImpersonateEm @ 8 NONAME
+	_ZN19RMemSpyDriverClient11OpenProcessEjR8RProcess @ 9 NONAME
+	_ZN19RMemSpyDriverClient11SetPriorityEj15TThreadPriority @ 10 NONAME
+	_ZN19RMemSpyDriverClient11StreamOpenLEv @ 11 NONAME
+	_ZN19RMemSpyDriverClient12GetChunkInfoEPvR22TMemSpyDriverChunkInfo @ 12 NONAME
+	_ZN19RMemSpyDriverClient12GetChunkInfoEPvR33TMemSpyDriverChunkInfoWithoutName @ 13 NONAME
+	_ZN19RMemSpyDriverClient12GetPAndSInfoEPvR22TMemSpyDriverPAndSInfo @ 14 NONAME
+	_ZN19RMemSpyDriverClient12GetStackDataEjR5TDes8Rj23TMemSpyDriverDomainTypei @ 15 NONAME
+	_ZN19RMemSpyDriverClient12GetStackInfoEjR22TMemSpyDriverStackInfo @ 16 NONAME
+	_ZN19RMemSpyDriverClient12WalkHeapInitEj @ 17 NONAME
+	_ZN19RMemSpyDriverClient13GetThreadInfoEjR23TMemSpyDriverThreadInfo @ 18 NONAME
+	_ZN19RMemSpyDriverClient13IsDebugKernelEv @ 19 NONAME
+	_ZN19RMemSpyDriverClient13WalkHeapCloseEv @ 20 NONAME
+	_ZN19RMemSpyDriverClient14GetCodeSegInfoEPvjR24TMemSpyDriverCodeSegInfo @ 21 NONAME
+	_ZN19RMemSpyDriverClient14GetProcessInfoEjR24TMemSpyDriverProcessInfo @ 22 NONAME
+	_ZN19RMemSpyDriverClient15GetChunkHandlesEPPvRi @ 23 NONAME
+	_ZN19RMemSpyDriverClient15GetHeapDataNextEjR5TDes8RjS2_ @ 24 NONAME
+	_ZN19RMemSpyDriverClient15GetHeapInfoUserER15TMemSpyHeapInfoj @ 25 NONAME
+	_ZN19RMemSpyDriverClient15GetHeapInfoUserER15TMemSpyHeapInfojR6RArrayI21TMemSpyDriverFreeCellE @ 26 NONAME
+	_ZN19RMemSpyDriverClient15MemoryModelTypeEv @ 27 NONAME
+	_ZN19RMemSpyDriverClient15RoundToPageSizeEm @ 28 NONAME
+	_ZN19RMemSpyDriverClient16EventMonitorOpenERj @ 29 NONAME
+	_ZN19RMemSpyDriverClient16GetStackDataNextEjR5TDes8Rj23TMemSpyDriverDomainTypei @ 30 NONAME
+	_ZN19RMemSpyDriverClient16WalkHeapNextCellEjR21TMemSpyDriverCellTypeRPvRiS4_S4_S4_S3_ @ 31 NONAME
+	_ZN19RMemSpyDriverClient17EventMonitorCloseEj @ 32 NONAME
+	_ZN19RMemSpyDriverClient17GetHeapInfoKernelER15TMemSpyHeapInfo @ 33 NONAME
+	_ZN19RMemSpyDriverClient17GetHeapInfoKernelER15TMemSpyHeapInfoR6RArrayI21TMemSpyDriverFreeCellE @ 34 NONAME
+	_ZN19RMemSpyDriverClient18EventMonitorNotifyEjR14TRequestStatusRj @ 35 NONAME
+	_ZN19RMemSpyDriverClient19GetContainerHandlesE26TMemSpyDriverContainerTypePPvRi @ 36 NONAME
+	_ZN19RMemSpyDriverClient19GetHeapDataKernelLCER15TMemSpyHeapInfoR6RArrayI21TMemSpyDriverFreeCellE @ 37 NONAME
+	_ZN19RMemSpyDriverClient19WalkHeapGetCellInfoERPvR21TMemSpyDriverCellTypeRiS4_S4_S4_S1_ @ 38 NONAME
+	_ZN19RMemSpyDriverClient20GetGenericHandleInfoEi26TMemSpyDriverContainerTypePvR30TMemSpyDriverHandleInfoGeneric @ 39 NONAME
+	_ZN19RMemSpyDriverClient20GetServerSessionInfoEPvR30TMemSpyDriverServerSessionInfo @ 40 NONAME
+	_ZN19RMemSpyDriverClient20ProcessThreadsResumeEj @ 41 NONAME
+	_ZN19RMemSpyDriverClient20WalkHeapReadCellDataEPvR5TDes8i @ 42 NONAME
+	_ZN19RMemSpyDriverClient21ProcessInspectionOpenEj @ 43 NONAME
+	_ZN19RMemSpyDriverClient21ProcessThreadsSuspendEj @ 44 NONAME
+	_ZN19RMemSpyDriverClient22GetThreadHandlesByTypeEi26TMemSpyDriverContainerTypePPvRi @ 45 NONAME
+	_ZN19RMemSpyDriverClient22ProcessInspectionCloseEj @ 46 NONAME
+	_ZN19RMemSpyDriverClient23GetProcessHandlesByTypeEi26TMemSpyDriverContainerTypePPvRi @ 47 NONAME
+	_ZN19RMemSpyDriverClient23GetReferencesToMyThreadEj @ 48 NONAME
+	_ZN19RMemSpyDriverClient23GetServerSessionHandlesEPvPS0_Ri @ 49 NONAME
+	_ZN19RMemSpyDriverClient24EventMonitorNotifyCancelEj @ 50 NONAME
+	_ZN19RMemSpyDriverClient24GetChunkHandlesForThreadEjPPvRi @ 51 NONAME
+	_ZN19RMemSpyDriverClient24GetReferencesToMyProcessEj @ 52 NONAME
+	_ZN19RMemSpyDriverClient25GetChunkHandlesForProcessEjPPvRi @ 53 NONAME
+	_ZN19RMemSpyDriverClient30GetApproximateKernelObjectSizeE26TMemSpyDriverContainerType @ 54 NONAME
+	_ZN19RMemSpyDriverClient31ProcessInspectionRequestChangesEjR14TRequestStatusR34TMemSpyDriverProcessInspectionInfo @ 55 NONAME
+	_ZN19RMemSpyDriverClient34ProcessInspectionAutoStartItemsAddEj @ 56 NONAME
+	_ZN19RMemSpyDriverClient36ProcessInspectionAutoStartItemsResetEv @ 57 NONAME
+	_ZN19RMemSpyDriverClient37ProcessInspectionRequestChangesCancelEj @ 58 NONAME
+	_ZN19RMemSpyDriverClient4OpenEv @ 59 NONAME
+	_ZN19RMemSpyDriverClient5CloseEv @ 60 NONAME
+	_ZN19RMemSpyDriverClient9ThreadEndEj9TExitType @ 61 NONAME
+	_ZN22RMemSpyMemStreamReader10ReadInt32LEv @ 62 NONAME
+	_ZN22RMemSpyMemStreamReader11ReadUint32LEv @ 63 NONAME
+	_ZN22RMemSpyMemStreamReader5CloseEv @ 64 NONAME
+	_ZN22RMemSpyMemStreamReader5ReadLER5TDes8 @ 65 NONAME
+	_ZN22RMemSpyMemStreamReader5ReadLER6TDes16 @ 66 NONAME
+	_ZN19RMemSpyDriverClient26GetCondVarSuspendedThreadsEPvPS0_Ri @ 67 NONAME
+	_ZN19RMemSpyDriverClient29GetCondVarSuspendedThreadInfoEPvR39TMemSpyDriverCondVarSuspendedThreadInfo @ 68 NONAME
+	_ZN19RMemSpyDriverClient15GetHeapInfoUserER15TMemSpyHeapInfojR6RArrayI21TMemSpyDriverFreeCellEi @ 69 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/group/MemSpyDriver.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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 <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../symbian_version.hrh"
+
+TARGET          memspydriver.ldd
+TARGETTYPE      ldd
+UID           	0x100000af  0x2002129B
+VENDORID        VID_DEFAULT
+SMPSAFE
+
+CAPABILITY      all
+
+SOURCEPATH      ../Kernel/Source
+
+SOURCE          MemSpyDriverEntryPoint.cpp
+SOURCE          MemSpyDriverDevice.cpp
+SOURCE          MemSpyDriverLogicalChannel.cpp
+
+SOURCE          MemSpyDriverSuspensionManager.cpp
+SOURCE          MemSpyDriverUserEventMonitor.cpp
+SOURCE          MemSpyDriverHeap.cpp
+SOURCE          MemSpyDriverHeapWalker.cpp
+SOURCE          MemSpyDriverUtils.cpp
+SOURCE          MemSpyDriverInspectedProcess.cpp
+SOURCE          MemSpyDriverInspectedProcessManager.cpp
+SOURCE          MemSpyDriverEventMonitor.cpp
+SOURCE          MemSpyDriverObjectIx.cpp
+SOURCE          MemSpyDriverStreamWriter.cpp
+SOURCE          MemSpyDriverXferBuffer.cpp
+source          MemSpyDriverOSAdaption.cpp
+
+SOURCEPATH      ../Kernel/Source/SubChannels
+SOURCE          MemSpyDriverLogChanBase.cpp
+SOURCE          MemSpyDriverLogChanChunks.cpp
+SOURCE          MemSpyDriverLogChanClientServer.cpp
+SOURCE          MemSpyDriverLogChanCodeSegs.cpp
+SOURCE          MemSpyDriverLogChanContainers.cpp
+SOURCE          MemSpyDriverLogChanContainerBase.cpp
+SOURCE          MemSpyDriverLogChanHeapBase.cpp
+SOURCE          MemSpyDriverLogChanHeapData.cpp
+SOURCE          MemSpyDriverLogChanHeapWalk.cpp
+SOURCE          MemSpyDriverLogChanHeapInfo.cpp
+SOURCE          MemSpyDriverLogChanMisc.cpp
+SOURCE          MemSpyDriverLogChanProcessInspection.cpp
+SOURCE          MemSpyDriverLogChanStack.cpp
+SOURCE          MemSpyDriverLogChanRawMemory.cpp
+SOURCE          MemSpyDriverLogChanUserEventMonitor.cpp
+SOURCE          MemSpyDriverLogChanThreadAndProcess.cpp
+
+
+USERINCLUDE     ../Shared
+USERINCLUDE     ../Kernel/Include
+USERINCLUDE     ../Kernel/Include/SubChannels
+
+// New Allocator support
+MACRO			STANDALONE_ALLOCHELPER
+SOURCEPATH      ../Shared
+SOURCE          heaputils.cpp
+
+OS_LAYER_KERNEL_SYSTEMINCLUDE
+
+START WINS
+            	win32_headers
+END
+
+MACRO           MCL_FIND_HANDLES
+
+#if (SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3) || defined(BSW_FLEXIBLE_MEMORY_MODEL)
+    MACRO       MCL_ROBJECTIX_DUPLICATION
+#else
+    MACRO       MCL_DOBJECTIX_DUPLICATION
+#endif
+
+#include <kernel/kern_ext.mmh>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/group/MemSpyDriverClient.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET					memspydriverclient.dll
+TARGETTYPE			dll
+UID							0x1000008D 0x2002129B
+VENDORID				VID_DEFAULT
+SMPSAFE
+
+#include		        "../../group/MemSpyCapabilities.mmh"
+
+SOURCEPATH				../User/Source
+SOURCE					MemSpyDriverClient.cpp
+SOURCE					MemSpyDriverStreamReader.cpp
+SOURCE					MemSpyDriverStreamReaderImp.cpp
+
+USERINCLUDE				../User/Include
+USERINCLUDE				../Shared
+
+OS_LAYER_SYSTEMINCLUDE
+
+LIBRARY					euser.lib efsrv.lib
+
+// New Allocator support
+MACRO			STANDALONE_ALLOCHELPER
+SOURCEPATH      ../Shared
+SOURCE          heaputils.cpp
+
+
+
+
+START WINS
+	baseaddress			0x40000000
+END
+
+START MARM
+
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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:
+*
+*/
+
+PRJ_PLATFORMS
+
+DEFAULT 
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+MemSpyDriver.mmp
+MemSpyDriverClient.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/BWINS/MemSpyEngineu.def	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,427 @@
+EXPORTS
+	??0CMemSpyEngineObject@@QAE@AAV0@@Z @ 1 NONAME ; CMemSpyEngineObject::CMemSpyEngineObject(class CMemSpyEngineObject &)
+	??0CMemSpyEngineObject@@QAE@XZ @ 2 NONAME ; CMemSpyEngineObject::CMemSpyEngineObject(void)
+	??1CMemSpyDeviceWideOperations@@UAE@XZ @ 3 NONAME ; CMemSpyDeviceWideOperations::~CMemSpyDeviceWideOperations(void)
+	??1CMemSpyEngine@@UAE@XZ @ 4 NONAME ; CMemSpyEngine::~CMemSpyEngine(void)
+	??1CMemSpyEngineActiveObject@@UAE@XZ @ 5 NONAME ; CMemSpyEngineActiveObject::~CMemSpyEngineActiveObject(void)
+	??1CMemSpyEngineActiveObjectArray@@UAE@XZ @ 6 NONAME ; CMemSpyEngineActiveObjectArray::~CMemSpyEngineActiveObjectArray(void)
+	??1CMemSpyEngineChunkList@@UAE@XZ @ 7 NONAME ; CMemSpyEngineChunkList::~CMemSpyEngineChunkList(void)
+	??1CMemSpyEngineCodeSegEntry@@UAE@XZ @ 8 NONAME ; CMemSpyEngineCodeSegEntry::~CMemSpyEngineCodeSegEntry(void)
+	??1CMemSpyEngineDriveEntry@@UAE@XZ @ 9 NONAME ; CMemSpyEngineDriveEntry::~CMemSpyEngineDriveEntry(void)
+	??1CMemSpyEngineDriveList@@UAE@XZ @ 10 NONAME ; CMemSpyEngineDriveList::~CMemSpyEngineDriveList(void)
+	??1CMemSpyEngineFbServBitmap@@UAE@XZ @ 11 NONAME ; CMemSpyEngineFbServBitmap::~CMemSpyEngineFbServBitmap(void)
+	??1CMemSpyEngineFbServBitmapArray@@UAE@XZ @ 12 NONAME ; CMemSpyEngineFbServBitmapArray::~CMemSpyEngineFbServBitmapArray(void)
+	??1CMemSpyEngineGenericKernelObjectContainer@@UAE@XZ @ 13 NONAME ; CMemSpyEngineGenericKernelObjectContainer::~CMemSpyEngineGenericKernelObjectContainer(void)
+	??1CMemSpyEngineGenericKernelObjectList@@UAE@XZ @ 14 NONAME ; CMemSpyEngineGenericKernelObjectList::~CMemSpyEngineGenericKernelObjectList(void)
+	??1CMemSpyEngineOpenFileList@@UAE@XZ @ 15 NONAME ; CMemSpyEngineOpenFileList::~CMemSpyEngineOpenFileList(void)
+	??1CMemSpyEngineServerEntry@@UAE@XZ @ 16 NONAME ; CMemSpyEngineServerEntry::~CMemSpyEngineServerEntry(void)
+	??1CMemSpyEngineServerList@@UAE@XZ @ 17 NONAME ; CMemSpyEngineServerList::~CMemSpyEngineServerList(void)
+	??1CMemSpyEngineSinkMetaData@@UAE@XZ @ 18 NONAME ; CMemSpyEngineSinkMetaData::~CMemSpyEngineSinkMetaData(void)
+	?AccessCount@CMemSpyEngineObject@@QBEHXZ @ 19 NONAME ; int CMemSpyEngineObject::AccessCount(void) const
+	?ActiveObjectListL@CMemSpyEngineHelperActiveObject@@QAEPAVCMemSpyEngineActiveObjectArray@@ABVCMemSpyThread@@@Z @ 20 NONAME ; class CMemSpyEngineActiveObjectArray * CMemSpyEngineHelperActiveObject::ActiveObjectListL(class CMemSpyThread const &)
+	?AddInfoL@CMemSpyEngineHelperROM@@QAEXAAVCMemSpyEngineOutputList@@@Z @ 21 NONAME ; void CMemSpyEngineHelperROM::AddInfoL(class CMemSpyEngineOutputList &)
+	?AddObserverL@CMemSpyEngineProcessMemoryTracker@@QAEXAAVMMemSpyEngineProcessMemoryTrackerObserver@@@Z @ 22 NONAME ; void CMemSpyEngineProcessMemoryTracker::AddObserverL(class MMemSpyEngineProcessMemoryTrackerObserver &)
+	?AmTracking@CMemSpyEngineProcessMemoryTracker@@QBEHXZ @ 23 NONAME ; int CMemSpyEngineProcessMemoryTracker::AmTracking(void) const
+	?AppendOwnerName@CMemSpyEngineChunkEntry@@QBEXAAVTDes16@@@Z @ 24 NONAME ; void CMemSpyEngineChunkEntry::AppendOwnerName(class TDes16 &) const
+	?At@CMemSpyEngineActiveObjectArray@@QAEAAVCMemSpyEngineActiveObject@@H@Z @ 25 NONAME ; class CMemSpyEngineActiveObject & CMemSpyEngineActiveObjectArray::At(int)
+	?At@CMemSpyEngineActiveObjectArray@@QBEABVCMemSpyEngineActiveObject@@H@Z @ 26 NONAME ; class CMemSpyEngineActiveObject const & CMemSpyEngineActiveObjectArray::At(int) const
+	?At@CMemSpyEngineChunkList@@QAEAAVCMemSpyEngineChunkEntry@@H@Z @ 27 NONAME ; class CMemSpyEngineChunkEntry & CMemSpyEngineChunkList::At(int)
+	?At@CMemSpyEngineChunkList@@QBEABVCMemSpyEngineChunkEntry@@H@Z @ 28 NONAME ; class CMemSpyEngineChunkEntry const & CMemSpyEngineChunkList::At(int) const
+	?At@CMemSpyEngineDriveList@@QAEAAVCMemSpyEngineDriveEntry@@H@Z @ 29 NONAME ; class CMemSpyEngineDriveEntry & CMemSpyEngineDriveList::At(int)
+	?At@CMemSpyEngineDriveList@@QBEABVCMemSpyEngineDriveEntry@@H@Z @ 30 NONAME ; class CMemSpyEngineDriveEntry const & CMemSpyEngineDriveList::At(int) const
+	?At@CMemSpyEngineEComCategory@@QAEAAVCMemSpyEngineEComInterface@@H@Z @ 31 NONAME ; class CMemSpyEngineEComInterface & CMemSpyEngineEComCategory::At(int)
+	?At@CMemSpyEngineEComInterface@@QAEAAVCMemSpyEngineEComImplementation@@H@Z @ 32 NONAME ; class CMemSpyEngineEComImplementation & CMemSpyEngineEComInterface::At(int)
+	?At@CMemSpyEngineFbServBitmapArray@@QAEAAVCMemSpyEngineFbServBitmap@@H@Z @ 33 NONAME ; class CMemSpyEngineFbServBitmap & CMemSpyEngineFbServBitmapArray::At(int)
+	?At@CMemSpyEngineFbServBitmapArray@@QBEABVCMemSpyEngineFbServBitmap@@H@Z @ 34 NONAME ; class CMemSpyEngineFbServBitmap const & CMemSpyEngineFbServBitmapArray::At(int) const
+	?At@CMemSpyEngineGenericKernelObjectContainer@@QBEABVCMemSpyEngineGenericKernelObjectList@@H@Z @ 35 NONAME ; class CMemSpyEngineGenericKernelObjectList const & CMemSpyEngineGenericKernelObjectContainer::At(int) const
+	?At@CMemSpyEngineGenericKernelObjectList@@QBEABVTMemSpyDriverHandleInfoGeneric@@H@Z @ 36 NONAME ; class TMemSpyDriverHandleInfoGeneric const & CMemSpyEngineGenericKernelObjectList::At(int) const
+	?At@CMemSpyEngineHelperECom@@QAEAAVCMemSpyEngineEComCategory@@H@Z @ 37 NONAME ; class CMemSpyEngineEComCategory & CMemSpyEngineHelperECom::At(int)
+	?At@CMemSpyEngineObjectContainer@@QBEAAVCMemSpyProcess@@H@Z @ 38 NONAME ; class CMemSpyProcess & CMemSpyEngineObjectContainer::At(int) const
+	?At@CMemSpyEngineOpenFileList@@QBEABVCMemSpyEngineOpenFileListForThread@@H@Z @ 39 NONAME ; class CMemSpyEngineOpenFileListForThread const & CMemSpyEngineOpenFileList::At(int) const
+	?At@CMemSpyEngineOpenFileListForThread@@QBEABVCMemSpyEngineOpenFileListEntry@@H@Z @ 40 NONAME ; class CMemSpyEngineOpenFileListEntry const & CMemSpyEngineOpenFileListForThread::At(int) const
+	?At@CMemSpyEngineServerList@@QBEABVCMemSpyEngineServerEntry@@H@Z @ 41 NONAME ; class CMemSpyEngineServerEntry const & CMemSpyEngineServerList::At(int) const
+	?At@CMemSpyProcess@@QBEAAVCMemSpyThread@@H@Z @ 42 NONAME ; class CMemSpyThread & CMemSpyProcess::At(int) const
+	?Bitmap@CMemSpyEngineFbServBitmap@@QAEAAVCFbsBitmap@@XZ @ 43 NONAME ; class CFbsBitmap & CMemSpyEngineFbServBitmap::Bitmap(void)
+	?Bitmap@CMemSpyEngineFbServBitmap@@QBEABVCFbsBitmap@@XZ @ 44 NONAME ; class CFbsBitmap const & CMemSpyEngineFbServBitmap::Bitmap(void) const
+	?BitmapByHandleL@CMemSpyEngineFbServBitmapArray@@QAEAAVCMemSpyEngineFbServBitmap@@H@Z @ 45 NONAME ; class CMemSpyEngineFbServBitmap & CMemSpyEngineFbServBitmapArray::BitmapByHandleL(int)
+	?BitmapIndexByHandle@CMemSpyEngineFbServBitmapArray@@QBEHH@Z @ 46 NONAME ; int CMemSpyEngineFbServBitmapArray::BitmapIndexByHandle(int) const
+	?CalculateStackSizes@CMemSpyEngineHelperStack@@QAEHABVCMemSpyProcess@@@Z @ 47 NONAME ; int CMemSpyEngineHelperStack::CalculateStackSizes(class CMemSpyProcess const &)
+	?Cancel@CMemSpyDeviceWideOperations@@QAEXXZ @ 48 NONAME ; void CMemSpyDeviceWideOperations::Cancel(void)
+	?Caption@CMemSpyEngineFbServBitmap@@QBEABVTDesC16@@XZ @ 49 NONAME ; class TDesC16 const & CMemSpyEngineFbServBitmap::Caption(void) const
+	?Caption@CMemSpyEngineHelperSysMemTrackerCycle@@QBEABVTDesC16@@XZ @ 50 NONAME ; class TDesC16 const & CMemSpyEngineHelperSysMemTrackerCycle::Caption(void) const
+	?ChangeCount@CMemSpyEngineHelperSysMemTrackerCycle@@QBEHXZ @ 51 NONAME ; int CMemSpyEngineHelperSysMemTrackerCycle::ChangeCount(void) const
+	?CleanupTextLC@MemSpyEngineUtils@@SAPAVHBufC16@@ABVTDesC16@@@Z @ 52 NONAME ; class HBufC16 * MemSpyEngineUtils::CleanupTextLC(class TDesC16 const &)
+	?Close@CMemSpyEngineObject@@UAEXXZ @ 53 NONAME ; void CMemSpyEngineObject::Close(void)
+	?Close@CMemSpyProcess@@UAEXXZ @ 54 NONAME ; void CMemSpyProcess::Close(void)
+	?Close@CMemSpyThread@@UAEXXZ @ 55 NONAME ; void CMemSpyThread::Close(void)
+	?Close@CMemSpyThreadInfoContainer@@UAEXXZ @ 56 NONAME ; void CMemSpyThreadInfoContainer::Close(void)
+	?CodeSegmentListL@CMemSpyEngineHelperCodeSegment@@QAEPAVCMemSpyEngineCodeSegList@@VTProcessId@@@Z @ 57 NONAME ; class CMemSpyEngineCodeSegList * CMemSpyEngineHelperCodeSegment::CodeSegmentListL(class TProcessId)
+	?CodeSegmentListL@CMemSpyEngineHelperCodeSegment@@QAEPAVCMemSpyEngineCodeSegList@@XZ @ 58 NONAME ; class CMemSpyEngineCodeSegList * CMemSpyEngineHelperCodeSegment::CodeSegmentListL(void)
+	?CompletedCycles@CMemSpyEngineHelperSysMemTracker@@QBEABV?$RPointerArray@VCMemSpyEngineHelperSysMemTrackerCycle@@@@XZ @ 59 NONAME ; class RPointerArray<class CMemSpyEngineHelperSysMemTrackerCycle> const & CMemSpyEngineHelperSysMemTracker::CompletedCycles(void) const
+	?ConnectionCount@CMemSpyThreadInfoSession@@QBEHABVTDesC16@@@Z @ 60 NONAME ; int CMemSpyThreadInfoSession::ConnectionCount(class TDesC16 const &) const
+	?Container@CMemSpyEngine@@QAEAAVCMemSpyEngineObjectContainer@@XZ @ 61 NONAME ; class CMemSpyEngineObjectContainer & CMemSpyEngine::Container(void)
+	?Container@CMemSpyEngine@@QBEABVCMemSpyEngineObjectContainer@@XZ @ 62 NONAME ; class CMemSpyEngineObjectContainer const & CMemSpyEngine::Container(void) const
+	?Count@CMemSpyEngineActiveObjectArray@@QBEHXZ @ 63 NONAME ; int CMemSpyEngineActiveObjectArray::Count(void) const
+	?Count@CMemSpyEngineChunkList@@QBEHXZ @ 64 NONAME ; int CMemSpyEngineChunkList::Count(void) const
+	?Count@CMemSpyEngineDriveList@@QBEHXZ @ 65 NONAME ; int CMemSpyEngineDriveList::Count(void) const
+	?Count@CMemSpyEngineFbServBitmapArray@@QBEHXZ @ 66 NONAME ; int CMemSpyEngineFbServBitmapArray::Count(void) const
+	?Count@CMemSpyEngineGenericKernelObjectContainer@@QBEHXZ @ 67 NONAME ; int CMemSpyEngineGenericKernelObjectContainer::Count(void) const
+	?Count@CMemSpyEngineGenericKernelObjectList@@QBEHXZ @ 68 NONAME ; int CMemSpyEngineGenericKernelObjectList::Count(void) const
+	?Count@CMemSpyEngineObjectContainer@@QBEHXZ @ 69 NONAME ; int CMemSpyEngineObjectContainer::Count(void) const
+	?Count@CMemSpyEngineOpenFileList@@QBEHXZ @ 70 NONAME ; int CMemSpyEngineOpenFileList::Count(void) const
+	?Count@CMemSpyEngineOpenFileListForThread@@QBEHXZ @ 71 NONAME ; int CMemSpyEngineOpenFileListForThread::Count(void) const
+	?Count@CMemSpyEngineServerList@@QBEHXZ @ 72 NONAME ; int CMemSpyEngineServerList::Count(void) const
+	?CountAll@CMemSpyEngineObjectContainer@@QBEHXZ @ 73 NONAME ; int CMemSpyEngineObjectContainer::CountAll(void) const
+	?CycleNumber@CMemSpyEngineHelperSysMemTrackerCycle@@QBEHXZ @ 74 NONAME ; int CMemSpyEngineHelperSysMemTrackerCycle::CycleNumber(void) const
+	?DataStreamBeginL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@0@Z @ 75 NONAME ; void CMemSpyEngineOutputSink::DataStreamBeginL(class TDesC16 const &, class TDesC16 const &)
+	?DataStreamBeginL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@@Z @ 76 NONAME ; void CMemSpyEngineOutputSink::DataStreamBeginL(class TDesC16 const &)
+	?DataStreamTimeStampBeginL@CMemSpyEngineOutputSink@@QAEXABVTTime@@@Z @ 77 NONAME ; void CMemSpyEngineOutputSink::DataStreamTimeStampBeginL(class TTime const &)
+	?DataStreamTimeStampEnd@CMemSpyEngineOutputSink@@QAEXXZ @ 78 NONAME ; void CMemSpyEngineOutputSink::DataStreamTimeStampEnd(void)
+	?DetailsIndexByEntry@CMemSpyThreadInfoHandleObjectBase@@QBEHABVTMemSpyDriverHandleInfoGeneric@@@Z @ 79 NONAME ; int CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry(class TMemSpyDriverHandleInfoGeneric const &) const
+	?DetailsIndexByHandle@CMemSpyThreadInfoHandleObjectBase@@QBEHPAX@Z @ 80 NONAME ; int CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle(void *) const
+	?DriveListL@CMemSpyEngineHelperFileSystem@@QAEPAVCMemSpyEngineDriveList@@XZ @ 81 NONAME ; class CMemSpyEngineDriveList * CMemSpyEngineHelperFileSystem::DriveListL(void)
+	?Engine@CMemSpyThreadInfoContainer@@QBEAAVCMemSpyEngine@@XZ @ 82 NONAME ; class CMemSpyEngine & CMemSpyThreadInfoContainer::Engine(void) const
+	?Engine@CMemSpyThreadInfoItemBase@@QBEAAVCMemSpyEngine@@XZ @ 83 NONAME ; class CMemSpyEngine & CMemSpyThreadInfoItemBase::Engine(void) const
+	?EntryByDriveNumber@CMemSpyEngineDriveList@@QAEPAVCMemSpyEngineDriveEntry@@W4TDriveNumber@@@Z @ 84 NONAME ; class CMemSpyEngineDriveEntry * CMemSpyEngineDriveList::EntryByDriveNumber(enum TDriveNumber)
+	?EntryExists@CMemSpyEngineChunkList@@QBEHPAX@Z @ 85 NONAME ; int CMemSpyEngineChunkList::EntryExists(void *) const
+	?FileName@CMemSpyEngineOpenFileListEntry@@QBEABVTDesC16@@XZ @ 86 NONAME ; class TDesC16 const & CMemSpyEngineOpenFileListEntry::FileName(void) const
+	?FormatHex@MemSpyEngineUtils@@SAXAAVTDes16@@H@Z @ 87 NONAME ; void MemSpyEngineUtils::FormatHex(class TDes16 &, int)
+	?FormatPercentage@MemSpyEngineUtils@@SA?AV?$TBuf@$0BO@@@NN@Z @ 88 NONAME ; class TBuf<30> MemSpyEngineUtils::FormatPercentage(double, double)
+	?FormatSizeText@MemSpyEngineUtils@@SA?AV?$TBuf@$0BE@@@AB_JHH@Z @ 89 NONAME ; class TBuf<20> MemSpyEngineUtils::FormatSizeText(long long const &, int, int)
+	?FormatSizeText@MemSpyEngineUtils@@SA?AV?$TBuf@$0BE@@@H@Z @ 90 NONAME ; class TBuf<20> MemSpyEngineUtils::FormatSizeText(int)
+	?FormatSizeTextPrecise@MemSpyEngineUtils@@SA?AV?$TBuf@$0BE@@@H@Z @ 91 NONAME ; class TBuf<20> MemSpyEngineUtils::FormatSizeTextPrecise(int)
+	?FormatTimeL@MemSpyEngineUtils@@SAXAAVTDes16@@ABVTTime@@H@Z @ 92 NONAME ; void MemSpyEngineUtils::FormatTimeL(class TDes16 &, class TTime const &, int)
+	?FormatTimeL@MemSpyEngineUtils@@SAXAAVTDes16@@AB_JH@Z @ 93 NONAME ; void MemSpyEngineUtils::FormatTimeL(class TDes16 &, long long const &, int)
+	?FsSession@CMemSpyEngine@@QAEAAVRFs@@XZ @ 94 NONAME ; class RFs & CMemSpyEngine::FsSession(void)
+	?FullName@CMemSpyThread@@QBE?AV?$TBuf@$0BAA@@@XZ @ 95 NONAME ; class TBuf<256> CMemSpyThread::FullName(void) const
+	?GetArrayOfBitmapHandlesL@CMemSpyEngineHelperFbServ@@QAEXAAV?$RArray@H@@@Z @ 96 NONAME ; void CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL(class RArray<int> &)
+	?GetCapabilityName@MemSpyEngineUtils@@SAXAAVTDes16@@W4TCapability@@@Z @ 97 NONAME ; void MemSpyEngineUtils::GetCapabilityName(class TDes16 &, enum TCapability)
+	?GetConfig@CMemSpyEngineHelperSysMemTracker@@QAEXAAVTMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 98 NONAME ; void CMemSpyEngineHelperSysMemTracker::GetConfig(class TMemSpyEngineHelperSysMemTrackerConfig &)
+	?GetExportableFileNameL@CMemSpyEngineFbServBitmap@@QBEXAAVTDes16@@@Z @ 99 NONAME ; void CMemSpyEngineFbServBitmap::GetExportableFileNameL(class TDes16 &) const
+	?GetFolderL@MemSpyEngineUtils@@SAXAAVRFs@@AAVTDes16@@ABVCMemSpyEngineSinkMetaData@@PBW4TDriveNumber@@@Z @ 100 NONAME ; void MemSpyEngineUtils::GetFolderL(class RFs &, class TDes16 &, class CMemSpyEngineSinkMetaData const &, enum TDriveNumber const *)
+	?GetHeapInfoKernelL@CMemSpyEngineHelperHeap@@QAEXAAVTMemSpyHeapInfo@@PAV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 101 NONAME ; void CMemSpyEngineHelperHeap::GetHeapInfoKernelL(class TMemSpyHeapInfo &, class RArray<class TMemSpyDriverFreeCell> *)
+	?GetHeapInfoUserL@CMemSpyEngineHelperHeap@@QAEXABVCMemSpyProcess@@AAV?$RArray@VTMemSpyHeapInfo@@@@@Z @ 102 NONAME ; void CMemSpyEngineHelperHeap::GetHeapInfoUserL(class CMemSpyProcess const &, class RArray<class TMemSpyHeapInfo> &)
+	?GetHeapInfoUserL@CMemSpyEngineHelperHeap@@QAEXABVTProcessId@@ABVTThreadId@@AAVTMemSpyHeapInfo@@PAV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 103 NONAME ; void CMemSpyEngineHelperHeap::GetHeapInfoUserL(class TProcessId const &, class TThreadId const &, class TMemSpyHeapInfo &, class RArray<class TMemSpyDriverFreeCell> *)
+	?GetRomInfoL@MemSpyEngineUtils@@SAXAAVTDes16@@0@Z @ 104 NONAME ; void MemSpyEngineUtils::GetRomInfoL(class TDes16 &, class TDes16 &)
+	?GetServerListL@CMemSpyEngineHelperServer@@QAEXAAV?$RArray@VTMemSpyDriverHandleInfoGeneric@@@@@Z @ 105 NONAME ; void CMemSpyEngineHelperServer::GetServerListL(class RArray<class TMemSpyDriverHandleInfoGeneric> &)
+	?GetServerSessionsL@CMemSpyEngineHelperServer@@QAEXABVTMemSpyDriverHandleInfoGeneric@@AAV?$RArray@VTMemSpyDriverServerSessionInfo@@@@@Z @ 106 NONAME ; void CMemSpyEngineHelperServer::GetServerSessionsL(class TMemSpyDriverHandleInfoGeneric const &, class RArray<class TMemSpyDriverServerSessionInfo> &)
+	?GetServerSessionsL@CMemSpyEngineHelperServer@@QAEXPAXAAV?$RArray@VTMemSpyDriverServerSessionInfo@@@@@Z @ 107 NONAME ; void CMemSpyEngineHelperServer::GetServerSessionsL(void *, class RArray<class TMemSpyDriverServerSessionInfo> &)
+	?GetSessionsL@CMemSpyEngineServerEntry@@QBEXAAVCMemSpyEngineHelperServer@@AAV?$RArray@VTMemSpyDriverServerSessionInfo@@@@@Z @ 108 NONAME ; void CMemSpyEngineServerEntry::GetSessionsL(class CMemSpyEngineHelperServer &, class RArray<class TMemSpyDriverServerSessionInfo> &) const
+	?GetSystemDrive@CMemSpyEngineHelperFileSystem@@SA?AW4TDriveNumber@@XZ @ 109 NONAME ; enum TDriveNumber CMemSpyEngineHelperFileSystem::GetSystemDrive(void)
+	?GetVersion@CMemSpyEngine@@QAEXAAVTVersion@@@Z @ 110 NONAME ; void CMemSpyEngine::GetVersion(class TVersion &)
+	?Handle@CMemSpyEngineFbServBitmap@@QBEHXZ @ 111 NONAME ; int CMemSpyEngineFbServBitmap::Handle(void) const
+	?HasCapability@CMemSpyEngineCodeSegEntry@@QBEHW4TCapability@@@Z @ 112 NONAME ; int CMemSpyEngineCodeSegEntry::HasCapability(enum TCapability) const
+	?HelperActiveObject@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperActiveObject@@XZ @ 113 NONAME ; class CMemSpyEngineHelperActiveObject & CMemSpyEngine::HelperActiveObject(void)
+	?HelperChunk@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperChunk@@XZ @ 114 NONAME ; class CMemSpyEngineHelperChunk & CMemSpyEngine::HelperChunk(void)
+	?HelperCodeSegment@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperCodeSegment@@XZ @ 115 NONAME ; class CMemSpyEngineHelperCodeSegment & CMemSpyEngine::HelperCodeSegment(void)
+	?HelperECom@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperECom@@XZ @ 116 NONAME ; class CMemSpyEngineHelperECom & CMemSpyEngine::HelperECom(void)
+	?HelperFbServ@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperFbServ@@XZ @ 117 NONAME ; class CMemSpyEngineHelperFbServ & CMemSpyEngine::HelperFbServ(void)
+	?HelperFileSystem@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperFileSystem@@XZ @ 118 NONAME ; class CMemSpyEngineHelperFileSystem & CMemSpyEngine::HelperFileSystem(void)
+	?HelperHeap@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperHeap@@XZ @ 119 NONAME ; class CMemSpyEngineHelperHeap & CMemSpyEngine::HelperHeap(void)
+	?HelperKernelContainers@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperKernelContainers@@XZ @ 120 NONAME ; class CMemSpyEngineHelperKernelContainers & CMemSpyEngine::HelperKernelContainers(void)
+	?HelperProcess@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperProcess@@XZ @ 121 NONAME ; class CMemSpyEngineHelperProcess & CMemSpyEngine::HelperProcess(void)
+	?HelperRAM@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperRAM@@XZ @ 122 NONAME ; class CMemSpyEngineHelperRAM & CMemSpyEngine::HelperRAM(void)
+	?HelperROM@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperROM@@XZ @ 123 NONAME ; class CMemSpyEngineHelperROM & CMemSpyEngine::HelperROM(void)
+	?HelperServer@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperServer@@XZ @ 124 NONAME ; class CMemSpyEngineHelperServer & CMemSpyEngine::HelperServer(void)
+	?HelperStack@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperStack@@XZ @ 125 NONAME ; class CMemSpyEngineHelperStack & CMemSpyEngine::HelperStack(void)
+	?HelperSysMemTracker@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperSysMemTracker@@XZ @ 126 NONAME ; class CMemSpyEngineHelperSysMemTracker & CMemSpyEngine::HelperSysMemTracker(void)
+	?HelperThread@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperThread@@XZ @ 127 NONAME ; class CMemSpyEngineHelperThread & CMemSpyEngine::HelperThread(void)
+	?ImpersonateL@CMemSpyEngineHelperProcess@@QAEXK@Z @ 128 NONAME ; void CMemSpyEngineHelperProcess::ImpersonateL(unsigned long)
+	?IndexByHandle@CMemSpyEngineCodeSegList@@QBEHPAX@Z @ 129 NONAME ; int CMemSpyEngineCodeSegList::IndexByHandle(void *) const
+	?IndexOf@CMemSpyEngineEComCategory@@QAEHABVCMemSpyEngineEComInterface@@@Z @ 130 NONAME ; int CMemSpyEngineEComCategory::IndexOf(class CMemSpyEngineEComInterface const &)
+	?IndexOf@CMemSpyEngineEComInterface@@QAEHABVCMemSpyEngineEComImplementation@@@Z @ 131 NONAME ; int CMemSpyEngineEComInterface::IndexOf(class CMemSpyEngineEComImplementation const &)
+	?IndexOf@CMemSpyEngineHelperECom@@QAEHABVCMemSpyEngineEComCategory@@@Z @ 132 NONAME ; int CMemSpyEngineHelperECom::IndexOf(class CMemSpyEngineEComCategory const &)
+	?InfoContainerForceSyncronousConstructionL@CMemSpyThread@@QAEAAVCMemSpyThreadInfoContainer@@XZ @ 133 NONAME ; class CMemSpyThreadInfoContainer & CMemSpyThread::InfoContainerForceSyncronousConstructionL(void)
+	?InfoContainerL@CMemSpyThread@@QAEAAVCMemSpyThreadInfoContainer@@XZ @ 134 NONAME ; class CMemSpyThreadInfoContainer & CMemSpyThread::InfoContainerL(void)
+	?InfoCurrent@CMemSpyThreadInfoMemoryTracking@@QAEAAVMDesC16Array@@XZ @ 135 NONAME ; class MDesC16Array & CMemSpyThreadInfoMemoryTracking::InfoCurrent(void)
+	?InfoHWM@CMemSpyThreadInfoMemoryTracking@@QAEAAVMDesC16Array@@XZ @ 136 NONAME ; class MDesC16Array & CMemSpyThreadInfoMemoryTracking::InfoHWM(void)
+	?InfoItemIndexByType@CMemSpyThreadInfoContainer@@QAEHW4TMemSpyThreadInfoItemType@@@Z @ 137 NONAME ; int CMemSpyThreadInfoContainer::InfoItemIndexByType(enum TMemSpyThreadInfoItemType)
+	?InfoPeak@CMemSpyThreadInfoMemoryTracking@@QAEAAVMDesC16Array@@XZ @ 138 NONAME ; class MDesC16Array & CMemSpyThreadInfoMemoryTracking::InfoPeak(void)
+	?InstallSinkL@CMemSpyEngine@@QAEXW4TMemSpySinkType@@@Z @ 139 NONAME ; void CMemSpyEngine::InstallSinkL(enum TMemSpySinkType)
+	?IsActive@CMemSpyEngineActiveObject@@QBEHXZ @ 140 NONAME ; int CMemSpyEngineActiveObject::IsActive(void) const
+	?IsActive@CMemSpyEngineHelperSysMemTracker@@QBEHXZ @ 141 NONAME ; int CMemSpyEngineHelperSysMemTracker::IsActive(void) const
+	?IsAddedToScheduler@CMemSpyEngineActiveObject@@QBEHXZ @ 142 NONAME ; int CMemSpyEngineActiveObject::IsAddedToScheduler(void) const
+	?IsAknIconCacheConfigurable@CMemSpyEngineHelperRAM@@QBEHXZ @ 143 NONAME ; int CMemSpyEngineHelperRAM::IsAknIconCacheConfigurable(void) const
+	?IsAlive@CMemSpyEngineObjectContainer@@QBEHVTProcessId@@@Z @ 144 NONAME ; int CMemSpyEngineObjectContainer::IsAlive(class TProcessId) const
+	?IsAlive@CMemSpyEngineObjectContainer@@QBEHVTProcessId@@VTThreadId@@@Z @ 145 NONAME ; int CMemSpyEngineObjectContainer::IsAlive(class TProcessId, class TThreadId) const
+	?IsDead@CMemSpyProcess@@QBEHXZ @ 146 NONAME ; int CMemSpyProcess::IsDead(void) const
+	?IsDead@CMemSpyThread@@QBEHXZ @ 147 NONAME ; int CMemSpyThread::IsDead(void) const
+	?IsReady@CMemSpyThreadInfoItemBase@@QBEHXZ @ 148 NONAME ; int CMemSpyThreadInfoItemBase::IsReady(void) const
+	?IsRomAddress@MemSpyEngineUtils@@SAHPAX@Z @ 149 NONAME ; int MemSpyEngineUtils::IsRomAddress(void *)
+	?IsSystemCritical@CMemSpyProcess@@QBEHXZ @ 150 NONAME ; int CMemSpyProcess::IsSystemCritical(void) const
+	?IsSystemCritical@CMemSpyThread@@QBEHXZ @ 151 NONAME ; int CMemSpyThread::IsSystemCritical(void) const
+	?IsSystemPermanent@CMemSpyProcess@@QBEHXZ @ 152 NONAME ; int CMemSpyProcess::IsSystemPermanent(void) const
+	?IsSystemPermanent@CMemSpyThread@@QBEHXZ @ 153 NONAME ; int CMemSpyThread::IsSystemPermanent(void) const
+	?Item@CMemSpyThreadInfoContainer@@QAEAAVCMemSpyThreadInfoItemBase@@H@Z @ 154 NONAME ; class CMemSpyThreadInfoItemBase & CMemSpyThreadInfoContainer::Item(int)
+	?Item@CMemSpyThreadInfoContainer@@QAEAAVCMemSpyThreadInfoItemBase@@W4TMemSpyThreadInfoItemType@@@Z @ 155 NONAME ; class CMemSpyThreadInfoItemBase & CMemSpyThreadInfoContainer::Item(enum TMemSpyThreadInfoItemType)
+	?ItemIndex@CMemSpyEngineChunkList@@QBEHABVCMemSpyEngineChunkEntry@@@Z @ 156 NONAME ; int CMemSpyEngineChunkList::ItemIndex(class CMemSpyEngineChunkEntry const &) const
+	?ItemIndex@CMemSpyEngineDriveList@@QBEHABVCMemSpyEngineDriveEntry@@@Z @ 157 NONAME ; int CMemSpyEngineDriveList::ItemIndex(class CMemSpyEngineDriveEntry const &) const
+	?ItemIndex@CMemSpyEngineServerList@@QBEHABVCMemSpyEngineServerEntry@@@Z @ 158 NONAME ; int CMemSpyEngineServerList::ItemIndex(class CMemSpyEngineServerEntry const &) const
+	?KillL@CMemSpyProcess@@QAEXXZ @ 159 NONAME ; void CMemSpyProcess::KillL(void)
+	?KillL@CMemSpyThread@@QAEXXZ @ 160 NONAME ; void CMemSpyThread::KillL(void)
+	?ListForProcessL@CMemSpyEngineHelperChunk@@QAEPAVCMemSpyEngineChunkList@@VTProcessId@@@Z @ 161 NONAME ; class CMemSpyEngineChunkList * CMemSpyEngineHelperChunk::ListForProcessL(class TProcessId)
+	?ListForThreadL@CMemSpyEngineHelperChunk@@QAEPAVCMemSpyEngineChunkList@@VTThreadId@@@Z @ 162 NONAME ; class CMemSpyEngineChunkList * CMemSpyEngineHelperChunk::ListForThreadL(class TThreadId)
+	?ListL@CMemSpyEngineHelperChunk@@QAEPAVCMemSpyEngineChunkList@@XZ @ 163 NONAME ; class CMemSpyEngineChunkList * CMemSpyEngineHelperChunk::ListL(void)
+	?ListOpenFilesL@CMemSpyEngine@@QAEXXZ @ 164 NONAME ; void CMemSpyEngine::ListOpenFilesL(void)
+	?ListOpenFilesL@CMemSpyEngineHelperFileSystem@@QAEXABVTThreadId@@@Z @ 165 NONAME ; void CMemSpyEngineHelperFileSystem::ListOpenFilesL(class TThreadId const &)
+	?ListOpenFilesL@CMemSpyEngineHelperFileSystem@@QAEXXZ @ 166 NONAME ; void CMemSpyEngineHelperFileSystem::ListOpenFilesL(void)
+	?MdcaCount@CMemSpyEngineActiveObjectArray@@UBEHXZ @ 167 NONAME ; int CMemSpyEngineActiveObjectArray::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineChunkEntry@@UBEHXZ @ 168 NONAME ; int CMemSpyEngineChunkEntry::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineChunkList@@UBEHXZ @ 169 NONAME ; int CMemSpyEngineChunkList::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineCodeSegList@@UBEHXZ @ 170 NONAME ; int CMemSpyEngineCodeSegList::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineDriveEntry@@UBEHXZ @ 171 NONAME ; int CMemSpyEngineDriveEntry::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineDriveList@@UBEHXZ @ 172 NONAME ; int CMemSpyEngineDriveList::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineEComCategory@@UBEHXZ @ 173 NONAME ; int CMemSpyEngineEComCategory::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineEComImplementation@@UBEHXZ @ 174 NONAME ; int CMemSpyEngineEComImplementation::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineEComInterface@@UBEHXZ @ 175 NONAME ; int CMemSpyEngineEComInterface::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineFbServBitmapArray@@UBEHXZ @ 176 NONAME ; int CMemSpyEngineFbServBitmapArray::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineGenericKernelObjectContainer@@UBEHXZ @ 177 NONAME ; int CMemSpyEngineGenericKernelObjectContainer::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineHelperECom@@UBEHXZ @ 178 NONAME ; int CMemSpyEngineHelperECom::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineHelperSysMemTracker@@UBEHXZ @ 179 NONAME ; int CMemSpyEngineHelperSysMemTracker::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineHelperSysMemTrackerCycle@@UBEHXZ @ 180 NONAME ; int CMemSpyEngineHelperSysMemTrackerCycle::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineObjectContainer@@UBEHXZ @ 181 NONAME ; int CMemSpyEngineObjectContainer::MdcaCount(void) const
+	?MdcaCount@CMemSpyEngineServerList@@UBEHXZ @ 182 NONAME ; int CMemSpyEngineServerList::MdcaCount(void) const
+	?MdcaCount@CMemSpyProcess@@UBEHXZ @ 183 NONAME ; int CMemSpyProcess::MdcaCount(void) const
+	?MdcaCount@CMemSpyThreadInfoActiveObjects@@UBEHXZ @ 184 NONAME ; int CMemSpyThreadInfoActiveObjects::MdcaCount(void) const
+	?MdcaCount@CMemSpyThreadInfoChunk@@UBEHXZ @ 185 NONAME ; int CMemSpyThreadInfoChunk::MdcaCount(void) const
+	?MdcaCount@CMemSpyThreadInfoCodeSeg@@UBEHXZ @ 186 NONAME ; int CMemSpyThreadInfoCodeSeg::MdcaCount(void) const
+	?MdcaCount@CMemSpyThreadInfoContainer@@UBEHXZ @ 187 NONAME ; int CMemSpyThreadInfoContainer::MdcaCount(void) const
+	?MdcaCount@CMemSpyThreadInfoItemBase@@UBEHXZ @ 188 NONAME ; int CMemSpyThreadInfoItemBase::MdcaCount(void) const
+	?MdcaPoint@CMemSpyEngineActiveObjectArray@@UBE?AVTPtrC16@@H@Z @ 189 NONAME ; class TPtrC16 CMemSpyEngineActiveObjectArray::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineChunkEntry@@UBE?AVTPtrC16@@H@Z @ 190 NONAME ; class TPtrC16 CMemSpyEngineChunkEntry::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineChunkList@@UBE?AVTPtrC16@@H@Z @ 191 NONAME ; class TPtrC16 CMemSpyEngineChunkList::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineCodeSegList@@UBE?AVTPtrC16@@H@Z @ 192 NONAME ; class TPtrC16 CMemSpyEngineCodeSegList::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineDriveEntry@@UBE?AVTPtrC16@@H@Z @ 193 NONAME ; class TPtrC16 CMemSpyEngineDriveEntry::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineDriveList@@UBE?AVTPtrC16@@H@Z @ 194 NONAME ; class TPtrC16 CMemSpyEngineDriveList::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineEComCategory@@UBE?AVTPtrC16@@H@Z @ 195 NONAME ; class TPtrC16 CMemSpyEngineEComCategory::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineEComImplementation@@UBE?AVTPtrC16@@H@Z @ 196 NONAME ; class TPtrC16 CMemSpyEngineEComImplementation::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineEComInterface@@UBE?AVTPtrC16@@H@Z @ 197 NONAME ; class TPtrC16 CMemSpyEngineEComInterface::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineFbServBitmapArray@@UBE?AVTPtrC16@@H@Z @ 198 NONAME ; class TPtrC16 CMemSpyEngineFbServBitmapArray::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineGenericKernelObjectContainer@@UBE?AVTPtrC16@@H@Z @ 199 NONAME ; class TPtrC16 CMemSpyEngineGenericKernelObjectContainer::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineHelperECom@@UBE?AVTPtrC16@@H@Z @ 200 NONAME ; class TPtrC16 CMemSpyEngineHelperECom::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineHelperSysMemTracker@@UBE?AVTPtrC16@@H@Z @ 201 NONAME ; class TPtrC16 CMemSpyEngineHelperSysMemTracker::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineHelperSysMemTrackerCycle@@UBE?AVTPtrC16@@H@Z @ 202 NONAME ; class TPtrC16 CMemSpyEngineHelperSysMemTrackerCycle::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineObjectContainer@@UBE?AVTPtrC16@@H@Z @ 203 NONAME ; class TPtrC16 CMemSpyEngineObjectContainer::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyEngineServerList@@UBE?AVTPtrC16@@H@Z @ 204 NONAME ; class TPtrC16 CMemSpyEngineServerList::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyProcess@@UBE?AVTPtrC16@@H@Z @ 205 NONAME ; class TPtrC16 CMemSpyProcess::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyThreadInfoActiveObjects@@UBE?AVTPtrC16@@H@Z @ 206 NONAME ; class TPtrC16 CMemSpyThreadInfoActiveObjects::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyThreadInfoChunk@@UBE?AVTPtrC16@@H@Z @ 207 NONAME ; class TPtrC16 CMemSpyThreadInfoChunk::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyThreadInfoCodeSeg@@UBE?AVTPtrC16@@H@Z @ 208 NONAME ; class TPtrC16 CMemSpyThreadInfoCodeSeg::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyThreadInfoContainer@@UBE?AVTPtrC16@@H@Z @ 209 NONAME ; class TPtrC16 CMemSpyThreadInfoContainer::MdcaPoint(int) const
+	?MdcaPoint@CMemSpyThreadInfoItemBase@@UBE?AVTPtrC16@@H@Z @ 210 NONAME ; class TPtrC16 CMemSpyThreadInfoItemBase::MdcaPoint(int) const
+	?MemoryDelta@CMemSpyEngineHelperSysMemTrackerCycle@@QBE_JXZ @ 211 NONAME ; long long CMemSpyEngineHelperSysMemTrackerCycle::MemoryDelta(void) const
+	?MemoryFree@CMemSpyEngineHelperSysMemTrackerCycle@@QBEAB_JXZ @ 212 NONAME ; long long const & CMemSpyEngineHelperSysMemTrackerCycle::MemoryFree(void) const
+	?MemoryFreePreviousCycle@CMemSpyEngineHelperSysMemTrackerCycle@@QBE_JXZ @ 213 NONAME ; long long CMemSpyEngineHelperSysMemTrackerCycle::MemoryFreePreviousCycle(void) const
+	?Name@CMemSpyEngineGenericKernelObjectList@@QBE?AVTPtrC16@@XZ @ 214 NONAME ; class TPtrC16 CMemSpyEngineGenericKernelObjectList::Name(void) const
+	?Name@CMemSpyProcess@@QBE?AVTPtrC16@@XZ @ 215 NONAME ; class TPtrC16 CMemSpyProcess::Name(void) const
+	?Name@CMemSpyThread@@QBE?AVTPtrC16@@XZ @ 216 NONAME ; class TPtrC16 CMemSpyThread::Name(void) const
+	?Name@CMemSpyThreadInfoActiveObjects@@UBE?AVTPtrC16@@XZ @ 217 NONAME ; class TPtrC16 CMemSpyThreadInfoActiveObjects::Name(void) const
+	?Name@CMemSpyThreadInfoChangeNotifier@@UBE?AVTPtrC16@@XZ @ 218 NONAME ; class TPtrC16 CMemSpyThreadInfoChangeNotifier::Name(void) const
+	?Name@CMemSpyThreadInfoChunk@@UBE?AVTPtrC16@@XZ @ 219 NONAME ; class TPtrC16 CMemSpyThreadInfoChunk::Name(void) const
+	?Name@CMemSpyThreadInfoCodeSeg@@UBE?AVTPtrC16@@XZ @ 220 NONAME ; class TPtrC16 CMemSpyThreadInfoCodeSeg::Name(void) const
+	?Name@CMemSpyThreadInfoGeneral@@UBE?AVTPtrC16@@XZ @ 221 NONAME ; class TPtrC16 CMemSpyThreadInfoGeneral::Name(void) const
+	?Name@CMemSpyThreadInfoHeap@@UBE?AVTPtrC16@@XZ @ 222 NONAME ; class TPtrC16 CMemSpyThreadInfoHeap::Name(void) const
+	?Name@CMemSpyThreadInfoLDD@@UBE?AVTPtrC16@@XZ @ 223 NONAME ; class TPtrC16 CMemSpyThreadInfoLDD::Name(void) const
+	?Name@CMemSpyThreadInfoLogicalChannel@@UBE?AVTPtrC16@@XZ @ 224 NONAME ; class TPtrC16 CMemSpyThreadInfoLogicalChannel::Name(void) const
+	?Name@CMemSpyThreadInfoMemoryTracking@@UBE?AVTPtrC16@@XZ @ 225 NONAME ; class TPtrC16 CMemSpyThreadInfoMemoryTracking::Name(void) const
+	?Name@CMemSpyThreadInfoMutex@@UBE?AVTPtrC16@@XZ @ 226 NONAME ; class TPtrC16 CMemSpyThreadInfoMutex::Name(void) const
+	?Name@CMemSpyThreadInfoOpenFiles@@UBE?AVTPtrC16@@XZ @ 227 NONAME ; class TPtrC16 CMemSpyThreadInfoOpenFiles::Name(void) const
+	?Name@CMemSpyThreadInfoOtherProcesses@@UBE?AVTPtrC16@@XZ @ 228 NONAME ; class TPtrC16 CMemSpyThreadInfoOtherProcesses::Name(void) const
+	?Name@CMemSpyThreadInfoOtherThreads@@UBE?AVTPtrC16@@XZ @ 229 NONAME ; class TPtrC16 CMemSpyThreadInfoOtherThreads::Name(void) const
+	?Name@CMemSpyThreadInfoOwnedProcessHandles@@UBE?AVTPtrC16@@XZ @ 230 NONAME ; class TPtrC16 CMemSpyThreadInfoOwnedProcessHandles::Name(void) const
+	?Name@CMemSpyThreadInfoOwnedThreadHandles@@UBE?AVTPtrC16@@XZ @ 231 NONAME ; class TPtrC16 CMemSpyThreadInfoOwnedThreadHandles::Name(void) const
+	?Name@CMemSpyThreadInfoPDD@@UBE?AVTPtrC16@@XZ @ 232 NONAME ; class TPtrC16 CMemSpyThreadInfoPDD::Name(void) const
+	?Name@CMemSpyThreadInfoSemaphore@@UBE?AVTPtrC16@@XZ @ 233 NONAME ; class TPtrC16 CMemSpyThreadInfoSemaphore::Name(void) const
+	?Name@CMemSpyThreadInfoServer@@UBE?AVTPtrC16@@XZ @ 234 NONAME ; class TPtrC16 CMemSpyThreadInfoServer::Name(void) const
+	?Name@CMemSpyThreadInfoSession@@UBE?AVTPtrC16@@XZ @ 235 NONAME ; class TPtrC16 CMemSpyThreadInfoSession::Name(void) const
+	?Name@CMemSpyThreadInfoStack@@UBE?AVTPtrC16@@XZ @ 236 NONAME ; class TPtrC16 CMemSpyThreadInfoStack::Name(void) const
+	?Name@CMemSpyThreadInfoTimer@@UBE?AVTPtrC16@@XZ @ 237 NONAME ; class TPtrC16 CMemSpyThreadInfoTimer::Name(void) const
+	?Name@CMemSpyThreadInfoUndertaker@@UBE?AVTPtrC16@@XZ @ 238 NONAME ; class TPtrC16 CMemSpyThreadInfoUndertaker::Name(void) const
+	?NewHeapSummaryExtendedLC@CMemSpyEngineHelperHeap@@QAEPAVCMemSpyEngineOutputList@@ABVTMemSpyHeapInfo@@PBV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 239 NONAME ; class CMemSpyEngineOutputList * CMemSpyEngineHelperHeap::NewHeapSummaryExtendedLC(class TMemSpyHeapInfo const &, class RArray<class TMemSpyDriverFreeCell> const *)
+	?NewHeapSummaryShortLC@CMemSpyEngineHelperHeap@@QAEPAVCMemSpyEngineOutputList@@ABVTMemSpyHeapInfo@@@Z @ 240 NONAME ; class CMemSpyEngineOutputList * CMemSpyEngineHelperHeap::NewHeapSummaryShortLC(class TMemSpyHeapInfo const &)
+	?NewL@CMemSpyDeviceWideOperations@@SAPAV1@AAVCMemSpyEngine@@AAVMMemSpyDeviceWideOperationsObserver@@W4TOperation@1@@Z @ 241 NONAME ; class CMemSpyDeviceWideOperations * CMemSpyDeviceWideOperations::NewL(class CMemSpyEngine &, class MMemSpyDeviceWideOperationsObserver &, enum CMemSpyDeviceWideOperations::TOperation)
+	?NewL@CMemSpyEngine@@SAPAV1@AAVRFs@@@Z @ 242 NONAME ; class CMemSpyEngine * CMemSpyEngine::NewL(class RFs &)
+	?NewL@CMemSpyEngineFbServBitmapArray@@SAPAV1@ABV?$RArray@H@@@Z @ 243 NONAME ; class CMemSpyEngineFbServBitmapArray * CMemSpyEngineFbServBitmapArray::NewL(class RArray<int> const &)
+	?NewL@CMemSpyEngineFbServBitmapArray@@SAPAV1@HABV?$RArray@H@@AAVMMemSpyEngineFbSerbBitmapArrayObserver@@H@Z @ 244 NONAME ; class CMemSpyEngineFbServBitmapArray * CMemSpyEngineFbServBitmapArray::NewL(int, class RArray<int> const &, class MMemSpyEngineFbSerbBitmapArrayObserver &, int)
+	?NewL@CMemSpyEngineSinkMetaData@@SAPAV1@ABVTDesC16@@00HH@Z @ 245 NONAME ; class CMemSpyEngineSinkMetaData * CMemSpyEngineSinkMetaData::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, int, int)
+	?NewL@CMemSpyEngineSinkMetaData@@SAPAV1@ABVTDesC16@@00HHABVTTime@@@Z @ 246 NONAME ; class CMemSpyEngineSinkMetaData * CMemSpyEngineSinkMetaData::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, int, int, class TTime const &)
+	?NewL@CMemSpyEngineSinkMetaData@@SAPAV1@XZ @ 247 NONAME ; class CMemSpyEngineSinkMetaData * CMemSpyEngineSinkMetaData::NewL(void)
+	?NewL@CMemSpyProcess@@SAPAV1@ABV1@@Z @ 248 NONAME ; class CMemSpyProcess * CMemSpyProcess::NewL(class CMemSpyProcess const &)
+	?NewLC@CMemSpyEngineFbServBitmap@@SAPAV1@H@Z @ 249 NONAME ; class CMemSpyEngineFbServBitmap * CMemSpyEngineFbServBitmap::NewLC(int)
+	?ObjectByAddressL@CMemSpyEngineActiveObjectArray@@QAEAAVCMemSpyEngineActiveObject@@PAX@Z @ 250 NONAME ; class CMemSpyEngineActiveObject & CMemSpyEngineActiveObjectArray::ObjectByAddressL(void *)
+	?ObjectIndexByAddress@CMemSpyEngineActiveObjectArray@@QBEHPAX@Z @ 251 NONAME ; int CMemSpyEngineActiveObjectArray::ObjectIndexByAddress(void *) const
+	?ObjectsAllL@CMemSpyEngineHelperKernelContainers@@QAEPAVCMemSpyEngineGenericKernelObjectContainer@@XZ @ 252 NONAME ; class CMemSpyEngineGenericKernelObjectContainer * CMemSpyEngineHelperKernelContainers::ObjectsAllL(void)
+	?ObjectsForSpecificContainerL@CMemSpyEngineHelperKernelContainers@@QAEPAVCMemSpyEngineGenericKernelObjectList@@W4TMemSpyDriverContainerType@@@Z @ 253 NONAME ; class CMemSpyEngineGenericKernelObjectList * CMemSpyEngineHelperKernelContainers::ObjectsForSpecificContainerL(enum TMemSpyDriverContainerType)
+	?ObserverAddL@CMemSpyThreadInfoContainer@@QAEXAAVMMemSpyThreadInfoContainerObserver@@@Z @ 254 NONAME ; void CMemSpyThreadInfoContainer::ObserverAddL(class MMemSpyThreadInfoContainerObserver &)
+	?ObserverRemove@CMemSpyThreadInfoContainer@@QAEXAAVMMemSpyThreadInfoContainerObserver@@@Z @ 255 NONAME ; void CMemSpyThreadInfoContainer::ObserverRemove(class MMemSpyThreadInfoContainerObserver &)
+	?Open@CMemSpyEngineObject@@UAEXXZ @ 256 NONAME ; void CMemSpyEngineObject::Open(void)
+	?Open@CMemSpyProcess@@UAEXXZ @ 257 NONAME ; void CMemSpyProcess::Open(void)
+	?Open@CMemSpyThread@@UAEXXZ @ 258 NONAME ; void CMemSpyThread::Open(void)
+	?Open@CMemSpyThreadInfoContainer@@UAEXXZ @ 259 NONAME ; void CMemSpyThreadInfoContainer::Open(void)
+	?OutputBinaryDataCompressedL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@PBE1H@Z @ 260 NONAME ; void CMemSpyEngineOutputSink::OutputBinaryDataCompressedL(class TDesC16 const &, unsigned char const *, unsigned char const *, int)
+	?OutputBinaryDataL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@PBE1H@Z @ 261 NONAME ; void CMemSpyEngineOutputSink::OutputBinaryDataL(class TDesC16 const &, unsigned char const *, unsigned char const *, int)
+	?OutputBlankLineL@CMemSpyEngineOutputSink@@QAEXXZ @ 262 NONAME ; void CMemSpyEngineOutputSink::OutputBlankLineL(void)
+	?OutputCellListingUserL@CMemSpyEngineHelperHeap@@QAEXABVCMemSpyThread@@@Z @ 263 NONAME ; void CMemSpyEngineHelperHeap::OutputCellListingUserL(class CMemSpyThread const &)
+	?OutputChunkInfoForProcessL@CMemSpyEngineHelperChunk@@QAEXABVCMemSpyProcess@@@Z @ 264 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL(class CMemSpyProcess const &)
+	?OutputChunkInfoForProcessL@CMemSpyEngineHelperChunk@@QAEXVTProcessId@@@Z @ 265 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL(class TProcessId)
+	?OutputChunkInfoForProcessL@CMemSpyEngineHelperChunk@@QAEXVTProcessId@@AAVTDes16@@@Z @ 266 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL(class TProcessId, class TDes16 &)
+	?OutputChunkInfoForThreadL@CMemSpyEngineHelperChunk@@QAEXABVCMemSpyThread@@@Z @ 267 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL(class CMemSpyThread const &)
+	?OutputChunkInfoForThreadL@CMemSpyEngineHelperChunk@@QAEXVTThreadId@@@Z @ 268 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL(class TThreadId)
+	?OutputChunkInfoForThreadL@CMemSpyEngineHelperChunk@@QAEXVTThreadId@@AAVTDes16@@@Z @ 269 NONAME ; void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL(class TThreadId, class TDes16 &)
+	?OutputCodeSegmentsL@CMemSpyEngineHelperCodeSegment@@QAEXIAAVTDes16@@ABVTDesC16@@VTChar@@H@Z @ 270 NONAME ; void CMemSpyEngineHelperCodeSegment::OutputCodeSegmentsL(unsigned int, class TDes16 &, class TDesC16 const &, class TChar, int)
+	?OutputDataColumnsL@CMemSpyEngineActiveObjectArray@@SAXAAVCMemSpyEngine@@@Z @ 271 NONAME ; void CMemSpyEngineActiveObjectArray::OutputDataColumnsL(class CMemSpyEngine &)
+	?OutputDataColumnsL@CMemSpyEngineChunkList@@SAXAAVCMemSpyEngine@@@Z @ 272 NONAME ; void CMemSpyEngineChunkList::OutputDataColumnsL(class CMemSpyEngine &)
+	?OutputDataColumnsL@CMemSpyEngineCodeSegList@@SAXAAVCMemSpyEngine@@@Z @ 273 NONAME ; void CMemSpyEngineCodeSegList::OutputDataColumnsL(class CMemSpyEngine &)
+	?OutputDataColumnsL@CMemSpyEngineFbServBitmap@@SAXAAVCMemSpyEngine@@@Z @ 274 NONAME ; void CMemSpyEngineFbServBitmap::OutputDataColumnsL(class CMemSpyEngine &)
+	?OutputDataColumnsL@CMemSpyEngineServerList@@SAXAAVCMemSpyEngine@@H@Z @ 275 NONAME ; void CMemSpyEngineServerList::OutputDataColumnsL(class CMemSpyEngine &, int)
+	?OutputDataL@CMemSpyEngineActiveObject@@QBEXAAVCMemSpyEngine@@@Z @ 276 NONAME ; void CMemSpyEngineActiveObject::OutputDataL(class CMemSpyEngine &) const
+	?OutputDataL@CMemSpyEngineChunkEntry@@QBEXAAVCMemSpyEngineHelperChunk@@@Z @ 277 NONAME ; void CMemSpyEngineChunkEntry::OutputDataL(class CMemSpyEngineHelperChunk &) const
+	?OutputDataL@CMemSpyEngineCodeSegEntry@@QBEXAAVCMemSpyEngineHelperCodeSegment@@@Z @ 278 NONAME ; void CMemSpyEngineCodeSegEntry::OutputDataL(class CMemSpyEngineHelperCodeSegment &) const
+	?OutputDataL@CMemSpyEngineFbServBitmap@@QBEXAAVCMemSpyEngine@@@Z @ 279 NONAME ; void CMemSpyEngineFbServBitmap::OutputDataL(class CMemSpyEngine &) const
+	?OutputDataL@CMemSpyEngineServerEntry@@QBEXAAVCMemSpyEngineHelperServer@@H@Z @ 280 NONAME ; void CMemSpyEngineServerEntry::OutputDataL(class CMemSpyEngineHelperServer &, int) const
+	?OutputHeapDataKernelL@CMemSpyEngineHelperHeap@@QAEXXZ @ 281 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapDataKernelL(void)
+	?OutputHeapDataUserL@CMemSpyEngineHelperHeap@@QAEXABVCMemSpyThread@@@Z @ 282 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapDataUserL(class CMemSpyThread const &)
+	?OutputHeapDataUserL@CMemSpyEngineHelperHeap@@QAEXABVTProcessId@@ABVTThreadId@@ABVTDesC16@@ABVTMemSpyHeapInfo@@PBV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 283 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapDataUserL(class TProcessId const &, class TThreadId const &, class TDesC16 const &, class TMemSpyHeapInfo const &, class RArray<class TMemSpyDriverFreeCell> const *)
+	?OutputHeapInfoForDeviceL@CMemSpyEngineHelperHeap@@QAEXH@Z @ 284 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapInfoForDeviceL(int)
+	?OutputHeapInfoKernelL@CMemSpyEngineHelperHeap@@QAEXXZ @ 285 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapInfoKernelL(void)
+	?OutputHeapInfoL@CMemSpyEngineHelperHeap@@QAEXABVTMemSpyHeapInfo@@ABVTDesC16@@PBV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 286 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapInfoL(class TMemSpyHeapInfo const &, class TDesC16 const &, class RArray<class TMemSpyDriverFreeCell> const *)
+	?OutputHeapInfoUserL@CMemSpyEngineHelperHeap@@QAEXABVCMemSpyThread@@@Z @ 287 NONAME ; void CMemSpyEngineHelperHeap::OutputHeapInfoUserL(class CMemSpyThread const &)
+	?OutputItemAndValueL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@0@Z @ 288 NONAME ; void CMemSpyEngineOutputSink::OutputItemAndValueL(class TDesC16 const &, class TDesC16 const &)
+	?OutputItemAndValueL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@IH@Z @ 289 NONAME ; void CMemSpyEngineOutputSink::OutputItemAndValueL(class TDesC16 const &, unsigned int, int)
+	?OutputL@CMemSpyEngineGenericKernelObjectContainer@@QBEXAAVCMemSpyEngineOutputSink@@@Z @ 290 NONAME ; void CMemSpyEngineGenericKernelObjectContainer::OutputL(class CMemSpyEngineOutputSink &) const
+	?OutputL@CMemSpyEngineGenericKernelObjectList@@QBEXAAVCMemSpyEngineOutputSink@@@Z @ 291 NONAME ; void CMemSpyEngineGenericKernelObjectList::OutputL(class CMemSpyEngineOutputSink &) const
+	?OutputL@CMemSpyEngineHelperKernelContainers@@QBEXABVCMemSpyEngineGenericKernelObjectContainer@@@Z @ 292 NONAME ; void CMemSpyEngineHelperKernelContainers::OutputL(class CMemSpyEngineGenericKernelObjectContainer const &) const
+	?OutputLineFormattedL@CMemSpyEngineOutputSink@@QAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 293 NONAME ; void CMemSpyEngineOutputSink::OutputLineFormattedL(class TRefByValue<class TDesC16 const >, ...)
+	?OutputLineL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@H@Z @ 294 NONAME ; void CMemSpyEngineOutputSink::OutputLineL(class TDesC16 const &, int)
+	?OutputPrefixClear@CMemSpyEngineOutputSink@@QAEXXZ @ 295 NONAME ; void CMemSpyEngineOutputSink::OutputPrefixClear(void)
+	?OutputPrefixSetFormattedLC@CMemSpyEngineOutputSink@@QAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 296 NONAME ; void CMemSpyEngineOutputSink::OutputPrefixSetFormattedLC(class TRefByValue<class TDesC16 const >, ...)
+	?OutputPrefixSetLC@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@@Z @ 297 NONAME ; void CMemSpyEngineOutputSink::OutputPrefixSetLC(class TDesC16 const &)
+	?OutputProcessInfoDetailedL@CMemSpyEngineHelperProcess@@QAEXABVCMemSpyProcess@@@Z @ 298 NONAME ; void CMemSpyEngineHelperProcess::OutputProcessInfoDetailedL(class CMemSpyProcess const &)
+	?OutputProcessInfoL@CMemSpyEngineHelperProcess@@QAEXABVCMemSpyProcess@@@Z @ 299 NONAME ; void CMemSpyEngineHelperProcess::OutputProcessInfoL(class CMemSpyProcess const &)
+	?OutputRawL@CMemSpyEngineOutputSink@@QAEXABVTDesC8@@@Z @ 300 NONAME ; void CMemSpyEngineOutputSink::OutputRawL(class TDesC8 const &)
+	?OutputSectionHeadingL@CMemSpyEngineOutputSink@@QAEXABVTDesC16@@VTChar@@@Z @ 301 NONAME ; void CMemSpyEngineOutputSink::OutputSectionHeadingL(class TDesC16 const &, class TChar)
+	?OutputStackDataL@CMemSpyEngineHelperStack@@QAEXABVCMemSpyThread@@W4TMemSpyDriverDomainType@@@Z @ 302 NONAME ; void CMemSpyEngineHelperStack::OutputStackDataL(class CMemSpyThread const &, enum TMemSpyDriverDomainType)
+	?OutputStackDataL@CMemSpyEngineHelperStack@@QAEXABVCMemSpyThread@@W4TMemSpyDriverDomainType@@H@Z @ 303 NONAME ; void CMemSpyEngineHelperStack::OutputStackDataL(class CMemSpyThread const &, enum TMemSpyDriverDomainType, int)
+	?OutputStackInfoForDeviceL@CMemSpyEngineHelperStack@@QAEXXZ @ 304 NONAME ; void CMemSpyEngineHelperStack::OutputStackInfoForDeviceL(void)
+	?OutputStackInfoL@CMemSpyEngineHelperStack@@QAEXABVCMemSpyThread@@@Z @ 305 NONAME ; void CMemSpyEngineHelperStack::OutputStackInfoL(class CMemSpyThread const &)
+	?OutputStackInfoL@CMemSpyEngineHelperStack@@QAEXVTProcessId@@VTThreadId@@AAVTDes16@@@Z @ 306 NONAME ; void CMemSpyEngineHelperStack::OutputStackInfoL(class TProcessId, class TThreadId, class TDes16 &)
+	?OutputThreadInfoL@CMemSpyEngineHelperThread@@QAEXABVCMemSpyThread@@H@Z @ 307 NONAME ; void CMemSpyEngineHelperThread::OutputThreadInfoL(class CMemSpyThread const &, int)
+	?OwnerName@CMemSpyEngineChunkEntry@@QBEXAAVTDes16@@@Z @ 308 NONAME ; void CMemSpyEngineChunkEntry::OwnerName(class TDes16 &) const
+	?PanicL@CMemSpyProcess@@QAEXXZ @ 309 NONAME ; void CMemSpyProcess::PanicL(void)
+	?PanicL@CMemSpyThread@@QAEXXZ @ 310 NONAME ; void CMemSpyThread::PanicL(void)
+	?Parent@CMemSpyEngineObject@@QBEPAV1@XZ @ 311 NONAME ; class CMemSpyEngineObject * CMemSpyEngineObject::Parent(void) const
+	?PrintL@CMemSpyThreadInfoContainer@@QAEXXZ @ 312 NONAME ; void CMemSpyThreadInfoContainer::PrintL(void)
+	?PrintL@CMemSpyThreadInfoItemBase@@QAEXXZ @ 313 NONAME ; void CMemSpyThreadInfoItemBase::PrintL(void)
+	?ProcessAndThreadByFullName@CMemSpyEngineObjectContainer@@QBEHABVTDesC16@@AAPAVCMemSpyProcess@@AAPAVCMemSpyThread@@@Z @ 314 NONAME ; int CMemSpyEngineObjectContainer::ProcessAndThreadByFullName(class TDesC16 const &, class CMemSpyProcess * &, class CMemSpyThread * &) const
+	?ProcessAndThreadByPartialName@CMemSpyEngineObjectContainer@@QBEHABVTDesC16@@AAPAVCMemSpyProcess@@AAPAVCMemSpyThread@@@Z @ 315 NONAME ; int CMemSpyEngineObjectContainer::ProcessAndThreadByPartialName(class TDesC16 const &, class CMemSpyProcess * &, class CMemSpyThread * &) const
+	?ProcessAndThreadByThreadId@CMemSpyEngineObjectContainer@@QBEHVTThreadId@@AAPAVCMemSpyProcess@@AAPAVCMemSpyThread@@@Z @ 316 NONAME ; int CMemSpyEngineObjectContainer::ProcessAndThreadByThreadId(class TThreadId, class CMemSpyProcess * &, class CMemSpyThread * &) const
+	?ProcessByIdL@CMemSpyEngineObjectContainer@@QBEAAVCMemSpyProcess@@VTProcessId@@@Z @ 317 NONAME ; class CMemSpyProcess & CMemSpyEngineObjectContainer::ProcessByIdL(class TProcessId) const
+	?ProcessId@CMemSpyEngineOpenFileListForThread@@QBEABVTProcessId@@XZ @ 318 NONAME ; class TProcessId const & CMemSpyEngineOpenFileListForThread::ProcessId(void) const
+	?ProcessIndexById@CMemSpyEngineObjectContainer@@QBEHVTProcessId@@@Z @ 319 NONAME ; int CMemSpyEngineObjectContainer::ProcessIndexById(class TProcessId) const
+	?RebuildL@CMemSpyThreadInfoItemBase@@UAEXXZ @ 320 NONAME ; void CMemSpyThreadInfoItemBase::RebuildL(void)
+	?RefreshL@CMemSpyEngineObjectContainer@@QAEXABVTDesC16@@@Z @ 321 NONAME ; void CMemSpyEngineObjectContainer::RefreshL(class TDesC16 const &)
+	?RefreshL@CMemSpyEngineObjectContainer@@QAEXXZ @ 322 NONAME ; void CMemSpyEngineObjectContainer::RefreshL(void)
+	?RemoveObserver@CMemSpyEngineHelperSysMemTracker@@QAEXPAVMMemSpyEngineHelperSysMemTrackerObserver@@@Z @ 323 NONAME ; void CMemSpyEngineHelperSysMemTracker::RemoveObserver(class MMemSpyEngineHelperSysMemTrackerObserver *)
+	?RemoveObserver@CMemSpyEngineProcessMemoryTracker@@QAEXAAVMMemSpyEngineProcessMemoryTrackerObserver@@@Z @ 324 NONAME ; void CMemSpyEngineProcessMemoryTracker::RemoveObserver(class MMemSpyEngineProcessMemoryTrackerObserver &)
+	?RequestIsPending@CMemSpyEngineActiveObject@@QBEHXZ @ 325 NONAME ; int CMemSpyEngineActiveObject::RequestIsPending(void) const
+	?ResetHWML@CMemSpyEngineProcessMemoryTracker@@QAEXXZ @ 326 NONAME ; void CMemSpyEngineProcessMemoryTracker::ResetHWML(void)
+	?SID@CMemSpyProcess@@QBEKXZ @ 327 NONAME ; unsigned long CMemSpyProcess::SID(void) const
+	?ServerListL@CMemSpyEngineHelperServer@@QAEPAVCMemSpyEngineServerList@@XZ @ 328 NONAME ; class CMemSpyEngineServerList * CMemSpyEngineHelperServer::ServerListL(void)
+	?SessionType@CMemSpyThreadInfoServer@@SA?AVTPtrC16@@W4TIpcSessionType@@@Z @ 329 NONAME ; class TPtrC16 CMemSpyThreadInfoServer::SessionType(enum TIpcSessionType)
+	?SetAknIconCacheStatusL@CMemSpyEngineHelperRAM@@QAE_JH@Z @ 330 NONAME ; long long CMemSpyEngineHelperRAM::SetAknIconCacheStatusL(int)
+	?SetConfigL@CMemSpyEngineHelperSysMemTracker@@QAEXABVTMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 331 NONAME ; void CMemSpyEngineHelperSysMemTracker::SetConfigL(class TMemSpyEngineHelperSysMemTrackerConfig const &)
+	?SetMemoryTrackingAutoStartProcessListL@CMemSpyEngineHelperProcess@@QAEXABV?$RArray@VTUid@@@@@Z @ 332 NONAME ; void CMemSpyEngineHelperProcess::SetMemoryTrackingAutoStartProcessListL(class RArray<class TUid> const &)
+	?SetObserver@CMemSpyEngine@@QAEXPAVMMemSpyEngineObserver@@@Z @ 333 NONAME ; void CMemSpyEngine::SetObserver(class MMemSpyEngineObserver *)
+	?SetObserver@CMemSpyEngineDriveEntry@@QAEXPAVMMemSpyEngineDriveEntryObserver@@@Z @ 334 NONAME ; void CMemSpyEngineDriveEntry::SetObserver(class MMemSpyEngineDriveEntryObserver *)
+	?SetObserver@CMemSpyEngineDriveList@@QAEXPAVMMemSpyEngineDriveListObserver@@@Z @ 335 NONAME ; void CMemSpyEngineDriveList::SetObserver(class MMemSpyEngineDriveListObserver *)
+	?SetObserver@CMemSpyEngineHelperSysMemTracker@@QAEXPAVMMemSpyEngineHelperSysMemTrackerObserver@@@Z @ 336 NONAME ; void CMemSpyEngineHelperSysMemTracker::SetObserver(class MMemSpyEngineHelperSysMemTrackerObserver *)
+	?SetParent@CMemSpyEngineObject@@QAEXPAV1@@Z @ 337 NONAME ; void CMemSpyEngineObject::SetParent(class CMemSpyEngineObject *)
+	?SetPriorityL@CMemSpyThread@@QAEXW4TThreadPriority@@@Z @ 338 NONAME ; void CMemSpyThread::SetPriorityL(enum TThreadPriority)
+	?ShowOnlyEntriesWithGlobalDataL@CMemSpyEngineCodeSegList@@QAEXXZ @ 339 NONAME ; void CMemSpyEngineCodeSegList::ShowOnlyEntriesWithGlobalDataL(void)
+	?Sink@CMemSpyEngine@@QAEAAVCMemSpyEngineOutputSink@@XZ @ 340 NONAME ; class CMemSpyEngineOutputSink & CMemSpyEngine::Sink(void)
+	?SinkType@CMemSpyEngine@@QAE?AW4TMemSpySinkType@@XZ @ 341 NONAME ; enum TMemSpySinkType CMemSpyEngine::SinkType(void)
+	?Size@CMemSpyEngineOpenFileListEntry@@QBEHXZ @ 342 NONAME ; int CMemSpyEngineOpenFileListEntry::Size(void) const
+	?SortByCodeSegs@CMemSpyEngineObjectContainer@@QAEXXZ @ 343 NONAME ; void CMemSpyEngineObjectContainer::SortByCodeSegs(void)
+	?SortByCodeSizeL@CMemSpyEngineCodeSegList@@QAEXXZ @ 344 NONAME ; void CMemSpyEngineCodeSegList::SortByCodeSizeL(void)
+	?SortByDataSizeL@CMemSpyEngineCodeSegList@@QAEXXZ @ 345 NONAME ; void CMemSpyEngineCodeSegList::SortByDataSizeL(void)
+	?SortByFileNameL@CMemSpyEngineCodeSegList@@QAEXXZ @ 346 NONAME ; void CMemSpyEngineCodeSegList::SortByFileNameL(void)
+	?SortByHeapUsage@CMemSpyEngineObjectContainer@@QAEXXZ @ 347 NONAME ; void CMemSpyEngineObjectContainer::SortByHeapUsage(void)
+	?SortById@CMemSpyEngineObjectContainer@@QAEXXZ @ 348 NONAME ; void CMemSpyEngineObjectContainer::SortById(void)
+	?SortByName@CMemSpyEngineObjectContainer@@QAEXXZ @ 349 NONAME ; void CMemSpyEngineObjectContainer::SortByName(void)
+	?SortByNameL@CMemSpyEngineChunkList@@QAEXXZ @ 350 NONAME ; void CMemSpyEngineChunkList::SortByNameL(void)
+	?SortByNameL@CMemSpyEngineServerList@@QAEXXZ @ 351 NONAME ; void CMemSpyEngineServerList::SortByNameL(void)
+	?SortBySessionCountL@CMemSpyEngineServerList@@QAEXXZ @ 352 NONAME ; void CMemSpyEngineServerList::SortBySessionCountL(void)
+	?SortBySizeL@CMemSpyEngineChunkList@@QAEXXZ @ 353 NONAME ; void CMemSpyEngineChunkList::SortBySizeL(void)
+	?SortByStackUsage@CMemSpyEngineObjectContainer@@QAEXXZ @ 354 NONAME ; void CMemSpyEngineObjectContainer::SortByStackUsage(void)
+	?SortByThreadCount@CMemSpyEngineObjectContainer@@QAEXXZ @ 355 NONAME ; void CMemSpyEngineObjectContainer::SortByThreadCount(void)
+	?SortByUidsL@CMemSpyEngineCodeSegList@@QAEXXZ @ 356 NONAME ; void CMemSpyEngineCodeSegList::SortByUidsL(void)
+	?StartL@CMemSpyEngineHelperSysMemTracker@@QAEXABVTMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 357 NONAME ; void CMemSpyEngineHelperSysMemTracker::StartL(class TMemSpyEngineHelperSysMemTrackerConfig const &)
+	?StartL@CMemSpyEngineHelperSysMemTracker@@QAEXXZ @ 358 NONAME ; void CMemSpyEngineHelperSysMemTracker::StartL(void)
+	?StartL@CMemSpyEngineProcessMemoryTracker@@QAEXXZ @ 359 NONAME ; void CMemSpyEngineProcessMemoryTracker::StartL(void)
+	?Stop@CMemSpyEngineProcessMemoryTracker@@QAEXXZ @ 360 NONAME ; void CMemSpyEngineProcessMemoryTracker::Stop(void)
+	?StopL@CMemSpyEngineHelperSysMemTracker@@QAEXXZ @ 361 NONAME ; void CMemSpyEngineHelperSysMemTracker::StopL(void)
+	?StripText@MemSpyEngineUtils@@SAHAAVTDes16@@ABVTDesC16@@@Z @ 362 NONAME ; int MemSpyEngineUtils::StripText(class TDes16 &, class TDesC16 const &)
+	?TerminateL@CMemSpyProcess@@QAEXXZ @ 363 NONAME ; void CMemSpyProcess::TerminateL(void)
+	?TerminateL@CMemSpyThread@@QAEXXZ @ 364 NONAME ; void CMemSpyThread::TerminateL(void)
+	?TextAfterDoubleColon@MemSpyEngineUtils@@SAXAAVTDes16@@@Z @ 365 NONAME ; void MemSpyEngineUtils::TextAfterDoubleColon(class TDes16 &)
+	?TextBeforeDoubleColon@MemSpyEngineUtils@@SAXAAVTDes16@@@Z @ 366 NONAME ; void MemSpyEngineUtils::TextBeforeDoubleColon(class TDes16 &)
+	?ThreadByIdL@CMemSpyProcess@@QBEAAVCMemSpyThread@@VTThreadId@@@Z @ 367 NONAME ; class CMemSpyThread & CMemSpyProcess::ThreadByIdL(class TThreadId) const
+	?ThreadId@CMemSpyEngineOpenFileListForThread@@QBEABVTThreadId@@XZ @ 368 NONAME ; class TThreadId const & CMemSpyEngineOpenFileListForThread::ThreadId(void) const
+	?ThreadIndexById@CMemSpyProcess@@QBEHVTThreadId@@@Z @ 369 NONAME ; int CMemSpyProcess::ThreadIndexById(class TThreadId) const
+	?ThreadName@CMemSpyEngineOpenFileListForThread@@QBEABVTDesC16@@XZ @ 370 NONAME ; class TDesC16 const & CMemSpyEngineOpenFileListForThread::ThreadName(void) const
+	?Time@CMemSpyEngineHelperSysMemTrackerCycle@@QBEABVTTime@@XZ @ 371 NONAME ; class TTime const & CMemSpyEngineHelperSysMemTrackerCycle::Time(void) const
+	?TimeFormatted@CMemSpyEngineHelperSysMemTrackerCycle@@QBEABVTDesC16@@XZ @ 372 NONAME ; class TDesC16 const & CMemSpyEngineHelperSysMemTrackerCycle::TimeFormatted(void) const
+	?TotalIncludesSharedMemory@CMemSpyThreadInfoMemoryTracking@@QBEHXZ @ 373 NONAME ; int CMemSpyThreadInfoMemoryTracking::TotalIncludesSharedMemory(void) const
+	?TotalOperationSize@CMemSpyDeviceWideOperations@@QBEHXZ @ 374 NONAME ; int CMemSpyDeviceWideOperations::TotalOperationSize(void) const
+	?TrackingActive@CMemSpyThreadInfoMemoryTracking@@QBEHXZ @ 375 NONAME ; int CMemSpyThreadInfoMemoryTracking::TrackingActive(void) const
+	?TrackingObserverAddL@CMemSpyThreadInfoMemoryTracking@@QAEXAAVMMemSpyEngineProcessMemoryTrackerObserver@@@Z @ 376 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL(class MMemSpyEngineProcessMemoryTrackerObserver &)
+	?TrackingObserverRemove@CMemSpyThreadInfoMemoryTracking@@QAEXAAVMMemSpyEngineProcessMemoryTrackerObserver@@@Z @ 377 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove(class MMemSpyEngineProcessMemoryTrackerObserver &)
+	?TrackingResetHWML@CMemSpyThreadInfoMemoryTracking@@QAEXXZ @ 378 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingResetHWML(void)
+	?TrackingSetTotalIncludesSharedMemoryL@CMemSpyThreadInfoMemoryTracking@@QAEXH@Z @ 379 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingSetTotalIncludesSharedMemoryL(int)
+	?TrackingStartL@CMemSpyThreadInfoMemoryTracking@@QAEXXZ @ 380 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingStartL(void)
+	?TrackingStopL@CMemSpyThreadInfoMemoryTracking@@QAEXXZ @ 381 NONAME ; void CMemSpyThreadInfoMemoryTracking::TrackingStopL(void)
+	?Type@CMemSpyEngineGenericKernelObjectList@@QBE?AW4TMemSpyDriverContainerType@@XZ @ 382 NONAME ; enum TMemSpyDriverContainerType CMemSpyEngineGenericKernelObjectList::Type(void) const
+	?Type@CMemSpyThreadInfoItemBase@@QBE?AW4TMemSpyThreadInfoItemType@@XZ @ 383 NONAME ; enum TMemSpyThreadInfoItemType CMemSpyThreadInfoItemBase::Type(void) const
+	?TypeAsString@CMemSpyEngineGenericKernelObjectList@@SA?AVTPtrC16@@W4TMemSpyDriverContainerType@@@Z @ 384 NONAME ; class TPtrC16 CMemSpyEngineGenericKernelObjectList::TypeAsString(enum TMemSpyDriverContainerType)
+	?VID@CMemSpyProcess@@QBEKXZ @ 385 NONAME ; unsigned long CMemSpyProcess::VID(void) const
+	__E32Dll @ 386 NONAME ABSENT ; int CMemSpyEngineWindowGroupList::MdcaCount(void) const
+	__E32Dll @ 387 NONAME ABSENT ; void CMemSpyEngineHelperWindowServer::GetWindowGroupListL(class RArray<class TMemSpyEngineWindowGroupInfo> &)
+	__E32Dll @ 388 NONAME ABSENT ; CMemSpyEngineWindowGroupList::~CMemSpyEngineWindowGroupList(void)
+	__E32Dll @ 389 NONAME ABSENT ; int CMemSpyEngineWindowGroupList::Count(void) const
+	__E32Dll @ 390 NONAME ABSENT ; int CMemSpyEngineWindowGroupList::ItemIndex(class TMemSpyEngineWindowGroupInfo const &) const
+	__E32Dll @ 391 NONAME ABSENT ; class CMemSpyEngineWindowGroupList * CMemSpyEngineHelperWindowServer::WindowGroupListL(void)
+	__E32Dll @ 392 NONAME ABSENT ; class CMemSpyEngineHelperWindowServer & CMemSpyEngine::HelperWindowServer(void)
+	__E32Dll @ 393 NONAME ABSENT ; class TPtrC16 CMemSpyEngineWindowGroupList::MdcaPoint(int) const
+	__E32Dll @ 394 NONAME ABSENT ; class TMemSpyEngineWindowGroupInfo const & CMemSpyEngineWindowGroupList::At(int) const
+	__E32Dll @ 395 NONAME ABSENT ; int CMemSpyEngineWindowGroupList::ItemIndex(class TMemSpyEngineWindowGroupBasicInfo const &) const
+	__E32Dll @ 396 NONAME ABSENT ; class TMemSpyEngineWindowGroupBasicInfo const & CMemSpyEngineWindowGroupList::At(int) const
+	__E32Dll @ 397 NONAME ABSENT ; void CMemSpyEngineHelperWindowServer::GetWindowGroupListL(class RArray<class TMemSpyEngineWindowGroupBasicInfo> &)
+	__E32Dll @ 398 NONAME ABSENT ; void CMemSpyEngineHelperWindowServer::GetWindowGroupDetailsL(int, class TMemSpyEngineWindowGroupDetails &)
+	__E32Dll @ 399 NONAME ABSENT ; void CMemSpyEngineHelperWindowServer::SwitchToL(int)
+	?Capabilities@CMemSpyProcess@@QBE?AUSCapabilitySet@@XZ @ 400 NONAME ; struct SCapabilitySet CMemSpyProcess::Capabilities(void) const
+	?UIDs@CMemSpyProcess@@QBE?AVTUidType@@XZ @ 401 NONAME ; class TUidType CMemSpyProcess::UIDs(void) const
+	?HelperCondVar@CMemSpyEngine@@QAEAAVCMemSpyEngineHelperCondVar@@XZ @ 402 NONAME ; class CMemSpyEngineHelperCondVar & CMemSpyEngine::HelperCondVar(void)
+	?GetCondVarSuspendedThreadsL@CMemSpyEngineHelperCondVar@@QAEXABVTMemSpyDriverHandleInfoGeneric@@AAV?$RArray@VTMemSpyDriverCondVarSuspendedThreadInfo@@@@@Z @ 403 NONAME ; void CMemSpyEngineHelperCondVar::GetCondVarSuspendedThreadsL(class TMemSpyDriverHandleInfoGeneric const &, class RArray<class TMemSpyDriverCondVarSuspendedThreadInfo> &)
+	?HelperWindowServer@CMemSpyEngine@@QAEAAVMMemSpyEngineHelperWindowServer@@XZ @ 404 NONAME ; class MMemSpyEngineHelperWindowServer & CMemSpyEngine::HelperWindowServer(void)
+	?IsHelperWindowServerSupported@CMemSpyEngine@@QAEHXZ @ 405 NONAME ; int CMemSpyEngine::IsHelperWindowServerSupported(void)
+	__E32Dll @ 406 NONAME ABSENT ; int CMemSpyEngineGenericKernelObjectList::Size(void) const
+	__E32Dll @ 407 NONAME ABSENT ; int CMemSpyEngineGenericKernelObjectList::Size(void)
+	?Size@CMemSpyEngineGenericKernelObjectList@@QBEHXZ @ 408 NONAME ; int CMemSpyEngineGenericKernelObjectList::Size(void) const
+	?NewHeapRawInfo@CMemSpyEngineHelperHeap@@QAEAAVTMemSpyHeapData@@ABVTMemSpyHeapInfo@@@Z @ 409 NONAME ABSENT ; class TMemSpyHeapData & CMemSpyEngineHelperHeap::NewHeapRawInfo(class TMemSpyHeapInfo const &)
+	?NewHeapRawInfo@CMemSpyEngineHelperHeap@@QAE?AVTMemSpyHeapData@@ABVTMemSpyHeapInfo@@@Z @ 410 NONAME ; class TMemSpyHeapData CMemSpyEngineHelperHeap::NewHeapRawInfo(class TMemSpyHeapInfo const &)
+	?ItemsCount@CMemSpyEngineGenericKernelObjectList@@QBEHXZ @ 411 NONAME ; int CMemSpyEngineGenericKernelObjectList::ItemsCount(void) const
+	?Priority@CMemSpyThread@@QBE?AW4TThreadPriority@@XZ @ 412 NONAME ; enum TThreadPriority CMemSpyThread::Priority(void) const
+	?NewL@CMemSpyEngine@@SAPAV1@AAVRFs@@H@Z @ 413 NONAME ; class CMemSpyEngine * CMemSpyEngine::NewL(class RFs &, int)
+	?Value@CMemSpyThreadInfoItemBase@@QBE?AVTPtrC16@@H@Z @ 414 NONAME ; class TPtrC16 CMemSpyThreadInfoItemBase::Value(int) const
+	?ExitType@CMemSpyProcess@@QBE?AW4TExitType@@XZ @ 415 NONAME ; enum TExitType CMemSpyProcess::ExitType(void) const
+	?ExitCategory@CMemSpyProcess@@QBE?AV?$TBuf@$0BA@@@XZ @ 416 NONAME ; class TBuf<16> CMemSpyProcess::ExitCategory(void) const
+	?Priority@CMemSpyProcess@@QBE?AW4TProcessPriority@@XZ @ 417 NONAME ; enum TProcessPriority CMemSpyProcess::Priority(void) const
+	?Caption@CMemSpyThreadInfoItemBase@@QBE?AVTPtrC16@@H@Z @ 418 NONAME ; class TPtrC16 CMemSpyThreadInfoItemBase::Caption(int) const
+	?ExitReason@CMemSpyProcess@@QBEHXZ @ 419 NONAME ; int CMemSpyProcess::ExitReason(void) const
+	?NewL@CMemSpyEngineSinkMetaData@@SAPAV1@ABVTDesC16@@000HHABVTTime@@@Z @ 420 NONAME ; class CMemSpyEngineSinkMetaData * CMemSpyEngineSinkMetaData::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, int, int, class TTime const &)
+	?InstallDebugSinkL@CMemSpyEngine@@QAEXXZ @ 421 NONAME ; void CMemSpyEngine::InstallDebugSinkL(void)
+	?NewL@CMemSpyEngineSinkMetaData@@SAPAV1@ABVTDesC16@@000HH@Z @ 422 NONAME ; class CMemSpyEngineSinkMetaData * CMemSpyEngineSinkMetaData::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, int, int)
+	?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)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/ClientServer/MemSpyEngineServer.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* 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 MEMSPYENGINESERVER_H
+#define MEMSPYENGINESERVER_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include <memspyengineclientinterface.h>
+#include <memspy/engine/memspydevicewideoperations.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyDwOperationTracker;
+
+NONSHARABLE_CLASS( CShutdown ) : public CTimer
+    {
+    enum {KMyShutdownDelay=10 * 1000000};       // 10s
+public:
+    inline CShutdown();
+    inline void ConstructL();
+    inline void Start();
+private:
+    void RunL();
+    };
+
+NONSHARABLE_CLASS( CMemSpyEngineServer ) : public CServer2
+    {
+public:
+    static CMemSpyEngineServer* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineServer();
+    
+    CMemSpyDwOperationTracker* CurrentOperationTracker() const { return iCurrentOperationTracker; }
+    void SetCurrentOperationTracker(CMemSpyDwOperationTracker* aTracker) { iCurrentOperationTracker = aTracker; }
+    
+    CMemSpyEngine& Engine() { return iEngine; } 
+    
+    void AddSession(TBool aCliRequest);
+    void DropSession(TBool aCliRequest);
+
+private:
+    CMemSpyEngineServer( CMemSpyEngine& aEngine );
+	void ConstructL();
+
+protected: // From CServer2
+	CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
+
+private:
+    CMemSpyEngine& iEngine;
+    CMemSpyDwOperationTracker* iCurrentOperationTracker;
+    
+    TInt iSessionCount;
+    TBool iCliConnected;
+    
+    CShutdown iShutdown;
+    };
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineSession ) : public CSession2
+	{
+public:
+	static CMemSpyEngineSession* NewL( CMemSpyEngine& aEngine, const RMessage2& aMessage );
+	~CMemSpyEngineSession();
+	
+	void CreateL();
+	
+private:
+	CMemSpyEngineSession( CMemSpyEngine& aEngine );
+	void ConstructL( const RMessage2& aMessage );
+
+private: // From CSession2
+	void ServiceL( const RMessage2& aMessage );
+
+private: // Internal methods
+    void DoServiceL( const RMessage2& aMessage );
+    void DoAsyncServiceL( const RMessage2& aMessage );
+    void DoUiServiceL( const RMessage2& aMessage );
+    void DoCmdServiceL( const RMessage2& aMessage );
+    static TInt ValidateFunction( TInt aFunction, TBool aIncludesThreadId, TBool aIncludesThreadName );
+    void HandleThreadSpecificOpL( TInt aFunction, const TThreadId& aThreadId );
+    void HandleThreadSpecificOpL( TInt aFunction, const TDesC& aThreadName );
+    void HandleThreadAgnosticOpL( TInt aFunction, const RMessage2& aMessage );
+    void StartDeviceWideOperationL(CMemSpyDeviceWideOperations::TOperation aOperation, const RMessage2& aMessage);
+    
+    inline CMemSpyEngineServer& Server() const { return *static_cast<CMemSpyEngineServer*>(const_cast<CServer2*>(CSession2::Server())); }
+
+private:
+    CMemSpyEngine& iEngine;
+    HBufC* iClientThreadName;
+    TUint32 iClientThreadId;
+    TBool iIsCliRequest;
+    };
+
+/**
+ * CMemSpyDwOperationTracker
+ * Tracks device wide operation progress and calls iOperationMessage.Complete upon completion. 
+ */
+NONSHARABLE_CLASS( CMemSpyDwOperationTracker ) : public MMemSpyDeviceWideOperationsObserver
+	{
+public:
+	static CMemSpyDwOperationTracker* NewL(CMemSpyDeviceWideOperations::TOperation aOperation, 
+			const RMessage2& aOperationMessage,
+			CMemSpyEngineServer& aServer);
+	~CMemSpyDwOperationTracker();
+	
+	void AddNotificationL(const RMessage2& aMessage);
+	
+	void Cancel();
+
+public: // From MMemSpyDeviceWideOperationsObserver
+	void HandleDeviceWideOperationEvent(TEvent aEvent, TInt aParam1, const TDesC& aParam2);
+	
+private:
+	CMemSpyDwOperationTracker(const RMessage2& aOperationMessage, CMemSpyEngineServer& aServer);
+	void ConstructL(CMemSpyDeviceWideOperations::TOperation aOperation);
+	
+private:
+	RMessage2 iOperationMessage;
+	CMemSpyEngineServer& iServer;
+	CArrayFixFlat<RMessage2>* iPendingNotifications;
+	CMemSpyDeviceWideOperations* iOperation;
+	TInt iProgress;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/EventHandlers/MemSpyEngineChunkWatcher.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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 MEMSPYENGINECHUNKWATCHER_H
+#define MEMSPYENGINECHUNKWATCHER_H
+
+// System includes
+#include <e32base.h>
+
+// Classes referenced
+class RMemSpyDriverClient;
+
+
+class MMemSpyEngineChunkWatcherObserver
+	{
+public: // From MMemSpyEngineChunkWatcherObserver
+	virtual void HandleChunkAddL( TUint aChunkHandle ) = 0;
+    virtual void HandleChunkDestroyL( TUint aChunkHandle ) = 0;
+	};
+
+
+NONSHARABLE_CLASS( CMemSpyEngineChunkWatcher ) : public CActive
+    {
+public:
+	static CMemSpyEngineChunkWatcher* NewL( RMemSpyDriverClient& aDriver, TInt aPriority = CActive::EPriorityStandard );
+	~CMemSpyEngineChunkWatcher();
+
+private:
+	CMemSpyEngineChunkWatcher( RMemSpyDriverClient& aDriver, TInt aPriority );
+	void ConstructL();
+
+public: // API
+    void AddObserverL( MMemSpyEngineChunkWatcherObserver& aObserver );
+    void RemoveObserver( MMemSpyEngineChunkWatcherObserver& aObserver );
+
+private: // From CActive
+	void RunL();
+	void DoCancel();
+
+private: // Internal methods
+    void Request();
+    void NotifyChunkAddL( TUint aChunkHandle );
+    void NotifyChunkDestroyL( TUint aChunkHandle );
+
+private: // Data members
+    TUint iId;
+    TUint iEventMonitorHandle;
+    RMemSpyDriverClient& iDriver;
+	RPointerArray< MMemSpyEngineChunkWatcherObserver > iObservers;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/Sink/MemSpyEngineOutputListItem.h	Mon Sep 06 15:00:47 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 MEMSPYENGINEOUTPUTLISTITEM_H
+#define MEMSPYENGINEOUTPUTLISTITEM_H
+
+// System includes
+#include <e32base.h>
+
+
+NONSHARABLE_CLASS( CMemSpyEngineOutputListItem ) : public CBase
+    {
+    friend class CMemSpyEngineOutputList;
+
+public:
+    static CMemSpyEngineOutputListItem* NewLC( const CMemSpyEngineOutputListItem& aCopyMe );
+    static CMemSpyEngineOutputListItem* NewLC( const TDesC& aCaption );
+    static CMemSpyEngineOutputListItem* NewLC( const TDesC& aCaption, const TDesC& aValue );
+    static CMemSpyEngineOutputListItem* NewLC( const TDesC& aCaption, TUint aValue );
+    static CMemSpyEngineOutputListItem* NewHexLC( const TDesC& aCaption, TUint aValue );
+    static CMemSpyEngineOutputListItem* NewDecimalLC( const TDesC& aCaption, TInt aValue );
+    static CMemSpyEngineOutputListItem* NewLongLC( const TDesC& aCaption, const TInt64& aValue );
+    static CMemSpyEngineOutputListItem* NewYesNoLC( const TDesC& aCaption, TBool aYes );
+    static CMemSpyEngineOutputListItem* NewTrueFalseLC( const TDesC& aCaption, TBool aTrue );
+    static CMemSpyEngineOutputListItem* NewOnOffLC( const TDesC& aCaption, TBool aOn );
+    static CMemSpyEngineOutputListItem* NewPercentageLC( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue );
+    ~CMemSpyEngineOutputListItem();
+
+private:
+    CMemSpyEngineOutputListItem();
+    void ConstructL( const TDesC& aCaption, const TDesC& aValue );
+
+public: // API
+    inline const TDesC& Caption() const { return *iCaption; }
+    inline const TDesC& Value() const { return *iValue; }
+    inline const TDesC& Combined() const { return *iCombined; }
+    void UpdateCombinedL();
+
+public:
+    void SetValueL( const TDesC& aValue );
+    void SetHexL( TUint aValue );
+    void SetDecimalL( TInt aValue );
+    void SetUnsignedL( TUint aValue );
+    void SetLongL( const TInt64& aValue );
+    void SetYesNoL( TBool aYes );
+    void SetTrueFalseL( TBool aTrue );
+    void SetOnOffL( TBool aOn );
+    void SetPercentageL( TInt aOneHundredPercentValue, TInt aValue );
+
+private:
+    HBufC* iCaption;
+    HBufC* iValue;
+    HBufC* iCombined;
+    };
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/Sink/MemSpyEngineOutputSinkDebug.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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 MEMSPYENGINEOUTPUTSINKDEBUG_H
+#define MEMSPYENGINEOUTPUTSINKDEBUG_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include <memspy/engine/memspyengineoutputsink.h>
+
+// Classes referenced
+class CMemSpyEngine;
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineOutputSinkDebug ) : public CMemSpyEngineOutputSink
+    {
+public:
+    static CMemSpyEngineOutputSinkDebug* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineOutputSinkDebug();
+
+public:
+    CMemSpyEngineOutputSinkDebug( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+private: // From CMemSpyEngineOutputSink
+    TMemSpySinkType Type() const;
+    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension );
+    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite );
+    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseTimeStamp );
+    void DataStreamEndL();
+    void DoOutputLineL( const TDesC& aLine );
+    void DoOutputRawL( const TDesC8& aData );
+    };
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/Sink/MemSpyEngineOutputSinkFile.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* 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 MEMSPYENGINEOUTPUTSINKFILE_H
+#define MEMSPYENGINEOUTPUTSINKFILE_H
+
+// System includes
+#include <e32base.h>
+#include <f32file.h>
+
+// User includes
+#include <memspy/engine/memspyengineoutputsink.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyEngineFileHolder;
+
+NONSHARABLE_CLASS( CMemSpyEngineOutputSinkFile ) : public CMemSpyEngineOutputSink
+    {
+public:
+    static CMemSpyEngineOutputSinkFile* NewL( CMemSpyEngine& aEngine, const TDesC& aRootFolder );
+    ~CMemSpyEngineOutputSinkFile();
+
+public:
+    CMemSpyEngineOutputSinkFile( CMemSpyEngine& aEngine );
+    void ConstructL( const TDesC& aRootFolder );
+    
+private: // From CMemSpyEngineOutputSink
+    void ProcessSuspendedL( TProcessId aId );
+    void ProcessResumed( TProcessId aId );
+    TMemSpySinkType Type() const;
+    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension );
+    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite );
+    void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseTimeStamp );
+    void DataStreamEndL();
+    void DoOutputLineL( const TDesC& aLine );
+    void DoOutputRawL( const TDesC8& aData );
+    TBool IsPrefixAllowed( const TDesC& aPrefix );
+
+private: // Internal
+    void IdentifyFileServerProcessIdL();
+    void ConstructDefaultLogFileL();
+    void DisableAllBuffersAfterFileServerResumedL();
+    CMemSpyEngineFileHolder& HeadLog() const;
+
+private:
+    RFs iFsSession;
+    RPointerArray< CMemSpyEngineFileHolder > iLogs;
+    RPointerArray< CMemSpyEngineFileHolder > iLogsPendingDestruction;
+
+    TUint iFileServerProcessId;
+    TBool iFileServerSuspended;
+    
+    HBufC* iRoot;
+
+private:
+    friend class CMemSpyEngineFileHolder;
+    };
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineFileHolder ) : public CBase
+    {
+public:
+    static CMemSpyEngineFileHolder* NewLC( CMemSpyEngineOutputSinkFile& aParent );
+    static CMemSpyEngineFileHolder* NewL( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData );
+    static CMemSpyEngineFileHolder* NewLogToRAML( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData );
+    ~CMemSpyEngineFileHolder();
+
+private:
+    CMemSpyEngineFileHolder( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData = NULL );
+    void ConstructL();
+    void CommonConstructL();
+
+public: // API
+    void WriteLineL( const TDesC& aData );
+    void WriteRawL( const TDesC8& aData );
+    void EnableBufferL();
+    void DisableBufferL();
+    const TDesC& FileName() const;
+    //
+    inline TBool UsingBuffer() const { return iEntireFileBuffer != NULL; }
+    inline TBool IsMainLog() const { return iIsMainLog; }
+
+private: // Internal
+    void OpenFileL();
+    void AddToWorkingBufferL( const TDesC8& aText );
+    void FlushWorkingBufferL();
+    void PrepareFileL( const TDriveNumber* aForceDrive = NULL );
+    HBufC* CleanContextInfoLC( const TDesC& aContext );
+    HBufC* GenerateFileNameLC( const TDriveNumber* aForceDrive = NULL );
+    RFs& FsSession();
+
+private: // Data members
+    CMemSpyEngineOutputSinkFile& iParent;
+    CMemSpyEngineSinkMetaData* iMetaData;
+    RFile iFile;
+    HBufC* iFileName;
+    HBufC8* iLineBuffer;
+    TBool iIsMainLog;
+    CBufFlat* iEntireFileBuffer;
+    CBufFlat* iWorkingBuffer;
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntries.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRIES_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRIES_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include <memspy/engine/memspyenginehelpersysmemtrackerenums.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+// Literal constants
+_LIT( KMemSpySWMTThreadNotFound, "Thread Not Found" );
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerEntry ) : public CBase
+    {
+protected:
+    CMemSpyEngineHelperSysMemTrackerEntry( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyEngineSysMemTrackerType aType );
+
+public: // API
+    void HandleNewCycleL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+public: // API - framework 
+    virtual TUint64 Key() const;
+    virtual void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
+
+protected: // API - framework, internal
+    virtual TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
+    virtual void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    virtual void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+public: // API - inline
+    inline TMemSpyEngineSysMemTrackerType Type() const { return iType; }
+    inline TUint8 Attributes() const { return iAttributes; }
+    //
+    inline TThreadId ThreadId() const { return iThreadId; }
+    inline void SetThread( TThreadId aThreadId ) { iThreadId = aThreadId; }
+    //
+    inline TProcessId ProcessId() const { return iProcessId; }
+    inline void SetProcess( TProcessId aProcessId ) { iProcessId = aProcessId; }
+    //
+    inline TUint32 Handle() const { return iHandle; }
+    inline void SetHandle( TAny* aHandle ) { iHandle = (TUint32) aHandle; }
+    inline void SetHandle( TUint32 aHandle ) { iHandle = aHandle; }
+    //
+    inline const TTime& LastUpdateTime() const { return iLastUpdateTime; }
+    
+public: // Attributes
+    inline TBool IsNew() const { return iAttributes & EMemSpyEngineSysMemTrackerEntryAttributeIsNew; }
+    inline void SetNew( TBool aNew );
+    //
+    inline TBool IsDead() const { return !IsAlive(); }
+    inline void SetDead() { iAttributes &= ~EMemSpyEngineSysMemTrackerEntryAttributeIsAlive; }
+    //
+    inline TBool IsAlive() const { return iAttributes & EMemSpyEngineSysMemTrackerEntryAttributeIsAlive; }
+    inline void SetAlive();
+
+protected: // Internal methods
+    CMemSpyEngine& Engine();
+    void UpdateTime();
+
+private: // Data members
+    CMemSpyEngineHelperSysMemTrackerImp& iTracker;
+    const TMemSpyEngineSysMemTrackerType iType;
+    TUint32 iThreadId;
+    TUint32 iProcessId;
+    TUint8 iAttributes;
+    TUint32 iHandle;
+    TTime iLastUpdateTime;
+    };
+
+
+
+
+
+// Helper class used when searching for entries
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerEntryWithSuppliedKey ) : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    inline CMemSpyEngineHelperSysMemTrackerEntryWithSuppliedKey( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TUint64& aKey )
+    : CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeCount ), iKey( aKey )
+        { }
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const { return iKey; }
+
+private: // Data members
+    const TUint64 iKey;
+    };
+
+
+
+
+
+inline void CMemSpyEngineHelperSysMemTrackerEntry::SetNew( TBool aNew )
+    {
+    if  ( aNew )
+        {
+        iAttributes |= EMemSpyEngineSysMemTrackerEntryAttributeIsNew;
+        }
+    else
+        {
+        iAttributes &= ~EMemSpyEngineSysMemTrackerEntryAttributeIsNew;
+        }
+    }
+
+
+inline void CMemSpyEngineHelperSysMemTrackerEntry::SetAlive()
+    {
+    iAttributes |= EMemSpyEngineSysMemTrackerEntryAttributeIsAlive;
+    UpdateTime();
+    }
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryBitmap.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYBITMAP_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYBITMAP_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
+
+// Classes referenced
+class CFbsBitmap;
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineOutputSink;
+class CMemSpyEngineOpenFileListEntry;
+class CMemSpyEngineOpenFileListForThread;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+class TMemSpyEngineFBServBitmapInfo;
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryBitmap : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryBitmap* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TInt aHandle );
+    ~CMemSpyEngineHelperSysMemTrackerEntryBitmap();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryBitmap( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
+    void ConstructL( TInt aHandle );
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const;
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+
+private: // Internal methods
+
+private: // Data members
+    TMemSpyEngineFBServBitmapInfo* iInfo;
+    };
+
+
+
+
+
+/**
+ * Change descriptor associated with bitmap changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap* NewLC( TUint8 aAttribs, const TMemSpyEngineFBServBitmapInfo& aInfo );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap( TUint8 aAttrib );
+    void ConstructL( const TMemSpyEngineFBServBitmapInfo& aInfo );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    TMemSpyEngineFBServBitmapInfo* iInfo;
+    CFbsBitmap* iBitmap;
+    };
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryChunk.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYCHUNK_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYCHUNK_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryChunk : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryChunk* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo );
+    static CMemSpyEngineHelperSysMemTrackerEntryChunk* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo, CMemSpyProcess& aProcess );
+    ~CMemSpyEngineHelperSysMemTrackerEntryChunk();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryChunk( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
+    void ConstructL( const TMemSpyDriverChunkInfo& aInfo, const TDesC& aChunkFullName );
+    void ConstructL( const TMemSpyDriverChunkInfo& aInfo, CMemSpyProcess& aProcess );
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
+
+private: // Data members
+    TMemSpyDriverChunkInfo iLast;
+    TMemSpyDriverChunkInfo iCurrent;
+    HBufC* iChunkName;
+    };
+
+
+
+
+/**
+ * Change descriptor associated with chunk-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeChunk ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeChunk* NewLC( TUint8 aAttribs, const TDesC& aChunkName, const TMemSpyDriverChunkInfo& aCurrent, const TMemSpyDriverChunkInfo* aLast = NULL );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeChunk();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeChunk( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent );
+    void ConstructL( const TDesC& aChunkName, const TMemSpyDriverChunkInfo* aLast );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    HBufC* iChunkName;
+    TMemSpyDriverChunkInfo iCurrent;
+    TMemSpyDriverChunkInfo* iLast;
+    };
+
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryCode.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYCODE_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYCODE_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineCodeSegEntry;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryCode : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryCode* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const CMemSpyEngineCodeSegEntry& aInfo );
+    ~CMemSpyEngineHelperSysMemTrackerEntryCode();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryCode( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
+    void ConstructL( const CMemSpyEngineCodeSegEntry& aInfo );
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+
+private: // Data members
+    HBufC* iCodeSegName;
+    TInt iSize;
+    };
+
+
+
+
+
+
+/**
+ * Change descriptor associated with code-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeCode ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeCode* NewLC( TUint8 aAttribs, const TDesC& aCodeSegName, TUint32 aSize, TUint32 aHandle );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeCode();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeCode( TUint8 aAttribs, TUint32 aSize, TUint32 aHandle );
+    void ConstructL( const TDesC& aCodeSegName );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    HBufC* iCodeSegName;
+    TUint32 iSize;
+    TUint32 iHandle;
+    };
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryDiskSpace.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYDISKSPACE_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYDISKSPACE_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryDiskSpace : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryDiskSpace* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TDriveNumber aDrive );
+    ~CMemSpyEngineHelperSysMemTrackerEntryDiskSpace();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryDiskSpace( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TDriveNumber aDrive );
+    void ConstructL();
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const;
+    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
+
+private: // Internal methods
+    void UpdateVolumeInfoL( TVolumeInfo& aInfo );
+
+private: // Data members
+    const TDriveNumber iDrive;
+    TVolumeInfo iLast;
+    TVolumeInfo iCurrent;
+    };
+
+
+
+
+
+
+
+
+
+/**
+ * Change descriptor associated with open file-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace* NewLC( TUint8 aAttribs, TDriveNumber aDrive, const TVolumeInfo& aCurrent, const TVolumeInfo* aLast );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace( TUint8 aAttrib, TDriveNumber aDrive );
+    void ConstructL( const TVolumeInfo& aCurrent, const TVolumeInfo* aLast );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    const TDriveNumber iDrive;
+    TBuf<7> iDriveName;
+    //
+    HBufC* iName;
+    TUint iUniqueID;
+    TInt64 iSize;
+    TInt64 iFree;
+    };
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFbserv.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYFBSERV_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYFBSERV_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
+
+// Classes referenced
+class CFbsBitmap;
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineOutputSink;
+class CMemSpyEngineOpenFileListEntry;
+class CMemSpyEngineOpenFileListForThread;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+class TMemSpyEngineFBServBitmapInfo;
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryFbserv : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryFbserv* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aCurrentLarge, const TMemSpyDriverChunkInfo& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount );
+    ~CMemSpyEngineHelperSysMemTrackerEntryFbserv();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryFbserv( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aCurrentLarge, const TMemSpyDriverChunkInfo& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount );
+    void ConstructL();
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const;
+    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
+    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+
+private: // Internal methods
+
+private: // Data members
+    TMemSpyDriverChunkInfo iCurrentLarge;
+    TMemSpyDriverChunkInfo iCurrentShared;
+    TMemSpyDriverChunkInfoWithoutName iLastShared;
+    TMemSpyDriverChunkInfoWithoutName iLastLarge;
+    TInt iCurrentBitmapConCount;
+    TInt iCurrentFontConCount;
+    TInt iLastBitmapConCount;
+    TInt iLastFontConCount;
+    TInt iCurrentAccessibleBitmapCount;
+    TInt iLastAccessibleBitmapCount;
+    };
+
+
+
+
+
+/**
+ * Change descriptor associated with bitmap changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv* NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfoWithoutName& aCurrentLarge, const TMemSpyDriverChunkInfoWithoutName& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv( TUint8 aAttrib, const TMemSpyDriverChunkInfoWithoutName& aCurrentLarge, const TMemSpyDriverChunkInfoWithoutName& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount );
+    void ConstructL();
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    const TMemSpyDriverChunkInfoWithoutName iSharedChunk;
+    const TMemSpyDriverChunkInfoWithoutName iLargeChunk;
+    const TInt iBitmapConCount;
+    const TInt iFontConCount;
+    const TInt iAccessibleBitmapCount;
+    };
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFileServerCache.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYFILESERVERCACHE_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYFILESERVERCACHE_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryFileServerCache : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryFileServerCache* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo );
+    ~CMemSpyEngineHelperSysMemTrackerEntryFileServerCache();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryFileServerCache( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo );
+    void ConstructL();
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
+
+private: // Data members
+    TMemSpyDriverChunkInfo iLast;
+    TMemSpyDriverChunkInfo iCurrent;
+    };
+
+
+
+
+/**
+ * Change descriptor associated with chunk-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache* NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent );
+    void ConstructL();
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    TMemSpyDriverChunkInfo iCurrent;
+    };
+
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryGlobalData.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYGLOBALDATA_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYGLOBALDATA_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+class CMemSpyEngineHelperSysMemTrackerGlobalData : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerGlobalData* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyProcess& aProcess, const TMemSpyDriverChunkInfo& aChunkInfo );
+    ~CMemSpyEngineHelperSysMemTrackerGlobalData();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerGlobalData( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
+    void ConstructL( CMemSpyProcess& aProcess, const TMemSpyDriverChunkInfo& aChunkInfo );
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
+
+private: // Internal methods
+    TBool IsProcessGlobalData() const;
+    TInt CurrentGlobalDataSize() const;
+
+private: // Data members
+    TMemSpyDriverChunkInfoWithoutName iCurrent;
+    TMemSpyDriverChunkInfoWithoutName* iLast;
+    HBufC* iChunkName;
+    };
+
+
+
+
+
+
+
+/**
+ * Change descriptor associated with global data-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData* NewLC( TUint8 aAttribs, const TDesC& aChunkName, const TMemSpyDriverChunkInfoWithoutName& aCurrent, const TMemSpyDriverChunkInfoWithoutName* aLast );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData( TUint8 aAttribs, const TMemSpyDriverChunkInfoWithoutName& aCurrent );
+    void ConstructL( const TDesC& aChunkName, const TMemSpyDriverChunkInfoWithoutName* aLast );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    HBufC* iChunkName;
+    TMemSpyDriverChunkInfoWithoutName iCurrent;
+    TMemSpyDriverChunkInfoWithoutName* iLast;
+    };
+
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHANDLEGENERIC_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHANDLEGENERIC_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineCodeSegEntry;
+class CMemSpyEngineOutputSink;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TAny* aHandle, TMemSpyDriverContainerType aType );
+    ~CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyDriverContainerType aType );
+    void ConstructL( TAny* aHandle );
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const;
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    HBufC* iName;
+    TMemSpyDriverContainerType iHandleType;
+    };
+
+
+
+
+
+/**
+ * Change descriptor associated with handle-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric* NewLC( TUint8 aAttribs, const TDesC& aName, TUint32 aHandle, TMemSpyDriverContainerType aType );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric( TUint8 aAttribs, TUint32 aHandle, TMemSpyDriverContainerType aType );
+    void ConstructL( const TDesC& aName );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    HBufC* iName;
+    TUint32 iHandle;
+    TMemSpyDriverContainerType iType;
+    };
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHANDLEPANDS_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHANDLEPANDS_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineCodeSegEntry;
+class CMemSpyEngineOutputSink;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TAny* aHandle );
+    ~CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
+    void ConstructL( TAny* aHandle );
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const;
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    HBufC* iName;
+    HBufC* iThreadName;
+    TMemSpyDriverPAndSInfo iInfo;
+    };
+
+
+
+
+
+/**
+ * Change descriptor associated with handle-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS* NewLC( TUint8 aAttribs, TUint32 aHandle, const TMemSpyDriverPAndSInfo& aInfo, const TDesC& aName, const TDesC& aThreadName );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS( TUint8 aAttribs, TUint32 aHandle, const TMemSpyDriverPAndSInfo& aInfo );
+    void ConstructL( const TDesC& aName, const TDesC& aThreadName );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    HBufC* iName;
+    HBufC* iThreadName;
+    TUint32 iHandle;
+    TMemSpyDriverPAndSInfo iInfo;
+    };
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHeap.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHEAP_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYHEAP_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryHeap : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryHeap* NewUserLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyThread& aThread );
+    static CMemSpyEngineHelperSysMemTrackerEntryHeap* NewKernelLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
+    ~CMemSpyEngineHelperSysMemTrackerEntryHeap();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryHeap( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyEngineSysMemTrackerType aType );
+    void ConstructL();
+    void ConstructL( CMemSpyThread& aThread );
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const;
+    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
+    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+    void SetAsShared( TBool aShared );
+
+private: // Internal methods
+    void UpdateHeapInfoL( TMemSpyHeapInfo& aInfo );
+    TBool HasHeapSizeChanged() const;
+    TBool HaveFreeCellsChanged() const;
+    TBool HaveAllocCellsChanged() const;
+
+private: // Data members
+    TMemSpyHeapInfo iLast;
+    TMemSpyHeapInfo iCurrent;
+    HBufC* iThreadName;
+    };
+
+
+
+/**
+ * Change descriptor associated with heap-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeHeap ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeHeap* NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TMemSpyHeapInfo& aCurrent, const TMemSpyHeapInfo* aLast = NULL );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeHeap();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeHeap( TUint8 aAttribs, const TMemSpyHeapInfo& aCurrent );
+    void ConstructL( const TDesC& aThreadName, const TMemSpyHeapInfo* aLast );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Internal methods
+    TBool IsKernel() const;
+    void FormatAttributes( TDes& aBuffer ) const;
+
+private: // Data members
+    HBufC* iThreadName;
+    TMemSpyHeapInfo iCurrent;
+    TMemSpyHeapInfo* iLast;
+    };
+
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryManager.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYMANAGER_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYMANAGER_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include <memspy/engine/memspyenginehelpersysmemtrackerenums.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class TMemSpyDriverChunkInfo;
+class CMemSpyEngineChunkList;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class CMemSpyEngineHelperSysMemTrackerEntry;
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerEntryManager ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryManager* NewL( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
+    static CMemSpyEngineHelperSysMemTrackerEntryManager* NewL( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyEngineHelperSysMemTrackerEntryManager& aMasterList );
+    ~CMemSpyEngineHelperSysMemTrackerEntryManager();
+
+protected:
+    CMemSpyEngineHelperSysMemTrackerEntryManager( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyEngineHelperSysMemTrackerEntryManager* aMasterList = NULL );
+    void ConstructL();
+
+public: // API
+    void IdentifyChangesL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void EverythingHasChangedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Internal methods
+    void ProcessChangesL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void AddItemAndPopL( CMemSpyEngineHelperSysMemTrackerEntry* aItem );
+    void MarkEverythingDead();
+    void MergeListIntoMeL( CMemSpyEngineHelperSysMemTrackerEntryManager& aOtherList );
+    TInt FindByHandle( TUint aHandle, TMemSpyEngineSysMemTrackerType aType ) const;
+    TInt FindByThreadId( const TThreadId& aThreadId ) const;
+    CMemSpyEngineHelperSysMemTrackerEntry* EntryByKey( const TUint64& aKey );
+    CMemSpyEngine& Engine();
+
+private: // Internal access
+    inline TBool ActingAsSecondaryList() const { return iMasterList != NULL; }
+
+private: // Sort order
+    static TInt CompareKey( const CMemSpyEngineHelperSysMemTrackerEntry& aLeft, const CMemSpyEngineHelperSysMemTrackerEntry& aRight );
+    static TInt CompareKeyAndTimeStamp( const CMemSpyEngineHelperSysMemTrackerEntry& aLeft, const CMemSpyEngineHelperSysMemTrackerEntry& aRight );
+
+private: // Seed creation
+    void CreateSeedItemsL();
+    void CreateSeedItemsHeapUserL( CMemSpyEngineChunkList& aList );
+    void CreateSeedItemsHeapUserL( CMemSpyProcess& aProcess, CMemSpyEngineChunkList* aList = NULL );
+    void CreateSeedItemsHeapUserL( CMemSpyThread& aThread, CMemSpyEngineChunkList* aList = NULL );
+    void CreateSeedItemsHeapKernelL( CMemSpyEngineChunkList& aList );
+    void CreateSeedItemsChunkLocalL( CMemSpyEngineChunkList& aList );
+    void CreateSeedItemsChunkGlobalL( CMemSpyEngineChunkList& aList );
+    void CreateSeedItemsGlobalDataL( CMemSpyEngineChunkList& aList );
+    void CreateSeedItemRamDriveL( CMemSpyEngineChunkList& aList );
+    void CreateSeedItemsBitmapL( CMemSpyEngineChunkList& aList );
+    void CreateSeedItemsStacksL( CMemSpyEngineChunkList& aList );
+    void CreateSeedItemsStacksL( CMemSpyThread& aThread, const TMemSpyDriverChunkInfo& aStackChunkInfo );
+    void CreateSeedItemsFileServerCacheL( CMemSpyEngineChunkList& aList );
+    void CreateSeedItemsCodeL();
+    void CreateSeedItemsHandlesL();
+    void CreateSeedItemsOpenFilesL();
+    void CreateSeedItemsDiskSpaceL();
+    void CreateSeedItemsSystemMemoryL();
+    void CreateSeedItemsWindowServerL();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerImp& iTracker;
+    CMemSpyEngineHelperSysMemTrackerEntryManager* iMasterList;
+    RPointerArray< CMemSpyEngineHelperSysMemTrackerEntry > iEntries;
+    };
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryOpenFile.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYOPENFILE_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYOPENFILE_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineOpenFileListEntry;
+class CMemSpyEngineOpenFileListForThread;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryOpenFile : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryOpenFile* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const CMemSpyEngineOpenFileListForThread& aThreadInfo, const CMemSpyEngineOpenFileListEntry& aEntryInfo );
+    ~CMemSpyEngineHelperSysMemTrackerEntryOpenFile();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryOpenFile( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
+    void ConstructL( const CMemSpyEngineOpenFileListForThread& aThreadInfo, const CMemSpyEngineOpenFileListEntry& aEntryInfo );
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const;
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+
+private: // Internal methods
+
+private: // Data members
+    TInt iSize;
+    HBufC* iFileName;
+    HBufC* iThreadName;
+    TInt iUniqueFileId;
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+/**
+ * Change descriptor associated with open file-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile* NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TDesC& aFileName, TInt aSize, TInt aUniqueFileId );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile( TUint8 aAttrib, TInt aSize, TInt aUniqueFileId );
+    void ConstructL( const TDesC& aThreadName, const TDesC& aFileName );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    HBufC* iFileName;
+    HBufC* iThreadName;
+    TInt iSize;
+    TInt iUniqueFileId;
+    };
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryRamDrive.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYRAMDRIVE_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYRAMDRIVE_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryRamDrive : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryRamDrive* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo );
+    ~CMemSpyEngineHelperSysMemTrackerEntryRamDrive();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryRamDrive( CMemSpyEngineHelperSysMemTrackerImp& aTracker );
+    void ConstructL( const TMemSpyDriverChunkInfo& aInfo );
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
+
+private: // Data members
+    TMemSpyDriverChunkInfo iLast;
+    TMemSpyDriverChunkInfo iCurrent;
+    };
+
+
+
+
+
+/**
+ * Change descriptor associated with ramdrive-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent, const TMemSpyDriverChunkInfo* aLast = NULL );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent );
+    void ConstructL( const TMemSpyDriverChunkInfo* aLast );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    TMemSpyDriverChunkInfo iCurrent;
+    TMemSpyDriverChunkInfo* iLast;
+    };
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryStack.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYSTACK_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYSTACK_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryStack : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryStack* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyThread& aThread, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo );
+    ~CMemSpyEngineHelperSysMemTrackerEntryStack();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryStack( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo );
+    void ConstructL( CMemSpyThread& aThread );
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const;
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+
+private: // Internal methods
+    TInt StackSize() const;
+
+private: // Data members
+    TMemSpyDriverChunkInfo iChunkInfo;
+    TThreadStackInfo iStackInfo;
+    HBufC* iThreadName;
+    };
+
+
+
+
+
+
+
+/**
+ * Change descriptor associated with stack-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeStack ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeStack* NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeStack();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeStack( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo );
+    void ConstructL( const TDesC& aThreadName );
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Internal methods
+    TInt StackSize() const;
+
+private: // Data members
+    const TMemSpyDriverChunkInfo iChunkInfo;
+    const TThreadStackInfo iStackInfo;
+    HBufC* iThreadName;
+    };
+
+
+
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntrySystemMemory.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYSYSTEMMEMORY_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYSYSTEMMEMORY_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h> 
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+
+
+enum TSystemMemoryType
+    {
+    ETypeTotal = 0,
+    ETypeFree
+    };
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerEntrySystemMemory ) : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntrySystemMemory* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TSystemMemoryType aType );
+    ~CMemSpyEngineHelperSysMemTrackerEntrySystemMemory();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntrySystemMemory( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TSystemMemoryType aType );
+    void ConstructL();
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const;
+    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
+
+private: // Data members
+    const TSystemMemoryType iType;
+    TInt iLast;
+    TInt iCurrent;
+    };
+
+
+
+
+
+/**
+ * Change descriptor associated with Ram-related changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory* NewLC( TUint8 aAttribs, TSystemMemoryType aType, TInt aCurrent, TInt aLast );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory( TUint8 aAttribs, TSystemMemoryType aType, TInt aCurrent, TInt aLast );
+    void ConstructL();
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+    const TSystemMemoryType iType;
+    const TInt iCurrent;
+    const TInt iLast;
+    };
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryWindowServer.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENTRYWINDOWSERVER_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENTRYWINDOWSERVER_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
+#include <memspy/engine/memspyenginehelperwindowserver.h>
+
+// Classes referenced
+class CMemSpyEngineOutputSink;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+class TMemSpyEngineWindowGroupDetails;
+
+
+
+class CMemSpyEngineHelperSysMemTrackerEntryWindowServer : public CMemSpyEngineHelperSysMemTrackerEntry
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerEntryWindowServer* NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyEngineWindowGroupDetails& aWindowGroupDetails );
+    ~CMemSpyEngineHelperSysMemTrackerEntryWindowServer();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerEntryWindowServer( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyEngineWindowGroupDetails& aWindowGroupDetails );
+    void ConstructL();
+
+public: // From CMemSpyEngineHelperSysMemTrackerEntry
+    TUint64 Key() const;
+    void UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry );
+    TBool HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) const;
+    void CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aInfo );
+
+private: // Internal methods
+
+private: // Data members
+    TMemSpyEngineWindowGroupDetails iCurrentWindowGroupDetails;
+    TMemSpyEngineWindowGroupDetails iLastWindowGroupDetails;
+    };
+
+
+
+
+
+
+
+/**
+ * Change descriptor associated with window group changes
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup ) : public CMemSpyEngineHelperSysMemTrackerCycleChange
+    {
+public:
+    enum TMemSpyWindowServerEvent
+        {
+        EMemSpyWindowServerEventNoEvent,
+        EMemSpyWindowServerEventNameChanged,
+        EMemSpyWindowServerEventFocusGained,
+        EMemSpyWindowServerEventFocusLost
+        };
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* NewLC( TUint8 aAttribs, const TMemSpyEngineWindowGroupDetails aCurrent, TMemSpyWindowServerEvent aEvent = EMemSpyWindowServerEventNoEvent );
+    ~CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup( TUint8 aAttrib, const TMemSpyEngineWindowGroupDetails aCurrent, TMemSpyWindowServerEvent aEvent );
+    void ConstructL();
+
+public: // From CMemSpyEngineHelperSysMemTrackerCycleChange
+    TMemSpyEngineSysMemTrackerType Type() const;
+    void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+   
+private: // Data members
+    TMemSpyEngineWindowGroupDetails iCurrentWindowGroupDetails;
+    TMemSpyWindowServerEvent iEvent;
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerImp.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERIMP_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERIMP_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class MMemSpyEngineHelperSysMemTrackerObserver;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class CMemSpyEngineHelperSysMemTrackerEntryManager;
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerImp ) : public CTimer, public MDesCArray
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerImp* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperSysMemTrackerImp();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerImp( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    void StartL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
+    void StopL();
+
+    void SetObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver );
+    void RemoveObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver );
+    
+    const RPointerArray< CMemSpyEngineHelperSysMemTrackerCycle >& CompletedCycles() const;
+
+public: // From MDesCArray
+    TInt MdcaCount() const;
+    TPtrC MdcaPoint( TInt aIndex ) const;
+
+public: // But not exported
+    void Reset();
+    void CheckForChangesNowL();
+    //
+    inline CMemSpyEngine& Engine() { return iEngine; }
+    inline const TMemSpyEngineHelperSysMemTrackerConfig& Config() const { return iConfig; }
+
+private: // Internal methods
+    void PrepareInitialCycleL();
+    void CheckForChangesL();
+    void NotifyObserverCycleStartedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void NotifyObserverCycleFinishedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void AddCycleAndPopL( CMemSpyEngineHelperSysMemTrackerCycle* aCycle );
+    CMemSpyEngineHelperSysMemTrackerCycle* LastCycleOrNull();
+
+private: // From CActive
+    void RunL();
+    TInt RunError( TInt aError );
+
+private:
+    CMemSpyEngine& iEngine;
+    TMemSpyEngineHelperSysMemTrackerConfig iConfig;
+    CMemSpyEngineHelperSysMemTrackerEntryManager* iEntryManager;
+    RPointerArray< CMemSpyEngineHelperSysMemTrackerCycle > iCompletedCycles;
+    MMemSpyEngineHelperSysMemTrackerObserver* iObserver;
+    };
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerLog.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERLOG_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERLOG_H
+
+// System includes
+#include <e32base.h>
+#include <e32debug.h>
+
+
+#ifdef SYSMEMTRACKERLOGGING
+
+    #define SYSMEMTRACKERLOG_PRINTF( command ) command
+
+#else
+
+    #define SYSMEMTRACKERLOG_PRINTF( command )
+
+#endif
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Include/SysMemTracker/MemSpyEngineHelperSysMemTrackerOutputFormatter.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKEROUTPUTFORMATTER_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKEROUTPUTFORMATTER_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// User includes
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerOutputFormatter ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerOutputFormatter* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperSysMemTrackerOutputFormatter();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerOutputFormatter( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    void SetConfig( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
+    void OutputL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    inline const TMemSpyEngineHelperSysMemTrackerConfig& Config() const { return iConfig; }
+
+private: // Internal methods
+    void OutputOverallHeaderL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void OutputOverallFooterL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    static TBool HaveTypesChanged( TInt aLeft, TInt aRight );
+
+private:
+    CMemSpyEngine& iEngine;
+    TMemSpyEngineHelperSysMemTrackerConfig iConfig;
+    };
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/ClientServer/MemSpyEngineServer.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1788 @@
+/*
+* 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 "MemSpyEngineServer.h"
+
+// System includes
+#include <e32svr.h>
+#include <w32std.h>
+#include <APGTASK.H>
+#include <APGWGNAM.H>  
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyenginelogger.h>
+#include <memspyengineclientinterface.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperstack.h>
+#include <memspy/engine/memspyenginehelperthread.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperfilesystem.h>
+#include <memspy/engine/memspyenginehelperram.h>
+#include <memspy/engine/memspyenginehelpersysmemtracker.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+#include <memspy/engine/memspyenginehelperkernelcontainers.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelperserver.h>
+#include <memspy/engine/memspyenginehelperecom.h>
+
+#include <memspy/engine/memspyprocessdata.h>
+#include <memspy/engine/memspythreaddata.h>
+#include <memspy/engine/memspykernelobjectdata.h>
+#include <memspy/engine/memspythreadinfoitemdata.h>
+#include <memspy/engine/memspymemorytrackingcycledata.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyenginehelperactiveobject.h>
+#include <memspy/engine/memspyserverdata.h>
+#include <memspysession.h>
+#include <memspy/engine/memspyecomdata.h>
+
+inline CShutdown::CShutdown() :CTimer(-1)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+inline void CShutdown::ConstructL()
+    {
+    CTimer::ConstructL();
+    }
+
+inline void CShutdown::Start()
+    {
+    After(KMyShutdownDelay);
+    }
+
+void CShutdown::RunL()
+    //
+    // Initiate server exit when the timer expires
+    //
+    {
+    CActiveScheduler::Stop();
+    }
+
+CMemSpyEngineServer::CMemSpyEngineServer( CMemSpyEngine& aEngine )
+:   CServer2( EPriorityNormal ), iEngine( aEngine )
+    {
+    }
+
+
+CMemSpyEngineServer::~CMemSpyEngineServer()
+    {
+    }
+
+
+void CMemSpyEngineServer::ConstructL()
+    {
+    StartL( KMemSpyServerName );
+        
+    iShutdown.ConstructL();
+    // ensure that the server still exits even if the 1st client fails to connect
+    iShutdown.Start();
+    }
+
+
+CMemSpyEngineServer* CMemSpyEngineServer::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineServer* self = new(ELeave) CMemSpyEngineServer( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CSession2* CMemSpyEngineServer::NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const
+    {
+    if  ( aVersion.iMajor != KMemSpyClientServerVersion )
+        {
+        RDebug::Printf( "[MemSpy] CMemSpyEngineSession::NewSessionL() - BAD VERSION" );
+        User::Leave( KErrNotSupported );
+        }
+    //
+    CMemSpyEngineSession* session = CMemSpyEngineSession::NewL( iEngine, aMessage );
+	return session;
+    }
+
+void CMemSpyEngineServer::AddSession(TBool aCliRequest)
+    {
+    if (aCliRequest)
+        {
+        iCliConnected = ETrue;
+        }
+    else
+        {
+        ++iSessionCount;
+        }
+    iShutdown.Cancel();
+    }
+
+void CMemSpyEngineServer::DropSession(TBool aCliRequest)
+    {
+    if (!aCliRequest)
+        {
+        --iSessionCount;
+        }
+    
+    if (iSessionCount == 0 && !iCliConnected)
+        {
+        iShutdown.Start();
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineSession::CMemSpyEngineSession( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+
+CMemSpyEngineSession::~CMemSpyEngineSession()
+    {
+#ifdef _DEBUG
+    TPtrC pThreadName( KNullDesC );
+    if  ( iClientThreadName )
+        {
+        pThreadName.Set( *iClientThreadName );
+        }
+
+    RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::~CMemSpyEngineSession() - DEAD SESSION - this: 0x%08x, id: %4d, name: %S"), this, iClientThreadId, iClientThreadName );
+#endif
+
+    delete iClientThreadName;
+        
+    Server().DropSession(iIsCliRequest);
+    }
+
+
+void CMemSpyEngineSession::ConstructL( const RMessage2& aMessage )
+    {
+	RThread thread;
+    const TInt error = aMessage.Client( thread );
+    CleanupClosePushL( thread );
+
+    TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::ConstructL() - this: 0x%08x - opening client thread - err: %d", this, error ) );
+
+    User::LeaveIfError( error );
+
+    const TFullName threadName( thread.FullName() );
+    iClientThreadName = threadName.AllocL();
+    iClientThreadId = thread.Id();
+
+    CleanupStack::PopAndDestroy( &thread );
+    
+    const TUid KCliUid3 = { 0x2002129D };
+    iIsCliRequest = aMessage.SecureId() == TSecureId(KCliUid3);
+    
+    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::ConstructL() - NEW SESSION - this: 0x%08x, id: %4d, client: %S"), this, iClientThreadId, iClientThreadName ) );
+    }
+
+void CMemSpyEngineSession::CreateL()
+    {   
+    Server().AddSession(iIsCliRequest);
+    }
+
+CMemSpyEngineSession* CMemSpyEngineSession::NewL( CMemSpyEngine& aEngine, const RMessage2& aMessage )
+    {
+    CMemSpyEngineSession* self = new(ELeave) CMemSpyEngineSession( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL( aMessage );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+void CMemSpyEngineSession::ServiceL( const RMessage2& aMessage )
+    {
+    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::ServiceL() - START - this: 0x%08x, fn: 0x%08x, id: %4d, client: %S"), this, aMessage.Function(), iClientThreadId, iClientThreadName ) );
+
+    TRAPD( error, DoServiceL( aMessage ) );
+    if  ( error != KErrNone )
+        {
+        RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::ServiceL() - SERVICE ERROR - this: 0x%08x, fn: %d, err: %d, client: %S"), this, aMessage.Function(), error, iClientThreadName );
+        }
+    
+    if ((aMessage.Function() & KMemSpyOpFlagsAsyncOperation) == 0 || error != KErrNone)
+    	{
+		aMessage.Complete( error );
+    	}
+
+    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::ServiceL() - END - this: 0x%08x, fn: 0x%08x, id: %4d, client: %S"), this, aMessage.Function(), iClientThreadId, iClientThreadName ) );
+	}
+
+// ---------------------------------------------------------
+// DoServiceL( const RMessage2& aMessage )
+// ---------------------------------------------------------
+//
+void CMemSpyEngineSession::DoServiceL( const RMessage2& aMessage )
+	{
+	TInt function = aMessage.Function() & KMemSpyOpFlagsTypeMask;
+	if (function >= EMemSpyClientServerOpMarkerUiFirst && 
+		function < EMemSpyClientServerOpMarkerUiLast)
+		
+		DoUiServiceL(aMessage);
+	else
+		DoCmdServiceL(aMessage);
+	}
+// ---------------------------------------------------------
+// DoUiServiceL( const RMessage2& aMessage )
+// ---------------------------------------------------------
+//
+void CMemSpyEngineSession::DoUiServiceL( const RMessage2& aMessage )
+    {
+	switch (aMessage.Function() & KMemSpyOpFlagsTypeMask)
+		{
+	    case EMemSpyClientServerOpGetOutputSink:
+	        {
+	        TMemSpySinkType sink = iEngine.SinkType();
+	        TPckgBuf<TMemSpySinkType> type( sink );
+	        
+	        aMessage.WriteL( 0, type );
+	        break;
+	        }
+		case EMemSpyClientServerOpGetProcessCount:
+			{
+			aMessage.WriteL(0, TPckgBuf<TInt>(iEngine.Container().Count()));
+			break;
+			}
+		case EMemSpyClientServerOpGetProcesses:
+			{
+			CMemSpyEngineObjectContainer& list = iEngine.Container();
+			
+			TPckgBuf<TInt> a0;
+			aMessage.ReadL(0, a0);
+			TInt realCount = Min(a0(), list.Count());
+			
+			for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyProcessData))
+				{
+				CMemSpyProcess& process = iEngine.Container().At(i);
+				TMemSpyProcessData data;
+				data.iIsDead = process.IsDead();
+				data.iId = process.Id();
+				data.iName.Copy(process.Name().Left(KMaxFullName));
+				data.iThreadCount = process.Count();
+				data.iPriority = process.Priority();
+				data.iExitType = process.ExitType();
+				data.iExitReason = process.ExitReason();
+				data.iExitCategory = process.ExitCategory();
+				data.iSID = process.SID();
+				
+				TPckgBuf<TMemSpyProcessData> buffer(data);
+				aMessage.WriteL(1, buffer, offset);
+				}
+			
+			a0 = list.Count();
+			aMessage.WriteL(0, a0);
+
+			break;
+			}
+		case EMemSpyClienServerOpGetProcessIdByName:
+			{
+			TFullName processName;
+			aMessage.ReadL(0, processName);
+			
+			TBool found(EFalse);
+			
+			for (TInt i=0; i<iEngine.Container().Count(); i++)
+				{
+				CMemSpyProcess& process = iEngine.Container().At(i);
+				if (process.Name().FindF(processName) >= 0)
+					{
+					found = ETrue;
+					TPckgBuf<TProcessId> procId(process.Id());
+					aMessage.WriteL(1, procId);
+					}
+				}
+			
+			if (!found)
+				{
+				User::Leave(KErrNotFound);
+				}
+			
+			break;
+			}
+		case EMemSpyClientServerOpProcessSystemPermanentOrCritical:
+			{
+			TBool ret = EFalse;
+			TPckgBuf<TProcessId> id;
+			aMessage.ReadL( 0, id );
+			
+			CMemSpyEngineObjectContainer& container = iEngine.Container();
+			CMemSpyProcess& process = container.ProcessByIdL( id() );
+			
+			if  ( process.IsSystemPermanent() || process.IsSystemCritical() )
+				{
+				ret = ETrue;
+				}
+			TPckgBuf<TBool> retBuf( ret );
+			aMessage.WriteL( 1, retBuf );
+			
+			break;
+			}
+		case EMemSpyClientServerOpEndProcess:
+			{
+			TPckgBuf<TProcessId> id;
+			aMessage.ReadL( 0, id );
+			TPckgBuf<TMemSpyEndType> type;
+			aMessage.ReadL( 1, type );
+					
+			CMemSpyEngineObjectContainer& container = iEngine.Container();			
+			CMemSpyProcess& process = container.ProcessByIdL( id() );
+									
+			switch ( type() )
+				{
+				case ETerminate:
+					{
+					process.TerminateL();
+					break;
+					}
+				case EPanic:
+					{
+					process.PanicL();
+					break;
+					}
+				case EKill:
+					{
+					process.KillL();
+					break;
+					}
+				}																
+			break;
+			}
+		case EMemSpyClientServerOpSwitchToProcess:
+			{/*
+			TInt wgCount;
+			RWsSession wsSession;
+			User::LeaveIfError( wsSession.Connect() );
+			CleanupClosePushL( wsSession );
+			User::LeaveIfError( wgCount = wsSession.NumWindowGroups() );
+			RArray<RWsSession::TWindowGroupChainInfo> wgArray;
+			CleanupClosePushL( wgArray );
+			User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) );
+			TApaTask task( wsSession );
+			TBool brought( EFalse );
+			TInt wgId( KErrNotFound );
+			TThreadId threadId;
+			
+			TPckgBuf<TProcessId> id;
+			aMessage.ReadL( 0, id );
+			CMemSpyEngineObjectContainer& container = iEngine.Container();
+			CMemSpyProcess& process = container.ProcessByIdL( id() );
+			
+			// loop trough threads in a process
+			for ( TInt i = 0; i < process.MdcaCount(); i++ )
+				{
+				TInt wgCountLocal = wgCount;
+							
+				// loop trough all window groups and see if a thread id matches
+				while( !brought && wgCountLocal-- )
+					{
+					wgId = wgArray[wgCountLocal].iId;
+					User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) );
+					if ( threadId == process.At( i ).Id() )
+						{
+						CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId );
+						task.SetWgId( wgId );
+						if ( !wgName->Hidden() && task.Exists() )
+							{
+							task.BringToForeground();
+							brought = ETrue;                        
+							}
+						CleanupStack::PopAndDestroy( wgName );
+						}
+					}
+				}
+			
+			TPckgBuf<TBool> ret( brought );
+			aMessage.WriteL( 1, ret );
+			
+			break;*/
+			}
+		case EMemSpyClientServerOpGetThreadCount:
+			{
+			TPckgBuf<TProcessId> pid;
+			aMessage.ReadL(1, pid);
+			CMemSpyProcess& process = iEngine.Container().ProcessByIdL(pid());
+			aMessage.WriteL(0, TPckgBuf<TInt>(process.Count()));
+			break;
+			}
+		case EMemSpyClientServerOpGetThreads:
+			{
+			TPckgBuf<TProcessId> pid;
+			aMessage.ReadL(2, pid);
+			
+			CMemSpyProcess& list = iEngine.Container().ProcessByIdL(pid());
+			
+			TPckgBuf<TInt> a0;
+			aMessage.ReadL(0, a0);
+			TInt realCount = Min(a0(), list.Count());
+						
+			for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyThreadData))
+				{
+				CMemSpyThread& thread = list.At(i);
+				
+				TMemSpyThreadData data;
+				data.iId = thread.Id();
+				data.iName.Copy(thread.Name().Left(KMaxFullName));
+				data.iThreadPriority = thread.Priority();
+				
+				TPckgBuf<TMemSpyThreadData> buffer(data);
+				aMessage.WriteL(1, buffer, offset);
+				}
+			
+			a0 = list.Count();
+			aMessage.WriteL(0, a0);
+
+			break;
+			}
+		case EMemSpyClientServerOpSetThreadPriority:
+			{
+			TPckgBuf<TThreadId> tid;
+			TPckgBuf<TInt> priority;
+			aMessage.ReadL(0, tid);
+			aMessage.ReadL(1, priority);
+			
+			CMemSpyProcess* process = NULL;
+			CMemSpyThread* thread = NULL; 
+			User::LeaveIfError(iEngine.Container().ProcessAndThreadByThreadId(tid(), process, thread));
+			
+			if (thread)
+				{				
+				thread->SetPriorityL(static_cast<TThreadPriority>(priority()));
+				}					
+			break;
+			}
+		case EMemSpyClientServerOpThreadSystemPermanentOrCritical:
+			{
+			TPckgBuf<TThreadId> id;
+			aMessage.ReadL( 0, id );
+			
+			CMemSpyEngineObjectContainer& container = iEngine.Container();            
+			CMemSpyProcess* process = NULL;
+			CMemSpyThread* thread = NULL; 
+			User::LeaveIfError( container.ProcessAndThreadByThreadId( id(), process, thread ) );
+			
+			TBool ret = thread && ( thread->IsSystemPermanent() || thread->IsSystemCritical() );
+			
+			TPckgBuf<TBool> retBuf( ret );
+			aMessage.WriteL( 1, retBuf );
+							
+			break;
+			}
+		case EMemSpyClientServerOpEndThread:
+			{
+			TPckgBuf<TThreadId> id;
+			aMessage.ReadL( 0, id );
+			TPckgBuf<TMemSpyEndType> type;
+			aMessage.ReadL( 1, type );
+			
+			CMemSpyEngineObjectContainer& container = iEngine.Container();
+			CMemSpyProcess* process = NULL;
+			CMemSpyThread* thread = NULL; 
+			User::LeaveIfError( container.ProcessAndThreadByThreadId( id(), process, thread ) );
+			
+			if( thread )
+				{
+				switch ( type() )
+					{
+					case ETerminate:
+						{
+						thread->TerminateL();
+						break;
+						}
+					case EPanic:
+						{
+						thread->PanicL();
+						break;
+						}
+					case EKill:
+						{
+						thread->KillL();
+						break;
+						}
+					}				
+				}			
+			break;
+			}
+		case EMemSpyClientServerOpSwitchToThread:
+			{
+			TInt wgCount;
+			RWsSession wsSession;
+			User::LeaveIfError( wsSession.Connect() );
+			CleanupClosePushL( wsSession );
+			User::LeaveIfError( wgCount = wsSession.NumWindowGroups() );
+			RArray<RWsSession::TWindowGroupChainInfo> wgArray;
+			CleanupClosePushL( wgArray );
+			User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) );
+			TApaTask task( wsSession );
+			TBool brought( EFalse );
+			TInt wgId( KErrNotFound );
+			TThreadId threadId;
+					
+			TPckgBuf<TThreadId> id;
+			aMessage.ReadL( 0, id );
+					
+			// loop trough all window groups and see if a thread id matches
+			while( !brought && wgCount-- )
+				{
+				wgId = wgArray[wgCount].iId;
+				User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) );
+				if ( threadId == id() )
+					{
+					CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId );
+					task.SetWgId( wgId );
+					if ( !wgName->Hidden() && task.Exists() )
+						{
+						task.BringToForeground();
+						brought = ETrue;                        
+						}
+					CleanupStack::PopAndDestroy( wgName );
+					}
+				}			
+			TPckgBuf<TBool> ret( brought );
+			aMessage.WriteL( 1, ret );															
+					
+			break;
+			}		
+		case EMemSpyClientServerOpGetInfoItemType:
+			{
+			
+			TPckgBuf<TInt> index;
+			aMessage.ReadL( 0, index );			
+			TPckgBuf<TThreadId> id;
+			aMessage.ReadL( 1, id);
+								
+			CMemSpyEngineObjectContainer& container = iEngine.Container();            
+			CMemSpyProcess* process = NULL; //not needed
+			CMemSpyThread* thread = NULL; 
+			User::LeaveIfError( container.ProcessAndThreadByThreadId( id(), process, thread ) );
+		            
+			CMemSpyThreadInfoContainer& threadInfoContainer = thread->InfoContainerForceSyncronousConstructionL();                        
+			TMemSpyThreadInfoItemType retType = threadInfoContainer.Item( index() ).Type();
+			
+			TPckgBuf<TMemSpyThreadInfoItemType> ret( retType );
+			aMessage.WriteL( 2, ret );			
+			
+			break;
+			}
+		case EMemSpyClientServerOpGetThreadInfoItemsCount:
+			{
+			TPckgBuf<TThreadId> id;
+			aMessage.ReadL( 0, id );
+			TPckgBuf<TMemSpyThreadInfoItemType> type;
+			aMessage.ReadL( 1, type );					 
+			
+			CMemSpyEngineObjectContainer& container = iEngine.Container();            
+			CMemSpyProcess* process = NULL;
+			CMemSpyThread* thread = NULL; 
+			
+			container.ProcessAndThreadByThreadId( id(), process, thread );
+			
+			CMemSpyThreadInfoContainer& threadInfoContainer = thread->InfoContainerForceSyncronousConstructionL();                 
+								
+			CMemSpyThreadInfoItemBase& threadInfoItemBase = threadInfoContainer.Item( type() );
+				    
+			TInt count = threadInfoItemBase.MdcaCount();		    
+			TPckgBuf<TInt> tempret( count );
+			aMessage.WriteL( 2, tempret );
+		
+			break;
+			}		
+		case EMemSpyClientServerOpGetThreadInfoItems:
+			{
+			TPckgBuf<TInt> count;
+			aMessage.ReadL( 0, count );						
+			TPckgBuf<TThreadId> id;
+			aMessage.ReadL( 1, id );
+			TPckgBuf<TMemSpyThreadInfoItemType> type;
+			aMessage.ReadL( 2, type );			
+			
+			CMemSpyEngineObjectContainer& container = iEngine.Container();            
+			CMemSpyProcess* process = NULL;
+			CMemSpyThread* thread = NULL; 
+			User::LeaveIfError( container.ProcessAndThreadByThreadId( id() , process, thread ) );
+							  
+			CMemSpyThreadInfoContainer& threadInfoContainer = thread->InfoContainerForceSyncronousConstructionL();      
+
+			CMemSpyThreadInfoItemBase& threadInfoItemBase = threadInfoContainer.Item( type() ); //get ThreadInfoItemBaseByType
+			
+			TInt itemCount = Min(count(), threadInfoItemBase.MdcaCount());
+								
+			for( TInt i=0, offset = 0; i<itemCount; i++, offset += sizeof( TMemSpyThreadInfoItemData ) )
+				{
+				TMemSpyThreadInfoItemData data;
+				
+				TPtrC caption(threadInfoItemBase.MdcaPoint(i).Mid(1));
+				TInt tabPos = caption.Locate('\t');
+				if (tabPos != KErrNotFound)
+					caption.Set(caption.Left(tabPos));
+				
+				TPtrC value(threadInfoItemBase.MdcaPoint(i));
+				tabPos = value.LocateReverse('\t');
+				if (tabPos != KErrNotFound)
+					value.Set(value.Mid(tabPos + 1));
+												
+				data.iCaption.Copy( caption.Left(64) );
+				data.iValue.Copy( value.Left(32) );
+							
+				TPckgBuf<TMemSpyThreadInfoItemData> buffer(data);
+				aMessage.WriteL(3, buffer, offset);				
+				}			
+			aMessage.WriteL(0, count);
+					
+			break;
+			}
+			
+		case EMemSpyClientServerOpGetProcessIdByThreadId:
+			{
+			TPckgBuf<TThreadId> tid;
+			aMessage.ReadL( 1, tid );					
+			
+			CMemSpyProcess* process = NULL;
+			CMemSpyThread* thread = NULL;
+			//
+			const TInt error = iEngine.Container().ProcessAndThreadByThreadId( tid(), process, thread );
+			
+			TProcessId pid = process->Id();
+			
+			TPckgBuf<TProcessId> ret(pid);
+			aMessage.WriteL( 0, ret );
+									
+			break;
+			}
+			
+		// --- KernelObjects related functions ---
+		case EMemSpyClientServerOpGetKernelObjectCount:
+			{
+			TInt iCount = EMemSpyDriverContainerTypeLast - EMemSpyDriverContainerTypeFirst + 1;
+			TPckgBuf<TInt> ret( iCount );
+			aMessage.WriteL(0, ret);			
+			break;
+			}
+		case EMemSpyClientServerOpGetKernelObjects:
+			{
+			TPckgBuf<TInt> count;
+			aMessage.ReadL(0, count);
+			
+			CMemSpyEngineGenericKernelObjectContainer* model = iEngine.HelperKernelContainers().ObjectsAllL(); //contains all the objects
+			CleanupStack::PushL( model );
+			
+			for( TInt i=0, offset = 0; i<count(); i++, offset += sizeof( TMemSpyKernelObjectData ) )
+				{
+				TMemSpyKernelObjectData data;
+				
+				TPtrC name(model->At(i).Name().Mid(1));
+				TInt tabPos = name.Locate('\t');
+				if (tabPos != KErrNotFound)
+					name.Set(name.Left(tabPos));
+												
+				data.iName.Copy(name);
+				data.iType = model->At(i).Type();
+				data.iCount = model->At(i).Count();											
+				data.iSize = model->At(i).Count() * model->At(i).Count();
+
+				TPckgBuf<TMemSpyKernelObjectData> buffer(data);
+				aMessage.WriteL(1, buffer, offset);
+				}			
+			aMessage.WriteL(0, count);
+			CleanupStack::PopAndDestroy( model );
+			break;
+			}
+		case EMemSpyClientServerOpGetKernelObjectItemCount:
+			{
+			TPckgBuf<TMemSpyDriverContainerType> tempType;
+			aMessage.ReadL(1, tempType); //get type of kernel object
+			TMemSpyDriverContainerType type = tempType();
+			
+			CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
+			CMemSpyEngineGenericKernelObjectList* iObjectList = kernelContainerManager.ObjectsForSpecificContainerL( type );			
+			
+			TInt count = iObjectList->Count();
+			TPckgBuf<TInt> ret( count );
+			aMessage.WriteL( 0, ret );
+						
+			break;
+			}
+		case EMemSpyClientServerOpGetKernelObjectItems:
+			{
+			TPckgBuf<TInt> count;
+			TPckgBuf<TMemSpyDriverContainerType> tempType;
+			aMessage.ReadL( 0, count ); //get count of items
+			aMessage.ReadL(1, tempType); //get type of kernel object
+			TInt c = count();
+						
+			CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
+			CMemSpyEngineGenericKernelObjectList* iObjectList = kernelContainerManager.ObjectsForSpecificContainerL( tempType() );			
+			
+			for( TInt i=0, offset = 0; i<c; i++, offset += sizeof( TMemSpyDriverHandleInfoGeneric ) )
+				{
+				TMemSpyDriverHandleInfoGeneric data;								
+															
+				data = iObjectList->At( i );
+				
+				TPckgBuf<TMemSpyDriverHandleInfoGeneric> buffer(data);
+				aMessage.WriteL(2, buffer, offset);
+				}			
+					
+			break;
+			}
+			
+		case EMemSpyClientServerOpOutputAllContainerContents:
+			{
+			CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
+			CMemSpyEngineGenericKernelObjectContainer* model = kernelContainerManager.ObjectsAllL();
+			
+			model->OutputL( iEngine.Sink() );
+
+			break;
+			}
+			
+		case EMemSpyClientServerOpDumpKernelHeap:
+			{
+		    iEngine.HelperHeap().OutputHeapDataKernelL();
+			
+			break;
+			}
+			
+		case EMemSpyClientServerOpOutputInfoHandles:
+			{
+			TPckgBuf<TThreadId> id;
+			aMessage.ReadL(0, id);
+			CMemSpyEngineObjectContainer& container = iEngine.Container();            
+			CMemSpyProcess* process = NULL;
+			CMemSpyThread* thread = NULL; 
+			User::LeaveIfError( container.ProcessAndThreadByThreadId( id() , process, thread ) );
+										  
+			CMemSpyThreadInfoContainer& threadInfoContainer = thread->InfoContainerForceSyncronousConstructionL();
+			
+			threadInfoContainer.PrintL();
+			
+			break;
+			}
+			
+		case EMemSpyClientServerOpOutputAOList:
+			{
+			TPckgBuf<TThreadId> id;
+			TPckgBuf<TMemSpyThreadInfoItemType> type;
+			aMessage.ReadL(0, id);
+			aMessage.ReadL(1, type);
+			
+			CMemSpyEngineObjectContainer& container = iEngine.Container();            
+			CMemSpyProcess* process = NULL;
+			CMemSpyThread* thread = NULL; 
+			User::LeaveIfError( container.ProcessAndThreadByThreadId( id() , process, thread ) );
+										  
+			CMemSpyThreadInfoContainer& threadInfoContainer = thread->InfoContainerForceSyncronousConstructionL();      
+
+			CMemSpyThreadInfoItemBase* threadInfoItem = &threadInfoContainer.Item( type() );
+						
+			CMemSpyThreadInfoActiveObjects* activeObjectArray = static_cast< CMemSpyThreadInfoActiveObjects* >( threadInfoItem );			
+						
+		    // Begin a new data stream
+		    _LIT( KMemSpyContext, "Active Object List - " );
+		    _LIT( KMemSpyFolder, "Active Objects" );
+		    iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
+		    		    
+		    // Set prefix for overall listing
+		    iEngine.Sink().OutputPrefixSetLC( KMemSpyContext );
+
+		    // Create header
+		    CMemSpyEngineActiveObjectArray::OutputDataColumnsL( iEngine );
+		    
+		    // List items
+		    const TInt count = activeObjectArray->Array().Count();
+		    for(TInt i=0; i<count; i++)
+		        {
+		        const CMemSpyEngineActiveObject& object = activeObjectArray->Array().At( i );
+		        //
+		        object.OutputDataL( iEngine );
+		        }
+
+		    // Tidy up
+		    CleanupStack::PopAndDestroy(); // prefix
+
+		    // End data stream		    		    
+		    iEngine.Sink().DataStreamEndL();		    
+			
+			break;
+			}
+			
+		// --- Kernel Heap related functions ---
+		case EMemSpyClientServerOpGetHeap:
+			{
+			TMemSpyHeapInfo heapInfo;			
+			iEngine.HelperHeap().GetHeapInfoKernelL( heapInfo );
+			TMemSpyHeapData data = iEngine.HelperHeap().NewHeapRawInfo( heapInfo );
+			
+			TPckgBuf<TMemSpyHeapData> buffer(data);
+			aMessage.WriteL(0, buffer);
+			
+			break;
+			}
+			
+		case EMemSpyClientServerOpGetServerCount:
+            {
+            CMemSpyEngineServerList* list = iEngine.HelperServer().ServerListL();
+            CleanupStack::PushL(list);
+            // TODO: cache it between calls
+            aMessage.WriteL(0, TPckgBuf<TInt>(list->MdcaCount()));
+            
+            CleanupStack::PopAndDestroy(list);
+            break;
+            }
+        // --- Servers related functions
+        case EMemSpyClientServerOpGetServers:
+            {
+            CMemSpyEngineServerList* list = iEngine.HelperServer().ServerListL();
+            CleanupStack::PushL(list);
+            
+            TPckgBuf<TInt> a0;
+            aMessage.ReadL(0, a0);
+            TInt realCount = Min(a0(), list->MdcaCount());
+            
+            for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyServerData))
+                {
+                const CMemSpyEngineServerEntry& server = list->At(i);
+                TMemSpyServerData data;
+                
+                CMemSpyProcess* process = NULL;
+                CMemSpyThread* thread = NULL;
+                TInt error = iEngine.Container().ProcessAndThreadByThreadId( server.Id(), process, thread );
+                if (error == KErrNone && thread)
+                    {
+                    data.iId = thread->Process().Id();
+                    }
+                data.iName.Copy(server.Name().Left(KMaxFullName));
+                data.iSessionCount = server.SessionCount();
+                
+                TPckgBuf<TMemSpyServerData> buffer(data);
+                aMessage.WriteL(1, buffer, offset);
+                }
+            
+            a0 = list->Count();
+            aMessage.WriteL(0, a0);
+            
+            CleanupStack::PopAndDestroy(list);
+
+            break;
+            }
+            
+        case EMemSpyClientServerOpGetSortedServers:
+        	{
+        	CMemSpyEngineServerList* list = iEngine.HelperServer().ServerListL();
+        	CleanupStack::PushL(list);
+        	
+        	TPckgBuf<TSortType> a2;
+        	aMessage.ReadL( 2, a2 );
+        	
+        	//sort the list of the servers
+        	if( a2() == ESortServByName )
+        		list->SortByNameL();
+        	else
+        		list->SortBySessionCountL();
+        	
+        	TPckgBuf<TInt> a0;        	
+        	aMessage.ReadL(0, a0);        	        	        
+        	
+        	TInt realCount = Min(a0(), list->MdcaCount());
+        	            
+        	for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyServerData))
+        		{
+				const CMemSpyEngineServerEntry& server = list->At(i);
+				TMemSpyServerData data;
+        	                
+				data.iId = server.Id();
+				data.iName.Copy(server.Name().Left(KMaxFullName));
+				data.iSessionCount = server.SessionCount();
+        	                
+				TPckgBuf<TMemSpyServerData> buffer(data);
+				aMessage.WriteL(1, buffer, offset);
+        		}        	           
+			a0 = list->Count();
+			aMessage.WriteL(0, a0);
+        	            
+			CleanupStack::PopAndDestroy(list);
+			break;
+        	}
+          
+        case EMemSpyClientServerOpServerListOutputGeneric:
+        	{
+            TPckgBuf<TBool> a0;
+            aMessage.ReadL(0, a0);
+        	
+            CMemSpyEngineServerList* list;            
+            list = iEngine.HelperServer().ServerListL();
+            CleanupStack::PushL(list);
+            
+            _LIT( KMemSpyContext, "Server List - " );
+            _LIT( KMemSpyFolder, "Servers" );
+            iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
+
+            // Set prefix for overall listing
+            iEngine.Sink().OutputPrefixSetLC( KMemSpyContext );
+
+            // Create header
+            CMemSpyEngineServerList::OutputDataColumnsL( iEngine, a0() );
+               
+            // List items
+            const TInt count = list->Count();
+            for(TInt i=0; i<count; i++)
+            	{
+				const CMemSpyEngineServerEntry& server = list->At( i );
+				//
+				server.OutputDataL( iEngine.HelperServer(), a0() );
+            	}
+
+            // Tidy up
+            CleanupStack::PopAndDestroy(); // prefix
+            
+            // End data stream
+            iEngine.Sink().DataStreamEndL();
+            
+            CleanupStack::PopAndDestroy(list);        	
+        	break;
+        	}        	
+        	
+		case EMemSpyClientServerOpGetMemoryTrackingCycleCount:
+			{
+			TInt count = iEngine.HelperSysMemTracker().CompletedCycles().Count();
+			TPckgBuf<TInt> ret( count );
+			aMessage.WriteL( 0, ret );			
+			break;
+			}		
+			
+		case EMemSpyClientServerOpGetMemoryTrackingCycles:
+			{
+			const RPointerArray<CMemSpyEngineHelperSysMemTrackerCycle>& list = iEngine.HelperSysMemTracker().CompletedCycles();
+
+			TPckgBuf<TInt> a0;
+			aMessage.ReadL(0, a0);
+			TInt realCount = Min(a0(), list.Count());
+			
+			for (TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyMemoryTrackingCycleData))
+				{
+				CMemSpyProcess& process = iEngine.Container().At(i);
+				TMemSpyMemoryTrackingCycleData data;
+				data.iCycleNumber = list[i]->CycleNumber();
+				data.iCaption.Copy(list[i]->Caption().Left(KMaxFullName));
+				data.iTime = list[i]->Time();
+				data.iFreeMemory = list[i]->MemoryFree();
+				data.iMemoryDelta = list[i]->MemoryDelta();
+				data.iPreviousCycleDiff = list[i]->MemoryFreePreviousCycle();
+				data.iChangeCount = list[i]->ChangeCount();
+				
+				TPckgBuf<TMemSpyMemoryTrackingCycleData> buffer(data);
+				aMessage.WriteL(1, buffer, offset);
+				}
+			
+			a0 = list.Count();
+			aMessage.WriteL(0, a0);
+
+		break;
+		}
+
+	case EMemSpyClientServerOpIsSwmtRunning:
+		{
+		TPckgBuf<TBool> running(iEngine.HelperSysMemTracker().IsActive());
+		aMessage.WriteL(0, running);
+		break;
+		}
+		
+	case EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodGet:
+	    {	    			   
+	    // Get current config
+	    TMemSpyEngineHelperSysMemTrackerConfig config;
+	    iEngine.HelperSysMemTracker().GetConfig( config );
+	    TInt time = config.iTimerPeriod.Int();
+	    TPckgBuf<TInt> tim(time);			            
+	    aMessage.WriteL( 0, tim );
+	    break;
+	    }
+	    
+	case EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesGet:
+		{
+		// Get current config
+		TMemSpyEngineHelperSysMemTrackerConfig config;
+		iEngine.HelperSysMemTracker().GetConfig( config );		
+		TInt categories = config.iEnabledCategories;		
+		TPckgBuf<TInt> ret( categories );
+		aMessage.WriteL( 0, ret );						
+		break;
+		}
+		
+	case EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterGet:
+		{
+		TMemSpyEngineHelperSysMemTrackerConfig config;
+		iEngine.HelperSysMemTracker().GetConfig( config );                 
+		TName threadNameFilter = config.iThreadNameFilter;
+		TPckgBuf<TName> name(threadNameFilter);
+		aMessage.WriteL( 0, name );
+		
+		break;
+		}
+		
+	case EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpGet:
+		{
+		TMemSpyEngineHelperSysMemTrackerConfig config;
+		iEngine.HelperSysMemTracker().GetConfig( config );		           
+		TBool heapDump = config.iDumpData;
+		TPckgBuf<TBool> heap(heapDump);			            
+		aMessage.WriteL( 0, heap );
+		break;
+		}
+						
+	case EMemSpyClientServerOpSystemWideMemoryTrackingModeGet:
+		{
+		TMemSpyEngineHelperSysMemTrackerConfig config;
+		iEngine.HelperSysMemTracker().GetConfig( config );	 		 
+		TPckgBuf<TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode> mod(config.iMode);			             		            
+		aMessage.WriteL(0, mod);	 			 		    
+		break;
+		}			
+		
+	case EMemSpyClientServerOpNotifyDeviceWideOperationProgress:
+		{
+		if (!Server().CurrentOperationTracker())
+			{
+			User::Leave(KErrNotReady);
+			}
+		
+		Server().CurrentOperationTracker()->AddNotificationL(aMessage);
+		break;
+		}
+		
+	case EMemSpyClientServerOpCancelDeviceWideOperation:
+		if (!Server().CurrentOperationTracker())
+			{
+			User::Leave(KErrNotReady);
+			}
+		
+		Server().CurrentOperationTracker()->Cancel();
+		break;
+	
+		
+	case EMemSpyClientServerOpGetEComCategoryCount:
+	    aMessage.WriteL(0, TPckgBuf<TInt>(iEngine.HelperECom().MdcaCount()));
+	    break;
+	    
+
+	case EMemSpyClientServerOpGetEComCategories:
+	    {
+	    TPckgBuf<TInt> a0;
+        aMessage.ReadL(0, a0);
+        TInt realCount = Min(a0(), iEngine.HelperECom().MdcaCount());
+        
+        for (TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyEComCategoryData))
+            {
+            TMemSpyEComCategoryData data;
+            data.iId.iUid = i;
+            data.iName.Copy(iEngine.HelperECom().At(i).Name());
+            data.iInterfaceCount = iEngine.HelperECom().At(i).MdcaCount();
+            
+            TPckgBuf<TMemSpyEComCategoryData> buffer(data);
+            aMessage.WriteL(1, buffer, offset);
+		}
+        
+        a0 = iEngine.HelperECom().MdcaCount();
+        aMessage.WriteL(0, a0);
+	    break;
+    }
+	    
+	case EMemSpyClientServerOpGetEComInterfaceCount:
+	    {
+	    TPckgBuf<TUid> a1;
+        aMessage.ReadL(1, a1);
+        TInt index = a1().iUid;
+        
+        if (index < 0 || index >= iEngine.HelperECom().MdcaCount())
+            {
+            User::Leave(KErrArgument);
+            }
+        
+        aMessage.WriteL(0, TPckgBuf<TInt>(iEngine.HelperECom().At(index).MdcaCount()));
+	    break;
+	    }
+	            
+	case EMemSpyClientServerOpGetEComInterfaces:
+	    {
+	    TPckgBuf<TInt> a0;
+        aMessage.ReadL(0, a0);
+        TInt realCount = Min(a0(), iEngine.HelperECom().MdcaCount());
+        
+        TPckgBuf<TUid> a1;
+        aMessage.ReadL(1, a1);
+        TInt categoryIndex = a1().iUid;
+        
+        if (categoryIndex < 0 || categoryIndex >= iEngine.HelperECom().MdcaCount())
+            {
+            User::Leave(KErrArgument);
+            }
+        
+        CMemSpyEngineEComCategory &category = iEngine.HelperECom().At(categoryIndex);
+        
+        for (TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyEComInterfaceData))
+            {
+            TMemSpyEComInterfaceData data;
+            data.iId.iUid = (TInt32) &category.At(i);
+            data.iCategoryId.iUid = categoryIndex;
+            data.iName.Copy(category.At(i).Name());
+            data.iImplementationCount = category.At(i).MdcaCount();
+            
+            TPckgBuf<TMemSpyEComInterfaceData> buffer(data);
+            aMessage.WriteL(2, buffer, offset);
+            }
+        
+        a0 = realCount;
+        aMessage.WriteL(0, a0);
+        
+        break;
+	    }
+	    
+	case EMemSpyClientServerOpGetEComImplementationCount:
+	    {
+	    TPckgBuf<TUid> a1;
+        aMessage.ReadL(1, a1);
+        CMemSpyEngineEComInterface* interface = reinterpret_cast<CMemSpyEngineEComInterface*>(a1().iUid);
+        
+        // TODO: check if it really is valid interface 
+        
+        aMessage.WriteL(0, TPckgBuf<TInt>(interface->MdcaCount()));
+	    break;
+	    }
+	                
+	case EMemSpyClientServerOpGetEComImplementations:
+	    {
+        TPckgBuf<TUid> a1;
+        aMessage.ReadL(1, a1);
+        CMemSpyEngineEComInterface* interface = reinterpret_cast<CMemSpyEngineEComInterface*>(a1().iUid);
+        
+        TPckgBuf<TInt> a0;
+        aMessage.ReadL(0, a0);
+        TInt realCount = Min(a0(), interface->MdcaCount());
+        
+        
+        for (TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyEComImplementationData))
+            {
+            TMemSpyEComImplementationData data;
+            data.iName.Copy(interface->At(i).Info().DisplayName());
+            data.iImplementationUid = interface->At(i).Info().ImplementationUid();
+            data.iVersion = interface->At(i).Info().Version();
+            data.iDataType.Copy(interface->At(i).Info().DataType());
+            data.iOpaqueData.Copy(interface->At(i).Info().OpaqueData());
+            data.iDrive = interface->At(i).Info().Drive();
+            data.iRomOnly = interface->At(i).Info().RomOnly();
+            data.iRomBased = interface->At(i).Info().RomBased();
+            data.iVendorId = interface->At(i).Info().VendorId();
+            data.iDisabled = interface->At(i).Info().Disabled();
+            
+            TPckgBuf<TMemSpyEComImplementationData> buffer(data);
+            aMessage.WriteL(2, buffer, offset);
+            }
+        
+        a0 = realCount;
+        aMessage.WriteL(0, a0);
+        
+        break;
+	    }
+	    
+		}
+    }
+
+// ---------------------------------------------------------
+// DoCmdServiceL( const RMessage2& aMessage )
+// ---------------------------------------------------------
+//
+void CMemSpyEngineSession::DoCmdServiceL( const RMessage2& aMessage )
+    {
+    TInt error = KErrNone;
+
+    // Check function attributes
+    const TInt function = aMessage.Function() & KMemSpyOpFlagsTypeMask;
+    const TInt argSpec = aMessage.Function() & KMemSpyOpFlagsInclusionMask;
+    const TBool byThreadId = ( argSpec == KMemSpyOpFlagsIncludesThreadId );
+    const TBool byThreadName = ( argSpec == KMemSpyOpFlagsIncludesThreadName );
+
+    TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - START - unmodified function: 0x%08x, opCode: %d [TID: %d, TN: %d]", aMessage.Function(), function, byThreadId, byThreadName ) );
+
+    // Check function is supported and argument combination is valid
+    error = ValidateFunction( function, byThreadId, byThreadName );
+    TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - validation result: %d", error ) );
+    
+    // Process function request
+    if  ( error == KErrNone )
+        {
+        if  ( byThreadId )
+            {
+            TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - [TID] thread-specific..." ) );
+            
+            const TThreadId threadId( aMessage.Int0() );
+            HandleThreadSpecificOpL( function, threadId );
+            }
+        else if ( byThreadName )
+            {
+            TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - [TN] thread-specific..." ) );
+
+            error = aMessage.GetDesLength( 0 /*slot 0*/ );
+        
+            if  ( error > 0 && error <= KMaxFullName )
+                {
+                TFullName* threadName = new(ELeave) TFullName();
+                CleanupStack::PushL( threadName );
+                aMessage.ReadL( 0, *threadName );
+                HandleThreadSpecificOpL( function, *threadName );
+                CleanupStack::PopAndDestroy( threadName );
+                }
+            else
+                {
+                error = KErrArgument;
+                }
+            }
+        else
+            {
+            TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - thread-agnostic..." ) );
+
+            HandleThreadAgnosticOpL( function, aMessage );
+            }
+        }
+
+    User::LeaveIfError( error );
+
+    TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::DoServiceL() - END" ) );
+    }
+
+
+
+TInt CMemSpyEngineSession::ValidateFunction( TInt aFunction, TBool aIncludesThreadId, TBool aIncludesThreadName )
+    {
+    TInt err = KErrNotSupported;
+    
+    // Check the operation is within op-code range
+    if  ( aFunction >= EMemSpyClientServerOpMarkerFirst && aFunction < EMemSpyClientServerOpMarkerLast )
+        {
+        // Check the operation doesn't include unnecessary or not supported information
+        const TBool includesThreadIdentifier = ( aIncludesThreadId || aIncludesThreadName );
+        if  ( includesThreadIdentifier && aFunction >= EMemSpyClientServerOpMarkerThreadAgnosticFirst )
+            {
+            // Passing a thread identifier to a thread agnostic operation
+            err = KErrArgument;
+            }
+        else
+            {
+            err = KErrNone;
+            }
+        }
+    //
+    if  ( err != KErrNone )
+        {
+        RDebug::Printf( "[MemSpy] CMemSpyEngineSession::ValidateFunction() - function request did not validate - [withId: %d, withName: %d]", aIncludesThreadId, aIncludesThreadName );
+        }
+    //
+    return err;
+    }
+
+
+void CMemSpyEngineSession::HandleThreadSpecificOpL( TInt aFunction, const TThreadId& aThreadId )
+    {
+    TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - START - aFunction: %d, aThreadId: %d", aFunction, (TUint) aThreadId ) );
+
+    ASSERT( (TUint) aThreadId != 0 );
+    TInt error = KErrNone;
+
+    // Check if its a kernel thread identifier
+    const TBool isKernel = ( static_cast<TUint32>( aThreadId ) == KMemSpyClientServerThreadIdKernel );
+
+    // Treat as thread specific operation
+    CMemSpyProcess* process = NULL;
+    CMemSpyThread* thread = NULL;
+    if  ( !isKernel )
+        {
+        error = iEngine.Container().ProcessAndThreadByThreadId( aThreadId, process, thread );
+        TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - search result: %d, proc: 0x%08x, thread: 0x%08x", error, process, thread ) );
+        }
+    else
+        {
+        // Kernel is only supported for a couple of operations
+        if  ( aFunction == EMemSpyClientServerOpHeapInfo || aFunction == EMemSpyClientServerOpHeapData )
+            {
+            }
+        else
+            {
+            TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - trying to call unsupported function for kernel thread!" ) );
+            error = KErrArgument;
+            }
+        }
+
+    // Must be no error so far and we must have a valid thread & process when performing a non-kernel op
+    // or then if we are performing a kernel op, we don't need the thread or process.
+    if  ( error == KErrNone && ( ( thread && process && !isKernel ) || ( isKernel ) ) )
+        {
+#ifdef _DEBUG
+        if  ( thread )
+            {
+            HBufC* threadName = thread->FullName().AllocLC();
+            _LIT( KTrace2, "[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - thread: %S" );
+            RDebug::Print( KTrace2, threadName );
+            CleanupStack::PopAndDestroy( threadName );
+            }
+        else if ( isKernel )
+            {
+            _LIT( KTrace2, "[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - thread: Kernel" );
+            RDebug::Print( KTrace2 );
+            }
+#endif
+
+        // Got a valid thread object - now work out which operation to perform...
+        switch( aFunction )
+            {
+        case EMemSpyClientServerOpSummaryInfo:
+            iEngine.HelperProcess().OutputProcessInfoL( *process );
+            break;
+        case EMemSpyClientServerOpSummaryInfoDetailed:
+            iEngine.HelperProcess().OutputProcessInfoDetailedL( *process );
+            break;
+        case EMemSpyClientServerOpHeapInfo:
+            if  ( isKernel )
+                {
+                iEngine.HelperHeap().OutputHeapInfoKernelL();
+                }
+            else
+                {
+                iEngine.HelperHeap().OutputHeapInfoUserL( *thread );
+                }
+            break;
+        case EMemSpyClientServerOpHeapCellListing:
+            iEngine.HelperHeap().OutputCellListingUserL( *thread );
+            break;
+        case EMemSpyClientServerOpHeapData:
+            if  ( isKernel )
+                {
+                iEngine.HelperHeap().OutputHeapDataKernelL();
+                }
+            else
+                {
+                iEngine.HelperHeap().OutputHeapDataUserL( *thread );
+                }
+            break;
+        case EMemSpyClientServerOpStackInfo:
+            iEngine.HelperStack().OutputStackInfoL( *thread );
+            break;
+        case EMemSpyClientServerOpStackDataUser:
+            iEngine.HelperStack().OutputStackDataL( *thread, EMemSpyDriverDomainUser, EFalse );
+            break;
+        case EMemSpyClientServerOpStackDataKernel:
+            iEngine.HelperStack().OutputStackDataL( *thread, EMemSpyDriverDomainKernel, EFalse );
+            break;
+        case EMemSpyClientServerOpOpenFiles:
+            iEngine.HelperFileSystem().ListOpenFilesL( aThreadId );
+            break;
+
+        default:
+            error = KErrNotSupported;
+            break;
+            }
+        }
+
+    TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - END - aFunction: %d, aThreadId: %d, error: %d", aFunction, (TUint) aThreadId, error ) );
+    User::LeaveIfError( error );
+    }
+
+
+void CMemSpyEngineSession::HandleThreadSpecificOpL( TInt aFunction, const TDesC& aThreadName )
+    {
+    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - START - aFunction: %d, aThreadName: %S"), aFunction, &aThreadName ) );
+    //
+    CMemSpyProcess* process = NULL;
+    CMemSpyThread* thread = NULL;
+    TInt error = iEngine.Container().ProcessAndThreadByPartialName( aThreadName, process, thread );
+    User::LeaveIfError( error );
+    //
+    const TThreadId threadId( thread->Id() );
+    HandleThreadSpecificOpL( aFunction, threadId );
+    //
+    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyEngineSession::HandleThreadSpecificOpL() - END - aFunction: %d, aThreadName: %S"), aFunction, &aThreadName ) );
+    }
+
+
+void CMemSpyEngineSession::HandleThreadAgnosticOpL( TInt aFunction, const RMessage2& aMessage )
+    {
+    TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - START" ) );
+    
+    //
+    if  ( aFunction ==  EMemSpyClientServerOpHeapInfoCompact )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpHeapInfoCompact") );
+        if (aMessage.Function() & KMemSpyOpFlagsAsyncOperation)
+        	{
+			StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EEntireDeviceHeapInfoCompact, aMessage);
+        	}
+        else
+        	{
+			iEngine.HelperHeap().OutputHeapInfoForDeviceL();
+        	}
+        }
+    else if ( aFunction ==  EMemSpyClientServerOpStackInfoCompact )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpStackInfoCompact") );
+        if (aMessage.Function() & KMemSpyOpFlagsAsyncOperation)
+			{
+			StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EEntireDeviceStackInfoCompact, aMessage);
+			}
+		else
+			{
+			iEngine.HelperStack().OutputStackInfoForDeviceL();
+			}
+        }
+    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart") );
+        iEngine.HelperSysMemTracker().StartL();
+        }
+    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop") );
+        iEngine.HelperSysMemTracker().StopL();
+        }
+    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingReset )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingReset") );
+        iEngine.HelperSysMemTracker().Reset();
+        }
+    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate") );
+        iEngine.HelperSysMemTracker().CheckForChangesNowL();
+        }
+    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet") );
+        
+        // Get current config
+        TMemSpyEngineHelperSysMemTrackerConfig config;
+        iEngine.HelperSysMemTracker().GetConfig( config );
+
+        // Set new timer value
+        config.iTimerPeriod = aMessage.Int0();
+
+        // And update config... which will leave if the config is invalid
+        iEngine.HelperSysMemTracker().SetConfigL( config );
+        }
+    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet") );
+        // Get current config
+        TMemSpyEngineHelperSysMemTrackerConfig config;
+        iEngine.HelperSysMemTracker().GetConfig( config );
+
+        // Set new categories
+        config.iEnabledCategories = aMessage.Int0();
+
+        // And update config... which will leave if the config is invalid
+        iEngine.HelperSysMemTracker().SetConfigL( config );
+        }
+    
+    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet") );
+        // Get current config
+        TMemSpyEngineHelperSysMemTrackerConfig config;
+        iEngine.HelperSysMemTracker().GetConfig( config );
+
+        // Set new filter
+        RBuf buf;
+        buf.CleanupClosePushL();
+        TInt len = aMessage.GetDesLength( 0 );
+        if ( len > 0 )
+            {
+            buf.CreateL( len );
+            aMessage.ReadL( 0, buf, 0 );
+            config.iThreadNameFilter.Copy( buf );            
+            }
+        else
+            {
+            config.iThreadNameFilter.Zero();
+            }
+        CleanupStack::PopAndDestroy( &buf );
+
+        // And update config... which will leave if the config is invalid
+        iEngine.HelperSysMemTracker().SetConfigL( config );
+        }
+    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet )
+        {
+        // Get current config
+        TMemSpyEngineHelperSysMemTrackerConfig config;
+        iEngine.HelperSysMemTracker().GetConfig( config );
+        
+        // Set new Heap Dump value
+        config.iDumpData = aMessage.Int0();
+        
+        // And update config... which will leave if the config is invalid
+        iEngine.HelperSysMemTracker().SetConfigL( config );
+        }
+    else if( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingModeSet)
+    	{
+		TMemSpyEngineHelperSysMemTrackerConfig config;
+		iEngine.HelperSysMemTracker().GetConfig( config );
+		
+		TPckgBuf<TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode> mode;
+		aMessage.ReadL( 0, mode );
+		
+		config.iMode = mode();
+			
+		// And update config... which will leave if the config is invalid
+		iEngine.HelperSysMemTracker().SetConfigL( config );
+    	}
+    
+    else if ( aFunction == EMemSpyClientServerOpSwitchOutputSinkTrace )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSwitchOutputSinkTrace") );
+        iEngine.InstallDebugSinkL();
+        }
+    else if ( aFunction == EMemSpyClientServerOpSwitchOutputSinkFile )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSwitchOutputSinkFile") );
+        // Read file name from message.
+        TFileName fileName;
+        RBuf buf;
+		buf.CleanupClosePushL();
+		
+		TInt len = aMessage.GetDesLength( 0 );
+		if ( len > 0 )
+			{
+			buf.CreateL( len );
+			aMessage.ReadL( 0, buf, 0 );
+			
+			iEngine.InstallFileSinkL( buf );           
+			}
+		else
+			{
+			iEngine.InstallFileSinkL( KNullDesC );
+			}
+		
+		CleanupStack::PopAndDestroy( &buf );
+        
+        }
+    else if ( aFunction == EMemSpyClientServerOpEnumerateKernelContainer )
+        {
+        const TMemSpyDriverContainerType type = CMemSpyEngineHelperKernelContainers::MapToType( static_cast< TObjectType >( aMessage.Int0() ) );
+
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpEnumerateKernelContainer - type: %d", type ) );
+
+        CMemSpyEngineGenericKernelObjectList* model = iEngine.HelperKernelContainers().ObjectsForSpecificContainerL( type );
+        CleanupStack::PushL( model );
+        model->OutputL( iEngine.Sink() );
+        CleanupStack::PopAndDestroy( model );
+        }
+    else if ( aFunction == EMemSpyClientServerOpEnumerateKernelContainerAll )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpEnumerateKernelContainerAll") );
+        CMemSpyEngineGenericKernelObjectContainer* model = iEngine.HelperKernelContainers().ObjectsAllL();
+        CleanupStack::PushL( model );
+        model->OutputL( iEngine.Sink() );
+        CleanupStack::PopAndDestroy( model );
+        }
+    else if ( aFunction == EMemSpyClientServerOpOpenFiles )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpOpenFiles") );
+        iEngine.ListOpenFilesL();
+        }
+    else if ( aFunction == EMemSpyClientServerOpDisableAknIconCache )
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpDisableAknIconCache") );
+        iEngine.HelperRAM().SetAknIconCacheStatusL( EFalse );
+        }
+    else if ( aFunction == EMemSpyClientServerOpSummaryInfo )
+    	{
+		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSummaryInfo") );
+		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityGeneralSummary, aMessage);
+    	}
+    else if ( aFunction == EMemSpyClientServerOpSummaryInfoDetailed )
+		{
+		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSummaryInfoDetailed") );
+		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed, aMessage);
+		}
+    else if ( aFunction == EMemSpyClientServerOpHeapInfo )
+		{
+		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpHeapInfo") );
+		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityHeapInfo, aMessage);
+		}
+    else if ( aFunction == EMemSpyClientServerOpHeapCellListing )
+		{
+		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpHeapCellListing") );
+		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityHeapCellListing, aMessage);
+		}
+    else if ( aFunction == EMemSpyClientServerOpHeapData )
+		{
+		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpHeapData") );
+		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityHeapData, aMessage);
+		}
+    else if ( aFunction == EMemSpyClientServerOpStackInfo )
+		{
+		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpStackInfo") );
+		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityStackInfo, aMessage);
+		}
+    else if ( aFunction == EMemSpyClientServerOpStackDataUser )
+		{
+		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpStackDataUser") );
+		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityStackDataUser, aMessage);
+		}
+    else if ( aFunction == EMemSpyClientServerOpStackDataKernel )
+		{
+		TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpStackDataKernel") );
+		StartDeviceWideOperationL(CMemSpyDeviceWideOperations::EPerEntityStackDataKernel, aMessage);
+		}
+    else
+        {
+        TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - [device-wide operation] => invoking UI") );
+        iEngine.NotifyClientServerOperationRequestL( aFunction );
+        }
+    //
+    TRACE( RDebug::Printf("[MemSpy] CMemSpyEngineSession::HandleThreadAgnosticOpL() - END" ) );
+    }
+
+void CMemSpyEngineSession::StartDeviceWideOperationL(CMemSpyDeviceWideOperations::TOperation aOperation, const RMessage2& aMessage)
+	{
+	if (Server().CurrentOperationTracker())
+		{
+		User::Leave(KErrInUse);
+		}
+	
+	Server().SetCurrentOperationTracker(CMemSpyDwOperationTracker::NewL(aOperation, aMessage, Server()));
+	}
+
+
+
+
+
+
+
+
+
+CMemSpyDwOperationTracker* CMemSpyDwOperationTracker::NewL(CMemSpyDeviceWideOperations::TOperation aOperation, 
+		const RMessage2& aOperationMessage, CMemSpyEngineServer& aServer)
+	{
+	CMemSpyDwOperationTracker* self = new (ELeave) CMemSpyDwOperationTracker(aOperationMessage, aServer);
+	CleanupStack::PushL( self );
+	self->ConstructL(aOperation);
+	CleanupStack::Pop( self );
+	return self;
+	}
+	
+CMemSpyDwOperationTracker::~CMemSpyDwOperationTracker()
+	{
+	delete iOperation;
+	delete iPendingNotifications;
+	}
+
+CMemSpyDwOperationTracker::CMemSpyDwOperationTracker(const RMessage2& aOperationMessage, CMemSpyEngineServer& aServer) : 
+		iOperationMessage(aOperationMessage),
+		iServer(aServer),
+		iPendingNotifications(0),
+		iOperation(0),
+		iProgress(0)
+	{
+	}
+
+
+void CMemSpyDwOperationTracker::ConstructL(CMemSpyDeviceWideOperations::TOperation aOperation)
+	{
+	iPendingNotifications = new (ELeave) CArrayFixFlat<RMessage2>(3);
+	iOperation = CMemSpyDeviceWideOperations::NewL(iServer.Engine(), *this, aOperation);
+	}
+
+void CMemSpyDwOperationTracker::AddNotificationL(const RMessage2& aMessage)
+	{
+	iPendingNotifications->AppendL(aMessage);
+	}
+
+void CMemSpyDwOperationTracker::Cancel()
+	{
+	iOperation->Cancel();
+	}
+
+void CMemSpyDwOperationTracker::HandleDeviceWideOperationEvent(TEvent aEvent, TInt aParam1, const TDesC& aParam2)
+	{
+	switch( aEvent )
+		{
+	case MMemSpyDeviceWideOperationsObserver::EOperationCompleted:
+	case MMemSpyDeviceWideOperationsObserver::EOperationCancelled:
+		iServer.SetCurrentOperationTracker(0);
+		
+		for (TInt i=0; i<iPendingNotifications->Count(); i++)
+			{
+			iPendingNotifications->At(i).Complete(KErrCancel);
+			}
+		
+		if (iOperationMessage.Function() & KMemSpyOpFlagsAsyncOperation)
+			{
+			iOperationMessage.Complete(
+				aEvent == MMemSpyDeviceWideOperationsObserver::EOperationCompleted ? KErrNone : KErrCancel);
+			}
+		
+		iPendingNotifications->Reset();
+		
+		delete this;
+		break;
+		
+	case MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd:
+		{
+		iProgress += aParam1;
+		for (TInt i=0; i<iPendingNotifications->Count(); i++)
+			{
+			TInt err;
+			TRAP(err, iPendingNotifications->At(i).WriteL(0, TPckgBuf<TInt>( iProgress * 100 / iOperation->TotalOperationSize() )));
+			TRAP(err, iPendingNotifications->At(i).WriteL(1, aParam2));
+			if (err != KErrNone)
+				{
+				// TODO: iPendingProgressNotifications->At(i).Panic()
+				}
+			iPendingNotifications->At(i).Complete(KErrNone);
+			}
+		iPendingNotifications->Reset();
+		break;
+		}
+		
+		}
+	
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/DeviceWideOps/MemSpyDeviceWideOperations.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,449 @@
+/*
+* 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 <memspy/engine/memspydevicewideoperations.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperstack.h>
+#include <memspy/engine/memspyenginehelperthread.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// Literal constants
+_LIT( KMemSpyUiThreadNameKernel, "Kernel" );
+_LIT( KMemSpyUiCompactHeap, "Compact Heap" );
+_LIT( KMemSpyUiCompactStack, "Compact Stack" );
+
+
+
+CMemSpyDeviceWideOperations::CMemSpyDeviceWideOperations( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationsObserver& aObserver, TOperation aOperation )
+:   CActive( EPriorityIdle ), iEngine( aEngine ), iObserver( aObserver ), iOperation( aOperation )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+EXPORT_C CMemSpyDeviceWideOperations::~CMemSpyDeviceWideOperations()
+    {
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::~CMemSpyDeviceWideOperations() - START - iOperationCancelled: %d", iOperationCancelled );
+#endif
+
+    Cancel();
+
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::~CMemSpyDeviceWideOperations() - END" );
+#endif
+    }
+
+
+void CMemSpyDeviceWideOperations::ConstructL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::ConstructL() - START" );
+#endif
+
+    // Set engine sink time stamp, which will cause the data to be written to a 
+    // uniquely named folder (if we're using a file sink)
+    TTime now;
+    now.HomeTime();
+    iEngine.Sink().DataStreamTimeStampBeginL( now );
+
+    const TInt processCountUser = iEngine.Container().Count();
+    const TInt threadCountUser = TotalNumberOfThreads();
+    const TInt threadCountIncludingKernelSupervisor = threadCountUser + 1; // includes kernel supervisor thread
+
+    // Decide what the maximum progress bar value is...
+    // If we're performing a detailed operation, then skip straight to the end because
+    // the entire operation is performed in one go.
+    iTotalOperationSize = 0;
+    switch( iOperation )
+        {
+    // Only applicable to user-threads
+    default:
+    case EPerEntityGeneralSummary:
+    case EPerEntityGeneralDetailed:
+    case EPerEntityGeneralHandles:
+    case EPerEntityHeapCellListing:
+    case EPerEntityStackInfo:
+    case EPerEntityStackDataUser:
+    case EPerEntityStackDataKernel:
+        iTotalOperationSize = threadCountUser;
+        break;
+    // Applies to user and kernel threads
+    case EPerEntityHeapInfo:
+        iTotalOperationSize = threadCountIncludingKernelSupervisor;
+        break;
+    // Operation is performed in one go
+    case EEntireDeviceHeapInfoCompact:
+    case EEntireDeviceStackInfoCompact:
+        iProcessIndex = processCountUser;
+        iTotalOperationSize = 1;
+        break;
+        }
+
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::ConstructL() - op. count: %d", iTotalOperationSize );
+#endif
+
+    // Report total amount of work to observer
+    iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationSized, iTotalOperationSize, KNullDesC );
+
+    // Start the process rolling...
+    CompleteSelf( KErrNone );
+
+    // Indicate that we're now starting the operation
+    iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationStarting, 0, KNullDesC );
+
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::ConstructL() - END" );
+#endif
+    }
+
+
+EXPORT_C CMemSpyDeviceWideOperations* CMemSpyDeviceWideOperations::NewL( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationsObserver& aObserver, TOperation aOperation )
+    {
+    CMemSpyDeviceWideOperations* self = new(ELeave) CMemSpyDeviceWideOperations( aEngine, aObserver, aOperation );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::NewL() - about to pop..." );
+#endif
+    CleanupStack::Pop( self );
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::NewL() - popped" );
+#endif
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyDeviceWideOperations::Cancel()
+    {
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::Cancel() - START - IsActive: %d", IsActive() );
+#endif
+
+    if  ( IsActive() )
+        {
+        CActive::Cancel();
+        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationCancelled, 0, KNullDesC );
+        }
+
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::Cancel() - END" );
+#endif
+    }
+
+
+EXPORT_C TInt CMemSpyDeviceWideOperations::TotalOperationSize() const
+    {
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::TotalOperationSize::Cancel() - ret: %d", iTotalOperationSize );
+#endif
+    return iTotalOperationSize;
+    }
+
+
+void CMemSpyDeviceWideOperations::RunL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyDeviceWideOperations::RunL() - START - iStatus: %d, iOperationCancelled: %d, iThreadIndex: %03d, iOperation: %d", iStatus.Int(), iOperationCancelled, iThreadIndex, iOperation );
+#endif
+
+    User::LeaveIfError( iStatus.Int() );
+    User::ResetInactivityTime();
+ 
+    if  ( iOperationCancelled )
+        {
+#ifdef _DEBUG
+        RDebug::Printf( "CMemSpyDeviceWideOperations::RunL() - operation was cancelled whilst running... => Finished" );
+#endif
+        SetFinished();
+        }
+    else
+        {
+        // Get the current process
+        CMemSpyEngineObjectContainer& container = iEngine.Container();
+        const TInt processCount = container.Count();
+        //
+        if  ( iProcessIndex < processCount ) 
+            {
+            PerformNextStepL();
+            }
+        else
+            {
+            // We're done - RunL will not be called again
+            TRAP_IGNORE( PerformFinalOperationL() );
+            SetFinished();
+            }
+        }
+
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::RunL() - END" );
+#endif
+    }
+
+
+void CMemSpyDeviceWideOperations::DoCancel()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyDeviceWideOperations::DoCancel() - START" );
+#endif
+
+    // Nothing to do here
+    iOperationCancelled = ETrue;
+
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyDeviceWideOperations::DoCancel() - END" );
+#endif
+    }
+
+
+TInt CMemSpyDeviceWideOperations::RunError( TInt aError )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyDeviceWideOperations::RunError() - START - iOperationCancelled: %d, aError: %d", iOperationCancelled, aError );
+#endif
+
+    // KErrNotFound can come when trying to suspend a process or thread that no longer exists.
+    if  ( !( aError == KErrDied || aError == KErrNotFound ) )
+        {
+#ifdef _DEBUG
+        RDebug::Printf( "CMemSpyDeviceWideOperations::RunError() - fatal error - cancelling..." );
+#endif       
+        Cancel();
+        }
+    //
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyDeviceWideOperations::RunError() - END - iOperationCancelled: %d, aError: %d", iOperationCancelled, aError );
+#endif
+    return KErrNone;
+    }
+
+
+void CMemSpyDeviceWideOperations::CompleteSelf( TInt aError )
+    {
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, aError );
+    SetActive();
+    }
+
+
+void CMemSpyDeviceWideOperations::PerformFinalOperationL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyDeviceWideOperations::PerformFinalOperationL() - START" );
+#endif
+
+    iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationCompleting, 0, KNullDesC );
+ 
+    // Carry out any remaining final one-shot operation
+    TPtrC pType( KNullDesC );
+    switch( iOperation )
+        {
+    case EEntireDeviceHeapInfoCompact:
+        // Entire operation is performed here
+        pType.Set( KMemSpyUiCompactHeap );
+        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressStart, 0, pType );
+        iEngine.HelperHeap().OutputHeapInfoForDeviceL();
+        break;
+    case EEntireDeviceStackInfoCompact:
+        // Entire operation is performed here
+        pType.Set( KMemSpyUiCompactStack );
+        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressStart, 0, pType );
+        iEngine.HelperStack().OutputStackInfoForDeviceL();
+        break;
+    case EPerEntityHeapInfo:
+        // Complete op by outputting kernel heap summary
+        pType.Set( KMemSpyUiThreadNameKernel );
+        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressStart, 0, pType );
+        iEngine.HelperHeap().OutputHeapInfoKernelL();
+        break;
+    case EPerEntityHeapData:
+        // Complete op by outputting kernel heap data
+        // TODO: Uncomment after kernel heap dump is fixed
+//        pType.Set( KMemSpyUiThreadNameKernel );
+//        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressStart, 0, pType );
+//        iEngine.HelperHeap().OutputHeapDataKernelL();
+        break;
+    default:
+        break;
+        }
+
+    // Report progress
+    iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd, 1, pType );
+
+#ifdef _DEBUG
+    RDebug::Print( _L("CMemSpyDeviceWideOperations::PerformFinalOperationL() - END - pType: %S"), &pType );
+#endif
+    }
+
+
+void CMemSpyDeviceWideOperations::PerformNextStepL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyDeviceWideOperations::PerformNextStepL() - START - iProcessIndex: %d, iThreadIndex: %d", iProcessIndex, iThreadIndex );
+#endif
+
+    // Get the current process
+    CMemSpyEngineObjectContainer& container = iEngine.Container();
+    const TInt processCount = container.Count();
+    CMemSpyProcess& process = container.At( iProcessIndex );
+    const TInt threadCount = process.Count();
+    
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyDeviceWideOperations::PerformNextStepL() - threadCount: %d, processCount: %d", threadCount, processCount );
+#endif
+
+    // Get current thread
+    if  ( iThreadIndex < threadCount )
+        {
+        CMemSpyThread& thread = process.At( iThreadIndex++ );
+        const TPtrC pName( thread.Name() );
+    
+#ifdef _DEBUG
+        RDebug::Print( _L("CMemSpyDeviceWideOperations::PerformNextStepL() - thread: %S"), &pName );
+#endif
+
+        // Report progress
+        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressStart, 0, pName );
+
+        TInt progressAmount = 1;
+        TRAP_IGNORE(
+
+            switch(iOperation)
+                {
+            case EPerEntityGeneralSummary:
+            case EPerEntityGeneralDetailed:
+                if  ( iOperation == EPerEntityGeneralSummary )
+                    {
+                    iEngine.HelperProcess().OutputProcessInfoL( process );
+                    }
+                else
+                    {
+                    iEngine.HelperProcess().OutputProcessInfoDetailedL( process );
+                    }
+
+                // Process specific item, so do this only once per perocess
+                progressAmount = threadCount; 
+                iThreadIndex = threadCount;
+                break;
+            case EPerEntityGeneralHandles:
+                thread.InfoContainerForceSyncronousConstructionL().PrintL();
+                break;
+            case EPerEntityHeapInfo:
+                // Output user thread summary here, kernel thread summary will be
+                // handled when dialog dismissed
+                iEngine.HelperHeap().OutputHeapInfoUserL( thread );
+                break;
+            case EPerEntityHeapCellListing:
+                iEngine.HelperHeap().OutputCellListingUserL( thread );
+                break;
+            case EPerEntityHeapData:
+                iEngine.HelperHeap().OutputHeapDataUserL( thread );
+                break;
+            case EPerEntityStackInfo:
+                iEngine.HelperStack().OutputStackInfoL( thread );
+                break;
+            case EPerEntityStackDataUser:
+                iEngine.HelperStack().OutputStackDataL( thread, EMemSpyDriverDomainUser );
+                break;
+            case EPerEntityStackDataKernel:
+                iEngine.HelperStack().OutputStackDataL( thread, EMemSpyDriverDomainKernel );
+                break;
+            default:
+                break;
+                }
+            );
+
+        // Report progress
+        iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd, progressAmount, pName );
+        }
+    else
+        {
+        // This process is exhausted - move on to the next
+        ++iProcessIndex;
+        iThreadIndex = 0;
+ 
+#ifdef _DEBUG
+        RDebug::Printf( "CMemSpyDeviceWideOperations::PerformNextStepL() - move to next process..." );
+#endif
+        }
+
+    // Request RunL be called again...
+    CompleteSelf( KErrNone );
+
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyDeviceWideOperations::PerformNextStepL() - END" );
+#endif
+    }
+
+
+void CMemSpyDeviceWideOperations::SetFinished()
+    {
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::SetFinished() - START" );
+#endif
+
+    // Cancel sink time stamp
+    iEngine.Sink().DataStreamTimeStampEnd();
+
+    iObserver.HandleDeviceWideOperationEvent( MMemSpyDeviceWideOperationsObserver::EOperationCompleted, 0, KNullDesC );
+
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::SetFinished() - END" );
+#endif
+    }
+
+
+TInt CMemSpyDeviceWideOperations::TotalNumberOfThreads() const
+    {
+    TInt count = 0;
+    //
+    const CMemSpyEngineObjectContainer& container = iEngine.Container();
+    const TInt processCount = container.Count();
+    //
+    for(TInt i=0; i<processCount; i++)
+        {
+        const CMemSpyProcess& process = container.At( i );
+        count += process.Count();
+        }
+    //
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyDeviceWideOperations::TotalNumberOfThreads() - count: %d", count );
+#endif
+    return count;
+    }
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/EventHandlers/MemSpyEngineChunkWatcher.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* 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 "MemSpyEngineChunkWatcher.h"
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+
+
+CMemSpyEngineChunkWatcher::CMemSpyEngineChunkWatcher( RMemSpyDriverClient& aDriver, TInt aPriority )
+:	CActive( aPriority ), iDriver( aDriver )
+	{
+	CActiveScheduler::Add( this );
+	}
+
+
+CMemSpyEngineChunkWatcher::~CMemSpyEngineChunkWatcher()
+	{
+	Cancel();
+    //
+    if ( iEventMonitorHandle != KNullHandle )
+        {
+        iDriver.EventMonitorClose( iEventMonitorHandle );
+        }
+    //
+    iObservers.Close();
+	}
+
+
+void CMemSpyEngineChunkWatcher::ConstructL()
+	{
+    const TInt error = iDriver.EventMonitorOpen( iEventMonitorHandle );
+    User::LeaveIfError( error );
+    //
+	Request();
+	}
+
+
+CMemSpyEngineChunkWatcher* CMemSpyEngineChunkWatcher::NewL( RMemSpyDriverClient& aDriver, TInt aPriority )
+	{
+	CMemSpyEngineChunkWatcher* self = new(ELeave) CMemSpyEngineChunkWatcher( aDriver, aPriority );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+
+void CMemSpyEngineChunkWatcher::AddObserverL( MMemSpyEngineChunkWatcherObserver& aObserver )
+    {
+    RemoveObserver( aObserver );
+    iObservers.AppendL( &aObserver );
+    }
+
+
+void CMemSpyEngineChunkWatcher::RemoveObserver( MMemSpyEngineChunkWatcherObserver& aObserver )
+    {
+    const TInt count = iObservers.Count();
+    for( TInt i=count-1; i>=0; i-- )
+        {
+        MMemSpyEngineChunkWatcherObserver* obs = iObservers[ i ];
+        if ( obs == &aObserver )
+            {
+            iObservers.Remove( i );
+            }
+        }
+    }
+
+
+void CMemSpyEngineChunkWatcher::RunL()
+	{
+    const TUint notifiedId = iId;
+    const TInt typeAsInt = iStatus.Int();
+    User::LeaveIfError( typeAsInt );
+	Request();
+    //
+    const TMemSpyDriverEventType type = static_cast< TMemSpyDriverEventType >( typeAsInt );
+    switch( type )
+        {
+    case EMemSpyDriverEventTypeChunkAdd:
+        {
+        NotifyChunkAddL( notifiedId );
+        break;
+        }
+    case EMemSpyDriverEventTypeChunkDestroy:
+        {
+        NotifyChunkDestroyL( notifiedId );
+        break;
+        }
+    default:
+        break;
+        }
+	}
+
+
+void CMemSpyEngineChunkWatcher::DoCancel()
+	{
+	iDriver.EventMonitorNotifyCancel( iEventMonitorHandle );
+	}
+
+
+void CMemSpyEngineChunkWatcher::Request()
+	{
+    Cancel();
+    iDriver.EventMonitorNotify( iEventMonitorHandle, iStatus, iId );
+	SetActive();
+	}
+
+
+void CMemSpyEngineChunkWatcher::NotifyChunkAddL( TUint aChunkHandle )
+    {
+    const TInt count = iObservers.Count();
+    for( TInt i=count-1; i>=0; i-- )
+        {
+        MMemSpyEngineChunkWatcherObserver* obs = iObservers[ i ];
+        TRAP_IGNORE( obs->HandleChunkAddL( aChunkHandle ) );
+        }
+    }
+
+
+void CMemSpyEngineChunkWatcher::NotifyChunkDestroyL( TUint aChunkHandle )
+    {
+    const TInt count = iObservers.Count();
+    for( TInt i=count-1; i>=0; i-- )
+        {
+        MMemSpyEngineChunkWatcherObserver* obs = iObservers[ i ];
+        TRAP_IGNORE( obs->HandleChunkDestroyL( aChunkHandle ) );
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/EventHandlers/MemSpyEngineMidwife.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,163 @@
+/*
+* 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 <memspy/engine/memspyenginemidwife.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+
+
+CMemSpyEngineMidwife::CMemSpyEngineMidwife( RMemSpyDriverClient& aDriver, TInt aPriority )
+:	CActive( aPriority ), iDriver( aDriver )
+	{
+	CActiveScheduler::Add( this );
+	}
+
+
+CMemSpyEngineMidwife::~CMemSpyEngineMidwife()
+	{
+	Cancel();
+    //
+    if ( iEventMonitorHandle != KNullHandle )
+        {
+        iDriver.EventMonitorClose( iEventMonitorHandle );
+        }
+    //
+    iObservers.Close();
+	}
+
+
+void CMemSpyEngineMidwife::ConstructL()
+	{
+    const TInt error = iDriver.EventMonitorOpen( iEventMonitorHandle );
+    User::LeaveIfError( error );
+    //
+	Request();
+	}
+
+
+CMemSpyEngineMidwife* CMemSpyEngineMidwife::NewL( RMemSpyDriverClient& aDriver, TInt aPriority )
+	{
+	CMemSpyEngineMidwife* self = new(ELeave) CMemSpyEngineMidwife( aDriver, aPriority );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+
+void CMemSpyEngineMidwife::AddObserverL( MMemSpyEngineMidwifeObserver& aObserver )
+    {
+    RemoveObserver( aObserver );
+    iObservers.AppendL( &aObserver );
+    }
+
+
+void CMemSpyEngineMidwife::RemoveObserver( MMemSpyEngineMidwifeObserver& aObserver )
+    {
+    const TInt count = iObservers.Count();
+    for( TInt i=count-1; i>=0; i-- )
+        {
+        MMemSpyEngineMidwifeObserver* obs = iObservers[ i ];
+        if ( obs == &aObserver )
+            {
+            iObservers.Remove( i );
+            }
+        }
+    }
+
+
+void CMemSpyEngineMidwife::RunL()
+	{
+    const TUint notifiedId = iId;
+    const TInt typeAsInt = iStatus.Int();
+    User::LeaveIfError( typeAsInt );
+	Request();
+    //
+    const TMemSpyDriverEventType type = static_cast< TMemSpyDriverEventType >( typeAsInt );
+    switch( type )
+        {
+    case EMemSpyDriverEventTypeThreadCreate:
+        {
+        const TThreadId id( notifiedId );
+        NotifyThreadBornL( id );
+        break;
+        }
+    case EMemSpyDriverEventTypeProcessCreate:
+        {
+        const TProcessId id( notifiedId );
+        NotifyProcessBornL( id );
+        break;
+        }
+    default:
+        // Process removal not handled as not relevant
+        break;
+        }
+	}
+
+
+void CMemSpyEngineMidwife::DoCancel()
+	{
+	iDriver.EventMonitorNotifyCancel( iEventMonitorHandle );
+	}
+
+
+void CMemSpyEngineMidwife::Request()
+	{
+    Cancel();
+    iDriver.EventMonitorNotify( iEventMonitorHandle, iStatus, iId );
+	SetActive();
+	}
+
+
+void CMemSpyEngineMidwife::NotifyProcessBornL( const TProcessId& aId )
+    {
+    // NB: opening may fail - client's must tolerate this
+    RProcess process;
+    iDriver.OpenProcess( aId, process );
+    CleanupClosePushL( process );
+    //
+    const TInt count = iObservers.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        MMemSpyEngineMidwifeObserver* obs = iObservers[ i ];
+        TRAP_IGNORE( obs->ProcessIsBornL( aId, process ) );
+        }
+    //
+    CleanupStack::PopAndDestroy( &process );
+    }
+
+
+void CMemSpyEngineMidwife::NotifyThreadBornL( const TThreadId& aId )
+    {
+    // NB: opening may fail - client's must tolerate this
+    RThread thread;
+    iDriver.OpenThread( aId, thread );
+    CleanupClosePushL( thread );
+    //
+    const TInt count = iObservers.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        MMemSpyEngineMidwifeObserver* obs = iObservers[ i ];
+        TRAP_IGNORE( obs->ThreadIsBornL( aId, thread ) );
+        }
+    //
+    CleanupStack::PopAndDestroy( &thread );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/EventHandlers/MemSpyEngineUndertaker.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,163 @@
+/*
+* 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 <memspy/engine/memspyengineundertaker.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+
+
+CMemSpyEngineUndertaker::CMemSpyEngineUndertaker( RMemSpyDriverClient& aDriver, TInt aPriority )
+:	CActive( aPriority ), iDriver( aDriver )
+	{
+	CActiveScheduler::Add( this );
+	}
+
+
+CMemSpyEngineUndertaker::~CMemSpyEngineUndertaker()
+	{
+	Cancel();
+    //
+    if ( iEventMonitorHandle != KNullHandle )
+        {
+        iDriver.EventMonitorClose( iEventMonitorHandle );
+        }
+    //
+    iObservers.Close();
+	}
+
+
+void CMemSpyEngineUndertaker::ConstructL()
+	{
+    const TInt error = iDriver.EventMonitorOpen( iEventMonitorHandle );
+    User::LeaveIfError( error );
+    //
+	Request();
+	}
+
+
+CMemSpyEngineUndertaker* CMemSpyEngineUndertaker::NewL( RMemSpyDriverClient& aDriver, TInt aPriority )
+	{
+	CMemSpyEngineUndertaker* self = new(ELeave) CMemSpyEngineUndertaker( aDriver, aPriority );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+
+void CMemSpyEngineUndertaker::AddObserverL( MMemSpyEngineUndertakerObserver& aObserver )
+    {
+    RemoveObserver( aObserver );
+    iObservers.AppendL( &aObserver );
+    }
+
+
+void CMemSpyEngineUndertaker::RemoveObserver( MMemSpyEngineUndertakerObserver& aObserver )
+    {
+    const TInt count = iObservers.Count();
+    for( TInt i=count-1; i>=0; i-- )
+        {
+        MMemSpyEngineUndertakerObserver* obs = iObservers[ i ];
+        if ( obs == &aObserver )
+            {
+            iObservers.Remove( i );
+            }
+        }
+    }
+
+
+void CMemSpyEngineUndertaker::RunL()
+	{
+    const TUint notifiedId = iId;
+    const TInt typeAsInt = iStatus.Int();
+    User::LeaveIfError( typeAsInt );
+	Request();
+    //
+    const TMemSpyDriverEventType type = static_cast< TMemSpyDriverEventType >( typeAsInt );
+    switch( type )
+        {
+    case EMemSpyDriverEventTypeProcessRemove:
+        {
+        const TProcessId id( notifiedId );
+        NotifyProcessDeadL( id );
+        break;
+        }
+    case EMemSpyDriverEventTypeThreadKill:
+        {
+        const TThreadId id( notifiedId );
+        NotifyThreadDeadL( id );
+        break;
+        }
+    default:
+        // Process removal not handled as not relevant
+        break;
+        }
+	}
+
+
+void CMemSpyEngineUndertaker::DoCancel()
+	{
+	iDriver.EventMonitorNotifyCancel( iEventMonitorHandle );
+	}
+
+
+void CMemSpyEngineUndertaker::Request()
+	{
+    Cancel();
+    iDriver.EventMonitorNotify( iEventMonitorHandle, iStatus, iId );
+	SetActive();
+	}
+
+
+void CMemSpyEngineUndertaker::NotifyProcessDeadL( const TProcessId& aId )
+    {
+    // NB: opening may fail - client's must tolerate this
+    RProcess process;
+    iDriver.OpenProcess( aId, process );
+    CleanupClosePushL( process );
+    //
+    const TInt count = iObservers.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        MMemSpyEngineUndertakerObserver* obs = iObservers[ i ];
+        TRAP_IGNORE( obs->ProcessIsDeadL( aId, process ) );
+        }
+    //
+    CleanupStack::PopAndDestroy( &process );
+    }
+
+
+void CMemSpyEngineUndertaker::NotifyThreadDeadL( const TThreadId& aId )
+    {
+    // NB: opening may fail - client's must tolerate this
+    RThread thread;
+    iDriver.OpenThread( aId, thread );
+    CleanupClosePushL( thread );
+    //
+    const TInt count = iObservers.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        MMemSpyEngineUndertakerObserver* obs = iObservers[ i ];
+        TRAP_IGNORE( obs->ThreadIsDeadL( aId, thread ) );
+        }
+    //
+    CleanupStack::PopAndDestroy( &thread );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperActiveObject.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,737 @@
+/*
+* 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 <memspy/engine/memspyenginehelperactiveobject.h>
+
+// System includes
+#include <s32mem.h>
+#include <e32svr.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverconstants.h>
+
+// Literal constants
+_LIT( KMemSpyEngineAOOutputComma, ", " );
+
+
+
+CMemSpyEngineHelperActiveObject::CMemSpyEngineHelperActiveObject( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperActiveObject::~CMemSpyEngineHelperActiveObject()
+    {
+    }
+
+
+void CMemSpyEngineHelperActiveObject::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperActiveObject* CMemSpyEngineHelperActiveObject::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperActiveObject* self = new(ELeave) CMemSpyEngineHelperActiveObject( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C CMemSpyEngineActiveObjectArray* CMemSpyEngineHelperActiveObject::ActiveObjectListL( const CMemSpyThread& aThread )
+    {
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListL() - START");
+    CMemSpyEngineActiveObjectArray* array = CMemSpyEngineActiveObjectArray::NewLC();
+
+    // Is the thread's process already suspended? If not, we need to do it now.
+    const TProcessId parentProcessId( aThread.Process().Id() );
+    const TBool isSuspended = ( iEngine.SuspendedProcessId() == parentProcessId );
+    if  ( !isSuspended )
+        {
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListL() - suspending process");
+        iEngine.ProcessSuspendLC( parentProcessId );
+        }
+
+    // Push a cleanup item to close the heap walk in case of leaves
+    CleanupStack::PushL( TCleanupItem( CleanupHeapWalk, this ) );
+
+    // Get the thread info
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListL() - getting thread info...");
+    TMemSpyDriverThreadInfo threadInfo;
+    TInt err = iEngine.Driver().GetThreadInfo( aThread.Id(), threadInfo );
+    User::LeaveIfError( err );
+    TAny* scheduler = threadInfo.iScheduler;
+
+#if defined( _DEBUG ) && !defined( __WINS__ )
+    iEngine.HelperHeap().OutputCellListingUserL( aThread );
+#endif
+
+    // Get the heap info - we need this for verification purposes
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListL() - getting heap info...");
+    err = iEngine.Driver().GetHeapInfoUser( iHeapInfo, aThread.Id() );
+    User::LeaveIfError( err );
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListL() - allocated cell header length is: %d", iHeapInfo.iHeapCellHeaderLengthAllocated);
+
+    // Do we have a ROM-based scheduler pointer?
+    if  ( scheduler != NULL && iHeapInfo.Type() != TMemSpyHeapInfo::ETypeUnknown )
+        {
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListL() - scheduler: 0x%08x", scheduler);
+
+        // Let's try to get the scheduler's heap cell...
+        HBufC8* data = SchedulerHeapCellDataLC( scheduler, aThread.Id() );
+        
+        // Try to extract the active object addresses
+        ExtractActiveObjectAddressesL( scheduler, *data, *array );
+        CleanupStack::PopAndDestroy( data );
+        }
+
+    // Tidy up
+    CleanupStack::PopAndDestroy(this); // heap walk cleanup item
+    if  ( !isSuspended )
+        {
+        CleanupStack::PopAndDestroy(); // will resume the process we suspended earlier
+        }
+    //
+    CleanupStack::Pop( array );
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListL() - END");
+    return array;
+    }
+
+
+HBufC8* CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC( TAny*& aCellAddress, TThreadId aThreadId )
+    {
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - START - aCellAddress: 0x%08x, aThread: %d", aCellAddress, I64INT(aThreadId.Id()));
+
+    // This is what we'll return, if we find it...
+    HBufC8* heapCellData = NULL;
+
+    // Now walk the heap!
+    TInt err = iEngine.Driver().WalkHeapInit( aThreadId );
+    User::LeaveIfError( err );
+
+    // Now we can try to find the cell's info
+    TMemSpyDriverCellType cellType;
+    TInt cellLength;
+    TInt cellNestingLevel;
+    TInt cellAllocationNumber;
+    TInt cellHeaderSize;
+    TAny* cellPayloadAddress;
+    //
+    err = iEngine.Driver().WalkHeapGetCellInfo( aCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType);
+    User::LeaveIfError( err );
+    
+	if (cellType & EMemSpyDriverAllocatedCellMask)
+        {
+        const TInt payloadLength = cellLength;
+        HBufC8* data = HBufC8::NewLC( payloadLength );
+        TPtr8 pData( data->Des() );
+        //
+        err = iEngine.Driver().WalkHeapReadCellData( aCellAddress, pData, payloadLength );
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - data fetch returned error: %d", err);
+        User::LeaveIfError( err );
+        heapCellData = data;
+        CleanupStack::Pop( data );
+        }
+    //
+    if  ( heapCellData == NULL )
+        {
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - END - didn't find the right cell => KErrNotFound");
+        User::Leave( KErrNotFound );
+        }
+    //
+    CleanupStack::PushL( heapCellData );
+
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - END - everything okay, cell is: 0x%08x", aCellAddress);
+    return heapCellData;
+    }
+
+
+void CMemSpyEngineHelperActiveObject::ExtractActiveObjectAddressesL( TAny* aSchedulerCellAddress, const TDesC8& aSchedulerCellData, CMemSpyEngineActiveObjectArray& aArray )
+    {
+    // Create read stream
+    RDesReadStream stream( aSchedulerCellData );
+    CleanupClosePushL( stream );
+
+    // First item is vtable
+    TUint address = stream.ReadUint32L();
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ExtractActiveObjectAddressesL() - vtable: 0x%08x", address );
+    (void) address;
+
+    // Next item is CActiveScheduler::iStack - which we'll skip, because it might be a stack address
+    // I suppose we could validate this against the thread's stack address range, but can't be bothered
+    // at the moment.
+    address = stream.ReadUint32L();
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ExtractActiveObjectAddressesL() - got CActiveScheduler::iStack as: 0x%08x", address);
+    (void) address;
+
+    // Then comes CActiveScheduler::iActiveQ - this is what we are interested in.... 
+    //
+    //  class TPriQue : public TDblQueBase
+    //        [TDblQueBase::iHead] - this just derives from TDblQueLinkBase and doesn't have any direct data members
+    //            class TDblQueLink : public TDblQueLinkBase
+    //                [ptr]  TDblQueLinkBase::iNext*
+    //                [ptr]  TDblQueLinkBase::iPrev*
+    // [TInt] TDblQueBase::iOffset
+    __ASSERT_COMPILE( sizeof( TDblQueLinkBase* ) == sizeof(TUint) );
+    __ASSERT_COMPILE( sizeof( TInt ) == 4 );
+
+    // Get read offset so that we know the starting address of the queue
+    const TStreamPos pos = stream.Source()->TellL(MStreamBuf::ERead);
+#ifdef __WINS__
+    const TAny* terminatingQueueAddress = (TAny*) (TUint(aSchedulerCellAddress) + pos.Offset());
+#else
+    const TAny* terminatingQueueAddress = (TAny*) aSchedulerCellAddress;
+#endif
+
+    const TAny* queueNext = (TAny*) stream.ReadUint32L();
+    const TAny* queuePrev = (TAny*) stream.ReadUint32L();
+    const TUint queueItemOffset = stream.ReadUint32L();
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ExtractActiveObjectAddressesL() - queueNext: 0x%08x, queuePrev: 0x%08x, queueItemOffset: %d, pos: %d, terminatingQueueAddress: 0x%08x", queueNext, queuePrev, queueItemOffset, pos.Offset(), terminatingQueueAddress);
+    (void) queuePrev;
+    CleanupStack::PopAndDestroy( &stream );
+        
+    // Iterate through the active objects
+    if  ( queueNext != NULL )
+        {
+        TAny* realNextCellHeapCell = NULL;
+        TAny* calculatedCellAddress = ((TAny*) (TUint(queueNext) - queueItemOffset));
+
+        while( !( calculatedCellAddress == NULL || calculatedCellAddress == terminatingQueueAddress || realNextCellHeapCell == terminatingQueueAddress ) )
+            {
+            // Create an active object for this cell
+            TAny* nextCell = ReadActiveObjectDataL( calculatedCellAddress, aArray );
+            
+            // Work out next cell address
+            calculatedCellAddress = ((TAny*) ( TUint( nextCell ) - queueItemOffset ) );
+            //RDebug::Printf("CMemSpyEngineHelperActiveObject::ExtractActiveObjectAddressesL() - calculatedCellAddress: 0x%08x, terminatingQueueAddress: 0x%08x", calculatedCellAddress, terminatingQueueAddress);
+
+            // Identify the next cell address
+            realNextCellHeapCell = ConvertAddressToRealHeapCellAddressL( nextCell );
+            }
+        }
+    }
+
+
+TAny* CMemSpyEngineHelperActiveObject::ConvertAddressToRealHeapCellAddressL( TAny* aAddress )
+    {
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ConvertAddressToRealHeapCellAddressL() - START - aAddress: 0x%08x", aAddress);
+
+    TMemSpyDriverCellType cellType;
+    TInt cellLength;
+    TInt cellNestingLevel;
+    TInt cellAllocationNumber;
+    TInt cellHeaderSize;
+    TAny* cellPayloadAddress;
+
+    TInt err = iEngine.Driver().WalkHeapGetCellInfo( aAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ConvertAddressToRealHeapCellAddressL() - END - err: %d, realCellAddress: 0x%08x, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, aAddress, cellLength, cellAllocationNumber, cellType);
+    User::LeaveIfError( err );
+
+    return aAddress;
+    }
+
+
+TAny* CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL( TAny* aCellAddress, CMemSpyEngineActiveObjectArray& aArray )
+    {
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - START");
+
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellAddress:     0x%08x", aCellAddress);
+    TAny* nextCellAddress = NULL;
+    
+    TMemSpyDriverCellType cellType;
+    TInt cellLength;
+    TInt cellNestingLevel;
+    TInt cellAllocationNumber;
+    TInt cellHeaderSize;
+    TAny* cellPayloadAddress;
+
+    // Make a separate copy of the cell address - calling GetCellInfo may well result in the address being
+    // changed in order to match the real starting address of a *heap cell*.
+    TAny* requestedCellAddress = aCellAddress;
+    TInt err = iEngine.Driver().WalkHeapGetCellInfo( requestedCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
+    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType);
+    User::LeaveIfError( err );
+    
+    if (cellType & EMemSpyDriverAllocatedCellMask)
+        {
+        const TInt payloadLength = cellLength;
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - payloadLength: %d", payloadLength);
+
+        // const TInt payloadLength = Max( 512, cellLength - iHeapInfo.iHeapCellHeaderLengthAllocated ); // Prevent negative payload lengths?
+        CBufFlat* data = CBufFlat::NewL( payloadLength );
+        CleanupStack::PushL( data );
+        data->ResizeL( payloadLength );
+        TPtr8 pData( data->Ptr( 0 ) );
+        //
+        err = iEngine.Driver().WalkHeapReadCellData( requestedCellAddress, pData, payloadLength );
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.heapCellAddress: 0x%08x (err: %d)", requestedCellAddress, err);
+        User::LeaveIfError( err );
+
+        // If an object is embedded directly within a class, for example
+        //
+        // class CSomething : public CBase
+        //   {
+        //   CIdle iEmbeddedIdler;
+        //   }
+        //
+        // then aCellAddress actually points to somewhere *within* a heap cell, not to the actual starting address of
+        // the heap cell itself. We must take this into account when parsing the heap cell data (i.e. the bit of the cell we
+        // are interested in starts part way through the cell data).
+        TInt cellOffset = TUint32( aCellAddress ) - TUint32( requestedCellAddress );
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellOffset:      %d (ignoring cell header)", cellOffset);
+        cellOffset -= cellHeaderSize;
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellOffset:      %d (adjusted for cell header)", cellOffset);
+
+        // Got the cell data for the active object. Let's parse it.
+        RBufReadStream stream( *data, cellOffset );
+        CleanupClosePushL( stream );
+
+        // First item should be vTable
+        TAny* vTable = (TAny*) stream.ReadUint32L();
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.vTable:          0x%08x", vTable );
+
+        // Next item should be the request status. First the iStatus, then the iFlags
+        const TInt requestStatusValue = stream.ReadInt32L();
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.rsVal:           %10d", requestStatusValue );
+        const TUint requestStatusFlags = stream.ReadUint32L();
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.rsFlags:         0x%02x", requestStatusFlags );
+
+        // Next comes the baseclass for the link - TDblQueLinkBase
+        TAny* nextEntryAddress = (TAny*) stream.ReadUint32L();
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Next:      0x%08x", nextEntryAddress );
+        TAny* prevEntryAddress = (TAny*) stream.ReadUint32L();
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Prev:      0x%08x", prevEntryAddress );
+
+        // Next comes the TPriQueueLink itself
+        const TInt priority = stream.ReadInt32L();
+        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Pri:       %d", priority );
+        
+        // Done - save object & tidy up
+        CMemSpyEngineActiveObject* object = CMemSpyEngineActiveObject::NewLC( aCellAddress, vTable, priority, requestStatusValue, requestStatusFlags, nextEntryAddress, prevEntryAddress, iEngine );
+        aArray.AddItemL( object );
+        CleanupStack::Pop( object );
+        CleanupStack::PopAndDestroy( 2, data ); // stream & data
+        
+        nextCellAddress = (TAny*) nextEntryAddress;
+        //RDebug::Printf(" ");
+        }
+
+    return nextCellAddress;
+    }
+
+
+void CMemSpyEngineHelperActiveObject::CleanupHeapWalk( TAny* aSelf )
+    {
+    CMemSpyEngineHelperActiveObject* self = reinterpret_cast< CMemSpyEngineHelperActiveObject* >( aSelf );
+    self->iEngine.Driver().WalkHeapClose();
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineActiveObjectArray::CMemSpyEngineActiveObjectArray()
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineActiveObjectArray::~CMemSpyEngineActiveObjectArray()
+    {
+    delete iHeader;
+    iObjects.ResetAndDestroy();
+    iObjects.Close();
+    }
+
+
+void CMemSpyEngineActiveObjectArray::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineActiveObjectArray* CMemSpyEngineActiveObjectArray::NewLC(  )
+    {
+    CMemSpyEngineActiveObjectArray* self = new(ELeave) CMemSpyEngineActiveObjectArray();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineActiveObjectArray::Count() const
+    {
+    return iObjects.Count();
+    }
+
+
+EXPORT_C CMemSpyEngineActiveObject& CMemSpyEngineActiveObjectArray::At( TInt aIndex )
+    {
+    return *iObjects[ aIndex ];
+    }
+
+
+EXPORT_C const CMemSpyEngineActiveObject& CMemSpyEngineActiveObjectArray::At( TInt aIndex ) const
+    {
+    return *iObjects[ aIndex ];
+    }
+
+
+EXPORT_C CMemSpyEngineActiveObject& CMemSpyEngineActiveObjectArray::ObjectByAddressL( TAny* aAddress )
+    {
+    const TInt index = ObjectIndexByAddress( aAddress );
+    User::LeaveIfError( index );
+    CMemSpyEngineActiveObject& ret = At( index );
+    return ret;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineActiveObjectArray::ObjectIndexByAddress( TAny* aAddress ) const
+    {
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineActiveObject& object = At( i );
+        //
+        if  ( object.Address() == aAddress )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C void CMemSpyEngineActiveObjectArray::OutputDataColumnsL( CMemSpyEngine& aEngine )
+    {
+    HBufC* columns = HBufC::NewLC( 1024 );
+    TPtr pColumns( columns->Des() );
+    //
+    _LIT(KCol1, "Address");
+    pColumns.Append( KCol1 );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    _LIT(KCol3, "Priority");
+    pColumns.Append( KCol3 );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    _LIT(KCol4, "Is Active");
+    pColumns.Append( KCol4 );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    _LIT(KCol5, "Request Pending");
+    pColumns.Append( KCol5 );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    _LIT(KCol6, "Status Value");
+    pColumns.Append( KCol6 );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    _LIT(KCol7, "Status Flags");
+    pColumns.Append( KCol7 );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    _LIT(KCol8, "vTable Address");
+    pColumns.Append( KCol8 );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    _LIT(KCol9, "vTable for Symbolic Lookup");
+    pColumns.Append( KCol9 );
+    //
+    aEngine.Sink().OutputLineL( pColumns );
+    CleanupStack::PopAndDestroy( columns );
+    }
+
+
+EXPORT_C TInt CMemSpyEngineActiveObjectArray::MdcaCount() const
+    {
+    TInt count = Count();
+    //
+    if  ( count > 0 )
+        {
+        ++count;
+        }
+    //
+    return count;
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineActiveObjectArray::MdcaPoint( TInt aIndex ) const
+    {
+    TPtrC ret( *iHeader );
+    //
+    if  ( aIndex > 0 )
+        {
+        const CMemSpyEngineActiveObject& object = At( aIndex - 1 );
+        ret.Set( object.Caption() );
+        }
+    //
+    return ret;
+    }
+
+
+void CMemSpyEngineActiveObjectArray::AddItemL( CMemSpyEngineActiveObject* aItem )
+    {
+    iObjects.AppendL( aItem );
+    BuildHeaderCaptionL();
+    }
+
+
+void CMemSpyEngineActiveObjectArray::InsertL( CMemSpyEngineActiveObject* aItem, TInt aIndex )
+    {
+    iObjects.InsertL( aItem, aIndex );
+    BuildHeaderCaptionL();
+    }
+
+
+void CMemSpyEngineActiveObjectArray::BuildHeaderCaptionL()
+    {
+    const TInt KHeaderLength = 100;
+    //
+    if  ( !iHeader )
+        {
+        iHeader = HBufC::NewL( KHeaderLength );
+        }
+    //
+    TPtr pHeader( iHeader->Des() );
+    //
+    _LIT(KCaption, "\tNumber of AO\'s\t\t%d");
+    pHeader.Format( KCaption, Count() );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineActiveObject::CMemSpyEngineActiveObject( TAny* aAddress, TAny* aVTable, TInt aPriority, TInt aRSValue, TUint aRSFlags, TAny* aNextAOAddress, TAny* aPrevAOAddress )
+:   CDesCArrayFlat(6), iAddress( aAddress ), iVTable( aVTable ), iPriority( aPriority ), iRequestStatusValue( aRSValue ), iRequestStatusFlags( aRSFlags ), iNextAOAddress( aNextAOAddress ), iPrevAOAddress( aPrevAOAddress )
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineActiveObject::~CMemSpyEngineActiveObject()
+    {
+    delete iCaption;
+    }
+
+
+void CMemSpyEngineActiveObject::ConstructL( CMemSpyEngine& /*aEngine*/ )
+    {
+    TBuf<256> item;
+
+    _LIT(KBasicFormat, "\t0x%08x\t\t");
+    item.Format( KBasicFormat, VTable() );
+
+    // Add modifiers
+    _LIT( KModifiers, "%d" );
+    _LIT( KBoxedCharFormat, " [%c]" );
+    item.AppendFormat( KModifiers, RequestStatusValue() );
+    if  ( IsActive() )
+        {
+        item.AppendFormat( KBoxedCharFormat, 'A' );
+        }
+    if  ( RequestIsPending() )
+        {
+        item.AppendFormat( KBoxedCharFormat, 'P' );
+        }
+    iCaption = item.AllocL();
+
+    // Listbox items
+    TPtrC value;
+
+    // Address
+    _LIT(KCaption1, "\tAddress\t\t0x%08x");
+    item.Format( KCaption1, iAddress );
+    AppendL( item );
+
+    // vTable
+    _LIT(KCaption2, "\tVTable\t\t0x%08x");
+    item.Format( KCaption2, iVTable );
+    AppendL( item );
+
+    //
+    _LIT(KCaption3, "\tStatus Value\t\t%d");
+    item.Format( KCaption3, iRequestStatusValue );
+    AppendL( item );
+
+    //
+    _LIT(KCaption5, "\tIs Active\t\t%S");
+    value.Set( YesNoValue( IsActive() ) );
+    item.Format( KCaption5, &value );
+    AppendL( item );
+
+    //
+    _LIT(KCaption6, "\tRequest Pending\t\t%S");
+    value.Set( YesNoValue( RequestIsPending() ) );
+    item.Format( KCaption6, &value );
+    AppendL( item );
+
+    //
+    _LIT(KCaption4, "\tPriority\t\t%d");
+    item.Format( KCaption4, iPriority );
+    AppendL( item );
+    }
+
+
+CMemSpyEngineActiveObject* CMemSpyEngineActiveObject::NewLC( TAny* aAddress, TAny* aVTable, TInt aPriority, TInt aRSValue, TUint aRSFlags, TAny* aNextAOAddress, TAny* aPrevAOAddress, CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineActiveObject* self = new(ELeave) CMemSpyEngineActiveObject( aAddress, aVTable, aPriority, aRSValue, aRSFlags, aNextAOAddress, aPrevAOAddress );
+    CleanupStack::PushL( self );
+    self->ConstructL( aEngine );
+    return self;
+    }
+
+
+EXPORT_C TBool CMemSpyEngineActiveObject::IsActive() const
+    {
+    return ( iRequestStatusFlags & CMemSpyEngineActiveObject::EActive );
+    }
+
+
+EXPORT_C TBool CMemSpyEngineActiveObject::IsAddedToScheduler() const
+    {
+    return ( iNextAOAddress != NULL );
+    }
+
+
+EXPORT_C TBool CMemSpyEngineActiveObject::RequestIsPending() const
+    {
+    return ( iRequestStatusFlags & CMemSpyEngineActiveObject::ERequestPending );
+    }
+
+
+EXPORT_C void CMemSpyEngineActiveObject::OutputDataL( CMemSpyEngine& aEngine ) const
+    {
+    _LIT(KMemSpyEngineAOOutputHex, "0x%08x");
+    _LIT(KMemSpyEngineAOOutputDecimal, "%d");
+    _LIT(KMemSpyEngineAOOutputDecimalFixed10, "%10d");
+    _LIT(KMemSpyEngineAOOutputString, "%S");
+    _LIT(KMemSpyEngineAOOutputVTable, "vTable: 0x%08x");
+    //
+    TPtrC yesNoValue( KNullDesC );
+    HBufC* columns = HBufC::NewLC( 1024 );
+    TPtr pColumns( columns->Des() );
+    //
+    pColumns.AppendFormat( KMemSpyEngineAOOutputHex, Address() );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    pColumns.AppendFormat( KMemSpyEngineAOOutputDecimal, Priority() );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    yesNoValue.Set( YesNoValue( IsActive() ) );
+    pColumns.AppendFormat( KMemSpyEngineAOOutputString, &yesNoValue );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    yesNoValue.Set( YesNoValue( RequestIsPending() ) );
+    pColumns.AppendFormat( KMemSpyEngineAOOutputString, &yesNoValue );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    pColumns.AppendFormat( KMemSpyEngineAOOutputDecimalFixed10, RequestStatusValue() );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    pColumns.AppendFormat( KMemSpyEngineAOOutputDecimal, RequestStatusFlags() );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    pColumns.AppendFormat( KMemSpyEngineAOOutputHex, VTable() );
+    pColumns.Append( KMemSpyEngineAOOutputComma );
+    //
+    pColumns.AppendFormat( KMemSpyEngineAOOutputVTable, VTable() );
+    //
+    aEngine.Sink().OutputLineL( pColumns );
+    CleanupStack::PopAndDestroy( columns );
+    }
+
+
+TPtrC CMemSpyEngineActiveObject::YesNoValue( TBool aValue )
+    {
+    _LIT(KYesString, "Yes");
+    _LIT(KNoString, "No");
+    //
+    TPtrC pRet( KNoString );
+    if  ( aValue )
+        {
+        pRet.Set( KYesString );
+        }
+    //
+    return pRet;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperChunk.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,812 @@
+/*
+* 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 <memspy/engine/memspyenginehelperchunk.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+
+// Constants
+const TInt KMemSpyEngineMaxChunkCount = 768;
+
+// Literal constants
+_LIT( KMemSpyEngineChunkListOutputComma, ", " );
+
+
+
+CMemSpyEngineHelperChunk::CMemSpyEngineHelperChunk( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperChunk::~CMemSpyEngineHelperChunk()
+    {
+    }
+
+
+void CMemSpyEngineHelperChunk::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperChunk* CMemSpyEngineHelperChunk::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperChunk* self = new(ELeave) CMemSpyEngineHelperChunk( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL( const CMemSpyThread& aThread )
+    {
+    OutputChunkInfoForThreadL( aThread.Id() );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL( TThreadId aTid )
+    {
+    TBuf<512> lineBuffer;
+    OutputChunkInfoForThreadL( aTid, lineBuffer );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForThreadL( TThreadId aTid, TDes& aLineBuffer )
+    {
+    DoOutputChunkInfoForObjectL( aTid, aLineBuffer, EThread );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL( const CMemSpyProcess& aProcess )
+    {
+    OutputChunkInfoForProcessL( aProcess.Id() );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL( TProcessId aPid )
+    {
+    TBuf<512> lineBuffer;
+    OutputChunkInfoForProcessL( aPid, lineBuffer );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperChunk::OutputChunkInfoForProcessL( TProcessId aPid, TDes& aLineBuffer )
+    {
+    DoOutputChunkInfoForObjectL( aPid, aLineBuffer, EProcess );
+    }
+
+
+EXPORT_C CMemSpyEngineChunkList* CMemSpyEngineHelperChunk::ListL()
+    {
+    RArray<TAny*> handles( 128 );
+    CleanupClosePushL( handles );
+    //
+    GetChunkHandlesL( handles, EAll );
+    CMemSpyEngineChunkList* list = CreateListFromHandlesL( handles );
+    //
+    CleanupStack::PopAndDestroy( &handles );
+    return list;
+    }
+
+
+EXPORT_C CMemSpyEngineChunkList* CMemSpyEngineHelperChunk::ListForThreadL( TThreadId aTid )
+    {
+    RArray<TAny*> handles( 128 );
+    CleanupClosePushL( handles );
+    //
+    GetChunkHandlesL( handles, EThread, aTid );
+    CMemSpyEngineChunkList* list = CreateListFromHandlesL( handles );
+    //
+    CleanupStack::PopAndDestroy( &handles );
+    return list;
+    }
+
+
+EXPORT_C CMemSpyEngineChunkList* CMemSpyEngineHelperChunk::ListForProcessL( TProcessId aPid )
+    {
+    RArray<TAny*> handles( 128 );
+    CleanupClosePushL( handles );
+    //
+    GetChunkHandlesL( handles, EProcess, aPid );
+    CMemSpyEngineChunkList* list = CreateListFromHandlesL( handles );
+    //
+    CleanupStack::PopAndDestroy( &handles );
+    return list;
+    }
+
+
+void CMemSpyEngineHelperChunk::DoOutputChunkInfoForObjectL( TUint aId, TDes& aLineBuffer, TType aType )
+    {
+    TFullName ownerName;
+	//
+    RArray<TAny*> handles( 128 );
+    CleanupClosePushL( handles );
+    //
+    GetChunkHandlesL( handles, aType, aId );
+    CMemSpyEngineChunkList* list = CreateListFromHandlesL( handles );
+    //
+    CleanupStack::PopAndDestroy( &handles );
+    CleanupStack::PushL( list );
+    //
+    const TInt count = list->Count();
+    for (TInt i=0; i<count; i++)
+    	{
+        const CMemSpyEngineChunkEntry& entry = list->At( i );
+        //
+        _LIT(KLine1, "Name");
+        iEngine.Sink().OutputItemAndValueL( KLine1, entry.Name() );
+        //
+        _LIT(KLine2, "Owner");
+        entry.OwnerName( ownerName );
+        iEngine.Sink().OutputItemAndValueL( KLine2, ownerName );
+        //
+        _LIT(KLine3, "Address");
+        _LIT(KLine3Format, "0x%08x - 0x%08x");
+        aLineBuffer.Format(KLine3Format, entry.BaseAddress(), entry.UpperAddress() );
+        iEngine.Sink().OutputItemAndValueL( KLine3, aLineBuffer );
+        //
+        _LIT(KLine4, "Size (max)");
+        _LIT(KLine4Format, "%d (%d)");
+        aLineBuffer.Format(KLine4Format, entry.Size(), entry.MaxSize());
+        iEngine.Sink().OutputItemAndValueL( KLine4, aLineBuffer );
+        //
+        if  ( i < count - 1 )
+            {
+            iEngine.Sink().OutputBlankLineL();
+    		}
+        }
+    //
+    CleanupStack::PopAndDestroy( list );
+    }
+
+
+void CMemSpyEngineHelperChunk::GetChunkHandlesL( RArray<TAny*>& aHandles, TType aType, TUint aId )
+    {
+	TAny* handles[ KMemSpyEngineMaxChunkCount ];
+	TInt count = KMemSpyEngineMaxChunkCount;
+
+    TInt r = 0;
+    //
+    switch( aType )
+        {
+    case EThread:
+        r = iEngine.Driver().GetChunkHandlesForThread( aId, handles, count );
+        break;
+    case EProcess:
+        r = iEngine.Driver().GetChunkHandlesForProcess( aId, handles, count );
+        break;
+    default:
+    case EAll:
+        r = iEngine.Driver().GetChunkHandles( handles, count );
+        break;
+        }
+    //
+    if  ( r == KErrNone )
+    	{
+        count = Min( count, KMemSpyEngineMaxChunkCount );
+        for( TInt index = 0; index < count; index++ )
+            {
+            TAny* handle = handles[ index ];
+
+            if  ( aHandles.Find( handle ) == KErrNotFound )
+                {
+                aHandles.AppendL( handle );
+                }
+            }
+        }
+    }
+
+
+CMemSpyEngineChunkList* CMemSpyEngineHelperChunk::CreateListFromHandlesL( const RArray<TAny*>& aHandles )
+    {
+    CMemSpyEngineChunkList* list = CMemSpyEngineChunkList::NewLC( iEngine );
+    //
+    TMemSpyDriverChunkInfo info;
+    const TInt count = aHandles.Count();
+    //
+    for( TInt i=0; i<count; i++ )
+        {
+        TAny* handle = aHandles[ i ];
+        //
+    	const TInt error = iEngine.Driver().GetChunkInfo( handle, info );
+        if  ( error == KErrNone )
+            {
+            CMemSpyEngineChunkEntry* entry = CMemSpyEngineChunkEntry::NewLC( iEngine, info );
+            list->AddItemL( entry );
+            CleanupStack::Pop( entry );
+            }
+        }
+    //
+    list->SortBySizeL();
+    //
+    CleanupStack::Pop( list );
+    return list;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineChunkList::CMemSpyEngineChunkList( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineChunkList::~CMemSpyEngineChunkList()
+    {
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    }
+
+
+void CMemSpyEngineChunkList::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineChunkList* CMemSpyEngineChunkList::NewLC( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineChunkList* self = new(ELeave) CMemSpyEngineChunkList( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineChunkList::Count() const
+    {
+    return iItems.Count();
+    }
+
+
+EXPORT_C CMemSpyEngineChunkEntry& CMemSpyEngineChunkList::At( TInt aIndex )
+    {
+    return *iItems[ aIndex ];
+    }
+
+
+EXPORT_C const CMemSpyEngineChunkEntry& CMemSpyEngineChunkList::At( TInt aIndex ) const
+    {
+    return *iItems[ aIndex ];
+    }
+
+
+EXPORT_C void CMemSpyEngineChunkList::SortByNameL()
+    {
+    TLinearOrder< CMemSpyEngineChunkEntry > comparer( CompareByName );
+    iItems.Sort( comparer );
+    }
+
+
+EXPORT_C void CMemSpyEngineChunkList::SortBySizeL()
+    {
+    TLinearOrder< CMemSpyEngineChunkEntry > comparer( CompareBySize );
+    iItems.Sort( comparer );
+    }
+
+
+EXPORT_C TInt CMemSpyEngineChunkList::ItemIndex( const CMemSpyEngineChunkEntry& aEntry ) const
+    {
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineChunkEntry* item = iItems[ i ];
+        //
+        if  ( item == &aEntry )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C void CMemSpyEngineChunkList::OutputDataColumnsL( CMemSpyEngine& aEngine )
+    {
+    HBufC* columns = HBufC::NewLC( 1024 );
+    TPtr pColumns( columns->Des() );
+
+    //
+    _LIT(KCol1, "Name");
+    pColumns.Append( KCol1 );
+    pColumns.Append( KMemSpyEngineChunkListOutputComma );
+
+    //
+    _LIT(KCol2, "Owning Process");
+    pColumns.Append( KCol2 );
+    pColumns.Append( KMemSpyEngineChunkListOutputComma );
+
+    //
+    _LIT(KCol3, "Size");
+    pColumns.Append( KCol3 );
+    pColumns.Append( KMemSpyEngineChunkListOutputComma );
+
+    //
+    _LIT(KCol4, "Max. Size");
+    pColumns.Append( KCol4 );
+    pColumns.Append( KMemSpyEngineChunkListOutputComma );
+
+    //
+    _LIT(KCol5, "Address");
+    pColumns.Append( KCol5 );
+
+    //
+    aEngine.Sink().OutputLineL( pColumns );
+    CleanupStack::PopAndDestroy( columns );
+    }
+
+
+EXPORT_C TBool CMemSpyEngineChunkList::EntryExists( TAny* aHandle ) const
+    {
+    TBool ret = EFalse;
+    //
+    const TInt count = Count();
+    for( TInt i=0; i<count && !ret; i++ )
+        {
+        const CMemSpyEngineChunkEntry* item = iItems[ i ];
+        ret = ( item->Handle() == aHandle );
+        }
+    //
+    return ret;
+    }
+
+
+void CMemSpyEngineChunkList::AddItemL( CMemSpyEngineChunkEntry* aItem )
+    {
+    iItems.AppendL( aItem );
+    }
+
+
+void CMemSpyEngineChunkList::Remove( TInt aIndex )
+    {
+    CMemSpyEngineChunkEntry* item = iItems[ aIndex ];
+    delete item;
+    iItems.Remove( aIndex );
+    }
+
+
+void CMemSpyEngineChunkList::RemoveByHandle( TAny* aChunkHandle )
+    {
+    const TInt index = ItemIndexByChunkHandle( aChunkHandle );
+    if  ( index >= 0 )
+        {
+        Remove( index );
+        }
+    }
+
+
+TInt CMemSpyEngineChunkList::ItemIndexByProcessId( TUint aPid ) const
+    {
+    const TInt ret = ItemIndexByProcessId( aPid, 0 );
+    return ret;
+    }
+
+
+TInt CMemSpyEngineChunkList::ItemIndexByProcessId( TUint aPid, TInt aStartIndex ) const
+    {
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = Count();
+    for( TInt i=aStartIndex; i<count; i++ )
+        {
+        const CMemSpyEngineChunkEntry* item = iItems[ i ];
+        //
+        if  ( item->OwnerId() == aPid )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineChunkList::ItemIndexByProcessId( TUint aPid, TMemSpyDriverChunkType aType ) const
+    {
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineChunkEntry* item = iItems[ i ];
+        //
+        if  ( item->OwnerId() == aPid && item->Info().iType == aType )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineChunkList::ItemIndexByChunkHandle( TAny* aHandle ) const
+    {
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineChunkEntry* item = iItems[ i ];
+        //
+        if  ( item->Handle() == aHandle )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineChunkList::MdcaCount() const
+    {
+    return Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineChunkList::MdcaPoint( TInt aIndex ) const
+    {
+    const CMemSpyEngineChunkEntry& item = At( aIndex );
+    return TPtrC( item.Caption() );
+    }
+
+
+TInt CMemSpyEngineChunkList::CompareByName( const CMemSpyEngineChunkEntry& aLeft, const CMemSpyEngineChunkEntry& aRight )
+    {
+    const TInt ret = aLeft.Name().CompareF( aRight.Name() );
+    return ret;
+    }
+
+
+TInt CMemSpyEngineChunkList::CompareBySize( const CMemSpyEngineChunkEntry& aLeft, const CMemSpyEngineChunkEntry& aRight )
+    {
+    TInt ret = -1;
+    //
+    if  ( aLeft.Size() < aRight.Size() )
+        {
+        ret = 1;
+        }
+    else if ( aLeft.Size() == aRight.Size() )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineChunkEntry::CMemSpyEngineChunkEntry( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+
+CMemSpyEngineChunkEntry::~CMemSpyEngineChunkEntry()
+    {
+    delete iCaption;
+    delete iInfo;
+    delete iList;
+    }
+
+
+void CMemSpyEngineChunkEntry::ConstructL( const TMemSpyDriverChunkInfo& aInfo )
+    {
+    // Copy info
+    iInfo = new(ELeave) TMemSpyDriverChunkInfo();
+    *iInfo = aInfo;
+
+    // Make caption
+    TBuf<KMaxFullName+128> item;
+    _LIT(KCaptionFormat, "\t%S\t\t%d");
+    item.Format( KCaptionFormat, &Name(), Size() );
+    iCaption = item.AllocL();
+
+    // Make other items
+    iList = CMemSpyEngineOutputList::NewL();
+
+    _LIT( KEntry0, "Name");
+    iList->AddItemL( KEntry0, Name() );
+
+    _LIT( KEntryType, "Type" );
+    switch( aInfo.iType )
+        {
+    default:
+    case EMemSpyDriverChunkTypeUnknown:
+        iList->AddItemL( KEntryType, _L("Unknown") );
+        break;
+    case EMemSpyDriverChunkTypeHeap:
+        iList->AddItemL( KEntryType, _L("Heap") );
+        break;
+    case EMemSpyDriverChunkTypeHeapKernel:
+        iList->AddItemL( KEntryType, _L("Kernel Heap") );
+        break;
+    case EMemSpyDriverChunkTypeStackAndProcessGlobalData:
+        iList->AddItemL( KEntryType, _L("Stack and Process Global Data") );
+        break;
+    case EMemSpyDriverChunkTypeStackKernel:
+        iList->AddItemL( KEntryType, _L("Kernel Stack") );
+        break;
+    case EMemSpyDriverChunkTypeGlobalData:
+        iList->AddItemL( KEntryType, _L("Global Data") );
+        break;
+    case EMemSpyDriverChunkTypeCode:
+        iList->AddItemL( KEntryType, _L("Code") );
+        break;
+    case EMemSpyDriverChunkTypeCodeGlobal:
+        iList->AddItemL( KEntryType, _L("Global Code") );
+        break;
+    case EMemSpyDriverChunkTypeCodeSelfModifiable:
+        iList->AddItemL( KEntryType, _L("Self Modifiable Code") );
+        break;
+    case EMemSpyDriverChunkTypeLocal:
+        iList->AddItemL( KEntryType, _L("Local") );
+        break;
+    case EMemSpyDriverChunkTypeGlobal:
+        iList->AddItemL( KEntryType, _L("Global") );
+        break;
+    case EMemSpyDriverChunkTypeRamDrive:
+        iList->AddItemL( KEntryType, _L("RAM Drive") );
+        break;
+        }
+
+    _LIT( KEntry1, "Owning Process");
+    OwnerName( item );
+    iList->AddItemL( KEntry1, item );
+
+    _LIT( KEntry2, "Address" );
+    _LIT( KEntry2Format, "0x%08x - 0x%08x" );
+    item.Format( KEntry2Format, BaseAddress(), UpperAddress() );
+    iList->AddItemL( KEntry2, item );
+
+    _LIT( KEntry3, "Size");
+    iList->AddItemL( KEntry3, Size() );
+
+    _LIT( KEntry4, "Max. Size");
+    iList->AddItemL( KEntry4, MaxSize() );
+
+    _LIT( KEntryAttributeFormat, "Attribute %d");
+    TInt attribNum = 0;
+    //
+    if  ( aInfo.iAttributes & ENormal )
+        {
+        item.Format( KEntryAttributeFormat, ++attribNum );
+        iList->AddItemL( item, _L("Normal") );
+        }
+    if  ( aInfo.iAttributes & EDoubleEnded )
+        {
+        item.Format( KEntryAttributeFormat, ++attribNum );
+        iList->AddItemL( item, _L("Double Ended") );
+        }
+    if  ( aInfo.iAttributes & EDisconnected )
+        {
+        item.Format( KEntryAttributeFormat, ++attribNum );
+        iList->AddItemL( item, _L("Disconnected") );
+        }
+    if  ( aInfo.iAttributes & EConstructed )
+        {
+        item.Format( KEntryAttributeFormat, ++attribNum );
+        iList->AddItemL( item, _L("Constructed") );
+        }
+    if  ( aInfo.iAttributes & EMemoryNotOwned )
+        {
+        item.Format( KEntryAttributeFormat, ++attribNum );
+        iList->AddItemL( item, _L("Memory Not Owned") );
+        }
+    }
+
+
+CMemSpyEngineChunkEntry* CMemSpyEngineChunkEntry::NewLC( CMemSpyEngine& aEngine, const TMemSpyDriverChunkInfo& aInfo )
+    {
+    CMemSpyEngineChunkEntry* self = new(ELeave) CMemSpyEngineChunkEntry( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInfo );
+    return self;
+    }
+
+
+const TDesC& CMemSpyEngineChunkEntry::Name() const
+    {
+    return iInfo->iName;
+    }
+
+
+TAny* CMemSpyEngineChunkEntry::Handle() const 
+    {
+    return iInfo->iHandle;
+    }
+
+
+TInt CMemSpyEngineChunkEntry::Size() const
+    {
+    return iInfo->iSize;
+    }
+
+
+TInt CMemSpyEngineChunkEntry::MaxSize() const
+    {
+    return iInfo->iMaxSize;
+    }
+
+
+TAny* CMemSpyEngineChunkEntry::BaseAddress() const
+    { 
+    return iInfo->iBaseAddress;
+    }
+
+
+TAny* CMemSpyEngineChunkEntry::UpperAddress() const
+    {
+    return (TAny*) (TUint(BaseAddress()) + TUint(Size()));
+    }
+
+
+TUint CMemSpyEngineChunkEntry::OwnerId() const
+    {
+    return iInfo->iOwnerId;
+    }
+
+
+EXPORT_C void CMemSpyEngineChunkEntry::OwnerName( TDes& aDes ) const
+    {
+    aDes.Zero();
+    AppendOwnerName( aDes );
+    }
+
+
+EXPORT_C void CMemSpyEngineChunkEntry::AppendOwnerName( TDes& aDes ) const
+    {
+    RProcess owner;
+    const TInt error = owner.Open( (TProcessId) OwnerId() );
+    if  ( error == KErrNone )
+        {
+        aDes.Append( owner.FullName() );
+        owner.Close();
+        }
+    }
+
+
+EXPORT_C void CMemSpyEngineChunkEntry::OutputDataL( CMemSpyEngineHelperChunk& aHelper ) const
+    {
+    HBufC* columns = HBufC::NewLC( 1024 );
+    TPtr pColumns( columns->Des() );
+
+    // Name
+    pColumns.Copy( Name() );
+    MemSpyEngineUtils::TextAfterDoubleColon( pColumns );
+    pColumns.Append( KMemSpyEngineChunkListOutputComma );
+
+    // Owning Process
+    AppendOwnerName( pColumns );
+    pColumns.Append( KMemSpyEngineChunkListOutputComma );
+
+    // Size
+    pColumns.AppendNum( Size(), EDecimal ); 
+    pColumns.Append( KMemSpyEngineChunkListOutputComma );
+
+    // Max. Size
+    pColumns.AppendNum( MaxSize(), EDecimal ); 
+    pColumns.Append( KMemSpyEngineChunkListOutputComma );
+
+    // Address
+    _LIT( KAddressFormat, "0x%08x - 0x%08x");
+    pColumns.AppendFormat( KAddressFormat, BaseAddress(), UpperAddress() );
+
+    //
+    aHelper.Engine().Sink().OutputLineL( pColumns );
+    CleanupStack::PopAndDestroy( columns );
+    }
+
+
+EXPORT_C TInt CMemSpyEngineChunkEntry::MdcaCount() const
+    {
+    return iList->MdcaCount();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineChunkEntry::MdcaPoint( TInt aIndex ) const
+    {
+    return iList->MdcaPoint( aIndex );
+    }
+
+
+TMemSpyDriverChunkInfo& CMemSpyEngineChunkEntry::Info()
+    {
+    return *iInfo;
+    }
+
+
+const TMemSpyDriverChunkInfo& CMemSpyEngineChunkEntry::Info() const
+    {
+    return *iInfo;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperCodeSegment.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,950 @@
+/*
+* 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 <memspy/engine/memspyenginehelpercodesegment.h>
+
+// System includes
+#include <e32capability.h>
+#include <f32file.h>
+#include <babitflags.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+
+// Constants
+const TInt KMemSpyEngineMaxCodeSegmentCount = 512;
+
+// Literal constants
+_LIT( KMemSpyEngineCodeSegListOutputComma, ", " );
+
+
+
+CMemSpyEngineHelperCodeSegment::CMemSpyEngineHelperCodeSegment( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperCodeSegment::~CMemSpyEngineHelperCodeSegment()
+    {
+    }
+
+
+void CMemSpyEngineHelperCodeSegment::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperCodeSegment* CMemSpyEngineHelperCodeSegment::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperCodeSegment* self = new(ELeave) CMemSpyEngineHelperCodeSegment( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperCodeSegment::OutputCodeSegmentsL( TUint aPid, TDes& aLine, const TDesC& aPrefix, TChar aSectionUnderlineCharacter, TBool aLowerCaseSectionHeading)
+    {
+	_LIT(KHeaderLC, "Code Segments");
+	_LIT(KHeaderUC, "CODE SEGMENTS");
+
+	_LIT(KFmtOverflow, "Only first %d code segments displayed");
+	_LIT(KFmtMod, "%S%08X-%08X %S");
+
+	const TInt KMaxCount = 256;
+	TAny* handles[KMaxCount];
+	TInt c = KMaxCount;
+
+	TInt r = iEngine.Driver().GetCodeSegs(aPid, handles, c);
+	if  ( r == KErrNone )
+    	{
+        if  ( c > 0 )
+            {
+            if  ( aLowerCaseSectionHeading )
+                {
+                iEngine.Sink().OutputSectionHeadingL( KHeaderLC, aSectionUnderlineCharacter );
+                }
+            else
+                {
+            	iEngine.Sink().OutputSectionHeadingL( KHeaderUC, aSectionUnderlineCharacter );
+                }
+
+        	if (c > KMaxCount)
+        		{
+        		c = KMaxCount;
+        		aLine.Format(KFmtOverflow, c);
+        		iEngine.Sink().OutputLineL( aLine );
+        		}
+
+        	TBuf<KMaxFileName> path;
+        	TMemSpyDriverCodeSegInfo info;
+        	for (TInt i=0; i<c; i++)
+        		{
+        		r = iEngine.Driver().GetCodeSegInfo(handles[i], aPid, info);
+                //
+        		if  ( r == KErrNone )
+        			{
+        			path.Copy( info.iCreateInfo.iFileName );
+        			aLine.Format(KFmtMod, &aPrefix, info.iMemoryInfo.iCodeBase,info.iMemoryInfo.iCodeBase + info.iMemoryInfo.iCodeSize, &path);
+        			iEngine.Sink().OutputLineL( aLine );
+        			}
+        		}
+            }
+        }
+   }
+
+
+EXPORT_C CMemSpyEngineCodeSegList* CMemSpyEngineHelperCodeSegment::CodeSegmentListL()
+    {
+    RArray<TAny*> handles( 16 );
+    CleanupClosePushL( handles );
+
+    // Get everything
+    GetCodeSegmentHandlesL( handles, NULL, EFalse );
+    CMemSpyEngineCodeSegList* list = ListFromHandlesLC( handles );
+    //
+    CleanupStack::Pop( list );
+    CleanupStack::PopAndDestroy( &handles );
+    //
+    return list;
+    }
+
+
+CMemSpyEngineCodeSegList* CMemSpyEngineHelperCodeSegment::CodeSegmentListRamLoadedL()
+    {
+    RArray<TAny*> handles( 16 );
+    CleanupClosePushL( handles );
+
+    // Get just RAM-loaded
+    GetCodeSegmentHandlesL( handles, NULL, ETrue );
+    CMemSpyEngineCodeSegList* list = ListFromHandlesLC( handles );
+    //
+    CleanupStack::Pop( list );
+    CleanupStack::PopAndDestroy( &handles );
+    //
+    return list;
+    }
+
+
+EXPORT_C CMemSpyEngineCodeSegList* CMemSpyEngineHelperCodeSegment::CodeSegmentListL( TProcessId aProcess )
+    {
+    TUint processId = aProcess;
+    //
+    RArray<TAny*> handles( 16 );
+    CleanupClosePushL( handles );
+    
+    // Get process-specific list
+    GetCodeSegmentHandlesL( handles, &processId, EFalse );
+    CMemSpyEngineCodeSegList* list = ListFromHandlesLC( handles );
+    //
+    CleanupStack::Pop( list );
+    CleanupStack::PopAndDestroy( &handles );
+    //
+    return list;
+    }
+
+
+void CMemSpyEngineHelperCodeSegment::GetCodeSegmentHandlesL( RArray<TAny*>& aHandles, TUint* aProcessId, TBool aRamOnly ) const
+    {
+	TAny* handles[ KMemSpyEngineMaxCodeSegmentCount ];
+	TInt count = KMemSpyEngineMaxCodeSegmentCount;
+
+	TInt r = KErrNone;
+	
+	if  ( aProcessId == NULL )
+    	{
+	    r = iEngine.Driver().GetCodeSegs( handles, count, aRamOnly );
+	    }
+    else
+	    {
+	    r = iEngine.Driver().GetCodeSegs( *aProcessId, handles, count );
+	    }
+
+	if  ( r == KErrNone )
+    	{
+        TInt index;
+        TLinearOrder< TAny* > comparer( SortByAddress );
+        
+        // Remove duplicates - since we reqested code segments for all processes, there
+        // might be some dupes.
+        count = Min( count, KMemSpyEngineMaxCodeSegmentCount );
+        for( index = 0; index < count; index++ )
+            {
+            TAny* handle = handles[ index ];
+            const TInt error = aHandles.InsertInOrder( handle, comparer );
+            //
+            if  ( ! (error == KErrNone || error == KErrAlreadyExists ) )
+                {
+                User::Leave( error );
+                }
+            }
+        }
+    }
+
+
+CMemSpyEngineCodeSegList* CMemSpyEngineHelperCodeSegment::ListFromHandlesLC( RArray<TAny*>& aHandles ) const
+    {
+    CMemSpyEngineCodeSegList* list = CMemSpyEngineCodeSegList::NewLC( iEngine );
+    //
+    TMemSpyDriverCodeSegInfo info;
+    const TInt count = aHandles.Count();
+    //
+    for (TInt i=0; i<count; i++)
+        {
+        TAny* handle = aHandles[ i ];
+        const TInt err = iEngine.Driver().GetCodeSegInfo( handle, 0, info );
+        //
+        if  ( err == KErrNone )
+        	{
+            // Create item
+            CMemSpyEngineCodeSegEntry* entry = CMemSpyEngineCodeSegEntry::NewLC( handle, info.iSize, info.iCreateInfo, info.iMemoryInfo );
+            list->AddItemL( entry );
+            CleanupStack::Pop( entry );
+        	}
+        }
+    //
+    return list;
+    }
+
+
+TInt CMemSpyEngineHelperCodeSegment::SortByAddress( TAny* const& aLeft, TAny* const& aRight )
+    {
+    TInt ret = 1;
+    //
+    if  ( aLeft < aRight )
+        {
+        ret = -1;
+        }
+    else if ( aLeft == aRight )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineCodeSegList::CMemSpyEngineCodeSegList( CMemSpyEngine& aEngine )
+:   CMemSpyEngineTwiddlableItemArray<CMemSpyEngineCodeSegEntry>( aEngine )
+    {
+    }
+
+
+void CMemSpyEngineCodeSegList::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineCodeSegList* CMemSpyEngineCodeSegList::NewLC( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineCodeSegList* self = new(ELeave) CMemSpyEngineCodeSegList( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+    
+EXPORT_C TInt CMemSpyEngineCodeSegList::IndexByHandle( TAny* aHandle ) const
+    {
+    TInt index = KErrNotFound;
+    //
+    const TInt count = Count();
+    for(TInt i=0; i<count; i++)
+        {
+        const CMemSpyEngineCodeSegEntry& entry = At( i );
+        if  ( entry.Handle() == aHandle )
+            {
+            index = i;
+            break;
+            }
+        }
+    //
+    return index;
+    }
+
+
+EXPORT_C void CMemSpyEngineCodeSegList::SortByFileNameL()
+    {
+    TLinearOrder< CMemSpyEngineCodeSegEntry > comparer( CompareByFileName );
+    Sort( comparer );
+    }
+
+
+EXPORT_C void CMemSpyEngineCodeSegList::SortByCodeSizeL()
+    {
+    TLinearOrder< CMemSpyEngineCodeSegEntry > comparer( CompareByCodeSize );
+    Sort( comparer );
+    }
+
+
+EXPORT_C void CMemSpyEngineCodeSegList::SortByDataSizeL()
+    {
+    TLinearOrder< CMemSpyEngineCodeSegEntry > comparer( CompareByDataSize );
+    Sort( comparer );
+    }
+
+
+EXPORT_C void CMemSpyEngineCodeSegList::SortByUidsL()
+    {
+    TLinearOrder< CMemSpyEngineCodeSegEntry > comparer( CompareByUid );
+    Sort( comparer );
+    }
+
+
+EXPORT_C void CMemSpyEngineCodeSegList::ShowOnlyEntriesWithGlobalDataL()
+    {
+    TMemSpyEngineVisibiltyFunction< CMemSpyEngineCodeSegEntry > function( VisibilityFunctionGlobalData, NULL );
+    ShowL( function );
+    SortByDataSizeL();
+    }
+
+
+EXPORT_C void CMemSpyEngineCodeSegList::OutputDataColumnsL( CMemSpyEngine& aEngine )
+    {
+    HBufC* columns = HBufC::NewLC( 1500 );
+    TPtr pColumns( columns->Des() );
+
+    //
+    _LIT(KCol1, "Name");
+    pColumns.Append( KCol1 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol2, "Uid %d");
+    pColumns.AppendFormat( KCol2, 1 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+    pColumns.AppendFormat( KCol2, 2 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+    pColumns.AppendFormat( KCol2, 3 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol3, "Module Version");
+    pColumns.Append( KCol3 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol4, "SID");
+    pColumns.Append( KCol4 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol5, "VID");
+    pColumns.Append( KCol5 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol6, "Code Size");
+    pColumns.Append( KCol6 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol7, "Text Size");
+    pColumns.Append( KCol7 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol8, "Data Size");
+    pColumns.Append( KCol8 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol9, "BSS Size");
+    pColumns.Append( KCol9 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol10, "Total Data Size");
+    pColumns.Append( KCol10 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol11, "Entrypoint Veneer");
+    pColumns.Append( KCol11 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol12, "File Entrypoint");
+    pColumns.Append( KCol12 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol13, "Dependency Count");
+    pColumns.Append( KCol13 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol14, "ROM Code Load Address");
+    pColumns.Append( KCol14 );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    //
+    _LIT(KCol15, "Data Load Address");
+    pColumns.Append( KCol15 );
+
+    //
+    _LIT(KCol16, "Capabilities...");
+    pColumns.Append( KCol16 );
+
+    //
+    aEngine.Sink().OutputLineL( pColumns );
+    CleanupStack::PopAndDestroy( columns );
+    }
+
+
+EXPORT_C TInt CMemSpyEngineCodeSegList::MdcaCount() const
+    {
+    return Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineCodeSegList::MdcaPoint( TInt aIndex ) const
+    {
+    const CMemSpyEngineCodeSegEntry& item = At( aIndex );
+    return TPtrC( item.Caption() );
+    }
+
+
+TInt CMemSpyEngineCodeSegList::IndexByName( const TDesC& aName ) const
+    {
+    TInt index = KErrNotFound;
+    //
+    const TInt count = Count();
+    for(TInt i=0; i<count; i++)
+        {
+        const CMemSpyEngineCodeSegEntry& entry = At( i );
+        if  ( entry.FileName().FindF( aName ) >= 0 )
+            {
+            index = i;
+            break;
+            }
+        }
+    //
+    return index;
+    }
+
+
+TInt CMemSpyEngineCodeSegList::CompareByFileName( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight )
+    {
+    const TInt ret = aLeft.FileName().CompareF( aRight.FileName() );
+    return ret;
+    }
+
+
+TInt CMemSpyEngineCodeSegList::CompareByCodeSize( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight )
+    {
+    TInt ret = -1;
+    //
+    if  ( aLeft.CreateInfo().iCodeSize < aRight.CreateInfo().iCodeSize )
+        {
+        ret = 1;
+        }
+    else if ( aLeft.CreateInfo().iCodeSize == aRight.CreateInfo().iCodeSize )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineCodeSegList::CompareByDataSize( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight )
+    {
+    TInt ret = -1;
+    //
+    if  ( aLeft.CreateInfo().iTotalDataSize < aRight.CreateInfo().iTotalDataSize )
+        {
+        ret = 1;
+        }
+    else if ( aLeft.CreateInfo().iTotalDataSize == aRight.CreateInfo().iTotalDataSize )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineCodeSegList::CompareByUid( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight )
+    {
+    TInt ret = -1;
+    //
+    if  ( aLeft.CreateInfo().iUids.MostDerived().iUid < aRight.CreateInfo().iUids.MostDerived().iUid )
+        {
+        ret = 1;
+        }
+    else if ( aLeft.CreateInfo().iUids.MostDerived().iUid == aRight.CreateInfo().iUids.MostDerived().iUid )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+TBool CMemSpyEngineCodeSegList::VisibilityFunctionGlobalData( const CMemSpyEngineCodeSegEntry*& aItem, TAny* /*aRune*/ )
+    {
+    const TBool hasGlobalData = ( aItem->CreateInfo().iTotalDataSize > 0 );
+    return hasGlobalData;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineCodeSegEntry::CMemSpyEngineCodeSegEntry( TAny* aHandle, TInt aSize, const TCodeSegCreateInfo& aCreateInfo, const TProcessMemoryInfo& aMemoryInfo )
+:   CDesCArrayFlat( 10 ), iHandle( aHandle ), iSize( aSize ), iCreateInfo( aCreateInfo ), iMemoryInfo( aMemoryInfo )
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineCodeSegEntry::~CMemSpyEngineCodeSegEntry()
+    {
+    delete iCaption;
+    delete iFileName;
+    }
+
+
+void CMemSpyEngineCodeSegEntry::ConstructL()
+    {
+    iFileName = HBufC::NewL( iCreateInfo.iFileName.Length() );
+    iFileName->Des().Copy( iCreateInfo.iFileName );
+
+    // Make caption
+    TParsePtrC parser( *iFileName );
+    const TPtrC pFileNameWithoutPath( parser.NameAndExt() );
+    TBuf<KMaxFullName + 128> item;
+    //
+    _LIT(KCodeSegFormat, "\t%S\t\t%S code");
+    const TMemSpySizeText codeSize( MemSpyEngineUtils::FormatSizeText( iCreateInfo.iCodeSize ) );
+    item.Format( KCodeSegFormat, &pFileNameWithoutPath, &codeSize );
+    if  ( iCreateInfo.iDataSize > 0 )
+        {
+        _LIT(KCodeSegFormatAdditionalData, ", %S data");
+        const TMemSpySizeText dataSize( MemSpyEngineUtils::FormatSizeText( iCreateInfo.iTotalDataSize ) );
+        item.AppendFormat( KCodeSegFormatAdditionalData, &dataSize );
+        }
+    iCaption = item.AllocL();
+
+    //
+    _LIT(KItem0, "\tName\t\t%S");
+    item.Format( KItem0, &pFileNameWithoutPath );
+    AppendL( item );
+
+    // Uids
+    const TUidType uids( iCreateInfo.iUids );
+    for( TInt i=0; i<KMaxCheckedUid; i++ )
+        {
+        _LIT(KItem1, "\tUid #%d\t\t0x%08x");
+        const TUid uidValue( uids[ i ] );
+        //
+        item.Format( KItem1, i+1, uidValue.iUid );
+        AppendL( item );
+        }
+    //
+    if  ( iCreateInfo.iModuleVersion == KModuleVersionWild )
+        {
+        _LIT(KItem12, "\tModule Version\t\t[Wild]");
+        AppendL( KItem12 );
+        }
+    else if ( iCreateInfo.iModuleVersion == KModuleVersionNull )
+        {
+        _LIT(KItem12, "\tModule Version\t\t[Null]");
+        AppendL( KItem12 );
+        }
+    else
+        {
+        _LIT(KItem12, "\tModule Version\t\t0x%08x");
+        item.Format( KItem12, iCreateInfo.iModuleVersion );
+        AppendL( item );
+        }
+
+    //
+    _LIT(KItem13, "\tSID\t\t0x%08x");
+    item.Format( KItem13, iCreateInfo.iS.iSecureId );
+    AppendL( item );
+
+    //
+    _LIT(KItem14, "\tVID\t\t0x%08x");
+    item.Format( KItem14, iCreateInfo.iS.iVendorId );
+    AppendL( item );
+
+    //
+    if  ( iCreateInfo.iCodeSize > 0 )
+        {
+        _LIT(KItem2, "\tCode Size\t\t%d");
+        item.Format( KItem2, iCreateInfo.iCodeSize );
+        AppendL( item );
+        }
+
+    //
+    if  ( iCreateInfo.iTotalDataSize > 0 )
+        {
+        _LIT(KItem6, "\tTotal Data Size\t\t%d");
+        item.Format( KItem6, iCreateInfo.iTotalDataSize );
+        AppendL( item );
+        }
+
+    //
+    if  ( iCreateInfo.iTextSize > 0 )
+        {
+        _LIT(KItem3, "\tText Size\t\t%d");
+        item.Format( KItem3, iCreateInfo.iTextSize );
+        AppendL( item );
+        }
+
+    //
+    if  ( iCreateInfo.iDataSize > 0 )
+        {
+        _LIT(KItem4, "\tData Size\t\t%d");
+        item.Format( KItem4, iCreateInfo.iDataSize );
+        AppendL( item );
+        }
+
+    //
+    if  ( iCreateInfo.iBssSize > 0 )
+        {
+        _LIT(KItem5, "\tBSS Size\t\t%d");
+        item.Format( KItem5, iCreateInfo.iBssSize );
+        AppendL( item );
+        }
+
+    //
+    _LIT(KItem7, "\tEntrypoint Veneer\t\t0x%08x");
+    item.Format( KItem7, iCreateInfo.iEntryPtVeneer );
+    AppendL( item );
+
+    //
+    _LIT(KItem8, "\tFile Entrypoint\t\t0x%08x");
+    item.Format( KItem8, iCreateInfo.iFileEntryPoint );
+    AppendL( item );
+
+    //
+    _LIT(KItem9, "\tDependency Count\t\t%d");
+    item.Format( KItem9, iCreateInfo.iDepCount );
+    AppendL( item );
+
+    //
+    if  ( iCreateInfo.iCodeLoadAddress != 0 )
+        {
+        _LIT(KItem10, "\tROM Code Load Addr.\t\t0x%08x");
+        item.Format( KItem10, iCreateInfo.iCodeLoadAddress );
+        AppendL( item );
+        }
+    else
+        {
+        _LIT(KItem10, "\tROM Code Load Addr.\t\t[RAM Loaded]");
+        AppendL( KItem10 );
+        }
+
+    //
+    if  ( iCreateInfo.iDataLoadAddress != 0 )
+        {
+        _LIT(KItem11, "\tData Load Addr.\t\t0x%08x");
+        item.Format( KItem11, iCreateInfo.iDataLoadAddress );
+        AppendL( item );
+        }
+
+    //
+    AddCapabilityItemsL();
+    }
+
+
+CMemSpyEngineCodeSegEntry* CMemSpyEngineCodeSegEntry::NewLC( TAny* aHandle, TInt aSize, const TCodeSegCreateInfo& aCreateInfo, const TProcessMemoryInfo& aMemoryInfo )
+    {
+    CMemSpyEngineCodeSegEntry* self = new(ELeave) CMemSpyEngineCodeSegEntry( aHandle, aSize, aCreateInfo, aMemoryInfo );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C TBool CMemSpyEngineCodeSegEntry::HasCapability( TCapability aCapability ) const
+    {
+    TBool hasCap = EFalse;
+    //
+    for( TInt i=0; i<SCapabilitySet::ENCapW && !hasCap; i++ )
+        {
+        const TUint32 capsRawValue = iCreateInfo.iS.iCaps[i];
+        const TBitFlags flags( capsRawValue );
+        //
+        hasCap = flags.IsSet( aCapability );
+        }
+    //
+    return hasCap;
+    }
+
+
+EXPORT_C void CMemSpyEngineCodeSegEntry::OutputDataL( CMemSpyEngineHelperCodeSegment& aHelper ) const
+    {
+    _LIT(KHexFormat, "0x%08x");
+
+    HBufC* columns = HBufC::NewLC( 4096 );
+    TPtr pColumns( columns->Des() );
+
+    // Name
+    TParsePtrC parser( *iFileName );
+    const TPtrC pFileNameWithoutPath( parser.NameAndExt() );
+    pColumns.Append( pFileNameWithoutPath );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // Uids
+    const TUidType uids( iCreateInfo.iUids );
+    for( TInt i=0; i<KMaxCheckedUid; i++ )
+        {
+        const TUid uidValue( uids[ i ] );
+        //
+        pColumns.AppendFormat( KHexFormat, uidValue.iUid );
+        pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+        }
+
+    // Module version
+    if  ( iCreateInfo.iModuleVersion == KModuleVersionWild )
+        {
+        _LIT( KCaption, "Wild");
+        pColumns.Append( KCaption );
+        }
+    else if ( iCreateInfo.iModuleVersion == KModuleVersionNull )
+        {
+        _LIT( KCaption, "Null");
+        pColumns.Append( KCaption );
+        }
+    else
+        {
+        pColumns.AppendFormat( KHexFormat, iCreateInfo.iModuleVersion );
+        }
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // SID
+    pColumns.AppendFormat( KHexFormat, iCreateInfo.iS.iSecureId );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // VID
+    pColumns.AppendFormat( KHexFormat, iCreateInfo.iS.iVendorId );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // Code size
+    if  ( iCreateInfo.iCodeSize > 0 )
+        {
+        pColumns.AppendNum( iCreateInfo.iCodeSize, EDecimal );
+        }
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // Text size
+    if  ( iCreateInfo.iTextSize > 0 )
+        {
+        pColumns.AppendNum( iCreateInfo.iTextSize, EDecimal );
+        }
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // Data size
+    if  ( iCreateInfo.iDataSize > 0 )
+        {
+        pColumns.AppendNum( iCreateInfo.iDataSize, EDecimal );
+        }
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // BSS
+    if  ( iCreateInfo.iBssSize > 0 )
+        {
+        pColumns.AppendNum( iCreateInfo.iBssSize, EDecimal );
+        }
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // Total data size
+    if  ( iCreateInfo.iTotalDataSize > 0 )
+        {
+        pColumns.AppendNum( iCreateInfo.iTotalDataSize, EDecimal );
+        }
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // Entrypoint veneer
+    pColumns.AppendFormat( KHexFormat, iCreateInfo.iEntryPtVeneer );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // File Entrypoint
+    pColumns.AppendFormat( KHexFormat, iCreateInfo.iFileEntryPoint );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // Dependency Count
+    pColumns.AppendNum( iCreateInfo.iDepCount, EDecimal );
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // ROM Code Load Address
+    if  ( iCreateInfo.iCodeLoadAddress != 0 )
+        {
+        pColumns.AppendFormat( KHexFormat, iCreateInfo.iCodeLoadAddress );
+        }
+    else
+        {
+        _LIT(KCaption, "N.A. - RAM Loaded");
+        pColumns.Append( KCaption );
+        }
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // Data Load Address
+    if  ( iCreateInfo.iDataLoadAddress != 0 )
+        {
+        pColumns.AppendFormat( KHexFormat, iCreateInfo.iDataLoadAddress );
+        }
+    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+
+    // Capabilities
+    CDesCArray* capabilities = CapabilityStringsLC();
+    const TInt count = capabilities->Count();
+    //
+    for( TInt j=0; j<count; j++ )
+        {
+        const TPtrC capabilityName( (*capabilities)[ j ] );
+        //
+        pColumns.Append( capabilityName );
+        if  ( j < count-1 )
+            {
+            pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
+            }
+        }
+    //
+    CleanupStack::PopAndDestroy( capabilities );
+
+    aHelper.Engine().Sink().OutputLineL( pColumns );
+
+    CleanupStack::PopAndDestroy( columns );
+    }
+
+
+void CMemSpyEngineCodeSegEntry::AddCapabilityItemsL()
+    {
+    _LIT(KCapFormat, "\tCapability #%3d\t\t%S");
+    TBuf<128> item;
+    //
+    CDesCArray* capabilities = CapabilityStringsLC();
+    const TInt count = capabilities->Count();
+    //
+    for( TInt i=0; i<count; i++ )
+        {
+        const TPtrC capabilityName( (*capabilities)[ i ] );
+        item.Format( KCapFormat, i+1, &capabilityName );
+        AppendL( item );
+        }
+    //
+    CleanupStack::PopAndDestroy( capabilities );
+    }
+
+
+CDesCArray* CMemSpyEngineCodeSegEntry::CapabilityStringsLC() const
+    {
+    CDesCArrayFlat* array = new(ELeave) CDesCArrayFlat( ECapability_Limit );
+    CleanupStack::PushL( array );
+    //
+    const TInt KCapabilityCountPer32Bits = 32;
+    //
+    for( TInt i=0; i<SCapabilitySet::ENCapW; i++ )
+        {
+        const TUint32 caps = iCreateInfo.iS.iCaps[i];
+        //
+        AddCapabilitiesL( caps, i * KCapabilityCountPer32Bits, *array );
+        }
+    //
+    return array;
+    }
+
+
+void CMemSpyEngineCodeSegEntry::AddCapabilitiesL( TUint32 aCaps, TInt aCapCount, CDesCArray& aArray ) const
+    {
+    TBitFlags flags( aCaps );
+    TBuf<128> capabilityName;
+    //
+    for( TInt i=aCapCount; i<aCapCount + 32 && i<ECapability_Limit; i++ )
+        {
+        const TBool isSet = flags.IsSet( i );
+        //
+        if  ( isSet )
+            {
+            // Get capability name
+            const TCapability capability = static_cast< TCapability >( i );
+            MemSpyEngineUtils::GetCapabilityName( capabilityName, capability );
+
+            // Make a capability entry for this item
+            aArray.AppendL( capabilityName );
+            }
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperCondVar.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* 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 <memspy/engine/memspyenginehelpercondvar.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+
+
+
+CMemSpyEngineHelperCondVar::CMemSpyEngineHelperCondVar( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperCondVar::~CMemSpyEngineHelperCondVar()
+    {
+    }
+
+
+void CMemSpyEngineHelperCondVar::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperCondVar* CMemSpyEngineHelperCondVar::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperCondVar* self = new(ELeave) CMemSpyEngineHelperCondVar( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+EXPORT_C void CMemSpyEngineHelperCondVar::GetCondVarSuspendedThreadsL( const TMemSpyDriverHandleInfoGeneric& aCondVarDetails, RArray<TMemSpyDriverCondVarSuspendedThreadInfo>& aThreads )
+    {   
+    const TInt KMaxCount = 256;
+    TAny* handles[KMaxCount];
+    TInt c = KMaxCount;
+
+    TInt r = iEngine.Driver().GetCondVarSuspendedThreads( aCondVarDetails.iHandle, handles, c );
+    if  ( r == KErrNone )
+        {
+        if  ( c > 0 )
+            {
+            if (c > KMaxCount)
+                {
+                c = KMaxCount;
+                }
+
+            TMemSpyDriverCondVarSuspendedThreadInfo info;
+            for (TInt i=0; i<c; i++)
+                {
+                r = iEngine.Driver().GetCondVarSuspendedThreadInfo( handles[i], info );
+                if (r == KErrNone)
+                    {
+                    aThreads.AppendL( info );
+                    }
+                }
+            }
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperECom.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,813 @@
+/*
+* 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 <memspy/engine/memspyenginehelperecom.h>
+
+// System includes
+#include <charconv.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyenginehelperfilesystem.h>
+
+// Literal constants
+_LIT8( KMemSpyEComXmlFileMimeType, "text/xml" );
+_LIT8( KMemSpyXmlSpec_MasterSection, "memspy_ecom_sections" );
+_LIT8( KMemSpyXmlSpec_ChildSectionCategory, "category" );
+_LIT8( KMemSpyXmlSpec_ChildSectionCategory_Attribute_Name, "name" );
+_LIT8( KMemSpyXmlSpec_ChildSectionInterface, "interface" );
+_LIT8( KMemSpyXmlSpec_ChildSectionInterface_Name, "name" );
+_LIT8( KMemSpyXmlSpec_ChildSectionInterface_Uid, "uid" );
+_LIT8( KMemSpyXmlSpec_HexPrefix, "0x" );
+
+
+
+
+
+CMemSpyEngineHelperECom::CMemSpyEngineHelperECom( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperECom::~CMemSpyEngineHelperECom()
+    {
+    iCategories.ResetAndDestroy();
+    iCategories.Close();
+    //
+    delete iParser;
+    delete iConverter;
+    //
+    iEComSession.Close();
+    REComSession::FinalClose();
+    }
+
+
+void CMemSpyEngineHelperECom::ConstructL()
+    {
+    TRAPD( err, ConstructInternalL() );
+    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructL() - error: %d", err );
+    err = err;
+    }
+
+
+void CMemSpyEngineHelperECom::ConstructInternalL()
+    {
+    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructInternalL() - START" );
+    iEComSession = REComSession::OpenL();
+
+    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructInternalL() - creating parser..." );
+	iParser = CParser::NewL( KMemSpyEComXmlFileMimeType, *this );
+
+    // We only convert from UTF-8 to UTF-16
+    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructInternalL() - creating charconv object..." );
+    iConverter = CCnvCharacterSetConverter::NewL();
+    if  ( iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierUtf8, iEngine.FsSession() ) == CCnvCharacterSetConverter::ENotAvailable )
+	    {
+		User::Leave(KErrNotFound);
+		}
+
+    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructInternalL() - reading xml..." );
+    ConstructFromFileL();
+    
+    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructInternalL() - END" );
+    }
+
+
+void CMemSpyEngineHelperECom::ConstructFromFileL()
+    {
+    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructFromFileL() - START" );
+
+    // Locate the source file
+    TRAPD( err, 
+        HBufC* fileName = FindEComXmlFileNameLC();
+        ParseL( *fileName );
+        CleanupStack::PopAndDestroy( fileName );
+        );
+    err = err;
+
+    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructFromFileL() - parse error: %d", err );
+
+    delete iConverter;
+    iConverter = NULL;
+
+    // Build captions
+    const TInt categoryCount = iCategories.Count();
+    for( TInt i=0; i<categoryCount; i++ )
+        {
+        //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructFromFileL() - building caption: %d", i );
+
+        CMemSpyEngineEComCategory* cat = iCategories[ i ];
+        cat->BuildCaptionL();
+        }
+
+    //RDebug::Printf( "CMemSpyEngineHelperECom::ConstructFromFileL() - END" );
+    }
+
+
+CMemSpyEngineHelperECom* CMemSpyEngineHelperECom::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperECom* self = new(ELeave) CMemSpyEngineHelperECom( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+REComSession& CMemSpyEngineHelperECom::EComSession()
+    {
+    return iEComSession;
+    }
+
+
+EXPORT_C CMemSpyEngineEComCategory& CMemSpyEngineHelperECom::At( TInt aIndex )
+    {
+    return *iCategories[ aIndex ];
+    }
+
+
+EXPORT_C TInt CMemSpyEngineHelperECom::IndexOf( const CMemSpyEngineEComCategory& aEntry )
+    {
+    const TInt index = iCategories.Find( &aEntry );
+    return index;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineHelperECom::MdcaCount() const
+    {
+    return iCategories.Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineHelperECom::MdcaPoint( TInt aIndex ) const
+    {
+    CMemSpyEngineEComCategory* category = iCategories[ aIndex ];
+    return category->Caption();
+    }
+
+
+HBufC* CMemSpyEngineHelperECom::FindEComXmlFileNameLC()
+    {
+    RFs& fsSession = iEngine.FsSession();
+    //
+    TFileName* fileName = new(ELeave) TFileName();
+    CleanupStack::PushL( fileName );
+    //
+    fsSession.PrivatePath( *fileName );
+    //
+    TFindFile findFile( fsSession );
+    User::LeaveIfError( findFile.FindByPath( KMemSpyEComInterfaceIdFileName, fileName ) );
+    //
+    HBufC* ret = findFile.File().AllocL();
+    CleanupStack::PopAndDestroy( fileName );
+    CleanupStack::PushL( ret );
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperECom::ConvertL( const TDesC8& aInput, TDes16& aOutput )
+    {
+    const TInt error = iConverter->ConvertToUnicode( aOutput, aInput, iCharconvConverterState );
+    User::LeaveIfError( error );
+    }
+
+
+void CMemSpyEngineHelperECom::ParseL( const TDesC& aFileName )
+    {
+	Xml::ParseL( *iParser, iEngine.FsSession(), aFileName );
+    //
+    const TInt error = iParserErrorCode;
+    //RDebug::Printf( "CMemSpyEngineHelperECom::ParseL() - iParserErrorCode: %d", iParserErrorCode );
+    iParserErrorCode = KErrNone;
+    //
+	User::LeaveIfError( error );
+    }
+
+
+void CMemSpyEngineHelperECom::OnChildSectionCategoryL( const RAttributeArray& aAttributes )
+    {
+    TBuf<128> name;
+    TBool gotName = EFalse;
+    //
+    const TInt count = aAttributes.Count();
+	for( TInt i=0; i<count; i++ )
+		{
+		const TPtrC8 attrib( aAttributes[ i ].Attribute().LocalName().DesC() );
+		const TPtrC8 value( aAttributes[ i ].Value().DesC() );
+        //
+		if  ( attrib.CompareF( KMemSpyXmlSpec_ChildSectionCategory_Attribute_Name ) == 0 )
+			{
+            if  ( gotName )
+                {
+                User::LeaveIfError( KErrCorrupt );
+                }
+            else
+                {
+                ConvertL( value, name );
+                gotName = ETrue;
+                }
+			}
+        }
+    //
+    if  ( gotName )
+        {
+        // Make a new category
+        //RDebug::Print( _L("CMemSpyEngineHelperECom::OnChildSectionCategoryL() - creating category: %S"), &name );
+
+        CMemSpyEngineEComCategory* category = CMemSpyEngineEComCategory::NewLC( *this, name );
+        iCategories.AppendL( category );
+        CleanupStack::Pop( category );
+
+        //RDebug::Print( _L("CMemSpyEngineHelperECom::OnChildSectionCategoryL() - created category: %S"), &name );
+        }
+    else
+        {
+        User::Leave( KErrCorrupt );
+        }
+    }
+
+
+void CMemSpyEngineHelperECom::OnChildSectionInterfaceL( const RAttributeArray& aAttributes )
+    {
+    TUid uid = KNullUid;
+    TBuf<128> name;
+    TBool gotName = EFalse;
+    TBool gotUid = EFalse;
+    //
+    const TInt count = aAttributes.Count();
+	for( TInt i=0; i<count; i++ )
+		{
+		const TPtrC8 attrib( aAttributes[ i ].Attribute().LocalName().DesC() );
+		const TPtrC8 value( aAttributes[ i ].Value().DesC() );
+        //
+		if  ( attrib.CompareF( KMemSpyXmlSpec_ChildSectionInterface_Name ) == 0 )
+			{
+            if  ( gotName )
+                {
+                User::LeaveIfError( KErrCorrupt );
+                }
+            else
+                {
+                ConvertL( value, name );
+                gotName = ETrue;
+                }
+			}
+		else if ( attrib.CompareF( KMemSpyXmlSpec_ChildSectionInterface_Uid ) == 0 )
+			{
+            if  ( gotUid )
+                {
+                User::LeaveIfError( KErrCorrupt );
+                }
+            else
+                {
+                if  ( value.Length() >= 8 )
+                    {
+                    TRadix radix = EDecimal;
+                    TPtrC8 pValue( value );
+                    //
+                    if  ( value.Length() == 10 && value.Left( 2 ) == KMemSpyXmlSpec_HexPrefix )
+                        {
+                        pValue.Set( value.Mid( 2 ) );
+                        radix = EHex;
+                        }
+                    //
+                    TUint32 uidVal = 0;
+                    TLex8 lexer( pValue );
+                    const TInt err = lexer.Val( uidVal, radix );
+                    User::LeaveIfError( err );
+                    uid.iUid = uidVal;
+                    gotUid = ETrue;
+                    }
+                }
+			}
+        }
+    //
+    const TInt catCount = iCategories.Count();
+    if  ( gotName && gotUid && catCount > 0 )
+        {
+        //RDebug::Print( _L("CMemSpyEngineHelperECom::OnChildSectionInterfaceL() - creating interface for %S [0x%08x]"), &name, uid.iUid );
+
+        CMemSpyEngineEComCategory* category = iCategories[ catCount - 1 ];
+        TRAPD( err, category->CreateInterfaceL( name, uid ) );
+        err = err;
+        //RDebug::Print( _L("CMemSpyEngineHelperECom::OnChildSectionInterfaceL() - error: %d, for %S [0x%08x]"), err, &name, uid.iUid );
+        }
+    else
+        {
+        User::Leave( KErrCorrupt );
+        }
+    }
+
+
+void CMemSpyEngineHelperECom::OnStartDocumentL( const RDocumentParameters& /*aDocParam*/, TInt aErrorCode )
+    {
+    User::LeaveIfError( aErrorCode );
+    }
+
+
+void CMemSpyEngineHelperECom::OnEndDocumentL( TInt aErrorCode )
+    {
+    User::LeaveIfError( aErrorCode );
+    }
+
+
+void CMemSpyEngineHelperECom::OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode )
+    {
+    User::LeaveIfError( aErrorCode );
+    //
+	TInt err = KErrNone;
+	const TPtrC8 name( aElement.LocalName().DesC() );
+    //
+    if  ( name.CompareF( KMemSpyXmlSpec_MasterSection ) == 0 )
+		{
+		iSeenMasterSection = ETrue;
+		}
+    else if ( iSeenMasterSection )
+        {
+        if  ( name.CompareF( KMemSpyXmlSpec_ChildSectionCategory ) == 0 )
+            {
+            OnChildSectionCategoryL( aAttributes );
+            }
+        else if ( name.CompareF( KMemSpyXmlSpec_ChildSectionInterface ) == 0 )
+            {
+            OnChildSectionInterfaceL( aAttributes );
+            }
+        }
+    //
+    User::LeaveIfError( err );
+    }
+
+
+void CMemSpyEngineHelperECom::OnEndElementL( const RTagInfo& /*aElement*/, TInt aErrorCode )
+    {
+    User::LeaveIfError( aErrorCode );
+    }
+
+
+void CMemSpyEngineHelperECom::OnContentL( const TDesC8& /*aBytes*/, TInt aErrorCode )
+    {
+    User::LeaveIfError( aErrorCode );
+    }
+
+
+void CMemSpyEngineHelperECom::OnStartPrefixMappingL( const RString& /*aPrefix*/, const RString& /*aUri*/, TInt aErrorCode )
+    {
+    User::LeaveIfError( aErrorCode );
+    }
+
+
+void CMemSpyEngineHelperECom::OnEndPrefixMappingL( const RString& /*aPrefix*/, TInt aErrorCode )
+    {
+    User::LeaveIfError( aErrorCode );
+    }
+
+
+void CMemSpyEngineHelperECom::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, TInt aErrorCode )
+    {
+    User::LeaveIfError( aErrorCode );
+    }
+
+
+void CMemSpyEngineHelperECom::OnSkippedEntityL( const RString& /*aName*/, TInt aErrorCode )
+    {
+    User::LeaveIfError( aErrorCode );
+    }
+
+
+void CMemSpyEngineHelperECom::OnProcessingInstructionL( const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt aErrorCode )
+    {
+    User::LeaveIfError( aErrorCode );
+    }
+
+
+void CMemSpyEngineHelperECom::OnError( TInt aErrorCode )
+    {
+    iParserErrorCode = aErrorCode;
+    }
+
+
+TAny* CMemSpyEngineHelperECom::GetExtendedInterface( const TInt32 /*aUid*/ )
+    {
+    return NULL;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineEComCategory::CMemSpyEngineEComCategory( CMemSpyEngineHelperECom& aHelper )
+:   iHelper( aHelper )
+    {
+    }
+
+    
+CMemSpyEngineEComCategory::~CMemSpyEngineEComCategory()
+    {
+    delete iCaption;
+    delete iName;
+    iInterfaces.ResetAndDestroy();
+    iInterfaces.Close();
+    }
+
+
+void CMemSpyEngineEComCategory::ConstructL( const TDesC& aName )
+    {
+    iName = aName.AllocL();
+    iCaption = aName.AllocL(); // Replace later on
+    }
+
+
+CMemSpyEngineEComCategory* CMemSpyEngineEComCategory::NewLC( CMemSpyEngineHelperECom& aHelper, const TDesC& aName )
+    {
+    CMemSpyEngineEComCategory* self = new(ELeave) CMemSpyEngineEComCategory( aHelper );
+    CleanupStack::PushL( self );
+    self->ConstructL( aName );
+    return self;
+    }
+
+
+EXPORT_C CMemSpyEngineEComInterface& CMemSpyEngineEComCategory::At( TInt aIndex )
+    {
+    return *iInterfaces[ aIndex ];
+    }
+
+
+EXPORT_C TInt CMemSpyEngineEComCategory::IndexOf( const CMemSpyEngineEComInterface& aEntry )
+    {
+    const TInt index = iInterfaces.Find( &aEntry );
+    return index;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineEComCategory::MdcaCount() const
+    {
+    return iInterfaces.Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineEComCategory::MdcaPoint( TInt aIndex ) const
+    {
+    CMemSpyEngineEComInterface* iface = iInterfaces[ aIndex ];
+    return iface->Caption();
+    }
+
+
+void CMemSpyEngineEComCategory::CreateInterfaceL( const TDesC& aName, TUid aUid )
+    {
+    CMemSpyEngineEComInterface* iface = CMemSpyEngineEComInterface::NewLC( *this, aName, aUid );
+    iInterfaces.AppendL( iface );
+    CleanupStack::Pop( iface );
+    }
+
+
+void CMemSpyEngineEComCategory::BuildCaptionL()
+    {
+    delete iCaption; 
+    iCaption = NULL;
+
+    _LIT( KCaptionFormat, "\t%S\t\t%d interface" );
+    iCaption = HBufC::NewL( 256 );
+    TPtr pCaption( iCaption->Des() );
+    pCaption.Format( KCaptionFormat, iName, iInterfaces.Count() );
+    if  ( iInterfaces.Count() > 1 )
+        {
+        pCaption.Append( 's' );
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineEComInterface::CMemSpyEngineEComInterface( CMemSpyEngineEComCategory& aCategory, TUid aUid )
+:   iUid( aUid ), iCategory( aCategory )
+    {
+    }
+
+    
+CMemSpyEngineEComInterface::~CMemSpyEngineEComInterface()
+    {
+    delete iCaption;
+    delete iName;
+    iImplementations.ResetAndDestroy();
+    iImplementations.Close();
+    }
+
+
+void CMemSpyEngineEComInterface::ConstructL( const TDesC& aName )
+    {
+    iName = aName.AllocL();
+
+    // Get implementation information for this interface...
+    RImplInfoPtrArray infoArray;
+    CleanupResetAndDestroyPushL( infoArray );
+    REComSession::ListImplementationsL( iUid, infoArray );
+
+    // Make implementation objects for each impl that exists.
+    const TInt count = infoArray.Count();
+    for( TInt i=count-1; i>=0; i-- )
+        {
+        CImplementationInformation* info = infoArray[ i ];
+
+        // Get info
+        CMemSpyEngineEComImplementation* impl = CMemSpyEngineEComImplementation::NewLC( *this, info );
+
+        // Now owned by impl
+        infoArray.Remove( i );
+
+        // Add to container
+        iImplementations.AppendL( impl );
+        CleanupStack::Pop( impl );
+        }
+
+    // Tidy up
+    CleanupStack::PopAndDestroy( &infoArray );
+
+    // Build caption
+    _LIT( KCaptionFormat, "\t%S\t\t[0x%08x] [%d impl]" );
+    iCaption = HBufC::NewL( 256 );
+    TPtr pCaption( iCaption->Des() );
+    pCaption.Format( KCaptionFormat, iName, iUid.iUid, count );
+    }
+
+
+CMemSpyEngineEComInterface* CMemSpyEngineEComInterface::NewLC( CMemSpyEngineEComCategory& aCategory, const TDesC& aName, TUid aUid )
+    {
+    CMemSpyEngineEComInterface* self = new(ELeave) CMemSpyEngineEComInterface( aCategory, aUid );
+    CleanupStack::PushL( self );
+    self->ConstructL( aName );
+    return self;
+    }
+
+
+EXPORT_C CMemSpyEngineEComImplementation& CMemSpyEngineEComInterface::At( TInt aIndex )
+    {
+    return *iImplementations[ aIndex ];
+    }
+
+
+EXPORT_C TInt CMemSpyEngineEComInterface::IndexOf( const CMemSpyEngineEComImplementation& aEntry )
+    {
+    const TInt index = iImplementations.Find( &aEntry );
+    return index;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineEComInterface::MdcaCount() const
+    {
+    return iImplementations.Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineEComInterface::MdcaPoint( TInt aIndex ) const
+    {
+    CMemSpyEngineEComImplementation* impl = iImplementations[ aIndex ];
+    return impl->Caption();
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineEComImplementation::CMemSpyEngineEComImplementation( CMemSpyEngineEComInterface& aInterface )
+:   iInterface( aInterface )
+    {
+    }
+
+    
+CMemSpyEngineEComImplementation::~CMemSpyEngineEComImplementation()
+    {
+    delete iCaption;
+    delete iName;
+    delete iInfoText;
+    delete iInfo;
+    }
+
+
+void CMemSpyEngineEComImplementation::ConstructL( CImplementationInformation* aInfo )
+    {
+    iInfoText = new(ELeave) CDesCArrayFlat( 10 );
+    TBuf< 256 > temp;
+
+    // Make items.
+    if  ( aInfo->DisplayName().Length() )
+        {
+        _LIT( KNameFormat, "0x%08x - %S" );
+        temp.Format( KNameFormat, aInfo->ImplementationUid().iUid, &aInfo->DisplayName() );
+        }
+    else
+        {
+        _LIT( KNameFormat, "0x%08x" );
+        temp.Format( KNameFormat, aInfo->ImplementationUid().iUid );
+        }
+    iName = temp.AllocL();
+
+    _LIT( KItem1, "\tImpl. Uid\t\t0x%08x" );
+    temp.Format( KItem1, aInfo->ImplementationUid().iUid );
+    iInfoText->AppendL( temp );
+
+    if  ( aInfo->DisplayName().Length() )
+        {
+        _LIT( KItem2, "\tDisplay Name\t\t%S" );
+        temp.Format( KItem2, &aInfo->DisplayName() );
+        }
+    else
+        {
+        _LIT( KItem2, "\tDisplay Name\t\t[Undefined]" );
+        temp.Copy( KItem2 );
+        }
+    iInfoText->AppendL( temp );
+
+    _LIT( KItem3, "\tVersion\t\t%d" );
+    temp.Format( KItem3, aInfo->Version() );
+    iInfoText->AppendL( temp );
+
+    HBufC* opaqueData = CopyAndCropLC( aInfo->OpaqueData() );
+    if  ( opaqueData->Length() )
+        {
+        _LIT( KItem4, "\tOpaque Data\t\t%S" );
+        temp.Format( KItem4, opaqueData );
+        }
+    else
+        {
+        _LIT( KItem4, "\tOpaque Data\t\t[Undefined]" );
+        temp.Copy( KItem4 );
+        }
+    iInfoText->AppendL( temp );
+    CleanupStack::PopAndDestroy( opaqueData );
+
+    HBufC* dataType = CopyAndCropLC( aInfo->DataType() );
+    if  ( opaqueData->Length() )
+        {
+        _LIT( KItem5, "\tData Type\t\t%S" );
+        temp.Format( KItem5, dataType );
+        }
+    else
+        {
+        _LIT( KItem5, "\tData Type\t\t[Undefined]" );
+        temp.Copy( KItem5 );
+        }
+    iInfoText->AppendL( temp );
+    CleanupStack::PopAndDestroy( dataType );
+
+    _LIT( KItem6, "\tDrive\t\t%S" );
+    TBuf< 10 > drive;
+    const TDriveNumber driveNumber = static_cast< TDriveNumber >( static_cast< TInt >( aInfo->Drive() ) );
+    CMemSpyEngineHelperFileSystem::GetDriveNumberText( driveNumber, drive );
+    temp.Format( KItem6, &drive );
+    iInfoText->AppendL( temp );
+
+    if  ( aInfo->Disabled() )
+        {
+        iInfoText->AppendL( _L("\tIs Disabled\t\tYes") );
+        }
+    else
+        {
+        iInfoText->AppendL( _L("\tIs Disabled\t\tNo") );
+        }
+
+    if  ( aInfo->RomOnly() )
+        {
+        iInfoText->AppendL( _L("\tROM-Only\t\tYes") );
+        }
+    else
+        {
+        iInfoText->AppendL( _L("\tROM-Only\t\tNo") );
+        }
+    
+    if  ( aInfo->RomBased() )
+        {
+        iInfoText->AppendL( _L("\tROM-Based\t\tYes") );
+        }
+    else
+        {
+        iInfoText->AppendL( _L("\tROM-Based\t\tNo") );
+        }
+    
+    // Make caption
+    if  ( aInfo->DisplayName().Length() )
+        {
+        _LIT( KCaptionFormat, "\t0x%08x\t\t%S" );
+        temp.Format( KCaptionFormat, aInfo->ImplementationUid().iUid, &aInfo->DisplayName() );
+        }
+    else
+        {
+        _LIT( KCaptionFormat, "\t0x%08x\t\t[Name Undefined]" );
+        temp.Format( KCaptionFormat, aInfo->ImplementationUid().iUid );
+        }
+    iCaption = temp.AllocL();
+
+    // Must do this last
+    iInfo = aInfo;
+    }
+
+
+CMemSpyEngineEComImplementation* CMemSpyEngineEComImplementation::NewLC( CMemSpyEngineEComInterface& aInterface, CImplementationInformation* aInfo )
+    {
+    CMemSpyEngineEComImplementation* self = new(ELeave) CMemSpyEngineEComImplementation( aInterface );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInfo );
+    return self;
+    }
+
+
+HBufC* CMemSpyEngineEComImplementation::CopyAndCropLC( const TDesC8& aText )
+    {
+    const TInt KMaxEComDataLength = 200; // Any longer and we'll crop it...
+    //
+    HBufC* data = HBufC::NewLC( aText.Length() );
+    data->Des().Copy( aText );
+    //
+    if  ( data->Length() > KMaxEComDataLength )
+        {
+        data->Des().SetLength( KMaxEComDataLength );
+        }
+    //
+    return data;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineEComImplementation::MdcaCount() const
+    {
+    return iInfoText->MdcaCount();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineEComImplementation::MdcaPoint( TInt aIndex ) const
+    {
+    return iInfoText->MdcaPoint( aIndex );
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperFbServ.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1335 @@
+/*
+* 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 <memspy/engine/memspyenginehelperfbserv.h>
+
+// System includes
+#include <s32mem.h>
+#include <f32file.h>
+#include <e32rom.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+
+// Literal constants
+_LIT( KMemSpyEngineFBServComma, ", " );
+_LIT( KMemSpyEngineFBServExportFileName, "Image_%08x_%02d_bpp_(%d x %d).bmp");
+_LIT( KMemSpyEngineFBSLargeChunkName, "FbsLargeChunk" );
+_LIT( KMemSpyEngineFBSSharedChunkName, "FbsSharedChunk" );
+
+
+CMemSpyEngineHelperFbServ::CMemSpyEngineHelperFbServ( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+
+CMemSpyEngineHelperFbServ::~CMemSpyEngineHelperFbServ()
+    {
+    iEngine.Driver().WalkHeapClose();
+    }
+
+
+void CMemSpyEngineHelperFbServ::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperFbServ* CMemSpyEngineHelperFbServ::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperFbServ* self = new(ELeave) CMemSpyEngineHelperFbServ( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+TBool CMemSpyEngineHelperFbServ::IsLargeBitmapChunk( const TMemSpyDriverChunkInfo& aChunkInfo )
+    {
+    TBool ret = EFalse;
+    //
+    if  ( aChunkInfo.iType == EMemSpyDriverChunkTypeGlobal )
+        {
+        ret = ( aChunkInfo.iName.FindF( KMemSpyEngineFBSLargeChunkName ) >= 0 );
+        }
+    //
+    return ret;
+    }
+
+
+TBool CMemSpyEngineHelperFbServ::IsSharedBitmapChunk( const TMemSpyDriverChunkInfo& aChunkInfo )
+    {
+    TBool ret = EFalse;
+    //
+    if  ( aChunkInfo.iType == EMemSpyDriverChunkTypeGlobal )
+        {
+        ret = ( aChunkInfo.iName.FindF( KMemSpyEngineFBSSharedChunkName ) >= 0 );
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL( RArray<TInt>& aHandles )
+    {
+    TInt fontConCount = 0;
+    TInt bitmapConCount =0;
+    //RArray<TInt> dirtyHandles;
+    //CleanupClosePushL( dirtyHandles );
+    GetArrayOfBitmapHandlesL( aHandles, bitmapConCount, fontConCount );
+    //CleanupStack::PopAndDestroy( &dirtyHandles );
+    }
+
+
+void CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL( RArray<TInt>& aHandles, TInt& aBitmapConCount, TInt& aFontConCount )
+    {
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - START") );
+    CMemSpyThread& fbServThread = IdentifyFbServThreadL();
+
+    // Suspend the process
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - got FBServ thread, suspending it..."));
+    iEngine.ProcessSuspendLC( fbServThread.Process().Id() );
+
+    // Get the heap cell data for the correct object (CFbTop)
+    TAny* cellAddress = NULL;
+    HBufC8* cellData = LocateCFbTopHeapCellDataLC( fbServThread, cellAddress );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - got CFbTop cell data: %d bytes", cellData->Length()));
+
+    // Work out the offset to the bitmap address handles array
+    const TUint offsetBitmapCon = OffsetToCObjectConBitmapCon();
+    const TUint offsetFontCon = OffsetToCObjectConFontCon();
+    const TUint offsetHandleArray = OffsetToBitmapHandleArray();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - offsetBitmapCon:   %d", offsetBitmapCon ));
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - offsetFontCon:     %d", offsetFontCon ));
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - offsetHandleArray: %d", offsetHandleArray ));
+
+    // Create stream for reading heap data (makes life a bit easier).
+    RDesReadStream stream( *cellData );
+    CleanupClosePushL( stream );
+    
+    // We need to skip over the preamble to the start of the actual data.
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - skipping %d bytes [to start of bitmap con]...", offsetBitmapCon ));
+    (void) stream.ReadL( offsetBitmapCon ); // skip this much
+
+    // Read CFbTop::iBitmapCon cell address
+    TAny* cellAddresBitmapCon = reinterpret_cast<TAny*>( stream.ReadUint32L() );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - cellAddresBitmapCon: 0x%08x", cellAddresBitmapCon ));
+    TInt bitmapConAllocated = 0;
+    RArray<TAny*> bitmapConAddresses;
+    CleanupClosePushL( bitmapConAddresses );
+    ReadCObjectConInfoL( cellAddresBitmapCon, bitmapConAddresses, aBitmapConCount, bitmapConAllocated );
+    CleanupStack::PopAndDestroy( &bitmapConAddresses );
+
+    // Read CFbTop::iFontCon cell address
+    TAny* cellAddresFontCon = reinterpret_cast<TAny*>( stream.ReadUint32L() );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - cellAddresFontCon: 0x%08x", cellAddresFontCon ));
+    TInt fontConAllocated = 0;
+    RArray<TAny*> fontConAddresses;
+    CleanupClosePushL( fontConAddresses );
+    ReadCObjectConInfoL( cellAddresFontCon, fontConAddresses, aFontConCount, fontConAllocated );
+    CleanupStack::PopAndDestroy( &fontConAddresses );
+
+    // Skip forwards to the bitmap handle array info
+    const TUint skipRemaining = ( offsetHandleArray - offsetFontCon );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - skipRemaining: %d", skipRemaining ));
+    (void) stream.ReadL( skipRemaining ); // skip this much
+
+    // The layout of RPointerArrayBase is as follows:
+    //
+    //  TInt iCount;
+	//  TAny** iEntries;
+	//  TInt iAllocated;
+	//  TInt iGranularity;
+	//  TInt iSpare1;
+	//  TInt iSpare2;
+
+    // Now read the next 4 bytes. This is the number of allocated array entries.
+    const TInt arrayEntryCount = stream.ReadInt32L();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - arrayEntryCount: %d", arrayEntryCount ));
+
+    // The next four bytes are the address of the cell we are interested in.
+    cellAddress = reinterpret_cast<TAny*>( stream.ReadUint32L() );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - cellAddress: 0x%08x", cellAddress ));
+    
+    // The next four bytes are the allocated count
+    const TInt arrayAlloctedCount = stream.ReadInt32L();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - arrayAlloctedCount: %d", arrayAlloctedCount ));
+    
+    // Validate
+    if  ( arrayEntryCount > arrayAlloctedCount || arrayEntryCount < 0 || arrayAlloctedCount < 0 )
+        {
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - invalid array details => Leave with KErrCorrupt"));
+        User::Leave( KErrCorrupt );
+        }
+    
+    // Clean up - don't need this data anymore. Real data is in another cell
+    CleanupStack::PopAndDestroy( 2, cellData );  // stream & cellData
+
+    // Now obtain the heap cell data for the actual array itself.
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - trying to find bitmap array data..."));
+    cellData = LocateBitmapArrayHeapCellDataLC( cellAddress, arrayAlloctedCount );
+    
+    // Parse the cell data in order to obtain the bitmap handles.
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - trying to extract bitmap handles..."));
+    ParseCellDataAndExtractHandlesL( *cellData, aHandles, arrayEntryCount );
+    
+    // Tidy up
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - resuming process..."));
+    CleanupStack::PopAndDestroy( cellData );
+ 
+    // Close heap walker & resume process
+    iEngine.Driver().WalkHeapClose();
+    CleanupStack::PopAndDestroy();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetArrayOfBitmapHandlesL() - END"));
+    }
+
+
+void CMemSpyEngineHelperFbServ::GetBitmapInfoL( TInt aHandle, TMemSpyEngineFBServBitmapInfo& aInfo )
+    {
+    CFbsBitmap* bitmap = GetBitmapInfoLC( aHandle, aInfo );
+    CleanupStack::PopAndDestroy( bitmap );
+    }
+ 
+
+CFbsBitmap* CMemSpyEngineHelperFbServ::GetBitmapInfoLC( TInt aHandle, TMemSpyEngineFBServBitmapInfo& aInfo )
+    {
+    CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
+    CleanupStack::PushL( bitmap );
+    const TInt error = bitmap->Duplicate( aHandle );
+    User::LeaveIfError( error );
+
+    // Basic info from bitmap itself
+    aInfo.iHandle = aHandle;
+    aInfo.iDisplayMode = bitmap->DisplayMode();
+
+    // Extended info comes from header
+    const SEpocBitmapHeader header( bitmap->Header() );
+    
+    aInfo.iSizeInPixels = header.iSizeInPixels;
+    aInfo.iCompressionType = header.iCompression;
+    aInfo.iColor = header.iColor;
+    aInfo.iBitsPerPixel = header.iBitsPerPixel;
+    aInfo.iSizeInBytes = header.iBitmapSize;
+
+    // Flags
+    aInfo.iFlags = TMemSpyEngineFBServBitmapInfo::EFlagsNone;
+    if  ( bitmap->IsRomBitmap() )
+        {
+        aInfo.iFlags |= TMemSpyEngineFBServBitmapInfo::EFlagsIsRomBitmap;
+        }
+     if  ( bitmap->IsLargeBitmap() )
+        {
+        aInfo.iFlags |= TMemSpyEngineFBServBitmapInfo::EFlagsIsLarge;
+        }
+    if  ( bitmap->IsCompressedInRAM() )
+        {
+        aInfo.iFlags |= TMemSpyEngineFBServBitmapInfo::EFlagsIsCompressedInRam;
+        }
+    else
+        {
+        // Can only do this if not compressed
+        if  ( bitmap->IsMonochrome() )
+             {
+             aInfo.iFlags |= TMemSpyEngineFBServBitmapInfo::EFlagsIsMonochrome;
+             }
+        }
+ 
+    return bitmap;
+    }
+
+
+CMemSpyThread& CMemSpyEngineHelperFbServ::IdentifyFbServThreadL()
+    {
+    _LIT(KFbServThreadName, "FbServ::!Fontbitmapserver");
+    //
+    CMemSpyThread* thread = NULL;
+    CMemSpyProcess* process = NULL;
+
+    // Get the fbserv thread object
+    CMemSpyEngineObjectContainer& container = iEngine.Container();
+    User::LeaveIfError( container.ProcessAndThreadByFullName( KFbServThreadName, process, thread ) );
+    //
+    return *thread;
+    }
+
+
+HBufC8* CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC( CMemSpyThread& aFbServThread, TAny*& aCellAddress )
+    {
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - START"));
+
+    // We'll start looking for the CFbTop object at cell index 0, then we'll
+    // continue to a maximum of cell index 10. These are not actual allocation
+    // numbers, they are just cell indicies within FBServ's heap.
+    // Realistically, the cell should be the 7th.
+    const TInt KFbServWillingToStartAtCellIndex = 0;
+    const TInt KFbServWillingToSearchUntilCellIndex = 10;
+
+    // We know the size of the cell is pretty big, since it contains a large 
+    // hash-map object (4096 elements by default, 4 bytes big => 16k). We'll
+    // not try to retrieve more than 18k of data.
+    const TInt KFbServExpectedMinimumCellSize = 14*1024;
+    const TInt KFbServExpectedMaximumCellSize = 18*1024;
+
+    // This is what we'll return, if we find it...
+    aCellAddress = NULL;
+    HBufC8* heapCellData = NULL;
+
+    // Get the heap info - we need this for verification purposes
+    TMemSpyHeapInfo info;
+    TInt err = iEngine.Driver().GetHeapInfoUser( info, aFbServThread.Id() );
+    if ( err == KErrNone && info.Type() == TMemSpyHeapInfo::ETypeUnknown )
+        {
+        err = KErrNotSupported;
+        }
+    User::LeaveIfError( err );
+
+    // Now walk the heap!
+    err = iEngine.Driver().WalkHeapInit( aFbServThread.Id() );
+    if  ( err == KErrNone )
+        {
+        TMemSpyDriverCellType cellType;
+        TAny* cellAddress;
+        TInt cellLength;
+        TInt cellNestingLevel;
+        TInt cellAllocationNumber;
+        TInt cellHeaderSize;
+        TAny* cellPayloadAddress;
+        //
+        for( TInt cellIndex = KFbServWillingToStartAtCellIndex; err == KErrNone && cellIndex < KFbServWillingToSearchUntilCellIndex; cellIndex++ )
+            {
+            err = iEngine.Driver().WalkHeapNextCell( aFbServThread.Id(), cellType, cellAddress, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - cellIndex[%d] err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", cellIndex, err, cellLength, cellAllocationNumber, cellType));
+
+            if  ( err == KErrNone && (cellType & EMemSpyDriverAllocatedCellMask))
+                {
+                // We know we are looking for a relatively large *allocated* cell.
+                if  ( cellLength >= KFbServExpectedMinimumCellSize && cellLength <= KFbServExpectedMaximumCellSize )
+                    {
+                    const TInt payloadLength = cellLength;
+
+                    // This is *probably* the right cell. Let's get the data and check.
+                    HBufC8* data = HBufC8::NewLC( payloadLength );
+                    TPtr8 pData( data->Des() );
+                    //
+                    err = iEngine.Driver().WalkHeapReadCellData( cellAddress, pData, payloadLength );
+                    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - data fetch returned error: %d", err));
+
+                    if  ( err == KErrNone )
+                        {
+                        //_LIT(KHeapDumpDataFormat, "%S");
+                        //iEngine.Sink().OutputBinaryDataL( KHeapDumpDataFormat, pData.Ptr(), (const TUint8*) cellAddress, pData.Length() );
+                    
+                        // Check the data
+                        const TUint heapMaxSize = info.AsRHeap().MetaData().iMaxHeapSize;
+                        const TUint heapBaseAddress = (TUint) info.AsRHeap().MetaData().ChunkBaseAddress();
+                        const TBool correctHeapCellLocated = VerifyCorrectHeapCellL( *data, cellAddress, cellPayloadAddress, heapBaseAddress, heapMaxSize );
+                        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - verified: %d", correctHeapCellLocated));
+
+                        if  ( correctHeapCellLocated )
+                            {
+                            aCellAddress = cellAddress;
+                            heapCellData = data;
+                            CleanupStack::Pop( data );
+                            break;
+                            }
+                        else
+                            {
+                            // Not the right cell. Keep going...
+                            CleanupStack::PopAndDestroy( data );
+                            }
+                        }
+                    }
+                }
+            }
+
+        // NB: don't do this here - 
+        // iEngine.Driver().WalkHeapClose();
+        // It gets done after all reading is complete
+        }
+
+    if  ( heapCellData == NULL )
+        {
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - END - didn't find the right cell => KErrNotFound"));
+        User::Leave( KErrNotFound );
+        }
+    //
+    CleanupStack::PushL( heapCellData );
+
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - END - everything okay, cell is: 0x%08x", aCellAddress));
+    return heapCellData;
+    }
+
+
+void CMemSpyEngineHelperFbServ::ReadCObjectConInfoL( TAny* aCellAddress, RArray<TAny*>& aContainerObjects, TInt& aCount, TInt& aAllocated )
+    {
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - START - trying cell: 0x%08x", aCellAddress ));
+
+    // What we will return
+    HBufC8* cellData = NULL;
+    
+    // Try to get info about real cell
+    TMemSpyDriverCellType cellType;
+    TInt cellLength;
+    TInt cellNestingLevel;
+    TInt cellAllocationNumber;
+    TInt cellHeaderSize;
+    TAny* cellPayloadAddress;
+
+    // NOTE: this call may change the value of 'cellAddress'
+    TInt err = iEngine.Driver().WalkHeapGetCellInfo( aCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - err: %d, cellAddress: 0x%08x, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, aCellAddress, cellLength, cellAllocationNumber, cellType));
+
+	if (err == KErrNone && (cellType & EMemSpyDriverAllocatedCellMask))
+        {
+        // Check that the cell size meets our expectations - it should be a CObjectCon cell.
+        const TInt expectedCellSize = sizeof(CObjectCon*) + cellHeaderSize;
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - expectedCellSize: %d, actual: %d, address: 0x%08x", expectedCellSize, cellLength, aCellAddress));
+
+        if  ( expectedCellSize <= cellLength )
+            {
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - cell lengths are good, trying to get cell data..."));
+
+            // Try to get real cell data        
+            cellData = HBufC8::NewLC( cellLength );
+            TPtr8 pData( cellData->Des() );
+            //
+            err = iEngine.Driver().WalkHeapReadCellData( aCellAddress, pData, cellLength );
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - reading cell data returned error: %d", err));
+            }
+        else
+            {
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - not enough data -> KErrCorrupt"));
+            err = KErrCorrupt;
+            }
+        }
+    else
+        {
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - END - didn't find cell data => KErrNotFound"));
+        User::Leave( KErrNotFound );
+        }
+
+    CObjectCon* con = CObjectCon::NewL();
+    const TUint32 KExpectedObjectConVTable = *((TUint32*) con);
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - KExpectedObjectConVTable: 0x%08x", KExpectedObjectConVTable ));
+    delete con;
+
+    // We should have the valid CObjectCon data now.
+    RDesReadStream stream( *cellData );
+    CleanupClosePushL( stream );
+    
+    // Read vtable
+    const TUint32 vTable = stream.ReadUint32L();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - actual vTable: 0x%08x", vTable ));
+    if  ( vTable != KExpectedObjectConVTable )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    const TInt uniqueId = stream.ReadInt32L();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - uniqueId: %d", uniqueId ));
+
+    aCount = stream.ReadInt32L();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - aCount: %d", aCount ));
+
+    aAllocated = stream.ReadInt32L();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - aAllocated: %d", aAllocated ));
+
+    // This is actually CObject's iObject, i.e. CObject** iObjects.
+    TAny* pObjects = reinterpret_cast< TAny*>( stream.ReadUint32L() );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - pObjects: 0x%08x", pObjects ));
+
+    CleanupStack::PopAndDestroy( 2, cellData ); // cellData & stream
+
+    // Now fetch the cell containing the CObject pointers...
+    err = iEngine.Driver().WalkHeapGetCellInfo( pObjects, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - array of CObject* cell fetch err: %d, cellAddress: 0x%08x, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, aCellAddress, cellLength, cellAllocationNumber, cellType));
+    User::LeaveIfError( err );
+
+    const TInt expectedSize = ( aAllocated * sizeof(CObject*) ) + cellHeaderSize;
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - expectedSize: %d, actual size: %d", expectedSize, cellLength ));
+    if  ( cellLength < expectedSize )
+        {
+        User::Leave( KErrUnderflow );
+        }
+    
+    // Get the data
+    cellData = HBufC8::NewLC( cellLength );
+    TPtr8 pData( cellData->Des() );
+    err = iEngine.Driver().WalkHeapReadCellData( pObjects, pData, cellLength );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - reading cell data returned error: %d", err));
+    User::LeaveIfError( err );
+
+    // Open stream
+    stream.Open( *cellData );
+    CleanupClosePushL( stream );
+
+    // Extract array of pointers
+    for( TInt i=0; i<aCount; i++ )
+        {
+        TAny* objectAddress = reinterpret_cast< TAny*>( stream.ReadUint32L() );
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - object[%04d]: 0x%08x", i, objectAddress ));
+        aContainerObjects.AppendL( objectAddress );
+        }
+    CleanupStack::PopAndDestroy( 2, cellData ); // cellData & stream
+
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ReadCObjectConInfoL() - END" ));
+    }
+
+
+HBufC8* CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC( TAny*& aArrayCellAddress, TInt aArrayAllocCount )
+    {
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - START - trying cell: 0x%08x, aArrayAllocCount: %d", aArrayCellAddress, aArrayAllocCount));
+
+    // What we will return
+    HBufC8* cellData = NULL;
+    
+    // Try to get info about real cell
+    TMemSpyDriverCellType cellType;
+    TInt cellLength;
+    TInt cellNestingLevel;
+    TInt cellAllocationNumber;
+    TInt cellHeaderSize;
+    TAny* cellPayloadAddress;
+
+    // NOTE: this call may change the value of 'cellAddress'
+    TInt err = iEngine.Driver().WalkHeapGetCellInfo( aArrayCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateCFbTopHeapCellDataLC() - err: %d, cellAddress: 0x%08x, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, aArrayCellAddress, cellLength, cellAllocationNumber, cellType));
+
+    if (err == KErrNone && (cellType & EMemSpyDriverAllocatedCellMask))
+        {
+        // Check that the cell size meets our expectations. 
+        // The cell should be a very specific length
+        const TInt expectedCellSize = (sizeof(CBase*) * aArrayAllocCount) + cellHeaderSize;
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - expectedCellSize: %d, actual: %d, address: 0x%08x", expectedCellSize, cellLength, aArrayCellAddress));
+
+        if  ( expectedCellSize <= cellLength )
+            {
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - cell lengths are good, trying to get cell data..."));
+
+            // Try to get real cell data        
+            cellData = HBufC8::NewLC( cellLength );
+            TPtr8 pData( cellData->Des() );
+            //
+            err = iEngine.Driver().WalkHeapReadCellData( aArrayCellAddress, pData, cellLength );
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - reading cell data returned error: %d", err));
+            }
+        else
+            {
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - not enough data -> KErrCorrupt"));
+            err = KErrCorrupt;
+            }
+        }
+    //
+    if  ( cellData == NULL )
+        {
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - END - didn't find cell data => KErrNotFound"));
+        err = KErrNotFound;
+        }
+    User::LeaveIfError( err );
+    //
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::LocateBitmapArrayHeapCellDataLC() - END - ok! - got %d bytes", cellData->Length() ) );
+    return cellData;
+    }
+
+
+void CMemSpyEngineHelperFbServ::ParseCellDataAndExtractHandlesL( const TDesC8& aData, RArray<TInt>& aHandles, TInt aArrayEntryCount )
+    {
+    aHandles.Reset();
+    
+    // Create read stream
+    RDesReadStream stream( aData );
+    CleanupClosePushL( stream );
+    
+    for( TInt i=0; i<aArrayEntryCount; i++ )
+        {
+        const TInt handle = stream.ReadInt32L();
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::ParseCellDataAndExtractHandlesL() - handle[%4d] = 0x%08x", i, handle));
+        aHandles.AppendL( handle );
+        }
+    
+    // Tidy up
+    CleanupStack::PopAndDestroy( &stream );
+    }
+
+
+TBool CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL( const TDesC8& aData, TAny* aCellAddress, TAny* aPayloadAddress, TUint aHeapStartingAddress, TUint aHeapMaxSize )
+    {
+    (void) aPayloadAddress;
+    (void) aCellAddress;
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - START - aDataLen: %d, aCellAddress: 0x%08x, aPayloadAddress: 0x%08x, aHeapStartingAddress: 0x%08x, aHeapSize: %d", aData.Length(), aCellAddress, aPayloadAddress, aHeapStartingAddress, aHeapMaxSize ));
+
+    const TUint KFbServHeapCeilingAddress = aHeapStartingAddress + aHeapMaxSize;
+
+    // Whether we can use this cell's data...
+    TBool correctCell = EFalse;
+
+    // We can use certain knowledge of the layout of the cell to work out
+    // if we've found the right one. 
+    // 
+    // This is fragile because of the font and bitmap server heap layout changes 
+    // significantly, then this can break.
+    RDesReadStream reader( aData );
+    CleanupClosePushL( reader );
+
+    // Get vtable address
+    TUint address = reader.ReadUint32L();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - suspected vtable: 0x%08x", address));
+
+#ifdef __EPOC32__
+    TBool isROMAddress = EFalse;
+    TInt err = User::IsRomAddress( isROMAddress, (TAny*) address );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - vtable (0x%08x) is in ROM: %d (error: %d)", address, isROMAddress, err));
+    User::LeaveIfError( err );
+
+    if  ( !isROMAddress )
+        {
+        // Close stream
+        CleanupStack::PopAndDestroy( &reader );
+
+        // VTable value should be in the ROM range.
+        correctCell = EFalse;
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - END - suspected CFbTop vTable isn't in ROM address range! - correctCell: %d", correctCell));
+        return correctCell;
+        }
+#else
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - skipping vtable: 0x%08x", address));
+#endif
+
+    // First real item is an RFs object instance. We can't check this
+    // very easily because its an embedded object-> We must skip it
+    __ASSERT_ALWAYS( sizeof(RFs) == 4, User::Invariant() );
+    address = reader.ReadUint32L();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - skipping RFs: 0x%08x", address));
+
+    // Next object is an address (CFontStore* iFontStore). We can validate this against
+    // the method arguments.
+    address = reader.ReadUint32L();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - iFontStore: 0x%08x", address));
+
+    if  ( address > aHeapStartingAddress && address < KFbServHeapCeilingAddress )
+        {
+        // Next comes another pointer (CObjectCon* iBitmapCon)
+        address = reader.ReadUint32L();
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - iBitmapCon: 0x%08x", address));
+
+        if  ( address > aHeapStartingAddress && address < KFbServHeapCeilingAddress )
+            {
+            // Next another pointer (CObjectCon* iFontCon)
+            address = reader.ReadUint32L();
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - iFontCon: 0x%08x", address));
+
+            if  ( address > aHeapStartingAddress && address < KFbServHeapCeilingAddress )
+                {
+                // And finally, yet another pointer (RHeap* iHeap)
+                address = reader.ReadUint32L();
+                TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - iHeap: 0x%08x", address));
+
+                if  ( address > aHeapStartingAddress && address < KFbServHeapCeilingAddress )
+                    {
+                    // That'll do.
+                    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - data seems okay!"));
+                    correctCell = ETrue;
+                    }
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &reader );
+    //
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::VerifyCorrectHeapCellL() - END - correctCell: %d", correctCell));
+    return correctCell;
+    }
+
+
+TUint CMemSpyEngineHelperFbServ::OffsetToCObjectConBitmapCon()
+    {
+    TUint ret = 0;
+
+    // VTable
+    ret += 4;
+
+    // RFs
+    ret += sizeof(RFs);
+
+	// CFontStore* iFontStore;
+    ret += sizeof(CBase*); // best effort
+
+    return ret;
+    }
+
+
+TUint CMemSpyEngineHelperFbServ::OffsetToCObjectConFontCon()
+    {
+    TUint ret = OffsetToCObjectConBitmapCon();
+
+	// CObjectCon* iBitmapCon;
+    ret += sizeof(CObjectCon*);
+
+    return ret;
+    }
+
+
+TUint CMemSpyEngineHelperFbServ::OffsetToBitmapHandleArray()
+    {
+    TUint ret = OffsetToCObjectConFontCon();
+
+	// CObjectConIx* iConIx;
+    ret += sizeof(CObjectConIx*);
+
+	// RHeap* iHeap;
+    ret += sizeof(RHeap*);
+
+	// RChunk iChunk
+    ret += sizeof(RChunk);
+
+	// RChunk iLargeBitmapChunk
+    ret += sizeof(RChunk);
+
+	// RMutex iLargeBitmapAccess
+    ret += sizeof(RMutex);
+
+	// CChunkPile* iPile;
+    ret += sizeof(CBase*); // best effort
+
+	// RPointerArray<HBufC> iFontNameAlias;
+    ret += sizeof(RPointerArray<HBufC>);
+	
+    return ret;
+    }
+
+
+CMemSpyEngineHelperFbServ::CBitmapObject* CMemSpyEngineHelperFbServ::GetBitmapObjectLC( TAny* aCellAddress )
+    {
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - START - aCellAddress: 0x%08x", aCellAddress ));
+
+    // What we will return
+    CBitmapObject* object = new(ELeave) CBitmapObject();
+    CleanupStack::PushL( object );
+
+    // The data we will read
+    HBufC8* cellData = NULL;
+    
+    // Try to get info about real cell
+    TMemSpyDriverCellType cellType;
+    TInt cellLength;
+    TInt cellNestingLevel;
+    TInt cellAllocationNumber;
+    TInt cellHeaderSize;
+    TAny* cellPayloadAddress;
+
+    // NOTE: this call may change the value of 'cellAddress'
+    TInt err = iEngine.Driver().WalkHeapGetCellInfo( aCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - err: %d, cellAddress: 0x%08x, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, aCellAddress, cellLength, cellAllocationNumber, cellType));
+
+    if (err == KErrNone && (cellType & EMemSpyDriverAllocatedCellMask))
+        {
+        // Check that the cell size meets our expectations - it should be a CBitmapObject, but without the additional "this" pointer
+        // which we have tacked onto the object.
+        const TInt expectedCellSize = sizeof( CBitmapObject ) + cellHeaderSize - sizeof( CBitmapObject* );
+        TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - expectedCellSize: %d, actual: %d, address: 0x%08x", expectedCellSize, cellLength, aCellAddress));
+
+        if  ( expectedCellSize <= cellLength )
+            {
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - cell lengths are good, trying to get cell data..."));
+
+            // Try to get real cell data        
+            cellData = HBufC8::NewLC( cellLength );
+            TPtr8 pData( cellData->Des() );
+            //
+            err = iEngine.Driver().WalkHeapReadCellData( aCellAddress, pData, cellLength );
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - reading cell data returned error: %d", err));
+            }
+        else
+            {
+            TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - not enough data -> KErrCorrupt"));
+            err = KErrCorrupt;
+            }
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    RDesReadStream stream( *cellData );
+    CleanupClosePushL( stream );
+    
+    // Read vtable
+    const TUint32 vTable = stream.ReadUint32L();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - actual vTable: 0x%08x", vTable ));
+    TBool isROMAddress = EFalse;
+    err = User::IsRomAddress( isROMAddress, (TAny*) vTable );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - vtable (0x%08x) is in ROM: %d (error: %d)", vTable, isROMAddress, err));
+    User::LeaveIfError( err );
+
+    // Skip CObject members
+    (void) stream.ReadL( sizeof( CObject ) ); // skip this much
+    object->iThisPointer = reinterpret_cast< CBitmapObject* >( cellPayloadAddress );;
+    object->iTop = reinterpret_cast< CBase* >( stream.ReadUint32L() );
+    object->iAddressPointer = reinterpret_cast< CBitwiseBitmap* >( stream.ReadUint32L() );
+    object->iHandle = stream.ReadInt32L();
+    object->iCleanBitmap = reinterpret_cast< CBitmapObject* >( stream.ReadUint32L() );
+
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - object->iThisPointer:    0x%08x", object->iThisPointer ));
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - object->iTop:            0x%08x", object->iTop ));
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - object->iAddressPointer: 0x%08x", object->iAddressPointer ));
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - object->iHandle:         0x%08x", object->iHandle ));
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - object->iCleanBitmap:    0x%08x", object->iCleanBitmap ));
+    
+    // Clean up - don't need this data anymore. Real data is in another cell
+    CleanupStack::PopAndDestroy( 2, cellData );  // stream & cellData
+
+    TRACE( RDebug::Printf("CMemSpyEngineHelperFbServ::GetBitmapObjectLC() - END - aCellAddress: 0x%08x", aCellAddress ));
+    return object;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineFbServBitmapArray::CMemSpyEngineFbServBitmapArray( const RArray<TInt>& aBitmapHandles )
+:   CActive( CActive::EPriorityIdle ), iBitmapHandles( aBitmapHandles ), iGranularity( 0 )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+CMemSpyEngineFbServBitmapArray::CMemSpyEngineFbServBitmapArray( TInt aPriority, const RArray<TInt>& aBitmapHandles, MMemSpyEngineFbSerbBitmapArrayObserver& aObserver, TInt aGranularity )
+:   CActive( aPriority ), iBitmapHandles( aBitmapHandles ), iObserver( &aObserver ), iGranularity( aGranularity )
+    {
+    CActiveScheduler::Add( this );
+    CompleteSelf();
+    }
+
+
+EXPORT_C CMemSpyEngineFbServBitmapArray::~CMemSpyEngineFbServBitmapArray()
+    {
+    Cancel();
+    //
+    iBitmaps.ResetAndDestroy();
+    iBitmaps.Close();
+    }
+
+
+void CMemSpyEngineFbServBitmapArray::ConstructL()
+    {
+    if  ( !IsActive() )
+        {
+        // Sync construction...
+        const TInt count = iBitmapHandles.Count();
+        for(TInt i=0; i<count; i++ )
+            {
+            const TInt handle = iBitmapHandles[ i ];
+            //
+            TRAP_IGNORE( CreateBitmapL( handle ) );
+            }
+    
+        SortBySizeL();
+        }
+    }
+
+
+EXPORT_C CMemSpyEngineFbServBitmapArray* CMemSpyEngineFbServBitmapArray::NewL( const RArray<TInt>& aBitmapHandles )
+    {
+    CMemSpyEngineFbServBitmapArray* self = new(ELeave) CMemSpyEngineFbServBitmapArray( aBitmapHandles );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C CMemSpyEngineFbServBitmapArray* CMemSpyEngineFbServBitmapArray::NewL( TInt aPriority, const RArray<TInt>& aBitmapHandles, MMemSpyEngineFbSerbBitmapArrayObserver& aObserver, TInt aGranularity )
+    {
+    CMemSpyEngineFbServBitmapArray* self = new(ELeave) CMemSpyEngineFbServBitmapArray( aPriority, aBitmapHandles, aObserver, aGranularity );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineFbServBitmapArray::Count() const
+    {
+    return iBitmaps.Count();
+    }
+
+
+EXPORT_C CMemSpyEngineFbServBitmap& CMemSpyEngineFbServBitmapArray::At( TInt aIndex )
+    {
+    return *iBitmaps[ aIndex ];
+    }
+
+
+EXPORT_C const CMemSpyEngineFbServBitmap& CMemSpyEngineFbServBitmapArray::At( TInt aIndex ) const
+    {
+    return *iBitmaps[ aIndex ];
+    }
+
+
+EXPORT_C CMemSpyEngineFbServBitmap& CMemSpyEngineFbServBitmapArray::BitmapByHandleL( TInt aHandle )
+    {
+    const TInt index = BitmapIndexByHandle( aHandle );
+    User::LeaveIfError( index );
+    CMemSpyEngineFbServBitmap& ret = At( index );
+    return ret;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineFbServBitmapArray::BitmapIndexByHandle( TInt aHandle ) const
+    {
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineFbServBitmap& bitmap = At( i );
+        //
+        if  ( bitmap.Handle() == aHandle )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineFbServBitmapArray::MdcaCount() const
+    {
+    return Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineFbServBitmapArray::MdcaPoint( TInt aIndex ) const
+    {
+    const CMemSpyEngineFbServBitmap& bitmap = At( aIndex );
+    return TPtrC( bitmap.Caption() );
+    }
+
+
+void CMemSpyEngineFbServBitmapArray::RunL()
+    {
+    const TInt bitmapHandleCount = iBitmapHandles.Count();
+    const TInt endIndex = Min( iIndex + iGranularity, bitmapHandleCount );
+    //
+    for( ; iIndex < endIndex; iIndex++ )
+        {
+        const TInt handle = iBitmapHandles[ iIndex ];
+        //
+        TRAP_IGNORE( CreateBitmapL( handle ) );
+        }
+    
+    // Report progress & queue for next iteration
+    MMemSpyEngineFbSerbBitmapArrayObserver::TEvent event = MMemSpyEngineFbSerbBitmapArrayObserver::EBitmapArrayConstructionComplete;
+    if  ( endIndex < bitmapHandleCount )
+        {
+        CompleteSelf();
+        event = MMemSpyEngineFbSerbBitmapArrayObserver::EBitmapItemsCreated;
+        }
+    else
+        {
+        SortBySizeL();
+        }
+
+    if  ( iObserver )
+        {
+        iObserver->HandleFbServBitmapArrayEventL( event );
+        }
+    }
+
+
+void CMemSpyEngineFbServBitmapArray::DoCancel()
+    {
+    // Nothing to do
+    }
+
+
+TInt CMemSpyEngineFbServBitmapArray::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+
+void CMemSpyEngineFbServBitmapArray::CompleteSelf()
+    {
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+    SetActive();
+    }
+
+
+void CMemSpyEngineFbServBitmapArray::CreateBitmapL( TInt aHandle )
+    {
+    CMemSpyEngineFbServBitmap* bitmap = CMemSpyEngineFbServBitmap::NewLC( aHandle );
+    iBitmaps.AppendL( bitmap );
+    CleanupStack::Pop( bitmap );
+    }
+
+
+void CMemSpyEngineFbServBitmapArray::SortBySizeL()
+    {
+    TLinearOrder< CMemSpyEngineFbServBitmap > comparer( CompareBySize );
+    iBitmaps.Sort( comparer );
+    }
+
+
+TInt CMemSpyEngineFbServBitmapArray::CompareBySize( const CMemSpyEngineFbServBitmap& aLeft, const CMemSpyEngineFbServBitmap& aRight )
+    {
+    TInt ret = 1;
+    //
+    if  ( aLeft.BitmapSizeInBytes() > aRight.BitmapSizeInBytes() )
+        {
+        ret = -1;
+        }
+    else if ( aLeft.BitmapSizeInBytes() == aRight.BitmapSizeInBytes() )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineFbServBitmap::CMemSpyEngineFbServBitmap()
+:   CDesCArrayFlat( 5 )
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineFbServBitmap::~CMemSpyEngineFbServBitmap()
+    {
+    delete iBitmap;
+    delete iCaption;
+    }
+
+
+void CMemSpyEngineFbServBitmap::ConstructL( TInt aHandle )
+    {
+    iBitmap = new(ELeave) CFbsBitmap();
+    const TInt error = iBitmap->Duplicate( aHandle );
+    User::LeaveIfError( error );
+    const SEpocBitmapHeader header( iBitmap->Header() );
+
+    // Prepare caption
+    _LIT( KCaptionFormat, "\t%2d bpp, %S\t\t%4d x %4d pixels" );
+    iCaption = HBufC::NewL( 128 );
+    TPtr pCaption( iCaption->Des() );
+    
+    // Create size string
+    const TMemSpySizeText size( MemSpyEngineUtils::FormatSizeText( header.iBitmapSize ) );
+    pCaption.AppendFormat( KCaptionFormat, header.iBitsPerPixel, &size, header.iSizeInPixels.iWidth, header.iSizeInPixels.iHeight );
+
+    // Prepare items
+    PrepareItemsL();
+    }
+
+
+EXPORT_C CMemSpyEngineFbServBitmap* CMemSpyEngineFbServBitmap::NewLC( TInt aHandle )
+    {
+    CMemSpyEngineFbServBitmap* self = new(ELeave) CMemSpyEngineFbServBitmap();
+    CleanupStack::PushL( self );
+    self->ConstructL( aHandle );
+    return self;
+    }
+
+
+TInt CMemSpyEngineFbServBitmap::BitmapSizeInBytes() const
+    {
+    const SEpocBitmapHeader header( iBitmap->Header() );
+    return header.iBitmapSize;
+    }
+
+
+EXPORT_C const TDesC& CMemSpyEngineFbServBitmap::Caption() const
+    {
+    return *iCaption;
+    }
+
+
+EXPORT_C CFbsBitmap& CMemSpyEngineFbServBitmap::Bitmap()
+    {
+    return *iBitmap;
+    }
+
+
+EXPORT_C const CFbsBitmap& CMemSpyEngineFbServBitmap::Bitmap() const
+    {
+    return *iBitmap;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineFbServBitmap::Handle() const
+    {
+    return iBitmap->Handle();
+    }
+
+
+EXPORT_C void CMemSpyEngineFbServBitmap::OutputDataL( CMemSpyEngine& aEngine ) const
+    {
+    const SEpocBitmapHeader header( iBitmap->Header() );
+    //
+    _LIT(KMemSpyFBServHex, "0x%08x");
+    _LIT(KMemSpyFBServDecimal, "%d");
+    //
+    HBufC* columns = HBufC::NewLC( 1024 );
+    TPtr pColumns( columns->Des() );
+    //
+    pColumns.AppendFormat( KMemSpyFBServHex, Handle() );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    pColumns.AppendFormat( KMemSpyFBServDecimal, header.iBitmapSize );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    pColumns.AppendFormat( KMemSpyFBServDecimal, header.iSizeInPixels.iWidth );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    pColumns.AppendFormat( KMemSpyFBServDecimal, header.iSizeInPixels.iHeight );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    pColumns.AppendFormat( KMemSpyFBServDecimal, header.iBitsPerPixel );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    pColumns.AppendFormat( KMemSpyFBServDecimal, header.iColor );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    TBuf<24> fileCompressionType;
+    GetFileCompressionTypeAsString( header.iCompression, fileCompressionType );
+    pColumns.Append( fileCompressionType );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    GetExportableFileNameL( pColumns );
+    //
+    aEngine.Sink().OutputLineL( pColumns );
+    CleanupStack::PopAndDestroy( columns );
+    }
+
+
+EXPORT_C void CMemSpyEngineFbServBitmap::OutputDataColumnsL( CMemSpyEngine& aEngine )
+    {
+    HBufC* columns = HBufC::NewLC( 1024 );
+    TPtr pColumns( columns->Des() );
+    //
+    _LIT(KCol1, "Handle");
+    pColumns.Append( KCol1 );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    _LIT(KCol2, "Uncompressed Size (Bytes)");
+    pColumns.Append( KCol2 );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    _LIT(KCol3, "Width");
+    pColumns.Append( KCol3 );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    _LIT(KCol4, "Height");
+    pColumns.Append( KCol4 );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    _LIT(KCol5, "BPP");
+    pColumns.Append( KCol5 );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    _LIT(KCol6, "Color");
+    pColumns.Append( KCol6 );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    _LIT(KCol7, "Compression");
+    pColumns.Append( KCol7 );
+    pColumns.Append( KMemSpyEngineFBServComma );
+    //
+    _LIT(KCol8, "File Name");
+    pColumns.Append( KCol8 );
+    //
+    aEngine.Sink().OutputLineL( pColumns );
+    CleanupStack::PopAndDestroy( columns );
+    }
+
+
+EXPORT_C void CMemSpyEngineFbServBitmap::GetExportableFileNameL( TDes& aAppendName ) const
+    {
+    const SEpocBitmapHeader header( iBitmap->Header() );
+
+    // Create a filename
+    aAppendName.AppendFormat( KMemSpyEngineFBServExportFileName, Handle(), header.iBitsPerPixel, header.iSizeInPixels.iWidth, header.iSizeInPixels.iHeight );
+    }
+
+
+void CMemSpyEngineFbServBitmap::GetExportableFileNameL( const TMemSpyEngineFBServBitmapInfo& aInfo, TDes& aAppendName )
+    {
+    aAppendName.AppendFormat( KMemSpyEngineFBServExportFileName, aInfo.iHandle, aInfo.iBitsPerPixel, aInfo.iSizeInPixels.iWidth, aInfo.iSizeInPixels.iHeight );
+    }
+
+
+void CMemSpyEngineFbServBitmap::PrepareItemsL()
+    {
+    const SEpocBitmapHeader header( iBitmap->Header() );
+    TBuf<256> item;
+
+    // View bitmap (ugly, but needed by UI)
+    _LIT(KCaptionMinus2, "\tView Bitmap\t\t");
+    AppendL( KCaptionMinus2 );
+
+    // Dimensions
+    _LIT(KCaptionMinus1, "\tDimensions\t\t%5d x %5d");
+    item.Format( KCaptionMinus1, header.iSizeInPixels.iWidth, header.iSizeInPixels.iHeight );
+    AppendL( item );
+
+    // Handle
+    _LIT(KCaption0, "\tHandle\t\t0x%08x");
+    item.Format( KCaption0, iBitmap->Handle() );
+    AppendL( item );
+
+    // In Rom?
+    _LIT(KCaption1, "\tIn ROM?\t\t%S");
+    _LIT(KIsRomBitmap, "Yes");
+    _LIT(KNotRomBitmap, "No");
+    if  ( iBitmap->IsRomBitmap() )
+        {
+        item.Format( KCaption1, &KIsRomBitmap );
+        }
+    else
+        {
+        item.Format( KCaption1, &KNotRomBitmap );
+        }
+    AppendL( item );
+
+    // Bits per pixel
+    _LIT(KCaption2, "\tBits Per Pixel\t\t%2d");
+    item.Format( KCaption2, header.iBitsPerPixel );
+    AppendL( item );
+
+    // Size of uncompressed bitmap data
+    _LIT(KCaption3, "\tUncompressed data size\t\t%S");
+    const TMemSpySizeText sizeStringUncompressed( MemSpyEngineUtils::FormatSizeText( header.iBitmapSize ) );
+    item.Format( KCaption3, &sizeStringUncompressed );
+    AppendL( item );
+
+    // Palette entry count
+    _LIT(KCaption4, "\tNumber of palette entries\t\t%d");
+    item.Format( KCaption4, header.iPaletteEntries );
+    AppendL( item );
+
+    // Colour
+    _LIT(KCaption5, "\tColour\t\t%d");
+    item.Format( KCaption5, header.iColor);
+    AppendL( item );
+
+    // Palette entry count
+    _LIT(KCaption6, "\tFile compression type\t\t%S");
+    TBuf<24> fileCompressionType;
+    GetFileCompressionTypeAsString( header.iCompression, fileCompressionType );
+    item.Format( KCaption6, &fileCompressionType );
+    AppendL( item );
+    }
+
+
+void CMemSpyEngineFbServBitmap::GetFileCompressionTypeAsString( TBitmapfileCompression aType, TDes& aString )
+    {
+    _LIT(KUnknown, "Unknown");
+    _LIT(KNoCompression, "None");
+    _LIT(KRLE, "RLE");
+    _LIT(KTwelveBitRLE, "12-bit RLE");
+    _LIT(KSixteenBitRLE, "16-bit RLE");
+    _LIT(KTwentyFourBitRLE, "24-bit RLE");
+    _LIT(KThirtyTwoBitRLE, "32-bit RLE");
+    //
+    switch( aType )
+        {
+    case ENoBitmapCompression:
+        aString = KNoCompression;
+        break;
+    case EByteRLECompression:
+        aString = KRLE;
+        break;
+    case ETwelveBitRLECompression:
+        aString = KTwelveBitRLE;
+        break;
+    case ESixteenBitRLECompression:
+        aString = KSixteenBitRLE;
+        break;
+    case ETwentyFourBitRLECompression:
+        aString = KTwentyFourBitRLE;
+        break;
+    case EThirtyTwoUBitRLECompression:
+        aString = KThirtyTwoBitRLE;
+        break;
+    default:
+    case ERLECompressionLast:
+        aString = KUnknown;
+        break;
+        }
+    }
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperFileSystem.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1191 @@
+/*
+* 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 <memspy/engine/memspyenginehelperfilesystem.h>
+
+// System includes
+#include <f32file.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include "MemSpyEngineOutputListItem.h"
+
+// Remap of E32 constant since this value only exists in recent v9.3 builds and MemSpy needs to build on v9.1
+const TUint KMemSpyDriveAttPageable = 0x100; // KDriveAttPageable
+const TUint KMemSpyMediaAttPageable = 0x200; // KMediaAttPageable
+
+// Literal constants
+_LIT( KMemSpyVolumeLabelNotSet, "None" );
+
+
+CMemSpyEngineHelperFileSystem::CMemSpyEngineHelperFileSystem( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperFileSystem::~CMemSpyEngineHelperFileSystem()
+    {
+    }
+
+
+void CMemSpyEngineHelperFileSystem::ConstructL()
+    {
+    iFileServerProcessId = MemSpyEngineUtils::IdentifyFileServerProcessIdL();
+    }
+
+
+CMemSpyEngineHelperFileSystem* CMemSpyEngineHelperFileSystem::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperFileSystem* self = new(ELeave) CMemSpyEngineHelperFileSystem( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C CMemSpyEngineDriveList* CMemSpyEngineHelperFileSystem::DriveListL()
+    {
+    CMemSpyEngineDriveList* list = CMemSpyEngineDriveList::NewLC( iEngine.FsSession() );
+    CleanupStack::Pop( list );
+    return list;
+    }
+
+
+EXPORT_C TDriveNumber CMemSpyEngineHelperFileSystem::GetSystemDrive()
+    {
+    TDriveNumber ret = EDriveC;
+#ifndef __WINS__
+    const TInt KRFsGetSystemDriveOrdinal = 336;
+    typedef TDriveNumber(*TRFsGetSystemDriveFunc)();
+    //
+    RLibrary lib;
+    const TInt loadErr = lib.Load( _L("EFSRV.DLL") );
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineHelperFileSystem::GetSystemDrive() - dll load: %d", loadErr );
+#endif
+    if  ( loadErr == KErrNone )
+        {
+        TLibraryFunction ordinal = lib.Lookup( KRFsGetSystemDriveOrdinal );
+#ifdef _DEBUG
+        RDebug::Printf( "CMemSpyEngineHelperFileSystem::GetSystemDrive() - ordinal: 0x%08x", ordinal );
+#endif
+        //
+        if  ( ordinal )
+            {
+            TRFsGetSystemDriveFunc func = (TRFsGetSystemDriveFunc) ordinal;
+            ret = (*func)();
+#ifdef _DEBUG
+            RDebug::Printf( "CMemSpyEngineHelperFileSystem::GetSystemDrive() - drive: %c:\\", 'A' + ret);
+#endif
+            }
+        //
+        lib.Close();
+        }
+#endif
+    //
+    return ret;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperFileSystem::ListOpenFilesL()
+    {
+    TOpenFileScan scanner( iEngine.FsSession() );
+
+    _LIT( KMemSpyContext, "Open File Listing" );
+    _LIT( KMemSpyFolder, "OpenFiles" );
+    iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
+
+    _LIT(KHeading, "OPEN FILES");
+    iEngine.Sink().OutputSectionHeadingL( KHeading, '=' );
+    
+    // Set prefix for overall listing
+    _LIT(KOverallPrefix, "OpenFiles - ");
+    iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
+
+    CFileList* list = NULL;
+    scanner.NextL( list );
+    while( list != NULL )
+        {
+        CleanupStack::PushL( list );
+        ListOpenFilesL( *list, scanner.ThreadId() );
+        CleanupStack::PopAndDestroy( list );
+        //
+        list = NULL;
+        scanner.NextL( list );
+        }
+
+    CleanupStack::PopAndDestroy(); // prefix
+    iEngine.Sink().DataStreamEndL();
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperFileSystem::ListOpenFilesL( const TThreadId& aThreadId )
+    {
+    TOpenFileScan scanner( iEngine.FsSession() );
+
+    _LIT( KMemSpyContext, "Open File Listing" );
+    _LIT( KMemSpyFolder, "OpenFiles" );
+    iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
+
+    _LIT(KHeading, "OPEN FILES");
+    iEngine.Sink().OutputSectionHeadingL( KHeading, '=' );
+    
+    // Set prefix for overall listing
+    _LIT(KOverallPrefix, "OpenFiles - ");
+    iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
+
+    CFileList* list = NULL;
+    scanner.NextL( list );
+    while( list != NULL )
+        {
+        if  ( scanner.ThreadId() == aThreadId )
+            {
+            CleanupStack::PushL( list );
+            ListOpenFilesL( *list, scanner.ThreadId() );
+            CleanupStack::Pop( list );
+            }
+        //
+        delete list;
+        list = NULL;
+        scanner.NextL( list );
+        }
+
+    CleanupStack::PopAndDestroy(); // prefix
+    iEngine.Sink().DataStreamEndL();
+    }
+
+
+void CMemSpyEngineHelperFileSystem::GetDriveNumberText( TDriveNumber aDriveNumber, TDes& aText )
+    {
+    const TInt offset = aDriveNumber - EDriveA;
+    const TChar driveChar = 'A' + offset;
+    aText.Copy( _L("EDrive") );
+    aText.Append( driveChar );
+    }
+
+
+void CMemSpyEngineHelperFileSystem::ListOpenFilesL( const CFileList& aList, const TThreadId& aThreadId )
+    {
+    _LIT( KLineFormatSpec, "%d %S %S %S %S" );
+    TBuf<64> timeBuf;
+    TMemSpySizeText valueBuf;
+
+    HBufC* itemBuf = HBufC::NewLC( 3 * KMaxFullName );
+    TPtr item( itemBuf->Des() );
+
+    TFullName threadName;
+    RThread thread;
+    if  ( iEngine.Driver().OpenThread( aThreadId, thread ) == KErrNone )
+        {
+        threadName = thread.FullName();
+        thread.Close();
+        }
+
+    const TInt entryCount = aList.Count();
+    for(TInt i=0; i<entryCount; i++)
+        {
+        const TEntry& entry = aList[ i ];
+
+        // Get time and size format strings
+        valueBuf = MemSpyEngineUtils::FormatSizeText( entry.iSize );
+        MemSpyEngineUtils::FormatTimeL( timeBuf, entry.iModified );
+
+        // Create item 
+        item.Format( KLineFormatSpec, 0, &entry.iName, &valueBuf, &timeBuf, &threadName );
+        iEngine.Sink().OutputLineL( item );
+        }
+
+    CleanupStack::PopAndDestroy( itemBuf );
+    }
+
+
+CMemSpyEngineOpenFileList* CMemSpyEngineHelperFileSystem::ListOpenFilesLC()
+    {
+    CMemSpyEngineOpenFileList* list = CMemSpyEngineOpenFileList::NewLC( iEngine );
+    return list;
+    }
+
+
+TProcessId CMemSpyEngineHelperFileSystem::FileServerProcessId() const
+    {
+    return iFileServerProcessId;
+    }
+
+
+const CMemSpyEngineChunkEntry* CMemSpyEngineHelperFileSystem::IdentifyCacheChunk( const CMemSpyEngineChunkList& aList, TInt& aIndex ) const
+    {
+    aIndex = KErrNotFound;
+    const CMemSpyEngineChunkEntry* ret = NULL;
+    //
+    const TInt count = aList.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineChunkEntry& entry = aList.At( i );
+        const TMemSpyDriverChunkInfo& info = entry.Info();
+        //
+        if  ( info.iType == EMemSpyDriverChunkTypeLocal )
+            {
+#ifdef _DEBUG
+            RDebug::Print( _L("CMemSpyEngineHelperFileSystem::IdentifyCacheChunk() - name: %S, pid: 0x%04x, f32Pid: 0x%04x, size: %d, max: %d, attribs: %d"), &info.iName, info.iOwnerId, (TUint) iFileServerProcessId, info.iSize, info.iMaxSize, info.iAttributes );
+#endif
+
+            if ( info.iOwnerId == FileServerProcessId() )
+                {
+                // Additionally, the chunk is disconnected.
+                const TBool isDisconnected = ( info.iAttributes & EMemSpyChunkAttributesDisconnected );
+#ifdef _DEBUG
+                RDebug::Printf( "CMemSpyEngineHelperFileSystem::IdentifyCacheChunk() - it is an f32 local chunk... isDisconnected: %d", isDisconnected );
+#endif
+
+                if  ( info.iSize > 0 && info.iMaxSize > 0 && isDisconnected )
+                    {
+                    aIndex = i;
+                    ret = &entry;
+#ifdef _DEBUG
+                    RDebug::Print( _L("CMemSpyEngineHelperFileSystem::IdentifyCacheChunk() - FOUND: %S, size: %d"), &info.iName, info.iSize );
+#endif
+                    break;
+                    }
+                }
+            }
+        }
+    //
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineHelperFileSystem::IdentifyCacheChunk() - END - ret: 0x%08x", ret );
+#endif
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineDriveList::CMemSpyEngineDriveList( RFs& aFsSession )
+:   CActive( EPriorityStandard ), iFsSession( aFsSession )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+EXPORT_C CMemSpyEngineDriveList::~CMemSpyEngineDriveList()
+    {
+    Cancel();
+    //
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    }
+
+
+void CMemSpyEngineDriveList::ConstructL()
+    {
+    TDriveList drives;
+    if  ( iFsSession.DriveList( drives ) == KErrNone )
+        {
+        for( TInt i=EDriveA; i<=EDriveZ; i++ )
+            {
+            const TDriveNumber drive = static_cast< TDriveNumber >( i );
+            if  ( drives[ i ] != KDriveAbsent )
+                {
+                TRAP_IGNORE( 
+                    CMemSpyEngineDriveEntry* driveEntry = CMemSpyEngineDriveEntry::NewLC( *this, drive );
+                    iItems.AppendL( driveEntry );
+                    CleanupStack::Pop( driveEntry );
+                    );
+                }
+            }
+        }
+
+    iFsSession.NotifyChange( ENotifyDisk, iStatus );
+    SetActive();
+    }
+
+
+CMemSpyEngineDriveList* CMemSpyEngineDriveList::NewLC( RFs& aFsSession )
+    {
+    CMemSpyEngineDriveList* self = new(ELeave) CMemSpyEngineDriveList( aFsSession );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+void CMemSpyEngineDriveList::RunL()
+    {
+    iFsSession.NotifyChange( ENotifyDisk, iStatus );
+    SetActive();
+    //
+    NotifyListChangedL();
+    }
+
+
+void CMemSpyEngineDriveList::DoCancel()
+    {
+    iFsSession.NotifyChangeCancel();
+    }
+
+
+EXPORT_C void CMemSpyEngineDriveList::SetObserver( MMemSpyEngineDriveListObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineDriveList::Count() const
+    {
+    return iItems.Count();
+    }
+
+
+EXPORT_C CMemSpyEngineDriveEntry& CMemSpyEngineDriveList::At( TInt aIndex )
+    {
+    return *iItems[ aIndex ];
+    }
+
+
+EXPORT_C const CMemSpyEngineDriveEntry& CMemSpyEngineDriveList::At( TInt aIndex ) const
+    {
+    return *iItems[ aIndex ];
+    }
+
+
+EXPORT_C TInt CMemSpyEngineDriveList::ItemIndex( const CMemSpyEngineDriveEntry& aEntry ) const
+    {
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineDriveEntry* item = iItems[ i ];
+        //
+        if  ( item == &aEntry )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C CMemSpyEngineDriveEntry* CMemSpyEngineDriveList::EntryByDriveNumber( TDriveNumber aDrive )
+    {
+    CMemSpyEngineDriveEntry* ret = NULL;
+    //
+    const TInt count = Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        CMemSpyEngineDriveEntry* item = iItems[ i ];
+        //
+        if  ( item->DriveNumber() == aDrive )
+            {
+            ret = item;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+RFs& CMemSpyEngineDriveList::FsSession()
+    {
+    return iFsSession;
+    }
+
+
+void CMemSpyEngineDriveList::NotifyListChangedL()
+    {
+    if  ( iObserver != NULL )
+        {
+        TRAP_IGNORE( iObserver->HandleDriveListChangedL( *this ) );
+        }
+    }
+
+
+EXPORT_C TInt CMemSpyEngineDriveList::MdcaCount() const
+    {
+    return Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineDriveList::MdcaPoint( TInt aIndex ) const
+    {
+    const CMemSpyEngineDriveEntry& item = At( aIndex );
+    return TPtrC( item.Caption() );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineDriveEntry::CMemSpyEngineDriveEntry( CMemSpyEngineDriveList& aList, TDriveNumber aDriveNumber )
+:   CActive( CActive::EPriorityStandard), iList( aList ), iDriveNumber( aDriveNumber ), iDriveUnit( aDriveNumber )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+EXPORT_C CMemSpyEngineDriveEntry::~CMemSpyEngineDriveEntry()
+    {
+    Cancel();
+    //
+    delete iCaption;
+    delete iItems;
+    }
+
+
+void CMemSpyEngineDriveEntry::ConstructL()
+    {
+    RunL();
+    }
+
+
+EXPORT_C void CMemSpyEngineDriveEntry::SetObserver( MMemSpyEngineDriveEntryObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+
+void CMemSpyEngineDriveEntry::RefreshL()
+    {
+    CMemSpyEngineOutputList* items = CMemSpyEngineOutputList::NewL();
+    delete iItems;
+    iItems = items;
+
+    /*
+	RFs13VolumeIOParamEiR18TVolumeIOParamInfo @ 344 NONAME
+	RFs17FileSystemSubTypeEiR6TDes16 @ 345 NONAME
+	RFs18QueryVolumeInfoExtEi22TQueryVolumeInfoExtCmdR5TDes8 @ 346 NONAME
+    */
+    const TInt err1 = FsSession().Drive( iDriveInfo, iDriveNumber );
+    const TInt err2 = FsSession().Volume( iVolumeInfo, iDriveNumber );
+    if  ( err1 || err2 )
+        {
+        _LIT( KUnavailable, "Unavailable");
+        iItems->AddItemL( KUnavailable );
+
+        // Mostly empty caption
+        CreateCaptionL( KNullDesC, KNullDesC );
+        }
+    else
+        {
+        // Literal constants
+        TBuf<KMaxFileName * 2> temp;
+        TBuf<KMaxFileName * 2> item;
+
+        AddStandardFieldsL();
+
+        _LIT( KEntry2a, "Media Type");
+        TBuf<20> mediaType;
+        GetMediaTypeText( iDriveInfo.iType, mediaType );
+        iItems->AddItemL( KEntry2a, mediaType );
+
+        _LIT( KEntry2b, "Battery Status");
+        GetBatteryState( iDriveInfo.iBattery, temp );
+        iItems->AddItemL( KEntry2b, temp );
+
+        // Now have enough data to create caption
+        CreateCaptionL( iVolumeInfo.iName, mediaType );
+        
+        CreateDriveAttributesL( item );
+        CreateMediaAttributesL( item );
+
+        _LIT( KEntry3a, "Volume Name");
+        if  ( iVolumeInfo.iName.Length() )
+            {
+            iItems->AddItemL( KEntry3a, iVolumeInfo.iName );
+            }
+        else
+            {
+            iItems->AddItemL( KEntry3a, KMemSpyVolumeLabelNotSet );
+            }
+
+        _LIT( KEntry3, "Volume UID");
+        iItems->AddItemHexL( KEntry3, iVolumeInfo.iUniqueID );
+
+        _LIT( KEntry4, "Volume Size");
+        temp = MemSpyEngineUtils::FormatSizeText( iVolumeInfo.iSize );
+        iItems->AddItemL( KEntry4, temp );
+
+        _LIT( KEntry5, "Volume Free");
+        temp = MemSpyEngineUtils::FormatSizeText( iVolumeInfo.iFree );
+        iItems->AddItemL( KEntry5, temp );
+
+        TMediaSerialNumber serialNum;
+        if  ( FsSession().GetMediaSerialNumber( serialNum, iDriveNumber ) == KErrNone )
+            {
+            _LIT( KEntry6, "Serial Number");
+            TBuf<KMaxSerialNumLength> serialNumUnicode;
+            serialNumUnicode.Copy( serialNum );
+            iItems->AddItemL( KEntry6, serialNumUnicode );
+            }
+
+        if  ( FsSession().FileSystemName( temp, iDriveNumber ) == KErrNone )
+            {
+            _LIT( KEntry7, "File System");
+            iItems->AddItemL( KEntry7, temp );
+            }
+        }
+    }
+
+
+CMemSpyEngineDriveEntry* CMemSpyEngineDriveEntry::NewLC( CMemSpyEngineDriveList& aList, TDriveNumber aDriveNumber )
+    {
+    CMemSpyEngineDriveEntry* self = new(ELeave) CMemSpyEngineDriveEntry( aList, aDriveNumber );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+void CMemSpyEngineDriveEntry::CreateDriveAttributesL( TDes& aItemBuf )
+    {
+    TInt driveAttribIndex = 0;
+    _LIT( KEntryText, "Drive Attribute %d");
+
+    if  ( iDriveInfo.iDriveAtt & KDriveAttLocal )
+        {
+        _LIT( KAttribName, "Local" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iDriveAtt & KDriveAttRom )
+        {
+        _LIT( KAttribName, "ROM" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iDriveAtt & KDriveAttRedirected )
+        {
+        _LIT( KAttribName, "Redirected" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iDriveAtt & KDriveAttSubsted )
+        {
+        _LIT( KAttribName, "Substed" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iDriveAtt & KDriveAttInternal )
+        {
+        _LIT( KAttribName, "Internal" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iDriveAtt & KDriveAttRemovable )
+        {
+        _LIT( KAttribName, "Removable" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iDriveAtt & KDriveAttRemote )
+        {
+        _LIT( KAttribName, "Remote" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iDriveAtt & KDriveAttTransaction )
+        {
+        _LIT( KAttribName, "Transaction" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iDriveAtt & KMemSpyDriveAttPageable )
+        {
+        _LIT( KAttribName, "Pageable" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iDriveAtt & KDriveAttRemovable )
+        {
+        _LIT( KAttribName, "Removable" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    }
+
+
+void CMemSpyEngineDriveEntry::CreateMediaAttributesL( TDes& aItemBuf )
+    {
+    TInt driveAttribIndex = 0;
+    _LIT( KEntryText, "Media Attribute %d");
+
+    if  ( iDriveInfo.iMediaAtt & KMediaAttVariableSize )
+        {
+        _LIT( KAttribName, "Variable Size" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iMediaAtt & KMediaAttDualDensity )
+        {
+        _LIT( KAttribName, "Dual Density" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iMediaAtt & KMediaAttFormattable )
+        {
+        _LIT( KAttribName, "Formattable" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iMediaAtt & KMediaAttWriteProtected )
+        {
+        _LIT( KAttribName, "Write Protected" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iMediaAtt & KMediaAttLockable )
+        {
+        _LIT( KAttribName, "Lockable" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iMediaAtt & KMediaAttLocked )
+        {
+        _LIT( KAttribName, "Locked" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iMediaAtt & KMediaAttHasPassword )
+        {
+        _LIT( KAttribName, "Has Password" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iMediaAtt & KMediaAttReadWhileWrite )
+        {
+        _LIT( KAttribName, "Read-while-Write" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iMediaAtt & KMediaAttDeleteNotify )
+        {
+        _LIT( KAttribName, "Delete Notify" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    if  ( iDriveInfo.iMediaAtt & KMemSpyMediaAttPageable )
+        {
+        _LIT( KAttribName, "Pageable" );
+        aItemBuf.Format( KEntryText, ++driveAttribIndex );
+        iItems->AddItemL( aItemBuf, KAttribName );
+        }
+    }
+
+
+void CMemSpyEngineDriveEntry::AddStandardFieldsL()
+    {
+    _LIT( KEntry1, "Unit Name");
+    const TDriveName driveUnitName = iDriveUnit.Name();
+    iItems->AddItemL( KEntry1, driveUnitName );
+
+    _LIT( KEntry2, "Unit Number");
+    TBuf<30> temp;
+    CMemSpyEngineHelperFileSystem::GetDriveNumberText( iDriveNumber, temp );
+    iItems->AddItemL( KEntry2, temp );
+
+    const TDriveNumber sysDrive = GetSystemDrive();
+    if  ( sysDrive == iDriveNumber )
+        {
+        _LIT( KEntry3, "System Drive");
+        iItems->AddItemYesNoL( KEntry3, ETrue );
+        }
+    }
+
+
+void CMemSpyEngineDriveEntry::CreateCaptionL( const TDesC& aVolumeName, const TDesC& aMediaType )
+    {
+    TBuf<256 * 2> caption;
+
+    // Always include drive unit name
+    const TDriveName driveUnitName = iDriveUnit.Name();
+    caption.AppendFormat( _L("\t%S"), &driveUnitName );
+
+    // If we have a volume name, then include that too
+    if  ( aVolumeName.Length() )
+        {
+        caption.AppendFormat( _L(" [%S]"), &aVolumeName );
+        }
+    
+    // New line
+    caption.Append( _L("\t\t") );
+
+    // Include media type if known, or unknown otherwise
+    if  ( aMediaType.Length() )
+        {
+        caption.Append( aMediaType );
+        }
+    else
+        {
+        _LIT( KUnknownMediaType, "Unknown" );
+        caption.Append( KUnknownMediaType );
+        }
+
+    HBufC* finalCaption = caption.AllocL();
+    delete iCaption;
+    iCaption = finalCaption;
+    }
+
+void CMemSpyEngineDriveEntry::GetMediaTypeText( TMediaType aType, TDes& aText )
+    {
+    switch( aType )
+        {
+    case EMediaNotPresent:
+        aText.Copy( _L("Not Present") );
+        break;
+    case EMediaFloppy:
+        aText.Copy( _L("Floppy") );
+        break;
+    case EMediaHardDisk:
+        aText.Copy( _L("Hard Disk") );
+        break;
+    case EMediaCdRom:
+        aText.Copy( _L("CD-ROM") );
+        break;
+    case EMediaRam:
+        aText.Copy( _L("RAM") );
+        break;
+    case EMediaFlash:
+        aText.Copy( _L("Flash") );
+        break;
+    case EMediaRom:
+        aText.Copy( _L("ROM") );
+        break;
+    case EMediaRemote:
+        aText.Copy( _L("Remote") );
+        break;
+    case EMediaNANDFlash:
+        aText.Copy( _L("NAND Flash") );
+        break;
+    default:
+    case EMediaUnknown:
+        aText.Copy( _L("Unknown") );
+        break;
+        }
+    }
+
+
+void CMemSpyEngineDriveEntry::GetBatteryState( TBatteryState aBatteryState, TDes& aText )
+    {
+    switch( aBatteryState )
+        {
+    case EBatNotSupported:
+        aText.Copy( _L("Not Supported") );
+        break;
+    case EBatGood:
+        aText.Copy( _L("Good") );
+        break;
+    case EBatLow:
+        aText.Copy( _L("Low") );
+        break;
+    default:
+        aText.Copy( _L("Unknown") );
+        break;
+        }
+    }
+
+
+TDriveNumber CMemSpyEngineDriveEntry::GetSystemDrive()
+    {
+    return CMemSpyEngineHelperFileSystem::GetSystemDrive();
+    }
+
+
+EXPORT_C TInt CMemSpyEngineDriveEntry::MdcaCount() const
+    {
+    return iItems->Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineDriveEntry::MdcaPoint( TInt aIndex ) const
+    {
+    return iItems->MdcaPoint( aIndex );
+    }
+
+
+void CMemSpyEngineDriveEntry::RunL()
+    {
+    FsSession().NotifyChange( ENotifyDisk, iStatus );
+    SetActive();
+    //
+    TRAP_IGNORE( RefreshL() );
+    //
+    if ( iObserver != NULL )
+        {
+        TRAP_IGNORE( iObserver->HandleDriveEntryChangedL( *this ) );
+        }
+    }
+
+
+void CMemSpyEngineDriveEntry::DoCancel()
+    {
+    FsSession().NotifyChangeCancel();
+    }
+
+
+RFs& CMemSpyEngineDriveEntry::FsSession()
+    {
+    return iList.FsSession();
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineOpenFileListEntry::CMemSpyEngineOpenFileListEntry()
+    {
+    }
+
+
+CMemSpyEngineOpenFileListEntry::~CMemSpyEngineOpenFileListEntry()
+    {
+    delete iFileName;
+    }
+
+
+void CMemSpyEngineOpenFileListEntry::ConstructL( const TEntry& aEntry )
+    {
+    iFileName = aEntry.iName.AllocL();
+    iAtt = aEntry.iAtt;
+    iType = aEntry.iType;
+    iSize = aEntry.iSize;
+    iModified = aEntry.iModified;
+    }
+
+
+CMemSpyEngineOpenFileListEntry* CMemSpyEngineOpenFileListEntry::NewLC( const TEntry& aEntry )
+    {
+    CMemSpyEngineOpenFileListEntry* self = new(ELeave) CMemSpyEngineOpenFileListEntry();
+    CleanupStack::PushL( self );
+    self->ConstructL( aEntry );
+    return self;
+    }
+
+
+EXPORT_C const TDesC& CMemSpyEngineOpenFileListEntry::FileName() const
+    {
+    return *iFileName;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineOpenFileListEntry::Size() const
+    {
+    return iSize;
+    }
+
+
+TInt CMemSpyEngineOpenFileListEntry::UniqueFileId() const
+    {
+    return iUniqueFileIdentifier;
+    }
+
+
+void CMemSpyEngineOpenFileListEntry::SetUniqueFileId( TInt aValue )
+    {
+    iUniqueFileIdentifier = aValue;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineOpenFileListForThread::CMemSpyEngineOpenFileListForThread( const TThreadId& aThreadId, const TProcessId& aProcessId )
+:   iThreadId( aThreadId ), iProcessId( aProcessId )
+    {
+    }
+
+
+CMemSpyEngineOpenFileListForThread::~CMemSpyEngineOpenFileListForThread()
+    {
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    delete iThreadName;
+    }
+
+
+void CMemSpyEngineOpenFileListForThread::ConstructL( const TDesC& aThreadName, const CFileList& aList )
+    {
+    iThreadName = aThreadName.AllocL();
+
+    // Create fs entries
+    const TInt entryCount = aList.Count();
+    for(TInt i=0; i<entryCount; i++)
+        {
+        const TEntry& fsEntry = (aList)[ i ];
+        //
+        CMemSpyEngineOpenFileListEntry* entry = CMemSpyEngineOpenFileListEntry::NewLC( fsEntry );
+        AddL( entry );
+        CleanupStack::Pop( entry );
+        }
+    }
+
+
+CMemSpyEngineOpenFileListForThread* CMemSpyEngineOpenFileListForThread::NewLC( const TDesC& aThreadName, const TThreadId& aThreadId, const TProcessId& aProcessId, const CFileList& aList )
+    {
+    CMemSpyEngineOpenFileListForThread* self = new(ELeave) CMemSpyEngineOpenFileListForThread( aThreadId, aProcessId );
+    CleanupStack::PushL( self );
+    self->ConstructL( aThreadName, aList );
+    return self;
+    }
+
+
+EXPORT_C const TDesC& CMemSpyEngineOpenFileListForThread::ThreadName() const
+    {
+    return *iThreadName;
+    }
+
+
+EXPORT_C const TThreadId& CMemSpyEngineOpenFileListForThread::ThreadId() const
+    {
+    return iThreadId;
+    }
+
+
+EXPORT_C const TProcessId& CMemSpyEngineOpenFileListForThread::ProcessId() const
+    {
+    return iProcessId;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineOpenFileListForThread::Count() const
+    {
+    return iItems.Count();
+    }
+
+
+EXPORT_C const CMemSpyEngineOpenFileListEntry& CMemSpyEngineOpenFileListForThread::At( TInt aIndex ) const
+    {
+    return *iItems[ aIndex ];
+    }
+ 
+
+void CMemSpyEngineOpenFileListForThread::AddL( CMemSpyEngineOpenFileListEntry* aEntry )
+    {
+    // Ensure we increment the unique filename counter if adding an entry where the same filename
+    // already is registered with the list.
+    CMemSpyEngineOpenFileListEntry* existingEntry = EntryByFileName( aEntry->FileName() );
+    if  ( existingEntry )
+        {
+        // EntryByFileName() always returns the most recent entry with the same name. The list
+        // itself is not sorted as entries are always appended to it.
+        const TInt lastUID = existingEntry->UniqueFileId();
+#ifdef _DEBUG
+        RDebug::Print( _L("CMemSpyEngineOpenFileListForThread::AddL() - searched for %S and found existing entry with UID: %d"), &aEntry->FileName(), lastUID );
+#endif
+
+        aEntry->SetUniqueFileId( lastUID + 1 );
+        }
+
+    iItems.AppendL( aEntry );
+    }
+
+
+CMemSpyEngineOpenFileListEntry* CMemSpyEngineOpenFileListForThread::EntryByFileName( const TDesC& aFileName )
+    {
+    CMemSpyEngineOpenFileListEntry* ret = NULL;
+    //
+    const TInt count = iItems.Count();
+    for( TInt i=count-1; i>=0; i-- )
+        {
+        CMemSpyEngineOpenFileListEntry* item = iItems[ i ];
+        if  ( item->FileName().CompareF( aFileName ) == 0 )
+            {
+            ret = item;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineOpenFileList::CMemSpyEngineOpenFileList()
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineOpenFileList::~CMemSpyEngineOpenFileList()
+    {
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    }
+
+
+void CMemSpyEngineOpenFileList::ConstructL( CMemSpyEngine& aEngine )
+    {
+    _LIT( KUnknownThread, "Unknown Thread" );
+    TFullName threadName;
+    TOpenFileScan scanner( aEngine.FsSession() );
+    //
+    CFileList* list = NULL;
+    scanner.NextL( list );
+    while( list != NULL )
+        {
+        CleanupStack::PushL( list );
+
+        // Reset name
+        threadName = KUnknownThread;
+        
+        // Try to get real thread name
+        TProcessId procId;
+        RThread thread;
+        if  ( aEngine.Driver().OpenThread( scanner.ThreadId(), thread ) == KErrNone )
+            {
+            RProcess process;
+            if ( thread.Process( process ) == KErrNone )
+                {
+                procId = process.Id();
+                process.Close();
+                }
+            //
+            thread.FullName( threadName );
+            thread.Close();
+            }
+
+        // Create thread entry
+        CMemSpyEngineOpenFileListForThread* threadEntry = CMemSpyEngineOpenFileListForThread::NewLC( threadName, scanner.ThreadId(), procId, *list );
+        iItems.AppendL( threadEntry );
+        CleanupStack::Pop( threadEntry );
+
+        // Destroy list and move on to next thread.
+        CleanupStack::PopAndDestroy( list );
+        list = NULL;
+        scanner.NextL( list );
+        }
+    }
+
+
+CMemSpyEngineOpenFileList* CMemSpyEngineOpenFileList::NewLC( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineOpenFileList* self = new(ELeave) CMemSpyEngineOpenFileList();
+    CleanupStack::PushL( self );
+    self->ConstructL( aEngine );
+    return self;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineOpenFileList::Count() const
+    {
+    return iItems.Count();
+    }
+
+
+EXPORT_C const CMemSpyEngineOpenFileListForThread& CMemSpyEngineOpenFileList::At( TInt aIndex ) const
+    {
+    return *iItems[ aIndex ];
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperHeap.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1207 @@
+/*
+* 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 <memspy/engine/memspyenginehelperheap.h>
+
+// System includes
+#include <s32mem.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyenginehelperrom.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// Constants
+const TBool KMemSpyHeapDumpCreateOwnDataStream = ETrue;
+
+// Literal constants
+_LIT( KCellTypeGoodAllocatedCell,        "[Allocated Cell]            ");
+_LIT( KCellTypeGoodFreeCell,             "[Free Cell]                 ");
+_LIT( KCellTypeBadAllocatedCellSize,     "[Bad Allocated Cell Size]   ");
+_LIT( KCellTypeBadAllocatedCellAddress,  "[Bad Allocated Cell Address]");
+_LIT( KCellTypeBadFreeCellAddress,       "[Bad Free Cell Address]     ");
+_LIT( KCellTypeBadFreeCellSize,          "[Bad Free Cell Size]        ");
+_LIT( KCellTypeBad,                      "[Bad Cell]                  ");
+_LIT( KCellTypeUnknown,                  "[Unknown!]                  ");
+_LIT( KCellListLineFormat, "%S cell: 0x%08x, cellLen: %8d, allocNum: %8d, nestingLev: %8d, cellData: 0x%08x, cellDataAddr: 0x%08x, headerSize: %02d");
+_LIT( KMemSpyMarkerHeapData, "<%SMEMSPY_HEAP_DATA_%03d>" );
+_LIT( KMemSpyMarkerCSV, "<%SMEMSPY_HEAP_CSV>" );
+_LIT( KMemSpyPrefixHeapData, "HeapData - %S - ");
+_LIT( KMemSpyPrefixCellList, "CellList - %S - ");
+_LIT( KMemSpyPrefixCSV, "CSV - " );
+
+
+CMemSpyEngineHelperHeap::CMemSpyEngineHelperHeap( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperHeap::~CMemSpyEngineHelperHeap()
+    {
+    }
+
+
+void CMemSpyEngineHelperHeap::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperHeap* CMemSpyEngineHelperHeap::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperHeap* self = new(ELeave) CMemSpyEngineHelperHeap( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+
+
+
+
+
+
+
+
+EXPORT_C void CMemSpyEngineHelperHeap::OutputCellListingUserL( const CMemSpyThread& aThread )
+    {
+    // Suspend the process
+    iEngine.ProcessSuspendLC( aThread.Process().Id() );
+
+    // Free cells
+    RArray<TMemSpyDriverFreeCell> freeCells;
+    CleanupClosePushL( freeCells );
+
+    // Info section
+    TMemSpyHeapInfo heapInfo;
+    const TInt error = iEngine.Driver().GetHeapInfoUser( heapInfo, aThread.Id(), freeCells );
+    if ( error == KErrNone )
+        {
+        UpdateSharedHeapInfoL( aThread.Process().Id(), aThread.Id(), heapInfo );
+        }
+    if  ( error == KErrNone && heapInfo.Type() != TMemSpyHeapInfo::ETypeUnknown )
+        {
+        // Get thread name for context
+        const TFullName pName( aThread.FullName() );
+
+        // Begin a new data stream
+        _LIT( KMemSpyFolder, "Heap\\Cell List" );
+        _LIT( KMemSpyContext, "Cell List - %S" );
+        HBufC* context = HBufC::NewLC( KMaxFileName );
+        TPtr pContext( context->Des() );
+        pContext.Format( KMemSpyContext, &pName );
+        iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder );
+        CleanupStack::PopAndDestroy( context );
+
+        // Set prefix for overall listing
+        iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixCellList, &pName );
+
+        // Start new section
+        _LIT(KHeader, "CELL LISTING");
+        iEngine.Sink().OutputSectionHeadingL( KHeader, '=' );
+
+        // Prepare temp buffers
+        TBuf<KMaxFullName + 100> printFormat;
+        HBufC* tempBuffer = HBufC::NewLC( 2048 );
+        TPtr pTempBuffer( tempBuffer->Des() );
+
+        // Print initial info
+        OutputHeapInfoL( heapInfo, pName, &freeCells );
+
+        // Code segments (needed for map file reading...)
+        _LIT(KCellListCodeSegInfoFormat, "CodeSegs - ");
+        iEngine.HelperCodeSegment().OutputCodeSegmentsL( aThread.Process().Id(), printFormat, KCellListCodeSegInfoFormat, '-', ETrue );
+    
+        // Now walk the heap!
+        TInt r = iEngine.Driver().WalkHeapInit( aThread.Id() );
+        if  ( r == KErrNone )
+            {
+             _LIT(KHeader2, "Cells");
+            iEngine.Sink().OutputSectionHeadingL( KHeader2, '-' );
+
+            TMemSpyDriverCellType cellType;
+            TAny* cellAddress;
+            TInt cellLength;
+            TInt cellNestingLevel;
+            TInt cellAllocationNumber;
+            TInt cellHeaderSize;
+            TAny* cellPayloadAddress;
+            TBuf8<4> cellData;
+            //
+            r = iEngine.Driver().WalkHeapNextCell( aThread.Id(), cellType, cellAddress, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
+            while( r == KErrNone )
+                {
+                TUint fourByteCellData = 0;
+                TPtrC pType(KNullDesC);
+                //
+				if (cellType & EMemSpyDriverAllocatedCellMask)
+					{
+                    r = iEngine.Driver().WalkHeapReadCellData( cellAddress, cellData, 4 );
+                    if  ( r == KErrNone )
+                        {
+                        fourByteCellData = DescriptorAsDWORD( cellData );
+                        }
+                    pType.Set(KCellTypeGoodAllocatedCell);
+                    }
+				else if (cellType & EMemSpyDriverFreeCellMask)
+					{
+                    pType.Set(KCellTypeGoodFreeCell);
+					}
+				else if (cellType & EMemSpyDriverBadCellMask)
+					{
+					switch (cellType)
+						{
+					case EMemSpyDriverHeapBadAllocatedCellSize:
+						pType.Set(KCellTypeBadAllocatedCellSize);
+						break;
+					case EMemSpyDriverHeapBadAllocatedCellAddress:
+						pType.Set(KCellTypeBadAllocatedCellAddress);
+						break;
+					case EMemSpyDriverHeapBadFreeCellAddress:
+						pType.Set(KCellTypeBadFreeCellAddress);
+						break;
+					case EMemSpyDriverHeapBadFreeCellSize:
+						pType.Set(KCellTypeBadFreeCellSize);
+						break;
+					default:
+						pType.Set(KCellTypeBad);
+						break;
+						}
+					}
+				else
+					{
+                    pType.Set(KCellTypeUnknown);
+                    }
+
+                if  ( r == KErrNone )
+                    {
+                    pTempBuffer.Format( KCellListLineFormat, &pType, cellAddress, cellLength, cellAllocationNumber, cellNestingLevel, fourByteCellData, cellPayloadAddress, cellHeaderSize );
+                    iEngine.Sink().OutputLineL( pTempBuffer );
+                    //
+                    r = iEngine.Driver().WalkHeapNextCell( aThread.Id(), cellType, cellAddress, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
+                    }
+                }
+            //
+            iEngine.Driver().WalkHeapClose();
+            }
+        CleanupStack::PopAndDestroy( tempBuffer );
+        CleanupStack::PopAndDestroy(); // clear prefix
+
+        iEngine.Sink().DataStreamEndL();
+        }
+
+    CleanupStack::PopAndDestroy( &freeCells );
+    CleanupStack::PopAndDestroy(); // resume process
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapDataUserL( const CMemSpyThread& aThread )
+    {
+    OutputHeapDataUserL( aThread, KMemSpyHeapDumpCreateOwnDataStream );
+    }
+
+
+void CMemSpyEngineHelperHeap::OutputHeapDataUserL( const CMemSpyThread& aThread, TBool aCreateDataStream )
+    {
+    // Make sure the process is suspended for the entire time we are manipulating it's heap
+    iEngine.ProcessSuspendLC( aThread.Process().Id() );
+
+    // Get the heap info, including cell information
+    RArray<TMemSpyDriverCell> cells;
+    CleanupClosePushL( cells );
+    TMemSpyHeapInfo heapInfo;
+    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::OutputHeapDataUserL() - checksum1: 0x%08x", heapInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
+    GetHeapInfoUserL(aThread.Process().Id(), aThread.Id(), heapInfo, &cells, ETrue);
+    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::OutputHeapDataUserL() - checksum2: 0x%08x", heapInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
+
+    // Get the heap data
+    const TFullName pName( aThread.FullName() );
+    OutputHeapDataUserL( aThread.Process().Id(), aThread.Id(), pName, heapInfo, aCreateDataStream, &cells );
+    CleanupStack::PopAndDestroy( &cells );
+
+    // Resume process
+    CleanupStack::PopAndDestroy();
+    }
+
+
+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 )
+    {
+    TBuf<KMaxFullName + 100> printFormat;
+
+    // Begin a new data stream
+    if  ( aCreateDataStream )
+        {
+        _LIT( KMemSpyFolder, "Heap\\Data" );
+        _LIT( KMemSpyContext, "Heap Data - %S" );
+        HBufC* context = HBufC::NewLC( KMaxFileName );
+        TPtr pContext( context->Des() );
+        pContext.Format( KMemSpyContext, &aThreadName );
+        iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder );
+        CleanupStack::PopAndDestroy( context );
+        }
+
+    // Get the heap info first of all
+    iEngine.ProcessSuspendLC( aPid );
+
+    // Start marker
+    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KNullDesC, (TUint) aTid );
+
+    // Set overall prefix
+    iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixHeapData, &aThreadName );
+
+    // Info section
+    OutputHeapInfoL( aInfo, aThreadName, aCells );
+
+    // Code segments (needed for map file reading...)
+    _LIT(KCellListCodeSegInfoFormat, "CodeSegs - ");
+    iEngine.HelperCodeSegment().OutputCodeSegmentsL( aPid, printFormat, KCellListCodeSegInfoFormat, '-', ETrue );
+
+    // Dump section
+    _LIT(KHeaderDump, "Heap Data");
+    iEngine.Sink().OutputSectionHeadingL( KHeaderDump, '-' );
+
+    HBufC8* data = HBufC8::NewLC( 4096 * 12 );
+    TPtr8 pData(data->Des());
+    TUint remaining = 0;
+    TUint readAddress = 0;
+
+    // When we obtained the heap info, we also obtained a checksum of all the free cells
+    // within the specified heap. We validate that this hasn't changed at the time we
+    // request the heap data for paranoia purposes (There have been "Issues" with MemSpy
+    // not actually suspending a process between fetching heap info & heap data, causing
+    // a mismatch in free cell information).
+    const TUint32 checksum = aInfo.AsRHeap().Statistics().StatsFree().Checksum();
+    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::OutputHeapDataUserL() - checksum: 0x%08x", checksum ) );
+
+    TInt r = iEngine.Driver().GetHeapData( aTid, checksum, 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().GetHeapDataNext(aTid, 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(); // resume process
+
+    // End marker
+    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KMemSpySinkTagClose, (TUint) aTid );
+
+    if  ( aCreateDataStream )
+        {
+        iEngine.Sink().DataStreamEndL();
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapInfoL( const TMemSpyHeapInfo& aInfo, const TDesC& aThreadName, const RArray<TMemSpyDriverCell>* aCells )
+	{
+    CMemSpyEngineOutputList* list = NewHeapSummaryExtendedLC(aInfo, aCells);
+
+    // Format the thread name according to upper/lower case request parameters
+    _LIT( KOverallCaption1, "HEAP INFO FOR THREAD '%S'");
+    list->InsertItemFormatUCL( 0, KOverallCaption1, &aThreadName );
+    list->InsertUnderlineForItemAtL( 0 );
+
+    // Print it
+    list->PrintL();
+
+    // Tidy up
+    CleanupStack::PopAndDestroy( list );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+void CMemSpyEngineHelperHeap::OutputCSVEntryL( TInt aIndex, const TMemSpyHeapInfo& aInfo, const TDesC& aThreadName, const TDesC& aProcessName )
+    {
+    const TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
+    const TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
+    const TMemSpyHeapStatisticsRHeap& rHeapStats = rHeapInfo.Statistics();
+
+    // Example:
+    //
+    //  <ENTRY_001>
+    //      <THREAD_NAME_001>ESock_IP</THREAD_NAME_001>
+    //      <PROCESS_NAME_001>c32exe.exe[101f7989]0001</PROCESS_NAME_001>
+    //      <CHUNK_NAME_001>Local-c812ba58</CHUNK_NAME_001>
+    //      <FIELDS_001>1,0x12400000,0x00c00074,36744,4092,524288,0x00c011a4,0,13,6872,1368,1680,2584,219,40,28996,0</FIELDS_001>
+    //  </ENTRY_001>
+    
+    _LIT( KFmtTagOpenAndClose, "<%S_%04d>%S</%S_%04d>" );
+    
+    _LIT( KFmtEntryId, "<%SENTRY_%04d>");
+    _LIT( KFmtNameThread, "THREAD_NAME");
+    _LIT( KFmtNameProcess, "PROCESS_NAME");
+    _LIT( KFmtNameChunk, "CHUNK_NAME");
+    _LIT( KFmtFields, "FIELDS");
+    _LIT( KFmtFieldContent , "<%S_%04d>%06d,0x%08x,0x%08x,%d,%d,%d,0x%08x,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</%S_%04d>");
+
+    // <ENTRY_001>
+    iEngine.Sink().OutputLineFormattedL( KFmtEntryId, &KNullDesC, aIndex );
+    
+    //      <THREAD_NAME_001>ESock_IP</THREAD_NAME_001>
+    iEngine.Sink().OutputLineFormattedL( KFmtTagOpenAndClose, &KFmtNameThread, aIndex, &aThreadName, &KFmtNameThread, aIndex );
+    
+    //      <PROCESS_NAME_001>c32exe.exe[101f7989]0001</PROCESS_NAME_001>
+    iEngine.Sink().OutputLineFormattedL( KFmtTagOpenAndClose, &KFmtNameProcess, aIndex, &aProcessName, &KFmtNameProcess, aIndex );
+    
+    //      <CHUNK_NAME_001>Local-c812ba58</CHUNK_NAME_001>
+    const TPtrC pChunkName( rHeapMetaData.ChunkName() );
+    iEngine.Sink().OutputLineFormattedL( KFmtTagOpenAndClose, &KFmtNameChunk, aIndex, &pChunkName, &KFmtNameChunk, aIndex );
+    
+    // Fields
+    iEngine.Sink().OutputLineFormattedL( KFmtFieldContent,
+                                         &KFmtFields,
+                                         aIndex,
+                                         aInfo.Tid(),
+                                         rHeapMetaData.ChunkHandle(),
+                                         rHeapMetaData.iAllocatorAddress,
+                                         rHeapMetaData.iHeapSize,
+                                         rHeapMetaData.iMinHeapSize,
+                                         rHeapMetaData.iMaxHeapSize,
+                                         NULL, // there's no longer a free list so we can't return the next ptr
+                                         0, // there's no longer a free list so we can't return it's length
+                                         rHeapStats.StatsFree().TypeCount(),
+                                         rHeapStats.StatsFree().TypeSize(),
+                                         rHeapStats.StatsFree().SlackSpaceCellSize(),
+                                         rHeapStats.StatsFree().LargestCellSize(),
+                                         rHeapStats.StatsAllocated().LargestCellSize(),
+                                         rHeapStats.StatsAllocated().TypeCount(),
+                                         0, // min cell no longer makes sense
+                                         rHeapStats.StatsAllocated().TypeSize(),
+                                         rHeapMetaData.IsSharedHeap(),
+                                         &KFmtFields,
+                                         aIndex
+                                         );
+    
+    // </ENTRY_001>
+    iEngine.Sink().OutputLineFormattedL( KFmtEntryId, &KMemSpySinkTagClose, aIndex );
+    }
+
+
+
+EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapInfoForDeviceL( TBool aIncludeKernel )
+    {
+    // NB: The goal here is to minimise the line length. We already look like we
+    // could exceed the available RDebug::Print length...
+    const TInt count = iEngine.Container().Count();
+    TInt index = 0;
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+    //
+    _LIT( KMemSpyFolder, "Heap\\Compact" );
+    _LIT( KMemSpyContext, "Heap Compact" );
+    _LIT( KMemSpyExtension, ".log" );
+    iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder, KMemSpyExtension );
+
+    // Start marker
+    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerCSV, &KNullDesC );
+
+    // Set overall prefix
+    iEngine.Sink().OutputPrefixSetLC( KMemSpyPrefixCSV );
+    
+    // Output version info
+    _LIT( KVersionNumber, "<VERSION>1</VERSION>" );
+    iEngine.Sink().OutputLineL( KVersionNumber );
+    
+    // Output time stamp
+    _LIT( KTimeStamp, "<TIMESTAMP>%u</TIMESTAMP>" );
+    iEngine.Sink().OutputLineFormattedL( KTimeStamp, User::FastCounter() );
+ 
+    // Heap info we'll populate by calling the driver
+    TMemSpyHeapInfo info;
+    TFullName processName;
+
+    if  ( aIncludeKernel )
+        {
+        // Get kernel heap info
+        GetHeapInfoKernelL( info );
+
+        if ( info.Type() != TMemSpyHeapInfo::ETypeUnknown )
+            {
+            TName threadName;
+            MemSpyEngineUtils::GetKernelHeapThreadAndProcessNames( threadName, processName );
+            OutputCSVEntryL( index++, info, threadName, processName );
+            }
+        }
+
+	for(TInt ii=0; ii<count; ii++)
+        {
+        const CMemSpyProcess& process = iEngine.Container().At( ii );
+        process.FullName( processName );
+        //
+        if  ( iEngine.ProcessSuspendAndGetErrorLC( process.Id() ) == KErrNone )
+            {
+            const TInt threadCount = process.Count();
+            //
+            for(TInt j=0; j<threadCount; j++)
+                {
+                const CMemSpyThread& thread = process.At( j );
+                const TPtrC threadName( thread.Name() );
+                //
+                const TInt error = iEngine.Driver().GetHeapInfoUser( info, thread.Id() );
+                if ( error == KErrNone )
+                    {
+                    UpdateSharedHeapInfoL( process.Id(), thread.Id(), info );
+                    }
+                if  ( error == KErrNone && info.Type() != TMemSpyHeapInfo::ETypeUnknown )
+                    {
+                    OutputCSVEntryL( index++, info, threadName, processName );
+                    }
+                }
+    
+            CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+            }
+        }
+
+    CleanupStack::PopAndDestroy(); // clear prefix
+    CleanupStack::PopAndDestroy( buf );
+
+	// End marker
+	iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerCSV, &KMemSpySinkTagClose );
+    iEngine.Sink().DataStreamEndL();
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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)
+    {
+    iEngine.ProcessSuspendLC( aProcess );
+    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::GetHeapInfoUserL() - checksum1: 0x%08x", aInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
+    
+    TInt r = KErrNone;
+    //
+    if  (aCells)
+        {
+        r = iEngine.Driver().GetHeapInfoUser( aInfo, aThread, *aCells, aCollectAllocatedCellsAsWellAsFree);
+        }
+    else
+        {
+        r = iEngine.Driver().GetHeapInfoUser( aInfo, aThread );
+        }
+    if ( !r )
+        {
+        UpdateSharedHeapInfoL( aProcess, aThread, aInfo );
+        }
+    
+    //
+    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::GetHeapInfoUserL() - checksum2: 0x%08x", aInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
+    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+    User::LeaveIfError( r );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoUserL( const CMemSpyProcess& aProcess, RArray<TMemSpyHeapInfo >& aInfos )
+    {
+    aInfos.Reset();
+    iEngine.ProcessSuspendLC( aProcess.Id() );
+    //
+    TMemSpyHeapInfo info;
+    //
+    const TInt count = aProcess.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyThread& thread = aProcess.At( i );
+        //
+        GetHeapInfoUserL( aProcess.Id(), thread.Id(), info );
+        aInfos.AppendL( info );
+        }
+    //
+    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapInfoUserL( const CMemSpyThread& aThread )
+    {
+    HBufC* threadName = aThread.FullName().AllocLC();
+    //
+    RArray<TMemSpyDriverFreeCell> freeCells;
+    CleanupClosePushL( freeCells );
+    //
+    TMemSpyHeapInfo info;
+    GetHeapInfoUserL( aThread.Process().Id(), aThread.Id(), info, &freeCells );
+    OutputHeapInfoL( info, *threadName, &freeCells );
+    //
+    CleanupStack::PopAndDestroy( 2, threadName ); // freecells & thread name
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>* aFreeCells )
+    {
+    TInt error = KErrNone;
+    //
+    if  ( aFreeCells )
+        {
+        error = iEngine.Driver().GetHeapInfoKernel( aInfo, *aFreeCells );
+        }
+    else
+        {
+        error = iEngine.Driver().GetHeapInfoKernel( aInfo );
+        }
+    //
+    User::LeaveIfError( error );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapInfoKernelL()
+    {
+    // Get thread name
+    TFullName threadName;
+    MemSpyEngineUtils::GetKernelHeapThreadName( threadName );
+
+    // Free cells
+    RArray<TMemSpyDriverFreeCell> freeCells;
+    CleanupClosePushL( freeCells );
+
+    // Get info
+    TMemSpyHeapInfo info;
+    GetHeapInfoKernelL( info, &freeCells );
+
+    // Ouput
+    OutputHeapInfoL( info, threadName, &freeCells );
+
+    CleanupStack::PopAndDestroy( &freeCells );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapDataKernelL()
+    {
+    OutputHeapDataKernelL( KMemSpyHeapDumpCreateOwnDataStream );
+    }
+
+
+void CMemSpyEngineHelperHeap::OutputHeapDataKernelL( TBool aCreateDataStream )
+    {
+    // Get thread name
+    TFullName threadName;
+    MemSpyEngineUtils::GetKernelHeapThreadName( threadName, EFalse );
+
+    // Begin a new data stream
+    if  ( aCreateDataStream )
+        {
+        _LIT( KMemSpyFolder, "Heap\\Data" );
+        _LIT( KMemSpyContext, "Heap Data - %S" );
+        HBufC* context = HBufC::NewLC( KMaxFileName );
+        TPtr pContext( context->Des() );
+        pContext.Format( KMemSpyContext, &threadName );
+        iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder );
+        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 );
+
+    // Start marker
+    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KNullDesC, info.Tid() );
+
+    // Set overall prefix
+    iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixHeapData, &threadName );
+
+    // Info section
+    OutputHeapInfoL( info, threadName, &freeCells );
+
+    // 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() );
+	*/
+
+    CleanupStack::PopAndDestroy(); // clear prefix
+    CleanupStack::PopAndDestroy( data );
+    CleanupStack::PopAndDestroy( &freeCells );
+
+    // End marker
+    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KMemSpySinkTagClose, info.Tid() );
+
+    if  ( aCreateDataStream )
+        {
+        iEngine.Sink().DataStreamEndL();
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXPORT_C CMemSpyEngineOutputList* CMemSpyEngineHelperHeap::NewHeapSummaryShortLC( const TMemSpyHeapInfo& aInfo )
+    {
+    CMemSpyEngineOutputList* list = CMemSpyEngineOutputList::NewLC( iEngine.Sink() );
+
+    // Heap type
+    _LIT( KItem0, "Heap type" );
+    if ( aInfo.Type() == TMemSpyHeapInfo::ETypeUnknown )
+        {
+        _LIT( KItem0_Type_Unknown, "Unknown" );
+        list->AddItemL( KItem0, KItem0_Type_Unknown );
+        }
+    else
+        {
+        const TMemSpyHeapInfoRHeap& rHeap = aInfo.AsRHeap();
+        const TMemSpyHeapMetaDataRHeap& metaData = rHeap.MetaData();
+        const TMemSpyHeapStatisticsRHeap& statistics = rHeap.Statistics();
+
+        _LIT( KItem0_Type_RHeap, "RHeap" );
+        _LIT( KItem0_Type_RHybridHeap, "RHybridHeap" );
+		if (aInfo.Type() == TMemSpyHeapInfo::ETypeRHeap)
+			{
+	        list->AddItemL( KItem0, KItem0_Type_RHeap );
+			}
+		else
+			{
+	        list->AddItemL( KItem0, KItem0_Type_RHybridHeap );
+			}
+
+        // Heap size is the size of the heap minus the size of the embedded (in-place) RHeap. 
+        _LIT( KItem1, "Heap size" );
+        list->AddItemL(KItem1, metaData.iHeapSize);
+
+        _LIT( KItem8b, "Allocator address" );
+        list->AddItemHexL( KItem8b, (TUint)metaData.iAllocatorAddress );
+        
+        _LIT( KItem1b, "Shared" );
+        list->AddItemYesNoL( KItem1b, metaData.IsSharedHeap() );
+
+        // This is the size (rounded to the page) of memory associated with
+        // the underlying heap chunk
+        _LIT( KItem2, "Chunk size" );
+        list->AddItemL( KItem2, metaData.ChunkSize() );
+
+        _LIT( KItem3, "Alloc. count" );
+        list->AddItemL( KItem3, statistics.StatsAllocated().TypeCount() );
+
+        _LIT( KItem4, "Free. count" );
+        list->AddItemL( KItem4, statistics.StatsFree().TypeCount() );
+
+        _LIT( KItem5, "Biggest alloc." );
+        list->AddItemL( KItem5, statistics.StatsAllocated().LargestCellSize() );
+
+        _LIT( KItem6, "Biggest free" );
+        list->AddItemL( KItem6, statistics.StatsFree().LargestCellSize() );
+
+        _LIT( KItem6a, "Total alloc." );
+        list->AddItemL( KItem6a, statistics.StatsAllocated().TypeSize() );
+
+        _LIT( KItem6b, "Total free" );
+        list->AddItemL( KItem6b, statistics.StatsFree().TypeSize() );
+
+        // Slack is the free space at the end of the heap
+        _LIT( KItem7, "Slack free space" );
+        list->AddItemL( KItem7, statistics.StatsFree().SlackSpaceCellSize() );
+
+        // Fragmentation is a measurement of free space scattered throughout the heap, but ignoring
+        // any slack space at the end (which can often be recovered, to the granularity of one page of ram)
+        _LIT( KItem8a, "Fragmentation" );
+        list->AddItemPercentageL( KItem8a, metaData.iHeapSize, ( statistics.StatsFree().TypeSize()  - statistics.StatsFree().SlackSpaceCellSize() ) );
+
+
+        _LIT( KItem9c, "Overhead (total)" );
+		const TInt totalOverhead = metaData.iHeapSize - statistics.StatsAllocated().TypeSize();
+        list->AddItemL( KItem9c, totalOverhead );
+
+        _LIT( KItem9d, "Overhead" );
+        list->AddItemPercentageL( KItem9d, metaData.iHeapSize, totalOverhead  );
+
+        _LIT( KItem10, "Min. length" );
+        list->AddItemL( KItem10, metaData.iMinHeapSize );
+
+        _LIT( KItem11, "Max. length" );
+        list->AddItemL( KItem11, metaData.iMaxHeapSize );
+
+        _LIT( KItem12, "Debug Allocator Library" );
+        list->AddItemYesNoL( KItem12, metaData.IsDebugAllocator() );
+        }
+
+    return list;
+    }
+
+
+EXPORT_C CMemSpyEngineOutputList* CMemSpyEngineHelperHeap::NewHeapSummaryExtendedLC( const TMemSpyHeapInfo& aInfo, const RArray<TMemSpyDriverCell>* aCells )
+	{
+    CMemSpyEngineOutputList* list = CMemSpyEngineOutputList::NewLC( iEngine.Sink() );
+    //
+    AppendMetaDataL( aInfo, *list );
+    AppendStatisticsL( aInfo, *list );
+    //
+    if  ( aCells )
+        {
+        AppendCellsL( *aCells, *list );
+        }
+    //
+    return list;
+    }
+
+
+//cigasto: not formatted - raw heap info 
+EXPORT_C TMemSpyHeapData CMemSpyEngineHelperHeap::NewHeapRawInfo( const TMemSpyHeapInfo& aInfo )
+	{
+	_LIT(KUnknown, "Unknown");
+	TMemSpyHeapData list;
+	list.iType.Copy(KUnknown);
+
+	// Heap type	
+	if (aInfo.Type() != TMemSpyHeapInfo::ETypeUnknown)
+		{
+		const TMemSpyHeapInfoRHeap& rHeap = aInfo.AsRHeap();
+		const TMemSpyHeapMetaDataRHeap& metaData = rHeap.MetaData();
+		const TMemSpyHeapStatisticsRHeap& statistics = rHeap.Statistics();
+
+		_LIT(KRHeap, "RHeap");
+		_LIT(KRHybridHeap, "RHybridHeap");
+		switch (aInfo.Type())
+			{
+			case TMemSpyHeapInfo::ETypeRHeap:
+				list.iType.Copy(KRHeap);
+				break;
+			case TMemSpyHeapInfo::ETypeRHybridHeap:
+				list.iType.Copy(KRHybridHeap);
+				break;
+			default:
+				break;
+			}
+
+	    // Heap size is the total amount of memory committed to the heap, which includes the size of the embedded (in-place) RHeap/RHybridHeap.
+	    list.iSize = metaData.iHeapSize;
+	    list.iBaseAddress = (TUint)metaData.iAllocatorAddress; // TODO we can't do the base address any more, allocator address is the closest thing
+	    list.iShared = metaData.IsSharedHeap();
+	    list.iChunkSize = metaData.ChunkSize();
+	    list.iAllocationsCount = statistics.StatsAllocated().TypeCount();
+	    list.iFreeCount = statistics.StatsFree().TypeCount();
+	    list.iBiggestAllocation = statistics.StatsAllocated().LargestCellSize();
+	    list.iBiggestFree = statistics.StatsFree().LargestCellSize();
+	    list.iTotalAllocations =  statistics.StatsAllocated().TypeSize();	        
+	    list.iTotalFree =  statistics.StatsFree().TypeSize();
+	    list.iSlackFreeSpace = statistics.StatsFree().SlackSpaceCellSize();
+	    list.iFragmentation = statistics.StatsFree().TypeSize() - statistics.StatsFree().SlackSpaceCellSize(); //to calculate percentage value use iSize as 100% value
+	    list.iHeaderSizeA = 0; //metaData.HeaderSizeAllocated();
+	    list.iHeaderSizeF = 0; //metaData.HeaderSizeFree();
+	    TInt allocOverhead = rHeap.Overhead(); //metaData.HeaderSizeAllocated() * statistics.StatsAllocated().TypeCount();
+	    list.iAllocationOverhead = allocOverhead;
+	    //TInt freeOverhead = metaData.HeaderSizeFree() * statistics.StatsFree().TypeCount();
+	    list.iFreeOverhead = 0; // TODO there is no way of calculating this
+	    list.iTotalOverhead = allocOverhead; // freeOverhead + allocOverhead
+	    list.iOverhead = allocOverhead; //freeOverhead + allocOverhead; //to calculate percentage value use iSize as 100% value    
+	    list.iMinLength = metaData.iMinHeapSize;
+	    list.iMaxLength = metaData.iMaxHeapSize;
+	    list.iDebugAllocatorLibrary = metaData.IsDebugAllocator();
+		}
+
+	return list;
+	}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TUint CMemSpyEngineHelperHeap::DescriptorAsDWORD( const TDesC8& aItem)
+    {
+    __ASSERT_ALWAYS( aItem.Length() >= 4, User::Invariant() );
+    const TUint ret =  aItem[0] +
+                      (aItem[1] << 8) + 
+                      (aItem[2] << 16) + 
+                      (aItem[3] << 24);
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperHeap::AppendMetaDataL( const TMemSpyHeapInfo& aInfo, CMemSpyEngineOutputList& aList )
+    {
+    const TMemSpyHeapInfoRHeap& rHeap = aInfo.AsRHeap();
+
+    // Make caption
+    _LIT( KOverallCaption1, "Meta Data" );
+    aList.AddItemL( KOverallCaption1 );
+    aList.AddUnderlineForPreviousItemL( '=', 0 );
+
+    // Type
+    _LIT( KMetaData_Type,  "Type:" );
+    if ( aInfo.Type() == TMemSpyHeapInfo::ETypeUnknown )
+        {
+        _LIT( KMetaData_Type_Unknown,  "Unknown" );
+        aList.AddItemL( KMetaData_Type, KMetaData_Type_Unknown );
+        }
+    else
+        {
+        const TMemSpyHeapMetaDataRHeap& metaData = rHeap.MetaData();
+    
+        // Type
+        _LIT( KMetaData_Type_RHeap,  "Symbian OS RHeap" );
+        _LIT( KMetaData_Type_RHybridHeap,  "Symbian OS RHybridHeap" );
+		if (aInfo.Type() == TMemSpyHeapInfo::ETypeRHeap)
+			{
+	        aList.AddItemL( KMetaData_Type, KMetaData_Type_RHeap );
+			}
+		else
+			{
+			aList.AddItemL( KMetaData_Type, KMetaData_Type_RHybridHeap );
+			}
+
+        // VTable
+        //_LIT( KMetaData_VTable,  "VTable:" );
+        //aList.AddItemHexL( KMetaData_VTable, metaData.VTable() );
+
+        // Object size
+        //_LIT( KMetaData_ObjectSize,  "Object Size:" );
+        //aList.AddItemL( KMetaData_ObjectSize, metaData.ClassSize() );
+
+        // Chunk name
+        _LIT( KMetaData_ChunkName,  "Chunk Name:" );
+        TPtrC pChunkName( metaData.ChunkName() );
+        aList.AddItemL( KMetaData_ChunkName, pChunkName );
+
+        // Chunk size
+        _LIT( KMetaData_ChunkSize,  "Chunk Size:" );
+        aList.AddItemL( KMetaData_ChunkSize, metaData.ChunkSize() );
+
+        // Chunk base address
+        _LIT( KMetaData_ChunkBaseAddress,  "Chunk Base Address:" );
+        aList.AddItemL( KMetaData_ChunkBaseAddress, metaData.ChunkBaseAddress() );
+
+        // Debug allocator
+        _LIT( KMetaData_DebugAllocator,  "Debug Allocator:" );
+        aList.AddItemYesNoL( KMetaData_DebugAllocator, metaData.IsDebugAllocator() );
+
+        // Shared Heap
+        _LIT( KMetaData_Shared,  "Shared:" );
+        aList.AddItemYesNoL( KMetaData_Shared, metaData.IsSharedHeap() );
+
+        // Add ROM info
+        iEngine.HelperROM().AddInfoL( aList );
+        }
+
+    aList.AddBlankItemL( 1 );
+    }
+
+void CMemSpyEngineHelperHeap::AppendStatisticsL( const TMemSpyHeapInfo& aInfo, CMemSpyEngineOutputList& aList )
+    {
+    if (aInfo.Type() != TMemSpyHeapInfo::ETypeUnknown)
+        {
+        const TMemSpyHeapInfoRHeap& rHeap = aInfo.AsRHeap();
+        const TMemSpyHeapStatisticsRHeap& rHeapStats = rHeap.Statistics();
+
+        // Shared captions
+        _LIT( KStatsData_CellCount,  "Number of cells:" );
+        _LIT( KStatsData_CellSize,  "Size of cells:" );
+        _LIT( KStatsData_LargestCellAddress,  "Largest cell:" );
+        _LIT( KStatsData_LargestCellSize,  "Largest cell size:" );
+
+        // Free space
+        _LIT( KOverallCaption1, "Free Cell Statistics" );
+        aList.AddItemL( KOverallCaption1 );
+        aList.AddUnderlineForPreviousItemL( '=', 0 );
+
+        aList.AddItemL( KStatsData_CellCount, rHeapStats.StatsFree().TypeCount() );
+        aList.AddItemL( KStatsData_CellSize, rHeapStats.StatsFree().TypeSize() );
+        aList.AddItemL( KStatsData_LargestCellAddress, rHeapStats.StatsFree().LargestCellAddress() );
+        aList.AddItemL( KStatsData_LargestCellSize, rHeapStats.StatsFree().LargestCellSize() );
+		if (aInfo.Type() == TMemSpyHeapInfo::ETypeRHeap)
+			{
+			_LIT( KStatsData_Free_SlackCellAddress,  "Slack:" );
+			aList.AddItemL( KStatsData_Free_SlackCellAddress, rHeapStats.StatsFree().SlackSpaceCellAddress() );
+			_LIT( KStatsData_Free_SlackCellSize,  "Slack size:" );
+			aList.AddItemL( KStatsData_Free_SlackCellSize, rHeapStats.StatsFree().SlackSpaceCellSize() );
+			}
+        _LIT( KStatsData_Free_Checksum,  "Checksum:" );
+        aList.AddItemHexL( KStatsData_Free_Checksum, rHeapStats.StatsFree().Checksum() );
+
+        aList.AddBlankItemL( 1 );
+
+        // Allocated space
+        _LIT( KOverallCaption2, "Allocated Cell Statistics" );
+        aList.AddItemL( KOverallCaption2 );
+        aList.AddUnderlineForPreviousItemL( '=', 0 );
+
+        aList.AddItemL( KStatsData_CellCount, rHeapStats.StatsAllocated().TypeCount() );
+        aList.AddItemL( KStatsData_CellSize, rHeapStats.StatsAllocated().TypeSize() );
+        aList.AddItemL( KStatsData_LargestCellAddress, rHeapStats.StatsAllocated().LargestCellAddress() );
+        aList.AddItemL( KStatsData_LargestCellSize, rHeapStats.StatsAllocated().LargestCellSize() );
+
+        aList.AddBlankItemL( 1 );
+         }
+    }
+
+
+void CMemSpyEngineHelperHeap::AppendCellsL(const RArray<TMemSpyDriverCell>& aCells, CMemSpyEngineOutputList& aList)
+    {
+    // For reasons that may or may not turn out to be sensible, we separate free and allocated cells in the output data
+
+    _LIT( KOverallCaption1, "Free Cell List" );
+    aList.AddItemL( KOverallCaption1 );
+    aList.AddUnderlineForPreviousItemL( '=', 0 );
+
+    TBuf<128> caption;
+    _LIT( KCaptionFormat, "FC %04d" );
+    _LIT( KValueFormat, "0x%08x %8d %d" );
+
+	TBool foundAllocatedCells = EFalse;
+    const TInt count = aCells.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const TMemSpyDriverCell& cell = aCells[ i ];
+		if (cell.iType & EMemSpyDriverAllocatedCellMask)
+			{
+			foundAllocatedCells = ETrue;
+			}
+		else if (cell.iType & EMemSpyDriverFreeCellMask)
+			{
+	        caption.Format( KCaptionFormat, i + 1 );
+		    aList.AddItemFormatL( caption, KValueFormat, cell.iAddress, cell.iLength, cell.iType );
+			}
+        }
+
+	if (foundAllocatedCells)
+		{
+        aList.AddBlankItemL( 1 );
+		_LIT( KOverallCaption1, "Allocated Cell List" );
+		aList.AddItemL( KOverallCaption1 );
+		aList.AddUnderlineForPreviousItemL( '=', 0 );
+
+		TBuf<128> caption;
+		_LIT( KCaptionFormat, "AC %04d" );
+		_LIT( KValueFormat, "0x%08x %8d %d" );
+
+		for (TInt i = 0; i < count; i++)
+			{
+			const TMemSpyDriverCell& cell = aCells[ i ];
+			if (cell.iType & EMemSpyDriverAllocatedCellMask)
+				{
+				caption.Format( KCaptionFormat, i + 1 );
+				aList.AddItemFormatL( caption, KValueFormat, cell.iAddress, cell.iLength, cell.iType );
+				}
+			}
+		}
+    }
+
+void CMemSpyEngineHelperHeap::UpdateSharedHeapInfoL( const TProcessId& aProcess, const TThreadId& aThread, TMemSpyHeapInfo& aInfo )
+    {
+    RArray<TThreadId> threads;
+    CleanupClosePushL( threads );
+    iEngine.Driver().GetThreadsL( aProcess, threads );
+    TMemSpyHeapInfo otherHeap;
+    TThreadId otherThreadId;
+    TInt r( KErrNone );
+    for ( TInt i = 0; i < threads.Count(); i++ )
+        {
+        otherThreadId = threads[i];
+        if ( aThread != otherThreadId ) // skip current thread
+            {
+            r = iEngine.Driver().GetHeapInfoUser( otherHeap, otherThreadId );
+            if ( !r && otherHeap.AsRHeap().MetaData().ChunkHandle() == aInfo.AsRHeap().MetaData().ChunkHandle() )
+                {
+                TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::UpdateSharedHeapInfoL - shared heap detected chunkhandle: 0x%08x", aInfo.AsRHeap().MetaData().ChunkHandle() ) );
+                aInfo.AsRHeap().MetaData().SetSharedHeap( ETrue );
+                break;
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( &threads );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperKernelContainers.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,542 @@
+/*
+* 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<memspy/engine/memspyenginehelperkernelcontainers.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+#include <memspy/driver/memspydriverconstants.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// Constants
+const TInt KMaxGenericHandleCount = 1024 * 2;
+_LIT( KMemSpyMarkerKernelContainer, "<%SMEMSPY_KERNEL_CONTAINER_%02d>" );
+_LIT( KMemSpyMarkerKernelContainersAll, "<%SMEMSPY_KERNEL_CONTAINERS>" );
+
+
+
+CMemSpyEngineHelperKernelContainers::CMemSpyEngineHelperKernelContainers( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperKernelContainers::~CMemSpyEngineHelperKernelContainers()
+    {
+    }
+
+
+void CMemSpyEngineHelperKernelContainers::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperKernelContainers* CMemSpyEngineHelperKernelContainers::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperKernelContainers* self = new(ELeave) CMemSpyEngineHelperKernelContainers( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C CMemSpyEngineGenericKernelObjectList* CMemSpyEngineHelperKernelContainers::ObjectsForSpecificContainerL( TMemSpyDriverContainerType aForContainer )
+    {
+    CMemSpyEngineGenericKernelObjectList* list = CMemSpyEngineGenericKernelObjectList::NewLC( aForContainer, iEngine );
+    AddObjectsFromContainerL( *list, aForContainer );
+    CleanupStack::Pop( list );
+    return list;
+    }
+
+
+EXPORT_C CMemSpyEngineGenericKernelObjectContainer* CMemSpyEngineHelperKernelContainers::ObjectsAllL()
+    {
+    CMemSpyEngineGenericKernelObjectContainer* container = CMemSpyEngineGenericKernelObjectContainer::NewLC();
+    //
+    for( TInt i=EMemSpyDriverContainerTypeFirst; i<=EMemSpyDriverContainerTypeLast; i++ )
+        {
+        const TMemSpyDriverContainerType type = static_cast< TMemSpyDriverContainerType >( i );
+        //
+        CMemSpyEngineGenericKernelObjectList* list = CMemSpyEngineGenericKernelObjectList::NewLC( type, iEngine );
+        AddObjectsFromContainerL( *list, type );
+        container->AddListL( list );
+        CleanupStack::Pop( list );
+        }
+    //
+    CleanupStack::Pop( container );
+    return container;
+    }
+
+
+CMemSpyEngineGenericKernelObjectContainer* CMemSpyEngineHelperKernelContainers::ObjectsAllLightweightL()
+    {
+    CMemSpyEngineGenericKernelObjectContainer* container = CMemSpyEngineGenericKernelObjectContainer::NewLC();
+    //
+    for( TInt i=EMemSpyDriverContainerTypeFirst; i<=EMemSpyDriverContainerTypeLast; i++ )
+        {
+        const TMemSpyDriverContainerType type = static_cast< TMemSpyDriverContainerType >( i );
+        //
+        CMemSpyEngineGenericKernelObjectList* list = CMemSpyEngineGenericKernelObjectList::NewLC( type, iEngine );
+        AddObjectsFromContainerL( *list, type, EFalse );
+        container->AddListL( list );
+        CleanupStack::Pop( list );
+        }
+    //
+    CleanupStack::Pop( container );
+    return container;
+    }
+
+
+TMemSpyDriverContainerType CMemSpyEngineHelperKernelContainers::MapToType( TObjectType aType )
+    {
+    TMemSpyDriverContainerType ret = EMemSpyDriverContainerTypeUnknown;
+    //
+    if ( aType >= EMemSpyDriverContainerTypeFirst && aType <= EMemSpyDriverContainerTypeLast )
+        {
+        ret = (TMemSpyDriverContainerType) aType;
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperKernelContainers::OutputL( const CMemSpyEngineGenericKernelObjectContainer& aContainer ) const
+    {
+    aContainer.OutputL( iEngine.Sink() );
+    }
+
+
+CMemSpyEngine& CMemSpyEngineHelperKernelContainers::Engine() const
+    {
+    return iEngine;
+    }
+
+
+void CMemSpyEngineHelperKernelContainers::AddObjectsFromContainerL( CMemSpyEngineGenericKernelObjectList& aList, TMemSpyDriverContainerType aContainer, TBool aGetInfo )
+    {
+	TAny* handles[KMaxGenericHandleCount];
+	TInt c = KMaxGenericHandleCount;
+
+	TInt r = iEngine.Driver().GetContainerHandles( aContainer, handles, c );
+	if  ( r == KErrNone )
+    	{
+        if  ( c > 0 )
+            {
+        	if (c > KMaxGenericHandleCount)
+        		{
+        		c = KMaxGenericHandleCount;
+        		}
+
+        	TMemSpyDriverHandleInfoGeneric info;
+        	for (TInt i=0; i<c && r == KErrNone; i++)
+        		{
+                if  ( aGetInfo )
+                    {
+        		    r = iEngine.Driver().GetGenericHandleInfo( KMemSpyDriverEnumerateContainerHandles, aContainer, handles[i], info );
+        		    if  ( r == KErrNone )
+        			    {
+        			    aList.AddItemL( info );
+        			    }
+                    }
+                else
+                    {
+                    aList.AddItemL( handles[ i ] );
+                    }
+        		}
+            }
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineGenericKernelObjectList::CMemSpyEngineGenericKernelObjectList( TMemSpyDriverContainerType aType )
+:   iType( aType ), iItems( 25 ), iHandles( 25 )
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineGenericKernelObjectList::~CMemSpyEngineGenericKernelObjectList()
+    {
+    delete iName;
+    iHandles.Close();
+    iItems.Close();
+    }
+
+
+void CMemSpyEngineGenericKernelObjectList::ConstructL( CMemSpyEngine& aEngine )
+    {
+    iName = HBufC::NewL( KMaxFullName );
+    iSize = aEngine.Driver().GetApproximateKernelObjectSize( iType );
+    UpdateNameL();
+    }
+
+
+CMemSpyEngineGenericKernelObjectList* CMemSpyEngineGenericKernelObjectList::NewLC( TMemSpyDriverContainerType aType, CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineGenericKernelObjectList* self = new(ELeave) CMemSpyEngineGenericKernelObjectList( aType );
+    CleanupStack::PushL( self );
+    self->ConstructL( aEngine );
+    return self;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineGenericKernelObjectList::Count() const
+    {
+    return iHandles.Count();
+    }
+
+
+EXPORT_C const TMemSpyDriverHandleInfoGeneric& CMemSpyEngineGenericKernelObjectList::At( TInt aIndex ) const
+    {
+    return iItems[ aIndex ];
+    }
+
+
+EXPORT_C TMemSpyDriverContainerType CMemSpyEngineGenericKernelObjectList::Type() const
+    {
+    return iType;
+    }
+
+EXPORT_C TInt CMemSpyEngineGenericKernelObjectList::Size() const
+    {
+    return iSize;
+    }
+
+EXPORT_C TInt CMemSpyEngineGenericKernelObjectList::ItemsCount() const
+	{
+	return iItems.Count();
+	}
+    
+
+EXPORT_C TPtrC CMemSpyEngineGenericKernelObjectList::TypeAsString( TMemSpyDriverContainerType aType )
+    {
+    _LIT( KTypeUnknown, "Unknown Type" );
+    _LIT( KTypeThread, "Thread" );
+    _LIT( KTypeProcess, "Process" );
+    _LIT( KTypeChunk, "Chunk" );
+    _LIT( KTypeLibrary, "Library" );
+    _LIT( KTypeSemaphore, "Semaphore" );
+    _LIT( KTypeMutex, "Mutex" );
+    _LIT( KTypeTimer, "Timer" );
+    _LIT( KTypeServer, "Server" );
+    _LIT( KTypeSession, "Session" );
+    _LIT( KTypeLogicalDevice, "Logical Device" );
+    _LIT( KTypePhysicalDevice, "Physical Device" );
+    _LIT( KTypeLogicalChannel, "Logical Channel" );
+    _LIT( KTypeChangeNotifier, "Change Notifier" );
+    _LIT( KTypeUndertaker, "Undertaker" );
+    _LIT( KTypeMsgQueue, "Msg. Queue" );
+    _LIT( KTypePropertyRef, "Property Ref." );
+    _LIT( KTypeCondVar, "Conditional Var." );
+     //
+    TPtrC pType( KTypeUnknown );
+    //
+    switch( aType )
+        {
+    case EMemSpyDriverContainerTypeThread:
+        pType.Set( KTypeThread );
+        break;
+    case EMemSpyDriverContainerTypeProcess:
+        pType.Set( KTypeProcess );
+        break;
+    case EMemSpyDriverContainerTypeChunk:
+        pType.Set( KTypeChunk );
+        break;
+    case EMemSpyDriverContainerTypeLibrary:
+        pType.Set( KTypeLibrary );
+        break;
+    case EMemSpyDriverContainerTypeSemaphore:
+        pType.Set( KTypeSemaphore );
+        break;
+    case EMemSpyDriverContainerTypeMutex:
+        pType.Set( KTypeMutex );
+        break;
+    case EMemSpyDriverContainerTypeTimer:
+        pType.Set( KTypeTimer );
+        break;
+    case EMemSpyDriverContainerTypeServer:
+        pType.Set( KTypeServer );
+        break;
+    case EMemSpyDriverContainerTypeSession:
+        pType.Set( KTypeSession );
+        break;
+    case EMemSpyDriverContainerTypeLogicalDevice:
+        pType.Set( KTypeLogicalDevice );
+        break;
+    case EMemSpyDriverContainerTypePhysicalDevice:
+        pType.Set( KTypePhysicalDevice );
+        break;
+    case EMemSpyDriverContainerTypeLogicalChannel:
+        pType.Set( KTypeLogicalChannel );
+        break;
+    case EMemSpyDriverContainerTypeChangeNotifier:
+        pType.Set( KTypeChangeNotifier );
+        break;
+    case EMemSpyDriverContainerTypeUndertaker:
+        pType.Set( KTypeUndertaker );
+        break;
+    case EMemSpyDriverContainerTypeMsgQueue:
+        pType.Set( KTypeMsgQueue );
+        break;
+    case EMemSpyDriverContainerTypePropertyRef:
+        pType.Set( KTypePropertyRef );
+        break;
+    case EMemSpyDriverContainerTypeCondVar:
+        pType.Set( KTypeCondVar );
+        break;
+        
+    default:
+        break;
+        }
+    //
+    return pType;
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineGenericKernelObjectList::Name() const
+    {
+    return TPtrC( *iName );
+    }
+
+
+EXPORT_C void CMemSpyEngineGenericKernelObjectList::OutputL( CMemSpyEngineOutputSink& aSink ) const
+    {
+    // Start marker
+    aSink.OutputLineFormattedL( KMemSpyMarkerKernelContainer, &KNullDesC, iType );
+
+    TBuf<70> itemPrefix;
+    TBuf<KMaxFullName + 128> buf;
+    const TInt entryCount = Count();
+    const TInt64 size( iSize * entryCount );
+    const TMemSpySizeText sizeText( MemSpyEngineUtils::FormatSizeText( size, 0 ) );
+    //    
+    _LIT(KContainerTitle, "CONTAINER \'%S\' => %d item(s), %S");
+    const TPtrC pType( TypeAsString( iType ) );
+    buf.Format(KContainerTitle, &pType, entryCount, &sizeText);
+    aSink.OutputSectionHeadingL( buf, '=' );
+    //
+    for( TInt entryIndex=0; entryIndex<entryCount; entryIndex++ )
+        {
+        const TMemSpyDriverHandleInfoGeneric& entry = At( entryIndex );
+        //
+        _LIT( KItemPrefixFormat, "[KernCont] {%04d} 0x%08x" );
+        itemPrefix.Format( KItemPrefixFormat, entryIndex, entry.iHandle );
+
+        buf.Copy( entry.iName );
+
+        aSink.OutputItemAndValueL( itemPrefix, buf );
+        }
+
+    // End marker
+    aSink.OutputBlankLineL();
+    aSink.OutputLineFormattedL( KMemSpyMarkerKernelContainer, &KMemSpySinkTagClose, iType );
+    aSink.OutputBlankLineL();
+    }
+
+
+TAny* CMemSpyEngineGenericKernelObjectList::HandleAt( TInt aIndex ) const
+    {
+    return iHandles[ aIndex ];
+    }
+
+
+void CMemSpyEngineGenericKernelObjectList::AddItemL( TAny* aHandle )
+    {
+    iHandles.InsertInAddressOrderL( aHandle );
+    }
+
+
+void CMemSpyEngineGenericKernelObjectList::AddItemL( const TMemSpyDriverHandleInfoGeneric& aItem )
+    {
+    AddItemL( aItem.iHandle );
+    iItems.AppendL( aItem );
+    //
+    //UpdateNameL();
+    }
+
+
+void CMemSpyEngineGenericKernelObjectList::UpdateNameL()
+    {
+    const TInt count = iItems.Count();
+    const TInt64 size( iSize * count );
+    const TMemSpySizeText sizeText( MemSpyEngineUtils::FormatSizeText( size, 0 ) );
+    //
+    _LIT(KNameFormat, "\t%S\t\t%d item");
+    TPtr pName( iName->Des() );
+    //
+    const TPtrC pType( TypeAsString( iType ) );
+    //
+    pName.Format( KNameFormat, &pType, count );
+    //
+    if  ( count == 0 || count > 1 )
+        {
+        pName.Append( _L("s") );
+        }
+
+    pName.AppendFormat( _L(", %S"), &sizeText );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineGenericKernelObjectContainer::CMemSpyEngineGenericKernelObjectContainer()
+:   iItems( 25 )
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineGenericKernelObjectContainer::~CMemSpyEngineGenericKernelObjectContainer()
+    {
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    }
+
+
+void CMemSpyEngineGenericKernelObjectContainer::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineGenericKernelObjectContainer* CMemSpyEngineGenericKernelObjectContainer::NewLC()
+    {
+    CMemSpyEngineGenericKernelObjectContainer* self = new(ELeave) CMemSpyEngineGenericKernelObjectContainer();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineGenericKernelObjectContainer::Count() const
+    {
+    return iItems.Count();
+    }
+
+
+EXPORT_C const CMemSpyEngineGenericKernelObjectList& CMemSpyEngineGenericKernelObjectContainer::At( TInt aIndex ) const
+    {
+    return *iItems[ aIndex ];
+    }
+
+
+EXPORT_C void CMemSpyEngineGenericKernelObjectContainer::OutputL( CMemSpyEngineOutputSink& aSink ) const
+    {
+    // Start marker
+    aSink.OutputLineFormattedL( KMemSpyMarkerKernelContainersAll, &KNullDesC );
+
+    const TInt listCount= Count();
+    for( TInt listIndex=0; listIndex<listCount; listIndex++ )
+        {
+        const CMemSpyEngineGenericKernelObjectList& list = At( listIndex );
+        list.OutputL( aSink );
+        }
+
+    // End marker
+    aSink.OutputLineFormattedL( KMemSpyMarkerKernelContainersAll, &KMemSpySinkTagClose );
+    }
+
+
+void CMemSpyEngineGenericKernelObjectContainer::AddListL( CMemSpyEngineGenericKernelObjectList* aList )
+    {
+    iItems.AppendL( aList );
+    }
+
+
+EXPORT_C TInt CMemSpyEngineGenericKernelObjectContainer::MdcaCount() const
+    {
+    return Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineGenericKernelObjectContainer::MdcaPoint( TInt aIndex ) const
+    {
+    const CMemSpyEngineGenericKernelObjectList& item = At( aIndex );
+    return item.Name();
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperProcess.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,289 @@
+/*
+* 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 <memspy/engine/memspyenginehelperprocess.h>
+
+// System includes
+#include <e32debug.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyenginemidwife.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include <memspy/engine/memspyenginehelperthread.h>
+#include <memspy/engine/memspyengineprocessmemorytracker.h>
+
+
+
+CMemSpyEngineHelperProcess::CMemSpyEngineHelperProcess( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperProcess::~CMemSpyEngineHelperProcess()
+    {
+    delete iUndertaker;
+    iEngine.Midwife().RemoveObserver( *this );
+    //
+    iMemoryTrackers.ResetAndDestroy();
+    iMemoryTrackers.Close();
+    iMemoryTrackerAutoStartProcessList.Close();
+    }
+
+
+void CMemSpyEngineHelperProcess::ConstructL()
+    {
+    iUndertaker = CMemSpyEngineUndertaker::NewL( iEngine.Driver() );
+    iUndertaker->AddObserverL( *this );
+    iEngine.Midwife().AddObserverL( *this );
+    }
+
+
+CMemSpyEngineHelperProcess* CMemSpyEngineHelperProcess::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperProcess* self = new(ELeave) CMemSpyEngineHelperProcess( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperProcess::ImpersonateL( TUint32 aSID )
+    {
+    const TInt err = iEngine.Driver().Impersonate( aSID );
+    User::LeaveIfError( err );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperProcess::OutputProcessInfoL( const CMemSpyProcess& aProcess )
+    {
+    OutputProcessInfoL( aProcess, EFalse );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperProcess::OutputProcessInfoDetailedL( const CMemSpyProcess& aProcess )
+    {
+    OutputProcessInfoL( aProcess, ETrue );
+    }
+
+
+void CMemSpyEngineHelperProcess::OutputProcessInfoL( const CMemSpyProcess& aProcess, TBool aDetailed )
+    {
+    const TUint pid = aProcess.Id();
+    const TUint sid = aProcess.SID();
+    RProcess process;
+    User::LeaveIfError( iEngine.Driver().OpenProcess( pid, process ) );
+    CleanupClosePushL( process );
+
+    const TPtrC procName( aProcess.Name() );
+    TBuf<512> infoBuf;
+    //
+    _LIT(KProcessInfo, "SUMMARY FOR PROCESS \'%S\'");
+    infoBuf.Format(KProcessInfo, &procName);
+    iEngine.Sink().OutputSectionHeadingL( infoBuf, '=' );
+   
+    _LIT(KProcessId, "Id");
+    iEngine.Sink().OutputItemAndValueL( KProcessId, pid );
+
+    _LIT(KProcessPri, "Priority");
+    TBuf<30> priority;
+    const TProcessPriority procPriValue = process.Priority();
+    CMemSpyProcess::AppendPriority( priority, procPriValue );
+    iEngine.Sink().OutputItemAndValueL( KProcessPri, priority );
+
+    _LIT(KProcessSID, "SID");
+    iEngine.Sink().OutputItemAndValueL( KProcessSID, sid, ETrue );
+    CleanupStack::PopAndDestroy( &process );
+
+    if  ( aDetailed )
+        {
+        iEngine.ProcessSuspendLC( pid );
+        iEngine.HelperChunk().OutputChunkInfoForProcessL( aProcess );
+        iEngine.HelperCodeSegment().OutputCodeSegmentsL( pid, infoBuf, KNullDesC, '-', ETrue );
+        CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+        }
+
+    const TInt count = aProcess.Count();
+    for(TInt i=0; i<count; i++)
+        {
+        const CMemSpyThread& thread = aProcess.At( i );
+        iEngine.HelperThread().OutputThreadInfoL( thread, aDetailed );
+        }
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperProcess::SetMemoryTrackingAutoStartProcessListL( const RArray<TUid>& aProcessUids )
+    {
+    iEngine.Driver().ProcessInspectionAutoStartItemsReset();
+    //
+    const TInt count = aProcessUids.Count();
+    iMemoryTrackerAutoStartProcessList.Reset();
+    //
+    for( TInt i=0; i<count; i++ )
+        {
+        const TUid uid = aProcessUids[ i ];
+#ifdef _DEBUG
+        RDebug::Printf( "CMemSpyEngineHelperProcess::SetMemoryTrackingAutoStartProcessListL() - uid[%2d] => 0x%08x", i, uid.iUid );
+#endif
+        //
+        User::LeaveIfError( iMemoryTrackerAutoStartProcessList.Append( uid ) );
+        //
+        const TInt driverErr = iEngine.Driver().ProcessInspectionAutoStartItemsAdd( uid.iUid );
+#ifdef _DEBUG
+        RDebug::Printf( "CMemSpyEngineHelperProcess::SetMemoryTrackingAutoStartProcessListL() - driver err: %d", driverErr );
+#endif
+        User::LeaveIfError( driverErr );
+        }
+    }
+
+
+CMemSpyEngineProcessMemoryTracker* CMemSpyEngineHelperProcess::TrackerOrNull( const TProcessId& aId )
+    {
+    CMemSpyEngineProcessMemoryTracker* ret = NULL;
+    //
+    const TInt count = iMemoryTrackers.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        CMemSpyEngineProcessMemoryTracker* tracker = iMemoryTrackers[ i ];
+        //
+        if ( tracker->ProcessId() == aId )
+            {
+            ret = tracker;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+    
+
+CMemSpyEngineProcessMemoryTracker& CMemSpyEngineHelperProcess::TrackerL( const TProcessId& aId )
+    {
+    CMemSpyEngineProcessMemoryTracker* tracker = TrackerOrNull( aId );
+    //
+    if  ( tracker == NULL )
+        {
+        // Make a new entry
+        tracker = CMemSpyEngineProcessMemoryTracker::NewLC( iEngine, aId );
+        User::LeaveIfError( iMemoryTrackers.Append( tracker ) );
+        CleanupStack::Pop( tracker );
+        }
+    //
+    return *tracker;
+    }
+
+
+CMemSpyEngineProcessMemoryTracker& CMemSpyEngineHelperProcess::TrackerL( const CMemSpyProcess& aProcess )
+    {
+    return TrackerL( aProcess.Id() );
+    }
+
+
+void CMemSpyEngineHelperProcess::ThreadIsBornL( const TThreadId& aId, const RThread& aThread )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineHelperProcess::ThreadIsBornL() - aId: 0x%08x, aThread handle: 0x%08x", (TUint) aId, aThread.Handle() );
+#else
+    (void) aId;
+    (void) aThread;
+#endif
+    }
+
+
+void CMemSpyEngineHelperProcess::ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineHelperProcess::ProcessIsBornL() - aId: 0x%08x, aProcess handle: 0x%08x", (TUint) aId, aProcess.Handle() );
+#else
+    (void) aId;
+    (void) aProcess;
+#endif
+
+    if ( aProcess.Handle() != KNullHandle )
+        {
+        const TBool isAutoStart = IsAutoStartupProcess( aProcess.SecureId() );
+        //
+        if ( isAutoStart )
+            {
+            CMemSpyEngineProcessMemoryTracker& tracker = TrackerL( aId );
+            tracker.StartL();
+            }
+        }
+    }
+
+
+void CMemSpyEngineHelperProcess::ThreadIsDeadL( const TThreadId& aId, const RThread& aThread )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineHelperProcess::ThreadIsDeadL() - aId: 0x%08x, aThread handle: 0x%08x", (TUint) aId, aThread.Handle() );
+#else
+    (void) aId;
+    (void) aThread;
+#endif
+    }
+
+
+void CMemSpyEngineHelperProcess::ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineHelperProcess::ProcessIsDeadL() - aId: 0x%08x, aProcess handle: 0x%08x", (TUint) aId, aProcess.Handle() );
+#else
+    (void) aProcess;
+#endif
+
+    CMemSpyEngineProcessMemoryTracker* tracker = TrackerOrNull( aId );
+    if  ( tracker )
+        {
+#ifdef _DEBUG
+        RDebug::Printf( "CMemSpyEngineHelperProcess::ProcessIsDeadL() - tracker for this process should take care of cleanup by itself..." );
+#endif
+        }
+    }
+    
+
+TBool CMemSpyEngineHelperProcess::IsAutoStartupProcess( TUid aUid ) const
+    {
+    TBool match = EFalse;
+    //
+    const TInt count = iMemoryTrackerAutoStartProcessList.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const TUid uid = iMemoryTrackerAutoStartProcessList[ i ];
+        if ( uid == aUid )
+            {
+            match = ETrue;
+            break;
+            }
+        }
+    //
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineHelperProcess::IsAutoStartupProcess() - aUid: 0x%08x, ret: %d", aUid.iUid, match );
+#endif
+    return match;
+    }
+    
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperRAM.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,156 @@
+/*
+* 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 <memspy/engine/memspyenginehelperram.h>
+
+// System includes
+#include <hal.h>
+#include <e32debug.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include "MemSpyEngineOutputListItem.h"
+#include <memspy/engine/memspyengineoutputsink.h>
+
+// Type defs
+typedef TInt(*TAknIconCacheConfigFunction)(TBool);
+
+// Constants
+const TInt KAknIconCacheConfigOrdinal = 44;
+
+// Literal constants
+_LIT( KMemSpyAknIconDllName, "AKNICON.DLL" );
+
+
+CMemSpyEngineHelperRAM::CMemSpyEngineHelperRAM( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperRAM::~CMemSpyEngineHelperRAM()
+    {
+    }
+
+
+void CMemSpyEngineHelperRAM::ConstructL()
+    {
+    CheckIfAknIconCacheCanBeConfiguredL();
+    }
+
+
+CMemSpyEngineHelperRAM* CMemSpyEngineHelperRAM::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperRAM* self = new(ELeave) CMemSpyEngineHelperRAM( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C TBool CMemSpyEngineHelperRAM::IsAknIconCacheConfigurable() const
+    {
+    return iIsAknIconCacheConfigurable;
+    }
+
+
+EXPORT_C TInt64 CMemSpyEngineHelperRAM::SetAknIconCacheStatusL( TBool aEnabled )
+    {
+    TInt64 ret( 0 );
+    //
+    if  ( iIsAknIconCacheConfigurable )
+        {
+        TInt freeRamBeforeOp = KErrNotFound;
+        User::LeaveIfError( HAL::Get( HALData::EMemoryRAMFree, freeRamBeforeOp ) );
+        //
+        const TInt error = SetAknIconStatus( aEnabled );
+        User::LeaveIfError( error );
+        //
+        if  ( aEnabled == EFalse )
+            {
+            // Turning cache off, check how much ram we saved...
+            TInt freeRamAfterOp = KErrNotFound;
+            User::LeaveIfError( HAL::Get( HALData::EMemoryRAMFree, freeRamAfterOp ) );
+
+            // Work out how much ram was saved... 
+            ret = ( freeRamAfterOp - freeRamBeforeOp );
+            }
+        }
+    //
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperRAM::CheckIfAknIconCacheCanBeConfiguredL()
+    {
+#ifndef __WINS__
+    RLibrary lib;
+    const TInt loadErr = lib.Load( KMemSpyAknIconDllName );
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineHelperRAM::SetAknIconStatus() - dll load: %d", loadErr );
+#endif
+    if  ( loadErr == KErrNone )
+        {
+        TLibraryFunction ordinal = lib.Lookup( KAknIconCacheConfigOrdinal );
+#ifdef _DEBUG
+        RDebug::Printf( "CMemSpyEngineHelperRAM::SetAknIconStatus() - ordinal: 0x%08x", ordinal );
+#endif
+        //
+        iIsAknIconCacheConfigurable = ( ordinal != NULL );
+        lib.Close();
+        }
+#endif
+    }
+
+
+TInt CMemSpyEngineHelperRAM::SetAknIconStatus( TBool aEnabled )
+    {
+    TInt ret = KErrNotSupported;
+    //
+#ifndef __WINS__
+    RLibrary lib;
+    const TInt loadErr = lib.Load( KMemSpyAknIconDllName );
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineHelperRAM::SetAknIconStatus() - dll load: %d", loadErr );
+#endif
+    if  ( loadErr == KErrNone )
+        {
+        TLibraryFunction ordinal = lib.Lookup( KAknIconCacheConfigOrdinal );
+#ifdef _DEBUG
+        RDebug::Printf( "CMemSpyEngineHelperRAM::SetAknIconStatus() - ordinal: 0x%08x", ordinal );
+#endif
+        //
+        if  ( ordinal )
+            {
+            TAknIconCacheConfigFunction func = (TAknIconCacheConfigFunction) ordinal;
+            ret = (*func)( aEnabled );
+#ifdef _DEBUG
+            RDebug::Printf( "CMemSpyEngineHelperRAM::SetAknIconStatus() - ret: %d", ret );
+#endif
+            }
+        //
+        lib.Close();
+        }
+#else
+	aEnabled = EFalse;
+#endif
+    //
+    return ret;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperROM.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 <memspy/engine/memspyenginehelperrom.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include "MemSpyEngineOutputListItem.h"
+#include <memspy/engine/memspyengineoutputsink.h>
+
+
+CMemSpyEngineHelperROM::CMemSpyEngineHelperROM( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperROM::~CMemSpyEngineHelperROM()
+    {
+    delete iPlatformVersion;
+    delete iChecksum;
+    }
+
+
+void CMemSpyEngineHelperROM::ConstructL()
+    {
+    iPlatformVersion = HBufC::NewL( 128 );
+    iChecksum = HBufC::NewL( 10 );
+    //
+    TPtr pChecksum( iChecksum->Des() );
+    TPtr pPlatformVersion( iPlatformVersion->Des() );
+    //
+    MemSpyEngineUtils::GetRomInfoL( pPlatformVersion, pChecksum );
+    }
+
+
+CMemSpyEngineHelperROM* CMemSpyEngineHelperROM::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperROM* self = new(ELeave) CMemSpyEngineHelperROM( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperROM::AddInfoL( CMemSpyEngineOutputList& aList )
+    {
+    _LIT( KRomChecksum, "ROM Checksum" );
+    aList.AddItemL( KRomChecksum, *iChecksum );
+
+    _LIT( KRomVersion, "ROM Version" );
+    aList.AddItemL( KRomVersion, *iPlatformVersion );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperServer.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,455 @@
+/*
+* 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 <memspy/engine/memspyenginehelperserver.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+#include <memspy/driver/memspydriverconstants.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+
+// Literal constants
+_LIT( KMemSpyEngineServListOutputComma, ", " );
+
+
+
+CMemSpyEngineHelperServer::CMemSpyEngineHelperServer( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperServer::~CMemSpyEngineHelperServer()
+    {
+    }
+
+
+void CMemSpyEngineHelperServer::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperServer* CMemSpyEngineHelperServer::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperServer* self = new(ELeave) CMemSpyEngineHelperServer( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperServer::GetServerSessionsL( TAny* aServerHandle, RArray<TMemSpyDriverServerSessionInfo>& aSessions )
+    {
+	const TInt KMaxCount = 256;
+	TAny* handles[KMaxCount];
+	TInt c = KMaxCount;
+
+	TInt r = iEngine.Driver().GetServerSessionHandles( aServerHandle, handles, c );
+	if  ( r == KErrNone )
+    	{
+        if  ( c > 0 )
+            {
+        	if (c > KMaxCount)
+        		{
+        		c = KMaxCount;
+        		}
+
+        	TMemSpyDriverServerSessionInfo info;
+        	for (TInt i=0; i<c; i++)
+        		{
+        		r = iEngine.Driver().GetServerSessionInfo( handles[i], info );
+        		if (r == KErrNone)
+        			{
+        			aSessions.AppendL( info );
+        			}
+        		}
+            }
+        }
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperServer::GetServerSessionsL( const TMemSpyDriverHandleInfoGeneric& aServerDetails, RArray<TMemSpyDriverServerSessionInfo>& aSessions )
+    {
+    GetServerSessionsL( aServerDetails.iHandle, aSessions );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperServer::GetServerListL( RArray<TMemSpyDriverHandleInfoGeneric>& aServers )
+    {
+	const TInt KMaxCount = 256;
+	TAny* handles[KMaxCount];
+	TInt c = KMaxCount;
+
+	TInt r = iEngine.Driver().GetContainerHandles( EMemSpyDriverContainerTypeServer, handles, c );
+	if  ( r == KErrNone )
+    	{
+        if  ( c > 0 )
+            {
+        	if (c > KMaxCount)
+        		{
+        		c = KMaxCount;
+        		}
+
+        	TMemSpyDriverHandleInfoGeneric info;
+        	for (TInt i=0; i<c; i++)
+        		{
+        		r = iEngine.Driver().GetGenericHandleInfo( KMemSpyDriverEnumerateContainerHandles, EMemSpyDriverContainerTypeServer, handles[i], info );
+        		if (r == KErrNone)
+        			{
+        			aServers.AppendL( info );
+        			}
+        		}
+            }
+        }
+    }
+
+
+EXPORT_C CMemSpyEngineServerList* CMemSpyEngineHelperServer::ServerListL()
+    {
+    CMemSpyEngineServerList* list = CMemSpyEngineServerList::NewLC();
+    //
+    RArray<TMemSpyDriverHandleInfoGeneric> servers;
+    CleanupClosePushL( servers );
+    //
+    GetServerListL( servers );
+    //
+    const TInt count = servers.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const TMemSpyDriverHandleInfoGeneric& details = servers[ i ];
+        //
+        CMemSpyEngineServerEntry* serverEntry = CMemSpyEngineServerEntry::NewLC( details );
+        list->AddItemL( serverEntry );
+        CleanupStack::Pop( serverEntry );
+        }
+    //
+    CleanupStack::PopAndDestroy( &servers );
+
+    // Sort the list by session count
+    list->SortBySessionCountL();
+
+    // Done
+    CleanupStack::Pop( list );
+    return list;
+    }
+
+
+CMemSpyEngine& CMemSpyEngineHelperServer::Engine() const
+    {
+    return iEngine;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineServerList::CMemSpyEngineServerList()
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineServerList::~CMemSpyEngineServerList()
+    {
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    }
+
+
+void CMemSpyEngineServerList::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineServerList* CMemSpyEngineServerList::NewLC()
+    {
+    CMemSpyEngineServerList* self = new(ELeave) CMemSpyEngineServerList();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineServerList::Count() const
+    {
+    return iItems.Count();
+    }
+
+
+EXPORT_C const CMemSpyEngineServerEntry& CMemSpyEngineServerList::At( TInt aIndex ) const
+    {
+    return *iItems[ aIndex ];
+    }
+
+
+EXPORT_C void CMemSpyEngineServerList::SortByNameL()
+    {
+    TLinearOrder< CMemSpyEngineServerEntry > comparer( CompareByName );
+    iItems.Sort( comparer );
+    }
+
+
+EXPORT_C void CMemSpyEngineServerList::SortBySessionCountL()
+    {
+    TLinearOrder< CMemSpyEngineServerEntry > comparer( CompareBySessionCount );
+    iItems.Sort( comparer );
+    }
+
+
+EXPORT_C TInt CMemSpyEngineServerList::ItemIndex( const CMemSpyEngineServerEntry& aEntry ) const
+    {
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineServerEntry* item = iItems[ i ];
+        //
+        if  ( item == &aEntry )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C void CMemSpyEngineServerList::OutputDataColumnsL( CMemSpyEngine& aEngine, TBool aClientThreadColumns )
+    {
+    HBufC* columns = HBufC::NewLC( 1024 );
+    TPtr pColumns( columns->Des() );
+    //
+    _LIT(KCol1, "Thread/Process Id");
+    pColumns.Append( KCol1 );
+    pColumns.Append( KMemSpyEngineServListOutputComma );
+    //
+    _LIT(KCol2, "Name");
+    pColumns.Append( KCol2 );
+    pColumns.Append( KMemSpyEngineServListOutputComma );
+    //
+    _LIT(KCol3, "Connected Session Count");
+    pColumns.Append( KCol3 );
+    //
+    if  ( aClientThreadColumns )
+        {
+        _LIT(KCol4, "Connected Client");
+        pColumns.Append( KMemSpyEngineServListOutputComma );
+        pColumns.Append( KCol4 );
+        }
+    //
+    aEngine.Sink().OutputLineL( pColumns );
+    CleanupStack::PopAndDestroy( columns );
+    }
+
+
+void CMemSpyEngineServerList::AddItemL( CMemSpyEngineServerEntry* aItem )
+    {
+    iItems.AppendL( aItem );
+    }
+
+
+EXPORT_C TInt CMemSpyEngineServerList::MdcaCount() const
+    {
+    return Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineServerList::MdcaPoint( TInt aIndex ) const
+    {
+    const CMemSpyEngineServerEntry& item = At( aIndex );
+    return TPtrC( item.Caption() );
+    }
+
+
+TInt CMemSpyEngineServerList::CompareByName( const CMemSpyEngineServerEntry& aLeft, const CMemSpyEngineServerEntry& aRight )
+    {
+    const TInt ret = aLeft.Name().CompareF( aRight.Name() );
+    return ret;
+    }
+
+
+TInt CMemSpyEngineServerList::CompareBySessionCount( const CMemSpyEngineServerEntry& aLeft, const CMemSpyEngineServerEntry& aRight )
+    {
+    TInt ret = -1;
+    //
+    if  ( aLeft.SessionCount() < aRight.SessionCount() )
+        {
+        ret = 1;
+        }
+    else if ( aLeft.SessionCount() == aRight.SessionCount() )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineServerEntry::CMemSpyEngineServerEntry()
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineServerEntry::~CMemSpyEngineServerEntry()
+    {
+    delete iCaption;
+    delete iName;
+    }
+
+
+void CMemSpyEngineServerEntry::ConstructL( const TMemSpyDriverHandleInfoGeneric& aInfo )
+    {
+    iName = HBufC::NewL( aInfo.iName.Length() );
+    iName->Des().Copy( aInfo.iName );
+    iSessionCount = aInfo.iCount;
+    iId = aInfo.iId;
+    iHandle = aInfo.iHandle;
+
+    // Make caption
+    _LIT(KServerListFormat, "\t%S\t\t%d session");
+    TBuf<KMaxFullName + 128> item;
+    //
+    item.Format( KServerListFormat, iName, iSessionCount );
+    //
+    if  ( iSessionCount != 1 )
+        {
+        // Add missing 's' 
+        item.Append( TChar('s') );
+        }
+    //
+    iCaption = item.AllocL();
+    }
+
+
+CMemSpyEngineServerEntry* CMemSpyEngineServerEntry::NewLC( const TMemSpyDriverHandleInfoGeneric& aInfo )
+    {
+    CMemSpyEngineServerEntry* self = new(ELeave) CMemSpyEngineServerEntry();
+    CleanupStack::PushL( self );
+    self->ConstructL( aInfo );
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyEngineServerEntry::OutputDataL( CMemSpyEngineHelperServer& aHelper, TBool aClientThreadColumns ) const
+    {
+    _LIT(KMemSpyEngineServListOutputDecimal, "%d");
+    _LIT(KMemSpyEngineServListOutputString, "%S");
+    //
+    HBufC* columns = HBufC::NewLC( 1024 );
+    TPtr pColumns( columns->Des() );
+    //
+    pColumns.AppendFormat( KMemSpyEngineServListOutputDecimal, Id() );
+    pColumns.Append( KMemSpyEngineServListOutputComma );
+    //
+    pColumns.AppendFormat( KMemSpyEngineServListOutputString, &Name() );
+    pColumns.Append( KMemSpyEngineServListOutputComma );
+    //
+    pColumns.AppendFormat( KMemSpyEngineServListOutputDecimal, SessionCount() );
+    //
+    aHelper.Engine().Sink().OutputLineL( pColumns );
+
+    if  ( aClientThreadColumns )
+        {
+        RArray<TMemSpyDriverServerSessionInfo> sessions;
+        CleanupClosePushL( sessions );
+
+        // Get the sessions
+        GetSessionsL( aHelper, sessions );
+
+        // Output an additional line per entry
+        const TInt count = sessions.Count();
+        for( TInt i=0; i<count; i++ )
+            {
+            const TMemSpyDriverServerSessionInfo& session = sessions[ i ];
+            //
+            pColumns.Copy( session.iName );
+            pColumns.Insert( 0, KMemSpyEngineServListOutputComma );
+            pColumns.Insert( 0, KMemSpyEngineServListOutputComma );
+            pColumns.Insert( 0, KMemSpyEngineServListOutputComma );
+            //
+            aHelper.Engine().Sink().OutputLineL( pColumns );
+            }
+        //
+        CleanupStack::PopAndDestroy( &sessions );
+        }
+
+    CleanupStack::PopAndDestroy( columns );
+    }
+
+
+EXPORT_C void CMemSpyEngineServerEntry::GetSessionsL( CMemSpyEngineHelperServer& aHelper, RArray<TMemSpyDriverServerSessionInfo>& aSessions ) const
+    {
+    aHelper.GetServerSessionsL( Handle(), aSessions );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperStack.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,407 @@
+/*
+* 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 <memspy/engine/memspyenginehelperstack.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include "MemSpyEngineOutputListItem.h"
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+
+// Literal constants
+_LIT( KMemSpyPrefixStackData, "StackData - %S - " );
+_LIT( KMemSpyMarkerStackData, "<%SMEMSPY_STACK_DATA_%03d>" );
+
+
+CMemSpyEngineHelperStack::CMemSpyEngineHelperStack( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperStack::~CMemSpyEngineHelperStack()
+    {
+    }
+
+
+void CMemSpyEngineHelperStack::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperStack* CMemSpyEngineHelperStack::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperStack* self = new(ELeave) CMemSpyEngineHelperStack( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperStack::OutputStackInfoL( const CMemSpyThread& aThread )
+    {
+    const TFullName pName( aThread.FullName() );
+    //
+    _LIT(KHeader, "STACK INFO FOR THREAD '%S'");
+    TBuf<KMaxFullName + 100> printFormat;
+    printFormat.Format( KHeader, &pName );
+    iEngine.Sink().OutputSectionHeadingL( printFormat, '=' );
+
+    OutputStackInfoL( aThread.Process().Id(), aThread.Id(), printFormat );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperStack::OutputStackInfoL( TProcessId aPid, TThreadId aTid, TDes& aLineBuffer )
+    {
+    TMemSpyDriverStackInfo info;
+    //
+    iEngine.ProcessSuspendLC( aPid );
+    const TInt r = iEngine.Driver().GetStackInfo( aTid, info );
+    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+    //
+    if  ( r == KErrNone )
+        {
+        CMemSpyEngineOutputList* list = CMemSpyEngineOutputList::NewLC( iEngine.Sink() );
+
+        {
+        // Header - user stack
+        list->AddItemL( _L("USER STACK") );
+        list->AddUnderlineForPreviousItemL();
+
+        // Summary
+        list->AddItemFormatL( _L("Address range"), _L("0x%08x - 0x%08x (%8d)"), info.iUserStackBase, info.iUserStackBase + info.iUserStackSize, info.iUserStackSize );
+        list->AddItemHexL( _L("Current stack pointer"), info.iUserStackPointer );
+
+        // Calculate usage
+        const TInt usedUserStack = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackPointer;
+        const TInt userStackUsagePct = (TInt) (( (TReal) usedUserStack / (TReal) info.iUserStackSize) * 100.0);
+        aLineBuffer.Format(_L("%d (%3d"), usedUserStack, userStackUsagePct);
+        aLineBuffer.Append(_L(" pct)"));
+        list->AddItemL( _L("Stack usage"), aLineBuffer );
+
+        // High watermark
+        list->AddItemHexL( _L("High watermark"), info.iUserStackHighWatermark );
+        const TInt userHighWaterMarkUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackHighWatermark;
+        const TInt userStackHighWaterMarkUsagePct = (TInt) (( (TReal) userHighWaterMarkUsage / (TReal) info.iUserStackSize) * 100.0);
+        aLineBuffer.Format(_L("%d (%3d"), userHighWaterMarkUsage, userStackHighWaterMarkUsagePct);
+        aLineBuffer.Append(_L(" pct)"));
+        list->AddItemL( _L("High watermark usage"), aLineBuffer );
+        }
+
+
+        {
+        // Header - supervisor stack
+        list->AddItemL( _L("SUPERVISOR STACK") );
+        list->AddUnderlineForPreviousItemL();
+
+        // Summary
+        list->AddItemFormatL( _L("Address range"), _L("0x%08x - 0x%08x (%8d)"), info.iSupervisorStackBase, info.iSupervisorStackBase + info.iSupervisorStackSize, info.iSupervisorStackSize );
+        list->AddItemHexL( _L("Current stack pointer"), info.iSupervisorStackPointer );
+
+        // Calculate usage
+        const TInt usedSupervisorStack = (TInt) ( info.iSupervisorStackBase + info.iSupervisorStackSize ) - info.iSupervisorStackPointer;
+        const TInt supervisorStackUsagePct = (TInt) (( (TReal) usedSupervisorStack / (TReal) info.iSupervisorStackSize) * 100.0);
+        aLineBuffer.Format(_L("%d (%3d"), usedSupervisorStack, supervisorStackUsagePct );
+        aLineBuffer.Append(_L(" pct)"));
+        list->AddItemL( _L("Stack usage"), aLineBuffer );
+
+        // High watermark
+        list->AddItemHexL( _L("High watermark"), info.iSupervisorStackHighWatermark );
+        const TInt supervisorStackHighWaterMarkUsage = (TInt) ( info.iSupervisorStackBase + info.iSupervisorStackSize ) - info.iSupervisorStackHighWatermark;
+        const TInt supervisorStackHighWaterMarkUsagePct = (TInt) (( (TReal) supervisorStackHighWaterMarkUsage / (TReal) info.iSupervisorStackSize) * 100.0);
+        aLineBuffer.Format(_L("%d (%3d"), supervisorStackHighWaterMarkUsage, supervisorStackHighWaterMarkUsagePct );
+        aLineBuffer.Append(_L(" pct)"));
+        list->AddItemL( _L("High watermark usage"), aLineBuffer );
+        }
+
+        list->PrintL();
+        CleanupStack::PopAndDestroy( list );
+        }
+
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperStack::OutputStackDataL( const CMemSpyThread& aThread, TMemSpyDriverDomainType aType )
+    {
+    OutputStackDataL( aThread, aType, ETrue );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperStack::OutputStackDataL( const CMemSpyThread& aThread, TMemSpyDriverDomainType aType, TBool aEntireStack )
+    {
+    TBuf<KMaxFullName + 100> printFormat;
+    printFormat = aThread.FullName();
+
+    // Begin a new data stream
+    _LIT( KMemSpyFolder, "Stack" );
+    HBufC* context = HBufC::NewLC( KMaxFileName );
+    TPtr pContext( context->Des() );
+    if  ( aType == EMemSpyDriverDomainUser )
+        {
+        _LIT(KMemSpyContext, "Data (User) - %S");
+        pContext.Format( KMemSpyContext, &printFormat );
+        }
+    else if ( aType == EMemSpyDriverDomainKernel )
+        {
+        _LIT(KMemSpyContext, "Data (Supervisor) - %S");
+        pContext.Format( KMemSpyContext, &printFormat );
+        }
+    iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder );
+    CleanupStack::PopAndDestroy( context );
+
+    // Suspend all threads in the process
+    iEngine.ProcessSuspendLC( aThread.Process().Id() );
+
+    // Start marker
+    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerStackData, &KNullDesC, (TUint) aThread.Id() );
+
+    // Set overall prefix
+    iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixStackData, &printFormat );
+
+    // Prepare data buffer
+    HBufC8* data = HBufC8::NewLC( 4096 * 4 );
+    TPtr8 pData(data->Des());
+    TUint remaining = 0;
+
+    TMemSpyDriverStackInfo info;
+    TInt r = iEngine.Driver().GetStackInfo( aThread.Id(), info );
+    if  ( r == KErrNone )
+        {
+        TUint spAddress = 0;
+        if  ( aType == EMemSpyDriverDomainUser )
+            {
+            _LIT(KHeaderUser, "USER STACK DATA");
+            iEngine.Sink().OutputSectionHeadingL(KHeaderUser, '-');
+            spAddress = info.iUserStackPointer;
+            }
+        else if ( aType == EMemSpyDriverDomainKernel )
+            {
+            _LIT(KHeaderKernel, "SUPERVISOR STACK DATA");
+            iEngine.Sink().OutputSectionHeadingL(KHeaderKernel, '-');
+            spAddress = info.iSupervisorStackPointer;
+            }
+
+        // Print header information
+        // ========================
+        TBuf<240> buf;
+
+        // Stack pointer
+        _LIT( KLine1, "Current stack pointer: 0x%08x");
+        buf.Format( KLine1, spAddress );
+        iEngine.Sink().OutputLineL( buf );
+
+        // Stack address range
+        _LIT( KLine2, "Stack address range:   0x%08x - 0x%08x");
+        if  ( aType == EMemSpyDriverDomainUser )
+            {
+            buf.Format( KLine2, info.iUserStackBase, info.iUserStackBase + info.iUserStackSize );
+            }
+        else
+            {
+            buf.Format( KLine2, info.iSupervisorStackBase, info.iSupervisorStackBase + info.iSupervisorStackSize );
+            }
+        iEngine.Sink().OutputLineL( buf );
+
+        // Stack size
+        _LIT( KLine3, "Stack size:              %d");
+        buf.Format( KLine3, ( aType == EMemSpyDriverDomainUser ) ? info.iUserStackSize : info.iSupervisorStackSize );
+        iEngine.Sink().OutputLineL( buf );
+        iEngine.Sink().OutputBlankLineL();
+
+        // If we are only fetching the 'current' part of the stack, then we need to maniuplate the
+        // printing address used to display the stack content
+        if  ( !aEntireStack )
+            {
+            // We start at the stack pointer address and work towards the end of the stack.
+            info.iUserStackBase = spAddress;
+            }
+
+        // Code segments (needed for map file reading...)
+        _LIT(KCodeSegInfoPrefix, "CodeSeg - ");
+        iEngine.HelperCodeSegment().OutputCodeSegmentsL( aThread.Process().Id(), printFormat, KCodeSegInfoPrefix );
+        
+        // Get the stack data
+        // ==================
+        _LIT(KStackDataPrefix, "%S");
+        r = iEngine.Driver().GetStackData( aThread.Id(), pData, remaining, aType, aEntireStack );
+
+        if  ( r == KErrNone )
+            {
+            while ( r == KErrNone )
+                {
+                iEngine.Sink().OutputBinaryDataL( KStackDataPrefix, pData.Ptr(), (const TUint8*) info.iUserStackBase, pData.Length() );
+                //
+                if  ( remaining > 0 )
+                    {
+                    info.iUserStackBase += pData.Length();
+                    r = iEngine.Driver().GetStackDataNext( aThread.Id(), pData, remaining, aType, aEntireStack );
+                    }
+                else
+                    {
+                    break;
+                    }
+                }
+            }
+
+        }
+    CleanupStack::PopAndDestroy( data );
+
+    CleanupStack::PopAndDestroy(); // clear prefix
+    CleanupStack::PopAndDestroy(); // resume process
+
+    // End marker
+    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerStackData, &KMemSpySinkTagClose, (TUint) aThread.Id() );
+    iEngine.Sink().DataStreamEndL();
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperStack::OutputStackInfoForDeviceL()
+    {
+    const TInt count = iEngine.Container().Count();
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+    //
+    _LIT( KMemSpyContext, "Stack" );
+    _LIT( KMemSpyFolder, "Device-Wide" );
+    _LIT( KMemSpyExtension, ".csv" );
+    iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder, KMemSpyExtension );
+
+    // Set overall prefix
+    _LIT(KOverallPrefix, "[Stack Summary]");
+    iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
+
+    _LIT(KListingHeader, "Thread, US. Base Address, US. Size, US. Addr, US. Usage, US. Usage Pct, US. HWM Addr, US. HWM Usage, US. HWM Usage Pct, SS. Base Address, SS. Size, SS. Addr, SS. Usage, SS. Usage Pct., SS. HWM Addr, SS. HWM Usage, SS. HWM Usage Pct");
+    iEngine.Sink().OutputBlankLineL();
+    iEngine.Sink().OutputLineL(KListingHeader);
+    
+    for(TInt ii=0; ii<count; ii++)
+        {
+        const CMemSpyProcess& process = iEngine.Container().At( ii );
+        const TPtrC procName( process.Name() );
+        //
+        if  ( iEngine.ProcessSuspendAndGetErrorLC( process.Id() ) == KErrNone )
+            {
+            TMemSpyDriverStackInfo info;
+            const TInt threadCount = process.Count();
+            //
+            for(TInt j=0; j<threadCount; j++)
+                {
+                const CMemSpyThread& thread = process.At( j );
+                const TPtrC threadName(thread.Name());
+
+                const TInt error = iEngine.Driver().GetStackInfo( thread.Id(), info );
+                if  ( error == KErrNone )
+                    {
+                    const TInt userStackUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackPointer;
+                    const TInt userStackUsagePct = (TInt) (( (TReal) userStackUsage / (TReal) info.iUserStackSize) * 100.0);
+                    const TInt userStackHighWaterMarkUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackHighWatermark;
+                    const TInt userStackHighWaterMarkUsagePct = (TInt) (( (TReal) userStackHighWaterMarkUsage / (TReal) info.iUserStackSize) * 100.0);
+                    const TInt supervisorStackUsage = (TInt) ( info.iSupervisorStackBase + info.iSupervisorStackSize ) - info.iSupervisorStackPointer;
+                    const TInt supervisorStackUsagePct = (TInt) (( (TReal) supervisorStackUsage / (TReal) info.iSupervisorStackSize) * 100.0);
+                    const TInt supervisorStackHighWaterMarkUsage = (TInt) ( info.iSupervisorStackBase + info.iSupervisorStackSize ) - info.iSupervisorStackHighWatermark;
+                    const TInt supervisorStackHighWaterMarkUsagePct = (TInt) (( (TReal) supervisorStackHighWaterMarkUsage / (TReal) info.iSupervisorStackSize) * 100.0);
+
+                    _LIT(KFormat, "%S::%S, 0x%08x, %8d, 0x%08x, %8d, %8d, 0x%08x, %8d, %8d, 0x%08x, %8d, 0x%08x, %8d, %8d, 0x%08x, %8d, %8d");
+                    pBuf.Format(  KFormat, &procName, &threadName, 
+                                 info.iUserStackBase, 
+                                 info.iUserStackSize, 
+                                 info.iUserStackPointer, 
+                                 userStackUsage,
+                                 userStackUsagePct,
+                                 info.iUserStackHighWatermark,
+                                 userStackHighWaterMarkUsage,
+                                 userStackHighWaterMarkUsagePct,
+                                 info.iSupervisorStackBase,
+                                 info.iSupervisorStackSize,
+                                 info.iSupervisorStackPointer,
+                                 supervisorStackUsage,
+                                 supervisorStackUsagePct,
+                                 info.iSupervisorStackHighWatermark,
+                                 supervisorStackHighWaterMarkUsage,
+                                 supervisorStackHighWaterMarkUsagePct
+                                 );
+                    iEngine.Sink().OutputLineL( pBuf );
+                    }
+                }
+            }
+        
+        CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+        }
+
+    CleanupStack::PopAndDestroy(); // clear prefix
+
+    CleanupStack::PopAndDestroy( buf );
+
+    _LIT(KEndOfHeapListing, "<= End Stack Summary =>");
+    iEngine.Sink().OutputLineL( KEndOfHeapListing );
+
+    iEngine.Sink().DataStreamEndL();
+    }
+
+
+EXPORT_C TInt CMemSpyEngineHelperStack::CalculateStackSizes( const CMemSpyProcess& aProcess )
+    {
+    TInt ret = 0;
+    //
+    TRAPD( error, ret = CalculateStackSizesL( aProcess ) );
+    //
+    if ( error != KErrNone )
+        {
+        ret = error;
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineHelperStack::CalculateStackSizesL( const CMemSpyProcess& aProcess )
+    {
+	TInt ret = 0;
+	//
+    iEngine.ProcessSuspendLC( aProcess.Id() );
+
+    TMemSpyDriverStackInfo info;
+    //
+    const TInt threadCount = aProcess.Count();
+    for( TInt i=0; i<threadCount; i++ )
+        {
+        const CMemSpyThread& thread = aProcess.At( i );
+        //
+        TInt r = iEngine.Driver().GetStackInfo( thread.Id(), info );
+        if  ( r == KErrNone )
+            {
+            ret += info.iUserStackSize;
+            ret += info.iSupervisorStackSize;
+            }
+        }
+    //
+    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+	return ret;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperThread.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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 <memspy/engine/memspyenginehelperthread.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+
+
+
+CMemSpyEngineHelperThread::CMemSpyEngineHelperThread( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperThread::~CMemSpyEngineHelperThread()
+    {
+    }
+
+
+void CMemSpyEngineHelperThread::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperThread* CMemSpyEngineHelperThread::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperThread* self = new(ELeave) CMemSpyEngineHelperThread( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperThread::OutputThreadInfoL( const CMemSpyThread& aThread, TBool aDetailed )
+    {
+    CMemSpyThreadInfoContainer* container = CMemSpyThreadInfoContainer::NewLC( const_cast< CMemSpyThread& >( aThread ), EMemSpyThreadInfoItemTypeGeneralInfo );
+
+    if  ( aDetailed )
+        {
+        container->AddItemL( EMemSpyThreadInfoItemTypeStack );
+        }
+
+    container->PrintL();
+    CleanupStack::PopAndDestroy( container );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/MemSpyEngine.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,306 @@
+/*
+* 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 <memspy/engine/memspyengine.h>
+
+// System includes
+#include <e32debug.h>
+
+// User includes
+#include <memspy/engine/memspyengineimp.h>
+
+
+CMemSpyEngine::CMemSpyEngine()
+    {
+    }
+
+
+EXPORT_C CMemSpyEngine::~CMemSpyEngine()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngine::~CMemSpyEngine() - START" );
+#endif
+
+    delete iImp;
+
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngine::~CMemSpyEngine() - END" );
+#endif
+    }
+
+
+void CMemSpyEngine::ConstructL( RFs& aFsSession )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngine::ConstructL() - START" );
+#endif
+    
+    iImp = new(ELeave) CMemSpyEngineImp( aFsSession, *this );
+    iImp->ConstructL();
+
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngine::ConstructL() - END" );
+#endif
+    }
+
+
+EXPORT_C CMemSpyEngine* CMemSpyEngine::NewL( RFs& aFsSession )
+    {
+    CMemSpyEngine* self = new(ELeave) CMemSpyEngine();
+    CleanupStack::PushL( self );
+    self->ConstructL( aFsSession );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+EXPORT_C CMemSpyEngine* CMemSpyEngine::NewL( RFs& aFsSession, TBool aStartServer )
+    {
+    return NewL(aFsSession);
+    }
+
+EXPORT_C RFs& CMemSpyEngine::FsSession()
+    {
+    return iImp->FsSession();
+    }
+
+
+EXPORT_C CMemSpyEngineObjectContainer& CMemSpyEngine::Container()
+    {
+    return iImp->Container();
+    }
+
+
+EXPORT_C const CMemSpyEngineObjectContainer& CMemSpyEngine::Container() const
+    {
+    return iImp->Container();
+    }
+
+
+EXPORT_C void CMemSpyEngine::SetObserver( MMemSpyEngineObserver* aObserver )
+    {
+    iImp->SetObserver( aObserver );
+    }
+
+
+void CMemSpyEngine::NotifyContainerChangeL()
+    {
+    iImp->NotifyContainerChangeL();
+    }
+
+
+void CMemSpyEngine::NotifyClientServerOperationRequestL( TInt aType )
+    {
+    iImp->NotifyClientServerOperationRequestL( aType );
+    }
+
+
+EXPORT_C CMemSpyEngineOutputSink& CMemSpyEngine::Sink()
+    {
+    return iImp->Sink();
+    }
+
+
+EXPORT_C TMemSpySinkType CMemSpyEngine::SinkType()
+    {
+    return iImp->SinkType();
+    }
+
+
+EXPORT_C void CMemSpyEngine::InstallSinkL( TMemSpySinkType aType )
+    {
+    iImp->InstallSinkL( aType, KNullDesC );
+    }
+
+EXPORT_C void CMemSpyEngine::InstallDebugSinkL()
+    {
+    iImp->InstallSinkL( ESinkTypeDebug, KNullDesC );
+    }
+
+EXPORT_C void CMemSpyEngine::InstallFileSinkL( const TDesC& aRootFolder )
+    {
+    iImp->InstallSinkL( ESinkTypeFile, aRootFolder );
+    }
+
+EXPORT_C void CMemSpyEngine::ListOpenFilesL()
+    {
+    iImp->ListOpenFilesL();
+    }
+
+
+EXPORT_C void CMemSpyEngine::GetVersion( TVersion& aVersion )
+    {
+    iImp->GetVersion( aVersion );
+    }
+
+
+EXPORT_C TBool CMemSpyEngine::IsHelperWindowServerSupported()
+    {
+    return iImp->IsHelperWindowServerSupported();
+    }
+
+
+CMemSpyEngineMidwife& CMemSpyEngine::Midwife()
+    {
+    return iImp->Midwife();
+    }
+
+
+CMemSpyEngineUndertaker& CMemSpyEngine::Undertaker()
+    {
+    return iImp->Undertaker();
+    }
+
+
+CMemSpyEngineChunkWatcher& CMemSpyEngine::ChunkWatcher()
+    {
+    return iImp->ChunkWatcher();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperHeap& CMemSpyEngine::HelperHeap()
+    {
+    return iImp->HelperHeap();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperStack& CMemSpyEngine::HelperStack()
+    {
+    return iImp->HelperStack();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperCodeSegment& CMemSpyEngine::HelperCodeSegment()
+    {
+    return iImp->HelperCodeSegment();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperChunk& CMemSpyEngine::HelperChunk()
+    {
+    return iImp->HelperChunk();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperThread& CMemSpyEngine::HelperThread()
+    {
+    return iImp->HelperThread();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperProcess& CMemSpyEngine::HelperProcess()
+    {
+    return iImp->HelperProcess();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperServer& CMemSpyEngine::HelperServer()
+    {
+    return iImp->HelperServer();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperActiveObject& CMemSpyEngine::HelperActiveObject()
+    {
+    return iImp->HelperActiveObject();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperKernelContainers& CMemSpyEngine::HelperKernelContainers()
+    {
+    return iImp->HelperKernelContainers();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperFileSystem& CMemSpyEngine::HelperFileSystem()
+    {
+    return iImp->HelperFileSystem();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperECom& CMemSpyEngine::HelperECom()
+    {
+    return iImp->HelperECom();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperSysMemTracker& CMemSpyEngine::HelperSysMemTracker()
+    {
+    return iImp->HelperSysMemTracker();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperFbServ& CMemSpyEngine::HelperFbServ()
+    {
+    return iImp->HelperFbServ();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperROM& CMemSpyEngine::HelperROM()
+    {
+    return iImp->HelperROM();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperRAM& CMemSpyEngine::HelperRAM()
+    {
+    return iImp->HelperRAM();
+    }
+
+
+EXPORT_C MMemSpyEngineHelperWindowServer& CMemSpyEngine::HelperWindowServer()
+    {
+    return iImp->HelperWindowServer();
+    }
+
+
+EXPORT_C CMemSpyEngineHelperCondVar& CMemSpyEngine::HelperCondVar()
+    {
+    return iImp->HelperCondVar();
+    }
+
+
+RMemSpyDriverClient& CMemSpyEngine::Driver()
+    {
+    return iImp->Driver();
+    }
+
+
+TInt CMemSpyEngine::ProcessSuspendAndGetErrorLC( TProcessId aId )
+    {
+    return iImp->ProcessSuspendAndGetErrorLC( aId );
+    }
+
+
+void CMemSpyEngine::ProcessSuspendLC( TProcessId aId )
+    {
+    iImp->ProcessSuspendLC( aId );
+    }
+
+
+void CMemSpyEngine::ProcessResume()
+    {
+    iImp->ProcessResume();
+    }
+    
+
+TProcessId CMemSpyEngine::SuspendedProcessId() const
+    {
+    return iImp->SuspendedProcessId();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/MemSpyEngineImp.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,582 @@
+/*
+* 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 <memspy/engine/memspyengineimp.h>
+
+// System includes
+#include <e32svr.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineundertaker.h>
+#include "MemSpyEngineChunkWatcher.h"
+#include <memspy/engine/memspyengineobserver.h>
+#include "MemSpyEngineServer.h"
+#include <memspy/engine/memspyengineutils.h>
+#include "MemSpyEngineOutputSinkDebug.h"
+#include "MemSpyEngineOutputSinkFile.h"
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperstack.h>
+#include <memspy/engine/memspyenginehelperthread.h>
+#include <memspy/engine/memspyenginehelperserver.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperactiveobject.h>
+#include <memspy/engine/memspyenginehelperkernelcontainers.h>
+#include <memspy/engine/memspyenginehelperfilesystem.h>
+#include <memspy/engine/memspyenginehelperecom.h>
+#include <memspy/engine/memspyenginehelpersysmemtracker.h>
+#include <memspy/engine/memspyenginehelperfbserv.h>
+#include <memspy/engine/memspyenginehelperrom.h>
+#include <memspy/engine/memspyenginehelperram.h>
+#include <memspy/engine/memspyenginehelperwindowserver.h>
+#include <memspy/engine/memspyenginehelpercondvar.h>
+
+#ifdef _DEBUG
+#define LOG(args...) RDebug::Printf(args)
+#else
+#define LOG(args...)
+#endif
+
+CMemSpyEngineImp::CMemSpyEngineImp( RFs& aFsSession, CMemSpyEngine& aEngine )
+:   iFsSession( aFsSession ), iEngine( aEngine )
+    {
+    }
+
+
+CMemSpyEngineImp::~CMemSpyEngineImp()
+    {
+    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - START" );
+
+    if  ( iMidwife )
+        {
+        iMidwife->RemoveObserver( *this );
+        }
+
+    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - deleting helpers..." );
+    delete iHelperSysMemTracker;
+    delete iServer;
+    delete iHelperKernelContainers;
+    delete iHelperFbServ;
+    delete iHelperHeap;
+    delete iHelperStack;
+    delete iHelperCodeSegment;
+    delete iHelperChunk;
+    delete iHelperThread;
+    delete iHelperProcess;
+    delete iHelperServer;
+    delete iHelperActiveObject;
+    delete iHelperFileSystem;
+    delete iHelperECom;
+    delete iHelperROM;
+    delete iHelperRAM;
+    delete iHelperWindowServer;
+    delete iHelperCondVar;
+    
+    iHelperWindowServerLoader.Close();
+
+    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - deleting utilities..." );
+    delete iChunkWatcher;
+    delete iUndertaker;
+    delete iMidwife;
+
+    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - destroying containers..." );
+    iContainers.ResetAndDestroy();
+    iContainers.Close();
+
+    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - destroying driver..." );
+    if  ( iMemSpyDriver )
+        {
+        iMemSpyDriver->Close();
+        delete iMemSpyDriver;
+        }
+
+    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - destroying sink..." );
+    delete iSink;
+
+    LOG( "CMemSpyEngineImp::~CMemSpyEngineImp() - END" );
+    }
+
+
+void CMemSpyEngineImp::ConstructL()
+    {
+    LOG( "CMemSpyEngineImp::ConstructL() - START" );
+    //
+    iFsSession.SetSessionPath( _L("\\") );
+    
+    iServer = CMemSpyEngineServer::NewL( iEngine );
+    
+    iMemSpyDriver = new(ELeave) RMemSpyDriverClient();
+    const TInt error = Driver().Open();
+    User::LeaveIfError( error );
+    //
+    InstallSinkL( ESinkTypeDebug );
+    //
+    iUndertaker = CMemSpyEngineUndertaker::NewL( Driver() );
+    iUndertaker->AddObserverL( *this );
+    //
+    iMidwife = CMemSpyEngineMidwife::NewL( Driver() );
+    //
+    iChunkWatcher = CMemSpyEngineChunkWatcher::NewL( Driver() );
+    //
+    CMemSpyEngineObjectContainer* container = CMemSpyEngineObjectContainer::NewL( iEngine );
+    CleanupStack::PushL( container );
+    iContainers.InsertL( container, 0 );
+    CleanupStack::Pop( container );
+    //
+    ConstructHelpersL();
+    //
+    iHelperSysMemTracker = CMemSpyEngineHelperSysMemTracker::NewL( iEngine );
+    iMidwife->AddObserverL( *this );
+
+    LOG( "CMemSpyEngineImp::ConstructL() - END" );
+    }
+
+
+void CMemSpyEngineImp::ConstructHelpersL()
+    {
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - START" );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Heap..." );
+    iHelperHeap = CMemSpyEngineHelperHeap::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Stack..." );
+    iHelperStack = CMemSpyEngineHelperStack::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Code Segments..." );
+    iHelperCodeSegment = CMemSpyEngineHelperCodeSegment::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Chunk..." );
+    iHelperChunk = CMemSpyEngineHelperChunk::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Thread..." );
+    iHelperThread = CMemSpyEngineHelperThread::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Process..." );
+    iHelperProcess = CMemSpyEngineHelperProcess::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Server..." );
+    iHelperServer = CMemSpyEngineHelperServer::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - AO..." );
+    iHelperActiveObject = CMemSpyEngineHelperActiveObject::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - Kernel Containers..." );
+    iHelperKernelContainers = CMemSpyEngineHelperKernelContainers::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - File System..." );
+    iHelperFileSystem = CMemSpyEngineHelperFileSystem::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - ECOM..." );
+    iHelperECom = CMemSpyEngineHelperECom::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - FBSERV..." );
+    iHelperFbServ = CMemSpyEngineHelperFbServ::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - ROM..." );
+    iHelperROM = CMemSpyEngineHelperROM::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - RAM..." );
+    iHelperRAM = CMemSpyEngineHelperRAM::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - WindowServer..." );
+    
+    TInt err = iHelperWindowServerLoader.Load( _L("memspywindowserverhelper.dll") );
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - WindowServer load err: %d", err );
+    if ( !err )
+        {
+#ifdef __WINS__ // ordinal is different 
+        TLibraryFunction entry = iHelperWindowServerLoader.Lookup( 3 );
+#else
+        TLibraryFunction entry = iHelperWindowServerLoader.Lookup( 1 );
+#endif
+        if ( entry != NULL )
+            {
+			typedef MMemSpyEngineHelperWindowServer* (*TEntryFn)(void);
+			TRAP(err, iHelperWindowServer = ((TEntryFn)entry)());
+			if (err)
+				{
+				LOG("err from memspywindowserverhelper.dll - %d", err);
+				}
+            }
+        }
+    
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - CondVar..." );
+    iHelperCondVar = CMemSpyEngineHelperCondVar::NewL( iEngine );
+
+    LOG( "CMemSpyEngineImp::ConstructHelpersL() - END" );
+    }
+
+
+RFs& CMemSpyEngineImp::FsSession()
+    {
+    return iFsSession;
+    }
+
+
+CMemSpyEngineObjectContainer& CMemSpyEngineImp::Container()
+    {
+    __ASSERT_ALWAYS( iContainers.Count() >= 1, MemSpyEngineUtils::Panic( EMemSpyEnginePanicInvalidContainer1 ) );
+    CMemSpyEngineObjectContainer* headContainer = iContainers[ 0 ];
+    return *headContainer;
+    }
+
+
+const CMemSpyEngineObjectContainer& CMemSpyEngineImp::Container() const
+    {
+    __ASSERT_ALWAYS( iContainers.Count() >= 1, MemSpyEngineUtils::Panic( EMemSpyEnginePanicInvalidContainer2 ) );
+    const CMemSpyEngineObjectContainer* headContainer = iContainers[ 0 ];
+    return *headContainer;
+    }
+
+
+void CMemSpyEngineImp::SetObserver( MMemSpyEngineObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+
+void CMemSpyEngineImp::NotifyContainerChangeL()
+    {
+    if  ( iObserver )
+        {
+        iObserver->HandleMemSpyEngineEventL( MMemSpyEngineObserver::EHandleThreadsOrProcessesChanged, &Container() );
+        }
+    }
+
+
+void CMemSpyEngineImp::NotifyClientServerOperationRequestL( TInt aType )
+    {
+    if  ( iObserver )
+        {
+        iObserver->HandleMemSpyEngineEventL( MMemSpyEngineObserver::EHandleClientServerOperationRequest, reinterpret_cast< TAny* >( aType ) );
+        }
+    }
+
+
+CMemSpyEngineOutputSink& CMemSpyEngineImp::Sink()
+    {
+    return *iSink;
+    }
+
+
+TMemSpySinkType CMemSpyEngineImp::SinkType()
+    {
+    return iSink->Type();
+    }
+
+void CMemSpyEngineImp::InstallSinkL( TMemSpySinkType aType )
+	{
+	InstallSinkL( aType, KNullDesC );
+	}
+
+void CMemSpyEngineImp::InstallSinkL( TMemSpySinkType aType, const TDesC& aRootFolder )
+    {
+    LOG( "CMemSpyEngineImp::InstallSinkL() - START - switching sink from %d to %d...", (iSink != NULL ? iSink->Type() : -1), aType );
+    //
+    CMemSpyEngineOutputSink* sink = NULL;
+    //
+    switch( aType )
+        {
+    case ESinkTypeDebug:
+        sink = CMemSpyEngineOutputSinkDebug::NewL( iEngine );
+        break;
+    case ESinkTypeFile:
+        sink = CMemSpyEngineOutputSinkFile::NewL( iEngine, aRootFolder );
+        break;
+        }
+    //
+    delete iSink;
+    iSink = sink;
+    //
+    LOG( "CMemSpyEngineImp::InstallSinkL() - END - sink type: %d", iSink->Type() );
+    }
+
+
+void CMemSpyEngineImp::ListOpenFilesL()
+    {
+    HelperFileSystem().ListOpenFilesL();
+    }
+
+
+void CMemSpyEngineImp::GetVersion( TVersion& aVersion )
+    {
+    iMemSpyDriver->GetVersion( aVersion );
+    }
+
+
+TBool CMemSpyEngineImp::IsHelperWindowServerSupported()
+    {
+    return iHelperWindowServer != NULL;
+    }
+
+
+CMemSpyEngineMidwife& CMemSpyEngineImp::Midwife()
+    {
+    return *iMidwife;
+    }
+
+
+CMemSpyEngineUndertaker& CMemSpyEngineImp::Undertaker()
+    {
+    return *iUndertaker;
+    }
+
+
+CMemSpyEngineChunkWatcher& CMemSpyEngineImp::ChunkWatcher()
+    {
+    return *iChunkWatcher;
+    }
+
+
+CMemSpyEngineHelperHeap& CMemSpyEngineImp::HelperHeap()
+    {
+    return *iHelperHeap;
+    }
+
+
+CMemSpyEngineHelperStack& CMemSpyEngineImp::HelperStack()
+    {
+    return *iHelperStack;
+    }
+
+
+CMemSpyEngineHelperCodeSegment& CMemSpyEngineImp::HelperCodeSegment()
+    {
+    return *iHelperCodeSegment;
+    }
+
+
+CMemSpyEngineHelperChunk& CMemSpyEngineImp::HelperChunk()
+    {
+    return *iHelperChunk;
+    }
+
+
+CMemSpyEngineHelperThread& CMemSpyEngineImp::HelperThread()
+    {
+    return *iHelperThread;
+    }
+
+
+CMemSpyEngineHelperProcess& CMemSpyEngineImp::HelperProcess()
+    {
+    return *iHelperProcess;
+    }
+
+
+CMemSpyEngineHelperServer& CMemSpyEngineImp::HelperServer()
+    {
+    return *iHelperServer;
+    }
+
+
+CMemSpyEngineHelperActiveObject& CMemSpyEngineImp::HelperActiveObject()
+    {
+    return *iHelperActiveObject;
+    }
+
+
+CMemSpyEngineHelperKernelContainers& CMemSpyEngineImp::HelperKernelContainers()
+    {
+    return *iHelperKernelContainers;
+    }
+
+
+CMemSpyEngineHelperFileSystem& CMemSpyEngineImp::HelperFileSystem()
+    {
+    return *iHelperFileSystem;
+    }
+
+
+CMemSpyEngineHelperECom& CMemSpyEngineImp::HelperECom()
+    {
+    return *iHelperECom;
+    }
+
+
+CMemSpyEngineHelperSysMemTracker& CMemSpyEngineImp::HelperSysMemTracker()
+    {
+    return *iHelperSysMemTracker;
+    }
+
+
+CMemSpyEngineHelperFbServ& CMemSpyEngineImp::HelperFbServ()
+    {
+    return *iHelperFbServ;
+    }
+
+
+CMemSpyEngineHelperROM& CMemSpyEngineImp::HelperROM()
+    {
+    return *iHelperROM;
+    }
+
+
+CMemSpyEngineHelperRAM& CMemSpyEngineImp::HelperRAM()
+    {
+    return *iHelperRAM;
+    }
+
+
+MMemSpyEngineHelperWindowServer& CMemSpyEngineImp::HelperWindowServer()
+    {
+    return *iHelperWindowServer;
+    }
+
+
+CMemSpyEngineHelperCondVar& CMemSpyEngineImp::HelperCondVar()
+    {
+    return *iHelperCondVar;
+    }
+
+
+RMemSpyDriverClient& CMemSpyEngineImp::Driver()
+    {
+    return *iMemSpyDriver;
+    }
+
+
+TInt CMemSpyEngineImp::ProcessSuspendAndGetErrorLC( TProcessId aId )
+    {
+    __ASSERT_ALWAYS( iSuspendedProcess == aId || iSuspendedProcess == 0, MemSpyEngineUtils::Panic( EMemSpyEnginePanicSuspendRequest1 ) );
+
+    TInt errorOrCount = Driver().ProcessThreadsSuspend( aId );
+    if  ( errorOrCount >= 0 )
+        {
+        if  ( errorOrCount == 1 )
+            {
+            iSuspendedProcess = aId;
+            }
+        else
+            {
+            // Suspending already suspended process
+            __ASSERT_ALWAYS( iSuspendedProcess == aId, MemSpyEngineUtils::Panic( EMemSpyEnginePanicSuspendRequest2 ) );
+            }
+        //
+        CleanupStack::PushL( TCleanupItem( ResumeSuspendedProcess, this ) );
+
+        if  ( errorOrCount == 1 )
+            {
+            iSink->ProcessSuspendedL( aId );
+            }
+            
+        // At this point, all was well
+        errorOrCount = KErrNone;
+        }
+
+    return errorOrCount;
+    }
+
+
+void CMemSpyEngineImp::ProcessSuspendLC( TProcessId aId )
+    {
+    const TInt error = ProcessSuspendAndGetErrorLC( aId );
+    User::LeaveIfError( error );
+    }
+
+
+void CMemSpyEngineImp::ProcessResume()
+    {
+    const TUint id = iSuspendedProcess;
+    //
+    const TInt errorOrCount = Driver().ProcessThreadsResume( id );
+    //
+    if  ( errorOrCount == 0 )
+        {
+        iSink->ProcessResumed( id );
+        iSuspendedProcess = 0;
+        }
+    }
+    
+
+TProcessId CMemSpyEngineImp::SuspendedProcessId() const
+    {
+    return TProcessId( iSuspendedProcess );
+    }
+
+
+void CMemSpyEngineImp::ResumeSuspendedProcess( TAny* aSelf )
+    {
+    CMemSpyEngineImp* self = reinterpret_cast< CMemSpyEngineImp* >( aSelf );
+    self->ProcessResume();
+    }
+
+
+void CMemSpyEngineImp::ThreadIsDeadL( const TThreadId& aId, const RThread& aThread )
+    {
+    if  ( aThread.Handle() != KNullHandle )
+        {
+        const TFullName name( aThread.FullName() );
+        //
+        TBuf<128> exitInfo;
+        const TExitCategoryName exitCategory( aThread.ExitCategory() );
+        CMemSpyThread::AppendExitInfo( exitInfo, aThread.ExitType(), aThread.ExitReason(), exitCategory );
+        //
+        _LIT( KMemSpyEventInfoText, "[MemSpy] Thread died: %S [%d - 0x%04x] %S" );
+        Sink().OutputLineFormattedL( KMemSpyEventInfoText, &name, (TUint32) aId, (TUint32) aId, &exitInfo );
+        }
+    }
+    
+
+void CMemSpyEngineImp::ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess )
+    {
+    if  ( aProcess.Handle() != KNullHandle )
+        {
+        const TFullName name( aProcess.FullName() );
+        //
+        TBuf<128> exitInfo;
+        const TExitCategoryName exitCategory( aProcess.ExitCategory() );
+        CMemSpyThread::AppendExitInfo( exitInfo, aProcess.ExitType(), aProcess.ExitReason(), exitCategory );
+        //
+        _LIT( KMemSpyEventInfoText, "[MemSpy] Process died: %S [%d - 0x%04x] %S" );
+        Sink().OutputLineFormattedL( KMemSpyEventInfoText, &name, (TUint32) aId, (TUint32) aId, &exitInfo );
+        }
+    }
+
+
+void CMemSpyEngineImp::ThreadIsBornL( const TThreadId& aId, const RThread& aThread )
+    {
+    if  ( aThread.Handle() != KNullHandle )
+        {
+        const TFullName name( aThread.FullName() );
+        //
+        _LIT( KMemSpyEventInfoText, "[MemSpy] Thread created: %S (%d / 0x%08x)" );
+        Sink().OutputLineFormattedL( KMemSpyEventInfoText, &name, (TUint32) aId, (TUint32) aId );
+        }
+    }
+
+
+void CMemSpyEngineImp::ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess )
+    {
+    if  ( aProcess.Handle() != KNullHandle )
+        {
+        const TFullName name( aProcess.FullName() );
+        //
+        _LIT( KMemSpyEventInfoText, "[MemSpy] Process created: %S (%d / 0x%08x)" );
+        Sink().OutputLineFormattedL( KMemSpyEventInfoText, &name, (TUint32) aId, (TUint32) aId );
+        }
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/MemSpyEngineProcessMemoryTracker.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,352 @@
+/*
+* 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 <memspy/engine/memspyengineprocessmemorytracker.h>
+
+// System includes
+#include <e32debug.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+
+// Constants
+const TInt KMemSpyNumberOfChangesReceivedProcessNotYetOpen = -1;
+const TInt KMemSpyNumberOfChangesReceivedProcessNowOpen = 0;
+
+
+CMemSpyEngineProcessMemoryTracker::CMemSpyEngineProcessMemoryTracker( CMemSpyEngine& aEngine, const TProcessId& aProcessId )
+:   CActive( EPriorityStandard ), iEngine( aEngine ), iProcessId( aProcessId ), iNumberOfChangesReceived( KMemSpyNumberOfChangesReceivedProcessNotYetOpen )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+CMemSpyEngineProcessMemoryTracker::~CMemSpyEngineProcessMemoryTracker()
+    {
+    Cancel();
+    
+    // Don't close the process if we didn't successfully open it...
+    if  ( iNumberOfChangesReceived != KMemSpyNumberOfChangesReceivedProcessNotYetOpen )
+        {
+        iEngine.Driver().ProcessInspectionClose( iProcessId );
+        }
+
+    iObservers.Close();
+    delete iProcessName;
+    }
+
+
+void CMemSpyEngineProcessMemoryTracker::ConstructL()
+    {
+    // Cache name    
+    RProcess process;
+    User::LeaveIfError( iEngine.Driver().OpenProcess( iProcessId, process ) );
+    CleanupClosePushL( process );
+    iProcessName = process.FullName().AllocL();
+    iSID = process.SecureId();
+    CleanupStack::PopAndDestroy( &process );
+
+    // Indicate that we've opened the process
+    iNumberOfChangesReceived = KMemSpyNumberOfChangesReceivedProcessNowOpen;
+
+    // Open driver session
+    const TInt error = iEngine.Driver().ProcessInspectionOpen( iProcessId );
+    User::LeaveIfError( error );
+
+    // Pull out the first change which the driver always prepares for us when
+    // we open an initial connection.
+    TRequestStatus status = KRequestPending;
+    iEngine.Driver().ProcessInspectionRequestChanges( iProcessId, status, iInfoCurrent );
+    User::WaitForRequest( status );
+    
+    // And update our HWM value based upon this initial seed...
+    UpdatePeaks( iInfoCurrent );
+    UpdateHWMIncShared( iInfoCurrent );
+    UpdateHWMExcShared( iInfoCurrent );
+    }
+
+
+CMemSpyEngineProcessMemoryTracker* CMemSpyEngineProcessMemoryTracker::NewLC( CMemSpyEngine& aEngine, const TProcessId& aProcessId )
+    {
+    CMemSpyEngineProcessMemoryTracker* self = new(ELeave) CMemSpyEngineProcessMemoryTracker( aEngine, aProcessId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C TBool CMemSpyEngineProcessMemoryTracker::AmTracking() const
+    {
+    return iAmTracking;
+    }
+
+
+EXPORT_C void CMemSpyEngineProcessMemoryTracker::StartL()
+    {
+    Cancel();
+    iNumberOfChangesReceived = 0;
+    //
+    iEngine.Driver().ProcessInspectionRequestChanges( iProcessId, iStatus, iInfoCurrent );
+    SetActive();
+    iAmTracking = ETrue;
+    //
+    const TInt count = iObservers.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        MMemSpyEngineProcessMemoryTrackerObserver* obs = iObservers[ i ];
+        TRAP_IGNORE( obs->HandleMemoryTrackingStartedL() );
+        }
+    }
+
+
+EXPORT_C void CMemSpyEngineProcessMemoryTracker::Stop()
+    {
+    Cancel();
+    //
+    iAmTracking = EFalse;
+    //
+    const TInt count = iObservers.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        MMemSpyEngineProcessMemoryTrackerObserver* obs = iObservers[ i ];
+        TRAP_IGNORE( obs->HandleMemoryTrackingStoppedL() );
+        }
+    }
+
+
+EXPORT_C void CMemSpyEngineProcessMemoryTracker::AddObserverL( MMemSpyEngineProcessMemoryTrackerObserver& aObserver )
+    {
+    RemoveObserver( aObserver );
+    User::LeaveIfError( iObservers.Append( &aObserver ) );
+    }
+ 
+
+EXPORT_C void CMemSpyEngineProcessMemoryTracker::RemoveObserver( MMemSpyEngineProcessMemoryTrackerObserver& aObserver )
+    {
+    TInt pos = iObservers.Find( &aObserver );
+    while( pos >= 0 )
+        {
+        iObservers.Remove( pos );
+        pos = iObservers.Find( &aObserver );
+        }
+    }
+
+
+EXPORT_C void CMemSpyEngineProcessMemoryTracker::ResetHWML()
+    {
+    iInfoHWMIncShared.iMemoryStack = 0;
+    iInfoHWMIncShared.iMemoryHeap = 0;
+    iInfoHWMIncShared.iMemoryChunkLocal = 0;
+    iInfoHWMIncShared.iMemoryChunkShared = 0;
+    iInfoHWMIncShared.iMemoryGlobalData = 0;
+    //
+    iInfoHWMExcShared.iMemoryStack = 0;
+    iInfoHWMExcShared.iMemoryHeap = 0;
+    iInfoHWMExcShared.iMemoryChunkLocal = 0;
+    iInfoHWMExcShared.iMemoryChunkShared = 0;
+    iInfoHWMExcShared.iMemoryGlobalData = 0;
+    //
+    const TInt count = iObservers.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        MMemSpyEngineProcessMemoryTrackerObserver* obs = iObservers[ i ];
+        TRAP_IGNORE( obs->HandleMemoryChangedL( iProcessId, InfoCurrent(), InfoHWMIncShared(), InfoHWMExcShared() ) );
+        }
+    }
+
+
+void CMemSpyEngineProcessMemoryTracker::RunL()
+    {
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::RunL() - START" );
+    ++iNumberOfChangesReceived;
+    
+    // Copy current results and request next event providing the driver didn't
+    // indicate an error (e.g. KErrDied in the case of process termination)
+    TMemSpyDriverProcessInspectionInfo info( iInfoCurrent );
+    if  ( iStatus.Int() >= KErrNone )
+        {
+        iEngine.Driver().ProcessInspectionRequestChanges( iProcessId, iStatus, iInfoCurrent );
+        SetActive();
+        }
+    else
+        {
+        //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::RunL() - iStatus: %d, not requesting further changes...", iStatus.Int() );
+        }
+
+    // Update stats
+    UpdatePeaks( info );
+    UpdateHWMIncShared( info );
+    UpdateHWMExcShared( info );
+
+    // Print out change to file/trace
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::RunL() - printing info..." );
+    PrintInfoL( info );
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::RunL() - done printing info" );
+
+    // Reset peak flags for next cycle
+    iInfoPeaks.ResetPeakFlags();
+
+    // Notify observers
+    const TInt count = iObservers.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        MMemSpyEngineProcessMemoryTrackerObserver* obs = iObservers[ i ];
+        TRAP_IGNORE( obs->HandleMemoryChangedL( iProcessId, info, InfoHWMIncShared(), InfoHWMExcShared() ) );
+        }
+
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::RunL() - END" );
+    }
+
+
+void CMemSpyEngineProcessMemoryTracker::DoCancel()
+    {
+    ////RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::DoCancel() - START - iStatus: %d", iStatus.Int() );
+    iEngine.Driver().ProcessInspectionRequestChangesCancel( iProcessId );
+    ////RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::DoCancel() - END - iStatus: %d", iStatus.Int() );
+    }
+
+
+void CMemSpyEngineProcessMemoryTracker::UpdatePeaks( const TMemSpyDriverProcessInspectionInfo& aLatestInfo )
+    {
+    if  ( aLatestInfo.iMemoryStack > iInfoPeaks.iMemoryStack )
+        {
+        iInfoPeaks.iPeakStack = ETrue;
+        iInfoPeaks.iMemoryStack = aLatestInfo.iMemoryStack;
+        }
+    if  ( aLatestInfo.iMemoryHeap > iInfoPeaks.iMemoryHeap )
+        {
+        iInfoPeaks.iPeakHeap = ETrue;
+        iInfoPeaks.iMemoryHeap = aLatestInfo.iMemoryHeap;
+        }
+    if  ( aLatestInfo.iMemoryChunkLocal > iInfoPeaks.iMemoryChunkLocal )
+        {
+        iInfoPeaks.iPeakChunkLocal = ETrue;
+        iInfoPeaks.iMemoryChunkLocal = aLatestInfo.iMemoryChunkLocal;
+        }
+    if  ( aLatestInfo.iMemoryChunkShared > iInfoPeaks.iMemoryChunkShared )
+        {
+        iInfoPeaks.iPeakChunkShared = ETrue;
+        iInfoPeaks.iMemoryChunkShared = aLatestInfo.iMemoryChunkShared;
+        }
+    if  ( aLatestInfo.iMemoryGlobalData > iInfoPeaks.iMemoryGlobalData )
+        {
+        iInfoPeaks.iPeakGlobalData = ETrue;
+        iInfoPeaks.iMemoryGlobalData = aLatestInfo.iMemoryGlobalData;
+        }
+    }
+
+
+void CMemSpyEngineProcessMemoryTracker::UpdateHWMIncShared( const TMemSpyDriverProcessInspectionInfo& aLatestInfo )
+    {
+    const TUint32 totalCurrent = aLatestInfo.TotalIncShared();
+    const TUint32 totalHWM = iInfoHWMIncShared.TotalIncShared();
+    //
+    if  ( totalCurrent > totalHWM )
+        {
+        // Got new HWM
+        iInfoHWMIncShared = aLatestInfo;
+        }
+    }
+
+
+void CMemSpyEngineProcessMemoryTracker::UpdateHWMExcShared( const TMemSpyDriverProcessInspectionInfo& aLatestInfo )
+    {
+    const TUint32 totalCurrent = aLatestInfo.TotalExcShared();
+    const TUint32 totalHWM = iInfoHWMExcShared.TotalExcShared();
+    //
+    if  ( totalCurrent > totalHWM )
+        {
+        // Got new HWM
+        iInfoHWMExcShared = aLatestInfo;
+        }
+    }
+
+
+void CMemSpyEngineProcessMemoryTracker::PrintInfoL( const TMemSpyDriverProcessInspectionInfo& aInfo )
+    {
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - START" );
+    TBuf<128> timeBuf;
+    TTime time( aInfo.iTime );
+    MemSpyEngineUtils::FormatTimeSimple( timeBuf, time );
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - got time..." );
+
+    // Output changes
+    const TBool noOverwrite = EFalse;
+    const TBool noTimeStamp = EFalse;
+
+    // Prepare prefix
+    _LIT( KMemSpyProcessMemoryTrackerPrefix, "[Change %05d] " );
+    TBuf<25> prefixBuf;
+    prefixBuf.Format( KMemSpyProcessMemoryTrackerPrefix, iNumberOfChangesReceived );
+    iEngine.Sink().OutputPrefixSetLC( prefixBuf );
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - set prefix" );
+
+    // Resume (or create) a data stream
+    _LIT( KMemSpyFolder, "Process Memory Tracking" );
+    _LIT( KMemSpyContext, "Process [0x%08x]" );
+    HBufC* context = HBufC::NewLC( KMaxFileName );
+    TPtr pContext( context->Des() );
+    pContext.Format( KMemSpyContext, (TUint) iSID );
+    iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder, KNullDesC, noOverwrite, noTimeStamp );
+    CleanupStack::PopAndDestroy( context );
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - set context" );
+
+    // Preapre peak characters
+    const TText KItemPeaked     = '*';
+    const TText KItemDidNotPeak = ' ';
+    const TText peakStack       = ( iInfoPeaks.iPeakStack       ? KItemPeaked : KItemDidNotPeak );
+    const TText peakHeap        = ( iInfoPeaks.iPeakHeap        ? KItemPeaked : KItemDidNotPeak );
+    const TText peakChunkLocal  = ( iInfoPeaks.iPeakChunkLocal  ? KItemPeaked : KItemDidNotPeak );
+    const TText peakChunkShared = ( iInfoPeaks.iPeakChunkShared ? KItemPeaked : KItemDidNotPeak );
+    const TText peakGlobalData  = ( iInfoPeaks.iPeakGlobalData  ? KItemPeaked : KItemDidNotPeak );
+
+    // Write data
+    _LIT( KMemSpyMemChangeFormat, "%S - pID: 0x%04x, stack[%c]: %6d, heap[%c]: %10d, local[%c]: %10d, shared[%c]: %10d, globalD[%c]: %10d, totalC: [%10d/%10d], totalHWM: [%10d/%10d] %S" );
+    HBufC* buf = HBufC::NewLC( 1024 );
+
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - formatting buffer..." );
+    buf->Des().Format( KMemSpyMemChangeFormat, &timeBuf, (TUint) iProcessId, 
+                                               peakStack, aInfo.iMemoryStack,
+                                               peakHeap, aInfo.iMemoryHeap,
+                                               peakChunkLocal, aInfo.iMemoryChunkLocal,
+                                               peakChunkShared, aInfo.iMemoryChunkShared, 
+                                               peakGlobalData, aInfo.iMemoryGlobalData, 
+                                               aInfo.TotalIncShared(), aInfo.TotalExcShared(), 
+                                               InfoHWMIncShared().TotalIncShared(), InfoHWMExcShared().TotalExcShared(), 
+                                               iProcessName );
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - outputting - 1, sinkType: %d", iEngine.Sink().Type() );
+    //RDebug::Print( _L("%S"), buf );
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - outputting - 2" );
+    iEngine.Sink().OutputLineL( *buf, ETrue );
+    CleanupStack::PopAndDestroy( buf );
+
+    // End stream
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - ending stream" );
+    iEngine.Sink().DataStreamEndL();
+
+    // Remove prefix
+    CleanupStack::PopAndDestroy();
+    //RDebug::Printf( "CMemSpyEngineProcessMemoryTracker::PrintInfoL() - END" );
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/MemSpyEngineTwiddlableItemArray.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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 <memspy/engine/memspyenginetwiddlableitemarray.h>
+
+// System includes
+#include <e32svr.h>
+
+// User includes
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/MemSpyEngineUtils.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,732 @@
+/*
+* 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 <memspy/engine/memspyengineutils.h>
+
+// System includes
+#include <e32svr.h>
+#include <e32capability.h>
+#ifdef __EPOC32__
+#include <e32rom.h>
+#endif
+
+// User includes
+#include <memspy/engine/memspyengineoutputsink.h>
+
+// Typedefs
+typedef TInt(*TSysUtilGetSWVersionFunction)(TDes&);
+
+// Literal constants
+_LIT( KMemSpyEngineDoubleColon, "::" );
+_LIT( KMemSpyKernelProcessName, "ekern" );
+_LIT( KMemSpyKernelProcessFullName, "ekern.exe[100041af]0001" );
+_LIT( KMemSpyKernelThreadName, "Supervisor" );
+_LIT( KMemSpyLogRootPath, "\\MemSpy\\" );
+_LIT( KMemSpyLogDefaultName, "Log" );
+_LIT( KMemSpyLogFileNameWithTimeStamp, "MemSpy - %4d%02d%02d - %02d.%02d.%02d.%06d - " );
+
+
+EXPORT_C void MemSpyEngineUtils::FormatTimeL( TDes& aBuf, const TInt64& aTimeVal, TBool aLocalTime )
+    {
+    const TTime time( aTimeVal );
+    FormatTimeL( aBuf, time, aLocalTime );
+    }
+
+
+EXPORT_C void MemSpyEngineUtils::FormatTimeL( TDes& aBuf, const TTime& aTime, TBool aLocalTime )
+    {
+    if  ( aLocalTime )
+        {
+        _LIT( KFormatSpecLocal, "%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B" );
+        // 
+        TTime time( aTime );
+        time += User::UTCOffset();
+        time.FormatL( aBuf, KFormatSpecLocal );
+        }
+    else
+        {
+        _LIT( KFormatSpecUTC, "%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B UTC" );
+        aTime.FormatL( aBuf, KFormatSpecUTC );
+        }
+    }
+
+
+void MemSpyEngineUtils::FormatTimeSimple( TDes& aBuf, const TTime& aTime )
+    {
+    const TDateTime dt = aTime.DateTime();
+    //
+    _LIT( KTimeFormatSpec, "%04d%02d%02d %02d:%02d:%02d" );
+    aBuf.Format( KTimeFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second() );
+    }
+
+
+EXPORT_C void MemSpyEngineUtils::FormatHex( TDes& aBuf, TInt aValue )
+    {
+    _LIT(KMemSpyNumericHexFormat, "0x%08x");
+    aBuf.Format( KMemSpyNumericHexFormat, aValue );
+    }
+
+
+EXPORT_C TMemSpySizeText MemSpyEngineUtils::FormatSizeText( const TInt64& aValue, TInt aDecimalPlaces, TBool aExtraRounding )
+    {
+    _LIT(KFormatKilo, "%dK");
+    _LIT(KFormatMega, "%SM");
+    _LIT(KFormatGiga, "%SG");
+
+	TMemSpySizeText buf;
+	if  ( aValue < 1024000 )					// If < 1000K
+		{
+		TInt sizeInK = 0;
+
+        if  ( aValue != 0 )
+			{
+			sizeInK = I64INT( (aValue + 512) >> 10 );
+			if  (sizeInK < 1)
+                {
+				sizeInK = 1;
+                }
+			if  (sizeInK > 999)
+                {
+				sizeInK = 999;
+                }
+			}
+
+        buf.Format( KFormatKilo, sizeInK );
+		}
+	else
+		{
+		TReal sizeInM = I64INT( aValue );
+		sizeInM /= 1048576;
+		if  ( sizeInM < 1 )
+            {
+			sizeInM = 1;
+            }
+
+        TPtrC pFormat( KFormatMega );
+		if  ( sizeInM >= 1000 )
+			{
+			sizeInM /= 1024;				// Size in G
+			if  (sizeInM < 1)
+                {
+				sizeInM = 1;
+                }
+			
+            pFormat.Set( KFormatGiga );
+			}
+
+        if  ( sizeInM > 999.9)
+            {
+            sizeInM = 999.9;
+            }
+
+        if  ( aExtraRounding )
+            {
+			sizeInM += 0.499999;
+            }
+
+		TBuf<16> size;
+		size.Num( sizeInM, TRealFormat( 14, aDecimalPlaces ) );	// Allow for "17179869184.0"G which is 2^64
+        buf.Format( pFormat, &size );
+		}
+
+    return buf;
+    }
+
+
+EXPORT_C TMemSpySizeText MemSpyEngineUtils::FormatSizeText( TInt aValue )
+    {
+    const TInt64 value( aValue );
+	return FormatSizeText( value );
+    }
+
+
+EXPORT_C TMemSpySizeText MemSpyEngineUtils::FormatSizeTextPrecise( TInt aValue )
+    {
+    /*
+    0123456789
+    ==========
+    1234567890
+
+    1,234,567,890
+
+    len = 10;
+    */
+
+	TMemSpySizeText buf;
+    buf.Num( aValue );
+    TInt index = buf.Length() - 3;
+    while( index > 0 )
+        {
+        buf.Insert( index, _L(",") );
+        index -= 3;
+        }
+
+    return buf;
+    }
+
+
+EXPORT_C TBool MemSpyEngineUtils::IsRomAddress( TAny* aAddress )
+    {
+    TBool inRom = EFalse;
+    //
+#ifdef __EPOC32__
+    const TInt err = User::IsRomAddress( inRom, aAddress );
+    if  ( err != KErrNone )
+        {
+        inRom = EFalse;
+        }
+#else
+    (void) aAddress;
+    inRom = ETrue;
+#endif
+    //
+    return inRom;
+    }
+
+
+EXPORT_C void MemSpyEngineUtils::GetCapabilityName( TDes& aBuf, TCapability aCapability )
+    {
+    const TPtrC8 pName( (const TUint8*) CapabilityNames[ aCapability ] );
+    aBuf.Copy( pName );
+    }
+
+
+EXPORT_C TBool MemSpyEngineUtils::StripText( TDes& aText, const TDesC& aStrip )
+    {
+    TBool stripped = EFalse;
+    const TInt stripTextLength = aStrip.Length();
+    //
+    if  ( aText.Length() > stripTextLength )
+        {
+        const TPtrC leftText( aText.Left( stripTextLength ) );
+        if  ( leftText.CompareF( aStrip ) == 0)
+            {
+            // Try to find the first double colon
+            const TInt doubleColonPos = aText.Find( KMemSpyEngineDoubleColon );
+            if  ( doubleColonPos >= stripTextLength )
+                {
+                aText.Delete( 0, doubleColonPos + 2 );
+                }
+            else
+                {
+                aText.Delete( 0, stripTextLength );
+                }
+
+            stripped = ETrue;
+            }
+        }
+    //
+    return stripped;
+    }
+
+
+EXPORT_C void MemSpyEngineUtils::TextBeforeDoubleColon( TDes& aText )
+    {
+    const TInt doubleColonPos = aText.Find( KMemSpyEngineDoubleColon );
+    if  ( doubleColonPos >= 0 )
+        {
+        aText.SetLength( doubleColonPos );
+        }
+    }
+
+
+EXPORT_C void MemSpyEngineUtils::TextAfterDoubleColon( TDes& aText )
+    {
+    const TInt doubleColonPos = aText.Find( KMemSpyEngineDoubleColon );
+    if  ( doubleColonPos >= 0 )
+        {
+        aText.Delete( 0, doubleColonPos + 2 );
+        }
+    }
+
+
+TPtrC MemSpyEngineUtils::TextAfterLastDoubleColon( const TDesC& aText )
+    {
+    TPtrC ret( aText );
+
+    // ABCD::123
+    const TInt doubleColonPos = aText.LocateReverseF( ':' );
+    if  ( doubleColonPos > 0 )
+        {
+        if ( aText[ doubleColonPos ] == ':' )
+            {
+            ret.Set( aText.Mid( doubleColonPos + 1 ) );
+            }
+        }
+
+    return ret;
+    }
+
+
+EXPORT_C TMemSpyPercentText MemSpyEngineUtils::FormatPercentage( TReal aOneHundredPercentValue, TReal aValue )
+    {
+    const TReal value = (( aValue / aOneHundredPercentValue) * 100.0);
+    
+    _LIT(KPercentFormat, "%3.2f %%");
+
+    TMemSpyPercentText val;
+    val.Format( KPercentFormat, value );
+    
+    return val;
+    }
+
+
+EXPORT_C HBufC* MemSpyEngineUtils::CleanupTextLC( const TDesC& aText )
+    {
+    _LIT( KMemSpyTabChar, "\t" );
+    _LIT( KMemSpyTabReplacementChar, " " );
+    _LIT( KMemSpyNewLineChar, "\n" );
+    _LIT( KMemSpyNewLineReplacementChar, " " );
+
+    TInt pos = KErrNotFound;
+
+    // Create replacement
+    const TInt originalLength = aText.Length();
+    HBufC* text = HBufC::NewLC( originalLength );
+    TPtr pText( text->Des() );
+    pText.Copy( aText );
+
+    // Replace tabs
+    pos = pText.Find( KMemSpyTabChar );
+    while( pos >= 0 )
+        {
+        pText.Replace( pos, KMemSpyTabChar().Length(), KMemSpyTabReplacementChar );
+        pos = pText.Find( KMemSpyTabChar );
+        }
+
+    // Replace tabs
+    pos = pText.Find( KMemSpyNewLineChar );
+    while( pos >= 0 )
+        {
+        pText.Replace( pos, KMemSpyNewLineChar().Length(), KMemSpyNewLineReplacementChar );
+        pos = pText.Find( KMemSpyNewLineChar );
+        }
+
+    __ASSERT_ALWAYS( pText.Length() == aText.Length(), User::Invariant() );
+    return text;
+    }
+
+
+EXPORT_C void MemSpyEngineUtils::GetRomInfoL( TDes& aPlatform, TDes& aChecksum )
+    {
+    aPlatform.Zero();
+    aChecksum.Zero();
+
+#ifdef __EPOC32__
+    // Get checksum 
+    TRomHeader* romHeader = (TRomHeader*) UserSvr::RomHeaderAddress();
+    if  ( romHeader )
+        {
+        aChecksum.Format( _L("0x%08x"), romHeader->iCheckSum );
+        }
+#endif
+
+    // Platform version
+    _LIT( KS60VersionDllName, "SysUtil.dll" );
+    RLibrary lib;
+    if  ( lib.Load( KS60VersionDllName ) == KErrNone )
+        {
+        // Get exported version function
+#ifdef __EPOC32__
+        const TInt KSysUtilOrdinal = 9;
+#else
+        const TInt KSysUtilOrdinal = 6;
+#endif
+        TLibraryFunction fn = lib.Lookup( KSysUtilOrdinal );
+        if ( fn != NULL )
+            {
+            TSysUtilGetSWVersionFunction sysUtilGetSWVersion = (TSysUtilGetSWVersionFunction) fn;
+            TInt err = (*sysUtilGetSWVersion)( aPlatform );
+            err = err;
+#ifdef _DEBUG
+            RDebug::Printf( "MemSpyEngineUtils::GetRomInfoL() - SysUtil::GetSWVersion() returned: %d", err );
+#endif
+            }
+
+        lib.Close();
+        }
+    }
+
+
+EXPORT_C void MemSpyEngineUtils::GetFolderL( RFs& aFsSession, TDes& aFolder, const CMemSpyEngineSinkMetaData& aMetaData, const TDriveNumber* aForceDrive )
+    {
+    const TChar KMemSpyDirectorySeparator = '\\';
+    const TChar KMemSpyDriveSeparator = ':';
+
+    TDriveList drives;
+    User::LeaveIfError( aFsSession.DriveList( drives ) );
+    
+    // We prefer to log to MMC if its available. If not, we'll log to C: instead. On
+    // WINS we prefer to log to C: because its easier to find via Windows Explorer.
+    TDriveNumber logDrive = EDriveC;
+    if  ( aForceDrive )
+        {
+        logDrive = *aForceDrive;
+        TRACE( RDebug::Printf( "MemSpyEngineUtils::GetFolderL() - FORCED TO DRIVE: %c:\\", *aForceDrive + 'A' ) );
+        }
+    else
+        {
+		// check if drive is specified in root path
+		if ( aMetaData.Root().Length() > 2 && aMetaData.Root()[1] == KMemSpyDriveSeparator )
+			{
+			TChar drive = aMetaData.Root()[0];
+			
+			// check if drive is valid
+			if (drives.Locate(drive) != KErrNone)
+				{
+				TDriveUnit driveUnit( aMetaData.Root().Left(1) );
+				logDrive = static_cast<TDriveNumber>(static_cast<TInt>(driveUnit));
+				}
+			else
+				{
+				logDrive = MemSpyEngineUtils::LocateSuitableDrive( aFsSession );
+				}
+			}
+		else
+			{
+			logDrive = MemSpyEngineUtils::LocateSuitableDrive( aFsSession );
+			}
+        }
+
+    // Prepare the drive buffer
+    HBufC* fileName = HBufC::NewLC( KMaxFileName * 2 );
+    TPtr pFileName( fileName->Des() );
+
+    // Prepare the drive name
+    TDriveUnit driveUnit( logDrive );
+    pFileName.Append( driveUnit.Name() );
+    
+    if ( aMetaData.Root().Length() == 0 )
+    	{
+		pFileName.Append( KMemSpyLogRootPath );
+    	}
+    else
+    	{
+		TPtrC root( aMetaData.Root() );
+		// check if root path contains drive (e.g. c:) and remove it
+		if ( root.Length() > 2 && root[1] == KMemSpyDriveSeparator )
+			{
+			root.Set( root.Mid( 2 ) );
+			}
+		// check if root starts with \ and remove it
+		if ( root.Length() > 1 && root[0] == KMemSpyDirectorySeparator )
+			{
+			root.Set( root.Mid( 1 ) );
+			}
+		
+		// append root path
+		pFileName.Append( KMemSpyDirectorySeparator );
+		pFileName.Append( root );
+		
+		// add trailing slash if necessary
+		if ( root[root.Length() - 1] != KMemSpyDirectorySeparator )
+			{
+			pFileName.Append( KMemSpyDirectorySeparator );
+			}
+    	}
+
+    // Add any custom folder information
+    if  ( aMetaData.Folder().Length() > 0 )
+        {
+        pFileName.Append( aMetaData.Folder() );
+        TRACE( RDebug::Print( _L("MemSpyEngineUtils::GetFolderL() - client folder: %S" ), &pFileName ) );
+
+        TChar lastChar = pFileName[ pFileName.Length() - 1 ];
+
+        // Take into account any "group" timestamp appendix
+        if  ( aMetaData.FolderTimeStamp().Length() )
+            {
+            if  ( lastChar != KMemSpyDirectorySeparator )
+                {
+                // Doesn't end with a backslash, so we must
+                // add separator info before the timestamp
+                pFileName.Append( ' ' );
+                pFileName.Append( '-' );
+                pFileName.Append( ' ' );
+                }
+
+            pFileName.Append( aMetaData.FolderTimeStamp() );
+            TRACE( RDebug::Print( _L("MemSpyEngineUtils::GetFolderL() - timestamp folder: %S" ), &pFileName ) );
+            }
+
+        // Ensure post-fixed by '\\' character
+        lastChar = ( pFileName[ pFileName.Length() - 1 ] );
+        if  ( lastChar != KMemSpyDirectorySeparator )
+            {
+            pFileName.Append( KMemSpyDirectorySeparator );
+            }
+        }
+
+    // Generate the timestamp file name
+    if  ( aMetaData.UseFileTimeStamp() )
+        {
+        TTime now;
+        now.HomeTime();
+        const TDateTime dateTime( now.DateTime() );
+        pFileName.AppendFormat( KMemSpyLogFileNameWithTimeStamp, dateTime.Year(), dateTime.Month() + 1, dateTime.Day() + 1,
+                                                                 dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond() );
+        TRACE( RDebug::Print( _L("MemSpyEngineUtils::GetFolderL() - timestamp file: %S" ), &pFileName ) );
+        }
+        
+    // Do we have some context information? If so, make sure its printable
+    HBufC* cleanedContext = NULL;
+    if  ( aMetaData.Context().Length() )
+        {
+        cleanedContext = CleanContextInfoLC( aMetaData.Context() );
+        }
+    else
+        {
+        // This must be the standard log then...
+        cleanedContext = KMemSpyLogDefaultName().AllocLC();
+        }
+
+    TRACE( RDebug::Print( _L("MemSpyEngineUtils::GetFolderL() - cleaned context: %S" ), cleanedContext ) );
+
+    // Build final part of file name
+    pFileName.Append( *cleanedContext );
+    CleanupStack::PopAndDestroy( cleanedContext );
+
+    // and finally, add the extension
+    if  ( aMetaData.Extension().Length() )
+        {
+        pFileName.Append( aMetaData.Extension() );
+        }
+    else
+        {
+        pFileName.Append( KMemSpyLogDefaultExtension );
+        }
+
+    TRACE( RDebug::Print( _L("MemSpyEngineUtils::GetFolderL() - END - fileName: %S"), fileName ) );
+    if  ( pFileName.Length() > aFolder.MaxLength() )
+        {
+        User::Leave( KErrOverflow );
+        }
+
+    aFolder.Copy( pFileName );
+    CleanupStack::PopAndDestroy( fileName );
+    }
+
+
+TDriveNumber MemSpyEngineUtils::LocateSuitableDrive( RFs& aFsSession )
+    {
+#ifndef __WINS__
+    TDriveInfo driveInfo;
+    TDriveList drives;
+    if  ( aFsSession.DriveList( drives ) == KErrNone )
+        {
+        for( TInt i=EDriveY; i>=EDriveD; i-- )
+            {
+            const TDriveNumber drive = static_cast< TDriveNumber >( i );
+            TRACE( RDebug::Print( _L("MemSpyEngineUtils::LocateSuitableDrive() - drive: %c:\\, available: %d"), drive + 'A', drives[ drive ] ) );
+
+            // Is drive available from an OS perspective?
+            if  ( drives[ drive ] != 0 )
+                {
+                // Check whether there is a disk present or not.
+                const TInt driveInfoErr = aFsSession.Drive( driveInfo, drive );
+                TRACE( RDebug::Print( _L("MemSpyEngineUtils::LocateSuitableDrive() - drive: %c:\\, driveInfoErr: %d"), drive + 'A', driveInfoErr ) );
+                if  ( driveInfoErr == KErrNone )
+                    {
+                    // Check if the drive is removable. We'll try to 
+                    // save data here in preference to the system drive if at all
+                    // possible...
+                    const TBool removable = ( driveInfo.iDriveAtt & KDriveAttRemovable );
+                    const TBool ram = ( driveInfo.iType == EMediaRam );
+                    const TBool rom = ( driveInfo.iType == EMediaRom );
+                    TRACE( RDebug::Printf( "MemSpyEngineUtils::LocateSuitableDrive() - drive: %c:\\, removable: %d, ram: %d, rom: %d", drive + 'A', removable, ram, rom ) );
+                    //
+                    if  ( removable && !( ram || rom ) )
+                        {
+                        // Check free space etc
+                        TVolumeInfo volInfo;
+                        const TInt volInfoErr = aFsSession.Volume( volInfo, drive );
+                        TRACE( RDebug::Printf( "MemSpyEngineUtils::LocateSuitableDrive() - drive: %c:\\, volInfoErr: %d", drive + 'A', volInfoErr ) );
+                        if  ( volInfoErr == KErrNone )
+                            {
+                            TRACE( RDebug::Printf( "MemSpyEngineUtils::LocateSuitableDrive() - END - using drive: %c:\\", drive + 'A', removable ) );
+                            return drive;
+                            }
+                        }
+                    }
+                }
+            }
+
+        }
+#else
+	(void) aFsSession;
+#endif
+
+    // Don't use RFs::GetSystemDrive() as it isn't available on v9.1
+    TRACE( RDebug::Printf( "MemSpyEngineUtils::LocateSuitableDrive() - END - fallback to EDriveC" ) );
+    return EDriveC;
+    }
+
+
+void MemSpyEngineUtils::FormatTimeNowL( TDes& aBuf, TBool aLocalTime )
+    {
+    TTime time;
+    if  ( aLocalTime )
+        {
+        time.HomeTime();
+        }
+    else
+        {
+        time.UniversalTime();
+        }
+
+    FormatTimeL( aBuf, time, aLocalTime );
+    }
+
+
+HBufC* MemSpyEngineUtils::DataStreamFolderNameWithTimeStampLC( const TDesC& aFolderName )
+    {
+    TMemSpyTimeText time;
+    FormatTimeNowL( time, ETrue );
+    //
+    HBufC* folder = HBufC::NewLC( aFolderName.Length() + time.Length() + 10 );
+    TPtr pFolder( folder->Des() );
+    //
+    pFolder.Append( aFolderName );
+    pFolder.Append( time );
+    //
+    return folder;
+    }
+
+
+void MemSpyEngineUtils::GetKernelHeapThreadName( TDes& aBuf, TBool aFullName )
+    {
+    if  ( !aFullName )
+        {
+        aBuf.Copy( KMemSpyKernelProcessName );
+        }
+    else
+        {
+        aBuf.Copy( KMemSpyKernelProcessFullName );
+        }
+
+    aBuf.Append( KMemSpyEngineDoubleColon );
+    aBuf.Append( KMemSpyKernelThreadName );
+    }
+
+
+void MemSpyEngineUtils::GetKernelHeapThreadAndProcessNames( TDes& aThreadName, TDes& aProcessName )
+    {
+    aThreadName.Copy( KMemSpyKernelThreadName );
+    aProcessName.Copy( KMemSpyKernelProcessName );
+    }
+
+
+TUint32 MemSpyEngineUtils::Hash( const TDesC& aText )
+    {
+    // DJB Hash Function
+    TUint32 hash = 5381;
+    //
+    const TInt length = aText.Length();
+    for( TInt i = 0; i < length; i++)
+        {
+        hash = ((hash << 5) + hash) + aText[ i ];
+        }
+    //
+    return hash;
+    }
+
+
+void MemSpyEngineUtils::Panic( TMemSpyEnginePanic aPanic )
+    {
+    _LIT( KMemSpyEnginePanicCategory, "MemSpyEngine" );
+    User::Panic( KMemSpyEnginePanicCategory, aPanic );
+    }
+
+
+TProcessId MemSpyEngineUtils::IdentifyFileServerProcessIdL()
+    {
+    TRACE( RDebug::Printf( "MemSpyEngineUtils::IdentifyFileServerProcessIdL() - START" ) );
+
+    TProcessId ret = KNullProcessId;
+
+    _LIT(KFindMask, "efile*");
+    TFullName name( KFindMask );
+    TFindProcess finder( name );
+
+    if  ( finder.Next( name ) == KErrNone )
+        {
+        RProcess process;
+        const TInt error = process.Open( name );
+        TRACE( RDebug::Print( _L("MemSpyEngineUtils::IdentifyFileServerProcessIdL() - process open err: %d, name: %S"), error, &name ) );
+        if  ( error == KErrNone )
+            {
+            ret = process.Id();
+            }
+
+        process.Close();
+        }
+
+    TRACE( RDebug::Printf( "MemSpyEngineUtils::IdentifyFileServerProcessIdL() - almost done - ret: %d", (TUint) ret ) );
+
+    if  ( static_cast< TUint >( ret ) == KNullProcessId )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    TRACE( RDebug::Printf( "MemSpyEngineUtils::IdentifyFileServerProcessIdL() - END - ret: %d", (TUint) ret ) );
+    return ret;
+    }
+
+
+HBufC* MemSpyEngineUtils::CleanContextInfoLC( const TDesC& aContext )
+    {
+    TRACE( RDebug::Print( _L("MemSpyEngineUtils::CleanContextInfoLC() - START - %S"), &aContext ) );
+    TFileName fileName;
+
+    TBool seenDoubleColon = EFalse;
+    const TInt length = aContext.Length();
+    for( TInt i=0; i<length; i++ )
+        {
+        const TChar c( aContext[ i ] );
+        const TBool haveNextChar = ( i+1 < length );
+        //
+        //TRACE( RDebug::Print( _L("MemSpyEngineUtils::CleanContextInfoLC() - c[%03d]: \'%c\', haveNextChar: %d, seenDoubleColon: %d"), i, (TUint32) c, haveNextChar, seenDoubleColon ) );
+        //
+        if  ( c == ':' && haveNextChar && aContext[ i + 1 ] == ':' )
+            {
+            // Skip double colon
+            i++;
+            fileName.Append( '-' );
+            seenDoubleColon = ETrue;
+            }
+        else if ( c == '.' )
+            {
+            if  ( seenDoubleColon )
+                {
+                break;
+                }
+            else
+                {
+                fileName.Append( '-' );
+                }
+            }
+        else
+            {
+            fileName.Append( c );
+            }
+        }
+
+    TRACE( RDebug::Print( _L("MemSpyEngineUtils::CleanContextInfoLC() - END - %S"), &fileName ) );
+    return fileName.AllocLC();
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Sink/MemSpyEngineOutputList.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,433 @@
+/*
+* 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 <memspy/engine/memspyengineoutputlist.h>
+
+// System includes
+#include <e32debug.h>
+
+// User includes
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include "MemSpyEngineOutputListItem.h"
+
+// Constants
+_LIT( KMemSpyOutputListPseudoBlankItem, " " );
+
+
+CMemSpyEngineOutputList::CMemSpyEngineOutputList( CMemSpyEngineOutputSink* aSink )
+:   iSink( aSink ), iFormatBufferPtr( NULL, 0 )
+    {
+    }
+
+
+CMemSpyEngineOutputList::~CMemSpyEngineOutputList()
+    {
+    delete iFormatBuffer;
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    }
+
+
+void CMemSpyEngineOutputList::ConstructL()
+    {
+    iFormatBuffer = HBufC::NewL( 1024 );
+    iFormatBufferPtr.Set( iFormatBuffer->Des() );
+    }
+
+
+CMemSpyEngineOutputList* CMemSpyEngineOutputList::NewL()
+    {
+    CMemSpyEngineOutputList* self = new(ELeave) CMemSpyEngineOutputList();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CMemSpyEngineOutputList* CMemSpyEngineOutputList::NewLC( CMemSpyEngineOutputSink& aSink )
+    {
+    CMemSpyEngineOutputList* self = new(ELeave) CMemSpyEngineOutputList( &aSink );
+    CleanupStack::PushL( self );
+
+    // No need to call ConstructL - it uses the sink's format buffer
+    return self;
+    }
+
+
+TInt CMemSpyEngineOutputList::MdcaCount() const
+    {
+    return iItems.Count();
+    }
+
+
+TPtrC CMemSpyEngineOutputList::MdcaPoint( TInt aPos ) const
+    {
+    CMemSpyEngineOutputListItem* item = iItems[ aPos ];
+    return TPtrC( item->Combined() );
+    }
+
+
+void CMemSpyEngineOutputList::PrintL()
+    {
+    ASSERT( iSink != NULL );
+    PrintL( *iSink );
+    }
+
+
+void CMemSpyEngineOutputList::PrintL( CMemSpyEngineOutputSink& aSink )
+    {
+    const TInt count = iItems.Count();
+    if  ( count > 0 )
+        {
+        // First pass to get max lengths
+        TInt maxLengthCaption = 0;
+        TInt maxLengthValue = 0;
+
+        for( TInt j=0; j<count; j++ )
+            {
+            const CMemSpyEngineOutputListItem* item = iItems[ j ];
+			if (item->Value().Length())
+				{
+	            maxLengthCaption = Max( maxLengthCaption, item->Caption().Length() );
+	            maxLengthValue = Max( maxLengthValue, item->Value().Length() );
+				}
+			else
+				{
+				// If something doesn't have a value (ie it's a section header, represented as just a caption) then the caption
+				// shouldn't be factored into the maxcaptionlength. But consider it in maxlengthValue to make sure we actually
+				// make the overall buffers big enough
+				maxLengthValue = Max( maxLengthValue, item->Caption().Length() );
+				}
+            }
+
+        // Second pass - real this time - to print the values
+        HBufC* line = HBufC::NewLC( ( maxLengthCaption + maxLengthValue ) + 20 );
+        TPtr pLine( line->Des() );
+        //
+        for( TInt i=0; i<count; i++ )
+            {
+            const CMemSpyEngineOutputListItem* item = iItems[ i ];
+
+            // Remove initial tabs in caption
+            HBufC* caption = MemSpyEngineUtils::CleanupTextLC( item->Caption() );
+        
+            // Create value item & replace any further tabs
+            HBufC* value = MemSpyEngineUtils::CleanupTextLC( item->Value() );
+
+            // Now format the final line, with padding.
+			if (value->Length()) 
+				{
+	            pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') );
+				}
+			else
+				{
+				// items without value (ie just captions, ie section headers) aren't constrained by the maxLengthCaption restriction
+				pLine.Copy(*caption);
+				}
+            pLine.Append( *value );
+            CleanupStack::PopAndDestroy( 2, caption );
+
+            // Sink output
+            aSink.OutputLineL( pLine );
+            }
+        //
+        CleanupStack::PopAndDestroy( line );
+        }
+    }
+
+
+CMemSpyEngineOutputListItem& CMemSpyEngineOutputList::Item( TInt aPos )
+    {
+    CMemSpyEngineOutputListItem* ret = iItems[ aPos ];
+    return *ret;
+    }
+
+
+const CMemSpyEngineOutputListItem& CMemSpyEngineOutputList::Item( TInt aPos ) const
+    {
+    const CMemSpyEngineOutputListItem* ret = iItems[ aPos ];
+    return *ret;
+    }
+
+
+void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption )
+    {
+    AddItemL( aCaption, KNullDesC );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, const TDesC& aValue )
+    {
+    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewLC( aCaption, aValue );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, TInt aValue )
+    {
+    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewDecimalLC( aCaption, aValue );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, TUint aValue )
+    {
+    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewDecimalLC( aCaption, aValue );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, const TInt64& aValue )
+    {
+    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewLongLC( aCaption, aValue );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, TAny* aValue )
+    {
+    AddItemHexL( aCaption, (TUint) aValue );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, TUint* aValue )
+    {
+    AddItemHexL( aCaption, (TUint) aValue );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemL( const TDesC& aCaption, TUint8* aValue )
+    {
+    AddItemHexL( aCaption, (TUint) aValue );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemFormatL( TRefByValue<const TDesC> aFormat, ... )
+    {
+	VA_LIST list;
+	VA_START(list,aFormat);
+
+    TPtr formatBuffer( FormatBuffer() );
+	formatBuffer.Zero();
+    formatBuffer.FormatList( aFormat, list );
+    //
+    AddItemL( formatBuffer, KNullDesC );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemFormatL( const TDesC& aCaption, TRefByValue<const TDesC> aValueFormat, ... )
+    {
+	VA_LIST list;
+	VA_START(list,aValueFormat);
+
+    TPtr formatBuffer( FormatBuffer() );
+	formatBuffer.Zero();
+    formatBuffer.FormatList( aValueFormat, list );
+    //
+    AddItemL( aCaption, formatBuffer );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemFormatUCL( TRefByValue<const TDesC> aFormat, ... )
+    {
+	VA_LIST list;
+	VA_START(list,aFormat);
+
+    TPtr formatBuffer( FormatBuffer() );
+	formatBuffer.Zero();
+    formatBuffer.FormatList( aFormat, list );
+    //
+    AddItemUCL( formatBuffer, KNullDesC );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemUCL( const TDesC& aCaption, const TDesC& aValue )
+    {
+    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewLC( aCaption, aValue );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    //
+    item->iCaption->Des().UpperCase();
+    item->UpdateCombinedL();
+    }
+
+
+void CMemSpyEngineOutputList::AddItemFormatUCL( const TDesC& aCaption, TRefByValue<const TDesC> aValueFormat, ... )
+    {
+	VA_LIST list;
+	VA_START(list,aValueFormat);
+
+    TPtr formatBuffer( FormatBuffer() );
+	formatBuffer.Zero();
+    formatBuffer.FormatList( aValueFormat, list );
+    //
+    AddItemUCL( aCaption, formatBuffer );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemHexL( const TDesC& aCaption, TUint aValue )
+    {
+    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewHexLC( aCaption, aValue );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemYesNoL( const TDesC& aCaption, TBool aYes )
+    {
+    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewYesNoLC( aCaption, aYes );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemTrueFalseL( const TDesC& aCaption, TBool aTrue )
+    {
+    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewTrueFalseLC( aCaption, aTrue );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemOnOffL( const TDesC& aCaption, TBool aOn )
+    {
+    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewOnOffLC( aCaption, aOn );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyEngineOutputList::AddItemPercentageL( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue )
+    {
+    const TMemSpyPercentText val( MemSpyEngineUtils::FormatPercentage( TReal( aOneHundredPercentValue ), TReal( aValue ) ) );
+    AddItemL( aCaption, val );
+    }
+
+
+void CMemSpyEngineOutputList::AddBlankItemL( TInt aRepetitions )
+    {
+    const TInt count = Count();
+    InsertBlankItemL( count, aRepetitions );
+    }
+
+
+void CMemSpyEngineOutputList::AddUnderlineForPreviousItemL( TChar aUnderlineCharacter, TInt aBlankItemCount )
+    {
+    const TInt count = iItems.Count();
+    if  ( count > 0 )
+        {
+        InsertUnderlineForItemAtL( count - 1, aUnderlineCharacter, aBlankItemCount );
+        }
+    }
+
+
+void CMemSpyEngineOutputList::InsertItemL( TInt aPos, const TDesC& aCaption )
+    {
+    InsertItemL( aPos, aCaption, KNullDesC );
+    }
+
+
+void CMemSpyEngineOutputList::InsertItemL( TInt aPos, const TDesC& aCaption, const TDesC& aValue )
+    {
+    CMemSpyEngineOutputListItem* item = CMemSpyEngineOutputListItem::NewLC( aCaption, aValue );
+    iItems.InsertL( item, aPos );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyEngineOutputList::InsertItemFormatUCL( TInt aPos, TRefByValue<const TDesC> aValueFormat, ... )
+    {
+	VA_LIST list;
+	VA_START(list,aValueFormat);
+
+    TPtr formatBuffer( FormatBuffer() );
+	formatBuffer.Zero();
+    formatBuffer.FormatList( aValueFormat, list );
+    //
+    InsertItemL( aPos, formatBuffer, KNullDesC );
+    }
+
+
+void CMemSpyEngineOutputList::InsertBlankItemL( TInt aPos, TInt aRepetitions )
+    {
+    while( aRepetitions-- > 0 )
+        {
+        InsertItemL( aPos, KMemSpyOutputListPseudoBlankItem, KMemSpyOutputListPseudoBlankItem );
+        }
+    }
+
+
+void CMemSpyEngineOutputList::InsertUnderlineForItemAtL( TInt aPos, TChar aUnderlineCharacter, TInt aBlankItemCount )
+    {
+    const CMemSpyEngineOutputListItem& item = Item( aPos );
+    
+    // Clean text
+    HBufC* caption = MemSpyEngineUtils::CleanupTextLC( item.Caption() );
+    //RDebug::Print( _L("CMemSpyEngineOutputList::AddUnderlineForPreviousItemL() - [%3d] caption: %S"), caption->Length(), caption );
+    HBufC* value = MemSpyEngineUtils::CleanupTextLC( item.Value() );
+    //RDebug::Print( _L("CMemSpyEngineOutputList::AddUnderlineForPreviousItemL() - [%3d] value: %S"), value->Length(), value );
+    
+    // Make underline descriptor
+    TBuf<1> underline;
+    underline.Append( aUnderlineCharacter );
+
+    // Make underline items
+    const TInt lenCaption = caption->Length();
+    if ( lenCaption > 0 )
+        {
+        TPtr pText( caption->Des() );
+        pText.Repeat( underline );
+        }
+
+    const TInt lenValue = value->Length();
+    if ( lenValue > 0 )
+        {
+        TPtr pText( value->Des() );
+        pText.Repeat( underline );
+        }
+
+    // Create new item
+    InsertItemL( aPos + 1, *caption, *value );
+
+    // Clean up
+    CleanupStack::PopAndDestroy( 2, caption );
+
+    // Make blank row if needed
+    InsertBlankItemL( aPos + 2, aBlankItemCount );
+    }
+
+
+TPtr& CMemSpyEngineOutputList::FormatBuffer()
+    {
+    if  ( iSink )
+        {
+        return iSink->FormatBuffer();
+        }
+    //
+    return iFormatBufferPtr;
+    }
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Sink/MemSpyEngineOutputListItem.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,280 @@
+/*
+* 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 "MemSpyEngineOutputListItem.h"
+
+// System includes
+#include <e32debug.h>
+
+// User includes
+#include <memspy/engine/memspyengineutils.h>
+
+// Constants
+const TInt KMemSpyNumericFormatBufferSize = 20;
+
+// Literal constants
+_LIT(KMemSpyNumericHexFormat, "0x%08x");
+_LIT(KMemSpyNumericUnsignedFormat, "%u");
+_LIT(KMemSpyNumericDecFormat, "%d");
+_LIT(KMemSpyNumericLongFormat, "%Ld");
+_LIT(KMemSpyCaptionYes, "Yes");
+_LIT(KMemSpyCaptionNo, "No");
+_LIT(KMemSpyCaptionOn, "On");
+_LIT(KMemSpyCaptionOff, "Off");
+_LIT(KMemSpyCaptionTrue, "True");
+_LIT(KMemSpyCaptionFalse, "False");
+
+
+
+CMemSpyEngineOutputListItem::CMemSpyEngineOutputListItem()
+    {
+    }
+
+
+CMemSpyEngineOutputListItem::~CMemSpyEngineOutputListItem()
+    {
+    delete iCaption;
+    delete iValue;
+    delete iCombined;
+    }
+
+
+void CMemSpyEngineOutputListItem::ConstructL( const TDesC& aCaption, const TDesC& aValue )
+    {
+    iCaption = aCaption.AllocL();
+    iValue = aValue.AllocL();
+    //
+    UpdateCombinedL();
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewLC( const CMemSpyEngineOutputListItem& aCopyMe )
+    {
+    CMemSpyEngineOutputListItem* self = new(ELeave) CMemSpyEngineOutputListItem();
+    CleanupStack::PushL( self );
+    self->ConstructL( aCopyMe.Caption(), aCopyMe.Value() );
+    return self;
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewLC( const TDesC& aCaption )
+    {
+    CMemSpyEngineOutputListItem* self = new(ELeave) CMemSpyEngineOutputListItem();
+    CleanupStack::PushL( self );
+    self->ConstructL( aCaption, KNullDesC );
+    return self;
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewLC( const TDesC& aCaption, const TDesC& aValue )
+    {
+    CMemSpyEngineOutputListItem* self = new(ELeave) CMemSpyEngineOutputListItem();
+    CleanupStack::PushL( self );
+    self->ConstructL( aCaption, aValue );
+    return self;
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewLC( const TDesC& aCaption, TUint aValue )
+    {
+    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
+    ret->SetUnsignedL( aValue );
+    return ret;
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewHexLC( const TDesC& aCaption, TUint aValue )
+    {
+    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
+    ret->SetHexL( aValue );
+    return ret;
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewDecimalLC( const TDesC& aCaption, TInt aValue )
+    {
+    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
+    ret->SetDecimalL( aValue );
+    return ret;
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewLongLC( const TDesC& aCaption, const TInt64& aValue )
+    {
+    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
+    ret->SetLongL( aValue );
+    return ret;
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewYesNoLC( const TDesC& aCaption, TBool aYes )
+    {
+    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
+    ret->SetYesNoL( aYes );
+    return ret;
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewTrueFalseLC( const TDesC& aCaption, TBool aTrue )
+    {
+    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
+    ret->SetTrueFalseL( aTrue );
+    return ret;
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewOnOffLC( const TDesC& aCaption, TBool aOn )
+    {
+    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
+    ret->SetOnOffL( aOn );
+    return ret;
+    }
+
+
+CMemSpyEngineOutputListItem* CMemSpyEngineOutputListItem::NewPercentageLC( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue )
+    {
+    CMemSpyEngineOutputListItem* ret = CMemSpyEngineOutputListItem::NewLC( aCaption );
+    ret->SetPercentageL( aOneHundredPercentValue, aValue );
+    return ret;
+    }
+
+
+void CMemSpyEngineOutputListItem::SetValueL( const TDesC& aValue )
+    {
+    if  ( iValue == NULL )
+        {
+        iValue = aValue.AllocL();
+        }
+    else
+        {
+        if  ( iValue->Des().MaxLength() < aValue.Length() )
+            {
+            iValue = iValue->ReAllocL( aValue.Length() );
+            }
+            
+        // Now its safe to assign new content
+        *iValue = aValue;
+        }
+        
+    UpdateCombinedL();
+    }
+
+
+void CMemSpyEngineOutputListItem::SetUnsignedL( TUint aValue )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    val.Format( KMemSpyNumericUnsignedFormat, aValue );
+    SetValueL( val );
+    }
+
+
+void CMemSpyEngineOutputListItem::SetHexL( TUint aValue )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    val.Format( KMemSpyNumericHexFormat, aValue );
+    SetValueL( val );
+    }
+
+
+void CMemSpyEngineOutputListItem::SetDecimalL( TInt aValue )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    val.Format( KMemSpyNumericDecFormat, aValue );
+    SetValueL( val );
+    }
+
+
+void CMemSpyEngineOutputListItem::SetLongL( const TInt64& aValue )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    val.Format( KMemSpyNumericLongFormat, aValue );
+    SetValueL( val );
+    }
+
+
+void CMemSpyEngineOutputListItem::SetYesNoL( TBool aYes )
+    {
+    if  ( aYes )
+        {
+        SetValueL( KMemSpyCaptionYes );
+        }
+    else
+        {
+        SetValueL( KMemSpyCaptionNo );
+        }
+    }
+
+
+void CMemSpyEngineOutputListItem::SetTrueFalseL( TBool aTrue )
+    {
+    if  ( aTrue )
+        {
+        SetValueL( KMemSpyCaptionTrue );
+        }
+    else
+        {
+        SetValueL( KMemSpyCaptionFalse );
+        }
+    }
+
+
+void CMemSpyEngineOutputListItem::SetOnOffL( TBool aOn )
+    {
+    if  ( aOn )
+        {
+        SetValueL( KMemSpyCaptionOn );
+        }
+    else
+        {
+        SetValueL( KMemSpyCaptionOff );
+        }
+    }
+
+
+void CMemSpyEngineOutputListItem::SetPercentageL( TInt aOneHundredPercentValue, TInt aValue )
+    {
+    const TMemSpyPercentText val( MemSpyEngineUtils::FormatPercentage( TReal( aOneHundredPercentValue ), TReal( aValue ) ) );
+    SetValueL( val );
+    }
+
+
+void CMemSpyEngineOutputListItem::UpdateCombinedL()
+    {
+    const TInt requiredLength = Caption().Length() + Value().Length() + 10;
+    //
+    if  ( iCombined == NULL )
+        {
+        iCombined = HBufC::NewL( requiredLength );
+        }
+    else if ( iCombined->Des().MaxLength() < requiredLength )
+        {
+        iCombined = iCombined->ReAllocL( requiredLength );
+        }
+        
+    TPtr pCombined( iCombined->Des() );
+    pCombined.Zero();
+    pCombined.Append( _L("\t") );
+    pCombined.Append( Caption() );
+    pCombined.Append( _L("\t\t") );
+    pCombined.Append( Value() );
+    }
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Sink/MemSpyEngineOutputSink.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,444 @@
+/*
+* 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 <memspy/engine/memspyengineoutputsink.h>
+
+// User includes
+#include <memspy/engine/memspyengineutils.h>
+
+// Constants
+const TInt KMemSpyItemAndValueAlignmentAmount = 30;
+const TInt KMemSpyNumericFormatBufferSize = 20;
+
+// Literal constants
+_LIT( KMemSpyNumericHexFormat, "0x%08x" );
+_LIT( KMemSpyNumericDecFormat, "%d" );
+_LIT( KMemSpyDataStreamFolderNameFormatSpec, "%04d%02d%02d - %02dh %02dm %02ds" );
+
+
+CMemSpyEngineOutputSink::CMemSpyEngineOutputSink( CMemSpyEngine& aEngine )
+:   iEngine( aEngine ), iFormatBufferPointer( NULL, 0 )
+    {
+    }
+
+
+CMemSpyEngineOutputSink::~CMemSpyEngineOutputSink()
+    {
+    delete iFormatBuffer;
+    delete iPrefix;
+    delete iLocalBuffer;
+    delete iDataStreamTimeStampSpecifier;
+    }
+
+
+void CMemSpyEngineOutputSink::BaseConstructL()
+    {
+    iFormatBuffer = HBufC::NewL( 1024 );
+    iFormatBufferPointer.Set( iFormatBuffer->Des() );
+    iPrefix = HBufC::NewL( 2048 );
+    iLocalBuffer = HBufC::NewL( 2048 );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::DataStreamTimeStampBeginL( const TTime& aTime )
+    {
+    const TDateTime dt( aTime.DateTime() );
+
+    // Build it up...
+    HBufC* spec = HBufC::NewL( KMaxFileName );
+    TPtr pName( spec->Des() );
+    pName.Format( KMemSpyDataStreamFolderNameFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second());
+    
+    DataStreamTimeStampEnd();
+    iDataStreamTimeStampSpecifier = spec;
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::DataStreamTimeStampEnd()
+    {
+    delete iDataStreamTimeStampSpecifier;
+    iDataStreamTimeStampSpecifier = NULL;
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::DataStreamBeginL( const TDesC& aContext )
+    {
+    DataStreamBeginL( aContext, KNullDesC );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder )
+    {
+    DataStreamBeginL( aContext, aFolder, KNullDesC );
+    }
+
+
+void CMemSpyEngineOutputSink::ProcessSuspendedL( TProcessId /*aId*/ )
+    {
+    }
+
+
+void CMemSpyEngineOutputSink::ProcessResumed( TProcessId /*aId*/ )
+    {
+    }
+
+
+TBool CMemSpyEngineOutputSink::IsPrefixAllowed( const TDesC& /*aPrefix*/ )
+    {
+    return ETrue;
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputPrefixSetLC( const TDesC& aPrefix )
+    {
+    __ASSERT_ALWAYS( aPrefix.Length() <= iPrefix->Des().MaxLength(), User::Invariant() );
+    TPtr pPrefix( iPrefix->Des() );
+    pPrefix.Zero();
+
+    if  ( IsPrefixAllowed( aPrefix ) )
+        {
+        pPrefix.Copy( aPrefix );
+        }
+
+    CleanupStack::PushL( TCleanupItem( ClearPrefix, this ) );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputPrefixSetFormattedLC( TRefByValue<const TDesC> aFormat, ... )
+    {
+	VA_LIST list;
+	VA_START(list,aFormat);
+    //
+	iFormatBufferPointer.Zero();
+    iFormatBufferPointer.FormatList( aFormat, list );
+    //
+    OutputPrefixSetLC( iFormatBufferPointer );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputPrefixClear()
+    {
+    iPrefix->Des().Zero();
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputRawL( const TDesC8& aData )
+    {
+    DoOutputRawL( aData );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputLineL( const TDesC& aLine, TBool aIncludePrefix )
+    {
+    TPtr pBuffer( iLocalBuffer->Des() );
+    if  ( aIncludePrefix )
+        {
+        pBuffer.Copy( *iPrefix );
+        }
+    else
+        {
+        pBuffer.Zero();
+        }
+
+    pBuffer.Append( aLine );
+    DoOutputLineL( pBuffer );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputLineFormattedL( TRefByValue<const TDesC> aFormat, ... )
+    {
+	VA_LIST list;
+	VA_START(list,aFormat);
+
+	iFormatBufferPointer.Zero();
+    iFormatBufferPointer.FormatList( aFormat, list );
+    //
+    OutputLineL( iFormatBufferPointer );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputBlankLineL()
+    {
+    DoOutputLineL( KNullDesC );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputSectionHeadingL( const TDesC& aCaption, TChar aUnderlineCharacter )
+    {
+    OutputBlankLineL();
+    OutputLineL( aCaption );
+    //
+    HBufC* underline = HBufC::NewLC( aCaption.Length() );
+    TPtr pUnderline( underline->Des() );
+    pUnderline.Fill( aUnderlineCharacter, aCaption.Length());
+    OutputLineL( *underline );
+    CleanupStack::PopAndDestroy( underline );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputItemAndValueL( const TDesC& aItem, const TDesC& aValue )
+    {
+    FormatBuffer().Zero();
+    FormatBuffer().Append( aItem );
+    FormatBuffer().Append( ':' );
+
+    const TInt padAmount = KMemSpyItemAndValueAlignmentAmount - aItem.Length();
+ 
+    FormatBuffer().AppendFill(' ', padAmount);
+    FormatBuffer().Append( ' ' );
+    FormatBuffer().Append( aValue );
+
+    OutputLineL( FormatBuffer() );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputItemAndValueL( const TDesC& aItem, TUint aValue, TBool aHex )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    //
+    if  ( aHex )
+        {
+        val.Format( KMemSpyNumericHexFormat, aValue );
+        }
+    else
+        {
+        val.Format( KMemSpyNumericDecFormat, aValue );
+        }
+    //
+    OutputItemAndValueL( aItem, val );
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputBinaryDataL( const TDesC& aFormat, const TUint8* aBufferAddress, const TUint8* aDisplayStartAddress, TInt aLength )
+    {
+    _LIT(KAddresPostfix, ": ");
+    _LIT(KDoubleSpace, "  ");
+    _LIT(KSingleSpace, " ");
+
+    const TInt maxLen = aLength;
+    TInt len = aLength;
+    const TUint8* pDataAddr = aBufferAddress;
+
+	TBuf<81> out;
+	TBuf<20> ascii;
+	TInt offset = 0;
+	const TUint8* a = pDataAddr;
+    const TUint8* displayAddress = aDisplayStartAddress;
+    //
+	while(len>0)
+		{
+		out.Zero();
+		ascii.Zero();
+		out.AppendNumFixedWidth((TUint) displayAddress, EHex, 8);
+		out.Append(KAddresPostfix);
+
+        TUint b;
+		for (b=0; b<16; b++)
+			{
+            TUint8 c = ' ';
+            if	((pDataAddr + offset + b) < pDataAddr + maxLen)
+	            {
+	            c = *(pDataAddr + offset + b);
+				out.AppendNumFixedWidth(c, EHex, 2);
+	            }
+            else
+	            {
+				out.Append(KDoubleSpace);
+	            }
+			out.Append( KSingleSpace );
+			if (c<=0x20 || c == 0x27 || c>=0x7f || c=='%')
+				c=0x2e;
+			ascii.Append(TChar(c));
+			}
+		out.Append(ascii);
+        out.ZeroTerminate();
+
+        FormatBuffer().Format( aFormat, &out );
+        OutputLineL( FormatBuffer() );
+
+        displayAddress += 16;
+        a += 16;
+		offset += 16;
+		len -= 16;
+        }
+    }
+
+
+EXPORT_C void CMemSpyEngineOutputSink::OutputBinaryDataCompressedL( const TDesC& aFormat, const TUint8* aBufferAddress, const TUint8* aDisplayStartAddress, TInt aLength )
+    {
+    _LIT(KAddresPostfix, ": ");
+    _LIT(KDoubleSpace, "  ");
+
+    const TInt maxLen = aLength;
+    TInt len = aLength;
+    const TUint8* pDataAddr = aBufferAddress;
+
+	TBuf<81> out;
+	TInt offset = 0;
+	const TUint8* a = pDataAddr;
+    const TUint8* displayAddress = aDisplayStartAddress;
+    //
+	while(len>0)
+		{
+		out.Zero();
+		out.AppendNumFixedWidth((TUint) displayAddress, EHex, 8);
+		out.Append(KAddresPostfix);
+
+        TUint b;
+		for (b=0; b<16; b++)
+			{
+            TUint8 c = ' ';
+            if	((pDataAddr + offset + b) < pDataAddr + maxLen)
+	            {
+	            c = *(pDataAddr + offset + b);
+				out.AppendNumFixedWidth(c, EHex, 2);
+	            }
+            else
+	            {
+				out.Append(KDoubleSpace);
+	            }
+			if (c<=0x20 || c>=0x7f || c=='%')
+				c=0x2e;
+			}
+        out.ZeroTerminate();
+
+        FormatBuffer().Format( aFormat, &out );
+        OutputLineL( FormatBuffer() );
+
+        displayAddress += 16;
+        a += 16;
+		offset += 16;
+		len -= 16;
+        }
+    }
+
+
+TPtr& CMemSpyEngineOutputSink::FormatBuffer()
+    {
+    return iFormatBufferPointer;
+    }
+
+
+CMemSpyEngine& CMemSpyEngineOutputSink::Engine()
+    {
+    return iEngine;
+    }
+
+
+void CMemSpyEngineOutputSink::ClearPrefix( TAny* aSelf )
+    {
+    CMemSpyEngineOutputSink* self = reinterpret_cast< CMemSpyEngineOutputSink* >( aSelf );
+    self->OutputPrefixClear();
+    }
+
+
+const TDesC& CMemSpyEngineOutputSink::DataStreamTimeStamp() const
+    {
+    if  ( iDataStreamTimeStampSpecifier )
+        {
+        return *iDataStreamTimeStampSpecifier;
+        }
+
+    return KNullDesC;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineSinkMetaData::CMemSpyEngineSinkMetaData( TBool aOverwrite, TBool aUseFileTimeStamp )
+:   iOverwrite( aOverwrite ), iUseFileTimeStamp( aUseFileTimeStamp )
+    {
+    }
+
+
+EXPORT_C CMemSpyEngineSinkMetaData::~CMemSpyEngineSinkMetaData()
+    {
+	delete iRoot;
+    delete iContext;
+    delete iFolder;
+    delete iExtension;
+    delete iFolderTimeStamp;
+    }
+
+
+void CMemSpyEngineSinkMetaData::ConstructL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, const TTime& aFolderTime )
+    {
+	iRoot = aRoot.AllocL();
+    iContext = aContext.AllocL();
+    iFolder = aFolder.AllocL();
+    iExtension = aExtension.AllocL();
+
+    const TDateTime dt = aFolderTime.DateTime();
+    HBufC* spec = HBufC::NewLC( KMaxFileName );
+    TPtr pName( spec->Des() );
+    pName.Format( KMemSpyDataStreamFolderNameFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second());
+    iFolderTimeStamp = pName.AllocL();
+    CleanupStack::PopAndDestroy( spec );
+    }
+
+
+EXPORT_C CMemSpyEngineSinkMetaData* CMemSpyEngineSinkMetaData::NewL()
+    {
+    return CMemSpyEngineSinkMetaData::NewL( KNullDesC, KNullDesC, KNullDesC, ETrue, ETrue );
+    }
+
+EXPORT_C CMemSpyEngineSinkMetaData* CMemSpyEngineSinkMetaData::NewL(  const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp )
+	{
+	return NewL( KNullDesC, aContext, aFolder, aExtension, aOverwrite, aUseFileTimeStamp );
+	}
+
+EXPORT_C CMemSpyEngineSinkMetaData* CMemSpyEngineSinkMetaData::NewL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp, const TTime& aFolderTimeStamp )
+    {
+    return NewL( KNullDesC, aContext, aFolder, aExtension, aOverwrite, aUseFileTimeStamp, aFolderTimeStamp );
+    }
+
+EXPORT_C CMemSpyEngineSinkMetaData* CMemSpyEngineSinkMetaData::NewL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp )
+    {
+    // Create a dummy time, we'll clear it after ConstructL() returns...
+    TTime now; now.HomeTime();
+
+    CMemSpyEngineSinkMetaData* self = new(ELeave) CMemSpyEngineSinkMetaData( aOverwrite, aUseFileTimeStamp );
+    CleanupStack::PushL( self );
+    self->ConstructL( aRoot, aContext, aFolder, aExtension, now );
+    CleanupStack::Pop( self );
+
+    // Clear folder time stamp
+    self->iFolderTimeStamp->Des().Zero();
+    return self;
+    }
+
+EXPORT_C CMemSpyEngineSinkMetaData* CMemSpyEngineSinkMetaData::NewL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp, const TTime& aFolderTimeStamp )
+    {
+    CMemSpyEngineSinkMetaData* self = new(ELeave) CMemSpyEngineSinkMetaData( aOverwrite, aUseFileTimeStamp );
+    CleanupStack::PushL( self );
+    self->ConstructL( aRoot, aContext, aFolder, aExtension, aFolderTimeStamp );
+    CleanupStack::Pop( self );
+    return self;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Sink/MemSpyEngineOutputSinkDebug.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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 "MemSpyEngineOutputSinkDebug.h"
+
+// System includes
+#include <e32svr.h>
+
+// Constants
+const TInt KMemSpyEngineOutputSinkDebugMaxLineLength = 0x100;
+
+
+CMemSpyEngineOutputSinkDebug::CMemSpyEngineOutputSinkDebug( CMemSpyEngine& aEngine )
+:   CMemSpyEngineOutputSink( aEngine )
+    {
+    }
+
+
+CMemSpyEngineOutputSinkDebug::~CMemSpyEngineOutputSinkDebug()
+    {
+    }
+
+
+void CMemSpyEngineOutputSinkDebug::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+
+CMemSpyEngineOutputSinkDebug* CMemSpyEngineOutputSinkDebug::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineOutputSinkDebug* self = new(ELeave) CMemSpyEngineOutputSinkDebug( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+TMemSpySinkType CMemSpyEngineOutputSinkDebug::Type() const
+    {
+    return ESinkTypeDebug;
+    }
+
+
+void CMemSpyEngineOutputSinkDebug::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension )
+    {
+    DataStreamBeginL( aContext, aFolder, aExtension, ETrue );
+    }
+
+
+void CMemSpyEngineOutputSinkDebug::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite )
+    {
+    DataStreamBeginL( aContext, aFolder, aExtension, aOverwrite, ETrue );
+    }
+
+
+void CMemSpyEngineOutputSinkDebug::DataStreamBeginL( const TDesC& /*aContext*/, const TDesC& /*aFolder*/, const TDesC& /*aExtension*/, TBool /*aOverwrite*/, TBool /*aUseTimeStamp*/ )
+    {
+    // Doesn't support data streams
+    }
+
+
+void CMemSpyEngineOutputSinkDebug::DataStreamEndL()
+    {
+    // Doesn't support data streams
+    }
+
+
+void CMemSpyEngineOutputSinkDebug::DoOutputLineL( const TDesC& aLine )
+    {
+    if  ( !aLine.Length() )
+        {
+        // Blank line is special case
+        RDebug::Printf( " " );
+        }
+    else
+        {
+        _LIT( KPrintFormat, "%S" );
+
+        HBufC* buf = aLine.AllocLC();
+        if  ( aLine.Length() > KMemSpyEngineOutputSinkDebugMaxLineLength )
+            {
+            buf->Des().SetLength( KMemSpyEngineOutputSinkDebugMaxLineLength );
+            }
+        RDebug::Print( KPrintFormat, buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    }
+
+
+void CMemSpyEngineOutputSinkDebug::DoOutputRawL( const TDesC8& /*aData*/ )
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/Sink/MemSpyEngineOutputSinkFile.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,749 @@
+/*
+* 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 "MemSpyEngineOutputSinkFile.h"
+
+// System includes
+#include <e32svr.h>
+
+// User includes
+#include <memspy/engine/memspyenginelogger.h>
+#include <memspy/engine/memspyengineutils.h>
+
+// Constants
+const TInt KMemSpyLineBufferLength = 1024;
+const TInt KMemSpyFileServerBufferExpandSize = 1024 * 32;
+
+// Literal constants
+_LIT8( KMemSpyCRLF, "\r\n" );
+
+
+CMemSpyEngineOutputSinkFile::CMemSpyEngineOutputSinkFile( CMemSpyEngine& aEngine )
+:   CMemSpyEngineOutputSink( aEngine )
+    {
+    }
+
+
+CMemSpyEngineOutputSinkFile::~CMemSpyEngineOutputSinkFile()
+    {
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::~CMemSpyEngineOutputSinkFile() - START" ) );
+    
+    delete iRoot;
+
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::~CMemSpyEngineOutputSinkFile() - destroying normal logs..." ) );
+    iLogs.ResetAndDestroy();
+    iLogs.Close();
+
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::~CMemSpyEngineOutputSinkFile() - destroying limbo logs..." ) );
+    iLogsPendingDestruction.ResetAndDestroy();
+    iLogsPendingDestruction.Close();
+
+    iFsSession.Close();
+
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::~CMemSpyEngineOutputSinkFile() - END" ) );
+    }
+
+
+void CMemSpyEngineOutputSinkFile::ConstructL( const TDesC& aRootFolder )
+    {
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructL() - START" ) );
+    
+    iRoot = aRootFolder.AllocL();
+
+    BaseConstructL();
+
+    // Identify the file server process id
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructL() - identifying f32 process id..." ) );
+    iFileServerProcessId = MemSpyEngineUtils::IdentifyFileServerProcessIdL();
+
+    // Create the standard output file
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructL() - connecting to f32..." ) );
+    User::LeaveIfError( iFsSession.Connect() );
+    
+    // Make default log file
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructL() - preparing default log..." ) );
+    ConstructDefaultLogFileL();
+
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructL() - END" ) );
+    }
+
+
+CMemSpyEngineOutputSinkFile* CMemSpyEngineOutputSinkFile::NewL( CMemSpyEngine& aEngine, const TDesC& aRootFolder )
+    {
+    CMemSpyEngineOutputSinkFile* self = new(ELeave) CMemSpyEngineOutputSinkFile( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL( aRootFolder );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+void CMemSpyEngineOutputSinkFile::ProcessSuspendedL( TProcessId aId )
+    {
+    TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::ProcessSuspendedL() - START - aId: %d, iFileServerSuspended: %d, iFileServerProcessId: %d"), (TUint) aId, iFileServerSuspended, (TUint) iFileServerProcessId ) );
+
+    iFileServerSuspended = ( (TUint) aId == iFileServerProcessId );
+    if  ( iFileServerSuspended )
+        {
+        const TInt count = iLogs.Count();
+        TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::ProcessSuspendedL() - enabling buffers for %d logs"), count ) );
+        for( TInt i=0; i<count; i++ )
+            {
+            CMemSpyEngineFileHolder* log = iLogs[i];
+            log->EnableBufferL();
+            }
+        }
+
+    TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::ProcessSuspendedL() - END - aId: %d, iFileServerSuspended: %d"), (TUint) aId, iFileServerSuspended ) );
+    }
+
+
+void CMemSpyEngineOutputSinkFile::ProcessResumed( TProcessId aId )
+    {
+    const TBool isF32Process = ( (TUint) aId == iFileServerProcessId );
+    TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::ProcessResumed() - START - aId: %d, iFileServerSuspended: %d, isF32Process: %d"), (TUint) aId, iFileServerSuspended, isF32Process ) );
+    //
+    if  ( iFileServerSuspended )
+        {
+        __ASSERT_ALWAYS( isF32Process, User::Invariant() );
+
+        TRAPD( err, DisableAllBuffersAfterFileServerResumedL() );
+        if ( err != KErrNone )
+            {
+            TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ProcessResumed() - disabled all buffers, completed with err: %d", err ) );
+            }
+
+        iLogsPendingDestruction.ResetAndDestroy();
+        TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ProcessResumed() - deleted all pending destruction logs..." ) );
+
+        // Indicate file server is no longer suspended
+        iFileServerSuspended = EFalse;
+        }
+    
+    TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::ProcessResumed() - END - aId: %d, iFileServerSuspended: %d, isF32Process: %d"), (TUint) aId, iFileServerSuspended, isF32Process ) );
+    }
+
+
+TMemSpySinkType CMemSpyEngineOutputSinkFile::Type() const
+    {
+    return ESinkTypeFile;
+    }
+
+
+void CMemSpyEngineOutputSinkFile::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension )
+    {
+    DataStreamBeginL( aContext, aFolder, aExtension, ETrue );
+    }
+
+
+void CMemSpyEngineOutputSinkFile::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite )
+    {
+    DataStreamBeginL( aContext, aFolder, aExtension, aOverwrite, ETrue );
+    }
+
+
+void CMemSpyEngineOutputSinkFile::DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseTimeStamp )
+    {
+    CMemSpyEngineSinkMetaData* meta = CMemSpyEngineSinkMetaData::NewL( iRoot->Des(), aContext, aFolder, aExtension, aOverwrite, aUseTimeStamp );
+    CleanupStack::PushL( meta );
+
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamBeginL() - START - log count: %d, iFileServerSuspended: %d", iLogs.Count(), iFileServerSuspended ) );
+    //
+    CMemSpyEngineFileHolder* log = NULL;
+    if  ( iFileServerSuspended )
+        {
+        TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamBeginL() - F32 SUSPENDED!" ) );
+        log = CMemSpyEngineFileHolder::NewLogToRAML( *this, meta );
+        }
+    else
+        {
+        log = CMemSpyEngineFileHolder::NewL( *this, meta );
+        }
+    //
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamBeginL() - log: 0x%08x", log ) );
+    CleanupStack::Pop( meta );
+    CleanupStack::PushL( log );
+    iLogs.AppendL( log );
+    CleanupStack::Pop( log );
+    //
+    TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::DataStreamBeginL() - END - log count: %d, iFileServerSuspended: %d, fileName: [%S]"), iLogs.Count(), iFileServerSuspended, &log->FileName() ) );
+    }
+
+
+void CMemSpyEngineOutputSinkFile::DataStreamEndL()
+    {
+    const TInt count = iLogs.Count();
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamEndL() - count: %d", count ) );
+
+    __ASSERT_ALWAYS( count > 1, User::Invariant() );
+
+    CMemSpyEngineFileHolder* headLog = iLogs[ count - 1 ];
+    iLogs.Remove( count - 1 );
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamEndL() - headLog: 0x%08x", headLog ) );
+
+    if  ( headLog->UsingBuffer() )
+        {
+        TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamEndL() - headLog is using buffer so doing deferred delete when F32 is not suspended anymore..." ) );
+
+        // Must save the log until after its safe to resume 
+        // writing to disk.
+        CleanupStack::PushL( headLog );
+        iLogsPendingDestruction.AppendL( headLog );
+        CleanupStack::Pop( headLog );
+        }
+    else
+        {
+        TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamEndL() - deleting head log immediately!" ) );
+        delete headLog;
+        }
+
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DataStreamEndL() - END" ) );
+    }
+
+
+void CMemSpyEngineOutputSinkFile::DoOutputLineL( const TDesC& aLine )
+    {
+    HeadLog().WriteLineL( aLine );
+    }
+
+
+void CMemSpyEngineOutputSinkFile::DoOutputRawL( const TDesC8& aData )
+    {
+    HeadLog().WriteRawL( aData );
+    }
+
+
+TBool CMemSpyEngineOutputSinkFile::IsPrefixAllowed( const TDesC& /*aPrefix*/ )
+    {
+    // If we are outputting to the main log, then we must allow
+    // the prefix. If we are outputting to a child log, then we don't
+    // need it.
+    return HeadLog().IsMainLog();
+    }
+
+
+void CMemSpyEngineOutputSinkFile::ConstructDefaultLogFileL()
+    {
+    CMemSpyEngineFileHolder* log = CMemSpyEngineFileHolder::NewLC( *this );
+
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructDefaultLogFileL() - START - headLog: 0x%08x", log ) );
+    iLogs.AppendL( log );
+    CleanupStack::Pop( log );
+
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::ConstructDefaultLogFileL() - END - headLog: 0x%08x", log ) );
+    }
+
+
+void CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL()
+    {
+    const TInt count = iLogs.Count();
+    const TInt count2 = iLogsPendingDestruction.Count();
+
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() - START - logs: %d, pending: %d", count, count2 ) );
+
+    TInt err = KErrNone;
+
+    // Inform logging object that they should stop logging to RAM. This may cause files
+    // to be opened and data flushed.
+    for( TInt i=0; i<count; i++ )
+        {
+        CMemSpyEngineFileHolder* log = iLogs[ i ];
+        TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() -  logN[%2d]: 0x%08x, name: %S"), i, log, &log->FileName() ) );
+        TRAP(err, log->DisableBufferL() );
+        if  ( err != KErrNone )
+            {
+            TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() - error whilst closing log: %d", err ) );
+            }
+        }
+
+    // Finalise any pending destruction log objects. These are log objects
+    // that were created and finalised whilst the file server was suspended.
+    for( TInt ii = count2-1; ii>=0; ii--)
+        {
+        CMemSpyEngineFileHolder* log = iLogsPendingDestruction[ ii ];
+        TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() - logPD[%2d]: 0x%08x, name: %S"), ii, log, &log->FileName() ) );
+        TRAP(err, log->DisableBufferL() );
+        if  ( err != KErrNone )
+            {
+            TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() - error whilst closing log: %d", err ) );
+            }
+        }
+
+    TRACE( RDebug::Printf( "CMemSpyEngineOutputSinkFile::DisableAllBuffersAfterFileServerResumedL() - END" ) );
+    }
+
+
+CMemSpyEngineFileHolder& CMemSpyEngineOutputSinkFile::HeadLog() const
+    {
+    // Head log is always the first log
+    const TInt count = iLogs.Count();
+    __ASSERT_ALWAYS( count >= 1, User::Invariant() );
+    CMemSpyEngineFileHolder* headLog = iLogs[ count - 1 ];
+
+    //TRACE( RDebug::Print( _L("CMemSpyEngineOutputSinkFile::HeadLog() - headLog: 0x%08x %S"), headLog, &headLog->FileName() ) );
+    return *headLog;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineFileHolder::CMemSpyEngineFileHolder( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData )
+:   iParent( aParent ), iMetaData( aMetaData )
+    {
+    }
+
+
+CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder()
+    {
+    TPtrC pFileName( KNullDesC );
+    if  ( iFileName != NULL )
+        {
+        pFileName.Set( *iFileName );
+        }
+    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - START - this: 0x%08x, iFileName: %S, handle: 0x%08x, iEntireFileBuffer: 0x%08x, iIsMainLog: %d"), this, &pFileName, iFile.SubSessionHandle(), iEntireFileBuffer, iIsMainLog ) );
+
+    if  ( iEntireFileBuffer || iWorkingBuffer )
+        {
+        // This may actually open the file
+        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - disabling file buffers..." ) );
+        TRAP_IGNORE( DisableBufferL() );
+        }
+
+    // Now close the file, deleting anything that is empty
+    if  ( iFile.SubSessionHandle() != KNullHandle )
+        {
+        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - flushing file..." ) );
+
+        // Flush anything that is pending and then check whether 
+        // the file is empty. If so, delete it.
+        iFile.Flush(); // Ignore error
+       
+        // Delete empty files
+        TInt size = 0;
+        TInt err = iFile.Size( size );
+        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - size: %d, err: %d", size, err ) );
+
+        if  ( err == KErrNone && size == 0 )
+            {
+            // Close the file and get F32 to delete it...
+            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - deleting empty file!" ) );
+            iFile.Close();
+            err = FsSession().Delete( *iFileName );
+            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - delete err: %d", err ) );
+            }
+        }
+    //
+    iFile.Close();
+    //
+    delete iLineBuffer;
+    delete iWorkingBuffer;
+    delete iEntireFileBuffer;
+    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::~CMemSpyEngineFileHolder() - END - this: 0x%08x, iFileName: %S, iIsMainLog: %d"), this, &pFileName, iIsMainLog ) );
+    delete iFileName;
+    delete iMetaData;
+    }
+
+
+void CMemSpyEngineFileHolder::CommonConstructL()
+    {
+    if  ( iLineBuffer == NULL )
+        {
+        iLineBuffer = HBufC8::NewL( KMemSpyLineBufferLength );
+        }
+    if  ( iWorkingBuffer == NULL )
+        {
+        iWorkingBuffer = CBufFlat::NewL( KMemSpyFileServerBufferExpandSize );
+        }
+    }
+
+
+void CMemSpyEngineFileHolder::ConstructL()
+    {
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::ConstructL(D) - START" ) );
+    iIsMainLog = ETrue;
+
+    // Make emtpy meta data
+    ASSERT( !iMetaData );
+    iMetaData = CMemSpyEngineSinkMetaData::NewL( iParent.iRoot->Des(), KNullDesC, KNullDesC, KNullDesC, ETrue, ETrue );
+
+    // Prepare common details
+    CommonConstructL();
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::ConstructL(D) - CommonConstructL() completed okay..." ) );
+
+    // Construct the default log file.
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::ConstructL(D) - calling OpenFileL()..." ) );
+    OpenFileL();
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::ConstructL(D) - called OpenFileL()" ) );
+
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::ConstructL(D) - END - iIsMainLog: %d", iIsMainLog ) );
+    }
+
+
+
+CMemSpyEngineFileHolder* CMemSpyEngineFileHolder::NewLC( CMemSpyEngineOutputSinkFile& aParent )
+    {
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::NewLC() - START") );
+    CMemSpyEngineFileHolder* self = new(ELeave) CMemSpyEngineFileHolder( aParent, NULL );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+CMemSpyEngineFileHolder* CMemSpyEngineFileHolder::NewL( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData )
+    {
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::NewL() - START") );
+    CMemSpyEngineFileHolder* self = new(ELeave) CMemSpyEngineFileHolder( aParent, aMetaData );
+    CleanupStack::PushL( self );
+    self->CommonConstructL();
+    self->OpenFileL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CMemSpyEngineFileHolder* CMemSpyEngineFileHolder::NewLogToRAML( CMemSpyEngineOutputSinkFile& aParent, CMemSpyEngineSinkMetaData* aMetaData )
+    {
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::NewLogToRAML() - START") );
+    CMemSpyEngineFileHolder* self = new(ELeave) CMemSpyEngineFileHolder( aParent, aMetaData );
+    CleanupStack::PushL( self );
+    self->CommonConstructL();
+    self->EnableBufferL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+void CMemSpyEngineFileHolder::OpenFileL()
+    {
+    TInt err = KErrNone;
+
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - START - iMetaData: 0x%08x", iMetaData ) );
+    ASSERT( iMetaData );
+
+    delete iFileName;
+    iFileName = NULL;
+    if  ( iFile.SubSessionHandle() != KNullHandle )
+        {
+        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - closing existing file..." ) );
+        iFile.Flush();
+        iFile.Close();
+        }
+    
+    // First try, with current external drive
+    TRAP( err, PrepareFileL() );
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - PrepareFileL(1) - err: %d", err ) );
+    
+    if  ( err != KErrNone )
+        {
+        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - trying with forced C:\\ ..." ) );
+
+        // Try again with C:\ instead...
+        const TDriveNumber cDrive = EDriveC;
+        TRAP(err, PrepareFileL( &cDrive ) );
+        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - PrepareFileL(2) - err: %d", err ) );
+        }
+
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - final err: %d", err ) );
+    User::LeaveIfError( err );
+
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::OpenFileL() - END - OK - iIsMainLog: %d", iIsMainLog ) );
+    }
+
+
+void CMemSpyEngineFileHolder::PrepareFileL( const TDriveNumber* aForceDrive )
+    {
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - START - this: 0x%08x", this ) );
+    ASSERT( iMetaData );
+
+    iFileName = GenerateFileNameLC( aForceDrive );
+    CleanupStack::Pop( iFileName );
+
+    // Try to make log directory - ignore if already exists
+    TInt error = FsSession().MkDirAll( *iFileName );
+    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::PrepareFileL() - iFileName: %S, mkDir: %d, aOverwrite: %d"), iFileName, error, iMetaData->Overwrite() ) );
+
+    if  ( error == KErrNone || error == KErrAlreadyExists )
+        {
+        if  ( iMetaData->Overwrite() )
+            {
+            error = iFile.Replace( FsSession(), *iFileName, EFileWrite );
+            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - overwrite/replace error: %d", error ) );
+            }
+        else
+            {
+            error = iFile.Open( FsSession(), *iFileName, EFileWrite );
+            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - open error: %d", error ) );
+            
+            // Try creating it then...
+            if  ( error == KErrNotFound )
+                {
+                error = iFile.Create( FsSession(), *iFileName, EFileWrite );
+                TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - create error: %d", error ) );
+                }
+            }
+            
+        // Seek to end of file
+        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - final error: %d", error ) );
+        if  ( error == KErrNone )
+            {
+            TInt pos = 0;
+            error = iFile.Seek( ESeekEnd, pos );
+            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - seek error: %d", error ) );
+            }
+        }
+
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::PrepareFileL() - END - this: 0x%08x, error: %d", this, error ) );
+    User::LeaveIfError( error );
+    }
+
+
+void CMemSpyEngineFileHolder::WriteLineL( const TDesC& aData )
+    {
+    TPtr8 pText( iLineBuffer->Des() );
+    pText.Copy( aData );
+    pText.Append( KMemSpyCRLF );
+
+    if  ( iWorkingBuffer != NULL )
+        {
+        AddToWorkingBufferL( pText );
+        }
+    else if ( iFile.SubSessionHandle() != KNullHandle )
+        {
+        const TInt error = iFile.Write( pText );
+        if  ( error != KErrNone )
+            {
+            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::WriteLineL() - FILE WRITE ERROR - this: 0x%08x, error: %d", this, error ) );
+            }
+        User::LeaveIfError( error );
+        }
+    else
+        {
+        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::WriteLineL() - DISCARDING LINE!" ) );
+        }
+    }
+
+
+void CMemSpyEngineFileHolder::WriteRawL( const TDesC8& aData )
+    {
+    const TInt error = iFile.Write( aData );
+    User::LeaveIfError( error );
+    }
+
+
+void CMemSpyEngineFileHolder::EnableBufferL()
+    {
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::EnableBufferL() - START - this: 0x%08x", this ) );
+    if  ( iEntireFileBuffer == NULL )
+        {
+        iEntireFileBuffer = CBufFlat::NewL( KMemSpyFileServerBufferExpandSize );
+        }
+    //
+    iEntireFileBuffer->Reset();
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::EnableBufferL() - END - this: 0x%08x", this ) );
+    }
+
+
+void CMemSpyEngineFileHolder::DisableBufferL()
+    {
+#ifdef _DEBUG
+    TInt size = 0;
+    if  ( iFile.SubSessionHandle() != KNullHandle )
+        {
+        iFile.Size( size );
+        }
+    TInt ramBufferSize = 0;
+    if  ( iEntireFileBuffer )
+        {
+        ramBufferSize = iEntireFileBuffer->Size();
+        }
+    //
+    RDebug::Printf( "CMemSpyEngineFileHolder::DisableBufferL() - START - file handle: 0x%08x, iEntireFileBuffer: 0x%08x, fileSize: %d, ramBufferSize: %d", iFile.SubSessionHandle(), iEntireFileBuffer, size, ramBufferSize );
+#endif
+
+    // This will also open the file if necessary
+    FlushWorkingBufferL();
+    //
+    if  ( iEntireFileBuffer != NULL )
+        {
+        // Probably need to open the file...
+        if  ( iFile.SubSessionHandle() == KNullHandle )
+            {
+            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::DisableBufferL() - FILE IS NOT YET OPEN!" ) );
+            OpenFileL();
+            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::DisableBufferL() - file opened okay." ) );
+            }
+
+        TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::DisableBufferL() - about to write entire file buffer - file: %S"), &FileName() ) );
+        const TPtr8 pBuffer( iEntireFileBuffer->Ptr( 0 ) );
+        const TInt error = iFile.Write( pBuffer );
+        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::DisableBufferL() - write result: %d", error ) );
+        //
+        delete iEntireFileBuffer;
+        iEntireFileBuffer = NULL;
+        //
+        User::LeaveIfError( error );
+        }
+    
+    TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::DisableBufferL() - END" ) );
+    }
+
+
+void CMemSpyEngineFileHolder::FlushWorkingBufferL()
+    {
+    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::FlushWorkingBufferL() - START - fileName: [%S], file handle: 0x%08x, iWorkingBuffer: 0x%08x"), &FileName(), iFile.SubSessionHandle(), iWorkingBuffer ) );
+    __ASSERT_ALWAYS( iWorkingBuffer, MemSpyEngineUtils::Panic( EMemSpyEnginePanicSinkFileWorkingFileBufferIsNull ) );
+
+    // The underlying file may not be open - it could be that we are buffering everything
+    // to RAM (i.e. the file server is currently suspended).
+    const TPtr8 pBuffer( iWorkingBuffer->Ptr(0) );
+    //
+    if  ( iEntireFileBuffer )
+        {
+        __ASSERT_ALWAYS( iEntireFileBuffer, MemSpyEngineUtils::Panic( EMemSpyEnginePanicSinkFileEntireFileBufferNull ) );
+
+        TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::FlushWorkingBufferL() - file not open or we are currently bufferring to RAM - copying %d bytes to entire file buffer (%d)", pBuffer.Length(), iEntireFileBuffer->Size() ) );
+        iEntireFileBuffer->InsertL( iEntireFileBuffer->Size(), pBuffer );
+        }
+    else if ( iFile.SubSessionHandle() != KNullHandle )
+        {
+        const TInt error = iFile.Write( pBuffer );
+        if  ( error != KErrNone )
+            {
+            TRACE( RDebug::Printf( "CMemSpyEngineFileHolder::FlushWorkingBufferL() - write result: %d", error ) );
+            }
+        User::LeaveIfError( error );
+        }
+
+    iWorkingBuffer->Reset();
+    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::FlushWorkingBufferL() - END - fileName: %S"), &FileName() ) );
+    }
+
+
+void CMemSpyEngineFileHolder::AddToWorkingBufferL( const TDesC8& aText )
+    {
+    if  ( iWorkingBuffer->Size() + aText.Length() > KMemSpyFileServerBufferExpandSize )
+        {
+        FlushWorkingBufferL();
+        }
+    //
+    iWorkingBuffer->InsertL( iWorkingBuffer->Size(), aText );
+    }
+
+
+HBufC* CMemSpyEngineFileHolder::CleanContextInfoLC( const TDesC& aContext )
+    {
+    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::CleanContextInfoLC() - START - %S"), &aContext ) );
+    TFileName fileName;
+
+    TBool seenDoubleColon = EFalse;
+    const TInt length = aContext.Length();
+    for( TInt i=0; i<length; i++ )
+        {
+        const TChar c( aContext[ i ] );
+        const TBool haveNextChar = ( i+1 < length );
+        //
+        //TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::CleanContextInfoLC() - c[%03d]: \'%c\', haveNextChar: %d, seenDoubleColon: %d"), i, (TUint32) c, haveNextChar, seenDoubleColon ) );
+        //
+        if  ( c == ':' && haveNextChar && aContext[ i + 1 ] == ':' )
+            {
+            // Skip double colon
+            i++;
+            fileName.Append( '-' );
+            seenDoubleColon = ETrue;
+            }
+        else if ( c == '.' )
+            {
+            if  ( seenDoubleColon )
+                {
+                break;
+                }
+            else
+                {
+                fileName.Append( '-' );
+                }
+            }
+        else
+            {
+            fileName.Append( c );
+            }
+        }
+
+    TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::CleanContextInfoLC() - END - %S"), &fileName ) );
+    return fileName.AllocLC();
+    }
+
+
+HBufC* CMemSpyEngineFileHolder::GenerateFileNameLC( const TDriveNumber* aForceDrive )
+    {
+    TFileName name;
+    MemSpyEngineUtils::GetFolderL( FsSession(), name, *iMetaData, aForceDrive );
+    return name.AllocLC();
+    }
+
+
+RFs& CMemSpyEngineFileHolder::FsSession()
+    {
+    return iParent.iFsSession;
+    }
+
+
+const TDesC& CMemSpyEngineFileHolder::FileName() const 
+    {
+    if  ( iFileName )
+        {
+        return *iFileName;
+        }
+    //
+    return KNullDesC;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTracker.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,179 @@
+/*
+* 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 <memspy/engine/memspyenginehelpersysmemtracker.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerobserver.h>
+#include "MemSpyEngineHelperSysMemTrackerOutputFormatter.h"
+
+
+CMemSpyEngineHelperSysMemTracker::CMemSpyEngineHelperSysMemTracker()
+    {
+    }
+
+    
+CMemSpyEngineHelperSysMemTracker::~CMemSpyEngineHelperSysMemTracker()
+    {
+    delete iOutputFormatter;
+    delete iImp;
+    }
+
+
+void CMemSpyEngineHelperSysMemTracker::ConstructL( CMemSpyEngine& aEngine )
+    {
+    iOutputFormatter = CMemSpyEngineHelperSysMemTrackerOutputFormatter::NewL( aEngine );
+    //
+    iImp = CMemSpyEngineHelperSysMemTrackerImp::NewL( aEngine );
+    iImp->SetObserver( this );
+    }
+
+
+CMemSpyEngineHelperSysMemTracker* CMemSpyEngineHelperSysMemTracker::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperSysMemTracker* self = new(ELeave) CMemSpyEngineHelperSysMemTracker();
+    CleanupStack::PushL( self );
+    self->ConstructL( aEngine );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C TBool CMemSpyEngineHelperSysMemTracker::IsActive() const
+    {
+    return iImp->IsActive();
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperSysMemTracker::StartL()
+    {
+    const TMemSpyEngineHelperSysMemTrackerConfig& config = iOutputFormatter->Config();
+    iImp->StartL( config );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperSysMemTracker::StartL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
+    {
+    SetConfigL( aConfig );
+    StartL();
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperSysMemTracker::StopL()
+    {
+    iImp->StopL();
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperSysMemTracker::SetConfigL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
+    {
+    TMemSpyEngineHelperSysMemTrackerConfig config( aConfig );
+
+    // Cap the value to ensure it doesn't fall beneath minimum value.
+    const TInt timeInSeconds = config.TimerPeriod().Int() / 1000000;
+    if  ( timeInSeconds < KMemSpySysMemTrackerConfigMinTimerPeriod )
+        {
+        config.iTimerPeriod = KMemSpySysMemTrackerConfigMinTimerPeriod * 1000000;
+        }
+    iOutputFormatter->SetConfig( config );
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperSysMemTracker::GetConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
+    {
+    aConfig = iOutputFormatter->Config();
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperSysMemTracker::SetObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver )
+    {
+    iRealObserver = aObserver;
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperSysMemTracker::RemoveObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver )
+    {
+    if ( iRealObserver == aObserver )
+        {
+        iRealObserver = NULL;
+        }
+    }
+
+
+EXPORT_C const RPointerArray< CMemSpyEngineHelperSysMemTrackerCycle >& CMemSpyEngineHelperSysMemTracker::CompletedCycles() const
+    {
+    return iImp->CompletedCycles();
+    }
+
+
+void CMemSpyEngineHelperSysMemTracker::Reset()
+    {
+    iImp->Reset();
+    }
+
+
+EXPORT_C void CMemSpyEngineHelperSysMemTracker::CheckForChangesNowL()
+    {
+    iImp->CheckForChangesNowL();
+    }
+
+
+EXPORT_C TInt CMemSpyEngineHelperSysMemTracker::MdcaCount() const
+    {
+    return iImp->MdcaCount();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineHelperSysMemTracker::MdcaPoint( TInt aIndex ) const
+    {
+    return iImp->MdcaPoint( aIndex );
+    }
+
+
+void CMemSpyEngineHelperSysMemTracker::HandleCyclesResetL()
+    {
+    if  ( iRealObserver )
+        {
+        TRAP_IGNORE( iRealObserver->HandleCyclesResetL() );
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTracker::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    if  ( iRealObserver )
+        {
+        TRAP_IGNORE( iRealObserver->HandleCycleStartedL( aCycle ) );
+        }
+    }
+
+void CMemSpyEngineHelperSysMemTracker::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    iOutputFormatter->OutputL( aCycle );
+    //
+    if  ( iRealObserver )
+        {
+        TRAP_IGNORE( iRealObserver->HandleCycleFinishedL( aCycle ) );
+        }
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycle.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,382 @@
+/*
+* 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 <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+
+// System includes
+#include <e32debug.h>
+#include <hal.h>
+#include <hal_data.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
+    
+// Literal constants
+_LIT( KMemSpySWMTDataFolderSpecification, "Data" );
+_LIT( KMemSpySWMTFolderSpecification, "System Wide MT\\Cycle %04d" );
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycle::CMemSpyEngineHelperSysMemTrackerCycle( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig, const CMemSpyEngineHelperSysMemTrackerCycle* aPreviousCycle )
+:   iConfig( aConfig ), iPreviousCycle( aPreviousCycle ), iCycleNumber( 1 )
+    {
+    iTime.HomeTime();
+    if  ( aPreviousCycle )
+        {
+        iCycleNumber = aPreviousCycle->CycleNumber() + 1;
+        }
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycle::~CMemSpyEngineHelperSysMemTrackerCycle()
+    {
+    delete iFixedItems;
+    delete iCaption;
+    delete iTimeFormatted;
+    //
+    DiscardChanges();
+    iChangeDescriptors.Close();
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::ConstructL()
+    {
+    iFixedItems = CMemSpyEngineOutputList::NewL();
+
+    // Get time stamp
+    TBuf<128> timeBuf;
+    MemSpyEngineUtils::FormatTimeSimple( timeBuf, iTime );
+    iTimeFormatted = timeBuf.AllocL();
+    
+    // Get free ram
+    TInt freeRam = KErrNotFound;
+    User::LeaveIfError( HAL::Get( HALData::EMemoryRAMFree, freeRam ) );
+    iMemoryFree = freeRam;
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycle* CMemSpyEngineHelperSysMemTrackerCycle::NewLC( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig, const CMemSpyEngineHelperSysMemTrackerCycle* aPreviousCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycle* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycle( aConfig, aPreviousCycle );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineHelperSysMemTrackerCycle::CycleNumber() const
+    {
+    return iCycleNumber;
+    }
+
+
+EXPORT_C const TTime& CMemSpyEngineHelperSysMemTrackerCycle::Time() const
+    {
+    return iTime;
+    }
+
+
+EXPORT_C const TDesC& CMemSpyEngineHelperSysMemTrackerCycle::TimeFormatted() const
+    {
+    return *iTimeFormatted;
+    }
+
+
+EXPORT_C const TDesC& CMemSpyEngineHelperSysMemTrackerCycle::Caption() const
+    {
+    return *iCaption;
+    }
+
+
+EXPORT_C const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryFree() const
+    {
+    return iMemoryFree;
+    }
+
+
+EXPORT_C TInt64 CMemSpyEngineHelperSysMemTrackerCycle::MemoryFreePreviousCycle() const
+    {
+    TInt64 ret = MemoryFree();
+    //
+    if  ( iPreviousCycle )
+        {
+        ret = iPreviousCycle->MemoryFree();
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C TInt64 CMemSpyEngineHelperSysMemTrackerCycle::MemoryDelta() const
+    {
+    const TInt64 ret = ( iMemoryFree - iMemoryUsed );
+    return ret;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineHelperSysMemTrackerCycle::ChangeCount() const
+    {
+    return iChangeCount;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineHelperSysMemTrackerCycle::MdcaCount() const
+    {
+    return iFixedItems->Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineHelperSysMemTrackerCycle::MdcaPoint( TInt aIndex ) const
+    {
+    return iFixedItems->MdcaPoint( aIndex );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::FinalizeL()
+    {
+    _LIT( KChange, "change" );
+    _LIT( KChanges, "changes" );
+
+    // Save change count
+    iChangeCount = iChangeDescriptors.Count();
+
+    // First make the main caption
+    TMemSpySizeText sizeText;
+    TMemSpySizeText deltaText;
+    TPtrC pChangeText( KChange );
+   
+    // Get free RAM formatted as a descriptor
+    sizeText = MemSpyEngineUtils::FormatSizeTextPrecise( MemoryFree() );
+
+    // Get delta formatted as a descriptor
+    const TInt64 delta( MemoryDelta() );
+    deltaText = MemSpyEngineUtils::FormatSizeTextPrecise( delta );
+
+    // Get number of changed threads as a descriptor
+    if  ( ChangeCount() == 0 || ChangeCount() > 1 )
+        {
+        pChangeText.Set( KChanges );
+        }
+
+    // Now make the caption
+    if  ( MemoryDelta() != 0 )
+        {
+        TBuf<300> buf;
+        _LIT( KMainCaption1, "\t[%03d] F: %S\t\tD: %S, %d %S" );
+        buf.Format( KMainCaption1, CycleNumber(), &sizeText, &deltaText, ChangeCount(), &pChangeText );
+        HBufC* caption = buf.AllocL();
+        delete iCaption;
+        iCaption = caption;
+        }
+    else
+        {
+        TBuf<300> buf;
+        _LIT( KMainCaption2, "\t[%03d] F: %S\t\tNo Delta, %d %S" );
+        buf.Format( KMainCaption2, CycleNumber(), &sizeText, ChangeCount(), &pChangeText );
+        HBufC* caption = buf.AllocL();
+        delete iCaption;
+        iCaption = caption;
+        }
+
+    // Now make the child entries
+    if  ( CycleNumber() > 0 )
+        {
+        _LIT(KItem1a, "Cycle");
+        iFixedItems->AddItemL( KItem1a, CycleNumber() );
+        }
+    else
+        {
+        _LIT(KItem1a, "Baseline");
+        iFixedItems->AddItemL( KItem1a );
+        }
+    //
+    _LIT(KItem1c, "Time");
+    iFixedItems->AddItemL( KItem1c, iTimeFormatted );
+    //
+    _LIT(KItem2, "Memory Free");
+    iFixedItems->AddItemL( KItem2, sizeText );
+    //
+    if  ( CycleNumber() > 0 )
+        {
+        _LIT(KItem2b, "Memory Change (vs. Last Cycle)");
+        sizeText = MemSpyEngineUtils::FormatSizeTextPrecise( MemoryFree() - MemoryFreePreviousCycle() );
+        iFixedItems->AddItemL( KItem2b, sizeText );
+        //
+        _LIT(KItem3, "Number of Changes");
+        iFixedItems->AddItemL( KItem3, ChangeCount() );
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::DiscardChanges()
+    {
+    iChangeDescriptors.ResetAndDestroy();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChange& CMemSpyEngineHelperSysMemTrackerCycle::ChangeAt( TInt aIndex )
+    {
+    return *iChangeDescriptors[ aIndex ];
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::GetDataFolderL( RFs& aFsSession, TDes& aFolder )
+    {
+    TFileName fileName;
+    fileName.Format( KMemSpySWMTFolderSpecification, CycleNumber() );
+
+    CMemSpyEngineSinkMetaData* metaData = CMemSpyEngineSinkMetaData::NewL( KNullDesC, fileName, KNullDesC, ETrue, EFalse, Time() );
+    CleanupStack::PushL( metaData );
+    MemSpyEngineUtils::GetFolderL( aFsSession, aFolder, *metaData );
+    CleanupStack::PopAndDestroy( metaData );
+
+    // This get's us something like:
+    //
+    //    E:\MemSpy\System Wide MT\Data - Cycle 001\Log.txt
+    //
+    // Now we must strip off the filename and return just the folder specification
+    const TParsePtrC parser( aFolder );
+    if  ( parser.NamePresent() && parser.ExtPresent() )
+        {
+        const TPtrC nameAndExt( parser.NameAndExt() );
+        aFolder.SetLength( aFolder.Length() - nameAndExt.Length() );
+        }
+
+    // Add "Data" on to the end so that we put all data in a clearly marked subdir)
+    aFolder.Append( KMemSpySWMTDataFolderSpecification );
+    TRACE( RDebug::Print(_L("CMemSpyEngineHelperSysMemTrackerCycle::GetDataFolderL() - folder1: %S"), &aFolder ) );
+
+    // Now we should return something like:
+    //
+    //    E:\MemSpy\System Wide MT\Data - Cycle 001
+    TRACE( RDebug::Print(_L("CMemSpyEngineHelperSysMemTrackerCycle::GetDataFolderL() - folder2: %S"), &aFolder ) );
+
+    const TInt err = aFsSession.MkDirAll( aFolder );
+    if  ( !(err == KErrNone || err == KErrAlreadyExists ) )
+        {
+        User::LeaveIfError( err );
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::DataStreamBeginL( CMemSpyEngineOutputSink& aSink, const TDesC& aContext )
+    {
+    // First make the folder...
+    HBufC* folder = HBufC::NewLC( KMemSpySWMTFolderSpecification().Length() + 10 );
+    TPtr pFolder( folder->Des() );
+    pFolder.Format( KMemSpySWMTFolderSpecification, CycleNumber() );
+
+    // Now start the data stream
+    aSink.DataStreamBeginL( aContext, pFolder, KMemSpyLogDefaultExtension, ETrue, EFalse );
+    CleanupStack::PopAndDestroy( folder );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::DataStreamEndL( CMemSpyEngineOutputSink& aSink )
+    {
+	aSink.DataStreamEndL();
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::AddAndPopL( CMemSpyEngineHelperSysMemTrackerCycleChange* aInfo )
+    {
+    iChangeDescriptors.AppendL( aInfo );
+    CleanupStack::Pop( aInfo );
+    }
+
+
+const TMemSpyEngineHelperSysMemTrackerConfig& CMemSpyEngineHelperSysMemTrackerCycle::Config() const
+    {
+    return iConfig; 
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::AddToMemoryUsed( TInt aValue )
+    {
+    iMemoryUsed += aValue;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::AddToMemoryHeapAllocs( TInt aValue )
+    {
+    iMemoryHeapAllocs += aValue;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::AddToMemoryHeapFrees( TInt aValue )
+    {
+    iMemoryHeapFrees += aValue;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::AddToCellCountFree( TInt aValue )
+    {
+    iCellCountsFrees += aValue;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycle::AddToCellCountAlloc( TInt aValue )
+    {
+    iCellCountsAllocs += aValue;
+    }
+
+
+const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryUsed() const
+    {
+    return iMemoryUsed;
+    }
+
+
+const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryHeapAllocs() const
+    {
+    return iMemoryHeapAllocs;
+    }
+
+
+const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryHeapFrees() const
+    {
+    return iMemoryHeapFrees;
+    }
+
+
+const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryHeapCellCountAlloc() const
+    {
+    return iCellCountsAllocs;
+    }
+
+
+const TInt64& CMemSpyEngineHelperSysMemTrackerCycle::MemoryHeapCellCountFree() const
+    {
+    return iCellCountsFrees;
+    }
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycleChange.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* 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 <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
+
+// System includes
+#include <e32debug.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyenginemidwife.h>
+#include <memspy/engine/memspyengineundertaker.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChange::CMemSpyEngineHelperSysMemTrackerCycleChange( TUint8 aAttribs )
+:   iAttributes( aAttribs )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChange::~CMemSpyEngineHelperSysMemTrackerCycleChange()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChange::BaseConstructL()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChange::FormatType( TMemSpySWMTTypeName& aBuffer ) const
+    {
+    _LIT( KTypeUnknown,                 "{????}" );
+    _LIT( KTypeHeap,                    "{HEAP}" );
+    _LIT( KTypeChunk,                   "{CHNK}" );
+    _LIT( KTypeCode,                    "{CODE}" );
+    _LIT( KTypeStack,                   "{STAK}" );
+    _LIT( KTypeGlobalData,              "{GLOD}" );
+    _LIT( KTypeRamDrive,                "{RAMD}" );
+    _LIT( KTypeOpenFile,                "{FILE}" );
+    _LIT( KTypeDiskSpace,               "{DISK}" );
+    _LIT( KTypeBitmap,                  "{BITM}" );
+    _LIT( KTypeHandleGeneric,           "{HGEN}" );
+    _LIT( KTypeHandlePAndS,             "{HPAS}" );
+    _LIT( KTypeFbserv,                  "{FABS}" );
+    _LIT( KTypeFileServerCache,         "{F32C}" );
+    _LIT( KTypeSystemMemory,            "{SYSM}" );
+    _LIT( KTypeWindowGroup,             "{WNDG}" );
+    //
+    switch( Type() )
+        {
+        case EMemSpyEngineSysMemTrackerTypeHeapUser:
+        case EMemSpyEngineSysMemTrackerTypeHeapKernel:
+            aBuffer.Append( KTypeHeap );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeChunk:
+            aBuffer.Append( KTypeChunk );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeCode:
+            aBuffer.Append( KTypeCode );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeHandleGeneric:
+            aBuffer.Append( KTypeHandleGeneric );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeHandlePAndS:
+            aBuffer.Append( KTypeHandlePAndS );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeStack:
+            aBuffer.Append( KTypeStack );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeGlobalData:
+            aBuffer.Append( KTypeGlobalData );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeRamDrive:
+            aBuffer.Append( KTypeRamDrive );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeOpenFile:
+            aBuffer.Append( KTypeOpenFile );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeDiskSpace:
+            aBuffer.Append( KTypeDiskSpace );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeBitmap:
+            aBuffer.Append( KTypeBitmap );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeFbserv:
+            aBuffer.Append( KTypeFbserv );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeFileServerCache:
+            aBuffer.Append( KTypeFileServerCache );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeSystemMemory:
+            aBuffer.Append( KTypeSystemMemory );
+            break;
+        case EMemSpyEngineSysMemTrackerTypeWindowServer:
+            aBuffer.Append( KTypeWindowGroup );
+            break;            
+        default:
+            aBuffer.Append( KTypeUnknown );
+            break;
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChange::FormatAttributes( TDes& aBuffer ) const
+    {
+    _LIT( KAttribNew,   "[N]" );
+    _LIT( KAttribDead,  "[D]" );
+    _LIT( KAttribAlive, "[A]" );
+    _LIT( KAttribPlus,  "+" );
+    //
+    aBuffer.Zero();
+    // 
+    if  ( iAttributes & EMemSpyEngineSysMemTrackerEntryAttributeIsNew )
+        {
+        aBuffer.Append( KAttribNew );
+        }
+    //
+    const TBool isDead = !( iAttributes & EMemSpyEngineSysMemTrackerEntryAttributeIsAlive );
+    if  ( isDead )
+        {
+        if  ( aBuffer.Length() )
+            {
+            aBuffer.Append( KAttribPlus );
+            }
+
+        aBuffer.Append( KAttribDead );
+        }
+    else
+        {
+        if  ( aBuffer.Length() )
+            {
+            aBuffer.Append( KAttribPlus );
+            }
+
+        aBuffer.Append( KAttribAlive );
+        }
+    }
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntries.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntries.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntry::CMemSpyEngineHelperSysMemTrackerEntry( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyEngineSysMemTrackerType aType )
+:   iTracker( aTracker ), iType( aType )
+    {
+    // Entry starts out alive - this also updates it's timestamp
+    SetAlive();
+
+    // Entry starts out new by default
+    SetNew( ETrue );
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntry::Key() const
+    {
+    const TUint32 val = ( Type() << 28 ); 
+    TUint64 ret = val;
+    ret <<= 32;
+    ret += Handle();
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntry::HandleNewCycleL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    __ASSERT_ALWAYS( !( IsNew() && IsDead() ), User::Panic(_L("MemSpySysMemT"), __LINE__ ) );
+
+    // First of all, if the item is not dead, then we can update the cycle stats
+    if  ( IsAlive() )
+        {
+        UpdateCycleStatistics( aCycle );
+        }
+
+    // We create change descriptors only if the item has changed state in some way.
+    // I.e.:
+    //
+    // 1) If the entry is new or is dead, then we will require a change descriptor.
+    // 2) If the entry has changed, we'll require a change descriptor.
+    //
+    // Case (1)
+    if  ( IsNew() || IsDead() )
+        {
+        CreateChangeDescriptorL( aCycle );
+        }
+    else
+        {
+        // Case (2) 
+        const TBool hasChanged = HasChangedL( aCycle.Config() );
+        if  ( hasChanged )
+            {
+            CreateChangeDescriptorL( aCycle );
+            }
+        }
+    }
+
+
+CMemSpyEngine& CMemSpyEngineHelperSysMemTrackerEntry::Engine()
+    {
+    return iTracker.Engine();
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntry::UpdateTime()
+    {
+    iLastUpdateTime.HomeTime();
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntry::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& /*aEntry*/ )
+    {
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntry::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
+    {
+    // This item does not internally change state once created
+    return EFalse;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntry::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntry::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    }
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryBitmap.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,227 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryBitmap.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperfbserv.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperfilesystem.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+CMemSpyEngineHelperSysMemTrackerEntryBitmap::CMemSpyEngineHelperSysMemTrackerEntryBitmap( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeOpenFile )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryBitmap::~CMemSpyEngineHelperSysMemTrackerEntryBitmap()
+    {
+    delete iInfo;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryBitmap::ConstructL( TInt aHandle )
+    {
+    iInfo = new(ELeave) TMemSpyEngineFBServBitmapInfo();
+    CMemSpyEngineHelperFbServ::GetBitmapInfoL( aHandle, *iInfo );
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryBitmap* CMemSpyEngineHelperSysMemTrackerEntryBitmap::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TInt aHandle )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryBitmap* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryBitmap( aTracker );
+    CleanupStack::PushL( self );
+    self->ConstructL( aHandle );
+    return self;
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntryBitmap::Key() const
+    {
+    return TUint64( iInfo->iHandle );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryBitmap::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::NewLC( Attributes(), *iInfo );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryBitmap::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    // Doesn't participate in direct memory usage and indirect usage cannot really be measured.
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap( TUint8 aAttribs )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::~CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap()
+    {
+    delete iInfo;
+    delete iBitmap;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::ConstructL( const TMemSpyEngineFBServBitmapInfo& aInfo )
+    {
+    BaseConstructL();
+
+    iInfo = new(ELeave) TMemSpyEngineFBServBitmapInfo();
+    *iInfo = aInfo;
+
+    iBitmap = new(ELeave) CFbsBitmap();
+    const TInt err = iBitmap->Duplicate( aInfo.iHandle );
+    if ( err != KErrNone )
+        {
+        RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::ConstructL() - aInfo.iHandle: 0x%08x, dupe Err: %d", aInfo.iHandle, err );
+        delete iBitmap;
+        iBitmap = NULL;
+        }
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap* CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::NewLC( TUint8 aAttribs, const TMemSpyEngineFBServBitmapInfo& aInfo )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap( aAttribs );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInfo );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeBitmap;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderLine, "Type, Handle, Dimensions [W x H], BPP, Disp. Mode, Color, Comp. Type, Size (Bytes), In Rom, Is Large, Is Mono, Is Compressed in Ram, Attribs");
+    aSink.OutputLineL( KHeaderLine );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,0x%08x,[%05d x %05d],%d,%d,%d,%d,%d,%d,%d,%d,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+
+    // Now output line
+    aSink.OutputLineFormattedL( KFormat,
+                                &type,
+                                iInfo->iHandle,
+                                iInfo->iSizeInPixels.iWidth,
+                                iInfo->iSizeInPixels.iHeight,
+                                iInfo->iBitsPerPixel,
+                                iInfo->iDisplayMode,
+                                iInfo->iColor,
+                                iInfo->iCompressionType,
+                                iInfo->iSizeInBytes,
+                                ( iInfo->iFlags & TMemSpyEngineFBServBitmapInfo::EFlagsIsRomBitmap ) ? 1 : 0,
+                                ( iInfo->iFlags & TMemSpyEngineFBServBitmapInfo::EFlagsIsMonochrome ) ? 1 : 0,
+                                ( iInfo->iFlags & TMemSpyEngineFBServBitmapInfo::EFlagsIsLarge ) ? 1 : 0,
+                                ( iInfo->iFlags & TMemSpyEngineFBServBitmapInfo::EFlagsIsCompressedInRam ) ? 1 : 0,
+                                &attribs
+                                );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    TRACE( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputDataL() - iInfo.iHandle: 0x%08x, iBitmap: 0x%08x, size: %03d x %03d", iInfo->iHandle, iBitmap, iInfo->iSizeInPixels.iWidth, iInfo->iSizeInPixels.iHeight ) );
+    if  ( iBitmap && iInfo->iSizeInPixels.iWidth > 0 && iInfo->iSizeInPixels.iHeight > 0 )
+        {
+        // Get folder
+        HBufC* fileName = HBufC::NewLC( KMaxFileName );
+        TPtr pFileName( fileName->Des() );
+        aCycle.GetDataFolderL( aSink.Engine().FsSession(), pFileName );
+        TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputDataL() - fileName1: [%S]"), fileName ) );
+
+        // Get file name
+        CMemSpyEngineFbServBitmap::GetExportableFileNameL( *iInfo, pFileName );
+        TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputDataL() - fileName2: [%S]"), fileName ) );
+
+        // Remove .bmp extension, since we're actually saving mbms
+        const TParsePtrC parser( pFileName );
+        if ( parser.ExtPresent() )
+            {
+            const TInt extLength = parser.Ext().Length();
+            const TInt totalLength = pFileName.Length();
+            pFileName.SetLength( totalLength - extLength );
+            }
+
+        // Add .MBM
+        _LIT( KEpocBitmapExtension, ".mbm" );
+        pFileName.Append( KEpocBitmapExtension );
+
+        const TInt err = iBitmap->Save( pFileName );
+        if  ( err != KErrNone )
+            {
+            RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerCycleChangeBitmap::OutputDataL() - err: %d, fileName: [%S]"), err, fileName ); 
+            }
+
+        // Clean up
+        CleanupStack::PopAndDestroy( fileName );
+        delete iBitmap;
+        iBitmap = NULL;
+        }
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryChunk.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,259 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryChunk.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntryChunk::CMemSpyEngineHelperSysMemTrackerEntryChunk( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeChunk )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryChunk::~CMemSpyEngineHelperSysMemTrackerEntryChunk()
+    {
+    delete iChunkName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryChunk::ConstructL( const TMemSpyDriverChunkInfo& aInfo, const TDesC& aFullChunkName )
+    {
+    iCurrent = aInfo;
+    iLast = aInfo;
+    //
+    iChunkName = aFullChunkName.AllocL();
+    SetHandle( aInfo.iHandle );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryChunk::ConstructL( const TMemSpyDriverChunkInfo& aInfo, CMemSpyProcess& aProcess )
+    {
+    ConstructL( aInfo, aInfo.iName );
+    //
+    SetProcess( aProcess.Id() );
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryChunk* CMemSpyEngineHelperSysMemTrackerEntryChunk::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryChunk* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryChunk( aTracker );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInfo, aInfo.iName );
+    return self;
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryChunk* CMemSpyEngineHelperSysMemTrackerEntryChunk::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo, CMemSpyProcess& aProcess )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryChunk* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryChunk( aTracker );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInfo, aProcess );
+    return self;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryChunk::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
+    {
+    const CMemSpyEngineHelperSysMemTrackerEntryChunk& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryChunk& >( aEntry );
+    
+    // Update state
+    iLast = iCurrent;
+    iCurrent = entry.iCurrent;
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntryChunk::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
+    {
+    const TBool hasChanged = ( iCurrent.iSize != iLast.iSize );
+    return hasChanged;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryChunk::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeChunk* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::NewLC( Attributes(), *iChunkName, iCurrent, IsNew() ? NULL : &iLast );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryChunk::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    aCycle.AddToMemoryUsed( iCurrent.iSize );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::CMemSpyEngineHelperSysMemTrackerCycleChangeChunk( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::~CMemSpyEngineHelperSysMemTrackerCycleChangeChunk()
+    {
+    delete iLast;
+    delete iChunkName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::ConstructL( const TDesC& aChunkName, const TMemSpyDriverChunkInfo* aLast )
+    {
+    BaseConstructL();
+
+    // Save the thread name
+    iChunkName = aChunkName.AllocL();
+
+    // Save last heap data (if available)
+    if ( aLast )
+        {
+        iLast = new (ELeave) TMemSpyDriverChunkInfo();
+        *iLast = *aLast;
+        }
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeChunk* CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::NewLC( TUint8 aAttribs, const TDesC& aChunkName, const TMemSpyDriverChunkInfo& aCurrent, const TMemSpyDriverChunkInfo* aLast )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeChunk* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeChunk( aAttribs, aCurrent );
+    CleanupStack::PushL( self );
+    self->ConstructL( aChunkName, aLast );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeChunk;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderChunk, "Type, Process, Chunk, Handle, Base Addr, Size, Max Size, Attribs");
+    aSink.OutputLineL( KHeaderChunk );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,%S,0x%08x,0x%08x,%d,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+
+    // Try to get associated process name
+    TFullName processName( KNullDesC );
+    CMemSpyEngine& engine = aSink.Engine();
+    const TInt procIndex = engine.Container().ProcessIndexById( iCurrent.iOwnerId );
+    if  ( procIndex >= 0 )
+        {
+        CMemSpyProcess& process = engine.Container().At( procIndex );
+        process.FullName( processName );
+        }
+
+    // Now output line
+    pBuf.Format( KFormat, 
+                 &type,
+                 &processName, 
+                 iChunkName,
+                 iCurrent.iHandle,
+                 iCurrent.iBaseAddress,
+                 iCurrent.iSize,
+                 iCurrent.iMaxSize,
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeChunk::OutputDataL( CMemSpyEngineOutputSink& /*aSink*/, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryCode.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,174 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryCode.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntryCode::CMemSpyEngineHelperSysMemTrackerEntryCode( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeCode )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryCode::~CMemSpyEngineHelperSysMemTrackerEntryCode()
+    {
+    delete iCodeSegName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryCode::ConstructL( const CMemSpyEngineCodeSegEntry& aInfo )
+    {
+    SetHandle( aInfo.Handle() );
+    iSize = Engine().Driver().RoundToPageSize( aInfo.Size() );
+    iCodeSegName = HBufC::NewL( aInfo.CreateInfo().iFileName.Length() );
+    iCodeSegName->Des().Copy( aInfo.CreateInfo().iFileName );
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryCode* CMemSpyEngineHelperSysMemTrackerEntryCode::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const CMemSpyEngineCodeSegEntry& aInfo )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryCode* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryCode( aTracker );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInfo );
+    return self;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryCode::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeCode* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeCode::NewLC( Attributes(), *iCodeSegName, iSize, Handle() );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryCode::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    aCycle.AddToMemoryUsed( iSize );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeCode::CMemSpyEngineHelperSysMemTrackerCycleChangeCode( TUint8 aAttribs, TUint32 aSize, TUint32 aHandle )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iSize( aSize ), iHandle( aHandle )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeCode::~CMemSpyEngineHelperSysMemTrackerCycleChangeCode()
+    {
+    delete iCodeSegName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeCode::ConstructL( const TDesC& aCodeSegName )
+    {
+    BaseConstructL();
+
+    // Save the thread name
+    iCodeSegName = aCodeSegName.AllocL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeCode* CMemSpyEngineHelperSysMemTrackerCycleChangeCode::NewLC( TUint8 aAttribs, const TDesC& aCodeSegName, TUint32 aSize, TUint32 aHandle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeCode* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeCode( aAttribs, aSize, aHandle );
+    CleanupStack::PushL( self );
+    self->ConstructL( aCodeSegName );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeCode::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeCode;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeCode::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderCode, "Type, Name, Handle, Size, Attribs");
+    aSink.OutputLineL( KHeaderCode );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeCode::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,0x%08x,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+
+    // Now output line
+    pBuf.Format( KFormat, 
+                 &type,
+                 iCodeSegName, 
+                 iHandle,
+                 iSize,
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryDiskSpace.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,219 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryDiskSpace.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::CMemSpyEngineHelperSysMemTrackerEntryDiskSpace( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TDriveNumber aDrive )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeDiskSpace ), iDrive( aDrive )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::~CMemSpyEngineHelperSysMemTrackerEntryDiskSpace()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::ConstructL()
+    {
+    UpdateVolumeInfoL( iCurrent );
+    iLast = iCurrent;
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryDiskSpace* CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TDriveNumber aDrive )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryDiskSpace* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryDiskSpace( aTracker, aDrive );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::Key() const
+    {
+    const TUint32 val = ( Type() << 28 );
+    TUint64 ret = val;
+    ret <<= 32;
+    ret += iDrive;
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::NewLC( Attributes(), iDrive, iCurrent, IsNew() ? NULL : &iLast );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
+    {
+    const TBool hasChanged = ( iCurrent.iFree != iLast.iFree ) || ( iCurrent.iSize != iLast.iSize );
+    TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::HasChangedL() - drive: %C:\\, iCurrent.iSize: %Ld, iLast.iSize: %Ld, iCurrent.iFree: %Ld, iLast.iFree: %Ld"), iDrive + 'A', iCurrent.iSize, iLast.iSize, iCurrent.iFree, iLast.iFree ) ); 
+    return hasChanged;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
+    {
+    const CMemSpyEngineHelperSysMemTrackerEntryDiskSpace& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryDiskSpace& >( aEntry );
+
+    TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::UpdateFromL() - START - drive: %C:\\, iCurrent.iSize: %Ld, iLast.iSize: %Ld, iCurrent.iFree: %Ld, iLast.iFree: %Ld"), iDrive + 'A', iCurrent.iSize, iLast.iSize, iCurrent.iFree, iLast.iFree ) ); 
+  
+    // Update state
+    iLast = iCurrent;
+    iCurrent = entry.iCurrent;
+
+    TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::UpdateFromL() - END - drive: %C:\\, iCurrent.iSize: %Ld, iLast.iSize: %Ld, iCurrent.iFree: %Ld, iLast.iFree: %Ld"), iDrive + 'A', iCurrent.iSize, iLast.iSize, iCurrent.iFree, iLast.iFree ) ); 
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::UpdateVolumeInfoL( TVolumeInfo& aInfo )
+    {
+    RFs& fsSession = Engine().FsSession();
+    User::LeaveIfError( fsSession.Volume( aInfo, iDrive ) );
+    TRACE( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::UpdateVolumeInfoL() - drive: %C:\\, aInfo.iSize: %Ld, aInfo.iFree: %Ld"), iDrive + 'A', iCurrent.iSize, iLast.iSize, iCurrent.iFree, iLast.iFree ) ); 
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace( TUint8 aAttribs, TDriveNumber aDrive )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iDrive( aDrive )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::~CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace()
+    {
+    delete iName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::ConstructL( const TVolumeInfo& aCurrent, const TVolumeInfo* /*aLast*/ )
+    {
+    BaseConstructL();
+
+    // Format drive letter
+    _LIT( KDriveFormatSpec, "EDrive%c" );
+    TChar driveChar( 'A' + iDrive );
+    iDriveName.Format( KDriveFormatSpec, (TInt) driveChar );
+
+    iName = aCurrent.iName.AllocL();
+    iUniqueID = aCurrent.iUniqueID;
+    iSize = aCurrent.iSize;
+    iFree = aCurrent.iFree;
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace* CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::NewLC( TUint8 aAttribs, TDriveNumber aDrive, const TVolumeInfo& aCurrent, const TVolumeInfo* aLast )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace( aAttribs, aDrive );
+    CleanupStack::PushL( self );
+    self->ConstructL( aCurrent, aLast );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeDiskSpace;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderLine, "Type, Drive Name, Drive Number, Size, Free, UID, Volume Name, Attribs");
+    aSink.OutputLineL( KHeaderLine );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeDiskSpace::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,%1d,%ld,%ld,%8x,%S,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf( buf->Des() );
+
+    // Now output line
+    pBuf.Format( KFormat,
+                 &type,
+                 &iDriveName,
+                 iDrive,
+                 iSize,
+                 iFree,
+                 iUniqueID,
+                 iName,
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFbserv.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,257 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryFbserv.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntryFbserv::CMemSpyEngineHelperSysMemTrackerEntryFbserv( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aCurrentLarge, const TMemSpyDriverChunkInfo& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeFbserv ), 
+    iCurrentLarge( aCurrentLarge ), iCurrentShared( aCurrentShared ), 
+    iCurrentBitmapConCount( aBitmapConCount ), 
+    iCurrentFontConCount( aFontConCount ),
+    iCurrentAccessibleBitmapCount( aAccessibleBitmapCount )
+    {
+    iLastShared = aCurrentShared;
+    iLastLarge = aCurrentLarge;
+    iLastBitmapConCount = aBitmapConCount;
+    iLastFontConCount = aFontConCount;
+    iLastAccessibleBitmapCount = aAccessibleBitmapCount;
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryFbserv::~CMemSpyEngineHelperSysMemTrackerEntryFbserv()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryFbserv::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryFbserv* CMemSpyEngineHelperSysMemTrackerEntryFbserv::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aCurrentLarge, const TMemSpyDriverChunkInfo& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryFbserv* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryFbserv( aTracker, aCurrentLarge, aCurrentShared, aBitmapConCount, aFontConCount, aAccessibleBitmapCount );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntryFbserv::Key() const
+    {
+    const TUint32 val = ( Type() << 28 );
+    TUint64 ret = val;
+    ret <<= 32;
+    ret += reinterpret_cast< TUint32 >( iCurrentLarge.iHandle );
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryFbserv::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
+    {
+    const CMemSpyEngineHelperSysMemTrackerEntryFbserv& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryFbserv& >( aEntry );
+    
+    // Update state
+    iLastShared = iCurrentShared;
+    iCurrentShared = entry.iCurrentShared;
+    iLastLarge = iCurrentLarge;
+    iCurrentLarge = entry.iCurrentLarge;
+    
+    // Counts
+    iLastBitmapConCount = iCurrentBitmapConCount;
+    iCurrentBitmapConCount = entry.iCurrentBitmapConCount;
+    //
+    iLastFontConCount = iCurrentFontConCount;
+    iCurrentFontConCount = entry.iCurrentFontConCount;
+    //
+    iLastAccessibleBitmapCount = iCurrentAccessibleBitmapCount;
+    iCurrentAccessibleBitmapCount = entry.iCurrentAccessibleBitmapCount;
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntryFbserv::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
+    {
+    const TBool hasChanged = ( iCurrentShared.iSize != iLastShared.iSize ) || ( iCurrentLarge.iSize != iLastLarge.iSize ) ||
+                             ( iCurrentFontConCount != iLastFontConCount ) || ( iCurrentBitmapConCount != iLastBitmapConCount ) ||
+                             ( iCurrentAccessibleBitmapCount != iCurrentAccessibleBitmapCount )
+                             ;
+    return hasChanged;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryFbserv::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::NewLC( Attributes(), iCurrentLarge, iCurrentShared, iCurrentBitmapConCount, iCurrentFontConCount, iCurrentAccessibleBitmapCount );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryFbserv::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    aCycle.AddToMemoryUsed( iCurrentShared.iSize );
+    aCycle.AddToMemoryUsed( iCurrentLarge.iSize );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv( TUint8 aAttribs, const TMemSpyDriverChunkInfoWithoutName& aCurrentLarge, const TMemSpyDriverChunkInfoWithoutName& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iSharedChunk( aCurrentShared ), iLargeChunk( aCurrentLarge ), iBitmapConCount( aBitmapConCount ), iFontConCount( aFontConCount ), iAccessibleBitmapCount( aAccessibleBitmapCount )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::~CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv* CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfoWithoutName& aCurrentLarge, const TMemSpyDriverChunkInfoWithoutName& aCurrentShared, TInt aBitmapConCount, TInt aFontConCount, TInt aAccessibleBitmapCount )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv( aAttribs, aCurrentLarge, aCurrentShared, aBitmapConCount, aFontConCount, aAccessibleBitmapCount );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeFbserv;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderChunk, "Type, FbsSharedChunk[Handle,Base,Size,Max Size], FbsLargeChunk[Handle,Base,Size,Max Size], AllBC, BCC, FCC, Attribs");
+    aSink.OutputLineL( KHeaderChunk );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeFbserv::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,FbsSharedChunk[0x%08x,0x%08x,%d,%d],FbsLargeChunk[0x%08x,0x%08x,%d,%d],%d,%d,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+
+    // Now output line
+    pBuf.Format( KFormat, 
+                 &type,
+
+                 // Shared chunk
+                 iSharedChunk.iHandle,
+                 iSharedChunk.iBaseAddress,
+                 iSharedChunk.iSize,
+                 iSharedChunk.iMaxSize,
+
+                 // Large chunk
+                 iLargeChunk.iHandle,
+                 iLargeChunk.iBaseAddress,
+                 iLargeChunk.iSize,
+                 iLargeChunk.iMaxSize,
+
+                 // Container counts
+                 iAccessibleBitmapCount,
+                 iBitmapConCount,
+                 iFontConCount,
+
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryFileServerCache.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryFileServerCache.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::CMemSpyEngineHelperSysMemTrackerEntryFileServerCache( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeFileServerCache ), iLast( aInfo ), iCurrent( aInfo )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::~CMemSpyEngineHelperSysMemTrackerEntryFileServerCache()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::ConstructL()
+    {
+    SetHandle( iCurrent.iHandle );
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryFileServerCache* CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryFileServerCache* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryFileServerCache( aTracker, aInfo );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
+    {
+    const CMemSpyEngineHelperSysMemTrackerEntryFileServerCache& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryFileServerCache& >( aEntry );
+    
+    // Update state
+    iLast = iCurrent;
+    iCurrent = entry.iCurrent;
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
+    {
+    const TBool hasChanged = ( iCurrent.iSize != iLast.iSize );
+    return hasChanged;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::NewLC( Attributes(), iCurrent );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    aCycle.AddToMemoryUsed( iCurrent.iSize );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::~CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache* CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache( aAttribs, aCurrent );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeFileServerCache;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderChunk, "Type, Name, Handle, Base Addr, Size, Max Size, Attribs");
+    aSink.OutputLineL( KHeaderChunk );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,0x%08x,0x%08x,%d,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+
+    // Now output line
+    pBuf.Format( KFormat, 
+                 &type,
+                 &iCurrent.iName, 
+                 iCurrent.iHandle,
+                 iCurrent.iBaseAddress,
+                 iCurrent.iSize,
+                 iCurrent.iMaxSize,
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeFileServerCache::OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    CMemSpyEngine& engine = aSink.Engine();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryGlobalData.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,285 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryGlobalData.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerGlobalData::CMemSpyEngineHelperSysMemTrackerGlobalData( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeGlobalData )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerGlobalData::~CMemSpyEngineHelperSysMemTrackerGlobalData()
+    {
+    delete iChunkName;
+    delete iLast;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerGlobalData::ConstructL( CMemSpyProcess& aProcess, const TMemSpyDriverChunkInfo& aChunkInfo )
+    {
+    iCurrent = aChunkInfo;
+    //
+    SetProcess( aProcess.Id() );
+    SetHandle( aChunkInfo.iHandle );
+
+    if  ( aChunkInfo.iType == EMemSpyDriverChunkTypeGlobalData )
+        {
+        // Pure global data, unique chunk
+        iLast = new(ELeave) TMemSpyDriverChunkInfo();
+        *iLast = aChunkInfo;
+        }
+    else if ( aChunkInfo.iType == EMemSpyDriverChunkTypeStackAndProcessGlobalData )
+        {
+        // Mostly stack, possibly some global data too. Get the global data size from
+        // the code seg associated with the process.
+        CMemSpyEngineCodeSegList* codeSegs = Engine().HelperCodeSegment().CodeSegmentListL( aProcess.Id() );
+        CleanupStack::PushL( codeSegs );
+
+        // We're looking for the process codesegment...
+        TFileName* fileName = new(ELeave) TFileName();
+        CleanupStack::PushL( fileName );
+        aProcess.GetFileName( *fileName );
+        const TInt pos = codeSegs->IndexByName( *fileName );
+        CleanupStack::PopAndDestroy( fileName );
+
+        // Get total data size
+        if  ( pos >= 0 )
+            {
+            const CMemSpyEngineCodeSegEntry& entry = codeSegs->At( pos );
+            const TCodeSegCreateInfo& createInfo = entry.CreateInfo();
+            iCurrent.iSize = Engine().Driver().RoundToPageSize( createInfo.iTotalDataSize );
+            
+            // If there is no data, then we don't want an entry in the list, so bail out.
+            if  ( iCurrent.iSize == 0 )
+                {
+                User::Leave( KErrNotSupported );
+                }
+            }
+
+        CleanupStack::PopAndDestroy( codeSegs );
+        }
+
+    iChunkName = aChunkInfo.iName.AllocL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerGlobalData* CMemSpyEngineHelperSysMemTrackerGlobalData::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyProcess& aProcess, const TMemSpyDriverChunkInfo& aChunkInfo )
+    {
+    CMemSpyEngineHelperSysMemTrackerGlobalData* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerGlobalData( aTracker );
+    CleanupStack::PushL( self );
+    self->ConstructL( aProcess, aChunkInfo );
+    return self;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerGlobalData::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
+    {
+    const CMemSpyEngineHelperSysMemTrackerGlobalData& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerGlobalData& >( aEntry );
+    __ASSERT_ALWAYS( entry.IsProcessGlobalData() == IsProcessGlobalData(), User::Panic(_L("MemSpySysMemT"), __LINE__ ) );
+   
+    if  ( !IsProcessGlobalData() )
+        {
+        // Update state
+        *iLast = iCurrent;
+        iCurrent = entry.iCurrent;
+        }
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerGlobalData::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
+    {
+    TBool hasChanged = EFalse;
+    //
+    if  ( !IsProcessGlobalData() )
+        {
+        hasChanged = ( iCurrent.iSize != iLast->iSize );
+        }
+    //
+    return hasChanged;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerGlobalData::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::NewLC( Attributes(), *iChunkName, iCurrent, IsNew() ? NULL : iLast );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerGlobalData::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    const TInt size = CurrentGlobalDataSize();
+    aCycle.AddToMemoryUsed( size );
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerGlobalData::IsProcessGlobalData() const
+    {
+    return ( iLast == NULL );
+    }
+
+
+TInt CMemSpyEngineHelperSysMemTrackerGlobalData::CurrentGlobalDataSize() const
+    {
+    const TInt size = iCurrent.iSize;
+    return size;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData( TUint8 aAttribs, const TMemSpyDriverChunkInfoWithoutName& aCurrent )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::~CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData()
+    {
+    delete iLast;
+    delete iChunkName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::ConstructL( const TDesC& aChunkName, const TMemSpyDriverChunkInfoWithoutName* aLast )
+    {
+    BaseConstructL();
+
+    // Save the thread name
+    iChunkName = aChunkName.AllocL();
+
+    // Save last heap data (if available)
+    if  ( aLast )
+        {
+        iLast = new (ELeave) TMemSpyDriverChunkInfoWithoutName();
+        *iLast = *aLast;
+        }
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData* CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::NewLC( TUint8 aAttribs, const TDesC& aChunkName, const TMemSpyDriverChunkInfoWithoutName& aCurrent, const TMemSpyDriverChunkInfoWithoutName* aLast )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData( aAttribs, aCurrent );
+    CleanupStack::PushL( self );
+    self->ConstructL( aChunkName, aLast );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeGlobalData;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderGlobalData, "Type, Process, Chunk, Handle, Base Addr, Size, Max Size, Attribs");
+    aSink.OutputLineL( KHeaderGlobalData );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,%S,0x%08x,0x%08x,%d,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+
+    // Try to get associated process name
+    TPtrC pProcessName( KNullDesC );
+    CMemSpyEngine& engine = aSink.Engine();
+    const TInt procIndex = engine.Container().ProcessIndexById( iCurrent.iOwnerId );
+    if  ( procIndex >= 0 )
+        {
+        CMemSpyProcess& process = engine.Container().At( procIndex );
+        pProcessName.Set( process.Name() );
+        }
+
+    // Now output line
+    pBuf.Format( KFormat, 
+                 &type,
+                 &pProcessName, 
+                 iChunkName,
+                 iCurrent.iHandle,
+                 iCurrent.iBaseAddress,
+                 iCurrent.iSize,
+                 iCurrent.iMaxSize,
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    CMemSpyEngine& engine = aSink.Engine();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+#include <memspy/driver/memspydriverconstants.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelperkernelcontainers.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyDriverContainerType aType )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeHandleGeneric ), iHandleType( aType )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::~CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric()
+    {
+    delete iName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::ConstructL( TAny* aHandle )
+    {
+    SetHandle( aHandle );
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric* CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TAny* aHandle, TMemSpyDriverContainerType aType )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric( aTracker, aType );
+    CleanupStack::PushL( self );
+    self->ConstructL( aHandle );
+    return self;
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::Key() const
+    {
+    const TUint32 val = ( Type() << 28 ) + iHandleType; 
+    TUint64 ret = val;
+    ret <<= 32;
+    ret += Handle();
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    // We lazy fetch the name to avoid having to get info for every single handle whenever a change cycle occurs...
+    if  ( iName == NULL )
+        {
+        TMemSpyDriverHandleInfoGeneric info;
+        const TInt err = Engine().Driver().GetGenericHandleInfo( KMemSpyDriverEnumerateContainerHandles, iHandleType, (TAny*) Handle(), info );
+        if  ( err == KErrNone )
+            {
+            // Save name
+            iName = HBufC::NewL( info.iName.Length() );
+            iName->Des().Copy( info.iName );
+            }
+        else
+            {
+            iName = KNullDesC().AllocL();
+            }
+        }
+    
+    CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::NewLC( Attributes(), *iName, Handle(), iHandleType );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric( TUint8 aAttribs, TUint32 aHandle, TMemSpyDriverContainerType aType )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iHandle( aHandle ), iType( aType )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::~CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric()
+    {
+    delete iName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::ConstructL( const TDesC& aName )
+    {
+    BaseConstructL();
+
+    // Save the thread name
+    iName = aName.AllocL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric* CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::NewLC( TUint8 aAttribs, const TDesC& aName, TUint32 aHandle, TMemSpyDriverContainerType aType )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric( aAttribs, aHandle, aType );
+    CleanupStack::PushL( self );
+    self->ConstructL( aName );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeHandleGeneric;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderLine, "Type, Name, Handle, Handle Type, Attribs");
+    aSink.OutputLineL( KHeaderLine );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHandleGeneric::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,0x%08x,%S,%S" );
+    //
+    TMemSpySWMTTypeName type;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+    //
+    const TPtrC pType( CMemSpyEngineGenericKernelObjectList::TypeAsString( iType ) );
+
+    // Now output line
+    pBuf.Format( KFormat, 
+                 &type,
+                 iName, 
+                 iHandle,
+                 &pType,
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+#include <memspy/driver/memspydriverconstants.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include<memspy/engine/memspyenginehelperkernelcontainers.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeHandlePAndS )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::~CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS()
+    {
+    delete iName;
+    delete iThreadName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::ConstructL( TAny* aHandle )
+    {
+    SetHandle( aHandle );
+    TInt err = Engine().Driver().GetPAndSInfo( aHandle, iInfo );
+    User::LeaveIfError( err );
+    SetThread( iInfo.iTid );
+
+    // Get thread name, if possible.
+    CMemSpyThread* thread = NULL;
+    CMemSpyProcess* process = NULL;
+    err = Engine().Container().ProcessAndThreadByThreadId( iInfo.iTid, process, thread );
+    if  ( err == KErrNone && thread )
+        {
+        TFullName* name = new(ELeave) TFullName();
+        CleanupStack::PushL( name );
+        thread->FullName( *name );
+        iThreadName = name->AllocL();
+        CleanupStack::PopAndDestroy( name );
+        }
+    else
+        {
+        iThreadName = KMemSpySWMTThreadNotFound().AllocL();
+        }
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS* CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TAny* aHandle )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS( aTracker );
+    CleanupStack::PushL( self );
+    self->ConstructL( aHandle );
+    return self;
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::Key() const
+    {
+    const TUint32 val = ( Type() << 28 ); 
+    TUint64 ret = val;
+    ret <<= 32;
+    ret += Handle();
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    // We lazy fetch the name to avoid having to get info for every single handle whenever a change cycle occurs...
+    if  ( iName == NULL )
+        {
+        TMemSpyDriverHandleInfoGeneric info;
+        const TInt err = Engine().Driver().GetGenericHandleInfo( KMemSpyDriverEnumerateContainerHandles, EMemSpyDriverContainerTypePropertyRef, (TAny*) Handle(), info );
+        if  ( err == KErrNone )
+            {
+            // Save name
+            iName = HBufC::NewL( info.iName.Length() );
+            iName->Des().Copy( info.iName );
+            }
+        else
+            {
+            iName = KNullDesC().AllocL();
+            }
+        }
+    
+    CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::NewLC( Attributes(), Handle(), iInfo, *iName, *iThreadName );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS( TUint8 aAttribs, TUint32 aHandle, const TMemSpyDriverPAndSInfo& aInfo )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iHandle( aHandle ), iInfo( aInfo )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::~CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS()
+    {
+    delete iName;
+    delete iThreadName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::ConstructL( const TDesC& aName, const TDesC& aThreadName )
+    {
+    BaseConstructL();
+    //
+    iName = aName.AllocL();
+    iThreadName = aThreadName.AllocL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS* CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::NewLC( TUint8 aAttribs, TUint32 aHandle, const TMemSpyDriverPAndSInfo& aInfo, const TDesC& aName, const TDesC& aThreadName )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS( aAttribs, aHandle, aInfo );
+    CleanupStack::PushL( self );
+    self->ConstructL( aName, aThreadName );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeHandlePAndS;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderLine, "Type, Name, Handle, Key Type, Category, Key, Ref. Count, Creator SID, Thread Id, Thread Name, Attribs");
+    aSink.OutputLineL( KHeaderLine );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHandlePAndS::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,0x%08x,%d,0x%08x,0x%08x,%d,0x%08x,%d,%S,%S" );
+    //
+    TMemSpySWMTTypeName type;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+
+    // Now output line
+    pBuf.Format( KFormat, 
+                 &type,
+                 iName, 
+                 iHandle,
+                 iInfo.iType,
+                 iInfo.iCategory,
+                 iInfo.iKey,
+                 iInfo.iRefCount,
+                 iInfo.iCreatorSID,
+                 iInfo.iTid,
+                 iThreadName,
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryHeap.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,407 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryHeap.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+#include <memspy/engine/memspyenginehelpersysmemtracker.h>
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntryHeap::CMemSpyEngineHelperSysMemTrackerEntryHeap( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TMemSpyEngineSysMemTrackerType aType )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, aType )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryHeap::~CMemSpyEngineHelperSysMemTrackerEntryHeap()
+    {
+    delete iThreadName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHeap::ConstructL()
+    {
+    // Kernel
+    TFullName name;
+    MemSpyEngineUtils::GetKernelHeapThreadName( name );
+    iThreadName = name.AllocL();
+    //
+    UpdateHeapInfoL( iLast );
+    iCurrent = iLast;
+    //
+    SetHandle( iCurrent.AsRHeap().MetaData().ChunkHandle() );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHeap::ConstructL( CMemSpyThread& aThread )
+    {
+    TFullName* name = new(ELeave) TFullName();
+    CleanupStack::PushL( name );
+    aThread.FullName( *name );
+    iThreadName = name->AllocL();
+    CleanupStack::PopAndDestroy( name );
+    //
+    SetThread( aThread.Id() );
+    SetProcess( aThread.Process().Id() );
+    //
+    UpdateHeapInfoL( iLast );
+    iCurrent = iLast;
+    //
+    SetHandle( iCurrent.AsRHeap().MetaData().ChunkHandle() );
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryHeap* CMemSpyEngineHelperSysMemTrackerEntryHeap::NewUserLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyThread& aThread )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryHeap* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryHeap( aTracker, EMemSpyEngineSysMemTrackerTypeHeapUser );
+    CleanupStack::PushL( self );
+    self->ConstructL( aThread );
+    return self;
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryHeap* CMemSpyEngineHelperSysMemTrackerEntryHeap::NewKernelLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryHeap* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryHeap( aTracker, EMemSpyEngineSysMemTrackerTypeHeapKernel );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntryHeap::Key() const
+    {
+    const TUint32 val = ( Type() << 28 ) + ThreadId(); 
+    TUint64 ret = val;
+    ret <<= 32;
+    ret += Handle();
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHeap::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
+    {
+    const CMemSpyEngineHelperSysMemTrackerEntryHeap& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryHeap& >( aEntry );
+    
+    // Update state
+    iLast = iCurrent;
+    iCurrent = entry.iCurrent;
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntryHeap::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
+    {
+    TBool hasChanged = EFalse;
+
+    // Work out if something has changed...
+    if  ( HasHeapSizeChanged() )
+        {
+        hasChanged = ETrue;
+        }
+    else if ( HaveAllocCellsChanged() )
+        {
+        hasChanged = ETrue;
+        }
+    else if ( HaveFreeCellsChanged() )
+        {
+        hasChanged = ETrue;
+        }
+
+    return hasChanged;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHeap::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeHeap* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::NewLC( Attributes(), *iThreadName, iCurrent, IsNew() ? NULL : &iLast );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHeap::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    const TMemSpyHeapMetaDataRHeap& metaC = iCurrent.AsRHeap().MetaData();
+    const TMemSpyHeapStatisticsRHeap& statsC = iCurrent.AsRHeap().Statistics();
+    //
+    aCycle.AddToMemoryUsed( metaC.ChunkSize() );
+    aCycle.AddToCellCountAlloc( statsC.StatsAllocated().TypeCount() );
+    aCycle.AddToMemoryHeapAllocs( statsC.StatsAllocated().TypeSize() );
+    aCycle.AddToCellCountFree( statsC.StatsFree().TypeCount() );
+    aCycle.AddToMemoryHeapFrees( statsC.StatsFree().TypeSize() );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHeap::SetAsShared( TBool aShared )
+    {
+    iCurrent.AsRHeap().MetaData().SetSharedHeap( aShared );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryHeap::UpdateHeapInfoL( TMemSpyHeapInfo& aInfo )
+    {
+    TInt error = KErrNone;
+    //
+    if  ( Type() == EMemSpyEngineSysMemTrackerTypeHeapUser )
+        {
+        // Get the heap info first of all
+        Engine().ProcessSuspendLC( ProcessId() );
+        error = Engine().Driver().GetHeapInfoUser( aInfo, ThreadId() );
+        CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+        }
+    else if ( Type() == EMemSpyEngineSysMemTrackerTypeHeapKernel )
+        {
+        // Kernel
+        error = Engine().Driver().GetHeapInfoKernel( aInfo );
+        }
+    else
+        {
+        User::Invariant();
+        }
+    //
+    User::LeaveIfError( error );
+    //
+    if  ( aInfo.Type() == TMemSpyHeapInfo::ETypeUnknown )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntryHeap::HasHeapSizeChanged() const
+    {
+    return ( iCurrent.AsRHeap().MetaData().ChunkSize() != iLast.AsRHeap().MetaData().ChunkSize() );
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntryHeap::HaveFreeCellsChanged() const
+    {
+    TBool changed = ( iCurrent.AsRHeap().Statistics().StatsFree().TypeCount() != iLast.AsRHeap().Statistics().StatsFree().TypeCount() ) ||
+		( iCurrent.AsRHeap().Statistics().StatsFree().TypeSize() != iLast.AsRHeap().Statistics().StatsFree().TypeSize() );
+    //
+    return changed;
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntryHeap::HaveAllocCellsChanged() const
+    {
+    return 
+        ( iCurrent.AsRHeap().Statistics().StatsAllocated().TypeCount() != iLast.AsRHeap().Statistics().StatsAllocated().TypeCount() ) ||
+        ( iCurrent.AsRHeap().Statistics().StatsAllocated().TypeSize() != iLast.AsRHeap().Statistics().StatsAllocated().TypeSize() );
+    }
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::CMemSpyEngineHelperSysMemTrackerCycleChangeHeap( TUint8 aAttribs, const TMemSpyHeapInfo& aCurrent )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::~CMemSpyEngineHelperSysMemTrackerCycleChangeHeap()
+    {
+    delete iLast;
+    delete iThreadName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::ConstructL( const TDesC& aThreadName, const TMemSpyHeapInfo* aLast )
+    {
+    BaseConstructL();
+
+    // Save the thread name
+    iThreadName = aThreadName.AllocL();
+
+    // Save last heap data (if available)
+    if ( aLast )
+        {
+        iLast = new (ELeave) TMemSpyHeapInfo();
+        *iLast = *aLast;
+        }
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeHeap* CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TMemSpyHeapInfo& aCurrent, const TMemSpyHeapInfo* aLast )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeHeap* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeHeap( aAttribs, aCurrent );
+    CleanupStack::PushL( self );
+    self->ConstructL( aThreadName, aLast );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::Type() const
+    {
+    TMemSpyEngineSysMemTrackerType ret = EMemSpyEngineSysMemTrackerTypeHeapUser;
+    //
+    if  ( IsKernel() )
+        {
+        ret = EMemSpyEngineSysMemTrackerTypeHeapKernel;
+        }
+    //
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderHeap, "Type, Thread, Chunk, Handle, Heap Addr, Size, Min, Max, 1st Free Addr, 1st Free Len, Alloc Count, Alloc Space, Free Count, Free Space, Free Slack, F.Largest, A.Largest, Attribs");
+    aSink.OutputLineL( KHeaderHeap );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,%S,0x%08x,0x%08x,%d,%d,%d,0x%08x,%d,%d,%d,%d,%d,%d,%d,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+
+    const TMemSpyHeapMetaDataRHeap& metaData = iCurrent.AsRHeap().MetaData();
+    const TMemSpyHeapStatisticsRHeap& stats = iCurrent.AsRHeap().Statistics();
+
+    // Strip any process & thread
+    const TPtrC pChunkName( MemSpyEngineUtils::TextAfterLastDoubleColon( metaData.ChunkName() ) );
+
+    pBuf.Format( KFormat, 
+                 &type,
+                 iThreadName, 
+                 &pChunkName,
+                 metaData.ChunkHandle(),
+                 /*objectData.Base(),*/ metaData.iAllocatorAddress,
+                 metaData.ChunkSize(),
+                 /*objectData.iMinLength,*/ metaData.iMinHeapSize,
+                 /*objectData.iMaxLength,*/ metaData.iMaxHeapSize,
+                 /*objectData.iFree.next,*/ NULL, //TODO
+                 /*objectData.iFree.len,*/ 0,
+                 stats.StatsAllocated().TypeCount(),
+                 stats.StatsAllocated().TypeSize(),
+                 stats.StatsFree().TypeCount(),
+                 stats.StatsFree().TypeSize(),
+                 stats.StatsFree().SlackSpaceCellSize(),
+                 stats.StatsFree().LargestCellSize(),
+                 stats.StatsAllocated().LargestCellSize(),
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngine& engine = aSink.Engine();
+
+    // First check that we can find the user-thread okay.
+    CMemSpyThread* thread = NULL;
+    CMemSpyProcess* process = NULL;
+    TBool allowedToDump = ETrue;
+    TMemSpyEngineHelperSysMemTrackerConfig config;
+    engine.HelperSysMemTracker().GetConfig( config );
+    if ( config.iThreadNameFilter.Length() > 0 && iThreadName->FindF( config.iThreadNameFilter ) == KErrNotFound )
+        {
+        allowedToDump = EFalse;
+        }
+    if  ( allowedToDump && !IsKernel() )
+        {
+        allowedToDump = ( engine.Container().ProcessAndThreadByThreadId( iCurrent.Tid(), process, thread ) == KErrNone );
+        }
+
+	// Now dump the heap data
+    if  ( allowedToDump )
+        {
+        // Starts a data Stream
+        aCycle.DataStreamBeginL( aSink, *iThreadName );
+        
+        TInt err = KErrNone;
+
+        if  ( IsKernel() )
+            {
+            TRAP(err, engine.HelperHeap().OutputHeapDataKernelL( KMemSpyEngineSinkDoNotCreateOwnDataStream ));
+            }
+        else if ( thread )
+            {
+            TRAP(err, engine.HelperHeap().OutputHeapDataUserL( *thread, KMemSpyEngineSinkDoNotCreateOwnDataStream )); 
+            }
+
+        // End the stream (commit the file)
+        aCycle.DataStreamEndL( aSink );
+        
+        User::LeaveIfError(err);
+        }
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::IsKernel() const
+    {
+    return ( iCurrent.Pid() == 0 && iCurrent.Tid() == 0 );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeHeap::FormatAttributes( TDes& aBuffer ) const
+    {
+    _LIT( KAttribShared, "[S]" ); // Attribute for Shared Heap
+    _LIT( KAttribPlus,  "+" );
+    CMemSpyEngineHelperSysMemTrackerCycleChange::FormatAttributes( aBuffer );
+    if ( iCurrent.AsRHeap().MetaData().IsSharedHeap() )
+        {
+        if ( aBuffer.Length() )
+            {
+            aBuffer.Append( KAttribPlus );
+            }
+        aBuffer.Append( KAttribShared );
+        }
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryManager.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1150 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryManager.h"
+
+// System includes
+#include <e32debug.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyenginemidwife.h>
+#include <memspy/engine/memspyengineundertaker.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyenginehelperfbserv.h>
+#include <memspy/engine/memspyenginehelperfilesystem.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include <memspy/engine/memspyenginehelperkernelcontainers.h>
+#include <memspy/engine/memspyenginehelperwindowserver.h>
+#include <memspy/engine/memspyenginehelpersysmemtracker.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include "MemSpyEngineHelperSysMemTrackerLog.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
+#include "MemSpyEngineHelperSysMemTrackerEntries.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryChunk.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryGlobalData.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryHeap.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryRamDrive.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryStack.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryCode.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryOpenFile.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryDiskSpace.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryBitmap.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryFbserv.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryFileServerCache.h"
+#include "MemSpyEngineHelperSysMemTrackerEntrySystemMemory.h"
+#include "MemSpyEngineHelperSysMemTrackerEntryWindowServer.h"
+
+
+// Constants
+
+// Message printed to RDebug output for some clients that may be reading traces 
+_LIT( KMemSpyKeepaliveMessage, "<MEMSPY_PROGRESS>" );
+
+
+CMemSpyEngineHelperSysMemTrackerEntryManager::CMemSpyEngineHelperSysMemTrackerEntryManager( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyEngineHelperSysMemTrackerEntryManager* aMasterList )
+:   iTracker( aTracker ), iMasterList( aMasterList )
+    {
+    }
+
+    
+CMemSpyEngineHelperSysMemTrackerEntryManager::~CMemSpyEngineHelperSysMemTrackerEntryManager()
+    {
+    iEntries.ResetAndDestroy();
+    iEntries.Close();
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::ConstructL()
+    {
+    CreateSeedItemsL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryManager* CMemSpyEngineHelperSysMemTrackerEntryManager::NewL( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryManager* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryManager( aTracker );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryManager* CMemSpyEngineHelperSysMemTrackerEntryManager::NewL( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyEngineHelperSysMemTrackerEntryManager& aMasterList )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryManager* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryManager( aTracker, &aMasterList );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::IdentifyChangesL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    // Mark everything in this list (i.e. the master list) as dead.
+    MarkEverythingDead();
+
+    // Create a new list which will act as a secondary list. This new list will only contain
+    // new entries. Any entries which it attempts to create that already exist in the master list
+    // will be discared (after updating the corresponding master list entry with new values).
+    CMemSpyEngineHelperSysMemTrackerEntryManager* newEM = CMemSpyEngineHelperSysMemTrackerEntryManager::NewL( iTracker, *this );
+    CleanupStack::PushL( newEM );
+
+    // At this point, we have performed several key operations
+    // 
+    // 1) We have tagged everything that is still alive as "alive".
+    // 2) We have left everything that no longer exists as "dead"
+    // 3) We have updated all alive entries with new values (if they have changed)
+    // 4) We have identified new entries (these are currently orphaned within the secondary list right now).
+    //
+    // We now need to merge the two lists, i.e. take all the new entries in 'newEM' and merge them
+    // into the current master list.
+    MergeListIntoMeL( *newEM );
+
+    // We can throw the other list away now as it will be empty.
+    CleanupStack::PopAndDestroy( newEM );
+
+    // At this point we have our final new list, but it still contains dead entries.
+    // We must next output all the change information required for this cycle.
+    ProcessChangesL( aCycle );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::EverythingHasChangedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    ProcessChangesL( aCycle );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::ProcessChangesL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    const TInt count = iEntries.Count();
+    for( TInt i=count-1; i>=0; i-- )
+        {
+        CMemSpyEngineHelperSysMemTrackerEntry* entry = iEntries[ i ];
+        
+        // Create any change descriptors etc
+        TRAP_IGNORE( entry->HandleNewCycleL( aCycle ) );
+
+        // Destroy the entry if it's no longer needed
+        if  ( entry->IsDead() )
+            {
+            delete entry;
+            iEntries.Remove( i );
+            }
+        else
+            {
+            // It's not new anymore
+            entry->SetNew( EFalse );
+            }
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::AddItemAndPopL( CMemSpyEngineHelperSysMemTrackerEntry* aItem )
+    {
+    // We sort by entry key, we do not allow duplicates
+    TLinearOrder<CMemSpyEngineHelperSysMemTrackerEntry> orderer( CompareKey );
+
+    // Before we save the entry we must check to see if the master list knows about it.
+    const TUint64 key( aItem->Key() );
+
+    // Operates in one of two ways. If we're in stand-alone mode, then it saves every specified entry.
+    // If we're in secondary mode (i.e. we have an associated master list) then it only saves new entries.
+    // Entries which are changed are updated (in the master list) and entries that don't exist anymore
+    // are tagged as dead.
+    //
+    if  ( ActingAsSecondaryList() )
+        {
+        CMemSpyEngineHelperSysMemTrackerEntry* existingEntry = iMasterList->EntryByKey( key );
+        if  ( existingEntry )
+            {
+            // Entry used to exist, still does. Update the master list entry with the information
+            // from the transient (new) entry.
+            existingEntry->UpdateFromL( *aItem );
+
+            // Entry is still alive. Previously, at the start of the cycle, we'd tagged all master list
+            // entries as dead, hence we must undo that if we find the entry really still exists...
+            // NB: this also updates the timestamp for the entry, to show when it was last still alive.
+            existingEntry->SetAlive();
+
+            // But it definitely isn't new anymore as we've seen it at least once before
+            existingEntry->SetNew( EFalse );
+
+            // Transient entry not needed anymore, keep original
+            CleanupStack::PopAndDestroy( aItem );
+            }
+        else
+            {
+            // Entry didn't exist before - it's a new one
+            iEntries.InsertInOrderL( aItem, orderer );
+            CleanupStack::Pop( aItem );
+            }
+
+        // Any entries in the master list which aren't present anymore in this list (aka, dead entries)
+        // will remain tagged as dead and will be filtered out and dealt with shortly...
+        }
+    else
+        {
+        // We ARE the master list
+        const TInt err = iEntries.InsertInOrder( aItem, orderer );
+        if  ( err == KErrAlreadyExists )
+            {
+            // Don't allow duplicates
+            RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::AddItemAndPopL() - ******* duplicate key ******* key: %LU, type: %d, tid: 0x%08x, pid: 0x%08x, handle: 0x%08x", key, aItem->Type(), (TUint32) aItem->ThreadId(), (TUint32) aItem->ProcessId(), aItem->Handle() );
+            delete aItem;
+            }
+        else if ( err != KErrNone )
+            {
+            User::Leave( err );
+            }
+
+        CleanupStack::Pop( aItem );
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::MarkEverythingDead()
+    {
+    const TInt count = iEntries.Count();
+    for( TInt i=count-1; i>=0; i-- )
+        {
+        CMemSpyEngineHelperSysMemTrackerEntry* entry = iEntries[ i ];
+        entry->SetDead();
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::MergeListIntoMeL( CMemSpyEngineHelperSysMemTrackerEntryManager& aOtherList )
+    {
+    const TInt count = aOtherList.iEntries.Count();
+    for( TInt i=count-1; i>=0; i-- )
+        {
+        CMemSpyEngineHelperSysMemTrackerEntry* entry = aOtherList.iEntries[ i ];
+        CleanupStack::PushL( entry );
+        aOtherList.iEntries.Remove( i );
+        AddItemAndPopL( entry );
+        }
+    }
+
+
+TInt CMemSpyEngineHelperSysMemTrackerEntryManager::FindByHandle( TUint aHandle, TMemSpyEngineSysMemTrackerType aType ) const
+    {
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = iEntries.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineHelperSysMemTrackerEntry* entry = iEntries[ i ];
+        if  ( entry->Handle() == aHandle && entry->Type() == aType )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineHelperSysMemTrackerEntryManager::FindByThreadId( const TThreadId& aThreadId ) const
+    {
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = iEntries.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineHelperSysMemTrackerEntry* entry = iEntries[ i ];
+        if  ( entry->ThreadId() == aThreadId )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntry* CMemSpyEngineHelperSysMemTrackerEntryManager::EntryByKey( const TUint64& aKey )
+    {
+    TLinearOrder<CMemSpyEngineHelperSysMemTrackerEntry> orderer( CompareKey );
+    //
+    CMemSpyEngineHelperSysMemTrackerEntryWithSuppliedKey tempEntry( iTracker, aKey );
+    const TInt pos = iEntries.FindInOrder( &tempEntry, orderer );
+    //
+    CMemSpyEngineHelperSysMemTrackerEntry* ret = NULL;
+    if  ( pos >= 0 )
+        {
+        ret = iEntries[ pos ];
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineHelperSysMemTrackerEntryManager::CompareKey( const CMemSpyEngineHelperSysMemTrackerEntry& aLeft, const CMemSpyEngineHelperSysMemTrackerEntry& aRight )
+    {
+    TInt ret = -1;
+    //
+    const TUint64 kLeft( aLeft.Key() );
+    const TUint64 kRight( aRight.Key() );
+    //
+    if  ( kLeft > kRight )
+        {
+        ret = 1;
+        }
+    else if ( kLeft == kRight )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineHelperSysMemTrackerEntryManager::CompareKeyAndTimeStamp( const CMemSpyEngineHelperSysMemTrackerEntry& aLeft, const CMemSpyEngineHelperSysMemTrackerEntry& aRight )
+    {
+    TInt ret = CompareKey( aLeft, aRight );
+    if  ( ret == 0 )
+        {
+        // Keys are the same, so compare time stamps
+        const TTime& tLeft = aLeft.LastUpdateTime();
+        const TTime& tRight = aRight.LastUpdateTime();
+        //
+        ret = -1;
+        if  ( tLeft > tRight )
+            {
+            ret = 1;
+            }
+        else if ( tLeft == tRight )
+            {
+            ret = 0;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+CMemSpyEngine& CMemSpyEngineHelperSysMemTrackerEntryManager::Engine()
+    {
+    return iTracker.Engine();
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL()
+    {
+    RDebug::Print( KMemSpyKeepaliveMessage );
+    
+    TMemSpyEngineHelperSysMemTrackerConfig config;
+    Engine().HelperSysMemTracker().GetConfig( config );
+    
+    // Get chunk list for entire device
+    CMemSpyEngineChunkList* chunks = Engine().HelperChunk().ListL( );
+    CleanupStack::PushL( chunks );
+
+#ifdef SYSMEMTRACKERLOGGING
+    {
+    const TInt chunkCount = chunks->Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
+        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() - MASTER - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
+        }
+    }
+#endif
+    
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache )
+        {
+        RDebug::Print( KMemSpyKeepaliveMessage );
+        // Extract F32 cache chunk
+        CreateSeedItemsFileServerCacheL( *chunks );        
+        }
+
+#ifdef SYSMEMTRACKERLOGGING
+    {
+    const TInt chunkCount = chunks->Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
+        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER F32 CACHE - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
+        }
+    }
+#endif
+
+// TODO: Uncomment when  bitmap handels are fixed
+//    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles )
+//        {
+//        RDebug::Print( KMemSpyKeepaliveMessage );
+//        // Bitmap
+//        CreateSeedItemsBitmapL( *chunks );        
+//        }
+
+#ifdef SYSMEMTRACKERLOGGING
+    {
+    const TInt chunkCount = chunks->Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
+        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER BITMAPS - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
+        }
+    }
+#endif
+
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap )
+        {
+        RDebug::Print( KMemSpyKeepaliveMessage );
+        // Look for user heaps
+        CreateSeedItemsHeapUserL( *chunks );
+        }
+
+#ifdef SYSMEMTRACKERLOGGING
+    {
+    const TInt chunkCount = chunks->Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
+        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER USER HEAP - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
+        }
+    }
+#endif
+
+//  TODO: Uncomment after fix
+//    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap )
+//        {
+//        RDebug::Print( KMemSpyKeepaliveMessage );
+//        // Look for kernel heaps
+//        CreateSeedItemsHeapKernelL( *chunks );
+//        }
+
+#ifdef SYSMEMTRACKERLOGGING
+    {
+    const TInt chunkCount = chunks->Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
+        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER KERNEL HEAP - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
+        }
+    }
+#endif
+
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks )
+        {
+        RDebug::Print( KMemSpyKeepaliveMessage );
+        // Local chunks
+        CreateSeedItemsChunkLocalL( *chunks );        
+        }
+
+#ifdef SYSMEMTRACKERLOGGING
+    {
+    const TInt chunkCount = chunks->Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
+        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER LOCL CHUNK - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
+        }
+    }
+#endif
+
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks )
+        {
+        RDebug::Print( KMemSpyKeepaliveMessage );
+        // Global chunks
+        CreateSeedItemsChunkGlobalL( *chunks );        
+        }
+
+#ifdef SYSMEMTRACKERLOGGING
+    {
+    const TInt chunkCount = chunks->Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
+        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER GLOB CHUNK - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
+        }
+    }
+#endif
+
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive )
+        {
+        RDebug::Print( KMemSpyKeepaliveMessage );
+        // RAM drive
+        CreateSeedItemRamDriveL( *chunks );        
+        }
+
+#ifdef SYSMEMTRACKERLOGGING
+    {
+    const TInt chunkCount = chunks->Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
+        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER RAMD - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
+        }
+    }
+#endif
+
+//    TODO: Uncomment after fix
+//    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks )
+//        {
+//        RDebug::Print( KMemSpyKeepaliveMessage );
+//        // Stacks ($DAT)
+//        CreateSeedItemsStacksL( *chunks );        
+//        }
+
+#ifdef SYSMEMTRACKERLOGGING
+     {
+   const TInt chunkCount = chunks->Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
+        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER STACKS - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
+        }
+    }
+#endif
+
+//  TODO: Uncomment after fix
+//    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData )
+//        {
+//        RDebug::Print( KMemSpyKeepaliveMessage );
+//        // Global data (DLL$DATA)
+//        CreateSeedItemsGlobalDataL( *chunks );        
+//        }
+
+ #ifdef SYSMEMTRACKERLOGGING
+    {
+    const TInt chunkCount = chunks->Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = chunks->At( i ).Info();
+        RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsL() -  AFTER GLOBAL DATA - info[%03d]: type: %d, size: %d, name: %S"), i, info.iType, info.iSize, &info.iName );
+        }
+    }
+#endif
+
+    // Don't need the chunks anymore
+    CleanupStack::PopAndDestroy( chunks );
+
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode )
+        {
+        RDebug::Print( KMemSpyKeepaliveMessage );
+        // Code
+        CreateSeedItemsCodeL();        
+        }
+
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles )
+        {
+        // Handles
+        RDebug::Print( KMemSpyKeepaliveMessage);
+        CreateSeedItemsHandlesL();        
+        }
+
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles )
+        {
+        RDebug::Print( KMemSpyKeepaliveMessage );
+        // Open files
+        CreateSeedItemsOpenFilesL();        
+        }
+
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage )
+        {
+        RDebug::Print( KMemSpyKeepaliveMessage );
+        // Disk space
+        CreateSeedItemsDiskSpaceL();        
+        }
+
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory )
+        {
+        RDebug::Print( KMemSpyKeepaliveMessage );
+        // System memory
+        CreateSeedItemsSystemMemoryL();        
+        }
+	
+    if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups )
+        {
+        RDebug::Print( KMemSpyKeepaliveMessage );
+        // Window Server
+        CreateSeedItemsWindowServerL();        
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL( CMemSpyEngineChunkList& aList )
+    {
+    CMemSpyEngine& engine = Engine();
+    const TInt procCount = engine.Container().Count();
+    for(TInt i=0; i<procCount; i++)
+        {
+        if ( !( i % 10 ) ) // Print the message on only every 10th cycle
+            {
+            RDebug::Print( KMemSpyKeepaliveMessage  );
+            }
+        CMemSpyProcess& process = engine.Container().At( i );
+        TRAP_IGNORE( CreateSeedItemsHeapUserL( process, &aList ) );
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL( CMemSpyProcess& aProcess, CMemSpyEngineChunkList* aList )
+    {
+    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL() - START - aProcess: %d", (TUint) aProcess.Id() ) );
+    
+    CMemSpyEngine& engine = Engine();
+    engine.ProcessSuspendLC( aProcess.Id() );
+
+    const TInt threadCount = aProcess.Count();
+    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL() - threadCount: %d", threadCount ) );
+
+    for( TInt j=0; j<threadCount; j++ )
+        {
+        CMemSpyThread& thread = aProcess.At( j );
+        //
+        if  ( !thread.IsDead() )
+            {
+            TRAP_IGNORE( CreateSeedItemsHeapUserL( thread, aList ) );
+            }
+        }
+    
+    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+
+    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL() - END" ) );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL( CMemSpyThread& aThread, CMemSpyEngineChunkList* aList )
+    {
+    TBool exists = FindByThreadId( aThread.Id() ) != KErrNotFound;
+    //
+    if  ( !exists )
+        {
+        CMemSpyEngineHelperSysMemTrackerEntryHeap* entry = CMemSpyEngineHelperSysMemTrackerEntryHeap::NewUserLC( iTracker, aThread );
+
+        // Check if chunk already logged
+        TInt entryIndex = FindByHandle( entry->Handle(), EMemSpyEngineSysMemTrackerTypeHeapUser ); 
+        exists =  entryIndex != KErrNotFound;
+        SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapUserL() - heapChunkHandle: 0x%08x, already exists: %d", entry->Handle(), exists ) );
+        if ( exists )
+            {
+            CMemSpyEngineHelperSysMemTrackerEntryHeap& sharedheapEntry = static_cast< CMemSpyEngineHelperSysMemTrackerEntryHeap& >( *iEntries[ entryIndex ] );
+            sharedheapEntry.SetAsShared( ETrue );
+            }
+
+        // Remove utilised entries
+        if  ( aList )
+            {
+            aList->RemoveByHandle( (TAny*) entry->Handle() );
+            }
+
+        // Save
+        if  ( !exists )
+            {
+            AddItemAndPopL( entry );
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy( entry );
+            }
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapKernelL( CMemSpyEngineChunkList& aList )
+    {
+    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapKernelL() - START" ) );
+
+    CMemSpyEngine& engine = Engine();
+    CMemSpyEngineHelperSysMemTrackerEntryHeap* entry = CMemSpyEngineHelperSysMemTrackerEntryHeap::NewKernelLC( iTracker );
+    AddItemAndPopL( entry );
+
+    // Remove utilised entries
+    aList.RemoveByHandle( (TAny*) entry->Handle() );
+
+    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHeapKernelL() - END" ) );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkLocalL( CMemSpyEngineChunkList& aList )
+    {
+    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkL() - START" ) );
+
+    const TInt chunkCount = aList.Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = aList.At( i ).Info();
+        SYSMEMTRACKERLOG_PRINTF( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkLocalL() - info[%03d]: type: %d, pid: 0x%04x, size: %d, name: %S"), i, info.iType, info.iOwnerId, info.iSize, &info.iName ) );
+        //
+        if  ( info.iType == EMemSpyDriverChunkTypeLocal )
+            {
+            // Try to find corresponding process
+            const TInt processIndex = Engine().Container().ProcessIndexById( info.iOwnerId );
+            SYSMEMTRACKERLOG_PRINTF( RDebug::Print( _L("CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkLocalL() - processIndex: %d"), processIndex ) );
+            //
+            if  ( processIndex >= 0 )
+                {
+                CMemSpyProcess& process = Engine().Container().At( processIndex );
+                //
+                TRAP_IGNORE(
+                    CMemSpyEngineHelperSysMemTrackerEntryChunk* entry = CMemSpyEngineHelperSysMemTrackerEntryChunk::NewLC( iTracker, info, process );
+                    AddItemAndPopL( entry );
+                    );
+                //
+                aList.Remove( i );
+                }
+            }
+        }
+
+    SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkL() - END" ) );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsChunkGlobalL( CMemSpyEngineChunkList& aList )
+    {
+    const TInt chunkCount = aList.Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = aList.At( i ).Info();
+        if  ( info.iType == EMemSpyDriverChunkTypeGlobal )
+            {
+            if  ( CMemSpyEngineHelperFbServ::IsSharedBitmapChunk( info ) || CMemSpyEngineHelperFbServ::IsLargeBitmapChunk( info ) )
+                {
+                // Don't process these two yet, they'll be handled by the bitmap code
+                }
+            else
+                {
+                TRAP_IGNORE(
+                    CMemSpyEngineHelperSysMemTrackerEntryChunk* entry = CMemSpyEngineHelperSysMemTrackerEntryChunk::NewLC( iTracker, info );
+                    AddItemAndPopL( entry );
+                    );
+
+                // Remove processed item
+                aList.Remove( i );
+                }
+            }
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemRamDriveL( CMemSpyEngineChunkList& aList )
+    {
+    const TInt chunkCount = aList.Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = aList.At( i ).Info();
+        if  ( info.iType == EMemSpyDriverChunkTypeRamDrive )
+            {
+            TRAP_IGNORE(
+                CMemSpyEngineHelperSysMemTrackerEntryRamDrive* entry = CMemSpyEngineHelperSysMemTrackerEntryRamDrive::NewLC( iTracker, info );
+                AddItemAndPopL( entry );
+                );
+
+            // Remove processed item
+            aList.Remove( i );
+            }
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsStacksL( CMemSpyEngineChunkList& aList )
+    {
+    CMemSpyEngine& engine = Engine();
+    CMemSpyEngineObjectContainer& container = engine.Container();
+    //
+    const TInt procCount = container.Count();
+    for( TInt p=0; p<procCount; p++ )
+        {
+        CMemSpyProcess& process = container.At( p );
+
+        // We've now sized the user-mode stacks for the process.
+        // Try to locate the stack/data chunk
+        const TInt index = aList.ItemIndexByProcessId( process.Id(), EMemSpyDriverChunkTypeStackAndProcessGlobalData );
+        if  ( index >= 0 )
+            {
+            const TMemSpyDriverChunkInfo& stackChunkInfo = aList.At( index ).Info();
+            //
+            const TInt threadCount = process.Count();
+            for( TInt t=0; t<threadCount; t++ )
+                {
+                CMemSpyThread& thread = process.At( t );
+                //
+                if  ( !thread.IsDead() )
+                    {
+                    TRAP_IGNORE( CreateSeedItemsStacksL( thread, stackChunkInfo ) );
+                    }
+                }
+            }
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsStacksL( CMemSpyThread& aThread, const TMemSpyDriverChunkInfo& aStackChunkInfo )
+    {
+    RThread rThread;
+    if  ( aThread.Open( rThread ) == KErrNone )
+        {
+        CleanupClosePushL( rThread );
+
+        TThreadStackInfo stackInfo;
+        if  ( rThread.StackInfo( stackInfo ) == KErrNone )
+            {
+            CMemSpyEngineHelperSysMemTrackerEntryStack* entry = CMemSpyEngineHelperSysMemTrackerEntryStack::NewLC( iTracker, aThread, aStackChunkInfo, stackInfo );
+            AddItemAndPopL( entry );
+            }
+
+        CleanupStack::PopAndDestroy( &rThread );
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsGlobalDataL( CMemSpyEngineChunkList& aList )
+    {
+    CMemSpyEngine& engine = Engine();
+    CMemSpyEngineObjectContainer& container = engine.Container();
+    //
+    const TInt chunkCount = aList.Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = aList.At( i ).Info();
+
+        if  ( info.iType == EMemSpyDriverChunkTypeGlobalData || info.iType == EMemSpyDriverChunkTypeStackAndProcessGlobalData )
+            {
+            // Need to get associated process
+            const TInt processIndex = container.ProcessIndexById( info.iOwnerId );
+            if  ( processIndex >= 0 )
+                {
+                CMemSpyProcess& process = container.At( processIndex );
+                //
+                if  ( info.iType == EMemSpyDriverChunkTypeGlobalData )
+                    {
+                    if ( !( i % 10 ) ) // Print the message on only every 10th cycle
+                        {
+                        RDebug::Print( KMemSpyKeepaliveMessage  );
+                        }
+                    // Pure global data, unique chunk
+                    TRAP_IGNORE( 
+                        CMemSpyEngineHelperSysMemTrackerGlobalData* entry = CMemSpyEngineHelperSysMemTrackerGlobalData::NewLC( iTracker, process, info );
+                        AddItemAndPopL( entry );
+                        );
+
+                    // Remove processed item
+                    aList.Remove( i );
+                    }
+                else if ( info.iType == EMemSpyDriverChunkTypeStackAndProcessGlobalData )
+                    {
+                    if ( !( i % 10 ) ) // Print the message on only every 10th cycle
+                        {
+                        RDebug::Print( KMemSpyKeepaliveMessage  );
+                        }
+                    // We don't check uniqueness as any stack entries share a common handle with the process
+                    // global data.
+                    TRAP_IGNORE( 
+                        CMemSpyEngineHelperSysMemTrackerGlobalData* entry = CMemSpyEngineHelperSysMemTrackerGlobalData::NewLC( iTracker, process, info );
+                        AddItemAndPopL( entry );
+                        );
+
+                    // Remove processed item
+                    aList.Remove( i );
+                    }
+                }
+            }
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsCodeL()
+    {
+    CMemSpyEngineCodeSegList* code = Engine().HelperCodeSegment().CodeSegmentListRamLoadedL();
+    CleanupStack::PushL( code );
+    //
+    const TInt count = code->Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineCodeSegEntry& info = code->At( i );
+        //
+        TRAP_IGNORE( 
+            CMemSpyEngineHelperSysMemTrackerEntryCode* entry = CMemSpyEngineHelperSysMemTrackerEntryCode::NewLC( iTracker, info );
+            AddItemAndPopL( entry );
+            );
+        }
+    //
+    CleanupStack::PopAndDestroy( code );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsHandlesL()
+    {
+    CMemSpyEngineGenericKernelObjectContainer* allContainers = Engine().HelperKernelContainers().ObjectsAllLightweightL();
+    CleanupStack::PushL( allContainers );
+    //
+    const TInt count = allContainers->Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineGenericKernelObjectList& list = allContainers->At( i );
+        //
+        const TInt entryCount = list.Count();
+        for( TInt j=0; j<entryCount; j++ )
+            {
+            TAny* handle = list.HandleAt( j );
+            CMemSpyEngineHelperSysMemTrackerEntry* entry = NULL;
+            //
+            TRAP_IGNORE( 
+                if  ( list.Type() == EMemSpyDriverContainerTypePropertyRef )
+                    {
+                    entry = CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS::NewLC( iTracker, handle );
+                    }
+                else
+                    {
+                    entry = CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric::NewLC( iTracker, handle, list.Type() );
+                    }
+
+                AddItemAndPopL( entry );
+                );
+            }
+        }
+    //
+    CleanupStack::PopAndDestroy( allContainers );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsOpenFilesL()
+    {
+    CMemSpyEngineOpenFileList* list = Engine().HelperFileSystem().ListOpenFilesLC();
+    //
+    const TInt threadCount = list->Count();
+    for( TInt t=0; t<threadCount; t++ )
+        {
+        const CMemSpyEngineOpenFileListForThread& thread = list->At( t );
+        //
+        const TInt entryCount = thread.Count();
+        for( TInt e=0; e<entryCount; e++ )
+            {
+            const CMemSpyEngineOpenFileListEntry& fileEntry = thread.At( e );
+            //
+            TRAP_IGNORE( 
+                CMemSpyEngineHelperSysMemTrackerEntryOpenFile* entry = CMemSpyEngineHelperSysMemTrackerEntryOpenFile::NewLC( iTracker, thread, fileEntry );
+                AddItemAndPopL( entry );
+                );
+            }
+        }
+    //
+    CleanupStack::PopAndDestroy( list );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsDiskSpaceL()
+    {
+    TDriveList list;
+    //
+    RFs& fsSession = Engine().FsSession();
+    if  ( fsSession.DriveList( list ) == KErrNone )
+        {
+        TDriveInfo info;
+        //
+        for( TInt i=0; i<KMaxDrives; i++ )
+            {
+            if  ( list[ i ] != KDriveAbsent )
+                {
+                if  ( fsSession.Drive( info, i ) == KErrNone )
+                    {
+                    TRAP_IGNORE( 
+                        CMemSpyEngineHelperSysMemTrackerEntryDiskSpace* entry = CMemSpyEngineHelperSysMemTrackerEntryDiskSpace::NewLC( iTracker, static_cast<TDriveNumber>( i ) );
+                        AddItemAndPopL( entry );
+                        );
+                    }
+                }
+            }
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsSystemMemoryL()
+    {
+    TRAP_IGNORE( 
+        CMemSpyEngineHelperSysMemTrackerEntrySystemMemory* entryT = CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::NewLC( iTracker, ETypeTotal );
+        AddItemAndPopL( entryT );
+        );
+    TRAP_IGNORE( 
+        CMemSpyEngineHelperSysMemTrackerEntrySystemMemory* entryF = CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::NewLC( iTracker, ETypeFree );
+        AddItemAndPopL( entryF );
+        );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsBitmapL( CMemSpyEngineChunkList& aList )
+    {
+    TInt bitmapConCount = 0;
+    TInt fontConCount = 0;
+    //
+    RArray<TInt> handles;
+    CleanupClosePushL( handles );
+    Engine().HelperFbServ().GetArrayOfBitmapHandlesL( handles, bitmapConCount, fontConCount );
+    //
+    const TInt count = handles.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const TInt handle = handles[ i ];
+        //
+        TRAP_IGNORE( 
+            CMemSpyEngineHelperSysMemTrackerEntryBitmap* entry = CMemSpyEngineHelperSysMemTrackerEntryBitmap::NewLC( iTracker, handle );
+            AddItemAndPopL( entry );
+            );
+        }
+    //
+    CleanupStack::PopAndDestroy( &handles );
+    
+    // Make overall fbserv info item
+    TMemSpyDriverChunkInfo infoChunkLarge;
+    TMemSpyDriverChunkInfo infoChunkShared;
+    //
+    const TInt chunkCount = aList.Count();
+    for( TInt i=chunkCount-1; i>=0; i-- )
+        {
+        const TMemSpyDriverChunkInfo& info = aList.At( i ).Info();
+        if  ( CMemSpyEngineHelperFbServ::IsSharedBitmapChunk( info ) )
+            {
+            SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsBitmapL() - found FbsSharedChunk..." ) );
+            infoChunkShared = info;
+            aList.Remove( i );
+            }
+        else if ( CMemSpyEngineHelperFbServ::IsLargeBitmapChunk( info ) )
+            {
+            SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsBitmapL() - found FbsLargeChunk..." ) );
+            infoChunkLarge = info;
+            aList.Remove( i );
+            }
+        }
+
+    TRAP_IGNORE( 
+        CMemSpyEngineHelperSysMemTrackerEntryFbserv* entry = CMemSpyEngineHelperSysMemTrackerEntryFbserv::NewLC( iTracker, infoChunkLarge, infoChunkShared, bitmapConCount, fontConCount, count );
+        AddItemAndPopL( entry );
+        );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsFileServerCacheL( CMemSpyEngineChunkList& aList )
+    {
+    TInt index = KErrNotFound;
+    const CMemSpyEngineChunkEntry* entry = Engine().HelperFileSystem().IdentifyCacheChunk( aList, index );
+    //
+    if  ( entry )
+        {
+        const TMemSpyDriverChunkInfo& info = entry->Info();
+        SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsFileServerCacheL() - found F32 cache chunk..." ) );
+        //
+        TRAP_IGNORE( 
+            CMemSpyEngineHelperSysMemTrackerEntryFileServerCache* entry = CMemSpyEngineHelperSysMemTrackerEntryFileServerCache::NewLC( iTracker, info );
+            AddItemAndPopL( entry );
+        );
+        //
+        aList.Remove( index );
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsWindowServerL()
+    {
+    if ( Engine().IsHelperWindowServerSupported() )
+        {
+        MMemSpyEngineHelperWindowServer& windowServerManager = Engine().HelperWindowServer();
+        MMemSpyEngineWindowGroupList* windowGroupList = windowServerManager.WindowGroupListL();
+        CleanupDeletePushL( windowGroupList );
+        TInt count = windowGroupList->Count();
+        TBool isFocused( EFalse );
+        for ( TInt i = 0; i < count; i++ )
+            {
+            TMemSpyEngineWindowGroupDetails windowGroupDetails;
+            windowServerManager.GetWindowGroupDetailsL( windowGroupList->At( i ).iId, windowGroupDetails );
+            windowGroupDetails.iOrdinalPosition = windowGroupList->At( i ).iOrdinalPosition;
+            if ( !isFocused && windowGroupDetails.iPriority == 0 )
+                {
+                windowGroupDetails.iIsFocused = ETrue;
+                isFocused = ETrue;
+                }
+            else
+                {
+                windowGroupDetails.iIsFocused = EFalse;
+                }
+            TRAP_IGNORE( 
+                CMemSpyEngineHelperSysMemTrackerEntryWindowServer* entry = CMemSpyEngineHelperSysMemTrackerEntryWindowServer::NewLC( iTracker, windowGroupDetails );
+                AddItemAndPopL( entry );
+                );
+            }
+        CleanupStack::PopAndDestroy( windowGroupList );
+        }
+    else
+        {
+        SYSMEMTRACKERLOG_PRINTF( RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerEntryManager::CreateSeedItemsWindowServerL() - Not supported" ) );
+        }
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryOpenFile.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,201 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryOpenFile.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperfilesystem.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+CMemSpyEngineHelperSysMemTrackerEntryOpenFile::CMemSpyEngineHelperSysMemTrackerEntryOpenFile( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeOpenFile )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryOpenFile::~CMemSpyEngineHelperSysMemTrackerEntryOpenFile()
+    {
+    delete iFileName;
+    delete iThreadName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryOpenFile::ConstructL( const CMemSpyEngineOpenFileListForThread& aThreadInfo, const CMemSpyEngineOpenFileListEntry& aEntryInfo )
+    {
+    // Get basic details
+    iThreadName = aThreadInfo.ThreadName().AllocL();
+    SetThread( aThreadInfo.ThreadId() );
+    SetProcess( aThreadInfo.ProcessId() );
+
+    // Set file details
+    iFileName = aEntryInfo.FileName().AllocL();
+    iSize = aEntryInfo.Size();
+    iUniqueFileId = aEntryInfo.UniqueFileId();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryOpenFile* CMemSpyEngineHelperSysMemTrackerEntryOpenFile::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const CMemSpyEngineOpenFileListForThread& aThreadInfo, const CMemSpyEngineOpenFileListEntry& aEntryInfo )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryOpenFile* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryOpenFile( aTracker );
+    CleanupStack::PushL( self );
+    self->ConstructL( aThreadInfo, aEntryInfo );
+    return self;
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntryOpenFile::Key() const
+    {
+    const TUint32 val = ( Type() << 28 ) + ( iUniqueFileId < 24 ) + ThreadId(); 
+    TUint64 ret = val;
+    ret <<= 32;
+    //
+    const TUint32 fileNameHash = MemSpyEngineUtils::Hash( *iFileName );
+    ret += fileNameHash;
+    //
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryOpenFile::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::NewLC( Attributes(), *iThreadName, *iFileName, iSize, iUniqueFileId );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryOpenFile::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    // Doesn't participate in direct memory usage and indirect usage cannot really be measured.
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile( TUint8 aAttribs, TInt aSize, TInt aUniqueFileId )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iSize( aSize ), iUniqueFileId( aUniqueFileId )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::~CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile()
+    {
+    delete iFileName;
+    delete iThreadName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::ConstructL( const TDesC& aThreadName, const TDesC& aFileName )
+    {
+    BaseConstructL();
+
+    // Save the thread name
+    iFileName = aFileName.AllocL();
+    iThreadName = aThreadName.AllocL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile* CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TDesC& aFileName, TInt aSize, TInt aUniqueFileId )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile( aAttribs, aSize, aUniqueFileId );
+    CleanupStack::PushL( self );
+    self->ConstructL( aThreadName, aFileName );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeOpenFile;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderLine, "Type, File Name, Thread, File Size, Instance Id, Attribs");
+    aSink.OutputLineL( KHeaderLine );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,%S,%d,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf( buf->Des() );
+
+    // Now output line
+    pBuf.Format( KFormat,
+                 &type,
+                 iFileName,
+                 iThreadName,
+                 iSize,
+                 iUniqueFileId,
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeOpenFile::OutputDataL( CMemSpyEngineOutputSink& /*aSink*/, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryRamDrive.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,212 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryRamDrive.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntryRamDrive::CMemSpyEngineHelperSysMemTrackerEntryRamDrive( CMemSpyEngineHelperSysMemTrackerImp& aTracker )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeRamDrive )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryRamDrive::~CMemSpyEngineHelperSysMemTrackerEntryRamDrive()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::ConstructL( const TMemSpyDriverChunkInfo& aInfo )
+    {
+    iCurrent = aInfo;
+    iLast = aInfo;
+    //
+    SetHandle( aInfo.iHandle );
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryRamDrive* CMemSpyEngineHelperSysMemTrackerEntryRamDrive::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryRamDrive* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryRamDrive( aTracker );
+    CleanupStack::PushL( self );
+    self->ConstructL( aInfo );
+    return self;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
+    {
+    const CMemSpyEngineHelperSysMemTrackerEntryRamDrive& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryRamDrive& >( aEntry );
+    
+    // Update state
+    iLast = iCurrent;
+    iCurrent = entry.iCurrent;
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntryRamDrive::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
+    {
+    const TBool hasChanged = ( iCurrent.iSize != iLast.iSize );
+    return hasChanged;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::NewLC( Attributes(), iCurrent, IsNew() ? NULL : &iLast );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    aCycle.AddToMemoryUsed( iCurrent.iSize );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::~CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive()
+    {
+    delete iLast;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::ConstructL( const TMemSpyDriverChunkInfo* aLast )
+    {
+    BaseConstructL();
+
+    // Save last heap data (if available)
+    if ( aLast )
+        {
+        iLast = new (ELeave) TMemSpyDriverChunkInfo();
+        *iLast = *aLast;
+        }
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent, const TMemSpyDriverChunkInfo* aLast )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive( aAttribs, aCurrent );
+    CleanupStack::PushL( self );
+    self->ConstructL( aLast );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeRamDrive;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderRamDrive, "Type, Chunk, Handle, Base Addr, Size, Max Size, Attribs");
+    aSink.OutputLineL( KHeaderRamDrive );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,0x%08x,0x%08x,%d,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+
+    // Now output line
+    pBuf.Format( KFormat, 
+                 &type,
+                 &iCurrent.iName,
+                 iCurrent.iHandle,
+                 iCurrent.iBaseAddress,
+                 iCurrent.iSize,
+                 iCurrent.iMaxSize,
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryStack.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,229 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryStack.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+CMemSpyEngineHelperSysMemTrackerEntryStack::CMemSpyEngineHelperSysMemTrackerEntryStack( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeStack ), iChunkInfo( aChunkInfo ), iStackInfo( aStackInfo )
+    {
+    SetHandle( aChunkInfo.iHandle );
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryStack::~CMemSpyEngineHelperSysMemTrackerEntryStack()
+    {
+    delete iThreadName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryStack::ConstructL( CMemSpyThread& aThread )
+    {
+    TFullName* name = new(ELeave) TFullName();
+    CleanupStack::PushL( name );
+    aThread.FullName( *name );
+    iThreadName = name->AllocL();
+    CleanupStack::PopAndDestroy( name );
+    //
+    SetThread( aThread.Id() );
+    SetProcess( aThread.Process().Id() );
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryStack* CMemSpyEngineHelperSysMemTrackerEntryStack::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, CMemSpyThread& aThread, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryStack* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryStack( aTracker, aChunkInfo, aStackInfo );
+    CleanupStack::PushL( self );
+    self->ConstructL( aThread );
+    return self;
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntryStack::Key() const
+    {
+    const TUint32 val = ( Type() << 28 ) + ThreadId(); 
+    TUint64 ret = val;
+    ret <<= 32;
+    ret += Handle();
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryStack::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeStack* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeStack::NewLC( Attributes(), *iThreadName, iChunkInfo, iStackInfo );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryStack::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    const TInt size = StackSize();
+    aCycle.AddToMemoryUsed( size );
+    }
+
+
+TInt CMemSpyEngineHelperSysMemTrackerEntryStack::StackSize() const
+    {
+    const TInt size = iStackInfo.iBase - iStackInfo.iLimit;
+    return size;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeStack::CMemSpyEngineHelperSysMemTrackerCycleChangeStack( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iChunkInfo( aChunkInfo ), iStackInfo( aStackInfo )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeStack::~CMemSpyEngineHelperSysMemTrackerCycleChangeStack()
+    {
+    delete iThreadName;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeStack::ConstructL( const TDesC& aThreadName )
+    {
+    BaseConstructL();
+
+    // Save the thread name
+    iThreadName = aThreadName.AllocL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeStack* CMemSpyEngineHelperSysMemTrackerCycleChangeStack::NewLC( TUint8 aAttribs, const TDesC& aThreadName, const TMemSpyDriverChunkInfo& aChunkInfo, const TThreadStackInfo& aStackInfo )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeStack* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeStack( aAttribs, aChunkInfo, aStackInfo );
+    CleanupStack::PushL( self );
+    self->ConstructL( aThreadName );
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeStack::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeStack;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeStack::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderStack, "Type, Thread, Chunk, Handle, Size, Attribs");
+    aSink.OutputLineL( KHeaderStack );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeStack::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,%S,0x%08x,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+
+    pBuf.Format( KFormat, 
+                 &type,
+                 iThreadName, 
+                 &iChunkInfo.iName,
+                 iChunkInfo.iHandle,
+                 StackSize(),
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeStack::OutputDataL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    CMemSpyEngine& engine = aSink.Engine();
+    }
+
+
+TInt CMemSpyEngineHelperSysMemTrackerCycleChangeStack::StackSize() const
+    {
+    const TInt size = iStackInfo.iBase - iStackInfo.iLimit;
+    return size;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntrySystemMemory.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,206 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntrySystemMemory.h"
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+#include <hal.h>
+#include <hal_data.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include "MemSpyEngineHelperSysMemTrackerImp.h"
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::CMemSpyEngineHelperSysMemTrackerEntrySystemMemory( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TSystemMemoryType aType )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeSystemMemory ), iType( aType )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::~CMemSpyEngineHelperSysMemTrackerEntrySystemMemory()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::ConstructL()
+    {
+    if ( iType == ETypeFree )
+        {
+        HAL::Get( HALData::EMemoryRAMFree, iCurrent );
+        }
+    else if ( iType == ETypeTotal )
+        {
+        HAL::Get( HALData::EMemoryRAM, iCurrent );
+        }
+    //
+    iLast = iCurrent;
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntrySystemMemory* CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, TSystemMemoryType aType )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntrySystemMemory* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntrySystemMemory( aTracker, aType );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::Key() const
+    {
+    const TUint32 val = ( Type() << 28 ); 
+    TUint64 ret = val;
+    ret <<= 32;
+    ret += static_cast<TInt>( iType );
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
+    {
+    const CMemSpyEngineHelperSysMemTrackerEntrySystemMemory& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntrySystemMemory& >( aEntry );
+    
+    // Update state
+    iLast = iCurrent;
+    iCurrent = entry.iCurrent;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::NewLC( Attributes(), iType, iCurrent, iLast );
+    aCycle.AddAndPopL( changeDescriptor );
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntrySystemMemory::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
+    {
+    const TBool hasChanged = ( iCurrent != iLast );
+    return hasChanged;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory( TUint8 aAttribs, TSystemMemoryType aType, TInt aCurrent, TInt aLast )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iType( aType ), iCurrent( aCurrent ), iLast( aLast )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::~CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory* CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::NewLC( TUint8 aAttribs, TSystemMemoryType aType, TInt aCurrent, TInt aLast )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory( aAttribs, aType, aCurrent, aLast );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeSystemMemory;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderSystemMemory, "Type, Name, Size, Attribs");
+    aSink.OutputLineL( KHeaderSystemMemory );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeSystemMemory::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%S,%d,%S" );
+    //
+    TMemSpySWMTTypeName category;
+    FormatType( category );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    _LIT( KTypeSystemMemoryFree, "Free" );
+    _LIT( KTypeSystemMemoryTotal, "Total" );
+    TBuf<20> type( KTypeSystemMemoryFree );
+    if ( iType == ETypeTotal )
+        {
+        type = KTypeSystemMemoryTotal;
+        }
+    //
+    aSink.OutputLineFormattedL( KFormat, &category, &type, iCurrent, &attribs );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerEntryWindowServer.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,242 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerEntryWindowServer.h"
+
+// User includes
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerEntryWindowServer::CMemSpyEngineHelperSysMemTrackerEntryWindowServer( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyEngineWindowGroupDetails& aWindowGroupDetails )
+:   CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeFbserv ), 
+    iCurrentWindowGroupDetails( aWindowGroupDetails ),
+    iLastWindowGroupDetails( aWindowGroupDetails )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryWindowServer::~CMemSpyEngineHelperSysMemTrackerEntryWindowServer()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryWindowServer::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerEntryWindowServer* CMemSpyEngineHelperSysMemTrackerEntryWindowServer::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyEngineWindowGroupDetails& aWindowGroupDetails )
+    {
+    CMemSpyEngineHelperSysMemTrackerEntryWindowServer* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryWindowServer( aTracker, aWindowGroupDetails );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+TUint64 CMemSpyEngineHelperSysMemTrackerEntryWindowServer::Key() const
+    {
+    return TUint64( iCurrentWindowGroupDetails.iId );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryWindowServer::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry )
+    {
+    const CMemSpyEngineHelperSysMemTrackerEntryWindowServer& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryWindowServer& >( aEntry );
+    iLastWindowGroupDetails = iCurrentWindowGroupDetails;
+    iCurrentWindowGroupDetails = entry.iCurrentWindowGroupDetails;
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerEntryWindowServer::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const
+    {
+    const TBool hasChanged = ( iCurrentWindowGroupDetails.iIsFocused != iLastWindowGroupDetails.iIsFocused ) ||
+                             ( iCurrentWindowGroupDetails.iCaption != iLastWindowGroupDetails.iCaption )
+                             ;
+    return hasChanged;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryWindowServer::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::TMemSpyWindowServerEvent event( CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::EMemSpyWindowServerEventNoEvent );
+    if ( iCurrentWindowGroupDetails.iCaption != iLastWindowGroupDetails.iCaption )
+        {
+        event = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::EMemSpyWindowServerEventNameChanged;
+        CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::NewLC( Attributes(), iCurrentWindowGroupDetails, event );
+        aCycle.AddAndPopL( changeDescriptor );
+        }
+    if ( iCurrentWindowGroupDetails.iIsFocused && !iLastWindowGroupDetails.iIsFocused )
+        {
+        event = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::EMemSpyWindowServerEventFocusGained;
+        CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::NewLC( Attributes(), iCurrentWindowGroupDetails, event );
+        aCycle.AddAndPopL( changeDescriptor );
+        }
+    if ( !iCurrentWindowGroupDetails.iIsFocused && iLastWindowGroupDetails.iIsFocused )
+        {
+        event = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::EMemSpyWindowServerEventFocusLost;
+        CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::NewLC( Attributes(), iCurrentWindowGroupDetails, event );
+        aCycle.AddAndPopL( changeDescriptor );
+        }
+    if ( event == CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::EMemSpyWindowServerEventNoEvent )
+        {
+        // If there were no events detected, it was a creation or deletion of a window group:
+        CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::NewLC( Attributes(), iCurrentWindowGroupDetails );
+        aCycle.AddAndPopL( changeDescriptor );        
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerEntryWindowServer::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup( TUint8 aAttribs, const TMemSpyEngineWindowGroupDetails aCurrent, TMemSpyWindowServerEvent aEvent )
+:   CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ),
+    iCurrentWindowGroupDetails( aCurrent ),
+    iEvent( aEvent )
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::~CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::NewLC( TUint8 aAttribs, const TMemSpyEngineWindowGroupDetails aCurrent, TMemSpyWindowServerEvent aEvent )
+    {
+    CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup( aAttribs, aCurrent, aEvent );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::Type() const
+    {
+    return EMemSpyEngineSysMemTrackerTypeWindowServer;
+    }
+   
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KHeaderWindowServer, "Type, Id, Name, Order, Event, Attribs");
+    aSink.OutputLineL( KHeaderWindowServer );
+    }
+ 
+
+void CMemSpyEngineHelperSysMemTrackerCycleChangeWindowGroup::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    _LIT( KFormat, "%S,%d,%S,%d,%d,%S" );
+    //
+    TMemSpySWMTTypeName type;;
+    FormatType( type );
+    //
+    TBuf<20> attribs;
+    FormatAttributes( attribs );
+    //
+    TFullName name;
+    if ( iCurrentWindowGroupDetails.iCaption.Length() )
+        {
+        name.Copy( iCurrentWindowGroupDetails.iCaption );
+        }
+    else
+        {
+        name.Copy( iCurrentWindowGroupDetails.iFullName );
+        }
+
+    HBufC* buf = HBufC::NewLC( 1024 );
+    TPtr pBuf(buf->Des());
+    
+    // Now output line
+    pBuf.Format( KFormat, 
+                 &type,
+                 //
+                 iCurrentWindowGroupDetails.iId,
+                 &name,
+                 iCurrentWindowGroupDetails.iOrdinalPosition, 
+                 iEvent,
+                 &attribs
+                 );
+
+    aSink.OutputLineL( pBuf );
+    CleanupStack::PopAndDestroy( buf );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerImp.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,287 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerImp.h"
+
+// System includes
+#include <e32debug.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerobserver.h>
+#include "MemSpyEngineHelperSysMemTrackerEntryManager.h"
+
+// Constants
+const TInt KMemSpyDefaultTrackerTimerPeriod = 30; // Seconds
+
+
+CMemSpyEngineHelperSysMemTrackerImp::CMemSpyEngineHelperSysMemTrackerImp( CMemSpyEngine& aEngine )
+:   CTimer( EPriorityStandard ), iEngine( aEngine )
+    {
+    CActiveScheduler::Add( this );
+    iConfig.iTimerPeriod = TTimeIntervalMicroSeconds32( KMemSpyDefaultTrackerTimerPeriod * 1000000 );
+    }
+
+    
+CMemSpyEngineHelperSysMemTrackerImp::~CMemSpyEngineHelperSysMemTrackerImp()
+    {
+    Cancel();
+    //
+    delete iEntryManager;
+    //
+    iCompletedCycles.ResetAndDestroy();
+    iCompletedCycles.Close();
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::ConstructL()
+    {
+    CTimer::ConstructL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerImp* CMemSpyEngineHelperSysMemTrackerImp::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperSysMemTrackerImp* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerImp( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::StartL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
+    {
+    TRACE( RDebug::Printf("CMemSpyEngineHelperSysMemTrackerImp::StartL() - START - timer period: %d", Config().TimerPeriod().Int() ) );
+
+    // Zap any old data
+    Reset();
+
+    // Cache client settings
+    iConfig = aConfig;
+
+    // Make new cycle
+    PrepareInitialCycleL();
+
+    // Start tracking via timer - future updates will by driven by RunL().
+    After( Config().TimerPeriod() );
+    TRACE( RDebug::Printf("CMemSpyEngineHelperSysMemTrackerImp::END() - START - timer period: %d", Config().TimerPeriod().Int() ) );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::StopL()
+    {
+    Cancel();
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::SetObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::RemoveObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver )
+    {
+    if  ( iObserver == aObserver )
+        {
+        iObserver = NULL;
+        }
+    }
+
+
+const RPointerArray< CMemSpyEngineHelperSysMemTrackerCycle >& CMemSpyEngineHelperSysMemTrackerImp::CompletedCycles() const
+    {
+    return iCompletedCycles;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::Reset()
+    {
+    Cancel();
+    iCompletedCycles.ResetAndDestroy();
+    //
+    if  ( iObserver )
+        {
+        TRAP_IGNORE( iObserver->HandleCyclesResetL() );
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::CheckForChangesNowL()
+    {
+    const TInt count = iCompletedCycles.Count();
+    TRACE( RDebug::Printf("CMemSpyEngineHelperSysMemTrackerImp::CheckForChangesNowL() - START - isActive: %d, cycleCount: %d", IsActive(), count ) );
+
+    if  ( IsActive() )
+        {
+        Cancel();
+        CheckForChangesL();
+        After( Config().TimerPeriod() );
+        }
+    else
+        {
+        // Timer not running, so we're probably being poked by some external-to-memspy client that
+        // wants to force an update.
+        //
+        // If we've never yet performed an initital cycle, then prep that. Otherwise, just proceed as normal
+        // as if we had been called back via RunL().
+        if  ( count == 0 )
+            {
+            PrepareInitialCycleL();
+            }
+        else
+            {
+            CheckForChangesL();
+            }
+        }
+
+    TRACE( RDebug::Printf("CMemSpyEngineHelperSysMemTrackerImp::CheckForChangesNowL() - END - isActive: %d, cycleCount: %d", IsActive(), iCompletedCycles.Count() ) );
+    }
+
+
+TInt CMemSpyEngineHelperSysMemTrackerImp::MdcaCount() const
+    {
+    return iCompletedCycles.Count();
+    }
+
+
+TPtrC CMemSpyEngineHelperSysMemTrackerImp::MdcaPoint( TInt aIndex ) const
+    {
+    const CMemSpyEngineHelperSysMemTrackerCycle* cycleInfo = iCompletedCycles[ aIndex ];
+    const TPtrC ret( cycleInfo->Caption() );
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::NotifyObserverCycleStartedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    if  ( iObserver )
+        {
+        TRAP_IGNORE( iObserver->HandleCycleStartedL( aCycle ) );
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::NotifyObserverCycleFinishedL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    if  ( iObserver )
+        {
+        TRAP_IGNORE( iObserver->HandleCycleFinishedL( aCycle ) );
+        aCycle.DiscardChanges();
+        }
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::AddCycleAndPopL( CMemSpyEngineHelperSysMemTrackerCycle* aCycle )
+    {
+    iCompletedCycles.AppendL( aCycle );
+    CleanupStack::Pop( aCycle );
+    aCycle->FinalizeL();
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerCycle* CMemSpyEngineHelperSysMemTrackerImp::LastCycleOrNull()
+    {
+    CMemSpyEngineHelperSysMemTrackerCycle* ret = NULL;
+    //
+    const TInt count = iCompletedCycles.Count();
+    if  ( count )
+        {
+        ret = iCompletedCycles[ count - 1 ];
+        }
+    //
+    return ret;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::PrepareInitialCycleL()
+    {
+    // Create seed items
+    CMemSpyEngineHelperSysMemTrackerEntryManager* entryManager = CMemSpyEngineHelperSysMemTrackerEntryManager::NewL( *this );
+    delete iEntryManager;
+    iEntryManager = entryManager;
+
+    // Everything changes on the first cycle.
+    CMemSpyEngineHelperSysMemTrackerCycle* baselineCycle = CMemSpyEngineHelperSysMemTrackerCycle::NewLC( iConfig );
+    NotifyObserverCycleStartedL( *baselineCycle );
+    iEntryManager->EverythingHasChangedL( *baselineCycle );
+    AddCycleAndPopL( baselineCycle );
+    NotifyObserverCycleFinishedL( *baselineCycle );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::CheckForChangesL()
+    {
+    // Create info structure 
+    CMemSpyEngineHelperSysMemTrackerCycle* cycle = CMemSpyEngineHelperSysMemTrackerCycle::NewLC( iConfig, LastCycleOrNull() );
+
+    // Notify 
+    NotifyObserverCycleStartedL( *cycle );
+
+    // Find changes
+    iEntryManager->IdentifyChangesL( *cycle );
+
+    // Finalise the cycle and save it
+    AddCycleAndPopL( cycle );
+
+    // Notify
+    NotifyObserverCycleFinishedL( *cycle );
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerImp::RunL()
+    {
+    CheckForChangesL();
+    After( Config().TimerPeriod() );
+    }
+
+
+TInt CMemSpyEngineHelperSysMemTrackerImp::RunError( TInt aError )
+    {
+    RDebug::Printf( "CMemSpyEngineHelperSysMemTrackerImp::RunError() - aError: %d", aError );
+    (void) aError;
+    //
+    Cancel();
+    After( Config().TimerPeriod() );
+    //
+    return KErrNone;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/SysMemTracker/MemSpyEngineHelperSysMemTrackerOutputFormatter.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* 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 "MemSpyEngineHelperSysMemTrackerOutputFormatter.h"
+
+// System includes
+#include <e32debug.h>
+
+// User includes
+#include "MemSpyEngineOutputListItem.h"
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyenginehelperrom.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
+
+// Constants
+_LIT( KMemSpyHeapDeltaTrackerFormatPrefix, "[MemSpy] [SMT %04d] " );
+_LIT( KMemSpyHeapDeltaTrackerFormatHeaderStart, "<SYSTEM WIDE MEMORY TRACKER>" );
+_LIT( KMemSpyHeapDeltaTrackerFormatFooterEnd, "</SYSTEM WIDE MEMORY TRACKER>" );
+const TInt KMemSpySWMTDataFileFormat = 2;
+
+
+CMemSpyEngineHelperSysMemTrackerOutputFormatter::CMemSpyEngineHelperSysMemTrackerOutputFormatter( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+    
+CMemSpyEngineHelperSysMemTrackerOutputFormatter::~CMemSpyEngineHelperSysMemTrackerOutputFormatter()
+    {
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerOutputFormatter::ConstructL()
+    {
+    }
+
+
+CMemSpyEngineHelperSysMemTrackerOutputFormatter* CMemSpyEngineHelperSysMemTrackerOutputFormatter::NewL( CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineHelperSysMemTrackerOutputFormatter* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerOutputFormatter( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerOutputFormatter::SetConfig( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
+    {
+    iConfig = aConfig;
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerOutputFormatter::OutputL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineOutputSink& sink = iEngine.Sink();
+    CMemSpyEngineHelperSysMemTrackerCycle& cycle = const_cast<CMemSpyEngineHelperSysMemTrackerCycle&>( aCycle );
+
+    // Set up prefix for info listing
+    sink.OutputPrefixSetFormattedLC( KMemSpyHeapDeltaTrackerFormatPrefix, aCycle.CycleNumber() );
+
+    // Begin a new data stream for heap info
+    _LIT( KMemSpyFolder1, "System Wide MT" );
+    _LIT( KMemSpyContext1, "Summary - Cycle %03d" );
+    HBufC* context1 = HBufC::NewLC( KMaxFileName );
+    TPtr pContext1( context1->Des() );
+    pContext1.Format( KMemSpyContext1, aCycle.CycleNumber() );
+    sink.DataStreamBeginL( pContext1, KMemSpyFolder1 );
+    CleanupStack::PopAndDestroy( context1 );
+
+    // Output overall header for cycle
+    OutputOverallHeaderL( cycle );
+
+    // Output the cycle information
+    TMemSpyEngineSysMemTrackerType lastType = EMemSpyEngineSysMemTrackerTypeCount;
+	const TInt changedCount = cycle.ChangeCount();
+	for( TInt j=0; j<changedCount; j++ )
+		{
+		CMemSpyEngineHelperSysMemTrackerCycleChange& item = cycle.ChangeAt( j );
+        const TMemSpyEngineSysMemTrackerType type = item.Type();
+
+        // Header (if needed)
+        if  ( HaveTypesChanged( type, lastType ) )
+            {
+            lastType = type;
+
+            CMemSpyEngineOutputSink& sink = iEngine.Sink();
+            sink.OutputBlankLineL();
+            sink.OutputBlankLineL();
+            item.OutputHeaderL( sink, cycle );
+            }
+        
+        // Content
+        TRAP_IGNORE( item.OutputContentL( sink, cycle ) );
+        }
+   
+    // Now dump the data for any changed entries
+    if  ( iConfig.DumpData() )
+        {
+		for( TInt j=0; j<changedCount; j++ )
+			{
+			CMemSpyEngineHelperSysMemTrackerCycleChange& item = cycle.ChangeAt( j );
+            TRAP_IGNORE( item.OutputDataL( sink, cycle ) );
+			}
+		}
+
+    // Output overall footer for cycle
+    OutputOverallFooterL( cycle );
+
+    // End summary data stream
+    sink.DataStreamEndL();
+		
+	CleanupStack::PopAndDestroy(); // prefix
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerOutputFormatter::OutputOverallHeaderL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+    {
+    CMemSpyEngineOutputSink& sink = iEngine.Sink();
+    sink.OutputBlankLineL();
+    sink.OutputBlankLineL();
+    sink.OutputBlankLineL();
+    sink.OutputBlankLineL();
+    //
+    sink.OutputLineL( KMemSpyHeapDeltaTrackerFormatHeaderStart );
+    sink.OutputBlankLineL();
+
+    // Lines
+    CMemSpyEngineOutputList* list = CMemSpyEngineOutputList::NewLC( sink );
+    
+    _LIT( KLine0, "File format version" );
+    list->AddItemL( KLine0, KMemSpySWMTDataFileFormat );
+
+    _LIT( KLine1, "Cycle number" );
+    list->AddItemL( KLine1, aCycle.CycleNumber() );
+
+    _LIT( KLine2, "Time" );
+    list->AddItemL( KLine2, aCycle.TimeFormatted() );
+
+    _LIT( KLine3, "Change count" );
+    list->AddItemL( KLine3, aCycle.ChangeCount() );
+
+    _LIT( KLine4, "Free memory (now)" );
+    list->AddItemL( KLine4, aCycle.MemoryFree() );
+
+    _LIT( KLine5, "Free memory (previous)" );
+    list->AddItemL( KLine5, aCycle.MemoryFreePreviousCycle() );
+
+    _LIT( KLine6, "MemSpy (RAM)" );
+    list->AddItemL( KLine6, User::Heap().Size() );
+
+    // Add ROM info
+    iEngine.HelperROM().AddInfoL( *list );
+
+    list->PrintL();
+    CleanupStack::PopAndDestroy( list );
+
+    sink.OutputBlankLineL();
+    sink.OutputBlankLineL();
+    }
+
+
+void CMemSpyEngineHelperSysMemTrackerOutputFormatter::OutputOverallFooterL( CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+    {
+    CMemSpyEngineOutputSink& sink = iEngine.Sink();
+    //
+    sink.OutputBlankLineL();
+    sink.OutputBlankLineL();
+    sink.OutputLineL( KMemSpyHeapDeltaTrackerFormatFooterEnd );
+    sink.OutputBlankLineL();
+    sink.OutputBlankLineL();
+    }
+
+
+TBool CMemSpyEngineHelperSysMemTrackerOutputFormatter::HaveTypesChanged( TInt aLeft, TInt aRight )
+    {
+    TBool ret = ( aLeft != aRight );
+    //
+    if ( ret )
+        {
+        // Check whether heap types are kernel vs user. We silently ignore this change.
+        if ( ( aLeft == EMemSpyEngineSysMemTrackerTypeHeapUser && aRight == EMemSpyEngineSysMemTrackerTypeHeapKernel ) ||
+             ( aLeft == EMemSpyEngineSysMemTrackerTypeHeapKernel && aRight == EMemSpyEngineSysMemTrackerTypeHeapUser ) )
+            {
+            ret = EFalse;
+            }
+        }
+    //
+    return ret;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObject.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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 <memspy/engine/memspyengineobject.h>
+
+
+EXPORT_C CMemSpyEngineObject::CMemSpyEngineObject()
+    {
+    Open();
+    }
+
+
+EXPORT_C CMemSpyEngineObject::CMemSpyEngineObject( CMemSpyEngineObject& aParent )
+:   iParent( &aParent )
+    {
+    Open();
+    }
+
+
+CMemSpyEngineObject::~CMemSpyEngineObject()
+    {
+    }
+
+
+EXPORT_C TInt CMemSpyEngineObject::AccessCount() const
+    {
+    __ASSERT_ALWAYS( iAccessCount >= 0, User::Invariant() );
+    return iAccessCount;
+    }
+
+
+EXPORT_C void CMemSpyEngineObject::Close()
+    {
+    __ASSERT_ALWAYS( iAccessCount >= 0, User::Invariant() );
+    if  ( --iAccessCount <= 0 )
+        {
+        delete this;
+        }
+    }
+
+
+EXPORT_C void CMemSpyEngineObject::Open()
+    {
+    __ASSERT_ALWAYS( iAccessCount >= 0, User::Invariant() );
+    ++iAccessCount;
+    }
+
+
+EXPORT_C CMemSpyEngineObject* CMemSpyEngineObject::Parent() const
+    {
+    return iParent;
+    }
+
+
+EXPORT_C void CMemSpyEngineObject::SetParent( CMemSpyEngineObject* aParent )
+    {
+    iParent = aParent;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectContainer.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,958 @@
+/*
+* 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 <memspy/engine/memspyengineobjectcontainer.h>
+
+// System includes
+#include <e32svr.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperstack.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+
+// Literal constants
+_LIT(KProcessFilter, "*");
+_LIT(KEKernProcessName, "ekern");
+
+
+CMemSpyEngineObjectContainer::CMemSpyEngineObjectContainer( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+	/*
+    TFindProcess procFinder( KProcessFilter );
+    TFullName nextMatch;
+    //
+    while( procFinder.Next( nextMatch ) == KErrNone )
+        {
+        _LIT(KProcListing, "%S");
+        RDebug::Print(KProcListing, &nextMatch);
+
+
+        _LIT(KFindMask, "*");
+        nextMatch += KFindMask;
+        //
+        TFindThread threadFinder( nextMatch );
+        //
+        while( threadFinder.Next( nextMatch ) == KErrNone )
+            {
+            _LIT(KThreadListing, "+--- %S");
+            RDebug::Print(KThreadListing, &nextMatch);
+            }
+        }
+	*/
+    }
+
+
+CMemSpyEngineObjectContainer::~CMemSpyEngineObjectContainer()
+    {
+    DestroyProcesses( iGarbage );
+    DestroyProcesses( iProcesses );
+    delete iUndertaker;
+    delete iMidwife;
+    delete iIdleNotifyContainerChanged;
+    }
+
+
+void CMemSpyEngineObjectContainer::ConstructL( const TDesC& aFilter )
+    {
+    iUndertaker = CMemSpyEngineUndertaker::NewL( iEngine.Driver() );
+    iUndertaker->AddObserverL( *this );
+    //
+    iMidwife = CMemSpyEngineMidwife::NewL( iEngine.Driver() );
+    iMidwife->AddObserverL( *this );
+    //
+    iIdleNotifyContainerChanged = CIdle::NewL( CActive::EPriorityIdle );
+    //
+    RefreshL( aFilter );
+    }
+
+
+CMemSpyEngineObjectContainer* CMemSpyEngineObjectContainer::NewL( CMemSpyEngine& aEngine )
+    {
+    return NewL( KProcessFilter, aEngine );
+    }
+
+
+CMemSpyEngineObjectContainer* CMemSpyEngineObjectContainer::NewL( const TDesC& aFilter, CMemSpyEngine& aEngine )
+    {
+    CMemSpyEngineObjectContainer* self = new(ELeave) CMemSpyEngineObjectContainer( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL( aFilter );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineObjectContainer::Count() const
+    {
+    return iProcesses.Count();
+    }
+
+
+EXPORT_C TInt CMemSpyEngineObjectContainer::CountAll() const
+    {
+    TInt ret = 0;
+    //
+    const TInt count = iProcesses.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        CMemSpyProcess* process = iProcesses[ i ];
+        ret += process->Count();
+        }
+    //
+    return ret;
+    }
+
+
+EXPORT_C void CMemSpyEngineObjectContainer::RefreshL()
+    {
+    RefreshL( KProcessFilter );
+    }
+
+
+EXPORT_C void CMemSpyEngineObjectContainer::RefreshL( const TDesC& aFilter )
+    {
+    LocateProcessesL( aFilter );
+    }
+
+
+EXPORT_C CMemSpyProcess& CMemSpyEngineObjectContainer::At( TInt aIndex ) const
+    {
+    CMemSpyProcess* ret = iProcesses[ aIndex ];
+    return *ret;
+    }
+
+
+EXPORT_C CMemSpyProcess& CMemSpyEngineObjectContainer::ProcessByIdL( TProcessId aId ) const
+    {
+    CMemSpyProcess* ret = NULL;
+    //
+    const TInt count = iProcesses.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        CMemSpyProcess* process = iProcesses[ i ];
+        if  ( process->Id() == aId )
+            {
+            ret = process;
+            break;
+            }
+        }
+    //
+    if  ( ret == NULL )
+        {
+        User::Leave( KErrNotFound );
+        }
+    //
+    return *ret;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineObjectContainer::ProcessIndexById( TProcessId aId ) const
+    {
+    TInt index = KErrNotFound;
+    //
+    const TInt count = iProcesses.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyProcess* process = iProcesses[ i ];
+        if  ( process->Id() == aId )
+            {
+            index = i;
+            break;
+            }
+        }
+    //
+    return index;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineObjectContainer::ProcessAndThreadByThreadId( TThreadId aTid, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const
+    {
+    aProcess = NULL;
+    aThread = NULL;
+    TInt error = KErrNotFound;
+    //
+    const TInt count = iProcesses.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        CMemSpyProcess* process = iProcesses[ i ];
+
+        // Check whether this process contains the thread we are looking for...
+        const TInt index = process->ThreadIndexById( aTid );
+        if  ( index >= 0 )
+            {
+            // Found it
+            aProcess = process;
+            aThread = &process->At( index );
+            error = KErrNone;
+            break;
+            }
+        }
+    //
+    if  ( error == KErrNotFound )
+        {
+        CMemSpyEngineObjectContainer* self = const_cast< CMemSpyEngineObjectContainer* >( this );
+        TRAP( error, self->TryToCreateProcessAndThreadL( aTid, aProcess, aThread ) );
+        }
+    //
+    return error;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineObjectContainer::ProcessAndThreadByFullName( const TDesC& aFullName, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const
+    {
+    aProcess = NULL;
+    aThread = NULL;
+    TInt error = KErrNotFound;
+    //
+    const TInt count = iProcesses.Count();
+    for( TInt i=0; i<count && aThread == NULL; i++ )
+        {
+        CMemSpyProcess& process = *iProcesses[ i ];
+        const TInt threadCount = process.Count();
+        //
+        for(TInt j=0; j<threadCount; j++)
+            {
+            CMemSpyThread& thread = process.At( j );
+            const TFullName threadName( thread.FullName() );
+            //
+            if  ( threadName.CompareF( aFullName ) == 0 )
+                {
+                // Found it
+                aProcess = &process;
+                aThread = &thread;
+                error = KErrNone;
+                break;
+                }
+            }
+
+        }
+    //
+    if  ( error == KErrNotFound )
+        {
+        // NB: cannot use driver API as we must open thread by name, and that only supports opening
+        // by id.
+        RThread thread;
+        error = thread.Open( aFullName );
+        if ( error == KErrNone )
+            {
+            const TThreadId threadId = thread.Id();
+            thread.Close();
+
+            CMemSpyEngineObjectContainer* self = const_cast< CMemSpyEngineObjectContainer* >( this );
+            TRAP( error, self->TryToCreateProcessAndThreadL( threadId, aProcess, aThread ) );
+            }
+        }
+    //
+    return error;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineObjectContainer::ProcessAndThreadByPartialName( const TDesC& aPartialName, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const
+    {
+    aProcess = NULL;
+    aThread = NULL;
+    TInt error = KErrNotFound;
+    //
+    const TInt count = iProcesses.Count();
+    for( TInt i=0; i<count && aThread == NULL; i++ )
+        {
+        CMemSpyProcess& process = *iProcesses[ i ];
+        const TInt threadCount = process.Count();
+        //
+        for(TInt j=0; j<threadCount; j++)
+            {
+            CMemSpyThread& thread = process.At( j );
+            const TFullName threadName( thread.FullName() );
+            //
+            if  ( threadName.FindF( aPartialName ) >= 0 )
+                {
+                // Found it
+                aProcess = &process;
+                aThread = &thread;
+                error = KErrNone;
+                break;
+                }
+            }
+
+        }
+    //
+    return error;
+    }
+
+
+EXPORT_C TBool CMemSpyEngineObjectContainer::IsAlive( TProcessId aPid ) const
+    {
+    const TInt processIndex = ProcessIndexById( aPid );
+    return ( processIndex >= 0 );
+    }
+
+
+EXPORT_C TBool CMemSpyEngineObjectContainer::IsAlive( TProcessId aPid, TThreadId aTid ) const
+    {
+    TBool isAlive = IsAlive( aPid );
+    if  ( isAlive )
+        {
+        const TInt processIndex = ProcessIndexById( aPid );
+        const CMemSpyProcess& process = At( processIndex );
+
+        // Check whether the thread is alive
+        isAlive = ( process.ThreadIndexById( aTid ) >= 0 );
+        }
+    //
+    return isAlive;
+    }
+
+
+EXPORT_C TInt CMemSpyEngineObjectContainer::MdcaCount() const
+    {
+    return iProcesses.Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyEngineObjectContainer::MdcaPoint(TInt aIndex) const
+    {
+    const CMemSpyProcess* process = iProcesses[ aIndex ];
+    return TPtrC( process->NameForListBox() );
+    }
+
+
+void CMemSpyEngineObjectContainer::LocateProcessesL( const TDesC& aFilter )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineObjectContainer::LocateProcessesL() - START" );
+#endif
+    DestroyProcesses( iProcesses );
+    //
+    const TProcessId myProcessId = RProcess().Id();
+	//
+    TFindProcess finder( aFilter );
+    TFullName nextMatch;
+    //
+    while( finder.Next( nextMatch ) == KErrNone )
+        {
+        if  ( nextMatch.FindF(KEKernProcessName) == KErrNotFound )
+            {
+#ifdef _DEBUG
+            RDebug::Print(_L( "CMemSpyEngineObjectContainer::LocateProcessesL() - found Proc: %S"), &nextMatch );
+#endif
+
+            RProcess p;
+            const TInt r = p.Open( nextMatch );
+            TProcessId processId( KNullProcessId );
+            if ( r == KErrNone )
+                {
+                processId = p.Id();
+                }
+            p.Close();
+
+#ifdef _DEBUG
+            RDebug::Printf( "CMemSpyEngineObjectContainer::LocateProcessesL() - open err: %d", r );
+#endif
+
+            if  ( r == KErrNone )
+                {
+                if  ( processId != myProcessId )
+                    {
+                    TRAPD( err, CreateProcessL( processId ) );
+#ifdef _DEBUG
+                    RDebug::Printf( "CMemSpyEngineObjectContainer::LocateProcessesL() - CreateProcessL err: %d", err );
+#endif
+                    err = err;
+                    }
+                }
+            }
+        }
+    //
+    SortByName();
+
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyEngineObjectContainer::LocateProcessesL() - END" );
+#endif
+    }
+
+
+CMemSpyProcess* CMemSpyEngineObjectContainer::CreateProcessL( const TProcessId& aId )
+    {
+#ifdef _DEBUG
+	RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::CreateProcessL() - START - pid: 0x%04x", (TUint) aId );
+#endif
+
+    CMemSpyProcess* processObj = CMemSpyProcess::NewLC( aId, iEngine );
+    const TPtrC pName( processObj->Name() );
+
+    if  ( pName.FindF( KEKernProcessName ) == KErrNotFound )
+        {
+        if  ( processObj->Count() == 0 )
+            {
+            // Calls delete
+#ifdef _DEBUG
+	        RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::CreateProcessL() - process has no threads... deleting it!" );
+#endif
+            processObj->Close();
+            processObj = NULL;
+            }
+        else
+            {
+            // Make sure we don't add duplicate processes...
+            AppendL( processObj );
+            }
+        }
+    else
+        {
+        // We don't support kernel-side threads
+#ifdef _DEBUG
+        RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::CreateProcessL() - kernel process... deleting it!" );
+#endif
+        processObj->Close();
+        processObj = NULL;
+        }
+
+    CleanupStack::Pop();
+
+#ifdef _DEBUG
+    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::CreateProcessL() - END - pid: 0x%04x, processObj: 0x%08x", (TUint) aId, processObj );
+#endif
+    return processObj;
+    }
+
+
+void CMemSpyEngineObjectContainer::DestroyProcesses( RArray< CMemSpyProcess* >& aList )
+    {
+    while( aList.Count() ) 
+        {
+        CMemSpyProcess* process = aList[ 0 ];
+        aList.Remove( 0 );
+        process->Close();
+        }
+
+    aList.Close();
+    }
+
+
+void CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL( const TThreadId& aTid, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(1) - START - aTid: 0x%04x", (TUint) aTid );
+#endif
+
+    // Must open thread and process in order to get process id.
+    RThread thread;
+    User::LeaveIfError( iEngine.Driver().OpenThread( aTid, thread ) );
+    CleanupClosePushL( thread );
+    RProcess process;
+    User::LeaveIfError( thread.Process( process ) );
+    const TProcessId processId = process.Id();
+    process.Close();
+
+    // Call overload
+    TryToCreateProcessAndThreadL( thread, aProcess, aThread );
+
+    CleanupStack::PopAndDestroy( &thread );
+
+#ifdef _DEBUG
+    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(1) - END - aTid: 0x%04x", (TUint) aTid );
+#endif
+    }
+
+
+void CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL( const RThread& aRThread, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - START - aTid: 0x%04x", (TUint) aRThread.Id() );
+#endif
+
+    // Full name of process
+    TFullName* name = new(ELeave) TFullName();
+    CleanupStack::PushL( name );
+
+    // Must open thread and process in order to get process id.
+    RProcess process;
+    User::LeaveIfError( aRThread.Process( process ) );
+    process.FullName( *name );
+    const TProcessId processId = process.Id();
+    process.Close();
+
+    const TBool isKernel = ( name->FindF( KEKernProcessName ) >= KErrNone );
+
+#ifdef _DEBUG
+    RDebug::Print( _L("[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - pid: 0x%04x, name: %S"), (TUint) processId, name );
+#endif
+
+    CleanupStack::PopAndDestroy( name );
+
+    // See if we have already created a process for this process id...
+    CMemSpyProcess* processObj = NULL;
+    const TInt procIndex = ProcessIndexById( processId );
+
+#ifdef _DEBUG
+    RDebug::Print( _L("[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - pid: 0x%04x, index: %d"), (TUint) processId, procIndex );
+#endif
+
+    if  ( isKernel )
+        {
+#ifdef _DEBUG
+        RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - caller requested a kernel thread/process..." );
+#endif
+        __ASSERT_ALWAYS( procIndex == KErrNotFound, MemSpyEngineUtils::Panic( EMemSpyEnginePanicEncounteredKernelUnexpectedly ) );
+
+#ifdef _DEBUG
+        RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - leaving with KErrNotSupported" );
+#endif
+        User::Leave( KErrNotSupported );
+        }
+    else if ( aRThread.Id() == RThread().Id() )
+        {
+        TRACE( RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - trying to create MemSpy -> leaving with KErrNotSupported" ) );
+        User::Leave( KErrNotSupported );
+        }
+    else
+        {
+        if  ( procIndex >= 0 )
+            {
+            // Existing process, but new thread?
+            processObj = iProcesses[ procIndex ];
+
+            // Make new thread
+            processObj->HandleThreadIsBornL( aRThread.Id() );
+            }
+        else
+            {
+            // Must also create a new process. This should, in theory, ensure
+            // the thread is also created.
+            processObj = CMemSpyProcess::NewLC( processId, iEngine );
+            if  ( processObj->Count() == 0 )
+                {
+                // No threads, discard process and leave
+                User::Leave( KErrNotFound );
+                }
+            else
+                {
+                // Save process
+                AppendL( processObj );
+                }
+
+            // Tidy up
+            CleanupStack::Pop();
+            }
+
+        // Check to see if the process contains the specified thread (it should do, since we just found
+        // the process using it).
+        CMemSpyThread& threadObj = processObj->ThreadByIdL( aRThread.Id() );
+
+        // We're done now.
+        aProcess = processObj;
+        aThread = &threadObj;
+
+        // Update sort order
+        Resort();
+
+        // Signal UI        
+        AsyncNotifyUiOfContainerChanges();
+        }
+
+#ifdef _DEBUG
+    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::TryToCreateProcessAndThreadL(2) - END - aTid: 0x%04x, pid: 0x%04x", (TUint) aRThread.Id(), (TUint) processId );
+#endif
+    }
+
+
+void CMemSpyEngineObjectContainer::Resort()
+    {
+    switch( iSortType )
+        {
+    case ESortById:
+        {
+        TLinearOrder< CMemSpyProcess* > comparer( CompareById );
+        iProcesses.Sort( comparer );
+        }
+        break;
+    default:
+    case ESortByName:
+        {
+        TLinearOrder< CMemSpyProcess* > comparer( CompareByName );
+        iProcesses.Sort( comparer );
+        }
+        break;
+    case ESortByThreadCount:
+        {
+        TLinearOrder< CMemSpyProcess* > comparer( CompareByThreadCount );
+        iProcesses.Sort( comparer );
+        }
+        break;
+    case ESortByCodeSegs:
+        {
+        TLinearOrder< CMemSpyProcess* > comparer( CompareByCodeSegs );
+        iProcesses.Sort( comparer );
+        }
+        break;
+    case ESortByHeapUsage:
+        {
+        TLinearOrder< CMemSpyProcess* > comparer( CompareByHeapUsage );
+        iProcesses.Sort( comparer );
+        }
+        break;
+    case ESortByStackUsage:
+        {
+        TLinearOrder< CMemSpyProcess* > comparer( CompareByStackUsage );
+        iProcesses.Sort( comparer );
+        }
+        break;
+        }
+    }
+
+
+EXPORT_C void CMemSpyEngineObjectContainer::SortById()
+    {
+    iSortType = ESortById;
+    Resort();
+    }
+
+
+EXPORT_C void CMemSpyEngineObjectContainer::SortByName()
+    {
+    iSortType = ESortByName;
+    Resort();
+    }
+
+
+EXPORT_C void CMemSpyEngineObjectContainer::SortByThreadCount()
+    {
+    iSortType = ESortByThreadCount;
+    Resort();
+    }
+
+
+EXPORT_C void CMemSpyEngineObjectContainer::SortByCodeSegs()
+    {
+    iSortType = ESortByCodeSegs;
+    Resort();
+    }
+
+
+EXPORT_C void CMemSpyEngineObjectContainer::SortByHeapUsage()
+    {
+    iSortType = ESortByHeapUsage;
+    Resort();
+    }
+
+
+EXPORT_C void CMemSpyEngineObjectContainer::SortByStackUsage()
+    {
+    iSortType = ESortByStackUsage;
+    Resort();
+    }
+
+
+void CMemSpyEngineObjectContainer::Remove( CMemSpyProcess& aProcess )
+    {
+    const TInt index = ProcessIndexById( aProcess.Id() );
+    if ( index >= 0 )
+        {
+        iProcesses.Remove( index );
+        }
+    }
+    
+    
+void CMemSpyEngineObjectContainer::AppendL( CMemSpyProcess* aProcess )
+    {
+    const TInt error = iProcesses.Append( aProcess );
+    User::LeaveIfError( error );    
+    }
+
+
+TInt CMemSpyEngineObjectContainer::CompareById( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
+    {
+    TInt ret = 1;
+    //
+    if  ( aLeft->Id() < aRight->Id() )
+        {
+        ret = -1;
+        }
+    else if ( aLeft->Id() == aRight->Id() )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineObjectContainer::CompareByThreadCount( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
+    {
+    TInt ret = -1;
+    //
+    if  ( aLeft->Count() < aRight->Count() )
+        {
+        ret = 1;
+        }
+    else if ( aLeft->Count() == aRight->Count() )
+        {
+        // Sort by name when thread counts are the same
+        ret = aLeft->Name().CompareF( aRight->Name() );
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineObjectContainer::CompareByName( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
+    {
+    return aLeft->Name().CompareF( aRight->Name() );
+    }
+
+
+TInt CMemSpyEngineObjectContainer::CompareByCodeSegs( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
+    {
+    CMemSpyEngine& engine = aLeft->Engine();
+    CMemSpyEngineHelperCodeSegment& helper = engine.HelperCodeSegment();
+    //
+    TInt leftCount = 0;
+    TInt rightCount = 0;
+    //
+    TRAP_IGNORE( 
+        CMemSpyEngineCodeSegList* leftList = helper.CodeSegmentListL( aLeft->Id() );
+        leftCount = leftList->Count();
+        delete leftList;
+        //
+        CMemSpyEngineCodeSegList* rightList = helper.CodeSegmentListL( aRight->Id() );
+        rightCount = rightList->Count();
+        delete rightList;
+        );
+    //
+    TInt ret = -1;
+    //
+    if  ( leftCount < rightCount )
+        {
+        ret = 1;
+        }
+    else if ( leftCount == rightCount )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineObjectContainer::CompareByHeapUsage( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
+    {
+    CMemSpyEngine& engine = aLeft->Engine();
+    CMemSpyEngineHelperHeap& helper = engine.HelperHeap();
+    //
+    TInt leftSize = 0;
+    TInt rightSize = 0;
+    //
+    TRAP_IGNORE( 
+        RArray< TMemSpyHeapInfo > leftInfos;
+        CleanupClosePushL( leftInfos );
+        helper.GetHeapInfoUserL( *aLeft, leftInfos );
+        const TInt leftCount = leftInfos.Count();
+        for( TInt i=0; i<leftCount; i++ )
+            {
+            const TMemSpyHeapInfo& info = leftInfos[ i ];
+            if ( info.Type() != TMemSpyHeapInfo::ETypeUnknown )
+                {
+                leftSize += (TInt) info.AsRHeap().MetaData().iHeapSize;
+                }
+            }
+        CleanupStack::PopAndDestroy( &leftInfos );
+        );
+    //
+    TRAP_IGNORE( 
+        RArray< TMemSpyHeapInfo > rightInfos;
+        CleanupClosePushL( rightInfos );
+        helper.GetHeapInfoUserL( *aRight, rightInfos );
+        const TInt rightCount = rightInfos.Count();
+        for( TInt i=0; i<rightCount; i++ )
+            {
+            const TMemSpyHeapInfo& info = rightInfos[ i ];
+            if ( info.Type() == TMemSpyHeapInfo::ETypeUnknown )
+                {
+                rightSize += (TInt) info.AsRHeap().MetaData().iHeapSize;
+                }
+            }
+        CleanupStack::PopAndDestroy( &rightInfos );
+        );
+    //
+    TInt ret = -1;
+    //
+    if  ( leftSize < rightSize )
+        {
+        ret = 1;
+        }
+    else if ( leftSize == rightSize )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+TInt CMemSpyEngineObjectContainer::CompareByStackUsage( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight )
+    {
+    CMemSpyEngine& engine = aLeft->Engine();
+    CMemSpyEngineHelperStack& helper = engine.HelperStack();
+    //
+    const TInt leftCount = helper.CalculateStackSizes( *aLeft );
+    const TInt rightCount = helper.CalculateStackSizes( *aRight );
+    //
+    TInt ret = -1;
+    //
+    if  ( leftCount < rightCount )
+        {
+        ret = 1;
+        }
+    else if ( leftCount == rightCount )
+        {
+        ret = 0;
+        }
+    //
+    return ret;
+    }
+
+
+TBool CMemSpyEngineObjectContainer::MoveToGarbageL( const TProcessId& aId )
+    {
+    const TInt pos = ProcessIndexById( aId );
+
+    if  ( pos >= 0 )
+        {
+        CMemSpyProcess* proc = iProcesses[ pos ];
+
+#ifdef _DEBUG
+        const TPtrC pName( proc->Name() );
+        RDebug::Print( _L("[MemSpy] CMemSpyEngineObjectContainer::MoveToGarbageL() - pid: 0x%04x, proc: 0x%08x, pos: %d, id: 0x%04x, name: %S"), (TUint) aId, proc, pos, (TUint) proc->Id(), &pName );
+#endif
+
+        User::LeaveIfError( iGarbage.Append( proc ) );
+        iProcesses.Remove( pos );
+        }
+	else
+        {
+#ifdef _DEBUG
+        RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::MoveToGarbageL() - pid: 0x%04x, pos: KErrNotFound", (TUint) aId );
+#endif
+        }
+        
+    return ( pos >= 0 );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+void CMemSpyEngineObjectContainer::ThreadIsDeadL( const TThreadId& aId, const RThread& aThread )
+    {
+    // Try to find the thread in question...
+    CMemSpyProcess* process = NULL;
+    CMemSpyThread* thread = NULL;
+    //
+    const TInt err = ProcessAndThreadByThreadId( aId, process, thread );
+    if  ( err == KErrNone && thread )
+        {
+        // This will force the thread to detect if it is dead or not...
+        thread->SetDeadL( aThread );
+
+        // Signal UI        
+        AsyncNotifyUiOfContainerChanges();
+        }
+    }
+    
+
+void CMemSpyEngineObjectContainer::ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess )
+    {
+    const TInt index = ProcessIndexById( aId );
+    if  ( index >= 0 )
+        {
+        CMemSpyProcess* process = iProcesses[ index ];
+        process->SetDeadL( aProcess );
+
+        // Signal UI        
+        AsyncNotifyUiOfContainerChanges();
+        }
+    }
+
+
+void CMemSpyEngineObjectContainer::ThreadIsBornL( const TThreadId& /*aId*/, const RThread& aThread )
+    {
+    if  ( aThread.Handle() != KNullHandle )
+        {
+        // The thread and process objects that will be created (or found, if they already exist).
+        CMemSpyProcess* process = NULL;
+        CMemSpyThread* thread = NULL;
+
+        // Create the objects if needed
+        TryToCreateProcessAndThreadL( aThread, process, thread );
+        }
+    }
+
+
+void CMemSpyEngineObjectContainer::ProcessIsBornL( const TProcessId& aId, const RProcess& /*aProcess*/ )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::ProcessIsBornL() - START - pid: 0x%04x", (TUint) aId );
+#endif
+    (void) aId;
+
+    // This gets handled by the new thread creation. When the first thread in the process
+    // is created, we'll also prepare a new process object.
+
+#ifdef _DEBUG
+	RDebug::Printf( "[MemSpy] CMemSpyEngineObjectContainer::ProcessIsBornL() - END - pid: 0x%04x", (TUint) aId );
+#endif
+    }
+    
+
+void CMemSpyEngineObjectContainer::AsyncNotifyUiOfContainerChanges()
+    {
+    iIdleNotifyContainerChanged->Cancel();
+    iIdleNotifyContainerChanged->Start( TCallBack( NotifyUiOfContainerChanges, this ) );
+    }
+
+
+TBool CMemSpyEngineObjectContainer::NotifyUiOfContainerChanges( TAny* aSelf )
+    {
+    CMemSpyEngineObjectContainer* self = reinterpret_cast< CMemSpyEngineObjectContainer* >( aSelf );
+    TRAP_IGNORE( self->iEngine.NotifyContainerChangeL() );
+    return EFalse;
+    }
+
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectProcess.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,651 @@
+/*
+* 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 <memspy/engine/memspyengineobjectprocess.h>
+
+// System includes
+#include <e32svr.h>
+#include <u32std.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+#include <memspy/driver/memspydriverpanics.h> // for terminate
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+
+// Literal constants
+_LIT( KMemSpyUnknownProcessName, "Unknown" );
+_LIT( KMemSpyUnknownExitCategory, "Unknown ExitCat" );
+_LIT( KMemSpyStandardProcessExtension, ".exe" );
+
+
+CMemSpyProcess::CMemSpyProcess( TProcessId aId, CMemSpyEngine& aEngine  )
+:   iId( aId ), iEngine( aEngine )
+    {
+    }
+
+
+CMemSpyProcess::~CMemSpyProcess()
+    {
+#ifdef _DEBUG
+    if  ( iName != NULL )
+        {
+        RDebug::Print(_L( "MEMSPY - dtor - CMemSpyProcess() - this: 0x%08x, name: %S"), this, iName);
+        }
+    else
+        {
+        RDebug::Printf( "MEMSPY - dtor - CMemSpyProcess() - this: 0x%08x", this );
+        }
+#endif
+
+    CloseAllThreads();
+    iThreads.Close();
+    delete iName;
+    delete iInfo;
+    }
+
+
+void CMemSpyProcess::ConstructL()
+    {
+    iInfo = new(ELeave) TMemSpyDriverProcessInfo();
+
+    RMemSpyDriverClient& driver = iEngine.Driver();
+    RProcess process;
+    User::LeaveIfError( driver.OpenProcess( iId, process ) );
+    CleanupClosePushL( process );
+
+    // Find the threads before we start tinkering with the process
+    // name
+    LocateThreadsL( process );
+
+    // Now build the process name
+    RefreshL( process );
+
+    CleanupStack::PopAndDestroy( &process );
+
+    
+#ifdef _DEBUG
+    if  ( iName != NULL )
+        {
+        RDebug::Print(_L( "MEMSPY - ctor - CMemSpyProcess() - this: 0x%08x, name: %S"), this, iName);
+        }
+    else
+        {
+        RDebug::Printf( "MEMSPY - ctor - CMemSpyProcess() - this: 0x%08x", this );
+        }
+#endif
+    }
+
+
+EXPORT_C CMemSpyProcess* CMemSpyProcess::NewL( const CMemSpyProcess& aCopyMe )
+    {
+    CMemSpyProcess* self = NewL( aCopyMe.Id(), aCopyMe.iEngine );
+    return self;
+    }
+
+
+CMemSpyProcess* CMemSpyProcess::NewL( TProcessId aId, CMemSpyEngine& aEngine )
+    {
+    CMemSpyProcess* self = CMemSpyProcess::NewL( aId, aEngine );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CMemSpyProcess* CMemSpyProcess::NewLC( TProcessId aId, CMemSpyEngine& aEngine )
+    {
+    CMemSpyProcess* self = new(ELeave) CMemSpyProcess( aId, aEngine );
+    CleanupClosePushL( *self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyProcess::Close()
+    {
+    if  ( !OpenOrCloseInProgress() )
+        {
+        const TInt ac = AccessCount();
+        SetOpenOrCloseInProgress( ETrue );
+
+        // Calling close can do a "delete this" so make sure
+        // we don't try to access the object again in that situation...
+        CMemSpyEngineObject::Close();
+        if  ( ac - 1 > 0 )
+            {
+            SetOpenOrCloseInProgress( EFalse );
+            }
+        else
+            {
+            // We don't care - we've just been deleted!
+            }
+        }
+    }
+
+
+EXPORT_C void CMemSpyProcess::Open()
+    {
+    if  ( !OpenOrCloseInProgress() )
+        {
+        SetOpenOrCloseInProgress( ETrue );
+        CMemSpyEngineObject::Open();
+        SetOpenOrCloseInProgress( EFalse );
+        }
+    }
+
+
+EXPORT_C TInt CMemSpyProcess::MdcaCount() const
+    {
+    return iThreads.Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyProcess::MdcaPoint(TInt aIndex) const
+    {
+    const CMemSpyThread* thread = iThreads[ aIndex ];
+    return TPtrC( thread->NameForListBox() );
+    }
+
+
+EXPORT_C TInt CMemSpyProcess::ThreadIndexById( TThreadId aId ) const
+    {
+    TInt index = KErrNotFound;
+    //
+    const TInt count = iThreads.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyThread* thread = iThreads[ i ];
+        if  ( thread->Id() == aId )
+            {
+            index = i;
+            break;
+            }
+        }
+    //
+    return index;
+    }
+
+
+EXPORT_C CMemSpyThread& CMemSpyProcess::ThreadByIdL( TThreadId aId ) const
+    {
+    CMemSpyThread* ret = NULL;
+    //
+    const TInt count = iThreads.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        CMemSpyThread* thread = iThreads[ i ];
+        if  ( thread->Id() == aId )
+            {
+            ret = thread;
+            break;
+            }
+        }
+    //
+    if  ( ret == NULL )
+        {
+        User::Leave( KErrNotFound );
+        }
+    //
+    return *ret;
+    }
+
+
+
+EXPORT_C TPtrC CMemSpyProcess::Name() const
+    {
+    // Just return the pure name, minus the leading tab
+    TPtrC pRet( iName->Mid(2) );
+    
+    // Find the last tab position
+    TInt pos = pRet.Locate(TChar('\t'));
+    if  ( pos > 0 )
+        {
+        pRet.Set( pRet.Left( pos ) );
+        }
+    //    
+    return pRet;
+    }
+
+
+EXPORT_C CMemSpyThread& CMemSpyProcess::At( TInt aIndex ) const
+    {
+    CMemSpyThread* ret = iThreads[ aIndex ];
+    return *ret;
+    }
+
+
+EXPORT_C void CMemSpyProcess::TerminateL()
+    {
+    RMemSpyDriverClient& driver = iEngine.Driver();
+    RProcess process;
+    User::LeaveIfError( driver.OpenProcess( iId, process ) );
+    process.Terminate( EPanicForcedTerminate );
+    process.Close();
+    //
+    RefreshL();
+    }
+
+
+EXPORT_C void CMemSpyProcess::KillL()
+    {
+    RMemSpyDriverClient& driver = iEngine.Driver();
+    RProcess process;
+    User::LeaveIfError( driver.OpenProcess( iId, process ) );
+    process.Kill( EPanicForcedKill );
+    process.Close();
+    //
+    RefreshL();
+    }
+
+
+EXPORT_C void CMemSpyProcess::PanicL()
+    {
+    RMemSpyDriverClient& driver = iEngine.Driver();
+    RProcess process;
+    User::LeaveIfError( driver.OpenProcess( iId, process ) );
+    process.Panic( KMemSpyClientPanic, EPanicForcedPanic );
+    process.Close();
+    //
+    RefreshL();
+    }
+
+
+EXPORT_C TBool CMemSpyProcess::IsSystemPermanent() const
+    {
+    const TBool ret = ( iInfo->iFlags & KProcessFlagSystemPermanent );
+    return ret;
+    }
+
+
+EXPORT_C TBool CMemSpyProcess::IsSystemCritical() const
+    {
+    const TBool ret = ( iInfo->iFlags & KProcessFlagSystemCritical );
+    return ret;
+    }
+
+
+void CMemSpyProcess::LocateThreadsL( RProcess& aProcess )
+    {
+    __ASSERT_ALWAYS( aProcess.Handle() != KNullHandle, MemSpyEngineUtils::Panic( EMemSpyEnginePanicProcessHandleNullWhenAttemptingToIdentifyThreads ) );
+
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyProcess::LocateThreadsL() - START - this: 0x%08x, pid: %d (0x%04x)", this, (TUint) aProcess.Id(), (TUint) aProcess.Id() );
+#endif
+
+    RArray<TThreadId> threadIds;
+    CleanupClosePushL( threadIds );
+
+    // Get list of child threads from driver.
+    iEngine.Driver().GetThreadsL( aProcess.Id(), threadIds );
+
+    // Create therad object for each thread the driver returned to us...
+    const TInt count = threadIds.Count();
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyProcess::LocateThreadsL() - got %d threads", count );
+#endif
+
+    for( TInt i=0; i<count; i++ )
+        {
+        const TThreadId threadId( threadIds[ i ] );
+#ifdef _DEBUG
+        RDebug::Printf("CMemSpyProcess::LocateThreadsL() - thread id: %d (0x%04d)", (TUint) threadId, (TUint) threadId );
+#endif
+        //
+        TRAP_IGNORE( 
+            CMemSpyThread* threadObj = CMemSpyThread::NewLC( threadId, *this );
+            iThreads.AppendL( threadObj );
+            CleanupStack::Pop( threadObj );
+            );
+        }
+
+    // Tidy up
+    CleanupStack::PopAndDestroy( &threadIds );
+    
+#ifdef _DEBUG
+    RDebug::Printf("CMemSpyProcess::LocateThreadsL() - END - this: 0x%08x, pid: %d (0x%04x), thread count: %d", this, (TUint) aProcess.Id(), (TUint) aProcess.Id(), iThreads.Count() );
+#endif
+    }
+
+
+void CMemSpyProcess::AppendPriority( TDes& aDes, TProcessPriority aPriority )
+    {
+    switch( aPriority )
+        {
+    case EPriorityLow:
+        aDes += _L("[L]");
+        break;
+    case EPriorityBackground:
+        aDes += _L("[B]");
+        break;
+    case EPriorityForeground:
+        aDes += _L("[F]");
+        break;
+    case EPriorityHigh:
+        aDes += _L("[H]");
+        break;
+    case EPriorityWindowServer:
+        aDes += _L("[WS]");
+        break;
+    case EPriorityFileServer:
+        aDes += _L("[FS]");
+        break;
+    case EPriorityRealTimeServer:
+        aDes += _L("[RTS]");
+        break;
+    case EPrioritySupervisor:
+        aDes += _L("[SUP]");
+        break;
+    default:
+        aDes += _L("[?]");
+        break;
+        }
+    }
+
+
+void CMemSpyProcess::GetFileName( TFileName& aFileName )
+    {
+    // Fallback
+    const TPtrC pNameCleaned( Name() );
+    aFileName.Zero();
+    aFileName.AppendFormat( _L("%S.exe"), &pNameCleaned );
+
+    // Try to get the proper name
+    RProcess process;
+    RMemSpyDriverClient& driver = iEngine.Driver();
+    if  ( driver.OpenProcess( iId, process ) == KErrNone )
+        {
+        aFileName = process.FileName();
+        process.Close();
+        }
+    }
+
+void CMemSpyProcess::RefreshL()
+    {
+    RMemSpyDriverClient& driver = iEngine.Driver();
+    RProcess process;
+
+    // Deliberately ignore error - the other overload of RefreshL can cope with
+    // a null handle.
+    driver.OpenProcess( iId, process );
+    CleanupClosePushL( process );
+
+    RefreshL( process );
+
+    CleanupStack::PopAndDestroy( &process );
+    }
+
+
+void CMemSpyProcess::RefreshL( const RProcess& aProcess )
+    {
+    const TBool handleValid = aProcess.Handle() != KNullHandle;
+    if  ( handleValid )
+        {
+        RMemSpyDriverClient& driver = iEngine.Driver();
+        User::LeaveIfError( driver.GetProcessInfo( iId, *iInfo ) );
+        }
+
+    // Get priority, exit info etc
+    iExitType = handleValid ? aProcess.ExitType() : EExitKill;
+    iPriority = handleValid ? aProcess.Priority() : EPriorityForeground;
+
+    // If the process is dead then we may not be able to get some attributes
+    // (it depends on whether the thread handle is valid anymore).
+    iExitReason = 0;
+    iExitCategory.Zero();
+
+    if  ( IsDead() )
+        {
+        if  ( handleValid )
+            {
+            iExitReason = aProcess.ExitReason();
+            iExitCategory = aProcess.ExitCategory(); 
+            }
+        else
+            {
+            iExitCategory = KMemSpyUnknownExitCategory;
+            }
+        }
+    else
+        {
+        // We only reset the flags if the process is still alive.
+        // If it is dead (i.e. 'if' branch) then we do not reset because
+        // we have no way to fetch them any more.
+        iFlags = EFlagsNone;
+        }
+
+    // Get raw process name and check whether it includes .exe suffix
+    TBool includesExecutableSuffix = EFalse;
+    HBufC* rawProcessName = GetProcessNameLC( aProcess, includesExecutableSuffix );
+    if ( includesExecutableSuffix )
+        {
+        iFlags |= EFlagsIncludedExecutableWithinName;
+        }
+
+    // Format priority as string
+    TBuf<10> priority;
+    AppendPriority( priority, iPriority );
+
+    // Convert the full name to the format we want in the UI
+    TBuf<KMaxFullName + 60> name;
+    TMemSpyTruncateOverflow overflow;
+
+    // FOR ALIVE PROCESSES:
+    //
+    // 1] Space, followed by tab
+    // 2] Process name (minus .exe)
+    // 3] Tab, Tab
+    // 4] Process uid
+    // 5] Thread count
+    // 6] Process priority
+    //
+    // FOR DEAD PROCESSES:
+    //
+    // 1] Space, followed by tab
+    // 2] Process name (minus .exe)
+    // 3] Tab, Tab
+    // 4] Process uid
+    // 5] Exit info
+
+    // Common
+    _LIT( KMemSpyProcessNameFormatSpecBasicName, " \t%S\t\t%8x, " );
+    name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, rawProcessName, iInfo->SID() );
+    CleanupStack::PopAndDestroy( rawProcessName );
+
+    if  ( IsDead() )
+        {
+        CMemSpyThread::AppendExitInfo( name, iExitType, iExitReason, iExitCategory );
+        }
+    else
+        {
+        _LIT( KMemSpyProcessNameFormatSpecAlive, "%2d thr, %S" );
+        name.AppendFormat( KMemSpyProcessNameFormatSpecAlive, &overflow, iThreads.Count(), &priority );
+        }
+
+    // Save end result
+    HBufC* finalName = name.AllocL();
+    delete iName;
+    iName = finalName;
+    }
+
+
+void CMemSpyProcess::SetDeadL()
+    {
+    RefreshL();
+    }
+
+
+void CMemSpyProcess::SetDeadL( const RProcess& aProcess )
+    {
+    RefreshL( aProcess );
+    }
+
+
+EXPORT_C TBool CMemSpyProcess::IsDead() const
+    {
+    const TBool isDead = ( iExitType != EExitPending );
+    return  isDead;
+    }
+
+
+EXPORT_C TUint32 CMemSpyProcess::SID() const
+    {
+    return iInfo->SID();
+    }
+
+
+EXPORT_C TUint32 CMemSpyProcess::VID() const
+    {
+    return iInfo->VID();
+    }
+
+EXPORT_C TProcessPriority CMemSpyProcess::Priority() const
+	{
+	return iPriority;
+	}
+
+EXPORT_C TExitCategoryName CMemSpyProcess::ExitCategory() const
+	{
+	return iExitCategory;
+	}
+
+EXPORT_C TInt CMemSpyProcess::ExitReason() const
+	{
+	return iExitReason;
+	}
+
+EXPORT_C TExitType CMemSpyProcess::ExitType() const
+	{
+	return iExitType;
+	}
+
+EXPORT_C TUidType CMemSpyProcess::UIDs() const
+    {
+    return iInfo->iUids;
+    }
+
+
+EXPORT_C SCapabilitySet CMemSpyProcess::Capabilities() const
+    {
+    return iInfo->iSecurityInfo.iCaps;
+    }
+
+void CMemSpyProcess::FullName( TDes& aFullName ) const
+    {
+    // c32exe.exe[101f7989]0001
+    aFullName.Zero();
+    aFullName.Append( Name() );
+    if ( iFlags & EFlagsIncludedExecutableWithinName )
+        {
+        // Add .exe
+        aFullName.Append( KMemSpyStandardProcessExtension );
+        }
+
+    aFullName.Append( '[' );
+	aFullName.AppendNumFixedWidth( iInfo->iUids[ 2 ].iUid, EHex, 8 );
+    aFullName.Append( ']' );
+	aFullName.AppendNumFixedWidth( iInfo->iGeneration, EDecimal, 4 );
+    }
+
+
+void CMemSpyProcess::HandleThreadIsBornL( const TThreadId& aId )
+    {
+    // A new thread has been created in this process. Just in case, we'll
+    // check there isn't already an existing thread with the same id...
+    const TInt index = ThreadIndexById( aId );
+    if  ( index < 0 )
+        {
+        TRAP_IGNORE( 
+            CMemSpyThread* threadObj = CMemSpyThread::NewLC( aId, *this );
+            iThreads.AppendL( threadObj );
+            CleanupStack::Pop( threadObj );
+            );
+        }
+    }
+
+
+HBufC* CMemSpyProcess::GetProcessNameLC( const RProcess& aProcessOrNull, TBool& aProcessNameIncludesExeSuffix ) const
+    {
+    _LIT( KMemSpySquareBraceOpen, "[" );
+    //
+    TFullName processName;
+    
+    // Assume the flags have already been set once previously in order to form default response
+    aProcessNameIncludesExeSuffix = ( iFlags & EFlagsIncludedExecutableWithinName );
+
+    const TBool handleValid = aProcessOrNull.Handle() != KNullHandle;
+    if  ( handleValid )
+        {
+        // Easy case - we have a valid thread handle...
+        //
+        // Get full name, e.g.:
+        //
+        // c32exe.exe[101f7989]0001
+        aProcessOrNull.FullName( processName );
+
+        // ... but we need to clean up the name so that it
+        // doesn't include the process UID, and neither does it
+        // include the extension (.exe).
+        TInt pos = processName.FindF( KMemSpySquareBraceOpen );
+        if  ( pos > 0 )
+            {
+            processName.SetLength( pos );
+            }
+        
+        // Discard '.exe'
+        pos = processName.FindF( KMemSpyStandardProcessExtension );
+        if  ( pos > 0 )
+            {
+            aProcessNameIncludesExeSuffix = ETrue;
+            processName.SetLength( pos );
+            }
+        }
+    else
+        {
+        // Since we don't have the possibility to enquire after the process's name
+        // we'll assume that it used to be alive and therefore at some point we did
+        // manage to grep it's name...
+        if  ( iName )
+            {
+            const TPtrC pOriginalName( Name() );
+            processName.Append( pOriginalName );
+            }
+        else
+            {
+            // Don't have a process handle, don't have any possibility to get the
+            // name from a prior cached version. Must use "unknown"
+            processName.Append( KMemSpyUnknownProcessName );
+            }
+        }
+    //
+    HBufC* ret = processName.AllocLC();
+    return ret;
+    }
+
+
+void CMemSpyProcess::CloseAllThreads()
+    {
+    const TInt count = iThreads.Count();
+    for(TInt i=count-1; i>=0; i--)
+        {
+        CMemSpyThread* thread = iThreads[ i ];
+        thread->Close();
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThread.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,532 @@
+/*
+* 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 <memspy/engine/memspyengineobjectthread.h>
+
+// System includes
+#include <e32svr.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverclient.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+
+// Constants
+_LIT( KMemSpyUnknownExitCategory, "Unknown ExitCat" );
+_LIT( KMemSpyUnknownThreadName, "Unknown Thread" );
+_LIT( KMemSpyThreadDoubleColon, "::" );
+
+
+CMemSpyThread::CMemSpyThread( TThreadId aId, CMemSpyProcess& aProcess )
+:   CMemSpyEngineObject( aProcess ), iId( aId ), iProcess( &aProcess )
+    {
+    }
+
+
+CMemSpyThread::~CMemSpyThread()
+    {
+    if  ( iInfoContainer )
+        {
+        iInfoContainer->Close();
+        }
+    delete iName;
+    }
+
+
+void CMemSpyThread::ConstructL()
+    {
+    RefreshL();
+    }
+
+
+CMemSpyThread* CMemSpyThread::NewL( TThreadId aId, CMemSpyProcess& aProcess )
+    {
+    CMemSpyThread* self = CMemSpyThread::NewLC( aId, aProcess );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CMemSpyThread* CMemSpyThread::NewLC( TThreadId aId, CMemSpyProcess& aProcess )
+    {
+    CMemSpyThread* self = new(ELeave) CMemSpyThread( aId, aProcess );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+EXPORT_C void CMemSpyThread::Open()
+    {
+    if  ( !OpenOrCloseInProgress() )
+        {
+        SetOpenOrCloseInProgress( ETrue );
+        CMemSpyEngineObject::Open();
+        SetOpenOrCloseInProgress( EFalse );
+        }
+    }
+
+
+EXPORT_C void CMemSpyThread::Close()
+    {
+    if  ( !OpenOrCloseInProgress() )
+        {
+        SetOpenOrCloseInProgress( ETrue );
+        CMemSpyEngineObject::Close();
+        SetOpenOrCloseInProgress( EFalse );
+        }
+    }
+
+
+void CMemSpyThread::AppendPriority( TDes& aDes, TThreadPriority aPriority )
+    {
+    switch( aPriority )
+        {
+    case EPriorityNull:
+        aDes += _L("[Null]");
+        break;
+    case EPriorityMuchLess:
+        aDes += _L("[Much Less]");
+        break;
+    case EPriorityLess:
+        aDes += _L("[Less]");
+        break;
+    case EPriorityNormal:
+        aDes += _L("[Normal]");
+        break;
+    case EPriorityMore:
+        aDes += _L("[More]");
+        break;
+    case EPriorityMuchMore:
+        aDes += _L("[Much More]");
+        break;
+    case EPriorityRealTime:
+        aDes += _L("[Real Time]");
+        break;
+
+    // Absolute values
+    case EPriorityAbsoluteVeryLow:
+        aDes += _L("[Abs Very Low]");
+        break;
+    case EPriorityAbsoluteLowNormal:
+        aDes += _L("[Abs Low Norm]");
+        break;
+    case EPriorityAbsoluteLow:
+        aDes += _L("[Abs Low]");
+        break;
+    case EPriorityAbsoluteBackground:
+        aDes += _L("[Abs Bgnd]");
+        break;
+    case EPriorityAbsoluteBackgroundNormal:
+        aDes += _L("[Abs Bgnd Norm]");
+        break;
+    case EPriorityAbsoluteForeground:
+        aDes += _L("[Abs Fgnd]");
+        break;
+    case EPriorityAbsoluteForegroundNormal:
+        aDes += _L("[Abs Fgnd Norm]");
+        break;
+    case EPriorityAbsoluteHigh:
+        aDes += _L("[Abs High]");
+        break;
+    case EPriorityAbsoluteHighNormal:
+        aDes += _L("[Abs High Norm]");
+        break;
+    case EPriorityAbsoluteRealTime1:
+    case EPriorityAbsoluteRealTime2:
+    case EPriorityAbsoluteRealTime3:
+    case EPriorityAbsoluteRealTime4:
+    case EPriorityAbsoluteRealTime5:
+    case EPriorityAbsoluteRealTime6:
+    case EPriorityAbsoluteRealTime7:
+    case EPriorityAbsoluteRealTime8:
+        aDes.AppendFormat( _L("[Abs RT %d]"), ( aPriority - EPriorityAbsoluteRealTime1 ) + 1 );
+        break;
+    default:
+        aDes += _L("[Unknown Pri.]");
+        break;
+        }
+    }
+
+
+void CMemSpyThread::AppendExitType( TDes& aDes, TExitType aType )
+    {
+    _LIT( KExitTypeKilled, "Killed" );
+    _LIT( KExitTypeTerminated, "Terminated" );
+    _LIT( KExitTypePanicked, "Panicked" );
+    _LIT( KExitTypePending, "Pending" );
+    
+    // Panic and Terminate are exceptional exit conditions.
+    // Kill, is ironically, not an exceptional condition.
+    switch( aType )
+        {
+    case EExitKill:
+        aDes += KExitTypeKilled;
+        break;
+    case EExitTerminate:
+        aDes += KExitTypeTerminated;
+        break;
+    case EExitPanic:
+        aDes += KExitTypePanicked;
+        break;
+    default:
+    case EExitPending:
+        aDes += KExitTypePending;
+        break;
+        }
+    }
+
+
+void CMemSpyThread::AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory )
+    {
+    aDes.Append( '[' );
+    const TInt length = aDes.Length();
+    AppendExitType( aDes, aType );
+    aDes.SetLength( length + 1 ); // Remove all but the first letter
+    aDes.Append( ']' );
+    
+    if  ( aType == EExitKill || aType == EExitPending )
+        {
+        // Kill implies "clean" exit. Pending implies not yet dead.
+        }
+    else
+        {
+        TMemSpyTruncateOverflow overflow;
+
+        // Terminate or Panic implies abnormal exit condition, so
+        // show full exit info.
+        _LIT( KAbnormalFormatSpec, " %S-%d" );
+        aDes.AppendFormat( KAbnormalFormatSpec, &overflow, &aExitCategory, aExitReason );
+        }
+    }
+
+
+CMemSpyEngine& CMemSpyThread::Engine() const
+    {
+    return Process().Engine();
+    }
+
+
+void CMemSpyThread::OpenLC( RThread& aThread )
+    {
+    const TInt error = Open( aThread );
+    User::LeaveIfError( error );
+    CleanupClosePushL( aThread );
+    }
+
+
+TInt CMemSpyThread::Open( RThread& aThread )
+    {
+    CMemSpyEngine& engine = iProcess->Engine();
+    RMemSpyDriverClient& driver = engine.Driver();
+    const TInt error = driver.OpenThread( iId, aThread );
+    return error;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThread::Name() const
+    {
+    // Just return the pure name, minus the leading tab
+    TPtrC pRet( iName->Mid(2) );
+    
+    // Find the last tab position
+    TInt pos = pRet.Locate(TChar('\t'));
+    if  ( pos > 0 )
+        {
+        pRet.Set( pRet.Left( pos ) );
+        }
+    //    
+    return pRet;
+    }
+
+
+EXPORT_C TFullName CMemSpyThread::FullName() const
+    {
+    TFullName name( iProcess->Name() );
+    name += KMemSpyThreadDoubleColon;
+    name += Name();
+    //
+    return name;
+    }
+
+
+EXPORT_C TBool CMemSpyThread::IsSystemPermanent() const
+    {
+    const TBool ret = ( iFlags & KThreadFlagSystemPermanent );
+    return ret;
+    }
+
+
+EXPORT_C TBool CMemSpyThread::IsSystemCritical() const
+    {
+    const TBool ret = ( iFlags & KThreadFlagSystemCritical );
+    return ret;
+    }
+
+
+EXPORT_C CMemSpyThreadInfoContainer& CMemSpyThread::InfoContainerL()
+    {
+    if  ( iInfoContainer == NULL )
+        {
+        const TBool KConstructAsynchronously = ETrue;
+        iInfoContainer = CMemSpyThreadInfoContainer::NewL( *this, KConstructAsynchronously );
+        }
+    //
+    return *iInfoContainer;
+    }
+
+
+EXPORT_C CMemSpyThreadInfoContainer& CMemSpyThread::InfoContainerForceSyncronousConstructionL()
+    {
+    if  ( iInfoContainer == NULL )
+        {
+        const TBool KConstructSynchronously = EFalse;
+        iInfoContainer = CMemSpyThreadInfoContainer::NewL( *this, KConstructSynchronously );
+        }
+    //
+    return *iInfoContainer;
+    }
+
+
+EXPORT_C void CMemSpyThread::KillL()
+    {
+    CMemSpyEngine& engine = iProcess->Engine();
+    RMemSpyDriverClient& driver = engine.Driver();
+    //
+    User::LeaveIfError( driver.ThreadEnd( Id(), EExitKill ) );
+    }
+
+
+EXPORT_C void CMemSpyThread::TerminateL()
+    {
+    CMemSpyEngine& engine = iProcess->Engine();
+    RMemSpyDriverClient& driver = engine.Driver();
+    //
+    User::LeaveIfError( driver.ThreadEnd( Id(), EExitTerminate ) );
+    }
+
+
+EXPORT_C void CMemSpyThread::PanicL()
+    {
+    CMemSpyEngine& engine = iProcess->Engine();
+    RMemSpyDriverClient& driver = engine.Driver();
+    //
+    User::LeaveIfError( driver.ThreadEnd( Id(), EExitPanic ) );
+    }
+
+
+EXPORT_C void CMemSpyThread::SetPriorityL( TThreadPriority aPriority )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThread::SetPriorityL() - START - aPriority: %d, orig pri: %d", aPriority, iPriority );
+#endif
+    CMemSpyEngine& engine = iProcess->Engine();
+    RMemSpyDriverClient& driver = engine.Driver();
+    //
+    const TInt err = driver.SetPriority( Id(), aPriority );
+#ifdef _DEBUG
+    TInt newPri = -1;
+    RThread thread;
+    if ( driver.OpenThread( iId, thread ) == KErrNone )
+        {
+        newPri = thread.Priority();
+        thread.Close();
+        }
+    RDebug::Printf( "CMemSpyThread::SetPriorityL() - err: %d, newPri: %d", err, newPri );
+#endif
+
+    User::LeaveIfError( err );
+    RefreshL();
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThread::SetPriorityL() - END" );
+#endif
+    }
+
+
+void CMemSpyThread::SetDeadL()
+    {
+    RefreshL();
+    }
+
+
+void CMemSpyThread::SetDeadL( const RThread& aThread )
+    {
+    RefreshL( aThread );
+	}
+
+
+void CMemSpyThread::FullName( TDes& aName ) const
+    {
+    iProcess->FullName( aName );
+    aName.Append( KMemSpyThreadDoubleColon );
+    aName.Append( Name() );
+    }
+
+
+EXPORT_C TBool CMemSpyThread::IsDead() const
+    {
+    const TBool isDead = ( iExitType != EExitPending );
+    return  isDead;
+    }
+
+EXPORT_C TThreadPriority CMemSpyThread::Priority() const
+	{
+	return iPriority;
+	}
+
+
+void CMemSpyThread::RefreshL()
+    {
+    CMemSpyEngine& engine = iProcess->Engine();
+    RMemSpyDriverClient& driver = engine.Driver();
+    
+    // Try to open thread. We use the device driver since
+    // it doesn't check (i.e. it bypasses) some of the conditions which the
+    // default RThread::Open() implementation enforces...
+    //
+    // Deliberately ignore error. The other overload of RefreshL will
+    // cope with the failure.
+    RThread thread;
+    driver.OpenThread( iId, thread );
+    CleanupClosePushL( thread );
+
+    // Call refresh with thread to perform actual heavy lifting...
+    RefreshL( thread );
+
+    // Clean up. This thread handle might actually not even be open, but that's okay...
+    CleanupStack::PopAndDestroy( &thread );
+    }
+
+
+void CMemSpyThread::RefreshL( const RThread& aThread )
+    {
+    const TBool handleValid = aThread.Handle() != KNullHandle;
+    if  ( handleValid )
+        {
+        // Annoyingly, we request the entire thread info structure just to get the thread flags...
+        iFlags = 0;
+        const User::TCritical critType = User::Critical( aThread );
+        if  ( critType == User::ESystemPermanent )
+            {
+            iFlags |= KThreadFlagSystemPermanent;
+            }
+        else if ( critType == User::ESystemCritical )
+            {
+            iFlags |= KThreadFlagSystemCritical;
+            }
+
+#ifdef _DEBUG
+        TMemSpyDriverThreadInfo threadInfo;
+        User::LeaveIfError( iProcess->Engine().Driver().GetThreadInfo( iId, threadInfo ) );
+        RDebug::Print( _L("CMemSpyThread::RefreshL() - old user pri: %d, curr user pri: %d, curr kernel pri: %d, iFlags: %d, name: %S"), iPriority, aThread.Priority(), threadInfo.iThreadPriority, iFlags, &threadInfo.iFullName );
+#endif
+        }
+
+    // Get exit info
+    iExitType = handleValid ? aThread.ExitType() : EExitKill;
+    iPriority = handleValid ? aThread.Priority() : EPriorityNormal;
+
+    // If the thread is dead then we may not be able to get some attributes
+    // (it depends on whether the thread handle is valid anymore).
+    iExitReason = 0;
+    iExitCategory.Zero();
+
+    if  ( IsDead() )
+        {
+        if  ( handleValid )
+            {
+            iExitReason = aThread.ExitReason();
+            iExitCategory = aThread.ExitCategory(); 
+            }
+        else
+            {
+            iExitCategory = KMemSpyUnknownExitCategory;
+            }
+        }
+    else
+        {
+        }
+
+    // Get raw thread name
+    HBufC* rawThreadName = GetThreadNameLC( aThread ); 
+
+    // Full name is enough for the thread name as well as the extra info
+    // we show
+    TFullName name;
+
+    // Build S60 listbox formatted name
+    _LIT( KMemSpyThreadNameFormatSpecBasicName, " \t%S\t\t" );
+    name.Format( KMemSpyThreadNameFormatSpecBasicName, rawThreadName );
+    CleanupStack::PopAndDestroy( rawThreadName );
+
+    // If the thread is dead show exit info
+    if  ( IsDead() )
+        {
+        AppendExitInfo( name, iExitType, iExitReason, iExitCategory );
+        }
+    else
+        {
+        // Otherwise, show priority
+        AppendPriority( name, iPriority );
+        }
+
+    // Save new fully formatted name
+    HBufC* newName = name.AllocL();
+    delete iName;
+    iName = newName;
+    }
+
+
+HBufC* CMemSpyThread::GetThreadNameLC( const RThread& aThreadOrNull ) const
+    {
+    TName threadName;
+    //
+    const TBool handleValid = aThreadOrNull.Handle() != KNullHandle;
+    //
+    if  ( handleValid )
+        {
+        // Easy case - we have a valid thread handle.
+        threadName.Append( aThreadOrNull.Name() );
+        }
+    else
+        {
+        // Since we don't have the possibility to enquire after the thread's name
+        // we'll assume that it used to be alive and therefore at some point we did
+        // manage to grep it's name...
+        if  ( iName )
+            {
+            const TPtrC pOriginalName( Name() );
+            threadName.Append( pOriginalName );
+            }
+        else
+            {
+            // Don't have a thread handle, don't have any possibility to get the
+            // name from a prior cached version. Must use "unknown"
+            threadName.Append( KMemSpyUnknownThreadName );
+            }
+        }
+    //
+    HBufC* ret = threadName.AllocLC();
+    return ret;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoContainer.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,355 @@
+/*
+* 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 <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+
+// System includes
+#include <e32svr.h>
+
+// User includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+
+
+
+CMemSpyThreadInfoContainer::CMemSpyThreadInfoContainer( CMemSpyThread& aThread )
+:   CMemSpyEngineObject( aThread ), iThread( &aThread )
+    {
+    }
+
+
+CMemSpyThreadInfoContainer::~CMemSpyThreadInfoContainer()
+    {
+    CloseAllInfoItems();
+    //
+    iItems.Close();
+    iObservers.Close();
+    }
+
+
+void CMemSpyThreadInfoContainer::ConstructItemByTypeL( TBool aAsync, TMemSpyThreadInfoItemType aType )
+    {
+    CMemSpyThreadInfoItemBase* item = NULL;
+    //
+    switch( aType )
+        {
+    case EMemSpyThreadInfoItemTypeGeneralInfo:
+        item = CMemSpyThreadInfoGeneral::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeHeap:
+        item = CMemSpyThreadInfoHeap::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeStack:
+        item = CMemSpyThreadInfoStack::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeChunk:
+        item = CMemSpyThreadInfoChunk::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeCodeSeg:
+        item = CMemSpyThreadInfoCodeSeg::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeOpenFiles:
+        item = CMemSpyThreadInfoOpenFiles::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeActiveObject:
+        item = CMemSpyThreadInfoActiveObjects::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeServer:
+        item = CMemSpyThreadInfoServer::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeSession:
+        item = CMemSpyThreadInfoSession::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeSemaphore:
+        item = CMemSpyThreadInfoSemaphore::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeMutex:
+        item = CMemSpyThreadInfoMutex::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeTimer:
+        item = CMemSpyThreadInfoTimer::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeLDD:
+        item = CMemSpyThreadInfoLDD::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypePDD:
+        item = CMemSpyThreadInfoPDD::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeLogicalChannel:
+        item = CMemSpyThreadInfoLogicalChannel::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeChangeNotifier:
+        item = CMemSpyThreadInfoChangeNotifier::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeUndertaker:
+        item = CMemSpyThreadInfoUndertaker::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeOwnedThreadHandles:
+        item = CMemSpyThreadInfoOwnedThreadHandles::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeOwnedProcessHandles:
+        item = CMemSpyThreadInfoOwnedProcessHandles::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeOtherThreads:
+        item = CMemSpyThreadInfoOtherThreads::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeOtherProcesses:
+        item = CMemSpyThreadInfoOtherProcesses::NewLC( *this, aAsync );
+        break;
+    case EMemSpyThreadInfoItemTypeMemoryTracking:
+        item = CMemSpyThreadInfoMemoryTracking::NewLC( *this, aAsync );
+        break;
+    default:
+    case EMemSpyThreadInfoItemTypeMessageQueue:
+    case EMemSpyThreadInfoItemTypeConditionalVariable:
+        break;
+        }
+    //
+    if  ( item )
+        {
+        iItems.AppendL( item );
+        CleanupStack::Pop( item );
+        }
+    }
+
+
+void CMemSpyThreadInfoContainer::ConstructL( TBool aAsync )
+    {
+    for( TInt type = EMemSpyThreadInfoItemTypeFirst; type<EMemSpyThreadInfoItemTypeLast; type++ )
+        {
+        const TMemSpyThreadInfoItemType realType = static_cast< TMemSpyThreadInfoItemType >( type );
+        ConstructItemByTypeL( aAsync, realType );
+        }
+    }
+
+
+CMemSpyThreadInfoContainer* CMemSpyThreadInfoContainer::NewL( CMemSpyThread& aThread, TBool aAsync )
+    {
+    CMemSpyThreadInfoContainer* self = CMemSpyThreadInfoContainer::NewLC( aThread, aAsync );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CMemSpyThreadInfoContainer* CMemSpyThreadInfoContainer::NewLC( CMemSpyThread& aThread, TBool aAsync )
+    {
+    CMemSpyThreadInfoContainer* self = new(ELeave) CMemSpyThreadInfoContainer( aThread );
+    CleanupStack::PushL( self );
+    self->ConstructL( aAsync );
+    return self;
+    }
+
+
+CMemSpyThreadInfoContainer* CMemSpyThreadInfoContainer::NewLC( CMemSpyThread& aThread, TMemSpyThreadInfoItemType aSpecificType )
+    {
+    CMemSpyThreadInfoContainer* self = new(ELeave) CMemSpyThreadInfoContainer( aThread );
+    CleanupStack::PushL( self );
+    self->ConstructItemByTypeL( EFalse, aSpecificType );
+    return self;
+    }
+
+
+void CMemSpyThreadInfoContainer::AddItemL( TMemSpyThreadInfoItemType aType )
+    {
+    const TInt index = InfoItemIndexByType( aType );
+    if  ( index == KErrNotFound )
+        {
+        ConstructItemByTypeL( EFalse, aType );
+        }
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoContainer::Open()
+    {
+    if  ( !OpenOrCloseInProgress() )
+        {
+        SetOpenOrCloseInProgress( ETrue );
+        CMemSpyEngineObject::Open();
+        SetOpenOrCloseInProgress( EFalse );
+        }
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoContainer::Close()
+    {
+    if  ( !OpenOrCloseInProgress() )
+        {
+        SetOpenOrCloseInProgress( ETrue );
+        CMemSpyEngineObject::Close();
+        SetOpenOrCloseInProgress( EFalse );
+        }
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoContainer::PrintL()
+    {
+    _LIT( KMemSpyFolder, "ThreadInfo" );
+    _LIT( KMemSpyContext, "ThreadInfo - %S" );
+    //
+    CMemSpyEngine& engine = Engine();
+    CMemSpyEngineOutputSink& sink = engine.Sink();
+    //
+    TFullName fullName( iThread->FullName() );
+    HBufC* context = HBufC::NewLC( KMaxFileName * 2 );
+    TPtr pContext( context->Des() );
+    pContext.Format( KMemSpyContext, &fullName );
+    sink.DataStreamBeginL( pContext, KMemSpyFolder );
+    CleanupStack::PopAndDestroy( context );
+    //
+    sink.OutputSectionHeadingL( fullName, TChar('=') );
+    sink.OutputBlankLineL();
+    //
+    const TInt count = iItems.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        CMemSpyThreadInfoItemBase* item = iItems[ i ];
+        item->PrintL();
+        }
+    //
+    sink.OutputBlankLineL();
+    sink.DataStreamEndL();
+    }
+
+
+EXPORT_C TInt CMemSpyThreadInfoContainer::MdcaCount() const
+    {
+    return iItems.Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoContainer::MdcaPoint( TInt aIndex ) const
+    {
+    return iItems[ aIndex ]->Name();
+    }
+
+
+EXPORT_C CMemSpyEngine& CMemSpyThreadInfoContainer::Engine() const
+    {
+    return iThread->Engine();
+    }
+
+
+EXPORT_C CMemSpyThreadInfoItemBase& CMemSpyThreadInfoContainer::Item( TInt aIndex )
+    {
+    return *iItems[ aIndex ];
+    }
+
+
+EXPORT_C CMemSpyThreadInfoItemBase& CMemSpyThreadInfoContainer::Item( TMemSpyThreadInfoItemType aType )
+    {
+    const TInt index = InfoItemIndexByType( aType );
+    CMemSpyThreadInfoItemBase* ret = iItems[ index ];
+    __ASSERT_ALWAYS( ret != NULL, User::Invariant() );
+    return *ret;
+    }
+
+
+EXPORT_C TInt CMemSpyThreadInfoContainer::InfoItemIndexByType( TMemSpyThreadInfoItemType aType )
+    {
+    TInt index = KErrNotFound;
+    //
+    const TInt count = iItems.Count();
+    for(TInt i=0; i<count; i++)
+        {
+        CMemSpyThreadInfoItemBase* item = iItems[ i ];
+        if  ( item->Type() == aType )
+            {
+            index = i;
+            break;
+            }
+        }
+    //
+    return index;
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoContainer::ObserverAddL( MMemSpyThreadInfoContainerObserver& aObserver )
+    {
+    const TInt count = iObservers.Count();
+    for(TInt i=count-1; i>=0; i--)
+        {
+        MMemSpyThreadInfoContainerObserver* observer = iObservers[ i ];
+        if  ( observer == &aObserver )
+            {
+            return;
+            }
+        }
+
+    iObservers.AppendL( &aObserver );
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoContainer::ObserverRemove( MMemSpyThreadInfoContainerObserver& aObserver )
+    {
+    const TInt count = iObservers.Count();
+    for(TInt i=count-1; i>=0; i--)
+        {
+        MMemSpyThreadInfoContainerObserver* observer = iObservers[ i ];
+        if  ( observer == &aObserver )
+            {
+            iObservers.Remove( i );
+            break;
+            }
+        }
+    }
+
+
+void CMemSpyThreadInfoContainer::NotifyObserverL( MMemSpyThreadInfoContainerObserver::TEvent aEvent, TMemSpyThreadInfoItemType aType )
+    {
+    if  ( aEvent == MMemSpyThreadInfoContainerObserver::EInfoItemDestroyed )
+        {
+        // Make sure we remove dead item
+        const TInt index = InfoItemIndexByType( aType );
+        if  ( index >= 0 )
+            {
+            iItems.Remove( index );
+            }
+        }
+        
+    const TInt count = iObservers.Count();
+    for(TInt i=count-1; i>=0; i--)
+        {
+        MMemSpyThreadInfoContainerObserver* observer = iObservers[ i ];
+        observer->HandleMemSpyEngineInfoContainerEventL( aEvent, aType );
+        }
+    }
+
+
+void CMemSpyThreadInfoContainer::OpenAllInfoItems()
+    {
+    const TInt count = iItems.Count();
+    for(TInt i=count-1; i>=0; i--)
+        {
+        CMemSpyThreadInfoItemBase* item = iItems[ i ];
+        item->Open();
+        }
+    }
+
+
+void CMemSpyThreadInfoContainer::CloseAllInfoItems()
+    {
+    const TInt count = iItems.Count();
+    for(TInt i=count-1; i>=0; i--)
+        {
+        CMemSpyThreadInfoItemBase* item = iItems[ i ];
+        item->Close();
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,3442 @@
+/*
+* 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 <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+
+// System includes
+#include <f32file.h>
+#include <hal.h>
+#include <kernel/arm/arm_types.h>
+#include <memspy/driver/memspydriverclient.h>
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include <memspy/engine/memspyenginehelperactiveobject.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+
+// User includes
+#include "MemSpyEngineOutputListItem.h"
+
+// Constants
+const TInt KMemSpyNumericFormatBufferSize = 20;
+
+// Literal constants
+_LIT( KMemSpyNumericHexFormat, "0x%08x" );
+_LIT( KMemSpyNumericDecFormat, "%d" );
+_LIT( KMemSpyNumericLongFormat, "%Ld" );
+_LIT( KMemSpyCaptionYes, "Yes" );
+_LIT( KMemSpyCaptionNo, "No" );
+_LIT( KMemSpyCaptionOn, "On" );
+_LIT( KMemSpyCaptionOff, "Off" );
+_LIT( KMemSpyUnavailable, "Unavailable" );
+_LIT( KMemSpyDead, "Dead" );
+_LIT( KMemSpyNoItems, "(No items)" );
+
+
+
+CMemSpyThreadInfoItemBase::CMemSpyThreadInfoItemBase( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aType, TBool aAsyncConstruction )
+:   CMemSpyEngineObject( aContainer ), iContainer( aContainer ), iCallBack( CActive::EPriorityLow ), iType( aType )
+    {
+    if  ( aAsyncConstruction )
+        {
+        TCallBack callBackMethod( CallConstructL, this );
+        iCallBack.Set( callBackMethod );
+        iCallBack.CallBack();
+        }
+    }
+
+
+CMemSpyThreadInfoItemBase::~CMemSpyThreadInfoItemBase()
+    {
+    TRAP_IGNORE( iContainer.NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemDestroyed, iType ) );
+    //
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    }
+
+
+TInt CMemSpyThreadInfoItemBase::CallConstructL( TAny* aSelf )
+    {
+    CMemSpyThreadInfoItemBase* self = reinterpret_cast< CMemSpyThreadInfoItemBase* >( aSelf );
+    self->iReady = EFalse;
+    
+    // Don't try to refresh dead thread
+    TInt err = KErrNone;
+    if ( !self->Container().Thread().IsDead() )
+        {
+        TRAP(err, self->ConstructL());
+        if  ( err != KErrNone )
+            {
+    #ifdef _DEBUG
+            RDebug::Printf( "CMemSpyThreadInfoItemBase::CallConstructL() - construction err: %d, iType: %d", err, self->iType );
+    #endif
+            self->AddItemL( KMemSpyUnavailable, KNullDesC );
+            self->iIsEmpty = ETrue;
+            }
+        else if ( self->MdcaCount() == 0 )
+            {
+            self->AddItemL( KMemSpyNoItems, KNullDesC );
+            self->iIsEmpty = ETrue;
+            }        
+        }
+    else
+        {
+        self->AddItemL( KMemSpyDead, KNullDesC );
+        self->iIsEmpty = ETrue;
+        }
+    //
+    self->iReady = ETrue;
+    return KErrNone;
+    }
+
+
+EXPORT_C TInt CMemSpyThreadInfoItemBase::MdcaCount() const
+    {
+    return iItems.Count();
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoItemBase::MdcaPoint( TInt aIndex ) const
+    {
+    CItem* item = iItems[ aIndex ];
+    return TPtrC( item->Combined() );
+    }
+
+EXPORT_C TPtrC CMemSpyThreadInfoItemBase::Caption(TInt aIndex ) const
+	{
+	CItem* item = iItems[ aIndex ];
+	return TPtrC( item->Caption() );
+	}
+
+EXPORT_C TPtrC CMemSpyThreadInfoItemBase::Value(TInt aIndex ) const
+	{
+	CItem* item = iItems[ aIndex ];
+	return TPtrC( item->Value() );
+	}
+
+EXPORT_C CMemSpyEngine& CMemSpyThreadInfoItemBase::Engine() const
+    {
+    return iContainer.Engine();
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoItemBase::PrintL()
+    {
+    const TInt count = iItems.Count();
+    if  ( count > 0 && !iIsEmpty )
+        {
+        CMemSpyEngine& engine = Engine();
+        CMemSpyEngineOutputSink& sink = engine.Sink();
+
+        HBufC* name = MemSpyEngineUtils::CleanupTextLC( Name() );
+        sink.OutputSectionHeadingL( *name, TChar('-') );
+        CleanupStack::PopAndDestroy( name );
+        sink.OutputPrefixSetLC( _L("  ") ); // Slight insertion
+
+        // First pass to get max lengths
+        TInt maxLengthCaption = 0;
+        TInt maxLengthValue = 0;
+
+        for( TInt j=0; j<count; j++ )
+            {
+            const CItem* item = iItems[ j ];
+            maxLengthCaption = Max( maxLengthCaption, item->Caption().Length() );
+            maxLengthValue = Max( maxLengthValue, item->Value().Length() );
+            }
+
+        // Second pass - real this time - to print the values
+        HBufC* line = HBufC::NewLC( ( maxLengthCaption + maxLengthValue ) + 20 );
+        TPtr pLine( line->Des() );
+        //
+        for( TInt i=0; i<count; i++ )
+            {
+            const CItem* item = iItems[ i ];
+
+            // Remove initial tabs in caption
+            HBufC* caption = MemSpyEngineUtils::CleanupTextLC( item->Caption() );
+        
+            // Create value item & replace any further tabs
+            HBufC* value = MemSpyEngineUtils::CleanupTextLC( item->Value() );
+
+            // Now format the final line, with padding.
+            pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') );
+            pLine.Append( *value );
+            CleanupStack::PopAndDestroy( 2, caption );
+
+            // Sink output
+            sink.OutputLineL( pLine );
+            }
+        //
+        CleanupStack::PopAndDestroy( line );
+        sink.OutputBlankLineL();
+        CleanupStack::PopAndDestroy(); // clear prefix
+        }
+    }
+
+
+
+void CMemSpyThreadInfoItemBase::AddItemL( const TDesC& aCaption, const TDesC& aValue )
+    {
+    CItem* item = CItem::NewLC( aCaption, aValue );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyThreadInfoItemBase::AddItemHexL( const TDesC& aCaption, TUint aValue )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    val.Format( KMemSpyNumericHexFormat, aValue );
+    AddItemL( aCaption, val );
+    }
+
+
+void CMemSpyThreadInfoItemBase::AddItemDecimalL( const TDesC& aCaption, TInt aValue )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    val.Format( KMemSpyNumericDecFormat, aValue );
+    AddItemL( aCaption, val );
+    }
+
+
+void CMemSpyThreadInfoItemBase::AddItemLongL( const TDesC& aCaption, const TInt64& aValue )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    val.Format( KMemSpyNumericLongFormat, aValue );
+    AddItemL( aCaption, val );
+    }
+
+
+void CMemSpyThreadInfoItemBase::AddItemYesNoL( const TDesC& aCaption, TBool aYes )
+    {
+    CItem* item = CItem::NewYesNoLC( aCaption, aYes );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyThreadInfoItemBase::AddItemOnOffL( const TDesC& aCaption, TBool aOn )
+    {
+    CItem* item = CItem::NewOnOffLC( aCaption, aOn );
+    iItems.AppendL( item );
+    CleanupStack::Pop( item );
+    }
+
+
+void CMemSpyThreadInfoItemBase::AddItemPercentageL( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue )
+    {
+    const TMemSpyPercentText val( MemSpyEngineUtils::FormatPercentage( TReal( aOneHundredPercentValue ), TReal( aValue ) ) );
+    AddItemL( aCaption, val );
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoItemBase::RebuildL()
+    {
+    Reset();
+    CallConstructL( this );
+    }
+
+
+EXPORT_C TBool CMemSpyThreadInfoItemBase::IsReady() const
+    {
+    return iReady;
+    }
+
+
+EXPORT_C TMemSpyThreadInfoItemType CMemSpyThreadInfoItemBase::Type() const
+    {
+    return iType;
+    }
+
+
+void CMemSpyThreadInfoItemBase::Reset()
+    {
+    iItems.ResetAndDestroy();
+    }
+
+
+void CMemSpyThreadInfoItemBase::StripProcessAndThreadNames( TDes& aText )
+    {
+    StripProcessName( aText );
+    StripThreadName( aText );
+    }
+
+
+void CMemSpyThreadInfoItemBase::StripProcessName( TDes& aText )
+    {
+    CMemSpyProcess& process = Container().Thread().Process();
+    const TPtrC processName( process.Name() );
+    TFullName temp;
+    //
+    _LIT( KProcessNameUidFormat1, "%S.exe[%08x]" );
+    temp.Format( KProcessNameUidFormat1, &processName, process.SID() );
+    const TBool stripped = MemSpyEngineUtils::StripText( aText, temp );
+    //
+    if  ( stripped == EFalse )
+        {
+        _LIT( KProcessNameUidFormat2, "%S[%08x]" );
+        temp.Format( KProcessNameUidFormat2, &processName, process.SID() );
+        MemSpyEngineUtils::StripText( aText, temp );
+        }
+    }
+
+
+void CMemSpyThreadInfoItemBase::StripThreadName( TDes& aText )
+    {
+    CMemSpyThread& thread = Container().Thread();
+    const TPtrC threadName( thread.Name() );
+    const TBool stripped = MemSpyEngineUtils::StripText( aText, threadName );
+    (void) stripped;
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem& CMemSpyThreadInfoItemBase::Item( TInt aIndex )
+    {
+    CItem* item = iItems[ aIndex ];
+    return *item;
+    }
+
+
+const CMemSpyThreadInfoItemBase::CItem& CMemSpyThreadInfoItemBase::Item( TInt aIndex ) const
+    {
+    const CItem* item = iItems[ aIndex ];
+    return *item;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoItemBase::CItem::CItem()
+    {
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem::~CItem()
+    {
+    delete iCaption;
+    delete iValue;
+    delete iCombined;
+    }
+
+
+void CMemSpyThreadInfoItemBase::CItem::ConstructL( const TDesC& aCaption, const TDesC& aValue )
+    {
+    iCaption = aCaption.AllocL();
+    iValue = aValue.AllocL();
+    //
+    UpdateCombinedL();
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLC( const CItem& aCopyMe )
+    {
+    CItem* self = new(ELeave) CItem();
+    CleanupStack::PushL( self );
+    self->ConstructL( aCopyMe.Caption(), aCopyMe.Value() );
+    return self;
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLC( const TDesC& aCaption )
+    {
+    CItem* self = new(ELeave) CItem();
+    CleanupStack::PushL( self );
+    self->ConstructL( aCaption, KNullDesC );
+    return self;
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLC( const TDesC& aCaption, const TDesC& aValue )
+    {
+    CItem* self = new(ELeave) CItem();
+    CleanupStack::PushL( self );
+    self->ConstructL( aCaption, aValue );
+    return self;
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewHexLC( const TDesC& aCaption, TUint aValue )
+    {
+    CItem* ret = CItem::NewLC( aCaption );
+    ret->SetHexL( aValue );
+    return ret;
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewDecimalLC( const TDesC& aCaption, TInt aValue )
+    {
+    CItem* ret = CItem::NewLC( aCaption );
+    ret->SetDecimalL( aValue );
+    return ret;
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLongLC( const TDesC& aCaption, const TInt64& aValue )
+    {
+    CItem* ret = CItem::NewLC( aCaption );
+    ret->SetLongL( aValue );
+    return ret;
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewYesNoLC( const TDesC& aCaption, TBool aYes )
+    {
+    CItem* ret = CItem::NewLC( aCaption );
+    ret->SetYesNoL( aYes );
+    return ret;
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewOnOffLC( const TDesC& aCaption, TBool aOn )
+    {
+    CItem* ret = CItem::NewLC( aCaption );
+    ret->SetOnOffL( aOn );
+    return ret;
+    }
+
+
+CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewPercentageLC( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue )
+    {
+    CItem* ret = CItem::NewLC( aCaption );
+    ret->SetPercentageL( aOneHundredPercentValue, aValue );
+    return ret;
+    }
+
+
+void CMemSpyThreadInfoItemBase::CItem::SetValueL( const TDesC& aValue )
+    {
+    if  ( iValue == NULL )
+        {
+        iValue = aValue.AllocL();
+        }
+    else
+        {
+        if  ( iValue->Des().MaxLength() < aValue.Length() )
+            {
+            iValue = iValue->ReAllocL( aValue.Length() );
+            }
+            
+        // Now its safe to assign new content
+        *iValue = aValue;
+        }
+        
+    UpdateCombinedL();
+    }
+
+
+void CMemSpyThreadInfoItemBase::CItem::SetHexL( TUint aValue )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    val.Format( KMemSpyNumericHexFormat, aValue );
+    SetValueL( val );
+    }
+
+
+void CMemSpyThreadInfoItemBase::CItem::SetDecimalL( TInt aValue )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    val.Format( KMemSpyNumericDecFormat, aValue );
+    SetValueL( val );
+    }
+
+
+void CMemSpyThreadInfoItemBase::CItem::SetLongL( const TInt64& aValue )
+    {
+    TBuf<KMemSpyNumericFormatBufferSize> val;
+    val.Format( KMemSpyNumericLongFormat, aValue );
+    SetValueL( val );
+    }
+
+
+void CMemSpyThreadInfoItemBase::CItem::SetYesNoL( TBool aYes )
+    {
+    if  ( aYes )
+        {
+        SetValueL( KMemSpyCaptionYes );
+        }
+    else
+        {
+        SetValueL( KMemSpyCaptionNo );
+        }
+    }
+
+
+void CMemSpyThreadInfoItemBase::CItem::SetOnOffL( TBool aOn )
+    {
+    if  ( aOn )
+        {
+        SetValueL( KMemSpyCaptionOn );
+        }
+    else
+        {
+        SetValueL( KMemSpyCaptionOff );
+        }
+    }
+
+
+void CMemSpyThreadInfoItemBase::CItem::SetPercentageL( TInt aOneHundredPercentValue, TInt aValue )
+    {
+    const TMemSpyPercentText val( MemSpyEngineUtils::FormatPercentage( TReal( aOneHundredPercentValue ), TReal( aValue ) ) );
+    SetValueL( val );
+    }
+
+
+void CMemSpyThreadInfoItemBase::CItem::UpdateCombinedL()
+    {
+    const TInt requiredLength = Caption().Length() + Value().Length() + 10;
+    //
+    if  ( iCombined == NULL )
+        {
+        iCombined = HBufC::NewL( requiredLength );
+        }
+    else if ( iCombined->Des().MaxLength() < requiredLength )
+        {
+        iCombined = iCombined->ReAllocL( requiredLength );
+        }
+        
+    TPtr pCombined( iCombined->Des() );
+    pCombined.Zero();
+    pCombined.Append( _L("\t") );
+    pCombined.Append( Caption() );
+    pCombined.Append( _L("\t\t") );
+    pCombined.Append( Value() );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoGeneral::CMemSpyThreadInfoGeneral( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeGeneralInfo, aAsyncConstruction )
+    {
+    }
+
+
+void CMemSpyThreadInfoGeneral::ConstructL()
+    {
+    TBuf<50> temp;
+    RThread thread;
+    Container().Thread().OpenLC( thread );
+    const CMemSpyProcess& process = Container().Thread().Process();
+
+    _LIT( KItem1, "Thread Id" );
+    AddItemLongL( KItem1, thread.Id() );
+
+    _LIT( KItem1a, "Process Id" );
+    AddItemLongL( KItem1a, (TUint) process.Id() );
+  
+    _LIT( KItem1b, "SID" );
+    AddItemHexL( KItem1b, process.SID() );
+  
+    _LIT( KItem1c, "VID" );
+    AddItemHexL( KItem1c, process.VID() );
+
+    _LIT( KItem2, "Thread Priority" );
+    CMemSpyThread::AppendPriority( temp, thread.Priority() );
+    AddItemL( KItem2, temp );
+    temp.Zero();
+   
+    _LIT( KItem3, "Process Priority" );
+    CMemSpyProcess::AppendPriority( temp, thread.ProcessPriority() );
+    AddItemL( KItem3, temp );
+    temp.Zero();
+   
+    _LIT( KItem4, "Request Count" );
+    AddItemDecimalL( KItem4, thread.RequestCount() );
+   
+    TInt processHandleCount = 0;
+    TInt threadHandleCount = 0;
+    thread.HandleCount( processHandleCount, threadHandleCount );
+
+    _LIT( KItem5a, "Process Handles" );
+    AddItemDecimalL( KItem5a, processHandleCount );
+
+    _LIT( KItem5b, "Thread Handles" );
+    AddItemDecimalL( KItem5b, threadHandleCount );
+
+    // Thread handle info
+    THandleInfo handleInfo;
+    thread.HandleInfo( &handleInfo );
+
+    _LIT( KItem5c, "Num. Proc. (Using)" );
+    AddItemDecimalL( KItem5c, handleInfo.iNumProcesses );
+
+    _LIT( KItem5d, "Num. Thread (Using)" );
+    AddItemDecimalL( KItem5d, handleInfo.iNumThreads );
+
+    _LIT( KItem5e, "Attributes" );
+    AddItemDecimalL( KItem5e, thread.Attributes() );
+    
+    // CPU time (request special kernel build)
+    TTimeIntervalMicroSeconds cpuTime;
+    if  ( thread.GetCpuTime( cpuTime ) == KErrNone )
+        {
+        _LIT( KItem5f, "CPU Time (us)" );
+        const TInt64 time = cpuTime.Int64();
+        AddItemLongL( KItem5f, time );
+        }
+
+    // Exit info
+    _LIT( KItem6, "Exit Type" );
+    CMemSpyThread::AppendExitType( temp, thread.ExitType() );
+    AddItemL( KItem6, temp );
+    temp.Zero();
+
+    if  ( thread.ExitType() != EExitPending )
+        {
+        _LIT( KItem7, "Exit Reason" );
+        AddItemDecimalL( KItem7, thread.ExitReason() );
+
+        _LIT( KItem8, "Exit Category" );
+        const TExitCategoryName cat( thread.ExitCategory() );
+        AddItemL( KItem8, cat );
+        }
+
+    // Registers
+    MakeRegisterListingL( thread );
+    
+    CleanupStack::PopAndDestroy( &thread );
+
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+    }
+
+
+CMemSpyThreadInfoGeneral* CMemSpyThreadInfoGeneral::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoGeneral* self = new(ELeave) CMemSpyThreadInfoGeneral( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoGeneral::Name() const
+    {
+    _LIT(KName, "\tGeneral");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoGeneral::MakeRegisterListingL( RThread& aThread )
+    {
+#ifndef __WINS__
+    _LIT(KRegFormatGeneral, "R%02d");
+    _LIT(KRegFormatSP, "SP");
+    _LIT(KRegFormatLR, "LR");
+    _LIT(KRegFormatPC, "PC");
+    _LIT(KRegFormatFlags, "Flags");
+    _LIT(KRegFormatDACR, "DACR"); // Data access control register
+    //
+    TArmRegSet regList;
+    TPckg<TArmRegSet> pRegList( regList );
+    //
+    aThread.Context( pRegList );
+	TArmReg* pReg = reinterpret_cast<TArmReg*>( &regList );
+    //
+    for( TInt i=0; i<KArmRegisterCount; i++ )
+        {
+        const TArmReg regValue = pReg[ i ];
+        //
+        if  ( i <= EArmR12 )
+            {
+            TBuf<128> buf;
+            buf.Format( KRegFormatGeneral, i );
+            AddItemHexL( buf, regValue );
+            }
+        else
+            {
+            TPtrC pCaption( KRegFormatGeneral );
+            //
+            if  ( i == EArmSp )
+                {
+                pCaption.Set( KRegFormatSP );
+                }
+            else if ( i == EArmLr )
+                {
+                pCaption.Set( KRegFormatLR );
+                }
+            else if ( i == EArmPc )
+                {
+                pCaption.Set( KRegFormatPC );
+                }
+            else if ( i == EArmFlags )
+                {
+                pCaption.Set( KRegFormatFlags );
+                }
+            else if ( i == EArmDacr )
+                {
+                pCaption.Set( KRegFormatDACR );
+                }
+            //
+            AddItemHexL( pCaption, regValue );
+            }
+        }
+#else
+    (void) aThread;
+#endif
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoHeap::CMemSpyThreadInfoHeap( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeHeap, aAsyncConstruction )
+    {
+    }
+
+
+void CMemSpyThreadInfoHeap::ConstructL()
+    {
+    CMemSpyEngineHelperHeap& heapHelper = Engine().HelperHeap();
+
+    // Get heap info first of all
+    TMemSpyHeapInfo info;
+    heapHelper.GetHeapInfoUserL( Container().Thread().Process().Id(), Container().Thread().Id(), info );
+    CMemSpyEngineOutputList* list = heapHelper.NewHeapSummaryShortLC( info );
+
+    // Now add each item to our view
+    const TInt count = list->Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const CMemSpyEngineOutputListItem& item = list->Item( i );
+        //
+        AddItemL( item.Caption(), item.Value() );
+        }
+
+    // Tidy up
+    CleanupStack::PopAndDestroy( list );
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+    }
+
+
+CMemSpyThreadInfoHeap* CMemSpyThreadInfoHeap::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoHeap* self = new(ELeave) CMemSpyThreadInfoHeap( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoHeap::Name() const
+    {
+    _LIT(KName, "\tHeap");
+    return TPtrC( KName );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoActiveObjects::CMemSpyThreadInfoActiveObjects( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeActiveObject, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoActiveObjects::~CMemSpyThreadInfoActiveObjects()
+    {
+    delete iItems;
+    }
+
+
+void CMemSpyThreadInfoActiveObjects::ConstructL()
+    {
+    CMemSpyEngine& engine = Container().Thread().Process().Engine();
+    engine.ProcessSuspendLC( Container().Thread().Process().Id() );
+    //
+    CMemSpyEngineActiveObjectArray* activeObjects = engine.HelperActiveObject().ActiveObjectListL( Container().Thread() );
+    delete iItems;
+    iItems = activeObjects;
+    //
+    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+    }
+
+
+CMemSpyThreadInfoActiveObjects* CMemSpyThreadInfoActiveObjects::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoActiveObjects* self = new(ELeave) CMemSpyThreadInfoActiveObjects( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoActiveObjects::Name() const
+    {
+    _LIT(KName, "\tActive Objects");
+    return TPtrC( KName );
+    }
+
+
+EXPORT_C TInt CMemSpyThreadInfoActiveObjects::MdcaCount() const
+    {
+    TInt count = 0;
+    //
+    if  ( iItems )
+        {
+        count = iItems->MdcaCount();
+        }
+    //
+    return count;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoActiveObjects::MdcaPoint(TInt aIndex) const
+    {
+    TPtrC ret( KNullDesC );
+    //
+    if  ( iItems )
+        {
+        ret.Set( iItems->MdcaPoint( aIndex ) );
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoOpenFiles::CMemSpyThreadInfoOpenFiles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeOpenFiles, aAsyncConstruction )
+    {
+    }
+
+
+void CMemSpyThreadInfoOpenFiles::ConstructL()
+    {
+    _LIT(KSpace, " ");
+    //
+    const TThreadId myThreadId = Container().Thread().Id();
+    CMemSpyEngine& engine = Container().Thread().Process().Engine();
+    RFs& fsSession = engine.FsSession();
+    //
+    TMemSpySizeText valueBuf;
+    TBuf<128> timeBuf;
+    TOpenFileScan scanner( fsSession );
+    //
+    CFileList* list = NULL;
+    scanner.NextL( list );
+
+    while( list != NULL )
+        {
+        if  ( scanner.ThreadId() == myThreadId )
+            {
+            CleanupStack::PushL( list );
+    
+            const TInt entryCount = list->Count();
+            for(TInt i=0; i<entryCount; i++)
+                {
+                const TEntry& entry = (*list)[ i ];
+
+                // Get time and size format strings
+                valueBuf = MemSpyEngineUtils::FormatSizeText( entry.iSize );
+                MemSpyEngineUtils::FormatTimeL( timeBuf, entry.iModified );
+                timeBuf.Insert( 0, KSpace );
+                timeBuf.Insert( 0, valueBuf );
+
+                // Get just file name
+                TParsePtrC parser( entry.iName );
+                const TPtrC pJustName( parser.NameAndExt() );
+
+                // Create item 
+                AddItemL( pJustName, timeBuf );
+                }
+
+            CleanupStack::Pop( list );
+            }
+
+        delete list;
+        list = NULL;
+        scanner.NextL( list );
+        }
+
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+    }
+
+
+CMemSpyThreadInfoOpenFiles* CMemSpyThreadInfoOpenFiles::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoOpenFiles* self = new(ELeave) CMemSpyThreadInfoOpenFiles( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoOpenFiles::Name() const
+    {
+    _LIT(KName, "\tOpen Files");
+    return TPtrC( KName );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoStack::CMemSpyThreadInfoStack( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeStack, aAsyncConstruction )
+    {
+    }
+
+
+void CMemSpyThreadInfoStack::ConstructL()
+    {
+    CMemSpyEngine& engine = Container().Thread().Process().Engine();
+    engine.ProcessSuspendLC( Container().Thread().Process().Id() );
+    //
+    TMemSpyDriverStackInfo info;
+    const TInt error = engine.Driver().GetStackInfo( Container().Thread().Id(), info );
+    User::LeaveIfError( error );
+    
+    _LIT( KItem1, "Size" );
+    AddItemDecimalL( KItem1, info.iUserStackSize );
+
+#ifndef __WINS__
+    const TInt userStackUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackPointer;
+    const TInt userStackHighWaterMarkUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackHighWatermark;
+
+    _LIT( KItem2, "Stack used" );
+    AddItemDecimalL( KItem2, userStackUsage );
+    
+    _LIT( KItem3, "(percentage)" );
+    AddItemPercentageL( KItem3, info.iUserStackSize, userStackUsage );
+
+    _LIT( KItem4, "High watermark" );
+    AddItemDecimalL( KItem4, userStackHighWaterMarkUsage );
+    
+    _LIT( KItem5, "(percentage)" );
+    AddItemPercentageL( KItem5, info.iUserStackSize, userStackHighWaterMarkUsage );
+#endif
+
+    _LIT( KItem6, "Base address" );
+    AddItemHexL( KItem6, info.iUserStackBase );
+
+#ifndef __WINS__
+    _LIT( KItem7, "Current pointer" );
+    AddItemHexL( KItem7, info.iUserStackPointer );
+#endif
+    //
+    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+    }
+
+
+CMemSpyThreadInfoStack* CMemSpyThreadInfoStack::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoStack* self = new(ELeave) CMemSpyThreadInfoStack( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoStack::Name() const
+    {
+    _LIT(KName, "\tStack");
+    return TPtrC( KName );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoChunk::CMemSpyThreadInfoChunk( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeChunk, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoChunk::~CMemSpyThreadInfoChunk()
+    {
+    delete iList;
+    }
+
+
+void CMemSpyThreadInfoChunk::ConstructL()
+    {
+    CMemSpyEngine& engine = Container().Thread().Process().Engine();
+    engine.ProcessSuspendLC( Container().Thread().Process().Id() );
+    //
+    CMemSpyEngineChunkList* list = engine.HelperChunk().ListForThreadL( Container().Thread().Id() );
+    delete iList;
+    iList = list;
+    //
+    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+    }
+
+
+CMemSpyThreadInfoChunk* CMemSpyThreadInfoChunk::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoChunk* self = new(ELeave) CMemSpyThreadInfoChunk( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoChunk::Name() const
+    {
+    _LIT(KName, "\tChunks");
+    return TPtrC( KName );
+    }
+
+
+EXPORT_C TInt CMemSpyThreadInfoChunk::MdcaCount() const
+    {
+    TInt count = 0;
+    //
+    if  ( iList )
+        {
+        count = iList->MdcaCount();
+        }
+    //
+    return count;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoChunk::MdcaPoint(TInt aIndex) const
+    {
+    TPtrC ret( KNullDesC );
+    //
+    if  ( iList )
+        {
+        ret.Set( iList->MdcaPoint( aIndex ) );
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoCodeSeg::CMemSpyThreadInfoCodeSeg( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeCodeSeg, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoCodeSeg::~CMemSpyThreadInfoCodeSeg()
+    {
+    delete iList;
+    }
+
+
+void CMemSpyThreadInfoCodeSeg::ConstructL()
+    {
+    CMemSpyEngine& engine = Container().Thread().Process().Engine();
+    engine.ProcessSuspendLC( Container().Thread().Process().Id() );
+    //
+    CMemSpyEngineCodeSegList* list = engine.HelperCodeSegment().CodeSegmentListL( Container().Thread().Process().Id() );
+    delete iList;
+    iList = list;
+    //
+    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+    }
+
+
+CMemSpyThreadInfoCodeSeg* CMemSpyThreadInfoCodeSeg::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoCodeSeg* self = new(ELeave) CMemSpyThreadInfoCodeSeg( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoCodeSeg::Name() const
+    {
+    _LIT(KName, "\tCode Segments");
+    return TPtrC( KName );
+    }
+
+
+EXPORT_C TInt CMemSpyThreadInfoCodeSeg::MdcaCount() const
+    {
+    TInt count = 0;
+    //
+    if  ( iList )
+        {
+        count = iList->MdcaCount();
+        }
+    //
+    return count;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoCodeSeg::MdcaPoint(TInt aIndex) const
+    {
+    TPtrC ret( KNullDesC );
+    //
+    if  ( iList )
+        {
+        ret.Set( iList->MdcaPoint( aIndex ) );
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoHandleObjectBase::CMemSpyThreadInfoHandleObjectBase( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, aItemType, aAsyncConstruction ), iContainerType( aContainerType )
+    {
+    }
+
+
+CMemSpyThreadInfoHandleObjectBase::~CMemSpyThreadInfoHandleObjectBase()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::~CMemSpyThreadInfoHandleObjectBase() - this: 0x%08x", this );
+#endif
+    iInfoItems.Close();
+    }
+
+
+void CMemSpyThreadInfoHandleObjectBase::ConstructL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - START" );
+#endif
+    iInfoItems.Reset();
+    //
+    CMemSpyProcess& process = Container().Thread().Process();
+    CMemSpyEngine& engine = process.Engine();
+    engine.ProcessSuspendLC( process.Id() );
+    //
+    RArray<THandleWrapper> handles;
+    CleanupClosePushL( handles );
+    GetHandlesL( handles );
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - got %d handle entries...", handles.Count() );
+#endif
+    //
+    TFullName name;
+    TMemSpyDriverHandleInfoGeneric info;
+    //
+    const TInt count = handles.Count();
+    for (TInt i=0; i<count; i++)
+    	{
+    	const THandleWrapper& handleWrapper = handles[ i ];
+        //
+    	const TInt r = engine.Driver().GetGenericHandleInfo( Container().Thread().Id(), handleWrapper.iType, handleWrapper.iHandle, info );
+        //
+#ifdef _DEBUG
+        RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - handle[%3d] 0x%08x, type: %d, refCount: %d, r: %d", i, handleWrapper.iHandle, handleWrapper.iType, handleWrapper.iRefCount, r );
+#endif
+        //
+        if  (r == KErrNone)
+    		{
+            name.Copy( info.iName );
+#ifdef _DEBUG
+            RDebug::Print( _L( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - HANDLE [%3d] %S"), handleWrapper.iRefCount, &name );
+#endif
+            StripProcessAndThreadNames( name );
+            //
+            iInfoItems.AppendL( info );
+            HandleContainerItemL( info, handleWrapper.iRefCount, name );
+            }
+     	}
+
+    CleanupStack::PopAndDestroy( &handles );
+    CleanupStack::PopAndDestroy(); // ProcessSuspendLC
+
+    HandleAllItemsLocatedL();
+
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+    }
+
+
+TBool CMemSpyThreadInfoHandleObjectBase::THandleWrapper::Match( const THandleWrapper& aLeft, const THandleWrapper& aRight )
+    {
+    return ( aLeft.iHandle == aRight.iHandle );
+    }
+
+
+EXPORT_C TInt CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry( const TMemSpyDriverHandleInfoGeneric& aEntry ) const
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry() - START - this: 0x%08x, aEntry.iHandle: 0x%08x", this, aEntry.iHandle );
+#endif
+    //
+    const TInt ret = DetailsIndexByHandle( aEntry.iHandle );
+    //
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry() - END - ret: %d", ret );
+#endif
+    return ret;
+    }
+
+
+EXPORT_C TInt CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle( TAny* aHandle ) const
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle() - START - this: 0x%08x, aHandle: 0x%08x", this, aHandle );
+#endif
+    TInt ret = KErrNotFound;
+    //
+    const TInt count = DetailsCount();
+    for(TInt i=0; i<count; i++)
+        {
+        const TMemSpyDriverHandleInfoGeneric& item = DetailsAt( i );
+        if  ( item.iHandle == aHandle )
+            {
+            ret = i;
+            break;
+            }
+        }
+    //
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle() - END - ret: %d", ret );
+#endif
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoHandleByContainer::CMemSpyThreadInfoHandleByContainer( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleObjectBase( aContainer, aItemType, aContainerType, aAsyncConstruction )
+    {
+    }
+
+
+void CMemSpyThreadInfoHandleByContainer::GetHandlesL( RArray<THandleWrapper>& aArray )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - START - container: %d", ContainerType() );
+#endif
+
+    aArray.Reset();
+
+    // Our handles will be stored here... duplicates are filtered out
+    TInt r = KErrNone;
+	TInt c = KMemSpyDefaultMaxHandleCount;
+	TAny* handles[ KMemSpyDefaultMaxHandleCount ];
+
+    CMemSpyProcess& process = Container().Thread().Process();
+    CMemSpyEngine& engine = process.Engine();
+    TIdentityRelation<CMemSpyThreadInfoHandleObjectBase::THandleWrapper> finder( THandleWrapper::Match );
+
+    // First get the handles for the process
+    if  ( r == KErrNone )
+        {
+        c = KMemSpyDefaultMaxHandleCount;
+        r = engine.Driver().GetProcessHandlesByType( process.Id(), ContainerType(), handles, c );
+        if  ( r == KErrNone && c > 0 )
+    	    {
+            c = Min( c, KMemSpyDefaultMaxHandleCount );
+    	    for( TInt i=0; i<c; i++ )
+    		    {
+    		    TAny* handle = handles[ i ];
+
+                // Create temporary entry that we'll use as the key in our array...
+                CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, ContainerType() );
+                
+                // Find existing duplicate entry (if there is one...)
+                const TInt errorOrIndex = aArray.Find( entry, finder );
+#ifdef _DEBUG
+                RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - PROC[%03d/%03d] - handle: 0x%08x, foundIndex: %d", i+1, c, handle, errorOrIndex );
+#endif
+
+    		    if  ( errorOrIndex == KErrNotFound )
+        		    {
+        		    // Not a duplicate handle, so keep it
+        		    aArray.AppendL( entry );
+#ifdef _DEBUG
+                    RDebug::Printf( "      new entry: 0x%08x", handle );
+#endif
+        		    }
+                else if ( errorOrIndex >= 0 )
+                    {
+                    // Increment reference count for duplicates...
+                    CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ];
+                    ++existingEntry.iRefCount;
+#ifdef _DEBUG
+                    RDebug::Printf( "      dupe entry - count is now: %d", existingEntry.iRefCount );
+#endif
+                    }
+     		    }
+            }
+        }
+
+    // Next get the handles for the thread
+    if  ( r == KErrNone )
+        {
+        c = KMemSpyDefaultMaxHandleCount;
+        r = engine.Driver().GetThreadHandlesByType( Container().Thread().Id(), ContainerType(), handles, c );
+        if  ( r == KErrNone && c > 0 )
+    	    {
+            c = Min( c, KMemSpyDefaultMaxHandleCount );
+    	    for( TInt i=0; i<c; i++ )
+    		    {
+    		    TAny* handle = handles[ i ];
+
+                // Create temporary entry that we'll use as the key in our array...
+                CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, ContainerType() );
+                
+                // Find existing duplicate entry (if there is one...)
+                const TInt errorOrIndex = aArray.Find( entry, finder );
+#ifdef _DEBUG
+                RDebug::Printf(  "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - THRD[%03d/%03d] - handle: 0x%08x, foundIndex: %d", i+1, c, handle, errorOrIndex );
+#endif
+    		    
+    		    if  ( errorOrIndex == KErrNotFound )
+        		    {
+        		    // Not a duplicate handle, so keep it
+        		    aArray.AppendL( entry );
+#ifdef _DEBUG
+                    RDebug::Printf( "      new entry: 0x%08x", handle );
+#endif
+        		    }
+                else if ( errorOrIndex >= 0 )
+                    {
+                    // Increment reference count for duplicates...
+                    CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ];
+                    ++existingEntry.iRefCount;
+#ifdef _DEBUG
+                    RDebug::Printf( "      dupe entry - count is now: %d", existingEntry.iRefCount );
+#endif
+                    }
+     		    }
+            }
+        }
+
+#ifdef _DEBUG
+    RDebug::Printf(  "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - final handle listing: " );
+
+    const TInt finalCount = aArray.Count();
+    for( TInt i=0; i<finalCount; i++ )
+        {
+        const THandleWrapper& handle = aArray[ i ];
+        RDebug::Printf(  "entry[%03d/%03d] - handle: 0x%08x, type: %d, refCount: %d", i+1, finalCount, handle.iHandle, handle.iType, handle.iRefCount );
+        }
+
+    RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - END - container: %d, finalCount: %d", ContainerType(), finalCount );
+#endif
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoServer::CMemSpyThreadInfoServer( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeServer, EMemSpyDriverContainerTypeServer, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoServer* CMemSpyThreadInfoServer::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoServer* self = new(ELeave) CMemSpyThreadInfoServer( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoServer::Name() const
+    {
+    _LIT(KName, "\tServers Running in Thread");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoServer::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    AddItemL( aFullName, KNullDesC );
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoServer::SessionType( TIpcSessionType aType )
+    {
+    _LIT( KUnsharable, "Unsharable" );
+    _LIT( KSharable, "Sharable" );
+    _LIT( KGlobalSharable, "Global Sharable" );
+    //
+    TPtrC pType(KNullDesC);
+    switch( aType )
+        {
+    case EIpcSession_Unsharable:
+        pType.Set( KUnsharable );
+        break;
+    case EIpcSession_Sharable:
+        pType.Set( KSharable );
+        break;
+    case EIpcSession_GlobalSharable:
+        pType.Set( KGlobalSharable );
+        break;
+    default:
+        pType.Set( KMemSpyUnavailable );
+        break;
+        }
+    //
+    return pType;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoSession::CMemSpyThreadInfoSession( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeSession, EMemSpyDriverContainerTypeSession, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoSession::~CMemSpyThreadInfoSession()
+    {
+    iServerNames.ResetAndDestroy();
+    iServerNames.Close();
+    }
+
+
+CMemSpyThreadInfoSession* CMemSpyThreadInfoSession::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoSession* self = new(ELeave) CMemSpyThreadInfoSession( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoSession::Name() const
+    {
+    _LIT(KName, "\tClient <-> Server\nConnections");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoSession::Reset()
+    {
+    CMemSpyThreadInfoHandleByContainer::Reset();
+    iServerNames.ResetAndDestroy();
+    }
+
+
+EXPORT_C TInt CMemSpyThreadInfoSession::ConnectionCount( const TDesC& aName ) const
+    {
+    TInt ret = 0;
+
+#ifdef _DEBUG
+    RDebug::Print( _L("CMemSpyThreadInfoSession::ConnectionCount() - START - aName: %S"), &aName );
+#endif
+
+    // See if we have an entry with that name...
+    TInt foundIndex = 0;
+    TRAP(ret, foundIndex = FindServerL(aName));
+    
+    if (ret == KErrNone)
+        {
+        // If we did, get the count
+        if  ( foundIndex >=0 && foundIndex < iServerNames.Count() )
+            {
+            ret = iServerNames[ foundIndex ]->iCount;
+            }
+        }
+
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoSession::ConnectionCount() - END - ret: %d", ret );
+#endif
+    //
+    return ret;
+    }
+
+TInt CMemSpyThreadInfoSession::FindServerL( const TDesC& aName ) const
+    {
+    TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
+    HBufC* name = aName.AllocLC();
+    CSessionInfoEntry* entry = new(ELeave) CSessionInfoEntry( name );
+    CleanupStack::Pop( name ); // don't destroy it as name is now owned by entry 
+    CleanupStack::PushL( entry );
+    const TInt foundIndex = iServerNames.Find( entry, comparer );
+    User::LeaveIfError(foundIndex); // so we only return a real index
+    CleanupStack::PopAndDestroy( entry );
+    return foundIndex;
+    }
+
+void CMemSpyThreadInfoSession::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    // Check whether we have the item already
+    TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
+
+    // Prepare object, just in case we don't find it...
+    HBufC* name = aFullName.AllocLC();
+
+#ifdef _DEBUG
+    TBuf<KMaxName> origName; origName.Copy( aItem.iName );
+    RDebug::Print( _L("CMemSpyThreadInfoSession::HandleContainerItemL() - START - handle: 0x%08x, type: %d, origName: %S, modName: %S"), aItem.iHandle, aItem.iType, &origName, name );
+#else
+    (void) aItem;
+#endif
+
+    CSessionInfoEntry* entry = new(ELeave) CSessionInfoEntry( name );
+    CleanupStack::Pop( name );
+    CleanupStack::PushL( entry );
+
+    // Search
+    const TInt foundIndex = iServerNames.Find( entry, comparer );
+    if  ( foundIndex == KErrNotFound )
+        {
+        // Make new entry
+        iServerNames.AppendL( entry );
+        CleanupStack::Pop( entry );
+        }
+    else if ( foundIndex >= 0 )
+        {
+        // Existing entry, increment count
+        CleanupStack::PopAndDestroy( entry );
+        entry = iServerNames[ foundIndex ];
+        ++entry->iCount;
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( entry );
+        }
+ 
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoSession::HandleContainerItemL() - END - foundIndex: %d", foundIndex );
+#endif
+    }
+
+
+void CMemSpyThreadInfoSession::HandleAllItemsLocatedL()
+    {
+    _LIT(KSecondLineFormatStringCount1, "1 connection");
+    _LIT(KSecondLineFormatStringCountMoreThanOne, "%d connections");
+    TBuf<50> buf;
+
+    // All items have been found, now create listbox entries
+    const TInt count = iServerNames.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        CSessionInfoEntry* entry = iServerNames[ i ];
+
+        if  ( entry->iCount == 1 )
+            {
+            buf.Copy( KSecondLineFormatStringCount1 );
+            }
+        else
+            {
+            buf.Format( KSecondLineFormatStringCountMoreThanOne, entry->iCount );
+            }
+
+        AddItemL( *entry->iName, buf );
+        }
+    }
+
+
+TBool CMemSpyThreadInfoSession::CompareEntries( const CSessionInfoEntry& aLeft, const CSessionInfoEntry& aRight )
+    {
+    return ( aLeft.iName->CompareF( *aRight.iName ) == 0 );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoSemaphore::CMemSpyThreadInfoSemaphore( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeSemaphore, EMemSpyDriverContainerTypeSemaphore, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoSemaphore* CMemSpyThreadInfoSemaphore::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoSemaphore* self = new(ELeave) CMemSpyThreadInfoSemaphore( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoSemaphore::Name() const
+    {
+    _LIT(KName, "\tSemaphores");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoSemaphore::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    _LIT( KFormatSpec, "Count: %d" );
+    TBuf<50> buf;
+    buf.AppendFormat( KFormatSpec, aItem.iCount );
+
+    AddItemL( aFullName, buf );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoMutex::CMemSpyThreadInfoMutex( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeMutex, EMemSpyDriverContainerTypeMutex, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoMutex* CMemSpyThreadInfoMutex::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoMutex* self = new(ELeave) CMemSpyThreadInfoMutex( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoMutex::Name() const
+    {
+    _LIT(KName, "\tMutexes");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoMutex::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    _LIT( KFormatSpec, "Count: %d" );
+    TBuf<50> buf;
+    buf.AppendFormat( KFormatSpec, aItem.iCount );
+
+    AddItemL( aFullName, buf );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoTimer::CMemSpyThreadInfoTimer( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeTimer, EMemSpyDriverContainerTypeTimer, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoTimer* CMemSpyThreadInfoTimer::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoTimer* self = new(ELeave) CMemSpyThreadInfoTimer( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoTimer::Name() const
+    {
+    _LIT(KName, "\tTimers");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoTimer::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& /*aFullName*/ )
+    {
+    // Get useful strings
+    TBuf<20> state;
+    GetTimerState( aItem.iTimerState, state );
+    TBuf<20> type;
+    GetTimerType( aItem.iTimerType, type );
+
+    AddItemL( type, state );
+    }
+
+
+void CMemSpyThreadInfoTimer::GetTimerState( TMemSpyDriverTimerState aState, TDes& aBuf )
+    {
+    switch( aState )
+        {
+    default:
+    case EMemSpyDriverTimerStateUnknown: 
+        {
+        _LIT(KStateUnknown, "Unknown");
+        aBuf.Copy( KStateUnknown );
+        }
+        break;
+    case EMemSpyDriverTimerStateIdle:
+        {
+        _LIT(KStateIdle, "Idle");
+        aBuf.Copy( KStateIdle );
+        }
+        break;
+    case EMemSpyDriverTimerStateWaiting: 
+        {
+        _LIT(KStateWaiting, "Waiting");
+        aBuf.Copy( KStateWaiting );
+        }
+        break;
+    case EMemSpyDriverTimerStateWaitHighRes: 
+        {
+        _LIT(KStateWaitHighRes, "Waiting, High Res.");
+        aBuf.Copy( KStateWaitHighRes );
+        }
+        break;
+        }
+    }
+
+
+void CMemSpyThreadInfoTimer::GetTimerType( TMemSpyDriverTimerType aType, TDes& aBuf )
+    {
+    switch( aType )
+        {
+    case EMemSpyDriverTimerTypeRelative:
+        {
+        _LIT( KType, "Relative" );
+        aBuf.Copy( KType );
+        }
+        break;
+    case EMemSpyDriverTimerTypeAbsolute:
+        {
+        _LIT( KType, "Absolute" );
+        aBuf.Copy( KType );
+        }
+        break;
+    case EMemSpyDriverTimerTypeHighRes:
+        {
+        _LIT( KType, "High Res." );
+        aBuf.Copy( KType );
+        }
+        break;
+    case EMemSpyDriverTimerTypeInactivity:
+        {
+        _LIT( KType, "Inactivity" );
+        aBuf.Copy( KType );
+        }
+        break;
+    default:
+        {
+        _LIT( KType, "Unknown" );
+        aBuf.Copy( KType );
+        }
+        break;
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoLDD::CMemSpyThreadInfoLDD( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeLDD, EMemSpyDriverContainerTypeLogicalDevice, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoLDD* CMemSpyThreadInfoLDD::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoLDD* self = new(ELeave) CMemSpyThreadInfoLDD( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoLDD::Name() const
+    {
+    _LIT(KName, "\tLogical Device Drivers");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoLDD::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    _LIT( KFormatSpec, "Open channels: %d" );
+    TBuf<50> buf;
+    buf.AppendFormat( KFormatSpec, aItem.iOpenChannels );
+
+    AddItemL( aFullName, buf );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoPDD::CMemSpyThreadInfoPDD( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypePDD, EMemSpyDriverContainerTypePhysicalDevice, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoPDD* CMemSpyThreadInfoPDD::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoPDD* self = new(ELeave) CMemSpyThreadInfoPDD( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoPDD::Name() const
+    {
+    _LIT(KName, "\tPhysical Device Drivers");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoPDD::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    AddItemL( aFullName, KNullDesC );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoLogicalChannel::CMemSpyThreadInfoLogicalChannel( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeLogicalChannel, EMemSpyDriverContainerTypeLogicalChannel, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoLogicalChannel* CMemSpyThreadInfoLogicalChannel::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoLogicalChannel* self = new(ELeave) CMemSpyThreadInfoLogicalChannel( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoLogicalChannel::Name() const
+    {
+    _LIT(KName, "\tLogical DD Channels");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoLogicalChannel::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    AddItemL( aFullName, KNullDesC );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoChangeNotifier::CMemSpyThreadInfoChangeNotifier( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeChangeNotifier, EMemSpyDriverContainerTypeChangeNotifier, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoChangeNotifier* CMemSpyThreadInfoChangeNotifier::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoChangeNotifier* self = new(ELeave) CMemSpyThreadInfoChangeNotifier( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoChangeNotifier::Name() const
+    {
+    _LIT(KName, "\tChange Notifiers");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoChangeNotifier::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    AddItemL( aFullName, KNullDesC );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoUndertaker::CMemSpyThreadInfoUndertaker( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeUndertaker, EMemSpyDriverContainerTypeUndertaker, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoUndertaker* CMemSpyThreadInfoUndertaker::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoUndertaker* self = new(ELeave) CMemSpyThreadInfoUndertaker( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoUndertaker::Name() const
+    {
+    _LIT(KName, "\tUndertakers");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoUndertaker::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    AddItemL( aFullName, KNullDesC );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoOwnedThreadHandles::CMemSpyThreadInfoOwnedThreadHandles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeOwnedThreadHandles, EMemSpyDriverContainerTypeThread, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoOwnedThreadHandles* CMemSpyThreadInfoOwnedThreadHandles::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoOwnedThreadHandles* self = new(ELeave) CMemSpyThreadInfoOwnedThreadHandles( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoOwnedThreadHandles::Name() const
+    {
+    _LIT(KName, "\tHandles to other\nThreads");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoOwnedThreadHandles::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName )
+    {
+    const TInt bracketPosStart = aFullName.LocateF( TChar('[') );
+    const TInt doubleColonPos = aFullName.FindF( _L("::" ) );
+    //
+    if  ( bracketPosStart >= 0 && doubleColonPos > bracketPosStart && doubleColonPos < aFullName.Length() - 2 )
+        {
+        // Process
+        TPtrC pProcessName( aFullName.Left( bracketPosStart ) );
+        HBufC* caption = HBufC::NewLC( KMaxName + 10 );
+        TPtr pCaption( caption->Des() );
+        pCaption.AppendFormat( _L("[%2d] %S"), aRefCount, &pProcessName );
+        
+        // Thread id & thread name
+        TPtrC pThreadName( aFullName.Mid( doubleColonPos + 2 ) );
+        HBufC* value = HBufC::NewLC( KMaxName + 10 );
+        TPtr pValue( value->Des() );
+        pValue.AppendFormat( _L("[%3d] %S"), aItem.iId, &pThreadName );
+
+        // Add it & tidy up
+        AddItemL( pCaption, pValue );
+        CleanupStack::PopAndDestroy( 2, caption );
+        }
+    else
+        {
+        AddItemL( aFullName, KNullDesC );
+        }
+    }
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoOwnedProcessHandles::CMemSpyThreadInfoOwnedProcessHandles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeOwnedProcessHandles, EMemSpyDriverContainerTypeProcess, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoOwnedProcessHandles* CMemSpyThreadInfoOwnedProcessHandles::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoOwnedProcessHandles* self = new(ELeave) CMemSpyThreadInfoOwnedProcessHandles( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoOwnedProcessHandles::Name() const
+    {
+    _LIT(KName, "\tHandles to other\nProcesses");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoOwnedProcessHandles::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName )
+    {
+    const TInt bracketPosStart = aFullName.LocateF( TChar('[') );
+    const TInt doubleColonPos = aFullName.FindF( _L("::" ) );
+    //
+    if  ( bracketPosStart >= 0 && doubleColonPos > bracketPosStart && doubleColonPos < aFullName.Length() - 2 )
+        {
+        // Process
+        TPtrC pProcessName( aFullName.Left( bracketPosStart ) );
+        HBufC* caption = HBufC::NewLC( KMaxName + 10 );
+        TPtr pCaption( caption->Des() );
+        pCaption.AppendFormat( _L("[%2d] %S"), aRefCount, &pProcessName );
+        
+        // Thread id & thread name
+        TPtrC pThreadName( aFullName.Mid( doubleColonPos + 2 ) );
+        HBufC* value = HBufC::NewLC( KMaxName + 10 );
+        TPtr pValue( value->Des() );
+        pValue.AppendFormat( _L("[%3d] %S"), aItem.iId, &pThreadName );
+
+        // Add it & tidy up
+        AddItemL( pCaption, pValue );
+        CleanupStack::PopAndDestroy( 2, caption );
+        }
+    else
+        {
+        AddItemL( aFullName, KNullDesC );
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoReferencedBy::CMemSpyThreadInfoReferencedBy( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoHandleObjectBase( aContainer, aItemType, aContainerType, aAsyncConstruction )
+    {
+    }
+
+
+void CMemSpyThreadInfoReferencedBy::GetHandlesL( RArray<THandleWrapper>& aArray )
+    {
+    aArray.Reset();
+    //
+    TInt r = KErrNone;
+    //
+    CMemSpyProcess& process = Container().Thread().Process();
+    CMemSpyEngine& engine = process.Engine();
+    TIdentityRelation<CMemSpyThreadInfoHandleObjectBase::THandleWrapper> finder( THandleWrapper::Match );
+
+    // We need to either search through:
+    //
+    // a) all thread & process handles looking for *this thread*, or
+    // b) all thread & process handles looking for *this process*
+    //
+    // We abuse the "container type" as a means of deciding whether it is
+    // the thread or the process we are looking for.
+    //
+    RMemSpyDriverClient& driver = engine.Driver();
+    if  ( ContainerType() == EMemSpyDriverContainerTypeProcess )
+        {
+        const TUint id = Container().Thread().Process().Id();
+        r = driver.GetReferencesToMyProcess( id );
+        }
+    else if ( ContainerType() == EMemSpyDriverContainerTypeThread )
+        {
+        const TUint id = Container().Thread().Id();
+        r = driver.GetReferencesToMyThread( id );
+        }
+    else
+        {
+        ASSERT( EFalse );
+        }
+    User::LeaveIfError( r );
+
+    RMemSpyMemStreamReader stream = driver.StreamOpenL();
+    CleanupClosePushL( stream );
+    
+    // Extract thread matches
+    const TInt threadCount = stream.ReadInt32L();
+    for( TInt i=0; i<threadCount; i++ )
+        {
+        TAny* handle = (TAny*) stream.ReadUint32L();
+
+        // Create temporary entry that we'll use as the key in our array...
+        CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, EMemSpyDriverContainerTypeThread );
+        
+        // Find existing duplicate entry (if there is one...)
+        const TInt errorOrIndex = aArray.Find( entry, finder );
+	    
+	    if  ( errorOrIndex == KErrNotFound )
+		    {
+		    // Not a duplicate handle, so keep it
+		    aArray.AppendL( entry );
+		    }
+        else if ( errorOrIndex >= 0 )
+            {
+            // Increment reference count for duplicates...
+            CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ];
+            ++existingEntry.iRefCount;
+            }
+        }
+    
+    // Extract process matches
+    const TInt processCount = stream.ReadInt32L();
+    for( TInt i=0; i<processCount; i++ )
+        {
+        TAny* handle = (TAny*) stream.ReadUint32L();
+
+        // Create temporary entry that we'll use as the key in our array...
+        CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, EMemSpyDriverContainerTypeProcess );
+        
+        // Find existing duplicate entry (if there is one...)
+        const TInt errorOrIndex = aArray.Find( entry, finder );
+	    
+	    if  ( errorOrIndex == KErrNotFound )
+		    {
+		    // Not a duplicate handle, so keep it
+		    aArray.AppendL( entry );
+		    }
+        else if ( errorOrIndex >= 0 )
+            {
+            // Increment reference count for duplicates...
+            CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ];
+            ++existingEntry.iRefCount;
+            }
+        }
+        
+    // Tidy up
+    CleanupStack::PopAndDestroy( &stream );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoOtherThreads::CMemSpyThreadInfoOtherThreads( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoReferencedBy( aContainer, EMemSpyThreadInfoItemTypeOtherThreads, EMemSpyDriverContainerTypeThread, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoOtherThreads* CMemSpyThreadInfoOtherThreads::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoOtherThreads* self = new(ELeave) CMemSpyThreadInfoOtherThreads( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoOtherThreads::Name() const
+    {
+    _LIT(KName, "\tReferences this Thread");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoOtherThreads::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    AddItemL( aFullName, KNullDesC );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoOtherProcesses::CMemSpyThreadInfoOtherProcesses( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoReferencedBy( aContainer, EMemSpyThreadInfoItemTypeOtherProcesses, EMemSpyDriverContainerTypeProcess, aAsyncConstruction )
+    {
+    }
+
+
+CMemSpyThreadInfoOtherProcesses* CMemSpyThreadInfoOtherProcesses::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoOtherProcesses* self = new(ELeave) CMemSpyThreadInfoOtherProcesses( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoOtherProcesses::Name() const
+    {
+    _LIT(KName, "\tReferences this Process");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoOtherProcesses::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName )
+    {
+    AddItemL( aFullName, KNullDesC );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoMemoryTracking::CMemSpyThreadInfoMemoryTracking( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTracking, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue )
+    {
+    }
+
+
+CMemSpyThreadInfoMemoryTracking::~CMemSpyThreadInfoMemoryTracking()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::~CMemSpyThreadInfoMemoryTracking() - START - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
+#endif
+    //
+    TrackingObserverRemove( *this );
+    //
+    delete iInfoHWM;
+    delete iInfoPeak;
+    delete iInfoCurrent;
+    //
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::~CMemSpyThreadInfoMemoryTracking() - END - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
+#endif
+    }
+
+
+void CMemSpyThreadInfoMemoryTracking::ConstructL()
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - START - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
+#endif
+    CMemSpyEngine& engine = Container().Thread().Process().Engine();
+    //
+    const TProcessId pid = Container().Thread().Process().Id();
+    iTracker = engine.HelperProcess().TrackerOrNull( pid );
+
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - requesting observer add... - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
+#endif
+    TrackingObserverAddL( *this );
+    //
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - preparing info item... - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
+#endif
+    if  ( iTracker )
+        {
+        delete iInfoCurrent;
+        iInfoCurrent = NULL;
+        iInfoCurrent = CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::NewLC( Container(), EFalse );
+        CleanupStack::Pop( iInfoCurrent );
+        //
+        delete iInfoHWM;
+        iInfoHWM = NULL;
+        iInfoHWM = CMemSpyThreadInfoMemoryTrackingStatisticsHWM::NewLC( Container(), EFalse );
+        CleanupStack::Pop( iInfoHWM );
+        //
+        delete iInfoPeak;
+        iInfoPeak = NULL;
+        iInfoPeak = CMemSpyThreadInfoMemoryTrackingStatisticsPeak::NewLC( Container(), EFalse );
+        CleanupStack::Pop( iInfoPeak );
+        }
+    
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - prepared info items - this: 0x%08x, iTracker: 0x%08x", this, iTracker );
+#endif
+
+    // Prepare items
+    _LIT( KItem0, "Tracking" );
+    AddItemOnOffL( KItem0, ( iTracker ) ? iTracker->AmTracking() : EFalse );
+
+    TInt64 valCurrent( 0 );
+    if  ( iTracker )
+        {
+        if  ( TotalIncludesSharedMemory() )
+            {
+            valCurrent = iTracker->InfoCurrent().TotalIncShared();
+            }
+        else
+            {
+            valCurrent = iTracker->InfoCurrent().TotalExcShared();
+            }
+        }
+    _LIT( KItem1, "Total [Current]" );
+    AddItemLongL( KItem1, valCurrent );
+
+    TInt64 valHWM( 0 );
+    if  ( iTracker )
+        {
+        if  ( TotalIncludesSharedMemory() )
+            {
+            valHWM = iTracker->InfoHWMIncShared().TotalIncShared();
+            }
+        else
+            {
+            valHWM = iTracker->InfoHWMExcShared().TotalExcShared();
+            }
+        }
+    _LIT( KItem2, "Total [HWM]" );
+    AddItemLongL( KItem2, valHWM );
+
+    TInt64 valPeak( 0 );
+    if  ( iTracker )
+        {
+        if  ( TotalIncludesSharedMemory() )
+            {
+            valPeak = iTracker->InfoPeaks().TotalIncShared();
+            }
+        else
+            {
+            valPeak = iTracker->InfoPeaks().TotalExcShared();
+            }
+        }
+    _LIT( KItem3, "Total [Peaks]" );
+    AddItemLongL( KItem3, valPeak );
+
+    //
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - END - this: 0x%08x", this );
+#endif
+    }
+
+
+CMemSpyThreadInfoMemoryTracking* CMemSpyThreadInfoMemoryTracking::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoMemoryTracking* self = new(ELeave) CMemSpyThreadInfoMemoryTracking( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+EXPORT_C TPtrC CMemSpyThreadInfoMemoryTracking::Name() const
+    {
+    _LIT(KName, "\tMemory Tracking");
+    return TPtrC( KName );
+    }
+
+
+EXPORT_C TBool CMemSpyThreadInfoMemoryTracking::TrackingActive() const
+    {
+    return ( iTracker != NULL ? iTracker->AmTracking() : EFalse );
+    }
+
+
+EXPORT_C TBool CMemSpyThreadInfoMemoryTracking::TotalIncludesSharedMemory() const
+    {
+    return iTotalIncludesSharedMemory;
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingSetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory )
+    {
+    iTotalIncludesSharedMemory = aIncludesSharedMemory;
+
+    if  ( iTracker )
+        {
+        iInfoCurrent->SetTotalIncludesSharedMemoryL( aIncludesSharedMemory );
+        iInfoHWM->SetTotalIncludesSharedMemoryL( aIncludesSharedMemory );
+        iInfoPeak->SetTotalIncludesSharedMemoryL( aIncludesSharedMemory );
+        
+        // Update totals
+        TRAP_IGNORE( UpdateCaptionsL( iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() ) );
+        }
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingStartL()
+    {
+    if  ( iTracker == NULL )
+        {
+        CMemSpyProcess& process = Container().Thread().Process();
+        CMemSpyEngine& engine = process.Engine();
+        iTracker = &engine.HelperProcess().TrackerL( process );
+
+        // Make sure we are also listening to the tracker!
+        TrackingObserverAddL( *this );
+        //
+        CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* infoCurrent = CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::NewLC( Container(), EFalse );
+        CMemSpyThreadInfoMemoryTrackingStatisticsHWM* infoHWM = CMemSpyThreadInfoMemoryTrackingStatisticsHWM::NewLC( Container(), EFalse );
+        CMemSpyThreadInfoMemoryTrackingStatisticsPeak* infoPeak = CMemSpyThreadInfoMemoryTrackingStatisticsPeak::NewLC( Container(), EFalse );
+        //
+        iInfoCurrent = infoCurrent;
+        iInfoHWM = infoHWM;
+        iInfoPeak = infoPeak;
+        //
+        CleanupStack::Pop( iInfoPeak );
+        CleanupStack::Pop( infoHWM );
+        CleanupStack::Pop( infoCurrent );
+        //
+        TrackingSetTotalIncludesSharedMemoryL( iTotalIncludesSharedMemory );
+        }
+
+    iTracker->StartL();
+
+    UpdateCaptionsL();
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingStopL()
+    {
+    if  ( iTracker != NULL )
+        {
+        iTracker->Stop();
+        }
+
+    UpdateCaptionsL();
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingResetHWML()
+    {
+    if  ( iTracker != NULL )
+        {
+        iTracker->ResetHWML();
+        }
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL( MMemSpyEngineProcessMemoryTrackerObserver& aObserver )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL() - START - iTracker: 0x%08x, this: 0x%08x", iTracker, this );
+#endif
+
+    if  ( iTracker != NULL )
+        {
+        iTracker->AddObserverL( aObserver );
+        }
+
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL() - END - iTracker: 0x%08x, this: 0x%08x", iTracker, this );
+#endif
+    }
+
+
+EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove( MMemSpyEngineProcessMemoryTrackerObserver& aObserver )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove() - START - iTracker: 0x%08x, this: 0x%08x", iTracker, this );
+#endif
+
+    if  ( iTracker != NULL )
+        {
+        iTracker->RemoveObserver( aObserver );
+        }
+
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove() - END - iTracker: 0x%08x, this: 0x%08x", iTracker, this );
+#endif
+    }
+
+
+EXPORT_C MDesCArray& CMemSpyThreadInfoMemoryTracking::InfoCurrent()
+    {
+    return *iInfoCurrent;
+    }
+
+
+EXPORT_C MDesCArray& CMemSpyThreadInfoMemoryTracking::InfoHWM()
+    {
+    return *iInfoHWM;
+    }
+
+
+EXPORT_C MDesCArray& CMemSpyThreadInfoMemoryTracking::InfoPeak()
+    {
+    return *iInfoPeak;
+    }
+
+
+void CMemSpyThreadInfoMemoryTracking::HandleMemoryTrackingStartedL()
+    {
+    __ASSERT_ALWAYS( iTracker, MemSpyEngineUtils::Panic( EMemSpyEnginePanicTrackerNull1 ) );
+    CMemSpyThreadInfoItemBase::CItem& trackingItem = Item( 0 );
+    trackingItem.SetOnOffL( iTracker->AmTracking() );
+    //
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+    }
+
+
+void CMemSpyThreadInfoMemoryTracking::HandleMemoryTrackingStoppedL()
+    {
+    __ASSERT_ALWAYS( iTracker, MemSpyEngineUtils::Panic( EMemSpyEnginePanicTrackerNull2 ) );
+    CMemSpyThreadInfoItemBase::CItem& trackingItem = Item( 0 );
+    trackingItem.SetOnOffL( iTracker->AmTracking() );
+    //
+    Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+    }
+
+
+void CMemSpyThreadInfoMemoryTracking::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared )
+    {
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::HandleMemoryChangedL() - START - this: 0x%08x", this );
+#endif 
+
+    __ASSERT_ALWAYS( iTracker, MemSpyEngineUtils::Panic( EMemSpyEnginePanicTrackerNull3 ) );
+    UpdateCaptionsL( aInfoCurrent, aHWMInfoIncShared, aHWMInfoExcShared );
+
+#ifdef _DEBUG
+    RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::HandleMemoryChangedL() - END - this: 0x%08x", this );
+#endif 
+    }
+
+
+void CMemSpyThreadInfoMemoryTracking::UpdateCaptionsL()
+    {
+    if  ( iTracker )
+        {
+        UpdateCaptionsL( iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() );
+        }
+    }
+
+
+void CMemSpyThreadInfoMemoryTracking::UpdateCaptionsL( const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared )
+    {
+    if  ( iTracker )
+        {
+        // Update caption
+        Item( 0 ).SetOnOffL( TrackingActive() );
+  
+        if  ( TotalIncludesSharedMemory() )
+            {
+            Item( 1 ).SetLongL( aInfoCurrent.TotalIncShared() );
+            Item( 2 ).SetLongL( aHWMInfoIncShared.TotalIncShared() );
+            Item( 3 ).SetLongL( iTracker->InfoPeaks().TotalIncShared() );
+            }
+        else
+            {
+            Item( 1 ).SetLongL( aInfoCurrent.TotalExcShared() );
+            Item( 2 ).SetLongL( aHWMInfoExcShared.TotalExcShared() );
+            Item( 3 ).SetLongL( iTracker->InfoPeaks().TotalExcShared() );
+            }
+
+        Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() );
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::CMemSpyThreadInfoMemoryTrackingStatisticsCurrent( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTrackingCurrent, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue )
+    {
+    }
+
+
+CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::~CMemSpyThreadInfoMemoryTrackingStatisticsCurrent()
+    {
+    if  ( iTracker )
+        {
+        iTracker->RemoveObserver( *this );
+        }
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::ConstructL()
+    {
+    CMemSpyEngine& engine = Container().Thread().Process().Engine();
+    //
+    if  ( iTracker )
+        {
+        iTracker->RemoveObserver( *this );
+        }
+    iTracker = &Container().Engine().HelperProcess().TrackerL( Container().Thread().Process() );
+    if  ( iTracker )
+        {
+        iTracker->AddObserverL( *this );
+        //
+        _LIT( KItem1, "Stack Memory" );
+        AddItemDecimalL( KItem1, iTracker->InfoCurrent().iMemoryStack );
+        //
+        _LIT( KItem2, "Heap Memory" );
+        AddItemDecimalL( KItem2, iTracker->InfoCurrent().iMemoryHeap );
+        //
+        _LIT( KItem3, "Local Chunk Memory" );
+        AddItemDecimalL( KItem3, iTracker->InfoCurrent().iMemoryChunkLocal );
+        //
+        _LIT( KItem4, "Shared Chunk Memory" );
+        AddItemDecimalL( KItem4, iTracker->InfoCurrent().iMemoryChunkShared );
+        //
+        _LIT( KItem5, "Global Data Memory" );
+        AddItemDecimalL( KItem5, iTracker->InfoCurrent().iMemoryGlobalData );
+        //
+        _LIT( KItem6, "Total" );
+        if  ( iTotalIncludesSharedMemory )
+            {
+            AddItemLongL( KItem6, iTracker->InfoCurrent().TotalIncShared() );
+            }
+        else
+            {
+            AddItemLongL( KItem6, iTracker->InfoCurrent().TotalExcShared() );
+            }
+        }
+    }
+
+
+CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* self = new(ELeave) CMemSpyThreadInfoMemoryTrackingStatisticsCurrent( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+TPtrC CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::Name() const
+    {
+    _LIT(KName, "\tCurrent Statistics");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory )
+    {
+    iTotalIncludesSharedMemory = aIncludesSharedMemory;
+    
+    // Update totals
+    HandleMemoryChangedL( iTracker->ProcessId(), iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() );
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::HandleMemoryTrackingStartedL()
+    {
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::HandleMemoryTrackingStoppedL()
+    {
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
+    {
+    Item( 0 ).SetDecimalL( aInfoCurrent.iMemoryStack );
+    Item( 1 ).SetDecimalL( aInfoCurrent.iMemoryHeap );
+    Item( 2 ).SetDecimalL( aInfoCurrent.iMemoryChunkLocal );
+    Item( 3 ).SetDecimalL( aInfoCurrent.iMemoryChunkShared );
+    Item( 4 ).SetDecimalL( aInfoCurrent.iMemoryGlobalData );
+    //
+    if  ( iTotalIncludesSharedMemory )
+        {
+        Item( 5 ).SetLongL( aInfoCurrent.TotalIncShared() );
+        }
+    else
+        {
+        Item( 5 ).SetLongL( aInfoCurrent.TotalExcShared() );
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoMemoryTrackingStatisticsPeak::CMemSpyThreadInfoMemoryTrackingStatisticsPeak( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTrackingPeak, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue )
+    {
+    }
+
+
+CMemSpyThreadInfoMemoryTrackingStatisticsPeak::~CMemSpyThreadInfoMemoryTrackingStatisticsPeak()
+    {
+    if  ( iTracker )
+        {
+        iTracker->RemoveObserver( *this );
+        }
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::ConstructL()
+    {
+    CMemSpyEngine& engine = Container().Thread().Process().Engine();
+    //
+    if  ( iTracker )
+        {
+        iTracker->RemoveObserver( *this );
+        }
+    iTracker = &Container().Engine().HelperProcess().TrackerL( Container().Thread().Process() );
+    if  ( iTracker )
+        {
+        iTracker->AddObserverL( *this );
+        //
+        _LIT( KItem1, "Stack Memory" );
+        AddItemDecimalL( KItem1, iTracker->InfoPeaks().iMemoryStack );
+        //
+        _LIT( KItem2, "Heap Memory" );
+        AddItemDecimalL( KItem2, iTracker->InfoPeaks().iMemoryHeap );
+        //
+        _LIT( KItem3, "Local Chunk Memory" );
+        AddItemDecimalL( KItem3, iTracker->InfoPeaks().iMemoryChunkLocal );
+        //
+        _LIT( KItem4, "Shared Chunk Memory" );
+        AddItemDecimalL( KItem4, iTracker->InfoPeaks().iMemoryChunkShared );
+        //
+        _LIT( KItem5, "Global Data Memory" );
+        AddItemDecimalL( KItem5, iTracker->InfoPeaks().iMemoryGlobalData );
+        //
+        _LIT( KItem6, "Total" );
+        if  ( iTotalIncludesSharedMemory )
+            {
+            AddItemLongL( KItem6, iTracker->InfoPeaks().TotalIncShared() );
+            }
+        else
+            {
+            AddItemLongL( KItem6, iTracker->InfoPeaks().TotalExcShared() );
+            }
+        }
+    }
+
+
+CMemSpyThreadInfoMemoryTrackingStatisticsPeak* CMemSpyThreadInfoMemoryTrackingStatisticsPeak::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoMemoryTrackingStatisticsPeak* self = new(ELeave) CMemSpyThreadInfoMemoryTrackingStatisticsPeak( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+TPtrC CMemSpyThreadInfoMemoryTrackingStatisticsPeak::Name() const
+    {
+    _LIT(KName, "\tPeak Statistics");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory )
+    {
+    iTotalIncludesSharedMemory = aIncludesSharedMemory;
+    
+    // Update totals
+    HandleMemoryChangedL( iTracker->ProcessId(), iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() );
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::HandleMemoryTrackingStartedL()
+    {
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::HandleMemoryTrackingStoppedL()
+    {
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aInfoCurrent*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
+    {
+    Item( 0 ).SetDecimalL( iTracker->InfoPeaks().iMemoryStack );
+    Item( 1 ).SetDecimalL( iTracker->InfoPeaks().iMemoryHeap );
+    Item( 2 ).SetDecimalL( iTracker->InfoPeaks().iMemoryChunkLocal );
+    Item( 3 ).SetDecimalL( iTracker->InfoPeaks().iMemoryChunkShared );
+    Item( 4 ).SetDecimalL( iTracker->InfoPeaks().iMemoryGlobalData );
+    //
+    if ( iTotalIncludesSharedMemory )
+        {
+        Item( 5 ).SetLongL( iTracker->InfoPeaks().TotalIncShared() );
+        }
+    else
+        {
+        Item( 5 ).SetLongL( iTracker->InfoPeaks().TotalExcShared() );
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyThreadInfoMemoryTrackingStatisticsHWM::CMemSpyThreadInfoMemoryTrackingStatisticsHWM( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+:   CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTrackingHWM, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue )
+    {
+    }
+
+
+CMemSpyThreadInfoMemoryTrackingStatisticsHWM::~CMemSpyThreadInfoMemoryTrackingStatisticsHWM()
+    {
+    if  ( iTracker )
+        {
+        iTracker->RemoveObserver( *this );
+        }
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::ConstructL()
+    {
+    CMemSpyEngine& engine = Container().Thread().Process().Engine();
+    //
+    if  ( iTracker )
+        {
+        iTracker->RemoveObserver( *this );
+        }
+    iTracker = &Container().Engine().HelperProcess().TrackerL( Container().Thread().Process() );
+    if  ( iTracker )
+        {
+        iTracker->AddObserverL( *this );
+        //
+        _LIT( KItem1, "Stack Memory" );
+        _LIT( KItem2, "Heap Memory" );
+        _LIT( KItem3, "Local Chunk Memory" );
+        _LIT( KItem4, "Shared Chunk Memory" );
+        _LIT( KItem5, "Global Data Memory" );
+        _LIT( KItem6, "Total" );
+        //
+        if  ( iTotalIncludesSharedMemory )
+            {
+            AddItemDecimalL( KItem1, iTracker->InfoHWMIncShared().iMemoryStack );
+            AddItemDecimalL( KItem2, iTracker->InfoHWMIncShared().iMemoryHeap );
+            AddItemDecimalL( KItem3, iTracker->InfoHWMIncShared().iMemoryChunkLocal );
+            AddItemDecimalL( KItem4, iTracker->InfoHWMIncShared().iMemoryChunkShared );
+            AddItemDecimalL( KItem5, iTracker->InfoHWMIncShared().iMemoryGlobalData );
+            AddItemLongL(    KItem6, iTracker->InfoHWMIncShared().TotalIncShared() );
+            }
+        else
+            {
+            AddItemDecimalL( KItem1, iTracker->InfoHWMExcShared().iMemoryStack );
+            AddItemDecimalL( KItem2, iTracker->InfoHWMExcShared().iMemoryHeap );
+            AddItemDecimalL( KItem3, iTracker->InfoHWMExcShared().iMemoryChunkLocal );
+            AddItemDecimalL( KItem4, iTracker->InfoHWMExcShared().iMemoryChunkShared );
+            AddItemDecimalL( KItem5, iTracker->InfoHWMExcShared().iMemoryGlobalData );
+            AddItemLongL(    KItem6, iTracker->InfoHWMExcShared().TotalExcShared() );
+            }
+        }
+    }
+
+
+CMemSpyThreadInfoMemoryTrackingStatisticsHWM* CMemSpyThreadInfoMemoryTrackingStatisticsHWM::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction )
+    {
+    CMemSpyThreadInfoMemoryTrackingStatisticsHWM* self = new(ELeave) CMemSpyThreadInfoMemoryTrackingStatisticsHWM( aContainer, aAsyncConstruction );
+    CleanupStack::PushL( self );
+    if  ( !aAsyncConstruction )
+        {
+        self->ConstructL();
+        }
+    return self;
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory )
+    {
+    iTotalIncludesSharedMemory = aIncludesSharedMemory;
+    
+    // Update totals
+    HandleMemoryChangedL( iTracker->ProcessId(), iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() );
+    }
+
+
+TPtrC CMemSpyThreadInfoMemoryTrackingStatisticsHWM::Name() const
+    {
+    _LIT(KName, "\tHigh-Water-Mark Statistics");
+    return TPtrC( KName );
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::HandleMemoryTrackingStartedL()
+    {
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::HandleMemoryTrackingStoppedL()
+    {
+    }
+
+
+void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aInfoCurrent*/, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared )
+    {
+    if  ( iTotalIncludesSharedMemory )
+        {
+        Item( 0 ).SetDecimalL( aHWMInfoIncShared.iMemoryStack );
+        Item( 1 ).SetDecimalL( aHWMInfoIncShared.iMemoryHeap );
+        Item( 2 ).SetDecimalL( aHWMInfoIncShared.iMemoryChunkLocal );
+        Item( 3 ).SetDecimalL( aHWMInfoIncShared.iMemoryChunkShared );
+        Item( 4 ).SetDecimalL( aHWMInfoIncShared.iMemoryGlobalData );
+        Item( 5 ).SetLongL(    aHWMInfoIncShared.TotalIncShared() );
+        }
+    else
+        {
+        Item( 0 ).SetDecimalL( aHWMInfoExcShared.iMemoryStack );
+        Item( 1 ).SetDecimalL( aHWMInfoExcShared.iMemoryHeap );
+        Item( 2 ).SetDecimalL( aHWMInfoExcShared.iMemoryChunkLocal );
+        Item( 3 ).SetDecimalL( aHWMInfoExcShared.iMemoryChunkShared );
+        Item( 4 ).SetDecimalL( aHWMInfoExcShared.iMemoryGlobalData );
+        Item( 5 ).SetLongL(    aHWMInfoExcShared.TotalExcShared() );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/eabi/MemSpyEngineu.def	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,556 @@
+EXPORTS
+	_ZN13CMemSpyEngine10GetVersionER8TVersion @ 1 NONAME
+	_ZN13CMemSpyEngine10HelperEComEv @ 2 NONAME
+	_ZN13CMemSpyEngine10HelperHeapEv @ 3 NONAME
+	_ZN13CMemSpyEngine11HelperChunkEv @ 4 NONAME
+	_ZN13CMemSpyEngine11HelperStackEv @ 5 NONAME
+	_ZN13CMemSpyEngine11SetObserverEP21MMemSpyEngineObserver @ 6 NONAME
+	_ZN13CMemSpyEngine12HelperFbServEv @ 7 NONAME
+	_ZN13CMemSpyEngine12HelperServerEv @ 8 NONAME
+	_ZN13CMemSpyEngine12HelperThreadEv @ 9 NONAME
+	_ZN13CMemSpyEngine12InstallSinkLE15TMemSpySinkType @ 10 NONAME
+	_ZN13CMemSpyEngine13HelperProcessEv @ 11 NONAME
+	_ZN13CMemSpyEngine14ListOpenFilesLEv @ 12 NONAME
+	_ZN13CMemSpyEngine16HelperFileSystemEv @ 13 NONAME
+	_ZN13CMemSpyEngine17HelperCodeSegmentEv @ 14 NONAME
+	_ZN13CMemSpyEngine18HelperActiveObjectEv @ 15 NONAME
+	_ZN13CMemSpyEngine19HelperSysMemTrackerEv @ 16 NONAME
+	_ZN13CMemSpyEngine22HelperKernelContainersEv @ 17 NONAME
+	_ZN13CMemSpyEngine4NewLER3RFs @ 18 NONAME
+	_ZN13CMemSpyEngine4SinkEv @ 19 NONAME
+	_ZN13CMemSpyEngine8SinkTypeEv @ 20 NONAME
+	_ZN13CMemSpyEngine9ContainerEv @ 21 NONAME
+	_ZN13CMemSpyEngine9FsSessionEv @ 22 NONAME
+	_ZN13CMemSpyEngine9HelperRAMEv @ 23 NONAME
+	_ZN13CMemSpyEngine9HelperROMEv @ 24 NONAME
+	_ZN13CMemSpyEngineD0Ev @ 25 NONAME
+	_ZN13CMemSpyEngineD1Ev @ 26 NONAME
+	_ZN13CMemSpyEngineD2Ev @ 27 NONAME
+	_ZN13CMemSpyThread10TerminateLEv @ 28 NONAME
+	_ZN13CMemSpyThread12SetPriorityLE15TThreadPriority @ 29 NONAME
+	_ZN13CMemSpyThread14InfoContainerLEv @ 30 NONAME
+	_ZN13CMemSpyThread41InfoContainerForceSyncronousConstructionLEv @ 31 NONAME
+	_ZN13CMemSpyThread4OpenEv @ 32 NONAME
+	_ZN13CMemSpyThread5CloseEv @ 33 NONAME
+	_ZN13CMemSpyThread5KillLEv @ 34 NONAME
+	_ZN13CMemSpyThread6PanicLEv @ 35 NONAME
+	_ZN14CMemSpyProcess10TerminateLEv @ 36 NONAME
+	_ZN14CMemSpyProcess4NewLERKS_ @ 37 NONAME
+	_ZN14CMemSpyProcess4OpenEv @ 38 NONAME
+	_ZN14CMemSpyProcess5CloseEv @ 39 NONAME
+	_ZN14CMemSpyProcess5KillLEv @ 40 NONAME
+	_ZN14CMemSpyProcess6PanicLEv @ 41 NONAME
+	_ZN17MemSpyEngineUtils10GetFolderLER3RFsR6TDes16RK25CMemSpyEngineSinkMetaDataPK12TDriveNumber @ 42 NONAME
+	_ZN17MemSpyEngineUtils11FormatTimeLER6TDes16RK5TTimei @ 43 NONAME
+	_ZN17MemSpyEngineUtils11FormatTimeLER6TDes16RKxi @ 44 NONAME
+	_ZN17MemSpyEngineUtils11GetRomInfoLER6TDes16S1_ @ 45 NONAME
+	_ZN17MemSpyEngineUtils12IsRomAddressEPv @ 46 NONAME
+	_ZN17MemSpyEngineUtils13CleanupTextLCERK7TDesC16 @ 47 NONAME
+	_ZN17MemSpyEngineUtils14FormatSizeTextERKxii @ 48 NONAME
+	_ZN17MemSpyEngineUtils14FormatSizeTextEi @ 49 NONAME
+	_ZN17MemSpyEngineUtils16FormatPercentageEdd @ 50 NONAME
+	_ZN17MemSpyEngineUtils17GetCapabilityNameER6TDes1611TCapability @ 51 NONAME
+	_ZN17MemSpyEngineUtils20TextAfterDoubleColonER6TDes16 @ 52 NONAME
+	_ZN17MemSpyEngineUtils21FormatSizeTextPreciseEi @ 53 NONAME
+	_ZN17MemSpyEngineUtils21TextBeforeDoubleColonER6TDes16 @ 54 NONAME
+	_ZN17MemSpyEngineUtils9FormatHexER6TDes16i @ 55 NONAME
+	_ZN17MemSpyEngineUtils9StripTextER6TDes16RK7TDesC16 @ 56 NONAME
+	_ZN19CMemSpyEngineObject4OpenEv @ 57 NONAME
+	_ZN19CMemSpyEngineObject5CloseEv @ 58 NONAME
+	_ZN19CMemSpyEngineObject9SetParentEPS_ @ 59 NONAME
+	_ZN19CMemSpyEngineObjectC1ERS_ @ 60 NONAME
+	_ZN19CMemSpyEngineObjectC1Ev @ 61 NONAME
+	_ZN19CMemSpyEngineObjectC2ERS_ @ 62 NONAME
+	_ZN19CMemSpyEngineObjectC2Ev @ 63 NONAME
+	_ZN22CMemSpyEngineChunkList11SortByNameLEv @ 64 NONAME
+	_ZN22CMemSpyEngineChunkList11SortBySizeLEv @ 65 NONAME
+	_ZN22CMemSpyEngineChunkList18OutputDataColumnsLER13CMemSpyEngine @ 66 NONAME
+	_ZN22CMemSpyEngineChunkList2AtEi @ 67 NONAME
+	_ZN22CMemSpyEngineChunkListD0Ev @ 68 NONAME
+	_ZN22CMemSpyEngineChunkListD1Ev @ 69 NONAME
+	_ZN22CMemSpyEngineChunkListD2Ev @ 70 NONAME
+	_ZN22CMemSpyEngineDriveList11SetObserverEP30MMemSpyEngineDriveListObserver @ 71 NONAME
+	_ZN22CMemSpyEngineDriveList18EntryByDriveNumberE12TDriveNumber @ 72 NONAME
+	_ZN22CMemSpyEngineDriveList2AtEi @ 73 NONAME
+	_ZN22CMemSpyEngineDriveListD0Ev @ 74 NONAME
+	_ZN22CMemSpyEngineDriveListD1Ev @ 75 NONAME
+	_ZN22CMemSpyEngineDriveListD2Ev @ 76 NONAME
+	_ZN22CMemSpyEngineHelperRAM22SetAknIconCacheStatusLEi @ 77 NONAME
+	_ZN22CMemSpyEngineHelperROM8AddInfoLER23CMemSpyEngineOutputList @ 78 NONAME
+	_ZN23CMemSpyEngineDriveEntry11SetObserverEP31MMemSpyEngineDriveEntryObserver @ 79 NONAME
+	_ZN23CMemSpyEngineDriveEntryD0Ev @ 80 NONAME
+	_ZN23CMemSpyEngineDriveEntryD1Ev @ 81 NONAME
+	_ZN23CMemSpyEngineDriveEntryD2Ev @ 82 NONAME
+	_ZN23CMemSpyEngineHelperECom2AtEi @ 83 NONAME
+	_ZN23CMemSpyEngineHelperECom7IndexOfERK25CMemSpyEngineEComCategory @ 84 NONAME
+	_ZN23CMemSpyEngineHelperHeap15OutputHeapInfoLERK15TMemSpyHeapInfoRK7TDesC16PK6RArrayI21TMemSpyDriverFreeCellE @ 85 NONAME
+	_ZN23CMemSpyEngineHelperHeap16GetHeapInfoUserLERK10TProcessIdRK9TThreadIdR15TMemSpyHeapInfoP6RArrayI21TMemSpyDriverFreeCellE @ 86 NONAME
+	_ZN23CMemSpyEngineHelperHeap16GetHeapInfoUserLERK14CMemSpyProcessR6RArrayI15TMemSpyHeapInfoE @ 87 NONAME
+	_ZN23CMemSpyEngineHelperHeap18GetHeapInfoKernelLER15TMemSpyHeapInfoP6RArrayI21TMemSpyDriverFreeCellE @ 88 NONAME
+	_ZN23CMemSpyEngineHelperHeap19OutputHeapDataUserLERK10TProcessIdRK9TThreadIdRK7TDesC16RK15TMemSpyHeapInfoPK6RArrayI21TMemSpyDriverFreeCellE @ 89 NONAME
+	_ZN23CMemSpyEngineHelperHeap19OutputHeapDataUserLERK13CMemSpyThread @ 90 NONAME
+	_ZN23CMemSpyEngineHelperHeap19OutputHeapInfoUserLERK13CMemSpyThread @ 91 NONAME
+	_ZN23CMemSpyEngineHelperHeap21NewHeapSummaryShortLCERK15TMemSpyHeapInfo @ 92 NONAME
+	_ZN23CMemSpyEngineHelperHeap21OutputHeapDataKernelLEv @ 93 NONAME
+	_ZN23CMemSpyEngineHelperHeap21OutputHeapInfoKernelLEv @ 94 NONAME
+	_ZN23CMemSpyEngineHelperHeap22OutputCellListingUserLERK13CMemSpyThread @ 95 NONAME
+	_ZN23CMemSpyEngineHelperHeap24NewHeapSummaryExtendedLCERK15TMemSpyHeapInfoPK6RArrayI21TMemSpyDriverFreeCellE @ 96 NONAME
+	_ZN23CMemSpyEngineHelperHeap24OutputHeapInfoForDeviceLEi @ 97 NONAME
+	_ZN23CMemSpyEngineOutputSink10OutputRawLERK6TDesC8 @ 98 NONAME
+	_ZN23CMemSpyEngineOutputSink11OutputLineLERK7TDesC16i @ 99 NONAME
+	_ZN23CMemSpyEngineOutputSink16DataStreamBeginLERK7TDesC16 @ 100 NONAME
+	_ZN23CMemSpyEngineOutputSink16DataStreamBeginLERK7TDesC16S2_ @ 101 NONAME
+	_ZN23CMemSpyEngineOutputSink16OutputBlankLineLEv @ 102 NONAME
+	_ZN23CMemSpyEngineOutputSink17OutputBinaryDataLERK7TDesC16PKhS4_i @ 103 NONAME
+	_ZN23CMemSpyEngineOutputSink17OutputPrefixClearEv @ 104 NONAME
+	_ZN23CMemSpyEngineOutputSink17OutputPrefixSetLCERK7TDesC16 @ 105 NONAME
+	_ZN23CMemSpyEngineOutputSink19OutputItemAndValueLERK7TDesC16S2_ @ 106 NONAME
+	_ZN23CMemSpyEngineOutputSink19OutputItemAndValueLERK7TDesC16ji @ 107 NONAME
+	_ZN23CMemSpyEngineOutputSink20OutputLineFormattedLE11TRefByValueIK7TDesC16Ez @ 108 NONAME
+	_ZN23CMemSpyEngineOutputSink21OutputSectionHeadingLERK7TDesC165TChar @ 109 NONAME
+	_ZN23CMemSpyEngineOutputSink22DataStreamTimeStampEndEv @ 110 NONAME
+	_ZN23CMemSpyEngineOutputSink25DataStreamTimeStampBeginLERK5TTime @ 111 NONAME
+	_ZN23CMemSpyEngineOutputSink26OutputPrefixSetFormattedLCE11TRefByValueIK7TDesC16Ez @ 112 NONAME
+	_ZN23CMemSpyEngineOutputSink27OutputBinaryDataCompressedLERK7TDesC16PKhS4_i @ 113 NONAME
+	_ZN23CMemSpyEngineServerList11SortByNameLEv @ 114 NONAME
+	_ZN23CMemSpyEngineServerList18OutputDataColumnsLER13CMemSpyEnginei @ 115 NONAME
+	_ZN23CMemSpyEngineServerList19SortBySessionCountLEv @ 116 NONAME
+	_ZN23CMemSpyEngineServerListD0Ev @ 117 NONAME
+	_ZN23CMemSpyEngineServerListD1Ev @ 118 NONAME
+	_ZN23CMemSpyEngineServerListD2Ev @ 119 NONAME
+	_ZN23CMemSpyThreadInfoServer11SessionTypeE15TIpcSessionType @ 120 NONAME
+	_ZN24CMemSpyEngineCodeSegList11SortByUidsLEv @ 121 NONAME
+	_ZN24CMemSpyEngineCodeSegList15SortByCodeSizeLEv @ 122 NONAME
+	_ZN24CMemSpyEngineCodeSegList15SortByDataSizeLEv @ 123 NONAME
+	_ZN24CMemSpyEngineCodeSegList15SortByFileNameLEv @ 124 NONAME
+	_ZN24CMemSpyEngineCodeSegList18OutputDataColumnsLER13CMemSpyEngine @ 125 NONAME
+	_ZN24CMemSpyEngineCodeSegList30ShowOnlyEntriesWithGlobalDataLEv @ 126 NONAME
+	_ZN24CMemSpyEngineHelperChunk14ListForThreadLE9TThreadId @ 127 NONAME
+	_ZN24CMemSpyEngineHelperChunk15ListForProcessLE10TProcessId @ 128 NONAME
+	_ZN24CMemSpyEngineHelperChunk25OutputChunkInfoForThreadLE9TThreadId @ 129 NONAME
+	_ZN24CMemSpyEngineHelperChunk25OutputChunkInfoForThreadLE9TThreadIdR6TDes16 @ 130 NONAME
+	_ZN24CMemSpyEngineHelperChunk25OutputChunkInfoForThreadLERK13CMemSpyThread @ 131 NONAME
+	_ZN24CMemSpyEngineHelperChunk26OutputChunkInfoForProcessLE10TProcessId @ 132 NONAME
+	_ZN24CMemSpyEngineHelperChunk26OutputChunkInfoForProcessLE10TProcessIdR6TDes16 @ 133 NONAME
+	_ZN24CMemSpyEngineHelperChunk26OutputChunkInfoForProcessLERK14CMemSpyProcess @ 134 NONAME
+	_ZN24CMemSpyEngineHelperChunk5ListLEv @ 135 NONAME
+	_ZN24CMemSpyEngineHelperStack16OutputStackDataLERK13CMemSpyThread23TMemSpyDriverDomainType @ 136 NONAME
+	_ZN24CMemSpyEngineHelperStack16OutputStackDataLERK13CMemSpyThread23TMemSpyDriverDomainTypei @ 137 NONAME
+	_ZN24CMemSpyEngineHelperStack16OutputStackInfoLE10TProcessId9TThreadIdR6TDes16 @ 138 NONAME
+	_ZN24CMemSpyEngineHelperStack16OutputStackInfoLERK13CMemSpyThread @ 139 NONAME
+	_ZN24CMemSpyEngineHelperStack19CalculateStackSizesERK14CMemSpyProcess @ 140 NONAME
+	_ZN24CMemSpyEngineHelperStack25OutputStackInfoForDeviceLEv @ 141 NONAME
+	_ZN24CMemSpyEngineServerEntryD0Ev @ 142 NONAME
+	_ZN24CMemSpyEngineServerEntryD1Ev @ 143 NONAME
+	_ZN24CMemSpyEngineServerEntryD2Ev @ 144 NONAME
+	_ZN25CMemSpyEngineActiveObjectD0Ev @ 145 NONAME
+	_ZN25CMemSpyEngineActiveObjectD1Ev @ 146 NONAME
+	_ZN25CMemSpyEngineActiveObjectD2Ev @ 147 NONAME
+	_ZN25CMemSpyEngineCodeSegEntryD0Ev @ 148 NONAME
+	_ZN25CMemSpyEngineCodeSegEntryD1Ev @ 149 NONAME
+	_ZN25CMemSpyEngineCodeSegEntryD2Ev @ 150 NONAME
+	_ZN25CMemSpyEngineEComCategory2AtEi @ 151 NONAME
+	_ZN25CMemSpyEngineEComCategory7IndexOfERK26CMemSpyEngineEComInterface @ 152 NONAME
+	_ZN25CMemSpyEngineFbServBitmap18OutputDataColumnsLER13CMemSpyEngine @ 153 NONAME
+	_ZN25CMemSpyEngineFbServBitmap5NewLCEi @ 154 NONAME
+	_ZN25CMemSpyEngineFbServBitmap6BitmapEv @ 155 NONAME
+	_ZN25CMemSpyEngineFbServBitmapD0Ev @ 156 NONAME
+	_ZN25CMemSpyEngineFbServBitmapD1Ev @ 157 NONAME
+	_ZN25CMemSpyEngineFbServBitmapD2Ev @ 158 NONAME
+	_ZN25CMemSpyEngineHelperFbServ24GetArrayOfBitmapHandlesLER6RArrayIiE @ 159 NONAME
+	_ZN25CMemSpyEngineHelperServer11ServerListLEv @ 160 NONAME
+	_ZN25CMemSpyEngineHelperServer14GetServerListLER6RArrayI30TMemSpyDriverHandleInfoGenericE @ 161 NONAME
+	_ZN25CMemSpyEngineHelperServer18GetServerSessionsLEPvR6RArrayI30TMemSpyDriverServerSessionInfoE @ 162 NONAME
+	_ZN25CMemSpyEngineHelperServer18GetServerSessionsLERK30TMemSpyDriverHandleInfoGenericR6RArrayI30TMemSpyDriverServerSessionInfoE @ 163 NONAME
+	_ZN25CMemSpyEngineHelperThread17OutputThreadInfoLERK13CMemSpyThreadi @ 164 NONAME
+	_ZN25CMemSpyEngineOpenFileListD0Ev @ 165 NONAME
+	_ZN25CMemSpyEngineOpenFileListD1Ev @ 166 NONAME
+	_ZN25CMemSpyEngineOpenFileListD2Ev @ 167 NONAME
+	_ZN25CMemSpyEngineSinkMetaData4NewLERK7TDesC16S2_S2_ii @ 168 NONAME
+	_ZN25CMemSpyEngineSinkMetaData4NewLERK7TDesC16S2_S2_iiRK5TTime @ 169 NONAME
+	_ZN25CMemSpyEngineSinkMetaData4NewLEv @ 170 NONAME
+	_ZN25CMemSpyEngineSinkMetaDataD0Ev @ 171 NONAME
+	_ZN25CMemSpyEngineSinkMetaDataD1Ev @ 172 NONAME
+	_ZN25CMemSpyEngineSinkMetaDataD2Ev @ 173 NONAME
+	_ZN25CMemSpyThreadInfoItemBase6PrintLEv @ 174 NONAME
+	_ZN25CMemSpyThreadInfoItemBase8RebuildLEv @ 175 NONAME
+	_ZN26CMemSpyEngineEComInterface2AtEi @ 176 NONAME
+	_ZN26CMemSpyEngineEComInterface7IndexOfERK31CMemSpyEngineEComImplementation @ 177 NONAME
+	_ZN26CMemSpyEngineHelperProcess12ImpersonateLEm @ 178 NONAME
+	_ZN26CMemSpyEngineHelperProcess18OutputProcessInfoLERK14CMemSpyProcess @ 179 NONAME
+	_ZN26CMemSpyEngineHelperProcess26OutputProcessInfoDetailedLERK14CMemSpyProcess @ 180 NONAME
+	_ZN26CMemSpyEngineHelperProcess38SetMemoryTrackingAutoStartProcessListLERK6RArrayI4TUidE @ 181 NONAME
+	_ZN26CMemSpyThreadInfoContainer12ObserverAddLER34MMemSpyThreadInfoContainerObserver @ 182 NONAME
+	_ZN26CMemSpyThreadInfoContainer14ObserverRemoveER34MMemSpyThreadInfoContainerObserver @ 183 NONAME
+	_ZN26CMemSpyThreadInfoContainer19InfoItemIndexByTypeE25TMemSpyThreadInfoItemType @ 184 NONAME
+	_ZN26CMemSpyThreadInfoContainer4ItemE25TMemSpyThreadInfoItemType @ 185 NONAME
+	_ZN26CMemSpyThreadInfoContainer4ItemEi @ 186 NONAME
+	_ZN26CMemSpyThreadInfoContainer4OpenEv @ 187 NONAME
+	_ZN26CMemSpyThreadInfoContainer5CloseEv @ 188 NONAME
+	_ZN26CMemSpyThreadInfoContainer6PrintLEv @ 189 NONAME
+	_ZN27CMemSpyDeviceWideOperations4NewLER13CMemSpyEngineR35MMemSpyDeviceWideOperationsObserverNS_10TOperationE @ 190 NONAME
+	_ZN27CMemSpyDeviceWideOperations6CancelEv @ 191 NONAME
+	_ZN27CMemSpyDeviceWideOperationsD0Ev @ 192 NONAME
+	_ZN27CMemSpyDeviceWideOperationsD1Ev @ 193 NONAME
+	_ZN27CMemSpyDeviceWideOperationsD2Ev @ 194 NONAME
+	_ZN28CMemSpyEngineObjectContainer10SortByNameEv @ 195 NONAME
+	_ZN28CMemSpyEngineObjectContainer14SortByCodeSegsEv @ 196 NONAME
+	_ZN28CMemSpyEngineObjectContainer15SortByHeapUsageEv @ 197 NONAME
+	_ZN28CMemSpyEngineObjectContainer16SortByStackUsageEv @ 198 NONAME
+	_ZN28CMemSpyEngineObjectContainer17SortByThreadCountEv @ 199 NONAME
+	_ZN28CMemSpyEngineObjectContainer8RefreshLERK7TDesC16 @ 200 NONAME
+	_ZN28CMemSpyEngineObjectContainer8RefreshLEv @ 201 NONAME
+	_ZN28CMemSpyEngineObjectContainer8SortByIdEv @ 202 NONAME
+	_ZN29CMemSpyEngineHelperFileSystem10DriveListLEv @ 203 NONAME
+	_ZN29CMemSpyEngineHelperFileSystem14GetSystemDriveEv @ 204 NONAME
+	_ZN29CMemSpyEngineHelperFileSystem14ListOpenFilesLERK9TThreadId @ 205 NONAME
+	_ZN29CMemSpyEngineHelperFileSystem14ListOpenFilesLEv @ 206 NONAME
+	_ZN30CMemSpyEngineActiveObjectArray16ObjectByAddressLEPv @ 207 NONAME
+	_ZN30CMemSpyEngineActiveObjectArray18OutputDataColumnsLER13CMemSpyEngine @ 208 NONAME
+	_ZN30CMemSpyEngineActiveObjectArray2AtEi @ 209 NONAME
+	_ZN30CMemSpyEngineActiveObjectArrayD0Ev @ 210 NONAME
+	_ZN30CMemSpyEngineActiveObjectArrayD1Ev @ 211 NONAME
+	_ZN30CMemSpyEngineActiveObjectArrayD2Ev @ 212 NONAME
+	_ZN30CMemSpyEngineFbServBitmapArray15BitmapByHandleLEi @ 213 NONAME
+	_ZN30CMemSpyEngineFbServBitmapArray2AtEi @ 214 NONAME
+	_ZN30CMemSpyEngineFbServBitmapArray4NewLERK6RArrayIiE @ 215 NONAME
+	_ZN30CMemSpyEngineFbServBitmapArray4NewLEiRK6RArrayIiER38MMemSpyEngineFbSerbBitmapArrayObserveri @ 216 NONAME
+	_ZN30CMemSpyEngineFbServBitmapArrayD0Ev @ 217 NONAME
+	_ZN30CMemSpyEngineFbServBitmapArrayD1Ev @ 218 NONAME
+	_ZN30CMemSpyEngineFbServBitmapArrayD2Ev @ 219 NONAME
+	_ZN30CMemSpyEngineHelperCodeSegment16CodeSegmentListLE10TProcessId @ 220 NONAME
+	_ZN30CMemSpyEngineHelperCodeSegment16CodeSegmentListLEv @ 221 NONAME
+	_ZN30CMemSpyEngineHelperCodeSegment19OutputCodeSegmentsLEjR6TDes16RK7TDesC165TChari @ 222 NONAME
+	_ZN31CMemSpyEngineHelperActiveObject17ActiveObjectListLERK13CMemSpyThread @ 223 NONAME
+	_ZN31CMemSpyThreadInfoMemoryTracking11InfoCurrentEv @ 224 NONAME
+	_ZN31CMemSpyThreadInfoMemoryTracking13TrackingStopLEv @ 225 NONAME
+	_ZN31CMemSpyThreadInfoMemoryTracking14TrackingStartLEv @ 226 NONAME
+	_ZN31CMemSpyThreadInfoMemoryTracking17TrackingResetHWMLEv @ 227 NONAME
+	_ZN31CMemSpyThreadInfoMemoryTracking20TrackingObserverAddLER41MMemSpyEngineProcessMemoryTrackerObserver @ 228 NONAME
+	_ZN31CMemSpyThreadInfoMemoryTracking22TrackingObserverRemoveER41MMemSpyEngineProcessMemoryTrackerObserver @ 229 NONAME
+	_ZN31CMemSpyThreadInfoMemoryTracking37TrackingSetTotalIncludesSharedMemoryLEi @ 230 NONAME
+	_ZN31CMemSpyThreadInfoMemoryTracking7InfoHWMEv @ 231 NONAME
+	_ZN31CMemSpyThreadInfoMemoryTracking8InfoPeakEv @ 232 NONAME
+	_ZN32CMemSpyEngineHelperSysMemTracker10SetConfigLERK38TMemSpyEngineHelperSysMemTrackerConfig @ 233 NONAME
+	_ZN32CMemSpyEngineHelperSysMemTracker11SetObserverEP40MMemSpyEngineHelperSysMemTrackerObserver @ 234 NONAME
+	_ZN32CMemSpyEngineHelperSysMemTracker14RemoveObserverEP40MMemSpyEngineHelperSysMemTrackerObserver @ 235 NONAME
+	_ZN32CMemSpyEngineHelperSysMemTracker5StopLEv @ 236 NONAME
+	_ZN32CMemSpyEngineHelperSysMemTracker6StartLERK38TMemSpyEngineHelperSysMemTrackerConfig @ 237 NONAME
+	_ZN32CMemSpyEngineHelperSysMemTracker6StartLEv @ 238 NONAME
+	_ZN32CMemSpyEngineHelperSysMemTracker9GetConfigER38TMemSpyEngineHelperSysMemTrackerConfig @ 239 NONAME
+	_ZN33CMemSpyEngineProcessMemoryTracker12AddObserverLER41MMemSpyEngineProcessMemoryTrackerObserver @ 240 NONAME
+	_ZN33CMemSpyEngineProcessMemoryTracker14RemoveObserverER41MMemSpyEngineProcessMemoryTrackerObserver @ 241 NONAME
+	_ZN33CMemSpyEngineProcessMemoryTracker4StopEv @ 242 NONAME
+	_ZN33CMemSpyEngineProcessMemoryTracker6StartLEv @ 243 NONAME
+	_ZN33CMemSpyEngineProcessMemoryTracker9ResetHWMLEv @ 244 NONAME
+	_ZN35CMemSpyEngineHelperKernelContainers11ObjectsAllLEv @ 245 NONAME
+	_ZN35CMemSpyEngineHelperKernelContainers28ObjectsForSpecificContainerLE26TMemSpyDriverContainerType @ 246 NONAME
+	_ZN36CMemSpyEngineGenericKernelObjectList12TypeAsStringE26TMemSpyDriverContainerType @ 247 NONAME
+	_ZN36CMemSpyEngineGenericKernelObjectListD0Ev @ 248 NONAME
+	_ZN36CMemSpyEngineGenericKernelObjectListD1Ev @ 249 NONAME
+	_ZN36CMemSpyEngineGenericKernelObjectListD2Ev @ 250 NONAME
+	_ZN41CMemSpyEngineGenericKernelObjectContainerD0Ev @ 251 NONAME
+	_ZN41CMemSpyEngineGenericKernelObjectContainerD1Ev @ 252 NONAME
+	_ZN41CMemSpyEngineGenericKernelObjectContainerD2Ev @ 253 NONAME
+	_ZNK13CMemSpyEngine9ContainerEv @ 254 NONAME
+	_ZNK13CMemSpyThread16IsSystemCriticalEv @ 255 NONAME
+	_ZNK13CMemSpyThread17IsSystemPermanentEv @ 256 NONAME
+	_ZNK13CMemSpyThread4NameEv @ 257 NONAME
+	_ZNK13CMemSpyThread6IsDeadEv @ 258 NONAME
+	_ZNK13CMemSpyThread8FullNameEv @ 259 NONAME
+	_ZNK14CMemSpyProcess11ThreadByIdLE9TThreadId @ 260 NONAME
+	_ZNK14CMemSpyProcess15ThreadIndexByIdE9TThreadId @ 261 NONAME
+	_ZNK14CMemSpyProcess16IsSystemCriticalEv @ 262 NONAME
+	_ZNK14CMemSpyProcess17IsSystemPermanentEv @ 263 NONAME
+	_ZNK14CMemSpyProcess2AtEi @ 264 NONAME
+	_ZNK14CMemSpyProcess3SIDEv @ 265 NONAME
+	_ZNK14CMemSpyProcess3VIDEv @ 266 NONAME
+	_ZNK14CMemSpyProcess4NameEv @ 267 NONAME
+	_ZNK14CMemSpyProcess6IsDeadEv @ 268 NONAME
+	_ZNK14CMemSpyProcess9MdcaCountEv @ 269 NONAME
+	_ZNK14CMemSpyProcess9MdcaPointEi @ 270 NONAME
+	_ZNK19CMemSpyEngineObject11AccessCountEv @ 271 NONAME
+	_ZNK19CMemSpyEngineObject6ParentEv @ 272 NONAME
+	_ZNK20CMemSpyThreadInfoLDD4NameEv @ 273 NONAME
+	_ZNK20CMemSpyThreadInfoPDD4NameEv @ 274 NONAME
+	_ZNK21CMemSpyThreadInfoHeap4NameEv @ 275 NONAME
+	_ZNK22CMemSpyEngineChunkList11EntryExistsEPv @ 276 NONAME
+	_ZNK22CMemSpyEngineChunkList2AtEi @ 277 NONAME
+	_ZNK22CMemSpyEngineChunkList5CountEv @ 278 NONAME
+	_ZNK22CMemSpyEngineChunkList9ItemIndexERK23CMemSpyEngineChunkEntry @ 279 NONAME
+	_ZNK22CMemSpyEngineChunkList9MdcaCountEv @ 280 NONAME
+	_ZNK22CMemSpyEngineChunkList9MdcaPointEi @ 281 NONAME
+	_ZNK22CMemSpyEngineDriveList2AtEi @ 282 NONAME
+	_ZNK22CMemSpyEngineDriveList5CountEv @ 283 NONAME
+	_ZNK22CMemSpyEngineDriveList9ItemIndexERK23CMemSpyEngineDriveEntry @ 284 NONAME
+	_ZNK22CMemSpyEngineDriveList9MdcaCountEv @ 285 NONAME
+	_ZNK22CMemSpyEngineDriveList9MdcaPointEi @ 286 NONAME
+	_ZNK22CMemSpyEngineHelperRAM26IsAknIconCacheConfigurableEv @ 287 NONAME
+	_ZNK22CMemSpyThreadInfoChunk4NameEv @ 288 NONAME
+	_ZNK22CMemSpyThreadInfoChunk9MdcaCountEv @ 289 NONAME
+	_ZNK22CMemSpyThreadInfoChunk9MdcaPointEi @ 290 NONAME
+	_ZNK22CMemSpyThreadInfoMutex4NameEv @ 291 NONAME
+	_ZNK22CMemSpyThreadInfoStack4NameEv @ 292 NONAME
+	_ZNK22CMemSpyThreadInfoTimer4NameEv @ 293 NONAME
+	_ZNK23CMemSpyEngineChunkEntry11OutputDataLER24CMemSpyEngineHelperChunk @ 294 NONAME
+	_ZNK23CMemSpyEngineChunkEntry15AppendOwnerNameER6TDes16 @ 295 NONAME
+	_ZNK23CMemSpyEngineChunkEntry9MdcaCountEv @ 296 NONAME
+	_ZNK23CMemSpyEngineChunkEntry9MdcaPointEi @ 297 NONAME
+	_ZNK23CMemSpyEngineChunkEntry9OwnerNameER6TDes16 @ 298 NONAME
+	_ZNK23CMemSpyEngineDriveEntry9MdcaCountEv @ 299 NONAME
+	_ZNK23CMemSpyEngineDriveEntry9MdcaPointEi @ 300 NONAME
+	_ZNK23CMemSpyEngineHelperECom9MdcaCountEv @ 301 NONAME
+	_ZNK23CMemSpyEngineHelperECom9MdcaPointEi @ 302 NONAME
+	_ZNK23CMemSpyEngineServerList2AtEi @ 303 NONAME
+	_ZNK23CMemSpyEngineServerList5CountEv @ 304 NONAME
+	_ZNK23CMemSpyEngineServerList9ItemIndexERK24CMemSpyEngineServerEntry @ 305 NONAME
+	_ZNK23CMemSpyEngineServerList9MdcaCountEv @ 306 NONAME
+	_ZNK23CMemSpyEngineServerList9MdcaPointEi @ 307 NONAME
+	_ZNK23CMemSpyThreadInfoServer4NameEv @ 308 NONAME
+	_ZNK24CMemSpyEngineCodeSegList13IndexByHandleEPv @ 309 NONAME
+	_ZNK24CMemSpyEngineCodeSegList9MdcaCountEv @ 310 NONAME
+	_ZNK24CMemSpyEngineCodeSegList9MdcaPointEi @ 311 NONAME
+	_ZNK24CMemSpyEngineServerEntry11OutputDataLER25CMemSpyEngineHelperServeri @ 312 NONAME
+	_ZNK24CMemSpyEngineServerEntry12GetSessionsLER25CMemSpyEngineHelperServerR6RArrayI30TMemSpyDriverServerSessionInfoE @ 313 NONAME
+	_ZNK24CMemSpyThreadInfoCodeSeg4NameEv @ 314 NONAME
+	_ZNK24CMemSpyThreadInfoCodeSeg9MdcaCountEv @ 315 NONAME
+	_ZNK24CMemSpyThreadInfoCodeSeg9MdcaPointEi @ 316 NONAME
+	_ZNK24CMemSpyThreadInfoGeneral4NameEv @ 317 NONAME
+	_ZNK24CMemSpyThreadInfoSession15ConnectionCountERK7TDesC16 @ 318 NONAME
+	_ZNK24CMemSpyThreadInfoSession4NameEv @ 319 NONAME
+	_ZNK25CMemSpyEngineActiveObject11OutputDataLER13CMemSpyEngine @ 320 NONAME
+	_ZNK25CMemSpyEngineActiveObject16RequestIsPendingEv @ 321 NONAME
+	_ZNK25CMemSpyEngineActiveObject18IsAddedToSchedulerEv @ 322 NONAME
+	_ZNK25CMemSpyEngineActiveObject8IsActiveEv @ 323 NONAME
+	_ZNK25CMemSpyEngineCodeSegEntry11OutputDataLER30CMemSpyEngineHelperCodeSegment @ 324 NONAME
+	_ZNK25CMemSpyEngineCodeSegEntry13HasCapabilityE11TCapability @ 325 NONAME
+	_ZNK25CMemSpyEngineEComCategory9MdcaCountEv @ 326 NONAME
+	_ZNK25CMemSpyEngineEComCategory9MdcaPointEi @ 327 NONAME
+	_ZNK25CMemSpyEngineFbServBitmap11OutputDataLER13CMemSpyEngine @ 328 NONAME
+	_ZNK25CMemSpyEngineFbServBitmap22GetExportableFileNameLER6TDes16 @ 329 NONAME
+	_ZNK25CMemSpyEngineFbServBitmap6BitmapEv @ 330 NONAME
+	_ZNK25CMemSpyEngineFbServBitmap6HandleEv @ 331 NONAME
+	_ZNK25CMemSpyEngineFbServBitmap7CaptionEv @ 332 NONAME
+	_ZNK25CMemSpyEngineOpenFileList2AtEi @ 333 NONAME
+	_ZNK25CMemSpyEngineOpenFileList5CountEv @ 334 NONAME
+	_ZNK25CMemSpyThreadInfoItemBase4TypeEv @ 335 NONAME
+	_ZNK25CMemSpyThreadInfoItemBase6EngineEv @ 336 NONAME
+	_ZNK25CMemSpyThreadInfoItemBase7IsReadyEv @ 337 NONAME
+	_ZNK25CMemSpyThreadInfoItemBase9MdcaCountEv @ 338 NONAME
+	_ZNK25CMemSpyThreadInfoItemBase9MdcaPointEi @ 339 NONAME
+	_ZNK26CMemSpyEngineEComInterface9MdcaCountEv @ 340 NONAME
+	_ZNK26CMemSpyEngineEComInterface9MdcaPointEi @ 341 NONAME
+	_ZNK26CMemSpyThreadInfoContainer6EngineEv @ 342 NONAME
+	_ZNK26CMemSpyThreadInfoContainer9MdcaCountEv @ 343 NONAME
+	_ZNK26CMemSpyThreadInfoContainer9MdcaPointEi @ 344 NONAME
+	_ZNK26CMemSpyThreadInfoOpenFiles4NameEv @ 345 NONAME
+	_ZNK26CMemSpyThreadInfoSemaphore4NameEv @ 346 NONAME
+	_ZNK27CMemSpyDeviceWideOperations18TotalOperationSizeEv @ 347 NONAME
+	_ZNK27CMemSpyThreadInfoUndertaker4NameEv @ 348 NONAME
+	_ZNK28CMemSpyEngineObjectContainer12ProcessByIdLE10TProcessId @ 349 NONAME
+	_ZNK28CMemSpyEngineObjectContainer16ProcessIndexByIdE10TProcessId @ 350 NONAME
+	_ZNK28CMemSpyEngineObjectContainer26ProcessAndThreadByFullNameERK7TDesC16RP14CMemSpyProcessRP13CMemSpyThread @ 351 NONAME
+	_ZNK28CMemSpyEngineObjectContainer26ProcessAndThreadByThreadIdE9TThreadIdRP14CMemSpyProcessRP13CMemSpyThread @ 352 NONAME
+	_ZNK28CMemSpyEngineObjectContainer29ProcessAndThreadByPartialNameERK7TDesC16RP14CMemSpyProcessRP13CMemSpyThread @ 353 NONAME
+	_ZNK28CMemSpyEngineObjectContainer2AtEi @ 354 NONAME
+	_ZNK28CMemSpyEngineObjectContainer5CountEv @ 355 NONAME
+	_ZNK28CMemSpyEngineObjectContainer7IsAliveE10TProcessId @ 356 NONAME
+	_ZNK28CMemSpyEngineObjectContainer7IsAliveE10TProcessId9TThreadId @ 357 NONAME
+	_ZNK28CMemSpyEngineObjectContainer8CountAllEv @ 358 NONAME
+	_ZNK28CMemSpyEngineObjectContainer9MdcaCountEv @ 359 NONAME
+	_ZNK28CMemSpyEngineObjectContainer9MdcaPointEi @ 360 NONAME
+	_ZNK29CMemSpyThreadInfoOtherThreads4NameEv @ 361 NONAME
+	_ZNK30CMemSpyEngineActiveObjectArray20ObjectIndexByAddressEPv @ 362 NONAME
+	_ZNK30CMemSpyEngineActiveObjectArray2AtEi @ 363 NONAME
+	_ZNK30CMemSpyEngineActiveObjectArray5CountEv @ 364 NONAME
+	_ZNK30CMemSpyEngineActiveObjectArray9MdcaCountEv @ 365 NONAME
+	_ZNK30CMemSpyEngineActiveObjectArray9MdcaPointEi @ 366 NONAME
+	_ZNK30CMemSpyEngineFbServBitmapArray19BitmapIndexByHandleEi @ 367 NONAME
+	_ZNK30CMemSpyEngineFbServBitmapArray2AtEi @ 368 NONAME
+	_ZNK30CMemSpyEngineFbServBitmapArray5CountEv @ 369 NONAME
+	_ZNK30CMemSpyEngineFbServBitmapArray9MdcaCountEv @ 370 NONAME
+	_ZNK30CMemSpyEngineFbServBitmapArray9MdcaPointEi @ 371 NONAME
+	_ZNK30CMemSpyEngineOpenFileListEntry4SizeEv @ 372 NONAME
+	_ZNK30CMemSpyEngineOpenFileListEntry8FileNameEv @ 373 NONAME
+	_ZNK30CMemSpyThreadInfoActiveObjects4NameEv @ 374 NONAME
+	_ZNK30CMemSpyThreadInfoActiveObjects9MdcaCountEv @ 375 NONAME
+	_ZNK30CMemSpyThreadInfoActiveObjects9MdcaPointEi @ 376 NONAME
+	_ZNK31CMemSpyEngineEComImplementation9MdcaCountEv @ 377 NONAME
+	_ZNK31CMemSpyEngineEComImplementation9MdcaPointEi @ 378 NONAME
+	_ZNK31CMemSpyThreadInfoChangeNotifier4NameEv @ 379 NONAME
+	_ZNK31CMemSpyThreadInfoLogicalChannel4NameEv @ 380 NONAME
+	_ZNK31CMemSpyThreadInfoMemoryTracking14TrackingActiveEv @ 381 NONAME
+	_ZNK31CMemSpyThreadInfoMemoryTracking25TotalIncludesSharedMemoryEv @ 382 NONAME
+	_ZNK31CMemSpyThreadInfoMemoryTracking4NameEv @ 383 NONAME
+	_ZNK31CMemSpyThreadInfoOtherProcesses4NameEv @ 384 NONAME
+	_ZNK32CMemSpyEngineHelperSysMemTracker15CompletedCyclesEv @ 385 NONAME
+	_ZNK32CMemSpyEngineHelperSysMemTracker8IsActiveEv @ 386 NONAME
+	_ZNK32CMemSpyEngineHelperSysMemTracker9MdcaCountEv @ 387 NONAME
+	_ZNK32CMemSpyEngineHelperSysMemTracker9MdcaPointEi @ 388 NONAME
+	_ZNK33CMemSpyEngineProcessMemoryTracker10AmTrackingEv @ 389 NONAME
+	_ZNK33CMemSpyThreadInfoHandleObjectBase19DetailsIndexByEntryERK30TMemSpyDriverHandleInfoGeneric @ 390 NONAME
+	_ZNK33CMemSpyThreadInfoHandleObjectBase20DetailsIndexByHandleEPv @ 391 NONAME
+	_ZNK34CMemSpyEngineOpenFileListForThread10ThreadNameEv @ 392 NONAME
+	_ZNK34CMemSpyEngineOpenFileListForThread2AtEi @ 393 NONAME
+	_ZNK34CMemSpyEngineOpenFileListForThread5CountEv @ 394 NONAME
+	_ZNK34CMemSpyEngineOpenFileListForThread8ThreadIdEv @ 395 NONAME
+	_ZNK34CMemSpyEngineOpenFileListForThread9ProcessIdEv @ 396 NONAME
+	_ZNK35CMemSpyEngineHelperKernelContainers7OutputLERK41CMemSpyEngineGenericKernelObjectContainer @ 397 NONAME
+	_ZNK35CMemSpyThreadInfoOwnedThreadHandles4NameEv @ 398 NONAME
+	_ZNK36CMemSpyEngineGenericKernelObjectList2AtEi @ 399 NONAME
+	_ZNK36CMemSpyEngineGenericKernelObjectList4NameEv @ 400 NONAME
+	_ZNK36CMemSpyEngineGenericKernelObjectList4TypeEv @ 401 NONAME
+	_ZNK36CMemSpyEngineGenericKernelObjectList5CountEv @ 402 NONAME
+	_ZNK36CMemSpyEngineGenericKernelObjectList7OutputLER23CMemSpyEngineOutputSink @ 403 NONAME
+	_ZNK36CMemSpyThreadInfoOwnedProcessHandles4NameEv @ 404 NONAME
+	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle10MemoryFreeEv @ 405 NONAME
+	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle11ChangeCountEv @ 406 NONAME
+	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle11CycleNumberEv @ 407 NONAME
+	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle11MemoryDeltaEv @ 408 NONAME
+	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle13TimeFormattedEv @ 409 NONAME
+	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle23MemoryFreePreviousCycleEv @ 410 NONAME
+	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle4TimeEv @ 411 NONAME
+	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle7CaptionEv @ 412 NONAME
+	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle9MdcaCountEv @ 413 NONAME
+	_ZNK37CMemSpyEngineHelperSysMemTrackerCycle9MdcaPointEi @ 414 NONAME
+	_ZNK41CMemSpyEngineGenericKernelObjectContainer2AtEi @ 415 NONAME
+	_ZNK41CMemSpyEngineGenericKernelObjectContainer5CountEv @ 416 NONAME
+	_ZNK41CMemSpyEngineGenericKernelObjectContainer7OutputLER23CMemSpyEngineOutputSink @ 417 NONAME
+	_ZNK41CMemSpyEngineGenericKernelObjectContainer9MdcaCountEv @ 418 NONAME
+	_ZNK41CMemSpyEngineGenericKernelObjectContainer9MdcaPointEi @ 419 NONAME
+	_ZTI23CMemSpyEngineDriveEntry @ 420 NONAME ; #<TI>#
+	_ZTI41CMemSpyEngineHelperSysMemTrackerEntryCode @ 421 NONAME ; #<TI>#
+	_ZTI41CMemSpyEngineHelperSysMemTrackerEntryHeap @ 422 NONAME ; #<TI>#
+	_ZTI42CMemSpyEngineHelperSysMemTrackerEntryChunk @ 423 NONAME ; #<TI>#
+	_ZTI42CMemSpyEngineHelperSysMemTrackerEntryStack @ 424 NONAME ; #<TI>#
+	_ZTI42CMemSpyEngineHelperSysMemTrackerGlobalData @ 425 NONAME ; #<TI>#
+	_ZTI43CMemSpyEngineHelperSysMemTrackerEntryBitmap @ 426 NONAME ; #<TI>#
+	_ZTI43CMemSpyEngineHelperSysMemTrackerEntryFbserv @ 427 NONAME ; #<TI>#
+	_ZTI45CMemSpyEngineHelperSysMemTrackerEntryOpenFile @ 428 NONAME ; #<TI>#
+	_ZTI45CMemSpyEngineHelperSysMemTrackerEntryRamDrive @ 429 NONAME ; #<TI>#
+	_ZTI46CMemSpyEngineHelperSysMemTrackerEntryDiskSpace @ 430 NONAME ; #<TI>#
+	_ZTI48CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS @ 431 NONAME ; #<TI>#
+	_ZTI50CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric @ 432 NONAME ; #<TI>#
+	_ZTI52CMemSpyEngineHelperSysMemTrackerEntryFileServerCache @ 433 NONAME ; #<TI>#
+	_ZTIN25CMemSpyThreadInfoItemBase5CItemE @ 434 NONAME ; #<TI>#
+	_ZTV23CMemSpyEngineDriveEntry @ 435 NONAME ; #<VT>#
+	_ZTV41CMemSpyEngineHelperSysMemTrackerEntryCode @ 436 NONAME ; #<VT>#
+	_ZTV41CMemSpyEngineHelperSysMemTrackerEntryHeap @ 437 NONAME ; #<VT>#
+	_ZTV42CMemSpyEngineHelperSysMemTrackerEntryChunk @ 438 NONAME ; #<VT>#
+	_ZTV42CMemSpyEngineHelperSysMemTrackerEntryStack @ 439 NONAME ; #<VT>#
+	_ZTV42CMemSpyEngineHelperSysMemTrackerGlobalData @ 440 NONAME ; #<VT>#
+	_ZTV43CMemSpyEngineHelperSysMemTrackerEntryBitmap @ 441 NONAME ; #<VT>#
+	_ZTV43CMemSpyEngineHelperSysMemTrackerEntryFbserv @ 442 NONAME ; #<VT>#
+	_ZTV45CMemSpyEngineHelperSysMemTrackerEntryOpenFile @ 443 NONAME ; #<VT>#
+	_ZTV45CMemSpyEngineHelperSysMemTrackerEntryRamDrive @ 444 NONAME ; #<VT>#
+	_ZTV46CMemSpyEngineHelperSysMemTrackerEntryDiskSpace @ 445 NONAME ; #<VT>#
+	_ZTV48CMemSpyEngineHelperSysMemTrackerEntryHandlePAndS @ 446 NONAME ; #<VT>#
+	_ZTV50CMemSpyEngineHelperSysMemTrackerEntryHandleGeneric @ 447 NONAME ; #<VT>#
+	_ZTV52CMemSpyEngineHelperSysMemTrackerEntryFileServerCache @ 448 NONAME ; #<VT>#
+	_ZTVN25CMemSpyThreadInfoItemBase5CItemE @ 449 NONAME ; #<VT>#
+	_ZThn16_NK14CMemSpyProcess9MdcaCountEv @ 450 NONAME ; #<thunk>#
+	_ZThn16_NK14CMemSpyProcess9MdcaPointEi @ 451 NONAME ; #<thunk>#
+	_ZThn16_NK22CMemSpyThreadInfoChunk9MdcaCountEv @ 452 NONAME ; #<thunk>#
+	_ZThn16_NK22CMemSpyThreadInfoChunk9MdcaPointEi @ 453 NONAME ; #<thunk>#
+	_ZThn16_NK24CMemSpyThreadInfoCodeSeg9MdcaCountEv @ 454 NONAME ; #<thunk>#
+	_ZThn16_NK24CMemSpyThreadInfoCodeSeg9MdcaPointEi @ 455 NONAME ; #<thunk>#
+	_ZThn16_NK25CMemSpyThreadInfoItemBase9MdcaCountEv @ 456 NONAME ; #<thunk>#
+	_ZThn16_NK25CMemSpyThreadInfoItemBase9MdcaPointEi @ 457 NONAME ; #<thunk>#
+	_ZThn16_NK26CMemSpyThreadInfoContainer9MdcaCountEv @ 458 NONAME ; #<thunk>#
+	_ZThn16_NK26CMemSpyThreadInfoContainer9MdcaPointEi @ 459 NONAME ; #<thunk>#
+	_ZThn16_NK30CMemSpyThreadInfoActiveObjects9MdcaCountEv @ 460 NONAME ; #<thunk>#
+	_ZThn16_NK30CMemSpyThreadInfoActiveObjects9MdcaPointEi @ 461 NONAME ; #<thunk>#
+	_ZThn24_N25CMemSpyEngineActiveObjectD0Ev @ 462 NONAME ; #<thunk>#
+	_ZThn24_N25CMemSpyEngineActiveObjectD1Ev @ 463 NONAME ; #<thunk>#
+	_ZThn24_N25CMemSpyEngineCodeSegEntryD0Ev @ 464 NONAME ; #<thunk>#
+	_ZThn24_N25CMemSpyEngineCodeSegEntryD1Ev @ 465 NONAME ; #<thunk>#
+	_ZThn24_N25CMemSpyEngineFbServBitmapD0Ev @ 466 NONAME ; #<thunk>#
+	_ZThn24_N25CMemSpyEngineFbServBitmapD1Ev @ 467 NONAME ; #<thunk>#
+	_ZThn28_N22CMemSpyEngineDriveListD0Ev @ 468 NONAME ; #<thunk>#
+	_ZThn28_N22CMemSpyEngineDriveListD1Ev @ 469 NONAME ; #<thunk>#
+	_ZThn28_N23CMemSpyEngineDriveEntryD0Ev @ 470 NONAME ; #<thunk>#
+	_ZThn28_N23CMemSpyEngineDriveEntryD1Ev @ 471 NONAME ; #<thunk>#
+	_ZThn28_N30CMemSpyEngineFbServBitmapArrayD0Ev @ 472 NONAME ; #<thunk>#
+	_ZThn28_N30CMemSpyEngineFbServBitmapArrayD1Ev @ 473 NONAME ; #<thunk>#
+	_ZThn28_NK22CMemSpyEngineDriveList9MdcaCountEv @ 474 NONAME ; #<thunk>#
+	_ZThn28_NK22CMemSpyEngineDriveList9MdcaPointEi @ 475 NONAME ; #<thunk>#
+	_ZThn28_NK23CMemSpyEngineDriveEntry9MdcaCountEv @ 476 NONAME ; #<thunk>#
+	_ZThn28_NK23CMemSpyEngineDriveEntry9MdcaPointEi @ 477 NONAME ; #<thunk>#
+	_ZThn28_NK30CMemSpyEngineFbServBitmapArray9MdcaCountEv @ 478 NONAME ; #<thunk>#
+	_ZThn28_NK30CMemSpyEngineFbServBitmapArray9MdcaPointEi @ 479 NONAME ; #<thunk>#
+	_ZThn4_N22CMemSpyEngineChunkListD0Ev @ 480 NONAME ; #<thunk>#
+	_ZThn4_N22CMemSpyEngineChunkListD1Ev @ 481 NONAME ; #<thunk>#
+	_ZThn4_N23CMemSpyEngineServerListD0Ev @ 482 NONAME ; #<thunk>#
+	_ZThn4_N23CMemSpyEngineServerListD1Ev @ 483 NONAME ; #<thunk>#
+	_ZThn4_N30CMemSpyEngineActiveObjectArrayD0Ev @ 484 NONAME ; #<thunk>#
+	_ZThn4_N30CMemSpyEngineActiveObjectArrayD1Ev @ 485 NONAME ; #<thunk>#
+	_ZThn4_N41CMemSpyEngineGenericKernelObjectContainerD0Ev @ 486 NONAME ; #<thunk>#
+	_ZThn4_N41CMemSpyEngineGenericKernelObjectContainerD1Ev @ 487 NONAME ; #<thunk>#
+	_ZThn4_NK22CMemSpyEngineChunkList9MdcaCountEv @ 488 NONAME ; #<thunk>#
+	_ZThn4_NK22CMemSpyEngineChunkList9MdcaPointEi @ 489 NONAME ; #<thunk>#
+	_ZThn4_NK23CMemSpyEngineChunkEntry9MdcaCountEv @ 490 NONAME ; #<thunk>#
+	_ZThn4_NK23CMemSpyEngineChunkEntry9MdcaPointEi @ 491 NONAME ; #<thunk>#
+	_ZThn4_NK23CMemSpyEngineServerList9MdcaCountEv @ 492 NONAME ; #<thunk>#
+	_ZThn4_NK23CMemSpyEngineServerList9MdcaPointEi @ 493 NONAME ; #<thunk>#
+	_ZThn4_NK25CMemSpyEngineEComCategory9MdcaCountEv @ 494 NONAME ; #<thunk>#
+	_ZThn4_NK25CMemSpyEngineEComCategory9MdcaPointEi @ 495 NONAME ; #<thunk>#
+	_ZThn4_NK26CMemSpyEngineEComInterface9MdcaCountEv @ 496 NONAME ; #<thunk>#
+	_ZThn4_NK26CMemSpyEngineEComInterface9MdcaPointEi @ 497 NONAME ; #<thunk>#
+	_ZThn4_NK28CMemSpyEngineObjectContainer9MdcaCountEv @ 498 NONAME ; #<thunk>#
+	_ZThn4_NK28CMemSpyEngineObjectContainer9MdcaPointEi @ 499 NONAME ; #<thunk>#
+	_ZThn4_NK30CMemSpyEngineActiveObjectArray9MdcaCountEv @ 500 NONAME ; #<thunk>#
+	_ZThn4_NK30CMemSpyEngineActiveObjectArray9MdcaPointEi @ 501 NONAME ; #<thunk>#
+	_ZThn4_NK31CMemSpyEngineEComImplementation9MdcaCountEv @ 502 NONAME ; #<thunk>#
+	_ZThn4_NK31CMemSpyEngineEComImplementation9MdcaPointEi @ 503 NONAME ; #<thunk>#
+	_ZThn4_NK37CMemSpyEngineHelperSysMemTrackerCycle9MdcaCountEv @ 504 NONAME ; #<thunk>#
+	_ZThn4_NK37CMemSpyEngineHelperSysMemTrackerCycle9MdcaPointEi @ 505 NONAME ; #<thunk>#
+	_ZThn4_NK41CMemSpyEngineGenericKernelObjectContainer9MdcaCountEv @ 506 NONAME ; #<thunk>#
+	_ZThn4_NK41CMemSpyEngineGenericKernelObjectContainer9MdcaPointEi @ 507 NONAME ; #<thunk>#
+	_ZThn56_NK24CMemSpyEngineCodeSegList9MdcaCountEv @ 508 NONAME ; #<thunk>#
+	_ZThn56_NK24CMemSpyEngineCodeSegList9MdcaPointEi @ 509 NONAME ; #<thunk>#
+	_ZThn8_NK23CMemSpyEngineHelperECom9MdcaCountEv @ 510 NONAME ; #<thunk>#
+	_ZThn8_NK23CMemSpyEngineHelperECom9MdcaPointEi @ 511 NONAME ; #<thunk>#
+	_ZThn8_NK32CMemSpyEngineHelperSysMemTracker9MdcaCountEv @ 512 NONAME ; #<thunk>#
+	_ZThn8_NK32CMemSpyEngineHelperSysMemTracker9MdcaPointEi @ 513 NONAME ; #<thunk>#
+	_ZN13CMemSpyEngine18HelperWindowServerEv @ 514 NONAME
+	_ZN28CMemSpyEngineWindowGroupListD0Ev @ 515 NONAME ABSENT
+	_ZN28CMemSpyEngineWindowGroupListD1Ev @ 516 NONAME ABSENT
+	_ZN28CMemSpyEngineWindowGroupListD2Ev @ 517 NONAME ABSENT
+	_ZN31CMemSpyEngineHelperWindowServer16WindowGroupListLEv @ 518 NONAME ABSENT
+	_ZN31CMemSpyEngineHelperWindowServer19GetWindowGroupListLER6RArrayI33TMemSpyEngineWindowGroupBasicInfoE @ 519 NONAME ABSENT
+	_ZN31CMemSpyEngineHelperWindowServer22GetWindowGroupDetailsLEiR31TMemSpyEngineWindowGroupDetails @ 520 NONAME ABSENT
+	_ZNK28CMemSpyEngineWindowGroupList2AtEi @ 521 NONAME ABSENT
+	_ZNK28CMemSpyEngineWindowGroupList5CountEv @ 522 NONAME ABSENT
+	_ZNK28CMemSpyEngineWindowGroupList9ItemIndexERK33TMemSpyEngineWindowGroupBasicInfo @ 523 NONAME ABSENT
+	_ZNK28CMemSpyEngineWindowGroupList9MdcaCountEv @ 524 NONAME ABSENT
+	_ZNK28CMemSpyEngineWindowGroupList9MdcaPointEi @ 525 NONAME ABSENT
+	_ZThn4_N28CMemSpyEngineWindowGroupListD0Ev @ 526 NONAME ABSENT
+	_ZThn4_N28CMemSpyEngineWindowGroupListD1Ev @ 527 NONAME ABSENT
+	_ZThn4_NK28CMemSpyEngineWindowGroupList9MdcaCountEv @ 528 NONAME ABSENT
+	_ZThn4_NK28CMemSpyEngineWindowGroupList9MdcaPointEi @ 529 NONAME ABSENT
+	_ZN31CMemSpyEngineHelperWindowServer9SwitchToLEi @ 530 NONAME ABSENT
+	_ZN13CMemSpyEngine13HelperCondVarEv @ 531 NONAME
+	_ZNK14CMemSpyProcess12CapabilitiesEv @ 532 NONAME
+	_ZNK14CMemSpyProcess4UIDsEv @ 533 NONAME
+	_ZN26CMemSpyEngineHelperCondVar27GetCondVarSuspendedThreadsLERK30TMemSpyDriverHandleInfoGenericR6RArrayI39TMemSpyDriverCondVarSuspendedThreadInfoE @ 534 NONAME
+	_ZTI49CMemSpyEngineHelperSysMemTrackerEntryWindowServer @ 535 NONAME ; #<TI>#
+	_ZTV49CMemSpyEngineHelperSysMemTrackerEntryWindowServer @ 536 NONAME ; #<VT>#
+	_ZN13CMemSpyEngine29IsHelperWindowServerSupportedEv @ 537 NONAME
+	_ZN23CMemSpyEngineHelperHeap14NewHeapRawInfoERK15TMemSpyHeapInfo @ 538 NONAME
+	_ZNK36CMemSpyEngineGenericKernelObjectList10ItemsCountEv @ 539 NONAME
+	_ZNK36CMemSpyEngineGenericKernelObjectList4SizeEv @ 540 NONAME
+	_ZNK13CMemSpyThread8PriorityEv @ 541 NONAME
+	_ZN13CMemSpyEngine4NewLER3RFsi @ 542 NONAME
+	_ZNK14CMemSpyProcess10ExitReasonEv @ 543 NONAME
+	_ZNK14CMemSpyProcess12ExitCategoryEv @ 544 NONAME
+	_ZNK14CMemSpyProcess8ExitTypeEv @ 545 NONAME
+	_ZNK14CMemSpyProcess8PriorityEv @ 546 NONAME
+	_ZNK25CMemSpyThreadInfoItemBase5ValueEi @ 547 NONAME
+	_ZNK25CMemSpyThreadInfoItemBase7CaptionEi @ 548 NONAME
+	_ZN13CMemSpyEngine16InstallFileSinkLERK7TDesC16 @ 549 NONAME
+	_ZN13CMemSpyEngine17InstallDebugSinkLEv @ 550 NONAME
+	_ZN25CMemSpyEngineSinkMetaData4NewLERK7TDesC16S2_S2_S2_ii @ 551 NONAME
+	_ZN25CMemSpyEngineSinkMetaData4NewLERK7TDesC16S2_S2_S2_iiRK5TTime @ 552 NONAME
+	_ZN32CMemSpyEngineHelperSysMemTracker19CheckForChangesNowLEv @ 553 NONAME
+	_ZN23CMemSpyEngineHelperHeap16GetHeapInfoUserLERK10TProcessIdRK9TThreadIdR15TMemSpyHeapInfoP6RArrayI21TMemSpyDriverFreeCellEi @ 554 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/group/MemSpyEngine.config	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,5 @@
+
+/**
+ * Use this file for MemSpy engine macro definitions
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/group/MemSpyEngine.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* 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 <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          memspyengine.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x2002129A
+VENDORID		VID_DEFAULT
+SMPSAFE
+
+#include		"../../group/MemSpyCapabilities.mmh"
+
+SOURCEPATH      ../Source
+SOURCE          MemSpyEngine.cpp
+SOURCE          MemSpyEngineImp.cpp
+SOURCE          MemSpyEngineUtils.cpp
+SOURCE			MemSpyEngineProcessMemoryTracker.cpp
+SOURCE          MemSpyEngineTwiddlableItemArray.cpp
+
+SOURCEPATH      ../Source/DeviceWideOps
+SOURCE          MemSpyDeviceWideOperations.cpp
+
+SOURCEPATH		../Source/ClientServer
+SOURCE          MemSpyEngineServer.cpp
+
+SOURCEPATH		../Source/ThreadAndProcess
+SOURCE          MemSpyEngineObject.cpp
+SOURCE          MemSpyEngineObjectProcess.cpp
+SOURCE          MemSpyEngineObjectContainer.cpp
+SOURCE          MemSpyEngineObjectThread.cpp
+SOURCE          MemSpyEngineObjectThreadInfoContainer.cpp
+SOURCE          MemSpyEngineObjectThreadInfoObjects.cpp
+
+SOURCEPATH		../Source/Sink
+SOURCE			MemSpyEngineOutputList.cpp
+SOURCE			MemSpyEngineOutputListItem.cpp
+SOURCE          MemSpyEngineOutputSink.cpp
+SOURCE          MemSpyEngineOutputSinkDebug.cpp
+SOURCE          MemSpyEngineOutputSinkFile.cpp
+
+SOURCEPATH		../Source/Helpers
+SOURCE          MemSpyEngineHelperHeap.cpp
+SOURCE          MemSpyEngineHelperStack.cpp
+SOURCE          MemSpyEngineHelperCodeSegment.cpp
+SOURCE          MemSpyEngineHelperFbServ.cpp
+SOURCE          MemSpyEngineHelperChunk.cpp
+SOURCE          MemSpyEngineHelperThread.cpp
+SOURCE          MemSpyEngineHelperProcess.cpp
+SOURCE          MemSpyEngineHelperServer.cpp
+SOURCE          MemSpyEngineHelperActiveObject.cpp
+SOURCE          MemSpyEngineHelperKernelContainers.cpp
+SOURCE			MemSpyEngineHelperFileSystem.cpp
+SOURCE			MemSpyEngineHelperECom.cpp
+SOURCE			MemSpyEngineHelperROM.cpp
+SOURCE			MemSpyEngineHelperRAM.cpp
+SOURCE          MemSpyEngineHelperCondVar.cpp
+
+SOURCEPATH      ../Source/SysMemTracker
+SOURCE			MemSpyEngineHelperSysMemTracker.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerImp.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryManager.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerOutputFormatter.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerCycle.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerCycleChange.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntries.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryHeap.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryChunk.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryRamDrive.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryStack.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryGlobalData.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryCode.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryHandleGeneric.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryHandlePAndS.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryOpenFile.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryDiskSpace.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryBitmap.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryFbserv.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryFileServerCache.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntrySystemMemory.cpp
+SOURCE			MemSpyEngineHelperSysMemTrackerEntryWindowServer.cpp
+
+SOURCEPATH      ../Source/EventHandlers
+SOURCE          MemSpyEngineUndertaker.cpp
+SOURCE          MemSpyEngineMidwife.cpp
+SOURCE          MemSpyEngineChunkWatcher.cpp
+
+
+USERINCLUDE		../Include
+USERINCLUDE		../Include/Helpers
+USERINCLUDE		../Include/Sink
+USERINCLUDE		../Include/SysMemTracker
+USERINCLUDE		../Include/ClientServer
+USERINCLUDE		../Include/ThreadAndProcess
+USERINCLUDE		../Include/EventHandlers
+USERINCLUDE		../Include/Logger
+
+OS_LAYER_SYSTEMINCLUDE
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY			euser.lib 
+LIBRARY			MemSpyDriverClient.lib hal.lib estor.lib
+LIBRARY			efsrv.lib bafl.lib fbscli.lib
+LIBRARY			ecom.lib xmlframework.lib charconv.lib
+LIBRARY			apgrfx.lib
+LIBRARY	 		ws32.lib
+
+
+#include "MemSpyEngine.config"
+
+//EXPORTUNFROZEN
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Engine/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* 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:
+*
+*/
+
+
+PRJ_MMPFILES
+MemSpyEngine.mmp
+	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/bwins/MemSpyClientu.def	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,221 @@
+EXPORTS
+	?CpuUse@CMemSpyApiThread@@QBEHXZ @ 1 NONAME ; int CMemSpyApiThread::CpuUse(void) const
+	?Name@CMemSpyApiKernelObjectItem@@QBEABVTDesC8@@XZ @ 2 NONAME ; class TDesC8 const & CMemSpyApiKernelObjectItem::Name(void) const
+	?GetThreadInfoItemsL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiThreadInfoItem@@@@VTThreadId@@W4TMemSpyThreadInfoItemType@@@Z @ 3 NONAME ; void RMemSpySession::GetThreadInfoItemsL(class RArray<class CMemSpyApiThreadInfoItem *> &, class TThreadId, enum TMemSpyThreadInfoItemType)
+	?Description@TMemSpyDeviceWideOperationProgress@@QBEABVTDesC16@@XZ @ 4 NONAME ; class TDesC16 const & TMemSpyDeviceWideOperationProgress::Description(void) const
+	?TotalOverhead@CMemSpyApiHeap@@QAEHXZ @ 5 NONAME ; int CMemSpyApiHeap::TotalOverhead(void)
+	?OutputDetailedPhoneInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 6 NONAME ; void RMemSpySession::OutputDetailedPhoneInfo(class TRequestStatus &)
+	?UniqueID@CMemSpyApiKernelObjectItem@@QBEHXZ @ 7 NONAME ; int CMemSpyApiKernelObjectItem::UniqueID(void) const
+	?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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/eabi/MemSpyClientu.def	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,236 @@
+EXPORTS
+	_ZN14CMemSpyApiHeap11BaseAddressEv @ 1 NONAME
+	_ZN14CMemSpyApiHeap11BiggestFreeEv @ 2 NONAME
+	_ZN14CMemSpyApiHeap11HeaderSizeAEv @ 3 NONAME
+	_ZN14CMemSpyApiHeap11HeaderSizeFEv @ 4 NONAME
+	_ZN14CMemSpyApiHeap12FreeOverheadEv @ 5 NONAME
+	_ZN14CMemSpyApiHeap13FragmentationEv @ 6 NONAME
+	_ZN14CMemSpyApiHeap13TotalOverheadEv @ 7 NONAME
+	_ZN14CMemSpyApiHeap14SlackFreeSpaceEv @ 8 NONAME
+	_ZN14CMemSpyApiHeap16AllocationsCountEv @ 9 NONAME
+	_ZN14CMemSpyApiHeap16TotalAllocationsEv @ 10 NONAME
+	_ZN14CMemSpyApiHeap17BiggestAllocationEv @ 11 NONAME
+	_ZN14CMemSpyApiHeap18AllocationOverheadEv @ 12 NONAME
+	_ZN14CMemSpyApiHeap21DebugAllocatorLibraryEv @ 13 NONAME
+	_ZN14CMemSpyApiHeap4SizeEv @ 14 NONAME
+	_ZN14CMemSpyApiHeap4TypeEv @ 15 NONAME
+	_ZN14CMemSpyApiHeap6SharedEv @ 16 NONAME
+	_ZN14CMemSpyApiHeap8OverheadEv @ 17 NONAME
+	_ZN14CMemSpyApiHeap9ChunkSizeEv @ 18 NONAME
+	_ZN14CMemSpyApiHeap9FreeCountEv @ 19 NONAME
+	_ZN14CMemSpyApiHeap9MaxLengthEv @ 20 NONAME
+	_ZN14CMemSpyApiHeap9MinLengthEv @ 21 NONAME
+	_ZN14CMemSpyApiHeap9TotalFreeEv @ 22 NONAME
+	_ZN14CMemSpyApiHeapD1Ev @ 23 NONAME
+	_ZN14CMemSpyApiHeapD2Ev @ 24 NONAME
+	_ZN14RMemSpySession10EndThreadLE9TThreadId14TMemSpyEndType @ 25 NONAME
+	_ZN14RMemSpySession11EndProcessLE10TProcessId14TMemSpyEndType @ 26 NONAME
+	_ZN14RMemSpySession11GetServersLER6RArrayIP16CMemSpyApiServerE @ 27 NONAME
+	_ZN14RMemSpySession11GetServersLER6RArrayIP16CMemSpyApiServerE9TSortType @ 28 NONAME
+	_ZN14RMemSpySession11GetSwmtModeERN38TMemSpyEngineHelperSysMemTrackerConfig30TMemSpyEngineSysMemTrackerModeE @ 29 NONAME
+	_ZN14RMemSpySession11GetThreadsLE10TProcessIdR6RArrayIP16CMemSpyApiThreadE9TSortType @ 30 NONAME
+	_ZN14RMemSpySession11SetSwmtModeEN38TMemSpyEngineHelperSysMemTrackerConfig30TMemSpyEngineSysMemTrackerModeE @ 31 NONAME
+	_ZN14RMemSpySession13GetOutputSinkER15TMemSpySinkType @ 32 NONAME
+	_ZN14RMemSpySession13GetProcessesLER6RArrayIP17CMemSpyApiProcessE9TSortType @ 33 NONAME
+	_ZN14RMemSpySession13GetSwmtFilterER4TBufILi128EE @ 34 NONAME
+	_ZN14RMemSpySession13OutputAOListLE9TThreadId25TMemSpyThreadInfoItemType @ 35 NONAME
+	_ZN14RMemSpySession13SetSwmtFilterERK7TDesC16 @ 36 NONAME
+	_ZN14RMemSpySession14DumpKernelHeapEv @ 37 NONAME
+	_ZN14RMemSpySession14IsSwmtRunningLEv @ 38 NONAME
+	_ZN14RMemSpySession14OutputHeapDataER14TRequestStatus @ 39 NONAME
+	_ZN14RMemSpySession14OutputHeapDataEv @ 40 NONAME
+	_ZN14RMemSpySession14OutputHeapInfoER14TRequestStatus @ 41 NONAME
+	_ZN14RMemSpySession14StopSwmtTimerLEv @ 42 NONAME
+	_ZN14RMemSpySession14SwitchToThreadE9TThreadIdi @ 43 NONAME
+	_ZN14RMemSpySession15ForceSwmtUpdateER14TRequestStatus @ 44 NONAME
+	_ZN14RMemSpySession15GetInfoItemTypeEi9TThreadIdR25TMemSpyThreadInfoItemType @ 45 NONAME
+	_ZN14RMemSpySession15OutputPhoneInfoER14TRequestStatus @ 46 NONAME
+	_ZN14RMemSpySession15OutputPhoneInfoEv @ 47 NONAME
+	_ZN14RMemSpySession15OutputStackInfoER14TRequestStatus @ 48 NONAME
+	_ZN14RMemSpySession15StartSwmtTimerLEi @ 49 NONAME
+	_ZN14RMemSpySession15StartSwmtTimerLEv @ 50 NONAME
+	_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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/group/MemSpyClient.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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 <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGETTYPE dll
+TARGET MemSpyClient.dll
+UID 0 0x2002EA8E
+VENDORID	VID_DEFAULT
+SMPSAFE
+
+CAPABILITY PowerMgmt SwEvent ReadUserData WriteUserData ReadDeviceData WriteDeviceData CommDD MultimediaDD DRM TrustedUI ProtServ DiskAdmin NetworkControl AllFiles NetworkServices LocalServices Location SurroundingsDD UserEnvironment
+
+SOURCEPATH ../src
+SOURCE 		memspysession.cpp 
+SOURCE 		memspyapiprocess.cpp 
+SOURCE 		memspyapikernelobject.cpp 
+SOURCE		memspyapiheap.cpp 
+SOURCE 		memspyapikernelobjectitem.cpp 
+SOURCE		memspyapithread.cpp 
+SOURCE		memspyapithreadinfoitem.cpp
+SOURCE		memspyapimemorytrackingcycle.cpp
+SOURCE 		memspyapiserver.cpp
+SOURCE 		memspyapiecom.cpp  
+
+USERINCLUDE ../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+LIBRARY 		euser.lib
+LIBRARY			ecom.lib
+LIBRARY			efsrv.lib
+LIBRARY			estor.lib
+LIBRARY			bafl.lib
+LIBRARY			ws32.lib
+LIBRARY			cone.lib
+LIBRARY			eikcore.lib
+LIBRARY			fbscli.lib 
+LIBRARY 		PlatformEnv.lib
+LIBRARY         MemSpyEngine.lib
+
+//EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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 <platform_paths.hrh>
+
+PRJ_EXPORTS
+// Public API
+../inc/memspysession.h OS_LAYER_PLATFORM_EXPORT_PATH(memspysession.h)
+../inc/memspyprocessdata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyprocessdata.h)
+../inc/memspykernelobjectdata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspykernelobjectdata.h)
+../inc/memspyheapdata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyheapdata.h)
+../inc/memspythreaddata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspythreaddata.h)
+../inc/memspythreadinfoitemdata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspythreadinfoitemdata.h)
+../inc/memspymemorytrackingcycledata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspymemorytrackingcycledata.h)
+../inc/memspyserverdata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyserverdata.h)
+../inc/memspyecomdata.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyecomdata.h)
+
+../inc/memspyapiprocess.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapiprocess.h)
+../inc/memspyapikernelobject.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapikernelobject.h)
+../inc/memspyapikernelobjectitem.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapikernelobjectitem.h)
+../inc/memspyapiheap.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapiheap.h)
+../inc/memspyapithread.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapithread.h)
+../inc/memspyapithreadinfoitem.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapithreadinfoitem.h)
+../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)
+
+PRJ_MMPFILES
+MemSpyClient.mmp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapiecom.h	Mon Sep 06 15:00:47 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:
+* Contains the declaration of  CMemSpyProcess class 
+*/
+
+#ifndef MEMSPYAPIECOM_H
+#define MEMSPYAPIECOM_H
+
+// System includes
+#include <e32base.h>
+#include <f32file.h>
+
+class TMemSpyEComCategoryData;
+class TMemSpyEComInterfaceData;
+class TMemSpyEComImplementationData;
+
+NONSHARABLE_CLASS( CMemSpyApiEComCategory ) : public CBase
+	{
+public:
+	IMPORT_C ~CMemSpyApiEComCategory();
+	
+	static CMemSpyApiEComCategory* NewL(const TMemSpyEComCategoryData& aData);
+
+	static CMemSpyApiEComCategory* NewLC(const TMemSpyEComCategoryData& aData);
+	
+public:
+	IMPORT_C TUid Id() const;
+	
+	IMPORT_C const TDesC& Name() const;
+	
+	IMPORT_C TInt InterfaceCount() const;
+	
+private:
+	void ConstructL(const TMemSpyEComCategoryData& aData);
+		
+private:
+	TMemSpyEComCategoryData *iData;
+};
+
+NONSHARABLE_CLASS( CMemSpyApiEComInterface ) : public CBase
+    {
+public:
+    IMPORT_C ~CMemSpyApiEComInterface();
+    
+    static CMemSpyApiEComInterface* NewL(const TMemSpyEComInterfaceData& aData);
+
+    static CMemSpyApiEComInterface* NewLC(const TMemSpyEComInterfaceData& aData);
+    
+public:
+    IMPORT_C TUid Id() const;
+    
+    IMPORT_C TUid CategoryId() const;
+    
+    IMPORT_C const TDesC& Name() const;
+    
+    IMPORT_C TInt ImplementationCount() const;
+    
+private:
+    void ConstructL(const TMemSpyEComInterfaceData& aData);
+        
+private:
+    TMemSpyEComInterfaceData *iData;
+};
+
+NONSHARABLE_CLASS( CMemSpyApiEComImplementation ) : public CBase 
+    {
+public:
+    IMPORT_C ~CMemSpyApiEComImplementation();
+    
+    static CMemSpyApiEComImplementation* NewL(const TMemSpyEComImplementationData& aData);
+
+    static CMemSpyApiEComImplementation* NewLC(const TMemSpyEComImplementationData& aData);
+    
+public:
+    IMPORT_C TUid ImplementationUid() const;
+        
+    IMPORT_C const TDesC& Name() const;
+    
+    IMPORT_C TInt Version() const;
+    
+    IMPORT_C const TDesC& DataType() const;
+        
+    IMPORT_C const TDesC& OpaqueData() const;
+    
+    IMPORT_C TDriveUnit Drive() const;
+        
+    IMPORT_C TBool RomOnly() const;
+        
+    IMPORT_C TBool RomBased() const;
+        
+    IMPORT_C TVendorId VendorId() const;
+        
+    IMPORT_C TBool Disabled() const;
+    
+private:
+    
+    void ConstructL(const TMemSpyEComImplementationData& aData);
+        
+private:
+    TMemSpyEComImplementationData *iData;
+};
+
+
+#endif // MEMSPYAPIECOM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapiheap.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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  CMemSpyApiHeap class 
+*/
+
+#ifndef MEMSPYAPIHEAP_H
+#define MEMSPYAPIHEAP_H
+
+// System includes
+#include <e32base.h>
+
+class TMemSpyHeapData;
+
+NONSHARABLE_CLASS( CMemSpyApiHeap ) 
+	{
+public:
+	IMPORT_C ~CMemSpyApiHeap();
+	
+	static CMemSpyApiHeap* NewL(const TMemSpyHeapData& aData);
+
+	static CMemSpyApiHeap* NewLC(const TMemSpyHeapData& aData);
+	
+public: //API
+	IMPORT_C TDesC& Type();
+	IMPORT_C TInt Size();
+	IMPORT_C TInt BaseAddress();
+	IMPORT_C TBool Shared();
+	IMPORT_C TInt ChunkSize();
+	IMPORT_C TInt AllocationsCount();
+	IMPORT_C TInt FreeCount();
+	IMPORT_C TInt BiggestAllocation();
+	IMPORT_C TInt BiggestFree();
+	IMPORT_C TInt TotalAllocations();
+	IMPORT_C TInt TotalFree();
+	IMPORT_C TInt SlackFreeSpace();
+	IMPORT_C TInt Fragmentation(); // Percentage value, iSize is 100% - value for calculation
+	IMPORT_C TInt HeaderSizeA();
+	IMPORT_C TInt HeaderSizeF();
+	IMPORT_C TInt AllocationOverhead();
+	IMPORT_C TInt FreeOverhead();
+	IMPORT_C TInt TotalOverhead();
+	IMPORT_C TInt Overhead(); //Percentage value, iSize is 100% - value for calculation
+	IMPORT_C TInt MinLength();
+	IMPORT_C TInt MaxLength();
+	IMPORT_C TBool DebugAllocatorLibrary();
+	
+private:
+	CMemSpyApiHeap();
+	
+	void ConstructL(const TMemSpyHeapData& aData);
+		
+private:
+	TMemSpyHeapData *iHeapData;
+};
+
+	
+#endif // MEMSPYAPIHEAP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapikernelobject.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 MEMSPYAPIPKERNELOBJECT_H
+#define MEMSPYAPIPKERNELOBJECT_H
+
+// System includes
+#include <e32base.h>
+
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+class TMemSpyKernelObjectData;
+
+NONSHARABLE_CLASS( CMemSpyApiKernelObject ) 
+	{
+public:
+	IMPORT_C ~CMemSpyApiKernelObject();
+	
+	static CMemSpyApiKernelObject* NewL(const TMemSpyKernelObjectData& aData);
+
+	static CMemSpyApiKernelObject* NewLC(const TMemSpyKernelObjectData& aData);
+	
+public:
+	IMPORT_C TMemSpyDriverContainerType Type() const;
+	
+	IMPORT_C const TDesC& Name() const;	
+						
+	IMPORT_C TInt Count() const;
+		
+	IMPORT_C TInt64 Size() const;
+	
+private:
+	CMemSpyApiKernelObject();
+	
+	void ConstructL(const TMemSpyKernelObjectData& aData);
+		
+private:
+	TMemSpyKernelObjectData *iKernelObjectData;
+};
+
+	
+#endif // MEMSPYAPIPKERNELOBJECT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapikernelobjectitem.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* 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 MEMSPYAPIKERNELOBJECTITEM_H
+#define MEMSPYAPIKERNELOBJECTITEM_H
+
+// System includes
+#include <e32base.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+class TMemSpyDriverHandleInfoGeneric;
+//class TMemSpyDriverContainerType;	
+//class TMemSpyDriverTimerType;
+//class TMemSpyDriverTimerState;
+
+NONSHARABLE_CLASS( CMemSpyApiKernelObjectItem ) 
+	{
+public:
+	IMPORT_C ~CMemSpyApiKernelObjectItem();
+	
+	static CMemSpyApiKernelObjectItem* NewL(const TMemSpyDriverHandleInfoGeneric& aData);
+
+	static CMemSpyApiKernelObjectItem* NewLC(const TMemSpyDriverHandleInfoGeneric& aData);
+	
+public:	
+	
+	IMPORT_C const TDesC8& Name() const;	
+	
+	IMPORT_C TAny* Handle() const;
+	
+	IMPORT_C TMemSpyDriverContainerType Type() const;
+	
+    // For Process, thread, chunk (owning process id), server (owning thread id)
+    IMPORT_C TInt Id() const;
+
+    // For Chunk, Library
+    IMPORT_C TUint32 Size() const;
+   
+    // For Semaphore, Mutex, Server
+    IMPORT_C TInt Count() const;
+
+    // For Mutex
+    IMPORT_C TInt WaitCount() const;
+
+    // For Server, Session
+    IMPORT_C TIpcSessionType SessionType() const;
+
+    // For Timer
+    IMPORT_C TMemSpyDriverTimerType TimerType() const;
+    IMPORT_C TMemSpyDriverTimerState TimerState() const;
+
+    // For Logical channel
+    IMPORT_C TInt OpenChannels();
+    
+    // For most of the object types
+    IMPORT_C const TDesC8& NameDetail() const; // Name
+    IMPORT_C TInt AccessCount() const;
+    IMPORT_C TInt UniqueID() const;
+    IMPORT_C TUint Protection() const;
+    IMPORT_C TUint8* AddressOfKernelOwner();
+    IMPORT_C TInt Priority() const;
+    IMPORT_C TUint8* AddressOfOwningProcess();
+    IMPORT_C TUint CreatorId() const;
+    IMPORT_C TUint SecurityZone() const;
+    IMPORT_C TInt Attributes() const;
+    IMPORT_C TUint8* AddressOfDataBssStackChunk();
+
+    // For Server, Session
+    IMPORT_C TUint8* AddressOfOwningThread();
+    IMPORT_C TUint8* AddressOfServer();
+    IMPORT_C TUint16 TotalAccessCount() const;
+    IMPORT_C TUint8 SvrSessionType() const;
+    IMPORT_C TInt MsgCount() const;
+    IMPORT_C TInt MsgLimit() const;
+    
+    // For chunk
+    IMPORT_C TInt MaxSize() const;
+    IMPORT_C TInt Bottom() const;
+    IMPORT_C TInt Top() const;
+    IMPORT_C TInt StartPos() const;
+    IMPORT_C TUint ControllingOwner() const;
+    IMPORT_C TUint Restrictions() const;
+    IMPORT_C TUint MapAttr() const;
+    IMPORT_C TUint ChunkType() const;
+    IMPORT_C const TDesC8& NameOfOwner() const; // chunk, server
+    
+    // For library
+    IMPORT_C TInt MapCount() const;
+    IMPORT_C TUint8 State() const;
+    IMPORT_C TUint8* AddressOfCodeSeg();
+    
+    // Semaphore, mutex, condvar
+    IMPORT_C TUint8 Resetting() const;
+    IMPORT_C TUint8 Order() const;
+    
+    // For Logical/Physical device
+    IMPORT_C TVersion Version() const;
+    IMPORT_C TUint ParseMask() const;
+    IMPORT_C TUint UnitsMask() const;
+    
+    // For change notifier
+    IMPORT_C TUint Changes() const;
+	
+private:
+	CMemSpyApiKernelObjectItem();
+	
+	void ConstructL(const TMemSpyDriverHandleInfoGeneric& aData);
+		
+private:
+	TMemSpyDriverHandleInfoGeneric *iItem;
+};
+
+	
+#endif // MEMSPYAPIKERNELOBJECTITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapimemorytrackingcycle.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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 MEMSPYAPIMEMORYTRACKINGCYCLE_H_
+#define MEMSPYAPIMEMORYTRACKINGCYCLE_H_
+
+#include <e32base.h>
+
+class TMemSpyMemoryTrackingCycleData;
+
+class CMemSpyApiMemoryTrackingCycle
+	{
+public: // API
+	IMPORT_C TInt CycleNumber() const;
+	IMPORT_C const TTime& Time() const;
+	IMPORT_C const TDesC& Caption() const;
+	IMPORT_C const TInt64& FreeMemory() const;
+	IMPORT_C TInt64 MemoryDelta() const;
+	IMPORT_C TInt64 PreviousCycleDiff() const;
+	IMPORT_C TInt ChangeCount() const;
+	
+public:
+	IMPORT_C ~CMemSpyApiMemoryTrackingCycle();
+	
+	static CMemSpyApiMemoryTrackingCycle* NewL(const TMemSpyMemoryTrackingCycleData& aData);
+
+	static CMemSpyApiMemoryTrackingCycle* NewLC(const TMemSpyMemoryTrackingCycleData& aData);
+	
+private:
+	CMemSpyApiMemoryTrackingCycle();
+	
+	void ConstructL(const TMemSpyMemoryTrackingCycleData& aData);
+	
+private:
+	TMemSpyMemoryTrackingCycleData* iData;
+	
+	};
+
+#endif /* MEMSPYAPIMEMORYTRACKINGCYCLE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapiprocess.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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 MEMSPYAPIPROCESS_H
+#define MEMSPYAPIPROCESS_H
+
+// System includes
+#include <e32base.h>
+
+class TMemSpyProcessData;
+
+NONSHARABLE_CLASS( CMemSpyApiProcess ) 
+	{
+public:
+	IMPORT_C ~CMemSpyApiProcess();
+	
+	static CMemSpyApiProcess* NewL(const TMemSpyProcessData& aData);
+
+	static CMemSpyApiProcess* NewLC(const TMemSpyProcessData& aData);
+	
+public:
+	IMPORT_C TProcessId Id() const;
+	
+	IMPORT_C const TDesC& Name() const;	
+	
+	IMPORT_C TExitCategoryName ExitCategory() const;
+	
+	IMPORT_C TInt ExitReason() const;
+	
+	IMPORT_C TExitType ExitType() const;
+	
+	IMPORT_C TInt ThreadCount() const;
+	
+	IMPORT_C TUint32 SID() const;
+	
+	IMPORT_C TUint32 VID() const;
+	
+	IMPORT_C TProcessPriority Priority() const;
+	
+	IMPORT_C TBool IsDead() const;
+	
+	
+private:
+	CMemSpyApiProcess();
+	
+	void ConstructL(const TMemSpyProcessData& aData);
+		
+private:
+	TMemSpyProcessData *iProcessData;
+};
+
+	
+#endif // MEMSPYAPIPROCESS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapiserver.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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 MEMSPYAPISERVER_H
+#define MEMSPYAPISERVER_H
+
+// System includes
+#include <e32base.h>
+
+class TMemSpyServerData;
+
+NONSHARABLE_CLASS( CMemSpyApiServer ) 
+	{
+public:
+	IMPORT_C ~CMemSpyApiServer();
+	
+	static CMemSpyApiServer* NewL(const TMemSpyServerData& aData);
+
+	static CMemSpyApiServer* NewLC(const TMemSpyServerData& aData);
+	
+public:
+	IMPORT_C TProcessId Id() const;
+	
+	IMPORT_C const TDesC& Name() const;	
+	
+	IMPORT_C TInt SessionCount() const;
+	
+private:
+	CMemSpyApiServer();
+	
+	void ConstructL(const TMemSpyServerData& aData);
+		
+private:
+	TMemSpyServerData *iData;
+};
+
+	
+#endif // MEMSPYAPISERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapithread.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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  CMemSpyProcessWrapper class and TMemSpyProcess data class
+*/
+
+#ifndef MEMSPYAPITHREAD_H
+#define MEMSPYAPITHREAD_H
+
+// System includes
+#include <e32base.h>
+
+class TMemSpyThreadData;
+
+NONSHARABLE_CLASS( CMemSpyApiThread ) {
+
+public:
+	IMPORT_C ~CMemSpyApiThread();
+	
+	static CMemSpyApiThread* NewL(const TMemSpyThreadData& aData);
+
+	static CMemSpyApiThread* NewLC(const TMemSpyThreadData& aData);
+
+public:
+	IMPORT_C TThreadId Id() const;
+	IMPORT_C TProcessId ProcessId() const;
+	
+	IMPORT_C const TDesC& Name() const;
+		
+	IMPORT_C TInt SID() const;
+	
+	IMPORT_C TInt VID() const;
+	
+	IMPORT_C TThreadPriority ThreadPriority() const;
+	
+	IMPORT_C TProcessPriority ProcessPriority() const;
+	
+	IMPORT_C TInt RequestCount() const;
+	
+	IMPORT_C TInt ThreadHandles() const;
+	
+	IMPORT_C TInt ProcessHandles() const;
+	
+	IMPORT_C TInt ThreadNumberUsing() const;
+	
+	IMPORT_C TInt ProcessNumberUsing() const;
+	
+	IMPORT_C TInt Attributes() const;
+	
+	IMPORT_C TInt CpuUse() const;
+	
+	IMPORT_C TExitType ExitType() const;
+	
+private:
+	CMemSpyApiThread();	
+	
+	void ConstructL(const TMemSpyThreadData& aData);
+private:
+	TMemSpyThreadData* iThreadData;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapithreadinfoitem.h	Mon Sep 06 15:00:47 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:
+* Contains the declaration of  CMemSpyProcess class 
+*/
+
+#ifndef MEMSPYAPITHREADINFOITEM_H
+#define MEMSPYAPITHREADINFOITEM_H
+
+// System includes
+#include <e32base.h>
+
+class TMemSpyThreadInfoItemData;
+
+NONSHARABLE_CLASS( CMemSpyApiThreadInfoItem ) 
+	{
+public:
+	IMPORT_C ~CMemSpyApiThreadInfoItem();
+	
+	static CMemSpyApiThreadInfoItem* NewL(const TMemSpyThreadInfoItemData& aData);
+
+	static CMemSpyApiThreadInfoItem* NewLC(const TMemSpyThreadInfoItemData& aData);
+	
+public:		
+	IMPORT_C const TDesC& Caption() const;	
+	
+	IMPORT_C const TDesC& Value() const;	
+	
+private:
+	CMemSpyApiThreadInfoItem();
+	
+	void ConstructL(const TMemSpyThreadInfoItemData& aData);
+		
+private:
+	TMemSpyThreadInfoItemData *iInfoItem;
+};
+
+	
+#endif // MEMSPYAPITHREADINFOITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyecomdata.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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  TMemSpyProcessData class
+*/
+
+#ifndef MEMSPYECOMDATA_H
+#define MEMSPYECOMDATA_H
+
+// TMemSpyProcess data class holds data to be sent to the UI
+class TMemSpyEComCategoryData 
+	{	
+public:
+	//constructor & destructor
+	inline TMemSpyEComCategoryData ()
+		: iInterfaceCount(0)
+		{
+		}
+	
+public:
+    TUid iId;        
+    TFullName iName;
+    TInt iInterfaceCount;
+	};
+
+class TMemSpyEComInterfaceData 
+    {   
+public:
+    //constructor & destructor
+    inline TMemSpyEComInterfaceData ()
+        : iImplementationCount(0)
+        {
+        }
+    
+public:
+    TUid iId;
+    TUid iCategoryId;
+    TFullName iName;
+    TInt iImplementationCount;
+    };
+
+class TMemSpyEComImplementationData 
+    {   
+public:
+    TUid iImplementationUid;
+    TFullName iName;
+    TInt iVersion;
+    TFullName iDataType;
+    TFullName iOpaqueData;
+    TDriveUnit iDrive;
+    TBool iRomOnly;
+    TBool iRomBased;
+    TVendorId iVendorId;    
+    TBool iDisabled;
+    };
+
+#endif // MEMSPYECOMDATA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyheapdata.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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  TMemSpyProcessData class
+*/
+
+#ifndef MEMSPYHEAPDATA_H
+#define MEMSPYHEAPDATA_H
+
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Constants
+const TInt KBuf = 16;
+
+// TMemSpyProcess data class holds data to be sent to the UI
+class TMemSpyHeapData 
+	{	
+public:
+	//constructor & destructor
+	inline TMemSpyHeapData()		
+	: iSize(0), iBaseAddress(0), iShared(EFalse), iChunkSize(0),
+	iAllocationsCount(0), iFreeCount(0), iBiggestAllocation(0), iBiggestFree(0), iTotalAllocations(0),
+    iTotalFree(0), iSlackFreeSpace(0), iFragmentation(0), iHeaderSizeA(0), iHeaderSizeF(0), iAllocationOverhead(0),
+    iFreeOverhead(0), iTotalOverhead(0), iOverhead(0), iMinLength(0), iMaxLength(0), iDebugAllocatorLibrary(EFalse)
+		{
+		}
+	
+public:
+	TBuf<KBuf> iType;
+	TUint iSize;
+	TLinAddr iBaseAddress;
+	TBool iShared;
+	TUint iChunkSize;
+	TUint iAllocationsCount;
+	TUint iFreeCount;
+	TUint iBiggestAllocation;
+	TUint iBiggestFree;
+    TUint iTotalAllocations;
+    TUint iTotalFree;
+    TUint iSlackFreeSpace;
+    TReal iFragmentation;
+    TUint iHeaderSizeA;
+    TUint iHeaderSizeF;
+    TUint iAllocationOverhead;
+    TUint iFreeOverhead;
+    TUint iTotalOverhead;
+    TReal iOverhead;
+    TInt iMinLength;
+    TInt iMaxLength;
+    TBool iDebugAllocatorLibrary;
+	};
+
+#endif // MEMSPYHEAPDATA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspykernelobjectdata.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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  TMemSpyProcessData class
+*/
+
+#ifndef MEMSPYKERNELOBJECTDATA_H
+#define MEMSPYKERNELOBJECTDATA_H
+
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// Constants
+const TInt KBufSize = 128;
+
+// TMemSpyProcess data class holds data to be sent to the UI
+class TMemSpyKernelObjectData 
+	{	
+public:
+	//constructor & destructor
+	inline TMemSpyKernelObjectData()
+		: iCount(0), iSize(0)
+		{
+		}
+	
+public:    
+    TMemSpyDriverContainerType iType;
+    TFullName iName;
+    TInt iCount;
+    TInt64 iSize;
+	};
+
+#endif // MEMSPYKERNELOBJECTDATA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspymemorytrackingcycledata.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* 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 MEMSPYMEMORYTRACKINGCYCLEDATA_H_
+#define MEMSPYMEMORYTRACKINGCYCLEDATA_H_
+
+struct TMemSpyMemoryTrackingCycleData
+	{
+	TInt iCycleNumber;
+	TTime iTime;
+	TFullName iCaption;
+	TInt64 iFreeMemory;
+	TInt64 iMemoryDelta;
+	TInt64 iPreviousCycleDiff;
+	TInt iChangeCount;
+	};
+
+#endif /* MEMSPYMEMORYTRACKINGCYCLEDATA_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyprocessdata.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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  TMemSpyProcessData class
+*/
+
+#ifndef MEMSPYPROCESSDATA_H
+#define MEMSPYPROCESSDATA_H
+
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// TMemSpyProcess data class holds data to be sent to the UI
+class TMemSpyProcessData 
+	{	
+public:
+	//constructor & destructor
+	inline TMemSpyProcessData()
+		: iId(0), iThreadCount(0), iExitCategory(0), iExitReason(0)
+		{
+		}
+	
+public:
+    TProcessId iId;        
+    TFullName iName;
+    TProcessPriority iPriority;
+    TExitCategoryName iExitCategory;
+    TInt iExitReason;
+    TExitType iExitType;
+    TInt iThreadCount;
+    TUint32 iSID;
+    TUint32 iVID;
+    TBool iIsDead;
+	};
+
+#endif // MEMSPYPROCESSDATA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyserverdata.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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  TMemSpyProcessData class
+*/
+
+#ifndef MEMSPYSERVERDATA_H
+#define MEMSPYSERVERDATA_H
+
+// TMemSpyProcess data class holds data to be sent to the UI
+class TMemSpyServerData 
+	{	
+public:
+	//constructor & destructor
+	inline TMemSpyServerData()
+		: iId(0), iSessionCount(0)
+		{
+		}
+	
+public:
+    TProcessId iId;        
+    TFullName iName;
+    TInt iSessionCount;
+	};
+
+#endif // MEMSPYSERVERDATA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspysession.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,282 @@
+/*
+* 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 MEMSPYSESSION_H
+#define MEMSPYSESSION_H
+
+
+// System includes
+#include <e32base.h>
+#include <u32std.h>
+
+//user includes
+#include <memspy/api/memspyapiprocess.h>
+
+#include <memspy/api/memspyapithread.h>
+#include <memspy/api/memspyapithreadinfoitem.h>
+#include <memspy/engine/memspythreadinfoitemdata.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspydevicewideoperations.h>
+
+#include <memspy/api/memspyapikernelobject.h>
+
+#include <memspy/api/memspyapikernelobjectitem.h> //for KernelObjectItems
+
+#include <memspy/api/memspyapiheap.h>
+
+#include <memspy/api/memspyapimemorytrackingcycle.h>
+
+#include <memspyengineclientinterface.h>
+#include <memspy/engine/memspyengineoutputsinktype.h>
+
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+#include <memspy/api/memspyapiserver.h>
+
+#include <memspy/api/memspyapiecom.h>
+
+// Constants
+const TInt KMemSpyVersion           = 2;
+
+enum TSortType
+	{
+	ESortProcById,
+	ESortProcByName,
+	ESortProcByThreadCount,
+	ESortProcByCodeSegs,
+	ESortProcByHeapUsage,
+	ESortProcByStackUsage,
+	ESortServByName,
+	ESortServBySessionCount
+	};
+
+enum TMemSpyOutputType
+    {
+    EOutputTypeDebug = 0,
+    EOutputTypeFile
+    };
+
+class TMemSpyDeviceWideOperationProgress 
+	{
+public:
+	IMPORT_C TInt Progress() const;
+	IMPORT_C const TDesC& Description() const;
+	
+private:
+	TPckgBuf<TInt> iProgress;
+	TFullName iDescription;
+	
+friend class RMemSpySession;
+	};
+
+
+NONSHARABLE_CLASS( RMemSpySession ) : public RSessionBase
+    {
+public:
+    IMPORT_C RMemSpySession();
+    IMPORT_C TInt Connect();
+    
+public:	//API
+    //Thread speciifc operations
+    IMPORT_C void OutputKernelHeapDataL(); //EMemSpyClientServerOpHeapData
+    
+    IMPORT_C void OutputKernelHeapData(TRequestStatus& aStatus); //EMemSpyClientServerOpHeapData
+    
+    IMPORT_C void OutputThreadHeapDataL(TThreadId aThreadId); //EMemSpyClientServerOpHeapData
+    
+    IMPORT_C void OutputThreadHeapDataL(const TDesC& aThreadName); //EMemSpyClientServerOpHeapData
+    
+    IMPORT_C void OutputThreadCellListL(TThreadId aThreadId);//EMemSpyClientServerOpHeapCellListing    
+    
+    IMPORT_C void OutputHeapInfoUserL(TThreadId aThreadId);	//EMemSpyClientServerOpHeapInfo
+    
+    IMPORT_C void SwitchOutputSinkL( TMemSpySinkType aType); //EMemSpyClientServerOpSwitchOutputSinkFile / EMemSpyClientServerOpSwitchOutputSinkTrace
+    
+    IMPORT_C void SwitchOutputToTraceL(); // EMemSpyClientServerOpSwitchOutputSinkTrace
+    
+    IMPORT_C void SwitchOutputToFileL(const TDesC& aRootFolder); // EMemSpyClientServerOpSwitchOutputSinkFile
+    
+    IMPORT_C void OutputStackInfoL(TThreadId aThreadId); //EMemSpyClientServerOpStackInfo
+    
+    IMPORT_C void OutputStackDataL(TThreadId aThreadId, TMemSpyDriverDomainType aType ); //EMemSpyClientServerOpStackDataUser / EMemSpyClientServerOpStackDataKernel    
+    
+    IMPORT_C void OutputThreadInfoHandlesL(TThreadId aThreadId); //EMemSpyClientServerOpOutputInfoHandles
+    
+    IMPORT_C void OutputAOListL(TThreadId aId, TMemSpyThreadInfoItemType aType);	//EMemSpyClientServerOpOutputAOList    
+    
+    IMPORT_C void OutputKernelObjectsL();// EMemSpyClientServerOpEnumerateKernelContainerAll
+    
+    IMPORT_C void OutputCompactStackInfoL();// EMemSpyClientServerOpStackInfoCompact
+    
+    IMPORT_C void OutputCompactHeapInfoL();// EMemSpyClientServerOpHeapInfoCompact
+    
+    // Device Wide Operations
+    // Synchronous operations - for CLI
+    IMPORT_C void OutputHeapData();
+    
+    // Asynchronous operations
+    IMPORT_C void OutputPhoneInfo(TRequestStatus& aStatus);
+    
+    IMPORT_C void OutputDetailedPhoneInfo(TRequestStatus& aStatus);
+    
+    IMPORT_C void OutputHeapInfo(TRequestStatus& aStatus);
+    
+    IMPORT_C void OutputCompactHeapInfo(TRequestStatus &aStatus);
+    
+    IMPORT_C void OutputHeapCellListing(TRequestStatus& aStatus);
+    
+    IMPORT_C void OutputHeapData(TRequestStatus& aStatus);
+    
+    IMPORT_C void OutputStackInfo(TRequestStatus& aStatus);
+    
+    IMPORT_C void OutputCompactStackInfo(TRequestStatus &aStatus);
+    
+    IMPORT_C void OutputUserStackData(TRequestStatus& aStatus);
+    
+    IMPORT_C void OutputKernelStackData(TRequestStatus& aStatus);
+    
+    IMPORT_C void NotifyDeviceWideOperationProgress(TMemSpyDeviceWideOperationProgress &aProgress, TRequestStatus &aStatus);
+    
+    IMPORT_C void CancelDeviceWideOperationL();
+    
+    // Synchronous operations for MemSpyLauncher
+    IMPORT_C void OutputPhoneInfo();
+    
+    // "Ui" operations
+    
+    IMPORT_C void GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType = ESortProcById);
+    
+    IMPORT_C TProcessId GetProcessIdByNameL(const TDesC& aProcessName);
+    
+    IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType = ESortProcById);
+    
+    IMPORT_C TInt ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue ); //aValue -> return value
+    
+    IMPORT_C void SetThreadPriorityL(TThreadId aId, TInt aPriority);
+    
+    IMPORT_C TInt EndProcessL( TProcessId aId, TMemSpyEndType aType );
+    
+    IMPORT_C TInt SwitchToProcess( TProcessId aId, TBool aBrought  );
+    
+    IMPORT_C void GetProcessIdByThreadId( TProcessId& aPID, TThreadId aTID );
+    
+    //SWMT operations
+    
+    IMPORT_C void GetMemoryTrackingCyclesL(RArray<CMemSpyApiMemoryTrackingCycle*>& aCycles);
+    
+    IMPORT_C TInt GetSwmtCyclesCount();
+    
+    IMPORT_C void SetSwmtAutoStartProcessList( CArrayFixFlat<TUid>* aList );
+    
+    IMPORT_C void SetSwmtFilter( const TDesC& aFilter );            
+    
+    IMPORT_C void SetSwmtCategoriesL(TInt aCategories);
+
+    IMPORT_C void SetSwmtHeapDumpsEnabledL(TBool aEnabled);
+    
+    IMPORT_C void SetSwmtMode(TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode);      
+    
+    IMPORT_C void SwmtResetTracking();
+    
+    IMPORT_C void GetOutputSink( TMemSpySinkType& aType );
+           
+    IMPORT_C TBool IsSwmtRunningL();
+    
+    IMPORT_C void StartSwmtTimerL(TInt aPeriod);
+    
+    IMPORT_C void StartSwmtTimerL(); // for CLI
+    
+    IMPORT_C void SetSwmtTimerIntervalL(TInt aPeriod); //for CLI
+    
+    IMPORT_C void StopSwmtTimerL();
+    
+    IMPORT_C void ForceSwmtUpdateL();
+    
+    IMPORT_C void ForceSwmtUpdate(TRequestStatus& aStatus);
+    
+    IMPORT_C void GetSwmtFilter( TName& aFilter );            
+        
+    IMPORT_C void GetSwmtCategoriesL(TInt& aCategories);
+
+    IMPORT_C void GetSwmtHeapDumpsEnabledL(TBool& aEnabled);
+        
+    IMPORT_C void GetSwmtMode(TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode& aMode);
+    
+    IMPORT_C void GetSwmtTimerIntervalL(TInt& aPeriod);
+    
+    //Threads operations
+    /**
+     * 
+     */
+    IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiProcess*> &aThreads, TSortType aSortType = ESortProcById);
+    
+    IMPORT_C TInt ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue );
+        
+    IMPORT_C TInt EndThreadL( TThreadId aId, TMemSpyEndType aType );
+    
+    IMPORT_C TInt SwitchToThread( TThreadId aId, TBool aBrought );
+    
+    IMPORT_C TInt GetInfoItemType( TInt aIndex, TThreadId aId, TMemSpyThreadInfoItemType &aType );
+    
+    IMPORT_C TInt GetThreadInfoItems( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType );
+    
+    IMPORT_C void GetThreadInfoItemsL( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType );            
+    
+    //KernelObjects operations
+    
+    IMPORT_C void GetKernelObjectsL( RArray<CMemSpyApiKernelObject*> &aKernelObjects );
+    
+    IMPORT_C TInt GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects );
+    
+    IMPORT_C void GetKernelObjectItemsL( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer );
+    
+    IMPORT_C TInt GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer );
+    
+    IMPORT_C void OutputAllContainerContents();
+    
+    // Heap 
+    
+    IMPORT_C CMemSpyApiHeap* GetHeapL();
+    
+	IMPORT_C CMemSpyApiHeap* GetHeap();
+	
+	IMPORT_C void DumpKernelHeap();
+	
+	// Servers
+	IMPORT_C void GetServersL(RArray<CMemSpyApiServer*> &aServers);
+	
+	IMPORT_C void GetServersL(RArray<CMemSpyApiServer*> &aServers, TSortType aSortType); 
+	
+	IMPORT_C void ServerListOutputGenericL( TBool aDetailed );
+		
+	// ECom
+
+	IMPORT_C void GetEComCategoriesL(RArray<CMemSpyApiEComCategory*> &aCategories);
+	
+	IMPORT_C void GetEComInterfacesL(TUid aCategory, RArray<CMemSpyApiEComInterface*> &aInterfaces);
+	
+	IMPORT_C void GetEComImplementationsL(TUid aInterface, RArray<CMemSpyApiEComImplementation*> &aImplementations);
+	
+private:
+    TInt StartServer();       
+    
+    void SetOutputTypeL(TMemSpyOutputType aOutputType);
+    
+    };
+
+#endif // MEMSPYSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspythreaddata.h	Mon Sep 06 15:00:47 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 MEMSPYTHREADDATA_H
+#define MEMSPYTHREADDATA_H
+
+//#include <kernel/arm/arm_types.h>
+
+class TMemSpyThreadData {
+public:
+	TMemSpyThreadData()
+	: iId(0), iPid(0), iSID(0), iVID(0), iRequestCount(0), iThreadHandles(0), iProcessHandles(0), iThreadNumberUsing(0), 
+	  iProcessNumberUsing(0), iAttributes(0), iCpuUse(0)
+		{
+		}
+	
+public:
+    TThreadId iId;
+    TProcessId iPid;    
+    TFullName iName;    //name without formatting. Formatting to be moved to the Avkon UI part
+    TInt iSID;
+    TInt iVID;
+    TThreadPriority iThreadPriority;
+    TProcessPriority iProcessPriority;
+    TInt iRequestCount;
+    TInt iThreadHandles;
+    TInt iProcessHandles;
+    TInt iThreadNumberUsing;
+    TInt iProcessNumberUsing;
+    TInt iAttributes;
+    TInt iCpuUse;        
+    TExitType iExitType;
+    RArray<TUint> iRegisters; //containts register contents of the thread (R00-R12, SP, LR, PC, Flags & DACR) - TUint for formating to HEX    
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspythreadinfoitemdata.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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  TMemSpyProcessData class
+*/
+
+#ifndef MEMSPYTHREADINFOITEMDATA_H
+#define MEMSPYTHREADINFOITEMDATA_H
+
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// TMemSpyProcess data class holds data to be sent to the UI
+class TMemSpyThreadInfoItemData 
+	{	
+public:
+	//constructor & destructor
+	inline TMemSpyThreadInfoItemData()		
+		{
+		}
+	
+public:
+    TBuf<64> iCaption;
+    TBuf<32> iValue;
+	};
+
+#endif // MEMSPYTHREADINFOITEMDATA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapiecom.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,190 @@
+/*
+* 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/memspyapiecom.h>
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyecomdata.h>
+
+
+EXPORT_C CMemSpyApiEComCategory::~CMemSpyApiEComCategory()
+	{
+	delete iData;
+	}
+
+EXPORT_C TUid CMemSpyApiEComCategory::Id() const
+	{
+	return iData->iId;
+	}
+
+EXPORT_C const TDesC& CMemSpyApiEComCategory::Name() const
+	{
+	return iData->iName;
+	}
+
+EXPORT_C TInt CMemSpyApiEComCategory::InterfaceCount() const
+    {
+    return iData->iInterfaceCount;
+    }
+
+void CMemSpyApiEComCategory::ConstructL(const TMemSpyEComCategoryData& aData)
+	{
+	iData = new (ELeave) TMemSpyEComCategoryData( aData );
+	}
+
+CMemSpyApiEComCategory* CMemSpyApiEComCategory::NewL(const TMemSpyEComCategoryData& aData)
+	{
+    CMemSpyApiEComCategory* self = CMemSpyApiEComCategory::NewLC( aData );
+	CleanupStack::Pop(self);
+	return (self);
+	}
+
+CMemSpyApiEComCategory* CMemSpyApiEComCategory::NewLC(const TMemSpyEComCategoryData& aData)
+	{
+    CMemSpyApiEComCategory* self = new (ELeave) CMemSpyApiEComCategory;
+	CleanupStack::PushL( self );
+	self->ConstructL( aData );
+	return ( self );
+	}
+
+
+
+
+
+
+
+
+EXPORT_C CMemSpyApiEComInterface::~CMemSpyApiEComInterface()
+    {
+    delete iData;
+    }
+
+EXPORT_C TUid CMemSpyApiEComInterface::Id() const
+    {
+    return iData->iId;
+    }
+
+EXPORT_C const TDesC& CMemSpyApiEComInterface::Name() const
+    {
+    return iData->iName;
+    }
+
+EXPORT_C TInt CMemSpyApiEComInterface::ImplementationCount() const
+    {
+    return iData->iImplementationCount;
+    }
+
+void CMemSpyApiEComInterface::ConstructL(const TMemSpyEComInterfaceData& aData)
+    {
+    iData = new (ELeave) TMemSpyEComInterfaceData( aData );
+    }
+
+CMemSpyApiEComInterface* CMemSpyApiEComInterface::NewL(const TMemSpyEComInterfaceData& aData)
+    {
+    CMemSpyApiEComInterface* self = CMemSpyApiEComInterface::NewLC( aData );
+    CleanupStack::Pop(self);
+    return (self);
+    }
+
+CMemSpyApiEComInterface* CMemSpyApiEComInterface::NewLC(const TMemSpyEComInterfaceData& aData)
+    {
+    CMemSpyApiEComInterface* self = new (ELeave) CMemSpyApiEComInterface;
+    CleanupStack::PushL( self );
+    self->ConstructL( aData );
+    return ( self );
+    }
+
+
+
+
+
+
+
+EXPORT_C CMemSpyApiEComImplementation::~CMemSpyApiEComImplementation()
+    {
+    delete iData;
+    }
+
+EXPORT_C TUid CMemSpyApiEComImplementation::ImplementationUid() const
+    {
+    return iData->iImplementationUid;
+    }
+    
+EXPORT_C const TDesC& CMemSpyApiEComImplementation::Name() const
+    {
+    return iData->iName;
+    }
+    
+EXPORT_C TInt CMemSpyApiEComImplementation::Version() const
+    {
+    return iData->iVersion;
+    }
+    
+EXPORT_C const TDesC& CMemSpyApiEComImplementation::DataType() const
+    {
+    return iData->iDataType;
+    }
+        
+EXPORT_C const TDesC& CMemSpyApiEComImplementation::OpaqueData() const
+    {
+    return iData->iOpaqueData;
+    }
+    
+EXPORT_C TDriveUnit CMemSpyApiEComImplementation::Drive() const
+    {
+    return iData->iDrive;
+    }
+        
+EXPORT_C TBool CMemSpyApiEComImplementation::RomOnly() const
+    {
+    return iData->iRomOnly;
+    }
+        
+EXPORT_C TBool CMemSpyApiEComImplementation::RomBased() const
+    {
+    return iData->iRomBased;
+    }
+        
+EXPORT_C TVendorId CMemSpyApiEComImplementation::VendorId() const
+    {
+    return iData->iVendorId;
+    }
+        
+EXPORT_C TBool CMemSpyApiEComImplementation::Disabled() const
+    {
+    return iData->iDisabled;
+    }
+
+void CMemSpyApiEComImplementation::ConstructL(const TMemSpyEComImplementationData& aData)
+    {
+    iData = new (ELeave) TMemSpyEComImplementationData( aData );
+    }
+
+CMemSpyApiEComImplementation* CMemSpyApiEComImplementation::NewL(const TMemSpyEComImplementationData& aData)
+    {
+    CMemSpyApiEComImplementation* self = CMemSpyApiEComImplementation::NewLC( aData );
+    CleanupStack::Pop(self);
+    return (self);
+    }
+
+CMemSpyApiEComImplementation* CMemSpyApiEComImplementation::NewLC(const TMemSpyEComImplementationData& aData)
+    {
+    CMemSpyApiEComImplementation* self = new (ELeave) CMemSpyApiEComImplementation;
+    CleanupStack::PushL( self );
+    self->ConstructL( aData );
+    return ( self );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapiheap.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* 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 <memspy/api/memspyapiheap.h>
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyheapdata.h>
+
+
+CMemSpyApiHeap::CMemSpyApiHeap() 
+	: iHeapData(0)
+	{
+	}
+
+EXPORT_C CMemSpyApiHeap::~CMemSpyApiHeap()
+	{
+	delete iHeapData;
+	}
+
+void CMemSpyApiHeap::ConstructL(const TMemSpyHeapData& aData)
+	{
+	iHeapData = new (ELeave) TMemSpyHeapData(aData);
+	}
+
+CMemSpyApiHeap* CMemSpyApiHeap::NewL(const TMemSpyHeapData& aData)
+	{
+	CMemSpyApiHeap* self = CMemSpyApiHeap::NewLC(aData);
+	CleanupStack::Pop(self);
+	return (self);
+	}
+
+CMemSpyApiHeap* CMemSpyApiHeap::NewLC(const TMemSpyHeapData& aData)
+	{
+	CMemSpyApiHeap* self = new (ELeave) CMemSpyApiHeap;
+	CleanupStack::PushL(self);
+	self->ConstructL(aData);
+	return (self);
+	}
+
+//api methods
+EXPORT_C TDesC& CMemSpyApiHeap::Type()
+	{
+	return iHeapData->iType;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::Size()
+	{
+	return iHeapData->iSize;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::BaseAddress()
+	{
+	return iHeapData->iBaseAddress;
+	}
+
+EXPORT_C TBool CMemSpyApiHeap::Shared()
+	{
+	return iHeapData->iShared;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::ChunkSize()
+	{
+	return iHeapData->iChunkSize;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::AllocationsCount()
+	{
+	return iHeapData->iAllocationsCount;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::FreeCount()
+	{
+	return iHeapData->iFreeCount;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::BiggestAllocation()
+	{
+	return iHeapData->iBiggestAllocation;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::BiggestFree()
+	{
+	return iHeapData->iBiggestFree;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::TotalAllocations()
+	{
+	return iHeapData->iTotalAllocations;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::TotalFree()
+	{
+	return iHeapData->iTotalFree;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::SlackFreeSpace()
+	{
+	return iHeapData->iSlackFreeSpace;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::Fragmentation()
+	{
+	return iHeapData->iFragmentation;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::HeaderSizeA()
+	{
+	return iHeapData->iHeaderSizeA;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::HeaderSizeF()
+	{
+	return iHeapData->iHeaderSizeF;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::AllocationOverhead()
+	{
+	return iHeapData->iAllocationOverhead;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::FreeOverhead()
+	{
+	return iHeapData->iFreeOverhead;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::TotalOverhead()
+	{
+	return iHeapData->iTotalOverhead;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::Overhead()
+	{
+	return iHeapData->iOverhead;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::MinLength()
+	{
+	return iHeapData->iMinLength;
+	}
+
+EXPORT_C TInt CMemSpyApiHeap::MaxLength()
+	{
+	return iHeapData->iMaxLength;
+	}
+
+EXPORT_C TBool CMemSpyApiHeap::DebugAllocatorLibrary()
+	{
+	return iHeapData->iDebugAllocatorLibrary;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapikernelobject.cpp	Mon Sep 06 15:00:47 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:
+*
+*/
+
+#include <memspy/api/memspyapikernelobject.h>
+#include <memspy/engine/memspykernelobjectdata.h>
+//#include <memspy/engine/memspyengineobjectprocess.h>
+//#include <memspy/engine/memspyengineobjectcontainer.h>
+
+
+EXPORT_C CMemSpyApiKernelObject::~CMemSpyApiKernelObject()
+	{
+	delete iKernelObjectData;
+	}
+
+
+CMemSpyApiKernelObject::CMemSpyApiKernelObject() : iKernelObjectData(0)
+	{
+	}
+
+CMemSpyApiKernelObject* CMemSpyApiKernelObject::NewL(const TMemSpyKernelObjectData& aData)
+	{
+	CMemSpyApiKernelObject* self = CMemSpyApiKernelObject::NewLC(aData);
+	CleanupStack::Pop(self);
+	return (self);
+	}
+
+CMemSpyApiKernelObject* CMemSpyApiKernelObject::NewLC(const TMemSpyKernelObjectData& aData)
+	{
+	CMemSpyApiKernelObject* self = new (ELeave) CMemSpyApiKernelObject;
+	CleanupStack::PushL(self);
+	self->ConstructL(aData);
+	return (self);
+	}
+
+void CMemSpyApiKernelObject::ConstructL(const TMemSpyKernelObjectData& aData)
+	{
+	iKernelObjectData = new (ELeave) TMemSpyKernelObjectData(aData);
+	}
+
+EXPORT_C TMemSpyDriverContainerType CMemSpyApiKernelObject::Type() const
+	{
+	return iKernelObjectData->iType;
+	}
+
+EXPORT_C const TDesC& CMemSpyApiKernelObject::Name() const
+	{
+	return iKernelObjectData->iName;
+	}
+					
+EXPORT_C TInt CMemSpyApiKernelObject::Count() const
+	{
+	return iKernelObjectData->iCount;
+	}
+	
+EXPORT_C TInt64 CMemSpyApiKernelObject::Size() const
+	{
+	return iKernelObjectData->iSize;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapikernelobjectitem.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,309 @@
+/*
+* 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 <memspy/api/memspyapikernelobjectitem.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+EXPORT_C CMemSpyApiKernelObjectItem::~CMemSpyApiKernelObjectItem()
+	{
+	delete iItem;
+	}
+
+
+CMemSpyApiKernelObjectItem::CMemSpyApiKernelObjectItem() : iItem(0)
+	{
+	}
+
+CMemSpyApiKernelObjectItem* CMemSpyApiKernelObjectItem::NewL(const TMemSpyDriverHandleInfoGeneric& aData)
+	{
+	CMemSpyApiKernelObjectItem* self = CMemSpyApiKernelObjectItem::NewLC(aData);
+	CleanupStack::Pop(self);
+	return (self);
+	}
+
+CMemSpyApiKernelObjectItem* CMemSpyApiKernelObjectItem::NewLC(const TMemSpyDriverHandleInfoGeneric& aData)
+	{
+	CMemSpyApiKernelObjectItem* self = new (ELeave) CMemSpyApiKernelObjectItem;
+	CleanupStack::PushL(self);
+	self->ConstructL(aData);
+	return (self);
+	}
+
+void CMemSpyApiKernelObjectItem::ConstructL(const TMemSpyDriverHandleInfoGeneric& aData)
+	{
+	iItem = new (ELeave) TMemSpyDriverHandleInfoGeneric(aData);
+	}
+
+EXPORT_C const TDesC8& CMemSpyApiKernelObjectItem::Name() const
+	{
+	/*
+	TBuf<KMaxName> ret;	
+	ret.Copy( iItem->iName );
+	return ret;
+	*/
+	return iItem->iName;
+	}
+
+EXPORT_C TAny* CMemSpyApiKernelObjectItem::Handle() const
+	{	
+	return iItem->iHandle;
+	}
+
+EXPORT_C TMemSpyDriverContainerType CMemSpyApiKernelObjectItem::Type() const
+	{
+	return iItem->iType;
+	}
+
+// For Process, thread, chunk (owning process id), server (owning thread id)
+EXPORT_C TInt CMemSpyApiKernelObjectItem::Id() const
+	{
+	return iItem->iId;
+	}
+
+// For Chunk, Library
+EXPORT_C TUint32 CMemSpyApiKernelObjectItem::Size() const
+	{
+	return iItem->iSize;
+	}
+
+// For Semaphore, Mutex, Server
+EXPORT_C TInt CMemSpyApiKernelObjectItem::Count() const
+	{
+	return iItem->iCount;
+	}
+
+// For Mutex
+EXPORT_C TInt CMemSpyApiKernelObjectItem::WaitCount() const
+	{
+	return iItem->iWaitCount;
+	}
+
+// For Server, Session
+EXPORT_C TIpcSessionType CMemSpyApiKernelObjectItem::SessionType() const
+	{
+	return iItem->iSessionType;
+	}
+
+// For Timer
+EXPORT_C TMemSpyDriverTimerType CMemSpyApiKernelObjectItem::TimerType() const
+	{
+	return iItem->iTimerType;
+	}
+
+EXPORT_C TMemSpyDriverTimerState CMemSpyApiKernelObjectItem::TimerState() const
+	{
+	return iItem->iTimerState;
+	}
+
+// For Logical channel
+EXPORT_C TInt CMemSpyApiKernelObjectItem::OpenChannels()
+	{
+	return iItem->iOpenChannels;
+	}
+
+// For most of the object types
+EXPORT_C const TDesC8& CMemSpyApiKernelObjectItem::NameDetail() const
+	{
+	/*
+	TBuf<KMaxName> ret;
+	ret.Copy( iItem->iNameDetail );
+	return ret;
+	*/
+	return iItem->iNameDetail;
+	}
+
+EXPORT_C TInt CMemSpyApiKernelObjectItem::AccessCount() const
+	{
+	return iItem->iAccessCount;
+	}
+
+EXPORT_C TInt CMemSpyApiKernelObjectItem::UniqueID() const
+	{
+	return iItem->iUniqueID;
+	}
+
+EXPORT_C TUint CMemSpyApiKernelObjectItem::Protection() const
+	{
+	return iItem->iProtection;
+	}
+		
+EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfKernelOwner()
+	{
+	return iItem->iAddressOfKernelOwner;
+	}
+
+EXPORT_C TInt CMemSpyApiKernelObjectItem::Priority() const
+	{
+	return iItem->iPriority;
+	}
+
+EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfOwningProcess()
+	{
+	return iItem->iAddressOfOwningProcess;
+	}
+
+EXPORT_C TUint CMemSpyApiKernelObjectItem::CreatorId() const
+	{
+	return iItem->iCreatorId;
+	}
+
+EXPORT_C TUint CMemSpyApiKernelObjectItem::SecurityZone() const
+	{
+	return iItem->iSecurityZone;
+	}
+
+EXPORT_C TInt CMemSpyApiKernelObjectItem::Attributes() const
+	{
+	return iItem->iAttributes;
+	}
+
+EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfDataBssStackChunk()
+	{
+	return iItem->iAddressOfDataBssStackChunk;
+	}
+
+// For Server, Session
+EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfOwningThread()
+	{
+	return iItem->iAddressOfOwningThread;
+	}
+
+EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfServer()
+	{
+	return iItem->iAddressOfServer;
+	}
+
+EXPORT_C TUint16 CMemSpyApiKernelObjectItem::TotalAccessCount() const
+	{
+	return iItem->iTotalAccessCount;
+	}
+
+EXPORT_C TUint8 CMemSpyApiKernelObjectItem::SvrSessionType() const
+	{
+	return iItem->iSvrSessionType;
+	}
+
+EXPORT_C TInt CMemSpyApiKernelObjectItem::MsgCount() const
+	{
+	return iItem->iMsgCount;
+	}
+
+EXPORT_C TInt CMemSpyApiKernelObjectItem::MsgLimit() const
+	{
+	return iItem->iMsgLimit;
+	}
+
+// For chunk
+EXPORT_C TInt CMemSpyApiKernelObjectItem::MaxSize() const
+	{
+	return iItem->iMaxSize;
+	}
+
+EXPORT_C TInt CMemSpyApiKernelObjectItem::Bottom() const
+	{
+	return iItem->iBottom;
+	}
+
+EXPORT_C TInt CMemSpyApiKernelObjectItem::Top() const
+	{
+	return iItem->iTop;
+	}
+
+EXPORT_C TInt CMemSpyApiKernelObjectItem::StartPos() const
+	{
+	return iItem->iStartPos;
+	}
+
+EXPORT_C TUint CMemSpyApiKernelObjectItem::ControllingOwner() const
+	{
+	return iItem->iControllingOwner;
+	}
+
+EXPORT_C TUint CMemSpyApiKernelObjectItem::Restrictions() const
+	{
+	return iItem->iRestrictions;
+	}
+
+EXPORT_C TUint CMemSpyApiKernelObjectItem::MapAttr() const
+	{
+	return iItem->iMapAttr;
+	}
+
+EXPORT_C TUint CMemSpyApiKernelObjectItem::ChunkType() const
+	{
+	return iItem->iChunkType;
+	}
+
+EXPORT_C const TDesC8& CMemSpyApiKernelObjectItem::NameOfOwner() const
+	{
+	/*
+	TBuf<KMaxName> ret;
+	ret.Copy( iItem->iNameOfOwner );
+	return ret;
+	*/
+	return iItem->iNameOfOwner;
+	}
+
+// For library
+EXPORT_C TInt CMemSpyApiKernelObjectItem::MapCount() const
+	{
+	return iItem->iMapCount;
+	}
+
+EXPORT_C TUint8 CMemSpyApiKernelObjectItem::State() const
+	{
+	return iItem->iState;
+	}
+
+EXPORT_C TUint8* CMemSpyApiKernelObjectItem::AddressOfCodeSeg()
+	{
+	return iItem->iAddressOfCodeSeg;
+	}
+
+// Semaphore, mutex, condvar
+EXPORT_C TUint8 CMemSpyApiKernelObjectItem::Resetting() const
+	{
+	return iItem->iResetting;
+	}
+
+EXPORT_C TUint8 CMemSpyApiKernelObjectItem::Order() const
+	{
+	return iItem->iOrder;
+	}
+
+// For Logical/Physical device
+EXPORT_C TVersion CMemSpyApiKernelObjectItem::Version() const
+	{
+	return iItem->iVersion;
+	}
+
+EXPORT_C TUint CMemSpyApiKernelObjectItem::ParseMask() const
+	{
+	return iItem->iParseMask;	
+	}
+
+EXPORT_C TUint CMemSpyApiKernelObjectItem::UnitsMask() const
+	{
+	return iItem->iUnitsMask;
+	}
+
+// For change notifier
+EXPORT_C TUint CMemSpyApiKernelObjectItem::Changes() const
+	{
+	return iItem->iChanges;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapimemorytrackingcycle.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* 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 <memspy/api/memspyapimemorytrackingcycle.h>
+#include <memspy/engine/memspymemorytrackingcycledata.h>
+
+EXPORT_C TInt CMemSpyApiMemoryTrackingCycle::CycleNumber() const
+	{
+	return iData->iCycleNumber;	
+	}
+
+EXPORT_C const TTime& CMemSpyApiMemoryTrackingCycle::Time() const
+	{
+	return iData->iTime;	
+	}
+
+EXPORT_C const TDesC& CMemSpyApiMemoryTrackingCycle::Caption() const
+	{
+	return iData->iCaption;	
+	}
+
+EXPORT_C const TInt64& CMemSpyApiMemoryTrackingCycle::FreeMemory() const
+	{
+	return iData->iFreeMemory;
+	}
+
+EXPORT_C TInt64 CMemSpyApiMemoryTrackingCycle::MemoryDelta() const
+	{
+	return iData->iMemoryDelta;
+	}
+
+EXPORT_C TInt64 CMemSpyApiMemoryTrackingCycle::PreviousCycleDiff() const
+	{
+	return iData->iPreviousCycleDiff;
+	}
+
+EXPORT_C TInt CMemSpyApiMemoryTrackingCycle::ChangeCount() const
+	{
+	return iData->iChangeCount;
+	}
+
+EXPORT_C CMemSpyApiMemoryTrackingCycle::~CMemSpyApiMemoryTrackingCycle()
+	{
+	delete iData;
+	}
+
+CMemSpyApiMemoryTrackingCycle* CMemSpyApiMemoryTrackingCycle::NewL(const TMemSpyMemoryTrackingCycleData& aData)
+	{
+	CMemSpyApiMemoryTrackingCycle* self = CMemSpyApiMemoryTrackingCycle::NewLC(aData);
+	CleanupStack::Pop(self);
+	return (self);
+	}
+
+CMemSpyApiMemoryTrackingCycle* CMemSpyApiMemoryTrackingCycle::NewLC(const TMemSpyMemoryTrackingCycleData& aData)
+	{
+	CMemSpyApiMemoryTrackingCycle* self = new (ELeave) CMemSpyApiMemoryTrackingCycle;
+	CleanupStack::PushL(self);
+	self->ConstructL(aData);
+	return self;
+	}
+
+CMemSpyApiMemoryTrackingCycle::CMemSpyApiMemoryTrackingCycle()
+	{
+	}
+
+void CMemSpyApiMemoryTrackingCycle::ConstructL(const TMemSpyMemoryTrackingCycleData& aData)
+	{
+	iData = new (ELeave) TMemSpyMemoryTrackingCycleData(aData);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapiprocess.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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 <memspy/api/memspyapiprocess.h>
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyprocessdata.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+
+
+EXPORT_C CMemSpyApiProcess::~CMemSpyApiProcess()
+	{
+	delete iProcessData;
+	}
+
+EXPORT_C TProcessId CMemSpyApiProcess::Id() const
+	{
+	return iProcessData->iId;
+	}
+
+EXPORT_C const TDesC& CMemSpyApiProcess::Name() const
+	{
+	return iProcessData->iName;
+	}
+
+EXPORT_C TExitCategoryName CMemSpyApiProcess::ExitCategory() const
+	{
+	return iProcessData->iExitCategory;
+	}
+	
+EXPORT_C TInt CMemSpyApiProcess::ExitReason() const
+	{
+	return iProcessData->iExitReason;
+	}
+	
+EXPORT_C TExitType CMemSpyApiProcess::ExitType() const
+	{
+	return iProcessData->iExitType;
+	}
+	
+EXPORT_C TInt CMemSpyApiProcess::ThreadCount() const
+	{
+	return iProcessData->iThreadCount;
+	}
+
+EXPORT_C TUint32 CMemSpyApiProcess::SID() const
+	{
+	return iProcessData->iSID;
+	}
+
+EXPORT_C TUint32 CMemSpyApiProcess::VID() const
+	{
+	return iProcessData->iSID;
+	}
+
+EXPORT_C TProcessPriority CMemSpyApiProcess::Priority() const
+	{
+	return iProcessData->iPriority;
+	}
+
+EXPORT_C TBool CMemSpyApiProcess::IsDead() const
+    {
+    return iProcessData->iIsDead;
+    }
+
+CMemSpyApiProcess::CMemSpyApiProcess() : iProcessData(0)
+	{
+	}
+
+void CMemSpyApiProcess::ConstructL(const TMemSpyProcessData& aData)
+	{
+	iProcessData = new (ELeave) TMemSpyProcessData(aData);
+	}
+
+CMemSpyApiProcess* CMemSpyApiProcess::NewL(const TMemSpyProcessData& aData)
+	{
+	CMemSpyApiProcess* self = CMemSpyApiProcess::NewLC(aData);
+	CleanupStack::Pop(self);
+	return (self);
+	}
+
+CMemSpyApiProcess* CMemSpyApiProcess::NewLC(const TMemSpyProcessData& aData)
+	{
+	CMemSpyApiProcess* self = new (ELeave) CMemSpyApiProcess;
+	CleanupStack::PushL(self);
+	self->ConstructL(aData);
+	return (self);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapiserver.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* 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 <memspy/api/memspyapiserver.h>
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyserverdata.h>
+
+EXPORT_C CMemSpyApiServer::~CMemSpyApiServer()
+	{
+	delete iData;
+	}
+
+EXPORT_C TProcessId CMemSpyApiServer::Id() const
+	{
+	return iData->iId;
+	}
+
+EXPORT_C const TDesC& CMemSpyApiServer::Name() const
+	{
+	return iData->iName;
+	}
+	
+EXPORT_C TInt CMemSpyApiServer::SessionCount() const
+	{
+	return iData->iSessionCount;
+	}
+
+CMemSpyApiServer::CMemSpyApiServer() : iData(0)
+	{
+	}
+
+void CMemSpyApiServer::ConstructL(const TMemSpyServerData& aData)
+	{
+	iData = new (ELeave) TMemSpyServerData(aData);
+	}
+
+CMemSpyApiServer* CMemSpyApiServer::NewL(const TMemSpyServerData& aData)
+	{
+    CMemSpyApiServer* self = CMemSpyApiServer::NewLC(aData);
+	CleanupStack::Pop(self);
+	return (self);
+	}
+
+CMemSpyApiServer* CMemSpyApiServer::NewLC(const TMemSpyServerData& aData)
+	{
+    CMemSpyApiServer* self = new (ELeave) CMemSpyApiServer;
+	CleanupStack::PushL(self);
+	self->ConstructL(aData);
+	return (self);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapithread.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* 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 <memspy/api/memspyapithread.h>
+#include <memspy/engine/memspythreaddata.h>
+
+
+EXPORT_C CMemSpyApiThread::~CMemSpyApiThread()
+	{
+	delete iThreadData;
+	}
+
+EXPORT_C TThreadId CMemSpyApiThread::Id() const
+	{
+	return iThreadData->iId;
+	}
+
+EXPORT_C TProcessId CMemSpyApiThread::ProcessId() const
+	{
+	return iThreadData->iPid;
+	}
+
+EXPORT_C const TDesC& CMemSpyApiThread::Name() const
+	{
+	return iThreadData->iName;
+	}
+
+EXPORT_C TInt CMemSpyApiThread::SID() const
+	{
+	return iThreadData->iSID;
+	}
+
+
+EXPORT_C TInt CMemSpyApiThread::VID() const
+	{
+	return iThreadData->iVID;
+	}
+
+EXPORT_C TThreadPriority CMemSpyApiThread::ThreadPriority() const
+	{
+	return iThreadData->iThreadPriority;
+	}
+
+EXPORT_C TProcessPriority CMemSpyApiThread::ProcessPriority() const
+	{
+	return iThreadData->iProcessPriority;
+	}
+
+EXPORT_C TInt CMemSpyApiThread::RequestCount() const
+	{
+	return iThreadData->iRequestCount;
+	}
+
+EXPORT_C TInt CMemSpyApiThread::ThreadHandles() const
+	{
+	return iThreadData->iThreadHandles;
+	}
+
+EXPORT_C TInt CMemSpyApiThread::ProcessHandles() const
+	{
+	return iThreadData->iProcessHandles;
+	}
+
+EXPORT_C TInt CMemSpyApiThread::ThreadNumberUsing() const
+	{
+	return iThreadData->iThreadNumberUsing;
+	}
+
+EXPORT_C TInt CMemSpyApiThread::ProcessNumberUsing() const
+	{
+	return iThreadData->iProcessNumberUsing;
+	}
+
+EXPORT_C TInt CMemSpyApiThread::Attributes() const
+	{
+	return iThreadData->iAttributes;
+	}
+
+EXPORT_C TInt CMemSpyApiThread::CpuUse() const
+	{
+	return iThreadData->iCpuUse;
+	}
+
+EXPORT_C TExitType CMemSpyApiThread::ExitType() const
+	{
+	return iThreadData->iExitType;
+	}
+
+CMemSpyApiThread::CMemSpyApiThread() : iThreadData(0)
+	{
+	}
+
+void CMemSpyApiThread::ConstructL(const TMemSpyThreadData& aData)
+	{
+	iThreadData = new (ELeave) TMemSpyThreadData(aData);
+	}
+
+CMemSpyApiThread* CMemSpyApiThread::NewL(const TMemSpyThreadData& aData)
+	{
+	CMemSpyApiThread* self = CMemSpyApiThread::NewLC(aData);
+	CleanupStack::Pop(self);
+	return (self);
+	}
+
+CMemSpyApiThread* CMemSpyApiThread::NewLC(const TMemSpyThreadData& aData)
+	{
+	CMemSpyApiThread* self = new (ELeave) CMemSpyApiThread;
+	CleanupStack::PushL(self);
+	self->ConstructL(aData);
+	return (self);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapithreadinfoitem.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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 <memspy/api/memspyapithreadinfoitem.h>
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspythreadinfoitemdata.h>
+
+EXPORT_C CMemSpyApiThreadInfoItem::~CMemSpyApiThreadInfoItem()
+	{
+	delete iInfoItem;
+	}
+
+EXPORT_C const TDesC& CMemSpyApiThreadInfoItem::Caption() const
+	{
+	return iInfoItem->iCaption;
+	}
+
+EXPORT_C const TDesC& CMemSpyApiThreadInfoItem::Value() const
+	{
+	return iInfoItem->iValue;
+	}
+
+CMemSpyApiThreadInfoItem::CMemSpyApiThreadInfoItem() : iInfoItem(0)
+	{
+	}
+
+void CMemSpyApiThreadInfoItem::ConstructL(const TMemSpyThreadInfoItemData& aData)
+	{
+	iInfoItem = new (ELeave) TMemSpyThreadInfoItemData(aData);
+	}
+
+CMemSpyApiThreadInfoItem* CMemSpyApiThreadInfoItem::NewL(const TMemSpyThreadInfoItemData& aData)
+	{
+	CMemSpyApiThreadInfoItem* self = CMemSpyApiThreadInfoItem::NewLC(aData);
+	CleanupStack::Pop(self);
+	return (self);
+	}
+
+CMemSpyApiThreadInfoItem* CMemSpyApiThreadInfoItem::NewLC(const TMemSpyThreadInfoItemData& aData)
+	{
+	CMemSpyApiThreadInfoItem* self = new (ELeave) CMemSpyApiThreadInfoItem;
+	CleanupStack::PushL(self);
+	self->ConstructL(aData);
+	return (self);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspysession.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,908 @@
+/*
+* 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 "memspysession.h"
+
+#include <memspyengineclientinterface.h>
+// API
+#include <memspy/engine/memspyprocessdata.h>
+#include <memspy/engine/memspythreaddata.h> 
+#include <memspy/engine/memspykernelobjectdata.h>
+#include <memspy/engine/memspyheapdata.h>
+#include <memspy/engine/memspymemorytrackingcycledata.h>
+//KernelObjects
+#include <memspy/driver/memspydriverenumerationsshared.h>
+// Servers
+#include <memspy/engine/memspyserverdata.h>
+// ECom
+#include <memspy/engine/memspyecomdata.h>
+
+// IMPLEMENTATION
+
+EXPORT_C RMemSpySession::RMemSpySession()
+    {
+    }
+
+
+EXPORT_C TInt RMemSpySession::Connect()
+    {
+	TInt error(KErrNone);
+	
+	for (TInt i=0; i<2; i++) // Two retries max
+		{
+		TInt error = CreateSession(KMemSpyServerName, TVersion(KMemSpyVersion, 0, 0));
+		
+		if (error != KErrNotFound && error != KErrServerTerminated)
+			return error;
+		
+		error = StartServer();
+		
+		if (error != KErrNone && error != KErrAlreadyExists)
+			return error;
+		}
+	
+	return error;	
+    }
+
+TInt RMemSpySession::StartServer()
+	{
+	RProcess server;
+	_LIT(KCommand, "start");
+	const TUid KServerUid3 = {0xE5883BC2};
+	TInt error = server.Create(KMemSpyServerName, KCommand);//, KServerUid3);
+	
+	if (error != KErrNone)
+		return error;
+	
+	TRequestStatus startStatus, stopStatus;
+	server.Logon(stopStatus);
+	if (stopStatus != KRequestPending)
+		{
+		User::WaitForRequest(stopStatus);
+		server.Kill(0);
+		server.Close();
+		return stopStatus.Int();
+		}
+	
+	server.Rendezvous(startStatus);
+	server.Resume();
+	User::WaitForRequest(startStatus, stopStatus);
+	if (startStatus == KRequestPending)
+		{
+		// not started yet, i.e. stopStatus was signaled
+		server.Close();
+		return stopStatus.Int();
+		}
+	
+	// Rendezvous was called - the server is ready
+	
+	// We first need to cancel Logon
+	server.LogonCancel(stopStatus);
+	// We don't need this anymore
+	server.Close();
+	// Wait for LogonCancel to complete
+	User::WaitForRequest(stopStatus);
+
+	// Everything went OK
+	return KErrNone;
+	}
+
+EXPORT_C void RMemSpySession::GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType)
+	{
+	TPckgBuf<TInt> count;
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetProcessCount, TIpcArgs(&count)));
+	
+	TInt requestedCount = count();
+	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyProcessData));
+	TPtr8 bufferPtr(buffer->Des());
+	
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetProcesses, TIpcArgs(&count, &bufferPtr)));
+	aProcesses.Reset();
+	
+	TInt receivedCount = Min(count(), requestedCount);
+	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyProcessData))
+		{
+		TPckgBuf<TMemSpyProcessData> data;
+		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyProcessData));
+		aProcesses.AppendL(CMemSpyApiProcess::NewLC(data()));
+		}
+	CleanupStack::Pop(aProcesses.Count());
+	CleanupStack::PopAndDestroy(buffer);
+	}
+
+EXPORT_C TProcessId RMemSpySession::GetProcessIdByNameL(const TDesC& aProcessName)
+	{
+	TPckgBuf<TProcessId> procId;
+	User::LeaveIfError(SendReceive(EMemSpyClienServerOpGetProcessIdByName, 
+			TIpcArgs(&aProcessName, &procId)));
+	
+	return procId();
+	}
+
+EXPORT_C TInt RMemSpySession::ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue )
+	{
+	TPckgBuf<TProcessId> arg1( aId );
+	TPckgBuf<TBool> arg2( aValue );
+	TIpcArgs args( &arg1, &arg2 );
+		
+	TInt error = SendReceive( EMemSpyClientServerOpProcessSystemPermanentOrCritical, args );
+	
+	aValue = arg2();
+	
+	return error;
+	}
+
+EXPORT_C TInt RMemSpySession::EndProcessL( TProcessId aId, TMemSpyEndType aType )
+	{
+	TPckgBuf<TProcessId> arg1( aId );
+	TPckgBuf<TMemSpyEndType> arg2( aType );
+	TIpcArgs args( &arg1, &arg2 );
+	
+	TInt error = SendReceive( EMemSpyClientServerOpEndProcess, args );
+	
+	return error;
+	}
+
+EXPORT_C TInt RMemSpySession::SwitchToProcess( TProcessId aId, TBool aBrought )
+	{
+	TPckgBuf<TProcessId> arg1( aId );
+	TPckgBuf<TBool> arg2( aBrought );
+	TIpcArgs args( &arg1, &arg2 );
+	
+	TInt error = SendReceive( EMemSpyClientServerOpSwitchToProcess, args );
+	
+	return error;	
+	}
+
+// Threads related methods
+EXPORT_C void RMemSpySession::GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType)
+	{
+	TPckgBuf<TInt> count;
+	TPckgBuf<TProcessId> pid(aProcessId);
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetThreadCount, TIpcArgs(&count, &pid)));
+	
+	TInt requestedCount = count();
+	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyThreadData));
+	TPtr8 bufferPtr(buffer->Des());
+	
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetThreads, TIpcArgs(&count, &bufferPtr, &pid)));
+	aThreads.Reset();
+	
+	TInt receivedCount = Min(count(), requestedCount);
+	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyThreadData))
+		{
+		TPckgBuf<TMemSpyThreadData> data;
+		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyThreadData));
+		aThreads.AppendL(CMemSpyApiThread::NewLC(data()));
+		}
+	CleanupStack::Pop(aThreads.Count());
+	CleanupStack::PopAndDestroy(buffer);
+	}
+
+EXPORT_C void RMemSpySession::SetThreadPriorityL(TThreadId aId, TInt aPriority)
+	{
+	TPckgBuf<TThreadId> arg1( aId );
+	TPckgBuf<TInt> arg2( aPriority );
+	
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpSetThreadPriority, TIpcArgs(&arg1, &arg2)));
+	}
+
+EXPORT_C TInt RMemSpySession::ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue )
+	{
+	TPckgBuf<TThreadId> arg1( aId );
+	TPckgBuf<TBool> arg2( aValue );
+	TIpcArgs args( &arg1, &arg2 );
+	
+	TInt error = SendReceive( EMemSpyClientServerOpThreadSystemPermanentOrCritical, args );
+	
+	aValue = arg2();
+	
+	return error;
+	}
+
+EXPORT_C TInt RMemSpySession::EndThreadL( TThreadId aId, TMemSpyEndType aType )
+	{
+	TPckgBuf<TThreadId> arg1( aId );
+	TPckgBuf<TMemSpyEndType> arg2( aType );
+	TIpcArgs args( &arg1, &arg2 );
+	
+	TInt error = SendReceive( EMemSpyClientServerOpEndThread, args );
+	
+	return error;
+	}
+
+EXPORT_C TInt RMemSpySession::SwitchToThread( TThreadId aId, TBool aBrought )
+	{
+	TPckgBuf<TThreadId> arg1( aId );
+	TPckgBuf<TBool> arg2( aBrought );
+	TIpcArgs args( &arg1, &arg2 );
+	
+	TInt error = SendReceive( EMemSpyClientServerOpSwitchToThread, args );
+	
+	return error;	
+	}
+
+EXPORT_C TInt RMemSpySession::GetInfoItemType( TInt aIndex, TThreadId aId, TMemSpyThreadInfoItemType &aType )
+	{
+	TPckgBuf<TInt> arg1( aIndex );
+	TPckgBuf<TThreadId> arg2( aId );
+	TPckgBuf<TMemSpyThreadInfoItemType> arg3;
+	TIpcArgs args( &arg1, &arg2, &arg3 );
+		
+	TInt error = SendReceive( EMemSpyClientServerOpGetInfoItemType, args );
+	
+	aType = arg3();
+	
+	return error;
+	}
+
+EXPORT_C void RMemSpySession::GetThreadInfoItemsL( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType )
+	{
+	TPckgBuf<TThreadId> id( aId );	
+	TPckgBuf<TMemSpyThreadInfoItemType> type( aType );
+	TPckgBuf<TInt> count;	
+	
+	TInt error = SendReceive( EMemSpyClientServerOpGetThreadInfoItemsCount, TIpcArgs( &id, &type, &count ) );
+	TInt itemCount = count();
+	
+	if( error == KErrNone )
+		{		
+		if( itemCount == 0 )
+			{
+			aInfoItems.Reset();
+			}
+		else
+			{
+			HBufC8* buffer = HBufC8::NewLC( itemCount * sizeof(TMemSpyThreadInfoItemData) );
+			TPtr8 bufferPtr(buffer->Des());
+			
+			TPckgBuf<TInt> requestedCount( itemCount );
+			
+			TIpcArgs args( &requestedCount, &id, &type, &bufferPtr );
+			TInt error = SendReceive( EMemSpyClientServerOpGetThreadInfoItems, args ); // TODO check error
+			
+			aInfoItems.Reset();
+		
+			for(TInt i=0, offset = 0; i < itemCount; i++, offset+=sizeof(TMemSpyThreadInfoItemData))
+				{
+				TPckgBuf<TMemSpyThreadInfoItemData> data;
+				data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyThreadInfoItemData));
+				aInfoItems.AppendL(CMemSpyApiThreadInfoItem::NewLC(data()));
+				}
+			
+			CleanupStack::Pop(aInfoItems.Count());
+			CleanupStack::PopAndDestroy(buffer);
+			}
+		}
+	
+	User::LeaveIfError(error);
+	}
+
+EXPORT_C TInt RMemSpySession::GetThreadInfoItems( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType )
+	{
+	TRAPD(error, GetThreadInfoItemsL(aInfoItems, aId, aType));
+	return error;
+	}
+
+EXPORT_C void RMemSpySession::GetProcessIdByThreadId( TProcessId& aPID, TThreadId aTID )
+	{	
+	TPckgBuf<TProcessId> pid(aPID);
+	TPckgBuf<TThreadId> tid(aTID);
+	
+	TIpcArgs args( &pid, &tid );
+	User::LeaveIfError( SendReceive( EMemSpyClientServerOpGetProcessIdByThreadId, args ) );
+	aPID = pid();
+	}
+
+//Kernel Objects specific operations
+EXPORT_C void RMemSpySession::GetKernelObjectsL( RArray<CMemSpyApiKernelObject*> &aKernelObjects )
+	{		
+	TPckgBuf<TInt> count;
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectCount, TIpcArgs(&count) ));
+	
+	TInt requestedCount = count();
+	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyKernelObjectData));
+	TPtr8 bufferPtr(buffer->Des());
+		
+	TIpcArgs args( &count, &bufferPtr );
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjects, args ));
+	
+	aKernelObjects.Reset();
+	
+	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyKernelObjectData))
+		{
+		TPckgBuf<TMemSpyKernelObjectData> data;
+		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyKernelObjectData));
+		aKernelObjects.AppendL(CMemSpyApiKernelObject::NewLC(data()));
+		}
+	
+	CleanupStack::Pop(aKernelObjects.Count());
+	CleanupStack::PopAndDestroy(buffer);
+	}
+
+EXPORT_C TInt RMemSpySession::GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects )
+	{
+	TRAPD(error, GetKernelObjectsL(aKernelObjects));
+	return error;
+	}
+
+EXPORT_C void RMemSpySession::GetKernelObjectItemsL( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer )
+	{
+	TPckgBuf<TInt> count;
+	TPckgBuf<TMemSpyDriverContainerType> type(aForContainer);
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItemCount, TIpcArgs(&count, &type) ));
+
+	TInt requestedCount = count();
+	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyDriverHandleInfoGeneric));
+	TPtr8 bufferPtr(buffer->Des());
+	
+	TIpcArgs args( &count, &type, &bufferPtr );
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItems, args ));
+	
+	aKernelObjectItems.Reset();
+	
+	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyDriverHandleInfoGeneric))
+		{
+		TPckgBuf<TMemSpyDriverHandleInfoGeneric> data;
+		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyDriverHandleInfoGeneric));
+		aKernelObjectItems.AppendL( CMemSpyApiKernelObjectItem::NewLC( data() ) );
+		}
+	CleanupStack::Pop(aKernelObjectItems.Count());
+	CleanupStack::PopAndDestroy(buffer);
+	}
+
+EXPORT_C TInt RMemSpySession::GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer )
+	{
+	TRAPD(error, GetKernelObjectItemsL(aKernelObjectItems, aForContainer));
+	return error;
+	}
+
+EXPORT_C void RMemSpySession::GetMemoryTrackingCyclesL(RArray<CMemSpyApiMemoryTrackingCycle*>& aCycles)
+	{
+	TPckgBuf<TInt> count;
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycleCount, TIpcArgs(&count) ));
+	
+	TInt requestedCount = count();
+	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyMemoryTrackingCycleData));
+	TPtr8 bufferPtr(buffer->Des());
+		
+	TIpcArgs args( &count, &bufferPtr );
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycles, args ));
+	
+	aCycles.Reset();
+	
+	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyMemoryTrackingCycleData))
+		{
+		TPckgBuf<TMemSpyMemoryTrackingCycleData> data;
+		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyMemoryTrackingCycleData));
+		aCycles.AppendL(CMemSpyApiMemoryTrackingCycle::NewLC(data()));
+		}
+	
+	CleanupStack::Pop(aCycles.Count());
+	CleanupStack::PopAndDestroy(buffer);
+	}
+
+EXPORT_C void RMemSpySession::OutputAllContainerContents()
+	{
+	SendReceive( EMemSpyClientServerOpOutputAllContainerContents );
+	}
+
+
+//Heap specific operations
+
+EXPORT_C CMemSpyApiHeap* RMemSpySession::GetHeapL()
+	{
+	CMemSpyApiHeap* aHeap;
+	
+	HBufC8* buffer = HBufC8::NewLC( sizeof(TMemSpyHeapData) );
+	TPtr8 bufferPtr(buffer->Des());
+	TIpcArgs args( &bufferPtr );
+	
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetHeap, args ));
+	
+	TPckgBuf<TMemSpyHeapData> data;
+	data.Copy(bufferPtr.Ptr(), sizeof(TMemSpyHeapData));		
+	aHeap = CMemSpyApiHeap::NewL( data() );
+	
+	CleanupStack::PopAndDestroy(buffer);
+		
+	return aHeap;
+	}
+
+EXPORT_C CMemSpyApiHeap* RMemSpySession::GetHeap()
+	{
+	CMemSpyApiHeap *result = NULL;
+	TRAPD(error, result = GetHeapL());
+	return error == KErrNone ? result : NULL;
+	}
+
+
+
+EXPORT_C void RMemSpySession::GetEComCategoriesL(RArray<CMemSpyApiEComCategory*> &aCategories)
+    {
+    TPckgBuf<TInt> count;
+    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComCategoryCount, TIpcArgs(&count)));
+    
+    TInt requestedCount = count();
+    HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEComCategoryData));
+    TPtr8 bufferPtr(buffer->Des());
+    
+    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComCategories, TIpcArgs(&count, &bufferPtr)));
+    aCategories.Reset();
+    
+    TInt receivedCount = Min(count(), requestedCount);
+    for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyEComCategoryData))
+        {
+        TPckgBuf<TMemSpyEComCategoryData> data;
+        data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEComCategoryData));
+        aCategories.AppendL(CMemSpyApiEComCategory::NewLC(data()));
+        }
+    CleanupStack::Pop(aCategories.Count());
+    CleanupStack::PopAndDestroy(buffer);
+    }
+    
+EXPORT_C void RMemSpySession::GetEComInterfacesL(TUid aCategory, RArray<CMemSpyApiEComInterface*> &aInterfaces)
+    {
+    TPckgBuf<TInt> count;
+    TPckgBuf<TUid> category(aCategory);
+    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComInterfaceCount, TIpcArgs(&count, &category)));
+    
+    TInt requestedCount = count();
+    HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEComInterfaceData));
+    TPtr8 bufferPtr(buffer->Des());
+    
+    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComInterfaces, TIpcArgs(&count, &category, &bufferPtr)));
+    aInterfaces.Reset();
+    
+    TInt receivedCount = Min(count(), requestedCount);
+    for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyEComInterfaceData))
+        {
+        TPckgBuf<TMemSpyEComInterfaceData> data;
+        data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEComInterfaceData));
+        aInterfaces.AppendL(CMemSpyApiEComInterface::NewLC(data()));
+        }
+    CleanupStack::Pop(aInterfaces.Count());
+    CleanupStack::PopAndDestroy(buffer);
+    }
+
+EXPORT_C void RMemSpySession::GetEComImplementationsL(TUid aInterface, RArray<CMemSpyApiEComImplementation*> &aImplementations)
+    {
+    TPckgBuf<TInt> count;
+    TPckgBuf<TUid> interface(aInterface);
+    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComImplementationCount, TIpcArgs(&count, &interface)));
+    
+    TInt requestedCount = count();
+    HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEComImplementationData));
+    TPtr8 bufferPtr(buffer->Des());
+    
+    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComImplementations, TIpcArgs(&count, &interface, &bufferPtr)));
+    aImplementations.Reset();
+    
+    TInt receivedCount = Min(count(), requestedCount);
+    for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyEComImplementationData))
+        {
+        TPckgBuf<TMemSpyEComImplementationData> data;
+        data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEComImplementationData));
+        aImplementations.AppendL(CMemSpyApiEComImplementation::NewLC(data()));
+        }
+    CleanupStack::Pop(aImplementations.Count());
+    CleanupStack::PopAndDestroy(buffer);
+    }
+
+EXPORT_C void RMemSpySession::DumpKernelHeap()
+	{
+	SendReceive( EMemSpyClientServerOpDumpKernelHeap );
+	}
+
+EXPORT_C void RMemSpySession::OutputKernelHeapDataL()
+	{		
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadId,
+			TIpcArgs(KMemSpyClientServerThreadIdKernel)));
+	
+	}
+
+EXPORT_C void RMemSpySession::OutputKernelHeapData(TRequestStatus& aStatus)
+	{
+	SendReceive(EMemSpyClientServerOpHeapData,
+		TIpcArgs(KMemSpyClientServerThreadIdKernel),
+		aStatus);
+	}
+
+EXPORT_C void RMemSpySession::OutputThreadHeapDataL( TThreadId aThreadId)
+	{			
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadId,
+			TIpcArgs(aThreadId)));
+	}
+
+EXPORT_C void RMemSpySession::OutputThreadHeapDataL(const TDesC& aThreadName)
+	{	
+	const TIpcArgs args( &aThreadName );
+	        
+	User::LeaveIfError( SendReceive( EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadName, args ));	
+	}
+
+EXPORT_C void RMemSpySession::OutputThreadCellListL(TThreadId aThreadId)
+	{	
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapCellListing | KMemSpyOpFlagsIncludesThreadId,
+			TIpcArgs(aThreadId)));
+	}
+
+EXPORT_C void RMemSpySession::OutputHeapInfoUserL(TThreadId aThreadId)
+	{
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpHeapInfo | KMemSpyOpFlagsIncludesThreadId,
+			TIpcArgs(aThreadId)));
+	}
+
+EXPORT_C void RMemSpySession::SwitchOutputSinkL( TMemSpySinkType aType )
+	{
+	TInt op;
+	if( aType == ESinkTypeFile )
+		op = EMemSpyClientServerOpSwitchOutputSinkFile;
+	else
+		op = EMemSpyClientServerOpSwitchOutputSinkTrace;
+			
+	User::LeaveIfError(SendReceive( op ));
+	}
+
+EXPORT_C void RMemSpySession::SwitchOutputToTraceL()
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSwitchOutputSinkTrace));
+	}
+    
+EXPORT_C void RMemSpySession::SwitchOutputToFileL(const TDesC& aRootFolder)
+	{
+	TIpcArgs args;
+	if (aRootFolder.Length())
+		{
+		args.Set(0, &aRootFolder);
+		}
+	
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSwitchOutputSinkFile, args));
+	}
+
+EXPORT_C void RMemSpySession::OutputStackInfoL(TThreadId aThreadId)
+	{
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpStackInfo | KMemSpyOpFlagsIncludesThreadId,
+			TIpcArgs(aThreadId)));
+	}
+
+EXPORT_C void RMemSpySession::OutputStackDataL(TThreadId aThreadId, TMemSpyDriverDomainType aType )
+	{
+	TInt op;
+	if( aType == EMemSpyDriverDomainUser )
+		op = EMemSpyClientServerOpStackDataUser;
+	else
+		op = EMemSpyClientServerOpStackDataKernel;
+	
+	User::LeaveIfError(SendReceive( op | KMemSpyOpFlagsIncludesThreadId,
+			TIpcArgs(aThreadId, aType)));
+		
+	}
+
+EXPORT_C void RMemSpySession::OutputThreadInfoHandlesL(TThreadId aThreadId)
+	{
+	TPckgBuf<TThreadId> id(aThreadId);
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpOutputInfoHandles, TIpcArgs( &id )));	
+	}
+
+EXPORT_C void RMemSpySession::OutputAOListL(TThreadId aId, TMemSpyThreadInfoItemType aType)
+	{
+	TPckgBuf<TThreadId> id(aId);
+	TPckgBuf<TMemSpyThreadInfoItemType> type(aType);
+	
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpOutputAOList, TIpcArgs( &id, &type )));
+	}
+
+EXPORT_C void RMemSpySession::OutputKernelObjectsL()
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpEnumerateKernelContainerAll));
+	}
+
+EXPORT_C void RMemSpySession::OutputCompactStackInfoL()
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpStackInfoCompact)); 
+	}
+
+EXPORT_C void RMemSpySession::OutputCompactHeapInfoL()
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapInfoCompact)); 
+	}
+// Asynchronous operations
+EXPORT_C void RMemSpySession::OutputPhoneInfo(TRequestStatus& aStatus)
+	{	
+	SendReceive(EMemSpyClientServerOpSummaryInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
+	}
+
+EXPORT_C void RMemSpySession::OutputDetailedPhoneInfo(TRequestStatus& aStatus)
+	{	
+	SendReceive(EMemSpyClientServerOpSummaryInfoDetailed | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
+	}
+
+EXPORT_C void RMemSpySession::OutputHeapInfo(TRequestStatus& aStatus)
+	{	
+	SendReceive(EMemSpyClientServerOpHeapInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
+	}
+
+EXPORT_C void RMemSpySession::OutputCompactHeapInfo(TRequestStatus& aStatus)
+	{	
+	SendReceive(EMemSpyClientServerOpHeapInfoCompact | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
+	}
+
+EXPORT_C void RMemSpySession::OutputHeapCellListing(TRequestStatus& aStatus)
+	{	
+	SendReceive(EMemSpyClientServerOpHeapCellListing | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
+	}
+
+EXPORT_C void RMemSpySession::OutputHeapData(TRequestStatus& aStatus)
+	{	
+	SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
+	}
+
+// synchronous version of the operation - for CLI
+EXPORT_C void RMemSpySession::OutputHeapData()
+	{
+	SendReceive(EMemSpyClientServerOpHeapData);
+	}
+
+EXPORT_C void RMemSpySession::OutputStackInfo(TRequestStatus& aStatus)
+	{	
+	SendReceive(EMemSpyClientServerOpStackInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
+	}
+
+EXPORT_C void RMemSpySession::OutputCompactStackInfo(TRequestStatus& aStatus)
+	{	
+	SendReceive(EMemSpyClientServerOpStackInfoCompact | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
+	}
+
+EXPORT_C void RMemSpySession::OutputUserStackData(TRequestStatus& aStatus)
+	{	
+	SendReceive(EMemSpyClientServerOpStackDataUser | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
+	}
+
+EXPORT_C void RMemSpySession::OutputKernelStackData(TRequestStatus& aStatus)
+	{	
+	SendReceive(EMemSpyClientServerOpStackDataKernel | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
+	}
+
+// Synchronous operations
+EXPORT_C void RMemSpySession::OutputPhoneInfo()
+	{	
+	SendReceive( EMemSpyClientServerOpSummaryInfo , TIpcArgs() );
+	}
+
+EXPORT_C TInt RMemSpySession::GetSwmtCyclesCount()
+	{
+	TPckgBuf<TInt> count;
+	TIpcArgs args( &count );
+		
+	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycleCount, args ));
+	
+	return count();
+	}
+
+EXPORT_C void RMemSpySession::SetSwmtAutoStartProcessList( CArrayFixFlat<TUid>* aList )
+	{
+	TInt count = aList->Count();
+	TIpcArgs args( &aList, &count );
+	
+	SendReceive( EMemSpyClientServerOpSetSwmtAutoStartProcessList, args );
+	}
+
+EXPORT_C void RMemSpySession::SwmtResetTracking()
+	{
+	SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingReset );
+	}
+
+EXPORT_C void RMemSpySession::GetOutputSink( TMemSpySinkType& aType )
+	{
+	TPckgBuf<TMemSpySinkType> type( aType );
+	TIpcArgs args( &type );
+	
+	SendReceive( EMemSpyClientServerOpGetOutputSink, args );
+	
+	aType = type();
+	}
+
+EXPORT_C void RMemSpySession::NotifyDeviceWideOperationProgress(TMemSpyDeviceWideOperationProgress &aProgress, TRequestStatus &aStatus)
+	{
+	SendReceive(EMemSpyClientServerOpNotifyDeviceWideOperationProgress | KMemSpyOpFlagsAsyncOperation,
+			TIpcArgs(&aProgress.iProgress, &aProgress.iDescription), 
+			aStatus);
+	}
+
+EXPORT_C void RMemSpySession::CancelDeviceWideOperationL()
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpCancelDeviceWideOperation));
+	}
+
+// SWMT operations
+EXPORT_C void RMemSpySession::SetSwmtCategoriesL(TInt aCategories)
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet,
+			TIpcArgs(aCategories)));
+	}
+
+EXPORT_C void RMemSpySession::SetSwmtHeapDumpsEnabledL(TBool aEnabled)
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet,
+			TIpcArgs(aEnabled)));
+	}
+
+EXPORT_C void RMemSpySession::SetSwmtMode(TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode)
+	{
+	TPckgBuf<TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode> mode( aMode );
+	TIpcArgs args(&mode);
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingModeSet, args));
+	}
+
+EXPORT_C TBool RMemSpySession::IsSwmtRunningL()
+	{
+	TPckgBuf<TBool> ret;
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpIsSwmtRunning, TIpcArgs(&ret)));
+	
+	return ret();
+	}
+
+EXPORT_C void RMemSpySession::StartSwmtTimerL(TInt aPeriod)
+	{
+	SetSwmtTimerIntervalL(aPeriod);
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart));
+	}
+
+EXPORT_C void RMemSpySession::StartSwmtTimerL()
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart));
+	}
+
+EXPORT_C void RMemSpySession::SetSwmtTimerIntervalL(TInt aPeriod)
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet,
+			TIpcArgs(aPeriod)));
+	}
+
+EXPORT_C void RMemSpySession::StopSwmtTimerL()
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop));
+	}
+
+
+EXPORT_C void RMemSpySession::ForceSwmtUpdateL()
+	{
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate));
+	}
+
+EXPORT_C void RMemSpySession::ForceSwmtUpdate(TRequestStatus& aStatus)
+	{
+	SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate, 
+			TIpcArgs(),
+			aStatus);
+	}
+
+EXPORT_C void RMemSpySession::SetSwmtFilter( const TDesC& aFilter )
+	{	
+	TIpcArgs args( &aFilter );
+	User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet, args ) );
+	}
+
+EXPORT_C void RMemSpySession::GetSwmtFilter( TName& aFilter )
+	{
+    TPckgBuf<TName> name;
+    TIpcArgs args( &name );
+		User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterGet, args ) );
+	aFilter = name();
+	}
+        
+EXPORT_C void RMemSpySession::GetSwmtCategoriesL(TInt& aCategories)
+	{
+	TPckgBuf<TInt> cat;	
+	TIpcArgs args( &cat );
+		User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesGet, args ) );
+	aCategories = cat();
+	}
+
+EXPORT_C void RMemSpySession::GetSwmtHeapDumpsEnabledL(TBool& aEnabled)
+	{
+	TPckgBuf<TBool> enabled;
+	TIpcArgs args( &enabled );
+		User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpGet, args ) );
+		
+	aEnabled = enabled();
+	}
+        
+EXPORT_C void RMemSpySession::GetSwmtMode(TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode& aMode)
+	{
+	TPckgBuf<TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode> mode;
+	TIpcArgs args( &mode );
+		User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingModeGet, args ) );
+	aMode = mode();
+	}
+    
+EXPORT_C void RMemSpySession::GetSwmtTimerIntervalL(TInt& aPeriod)
+	{
+	TPckgBuf<TInt> time;
+	TIpcArgs args( &time );
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodGet,
+			args));
+	aPeriod = time();
+	}
+
+EXPORT_C TInt TMemSpyDeviceWideOperationProgress::Progress() const 
+	{
+	return iProgress();
+	}
+
+EXPORT_C const TDesC& TMemSpyDeviceWideOperationProgress::Description() const
+	{
+	return iDescription;
+	}
+
+// Servers
+EXPORT_C void RMemSpySession::GetServersL(RArray<CMemSpyApiServer*> &aServers)
+    {
+    TPckgBuf<TInt> count;
+    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServerCount, TIpcArgs(&count)));
+    
+    TInt requestedCount = count();
+    HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyServerData));
+    TPtr8 bufferPtr(buffer->Des());
+    
+    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServers, TIpcArgs(&count, &bufferPtr)));
+    aServers.Reset();
+    
+    TInt receivedCount = Min(count(), requestedCount);
+    for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyServerData))
+        {
+        TPckgBuf<TMemSpyServerData> data;
+        data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyServerData));
+        aServers.AppendL(CMemSpyApiServer::NewLC(data()));
+        }
+    CleanupStack::Pop(aServers.Count());
+    CleanupStack::PopAndDestroy(buffer);
+    }
+
+EXPORT_C void RMemSpySession::GetServersL(RArray<CMemSpyApiServer*> &aServers, TSortType aSortType)
+	{
+	TPckgBuf<TInt> count;
+	TPckgBuf<TSortType> sort( aSortType );
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServerCount, TIpcArgs(&count)));
+	    	
+	TInt requestedCount = count();
+	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyServerData));
+	TPtr8 bufferPtr(buffer->Des());
+	    
+	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetSortedServers, TIpcArgs(&count, &bufferPtr, &sort)));
+	aServers.Reset();
+	    
+	TInt receivedCount = Min(count(), requestedCount);
+	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyServerData))
+		{
+		TPckgBuf<TMemSpyServerData> data;
+		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyServerData));
+		aServers.AppendL(CMemSpyApiServer::NewLC(data()));
+		}
+	CleanupStack::Pop(aServers.Count());
+	CleanupStack::PopAndDestroy(buffer);
+	}
+
+EXPORT_C void RMemSpySession::ServerListOutputGenericL( TBool aDetailed )
+	{
+	TPckgBuf<TBool> detailed( aDetailed );
+	TIpcArgs args( &detailed );
+	User::LeaveIfError( SendReceive( EMemSpyClientServerOpServerListOutputGeneric, args ) );
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyServer/Source/MemSpyServerMain.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* 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:
+* MemSpyServer Main class
+*/
+
+// System includes
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+
+// User includes
+//#include "MemSpyServer.h"
+
+static void RunServerL()
+    {
+    // Scheduler
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
+    CleanupStack::PushL( scheduler );    
+    CActiveScheduler::Install( scheduler );    
+    
+    // F32
+    RFs fsSession;
+    User::LeaveIfError(fsSession.Connect());
+    CleanupClosePushL(fsSession);
+    
+    // MemSpyEngine initialization
+    CMemSpyEngine* engine = CMemSpyEngine::NewL(fsSession);
+    CleanupStack::PushL(engine);
+    
+    // Play nicely with external processes
+    RProcess::Rendezvous( KErrNone );       
+
+    // Start wait loop.
+    CActiveScheduler::Start();
+    
+    // Tidy up
+    CleanupStack::PopAndDestroy( 3, scheduler );
+    }
+
+TInt E32Main()
+    {
+    __UHEAP_MARK;
+
+    CTrapCleanup* cleanupTrap = CTrapCleanup::New();
+    
+	TInt r = KErrNoMemory;
+	if ( cleanupTrap )
+		{
+		TRAPD(err, RunServerL());		
+		if  ( err != KErrNone )
+		        {
+		        RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MemSpyServer - error: %d"), err);
+		        }
+		delete cleanupTrap;
+		}  
+
+    __UHEAP_MARKEND;
+
+    return r;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyServer/data/MemSpyEComInterfaceIds.xml	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,18 @@
+<?xml version="1.0" standalone="yes"?>
+<memspy_ecom_sections>
+
+    <category name="Messaging">
+		<interface uid="0xABCD1234" name="Watchers" />
+    </category>
+
+    <category name="App-Protocols">
+		<interface uid="0x101F446D" name="HTTP Filters" />
+		<interface uid="0x1000A449" name="HTTP Protocol" />
+    </category>
+
+    <category name="S60 AIW">
+		<interface uid="0x101F8650" name="AIW Class Base" />
+		<interface uid="0x101F8652" name="AIW Class Menu" />
+    </category>
+
+</memspy_ecom_sections>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyServer/group/MemSpyServer.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* 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 <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGETTYPE EXE
+TARGET MemSpyServer.exe
+UID 0 0x2002EA8D
+SECUREID     0xE5883BC2
+VENDORID	 0x101FB657 // Nokia
+
+EPOCSTACKSIZE 0x4000
+EPOCHEAPSIZE 0x100000 0x4000000
+
+
+SOURCEPATH ../Source
+SOURCE		MemSpyServerMain.cpp 
+
+USERINCLUDE ../Include
+
+CAPABILITY ReadUserData WriteUserData ReadDeviceData WriteDeviceData PowerMgmt
+
+OS_LAYER_SYSTEMINCLUDE
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         MemSpyDriverClient.lib
+LIBRARY         MemSpyEngine.lib
+
+LIBRARY 		euser.lib
+LIBRARY			ecom.lib
+LIBRARY			efsrv.lib
+LIBRARY			estor.lib
+LIBRARY			bafl.lib
+LIBRARY			ws32.lib
+LIBRARY			cone.lib
+LIBRARY			eikcore.lib
+LIBRARY			fbscli.lib 
+LIBRARY 		PlatformEnv.lib
+LIBRARY 		flogger.lib
+LIBRARY			apgrfx.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyServer/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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:
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../data/MemSpyEComInterfaceIds.xml									z:/private/E5883BC2/memspyecominterfaceids.xml
+
+
+PRJ_MMPFILES
+MemSpyServer.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/group/MemSpyCapabilities.mmh	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +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:
+*
+*/
+
+
+CAPABILITY      ReadUserData WriteUserData ReadDeviceData WriteDeviceData SwEvent PowerMgmt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/group/ReleaseNotes_MemSpy.txt	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,159 @@
+===============================================================================
+
+RELEASE NOTES - MEMSPY v2.2.0
+RELEASED 24th August 2010 
+
+SUPPORTS S60 5.0+
+
+===============================================================================
+
+Product Description:
+====================
+MemSpy is a tracing application running on an S60 device. MemSpy is typically
+used to narrow down the field of investigation. Once you know where the problem
+is (e.g. the thread or process), you can use other tools to perform more
+detailed inspection. 
+
+Main Features:
+==============
+- RAM usage of a thread or process
+- Amount of stack each thread has
+- Active objects for a given thread
+- Files that are open in a system, or files that have been opened by a thread
+- Device RAM / ROM configuration
+- Servers that are running (and their sessions)
+- Any memory chunks
+- Heap memory changes over time
+- Bitmaps loaded by the font & bitmap server
+
+===============================================================================
+
+What's New in v2.2.0
+====================
+- 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.
+
+===============================================================================
+
+Installation Notes:
+===================
+MemSpy is typically preinstalled on ROM. If not, it can be added to the
+ROM with the .iby file. Alternatively, a .sis file can be found under the sis-
+directory, but the user needs to sign it with their own developer certificate.
+In Nokia R&D environment, you can use directly the R&D-signed .sis file under 
+the internal\sis directory.
+
+When signing with own developer certificate, the following capabilities are
+needed:
+  TCB
+  CommDD
+  PowerMgmt
+  MultimediaDD
+  ReadDeviceData
+  WriteDeviceData
+  DRM
+  TrustedUI
+  ProtServ
+  DiskAdmin
+  NetworkControl
+  AllFiles
+  SwEvent
+  NetworkServices
+  LocalServices
+  ReadUserData
+  WriteUserData
+  Location
+  SurroundingsDD
+  UserEnvironment
+
+===============================================================================
+
+System Requirements:
+====================
+Basic Requirements:
+- Any S60 5.x device or emulator environment
+
+===============================================================================
+
+Compatibility Issues:
+=====================
+N/A
+
+===============================================================================
+
+Known Issues:
+=============
+- Following command line functions do not work: CmdUI_Background,
+  CmdUI_Foreground, CmdUI_Exit.
+- Command line function CmdSWMT_ForceUpdate does not work correctly when using
+  different category settings in sequential CmdSWMT_ForceUpdate functions.
+- Exporting FBS bitmaps does not work if E: drive is not available.
+
+===============================================================================
+
+Version History:
+================
+
+Version 2.1.0 - 15th June 2010 
+------------------------------
+- Feature: Folder where log files are saved can now be set in settings.
+- Feature: Introduced new Orbit based user interface.
+- Change: Servers, Ecom, Window groups, System info and Automatic Capture were
+  removed.
+- Change: Console interface was removed.
+- Change: Command line interface commands were changed to be more user 
+  friendly.
+
+Version 1.2.0 - 27th October 2009 
+---------------------------------
+- Feature: Tracking modes introduced for simplify System Wide Memory Tracking
+  settings.
+- Feature: System Wide Memory Tracking categories can now be selected.
+- Feature: Heap data captured during System Wide Memory Tracking can be
+  filtered by thread name.
+- Feature: Shared heaps can now be detected with S60 UI and trace output.
+- Feature: Batch files for running MemSpy functions can now be executed from
+  command line.
+- Change: Command line interface documented in User's Guide.
+
+Version 1.1.0 - 22nd July 2009
+------------------------------
+- Fix: Browsing chunk list resulted in a crash.
+- Feature: Details of Kernel Objects can be now displayed on S60 UI.
+- Feature: Process and Thread Kernel Objects can be now terminated and
+  switched to.
+- Feature: Window Groups view for displaying Window Group details, terminating
+  and switching to a Window Group.
+- Feature: Window Groups can be now tracked with SWMT.
+
+Version 1.0.2 - 13th May 2009
+-----------------------------
+- Fix: Correction for rapid insertion & removal of USB cable when viewing
+  kernel containers.
+- Fix: Prevent SWMT from locking MemSpy UI by disallowing too short SWMT
+  timer intervals.
+- Fix: Prevent saving bitmaps with zero-pixel dimensions to disk.    
+- Change: Remove dependency on TimeZoneServer
+
+Version 1.0.1 - 16th March 2009
+------------------------------
+- Feature: Client <-> Server interface now works with console UI as well as 
+  S60 UI.
+- Fix: Process memory tracking values now update correctly in S60 UI.
+- Fix: Navigating back from some views resulted in a crash.
+- Fix: Unable to obtain heap data for some threads which contain lots of 
+  free cells.
+
+Version 1.0.0 - 4th March 2009
+------------------------------
+- Initial release for Symbian Foundation
+
+===============================================================================
+
+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".
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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 <platform_paths.hrh>
+
+// API
+#include "../memspy_plat/group/bld.inf"
+
+// Driver
+#include "../Driver/group/bld.inf"
+
+// Engine includes
+#include "../Engine/group/bld.inf"
+
+// Commandline includes
+#include "../CommandLine/group/bld.inf"
+
+// MemSpyServer
+#include "../MemSpyServer/group/bld.inf"
+
+// MemSpyClient
+#include "../MemSpyClient/group/bld.inf"
+
+PRJ_EXPORTS
+../rom/memspy.iby      CORE_IBY_EXPORT_PATH(tools,memspy.iby)
+../rom/memspy_rom.iby  CORE_IBY_EXPORT_PATH(tools/rom,memspy_rom.iby)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +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:
+*
+*/
+
+// MemSpy API
+#include "../memspy_api/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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 <platform_paths.hrh>
+
+PRJ_EXPORTS
+// Public API
+../include/MemSpyEngineClientInterface.h				                            OS_LAYER_PLATFORM_EXPORT_PATH(memspyengineclientinterface.h)
+
+// Main engine API
+../include/memspy/engine/MemSpyEngine.h									            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengine.h)
+../include/memspy/engine/MemSpyEngineImp.h								            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineimp.h)
+../include/memspy/engine/MemSpyEngineUtils.h							            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineutils.h)
+../include/memspy/engine/MemSpyEngineObserver.h							            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobserver.h)
+../include/memspy/engine/MemSpyEngineTwiddlableItemArray.h				            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginetwiddlableitemarray.h)
+../include/memspy/engine/MemSpyEngineTwiddlableItemArray.inl			            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginetwiddlableitemarray.inl)
+../include/memspy/engine/MemSpyEngineProcessMemoryTracker.h				            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineprocessmemorytracker.h)
+
+// Device wide operations
+../include/memspy/engine/DeviceWideOps/MemSpyDeviceWideOperations.h				    OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspydevicewideoperations.h)
+
+// Sink
+../include/memspy/engine/Sink/MemSpyEngineOutputSink.h					            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineoutputsink.h)
+../include/memspy/engine/Sink/MemSpyEngineOutputSinkType.h				            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineoutputsinktype.h)
+../include/memspy/engine/Sink/MemSpyEngineOutputList.h					            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineoutputlist.h)
+
+// Logger
+../include/memspy/engine/Logger/MemSpyEngineLogger.h					            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginelogger.h)
+
+// Event Handlers
+../include/memspy/engine/EventHandlers/MemSpyEngineMidwife.h			            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginemidwife.h)
+../include/memspy/engine/EventHandlers/MemSpyEngineUndertaker.h			            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineundertaker.h)
+
+// Thread and process
+../include/memspy/engine/ThreadAndProcess/MemSpyEngineObject.h						OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobject.h)
+../include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectContainer.h				OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobjectcontainer.h)
+../include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectProcess.h				OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobjectprocess.h)
+../include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThread.h				OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobjectthread.h)
+../include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoContainer.h	OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobjectthreadinfocontainer.h)
+../include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.h		OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyengineobjectthreadinfoobjects.h)
+
+// Helpers
+../include/memspy/engine/Helpers/MemSpyEngineHelperActiveObject.h					OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperactiveobject.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperChunk.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperchunk.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperCodeSegment.h					OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpercodesegment.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperCondVar.h						OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpercondvar.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperECom.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperecom.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperFbServ.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperfbserv.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperFileSystem.h						OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperfilesystem.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperHeap.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperheap.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperKernelContainers.h				OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperkernelcontainers.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperProcess.h						OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperprocess.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperRAM.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperram.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperROM.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperrom.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperServer.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperserver.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperStack.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperstack.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperThread.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperthread.h)
+../include/memspy/engine/Helpers/MemSpyEngineHelperWindowServer.h							OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelperwindowserver.h)
+
+// SWMT
+../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTracker.h			OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtracker.h)
+../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerConfig.h		OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtrackerconfig.h)
+../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycle.h		OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtrackercycle.h)
+../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycleChange.h	OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtrackercyclechange.h)
+../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerObserver.h	OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtrackerobserver.h)
+../include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerEnums.h		OS_LAYER_PLATFORM_EXPORT_PATH(memspy/engine/memspyenginehelpersysmemtrackerenums.h)
+
+// Driver
+../include/memspy/driver/kernel/MemSpyDriverPanics.h				                OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverpanics.h)
+
+../include/memspy/driver/shared/MemSpyDriverConstants.h					            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverconstants.h)
+../include/memspy/driver/shared/MemSpyDriverObjectsShared.h				            OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverobjectsshared.h)
+../include/memspy/driver/shared/MemSpyDriverEnumerationsShared.h			        OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverenumerationsshared.h)
+../include/memspy/driver/shared/MemSpyDriverObjectsSharedRHeap.h			        OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverobjectssharedrheap.h)
+
+../include/memspy/driver/user/MemSpyDriverClient.h				                    OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverclient.h)
+../include/memspy/driver/user/MemSpyDriverStreamReader.h			                OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverstreamreader.h)
+../include/memspy/driver/user/MemSpyDriverLightweightClient.h		                OS_LAYER_PLATFORM_EXPORT_PATH(memspy/driver/memspydriverlightweightclient.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/MemSpyEngineClientInterface.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,742 @@
+/*
+* 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 MEMSPYENGINECLIENTINTERFACE_H
+#define MEMSPYENGINECLIENTINTERFACE_H
+
+
+// System includes
+#include <e32base.h>
+#include <u32std.h>
+
+// Constants
+const TInt KMemSpyClientServerVersion           = 2;
+const TInt KMemSpyListInfoForAllThreads         = -1;
+
+/**
+ * Special constant to be used to indicate kernel thread id
+ * when performing kernel-specific thread agnostic operations.
+ *
+ * Note that the kernel thread is not supported for all thread-specific
+ * operation types. 
+ *
+ * Use this value to indicate that the kernel thread is the target
+ * thread when calling the thread-specific overload of PerformOperation().
+ */
+const TUint32 KMemSpyClientServerThreadIdKernel = KMaxTUint32;
+
+// Internal constants
+const TInt KMemSpyOpFlagsTypeMask               = 0x0000FFFF;
+const TInt KMemSpyOpFlagsInclusionMask          = 0xFFFF0000;
+const TInt KMemSpyOpFlagsIncludesThreadId       = 0x00010000;
+const TInt KMemSpyOpFlagsIncludesThreadName     = 0x00020000;
+const TInt KMemSpyOpFlagsAsyncOperation         = 0x00040000;
+// Literal constants
+_LIT( KMemSpyServerName, "MemSpyServer" );
+_LIT( KMemSpyProcessName0, "MemSpyServer.exe" );
+_LIT( KMemSpyProcessName1, "MemSpyUI.exe" );
+//_LIT( KMemSpyProcessName2, "MemSpyConsole.exe" );
+
+//
+// Supported MemSpy operation types
+//
+// Operations which can only be applied to a specific thread are
+// prefixed by [TS] - i.e. it is permitted to use the thread-specific 
+// overload of PerformOperation() for this operation type.
+//
+// Operations that can be applied only to the entire device are
+// prefixed by [ED] - i.e. it is permitted to use the 
+// thread-agnostic overload of PerformOperation() for this operation type.
+//
+// Operations that support kernel-thread-specific requests
+// are prefixed by [KS] - i.e. it is permitted to use the 
+// thread-specific overload of PerformOperation() and the thread
+// identification parameter should correspond to KMemSpyClientServerThreadIdKernel.
+// NB: The overload of PerformOperation() which supports a descriptor cannot
+// be used.
+//
+// Operations that are not relevant to a thread are prefixed
+// by [NT] - i.e. use the thread-agnostic overload of
+// PerformOperation()
+//
+// All other op codes are deemed internal and are not to be
+// used except via provided APIs.
+//
+enum TMemSpyClientServerOp
+    {
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpMarkerFirst = 0,
+
+    /**
+     * [TS][ED]
+     * Show basic summary information about a thread/process
+     */
+    EMemSpyClientServerOpSummaryInfo = EMemSpyClientServerOpMarkerFirst,
+
+    /**
+     * [TS][ED]
+     * Show detailed summary information about a thread/process
+     */
+    EMemSpyClientServerOpSummaryInfoDetailed,
+
+    /**
+     * [TS][ED][KS]
+     * Show heap information & statistics for a user-side thread
+     */
+    EMemSpyClientServerOpHeapInfo,
+
+    /**
+     * [TS][ED]
+     * Prvide heap cell listings for a thread
+     */
+    EMemSpyClientServerOpHeapCellListing,
+
+    /**
+     * [TS][ED][KS]
+     * Dump a thread's heap
+     */
+    EMemSpyClientServerOpHeapData,
+
+    /**
+     * [TS][ED]
+     * Show summary information about a thread's stack
+     */
+    EMemSpyClientServerOpStackInfo,
+
+    /**
+     * [TS][ED]
+     * Dump a thread's user-side stack
+     */
+    EMemSpyClientServerOpStackDataUser,
+
+    /**
+     * [TS][ED]
+     * Dump a thread's kernel-side stack
+     */
+    EMemSpyClientServerOpStackDataKernel,
+
+    /**
+     * [TS][ED]
+     * List all open files in the OS or then the open files
+     * for a given thread.
+     */
+    EMemSpyClientServerOpOpenFiles,
+    
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpMarkerThreadAgnosticFirst,
+
+    /**
+     * [ED]
+     * Provide compact heap information for the entire device, which
+     * can be compared with other similar listings using Heap Analyser.
+     */
+    EMemSpyClientServerOpHeapInfoCompact = EMemSpyClientServerOpMarkerThreadAgnosticFirst,
+
+    /**
+     * [ED]
+     * Show compact stack information for the device
+     */
+    EMemSpyClientServerOpStackInfoCompact,
+
+    /**
+     * [NT]
+     * Start the system wide memory tracker (SWMT) running, so that when
+     * the timer expires, the system characteristics will be sampled
+     * and any changes notified. NB: Starting the SWMT running for the first time
+     * will cause an initial preparatory cycle to be established. Future updates
+     * will then follow when the timer tick period expires
+     */
+    EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart,
+
+    /** 
+     * [NT]
+     * Stop the system wide memory tracker. No futher automatic timer-based
+     * SWMT cycles will be performed unless "Force update" is utilised or the timer
+     * is started again.
+     */
+    EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop,
+
+    /** 
+     * [NT]
+     * Reset the SWMT so that all existing cycles are discarded (which can free
+     * quite a lot of memory). All operations are cancelled, the SWMT will be idle.
+     * 
+     * If performing manual "force updates" to the SWMT, then the SWMT should be reset
+     * before starting a new test run. For timer-based SWMT sampling, this operation
+     * is performed internally by MemSpy and therefore is redundant in that situation.
+     */
+    EMemSpyClientServerOpSystemWideMemoryTrackingReset,
+
+    /**
+     * [NT]
+     * Force the system wide memory tracker (internal to memspy) to
+     * perform a refresh
+     */
+    EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpSwitchOutputSinkFile,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpSwitchOutputSinkTrace,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpEnumerateKernelContainer,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpEnumerateKernelContainerAll,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpBitmapsSave,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpDisableAknIconCache,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpSendToBackground,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpBringToForeground,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpExit,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet,
+
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet,
+        
+    /**
+     * [INTERNAL REQUEST]
+     */
+    EMemSpyClientServerOpSystemWideMemoryTrackingModeSet,        
+    
+    /**
+	 * [INTERNAL REQUEST]
+	 */
+	EMemSpyClientServerOpMarkerUiFirst,
+	
+	EMemSpyClientServerOpGetProcessCount = EMemSpyClientServerOpMarkerUiFirst,
+	
+	EMemSpyClientServerOpGetProcesses,
+	
+	EMemSpyClienServerOpGetProcessIdByName,
+	
+	EMemSpyClientServerOpGetThreadCount,
+	
+	EMemSpyClientServerOpGetThreads,
+	
+	EMemSpyClientServerOpSetThreadPriority,
+	
+	EMemSpyClientServerOpProcessSystemPermanentOrCritical,
+	
+	EMemSpyClientServerOpEndProcess,
+	
+	EMemSpyClientServerOpSwitchToProcess,
+	
+	//Threads operations
+	EMemSpyClientServerOpThreadSystemPermanentOrCritical,
+	
+	EMemSpyClientServerOpEndThread,
+	
+	EMemSpyClientServerOpSwitchToThread,
+	
+	EMemSpyClientServerOpGetInfoItemType,
+	
+	EMemSpyClientServerOpGetProcessIdByThreadId,
+	
+	EMemSpyClientServerOpGetThreadInfoItemsCount,
+	
+	EMemSpyClientServerOpGetThreadInfoItems,
+	
+	EMemSpyClientServerOpOutputInfoHandles,
+	
+	EMemSpyClientServerOpOutputAOList,
+		
+	
+	//Kernel Objects operations
+	EMemSpyClientServerOpGetKernelObjectCount,
+	
+	EMemSpyClientServerOpGetKernelObjects,
+	
+	EMemSpyClientServerOpGetKernelObjectItemCount,
+	
+	EMemSpyClientServerOpGetKernelObjectItems,
+	
+	EMemSpyClientServerOpGetHeap,
+	
+	EMemSpyClientServerOpGetMemoryTrackingCycleCount,
+	
+	EMemSpyClientServerOpGetMemoryTrackingCycles,
+	
+	EMemSpyClientServerOpGetMemoryTrackingMdcaCount,
+	/**
+	 * [INTERNAL REQUEST]
+	 * Register for notifications of device wide operation progress.
+	 */
+	EMemSpyClientServerOpNotifyDeviceWideOperationProgress,
+	
+	/**
+	 * [INTERNAL REQUEST]
+	 * Cancel current device wide operation
+	 */
+	EMemSpyClientServerOpCancelDeviceWideOperation,	
+	
+	EMemSpyClientServerOpOutputAllContainerContents,
+	    
+	EMemSpyClientServerOpDumpKernelHeap,
+	
+	EMemSpyClientServerOpSetSwmtAutoStartProcessList,
+		
+	EMemSpyClientServerOpGetOutputSink,
+	
+	/**
+	 * [INTERNAL REQUEST]
+	 * Check if system wide memory tracking timer is running.
+	 */
+	EMemSpyClientServerOpIsSwmtRunning,
+	
+	EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodGet,
+
+	EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterGet,
+    
+    EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesGet,
+    
+    EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpGet,
+
+    EMemSpyClientServerOpSystemWideMemoryTrackingModeGet,   
+	
+    //Servers methods
+	EMemSpyClientServerOpGetServerCount,
+	
+	EMemSpyClientServerOpGetServers,
+	
+	EMemSpyClientServerOpGetSortedServers,
+	
+	EMemSpyClientServerOpServerListOutputGeneric,
+	
+	EMemSpyClientServerOpGetEComCategoryCount,
+	    
+	EMemSpyClientServerOpGetEComCategories,
+	
+	EMemSpyClientServerOpGetEComInterfaceCount,
+	        
+	EMemSpyClientServerOpGetEComInterfaces,
+	
+	EMemSpyClientServerOpGetEComImplementationCount,
+	            
+	EMemSpyClientServerOpGetEComImplementations,
+	
+	EMemSpyClientServerOpMarkerUiLast,		
+	
+	/**
+	 * [INTERNAL REQUEST]
+	 */
+    EMemSpyClientServerOpMarkerLast,
+    };
+
+
+enum TMemSpyEndType
+	{
+	ETerminate,
+	EKill,
+	EPanic
+	};
+
+
+
+
+
+NONSHARABLE_CLASS( RMemSpyEngineClientInterface ) : public RSessionBase
+    {
+public:
+    inline RMemSpyEngineClientInterface();
+    inline TInt Connect();
+    inline void Close();
+
+public: // API
+
+    /**
+     * Thread-agnostic request function. Performs the operation in the context of
+     * the entire device.
+     *
+     * I.e. can only be used for [NT] or [ED] requests.
+     */
+    inline TInt PerformOperation( TMemSpyClientServerOp aOperation );
+
+    /**
+     * Thread-specific request functions. Perform the requested operation in the context
+     * of the specified thread id, or (possibly partial) thread name.
+     *
+     * To perform the operation in the context of the current thread, invoke the
+     * function as follows:
+     *
+     *      PerformOperation( <...>, RThread().Id() );
+     *
+     * I.e. can only be used for [TS] requests.
+     */
+    inline TInt PerformOperation( TMemSpyClientServerOp aOperation, TThreadId aId );
+    inline TInt PerformOperation( TMemSpyClientServerOp aOperation, const TDesC& aThreadName );
+
+    /**
+     * General functions to switch MemSpy's output mode.
+     */
+    inline TInt SwitchOutputModeFile();
+    inline TInt SwitchOutputModeTrace();
+
+    /**
+     * Configure the system wide memory tracker timer interval (for automatic timer-based polling).
+     * Change will take effect next time SWMT is started.
+     */
+    inline TInt SystemWideMemoryTrackerTimerIntervalSet( TInt aInterval );
+
+    /**
+     * Configure the system wide memory tracker categories.
+     * Change will take effect next time SWMT is started.
+     */
+    inline TInt SystemWideMemoryTrackerCategoriesSet( TInt aCategories );
+
+    /**
+     * Configure the system wide memory tracker for filtering user heaps by thread name.
+     * Change will take effect next time SWMT is started.
+     */
+    inline TInt SystemWideMemoryTrackerThreadFilterSet( const TDesC& aFilter );
+    
+    /**
+     * Configure the system wide memory tracker for enabling/disabling Heap dumps during SWMT.
+     * Change will take effect next time SWMT is started.
+     */
+    inline TInt SystemWideMemoryTrackerHeapDumpSet( TBool aDumpEnabled );
+    
+    /**
+     * List the contents of a specific kernel container. See TObjectType for types.
+     */
+    inline TInt EnumerateKernelContainer( TObjectType aType );
+
+    /**
+     * List the contents of all kernel containers
+     */
+    inline TInt EnumerateKernelContainerAll();
+
+    /**
+     * Save bitmaps to memory card
+     */
+    inline TInt SaveAllBitmaps();
+
+    /**
+     * Disable AknIcon caching
+     */
+    inline TInt DisableAknIconCache();
+
+    /**
+     * Send MemSpy to the background/bring to foreground
+     */
+    inline TInt SendToBackground();
+    inline TInt BringToForeground();
+
+    /**
+     * Exit MemSpy
+     */
+    inline TInt Exit();
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+inline RMemSpyEngineClientInterface::RMemSpyEngineClientInterface()
+    {
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::Connect()
+    {
+    TVersion version( KMemSpyClientServerVersion, 0, 0 );
+    return CreateSession( KMemSpyServerName, version );
+    }
+
+
+inline void RMemSpyEngineClientInterface::Close()
+    {
+    RSessionBase::Close();
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::PerformOperation( TMemSpyClientServerOp aOperation )
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = aOperation;
+        const TIpcArgs args( KMemSpyListInfoForAllThreads );
+        //
+        error = SendReceive( opCode, args );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::PerformOperation( TMemSpyClientServerOp aOperation, TThreadId aId )
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = aOperation | KMemSpyOpFlagsIncludesThreadId;
+        const TIpcArgs args( aId );
+        //
+        error = SendReceive( opCode, args );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::PerformOperation( TMemSpyClientServerOp aOperation, const TDesC& aThreadName )
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = aOperation | KMemSpyOpFlagsIncludesThreadName;
+        const TIpcArgs args( &aThreadName );
+        //
+        error = SendReceive( opCode, args );
+        }
+    return error;
+    }
+
+
+
+
+
+
+inline TInt RMemSpyEngineClientInterface::SwitchOutputModeFile()
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpSwitchOutputSinkFile;
+        error = SendReceive( opCode );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::SwitchOutputModeTrace()
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpSwitchOutputSinkTrace;
+        error = SendReceive( opCode );
+        }
+    return error;
+    }
+
+
+
+
+
+
+
+
+inline TInt RMemSpyEngineClientInterface::SystemWideMemoryTrackerTimerIntervalSet( TInt aInterval )
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet;
+        const TIpcArgs args( aInterval );
+        //
+        error = SendReceive( opCode, args );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::SystemWideMemoryTrackerCategoriesSet( TInt aCategories )
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet;
+        const TIpcArgs args( aCategories );
+        //
+        error = SendReceive( opCode, args );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::SystemWideMemoryTrackerThreadFilterSet( const TDesC& aFilter )
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet;
+        TIpcArgs args( &aFilter );
+        error = SendReceive( opCode, args );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::SystemWideMemoryTrackerHeapDumpSet( TBool aDumpEnabled  )
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet;
+        const TIpcArgs args( aDumpEnabled );
+        error = SendReceive( opCode, args );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::EnumerateKernelContainer( TObjectType aType )
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpEnumerateKernelContainer;
+        const TIpcArgs args( aType );
+        //
+        error = SendReceive( opCode, args );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::EnumerateKernelContainerAll()
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpEnumerateKernelContainerAll;
+        error = SendReceive( opCode );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::SaveAllBitmaps()
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpBitmapsSave;
+        error = SendReceive( opCode );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::DisableAknIconCache()
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpDisableAknIconCache;
+        error = SendReceive( opCode );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::SendToBackground()
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpSendToBackground;
+        error = SendReceive( opCode );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::BringToForeground()
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpBringToForeground;
+        error = SendReceive( opCode );
+        }
+    return error;
+    }
+
+
+inline TInt RMemSpyEngineClientInterface::Exit()
+    {
+    TInt error = KErrNotReady;
+    if  ( Handle() != KNullHandle )
+        {
+        const TInt opCode = EMemSpyClientServerOpExit;
+        error = SendReceive( opCode );
+        }
+    return error;
+    }
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/kernel/MemSpyDriverPanics.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 MEMSPYDRIVERPANICS_H
+#define MEMSPYDRIVERPANICS_H
+
+// System includes
+#include <e32cmn.h>
+
+
+/**
+ * Mem spy driver client panic category
+ */
+_LIT( KMemSpyClientPanic, "MemSpyDriver" );
+
+
+/**
+ * Panic codes
+ */
+enum TMemSpyDriverPanic
+	{
+	EPanicBadDescriptor = 0,
+	EPanicHeapWalkPending,
+	EPanicHeapWalkNotInitialised,
+    EPanicThreadsInProcessNotSuspended,
+    EPanicWrongProcessSuspended,
+    EPanicAttemptingToSuspendMultipleProcesses,
+    EPanicAttemptingToResumeNonSuspendedProcess,
+    EPanicHeapInfoNotYetSeeded,
+    EPanicHeapChunkAlreadyCloned,
+    EPanicForcedKill,
+    EPanicForcedTerminate,
+    EPanicForcedPanic,
+    EPanicKernelHeapDataInitError,
+    EPanicKernelHeapDataFetchError,
+    EPanicHeapFreeCellStreamNotClosed,
+    EPanicHeapFreeCellStreamNotOpen
+	};
+
+
+	
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverConstants.h	Mon Sep 06 15:00:47 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:
+*
+*/
+
+#ifndef MEMSPYDRIVERCONSTANTS_H
+#define MEMSPYDRIVERCONSTANTS_H
+
+// System includes
+#include <e32def.h>
+
+
+/**
+*
+*/
+_LIT(KMemSpyDriverDeviceName, "MEMSPYDRIVER");
+
+
+/**
+ *
+ */
+inline TVersion KMemSpyDriverVersion() { return TVersion(1, 0, 0); }
+
+
+/**
+ * As this LDD allows to bypass platform security, we need to restrict
+ * access to a few trusted clients.
+ */
+const TUint32 KMemSpyUiSID = 0x2002129F;
+const TUint32 KMemSpyConsoleUiSID = 0x2002129E;
+
+
+/**
+ *
+ */
+const TInt KMemSpyDriverEnumerateContainerHandles = -1;
+
+
+/**
+ * Used for get heap data calls when requesting the kernel heap
+ * 
+ */
+const TUint KMemSpyDriverGetKernelHeapDataPseudoThreadId = 0;
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverEnumerationsShared.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* 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 MEMSPYDRIVERENUMERATIONSSHARED_H
+#define MEMSPYDRIVERENUMERATIONSSHARED_H
+
+// System includes
+#include <u32std.h>
+
+// Enumerations
+enum TMemSpyDriverCellType
+	{
+	EMemSpyDriverAllocatedCellMask	= 0x000000FF,
+	EMemSpyDriverFreeCellMask		= 0x0000FF00,
+	EMemSpyDriverBadCellMask		= 0xFF000000,
+
+	EMemSpyDriverHeapAllocation		= 0x00000001,
+	EMemSpyDriverDlaAllocation		= 0x00000002,
+	EMemSpyDriverPageAllocation		= 0x00000003,
+	EMemSpyDriverSlabAllocation		= 0x00000004,
+	
+	EMemSpyDriverHeapFreeCell		= 0x00000100,
+	EMemSpyDriverDlaFreeCell		= 0x00000200,
+	EMemSpyDriverSlabFreeCell		= 0x00000300, // Used to track free cells in partially-filled slabs
+	EMemSpyDriverSlabFreeSlab		= 0x00000400, // Used to track entirely empty slabs (that don't have a specific cell size)
+
+	EMemSpyDriverHeapBadFreeCellAddress			= 0x01000000,
+	EMemSpyDriverHeapBadFreeCellSize			= 0x02000000,
+	EMemSpyDriverHeapBadAllocatedCellSize		= 0x03000000,
+	EMemSpyDriverHeapBadAllocatedCellAddress	= 0x04000000,
+	};
+
+
+enum TMemSpyDriverThreadOrProcess
+    {
+    EMemSpyDriverThreadOrProcessTypeThread = EThread, // From TObjectType
+    EMemSpyDriverThreadOrProcessTypeProcess = EProcess
+    };
+
+
+enum TMemSpyDriverDomainType
+    {
+    EMemSpyDriverDomainUser = 0,
+    EMemSpyDriverDomainKernel
+    };
+
+
+enum TMemSpyDriverChunkType
+    {
+    EMemSpyDriverChunkTypeUnknown = 0,
+    EMemSpyDriverChunkTypeHeap,
+    EMemSpyDriverChunkTypeHeapKernel,
+    EMemSpyDriverChunkTypeStackAndProcessGlobalData,
+    EMemSpyDriverChunkTypeStackKernel,
+    EMemSpyDriverChunkTypeGlobalData,
+    EMemSpyDriverChunkTypeCode,
+    EMemSpyDriverChunkTypeCodeGlobal,
+    EMemSpyDriverChunkTypeCodeSelfModifiable,
+    EMemSpyDriverChunkTypeLocal,
+    EMemSpyDriverChunkTypeGlobal,
+    EMemSpyDriverChunkTypeRamDrive
+    };
+
+
+enum TMemSpyDriverContainerType
+    {
+    EMemSpyDriverContainerTypeUnknown          = -1,
+    EMemSpyDriverContainerTypeFirst            = EThread,
+	EMemSpyDriverContainerTypeThread           = EMemSpyDriverContainerTypeFirst,
+	EMemSpyDriverContainerTypeProcess          = EProcess,
+	EMemSpyDriverContainerTypeChunk            = EChunk,
+	EMemSpyDriverContainerTypeLibrary          = ELibrary,
+	EMemSpyDriverContainerTypeSemaphore        = ESemaphore,
+	EMemSpyDriverContainerTypeMutex            = EMutex,
+	EMemSpyDriverContainerTypeTimer            = ETimer,
+	EMemSpyDriverContainerTypeServer           = EServer,
+	EMemSpyDriverContainerTypeSession          = ESession,
+	EMemSpyDriverContainerTypeLogicalDevice    = ELogicalDevice,
+	EMemSpyDriverContainerTypePhysicalDevice   = EPhysicalDevice,
+	EMemSpyDriverContainerTypeLogicalChannel   = ELogicalChannel,
+	EMemSpyDriverContainerTypeChangeNotifier   = EChangeNotifier,
+	EMemSpyDriverContainerTypeUndertaker       = EUndertaker,
+	EMemSpyDriverContainerTypeMsgQueue         = EMsgQueue,
+	EMemSpyDriverContainerTypePropertyRef      = EPropertyRef,
+	EMemSpyDriverContainerTypeCondVar          = ECondVar,
+	EMemSpyDriverContainerTypeLast             = EMemSpyDriverContainerTypeCondVar
+    };
+
+
+enum TMemSpyDriverTimerType // Same as TTimer::TTimerType
+    {
+    EMemSpyDriverTimerTypeUnknown = 0,
+	EMemSpyDriverTimerTypeRelative = 1,
+    EMemSpyDriverTimerTypeAbsolute = 2,
+    EMemSpyDriverTimerTypeLocked = 4,
+    EMemSpyDriverTimerTypeHighRes = 8,
+    EMemSpyDriverTimerTypeInactivity = 16
+    };
+
+
+enum TMemSpyDriverTimerState // Same as TTimer::TTimerState
+    {
+    EMemSpyDriverTimerStateUnknown = -1,
+	EMemSpyDriverTimerStateIdle = 0,
+    EMemSpyDriverTimerStateWaiting,
+    EMemSpyDriverTimerStateWaitHighRes
+    };
+
+enum TMemSpyDriverEventType
+    {
+    EMemSpyDriverEventTypeThreadCreate = 0,
+    EMemSpyDriverEventTypeThreadKill,
+    EMemSpyDriverEventTypeProcessRemove,
+    EMemSpyDriverEventTypeProcessCreate,
+    EMemSpyDriverEventTypeChunkAdd,
+    EMemSpyDriverEventTypeChunkDestroy,
+    };
+
+enum TMemSpyMemoryModelType
+    {
+    EMemSpyMemoryModelTypeUnknown = 0,
+    EMemSpyMemoryModelTypeMoving,
+    EMemSpyMemoryModelTypeMultiple,
+    EMemSpyMemoryModelTypeEmulator
+    };
+
+enum TMemSpyChunkAttributes
+	{
+	EMemSpyChunkAttributesNormal            = 0x00,
+	EMemSpyChunkAttributesDoubleEnded	    = 0x01,
+	EMemSpyChunkAttributesDisconnected	    = 0x02,
+	EMemSpyChunkAttributesConstructed   	= 0x04,
+	EMemSpyChunkAttributesMemoryNotOwned	= 0x08
+	};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverObjectsShared.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,470 @@
+/*
+* 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 MEMSPYDRIVEROBJECTSSHARED_H
+#define MEMSPYDRIVEROBJECTSSHARED_H
+
+// System includes
+#include <u32std.h>
+
+// User includes
+#include <memspy/driver/memspydriverenumerationsshared.h>
+#include <memspy/driver/memspydriverobjectssharedrheap.h>
+
+// Classes referenced
+class CActiveScheduler;
+class CTrapCleanup;
+
+
+
+/**
+ * ARM user registers.
+ * Size must be multiple of 4 bytes.
+ */
+class TMemSpyDriverRegSet
+	{
+public:
+	enum { KRegCount = 16 };
+	TUint32 iRn[KRegCount];
+	TUint32 iCpsr;
+	};
+
+
+/** 
+ * ARM-specific exception-related data.
+ * Size must be multiple of 4 bytes.
+ */ 
+class TMemSpyDriverCpuExcInfo
+	{
+public:
+	enum TExcCode 
+		{ 
+		EPrefetchAbort=0,
+		EDataAbort=1,
+		EUndefinedOpcode=2,
+		};
+public:
+	TExcCode iExcCode;
+	/** Point to instruction which caused exception */
+	TUint32 iFaultPc;
+	/** 
+     Address which caused exception (System Control Coprocessor Fault
+	 Address Register)
+	*/
+	TUint32 iFaultAddress;
+	/** System Control Coprocessor Fault Status Register */
+	TUint32 iFaultStatus;
+	/** R13 supervisor mode banked register */
+	TUint32 iR13Svc;
+	/** R14 supervisor mode banked register */
+	TUint32 iR14Svc;
+	/** SPSR supervisor mode banked register */
+	TUint32 iSpsrSvc;
+	};
+
+
+
+
+
+/**
+ * Stack water mark parameters
+ */
+struct TMemSpyDriverStackWatermarkParams
+    {
+    TUint8* iStackDataAddress;
+    TInt iStackDataLength;
+    TRequestStatus* iStatus;
+    TLinAddr iUserStackPointer;
+    };
+
+
+
+
+/**
+ * Stack information block.
+ */
+class TMemSpyDriverStackInfo
+	{
+public:
+    TUint iUserStackPointer;
+	TUint32 iUserStackBase;
+	TInt iUserStackSize;
+    TUint32 iUserStackHighWatermark;
+    //
+    TUint iSupervisorStackPointer;
+	TUint32 iSupervisorStackBase;
+	TInt iSupervisorStackSize;
+    TUint32 iSupervisorStackHighWatermark;
+	};
+
+
+/**
+ * Basic thread information block
+ */
+class TMemSpyDriverThreadInfoBase
+	{
+public:
+    // Registers
+    TMemSpyDriverRegSet iCpu;
+    
+    // Stack
+    TMemSpyDriverStackInfo iStackInfo;
+    
+    // User thread framework
+	RAllocator* iAllocator;
+    CActiveScheduler* iScheduler;
+	};
+
+
+/**
+ * Thread information block.
+ */
+class TMemSpyDriverThreadInfo : public TMemSpyDriverThreadInfoBase
+	{
+public:
+	TFullName iFullName;
+ 
+    // Basic properties
+	TUint iPid;
+    TThreadPriority iThreadPriority;
+
+    // Exit information
+	TInt iExitReason;
+    TExitType iExitType;
+    TExitCategoryName iExitCategory;
+	};
+
+
+/**
+ * Process information block.
+ */
+class TMemSpyDriverProcessInfo
+    {
+public:
+    inline TUint32 SID() const { return iSecurityInfo.iSecureId; }
+    inline TUint32 VID() const { return iSecurityInfo.iVendorId; }
+
+public:
+    TUidType iUids;
+    TUint32 iFlags;
+    TInt iGeneration;
+    TInt iPriority;
+    SSecurityInfo iSecurityInfo;
+    };
+
+
+/** 
+ * Code Segment Information Block 
+ */
+class TMemSpyDriverCodeSegInfo
+	{
+public:
+    inline TMemSpyDriverCodeSegInfo()
+        : iSize( 0 )
+        {
+        }
+
+public:
+    TUint32 iSize;
+    TCodeSegCreateInfo iCreateInfo;
+    TProcessMemoryInfo iMemoryInfo;
+	};
+
+
+
+
+
+/**
+ * Generic object related
+ */
+class TMemSpyDriverHandleInfoGeneric
+    {
+public: // Supported for all types
+	TBuf8<KMaxName> iName; // FullName
+    TAny* iHandle;
+    TMemSpyDriverContainerType iType;
+
+public: // Type-specific members
+
+    // For Process, thread, chunk (owning process id), server (owning thread id)
+    TInt iId;
+
+    // For Chunk, Library
+    TUint32 iSize;
+   
+    // For Semaphore, Mutex, Server
+    TInt iCount;
+
+    // For Mutex
+    TInt iWaitCount;
+
+    // For Server, Session
+    TIpcSessionType iSessionType;
+
+    // For Timer
+    TMemSpyDriverTimerType iTimerType;
+    TMemSpyDriverTimerState iTimerState;
+
+    // For Logical channel
+    TInt iOpenChannels;
+    
+    // For most of the object types
+	TBuf8<KMaxName> iNameDetail; // Name
+    TInt iAccessCount;
+    TInt iUniqueID;
+    TUint iProtection;
+    TUint8* iAddressOfKernelOwner;
+    TInt iPriority;
+    TUint8* iAddressOfOwningProcess;
+    TUint iCreatorId;
+    TUint iSecurityZone;
+    TInt iAttributes;
+    TUint8* iAddressOfDataBssStackChunk;
+
+    // For Server, Session
+    TUint8* iAddressOfOwningThread;
+    TUint8* iAddressOfServer;
+    TUint16 iTotalAccessCount;
+    TUint8 iSvrSessionType;
+    TInt iMsgCount;
+    TInt iMsgLimit;
+    
+    // For chunk
+    TInt iMaxSize;
+    TInt iBottom;
+    TInt iTop;
+    TInt iStartPos;
+    TUint iControllingOwner;
+    TUint iRestrictions;
+    TUint iMapAttr;
+    TUint iChunkType;
+    TBuf8<KMaxName> iNameOfOwner; // chunk, server
+    
+    // For library
+    TInt iMapCount;
+    TUint8 iState;
+    TUint8* iAddressOfCodeSeg;
+    
+    // Semaphore, mutex, condvar
+    TUint8 iResetting;
+    TUint8 iOrder;
+    
+    // For Logical/Physical device
+    TVersion iVersion;
+    TUint iParseMask;
+    TUint iUnitsMask;
+    
+    // For change notifier
+    TUint iChanges;
+    };
+
+
+
+/**
+ *
+ */
+class TMemSpyDriverServerSessionInfo
+    {
+public: // Enumerations
+    enum TOwnerType
+        {
+        EOwnerNone = -1,
+        EOwnerThread = 0,
+        EOwnerProcess
+        };
+
+public:
+    TInt iOwnerId;
+    TOwnerType iOwnerType;
+    TBuf8<KMaxName> iName;
+    TIpcSessionType iSessionType;
+    TUint8* iAddress;
+    };
+
+
+
+/**
+ *
+ */
+class TMemSpyDriverProcessInspectionInfo
+    {
+public:
+    inline TMemSpyDriverProcessInspectionInfo()
+        : iProcessId( 0 ),
+          iMemoryHeap( 0 ),
+          iMemoryStack( 0 ),
+          iMemoryGlobalData( 0 ),
+          iMemoryChunkLocal( 0 ),
+          iMemoryChunkShared( 0 )
+        {
+        }
+
+public: // API
+    inline TUint32 TotalIncShared() const
+        {
+        const TUint32 ret = TotalExcShared() + iMemoryChunkShared;
+        return ret;
+        }
+
+    inline TUint32 TotalExcShared() const
+        {
+        const TUint32 ret = iMemoryHeap + iMemoryStack + iMemoryChunkLocal + iMemoryGlobalData;
+        return ret;
+        }
+
+public:
+    TUint32 iProcessId;
+    //
+    TUint32 iMemoryHeap;
+    TUint32 iMemoryStack;
+    TUint32 iMemoryGlobalData;
+    TUint32 iMemoryChunkLocal;
+    TUint32 iMemoryChunkShared;
+    //
+    TInt64 iTime;
+    };
+
+
+
+
+
+
+class TMemSpyHeapInfo
+    {
+public: // Enumerations
+    enum THeapImplementationType
+        {
+        ETypeUnknown = 0,
+        ETypeRHeap = 1,
+		ETypeRHybridHeap = 2,
+        };
+
+public: // Constructor & destructor
+    inline TMemSpyHeapInfo()
+        {
+        }
+
+public: // API
+    inline void SetType( THeapImplementationType aType ) { iType = aType; }
+    inline THeapImplementationType Type() const { return iType; }
+    //
+    inline TMemSpyHeapInfoRHeap& AsRHeap() { return iRHeap; }
+    inline const TMemSpyHeapInfoRHeap& AsRHeap() const { return iRHeap; }
+    //
+    inline void SetTid( TUint32 aId ) { iTid = aId; }
+    inline TUint32 Tid() const { return iTid; }
+    //
+    inline void SetPid( TUint32 aId ) { iPid = aId; }
+    inline TUint32 Pid() const { return iPid; }
+
+private: // Data members
+    THeapImplementationType iType;
+    TMemSpyHeapInfoRHeap iRHeap;
+    TUint32 iPid;
+    TUint32 iTid;
+    };
+
+
+
+
+
+
+/**
+ * Chunk info base class
+ */
+class TMemSpyDriverChunkInfoWithoutName
+    {
+public:
+    inline TMemSpyDriverChunkInfoWithoutName()
+        : iHandle( NULL ),
+          iBaseAddress( NULL ),
+          iSize( 0 ),
+          iMaxSize( 0 ),
+          iOwnerId( 0 ),
+          iType( EMemSpyDriverChunkTypeUnknown )
+        {
+        }
+
+public:
+    TAny* iHandle;
+	TAny* iBaseAddress;
+	TUint iSize;
+	TUint iMaxSize;
+	TUint iOwnerId;
+    TMemSpyDriverChunkType iType;
+    TInt iAttributes;
+    };
+
+
+/**
+ * Chunk info 
+ */
+class TMemSpyDriverChunkInfo : public TMemSpyDriverChunkInfoWithoutName
+    {
+public:
+    inline TMemSpyDriverChunkInfo()
+        : TMemSpyDriverChunkInfoWithoutName(),
+          iName( KNullDesC )
+        {
+        }
+
+public:
+	TFullName iName;
+    };
+
+
+/**
+ * cell information
+ */
+class TMemSpyDriverFreeCell
+	{
+public:
+	TMemSpyDriverCellType iType;
+	TAny* iAddress;
+	TInt iLength;
+	};
+
+// For compatibility I can't change TMemSpyDriverCell to be the class and typdef/derive TMemSpyDriverFreeCell. Sigh...
+typedef TMemSpyDriverFreeCell TMemSpyDriverCell;
+
+
+/** 
+ * P&S information
+ */
+class TMemSpyDriverPAndSInfo
+    {
+public:
+    RProperty::TType iType;
+    TUint iCategory;
+    TUint iKey;
+    TInt iRefCount;
+    TUint32 iTid;
+    TUint32 iCreatorSID;
+    };
+
+
+/**
+ * CondVar suspended thread information
+ */
+class TMemSpyDriverCondVarSuspendedThreadInfo
+    {
+public:
+    TBuf8<KMaxName> iName;
+    TUint8* iAddress;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverObjectsSharedRHeap.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,327 @@
+/*
+* 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 MEMSPYDRIVEROBJECTSSHAREDRHEAP_H
+#define MEMSPYDRIVEROBJECTSSHAREDRHEAP_H
+
+// System includes
+#include <u32std.h>
+#ifndef __KERNEL_MODE__
+#include <e32debug.h>
+#endif
+
+// User includes
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// Defines
+//#define __CHECK_CHUNK_NAME
+
+// Classes referenced
+class CActiveScheduler;
+class CTrapCleanup;
+
+
+/**
+ * Base class for MemSpy RHeap statistics
+ */
+class TMemSpyHeapStatisticsRHeapBase
+    {
+public: // Type
+    enum TType
+        {
+        ETypeAllocated = 0,
+        ETypeFree
+        };
+
+public: // Constructors & destructor
+    inline TMemSpyHeapStatisticsRHeapBase( TType aType )
+        : iType( aType ), 
+          iTypeCount( 0 ), 
+          iTypeSize( 0 ),
+          iLargestCellAddress( NULL ),
+          iLargestCellSize( 0 )
+        {
+        }
+
+public: // API
+    inline TType Type() const { return iType; }
+    //
+    inline TUint TypeCount() const { return iTypeCount; }
+    inline void SetTypeCount( TUint aValue ) { iTypeCount = aValue; }
+    //
+    inline TUint TypeSize() const { return iTypeSize; }
+    inline void SetTypeSize( TUint aValue ) { iTypeSize = aValue; }
+    //
+    inline TAny* LargestCellAddress() const { return iLargestCellAddress; }
+    inline void SetLargestCellAddress( TAny* aAddress ) { iLargestCellAddress = aAddress; }
+    //
+    inline TUint LargestCellSize() const { return iLargestCellSize; }
+    inline void SetLargestCellSize( TUint aSize ) { iLargestCellSize = aSize; }
+
+private: // Data members
+    TType iType;
+    TUint iTypeCount;
+    TUint iTypeSize;
+    TAny* iLargestCellAddress;
+    TUint iLargestCellSize;
+    };
+
+
+
+
+
+/**
+ * RHeap statistics for Allocated cell types
+ */
+class TMemSpyHeapStatisticsRHeapAllocated : public TMemSpyHeapStatisticsRHeapBase
+    {
+public: // Constructors
+    inline TMemSpyHeapStatisticsRHeapAllocated()
+        : TMemSpyHeapStatisticsRHeapBase( TMemSpyHeapStatisticsRHeapBase::ETypeAllocated )
+        {
+        }
+
+public:
+    };
+
+
+
+
+
+
+/**
+ * RHeap statistics for Free cell types
+ */
+class TMemSpyHeapStatisticsRHeapFree : public TMemSpyHeapStatisticsRHeapBase
+    {
+public: // Constructors
+    inline TMemSpyHeapStatisticsRHeapFree()
+        : TMemSpyHeapStatisticsRHeapBase( TMemSpyHeapStatisticsRHeapBase::ETypeFree ),
+          iSlackSpace( 0 ), iSlackSpaceCellAddress( NULL ), iChecksum( 0 )
+        {
+        }
+
+public: // API
+    inline TUint SlackSpaceCellSize() const { return iSlackSpace; }
+    inline void SetSlackSpaceCellSize( TUint aValue ) { iSlackSpace = aValue; }
+    //
+    inline TAny* SlackSpaceCellAddress() const { return iSlackSpaceCellAddress; }
+    inline void SetSlackSpaceCellAddress( TAny* aAddress ) { iSlackSpaceCellAddress = aAddress; }
+    //
+    inline TUint32 Checksum() const { return iChecksum; }
+    inline void SetChecksum( TUint32 aValue ) { iChecksum = aValue; }
+
+public:
+    TUint iSlackSpace;
+    TAny* iSlackSpaceCellAddress;
+    TUint32 iChecksum;
+    };
+
+/**
+ * RHeap statistics class
+ */
+class TMemSpyHeapStatisticsRHeap
+    {
+public: // Constructors
+    inline TMemSpyHeapStatisticsRHeap()
+		: iCommittedFreeSpace(0)
+        {
+        }
+
+public: // API
+    inline TMemSpyHeapStatisticsRHeapFree& StatsFree() { return iStatisticsFree; }
+    inline const TMemSpyHeapStatisticsRHeapFree& StatsFree() const { return iStatisticsFree; }
+    //
+    inline TMemSpyHeapStatisticsRHeapAllocated& StatsAllocated() { return iStatisticsAllocated; }
+    inline const TMemSpyHeapStatisticsRHeapAllocated& StatsAllocated() const { return iStatisticsAllocated; }
+
+
+private: // Data members
+    TMemSpyHeapStatisticsRHeapFree iStatisticsFree;
+    TMemSpyHeapStatisticsRHeapAllocated iStatisticsAllocated;
+
+public: // I am fed up of all these pointless inline accessors...
+	TInt iCommittedFreeSpace; // The amount of committed memory that isn't payload data in allocated or free cells
+    };
+
+
+
+
+
+
+
+/**
+ *
+ */
+class TMemSpyHeapMetaDataRHeap
+    {
+public: // Constructors
+    inline TMemSpyHeapMetaDataRHeap()
+        : iChunkSize( 0 ),
+          iChunkHandle( NULL ),
+          iChunkBaseAddress( NULL ),
+          iDebugAllocator( EFalse ),
+          //iHeaderSizeFree( 0 ),
+          //iHeaderSizeAllocated( 0 ),
+          iIsUserThread( ETrue ),
+		  iVTable(0),
+          iSharedHeap( EFalse ),
+          iHeapSize(0),
+          iAllocatorAddress(NULL),
+		  iMinHeapSize(0),
+		  iMaxHeapSize(0)
+        {
+        }
+
+public: // API
+#ifndef __KERNEL_MODE__
+    inline TPtrC ChunkName() const
+        {
+        TBool alreadyExpanded = ETrue;
+
+#ifdef __CHECK_CHUNK_NAME
+        {
+        RDebug::Printf( "TMemSpyHeapMetaDataRHeap::ChunkName() - BEF - length: %d", iChunkName.Length() );
+        const TUint8* data2 = iChunkName.Ptr();
+        const TInt count = iChunkName.Length();
+        for( TInt i=0;i<count;i++)
+            {
+            RDebug::Printf( "TMemSpyHeapMetaDataRHeap::ChunkName() - BEF - data[%03d] = 0x%08x = %02x (%c)", i, data2, *data2, *data2 );
+            ++data2;
+            }
+        }
+#endif
+
+        // Check if it already has been converted to unicode
+        const TUint8* data = iChunkName.Ptr();
+        if ( iChunkName.Length() >= 1 )
+            {
+            const TUint8 highByte = *(data + 1);
+            alreadyExpanded = ( highByte == 0 ); 
+            }
+
+        // Once expanded, the descriptor is twice the length
+        TPtrC ret( (TUint16*) iChunkName.Ptr(), iChunkName.Length() / 2 );
+        //
+        if ( !alreadyExpanded )
+            {
+            const TInt halfLength = iChunkName.Length() / 2;
+            TMemSpyHeapMetaDataRHeap* self = const_cast< TMemSpyHeapMetaDataRHeap* >( this );
+            ret.Set( self->iChunkName.Expand() );
+            }
+
+#ifdef __CHECK_CHUNK_NAME
+        {
+        RDebug::Printf( "TMemSpyHeapMetaDataRHeap::ChunkName() - AFT - length: %d", iChunkName.Length() );
+        const TUint8* data2 = iChunkName.Ptr();
+        const TInt count = iChunkName.Length();
+        for( TInt i=0;i<count;i++)
+            {
+            RDebug::Printf( "TMemSpyHeapMetaDataRHeap::ChunkName() - AFT - data[%03d] = 0x%08x = %02x (%c)", i, data2, *data2, *data2 );
+            ++data2;
+            }
+        const TPtrC pNextRet( (TUint16*) iChunkName.Ptr(), iChunkName.Length() / 2 );
+        RDebug::Print( _L("TMemSpyHeapMetaDataRHeap::ChunkName() - ret: [%S], nextRet: [%S]"), &ret, &pNextRet );
+        }
+#endif
+        //
+        return ret;
+        }
+
+    inline void SetChunkName( const TDesC16& aValue )
+        {
+        iChunkName.Copy( aValue );
+        iChunkName.Collapse();
+        }
+#else
+    inline void SetChunkName( const TDesC8& aValue )
+        {
+        iChunkName.Copy( aValue );
+        }
+#endif
+    //
+    inline TUint ChunkSize() const { return iChunkSize; }
+    inline void SetChunkSize( TUint aValue ) { iChunkSize = aValue; }
+    //
+    inline TAny* ChunkHandle() const { return iChunkHandle; }
+    inline void SetChunkHandle( TAny* aValue ) { iChunkHandle = aValue; }
+    //
+    inline TAny* ChunkBaseAddress() const { return iChunkBaseAddress; }
+    inline void SetChunkBaseAddress( TAny* aValue ) { iChunkBaseAddress = aValue; }
+    //
+    inline TBool IsDebugAllocator() const { return iDebugAllocator; }
+    inline void SetDebugAllocator( TBool aValue ) { iDebugAllocator = aValue; }
+    //
+    inline TBool IsUserThread() const { return iIsUserThread; }
+    inline void SetUserThread( TBool aValue ) { iIsUserThread = aValue; }
+    //
+    inline TBool IsSharedHeap() const { return iSharedHeap; }
+    inline void SetSharedHeap( TBool aValue ) { iSharedHeap = aValue; }
+    //
+    inline TUint VTable() const { return iVTable; }
+    inline void SetVTable( TUint aValue ) { iVTable = aValue; }
+
+private: // Data members
+    TBuf8< KMaxFullName * 2 > iChunkName;
+public:
+    TUint iChunkSize;
+    TAny* iChunkHandle;
+    TAny* iChunkBaseAddress;
+    TBool iDebugAllocator;
+    TBool iSharedHeap;
+    TBool iIsUserThread;
+    TUint iVTable;
+	TUint iHeapSize; // Committed size - generally the same as iChunkSize (except maybe for kernel heap)
+	TAny* iAllocatorAddress; // replacement for things using the RHeap base address
+	TUint iMinHeapSize; // Minimum committed size
+	TUint iMaxHeapSize; // Max committed size
+    };
+
+
+/**
+ *
+ */
+class TMemSpyHeapInfoRHeap
+    {
+public: // Constructors
+    inline TMemSpyHeapInfoRHeap()
+        {
+        }
+
+public: // API
+    inline TMemSpyHeapMetaDataRHeap& MetaData() { return iMetaData; }
+    inline const TMemSpyHeapMetaDataRHeap& MetaData() const { return iMetaData; }
+    //
+    //inline TMemSpyHeapObjectDataRHeap& ObjectData() { return iObjectData; }
+    //inline const TMemSpyHeapObjectDataRHeap& ObjectData() const { return iObjectData; }
+    //
+    inline TMemSpyHeapStatisticsRHeap& Statistics() { return iStatistics; }
+    inline const TMemSpyHeapStatisticsRHeap& Statistics() const { return iStatistics; }
+
+	inline TInt Overhead() const { return iMetaData.iHeapSize - iStatistics.StatsAllocated().TypeSize() - iStatistics.iCommittedFreeSpace; }
+
+private: // Data members
+    TMemSpyHeapMetaDataRHeap iMetaData;
+    //TMemSpyHeapObjectDataRHeap iObjectData;
+    TMemSpyHeapStatisticsRHeap iStatistics;
+    };
+
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverClient.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,401 @@
+/*
+* 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 MEMSPYDRIVERCLIENT_H
+#define MEMSPYDRIVERCLIENT_H
+
+// System includes
+#include <e32base.h>
+#include <e32std.h>
+#include <e32const.h>
+
+// User includes
+#include <memspy/driver/memspydriverstreamreader.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+
+class RMemSpyDriverClient : public RBusLogicalChannel
+	{
+public: // GENERAL API
+
+    /**
+     *
+     */
+	IMPORT_C TInt Open();
+
+    /**
+     *
+     */
+	IMPORT_C void Close();
+
+    /**
+     *
+     */
+    IMPORT_C void GetVersion( TVersion& aVersion );
+
+
+public: // RAW MEMORY
+
+    /**
+     *
+     */
+	IMPORT_C TInt ReadMemory( TUint aTid, TLinAddr aSrc, TDes8& aDest );
+
+
+public: // CODE SEGS
+
+    /**
+     *
+     */
+	IMPORT_C TInt GetCodeSegs( TAny** aHandleArray, TInt& aHandleCount, TBool aOnlyRamLoaded = EFalse );
+
+    /**
+     *
+     */
+	IMPORT_C TInt GetCodeSegs( TUint aPid, TAny** aHandleArray, TInt& aHandleCount );
+
+    /**
+     *
+     */
+	IMPORT_C TInt GetCodeSegInfo( TAny* aHandle, TUint aPid, TMemSpyDriverCodeSegInfo& aInfo );
+
+
+public: // CHUNKS
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetChunkHandles( TAny** aHandleArray, TInt& aHandleCount );
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetChunkInfo( TAny* aHandle, TMemSpyDriverChunkInfo& aInfo );
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetChunkInfo( TAny* aHandle, TMemSpyDriverChunkInfoWithoutName& aInfo );
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetChunkHandlesForProcess( TUint aPid, TAny** aHandleArray, TInt& aHandleCount );
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetChunkHandlesForThread( TUint aTid, TAny** aHandleArray, TInt& aHandleCount );
+
+
+public: // THREAD & PROCESS 
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetThreadInfo( TUint aTid, TMemSpyDriverThreadInfo& aInfo );
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetProcessInfo( TUint aPid, TMemSpyDriverProcessInfo& aInfo );
+
+    /**
+     *
+     */
+    IMPORT_C TInt ProcessThreadsSuspend( TUint aPid );
+
+    /**
+     *
+     */
+    IMPORT_C TInt ProcessThreadsResume( TUint aPid );
+
+    /**
+     *
+     */
+    IMPORT_C TInt ThreadEnd( TUint aTid, TExitType aType );
+
+    /**
+     *
+     */
+    IMPORT_C TInt OpenThread( TUint aId, RThread& aThread );
+
+    /**
+     *
+     */
+    IMPORT_C TInt OpenProcess( TUint aId, RProcess& aProcess );
+
+    /**
+     *
+     */
+    IMPORT_C void GetThreadsL( const TProcessId& aId, RArray<TThreadId>& aThreads );
+
+    /**
+     *
+     */
+    IMPORT_C TInt SetPriority( TUint aId, TThreadPriority aPriority );
+
+public: // HEAP INFO
+
+    /**
+     *
+     */
+    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 GetHeapInfoKernel( TMemSpyHeapInfo& aInfo );
+    IMPORT_C TInt GetHeapInfoKernel( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>& aFreeCells );
+
+public: // HEAP DATA
+
+    /**
+     * Get free cell data. If aFreeCellChecksum is 0, then no checksum comparison is performed.
+     */
+    IMPORT_C TInt GetHeapData( TUint aTid, TUint32 aFreeCellChecksum, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining );
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetHeapDataNext( TUint aTid, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining );
+
+    /**
+     *
+     */
+    IMPORT_C HBufC8* GetHeapDataKernelLC( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>& aFreeCells );
+
+
+public: // HEAP WALK
+
+    /**
+     *
+     */
+    IMPORT_C TInt WalkHeapInit( TUint aTid );
+
+    /**
+     *
+     */
+    IMPORT_C TInt WalkHeapNextCell( TUint aTid, TMemSpyDriverCellType& aCellType, TAny*& aCellAddress, TInt& aLength, TInt& aNestingLevel, TInt& aAllocNumber, TInt& aCellheaderSize, TAny*& aCellPayloadAddress );
+
+    /**
+     *
+     */
+    IMPORT_C TInt WalkHeapReadCellData( TAny* aCellAddress, TDes8& aDest, TInt aReadLen );
+
+    /**
+     *
+     */
+    IMPORT_C TInt WalkHeapGetCellInfo( TAny*& aCellAddress, TMemSpyDriverCellType& aCellType, TInt& aLength, TInt& aNestingLevel, TInt& aAllocNumber, TInt& aCellheaderSize, TAny*& aCellPayloadAddress );
+
+    /**
+     *
+     */
+    IMPORT_C void WalkHeapClose();
+
+
+public: // STACK RELATED
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetStackInfo( TUint aTid, TMemSpyDriverStackInfo& aInfo );
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetStackData( TUint aTid, TDes8& aDest, TUint& aAmountRemaining, TMemSpyDriverDomainType aDomain = EMemSpyDriverDomainUser, TBool aEntireStack = ETrue );
+
+    /**
+     *
+     */
+    IMPORT_C TInt GetStackDataNext( TUint aTid, TDes8& aDest, TUint& aAmountRemaining, TMemSpyDriverDomainType aDomain = EMemSpyDriverDomainUser, TBool aEntireStack = ETrue );
+
+
+public: // EVENT MONITOR
+
+    /**
+     * @returns TInt handle
+     */
+    IMPORT_C TInt EventMonitorOpen( TUint& aHandle );
+
+    /**
+     *
+     */
+    IMPORT_C TInt EventMonitorClose( TUint aHandle );
+
+    /**
+     *
+     */
+    IMPORT_C void EventMonitorNotify( TUint aHandle, TRequestStatus& aStatus, TUint& aContext );
+
+    /**
+     *
+     */
+    IMPORT_C void EventMonitorNotifyCancel( TUint aHandle );
+
+
+public: // PROCESS INSPECTION
+
+    /**
+     *
+     */
+    IMPORT_C TInt ProcessInspectionOpen( TUint aPid );
+
+    /**
+     *
+     */
+    IMPORT_C TInt ProcessInspectionClose( TUint aPid );
+
+    /**
+     *
+     */
+    IMPORT_C void ProcessInspectionRequestChanges( TUint aPid, TRequestStatus& aStatus, TMemSpyDriverProcessInspectionInfo& aInfo );
+
+    /**
+     *
+     */
+    IMPORT_C void ProcessInspectionRequestChangesCancel( TUint aPid );
+
+    /**
+     *
+     */
+    IMPORT_C void ProcessInspectionAutoStartItemsReset();
+
+    /**
+     *
+     */
+    IMPORT_C TInt ProcessInspectionAutoStartItemsAdd( TUint aSID );
+
+
+public: // Handles related
+
+    /**
+     * Get all of the handles in a specific container
+     */
+	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 );
+
+    /**
+     * Get all handles of a specific type, for a specific process. 
+     */
+	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
+     * use KMemSpyDriverEnumerateContainerHandles as the aTid parameter.
+     */
+    IMPORT_C TInt GetGenericHandleInfo( TInt aTid, TMemSpyDriverContainerType aType, TAny* aHandle, TMemSpyDriverHandleInfoGeneric& aParams );
+
+    /**
+     * Fetches the in-memory size of a specific kernel object (where possible). The size is an approximation since
+     * it doesn't take into account the size of ASSP-specific classes.
+     */
+    IMPORT_C TInt GetApproximateKernelObjectSize( TMemSpyDriverContainerType aType );
+
+    /**
+     * Use this method to identify the handles of threads & processes that happen to reference
+     * the specified thread or process.
+     *
+     * In brief, every kernel-side thread and process object contains a handle container. This container
+     * is the DObject-handles which the thread or process has open.
+     *
+     * This method can be used to search all of the other handle containers within other threads & processes
+     * 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 );
+
+    /**
+     * Get info about a P&S kernel object
+     */
+    IMPORT_C TInt GetPAndSInfo( TAny* aHandle, TMemSpyDriverPAndSInfo& aInfo );
+
+    /**
+     * Get handles to suspended threads from a CondVar
+     */
+    IMPORT_C TInt GetCondVarSuspendedThreads( TAny* aCondVarHandle, TAny** aThreadHandleArray, TInt& aThreadCount );
+
+    /**
+     * Get info about CondVar suspended thread
+     */
+    IMPORT_C TInt GetCondVarSuspendedThreadInfo( TAny* aHandle, TMemSpyDriverCondVarSuspendedThreadInfo& aInfo );
+    
+public: // CLIENT <-> SERVER
+
+    /**
+     * Gets handles of all sessions that are connected to a particular server
+     */
+	IMPORT_C TInt GetServerSessionHandles( TAny* aServerHandle, TAny** aSessionHandleArray, TInt& aSessionHandleCount );
+
+    /**
+     * Gets session information for a given session handle.
+     */
+    IMPORT_C TInt GetServerSessionInfo( TAny* aSessionHandle, TMemSpyDriverServerSessionInfo& aParams );
+
+
+public: // STREAM INTERFACE
+
+    /**
+     * Opens a MemSpy data stream for reading
+     */
+    IMPORT_C RMemSpyMemStreamReader StreamOpenL();
+
+public: // MISC
+
+    /**
+     *
+     */
+    IMPORT_C TMemSpyMemoryModelType MemoryModelType();
+
+    /**
+     *
+     */
+    IMPORT_C TBool IsDebugKernel();
+
+    /**
+     * Round value to a multiple of the current page size
+     *
+     */
+    IMPORT_C TUint32 RoundToPageSize( TUint32 aValue );
+
+    /**
+     *
+     */
+    IMPORT_C TInt Impersonate( TUint32 aValue );
+
+private: // Internal methods
+    static TUint RHeapVTable();
+    static TBool DebugEUser();
+    void ResetStreamBuffer();
+    void ReadHeapInfoFreeCellsFromXferBufferL( RArray<TMemSpyDriverFreeCell>& aFreeCells );
+
+private: // Data members
+    RBuf8 iBuffer;
+	};
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverLightweightClient.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* 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 MEMSPYDRIVERLIGHTWEIGHTCLIENT_H
+#define MEMSPYDRIVERLIGHTWEIGHTCLIENT_H
+
+// System includes
+#include <e32std.h>
+
+// Structs etc
+_LIT(KMemSpyDriverDeviceName, "MEMSPYDRIVER");
+inline TVersion KMemSpyDriverVersion() { return TVersion(1, 0, 0); }
+
+enum TMemSpyDriverOpCode
+	{
+	EMemSpyDriverGetCodeSegsForProcess = 3,
+	EMemSpyDriverGetCodeSegInfo = 4
+    };
+
+struct TMemSpyDriverInternalCodeSnapshotParams
+	{
+	TUint iPid;
+	TAny** iHandles;
+	TInt* iCountPtr;
+	};
+class TMemSpyDriverCodeSegInfo
+	{
+public:
+    TCodeSegCreateInfo iCreateInfo;
+    TProcessMemoryInfo iMemoryInfo;
+	};
+struct TMemSpyDriverInternalCodeSegParams
+	{
+	TUint iPid;
+	TAny* iHandle;
+	TMemSpyDriverCodeSegInfo* iInfoPointer;
+	};
+
+
+class RMemSpyDriverLightweightClient : public RBusLogicalChannel
+	{
+public:
+
+	inline TInt Open()
+        {
+        TInt err = User::LoadLogicalDevice( KMemSpyDriverDeviceName );
+        //
+	    if  ( err == KErrNone || err == KErrAlreadyExists )
+		    {
+		    err = DoCreate( KMemSpyDriverDeviceName, KMemSpyDriverVersion(), KNullUnit, NULL, NULL, EOwnerThread );
+		    }
+        //
+	    return err;
+        }
+
+	inline TInt GetCodeSegs( TUint aPid, TAny** aHandleArray, TInt& aHandleCount )
+        {
+	    TMemSpyDriverInternalCodeSnapshotParams params;
+	    params.iPid = aPid;
+	    params.iHandles = aHandleArray;
+	    params.iCountPtr = &aHandleCount;
+	    return DoControl( EMemSpyDriverGetCodeSegsForProcess, &params, NULL );
+        }
+
+	inline TInt GetCodeSegInfo( TAny* aHandle, TUint aPid, TMemSpyDriverCodeSegInfo& aInfo )
+        {
+	    TMemSpyDriverInternalCodeSegParams params;
+	    params.iPid = aPid;
+	    params.iHandle = aHandle;
+	    params.iInfoPointer = &aInfo;
+        //
+	    const TInt r = DoControl( EMemSpyDriverGetCodeSegInfo, &params, NULL );
+	    return r;
+        }
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverStreamReader.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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 MEMSPYDRIVERSTREAMREADER_H
+#define MEMSPYDRIVERSTREAMREADER_H
+
+// System includes
+#include <e32base.h>
+
+// Classes referenced
+class CMemSpyMemStreamReader;
+
+
+class RMemSpyMemStreamReader
+    {
+friend class RMemSpyDriverClient;
+
+public:
+    IMPORT_C void Close();
+
+private:
+    RMemSpyMemStreamReader( CMemSpyMemStreamReader* aImp );
+
+public: // API
+    IMPORT_C TInt32 ReadInt32L();
+    IMPORT_C TUint32 ReadUint32L();
+    IMPORT_C void ReadL( TDes8& aDes );
+    IMPORT_C void ReadL( TDes16& aDes );
+
+private:
+    CMemSpyMemStreamReader* iImp;
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/DeviceWideOps/MemSpyDeviceWideOperations.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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 MEMSPYDEVICEWIDEOPERATIONS_H
+#define MEMSPYDEVICEWIDEOPERATIONS_H
+
+// System includes
+#include <e32base.h>
+
+// Classes referenced
+class CMemSpyEngine;
+
+class MMemSpyDeviceWideOperationsObserver
+    {
+public: // Enumerations
+    enum TEvent
+        {
+        // Indicates we've worked out how much work is required
+        EOperationSized = 0,
+
+        // Indicates that we are starting the requested operation
+        EOperationStarting,
+
+        // Indicates some work has been done
+        EOperationProgressStart,
+        EOperationProgressEnd,
+
+        // Indicates that the cancellation request has been acknowledged
+        EOperationCancelled,
+
+        // Indicates that we are entering the completion phase
+        EOperationCompleting,
+
+        // Indicates that the operation is complete and this object can be destroyed now
+        EOperationCompleted
+        };
+
+public: // From MMemSpyDeviceWideOperationsObserver
+    virtual void HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 ) = 0;
+    };
+
+
+NONSHARABLE_CLASS( CMemSpyDeviceWideOperations ) : public CActive
+    {
+public:
+    enum TOperation
+        {
+        // Brief overview of user thread
+        EPerEntityGeneralSummary = 0,
+
+        // Detailed information about user thread
+        EPerEntityGeneralDetailed,
+
+        // Thread handles for user thread (dumps thread info container)
+        EPerEntityGeneralHandles,
+        
+        // Heap information for user or kernel thread
+        EPerEntityHeapInfo,
+
+        // Compact heap information for entire device (kernel & user threads)
+        EEntireDeviceHeapInfoCompact,
+
+        // Heap cell listings for specific user thread
+        EPerEntityHeapCellListing,
+        
+        // Heap data for kernel or user threads
+        EPerEntityHeapData,
+        
+        // Summary stack info
+        EPerEntityStackInfo,
+
+        // Compact stack information for the entire device (user threads only)
+        EEntireDeviceStackInfoCompact,
+        
+        // User-side stack for user thread
+        EPerEntityStackDataUser,
+
+        // Supervisor-side stack for user thread
+        EPerEntityStackDataKernel,
+        };
+
+public:
+    IMPORT_C static CMemSpyDeviceWideOperations* NewL( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationsObserver& aObserver, TOperation aOperation );
+    IMPORT_C ~CMemSpyDeviceWideOperations();
+
+private:
+    CMemSpyDeviceWideOperations( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationsObserver& aObserver, TOperation aOperation );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void Cancel();
+    IMPORT_C TInt TotalOperationSize() const;
+
+private: // From CActive
+    void RunL();
+    void DoCancel();
+    TInt RunError(TInt aError);
+
+private: // Internal methods
+    void CompleteSelf( TInt aError );
+    void PerformNextStepL();
+    void PerformFinalOperationL();
+    void SetFinished();
+    TInt TotalNumberOfThreads() const;
+
+private: // Member data
+    CMemSpyEngine& iEngine;
+    MMemSpyDeviceWideOperationsObserver& iObserver;
+    TOperation iOperation;
+    TInt iProcessIndex;
+    TInt iThreadIndex;
+    TBool iOperationCancelled;
+    TInt iTotalOperationSize;
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/EventHandlers/MemSpyEngineMidwife.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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 MEMSPYENGINEMIDWIFE_H
+#define MEMSPYENGINEMIDWIFE_H
+
+// System includes
+#include <e32base.h>
+
+// Classes referenced
+class RMemSpyDriverClient;
+
+
+class MMemSpyEngineMidwifeObserver
+	{
+public: // From MMemSpyEngineMidwifeObserver
+	virtual void ThreadIsBornL( const TThreadId& aId, const RThread& aThread ) = 0;
+	virtual void ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess ) = 0;
+	};
+
+
+NONSHARABLE_CLASS( CMemSpyEngineMidwife ) : public CActive
+    {
+public:
+	static CMemSpyEngineMidwife* NewL( RMemSpyDriverClient& aDriver, TInt aPriority = CActive::EPriorityStandard );
+	~CMemSpyEngineMidwife();
+
+private:
+	CMemSpyEngineMidwife( RMemSpyDriverClient& aDriver, TInt aPriority );
+	void ConstructL();
+
+public: // API
+    void AddObserverL( MMemSpyEngineMidwifeObserver& aObserver );
+    void RemoveObserver( MMemSpyEngineMidwifeObserver& aObserver );
+
+private: // From CActive
+	void RunL();
+	void DoCancel();
+
+private: // Internal methods
+    void Request();
+    void NotifyProcessBornL( const TProcessId& aId );
+    void NotifyThreadBornL( const TThreadId& aId );
+
+private: // Data members
+    TUint iId;
+    RMemSpyDriverClient& iDriver;
+    TUint iEventMonitorHandle;
+	RPointerArray< MMemSpyEngineMidwifeObserver > iObservers;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/EventHandlers/MemSpyEngineUndertaker.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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 MEMSPYENGINEUNDERTAKER_H
+#define MEMSPYENGINEUNDERTAKER_H
+
+// System includes
+#include <e32base.h>
+
+// Classes referenced
+class RMemSpyDriverClient;
+
+
+class MMemSpyEngineUndertakerObserver
+	{
+public: // From MMemSpyEngineUndertakerObserver
+	virtual void ThreadIsDeadL( const TThreadId& aId, const RThread& aThread ) = 0;         // aThread may not be initialised
+	virtual void ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess ) = 0;     // aProcess may not be initialised
+	};
+
+
+NONSHARABLE_CLASS( CMemSpyEngineUndertaker ) : public CActive
+    {
+public:
+	static CMemSpyEngineUndertaker* NewL( RMemSpyDriverClient& aDriver, TInt aPriority = CActive::EPriorityStandard );
+	~CMemSpyEngineUndertaker();
+
+private:
+	CMemSpyEngineUndertaker( RMemSpyDriverClient& aDriver, TInt aPriority );
+	void ConstructL();
+
+public: // API
+    void AddObserverL( MMemSpyEngineUndertakerObserver& aObserver );
+    void RemoveObserver( MMemSpyEngineUndertakerObserver& aObserver );
+
+private: // From CActive
+	void RunL();
+	void DoCancel();
+
+private: // Internal methods
+    void Request();
+    void NotifyProcessDeadL( const TProcessId& aId );
+    void NotifyThreadDeadL( const TThreadId& aId );
+
+private: // Data members
+    TUint iId;
+    TUint iEventMonitorHandle;
+    RMemSpyDriverClient& iDriver;
+	RPointerArray< MMemSpyEngineUndertakerObserver > iObservers;
+    };
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperActiveObject.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* 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 MEMSPYENGINEHELPERACTIVEOBJECT_H
+#define MEMSPYENGINEHELPERACTIVEOBJECT_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include <memspy/engine/memspyengineobject.h>
+
+// Classes referenced
+class CMemSpyThread;
+class CMemSpyEngine;
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineActiveObject ) : public CDesCArrayFlat
+    {
+public:
+	enum TRequestStatusFlags
+		{
+		EActive				= 1,  //bit0
+		ERequestPending		= 2,  //bit1
+		};
+
+public: // Construct / destruct
+    static CMemSpyEngineActiveObject* NewLC( TAny* aAddress, TAny* aVTable, TInt aPriority, TInt aRSValue, TUint aRSFlags, TAny* aNextAOAddress, TAny* aPrevAOAddress, CMemSpyEngine& aEngine );
+    IMPORT_C ~CMemSpyEngineActiveObject();
+    
+private: // Internal construct
+    CMemSpyEngineActiveObject( TAny* aAddress, TAny* aVTable, TInt aPriority, TInt aRSValue, TUint aRSFlags, TAny* aNextAOAddress, TAny* aPrevAOAddress );
+    void ConstructL( CMemSpyEngine& aEngine );
+    
+public:
+    inline TAny* Address() const { return iAddress; }
+    inline TAny* VTable() const { return iVTable; }
+    inline TAny* NextAOAddress() const { return iNextAOAddress; }
+    inline TAny* PrevAOAddress() const { return iPrevAOAddress; }
+    inline TInt RequestStatusValue() const { return iRequestStatusValue; }
+    inline TUint RequestStatusFlags() const { return iRequestStatusFlags; }
+    inline const TDesC& Caption() const { return *iCaption; }
+    inline TInt Priority() const { return iPriority; }
+    IMPORT_C TBool IsActive() const;
+    IMPORT_C TBool IsAddedToScheduler() const;
+    IMPORT_C TBool RequestIsPending() const;
+    IMPORT_C void OutputDataL( CMemSpyEngine& aEngine ) const;
+
+public: // But not exported
+    void SetPriority( TInt aPriority );
+    void SetVTable( TAny* aVTable );
+    void SetRequestStatusValues( TInt aStatus, TUint aFlags );
+
+private: // Internal methods
+    static TPtrC YesNoValue( TBool aValue );
+
+private: // Data members
+    TAny* iAddress;
+    TAny* iVTable;
+    TInt iPriority;
+    TInt iRequestStatusValue;
+    TUint iRequestStatusFlags;
+    TAny* iNextAOAddress;
+    TAny* iPrevAOAddress;
+    //
+    HBufC* iCaption;
+    };
+
+
+
+// CActive
+
+NONSHARABLE_CLASS( CMemSpyEngineActiveObjectArray ) : public CBase, public MDesCArray
+    {
+public: // Construct/destruct
+    static CMemSpyEngineActiveObjectArray* NewLC();
+    IMPORT_C ~CMemSpyEngineActiveObjectArray();
+
+private: // Internal construction
+    CMemSpyEngineActiveObjectArray();
+    void ConstructL();
+
+public: // API
+    IMPORT_C TInt Count() const;
+    IMPORT_C CMemSpyEngineActiveObject& At( TInt aIndex );
+    IMPORT_C const CMemSpyEngineActiveObject& At( TInt aIndex ) const;
+    IMPORT_C CMemSpyEngineActiveObject& ObjectByAddressL( TAny* aAddress );
+    IMPORT_C TInt ObjectIndexByAddress( TAny* aAddress ) const;
+    IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine );
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+public: // But not exported
+    void AddItemL( CMemSpyEngineActiveObject* aItem );
+    void InsertL( CMemSpyEngineActiveObject* aItem, TInt aIndex );
+
+private: // Internal methods
+    void BuildHeaderCaptionL();
+
+private: // Data members
+    HBufC* iHeader;
+    RPointerArray< CMemSpyEngineActiveObject > iObjects;
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperActiveObject ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperActiveObject* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperActiveObject();
+
+private:
+    CMemSpyEngineHelperActiveObject( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C CMemSpyEngineActiveObjectArray* ActiveObjectListL( const CMemSpyThread& aThread );
+
+private: // Internal methods
+    HBufC8* SchedulerHeapCellDataLC( TAny*& aCellAddress, TThreadId aThreadId );
+    void ExtractActiveObjectAddressesL( TAny* aSchedulerCellAddress, const TDesC8& aSchedulerCellData, CMemSpyEngineActiveObjectArray& aArray );
+    TAny* ReadActiveObjectDataL( TAny* aCellAddress, CMemSpyEngineActiveObjectArray& aArray );
+    static void CleanupHeapWalk( TAny* aSelf );
+    TAny* ConvertAddressToRealHeapCellAddressL( TAny* aAddress );
+
+private:
+    CMemSpyEngine& iEngine;
+    TMemSpyHeapInfo iHeapInfo;
+    };
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperChunk.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,187 @@
+/*
+* 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 MEMSPYENGINEHELPERCHUNK_H
+#define MEMSPYENGINEHELPERCHUNK_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// Classes referenced
+class CMemSpyThread;
+class CMemSpyProcess;
+class CMemSpyEngine;
+class CMemSpyEngineChunkEntry;
+class CMemSpyEngineChunkList;
+class CMemSpyEngineOutputList;
+class TMemSpyDriverChunkInfo;
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperChunk ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperChunk* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperChunk();
+
+private:
+    CMemSpyEngineHelperChunk( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void OutputChunkInfoForThreadL( const CMemSpyThread& aThread );
+    IMPORT_C void OutputChunkInfoForThreadL( TThreadId aTid );
+    IMPORT_C void OutputChunkInfoForThreadL( TThreadId aTid, TDes& aLine );
+    //
+    IMPORT_C void OutputChunkInfoForProcessL( const CMemSpyProcess& aProcess );
+    IMPORT_C void OutputChunkInfoForProcessL( TProcessId aPid );
+    IMPORT_C void OutputChunkInfoForProcessL( TProcessId aPid, TDes& aLine );
+    //
+    IMPORT_C CMemSpyEngineChunkList* ListL();
+    IMPORT_C CMemSpyEngineChunkList* ListForThreadL( TThreadId aTid );
+    IMPORT_C CMemSpyEngineChunkList* ListForProcessL( TProcessId aPid );
+
+public:
+    inline CMemSpyEngine& Engine() const { return iEngine; }
+
+private: // Internal enumerations
+    enum TType
+        {
+        EThread = 0,
+        EProcess,
+        EAll
+        };
+
+private: // Internal methods
+    void DoOutputChunkInfoForObjectL( TUint aId, TDes& aLineBuffer, TType aType );
+    void GetChunkHandlesL( RArray<TAny*>& aHandles, TType aType, TUint aId = 0 );
+    CMemSpyEngineChunkList* CreateListFromHandlesL( const RArray<TAny*>& aHandles );
+
+private:
+    CMemSpyEngine& iEngine;
+    };
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineChunkList ) : public CBase, public MDesCArray
+    {
+public:
+    static CMemSpyEngineChunkList* NewLC( CMemSpyEngine& aEngine );
+    IMPORT_C ~CMemSpyEngineChunkList();
+
+private:
+    CMemSpyEngineChunkList( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C TInt Count() const;
+    IMPORT_C CMemSpyEngineChunkEntry& At( TInt aIndex );
+    IMPORT_C TInt ItemIndex( const CMemSpyEngineChunkEntry& aEntry ) const;
+    IMPORT_C TBool EntryExists( TAny* aHandle ) const;
+    IMPORT_C const CMemSpyEngineChunkEntry& At( TInt aIndex ) const;
+    IMPORT_C void SortByNameL();
+    IMPORT_C void SortBySizeL();
+    IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine );
+
+public: // But not exported
+    void AddItemL( CMemSpyEngineChunkEntry* aItem );
+    void Remove( TInt aIndex );
+    void RemoveByHandle( TAny* aChunkHandle );
+    TInt ItemIndexByProcessId( TUint aPid ) const;
+    TInt ItemIndexByProcessId( TUint aPid, TInt aStartIndex ) const;
+    TInt ItemIndexByProcessId( TUint aPid, TMemSpyDriverChunkType aType ) const;
+    TInt ItemIndexByChunkHandle( TAny* aHandle ) const;
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // Internal methods
+    static TInt CompareByName( const CMemSpyEngineChunkEntry& aLeft, const CMemSpyEngineChunkEntry& aRight );
+    static TInt CompareBySize( const CMemSpyEngineChunkEntry& aLeft, const CMemSpyEngineChunkEntry& aRight );
+
+private: // Data members
+    CMemSpyEngine& iEngine;
+    RPointerArray<CMemSpyEngineChunkEntry> iItems;
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineChunkEntry ) : public CBase, public MDesCArray
+    {
+public: // Enumerations - see DChunk::TChunkAttributes
+    enum TChunkAttributes
+        {
+		ENormal			=0x00,
+		EDoubleEnded	=0x01,
+		EDisconnected	=0x02,
+		EConstructed	=0x04,
+		EMemoryNotOwned	=0x08
+        };
+
+    public:
+    static CMemSpyEngineChunkEntry* NewLC( CMemSpyEngine& aEngine, const TMemSpyDriverChunkInfo& aInfo );
+    ~CMemSpyEngineChunkEntry();
+
+private:
+    CMemSpyEngineChunkEntry( CMemSpyEngine& aEngine );
+    void ConstructL( const TMemSpyDriverChunkInfo& aInfo );
+
+public: // API
+    inline const TDesC& Caption() const { return *iCaption; }
+
+public: // API - chunk info
+    const TDesC& Name() const;
+    TAny* Handle() const;
+    TInt Size() const;
+    TInt MaxSize() const;
+    TAny* BaseAddress() const;
+    TAny* UpperAddress() const;
+    TUint OwnerId() const;
+
+public: // API
+    IMPORT_C void OwnerName( TDes& aDes ) const;
+    IMPORT_C void AppendOwnerName( TDes& aDes ) const;
+    IMPORT_C void OutputDataL( CMemSpyEngineHelperChunk& aHelper ) const;
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+public: // But not exported
+    TMemSpyDriverChunkInfo& Info();    
+    const TMemSpyDriverChunkInfo& Info() const;    
+
+private: // Member data
+    CMemSpyEngine& iEngine;
+    TMemSpyDriverChunkInfo* iInfo;
+    HBufC* iCaption;
+    CMemSpyEngineOutputList* iList;
+    };
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperCodeSegment.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* 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 MEMSPYENGINEHELPERCODESEGMENT_H
+#define MEMSPYENGINEHELPERCODESEGMENT_H
+
+// System includes
+#include <e32base.h>
+#include <e32svr.h>
+#include <badesca.h>
+
+// User includes
+#include <memspy/engine/memspyenginetwiddlableitemarray.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyEngineCodeSegEntry;
+class CMemSpyEngineCodeSegList;
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperCodeSegment ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperCodeSegment* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperCodeSegment();
+
+private:
+    CMemSpyEngineHelperCodeSegment( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void OutputCodeSegmentsL( TUint aPid, TDes& aLine, const TDesC& aPrefix, TChar aSectionUnderlineCharacter = '=', TBool aLowerCaseSectionHeading = EFalse );
+    IMPORT_C CMemSpyEngineCodeSegList* CodeSegmentListL();
+    IMPORT_C CMemSpyEngineCodeSegList* CodeSegmentListL( TProcessId aProcess );
+
+public: // API - but not exported
+    CMemSpyEngineCodeSegList* CodeSegmentListRamLoadedL();
+    inline CMemSpyEngine& Engine() const { return iEngine; }
+
+private: // Internal 
+    void GetCodeSegmentHandlesL( RArray<TAny*>& aHandles, TUint* aProcessId = NULL, TBool aRamOnly = EFalse ) const;
+    CMemSpyEngineCodeSegList* ListFromHandlesLC( RArray<TAny*>& aHandles ) const;
+    static TInt SortByAddress( TAny* const& aLeft, TAny* const& aRight );
+
+private:
+    CMemSpyEngine& iEngine;
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineCodeSegList ) : public CMemSpyEngineTwiddlableItemArray<CMemSpyEngineCodeSegEntry>, public MDesCArray
+    {
+public:
+    static CMemSpyEngineCodeSegList* NewLC( CMemSpyEngine& aEngine );
+
+private:
+    CMemSpyEngineCodeSegList( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C TInt IndexByHandle( TAny* aHandle ) const;
+    IMPORT_C void SortByFileNameL();
+    IMPORT_C void SortByCodeSizeL();
+    IMPORT_C void SortByDataSizeL();
+    IMPORT_C void SortByUidsL();
+    IMPORT_C void ShowOnlyEntriesWithGlobalDataL();
+    IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine );
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+public: // API - but not exported
+    TInt IndexByName( const TDesC& aName ) const;
+
+private: // Internal methods
+    static TInt CompareByFileName( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
+    static TInt CompareByCodeSize( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
+    static TInt CompareByDataSize( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
+    static TInt CompareByUid( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
+    static TBool VisibilityFunctionGlobalData( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineCodeSegEntry ) : public CDesCArrayFlat
+    {
+public:
+    static CMemSpyEngineCodeSegEntry* NewLC( TAny* aHandle, TInt aSize, const TCodeSegCreateInfo& aCreateInfo, const TProcessMemoryInfo& aMemoryInfo );
+    IMPORT_C ~CMemSpyEngineCodeSegEntry();
+
+private:
+    CMemSpyEngineCodeSegEntry( TAny* aHandle, TInt aSize, const TCodeSegCreateInfo& aCreateInfo, const TProcessMemoryInfo& aMemoryInfo );
+    void ConstructL();
+
+public: // API
+    inline TAny* Handle() const { return iHandle; }
+    inline TInt Size() const { return iSize; }
+    inline const TDesC& Caption() const { return *iCaption; }
+    inline const TDesC& FileName() const { return *iFileName; }
+    inline const TCodeSegCreateInfo& CreateInfo() const { return iCreateInfo; }
+    inline const TProcessMemoryInfo& MemoryInfo() const { return iMemoryInfo; }
+
+public: // API
+    IMPORT_C TBool HasCapability( TCapability aCapability ) const;
+    IMPORT_C void OutputDataL( CMemSpyEngineHelperCodeSegment& aHelper ) const;
+
+private: // Internal methods
+    void AddCapabilityItemsL();
+    CDesCArray* CapabilityStringsLC() const;
+    void AddCapabilitiesL( TUint32 aCaps, TInt aCapCount, CDesCArray& aArray ) const;
+
+private: // Member data
+    TAny* iHandle;
+    TInt iSize;
+    HBufC* iCaption;
+    HBufC* iFileName;
+    TCodeSegCreateInfo iCreateInfo;
+    TProcessMemoryInfo iMemoryInfo;
+    };
+
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperCondVar.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 MEMSPYENGINEHELPERCONDVAR_H
+#define MEMSPYENGINEHELPERCONDVAR_H
+
+// System includes
+#include <e32base.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include <memspy/engine/memspyengineobject.h>
+
+// Classes referenced
+class CMemSpyThread;
+class CMemSpyEngine;
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperCondVar ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperCondVar* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperCondVar();
+
+private:
+    CMemSpyEngineHelperCondVar( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void GetCondVarSuspendedThreadsL( const TMemSpyDriverHandleInfoGeneric& aCondVarDetails, RArray<TMemSpyDriverCondVarSuspendedThreadInfo>& aThreads );
+
+private:
+    CMemSpyEngine& iEngine;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperECom.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,216 @@
+/*
+* 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 MEMSPYENGINEHELPERECOM_H
+#define MEMSPYENGINEHELPERECOM_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+#include <ecom/ecom.h>
+#include <xml/contenthandler.h> // MContentHandler mix in class
+#include <xml/parser.h>
+
+// Literal constants
+_LIT( KMemSpyEComInterfaceIdFileName, "MemSpyEComInterfaceIds.xml" );
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyEngineEComCategory;
+class CMemSpyEngineEComInterface;
+class CMemSpyEngineEComImplementation;
+class CCnvCharacterSetConverter;
+
+// Namespaces referenced
+using namespace Xml;
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperECom ) : public CBase, public MContentHandler, public MDesCArray
+    {
+public:
+    static CMemSpyEngineHelperECom* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperECom();
+
+private:
+    CMemSpyEngineHelperECom( CMemSpyEngine& aEngine );
+    void ConstructL();
+    void ConstructInternalL();
+    void ConstructFromFileL();
+
+public: // Internal API
+    REComSession& EComSession();
+    inline TInt Count() const { return iCategories.Count(); }
+    IMPORT_C CMemSpyEngineEComCategory& At( TInt aIndex );
+    IMPORT_C TInt IndexOf( const CMemSpyEngineEComCategory& aEntry );
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // Internal methods
+    HBufC* FindEComXmlFileNameLC();
+    void ConvertL( const TDesC8& aInput, TDes16& aOutput );
+    void ParseL( const TDesC& aFileName );
+
+private: // XML helper functions
+    void OnChildSectionCategoryL( const RAttributeArray& aAttributes );
+    void OnChildSectionInterfaceL( const RAttributeArray& aAttributes );
+
+private: // From MContentHandler
+	void OnStartDocumentL( const RDocumentParameters& aDocParam, TInt aErrorCode );
+	void OnEndDocumentL( TInt aErrorCode );
+	void OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode );
+	void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode );
+	void OnContentL( const TDesC8& aBytes, TInt aErrorCode );
+	void OnStartPrefixMappingL( const RString& aPrefix, const RString& aUri, TInt aErrorCode );
+	void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode );
+	void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode );
+	void OnSkippedEntityL( const RString& aName, TInt aErrorCode );
+	void OnProcessingInstructionL( const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode );
+	void OnError( TInt aErrorCode );
+	TAny* GetExtendedInterface( const TInt32 aUid );
+
+private:
+    CMemSpyEngine& iEngine;
+    REComSession iEComSession;
+    TInt iParserErrorCode;
+    TInt iCharconvConverterState;
+    TBool iSeenMasterSection;
+    CParser* iParser;
+    CCnvCharacterSetConverter* iConverter;
+    RPointerArray<CMemSpyEngineEComCategory> iCategories;
+    };
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineEComCategory ) : public CBase, public MDesCArray
+    {
+public:
+    static CMemSpyEngineEComCategory* NewLC( CMemSpyEngineHelperECom& aHelper, const TDesC& aName );
+    ~CMemSpyEngineEComCategory();
+
+private:
+    CMemSpyEngineEComCategory( CMemSpyEngineHelperECom& aHelper );
+    void ConstructL( const TDesC& aName );
+
+public: // API
+    inline const TDesC& Name() const { return *iName; }
+    inline const TDesC& Caption() const { return *iCaption; }
+    inline REComSession& EComSession() { return iHelper.EComSession(); }
+    inline TInt Count() const { return iInterfaces.Count(); }
+    IMPORT_C CMemSpyEngineEComInterface& At( TInt aIndex );
+    IMPORT_C TInt IndexOf( const CMemSpyEngineEComInterface& aEntry );
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+public: // Iternal API
+    void CreateInterfaceL( const TDesC& aName, TUid aUid );
+    void BuildCaptionL();
+
+private:
+    CMemSpyEngineHelperECom& iHelper;
+    RPointerArray<CMemSpyEngineEComInterface> iInterfaces;
+    HBufC* iName;
+    HBufC* iCaption;
+    };
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineEComInterface ) : public CBase, public MDesCArray
+    {
+public:
+    static CMemSpyEngineEComInterface* NewLC( CMemSpyEngineEComCategory& aCategory, const TDesC& aName, TUid aUid );
+    ~CMemSpyEngineEComInterface();
+
+private:
+    CMemSpyEngineEComInterface( CMemSpyEngineEComCategory& aCategory, TUid aUid );
+    void ConstructL( const TDesC& aName );
+
+public: // API
+    inline const TDesC& Name() const { return *iName; }
+    inline const TDesC& Caption() const { return *iCaption; }
+    inline TInt Count() const { return iImplementations.Count(); }
+    inline CMemSpyEngineEComCategory& Category() const { return iCategory; }
+    IMPORT_C CMemSpyEngineEComImplementation& At( TInt aIndex );
+    IMPORT_C TInt IndexOf( const CMemSpyEngineEComImplementation& aEntry );
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // Data members
+    TUid iUid;
+    CMemSpyEngineEComCategory& iCategory;
+    RPointerArray<CMemSpyEngineEComImplementation> iImplementations;
+    HBufC* iName;
+    HBufC* iCaption;
+    };
+
+
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineEComImplementation ) : public CBase, public MDesCArray
+    {
+public:
+    static CMemSpyEngineEComImplementation* NewLC( CMemSpyEngineEComInterface& aInterface, CImplementationInformation* aInfo );
+    ~CMemSpyEngineEComImplementation();
+
+private:
+    CMemSpyEngineEComImplementation( CMemSpyEngineEComInterface& aInterface );
+    void ConstructL( CImplementationInformation* aInfo );
+
+public: // API
+    inline const TDesC& Name() const { return *iName; }
+    inline const TDesC& Caption() const { return *iCaption; }
+    inline CMemSpyEngineEComInterface& Interface() const { return iInterface; }
+    inline CImplementationInformation& Info() const { return *iInfo; }
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // Internal methods
+    static HBufC* CopyAndCropLC( const TDesC8& aText );
+
+private: // Data members
+    CMemSpyEngineEComInterface& iInterface;
+    CImplementationInformation* iInfo;
+    CDesCArray* iInfoText;
+    HBufC* iName;
+    HBufC* iCaption;
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperFbServ.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,243 @@
+/*
+* 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 MEMSPYENGINEHELPERFBSERV_H
+#define MEMSPYENGINEHELPERFBSERV_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+#include <fbs.h>
+#include <bitmap.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class TMemSpyDriverChunkInfo;
+class TMemSpyEngineFBServBitmapInfo;
+
+// Constants
+const TInt KMemSpyEngineDefaultBitmapCreationBatchSize = 4; // Create 4 bitmaps (asynchronously) at a time
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperFbServ ) : public CBase
+    {
+public: // Construct/destruct
+    static CMemSpyEngineHelperFbServ* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperFbServ();
+
+private: // Internal construction
+    CMemSpyEngineHelperFbServ( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void GetArrayOfBitmapHandlesL( RArray<TInt>& aHandles );
+
+public: // API - but not exported
+    void GetArrayOfBitmapHandlesL( RArray<TInt>& aHandles, TInt& aBitmapConCount, TInt& aFontConCount );
+    static TBool IsLargeBitmapChunk( const TMemSpyDriverChunkInfo& aChunkInfo );
+    static TBool IsSharedBitmapChunk( const TMemSpyDriverChunkInfo& aChunkInfo );
+    static void GetBitmapInfoL( TInt aHandle, TMemSpyEngineFBServBitmapInfo& aInfo );
+    static CFbsBitmap* GetBitmapInfoLC( TInt aHandle, TMemSpyEngineFBServBitmapInfo& aInfo );
+
+private: // Internal structures
+    class CBitmapObject : public CObject
+        {
+    public:
+        CBitmapObject* iThisPointer;
+    public:
+        CBase* iTop; // actually CFbTop*
+        CBitwiseBitmap* iAddressPointer;
+        TInt iHandle;
+        CBitmapObject* iCleanBitmap;
+        };
+
+private: // Internal methods
+    CMemSpyThread& IdentifyFbServThreadL();
+    HBufC8* LocateCFbTopHeapCellDataLC( CMemSpyThread& aFbServThread, TAny*& aCellAddress );
+    HBufC8* LocateBitmapArrayHeapCellDataLC( TAny*& aArrayCellAddress, TInt aArrayAllocCount );
+    void ReadCObjectConInfoL( TAny* aCellAddress, RArray<TAny*>& aContainerObjects, TInt& aCount, TInt& aAllocated );
+    static void ParseCellDataAndExtractHandlesL( const TDesC8& aData, RArray<TInt>& aHandles, TInt aArrayEntryCount );
+    static TBool VerifyCorrectHeapCellL( const TDesC8& aData, TAny* aCellAddress, TAny* aPayloadAddress, TUint aHeapStartingAddress, TUint aHeapMaxSize );
+    static TUint OffsetToCObjectConBitmapCon();
+    static TUint OffsetToCObjectConFontCon();
+    static TUint OffsetToBitmapHandleArray();
+    CBitmapObject* GetBitmapObjectLC( TAny* aAddress );
+
+private: // Data members
+    CMemSpyEngine& iEngine;
+    };
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineFbServBitmap ) : public CDesCArrayFlat
+    {
+public: // Construct/destruct
+    IMPORT_C static CMemSpyEngineFbServBitmap* NewLC( TInt aHandle );
+    IMPORT_C ~CMemSpyEngineFbServBitmap();
+
+private: // Internal construction
+    CMemSpyEngineFbServBitmap();
+    void ConstructL( TInt aHandle );
+
+public: // API
+    TInt BitmapSizeInBytes() const;
+    IMPORT_C const TDesC& Caption() const;
+    IMPORT_C CFbsBitmap& Bitmap();
+    IMPORT_C const CFbsBitmap& Bitmap() const;
+    IMPORT_C TInt Handle() const;
+    IMPORT_C void OutputDataL( CMemSpyEngine& aEngine ) const;
+    IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine );
+    IMPORT_C void GetExportableFileNameL( TDes& aAppendName ) const;
+
+public: // But not exported
+    static void GetExportableFileNameL( const TMemSpyEngineFBServBitmapInfo& aInfo, TDes& aAppendName );
+
+private: // Internal
+    void PrepareItemsL();
+
+private: 
+    static void GetFileCompressionTypeAsString( TBitmapfileCompression aType, TDes& aString );
+
+private: // Data members
+    CFbsBitmap* iBitmap;
+    HBufC* iCaption;
+    };
+
+
+
+
+
+
+
+
+
+
+class MMemSpyEngineFbSerbBitmapArrayObserver
+    {
+public:
+    enum TEvent
+        {
+        EBitmapItemsCreated = 0,
+        EBitmapArrayConstructionComplete
+        };
+
+public: // From MMemSpyEngineFbSerbBitmapArrayObserver
+    virtual void HandleFbServBitmapArrayEventL( TEvent aEvent ) = 0;
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineFbServBitmapArray ) : public CActive, public MDesCArray
+    {
+public: // Construct/destruct
+    IMPORT_C static CMemSpyEngineFbServBitmapArray* NewL( const RArray<TInt>& aBitmapHandles );
+    IMPORT_C static CMemSpyEngineFbServBitmapArray* NewL( TInt aPriority, const RArray<TInt>& aBitmapHandles, MMemSpyEngineFbSerbBitmapArrayObserver& aObserver, TInt aGranularity = KMemSpyEngineDefaultBitmapCreationBatchSize );
+    IMPORT_C ~CMemSpyEngineFbServBitmapArray();
+
+private: // Internal construction
+    CMemSpyEngineFbServBitmapArray( const RArray<TInt>& aBitmapHandles );
+    CMemSpyEngineFbServBitmapArray( TInt aPriority, const RArray<TInt>& aBitmapHandles, MMemSpyEngineFbSerbBitmapArrayObserver& aObserver, TInt aGranularity );
+    void ConstructL();
+
+public: // API
+    IMPORT_C TInt Count() const;
+    IMPORT_C CMemSpyEngineFbServBitmap& At( TInt aIndex );
+    IMPORT_C const CMemSpyEngineFbServBitmap& At( TInt aIndex ) const;
+    IMPORT_C CMemSpyEngineFbServBitmap& BitmapByHandleL( TInt aHandle );
+    IMPORT_C TInt BitmapIndexByHandle( TInt aHandle ) const;
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // From CActive
+    void RunL();
+    void DoCancel();
+    TInt RunError( TInt aError );
+
+private: // Internal
+    void CompleteSelf();
+    void CreateBitmapL( TInt aHandle );
+    void SortBySizeL();
+    static TInt CompareBySize( const CMemSpyEngineFbServBitmap& aLeft, const CMemSpyEngineFbServBitmap& aRight );
+
+private: // Data members
+    const RArray<TInt>& iBitmapHandles;
+    MMemSpyEngineFbSerbBitmapArrayObserver* iObserver;
+    const TInt iGranularity;
+
+    // Transient
+    TInt iIndex;
+
+    // Owned
+    RPointerArray< CMemSpyEngineFbServBitmap > iBitmaps;
+    };
+
+
+
+
+
+
+
+class TMemSpyEngineFBServBitmapInfo
+    {
+public:
+    inline TMemSpyEngineFBServBitmapInfo()
+        : iHandle( 0 ), iSizeInPixels( 0, 0 ), iCompressionType( ENoBitmapCompression ),
+        iSizeInBytes( 0 ), iDisplayMode( 0 ), iBitsPerPixel( 0 ), iFlags( TMemSpyEngineFBServBitmapInfo::EFlagsNone )
+        {}
+
+public: // Enumerations
+    enum TFlags
+        {
+        EFlagsNone = 0,
+        EFlagsIsRomBitmap = 1,
+        EFlagsIsMonochrome = 2,
+        EFlagsIsLarge = 4,
+        EFlagsIsCompressedInRam = 8,
+        };
+
+public: // Data members
+    TInt iHandle;
+    TSize iSizeInPixels;
+    TBitmapfileCompression iCompressionType;
+    TInt iSizeInBytes;
+    TInt8 iDisplayMode;
+    TInt8 iBitsPerPixel;
+    TUint16 iFlags;
+    TInt iColor;
+    };
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperFileSystem.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,306 @@
+/*
+* 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 MEMSPYENGINEHELPERFILESYSTEM_H
+#define MEMSPYENGINEHELPERFILESYSTEM_H
+
+// System includes
+#include <e32base.h>
+#include <f32file.h>
+#include <badesca.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyEngineChunkList;
+class CMemSpyEngineChunkEntry;
+class CMemSpyEngineOutputList;
+class CMemSpyEngineDriveEntry;
+class CMemSpyEngineDriveList;
+class CMemSpyEngineOpenFileList;
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperFileSystem ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperFileSystem* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperFileSystem();
+
+private:
+    CMemSpyEngineHelperFileSystem( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C CMemSpyEngineDriveList* DriveListL();
+    IMPORT_C static TDriveNumber GetSystemDrive();
+    IMPORT_C void ListOpenFilesL();
+    IMPORT_C void ListOpenFilesL( const TThreadId& aThreadId );
+    inline CMemSpyEngine& Engine() const { return iEngine; }
+
+public: // API - But not exported
+    CMemSpyEngineOpenFileList* ListOpenFilesLC();
+    TProcessId FileServerProcessId() const;
+    const CMemSpyEngineChunkEntry* IdentifyCacheChunk( const CMemSpyEngineChunkList& aList, TInt& aIndex ) const;
+    static void GetDriveNumberText( TDriveNumber aDriveNumber, TDes& aText );
+
+private: // Internal methods
+    void ListOpenFilesL( const CFileList& aList, const TThreadId& aThreadId );
+
+private:
+    CMemSpyEngine& iEngine;
+    TProcessId iFileServerProcessId;
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineOpenFileListEntry ) : public CBase
+    {
+public:
+    static CMemSpyEngineOpenFileListEntry* NewLC( const TEntry& aEntry );
+    ~CMemSpyEngineOpenFileListEntry();
+
+private:
+    CMemSpyEngineOpenFileListEntry();
+    void ConstructL( const TEntry& aEntry );
+
+public:
+    IMPORT_C const TDesC& FileName() const;
+    IMPORT_C TInt Size() const;
+
+public: // But not exported
+    TInt UniqueFileId() const;
+    void SetUniqueFileId( TInt aValue );
+
+private: // Member data
+	TUint iAtt;
+    TInt iSize;
+	TTime iModified;
+	TUidType iType;
+    HBufC* iFileName;
+
+    // When enumerating the list of entries associated with a thread, some threads open
+    // the same file multiple times. To avoid duplicates, we ensure that each file
+    // has a unique identifier associated with it, so that we can distinguish instances from
+    // one another.
+    TInt iUniqueFileIdentifier;
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineOpenFileListForThread ) : public CBase
+    {
+public:
+    static CMemSpyEngineOpenFileListForThread* NewLC( const TDesC& aThreadName, const TThreadId& aThreadId, const TProcessId& aProcessId, const CFileList& aList );
+    ~CMemSpyEngineOpenFileListForThread();
+
+private:
+    CMemSpyEngineOpenFileListForThread( const TThreadId& aThreadId, const TProcessId& aProcessId );
+    void ConstructL( const TDesC& aThreadName, const CFileList& aList );
+
+public:
+    void AddL( CMemSpyEngineOpenFileListEntry* aEntry );
+    CMemSpyEngineOpenFileListEntry* EntryByFileName( const TDesC& aFileName );
+
+public:
+    IMPORT_C const TDesC& ThreadName() const;
+    IMPORT_C const TThreadId& ThreadId() const;
+    IMPORT_C const TProcessId& ProcessId() const;
+    IMPORT_C TInt Count() const;
+    IMPORT_C const CMemSpyEngineOpenFileListEntry& At( TInt aIndex ) const;
+
+private: // Member data
+    TThreadId iThreadId;
+    TProcessId iProcessId;
+    HBufC* iThreadName;
+    RPointerArray< CMemSpyEngineOpenFileListEntry > iItems;
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineOpenFileList ) : public CBase
+    {
+public:
+    static CMemSpyEngineOpenFileList* NewLC( CMemSpyEngine& aEngine );
+    IMPORT_C ~CMemSpyEngineOpenFileList();
+
+private:
+    CMemSpyEngineOpenFileList();
+    void ConstructL( CMemSpyEngine& aEngine );
+
+public: // API
+    IMPORT_C TInt Count() const;
+    IMPORT_C const CMemSpyEngineOpenFileListForThread& At( TInt aIndex ) const;
+
+private: // Data members
+    RPointerArray< CMemSpyEngineOpenFileListForThread > iItems;
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+class MMemSpyEngineDriveListObserver
+    {
+public: // From MMemSpyEngineDriveListObserver
+    virtual void HandleDriveListChangedL( const CMemSpyEngineDriveList& aList ) = 0;
+    };
+
+
+NONSHARABLE_CLASS( CMemSpyEngineDriveList ) : public CActive, public MDesCArray
+    {
+public:
+    static CMemSpyEngineDriveList* NewLC( RFs& aFsSession );
+    IMPORT_C ~CMemSpyEngineDriveList();
+
+private:
+    CMemSpyEngineDriveList( RFs& aFsSession );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void SetObserver( MMemSpyEngineDriveListObserver* aObserver );
+    IMPORT_C TInt Count() const;
+    IMPORT_C CMemSpyEngineDriveEntry& At( TInt aIndex );
+    IMPORT_C const CMemSpyEngineDriveEntry& At( TInt aIndex ) const;
+    IMPORT_C TInt ItemIndex( const CMemSpyEngineDriveEntry& aEntry ) const;
+    IMPORT_C CMemSpyEngineDriveEntry* EntryByDriveNumber( TDriveNumber aDrive );
+
+public: // But not exported
+    RFs& FsSession();
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // From CActive
+    void RunL();
+    void DoCancel();
+
+private: // Internal methods
+    void NotifyListChangedL();
+
+private: // Data members
+    RFs& iFsSession;
+    RPointerArray< CMemSpyEngineDriveEntry > iItems;
+    MMemSpyEngineDriveListObserver* iObserver;
+    };
+
+
+
+
+
+
+
+
+
+
+
+class MMemSpyEngineDriveEntryObserver
+    {
+public: // From MMemSpyEngineDriveEntryObserver
+    virtual void HandleDriveEntryChangedL( const CMemSpyEngineDriveEntry& aEntry ) = 0;
+    };
+
+
+class CMemSpyEngineDriveEntry : public CActive, public MDesCArray
+    {
+public:
+    static CMemSpyEngineDriveEntry* NewLC( CMemSpyEngineDriveList& aList, TDriveNumber aDriveNumber );
+    IMPORT_C ~CMemSpyEngineDriveEntry();
+
+private:
+    CMemSpyEngineDriveEntry( CMemSpyEngineDriveList& aList, TDriveNumber aDriveNumber );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void SetObserver( MMemSpyEngineDriveEntryObserver* aObserver );
+    inline const TDesC& Caption() const { return *iCaption; }
+    inline TDriveNumber DriveNumber() const { return iDriveNumber; }
+    inline const TDriveUnit& DriveUnit() const { return iDriveUnit; }
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // Internal methods
+    void RefreshL();
+    void CreateDriveAttributesL( TDes& aItemBuf );
+    void CreateMediaAttributesL( TDes& aItemBuf );
+    void AddStandardFieldsL();
+    void CreateCaptionL( const TDesC& aVolumeName, const TDesC& aMediaType );
+    static void GetMediaTypeText( TMediaType aType, TDes& aText );
+    static void GetBatteryState( TBatteryState aBatteryState, TDes& aText );
+    static TDriveNumber GetSystemDrive();
+    RFs& FsSession();
+
+private: // From CActive
+    void RunL();
+    void DoCancel();
+
+private: // Member data
+    CMemSpyEngineDriveList& iList;
+    const TDriveNumber iDriveNumber;
+    const TDriveUnit iDriveUnit;
+    TMediaSerialNumber iSerialNumber;
+    TVolumeInfo iVolumeInfo;
+    TDriveInfo iDriveInfo;
+    HBufC* iCaption;
+    CMemSpyEngineOutputList* iItems;
+    MMemSpyEngineDriveEntryObserver* iObserver;
+    };
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperHeap.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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 MEMSPYENGINEHELPERHEAP_H
+#define MEMSPYENGINEHELPERHEAP_H
+
+// System includes
+#include <e32base.h>
+#include <s32strm.h>
+#include <bamdesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// MemSpyClient includes
+#include <memspy/engine/memspyheapdata.h>
+
+// Classes referenced
+class CMemSpyThread;
+class CMemSpyEngine;
+class CMemSpyProcess;
+class CMemSpyEngineOutputList;
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperHeap ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperHeap* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperHeap();
+
+private:
+    CMemSpyEngineHelperHeap( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API - User Heap 
+    IMPORT_C void GetHeapInfoUserL( const TProcessId& aProcess, const TThreadId& aThread, TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverCell>* aCells = NULL );
+	IMPORT_C void GetHeapInfoUserL(const TProcessId& aProcess, const TThreadId& aThread, TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverCell>* aCells, TBool aCollectAllocatedCellsAsWellAsFree);
+    IMPORT_C void GetHeapInfoUserL( const CMemSpyProcess& aProcess, RArray<TMemSpyHeapInfo >& aInfos );
+    IMPORT_C void OutputHeapInfoUserL( const CMemSpyThread& aThread );
+    IMPORT_C void OutputHeapDataUserL( const CMemSpyThread& aThread );
+    IMPORT_C void OutputHeapDataUserL( const TProcessId& aPid, const TThreadId& aTid, const TDesC& aThreadName, const TMemSpyHeapInfo& aInfo, const RArray<TMemSpyDriverFreeCell>* aFreeCells = NULL );
+    IMPORT_C void OutputCellListingUserL( const CMemSpyThread& aThread );
+
+public: // API - Kernel Heap
+    IMPORT_C void GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>* aFreeCells = NULL );
+    IMPORT_C void OutputHeapInfoKernelL();
+    IMPORT_C void OutputHeapDataKernelL();
+
+public: // API - Common
+    IMPORT_C void OutputHeapInfoL( const TMemSpyHeapInfo& aInfo, const TDesC& aThreadName, const RArray<TMemSpyDriverCell>* aCells = NULL );
+    IMPORT_C void OutputHeapInfoForDeviceL( TBool aIncludeKernel = ETrue );
+    IMPORT_C CMemSpyEngineOutputList* NewHeapSummaryShortLC( const TMemSpyHeapInfo& aInfo );
+    IMPORT_C CMemSpyEngineOutputList* NewHeapSummaryExtendedLC( const TMemSpyHeapInfo& aInfo, const RArray<TMemSpyDriverCell>* aCells = NULL );
+    //cigasto    
+    IMPORT_C TMemSpyHeapData NewHeapRawInfo( const TMemSpyHeapInfo& aInfo ); //not formatted heap info
+
+public: // But not exported
+    void OutputHeapDataKernelL( TBool aCreateDataStream );
+    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 );
+
+private:
+    static TUint DescriptorAsDWORD( const TDesC8& aItem );
+    void AppendMetaDataL( const TMemSpyHeapInfo& aInfo, CMemSpyEngineOutputList& aList );
+    void AppendStatisticsL( const TMemSpyHeapInfo& aInfo, CMemSpyEngineOutputList& aList );
+	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 );
+
+private:
+    CMemSpyEngine& iEngine;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperKernelContainers.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* 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 MEMSPYENGINEHELPERKERNELCONTAINERS_H
+#define MEMSPYENGINEHELPERKERNELCONTAINERS_H
+
+// System includes
+#include <e32base.h>
+#include <u32std.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include <memspy/engine/memspyengineobject.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyEngineOutputSink;
+class CMemSpyEngineGenericKernelObjectList;
+class CMemSpyEngineGenericKernelObjectContainer;
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperKernelContainers ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperKernelContainers* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperKernelContainers();
+
+private:
+    CMemSpyEngineHelperKernelContainers( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C CMemSpyEngineGenericKernelObjectList* ObjectsForSpecificContainerL( TMemSpyDriverContainerType aForContainer );
+    IMPORT_C CMemSpyEngineGenericKernelObjectContainer* ObjectsAllL();
+    IMPORT_C void OutputL( const CMemSpyEngineGenericKernelObjectContainer& aContainer ) const;
+
+public: // But not exported
+    CMemSpyEngine& Engine() const;
+    CMemSpyEngineGenericKernelObjectContainer* ObjectsAllLightweightL();
+    static TMemSpyDriverContainerType MapToType( TObjectType aType ); 
+
+private: // Internal methods
+    void AddObjectsFromContainerL( CMemSpyEngineGenericKernelObjectList& aList, TMemSpyDriverContainerType aContainer, TBool aGetInfo = ETrue );
+
+private:
+    CMemSpyEngine& iEngine;
+    };
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineGenericKernelObjectList ) : public CBase
+    {
+public:
+    static CMemSpyEngineGenericKernelObjectList* NewLC( TMemSpyDriverContainerType aType, CMemSpyEngine& aEngine );
+    IMPORT_C ~CMemSpyEngineGenericKernelObjectList();
+
+private:
+    CMemSpyEngineGenericKernelObjectList( TMemSpyDriverContainerType aType );
+    void ConstructL( CMemSpyEngine& aEngine );
+
+public: // API
+    IMPORT_C TInt Count() const;
+    IMPORT_C const TMemSpyDriverHandleInfoGeneric& At( TInt aIndex ) const;
+    IMPORT_C TMemSpyDriverContainerType Type() const;
+    IMPORT_C static TPtrC TypeAsString( TMemSpyDriverContainerType aType );
+    IMPORT_C TPtrC Name() const;
+    IMPORT_C void OutputL( CMemSpyEngineOutputSink& aSink ) const;
+    IMPORT_C TInt Size() const;
+    IMPORT_C TInt ItemsCount() const;
+
+public: // But not exported
+    TAny* HandleAt( TInt aIndex ) const;
+    void AddItemL( TAny* aHandle );
+    void AddItemL( const TMemSpyDriverHandleInfoGeneric& aItem );
+
+private: // Internal methods
+    void UpdateNameL();
+
+private: // Data members
+    TMemSpyDriverContainerType iType;
+    RArray<TMemSpyDriverHandleInfoGeneric> iItems;
+    RPointerArray<TAny> iHandles;
+    HBufC* iName;
+    TInt iSize;
+    };
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineGenericKernelObjectContainer ) : public CBase, public MDesCArray
+    {
+public:
+    static CMemSpyEngineGenericKernelObjectContainer* NewLC();
+    IMPORT_C ~CMemSpyEngineGenericKernelObjectContainer();
+
+private:
+    CMemSpyEngineGenericKernelObjectContainer();
+    void ConstructL();
+
+public: // API
+    IMPORT_C TInt Count() const;
+    IMPORT_C const CMemSpyEngineGenericKernelObjectList& At( TInt aIndex ) const;
+    IMPORT_C void OutputL( CMemSpyEngineOutputSink& aSink ) const;
+
+public: // But not exported
+    void AddListL( CMemSpyEngineGenericKernelObjectList* aList );
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // Data members
+    RPointerArray<CMemSpyEngineGenericKernelObjectList> iItems;
+    };
+
+
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperProcess.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* 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 MEMSPYENGINEHELPERPROCESS_H
+#define MEMSPYENGINEHELPERPROCESS_H
+
+// System includes
+#include <e32base.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include <memspy/engine/memspyenginemidwife.h>
+#include <memspy/engine/memspyengineundertaker.h>
+
+// Classes referenced
+class CMemSpyProcess;
+class CMemSpyEngine;
+class CMemSpyEngineProcessMemoryTracker;
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperProcess ) : public CBase, public MMemSpyEngineMidwifeObserver, MMemSpyEngineUndertakerObserver
+    {
+public:
+    static CMemSpyEngineHelperProcess* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperProcess();
+
+private:
+    CMemSpyEngineHelperProcess( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void ImpersonateL( TUint32 aSID = 0 );
+    IMPORT_C void OutputProcessInfoL( const CMemSpyProcess& aProcess );
+    IMPORT_C void OutputProcessInfoDetailedL( const CMemSpyProcess& aProcess );
+    IMPORT_C void SetMemoryTrackingAutoStartProcessListL( const RArray<TUid>& aProcessUids );
+    inline const RArray<TUid>& MemoryTrackingAutoStartProcessList() const { return iMemoryTrackerAutoStartProcessList; }
+    CMemSpyEngineProcessMemoryTracker* TrackerOrNull( const TProcessId& aId );
+    CMemSpyEngineProcessMemoryTracker& TrackerL( const TProcessId& aId );
+    CMemSpyEngineProcessMemoryTracker& TrackerL( const CMemSpyProcess& aProcess );
+
+private: // From MMemSpyEngineMidwifeObserver
+	void ThreadIsBornL( const TThreadId& aId, const RThread& aThread );
+	void ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess );
+
+private: // From MMemSpyEngineUndertakerObserver
+	void ThreadIsDeadL( const TThreadId& aId, const RThread& aThread );
+	void ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess );
+
+private: // Internal methods
+    void OutputProcessInfoL( const CMemSpyProcess& aProcess, TBool aDetailed );
+    TBool IsAutoStartupProcess( TUid aUid ) const;
+
+private:
+    CMemSpyEngine& iEngine;
+    CMemSpyEngineUndertaker* iUndertaker;
+    RArray<TUid> iMemoryTrackerAutoStartProcessList;
+    RPointerArray<CMemSpyEngineProcessMemoryTracker> iMemoryTrackers;
+    };
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperRAM.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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 MEMSPYENGINEHELPERRAM_H
+#define MEMSPYENGINEHELPERRAM_H
+
+// System includes
+#include <e32base.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyEngineOutputList;
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperRAM ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperRAM* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperRAM();
+
+private:
+    CMemSpyEngineHelperRAM( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C TBool IsAknIconCacheConfigurable() const;
+
+    /** Returns RAM change value */
+    IMPORT_C TInt64 SetAknIconCacheStatusL( TBool aEnabled );
+
+private: // Internal methods
+    void CheckIfAknIconCacheCanBeConfiguredL();
+    TInt SetAknIconStatus( TBool aEnabled );
+
+private:
+    CMemSpyEngine& iEngine;
+    TBool iIsAknIconCacheConfigurable;
+    };
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperROM.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 MEMSPYENGINEHELPERROM_H
+#define MEMSPYENGINEHELPERROM_H
+
+// System includes
+#include <e32base.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyEngineOutputList;
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperROM ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperROM* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperROM();
+
+private:
+    CMemSpyEngineHelperROM( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void AddInfoL( CMemSpyEngineOutputList& aList );
+
+private:
+    CMemSpyEngine& iEngine;
+    HBufC* iPlatformVersion;
+    HBufC* iChecksum;
+    };
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperServer.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* 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 MEMSPYENGINEHELPERSERVER_H
+#define MEMSPYENGINEHELPERSERVER_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include <memspy/engine/memspyengineobject.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyEngineServerList;
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperServer ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperServer* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperServer();
+
+private:
+    CMemSpyEngineHelperServer( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C CMemSpyEngineServerList* ServerListL();
+    IMPORT_C void GetServerSessionsL( TAny* aServerHandle, RArray<TMemSpyDriverServerSessionInfo>& aSessions );
+    IMPORT_C void GetServerSessionsL( const TMemSpyDriverHandleInfoGeneric& aServerDetails, RArray<TMemSpyDriverServerSessionInfo>& aSessions );
+    IMPORT_C void GetServerListL( RArray<TMemSpyDriverHandleInfoGeneric>& aServers );
+
+public: // But not exported
+    CMemSpyEngine& Engine() const;
+
+private:
+    CMemSpyEngine& iEngine;
+    };
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineServerEntry ) : public CBase
+    {
+public:
+    static CMemSpyEngineServerEntry* NewLC( const TMemSpyDriverHandleInfoGeneric& aInfo );
+    IMPORT_C ~CMemSpyEngineServerEntry();
+
+private:
+    CMemSpyEngineServerEntry();
+    void ConstructL( const TMemSpyDriverHandleInfoGeneric& aInfo );
+
+public:
+    inline const TDesC& Caption() const { return *iCaption; }
+    inline const TDesC& Name() const { return *iName; }
+    inline const TInt SessionCount() const { return iSessionCount; }
+    inline TInt Id() const { return iId; }
+    inline TAny* Handle() const { return iHandle; }
+    IMPORT_C void OutputDataL( CMemSpyEngineHelperServer& aHelper, TBool aClientThreadColumns ) const;
+    IMPORT_C void GetSessionsL( CMemSpyEngineHelperServer& aHelper, RArray<TMemSpyDriverServerSessionInfo>& aSessions ) const;
+
+private: // Member data
+    HBufC* iCaption;
+    HBufC* iName;
+    TInt iSessionCount;
+    TInt iId;
+    TAny* iHandle;
+    };
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineServerList ) : public CBase, public MDesCArray
+    {
+public:
+    static CMemSpyEngineServerList* NewLC();
+    IMPORT_C ~CMemSpyEngineServerList();
+
+private:
+    CMemSpyEngineServerList();
+    void ConstructL();
+
+public: // API
+    IMPORT_C TInt Count() const;
+    IMPORT_C const CMemSpyEngineServerEntry& At( TInt aIndex ) const;
+    IMPORT_C void SortByNameL();
+    IMPORT_C void SortBySessionCountL();
+    IMPORT_C TInt ItemIndex( const CMemSpyEngineServerEntry& aEntry ) const;
+    IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine, TBool aClientThreadColumns = EFalse );
+
+public: // But not exported
+    void AddItemL( CMemSpyEngineServerEntry* aItem );
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // Internal methods
+    static TInt CompareByName( const CMemSpyEngineServerEntry& aLeft, const CMemSpyEngineServerEntry& aRight );
+    static TInt CompareBySessionCount( const CMemSpyEngineServerEntry& aLeft, const CMemSpyEngineServerEntry& aRight );
+
+private: // Data members
+    RPointerArray<CMemSpyEngineServerEntry> iItems;
+    };
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperStack.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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 MEMSPYENGINEHELPERSTACK_H
+#define MEMSPYENGINEHELPERSTACK_H
+
+// System includes
+#include <e32base.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// Classes referenced
+class CMemSpyThread;
+class CMemSpyEngine;
+class CMemSpyProcess;
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperStack ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperStack* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperStack();
+
+private:
+    CMemSpyEngineHelperStack( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void OutputStackInfoL( const CMemSpyThread& aThread );
+    IMPORT_C void OutputStackInfoL( TProcessId aPid, TThreadId aTid, TDes& aLineBuffer );
+    //
+    IMPORT_C void OutputStackDataL( const CMemSpyThread& aThread, TMemSpyDriverDomainType aType );
+    IMPORT_C void OutputStackDataL( const CMemSpyThread& aThread, TMemSpyDriverDomainType aType, TBool aEntireStack );
+    //
+    IMPORT_C void OutputStackInfoForDeviceL();
+    IMPORT_C TInt CalculateStackSizes( const CMemSpyProcess& aProcess );
+
+private:
+    TInt CalculateStackSizesL( const CMemSpyProcess& aProcess );
+
+private:
+    CMemSpyEngine& iEngine;
+    };
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperThread.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 MEMSPYENGINEHELPERTHREAD_H
+#define MEMSPYENGINEHELPERTHREAD_H
+
+// System includes
+#include <e32base.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include <memspy/engine/memspyengineobject.h>
+
+// Classes referenced
+class CMemSpyThread;
+class CMemSpyEngine;
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperThread ) : public CBase
+    {
+public:
+    static CMemSpyEngineHelperThread* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperThread();
+
+private:
+    CMemSpyEngineHelperThread( CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API
+    IMPORT_C void OutputThreadInfoL( const CMemSpyThread& aThread, TBool aDetailed );
+
+private:
+    CMemSpyEngine& iEngine;
+    };
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperWindowServer.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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 MEMSPYENGINEHELPERWINDOWSERVER_H
+#define MEMSPYENGINEHELPERWINDOWSERVER_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Classes referenced
+
+
+/** 
+ * WindowGroup basic info
+ */
+class TMemSpyEngineWindowGroupBasicInfo
+    {
+public:
+    TInt iId;
+    TFullName iFullName;
+    TThreadId iThreadId;
+    TInt iOrdinalPosition;
+    };
+
+
+/** 
+ * WindowGroup details
+ */
+class TMemSpyEngineWindowGroupDetails : public TMemSpyEngineWindowGroupBasicInfo
+    {
+public:
+    TInt iPriority;
+    TInt iWindowGroupHandle;
+    TFullName iName;
+    TUid iUID;
+    TBool iIsBusy;
+    TBool iIsSystem;
+    TBool iIsHidden;
+    TFullName iCaption;
+    TFullName iDocName;
+    TBool iIsFocused;
+    };
+
+
+
+class MMemSpyEngineWindowGroupList : public MDesCArray
+    {
+public:
+    virtual ~MMemSpyEngineWindowGroupList() {};
+
+public: // API
+    virtual TInt Count() const = 0;
+    virtual const TMemSpyEngineWindowGroupBasicInfo& At( TInt aIndex ) const = 0;
+    virtual TInt ItemIndex( const TMemSpyEngineWindowGroupBasicInfo& aEntry ) const = 0;
+
+public: // But not exported
+    virtual void AddItemL( TMemSpyEngineWindowGroupBasicInfo& aItem ) = 0;
+
+public: // From MDesCArray
+    virtual TInt MdcaCount() const = 0;
+    virtual TPtrC MdcaPoint( TInt aIndex ) const = 0;
+    };
+
+
+
+
+class MMemSpyEngineHelperWindowServer
+    {
+public:
+    virtual ~MMemSpyEngineHelperWindowServer(){};
+
+public: // API
+    virtual MMemSpyEngineWindowGroupList* WindowGroupListL() = 0;
+    virtual void GetWindowGroupListL( RArray<TMemSpyEngineWindowGroupBasicInfo>& aWindowGroups ) = 0;
+    virtual void GetWindowGroupDetailsL( TInt aWindowGroupId, TMemSpyEngineWindowGroupDetails& aWindowGroupDetails ) = 0;
+    virtual void SwitchToL( TInt aWindowGroupId ) = 0;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Logger/MemSpyEngineLogger.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* 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 MEMSPYENGINELOGGER_H
+#define MEMSPYENGINELOGGER_H
+
+// System includes
+#include <e32base.h>
+#include <f32file.h>
+#include <badesca.h>
+
+#ifdef _DEBUG
+#   define TRACE( x ) x
+#else
+#   define TRACE( x )
+#endif
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngine.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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 MEMSPYENGINE_H
+#define MEMSPYENGINE_H
+
+// System includes
+#include <e32base.h>
+#include <memspy/engine/memspyengineoutputsinktype.h>
+#include <memspy/engine/memspyenginelogger.h>
+#include <memspy/engine/memspyenginehelperwindowserver.h>
+
+// Classes referenced
+class RFs;
+class RMemSpyDriverClient;
+class MMemSpyEngineObserver;
+class CMemSpyProcess;
+class CMemSpyThread;
+class CMemSpyEngineImp;
+class CMemSpyEngineOutputSink;
+class CMemSpyEngineServer;
+class CMemSpyEngineMidwife;
+class CMemSpyEngineUndertaker;
+class CMemSpyEngineChunkWatcher;
+class CMemSpyEngineChunkWatcher;
+class CMemSpyEngineObjectContainer;
+class CMemSpyEngineHelperHeap;
+class CMemSpyEngineHelperStack;
+class CMemSpyEngineHelperCodeSegment;
+class CMemSpyEngineHelperChunk;
+class CMemSpyEngineHelperThread;
+class CMemSpyEngineHelperProcess;
+class CMemSpyEngineHelperServer;
+class CMemSpyEngineHelperActiveObject;
+class CMemSpyEngineHelperKernelContainers;
+class CMemSpyEngineHelperFileSystem;
+class CMemSpyEngineHelperECom;
+class CMemSpyEngineHelperFbServ;
+class CMemSpyEngineHelperSysMemTracker;
+class CMemSpyEngineHelperROM;
+class CMemSpyEngineHelperRAM;
+class CMemSpyEngineHelperCondVar;
+
+
+NONSHARABLE_CLASS( CMemSpyEngine ) : public CBase
+    {
+public:
+    IMPORT_C static CMemSpyEngine* NewL( RFs& aFsSession );
+    IMPORT_C static CMemSpyEngine* NewL( RFs& aFsSession, TBool aStartServer );
+    IMPORT_C ~CMemSpyEngine();
+
+private:
+    CMemSpyEngine();
+    void ConstructL( RFs& aFsSession );
+
+public: // API
+    IMPORT_C RFs& FsSession();
+    IMPORT_C CMemSpyEngineObjectContainer& Container();
+    IMPORT_C const CMemSpyEngineObjectContainer& Container() const;
+    IMPORT_C void SetObserver( MMemSpyEngineObserver* aObserver );
+
+public:
+    void NotifyContainerChangeL();
+    void NotifyClientServerOperationRequestL( TInt aType );
+
+public: // Sink related
+    IMPORT_C CMemSpyEngineOutputSink& Sink();
+    IMPORT_C TMemSpySinkType SinkType();
+    IMPORT_C void InstallSinkL( TMemSpySinkType aType );
+    IMPORT_C void InstallDebugSinkL();
+    IMPORT_C void InstallFileSinkL( const TDesC& aRootFolder );
+
+public: // Misc
+    IMPORT_C void ListOpenFilesL();
+    IMPORT_C void GetVersion( TVersion& aVersion );
+    IMPORT_C TBool IsHelperWindowServerSupported();
+
+public: 
+    IMPORT_C CMemSpyEngineHelperHeap& HelperHeap();
+    IMPORT_C CMemSpyEngineHelperStack& HelperStack();
+    IMPORT_C CMemSpyEngineHelperCodeSegment& HelperCodeSegment();
+    IMPORT_C CMemSpyEngineHelperChunk& HelperChunk();
+    IMPORT_C CMemSpyEngineHelperThread& HelperThread();
+    IMPORT_C CMemSpyEngineHelperProcess& HelperProcess();
+    IMPORT_C CMemSpyEngineHelperServer& HelperServer();
+    IMPORT_C CMemSpyEngineHelperActiveObject& HelperActiveObject();
+    IMPORT_C CMemSpyEngineHelperKernelContainers& HelperKernelContainers();
+    IMPORT_C CMemSpyEngineHelperFileSystem& HelperFileSystem();
+    IMPORT_C CMemSpyEngineHelperECom& HelperECom();
+    IMPORT_C CMemSpyEngineHelperSysMemTracker& HelperSysMemTracker();
+    IMPORT_C CMemSpyEngineHelperFbServ& HelperFbServ();
+    IMPORT_C CMemSpyEngineHelperROM& HelperROM();
+    IMPORT_C CMemSpyEngineHelperRAM& HelperRAM();
+    IMPORT_C MMemSpyEngineHelperWindowServer& HelperWindowServer();
+    IMPORT_C CMemSpyEngineHelperCondVar& HelperCondVar();
+
+public: // Driver
+    RMemSpyDriverClient& Driver();
+
+public: // Event handlers
+    CMemSpyEngineMidwife& Midwife();
+    CMemSpyEngineUndertaker& Undertaker();
+    CMemSpyEngineChunkWatcher& ChunkWatcher();
+
+public: // Process related
+    TInt ProcessSuspendAndGetErrorLC( TProcessId aId );
+    void ProcessSuspendLC( TProcessId aId );
+    void ProcessResume();
+    TProcessId SuspendedProcessId() const;
+
+private: // Data members
+    CMemSpyEngineImp* iImp;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineImp.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* 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 MEMSPYENGINEIMP_H
+#define MEMSPYENGINEIMP_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// User includes
+#include <memspy/engine/memspyenginemidwife.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineundertaker.h>
+#include <memspy/engine/memspyenginehelperwindowserver.h>
+
+// Classes referenced
+class RFs;
+class CMemSpyProcess;
+class CMemSpyThread;
+class RMemSpyDriverClient;
+class CMemSpyEngineServer;
+class MMemSpyEngineObserver;
+class CMemSpyEngineChunkWatcher;
+class CMemSpyEngineObjectContainer;
+class CMemSpyEngineHelperHeap;
+class CMemSpyEngineHelperStack;
+class CMemSpyEngineHelperCodeSegment;
+class CMemSpyEngineHelperChunk;
+class CMemSpyEngineHelperThread;
+class CMemSpyEngineHelperProcess;
+class CMemSpyEngineHelperServer;
+class CMemSpyEngineHelperActiveObject;
+class CMemSpyEngineHelperKernelContainers;
+class CMemSpyEngineHelperFileSystem;
+class CMemSpyEngineHelperECom;
+class CMemSpyEngineHelperFbServ;
+class CMemSpyEngineHelperSysMemTracker;
+class CMemSpyEngineHelperROM;
+class CMemSpyEngineHelperRAM;
+class CMemSpyEngineHelperCondVar;
+
+
+NONSHARABLE_CLASS( CMemSpyEngineImp ) : public CBase, public MMemSpyEngineUndertakerObserver, 
+                                                   public MMemSpyEngineMidwifeObserver
+    {
+public:
+    CMemSpyEngineImp( RFs& aFsSession, CMemSpyEngine& aEngine );
+    ~CMemSpyEngineImp();
+    void ConstructL();
+
+private: // Construction support
+    void ConstructHelpersL();
+
+public: // API
+    RFs& FsSession();
+    CMemSpyEngineObjectContainer& Container();
+    const CMemSpyEngineObjectContainer& Container() const;
+    void SetObserver( MMemSpyEngineObserver* aObserver );
+
+public:
+    void NotifyContainerChangeL();
+    void NotifyClientServerOperationRequestL( TInt aType );
+
+public: // Sink related
+    CMemSpyEngineOutputSink& Sink();
+    TMemSpySinkType SinkType();
+    void InstallSinkL( TMemSpySinkType aType );
+    void InstallSinkL( TMemSpySinkType aType, const TDesC& aRootFolder );
+
+public: // Misc
+    void ListOpenFilesL();
+    void GetVersion( TVersion& aVersion );
+    TBool IsHelperWindowServerSupported();
+
+public: 
+    CMemSpyEngineHelperHeap& HelperHeap();
+    CMemSpyEngineHelperStack& HelperStack();
+    CMemSpyEngineHelperCodeSegment& HelperCodeSegment();
+    CMemSpyEngineHelperChunk& HelperChunk();
+    CMemSpyEngineHelperThread& HelperThread();
+    CMemSpyEngineHelperProcess& HelperProcess();
+    CMemSpyEngineHelperServer& HelperServer();
+    CMemSpyEngineHelperActiveObject& HelperActiveObject();
+    CMemSpyEngineHelperKernelContainers& HelperKernelContainers();
+    CMemSpyEngineHelperFileSystem& HelperFileSystem();
+    CMemSpyEngineHelperECom& HelperECom();
+    CMemSpyEngineHelperSysMemTracker& HelperSysMemTracker();
+    CMemSpyEngineHelperFbServ& HelperFbServ();
+    CMemSpyEngineHelperROM& HelperROM();
+    CMemSpyEngineHelperRAM& HelperRAM();
+    MMemSpyEngineHelperWindowServer& HelperWindowServer();
+    CMemSpyEngineHelperCondVar& HelperCondVar();
+
+public: // Driver
+    RMemSpyDriverClient& Driver();
+
+public: // Event handlers
+    CMemSpyEngineMidwife& Midwife();
+    CMemSpyEngineUndertaker& Undertaker();
+    CMemSpyEngineChunkWatcher& ChunkWatcher();
+
+public: // Process related
+    TInt ProcessSuspendAndGetErrorLC( TProcessId aId );
+    void ProcessSuspendLC( TProcessId aId );
+    void ProcessResume();
+    TProcessId SuspendedProcessId() const;
+
+private: // From MMemSpyEngineUndertakerObserver
+	void ThreadIsDeadL( const TThreadId& aId, const RThread& aThread );
+	void ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess );
+
+private: // From MMemSpyEngineMidwifeObserver
+	void ThreadIsBornL( const TThreadId& aId, const RThread& aThread );
+	void ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess );
+
+private: // Internal methods
+    static void ResumeSuspendedProcess( TAny* aSelf );
+
+private: // Data members
+    RFs& iFsSession;
+    CMemSpyEngine& iEngine;
+    CMemSpyEngineObjectContainer* iContainer;
+    RMemSpyDriverClient* iMemSpyDriver;
+    MMemSpyEngineObserver* iObserver;
+    CMemSpyEngineUndertaker* iUndertaker;
+    CMemSpyEngineMidwife* iMidwife;
+    CMemSpyEngineChunkWatcher* iChunkWatcher;
+    //
+    CMemSpyEngineHelperHeap* iHelperHeap;
+    CMemSpyEngineHelperStack* iHelperStack;
+    CMemSpyEngineHelperCodeSegment* iHelperCodeSegment;
+    CMemSpyEngineHelperChunk* iHelperChunk;
+    CMemSpyEngineHelperThread* iHelperThread;
+    CMemSpyEngineHelperProcess* iHelperProcess;
+    CMemSpyEngineHelperServer* iHelperServer;
+    CMemSpyEngineHelperActiveObject* iHelperActiveObject;
+    CMemSpyEngineHelperKernelContainers* iHelperKernelContainers;
+    CMemSpyEngineHelperFileSystem* iHelperFileSystem;
+    CMemSpyEngineHelperECom* iHelperECom;
+    CMemSpyEngineHelperSysMemTracker* iHelperSysMemTracker;
+    CMemSpyEngineHelperFbServ* iHelperFbServ;
+    CMemSpyEngineHelperROM* iHelperROM;
+    CMemSpyEngineHelperRAM* iHelperRAM;
+    MMemSpyEngineHelperWindowServer* iHelperWindowServer;
+    CMemSpyEngineHelperCondVar* iHelperCondVar;
+    //
+    CMemSpyEngineServer* iServer;
+    //
+    CMemSpyEngineOutputSink* iSink;
+    TUint iSuspendedProcess;
+    RPointerArray<CMemSpyEngineObjectContainer> iContainers;
+    RLibrary iHelperWindowServerLoader;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineObserver.h	Mon Sep 06 15:00:47 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 MEMSPYENGINEOBSERVER_H
+#define MEMSPYENGINEOBSERVER_H
+
+// System includes
+#include <e32base.h>
+
+
+
+class MMemSpyEngineObserver
+    {
+public: // Enumerations
+    enum TEvent
+        {
+        EHandleThreadsOrProcessesChanged,
+        EHandleClientServerOperationRequest
+        };
+
+public: // From MMemSpyEngineObserver
+    virtual void HandleMemSpyEngineEventL( TEvent aEvent, TAny* aContext = NULL ) = 0;
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineProcessMemoryTracker.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* 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 MEMSPYENGINEPROCESSMEMORYTRACKER_H
+#define MEMSPYENGINEPROCESSMEMORYTRACKER_H
+
+// System includes
+#include <e32base.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Classes referenced
+class CMemSpyEngine;
+
+
+
+class MMemSpyEngineProcessMemoryTrackerObserver
+    {
+public: // From MMemSpyEngineProcessMemoryTrackerObserver
+    virtual void HandleMemoryTrackingStartedL() = 0;
+    virtual void HandleMemoryTrackingStoppedL() = 0;
+    virtual void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ) = 0;
+    };
+
+
+NONSHARABLE_CLASS( TMemSpyEngineProcessInspectionInfoWithPeakInfo ) : public TMemSpyDriverProcessInspectionInfo
+    {
+public:
+    inline TMemSpyEngineProcessInspectionInfoWithPeakInfo()
+        {
+        }
+
+    inline void ResetPeakFlags()
+        {
+        iPeakStack = EFalse;
+        iPeakHeap = EFalse;
+        iPeakChunkLocal = EFalse;
+        iPeakChunkShared = EFalse;
+        iPeakGlobalData = EFalse;
+        }
+
+public:
+    TBool iPeakStack;
+    TBool iPeakHeap;
+    TBool iPeakChunkLocal;
+    TBool iPeakChunkShared;
+    TBool iPeakGlobalData;
+    };
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineProcessMemoryTracker ) : public CActive
+    {
+public:
+    static CMemSpyEngineProcessMemoryTracker* NewLC( CMemSpyEngine& aEngine, const TProcessId& aProcessId );
+    ~CMemSpyEngineProcessMemoryTracker();
+
+private:
+    CMemSpyEngineProcessMemoryTracker( CMemSpyEngine& aEngine, const TProcessId& aProcessId );
+    void ConstructL();
+
+public: // API
+    IMPORT_C TBool AmTracking() const;
+    IMPORT_C void StartL();
+    IMPORT_C void Stop();
+    IMPORT_C void AddObserverL( MMemSpyEngineProcessMemoryTrackerObserver& aObserver );
+    IMPORT_C void RemoveObserver( MMemSpyEngineProcessMemoryTrackerObserver& aObserver );
+    IMPORT_C void ResetHWML();
+    //
+    inline TProcessId ProcessId() const { return iProcessId; }
+    inline const TMemSpyDriverProcessInspectionInfo& InfoCurrent() const { return iInfoCurrent; }
+    inline const TMemSpyDriverProcessInspectionInfo& InfoPeaks() const { return static_cast< const TMemSpyDriverProcessInspectionInfo& >( iInfoPeaks ); }
+    inline const TMemSpyDriverProcessInspectionInfo& InfoHWMIncShared() const { return iInfoHWMIncShared; }
+    inline const TMemSpyDriverProcessInspectionInfo& InfoHWMExcShared() const { return iInfoHWMIncShared; }
+    
+private: // From CActive
+    void RunL();
+    void DoCancel();
+
+private: // Internal methods
+    void PrintInfoL( const TMemSpyDriverProcessInspectionInfo& aInfo );
+    void UpdatePeaks( const TMemSpyDriverProcessInspectionInfo& aLatestInfo );
+    void UpdateHWMIncShared( const TMemSpyDriverProcessInspectionInfo& aLatestInfo );
+    void UpdateHWMExcShared( const TMemSpyDriverProcessInspectionInfo& aLatestInfo );
+
+private: // Data members
+    CMemSpyEngine& iEngine;
+    const TProcessId iProcessId;
+    TSecureId iSID;
+    TBool iAmTracking;
+    HBufC* iProcessName;
+    TInt iNumberOfChangesReceived;
+    RPointerArray<MMemSpyEngineProcessMemoryTrackerObserver> iObservers;
+
+    TMemSpyDriverProcessInspectionInfo iInfoCurrent;
+    TMemSpyDriverProcessInspectionInfo iInfoHWMIncShared;
+    TMemSpyDriverProcessInspectionInfo iInfoHWMExcShared;
+    TMemSpyEngineProcessInspectionInfoWithPeakInfo iInfoPeaks;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineTwiddlableItemArray.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* 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 MEMSPYENGINETWIDDLABLEITEMARRAY_H
+#define MEMSPYENGINETWIDDLABLEITEMARRAY_H
+
+// System includes
+#include <e32base.h>
+
+// Classes referenced
+class CMemSpyEngine;
+
+// Type definitions
+typedef TBool (*TMemSpyEngineGeneralVisibiltyFunction)( const TAny*&, TAny* aRune );
+
+
+
+template <class T>
+NONSHARABLE_CLASS( TMemSpyEngineVisibiltyFunction )
+	{
+public:
+    inline TMemSpyEngineVisibiltyFunction( TBool (*aFunction)( const T*&, TAny* aRune ), TAny* aRune = NULL );
+
+public: // API
+    inline operator TMemSpyEngineGeneralVisibiltyFunction() const;
+    inline TAny* Rune() const;
+
+private:
+	TMemSpyEngineGeneralVisibiltyFunction iFunction;
+    TAny* iRune;
+	};
+
+
+
+
+template <class T>
+NONSHARABLE_CLASS( CMemSpyEngineTwiddlableItemArray ) : public CBase
+    {
+public:
+    inline ~CMemSpyEngineTwiddlableItemArray();
+
+protected:
+    inline CMemSpyEngineTwiddlableItemArray( CMemSpyEngine& aEngine );
+
+public: // API
+    inline TInt Count() const;
+    inline void ShowAllL();
+    inline void HideAllL();
+    inline void ShowL( TMemSpyEngineVisibiltyFunction<T> aFunction );
+    inline void HideL( TMemSpyEngineVisibiltyFunction<T> aFunction );
+    inline void AddItemL( T* aItem );
+    inline void AddItemL( T* aItem, TMemSpyEngineVisibiltyFunction<T> aFunction );
+    //
+    inline CMemSpyEngine& Engine() const;
+    inline T& At( TInt aIndex );
+    inline const T& At( TInt aIndex ) const;
+    inline TInt ItemIndex( const T& aItem ) const;
+
+protected: // Framework methods
+    inline void Sort( TLinearOrder<T> aOrder );
+
+private: // Internal methods
+    static inline TBool ShowAllItemsVisibilityFunction( const T*& aItem, TAny* aRune );
+
+private:
+    CMemSpyEngine& iEngine;
+    RPointerArray<T> iAllEntries;
+    RPointerArray<T> iVisibleEntries;
+    };
+
+
+
+
+#include <memspy/engine/memspyenginetwiddlableitemarray.inl>
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineTwiddlableItemArray.inl	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,198 @@
+/*
+* 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 MEMSPYENGINETWIDDLABLEITEMARRAY_INL
+#define MEMSPYENGINETWIDDLABLEITEMARRAY_INL
+
+//
+// TMemSpyEngineVisibiltyFunction
+//
+template <class T>
+inline TMemSpyEngineVisibiltyFunction<T>::TMemSpyEngineVisibiltyFunction( TBool (*aFunction)(const T*&, TAny* aRune), TAny* aRune )
+:   iRune( aRune )
+	{
+    iFunction = (TMemSpyEngineGeneralVisibiltyFunction) aFunction;
+    }
+
+
+template <class T>
+inline TMemSpyEngineVisibiltyFunction<T>::operator TMemSpyEngineGeneralVisibiltyFunction() const
+	{
+    return iFunction;
+    }
+
+
+template <class T>
+inline TAny* TMemSpyEngineVisibiltyFunction<T>::Rune() const
+    {
+    return iRune;
+    }
+
+
+
+
+
+
+
+//
+// CMemSpyEngineTwiddlableItemArray
+//
+template <class T>
+inline CMemSpyEngineTwiddlableItemArray<T>::CMemSpyEngineTwiddlableItemArray( CMemSpyEngine& aEngine )
+:   iEngine( aEngine )
+    {
+    }
+
+
+template <class T>
+inline CMemSpyEngineTwiddlableItemArray<T>::~CMemSpyEngineTwiddlableItemArray()
+    {
+    iAllEntries.ResetAndDestroy();
+    iAllEntries.Close();
+
+    // Doesn't own objects - just references those in the "iAllEntries" array
+    iVisibleEntries.Close();
+    }
+
+
+template <class T>
+inline TInt CMemSpyEngineTwiddlableItemArray<T>::Count() const
+    {
+    return iVisibleEntries.Count();
+    }
+
+
+template <class T>
+inline void CMemSpyEngineTwiddlableItemArray<T>::ShowAllL()
+    {
+    TMemSpyEngineVisibiltyFunction<T> function( ShowAllItemsVisibilityFunction );
+    ShowL( function );
+    }
+
+
+template <class T>
+inline void CMemSpyEngineTwiddlableItemArray<T>::HideAllL()
+    {
+    iVisibleEntries.Reset();
+    }
+
+
+template <class T>
+inline void CMemSpyEngineTwiddlableItemArray<T>::ShowL( TMemSpyEngineVisibiltyFunction<T> aFunction )
+    {
+    iVisibleEntries.Reset();
+    //
+    const TInt count = iAllEntries.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const T* entry = iAllEntries[ i ];
+        const TAny* entryPtr = (TAny*) entry;
+        //
+        if  ( (*aFunction)( entryPtr, aFunction.Rune() ) )
+            {
+            iVisibleEntries.AppendL( entry );
+            }
+        }
+    }
+
+
+template <class T>
+inline void CMemSpyEngineTwiddlableItemArray<T>::HideL( TMemSpyEngineVisibiltyFunction<T> aFunction )
+    {
+    iVisibleEntries.Reset();
+    //
+    const TInt count = iAllEntries.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        const T* entry = iAllEntries[ i ];
+        const TAny* entryPtr = (TAny*) entry;
+        //
+        if  ( (*aFunction)( entryPtr, aFunction.Rune() ) == EFalse )
+            {
+            iVisibleEntries.AppendL( entry );
+            }
+        }
+    }
+
+
+template <class T>
+inline void CMemSpyEngineTwiddlableItemArray<T>::AddItemL( T* aItem )
+    {
+    TMemSpyEngineVisibiltyFunction<T> function( ShowAllItemsVisibilityFunction );
+    AddItemL( aItem, function );
+    }
+
+
+template <class T>
+inline void CMemSpyEngineTwiddlableItemArray<T>::AddItemL( T* aItem, TMemSpyEngineVisibiltyFunction<T> aFunction )
+    {
+    iAllEntries.AppendL( aItem );
+    //
+    const TAny* entryPtr = (TAny*) aItem;
+    if  ( (*aFunction)( entryPtr, aFunction.Rune() ) )
+        {
+        iVisibleEntries.AppendL( aItem );
+        }
+    }
+
+
+template <class T>
+inline CMemSpyEngine& CMemSpyEngineTwiddlableItemArray<T>::Engine() const
+    {
+    return iEngine;
+    }
+
+
+template <class T>
+inline T& CMemSpyEngineTwiddlableItemArray<T>::At( TInt aIndex )
+    {
+    T* entry = iVisibleEntries[ aIndex ];
+    return *entry;
+    }
+
+
+template <class T>
+inline const T& CMemSpyEngineTwiddlableItemArray<T>::At( TInt aIndex ) const
+    {
+    const T* entry = iVisibleEntries[ aIndex ];
+    return *entry;
+    }
+
+
+template <class T>
+inline TInt CMemSpyEngineTwiddlableItemArray<T>::ItemIndex( const T& aItem ) const
+    {
+    const TInt index = iVisibleEntries.Find( &aItem );
+    return index;
+    }
+
+
+template <class T>
+inline TBool CMemSpyEngineTwiddlableItemArray<T>::ShowAllItemsVisibilityFunction( const T*& /*aItem*/, TAny* /*aRune*/ )
+    {
+    return ETrue;
+    }
+
+
+template <class T>
+inline void CMemSpyEngineTwiddlableItemArray<T>::Sort( TLinearOrder<T> aOrder )
+    {
+    iVisibleEntries.Sort( aOrder );
+    }
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/MemSpyEngineUtils.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* 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 MEMSPYENGINEUTILS_H
+#define MEMSPYENGINEUTILS_H
+
+// Configuration defines
+#define __INCLUDE_CAPABILITY_NAMES__
+#define __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include <memspy/engine/memspyenginelogger.h>
+
+// Type definitions
+typedef TBuf<20> TMemSpySizeText;
+typedef TBuf<30> TMemSpyPercentText;
+typedef TBuf<60> TMemSpyTimeText;
+
+// Classes referenced
+class CMemSpyEngineSinkMetaData;
+
+// Literal constants
+_LIT( KMemSpyLogDefaultExtension, ".txt" );
+
+// Enumerations
+enum TMemSpyEnginePanic
+    {
+    EMemSpyEnginePanicInvalidContainer1 = 0,
+    EMemSpyEnginePanicInvalidContainer2 = 1,
+    EMemSpyEnginePanicSuspendRequest1 = 2,
+    EMemSpyEnginePanicSuspendRequest2 = 3,
+    EMemSpyEnginePanicProcessHandleNullWhenAttemptingToIdentifyThreads = 4,
+    EMemSpyEnginePanicEncounteredKernelUnexpectedly = 5,
+    EMemSpyEnginePanicCyclesHaveGoneCyclic = 6,
+    EMemSpyEnginePanicTrackerNull1 = 7,
+    EMemSpyEnginePanicTrackerNull2 = 8,
+    EMemSpyEnginePanicTrackerNull3 = 9,
+    EMemSpyEnginePanicTrackerNull4 = 10,
+    EMemSpyEnginePanicSinkFileEntireFileBufferNull = 11,
+    EMemSpyEnginePanicSinkFileWorkingFileBufferIsNull = 11,
+    };
+
+
+class MemSpyEngineUtils
+    {
+public:
+    IMPORT_C static void FormatTimeL( TDes& aBuf, const TInt64& aTimeVal, TBool aLocalTime = ETrue );
+    IMPORT_C static void FormatTimeL( TDes& aBuf, const TTime& aTime, TBool aLocalTime = ETrue );
+    IMPORT_C static void FormatHex( TDes& aBuf, TInt aValue );
+    IMPORT_C static TMemSpySizeText FormatSizeText( const TInt64& aValue, TInt aDecimalPlaces = 1, TBool aExtraRounding = EFalse );
+    IMPORT_C static TMemSpySizeText FormatSizeText( TInt aValue );
+    IMPORT_C static TMemSpySizeText FormatSizeTextPrecise( TInt aValue );
+    IMPORT_C static TBool IsRomAddress( TAny* aAddress );
+    IMPORT_C static void GetCapabilityName( TDes& aBuf, TCapability aCapability );
+    IMPORT_C static TBool StripText( TDes& aText, const TDesC& aStrip );
+    IMPORT_C static void TextBeforeDoubleColon( TDes& aText );
+    IMPORT_C static void TextAfterDoubleColon( TDes& aText );
+    IMPORT_C static TMemSpyPercentText FormatPercentage( TReal aOneHundredPercentValue, TReal aValue );
+    IMPORT_C static HBufC* CleanupTextLC( const TDesC& aText );
+    IMPORT_C static void GetRomInfoL( TDes& aPlatform, TDes& aChecksum );
+    IMPORT_C static void GetFolderL( RFs& aFsSession, TDes& aFolder, const CMemSpyEngineSinkMetaData& aMetaData, const TDriveNumber* aForceDrive = NULL );
+
+public: // Not exported
+    static TDriveNumber LocateSuitableDrive( RFs& aFsSession );
+    static void FormatTimeSimple( TDes& aBuf, const TTime& aTime );
+    static void FormatTimeNowL( TDes& aBuf, TBool aLocalTime = ETrue );
+    static HBufC* DataStreamFolderNameWithTimeStampLC( const TDesC& aFolderName );
+    static void GetKernelHeapThreadName( TDes& aBuf, TBool aFullName = ETrue );
+    static void GetKernelHeapThreadAndProcessNames( TDes& aThreadName, TDes& aProcessName );
+    static TUint32 Hash( const TDesC& aText );
+    static HBufC* CleanContextInfoLC( const TDesC& aContext );
+    static TProcessId IdentifyFileServerProcessIdL();
+    static TPtrC TextAfterLastDoubleColon( const TDesC& aText );
+
+public: // Panic utility
+    static void Panic( TMemSpyEnginePanic aPanic );
+    };
+
+
+
+// Utility functions & classes
+template <class T>
+class CleanupResetAndDestroy
+    {
+public:
+    inline static void PushL(T& aRef);
+
+private:
+    static void ResetAndDestroy(TAny *aPtr);
+    };
+
+template <class T>
+inline void CleanupResetAndDestroyL(T& aRef);
+
+// Template class CleanupClose
+template <class T>
+inline void CleanupResetAndDestroy<T>::PushL(T& aRef) { CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) ); }
+template <class T>
+void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr) { static_cast< T* >( aPtr )->ResetAndDestroy(); }
+template <class T>
+inline void CleanupResetAndDestroyPushL(T& aRef) { CleanupResetAndDestroy<T>::PushL(aRef); }
+
+// Overflow utility class
+class TMemSpyTruncateOverflow : public TDesOverflow
+	{
+public:
+	virtual void Overflow( TDes& ) { }
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputList.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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 MEMSPYENGINEOUTPUTLIST_H
+#define MEMSPYENGINEOUTPUTLIST_H
+
+// System includes
+#include <e32base.h>
+#include <bamdesca.h>
+
+// Classes referenced
+class CMemSpyEngineOutputSink;
+class CMemSpyEngineOutputListItem;
+
+
+NONSHARABLE_CLASS( CMemSpyEngineOutputList ) : public CBase, public MDesCArray
+    {
+public:
+    static CMemSpyEngineOutputList* NewL();
+    static CMemSpyEngineOutputList* NewLC( CMemSpyEngineOutputSink& aSink );
+    ~CMemSpyEngineOutputList();
+
+private:
+    CMemSpyEngineOutputList( CMemSpyEngineOutputSink* aSink = NULL );
+    void ConstructL();
+
+public: // From MDesCArray
+    TInt MdcaCount() const;
+    TPtrC MdcaPoint( TInt aPos ) const;
+
+public: // API - add
+    void AddItemL( const TDesC& aCaption );
+    void AddItemL( const TDesC& aCaption, const TDesC& aValue );
+    void AddItemL( const TDesC& aCaption, TInt aValue );
+    void AddItemL( const TDesC& aCaption, TUint aValue );
+    void AddItemL( const TDesC& aCaption, const TInt64& aValue );
+    void AddItemL( const TDesC& aCaption, TAny* aValue );
+    void AddItemL( const TDesC& aCaption, TUint* aValue );
+    void AddItemL( const TDesC& aCaption, TUint8* aValue );
+    void AddItemFormatL( const TDesC& aCaption, TRefByValue<const TDesC> aValueFormat, ... );
+    void AddItemFormatL( TRefByValue<const TDesC> aFormat, ... );
+    void AddItemUCL( const TDesC& aCaption, const TDesC& aValue );
+    void AddItemFormatUCL( const TDesC& aCaption, TRefByValue<const TDesC> aValueFormat, ... );
+    void AddItemFormatUCL( TRefByValue<const TDesC> aFormat, ... );
+    void AddItemHexL( const TDesC& aCaption, TUint aValue );
+    void AddItemYesNoL( const TDesC& aCaption, TBool aYes );
+    void AddItemTrueFalseL( const TDesC& aCaption, TBool aTrue );
+    void AddItemOnOffL( const TDesC& aCaption, TBool aOn );
+    void AddItemPercentageL( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue );
+    void AddBlankItemL( TInt aRepetitions = 1 );
+    void AddUnderlineForPreviousItemL( TChar aUnderlineCharacter = '=', TInt aBlankItemCount = 1 );
+
+public: // API - insert
+    void InsertItemL( TInt aPos, const TDesC& aCaption );
+    void InsertItemL( TInt aPos, const TDesC& aCaption, const TDesC& aValue );
+    void InsertItemFormatUCL( TInt aPos, TRefByValue<const TDesC> aValueFormat, ... );
+    void InsertBlankItemL( TInt aPos, TInt aRepetitions = 1 );
+    void InsertUnderlineForItemAtL( TInt aPos, TChar aUnderlineCharacter = '=', TInt aBlankItemCount = 1 );
+
+public: // API - print
+    void PrintL();
+    void PrintL( CMemSpyEngineOutputSink& aSink );
+
+public: // API - access
+    CMemSpyEngineOutputListItem& Item( TInt aPos );
+    const CMemSpyEngineOutputListItem& Item( TInt aPos ) const;
+    inline TInt Count() const { return iItems.Count(); }
+
+private: // Internal methods
+    TPtr& FormatBuffer();
+
+private: // Data members
+    CMemSpyEngineOutputSink* iSink;
+    HBufC* iFormatBuffer;
+    TPtr iFormatBufferPtr;
+    RPointerArray<CMemSpyEngineOutputListItem> iItems;
+    };
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputSink.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* 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 MEMSPYENGINEOUTPUTSINK_H
+#define MEMSPYENGINEOUTPUTSINK_H
+
+// System includes
+#include <e32base.h>
+#include <bamdesca.h>
+
+// User includes
+#include <memspy/engine/memspyengineoutputsinktype.h>
+
+// Classes referenced
+class CMemSpyEngine;
+
+// Constants
+const TBool KMemSpyEngineSinkDoNotCreateOwnDataStream = EFalse;
+
+// Literal constants
+_LIT( KMemSpySinkTagClose, "/" );
+
+
+/** 
+ * Context is like additional data that is appended to the file name.
+ * Folder is used to formulate a subdirectory within the main memspy output folder
+ * Extension is the file extension
+ * aUseFileTimeStamp, if true, will cause all output files (irrespective of the folder) to include a timestamp prefix
+ * aFolderTimeStamp, if specified, will cause the parent folder to also have a timestamp prepended to it
+ */
+NONSHARABLE_CLASS( CMemSpyEngineSinkMetaData ) : public CBase
+    {
+public:
+    IMPORT_C static CMemSpyEngineSinkMetaData* NewL();
+    IMPORT_C static CMemSpyEngineSinkMetaData* NewL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp );
+    IMPORT_C static CMemSpyEngineSinkMetaData* NewL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp, const TTime& aFolderTimeStamp );
+    IMPORT_C static CMemSpyEngineSinkMetaData* NewL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp );
+    IMPORT_C static CMemSpyEngineSinkMetaData* NewL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseFileTimeStamp, const TTime& aFolderTimeStamp );
+    IMPORT_C ~CMemSpyEngineSinkMetaData();
+
+private:
+    CMemSpyEngineSinkMetaData( TBool aOverwrite, TBool aUseTimeStamp );
+    void ConstructL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, const TTime& aFolderTime );
+
+public: // Access
+    inline const TDesC& Root() const { return *iRoot; }
+    inline const TDesC& Context() const { return *iContext; }
+    inline const TDesC& Folder() const { return *iFolder; }
+    inline const TDesC& Extension() const { return *iExtension; }
+    inline const TDesC& FolderTimeStamp() const { return *iFolderTimeStamp; }
+    inline const TBool Overwrite() const { return iOverwrite; }
+    inline const TBool UseFileTimeStamp() const { return iUseFileTimeStamp; }
+
+private: // Data members
+    HBufC* iRoot;
+    HBufC* iContext;
+    HBufC* iFolder;
+    HBufC* iExtension;
+    HBufC* iFolderTimeStamp;
+    TBool iOverwrite;
+    TBool iUseFileTimeStamp;
+    };
+
+
+
+NONSHARABLE_CLASS( CMemSpyEngineOutputSink ) : public CBase
+    {
+protected:
+    CMemSpyEngineOutputSink( CMemSpyEngine& aEngine );
+    void BaseConstructL();
+
+public:
+    ~CMemSpyEngineOutputSink();
+
+public:
+    virtual TMemSpySinkType Type() const = 0;
+
+public:
+    IMPORT_C void DataStreamTimeStampBeginL( const TTime& aTime );
+    IMPORT_C void DataStreamTimeStampEnd();
+    IMPORT_C void DataStreamBeginL( const TDesC& aContext );
+    IMPORT_C void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder );
+    virtual void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension ) = 0;
+    virtual void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite ) = 0;
+    virtual void DataStreamBeginL( const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, TBool aOverwrite, TBool aUseTimeStamp ) = 0;
+    virtual void DataStreamEndL() = 0;
+
+public:
+    virtual void ProcessSuspendedL( TProcessId aId );
+    virtual void ProcessResumed( TProcessId aId );
+
+public:
+    IMPORT_C void OutputPrefixSetLC( const TDesC& aPrefix );
+    IMPORT_C void OutputPrefixSetFormattedLC( TRefByValue<const TDesC> aFormat, ... );
+    IMPORT_C void OutputPrefixClear();
+
+public:
+    IMPORT_C void OutputRawL( const TDesC8& aData );
+    IMPORT_C void OutputLineL( const TDesC& aLine, TBool aIncludePrefix = ETrue );
+    IMPORT_C void OutputLineFormattedL( TRefByValue<const TDesC> aFormat, ... );
+    IMPORT_C void OutputBlankLineL();
+    IMPORT_C void OutputSectionHeadingL( const TDesC& aCaption, TChar aUnderlineCharacter );
+
+public:
+    IMPORT_C void OutputItemAndValueL( const TDesC& aItem, const TDesC& aValue );
+    IMPORT_C void OutputItemAndValueL( const TDesC& aItem, TUint aValue, TBool aHex = EFalse );
+
+public:
+    IMPORT_C void OutputBinaryDataL( const TDesC& aFormat, const TUint8* aBufferAddress, const TUint8* aDisplayStartAddress, TInt aLength );
+    IMPORT_C void OutputBinaryDataCompressedL( const TDesC& aFormat, const TUint8* aBufferAddress, const TUint8* aDisplayStartAddress, TInt aLength );
+
+public: // But not exported
+    TPtr& FormatBuffer();
+    CMemSpyEngine& Engine();
+
+protected:
+    virtual void DoOutputLineL( const TDesC& aLine ) = 0;
+    virtual void DoOutputRawL( const TDesC8& aData ) = 0;
+    virtual TBool IsPrefixAllowed( const TDesC& aPrefix );
+
+protected:
+    static void ClearPrefix( TAny* aSelf );
+    const TDesC& DataStreamTimeStamp() const;
+
+protected:
+    CMemSpyEngine& iEngine;
+
+private:
+    HBufC* iFormatBuffer;
+    HBufC* iLocalBuffer;
+    HBufC* iPrefix;
+    TPtr iFormatBufferPointer;
+    HBufC* iDataStreamTimeStampSpecifier;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Sink/MemSpyEngineOutputSinkType.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* 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 MEMSPYENGINEOUTPUTSINKTYPE_H
+#define MEMSPYENGINEOUTPUTSINKTYPE_H
+
+
+// Enumerations
+enum TMemSpySinkType
+    {
+    ESinkTypeDebug = 0,
+    ESinkTypeFile
+    };
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTracker.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKER_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKER_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// User includes
+#include <memspy/engine/memspyenginehelpersysmemtrackerobserver.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyEngineHelperSysMemTrackerImp;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class MMemSpyEngineHelperSysMemTrackerObserver;
+class CMemSpyEngineHelperSysMemTrackerOutputFormatter;
+
+
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTracker ) : public CBase, public MMemSpyEngineHelperSysMemTrackerObserver, public MDesCArray
+    {
+public:
+    static CMemSpyEngineHelperSysMemTracker* NewL( CMemSpyEngine& aEngine );
+    ~CMemSpyEngineHelperSysMemTracker();
+
+private:
+    CMemSpyEngineHelperSysMemTracker();
+    void ConstructL( CMemSpyEngine& aEngine );
+
+public: // API
+    IMPORT_C TBool IsActive() const;
+    IMPORT_C void StartL();
+    IMPORT_C void StartL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
+    IMPORT_C void StopL();
+    //
+    IMPORT_C void SetConfigL( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
+    IMPORT_C void GetConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
+    //
+    IMPORT_C void SetObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver );
+    IMPORT_C void RemoveObserver( MMemSpyEngineHelperSysMemTrackerObserver* aObserver );
+    //
+    IMPORT_C const RPointerArray< CMemSpyEngineHelperSysMemTrackerCycle >& CompletedCycles() const;
+
+    IMPORT_C void CheckForChangesNowL();
+
+public: // But not exported
+    void Reset();
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // From MMemSpyEngineHelperSysMemTrackerObserver
+    void HandleCyclesResetL();
+    void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+    void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private:
+    CMemSpyEngineHelperSysMemTrackerImp* iImp;
+    MMemSpyEngineHelperSysMemTrackerObserver* iRealObserver;
+    CMemSpyEngineHelperSysMemTrackerOutputFormatter* iOutputFormatter;
+    };
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerConfig.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERCONFIG_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERCONFIG_H
+
+// System includes
+#include <e32base.h>
+
+// Constants
+const TInt KMemSpySysMemTrackerConfigMinTimerPeriod = 30; // Seconds
+const TInt KMemSpySysMemTrackerConfigMaxTimerPeriod = 60; // Seconds
+
+
+NONSHARABLE_CLASS( TMemSpyEngineHelperSysMemTrackerConfig )
+    {
+public:
+    inline TMemSpyEngineHelperSysMemTrackerConfig()
+        : iTimerPeriod( KMemSpySysMemTrackerConfigMinTimerPeriod * 1000000 ),
+          iDumpData( EFalse ),
+          iEnabledCategories( EMemSpyEngineSysMemTrackerCategoryAll ),
+          iMode( MemSpyEngineSysMemTrackerModeBasic )
+        {
+        }
+
+public:
+    inline TBool DumpData() const { return iDumpData; }
+    inline const TTimeIntervalMicroSeconds32& TimerPeriod() const { return iTimerPeriod; }
+    inline const TInt EnabledCategoryCount() 
+        { 
+        TInt count(0);
+        for( TInt bit = EMemSpyEngineSysMemTrackerCategoryWindowGroups; bit > 0; bit = bit >> 1 )
+            {
+            if ( bit & iEnabledCategories )
+                {
+                count++;
+                }
+            }
+        return count;
+        }
+
+public:
+    enum TMemSpyEngineSysMemTrackerCategories
+        {
+        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,
+        EMemSpyEngineSysMemTrackerCategoryAll             = 0xffff
+        };
+    
+    enum TMemSpyEngineSysMemTrackerMode
+        {
+        MemSpyEngineSysMemTrackerModeBasic = 0,
+        MemSpyEngineSysMemTrackerModeFull,
+        MemSpyEngineSysMemTrackerModeCustom
+        };
+    
+public:
+    TTimeIntervalMicroSeconds32 iTimerPeriod;
+    TBool iDumpData;
+    TInt iEnabledCategories;
+    TName iThreadNameFilter;
+    TMemSpyEngineSysMemTrackerMode iMode;
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycle.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERCYCLE_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERCYCLE_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Classes referenced
+class RFs;
+class CMemSpyEngineOutputList;
+class CMemSpyEngineOutputSink;
+class TMemSpyEngineHelperSysMemTrackerConfig;
+class CMemSpyEngineHelperSysMemTrackerCycleChange;
+
+
+
+/**
+ * A cycle object represents one or more changes that have taken place 
+ * in the entire OS
+ *
+ * The individual elements that make up the overall cycle description are
+ * obtained by iterating through the various CMemSpyEngineHelperSysMemTrackerCycleChange
+ * instances owned by this object.
+ *
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycle ) : public CBase, public MDesCArray
+    {
+public:
+    static CMemSpyEngineHelperSysMemTrackerCycle* NewLC( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig, const CMemSpyEngineHelperSysMemTrackerCycle* aPreviousCycle = NULL );
+    ~CMemSpyEngineHelperSysMemTrackerCycle();
+
+private:
+    CMemSpyEngineHelperSysMemTrackerCycle( const TMemSpyEngineHelperSysMemTrackerConfig& aConfig, const CMemSpyEngineHelperSysMemTrackerCycle* aPreviousCycle = NULL );
+    void ConstructL();
+
+public: // API - info about this cycle
+    IMPORT_C TInt CycleNumber() const;
+    IMPORT_C const TTime& Time() const;
+    IMPORT_C const TDesC& TimeFormatted() const;
+    IMPORT_C const TDesC& Caption() const;
+    IMPORT_C const TInt64& MemoryFree() const;
+    IMPORT_C TInt64 MemoryDelta() const;
+    IMPORT_C TInt64 MemoryFreePreviousCycle() const;
+
+public: // API - access specific changes
+    IMPORT_C TInt ChangeCount() const;
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
+
+public: // Internal API
+    void FinalizeL();
+    void AddAndPopL( CMemSpyEngineHelperSysMemTrackerCycleChange* aInfo );
+    void DiscardChanges();
+    CMemSpyEngineHelperSysMemTrackerCycleChange& ChangeAt( TInt aIndex );
+    void GetDataFolderL( RFs& aFsSession, TDes& aFolder );
+    void DataStreamBeginL( CMemSpyEngineOutputSink& aSink, const TDesC& aContext );
+    void DataStreamEndL( CMemSpyEngineOutputSink& aSink );
+
+public: // Misc
+    const TMemSpyEngineHelperSysMemTrackerConfig& Config() const;
+    //
+    void AddToMemoryUsed( TInt aValue );
+    void AddToMemoryHeapAllocs( TInt aValue );
+    void AddToMemoryHeapFrees( TInt aValue );
+    void AddToCellCountFree( TInt aValue );
+    void AddToCellCountAlloc( TInt aValue );
+    //
+    const TInt64& MemoryUsed() const;
+    const TInt64& MemoryHeapAllocs() const;
+    const TInt64& MemoryHeapFrees() const;
+    const TInt64& MemoryHeapCellCountAlloc() const;
+    const TInt64& MemoryHeapCellCountFree() const;
+
+private: // Data members
+    const TMemSpyEngineHelperSysMemTrackerConfig& iConfig;
+    const CMemSpyEngineHelperSysMemTrackerCycle* iPreviousCycle;
+    TInt iCycleNumber;
+    TTime iTime;
+    TInt64 iMemoryFree;
+    HBufC* iTimeFormatted;
+    HBufC* iCaption;
+    TInt iChangeCount;
+    CMemSpyEngineOutputList* iFixedItems;
+    RPointerArray< CMemSpyEngineHelperSysMemTrackerCycleChange > iChangeDescriptors;
+
+private: // Data members - transient
+    TInt64 iMemoryUsed;
+    TInt64 iMemoryHeapFrees;
+    TInt64 iMemoryHeapAllocs;
+    TInt64 iCellCountsFrees;
+    TInt64 iCellCountsAllocs;
+    };
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerCycleChange.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERCYCLECHANGE_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERCYCLECHANGE_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include <memspy/engine/memspyenginehelpersysmemtrackerenums.h> 
+
+// Classes referenced
+class CMemSpyEngineOutputSink;
+class CMemSpyEngineOutputList;
+class CMemSpyEngineHelperSysMemTrackerCycle;
+typedef TBuf<6> TMemSpySWMTTypeName;
+
+/**
+ * A change descriptor object represents precisely one system-wide change that was detected
+ * during any given cycle.
+ *
+ */
+NONSHARABLE_CLASS( CMemSpyEngineHelperSysMemTrackerCycleChange ) : public CBase
+    {
+public:
+    ~CMemSpyEngineHelperSysMemTrackerCycleChange();
+
+protected:
+    CMemSpyEngineHelperSysMemTrackerCycleChange( TUint8 aAttributes );
+    void BaseConstructL();
+
+public: // API - framework
+    virtual TMemSpyEngineSysMemTrackerType Type() const = 0;
+    virtual void OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) = 0;
+    virtual void OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) = 0;
+    virtual void OutputDataL( CMemSpyEngineOutputSink& /*aSink*/, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) { };
+
+protected: // Internal methods
+    void FormatType( TMemSpySWMTTypeName& aBuffer ) const;
+    void FormatAttributes( TDes& aBuffer ) const;
+
+private: // Data members
+    const TUint8 iAttributes;
+    };
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerEnums.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKERENUMS_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKERENUMS_H
+
+// System includes
+#include <e32std.h>
+
+// Enumerations
+enum TMemSpyEngineSysMemTrackerType
+    {
+    EMemSpyEngineSysMemTrackerTypeHeapUser = 0,
+    EMemSpyEngineSysMemTrackerTypeHeapKernel,
+    EMemSpyEngineSysMemTrackerTypeChunk,
+    EMemSpyEngineSysMemTrackerTypeRamDrive,
+    EMemSpyEngineSysMemTrackerTypeStack,
+    EMemSpyEngineSysMemTrackerTypeGlobalData,
+    EMemSpyEngineSysMemTrackerTypeCode,
+    EMemSpyEngineSysMemTrackerTypeOpenFile,
+    EMemSpyEngineSysMemTrackerTypeDiskSpace,
+    EMemSpyEngineSysMemTrackerTypeBitmap,
+    EMemSpyEngineSysMemTrackerTypeHandleGeneric,
+    EMemSpyEngineSysMemTrackerTypeHandlePAndS,
+    EMemSpyEngineSysMemTrackerTypeFbserv,
+    EMemSpyEngineSysMemTrackerTypeFileServerCache,
+    EMemSpyEngineSysMemTrackerTypeSystemMemory,
+    EMemSpyEngineSysMemTrackerTypeWindowServer,
+    
+    //
+    EMemSpyEngineSysMemTrackerTypeCount // MARKER - must be last
+    };
+
+
+enum TMemSpyEngineSysMemTrackerEntryAttributes
+    {
+    EMemSpyEngineSysMemTrackerEntryAttributeNone = 0,
+    EMemSpyEngineSysMemTrackerEntryAttributeIsNew = 1,
+    EMemSpyEngineSysMemTrackerEntryAttributeIsAlive = 2
+    };
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerObserver.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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 MEMSPYENGINEHELPERSYSMEMTRACKER_OBSERVER_H
+#define MEMSPYENGINEHELPERSYSMEMTRACKER_OBSERVER_H
+
+// System includes
+#include <e32base.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Classes referenced
+class CMemSpyEngineHelperSysMemTrackerCycle;
+
+
+
+class MMemSpyEngineHelperSysMemTrackerObserver
+    {
+public: // From MMemSpyEngineHelperSysMemTrackerObserver
+    virtual void HandleCyclesResetL() = 0;
+    virtual void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) = 0;
+    virtual void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) = 0;
+    };
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObject.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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 MEMSPYENGINEOBJECT_H
+#define MEMSPYENGINEOBJECT_H
+
+// System includes
+#include <e32base.h>
+
+
+NONSHARABLE_CLASS( CMemSpyEngineObject ) : public CBase
+    {
+public:
+    IMPORT_C CMemSpyEngineObject();
+    IMPORT_C CMemSpyEngineObject( CMemSpyEngineObject& aParent );
+
+protected:
+    ~CMemSpyEngineObject();
+
+public: // API
+    IMPORT_C TInt AccessCount() const;
+    IMPORT_C virtual void Close();
+    IMPORT_C virtual void Open();
+    IMPORT_C CMemSpyEngineObject* Parent() const;
+    IMPORT_C void SetParent( CMemSpyEngineObject* aParent );
+    
+protected: // Internal API
+    inline TBool OpenOrCloseInProgress() const { return iOpenOrCloseInProgress; }
+    inline void SetOpenOrCloseInProgress( TBool aOpenOrCloseInProgress ) { iOpenOrCloseInProgress = aOpenOrCloseInProgress; }
+
+private:
+    TInt iAccessCount;
+    CMemSpyEngineObject* iParent;
+    TBool iOpenOrCloseInProgress;
+    };
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectContainer.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* 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 MEMSPYENGINEOBJECTCONTAINER_H
+#define MEMSPYENGINEOBJECTCONTAINER_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// User includes
+#include <memspy/engine/memspyenginemidwife.h>
+#include <memspy/engine/memspyengineundertaker.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyProcess;
+
+
+NONSHARABLE_CLASS( CMemSpyEngineObjectContainer ) : public CBase, public MDesCArray, public MMemSpyEngineUndertakerObserver, public MMemSpyEngineMidwifeObserver
+    {
+public:
+    static CMemSpyEngineObjectContainer* NewL( CMemSpyEngine& aEngine );
+    static CMemSpyEngineObjectContainer* NewL( const TDesC& aFilter, CMemSpyEngine& aEngine );
+    ~CMemSpyEngineObjectContainer();
+
+private:
+    CMemSpyEngineObjectContainer( CMemSpyEngine& aEngine );
+    void ConstructL( const TDesC& aFilter );
+
+public: // API
+    IMPORT_C TInt Count() const;
+    IMPORT_C TInt CountAll() const;
+
+public:
+    IMPORT_C void RefreshL();
+    IMPORT_C void RefreshL( const TDesC& aFilter );
+    IMPORT_C TBool IsAlive( TProcessId aPid ) const;
+    IMPORT_C TBool IsAlive( TProcessId aPid, TThreadId aTid ) const;
+    IMPORT_C CMemSpyProcess& At( TInt aIndex ) const;
+    IMPORT_C CMemSpyProcess& ProcessByIdL( TProcessId aId ) const;
+    IMPORT_C TInt ProcessIndexById( TProcessId aId ) const;
+    IMPORT_C TInt ProcessAndThreadByThreadId( TThreadId aTid, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const;
+    IMPORT_C TInt ProcessAndThreadByFullName( const TDesC& aFullName, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const;
+    IMPORT_C TInt ProcessAndThreadByPartialName( const TDesC& aPartialName, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread ) const;
+
+public: // API - sorting
+    IMPORT_C void SortById();
+    IMPORT_C void SortByName();
+    IMPORT_C void SortByThreadCount();
+    IMPORT_C void SortByCodeSegs();
+    IMPORT_C void SortByHeapUsage();
+    IMPORT_C void SortByStackUsage();
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
+
+private: // From MMemSpyEngineUndertakerObserver
+	void ThreadIsDeadL( const TThreadId& aId, const RThread& aThread );
+	void ProcessIsDeadL( const TProcessId& aId, const RProcess& aProcess );
+
+public: // From MMemSpyEngineMidwifeObserver
+	void ThreadIsBornL( const TThreadId& aId, const RThread& aThread );
+	void ProcessIsBornL( const TProcessId& aId, const RProcess& aProcess );
+
+private: // Internal methods
+    void Remove( CMemSpyProcess& aProcess );
+    void AppendL( CMemSpyProcess* aProcess );
+    void Resort();
+    void LocateProcessesL( const TDesC& aFilter );
+    void DestroyProcesses( RArray< CMemSpyProcess* >& aList );
+    void TryToCreateProcessAndThreadL( const TThreadId& aTid, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread );
+    void TryToCreateProcessAndThreadL( const RThread& aRThread, CMemSpyProcess*& aProcess, CMemSpyThread*& aThread );
+    CMemSpyProcess* CreateProcessL( const TProcessId& aId );
+    TBool MoveToGarbageL( const TProcessId& aId );
+
+private: // Comparison functions
+    static TInt CompareById( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
+    static TInt CompareByName( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
+    static TInt CompareByThreadCount( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
+    static TInt CompareByCodeSegs( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
+    static TInt CompareByHeapUsage( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
+    static TInt CompareByStackUsage( CMemSpyProcess* const & aLeft, CMemSpyProcess* const & aRight );
+
+private: // Idle callback related
+    void AsyncNotifyUiOfContainerChanges();
+    static TBool NotifyUiOfContainerChanges( TAny* aSelf );
+
+private: // Enumerations
+    enum TSortType
+        {
+        ESortById = 0,
+        ESortByName,
+        ESortByThreadCount,
+        ESortByCodeSegs,
+        ESortByHeapUsage,
+        ESortByStackUsage
+        };
+        
+private:
+    CMemSpyEngine& iEngine;
+    TSortType iSortType;
+    CMemSpyEngineUndertaker* iUndertaker;
+    CMemSpyEngineMidwife* iMidwife;
+    CIdle* iIdleNotifyContainerChanged;
+    RArray< CMemSpyProcess* > iProcesses;
+    RArray< CMemSpyProcess* > iGarbage;
+    };
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectProcess.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* 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 MEMSPYENGINEOBJECTPROCESS_H
+#define MEMSPYENGINEOBJECTPROCESS_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// User includes
+#include <memspy/engine/memspyengineobject.h>
+
+// Classes referenced
+class CMemSpyThread;
+class CMemSpyEngine;
+class TMemSpyDriverProcessInfo;
+
+
+NONSHARABLE_CLASS( CMemSpyProcess ) : public CMemSpyEngineObject, public MDesCArray
+    {
+public:
+    IMPORT_C static CMemSpyProcess* NewL( const CMemSpyProcess& aCopyMe );
+    static CMemSpyProcess* NewL( TProcessId aId, CMemSpyEngine& aEngine );
+    static CMemSpyProcess* NewLC( TProcessId aId, CMemSpyEngine& aEngine );
+
+private:
+    ~CMemSpyProcess();
+
+public: // From CMemSpyEngineObject
+    IMPORT_C void Open();
+    IMPORT_C void Close();
+
+private:
+    CMemSpyProcess( TProcessId aId, CMemSpyEngine& aEngine );
+    void ConstructL();
+
+public: // API - access
+    inline CMemSpyEngine& Engine() const { return iEngine; }
+    inline const TDesC& NameForListBox() const { return *iName; }
+    inline TProcessId Id() const { return iId; }
+    inline TInt Count() const { return iThreads.Count(); }
+    
+public: // API - query
+    IMPORT_C TPtrC Name() const;
+    IMPORT_C CMemSpyThread& At( TInt aIndex ) const;
+    IMPORT_C TInt ThreadIndexById( TThreadId aId ) const;
+    IMPORT_C CMemSpyThread& ThreadByIdL( TThreadId aId ) const;
+    IMPORT_C TBool IsSystemPermanent() const;
+    IMPORT_C TBool IsSystemCritical() const;
+    IMPORT_C TBool IsDead() const;
+    IMPORT_C TUint32 SID() const;
+    IMPORT_C TUint32 VID() const;
+    IMPORT_C TProcessPriority Priority() const;
+    IMPORT_C TExitCategoryName ExitCategory() const;
+    IMPORT_C TInt ExitReason() const;
+    IMPORT_C TExitType ExitType() const;
+    
+public: // API - misc
+    IMPORT_C void KillL();
+    IMPORT_C void TerminateL();
+    IMPORT_C void PanicL();
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
+
+public: // New API functions:
+    IMPORT_C TUidType UIDs() const;
+    IMPORT_C SCapabilitySet Capabilities() const;
+
+public: // API - but not exported
+    void GetFileName( TFileName& aFileName );
+    void RefreshL();
+    void RefreshL( const RProcess& aProcess );
+    void SetDeadL();
+    void SetDeadL( const RProcess& aProcess );
+    void FullName( TDes& aFullName ) const;
+
+public: // API - utility functions
+    static void AppendPriority( TDes& aDes, TProcessPriority aPriority );
+
+public: // Called by process container
+    void HandleThreadIsBornL( const TThreadId& aId );
+
+private: // Internal methods
+    void LocateThreadsL( RProcess& aProcess );
+    void BuildFormattedNameL();
+    void CloseAllThreads();
+    HBufC* GetProcessNameLC( const RProcess& aProcessOrNull, TBool& aProcessNameIncludesExeSuffix ) const;
+
+private: // Internal enumerations
+    enum TFlags
+        {
+        EFlagsNone = 0,
+        EFlagsIncludedExecutableWithinName = 1
+        };
+
+private: // Data members
+    const TProcessId iId;
+    CMemSpyEngine& iEngine;
+    TProcessPriority iPriority;
+    TExitCategoryName iExitCategory;
+    TInt iExitReason;
+    TExitType iExitType;
+    HBufC* iName;
+    RArray< CMemSpyThread* > iThreads;
+    TMemSpyDriverProcessInfo* iInfo;
+    TUint32 iFlags;
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThread.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* 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 MEMSPYENGINEOBJECTTHREAD_H
+#define MEMSPYENGINEOBJECTTHREAD_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// User includes
+#include <memspy/engine/memspyengineobject.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyProcess;
+class CMemSpyThreadInfoContainer;
+
+
+NONSHARABLE_CLASS( CMemSpyThread ) : public CMemSpyEngineObject
+    {
+public:
+    static CMemSpyThread* NewL( TThreadId aId, CMemSpyProcess& aProcess );
+    static CMemSpyThread* NewLC( TThreadId aId, CMemSpyProcess& aProcess );
+
+private:
+    ~CMemSpyThread();
+
+public: // From CMemSpyEngineObject
+    IMPORT_C void Open();
+    IMPORT_C void Close();
+
+private:
+    CMemSpyThread( TThreadId aId, CMemSpyProcess& aProcess );
+    void ConstructL();
+
+public: // API - query
+    IMPORT_C TPtrC Name() const;
+    IMPORT_C TFullName FullName() const;
+    IMPORT_C CMemSpyThreadInfoContainer& InfoContainerL();
+    IMPORT_C CMemSpyThreadInfoContainer& InfoContainerForceSyncronousConstructionL();
+    IMPORT_C TBool IsSystemPermanent() const;
+    IMPORT_C TBool IsSystemCritical() const;
+    IMPORT_C TBool IsDead() const;
+    IMPORT_C TThreadPriority Priority() const;
+
+public: // API - misc
+    IMPORT_C void KillL();
+    IMPORT_C void TerminateL();
+    IMPORT_C void PanicL();
+    IMPORT_C void SetPriorityL( TThreadPriority aPriority );
+
+public: // API - access
+    inline CMemSpyProcess& Process() { return *iProcess; }
+    inline const CMemSpyProcess& Process() const { return *iProcess; }
+    inline TThreadId Id() const { return iId; }
+    inline const TDesC& NameForListBox() const { return *iName; }
+    inline TBool InfoContainerReady() const { return iInfoContainer != NULL; }
+
+public: // API - but not exported
+    CMemSpyEngine& Engine() const;
+    void OpenLC( RThread& aThread );
+    TInt Open( RThread& aThread );
+    void RefreshL();
+    void RefreshL( const RThread& aThread );
+    void SetDeadL();
+    void SetDeadL( const RThread& aThread );
+    void FullName( TDes& aName ) const;
+
+public: // API - utility functions - used by process also
+    static void AppendPriority( TDes& aDes, TThreadPriority aPriority );
+    static void AppendExitType( TDes& aDes, TExitType aType );
+    static void AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory );
+
+private: // Internal methods
+    HBufC* GetThreadNameLC( const RThread& aThreadOrNull ) const;
+
+private: // Data members
+    TThreadId iId;
+    CMemSpyProcess* iProcess;
+    HBufC* iName;
+    CMemSpyThreadInfoContainer* iInfoContainer;
+
+    // RThread attributes
+    TThreadPriority iPriority;
+    TExitCategoryName iExitCategory;
+    TExitType iExitType;
+    TInt iExitReason;
+    TUint32 iFlags;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoContainer.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* 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 MEMSPYENGINETHREADINFOCONTAINER_H
+#define MEMSPYENGINETHREADINFOCONTAINER_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// User includes
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobject.h>
+
+// Classes referenced
+class CMemSpyThread;
+class CMemSpyEngine;
+
+class MMemSpyThreadInfoContainerObserver
+    {
+public: // Enumerations
+    enum TEvent
+        {
+        EInfoItemChanged = 0,
+        EInfoItemDestroyed
+        };
+
+public: // From MMemSpyThreadInfoContainerObserver
+    virtual void HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType ) = 0;
+    };
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoContainer ) : public CMemSpyEngineObject, public MDesCArray
+    {
+public:
+    static CMemSpyThreadInfoContainer* NewL( CMemSpyThread& aThread, TBool aAsync = ETrue );
+    static CMemSpyThreadInfoContainer* NewLC( CMemSpyThread& aThread, TBool aAsync = ETrue );
+    static CMemSpyThreadInfoContainer* NewLC( CMemSpyThread& aThread, TMemSpyThreadInfoItemType aSpecificType );
+
+private:
+    CMemSpyThreadInfoContainer( CMemSpyThread& aThread );
+    ~CMemSpyThreadInfoContainer();
+    void ConstructL( TBool aAsync );
+    void ConstructItemByTypeL( TBool aAsync, TMemSpyThreadInfoItemType aType );
+
+public: // From CMemSpyEngineObject
+    IMPORT_C void Open();
+    IMPORT_C void Close();
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
+
+public: // API
+    inline CMemSpyThread& Thread() { return *iThread; }
+    inline const CMemSpyThread& Thread() const { return *iThread; }
+    IMPORT_C CMemSpyEngine& Engine() const;
+    IMPORT_C CMemSpyThreadInfoItemBase& Item( TInt aIndex );
+    IMPORT_C CMemSpyThreadInfoItemBase& Item( TMemSpyThreadInfoItemType aType );
+    IMPORT_C TInt InfoItemIndexByType( TMemSpyThreadInfoItemType aType );
+    IMPORT_C void ObserverAddL( MMemSpyThreadInfoContainerObserver& aObserver );
+    IMPORT_C void ObserverRemove( MMemSpyThreadInfoContainerObserver& aObserver );
+    IMPORT_C void PrintL();
+    void AddItemL( TMemSpyThreadInfoItemType aType );
+
+public: // But not exported
+    void NotifyObserverL( MMemSpyThreadInfoContainerObserver::TEvent aEvent, TMemSpyThreadInfoItemType aType );
+
+private: // Internal methods
+    void OpenAllInfoItems();
+    void CloseAllInfoItems();
+
+private:
+    CPeriodic* iIdleResetListboxTimer;
+    CMemSpyThread* iThread;
+    RArray< CMemSpyThreadInfoItemBase* > iItems;
+    RArray< MMemSpyThreadInfoContainerObserver* > iObservers;
+    };
+
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,916 @@
+/*
+* 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 MEMSPYTHREADINFOOBJECTS_H
+#define MEMSPYTHREADINFOOBJECTS_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+
+// User includes
+#include <memspy/engine/memspyengineobject.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include <memspy/engine/memspyengineprocessmemorytracker.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyThread;
+class CMemSpyThreadInfoContainer;
+class CMemSpyEngineChunkList;
+class CMemSpyEngineCodeSegList;
+class CMemSpyEngineActiveObjectArray;
+
+// Enumerations
+enum TMemSpyThreadInfoItemType
+    {
+    EMemSpyThreadInfoItemTypeFirst = 0,
+    //
+    EMemSpyThreadInfoItemTypeGeneralInfo = EMemSpyThreadInfoItemTypeFirst,
+    EMemSpyThreadInfoItemTypeHeap,
+    EMemSpyThreadInfoItemTypeStack,
+    EMemSpyThreadInfoItemTypeChunk,
+    EMemSpyThreadInfoItemTypeCodeSeg,
+    EMemSpyThreadInfoItemTypeOpenFiles,
+    EMemSpyThreadInfoItemTypeActiveObject,
+    EMemSpyThreadInfoItemTypeOwnedThreadHandles,
+    EMemSpyThreadInfoItemTypeOwnedProcessHandles,
+    EMemSpyThreadInfoItemTypeServer,
+    EMemSpyThreadInfoItemTypeSession,
+    EMemSpyThreadInfoItemTypeSemaphore,
+    EMemSpyThreadInfoItemTypeOtherThreads,
+    EMemSpyThreadInfoItemTypeOtherProcesses,
+    EMemSpyThreadInfoItemTypeMutex,
+    EMemSpyThreadInfoItemTypeTimer,
+    EMemSpyThreadInfoItemTypeLogicalChannel,
+    EMemSpyThreadInfoItemTypeChangeNotifier,
+    EMemSpyThreadInfoItemTypeUndertaker,
+    EMemSpyThreadInfoItemTypeMessageQueue,
+    EMemSpyThreadInfoItemTypeConditionalVariable,
+    EMemSpyThreadInfoItemTypeLDD,
+    EMemSpyThreadInfoItemTypePDD,
+    EMemSpyThreadInfoItemTypeMemoryTracking,
+    EMemSpyThreadInfoItemTypeMemoryTrackingCurrent,
+    EMemSpyThreadInfoItemTypeMemoryTrackingHWM,
+    EMemSpyThreadInfoItemTypeMemoryTrackingPeak,
+    //
+    EMemSpyThreadInfoItemTypeLast
+    };
+
+// Constants
+const TInt KMemSpyDefaultMaxHandleCount = 128;
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoItemBase ) : public CMemSpyEngineObject, public MDesCArray
+    {
+protected:
+    CMemSpyThreadInfoItemBase( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aType, TBool aAsyncConstruction );
+    ~CMemSpyThreadInfoItemBase();
+    virtual void ConstructL() = 0;
+
+private: // Construction support
+    static TInt CallConstructL( TAny* aSelf );
+
+public: // API
+    virtual TPtrC Name() const = 0;
+    IMPORT_C TMemSpyThreadInfoItemType Type() const;
+    IMPORT_C virtual void RebuildL();
+    inline CMemSpyThreadInfoContainer& Container() { return iContainer; }
+    IMPORT_C TBool IsReady() const;
+    IMPORT_C CMemSpyEngine& Engine() const;
+    IMPORT_C void PrintL();
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
+    IMPORT_C TPtrC Caption(TInt aIndex ) const;
+    IMPORT_C TPtrC Value(TInt aIndex ) const;
+
+protected:
+    class CItem : public CBase
+        {
+        public:
+            static CItem* NewLC( const CItem& aCopyMe );
+            static CItem* NewLC( const TDesC& aCaption );
+            static CItem* NewLC( const TDesC& aCaption, const TDesC& aValue );
+            static CItem* NewHexLC( const TDesC& aCaption, TUint aValue );
+            static CItem* NewDecimalLC( const TDesC& aCaption, TInt aValue );
+            static CItem* NewLongLC( const TDesC& aCaption, const TInt64& aValue );
+            static CItem* NewYesNoLC( const TDesC& aCaption, TBool aYes );
+            static CItem* NewOnOffLC( const TDesC& aCaption, TBool aOn );
+            static CItem* NewPercentageLC( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue );
+            ~CItem();
+
+        private:
+            CItem();
+            void ConstructL( const TDesC& aCaption, const TDesC& aValue );
+
+        public: // API
+            inline const TDesC& Caption() const { return *iCaption; }
+            inline const TDesC& Value() const { return *iValue; }
+            inline const TDesC& Combined() const { return *iCombined; }
+
+        public:
+            void SetValueL( const TDesC& aValue );
+            void SetHexL( TUint aValue );
+            void SetDecimalL( TInt aValue );
+            void SetLongL( const TInt64& aValue );
+            void SetYesNoL( TBool aYes );
+            void SetOnOffL( TBool aOn );
+            void SetPercentageL( TInt aOneHundredPercentValue, TInt aValue );
+            
+        private: // Internal
+            void UpdateCombinedL();
+        
+        private:
+            HBufC* iCaption;
+            HBufC* iValue;
+            HBufC* iCombined;
+        };
+
+protected: // Internal API
+    void AddItemL( const TDesC& aCaption, const TDesC& aValue );
+    void AddItemHexL( const TDesC& aCaption, TUint aValue );
+    void AddItemDecimalL( const TDesC& aCaption, TInt aValue );
+    void AddItemLongL( const TDesC& aCaption, const TInt64& aValue );
+    void AddItemYesNoL( const TDesC& aCaption, TBool aYes );
+    void AddItemOnOffL( const TDesC& aCaption, TBool aOn );
+    void AddItemPercentageL( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue );
+    void StripProcessAndThreadNames( TDes& aText );
+    void StripProcessName( TDes& aText );
+    void StripThreadName( TDes& aText );
+    CItem& Item( TInt aIndex );
+    const CItem& Item( TInt aIndex ) const;
+    virtual void Reset();
+
+private:
+    mutable CMemSpyThreadInfoContainer& iContainer;
+    TBool iReady;
+    TBool iIsEmpty;
+    RPointerArray<CItem> iItems;
+    CAsyncCallBack iCallBack;
+    const TMemSpyThreadInfoItemType iType;
+    };
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoGeneral ) : public CMemSpyThreadInfoItemBase
+    {
+public:
+    static CMemSpyThreadInfoGeneral* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoGeneral( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // Internal methods
+    void MakeRegisterListingL( RThread& aThread );
+    };
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoHeap ) : public CMemSpyThreadInfoItemBase
+    {
+public:
+    static CMemSpyThreadInfoHeap* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoHeap( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+    };
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoOpenFiles ) : public CMemSpyThreadInfoItemBase
+    {
+public:
+    static CMemSpyThreadInfoOpenFiles* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoOpenFiles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+    };
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoActiveObjects ) : public CMemSpyThreadInfoItemBase
+    {
+public:
+    static CMemSpyThreadInfoActiveObjects* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    ~CMemSpyThreadInfoActiveObjects();
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoActiveObjects( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
+    
+public: // API
+    inline CMemSpyEngineActiveObjectArray& Array() { return *iItems; }
+
+private: // Member data
+    CMemSpyEngineActiveObjectArray* iItems;
+    };
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoStack ) : public CMemSpyThreadInfoItemBase
+    {
+public:
+    static CMemSpyThreadInfoStack* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoStack( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+    };
+
+
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoChunk ) : public CMemSpyThreadInfoItemBase
+    {
+public:
+    static CMemSpyThreadInfoChunk* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    ~CMemSpyThreadInfoChunk();
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoChunk( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
+    
+public: // API
+    inline CMemSpyEngineChunkList& List() { return *iList; }
+    inline void NullifyList() { iList = NULL; }
+
+private:
+    CMemSpyEngineChunkList* iList;
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoCodeSeg ) : public CMemSpyThreadInfoItemBase
+    {
+public:
+    static CMemSpyThreadInfoCodeSeg* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    ~CMemSpyThreadInfoCodeSeg();
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoCodeSeg( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+public: // From MDesCArray
+    IMPORT_C TInt MdcaCount() const;
+    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
+    
+public: // API
+    inline CMemSpyEngineCodeSegList& List() { return *iList; }
+    inline void NullifyList() { iList = NULL; }
+
+private: // Data members
+    CMemSpyEngineCodeSegList* iList;
+    };
+
+
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoHandleObjectBase ) : public CMemSpyThreadInfoItemBase
+    {
+public:
+    ~CMemSpyThreadInfoHandleObjectBase();
+
+protected: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoHandleObjectBase( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // New API
+    inline TMemSpyDriverContainerType ContainerType() const { return iContainerType; }
+    inline TInt DetailsCount() const { return iInfoItems.Count(); }
+    inline TMemSpyDriverHandleInfoGeneric& DetailsAt( TInt aIndex ) { return iInfoItems[ aIndex ]; }
+    inline const TMemSpyDriverHandleInfoGeneric& DetailsAt( TInt aIndex ) const { return iInfoItems[ aIndex ]; }
+    IMPORT_C TInt DetailsIndexByEntry( const TMemSpyDriverHandleInfoGeneric& aEntry ) const;
+    IMPORT_C TInt DetailsIndexByHandle( TAny* aHandle ) const;
+
+protected: // Internal class
+    class THandleWrapper
+        {
+    public:
+        inline THandleWrapper( TAny* aHandle, TMemSpyDriverContainerType aType ) : iHandle( aHandle ), iType( aType ), iRefCount( 1 ) { }
+
+    public: // API
+        static TBool Match( const THandleWrapper& aLeft, const THandleWrapper& aRight );
+
+    public: // Data members
+        TAny* iHandle;
+        TMemSpyDriverContainerType iType;
+        TInt iRefCount;
+        };
+
+protected: // Internal API
+    virtual void GetHandlesL( RArray<THandleWrapper>& aArray ) = 0;
+
+protected: // New internal framework API
+    virtual void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName ) = 0;
+    virtual void HandleAllItemsLocatedL() { }
+
+private: // Data members
+    const TMemSpyDriverContainerType iContainerType;
+    RArray< TMemSpyDriverHandleInfoGeneric > iInfoItems;
+    };
+
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoHandleByContainer ) : public CMemSpyThreadInfoHandleObjectBase
+    {
+protected: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoHandleByContainer( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction );
+
+protected: // From CMemSpyThreadInfoHandleObjectBase
+    void GetHandlesL( RArray<THandleWrapper>& aArray );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoReferencedBy ) : public CMemSpyThreadInfoHandleObjectBase
+    {
+protected: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoReferencedBy( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction );
+
+protected: // From CMemSpyThreadInfoHandleObjectBase
+    void GetHandlesL( RArray<THandleWrapper>& aArray );
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoServer ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoServer* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoServer( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+    IMPORT_C static TPtrC SessionType( TIpcSessionType aType );
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoSession ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoSession* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    ~CMemSpyThreadInfoSession();
+
+private:
+    CMemSpyThreadInfoSession( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+public: // API
+    IMPORT_C TInt ConnectionCount( const TDesC& aName ) const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    void HandleAllItemsLocatedL();
+
+protected: // From CMemSpyThreadInfoItemBase
+    void Reset();
+
+private: // Internal object
+    class CSessionInfoEntry : public CBase
+        {
+    public:
+        inline CSessionInfoEntry( HBufC* aName ) : iCount(1), iName( aName ) { }
+        inline ~CSessionInfoEntry() { delete iName; }
+
+    public:
+        TInt iCount;
+        HBufC* iName;
+        };
+
+private: // Internal methods
+    static TBool CompareEntries( const CSessionInfoEntry& aLeft, const CSessionInfoEntry& aRight );
+    TInt FindServerL( const TDesC& aName ) const;
+    
+private:
+    RPointerArray<CSessionInfoEntry> iServerNames;
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoSemaphore ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoSemaphore* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoSemaphore( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoMutex ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoMutex* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoMutex( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoTimer ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoTimer* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoTimer( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+
+private: // Internal methods
+    static void GetTimerState( TMemSpyDriverTimerState aState, TDes& aBuf );
+    static void GetTimerType( TMemSpyDriverTimerType aType, TDes& aBuf );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoLDD ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoLDD* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoLDD( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoPDD ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoPDD* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoPDD( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoLogicalChannel ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoLogicalChannel* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoLogicalChannel( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoChangeNotifier ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoChangeNotifier* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoChangeNotifier( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoUndertaker ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoUndertaker* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoUndertaker( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoOwnedThreadHandles ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoOwnedThreadHandles* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoOwnedThreadHandles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoOwnedProcessHandles ) : public CMemSpyThreadInfoHandleByContainer
+    {
+public:
+    static CMemSpyThreadInfoOwnedProcessHandles* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoOwnedProcessHandles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoOtherThreads ) : public CMemSpyThreadInfoReferencedBy
+    {
+public:
+    static CMemSpyThreadInfoOtherThreads* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoOtherThreads( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoOtherProcesses ) : public CMemSpyThreadInfoReferencedBy
+    {
+public:
+    static CMemSpyThreadInfoOtherProcesses* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+private:
+    CMemSpyThreadInfoOtherProcesses( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+
+private: // From CMemSpyThreadInfoHandleByContainer
+    void HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName );
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoMemoryTrackingStatisticsCurrent ) : public CMemSpyThreadInfoItemBase, public MMemSpyEngineProcessMemoryTrackerObserver
+    {
+public:
+    static CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    ~CMemSpyThreadInfoMemoryTrackingStatisticsCurrent();
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoMemoryTrackingStatisticsCurrent( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    TPtrC Name() const;
+    
+public: // API
+    void SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory );
+    inline CMemSpyEngineProcessMemoryTracker& Tracker() { return *iTracker; }
+
+private: // From MMemSpyEngineProcessMemoryTrackerObserver
+    void HandleMemoryTrackingStartedL();
+    void HandleMemoryTrackingStoppedL();
+    void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
+
+private: // Member data
+    TBool iTotalIncludesSharedMemory;
+    CMemSpyEngineProcessMemoryTracker* iTracker;
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoMemoryTrackingStatisticsPeak ) : public CMemSpyThreadInfoItemBase, public MMemSpyEngineProcessMemoryTrackerObserver
+    {
+public:
+    static CMemSpyThreadInfoMemoryTrackingStatisticsPeak* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    ~CMemSpyThreadInfoMemoryTrackingStatisticsPeak();
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoMemoryTrackingStatisticsPeak( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    TPtrC Name() const;
+    
+public: // API
+    void SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory );
+    inline CMemSpyEngineProcessMemoryTracker& Tracker() { return *iTracker; }
+
+private: // From MMemSpyEngineProcessMemoryTrackerObserver
+    void HandleMemoryTrackingStartedL();
+    void HandleMemoryTrackingStoppedL();
+    void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
+
+private: // Member data
+    TBool iTotalIncludesSharedMemory;
+    CMemSpyEngineProcessMemoryTracker* iTracker;
+    };
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoMemoryTrackingStatisticsHWM ) : public CMemSpyThreadInfoItemBase, public MMemSpyEngineProcessMemoryTrackerObserver
+    {
+public:
+    static CMemSpyThreadInfoMemoryTrackingStatisticsHWM* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    ~CMemSpyThreadInfoMemoryTrackingStatisticsHWM();
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoMemoryTrackingStatisticsHWM( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    TPtrC Name() const;
+    
+public: // API
+    void SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory );
+    inline CMemSpyEngineProcessMemoryTracker& Tracker() { return *iTracker; }
+
+private: // From MMemSpyEngineProcessMemoryTrackerObserver
+    void HandleMemoryTrackingStartedL();
+    void HandleMemoryTrackingStoppedL();
+    void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
+
+private: // Member data
+    TBool iTotalIncludesSharedMemory;
+    CMemSpyEngineProcessMemoryTracker* iTracker;
+    };
+
+
+
+
+
+NONSHARABLE_CLASS( CMemSpyThreadInfoMemoryTracking ) : public CMemSpyThreadInfoItemBase, public MMemSpyEngineProcessMemoryTrackerObserver
+    {
+public:
+    static CMemSpyThreadInfoMemoryTracking* NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    ~CMemSpyThreadInfoMemoryTracking();
+
+private: // From CMemSpyThreadInfoItemBase
+    CMemSpyThreadInfoMemoryTracking( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction );
+    void ConstructL();
+
+public: // From CMemSpyThreadInfoItemBase
+    IMPORT_C TPtrC Name() const;
+    
+public: // API
+    IMPORT_C TBool TrackingActive() const;
+    IMPORT_C TBool TotalIncludesSharedMemory() const;
+    IMPORT_C void TrackingSetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory );
+    IMPORT_C void TrackingStartL();
+    IMPORT_C void TrackingStopL();
+    IMPORT_C void TrackingResetHWML();
+    IMPORT_C void TrackingObserverAddL( MMemSpyEngineProcessMemoryTrackerObserver& aObserver );
+    IMPORT_C void TrackingObserverRemove( MMemSpyEngineProcessMemoryTrackerObserver& aObserver );
+    IMPORT_C MDesCArray& InfoCurrent();
+    IMPORT_C MDesCArray& InfoHWM();
+    IMPORT_C MDesCArray& InfoPeak();
+    inline TBool TrackerExists() const { return iTracker != NULL; }
+
+private: // From MMemSpyEngineProcessMemoryTrackerObserver
+    void HandleMemoryTrackingStartedL();
+    void HandleMemoryTrackingStoppedL();
+    void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
+
+private: // Internal methods
+    inline CMemSpyEngineProcessMemoryTracker& Tracker() { return *iTracker; }
+    void UpdateCaptionsL();
+    void UpdateCaptionsL( const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
+
+private: // Member data
+    TBool iTotalIncludesSharedMemory;
+    CMemSpyEngineProcessMemoryTracker* iTracker;
+    CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* iInfoCurrent;
+    CMemSpyThreadInfoMemoryTrackingStatisticsHWM* iInfoHWM;
+    CMemSpyThreadInfoMemoryTrackingStatisticsPeak* iInfoPeak;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/memspy_plat/memspy_api/memspy_api.metaxml	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,19 @@
+<?xml version="1.0" ?>
+<api id="d6c032dbc08ddbb1c1db14ad08df1147" dataversion="2.0">
+  <name>MemSpy API</name>
+  <description>Defines the API, which is used for external client server usage and different MemSpy internal sub projects.</description>
+  <type>c++</type>
+  <collection>memspy</collection>
+  <libs>
+    <lib name="memspydriverclient.lib" />
+    <lib name="memspyengine.lib" />
+  </libs>
+  <release category="platform" sinceversion="5.1"/>
+  <attributes>
+     <!-- This indicates whether the api provides separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsure then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/rom/memspy.iby	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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 MEMSPY_IBY
+#define MEMSPY_IBY
+
+// Engine 
+file=ABI_DIR\BUILD_DIR\MemSpyDriverClient.dll									SHARED_LIB_DIR\MemSpyDriverClient.dll
+file=ABI_DIR\BUILD_DIR\MemSpyEngine.dll											SHARED_LIB_DIR\MemSpyEngine.dll
+
+// Client - server
+file=ABI_DIR\BUILD_DIR\MemSpyServer.exe											SHARED_LIB_DIR\MemSpyServer.exe
+file=ABI_DIR\BUILD_DIR\MemSpyClient.dll											SHARED_LIB_DIR\MemSpyClient.dll
+data=ZPRIVATE\\E5883BC2\MemSpyEComInterfaceIds.xml							    \private\E5883BC2\MemSpyEComInterfaceIds.xml
+
+// Commandline
+file=ABI_DIR\BUILD_DIR\MemSpy.exe									            SHARED_LIB_DIR\MemSpy.exe
+
+// Console UI
+//file=ABI_DIR\BUILD_DIR\MemSpyConsole.exe										SHARED_LIB_DIR\MemSpyConsole.exe
+//data=ZPRIVATE\\2002129E\MemSpyEComInterfaceIds.xml							    \private\2002129E\MemSpyEComInterfaceIds.xml
+//data=ZPRIVATE\\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml		    \private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/rom/memspy_rom.iby	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 MEMSPY_ROM_IBY
+#define MEMSPY_ROM_IBY
+
+// Driver 
+device[VARID]=KERNEL_DIR\BUILD_DIR\MemSpyDriver.ldd								SHARED_LIB_DIR\MemSpyDriver.ldd
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/symbian_version.hrh	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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: Symbian version configuration file 
+*
+*/
+
+#ifndef __SYMBIAN_VERSION_HRH
+#define __SYMBIAN_VERSION_HRH
+
+// S60 and Symbian version number enumeration definitions
+
+#define S60_30                                              30
+#define S60_31                                              31
+#define S60_32                                              32
+#define S60_50                                              50
+#define S60_51                                              91
+#define S60_52                                              92
+#define SYMBIAN_1                                           50
+#define SYMBIAN_2                                           91
+#define SYMBIAN_3                                           92
+#define SYMBIAN_4                                           101
+
+
+/**
+ * Defines the S60 or Symbian version used by this component. This flag can be
+ * used to variate the source code based on the SDK in use. The value of the
+ * flag should be always changed to reflect the current build environment.
+ */
+#define SYMBIAN_VERSION_SUPPORT                              SYMBIAN_4
+
+
+#endif  // __SYMBIAN_VERSION_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/techview/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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:
+*
+*/
+
+PRJ_PLATFORMS
+
+DEFAULT 
+
+PRJ_EXPORTS
+
+../include/data_caging_paths.hrh /epoc32/include/variant/data_caging_paths.hrh
+
+PRJ_MMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/techview/include/data_caging_paths.hrh	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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:
+*
+*/
+
+// This compatibility file can be exported on TechView builds in which
+// the data_caging_paths.hrh header is not already present. 
+
+#ifndef TECHVIEW_DATA_CAGING_PATHS_H
+#define TECHVIEW_DATA_CAGING_PATHS_H
+
+#define VID_DEFAULT 0x101FB657
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/group/ProfilerEngine.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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 <platform_paths.hrh>
+
+
+TARGET      PIProfilerEngine.exe
+TARGETTYPE  EXE
+UID         0x100039CE 0x2001E5AD
+VENDORID    VID_DEFAULT
+CAPABILITY  ALL -TCB
+SMPSAFE
+
+EPOCSTACKSIZE     	0x10000
+EPOCHEAPSIZE        0x100000 0x2000000  // Min 1MB, Max 32MB
+
+OS_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../inc
+SOURCEPATH      ../src
+
+SOURCE		ProfilerErrorChecker.cpp
+SOURCE      ProfilerEngine.cpp 
+SOURCE      SamplerController.cpp
+SOURCE      SamplerPluginLoader.cpp 
+SOURCE      WriterController.cpp
+SOURCE      WriterPluginLoader.cpp 
+SOURCE		ProfilerTimer.cpp 
+
+LIBRARY		sysutil.lib 
+LIBRARY     efsrv.lib
+LIBRARY     c32.lib
+LIBRARY     euser.lib 
+LIBRARY     estor.lib 
+LIBRARY     fbscli.lib
+LIBRARY     ws32.lib
+LIBRARY     bafl.lib 
+LIBRARY     charconv.lib
+LIBRARY     ecom.lib
+LIBRARY		platformenv.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/group/ProfilerEshell.mmp	Mon Sep 06 15:00:47 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:  
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+
+TARGET      PIProfiler.exe
+TARGETTYPE  EXE
+UID         0x100039CE 0x2021E5AD	// test UID, get an official
+VENDORID    VID_DEFAULT
+CAPABILITY  ALL -TCB
+SMPSAFE
+
+EPOCSTACKSIZE     	0x10000
+
+OS_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../inc
+SOURCEPATH      ../src
+
+
+SOURCE      ProfilerEshell.cpp 
+
+LIBRARY     c32.lib
+LIBRARY     euser.lib 
+LIBRARY     bafl.lib 
+LIBRARY		efsrv.lib 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2007 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:  
+*
+*/
+
+
+PRJ_MMPFILES
+ProfilerEngine.mmp
+ProfilerEshell.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/inc/ProfilerEngine.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,258 @@
+/*
+* 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 __PROFILERENGINE__
+#define __PROFILERENGINE__
+
+#include <e32base.h>
+#include <e32svr.h>
+#include <e32property.h> 
+
+#include <piprofiler/SamplerPluginInterface.h>
+#include <piprofiler/WriterPluginInterface.h>
+#include <piprofiler/ProfilerSession.h>
+#include <piprofiler/ProfilerAttributes.h>	// internal settings format presentations 
+
+#include "SamplerController.h"
+#include "WriterController.h"
+#include "ProfilerErrorChecker.h"
+#include "ProfilerTimer.h"
+
+// CONSTANTS
+const TInt KProfilerPrefixMaxLength = 32;
+const TInt KSettingsFileSize = 4096;
+
+/*
+ * This is an internal interface to the profiling engine which allows
+ * an additional control DLL to be loaded, replacing the profiler's
+ * default console UI
+ */
+
+/**
+ * Implementation class providing access to the profiler engine
+ */
+
+class MProfilerEngine
+{
+public:
+	virtual TInt				ControlL(TInt aCommand) =0;
+	virtual TInt				ControlDataL(TInt aCommand, TAny* data1 = 0, TAny* data2 = 0) = 0; 
+	
+	virtual TInt                GetSamplerAttributesL(const RMessage2& aMessage) = 0;
+    virtual TInt                GetSamplerAttributeCountL(const RMessage2& aMessage) = 0;
+	virtual TInt                SetSamplerAttributesL(const RMessage2& aMessage) = 0;
+	virtual TInt                GetGeneralAttributesL(const RMessage2& aMessage) = 0;
+	virtual TInt                SetGeneralAttributesL(const RMessage2& aMessage) = 0;
+    virtual TInt                 RefreshStatus(const RMessage2& aMessage) = 0;
+	virtual RProfiler::TSamplerState 	State() const =0;
+};
+
+/**
+ * The interface that the extra controller must implement to access
+ * the profiler.
+ */
+class MProfilerController
+{
+	public:
+		/** Release the controller from the profiler. This is invoked when the profiler is unloading. */
+		virtual void				Release() = 0;
+		/** Ask the profiler to change state */
+		inline TInt					ControlL(TInt aCommand) const;
+		/** Ask the profiler to change state */
+		inline TInt					ControlDataL(TInt aCommand, TAny* data1 = 0, TAny* data2 = 0) const;
+		
+		inline TInt                 GetSamplerAttributesL(const RMessage2& aMessage) const;
+        inline TInt                 SetSamplerAttributesL(const RMessage2& aMessage) const;
+        inline TInt                 GetGeneralAttributesL(const RMessage2& aMessage) const;
+        inline TInt                 SetGeneralAttributesL(const RMessage2& aMessage) const;
+        inline TInt                 GetSamplerAttributeCountL(const RMessage2& aMessage) const;
+        inline TInt                 RefreshStatus(const RMessage2& aMessage) const;
+		/* Query the profiler state */
+		inline RProfiler::TSamplerState	GeTComand() const;
+	protected:
+		inline						MProfilerController(MProfilerEngine& aEngine);
+	private:
+		MProfilerEngine& iEngine;
+};
+
+/** The signature of ordinal 1 in the controller DLL */
+typedef MProfilerController* (*TProfilerControllerFactoryL)(TInt aPriority, MProfilerEngine& aEngine);
+/** The second UID required by the controller DLL */
+const TUid KUidProfilerKeys={0x1000945c};
+
+inline MProfilerController::MProfilerController(MProfilerEngine& aEngine)
+	:iEngine(aEngine)
+{
+
+}
+
+inline TInt MProfilerController::ControlL(TInt aCommand) const
+{
+	return iEngine.ControlL(aCommand);
+}
+
+inline TInt MProfilerController::ControlDataL(TInt aCommand,TAny* data1, TAny* data2) const
+{
+	return iEngine.ControlDataL(aCommand,data1,data2);
+}
+
+inline TInt MProfilerController::GetSamplerAttributesL(const RMessage2& aMessage) const
+{
+    return iEngine.GetSamplerAttributesL(aMessage);
+}
+
+inline TInt MProfilerController::SetSamplerAttributesL(const RMessage2& aMessage) const
+{
+    return iEngine.SetSamplerAttributesL(aMessage);
+}
+
+inline TInt MProfilerController::GetGeneralAttributesL(const RMessage2& aMessage) const
+{
+    return iEngine.GetGeneralAttributesL(aMessage);
+}
+
+inline TInt MProfilerController::GetSamplerAttributeCountL(const RMessage2& aMessage) const
+{
+    return iEngine.GetSamplerAttributeCountL(aMessage);
+}
+
+inline TInt MProfilerController::SetGeneralAttributesL(const RMessage2& aMessage) const
+{
+    return iEngine.SetGeneralAttributesL(aMessage);
+}
+
+inline TInt MProfilerController::RefreshStatus(const RMessage2& aMessage) const
+{
+    return iEngine.RefreshStatus(aMessage);
+}
+
+inline RProfiler::TSamplerState MProfilerController::GeTComand() const
+{
+	return iEngine.State();
+}
+
+class CSamplerController;
+class CWriterController;
+class MSamplerControllerObserver;
+class MProfilerErrorObserver;
+
+class CProfiler : public CBase, private MProfilerEngine, 
+    MSamplerControllerObserver, 
+    MProfilerErrorObserver,
+    MProfilerTimerObserver
+{
+	public:
+		
+		static CProfiler*	NewLC(const TDesC& aSettingsFile);
+
+		/**
+		 * Method for control commands, i.e. start, stop and exit 
+		 * 
+		 * @param aCommand command to be parsed and executed
+		 * @return TInt KErrNone if succeed, else error code
+		 */
+		TInt				ControlL(TInt aCommand);
+
+		/**
+         * Method for control data, e.g. settings
+         * 
+         * @param aCommand command to be parsed and executed
+         * @param value1 can contain any value, integer or string, depends on use case 
+         * @param value2 can contain any value, integer or string, depends on use case 
+         * @return TInt KErrNone if succeed, else error code
+         */
+		TInt				ControlDataL(TInt aCommand, TAny* value1 = 0, TAny* value2 = 0);	
+
+		// setting attributes manipulation
+		TInt  GetGeneralAttributesL(const RMessage2& aMessage);
+		TInt  GetSamplerAttributesL(const RMessage2& aMessage);
+		TInt  SetGeneralAttributesL(const RMessage2& aMessage);
+		TInt  SetSamplerAttributesL(const RMessage2& aMessage);
+		TInt  GetSamplerAttributeCountL(const RMessage2& aMessage);
+		TInt  RefreshStatus(const RMessage2& /*aMessage*/);
+
+		// from CProfilerErrorChecker
+		void  HandleSamplerControllerReadyL();
+		void  NotifyRequesterForSettingsUpdate();
+		void  HandleProfilerErrorChangeL( TInt aError );
+		
+		// from MProfilerTimerObserver
+		void HandleTimerExpiresL(TInt aError);
+	    
+		void 				Finalise();
+		CProfilerSampleStream* GetSamplerStream();
+	    void  HandleError(TInt aErr);
+	    static TBool CheckLocationSanity(RFs& fs, const TDesC8& aLocation);
+private:
+							CProfiler(const TDesC& aSettingsFile);
+							~CProfiler();
+		void				ConstructL();
+		TInt 				LoadSettingsL(/*const TDesC& configFile*/);		
+		void                DoGetValueFromSettingsArray(CDesC8ArrayFlat* aLineArray, const TDesC8& aAttribute, TDes8& aValue);
+		void                DoGetValueFromSettingsArray(CDesC8ArrayFlat* aLineArray, const TDesC8& aAttribute, TInt& aValue);
+		void                UpdateSavedGeneralAttributes(CDesC8ArrayFlat* aSavedAttributes);
+		template<class T> CBufFlat* ExternalizeLC(const T& aElements);
+		
+		RProfiler::TSamplerState	State() const;
+
+		void DrainSampleStream();
+		void InstallStreamForActiveTraces(CSamplerPluginInterface& aSampler, CWriterPluginInterface& aWriter, TDesC& totalPrefix);
+		void SaveSettingsL();
+		
+		TInt HandleGeneralSettingsChange();
+		TInt CheckOldProfilerRunning();
+public:
+        // trace file settings
+		TBuf8<KProfilerPrefixMaxLength>	iFilePrefix;
+		TBuf8<KProfilerPrefixMaxLength>	iDriveLetter;
+		TBuf8<KProfilerPrefixMaxLength*2> iTotalPrefix;
+
+		TBuf<256>                       iSettingsFileLocation;
+		
+		MProfilerController*			iServer;
+		RProfiler::TSamplerState		iState;
+		
+		CProfilerSampleStream* 			iUserStream;
+		
+		// plug-in controllers
+		CWriterController*				iWriterHandler;
+		CSamplerController*				iSamplerHandler;
+
+		// setting attribute containers
+		TGeneralAttributes				iGeneralAttributes;
+		CArrayFixFlat<TSamplerAttributes>*	iDefaultSamplerAttributesArray;
+		
+		// temporary settings file array container
+		CDesC8ArrayFlat*                iSavedLineArray;	
+		TInt                            iSavedLinesCount;
+	    // saved settings, add extra 1 byte space to end buffer with a '\n'
+	    TBuf8<KSettingsFileSize + 1>   iSettingsBuffer;   
+
+	    // P&S status properties
+		RProperty						iEngineStatus;
+        RProperty                       iUpdateStatus;
+	    TBuf<128>                       iFileNameStream;
+private:
+        TBool                           iSettingsFileLoaded;
+        CProfilerErrorChecker*          iErrorChecker;
+        CProfilerTimer*                 iTimer;
+};
+
+#include <piprofiler/ProfilerGenericClassesUsr.h>
+#endif	// __PROFILERENGINE__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/inc/ProfilerErrorChecker.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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 PROFILERERRORCHECKER_H_
+#define PROFILERERRORCHECKER_H_
+
+// CLASS DECLARATIONS
+class MProfilerErrorObserver
+    {
+    public: // New
+        virtual void HandleProfilerErrorChangeL( TInt aError ) = 0;
+    };
+
+
+class CProfilerErrorChecker : public CActive
+    {
+public:
+    static CProfilerErrorChecker* CProfilerErrorChecker::NewL();
+    ~CProfilerErrorChecker();
+    void SetObserver(MProfilerErrorObserver* aObserver);
+private:
+    CProfilerErrorChecker();
+    void ConstructL();
+    void RunL();
+    TInt RunError(TInt aError);
+    void DoCancel();
+private:
+    MProfilerErrorObserver*     iObserver;
+    RProperty                   iErrorStatus;
+    };
+
+#endif /* PROFILERERRORCHECKER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/inc/ProfilerEshell.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* 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 PROFILERESHELL_H_
+#define PROFILERESHELL_H_
+
+#include <e32base.h>
+#include <e32std.h>  
+#include <bacline.h>    // CCommandLineArguments
+
+class CProfilerEShell : public CBase
+    {
+public:
+    static CProfilerEShell* NewL();
+    ~CProfilerEShell();
+    
+    void ConstructL();
+private:
+    CProfilerEShell();
+    
+    };
+
+#endif /* PROFILERESHELL_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/inc/ProfilerTimer.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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 PROFILERTIMER_H_
+#define PROFILERTIMER_H_
+
+#include <e32std.h>
+#include <e32base.h>
+
+class MProfilerTimerObserver
+    {
+public:
+    virtual void HandleTimerExpiresL(TInt aError) = 0;
+    };
+
+class CProfilerTimer : public CActive
+    {
+public:
+    static CProfilerTimer* NewL(const TInt aPriority, MProfilerTimerObserver& aObserver);
+    ~CProfilerTimer();
+    
+public:
+    
+    void After(TUint aPeriodInSeconds);
+    
+protected:
+    
+    // From CActive
+    void RunL();
+    void DoCancel();
+    
+private:
+    
+    CProfilerTimer(const TInt aPriority, MProfilerTimerObserver& aObserver);
+    void ConstructL(void);
+    
+private:
+    
+    RTimer      iTimer;
+    MProfilerTimerObserver&    iObserver;
+    };
+
+#endif /* PROFILERTIMER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/inc/SamplerController.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,154 @@
+/*
+* 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 __SAMPLERCONTROLLER_H__
+#define __SAMPLERCONTROLLER_H__
+
+// system includes
+#include <utf.h>
+#include <e32cmn.h>
+
+
+// The user-interface to the sampling device driver sued by the profiling engine
+// user includes
+#include <piprofiler/ProfilerConfig.h>
+#include <piprofiler/ProfilerVersion.h>
+#include <piprofiler/SamplerPluginInterface.h>
+
+#include "SamplerPluginLoader.h"
+
+/*
+ *	Forward declarations
+ */
+class TBapBuf;
+class CProfilerSampleStream;
+class CSamplerPluginLoader;
+class CSamplerPluginInterface;
+class MSamplerControllerObserver;
+/**
+ * The sampler controller for handling the actual sampler plugins.
+ */
+
+class CSamplerController : public CBase, MSamplerPluginLoadObserver
+	{
+	
+public:
+	static CSamplerController* NewL(CProfilerSampleStream& aStream);
+	void ConstructL();
+	
+	CSamplerController(CProfilerSampleStream& aStream);
+	~CSamplerController();
+	
+	/** 
+	 * 
+	 * Methods for user mode sampling
+	 * 
+	 **/
+	
+	/** Initialise the user mode samplers **/					
+	void InitialiseSamplerListL();
+		 
+	/* Overrider of MSamplerPluginLoaderObserver class **/
+	void HandlePluginLoaded( KSamplerPluginLoaderStatus aStatus );
+	
+	/* returns the name matching plugin Uid */
+	TUid GetPluginUID(TDesC8& name);
+
+	/** Start enabled samplers **/				
+	void StartSamplerPluginsL();
+
+	/** Stop enabled samplers **/				
+	TInt StopSamplerPlugins();
+
+public:
+
+	CSamplerPluginInterface* GetPlugin(TUid aUid);
+
+	TInt GetPluginList(TDes* aList);
+	
+    TInt SetSamplerSettingsL(TInt aUid, TSamplerAttributes& aAttributes);
+
+    void GetSamplerAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes);
+	
+	TInt UpdateSavedSamplerAttributesL(CDesC8ArrayFlat* aSavedLineArray, CArrayFixFlat<TSamplerAttributes>* aAttributes);
+	
+	/*
+	 * Compose all sampler (sampler or sub-sampler) attributes as text array for saving to settings file, 
+	 * called by CSamplerController (and Profiler Engine) 
+	 * 
+	 * @param aFile settings file where to write the settings 
+	 */
+	void ComposeAttributesToSettingsFileFormat(RFile& aFile, CArrayFixFlat<TSamplerAttributes>* aAttributes);
+	
+	/*
+	 * Compose all sampler (sampler or sub-sampler) attributes as text array for saving to settings file, 
+	 * called by CSamplerController (and Profiler Engine) 
+	 * 
+     * @param aFile settings file where to write the settings 
+	 * @param aAttrArray is container for saving the text to 
+	 */
+	void ComposeSettingsText(RFile& aFile, CArrayFixFlat<TSamplerAttributes>* aAttrArray);
+	
+	void SetObserver(MSamplerControllerObserver* aObserver);
+	
+	void     Str2Bool(const TDesC8& aBuf, TBool& aValue);
+    
+    void     Str2Int(const TDesC8& aBuf, TInt& aValue);
+    
+    void     Str2Int(const TDesC8& aBuf, TUint32& aValue);
+    
+    TBuf8<16> Bool2Str(const TBool& aValue);
+    
+    TBuf8<16> Int2Str(const TInt& aValue);
+public:
+
+    CArrayPtrFlat<CSamplerPluginInterface>* iPluginArray;
+    
+    // Asynchronous loader for the sampler plug-ins.
+    CSamplerPluginLoader*     iPluginLoader;
+    
+    // UID of the selected plugin in the container's lbx.
+    TUid                      iSelectedPluginUid;
+    
+    // shared sample stream for all plugin samplers
+    CProfilerSampleStream&    iStream;
+
+private:
+	MSamplerControllerObserver* iObserver;
+};
+
+/**
+* Interface for SamplerPluginLoader observer. MSamplerPluginLoadObserver gets
+* notifications when plugins are loaded.
+*
+* @lib ProfilerEngine.exe/.lib
+* @since Series60_30.1
+*/
+
+class MSamplerControllerObserver
+    {
+    public: // New
+
+        //CSamplerController calls this function when each plug-in is loaded or
+        //loading is finished..
+        
+        virtual void HandleSamplerControllerReadyL() = 0;
+        virtual void HandleError(TInt aError) = 0;
+    };
+    
+#endif	// __SAMPLERCONTROLLER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/inc/SamplerPluginLoader.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,291 @@
+/*
+* 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  SAMPLERPLUGINLOADER_H
+#define  SAMPLERPLUGINLOADER_H
+
+// INCLUDES
+#include    <e32base.h>
+#include    <ecom/implementationinformation.h>
+#include 	<piprofiler/ProfilerConfig.h>
+#include 	<piprofiler/SamplerPluginInterface.h>
+
+// CONSTANTS
+// Value for a to b comparison result when logically a == b.
+const TInt KSamplerComparisonEqual     = 0;
+
+// Value for a to b comparison result when logically a < b.
+const TInt KSamplerComparisonBefore    = -1;
+
+// Value for a to b comparison result when logically a > b.
+const TInt KSamplerComparisonAfter     = 1;
+
+// CLASS DEFINITIONS
+class CSamplerPluginInterface;
+class MSamplerPluginLoadObserver;
+class REComSession;
+
+/**
+* CSamplerPluginLoader. Mechanism used to load plugins asynchronously. Uses
+* MSamplerPluginLoadObserver as a callback.
+*
+* @lib ProfilerEngine.exe/.lib???????????
+* @since Series60_30.1
+*/
+class CSamplerPluginLoader : public CActive
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        *
+        * @param aAppUi Pointer to application UI. Does not take ownership.
+        */
+        static CSamplerPluginLoader* NewL();
+
+        /**
+        * Destructor
+        */
+        ~CSamplerPluginLoader();
+
+    private: // Internal construction
+
+        /**
+        * Default C++ contructor
+        */
+        CSamplerPluginLoader();
+
+        /**
+        * Symbian OS default constructor
+        * @return void
+        */
+        void ConstructL();
+
+    public: // API
+
+        /**
+        * Starts loading GS plug-ins asynchronously. Will call
+        * MSamplerPluginLoadObserver::HandlePluginLoaded() each time a plug-in is
+        * loaded and when all plugins are loaded.
+        *
+        * CSamplerPluginLoader transfers the ownership of each loaded plugin view to
+        * CAknViewAppUi. It is client's responsibility to remove the views from
+        * CAknViewAppUi and delete the plugins if necessary.
+        *
+        * @param aInterfaceUid Uid ofthe interfaces to be loaded.
+        * @param aParentUid Uid of the parent. Only children of this parent
+        *        will be loaded.
+        * @param aPluginArray An array for the loaded GS plug-ins.
+        *        CSamplerPluginLoader does not take the ownership of this array.
+        */
+        void LoadAsyncL( CArrayPtrFlat<CSamplerPluginInterface>* aPluginArray );
+
+        /**
+        * Load a specific plugin instance synchronously.
+        *
+        * @param aInterfaceUid Uid ofthe interfaces to be loaded.
+        * @param aImplementationUid Uid of the implementation to load
+        */
+        void LoadSyncL( CArrayPtrFlat<CSamplerPluginInterface>* aPluginArray );
+
+        /**
+        * Sets observer for this loader. Only one observer per loader in one
+        * time is possible.
+        */
+        void SetObserver(MSamplerPluginLoadObserver* aObserver);
+
+        /**
+        * Aborts asynchronous loading of the GS plug-ins.
+        */
+        void AbortAsyncLoad();
+
+
+        /**
+        * Sorts the plugin array.
+        *
+        * Sorting criterias:
+        *
+        * 1. Order number if provider category is Internal.
+        * 2. Provider category. Precedence as follows:
+        *       1. KGSPluginProviderInternal
+        *       2. EGSPluginProviderOEM
+        *       3. EGSPluginProviderOperator
+        *       4. EGSPluginProvider3rdParty
+        * 3. Alphabetical
+        *
+        * @param aPlugins The array which will be sorted.
+        */
+        void SortPluginsL( CArrayPtrFlat<CSamplerPluginInterface>* aPlugins );
+
+    private: // Internal methods
+
+        /**
+        * Starts loading next plugin.
+        */
+        void LoadNextPluginL();
+
+        /**
+        * Creates a plugin instance from given UID. Ownership is transferred.
+        */
+        CSamplerPluginInterface& CreatePluginInstanceL( 
+                const CImplementationInformation& aImpInfo );
+
+        /**
+        * Notifies MPluginLoadObserver.
+        */
+        void NotifyProgress();
+
+        /**
+        * Notifies MPluginLoadObserver.
+        */
+        void NotifyFinished();
+
+        /**
+        * Wait for the next round of CActive execution.
+        */
+        void CompleteOwnRequest();
+
+        // Insertion function used by sorting:
+
+        /**
+        * Inserts plugin in the correct position in the array using sorting 
+        * criterias. Assumes aPlugins is ordered.
+        *
+        * @param aPlugin The plugin to be inserted.
+        * @param aPlugins Array in which the plugin is inserted into the
+        *        corresponding location.
+        */
+        void InsertPluginInOrderL(
+            CSamplerPluginInterface* aPlugin,
+            CArrayPtrFlat<CSamplerPluginInterface>* aPlugins );
+
+        // Comparison functions:
+
+        /**
+        * Compares plugins according to comparison criterias.
+        * 
+        * Note: GS internal comparison constants such as KGSComparisonEqual are 
+        * different from the ones outputted by this function. This is because 
+        * this function is also usable by RArray sort -functionality but BC 
+        * cannot be broken in GS.
+        * 
+        * @return Negative value: If aFirst before aSecond.
+        *                      0: If equal.
+        *         Positive value: If aSecond before aFirst.
+        */
+        static TInt Compare( const CSamplerPluginInterface& aFirst,    
+                             const CSamplerPluginInterface& aSecond );
+
+        /**
+        *
+        * @return   KGSComparisonEqual  = equal indexes
+        *           KGSComparisonBefore = aFirst is before aSecond
+        *           KGSComparisonAfter  = aFirst is after aSecond
+        */
+
+        static TInt CompareIndex( 
+                const CSamplerPluginInterface& aFirst,
+                const CSamplerPluginInterface& aSecond );
+
+    private: // Utility methods
+
+        /**
+        * Parses descriptor to UID.
+        */
+        static TInt ParseToUid( const TDesC8& aSource, TUid& aTarget );
+
+        /**
+        * Parsers plugin's order number
+        */
+        static TInt ParseOrderNumber( const TDesC8& aSource, TInt& aOrderNumber );
+
+    private: // From CActive
+
+        /**
+        * See base class.
+        */
+        void RunL();
+
+        /**
+        * See base class.
+        */
+        TInt RunError( TInt aError );
+
+        /**
+        * See base class.
+        */
+        void DoCancel();
+
+    private: // Data
+        // Pluginloader goes through this array and loads the plugins into
+        // iPluginArray if they fulfill the criterias.
+        RImplInfoPtrArray iImplInfoArray;
+
+        // Used as an iterator to maintain location in iImplInfoArray.
+        TInt iImplInfoArrayIterator;
+
+        // Array of loaded plugins.Plugins are owned by iAppUi. Only the array
+        // pointers are owned by this class and therefore only reset array.
+        CArrayPtrFlat<CSamplerPluginInterface>* iPluginArray;
+
+        // Pointer to observer. Not owned.
+        MSamplerPluginLoadObserver* iObserver;
+
+        // Number of RunL calls.
+        TInt iRunLDebugCount;
+
+    };
+
+
+/**
+* Interface for SamplerPluginLoader observer. MSamplerPluginLoadObserver gets
+* notifications when plugins are loaded.
+*
+* @lib ProfilerEngine.exe/.lib???????????
+* @since Series60_30.1
+*/
+
+class MSamplerPluginLoadObserver
+    {
+    public: // Enums
+        enum KSamplerPluginLoaderStatus
+            {
+            // One plugin loaded successfully, continue to next.
+            ESamplerSuccess,
+            // Loading one plugin failed, contiue to next.
+            ESamplerFail,
+            // Client called AbortAsyncLoad(), finished loading.
+            ESamplerAborted,
+            // All plugins loaded successfully, finished loading.
+            ESamplerFinished,
+            // Severe error with loader, finished loading.
+            ESamplerError
+            };
+
+    public: // New
+
+        //CSamplerPluginLoader calls this function when each plug-in is loaded or
+        //loading is finished..
+        
+        IMPORT_C virtual void HandlePluginLoaded(
+            KSamplerPluginLoaderStatus aStatus ) = 0;
+    };
+
+
+#endif // SAMPLERPLUGINLOADER_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/inc/WriterController.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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 __WRITERCONTROLLER_H__
+#define __WRITERCONTROLLER_H__
+
+// system includes
+#include <utf.h>
+#include <e32cmn.h>
+
+
+// The user-interface to the sampling device driver sued by the profiling engine
+// user includes
+#include <piprofiler/ProfilerConfig.h>
+#include <piprofiler/ProfilerVersion.h>
+#include <piprofiler/WriterPluginInterface.h>
+
+#include "WriterPluginLoader.h"
+
+/*
+ *	Forward declarations
+ */
+class TBapBuf;
+class CWriterPluginLoader;
+class CWriterPluginInterface;
+
+/**
+ * The writer controller for handling the available Data writer plugins.
+ */
+  
+class CWriterController : public CBase, MWriterPluginLoadObserver
+	{
+	
+public:
+	static CWriterController* NewL(CProfilerSampleStream& aStream);
+	void ConstructL();
+	
+	CWriterController(CProfilerSampleStream& aStream);
+    ~CWriterController();
+	
+	/** 
+	 * 
+	 * Methods for user mode sampling
+	 * 
+	 **/
+	
+	/** Initialise the user mode samplers **/					
+	void InitialiseWriterListL();
+	
+	/* Overrider of MSamplerPluginLoaderObserver class **/
+	void HandlePluginLoaded( KWriterPluginLoaderStatus /*aStatus*/ );
+	
+	/* returns the matching plugin Uid */
+	TUid GetPluginUID(TInt traceId);
+	
+	CWriterPluginInterface* GetActiveWriter();
+	
+	 /** Returns the sampler type (kernel/user) **/
+	TUint32 GetWriterType(TUint32 samplerId);
+
+	/** Set additional settings for a trace **/			
+	TInt AdditionalUserTraceSettings(TInt traceId, TInt settings);
+
+	/** Set data stream for samplers **/
+	//void SetSampleStream(RProfilerSampleStream* iStream);
+
+	TInt StartSelectedPlugin();
+
+	void StopSelectedPlugin();
+
+	/** Set selected plugin active **/
+	void SetPluginActive(TUid uid, const TWriterPluginValueKeys aKey);
+
+	TInt SetPluginSettings(TUid aUid, TDes& aDes);
+	
+	/** Get settings for a specific plugin **/
+	void GetPluginSettings(TUid uid, TDes& aVal);
+	
+	/** Request stream read **/
+	//void FillThisStreamBuffer(TBapBuf* aBuffer, TRequestStatus& aStatus);
+	
+	CWriterPluginInterface* GetPlugin(TUid aUid);
+	
+	CArrayPtrFlat<CWriterPluginInterface>* GetPluginList();
+	
+	void InitialisePluginStream();
+public:
+    CArrayPtrFlat<CWriterPluginInterface>* iPluginArray;
+    
+    // Asynchronous loader for the writer plug-ins.
+    CWriterPluginLoader* iPluginLoader;
+    
+    // UID of the selected plugin in the container's lbx.
+    TUid iSelectedPluginUid;
+    
+    CProfilerSampleStream& iStream;
+};
+
+	
+#endif	// __WRITERCONTROLLER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/inc/WriterPluginLoader.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,302 @@
+/*
+* 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  WRITERPLUGINLOADER_H
+#define  WRITERPLUGINLOADER_H
+
+// INCLUDES
+#include    <e32base.h>
+#include    <ecom/implementationinformation.h>
+#include 	<piprofiler/ProfilerConfig.h>
+#include 	<piprofiler/WriterPluginInterface.h>
+#include    <piprofiler/ProfilerTraces.h>
+
+// CONSTANTS
+
+// Value for a to b comparison result when logically a == b.
+const TInt KWriterComparisonEqual     = 0;
+
+// Value for a to b comparison result when logically a < b.
+const TInt KWriterComparisonBefore    = -1;
+
+// Value for a to b comparison result when logically a > b.
+const TInt KWriterComparisonAfter     = 1;
+
+// CLASS DEFINITIONS
+class CWriterPluginInterface;
+class MWriterPluginLoadObserver;
+class REComSession;
+
+/**
+* CWriterPluginLoader. Mechanism used to load plugins asynchronously. Uses
+* MWriterPluginLoadObserver as a callback.
+*
+* @lib ProfilerEngine.exe/.lib???????????
+* @since Series60_30.1
+*/
+class CWriterPluginLoader : public CActive
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        *
+        * @param aAppUi Pointer to application UI. Does not take ownership.
+        */
+        static CWriterPluginLoader* NewL();
+
+        /**
+        * Destructor
+        */
+        ~CWriterPluginLoader();
+
+    private: // Internal construction
+
+        /**
+        * Default C++ contructor
+        */
+        CWriterPluginLoader();
+
+        /**
+        * Symbian OS default constructor
+        * @return void
+        */
+        void ConstructL();
+
+    public: // API
+
+        /**
+        * Starts loading GS plug-ins asynchronously. Will call
+        * MWriterPluginLoadObserver::HandlePluginLoaded() each time a plug-in is
+        * loaded and when all plugins are loaded.
+        *
+        * CWriterPluginLoader transfers the ownership of each loaded plugin view to
+        * CAknViewAppUi. It is client's responsibility to remove the views from
+        * CAknViewAppUi and delete the plugins if necessary.
+        *
+        * @param aInterfaceUid Uid ofthe interfaces to be loaded.
+        * @param aParentUid Uid of the parent. Only children of this parent
+        *        will be loaded.
+        * @param aPluginArray An array for the loaded GS plug-ins.
+        *        CWriterPluginLoader does not take the ownership of this array.
+        */
+        void LoadAsyncL( CArrayPtrFlat<CWriterPluginInterface>* aPluginArray );
+
+        /**
+        * Load a specific plugin instance synchronously.
+        *
+        * @param aInterfaceUid Uid ofthe interfaces to be loaded.
+        * @param aImplementationUid Uid of the implementation to load
+        */
+        CWriterPluginInterface& LoadSyncL( TUid aImplementationUid );
+
+        /**
+        * Sets observer for this loader. Only one observer per loader in one
+        * time is possible.
+        */
+        void SetObserver(MWriterPluginLoadObserver* aObserver);
+
+        /**
+        * Aborts asynchronous loading of the GS plug-ins.
+        */
+        void AbortAsyncLoad();
+
+        /**
+        * Sorts the plugin array.
+        *
+        * Sorting criterias:
+        *
+        * 1. Order number if provider category is Internal.
+        * 2. Provider category. Precedence as follows:
+        * 3. Alphabetical
+        *
+        * @param aPlugins The array which will be sorted.
+        */
+        void SortPluginsL( CArrayPtrFlat<CWriterPluginInterface>* aPlugins );
+
+    private: // Internal methods
+
+        /**
+        * Starts loading next plugin.
+        */
+        void LoadNextPluginL();
+
+        /**
+        * Creates a plugin instance from given UID. Ownership is transferred.
+        */
+        CWriterPluginInterface& CreatePluginInstanceL( 
+                const CImplementationInformation& aImpInfo );
+
+        /**
+        * Notifies MGSPluginLoadObserver.
+        */
+        void NotifyProgress();
+
+        /**
+        * Notifies MGSPluginLoadObserver.
+        */
+        void NotifyFinished();
+
+        /**
+        * Wait for the next round of CActive execution.
+        */
+        void CompleteOwnRequest();
+
+        // Insertion function used by sorting:
+
+        /**
+        * Inserts plugin in the correct position in the array using sorting 
+        * criterias. Assumes aPlugins is ordered.
+        *
+        * @param aPlugin The plugin to be inserted.
+        * @param aPlugins Array in which the plugin is inserted into the
+        *        corresponding location.
+        */
+        void InsertPluginInOrderL(
+        		CWriterPluginInterface* aPlugin,
+            CArrayPtrFlat<CWriterPluginInterface>* aPlugins );
+
+        // Comparison functions:
+
+        /**
+        * Compares plugins according to comparison criterias.
+        * 
+        * Note: GS internal comparison constants such as KGSComparisonEqual are 
+        * different from the ones outputted by this function. This is because 
+        * this function is also usable by RArray sort -functionality but BC 
+        * cannot be broken in GS.
+        * 
+        * @return Negative value: If aFirst before aSecond.
+        *                      0: If equal.
+        *         Positive value: If aSecond before aFirst.
+        */
+        static TInt Compare( const CWriterPluginInterface& aFirst,    
+                             const CWriterPluginInterface& aSecond );
+
+        /**
+        *
+        * @return   KGSComparisonEqual  = equal indexes
+        *           KGSComparisonBefore = aFirst is before aSecond
+        *           KGSComparisonAfter  = aFirst is after aSecond
+        */
+
+        static TInt CompareIndex( 
+                const CWriterPluginInterface& aFirst,
+                const CWriterPluginInterface& aSecond );
+
+    private: // Utility methods
+
+        /**
+        * Parses descriptor to UID.
+        */
+        static TInt ParseToUid( const TDesC8& aSource, TUid& aTarget );
+
+        /**
+        * Parsers plugin's order number
+        */
+        static TInt ParseOrderNumber( const TDesC8& aSource, TInt& aOrderNumber );
+
+        /**
+        * Print debug information.
+        */
+        static void PrintInfoDebug( const CImplementationInformation& aInfo,
+                                    TInt aIterator,
+                                    TInt aPluginCount );
+        
+        /**
+         * Display loading error popup message.
+         */
+        void DisplayErrorPopupL( TInt aError, 
+                                 const CImplementationInformation* aInfo );
+        
+    private: // From CActive
+
+        /**
+        * See base class.
+        */
+        void RunL();
+
+        /**
+        * See base class.
+        */
+        TInt RunError( TInt aError );
+
+        /**
+        * See base class.
+        */
+        void DoCancel();
+
+    private: // Data
+
+
+        // Pluginloader goes through this array and loads the plugins into
+        // iPluginArray if they fulfill the criterias.
+        RImplInfoPtrArray iImplInfoArray;
+
+        // Used as an iterator to maintain location in iImplInfoArray.
+        TInt iImplInfoArrayIterator;
+
+        // Array of loaded plugins.Plugins are owned by iAppUi. Only the array
+        // pointers are owned by this class and therefore only reset array.
+        CArrayPtrFlat<CWriterPluginInterface>* iPluginArray;
+
+        // Pointer to observer. Not owned.
+        MWriterPluginLoadObserver* iObserver;
+
+        // Number of RunL calls.
+        TInt iRunLDebugCount;
+    };
+
+
+/**
+* Interface for WriterPluginLoader observer. MWriterPluginLoadObserver gets
+* notifications when plugins are loaded.
+*
+* @lib ProfilerEngine.exe/.lib???????????
+* @since Series60_30.1
+*/
+
+class MWriterPluginLoadObserver
+    {
+    public: // Enums
+        enum KWriterPluginLoaderStatus
+            {
+            // One plugin loaded successfully, continue to next.
+            EWriterSuccess,
+            // Loading one plugin failed, contiue to next.
+            EWriterFail,
+            // Client called AbortAsyncLoad(), finished loading.
+            EWriterAborted,
+            // All plugins loaded successfully, finished loading.
+            EWriterFinished,
+            // Severe error with loader, finished loading.
+            EWriterError
+            };
+
+    public: // New
+
+        //CWriterPluginLoader calls this function when each plug-in is loaded or
+        //loading is finished..
+        
+        IMPORT_C virtual void HandlePluginLoaded(
+            KWriterPluginLoaderStatus aStatus ) = 0;
+    };
+
+
+#endif // WRITERPLUGINLOADER_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/src/ProfilerEngine.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1515 @@
+/*
+* 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 <e32cons.h>
+#include <e32base.h>
+#include <f32file.h>
+#include <c32comm.h>
+#include <s32file.h>
+#include <pathinfo.h>
+#include <s32mem.h>
+#include <bautils.h>
+#include <sysutil.h>
+#include <piprofiler/ProfilerConfig.h>
+#include "ProfilerEngine.h"
+#include <piprofiler/ProfilerTraces.h>
+
+// properties
+const TUid KEngineStatusPropertyCat={0x2001E5AD};
+enum TEnginePropertyKeys
+	{
+	EProfilerEngineStatus = 8,
+	EProfilerErrorStatus
+	};
+
+static _LIT_SECURITY_POLICY_PASS( KAllowAllPolicy );
+
+// CONSTANTS 
+const TInt KStreamBufferSize = 32768;
+const TInt KSavedLineCount = 64;
+const TInt KFileNameBufSize = 128;
+// Use this UID if plugin belongs to DebOutWriterPlugin:
+const TUid KDebOutWriterPluginUid = { 0x2001E5BA };
+// Use this UID if plugin belongs to MmcOutWriterPlugin:
+const TUid KDiskWriterPluginUid = { 0x2001E5BB };
+
+// LITERALS
+_LIT8(KGenericTraceOutput, "output_type");
+_LIT8(KGenericTraceFilePrefix, "file_prefix");
+_LIT8(KGenericTraceFileSaveDrive, "save_file_location");
+_LIT8(KGenericTimedProfilingPeriod, "profiling_period");
+_LIT8(KEquals, "=");
+_LIT8(KNewLineSeparator, "\n");
+_LIT8(KProfilerVersionTag, "version");
+_LIT8(KEndMark, "[end]");
+_LIT8(KOutputToDebugOutput, "debug_output");
+
+/** 
+ * 
+ * The controller class used to provide the Profiler functions. 
+ * This runs as a server in the engine thread
+ * 
+ */
+class CPServer : public CServer2, public MProfilerController
+    {
+public:
+    static MProfilerController*		NewL(TInt aPriority, MProfilerEngine& aEngine);
+
+private:
+                        CPServer(TInt aPriority, MProfilerEngine& aEngine);
+    void				Release();
+    CSession2*			NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
+    
+public:
+    static TInt         iClientCount;
+    };
+
+TInt CPServer::iClientCount = 0;
+
+// The session class used by the server controller
+class CPSession : public CSession2
+    {
+private:
+    inline const CPServer&	Server() const;
+    void					ServiceL(const RMessage2& aMessage);
+    };
+
+/*
+ *
+ *	CProfiler class implementation
+ *
+ */
+// --------------------------------------------------------------------------------------------
+CProfiler* CProfiler::NewLC(const TDesC& aSettingsFile)
+    {
+	CProfiler* self = new(ELeave) CProfiler(aSettingsFile);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+    }
+
+// --------------------------------------------------------------------------------------------
+CProfiler::CProfiler(const TDesC& aSettingsFile) : 
+    iSettingsFileLocation(aSettingsFile)
+	{
+	// define property for Profiler Engine status, UI may read it for control purposes
+	if ( RProperty::Define(KEngineStatusPropertyCat, 
+	        EProfilerEngineStatus, 
+	        RProperty::EInt, 
+	        KAllowAllPolicy, 
+	        KAllowAllPolicy, 
+	        0) != KErrAlreadyExists )
+	    {
+	    LOGTEXT(_L("CProfiler::CProfiler - status property already defined"));
+	    }
+
+	if ( RProperty::Define(KEngineStatusPropertyCat, 
+	        EProfilerErrorStatus, 
+            RProperty::EInt, 
+            KAllowAllPolicy, 
+            KAllowAllPolicy, 
+            0) != KErrAlreadyExists )
+        {
+        LOGTEXT(_L("CProfiler::CProfiler - status property already defined"));
+        }
+
+	// attach to own property
+	iEngineStatus.Attach(KEngineStatusPropertyCat, EProfilerEngineStatus);
+	// set status idle
+	iEngineStatus.Set(KEngineStatusPropertyCat, EProfilerEngineStatus, RProfiler::EIdle);
+	
+    // attach to own property
+    iUpdateStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus);
+    // set status idle
+    iUpdateStatus.Set(KEngineStatusPropertyCat, EProfilerErrorStatus, EFalse);
+	}
+
+// --------------------------------------------------------------------------------------------
+CProfiler::~CProfiler()
+    {
+	LOGTEXT(_L("CProfiler::~CProfiler - Enter"));
+
+	// delete error checker
+    if(iErrorChecker)
+        {
+        iErrorChecker->Cancel();
+        delete iErrorChecker;
+        iErrorChecker = NULL;
+        }
+	
+	// delete settings array
+	if(iDefaultSamplerAttributesArray)
+	    {
+	    iDefaultSamplerAttributesArray->Reset();
+	    delete iDefaultSamplerAttributesArray;
+	    iDefaultSamplerAttributesArray = NULL;
+	    }
+
+    // delete settings file raw line array
+    if(iSavedLineArray)
+        {
+        iSavedLineArray->Reset();
+        delete iSavedLineArray;
+        iSavedLineArray = NULL;
+        }
+		
+	// delete sampler controller, cleans up the sampler plugin instances
+	if(iSamplerHandler)
+		{
+		delete iSamplerHandler;
+		iSamplerHandler = NULL;
+		}
+	// delete writer controller, cleans up the writer plugin instances
+	if(iWriterHandler)
+		{
+		delete iWriterHandler;
+		iWriterHandler = NULL;
+		}
+
+    // delete user side sampler stream 
+	if(iUserStream)
+		{
+		delete iUserStream;
+		iUserStream = NULL;
+		}
+
+	// close engine status property
+	iEngineStatus.Close();
+	if (RProperty::Delete(KEngineStatusPropertyCat, EProfilerEngineStatus) != KErrNotFound)
+	    {
+	    LOGTEXT(_L("CProfiler::~CProfiler - cannot close status property"));
+	    }
+    // close engine update property
+    iUpdateStatus.Close();
+    if (RProperty::Delete(KEngineStatusPropertyCat, EProfilerErrorStatus) != KErrNotFound)
+        {
+        LOGTEXT(_L("CProfiler::~CProfiler - cannot close update property"));
+        }
+    
+    // close server process
+    if (iServer)
+        {
+        LOGTEXT(_L("CProfiler::~CProfiler - Releasing server"));
+        iServer->Release();        
+        }
+    
+    if( iTimer )
+        {
+        iTimer->Cancel();
+        delete iTimer;
+        iTimer = 0;
+        }
+    
+	LOGTEXT(_L("CProfiler::~CProfiler - Finished"));
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfiler::ConstructL()
+    {
+	LOGTEXT(_L("CProfiler::ConstructL - Enter"));
+	TInt err(0);
+	TLex lex;
+	
+	if ( iSettingsFileLocation.CompareF(KNullDesC) != 0 )
+	    {
+        lex=(iSettingsFileLocation);
+        // parse the first command line argument, the command itself
+        lex.Mark();
+        lex.SkipCharacters();
+        if(lex.TokenLength() != 0)
+            {
+            // there is another item in the list
+            TPtrC filename = lex.MarkedToken();
+            LOGSTRING2("filename %S", &filename);
+            lex.SkipSpace();
+            lex.Mark();
+            lex.SkipCharacters();
+            if(lex.TokenLength() != 0)
+                {
+                TPtrC boot = lex.MarkedToken();
+                LOGTEXT(_L("boot mode"));
+                }
+            }
+	    }
+	
+    // create new sampler stream instance
+    iUserStream = CProfilerSampleStream::NewL(KStreamBufferSize);
+    if(!iUserStream)
+        {
+        LOGTEXT(_L("Profiler engine cannot reserve memory"));
+        User::Leave(KErrCancel);   // operation cancelled
+        }
+	
+    // engine status checker
+    iErrorChecker = CProfilerErrorChecker::NewL();
+    iErrorChecker->SetObserver(this);
+
+	// create and initiate plug-in controller instances
+    iSamplerHandler = CSamplerController::NewL(*iUserStream);
+    iWriterHandler = CWriterController::NewL(*iUserStream);
+    
+    iWriterHandler->InitialiseWriterListL();
+    
+    // set engine as an observer to sampler controller to get the notification of plugin load has ended
+    iSamplerHandler->SetObserver(this);
+    
+    // default settings from sampler plugins, maximum 20 sampler plugins
+    iDefaultSamplerAttributesArray = new(ELeave) CArrayFixFlat<TSamplerAttributes>(20); 
+    
+    // set profiler status to initializing
+    iState = RProfiler::EInitializing;
+	iEngineStatus.Set(RProfiler::EInitializing);
+	
+	// set default general settings, will be overdriven if changed in settings file
+	iGeneralAttributes.iTraceOutput.Copy(KDefaultTraceOutput);
+	iGeneralAttributes.iTraceFilePrefix.Copy(KDefaultTraceFilePrefix);
+	iGeneralAttributes.iSaveFileDrive.Copy(KDefaultTraceFileSaveDrive);
+	iGeneralAttributes.iTimedSamplingPeriod = KDefaultTimedSamplingPeriod;
+	
+	RThread me;
+	
+	me.SetPriority(EPriorityRealTime);
+
+	err = KErrGeneral;
+	TInt count = 0;
+
+	while(err != KErrNone && count < 30)
+	    {
+		err = User::RenameThread(KProfilerName);
+		if(err != KErrNone)
+		    {
+		    LOGSTRING2("CProfiler: error renaming the thread, err %d", err);
+			User::Leave(err);
+		    }
+		else break;
+	    }
+
+	// set settings file loading preferences
+	iSettingsFileLoaded = EFalse;
+
+	// change status property to idle since initialization successfull
+	iState = RProfiler::EIdle;
+	if( iEngineStatus.Set((TInt)RProfiler::EIdle) != KErrNone )
+	    {
+	    LOGTEXT(_L("CProfiler::ConstructL - engine status property change failed"));
+	    }
+
+    if( iUpdateStatus.Set(EFalse) != KErrNone )
+        {
+        LOGTEXT(_L("CProfiler::ConstructL - engine status property change failed"));
+        }
+
+	// create a server instance for clients to communicate with 
+	iServer = CPServer::NewL(10,*this);
+	
+	// close the handle 
+	me.Close();
+	
+	iTimer = CProfilerTimer::NewL(CActive::EPriorityStandard, *this);
+	
+	LOGTEXT(_L("CProfiler::ConstructL - Exit"));
+	
+    }
+
+CProfilerSampleStream* CProfiler::GetSamplerStream()
+    {
+    return iUserStream;
+    }
+
+void CProfiler::HandleSamplerControllerReadyL()
+    {
+    // load settings
+    // check if settings file already loaded
+    if(!iSettingsFileLoaded)
+        {
+        // load default settings file
+        LoadSettingsL();
+
+        iSettingsFileLoaded = ETrue;
+        }
+    
+    // notify engine's launcher(UI or PIProfilerLauncher) to continue launch
+    RProcess::Rendezvous(KErrNone); 
+    }
+
+void CProfiler::NotifyRequesterForSettingsUpdate()
+    {
+    // set update status P&S property true => update needed on UI side
+    iUpdateStatus.Set(ETrue);
+    }
+
+void CProfiler::HandleProfilerErrorChangeL(TInt aError)
+    {
+    LOGSTRING2("CProfiler::HandleProfilerErrorChangeL() - error received, %d", aError);
+    
+    // check if profiler running
+    if(iState == RProfiler::ERunning)
+        {
+        // stop profiler if error occurred during the trace
+        iEngineStatus.Set(aError);
+        
+        // stop samplers, NOTE! Writer plugins not stopped since 
+        iSamplerHandler->StopSamplerPlugins();
+
+        // stop debug output plugin and write the rest of the trace data to output
+        if(iGeneralAttributes.iTraceOutput.CompareF(KOutputToDebugOutput) == 0)   
+            {
+            // write the rest of trace data only if debug output selected
+            iWriterHandler->StopSelectedPlugin();
+            }
+        LOGSTRING2("CProfiler::HandleProfilerErrorChangeL - sampling stopped, going to state %d", RProfiler::EIdle);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Gets a value from settings file for certain attribute.
+// ----------------------------------------------------------------------------
+void CProfiler::DoGetValueFromSettingsArray(CDesC8ArrayFlat* aLineArray, const TDesC8& aAttribute, TDes8& aValue)
+    {
+    LOGTEXT(_L("CProfiler::DoGetValueFromSettingsFile()"));
+    _LIT8(KSettingItemSeparator, "=");
+    
+    // read a line of given array
+    for (TInt i=0; i<aLineArray->MdcaCount(); i++)
+        {
+        // check if this line has a separator
+        TInt sepPos = aLineArray->MdcaPoint(i).Find(KSettingItemSeparator);
+        if (sepPos > 0)
+            {
+            // check that the element matches
+            if (aLineArray->MdcaPoint(i).Left(sepPos).CompareF(aAttribute) == 0)
+                {
+                // get the value
+                aValue.Copy(aLineArray->MdcaPoint(i).Right(aLineArray->MdcaPoint(i).Length()-sepPos-1));
+                break;
+                }
+            }
+        }
+    }
+
+void CProfiler::DoGetValueFromSettingsArray(CDesC8ArrayFlat* aLineArray, const TDesC8& aAttribute, TInt& aValue)
+    {
+    LOGTEXT(_L("CProfiler::DoGetValueFromSettingsFile()"));
+    _LIT8(KSettingItemSeparator, "=");
+    
+    // read a line of given array
+    for (TInt i=0; i<aLineArray->MdcaCount(); i++)
+        {
+        // check if this line has a separator
+        TInt sepPos = aLineArray->MdcaPoint(i).Find(KSettingItemSeparator);
+        if (sepPos > 0)
+            {
+            // check that the element matches
+            if (aLineArray->MdcaPoint(i).Left(sepPos).CompareF(aAttribute) == 0)
+                {
+                // get the value                
+                TLex8 parser(aLineArray->MdcaPoint(i).Right(aLineArray->MdcaPoint(i).Length()-sepPos-1));
+                parser.Val(aValue);
+                break;
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+TInt CProfiler::GetSamplerAttributesL(const RMessage2& aMessage)
+    {
+    TInt err(KErrNone);
+    TInt pos(0);
+
+    // get sampler count
+    TInt count(iDefaultSamplerAttributesArray->Count());
+
+    // write each of the default sampler plugin setting attributes over client-server session 
+    for (TInt i(0); i<count; ++i)
+       {
+       TSamplerAttributes attr = iDefaultSamplerAttributesArray->At(i);
+       TPckgC<TSamplerAttributes> attrPckg(attr);
+       
+       // write a TSamplerAttributes container at a time
+       aMessage.WriteL(0, attrPckg, pos);
+       pos += attrPckg.Length();
+       }
+
+    aMessage.Complete(err);
+    return err;
+    }
+
+// --------------------------------------------------------------------------------------------
+TInt CProfiler::SetSamplerAttributesL(const RMessage2& aMessage)
+    {
+    TSamplerAttributes attr;
+    TPckg<TSamplerAttributes> inAttr(attr);
+    
+    TInt err = aMessage.Read(0, inAttr, 0);    
+    
+    // apply the changes directly to a plugin
+    iSamplerHandler->SetSamplerSettingsL(attr.iUid, attr);
+    
+    aMessage.Complete(err);
+    return err;
+    }
+
+// --------------------------------------------------------------------------------------------
+TInt CProfiler::GetGeneralAttributesL(const RMessage2& aMessage)
+    {
+    TPckgBuf<TGeneralAttributes> generalSettings( iGeneralAttributes );
+    
+    // write general attributes over client-server session
+    TInt err = aMessage.Write(0, generalSettings);
+    
+    aMessage.Complete(err);
+    return err;
+    }
+
+// --------------------------------------------------------------------------------------------
+TInt CProfiler::SetGeneralAttributesL(const RMessage2& aMessage)
+    {
+    // read the general settings from message
+    TGeneralAttributes attr;
+    TPckg<TGeneralAttributes> inPckg(attr);
+    TInt err = aMessage.Read(0, inPckg, 0);
+    
+    // copy to the general attributes
+    iGeneralAttributes.iSaveFileDrive.Copy(attr.iSaveFileDrive);
+    iGeneralAttributes.iTraceFilePrefix.Copy(attr.iTraceFilePrefix);
+    iGeneralAttributes.iTraceOutput.Copy(attr.iTraceOutput);
+    iGeneralAttributes.iTimedSamplingPeriod = attr.iTimedSamplingPeriod;
+    
+    aMessage.Complete(err);
+    return err;
+    }
+
+TInt CProfiler::GetSamplerAttributeCountL(const RMessage2& aMessage)
+    {
+    // get the plugin array count and wrap it to TPckgBuf<>
+    TPckgBuf<TInt> attributeCount(iDefaultSamplerAttributesArray->Count());
+    
+    // write general attributes over client-server session
+    TInt err = aMessage.Write(0, attributeCount);
+    
+    aMessage.Complete(err);
+    return err;
+    }
+
+TInt CProfiler::RefreshStatus(const RMessage2& aMessage)
+    {
+    TInt err(KErrNone);
+    
+    // update profiler status for requester
+    iEngineStatus.Set(iState);
+    
+    aMessage.Complete(err);
+    return err;
+    }
+
+// --------------------------------------------------------------------------------------------
+TInt CProfiler::LoadSettingsL(/*const TDesC& configFile*/)
+    {
+	RFs fileServer;
+	RFile file;
+	TInt err(KErrNone);
+    
+	// connect to file server 
+	err = fileServer.Connect();
+	
+	// check if file server can be connected
+	if (err != KErrNone)
+	    {
+		// file server couldn't be connected
+		return KErrGeneral;
+	    }
+
+	// check if settings file location length reasonable
+	if ( iSettingsFileLocation.CompareF(KNullDesC) == 0 )
+	    {
+		// open the file with the default path and name
+		TBuf<256> pathAndName;
+		pathAndName.Append(PathInfo::PhoneMemoryRootPath());
+		pathAndName.Append(KProfilerSettingsFileName);
+		iSettingsFileLocation.Copy(pathAndName);
+		LOGTEXT(_L("CProfiler::LoadSettings - Opening settings file with name (with the default path)"));
+		LOGTEXT(pathAndName);
+	    }
+
+    // open the file with the given path and name
+    err = file.Open(fileServer,iSettingsFileLocation,EFileRead);
+
+	
+	// check if RFile::Open() returned error
+	if (err != KErrNone)
+	    {
+		// file couldn't be opened
+		LOGTEXT(_L("CProfiler::LoadSettings - Failed to open settings, using default"));
+
+		// check if settings already loaded
+		if(iDefaultSamplerAttributesArray->Count() > 0)
+		    {
+		    // reset default settings array
+		    iDefaultSamplerAttributesArray->Reset();
+		    }
+		
+		// load default settings, instead of settings file ones
+		iSamplerHandler->GetSamplerAttributesL(iDefaultSamplerAttributesArray);
+		
+		fileServer.Close();
+		return KErrNone;
+	    }
+	
+	// initialize iSavedLineArray, initial settings file lines 64
+	if(iSavedLineArray)
+	    {
+        iSavedLineArray->Reset();
+	    }
+	else
+	    {
+        iSavedLineArray = new (ELeave) CDesC8ArrayFlat(KSavedLineCount);
+	    }
+	
+	iSavedLinesCount = KSavedLineCount;
+	
+    // get size of the file
+    TInt fileSize(0);
+    err = file.Size(fileSize);
+    // check if an error occurred reading the file size
+    if(err != KErrNone)
+        {
+        return KErrGeneral; // could not find the size
+        }
+        
+    // sanity check for the file size
+    if (fileSize < 3 || fileSize > 20000)
+        {
+        fileSize = KSettingsFileSize;
+        return KErrNotSupported;
+        }
+    
+	// read the contents of the file to buffer. 
+	iSettingsBuffer.Zero();
+	file.Read(iSettingsBuffer, fileSize);
+	file.Close();
+	fileServer.Close();
+	LOGSTRING2("CProfiler::LoadSettings: read %d bytes",iSettingsBuffer.Length());
+
+	// append end mark "[end]"
+    iSettingsBuffer.Append(KEndMark);
+	// force an ending newline
+	iSettingsBuffer.Append('\n');
+
+	// next fill the saved settings array (CDesC8ArrayFlat) for further comparison with changes and default values
+    TBuf8<384> tmpBuf;
+    TInt lineCount(0);
+    TBool commentFound(EFalse);
+    for (TInt i(0); i<iSettingsBuffer.Length(); i++)  // loop all chars
+        {
+        // if new line char found, create a new text line
+        if (iSettingsBuffer[i]=='\r' || iSettingsBuffer[i]=='\n')
+            {
+            // check if collected string has reasonable length
+            if (tmpBuf.Length() > 0)
+                {
+                // remove extra spaces
+                tmpBuf.TrimAll();
+                // check if the size of the array too small
+                if(lineCount >= iSavedLinesCount)
+                    {
+                    iSavedLineArray->ExpandL(20);   // expand by 20 lines
+                    iSavedLinesCount += 20;
+                    }
+                iSavedLineArray->AppendL(tmpBuf);
+                tmpBuf.Copy(KNullDesC8);
+                lineCount++;
+                }
+            commentFound = EFalse;
+            }
+        // check if comment mark ';' is found on the line, skip the rest of the line
+        else if(iSettingsBuffer[i]==';')
+            {
+            commentFound = ETrue;
+            }
+        // otherwise append a char to the temp line buffer if it is a wanted ASCII char
+        else if (iSettingsBuffer[i]>=32 && iSettingsBuffer[i]<=127 && !commentFound)
+            {
+            tmpBuf.Append(iSettingsBuffer[i]);
+            }
+        }
+    
+    // empty tmpBuf
+    tmpBuf.Copy(KNullDesC8);
+    // check settings file version
+    DoGetValueFromSettingsArray(iSavedLineArray, KProfilerVersionTag, tmpBuf); 
+
+    TBuf8<32> version;
+    version.Copy(PROFILER_VERSION_SHORT);
+    
+    // check if settings file version is 
+    if(tmpBuf.CompareF(version) >= 0)
+        {
+        // update general attributes
+        UpdateSavedGeneralAttributes(iSavedLineArray);
+        
+        // update settings to sampler plugins and save the attributes to default array
+        iSamplerHandler->UpdateSavedSamplerAttributesL(iSavedLineArray, iDefaultSamplerAttributesArray);
+        }
+    else
+        {
+        // check if settings already loaded
+        if(iDefaultSamplerAttributesArray)
+            {
+            // reset default settings array
+            iDefaultSamplerAttributesArray->Reset();
+
+			// get the default settings if settings file version too old
+			iSamplerHandler->GetSamplerAttributesL(iDefaultSamplerAttributesArray);
+			}
+        }
+    
+	return err; 
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfiler::UpdateSavedGeneralAttributes(CDesC8ArrayFlat* aSavedAttributes)
+    {
+    // get saved general settings
+    DoGetValueFromSettingsArray(aSavedAttributes, KGenericTraceOutput, iGeneralAttributes.iTraceOutput);
+    DoGetValueFromSettingsArray(aSavedAttributes, KGenericTraceFilePrefix, iGeneralAttributes.iTraceFilePrefix);
+    DoGetValueFromSettingsArray(aSavedAttributes, KGenericTraceFileSaveDrive, iGeneralAttributes.iSaveFileDrive);
+    DoGetValueFromSettingsArray(aSavedAttributes, KGenericTimedProfilingPeriod, iGeneralAttributes.iTimedSamplingPeriod);
+    }
+
+TBool CProfiler::CheckLocationSanity(RFs& fs, const TDesC8& aLocation)
+    {
+    TBool ret(EFalse);
+    TBool noDiskSpace(EFalse);
+    TBuf<32> drive;
+    
+    CnvUtfConverter::ConvertToUnicodeFromUtf8(drive, aLocation);
+    TDriveUnit driveUnit = TDriveUnit(drive);
+    
+    // check that the root folder is correct
+    if (drive.Length() > 2 && BaflUtils::CheckFolder(fs, drive.Left(3)) == KErrNone)
+        {
+        // test available disk space 
+        TRAP_IGNORE((noDiskSpace = SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, driveUnit)));
+        if(!noDiskSpace)
+            ret = ETrue;
+        }
+    
+    return ret;
+    }
+
+TInt CProfiler::HandleGeneralSettingsChange()
+    {
+    // local literals
+    _LIT8(KBackSlash, "\\");
+    _LIT8(KTraceFileExtension, ".dat");
+    
+    TBuf8<KFileNameBufSize> fileNameBuf;
+    TBuf8<10> number;
+    TInt result(0);
+    TInt index(1);
+    TInt hashLocation(0);
+    TParse parse;
+
+    // check if plugin writer changed
+    if(iGeneralAttributes.iTraceOutput.CompareF(KOutputToDebugOutput) == 0)
+        {
+        iWriterHandler->SetPluginActive( KDebOutWriterPluginUid, EWriterPluginEnabled );
+        }
+    else
+        {
+        RFs fileServer;
+        RFile file;
+        
+        // connect to the file server
+        result = fileServer.Connect();
+        if(result == KErrNone)
+            {
+            // disk writer plugin will be activated
+            iWriterHandler->SetPluginActive( KDiskWriterPluginUid, EWriterPluginEnabled );
+            
+            // fix the trace data file location as well
+            iTotalPrefix.Zero();
+            iTotalPrefix.Append(iGeneralAttributes.iSaveFileDrive);
+            
+            // check that trace file location sane
+            if(!CProfiler::CheckLocationSanity(fileServer, iTotalPrefix))
+                {
+                fileServer.Close();
+                return KErrPathNotFound;
+                }
+            
+            // remove extra spaces
+            iTotalPrefix.TrimAll();
+            
+            // check the directory contains a trailing backlash
+            if(iTotalPrefix.Right(1) != _L8("\\") && 
+                    iTotalPrefix.Right(1) != _L8("/"))
+                {
+                // append backslash to end
+                iTotalPrefix.Append(KBackSlash);
+                }
+            
+            // append trace file name prefix e.g. PIProfiler_#
+            iTotalPrefix.Append(iGeneralAttributes.iTraceFilePrefix);
+    
+            // locate '#' mark for finding the next free trace file name, e.g. E:\data\PIProfiler_4.dat
+            hashLocation = iTotalPrefix.Locate('#');
+            if( hashLocation == KErrNotFound )
+                {
+                // append simply at the end of the trace file prefix, no need to inform user
+                iTotalPrefix.Append('#');
+                // get new hash mark location
+                hashLocation = iTotalPrefix.Locate('#');
+                }
+    
+            // add the file extension
+            iTotalPrefix.Append(KTraceFileExtension);
+
+            // search for files with different indices
+            // until a free filename is found
+            while(result != KErrNotFound)
+                {
+                fileNameBuf.Zero();
+                // start with the original prefix
+                fileNameBuf.Append(iTotalPrefix);
+                // convert the number to a descriptor
+                number.Num(index);
+                // replace the hashmark with the real number
+                fileNameBuf.Replace(hashLocation,1,number);
+                
+                // make a copy to the iFileNameStream descriptor
+                iFileNameStream.Zero();
+                CnvUtfConverter::ConvertToUnicodeFromUtf8(iFileNameStream, fileNameBuf);
+                
+                LOGSTRING2("CProfiler::HandleGeneralSettingsChange() - trying to open files %S ",&iFileNameStream);
+
+                if((result = parse.Set(iFileNameStream, NULL, NULL)) != KErrNone)
+                    {
+                    // break loop if fails, problems in file name => change to log into debug output
+                    break;
+                    }
+                
+                // create directory for trace files if not exists
+                result = fileServer.MkDirAll(parse.FullName());
+
+                // check that file server responded with KErrNone or KErrAlreadyExists
+                if( result != KErrNone && result != KErrAlreadyExists)
+                    {
+                    // if some other result, e.g. memory full => break
+                    break;
+                    }
+
+                // attempt opening the file
+                result = file.Open(fileServer,parse.FullName(),EFileShareReadersOnly);
+                if(result != KErrNotFound)
+                    {
+                    if( result != KErrNotReady && 
+                        result != KErrServerBusy ) 
+                        {
+                        // close the file if it could be opened
+                        LOGSTRING2("Found STREAM file with index %d",index);
+                        index++;
+                        }
+                    else 
+                        {
+                        // in boot measurements the file system might not be ready yet.
+                        LOGSTRING2("Problem in opening STREAM file %d",index);
+                        }
+                    file.Close();
+                    }
+                } // while
+            }
+        else
+            {
+            // return error code
+            return result;
+            }
+        
+        TUint32 id(iWriterHandler->GetActiveWriter()->GetWriterType());
+        
+        // check if a file name is one that does not exist and selected plugin is disk writer
+        if(result == KErrNotFound && id == KDiskWriterPluginUid.iUid)
+            {
+            // write right trace data file name to disk writer plugin
+            iWriterHandler->SetPluginSettings( KDiskWriterPluginUid, iFileNameStream );
+            }
+        else
+            {
+            // return error if could not create trace log file
+            return result;
+            }
+        // close file server
+        fileServer.Close();
+        }   // if output == KOutputToDebugOutput
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfiler::HandleTimerExpiresL(TInt aError)
+    {
+    LOGSTRING2("CProfiler::HandleTimerExpiresL - Error: %d", aError);
+    this->ControlL(RProfiler::EStopSampling);
+    if( CPServer::iClientCount <= 0 )
+        {
+        LOGSTRING("CProfiler::HandleTimerExpiresL - No clients attached, shutting down server...");
+        this->ControlL(RProfiler::EExitProfiler);                
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfiler::SaveSettingsL()
+    {
+    LOGTEXT(_L("CProfiler::SaveSettings()"));
+    
+    // local literal
+    _LIT(KGeneralHeader, "[general]");
+    _LIT(KVersionHeader, "version");
+    _LIT8(KPIProfilerSettingsHeader, "; PI Profiler Settings File");
+    _LIT8(KGeneralSettingsHeader, "; general settings");
+    _LIT8(KOutputFileDescription,"; \"output_type=file_system\" writes *.dat file to external memory");
+    _LIT8(KOutputDebugDescription,"; \"output_type=debug_output\" writes *.dat file to debug port");
+    _LIT8(KOutputFilePrefixDescription,"; if writing to file, prefix of the *.dat file\r\n; first '#' in the prefix is replaced with an integer");
+    _LIT8(KOutputSaveDriveDescription,"; if writing to file, the location to store the *.dat file");
+    _LIT8(KTimedProfilingPeriod,"; period (in seconds) used when using timed profiling");
+    
+    RFs fs;
+    RFile settingsFile;
+    TInt err(KErrNone);
+    TBuf8<384> line;
+    
+    // connect to file server
+    err = fs.Connect();
+    if( err != KErrNone )
+        {
+        // failed to write settings to settings file
+        return;
+        }
+    
+    // create and set the private path
+    fs.CreatePrivatePath(EDriveC);
+    fs.SetSessionToPrivate(EDriveC);
+  
+    // create the new settings file
+    err = settingsFile.Replace(fs, iSettingsFileLocation, EFileWrite);
+    if(err != KErrNone)
+        return;
+    
+    CleanupClosePushL(settingsFile);  
+
+    // write the header
+    line.Copy(KPIProfilerSettingsHeader);
+    line.Append(KNewLineSeparator);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+    
+    // write the header
+    line.Copy(KGeneralSettingsHeader);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+
+    // write all generic settings
+    line.Copy(KGeneralHeader);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+
+    // write version info
+    line.Copy(KVersionHeader);
+    line.Append(KEquals);
+    line.Append(PROFILER_VERSION_SHORT);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+
+    // output explanation
+    line.Copy(KOutputFileDescription);
+    line.Append(KNewLineSeparator);
+    line.Append(KOutputDebugDescription);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+    
+    // write trace output
+    line.Copy(KGenericTraceOutput);
+    line.Append(KEquals);
+    line.Append(iGeneralAttributes.iTraceOutput);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+    
+    // file prefix explanation
+    line.Copy(KOutputFilePrefixDescription);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+
+    // write trace file prefix
+    line.Copy(KGenericTraceFilePrefix);
+    line.Append(KEquals);
+    line.Append(iGeneralAttributes.iTraceFilePrefix);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+    
+    // file prefix explanation
+    line.Copy(KOutputSaveDriveDescription);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+
+    // write trace file location
+    line.Copy(KGenericTraceFileSaveDrive);
+    line.Append(KEquals);
+    line.Append(iGeneralAttributes.iSaveFileDrive);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+    
+    // timed profiling period explanation
+    line.Copy(KTimedProfilingPeriod);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+    
+    // Write timed profiling period value
+    line.Copy(KGenericTimedProfilingPeriod);
+    line.Append(KEquals);
+    TBuf<16> tmpNum;
+    tmpNum.AppendNum(iGeneralAttributes.iTimedSamplingPeriod);
+    line.Append(tmpNum);
+    line.Append(KNewLineSeparator);
+    settingsFile.Write(line);
+        
+    // reset the default attributes array
+    iDefaultSamplerAttributesArray->Reset();
+    
+    // update the latest changes from plugins
+    iSamplerHandler->GetSamplerAttributesL(iDefaultSamplerAttributesArray);
+    
+    // call CSamplerController to write all sampler settings
+    iSamplerHandler->ComposeAttributesToSettingsFileFormat(settingsFile, iDefaultSamplerAttributesArray);
+    
+    CleanupStack::PopAndDestroy(); //settingsFile
+    // close file
+    fs.Close();
+    }
+
+TInt CProfiler::CheckOldProfilerRunning()
+    {
+    TFindProcess procName;
+    procName.Find(_L("BappeaProf.exe*"));
+    TFullName aResult;
+    TInt err(KErrNone);
+    RProcess proc;    
+    
+    // now check if old Profiler is still running on
+    err = procName.Next(aResult);
+    // check if old profiler process found 
+    if(err == KErrNone)
+        {
+        // other process found, i.e. right process to communicate with, in case started from eshell
+        err = proc.Open(procName);
+        if(err == KErrNone)
+            {
+            if(proc.ExitCategory().Length() > 0)
+                {
+                proc.Close();
+                // process already exited => create a new one
+                return KErrNotFound;
+                }
+            proc.Close();
+            }
+        // return error for error handling
+        return KErrAlreadyExists;
+        }
+    return err;
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfiler::HandleError(TInt aErr)
+    {
+    // write error to status property to inform requester
+    TInt err(iEngineStatus.Set(KEngineStatusPropertyCat, EProfilerEngineStatus, aErr));
+    if(err != KErrNone)
+        RDebug::Print(_L("CProfiler::HandleError() - error setting status: %d"), err);
+    }
+
+// --------------------------------------------------------------------------------------------
+TInt CProfiler::ControlDataL(TInt aCommand,TAny* value1,TAny* /*value2*/)
+    {
+	LOGSTRING3("CProfiler::ControlData %d, 0x%x",aCommand,value1);
+
+	_LIT(KDebugOutput, "debug_output");
+	_LIT(KFileOutput, "file_system");
+	_LIT8(KOutputToDebugOutput, "debug_output");
+	
+	TDes* desc;
+	TPtrC ptrDesc;
+	
+	switch(aCommand)
+	    {
+		// new controls
+	    case RProfiler::EGetFileName:
+	        {
+            LOGTEXT(_L("Profiler::EGetFileName - start"));
+            LOGSTRING2("Profiler::EGetFileName - total file name is: %S",(TDes*)value1);
+            desc = (TDes*)value1;
+            desc->Zero();
+            desc->Append(iFileNameStream);
+            LOGSTRING2("Profiler::EGetFileName - now total file name is: %S",(TDes*)value1);
+            return KErrNone;
+	        }
+        case RProfiler::EGetActiveWriter:
+            {
+            LOGTEXT(_L("Profiler::EGetActiveWriter - start"));
+            desc = (TDes*)value1;
+            desc->Zero();
+            if(iGeneralAttributes.iTraceOutput.CompareF(KOutputToDebugOutput) == 0)
+                {
+                desc->Append(KDebugOutput);
+                }
+            else
+                {
+                desc->Append(KFileOutput);
+                }
+            return KErrNone;
+            }
+	    }
+
+	return KErrNone;
+    }
+
+// --------------------------------------------------------------------------------------------
+TInt CProfiler::ControlL(TInt aCommand)
+    {
+	LOGSTRING2("CProfiler::Control - Controlling ProfilerEngine %d",aCommand);
+	TInt err(KErrNone);
+	
+	switch (aCommand)
+	    {
+		case RProfiler::EStartSampling:
+		case RProfiler::EStartTimedSampling:
+		    {
+		    // check first if old Profiler already running
+		    err = CheckOldProfilerRunning();
+		    if(err == KErrAlreadyExists)
+		        {
+		        // if exists do not start a profiling process since corrupts the collected trace data  
+		        HandleError(err);
+		        err = KErrNone;
+		        return err;
+		        }
+		    
+		    // save settings before launching the profiler
+		    // reason: the profiling may have set to the background => need for get right settings
+		    SaveSettingsL();
+		    
+		    // set the general settings to writer plugins to reflect the latest changes
+		    err = HandleGeneralSettingsChange();
+		    if(err == KErrNone)
+		        {
+                // reset the buffers before new profiling
+                iUserStream->ResetBuffers();
+    
+                // give the CProfilerSampleStream a handle to current writer
+                iUserStream->SetWriter(*iWriterHandler->GetActiveWriter());
+                
+                // set initially debug output writer active
+                err = iWriterHandler->StartSelectedPlugin();
+    
+                // check that writer plugin started
+                if(err != KErrNone)
+                    {
+                    // if not started handle error
+                    HandleError(err);
+                    }
+                else
+                    {
+                    // start activated sampler plug-in, NOTE: plugins check if errors occur in startup for some reason
+                    iSamplerHandler->StartSamplerPluginsL();
+        
+                    // set engine state P&S property to running, e.g. for PIProfiler UI to read
+                    iState = RProfiler::ERunning;
+        
+                    // set the engine into running mode
+                    iEngineStatus.Set(iState);
+                    }
+                }
+		    else
+		        {
+		        // handle error and notify requester
+		        HandleError(err);
+		        }
+		    
+		    if( aCommand == RProfiler::EStartTimedSampling )
+		        {
+                iTimer->After(iGeneralAttributes.iTimedSamplingPeriod);
+                LOGTEXT(_L("CProfiler::Control - Finished processing EStartTimedSampling!"));
+		        }
+		    else
+		        {
+                LOGTEXT(_L("CProfiler::Control - Finished processing EStartSampling!"));
+		        }
+
+			return err;
+		    }
+		case RProfiler::EStopSampling:
+			LOGTEXT(_L("CProfiler::Control - Starting to stop sampling..."));
+			// stop sampler plugins
+			if(iState == RProfiler::ERunning)
+				{
+				iState = RProfiler::EStopping;
+				iEngineStatus.Set(RProfiler::EStopping);
+				
+				iSamplerHandler->StopSamplerPlugins();
+	
+				// finalize the filled buffer writing
+				iUserStream->Finalise();
+				
+				// stop output plugin and write the rest of the trace data to output
+				LOGTEXT(_L("CProfiler::Control - stopping writer"));
+				iWriterHandler->StopSelectedPlugin();
+	
+				// set engine state P&S property idle 
+				iState = RProfiler::EIdle;
+				iEngineStatus.Set(RProfiler::EIdle);
+				
+				LOGSTRING2("CProfiler::Control - sampling stopped, going to state %d", RProfiler::EIdle);
+				}
+			return KErrNone;
+
+		case RProfiler::EExitProfiler:
+		    {
+		    // save settings into settings file when exiting
+		    SaveSettingsL();
+
+            if(iUserStream)
+                {
+                delete iUserStream;
+                iUserStream = NULL;
+                }
+		    
+            // set engine state P&S property idle 
+            iState = RProfiler::EIdle;
+            iEngineStatus.Set(RProfiler::EIdle);
+               
+            LOGTEXT(_L("Stopping Activer Scheduler"));
+            CActiveScheduler::Stop();
+            LOGTEXT(_L("Stopped Activer Scheduler"));
+
+            return KErrNone;
+		    }
+		    
+		case RProfiler::EAttachClient:
+		    {
+		    // Increase client reference count
+		    ++CPServer::iClientCount;
+		    LOGSTRING2("Increased client reference count to: %d", CPServer::iClientCount);
+		    return KErrNone;
+		    }
+		case RProfiler::ERemoveClient:
+		    {
+		    // Decrease client reference count
+		    --CPServer::iClientCount;
+		    LOGSTRING2("Decreasing client reference count to: %d", CPServer::iClientCount);
+		    return KErrNone;
+		    }
+	    }
+
+	LOGTEXT(_L("CProfiler::Control - returning"));
+
+	return err;
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfiler::Finalise()
+    {	
+	LOGTEXT(_L("CProfiler::Finalise - Finished processing EStopSampling!"));
+    }
+
+// --------------------------------------------------------------------------------------------
+RProfiler::TSamplerState CProfiler::State() const
+    {
+	return iState;
+    }
+
+/*
+ *
+ *	Class CPServer definition
+ *
+ */
+// --------------------------------------------------------------------------------------------
+inline const CPServer& CPSession::Server() const
+    {
+	return *static_cast<const CPServer*>(CSession2::Server());
+    }
+
+// --------------------------------------------------------------------------------------------
+void CPSession::ServiceL(const RMessage2& aMessage)
+    {
+	LOGTEXT(_L("CPSession::ServiceL - Starting to process message"));
+	TInt err(KErrNone);
+	
+	if(aMessage.Function() == RProfiler::EGetGeneralAttributes)
+	    {
+	    Server().GetGeneralAttributesL(aMessage);
+	    }
+	else if(aMessage.Function() == RProfiler::ESetGeneralAttributes)
+	    {
+        Server().SetGeneralAttributesL(aMessage);
+	    }
+	else if(aMessage.Function() == RProfiler::EGetSamplerAttributes)
+	    {
+        Server().GetSamplerAttributesL(aMessage);
+	    }
+    else if(aMessage.Function() == RProfiler::EGetSamplerAttributeCount)
+        {
+        Server().GetSamplerAttributeCountL(aMessage);
+        }
+    else if(aMessage.Function() == RProfiler::ESetSamplerAttributes)
+        {
+        Server().SetSamplerAttributesL(aMessage);
+        }
+    else if(aMessage.Function() == RProfiler::ERefreshProfilerStatus)
+        {
+        Server().RefreshStatus(aMessage);
+        }
+	else if(aMessage.Ptr0() == 0 && aMessage.Ptr1() == 0 && aMessage.Ptr2() == 0)
+		{	
+		LOGTEXT(_L("Ptr0 && Ptr1 == 0 && Ptr2 == 0"));
+		aMessage.Complete(Server().ControlL(RProfiler::TCommand(aMessage.Function())));
+		LOGTEXT(_L("CPSession::ServiceL - Message completed"));
+		} 
+	else if(aMessage.Ptr0() != 0 && aMessage.Ptr1() != 0 && aMessage.Ptr2() != 0)
+		{
+		LOGTEXT(_L("Error with message, all pointers contain data!"));
+		}
+		
+	else if (aMessage.Ptr0() != 0)
+		{
+		if(aMessage.Ptr1() == 0)
+			{
+			LOGTEXT(_L("ServiceL: Ptr0 != 0 && Ptr1 == 0"));
+			// provided value is a descriptor
+			TBuf<64>* dst = new TBuf<64>;
+			aMessage.ReadL(0,*dst,0);
+	
+			err = Server().ControlDataL(aMessage.Function(),(TAny*)dst);
+			delete dst;
+			aMessage.Complete(err);
+			LOGTEXT(_L("CPSession::ServiceL - Message completed"));
+			}
+		else
+			{
+			LOGTEXT(_L("ServiceL: Ptr0 != 0 && Ptr1 != 0"));
+			// provided value is a descriptor
+			TBuf<64>* dst = new TBuf<64>;
+			aMessage.ReadL(0,*dst,0);
+			
+			TUint32 num1 = (TUint32)aMessage.Ptr1();
+			
+			err = Server().ControlDataL(aMessage.Function(),(TAny*)dst, (TAny*)num1);
+			delete dst;
+			aMessage.Complete(err);
+			LOGTEXT(_L("CPSession::ServiceL - Message completed"));
+			}
+		}
+	else if (aMessage.Ptr1() != 0)
+		{
+		LOGTEXT(_L("ServiceL: Ptr1 != 0"));
+		// provided value is a TUint32
+		if( ((TUint32)aMessage.Ptr3()) == 0xffffffff)
+			{
+			TUint32 num = (TUint32)aMessage.Ptr1();
+			err = Server().ControlDataL(aMessage.Function(),(TAny*)num);
+			aMessage.Complete(err);
+			LOGTEXT(_L("CPSession::ServiceL - Message completed"));
+			}
+		else
+			{
+			LOGTEXT(_L("ServiceL: Ptr3 != 0xffffffff"));
+			TUint32 num1 = (TUint32)aMessage.Ptr1();
+			TUint32 num2 = (TUint32)aMessage.Ptr3();
+			err = Server().ControlDataL(aMessage.Function(),(TAny*)num1,(TAny*)num2);
+			aMessage.Complete(err);
+			LOGTEXT(_L("CPSession::ServiceL - Message completed"));
+			}
+		}
+	else if (aMessage.Ptr2() != 0)
+		{
+		// command requests for data, provided 
+		// value should be a descriptor
+		if( ((TUint32)aMessage.Ptr3()) == 0xffffffff)
+			{
+			LOGTEXT(_L("ServiceL: Ptr2 != 0 && Ptr3 == 0xffffffff"));
+	
+			TBuf<256>* src = new TBuf<256>;
+			src->Zero();
+			err = Server().ControlDataL(aMessage.Function(),(TAny*)src);
+	
+			LOGSTRING2("Got sampler data %S",src);
+			
+			aMessage.WriteL(2, *src, 0);
+	
+			delete src;
+			aMessage.Complete(err);
+			LOGTEXT(_L("CPSession::ServiceL - Message completed"));
+			}
+		else 
+			{
+			LOGTEXT(_L("ServiceL: Ptr2 != 0 && Ptr3 != 0xffffffff"));
+			
+			TUint32 num1 = (TUint32)aMessage.Ptr2();	// containing id
+			TBuf<256>* buffer = new TBuf<256>;		// Text data, e.g. plug-in name or description
+
+			LOGSTRING3("Getting data for sampler: 0x%X, buffer max len %d",num1, aMessage.GetDesMaxLength(3));
+
+			err = Server().ControlDataL(aMessage.Function(), (TAny*)num1, (TAny*)buffer);
+
+			LOGSTRING2("Got sampler data %S",&buffer);
+			
+			// write back to same parameter
+			aMessage.WriteL(3, *buffer, 0);
+			
+			delete buffer;
+			aMessage.Complete(err);
+			LOGTEXT(_L("CPSession::ServiceL - Message completed"));	
+			}
+		}
+	LOGTEXT(_L("CPSession::ServiceL - Message processed"));
+    }
+
+// --------------------------------------------------------------------------------------------
+MProfilerController* CPServer::NewL(TInt aPriority, MProfilerEngine& aEngine)
+    {
+	LOGTEXT(_L("CPServer::NewL - Enter"));
+	CPServer* self = new(ELeave) CPServer(aPriority, aEngine);
+	CleanupStack::PushL(self);
+	self->StartL(KProfilerName);
+	CleanupStack::Pop();
+	LOGTEXT(_L("CPSession::NewL - Exit"));
+	return self;
+    }
+
+// --------------------------------------------------------------------------------------------
+CPServer::CPServer(TInt aPriority, MProfilerEngine& aEngine)
+	: CServer2(aPriority), MProfilerController(aEngine)
+    {
+
+    }
+
+// --------------------------------------------------------------------------------------------
+void CPServer::Release()
+    {
+	delete this;
+    }
+
+// --------------------------------------------------------------------------------------------
+CSession2* CPServer::NewSessionL(const TVersion&,const RMessage2&) const
+    {
+	return new(ELeave) CPSession();
+    }
+
+/*
+ *
+ * Static methods for controlling the profiler
+ * through command line
+ *
+ */
+// --------------------------------------------------------------------------------------------
+static void RunEngineServerL(const TDesC& aSettingsFile)
+    {
+	RDebug::Print(_L("Profiler: RunEngineServerL() - Install active scheduler"));
+	CActiveScheduler* pS = new CActiveScheduler;
+	CActiveScheduler::Install(pS);
+	CProfiler* p = CProfiler::NewLC(aSettingsFile);
+	CActiveScheduler::Start();
+	p->Finalise();
+	CleanupStack::PopAndDestroy(p);
+	delete pS;
+    }
+
+// --------------------------------------------------------------------------------------------
+static TInt TestSettingsFile(const TDesC& configFile)
+    {
+    RFs fs;
+    LOGSTRING2("TestSettingsFile: entry %S", &configFile);
+    // check if file server can be connected
+    if (fs.Connect() != KErrNone)
+        {
+        LOGTEXT(_L("TestSettingsFile: could not connect file server"));
+        // file server couldn't be connected, return false
+        return KErrNotFound;
+        }
+
+    // check if config file name length is > 0
+    if (configFile.Length() > 0)
+        {
+        LOGTEXT(_L("TestSettingsFile: checking location sanity"));
+        // check sanity of settings file location
+        if(BaflUtils::CheckFolder(fs, configFile) != KErrNone)
+            {
+            LOGTEXT(_L("TestSettingsFile: location sanity check failed"));
+            fs.Close();
+            return KErrGeneral;
+            }
+        }
+    else
+        {
+        // configFile length 0, return false
+        LOGTEXT(_L("TestSettingsFile: config file string null length"));
+        fs.Close();
+        return KErrNotFound;
+        }
+    // return true if tests passed
+    LOGTEXT(_L("TestSettingsFile: exiting..."));
+    fs.Close();
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------------------------
+GLDEF_C TInt E32Main()
+    {
+    // parse command line arguments 
+    TBuf<256> c;
+    TInt err(KErrNone);
+    
+    // copy the full command line with arguments into a buffer
+    User::CommandLine(c);
+
+    TBuf<256> fileName;
+    fileName.Append(c); // only one settings param should be
+    LOGSTRING3("Filename is %S, response %d 1", &fileName, err);
+    err = TestSettingsFile(fileName);
+    if(err != KErrNone)
+        {
+        LOGSTRING3("Filename is %S, response %d 2", &fileName, err);
+        // settings file does not exist, copy null desc to file name
+        fileName.Copy(KNullDesC);
+        }
+
+    LOGSTRING3("Filename is %S, response %d 3", &fileName, err);
+    
+    // if no command line arguments found just start the profiler process
+    __UHEAP_MARK;
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    TInt ret(KErrNoMemory);
+    if( cleanup )
+        {
+        TRAPD( ret, RunEngineServerL(fileName) );
+        RDebug::Print(_L("Profiler: E32Main() - ret %d"), ret);
+        delete cleanup;
+        } 
+    __UHEAP_MARKEND;
+
+    return ret;
+    } 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/src/ProfilerErrorChecker.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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 <e32std.h>
+#include <e32base.h>
+#include <e32property.h>
+
+#include <piprofiler/ProfilerTraces.h>
+
+#include "ProfilerErrorChecker.h"
+
+// properties
+const TUid KEngineStatusPropertyCat={0x2001E5AD};
+enum TEnginePropertyKeys
+    {
+    EProfilerEngineStatus = 8,
+    EProfilerErrorStatus
+    };
+
+/*
+ *
+ *  CProfilerErrorChecker class implementation
+ *
+ */
+CProfilerErrorChecker* CProfilerErrorChecker::NewL()
+    {
+    CProfilerErrorChecker* self = new(ELeave) CProfilerErrorChecker;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// --------------------------------------------------------------------------------------------
+CProfilerErrorChecker::CProfilerErrorChecker() :
+    CActive(EPriorityStandard)
+    {
+    }
+
+CProfilerErrorChecker::~CProfilerErrorChecker()
+    {
+    Cancel();
+    iErrorStatus.Close();
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfilerErrorChecker::ConstructL()
+    {
+    
+    LOGTEXT(_L("Trying to attach to profiler engine error status property"));
+    User::LeaveIfError(iErrorStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus));
+    CActiveScheduler::Add(this);
+
+    // subscribe to P&S status property
+    iErrorStatus.Subscribe(iStatus);
+    SetActive();
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfilerErrorChecker::SetObserver(MProfilerErrorObserver* aObserver)
+    {
+    iObserver = aObserver;
+    }
+
+// --------------------------------------------------------------------------------------------
+TInt CProfilerErrorChecker::RunError(TInt aError)
+    {
+    iErrorStatus.Close();
+    return aError;
+    }
+// --------------------------------------------------------------------------------------------
+void CProfilerErrorChecker::RunL()
+    {
+    // resubscribe before processing new value to prevent missing updates
+    iErrorStatus.Subscribe(iStatus);
+    SetActive();
+
+    TInt stat(0);
+    if(iErrorStatus.Get(stat) != KErrNone)
+        {
+        // check if error status != KErrNone
+        if(stat != 0)
+            {
+            iObserver->HandleProfilerErrorChangeL(stat);
+            }
+        
+        // reset error code
+        iErrorStatus.Set(KErrNone);
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+ 
+void CProfilerErrorChecker::DoCancel()
+    {
+    iErrorStatus.Cancel();
+    }
+
+// end of file
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/src/ProfilerEshell.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,440 @@
+/*
+* 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 <e32cons.h>
+
+#include "ProfilerEshell.h"
+#include <piprofiler/ProfilerSession.h>
+
+
+
+_LIT(KProfilerEngineExe, "PIProfilerEngine.exe");
+
+/*
+ *
+ * Static methods for controlling the profiler
+ * through command line
+ *
+ */
+// --------------------------------------------------------------------------------------------
+static void PrintUsageInfo(const TDesC& aAdditionalInfo)
+    {
+    _LIT(KConsoleName, "Console");
+    _LIT(KLegalNote, "PIProfiler Version 2.2.2 Copyright @ 2009 Nokia\n");
+    _LIT(KUsageNote, "Usage: PIProfiler [start/end/timed] settingsfile [time to run]\n");
+    _LIT(KExample, "Example: PIProfiler timed C:\\data\\piprofilersettings.txt 60\n");
+
+    TRAP_IGNORE(CConsoleBase* console = Console::NewL(KConsoleName,TSize(KConsFullScreen,KConsFullScreen));
+        console->Printf(KLegalNote);
+        console->Printf(KUsageNote);
+        console->Printf(KExample);
+        console->Write(aAdditionalInfo);
+    
+        console->Printf(_L("\n[Press any key]"));
+        console->Getch();
+        delete console;);
+    }
+
+// --------------------------------------------------------------------------------------------
+static TInt FindProcess()
+    {
+    TFindProcess procName;
+    procName.Find(_L("PIProfilerEngine.exe*"));
+    TFullName aResult;
+    
+    // find the first appearance, i.e. "myself"...
+    TInt err(procName.Next(aResult));  // the first appearance
+    if(err == KErrNotFound)
+        {
+        // now check if old Profiler is still running on
+        procName.Find(_L("BappeaProf.exe*"));
+        err = procName.Next(aResult);
+        // check if old profiler process found 
+        if(err == KErrNone)
+            {
+            // return error for error handling
+            return KErrAlreadyExists;
+            }
+        // return KErrNotFound and a new profiler engine process can be started
+        return KErrNotFound;
+        }
+    return err;
+    }
+
+/**
+ * Function for starting profiler engine in the background,
+ * call profiler to load settings
+ * and start sampling process
+ * 
+ * @param configFile name and location of settings file
+ * @param aRunTimeInSeconds run time in seconds
+ * @param aBootTime run boot time sampling or not.
+ */
+// --------------------------------------------------------------------------------------------
+static TInt StartProfilerProcess(const TDesC& configFile, TInt aRunTimeInSeconds, TBool aBootTime)
+    {
+    TInt err(KErrNone);
+    RProcess proc;
+    TRequestStatus status = KRequestPending;
+    TBuf<256> conf;
+    conf.Zero();
+    conf.Append(configFile);
+    if(aBootTime)
+        {
+        RDebug::Printf("boot time measurement");
+        conf.Append(_L(" "));
+        conf.Append(_L("boot"));
+        }
+    RDebug::RawPrint(conf);
+    // check if process exists
+    err = FindProcess();
+    LOGSTRING2("PIProfiler: tried to find process, response %d", err); 
+
+    // check if already exists and don't start a new eshell profiling
+    if( err == KErrNotFound )
+        {
+        // try create new process
+        err = proc.Create(KProfilerEngineExe, conf);
+
+        LOGSTRING2("PIProfiler: created process, response %d", err); 
+
+        // check if RProcess::Create() succeeded
+        if( err == KErrNone )
+            {
+            // Trigger rendezvous on the supplied TRequestStatus object
+            proc.Rendezvous(status); 
+
+            // kick off the engine process
+            proc.Resume();
+            
+            // wait for the constructor to complete 
+            User::WaitForRequest(status); 
+            
+            // just lose the handle
+            proc.Close();
+            
+            // start sampling, using settings found in settings file or if not found the default settings
+            err = RProfiler::StartSampling();
+            // check if command succesful
+            if( err != KErrNone )
+                {
+                LOGSTRING2("PI Profiler start: err %d", err);
+                _LIT(KNoteProfilerCannotStart, "PI Profiler: cannot start PI Profiler, check settings!");
+                PrintUsageInfo(KNoteProfilerCannotStart);
+                
+                // check if process still alive
+                if(err != KErrNotFound)
+                    {
+                    // exit the profiler process since process was started
+                    RProfiler::ExitProfiler();
+                    }
+                return err;
+                }
+            
+            if(aRunTimeInSeconds > 0)
+                {
+                RDebug::Print(_L("Profiler running for %d s... "), aRunTimeInSeconds);
+                User::After(aRunTimeInSeconds*1000000);
+                RDebug::Print(_L("************* Profiler process closing *********"));
+        
+                // stop sampling process
+                err = RProfiler::StopSampling();
+                // check if command succesfull
+                if( err != KErrNone )
+                    {
+                    LOGTEXT(_L("Profiler: could not connect engine, stop failed"));
+                    return err;
+                    }
+                
+                // exit the profiler process
+                err = RProfiler::ExitProfiler();
+                // check if command succesfull
+                if( err != KErrNone )
+                    {
+                    LOGTEXT(_L("Profiler: could not connect engine, exit failed"));
+                    return err;
+                    }
+                }
+            } 
+        else
+            {
+            _LIT(KNoteCannotFindProfiler, "PI Profiler: could not find PIProfilerEngine.exe");
+            PrintUsageInfo(KNoteCannotFindProfiler);
+            }
+        }
+    // check if old Profiler is already running
+    else if( err == KErrAlreadyExists )
+        {
+        _LIT(KNoteAlreadyRunning, "PI Profiler: old Profiler process already running, close it down before launching the new!");
+        PrintUsageInfo(KNoteAlreadyRunning);
+        }
+    // otherwise show error note
+    else
+        {
+        _LIT(KNoteAlreadyRunning, "PI Profiler: already running, not able to launch new one. NOTE: check if UI running!");
+        PrintUsageInfo(KNoteAlreadyRunning);
+        }
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------------------------
+static TInt EndProfilerProcess()
+    {
+    LOGTEXT(_L("EndProfilerProcess() ..."));
+
+    // call profiler to stop sampling
+    TInt err = RProfiler::StopSampling();
+    
+    // check if command succesfull
+    if( err != KErrNone )
+        {
+        LOGTEXT(_L("Profiler: could not connect engine, stop failed"));
+        return err;
+        }
+    
+    // exit the profiler process
+    err = RProfiler::ExitProfiler();
+    // check if command succesfull
+    if( err != KErrNone )
+        {
+        LOGTEXT(_L("Profiler: could not connect engine, exit failed"));
+        return err;
+        }
+    
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------------------------
+static TInt TestSettingsFile(const TDesC& configFile)
+    {
+    RFs fs;
+    RFile file;
+    TInt err(KErrNone);
+
+    // check if file server can be connected
+    if (fs.Connect() != KErrNone)
+        {
+        // file server couldn't be connected, return false
+        return KErrNotFound;
+        }
+
+    // check if config file name length is > 0
+    if (configFile.Length() > 0)
+        {
+        // open the file with the given path and name
+        err = file.Open(fs,configFile,EFileRead);
+        // check if file open was succesfull 
+        if(err != KErrNone)
+            {
+            // return false if failed
+            fs.Close();
+            return err;
+            }
+        
+        }
+    else
+        {
+        // configFile length 0, return false
+        fs.Close();
+        return KErrNotFound;
+        }
+    // return true if tests passed
+    file.Close();
+    fs.Close();
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------------------------
+static TInt ParseCommandAndExecute()
+    {
+    // commands literals for finding the right keyword 
+    _LIT(KAutomatedTestStart,"start*");
+    _LIT(KAutomatedTestEnd,"end*");
+    _LIT(KAutomatedTestTimed,"timed*");
+    _LIT(KBootMeasurement,"boot*");
+    TBuf<256> c;
+    TInt match(KErrNotFound);
+    TInt bootmatch(KErrNotFound);
+    TBool myBoot=false;
+    // copy the full command line with arguments into a buffer
+    User::CommandLine(c);
+    LOGSTRING2("command: %S", &c);
+
+    // try to match with each of the literals defined above
+    // (commands in atf format)
+    
+    // check if command is "start"
+    match = c.Match(KAutomatedTestStart);
+    if (match != KErrNotFound)
+        {
+        LOGTEXT(_L("Found keyword start"));
+
+        TBuf<256> fileName;
+        fileName.Append(c.Right(c.Length()-6));
+        LOGSTRING2("Filename is %S", &fileName);
+        if(TestSettingsFile(fileName) != KErrNone)
+            {
+            _LIT(KSettingsFileFailed, "False settings file");
+            PrintUsageInfo(KSettingsFileFailed);
+            return -2;
+            }
+        // execute Profile process 
+        if( StartProfilerProcess(fileName, 0, myBoot) == KErrNone )
+            {
+            return -10;
+            }
+        return -2;
+        }
+
+    // check if command is "end"
+    match = c.Match(KAutomatedTestEnd);
+    if (match != KErrNotFound)
+        {
+        LOGTEXT(_L("Found keyword end"));
+
+        // stop the profiling process
+        EndProfilerProcess();
+        return -10;
+        }
+
+    // check if command is "timed"
+    match = c.Match(KAutomatedTestTimed);
+    // check if command is "boot"
+    bootmatch = c.Match(KBootMeasurement);
+    if ((match!= KErrNotFound) || (bootmatch != KErrNotFound))
+        {
+        // command "timed" or " boot" found, need for finding settings file and run time next
+        if(bootmatch != KErrNotFound)
+            {
+            LOGTEXT(_L("Found keyword boot"));
+            myBoot = TRUE;
+            }
+        if(match != KErrNotFound)
+            {
+            LOGTEXT(_L("Found keyword timed"));
+            }
+        
+        TBuf<256> temp;
+        temp.Append(c);
+        TLex lex(temp);
+        
+        TBuf<256> fileName;
+        TInt seconds;
+
+        // parse the first command line argument, the command itself
+        lex.Mark();
+        lex.SkipCharacters();
+        if(lex.TokenLength() != 0)
+            {
+            #ifdef PIPROFILER_PRINTS
+            TPtrC token = lex.MarkedToken();
+            LOGSTRING2("Token 1 %S",&token);
+            #endif
+            }
+        else
+            {
+            LOGTEXT(_L("Problem 1 in parsing command line"));
+            _LIT(KSettingsFileFailed, "Failure: False argument");
+            PrintUsageInfo(KSettingsFileFailed);
+            return -2;
+            }
+
+        // parse the second command line argument, the settings file name
+        lex.SkipSpace();
+        lex.Mark();
+        lex.SkipCharacters();
+        if(lex.TokenLength() != 0)
+            {
+            TPtrC token2 = lex.MarkedToken();
+            LOGSTRING2("Token 2 %S",&token2);
+            fileName.Append(token2);
+            LOGSTRING2("Value of fileName is %S",&fileName);
+//            if(TestSettingsFile(fileName) != KErrNone)
+//                {
+//                _LIT(KSettingsFileFailed, "Failure: False settings file");
+//                PrintUsageInfo(KSettingsFileFailed);
+//                return -2;
+//                }
+            }
+        else
+            {
+            LOGTEXT(_L("Problem 2 in parsing command line"));
+            _LIT(KSettingsFileFailed, "Failure: No settings file specified");
+            PrintUsageInfo(KSettingsFileFailed);
+            return -2;
+            }
+
+        // parse the third command line argument, the run time in seconds
+        lex.SkipSpace();
+        lex.Mark();
+        lex.SkipCharacters();
+        if(lex.TokenLength() != 0)
+            {
+            // third token ok, try to convert into TInt value
+            TPtrC token3 = lex.MarkedToken();
+            LOGSTRING2("Token 3 %S",&token3);
+            TLex num(token3);
+            TInt err = num.Val(seconds);
+            // check if given time value acceptable 
+            if (err != KErrNone)
+                {
+                // value parsing failed, show info note to user
+                _LIT(KSecondsFailed, "Failure: False time value");
+                PrintUsageInfo(KSecondsFailed);
+                return -2;
+                }
+            }
+        else
+            {
+            LOGTEXT(_L("Problem 3 in parsing command line"));
+            _LIT(KSecondsFailed, "Failure: False time value");
+            PrintUsageInfo(KSecondsFailed);
+            return -2;
+            }           
+        
+        LOGSTRING3("Filename is %S, seconds is %d", &fileName, seconds);
+        // execute Profile process 
+        if( StartProfilerProcess(fileName, seconds, myBoot) == KErrNone )
+            {
+            return -10;
+            }
+        return -2;
+        }
+    
+    // check if space character in the middle of command line string 
+    if( c.LocateReverse(' ') != KErrNotFound)
+        {
+        _LIT(KWrongParameters, "Failure: Check command line parameters");
+        PrintUsageInfo(KWrongParameters);
+        return -2;
+        }
+    
+    // return -1 if no command found
+    LOGTEXT(_L("No keyword found"));
+    return -1;
+    }
+
+// --------------------------------------------------------------------------------------------
+GLDEF_C TInt E32Main()
+    {
+    // parse command line arguments
+    ParseCommandAndExecute();
+
+    return KErrNone;
+
+    } 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/src/ProfilerTimer.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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 "ProfilerTimer.h"
+
+/*
+ *
+ *  CProfilerTimer class implementation
+ *
+ */
+// --------------------------------------------------------------------------------------------
+CProfilerTimer::CProfilerTimer(const TInt aPriority, MProfilerTimerObserver& aObserver)
+: 
+CActive(aPriority),
+iObserver(aObserver)
+    {    
+    } 
+
+// --------------------------------------------------------------------------------------------
+CProfilerTimer::~CProfilerTimer()
+    {
+    Cancel();
+    iTimer.Close();
+    } 
+
+// --------------------------------------------------------------------------------------------
+CProfilerTimer* CProfilerTimer::NewL(const TInt aPriority, MProfilerTimerObserver& aObserver)
+    {
+    CProfilerTimer* self = new (ELeave) CProfilerTimer(aPriority, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfilerTimer::ConstructL(void)
+    {
+    CActiveScheduler::Add(this);
+    iTimer.CreateLocal();
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfilerTimer::After(TUint aPeriodInSeconds)
+    {
+    Cancel();
+    TTimeIntervalMicroSeconds32 period = aPeriodInSeconds * 1000000;
+    iTimer.After(iStatus, period);
+    SetActive();
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfilerTimer::DoCancel()
+    {
+    iTimer.Cancel();
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfilerTimer::RunL()
+    {
+    iObserver.HandleTimerExpiresL(iStatus.Int());
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/src/SamplerController.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,500 @@
+/*
+* 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 "SamplerController.h"
+//#include <piprofiler/EngineUIDs.h>
+
+// CONSTANTS
+const TInt KMaxSamplerPluginCount = 20;
+const TInt KMaxExtraSettingsItemCount = 6;
+
+// LITERALS
+_LIT8(KSamplingPeriod, "sampling_period_ms");
+_LIT8(KNewLine8, "\n");
+_LIT8(KEquals8, "=");
+_LIT8(KSettingsText, " settings");
+_LIT(KNewLine, "\n");
+_LIT(KEquals, "=");
+_LIT(KCommentSeparator, " ; ");
+
+CSamplerController* CSamplerController::NewL(CProfilerSampleStream& aStream)
+    {
+    CSamplerController* self = new( ELeave ) CSamplerController(aStream);
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+void CSamplerController::ConstructL()
+	{
+	// initiate sampler plugin list
+	InitialiseSamplerListL();
+	}
+
+
+CSamplerController::CSamplerController(CProfilerSampleStream& aStream) : 
+    iStream(aStream)
+	{
+	}
+
+void CSamplerController::InitialiseSamplerListL()
+    {
+    // create new sampler plugin array
+    iPluginArray = new (ELeave) CArrayPtrFlat<CSamplerPluginInterface>( KMaxSamplerPluginCount );
+    
+    // create plugin loader instance
+    iPluginLoader = CSamplerPluginLoader::NewL();
+    
+    // register sampler controller to get notifications of succesfull plugin load
+    iPluginLoader->SetObserver( this );
+    
+    // load sampler plugins asynchronously
+    iPluginLoader->LoadAsyncL( iPluginArray );
+    
+    LOGTEXT(_L(" RSamplerController::InitialiseUserSideSamplerList - exit"));	
+    }
+
+CSamplerController::~CSamplerController()
+	{
+	LOGTEXT(_L("CSamplerController::~CSamplerController - entry" ));
+	
+    if ( iPluginArray )
+        {
+        // destroy the plugin instances
+        // empty loaded plugins from array
+        for(TInt i(0);i<iPluginArray->Count();i++)
+            {
+            if(iPluginArray->At(i))
+                {
+                delete iPluginArray->At(i);
+                iPluginArray->At(i) = NULL;
+                }
+            }
+        iPluginArray->Reset();
+        delete iPluginArray;
+        iPluginArray = NULL;
+        }
+	
+	if ( iPluginLoader )
+	    {
+	    iPluginLoader->AbortAsyncLoad();
+	    delete iPluginLoader;
+	    iPluginLoader = NULL;
+	    }
+    
+	LOGTEXT(_L("CSamplerController::~CSamplerController - exit" ));
+	}
+
+void CSamplerController::SetObserver(MSamplerControllerObserver* aObserver)
+    {
+    iObserver = aObserver;
+    }
+    
+TInt CSamplerController::UpdateSavedSamplerAttributesL(CDesC8ArrayFlat* aSavedLineArray, CArrayFixFlat<TSamplerAttributes>* aAttributes)
+    {
+    TInt err(KErrNone);
+    TInt count(iPluginArray->Count());
+    // all plugins get their own settings among whole lump of setting strings
+    CSamplerPluginInterface* plugin = NULL;
+    
+    // loop through the plugin array
+    for(TInt i(0);i<count;i++)
+        {
+        // get each plugin at a time
+        plugin = iPluginArray->At(i);
+        
+        // call each plugin to sort out its own settings 
+        err = plugin->ConvertRawSettingsToAttributes(aSavedLineArray);
+        
+        // get plugin specific attributes, array may contain attributes of several sub samplers
+        plugin->GetAttributesL(aAttributes); 
+        }
+    
+    return err;
+    }
+
+TInt CSamplerController::SetSamplerSettingsL(TInt aUid, TSamplerAttributes& aAttributes)
+    {
+    // parse right plugin based on UID
+    CSamplerPluginInterface* plugin = GetPlugin(TUid::Uid(aUid));
+    
+    // set the sampler attributes of a sampler plugin
+    plugin->SetAttributesL(aAttributes);
+    
+    return KErrNone;
+    }
+
+void CSamplerController::GetSamplerAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes)
+    {
+    CSamplerPluginInterface* plugin = NULL;
+    
+    TInt count(iPluginArray->Count());
+    
+    // get first all the attributes from all the sampler plugins listed in iPluginArray
+    for(TInt i(0);i<count;i++)
+        {
+        // get the plugin first
+        plugin = iPluginArray->At(i);
+        
+        // get plugin specific attributes, array may contain attributes of several sub samplers
+        plugin->GetAttributesL(aAttributes); 
+        }
+    }
+
+void CSamplerController::ComposeAttributesToSettingsFileFormat(RFile& aFile, CArrayFixFlat<TSamplerAttributes>* aAttributes)
+    {
+    // write immediately to settings file
+    ComposeSettingsText(aFile, aAttributes);
+    }
+
+void CSamplerController::ComposeSettingsText(RFile& aFile, CArrayFixFlat<TSamplerAttributes>* aAttrArray)
+    {
+    // temporary buffer for a setting line
+    TBuf<384> settingLine;
+    TBuf8<384> settingLine8;
+    TInt itemCount(0);
+    TBuf<266> tBuf;
+    
+    TSamplerAttributes attr;
+    
+    for(TInt i(0);i<aAttrArray->Count();i++)
+        {
+        // get the attribute container 
+        attr = aAttrArray->At(i);
+        
+        // add the name and description of the sampler in brackets first
+        settingLine8.Copy(KBracketOpen);
+        settingLine8.Append(attr.iShortName);
+        settingLine8.Append(KBracketClose);
+        settingLine8.Append(KCommentSeparator());
+        settingLine8.Append(attr.iName);
+        settingLine8.Append(KSettingsText);
+        settingLine8.Append(KNewLine8);
+        aFile.Write(settingLine8);
+        
+        // enabled
+        settingLine8.Copy(KEnabled);
+        settingLine8.Append(KEquals8);
+        settingLine8.Append(Bool2Str(attr.iEnabled));
+        settingLine8.Append(KNewLine8);
+        aFile.Write(settingLine8);
+        
+        // sampling rate (if set)
+        if( attr.iSampleRate != -1 )
+            {
+            settingLine8.Copy(KSamplingPeriod);
+            settingLine8.Append(KEquals8);
+            settingLine8.Append(Int2Str(attr.iSampleRate));
+            settingLine8.Append(KNewLine8);
+            aFile.Write(settingLine8);
+            }
+        
+        itemCount = attr.iItemCount;
+        
+        // check if item count set is sane, max extra settings item count 6
+        if(itemCount > KMaxExtraSettingsItemCount)
+            {
+            // probably forgot to set the item count value in plugin => safe to set it 0
+            itemCount = 0;
+            }
+        
+        // setting items
+        for (TInt j(0);j<itemCount;j++)
+            {
+            switch(j)
+                {
+                case 0: // settingItem1
+                    {
+                    settingLine.Copy(attr.iSettingItem1.iSettingText);
+                    settingLine.Append(KEquals());
+                    settingLine.Append(attr.iSettingItem1.iValue);
+                    settingLine.Append(KCommentSeparator());
+                    settingLine.Append(attr.iSettingItem1.iUIText);
+                    settingLine.Append(KNewLine());
+                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
+                    aFile.Write(settingLine8);
+                    break;
+                    }
+                case 1: // settingItem2
+                    {
+                    settingLine.Copy(attr.iSettingItem2.iSettingText);
+                    settingLine.Append(KEquals());
+                    settingLine.Append(attr.iSettingItem2.iValue);
+                    settingLine.Append(KCommentSeparator());
+                    settingLine.Append(attr.iSettingItem2.iUIText);
+                    settingLine.Append(KNewLine());
+                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
+                    aFile.Write(settingLine8);
+                    break;
+                    }
+                case 2: // settingItem3
+                    {
+                    settingLine.Copy(attr.iSettingItem3.iSettingText);
+                    settingLine.Append(KEquals());
+                    settingLine.Append(attr.iSettingItem3.iValue);
+                    settingLine.Append(KCommentSeparator());
+                    settingLine.Append(attr.iSettingItem3.iUIText);
+                    settingLine.Append(KNewLine());
+                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
+                    aFile.Write(settingLine8);
+                    break;
+                    }
+                case 3: // settingItem4
+                    {
+                    settingLine.Copy(attr.iSettingItem4.iSettingText);
+                    settingLine.Append(KEquals());
+                    settingLine.Append(attr.iSettingItem4.iValue);
+                    settingLine.Append(KCommentSeparator());
+                    settingLine.Append(attr.iSettingItem4.iUIText);
+                    settingLine.Append(KNewLine());
+                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
+                    aFile.Write(settingLine8);
+                    break;
+                    }
+                case 4: // settingItem5
+                    {
+                    settingLine.Copy(attr.iSettingItem5.iSettingText);
+                    settingLine.Append(KEquals());
+                    settingLine.Append(attr.iSettingItem5.iValue);
+                    settingLine.Append(KCommentSeparator());
+                    settingLine.Append(attr.iSettingItem5.iUIText);
+                    settingLine.Append(KNewLine());
+                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
+                    aFile.Write(settingLine8);
+                    break;
+                    }
+                case 5: // settingItem6
+                    {
+                    settingLine.Copy(attr.iSettingItem6.iSettingText);
+                    settingLine.Append(KEquals());
+                    settingLine.Append(attr.iSettingItem6.iValue);
+                    settingLine.Append(KCommentSeparator());
+                    settingLine.Append(attr.iSettingItem6.iUIText);
+                    settingLine.Append(KNewLine());
+                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
+                    aFile.Write(settingLine8);
+                    break;
+                    }
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Converts given descriptor into TBool value.
+// ----------------------------------------------------------------------------
+//
+inline void CSamplerController::Str2Bool(const TDesC8& aBuf, TBool& aValue)
+    {
+    if (aBuf.CompareF(KFalse) == 0)
+        aValue = EFalse;
+    else
+        aValue = ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// Converts given descriptor into TInt value.
+// ----------------------------------------------------------------------------
+//
+inline void CSamplerController::Str2Int(const TDesC8& aBuf, TInt& aValue)
+    {
+    TLex8 conv;
+    conv.Assign(aBuf);
+    
+    if (conv.Val(aValue) != KErrNone)
+        aValue = 0;
+    }
+
+// ----------------------------------------------------------------------------
+// Converts given descriptor into TInt value.
+// ----------------------------------------------------------------------------
+//
+inline void CSamplerController::Str2Int(const TDesC8& aBuf, TUint32& aValue)
+    {
+    TInt temp(0);
+    
+    TLex8 conv;
+    conv.Assign(aBuf);
+    
+    if (conv.Val(temp) != KErrNone)
+        aValue = 0;
+    else
+        aValue = (TUint32)temp;
+    }
+
+// ----------------------------------------------------------------------------
+// Converts given boolean into a descriptor.
+// ----------------------------------------------------------------------------
+//
+inline TBuf8<16> CSamplerController::Bool2Str(const TBool& aValue)
+    {
+    TBuf8<16> buf;
+    
+    if (aValue)
+        buf.Copy(KTrue);
+    else
+        buf.Copy(KFalse);
+    
+    return buf;
+    }
+
+// ----------------------------------------------------------------------------
+// Converts given integer into a descriptor.
+// ----------------------------------------------------------------------------
+//
+inline TBuf8<16> CSamplerController::Int2Str(const TInt& aValue)
+    {
+    TBuf8<16> buf;
+    buf.AppendNum(aValue);
+   
+    return buf;
+    }
+
+
+void CSamplerController::HandlePluginLoaded( KSamplerPluginLoaderStatus aStatus )
+    {
+    
+    // process status value
+    switch(aStatus)
+        {
+        case 0:
+            LOGSTRING2("RSamplerController - one plugin loaded, status: %d", aStatus);
+            break;
+        case 1:
+            LOGSTRING2("RSamplerController - a plugin load failed: %d", aStatus);
+            break;
+        case 2:
+            LOGSTRING2("RSamplerController - plugin loading aborted: %d", aStatus);
+            break;
+        case 3:
+            LOGSTRING2("RSamplerController - all plugins loaded: %d", aStatus);
+            TRAPD(err, iPluginLoader->SortPluginsL(iPluginArray));
+            if(err != KErrNone)
+                {
+                LOGTEXT(_L("Sampler controller unable to sort plugins"));
+                }
+            
+            // call engine to finalize the startup
+            TRAPD(result, iObserver->HandleSamplerControllerReadyL(););
+            if(result != KErrNone)
+                {
+                LOGTEXT(_L("Failed to notify engine"));
+                }
+            break;
+        case 4:
+            LOGSTRING2("RSamplerController - error in loading plugins: %d", aStatus);
+            break;
+        default:
+            break;
+        }
+    }
+
+
+CSamplerPluginInterface* CSamplerController::GetPlugin(TUid aUid)
+	{
+	LOGTEXT(_L("RSamplerController::GetPlugin - entry"));
+	// check that plugin array contains samplers
+	if( iPluginArray && iPluginArray->Count() > 0 )
+	  {
+    	for(TInt i=0;i<iPluginArray->Count();i++)
+    		{
+	    	CSamplerPluginInterface* plugin = iPluginArray->At(i);
+	    	TUid uid = plugin->Id(-1);	// get parent uid first
+	    	if(uid == aUid)
+	    		{
+	    		LOGTEXT(_L("CSamplerController::GetPlugin() - main plug-in found!"));
+    			return plugin;
+				} 
+
+            if(plugin->SubId(aUid) != KErrNotFound)
+                {
+                LOGTEXT(_L("CSamplerController::GetPlugin() - subsampler found!"));
+                return plugin;
+                }
+    		}
+		}	
+	LOGTEXT(_L("CSamplerController::GetPlugin() - No plug-in found for UID"));
+
+	return (CSamplerPluginInterface*)0;
+	}
+
+// start user mode samplers
+void CSamplerController::StartSamplerPluginsL()
+    {
+    CSamplerPluginInterface* plugin = NULL;
+
+	if( iPluginArray )
+		{
+		TInt count(iPluginArray->Count());
+	
+		for(TInt i(0);i<count;i++)
+			{
+			plugin = iPluginArray->At(i);
+			// check if some error received when starting profiling
+			TRAPD(err, plugin->ResetAndActivateL(iStream));
+			LOGSTRING2(" RSamplerController::StartSamplerPlugin - plugin activated (0x%X)", plugin->Id(-1));  
+			if( err != KErrNone)
+				{
+				LOGSTRING2(" RSamplerController::StartSamplerPlugin - error %d", i);  
+				// handle received error, need to update UI!
+				iObserver->HandleError(err);
+				}
+            }
+	    }
+    }
+
+// stop user mode samplers
+TInt CSamplerController::StopSamplerPlugins()
+	{
+	TInt count(0);
+
+	if( iPluginArray && iPluginArray->Count() > 0 )
+		{
+		TInt i(0);
+		CSamplerPluginInterface* plugin = NULL;
+		// stop kernel mode samplers
+    	for(;i<iPluginArray->Count();i++)
+    		{
+			plugin = iPluginArray->At(i); 
+			TUint32 id = plugin->Id(-1).iUid;
+            LOGSTRING2(" CSamplerController::StopSamplerPlugins - traceId = %d",
+                        id);
+            // stop only started samplers
+            if(plugin->Enabled())
+                {
+                // stop selected plugin
+                plugin->StopSampling();
+                // check if user mode sampler, special flush needed to direct data to stream
+                if(plugin->GetSamplerType() == PROFILER_USER_MODE_SAMPLER)
+                    {
+                    LOGTEXT(_L(" CSamplerController::StopSamplerPlugins - flushing user mode sampler stream"));
+                    plugin->Flush();
+                    }
+                }
+            count++;
+    		}
+		}
+	return count; 	
+	}
+
+// end of file
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/src/SamplerPluginLoader.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,539 @@
+/*
+* 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 FILES
+#include    "SamplerPluginLoader.h"
+//#include	<piprofiler/EngineUIDs.h>
+#include    <utf.h> // CnvUtfConverter
+#include  	<basched.h>
+
+// CONSTANTS
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::NewL
+//
+// EPOC two-phased constructor
+// ----------------------------------------------------------------------------
+//
+CSamplerPluginLoader* CSamplerPluginLoader::NewL()
+    {
+    CSamplerPluginLoader* self = new( ELeave ) CSamplerPluginLoader;
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::CSamplerPluginLoader
+//
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CSamplerPluginLoader::CSamplerPluginLoader() : CActive( EPriorityStandard )
+    {
+    LOGSTRING( "CSamplerPluginLoader()::CSamplerPluginLoader()" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::ConstructL
+//
+// EPOC default constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::ConstructL( )
+    {
+    LOGSTRING( "CSamplerPluginLoader()::ConstructL()" );
+
+    // get list of implementations
+    CSamplerPluginInterface::ListAllImplementationsL( iImplInfoArray );
+
+    CActiveScheduler::Add( this );
+    }
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::~CSamplerPluginLoader
+//
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CSamplerPluginLoader::~CSamplerPluginLoader()
+    {
+    LOGSTRING( "CSamplerPluginLoader()::~CSamplerPluginLoader()" );
+
+    AbortAsyncLoad();
+
+    Cancel();
+    
+    // reset ECOM implementation info array
+    iImplInfoArray.ResetAndDestroy();   // This is needed
+    iImplInfoArray.Close();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::LoadAsync
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::LoadAsyncL(CArrayPtrFlat<CSamplerPluginInterface>* aPluginArray )
+    {
+    iPluginArray = aPluginArray;
+
+    // Reset iterator
+    iImplInfoArrayIterator = 0;
+
+    LOGSTRING2( "CSamplerPluginLoader()::Implementation info count: %d",
+        iImplInfoArray.Count() );
+
+    NotifyProgress();
+
+    //Begin CActive asynchronous loop.
+    CompleteOwnRequest();
+    }
+    
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::LoadSyncL
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::LoadSyncL(CArrayPtrFlat<CSamplerPluginInterface>* aPluginArray)
+    {
+    // cancel first active object from loading samplers dynamically
+    Cancel();
+    CSamplerPluginInterface* plugin = NULL;
+    
+    iPluginArray = aPluginArray;
+
+    // Get a list of all implementations, even though we only want one specific
+    // one. There appears to be no way to otherwise extract a specific implementation
+    // info object :(
+    // Search for the implementation that matches aImplementationUid
+    const TInt impCount = iImplInfoArray.Count();
+    for( TInt i=0; i<impCount; i++ )
+        {
+        const CImplementationInformation* info = iImplInfoArray[ i ];
+            {
+            TRAPD(ret, plugin = &CreatePluginInstanceL( *info ); );
+            if( ret == KErrNone )
+                {
+                // Plugin ownership is transfered to iPluginArray
+                InsertPluginInOrderL( plugin, iPluginArray );
+                }
+            else
+                {
+                // Error note is displayed even if plugin is not loaded
+                LOGSTRING2("CSamplerPluginLoader::LoadSyncL() - plugin load failed, error %d", ret);
+                }
+            break;
+            }
+        }
+
+    if  ( plugin == NULL )
+        {
+        User::Leave( KErrNotFound );
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::AbortAsyncLoad
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::AbortAsyncLoad()
+    {
+    LOGSTRING( "CSamplerPluginLoader()::AbortAsyncLoad()" );
+    Cancel();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::RunL
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::RunL()
+    {
+    iRunLDebugCount++;
+    LoadNextPluginL();
+
+    // Check if there are still more plugins to be loaded:
+    if ( iImplInfoArrayIterator < iImplInfoArray.Count() )
+        {
+        NotifyProgress();
+        // Continue CActive asynchronous loop.
+        CompleteOwnRequest();
+        }
+    else
+        {
+        // All plugins loaded:
+        LOGSTRING( "CSamplerPluginLoader()::Loading plugins finished." );
+        NotifyFinished();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CScGenreItemConstructionConductor::CompleteOwnRequest
+//
+// Issue request complete notification.
+// ---------------------------------------------------------------------------
+void CSamplerPluginLoader::CompleteOwnRequest()
+    {
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+    SetActive();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::RunError
+// ----------------------------------------------------------------------------
+//
+TInt CSamplerPluginLoader::RunError( TInt aError )
+    {
+    // This method is called when a plugin loading fails.
+    // Always "fake" the return value so that ActiveSchedule
+    // keeps running and later plugins are continued to be loaded.
+    // Check if still plugins to be loaded:
+    LOGTEXT(_L("CSamplerPluginLoader::RunError() - error in loading plugin"));
+    if( iImplInfoArrayIterator < iImplInfoArray.Count() )
+        {
+        NotifyProgress();
+
+        //Continue CActive asynchronous loop.
+        CompleteOwnRequest();
+        }
+    else // All plugins loaded:
+        {
+        NotifyFinished();
+        }
+
+    if ( aError == KLeaveExit )
+        {
+        return KLeaveExit;
+        }
+
+    return KErrNone;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::DoCancel
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::DoCancel()
+    {
+
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::NotifyProgress
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::NotifyProgress()
+    {
+    if( iObserver )
+        {
+        iObserver->HandlePluginLoaded( MSamplerPluginLoadObserver::ESamplerSuccess);
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::NotifyFinished
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::NotifyFinished()
+    {
+    if( iObserver )
+        {
+        iObserver->HandlePluginLoaded( MSamplerPluginLoadObserver::ESamplerFinished );
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::SetObserver
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::SetObserver(MSamplerPluginLoadObserver* aObserver)
+    {
+    LOGSTRING2("CSamplerPluginLoader()::Observer set:0x%X", aObserver);
+    iObserver = aObserver;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::ParseToUid
+// Parses a UID from descriptor of form '0xNNNNNNNN' where N is hexadecimal.
+//
+// ----------------------------------------------------------------------------
+//
+TInt CSamplerPluginLoader::ParseToUid( const TDesC8& aSource, TUid& aTarget )
+    {
+    // Remove "0x" from the descriptor if it exists
+    _LIT8(KHexPrefix, "0x");
+
+    TPtrC8 pSource( aSource );
+    const TInt prefixPosition = pSource.Find( KHexPrefix );
+    if  ( prefixPosition != KErrNotFound )
+        {
+        pSource.Set( aSource.Mid( prefixPosition + KHexPrefix().Length() ) );
+        }
+
+    // Parse to integer
+    TLex8 lex( pSource );
+    TUint integer = 0;
+
+    // Parse using TRadix::EHex as radix:
+    const TInt err = lex.Val( integer, EHex );
+    aTarget.iUid = integer;
+
+    if( err != KErrNone )
+        {
+        // If parsing parent UID failed, do not load plugin:
+        LOGSTRING2(
+            "CSamplerPluginLoader()::Parsing parent UID failed. Error code:%d",
+            err );
+        }
+    return err;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::ParseOrderNumber
+//
+//
+// ----------------------------------------------------------------------------
+//
+TInt CSamplerPluginLoader::ParseOrderNumber( const TDesC8& aSource, TInt& aOrderNumber )
+    {
+    // Parse plugin's order number from opaque_data:
+    TLex8 lex( aSource );
+    const TInt orderErr = lex.Val( aOrderNumber );
+    return orderErr;
+    }
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::LoadNextPluginL
+// Iterate through iImplInfoArray. Load the plugin if it is eligible for
+// loading. Loaded plugin is added to iPluginArray. Each time a plugin is
+// loaded, iObserver is notified.
+//
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::LoadNextPluginL()
+    {
+    // Iterate through iImplInfoArray. This loop continues between function
+    // calls. Therefore member variable iImplInfoArrayIterator is used as a
+    // counter. Loop will break when match is found and continues on next RunL.
+    for( ; iImplInfoArrayIterator < iImplInfoArray.Count();  )
+        {
+        const CImplementationInformation* info =
+            iImplInfoArray[ iImplInfoArrayIterator ];
+
+        iImplInfoArrayIterator++;
+
+//        PrintInfoDebug( *info, iImplInfoArrayIterator, iImplInfoArray.Count() );
+        LOGSTRING3("CSamplerPluginLoader() - iImplInfoArrayIterator %d, iImplInfoArray.Count() %d", 
+                iImplInfoArrayIterator, 
+                iImplInfoArray.Count() );
+        
+        // If this plugin is OK -> load it:
+        LOGSTRING2( "CSamplerPluginLoader() %S eligible for parent",
+                &info->DisplayName());
+        CSamplerPluginInterface* plugin = NULL;
+        TInt error(KErrNone);
+        // Create plugin. Trap leave for debugging purposes.
+        TRAP( error, plugin = &CreatePluginInstanceL( *info ); );
+
+        if( error == KErrNone )
+            {
+            // Plugin ownership is transfered to iPluginArray
+            InsertPluginInOrderL( plugin, iPluginArray );
+            }
+        else
+            {
+            // Error note is displayed even if plugin is not loaded
+            LOGSTRING2("CSamplerPluginLoader::LoadNextPluginL() - plugin load failed, error %d", error);
+            }
+        // Wait for next round
+        break;
+        }
+    }
+ 
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::CreatePluginInstanceL
+//
+//
+// ----------------------------------------------------------------------------
+//
+
+CSamplerPluginInterface& CSamplerPluginLoader::CreatePluginInstanceL(
+    const CImplementationInformation& aImpInfo )
+    {
+    // Now we can load the plugin
+    const TUid implUid = aImpInfo.ImplementationUid();
+
+    CSamplerPluginInterface* plugin = CSamplerPluginInterface::NewL( implUid , (TAny*)&aImpInfo.DisplayName() );
+    CleanupStack::PushL ( plugin );
+
+    // Parse plugin's order number from opaque_data:
+    TInt orderNumber(0);
+    const TInt orderErr = ParseOrderNumber( aImpInfo.OpaqueData(), orderNumber );
+
+    if  ( orderErr == KErrNone && orderNumber >= 0 )
+        {
+        	plugin->iOrder = orderNumber;
+        }
+    CleanupStack::Pop( plugin ); // CSamplerController is now responsible for this memory.
+
+    return *plugin;
+    }
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::SortPluginsL
+//
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::SortPluginsL(
+        CArrayPtrFlat<CSamplerPluginInterface>* aPlugins )
+    {
+    RPointerArray<CSamplerPluginInterface> plugins;
+    TLinearOrder<CSamplerPluginInterface> order( CSamplerPluginLoader::Compare );
+
+    // Insertion will also order
+    for( TInt i = 0; i < aPlugins->Count(); i++ )
+        {
+        plugins.InsertInOrderL( (*aPlugins)[i], order );
+        }
+
+    // Replace original array content with sorted items
+    aPlugins->Reset();
+    for( TInt i = 0; i < plugins.Count(); i++ )
+        {
+        aPlugins->AppendL( plugins[i] );
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::Compare
+//
+// Compare two plugins.
+// Precedence:
+// [1. plugin provider category]
+// 2. plugin order number
+// 3. plugin caption
+// Plugin provider gategory is currently disabled (not supported yet).
+// ----------------------------------------------------------------------------
+//
+TInt CSamplerPluginLoader::Compare( const CSamplerPluginInterface& aFirst,
+                               const CSamplerPluginInterface& aSecond )
+    {
+    // compare indexes and sort
+    return CompareIndex( aFirst, aSecond );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::InsertPluginInOrderL
+//
+// ----------------------------------------------------------------------------
+//
+void CSamplerPluginLoader::InsertPluginInOrderL(
+    CSamplerPluginInterface* aPlugin,
+    CArrayPtrFlat<CSamplerPluginInterface>* aPlugins )
+    {
+    CSamplerPluginInterface* comparedPlugin;
+    TInt comparison = 0;
+    TBool inserted = EFalse;
+
+    for( TInt i = 0; i < aPlugins->Count(); i++ )
+        {
+        comparedPlugin = (*aPlugins)[i];
+        // Optimization: do not call time consuming Compare() multiple times!
+        comparison = Compare( *aPlugin, *comparedPlugin );
+        if( comparison < 0 )
+            {
+            aPlugins->InsertL( i, aPlugin );
+            inserted = ETrue;
+            break;
+            }
+        else if( comparison == 0 )
+            {
+            aPlugins->InsertL( i+1, aPlugin );
+            inserted = ETrue;
+            break;
+            }
+        }
+    // Plugin was not before any other plugin - make sure it's appended
+    if( !inserted )
+        {
+        aPlugins->AppendL( aPlugin );
+        }
+
+    #ifdef _GS_PLUGINLOADER_SORTING_TRACES
+        PrintOrderTraces( aPlugins );
+    #endif // _GS_PLUGINLOADER_SORTING_TRACES
+
+    }
+
+// ----------------------------------------------------------------------------
+// CSamplerPluginLoader::CompareIndex
+// ----------------------------------------------------------------------------
+//
+TInt CSamplerPluginLoader::CompareIndex( const CSamplerPluginInterface& aFirst,
+                                    const CSamplerPluginInterface& aSecond )
+    {
+    TInt comparison = KSamplerComparisonEqual;
+    // The plugin having index is before the one not having one
+
+    if( aFirst.iOrder  == KSamplerPluginNotIndexed &&
+        aSecond.iOrder == KSamplerPluginNotIndexed )
+        {
+        // Neither have index -> equal
+        comparison = KSamplerComparisonEqual;
+        }
+    else if( aFirst.iOrder == KSamplerPluginNotIndexed )
+        {
+        // The plugin having index is before the one not having one
+        comparison = KSamplerComparisonAfter;
+        }
+    else if( aSecond.iOrder == KSamplerPluginNotIndexed )
+        {
+        // The plugin having index is before the one not having one
+        comparison = KSamplerComparisonBefore;
+        }
+    else if( aFirst.iOrder < aSecond.iOrder )
+        {
+        // Compare actual index values
+        comparison = KSamplerComparisonBefore;
+        }
+    else if( aFirst.iOrder > aSecond.iOrder )
+        {
+        // Compare actual index values
+        comparison = KSamplerComparisonAfter;
+        }
+    return comparison;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/src/WriterController.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,283 @@
+/*
+* 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 <piprofiler/EngineUIDs.h>
+#include <piprofiler/ProfilerTraces.h>
+
+#include "WriterController.h"
+
+const TInt KMaxWriterPluginCount = 10;
+
+
+CWriterController* CWriterController::NewL(CProfilerSampleStream& aStream)
+    {
+    CWriterController* self = new( ELeave ) CWriterController(aStream);
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CWriterController::CWriterController(CProfilerSampleStream& aStream) : 
+    iStream(aStream)
+    {
+    }
+
+void CWriterController::ConstructL()
+	{
+	// initiate writer plugin list
+
+	}
+
+
+void CWriterController::InitialiseWriterListL()
+    {
+    // create new writer plugin array
+    iPluginArray = new(ELeave) CArrayPtrFlat<CWriterPluginInterface>( KMaxWriterPluginCount );
+    
+    // create new writer plugin loader
+    iPluginLoader = CWriterPluginLoader::NewL();
+    iPluginLoader->SetObserver( this );
+    iPluginLoader->LoadAsyncL( iPluginArray );
+
+    LOGTEXT(_L(" RWriterController::InitialiseWriterList - exit"));	
+    }
+
+CWriterController::~CWriterController()
+    {
+    LOGTEXT(_L("RWriterController::~RWriterController" ));
+    if ( iPluginArray )
+        {
+        // destroy the plugin instances
+        // empty loaded plugins from array
+        for(TInt i(0);i<iPluginArray->Count();i++)
+            {
+            if(iPluginArray->At(i))
+                {
+                delete iPluginArray->At(i);
+                iPluginArray->At(i) = NULL;
+                }
+            }
+        iPluginArray->Reset();
+        delete iPluginArray;
+        iPluginArray = NULL;
+        }
+    
+    if ( iPluginLoader )
+        {
+        iPluginLoader->AbortAsyncLoad();
+        delete iPluginLoader;
+        iPluginLoader = NULL;
+        }
+
+    }
+
+
+void CWriterController::InitialisePluginStream()
+	{
+	LOGTEXT(_L("RWriterController::InitialisePluginStream - entry"));
+	if( iPluginArray )
+		{
+		TInt pluginCount(iPluginArray->Count());
+	
+		LOGSTRING2("RWriterController::InitialisePluginStream - plugin count %d, searching through", pluginCount);
+	  	for(TInt i=0;i<pluginCount;i++)
+	  	    {
+  			LOGSTRING2("RWriterController::InitialisePluginStream - getting plugin n:o: %d...", i);
+	    	CWriterPluginInterface* plugin = iPluginArray->At(i);
+	  		LOGSTRING2("RWriterController::InitialisePluginStream - writer found, 0x%x, initializing stream...", plugin->Id());
+    		plugin->SetStream(iStream);
+	  		LOGTEXT(_L("RSamplerController::InitialisePluginStream - succeeded!"));
+	  	    }
+	  	}
+	LOGTEXT(_L("RSamplerController::InitialisePluginStream - exit"));
+
+	}
+
+CArrayPtrFlat<CWriterPluginInterface>* CWriterController::GetPluginList()
+    {
+	return iPluginArray;
+    }
+
+void CWriterController::HandlePluginLoaded( KWriterPluginLoaderStatus aStatus )
+    {
+    
+    switch(aStatus)
+        {
+        case 0:
+            LOGSTRING2("RWriterController - one plugin loaded, status: %d", aStatus);
+            break;
+        case 1:
+            LOGSTRING2("RWriterController - a plugin load failed: %d", aStatus);
+            break;
+        case 2:
+            LOGSTRING2("RWriterController - plugin loading aborted: %d", aStatus);
+            break;
+        case 3:
+            LOGSTRING2("RWriterController - all plugins loaded: %d", aStatus);
+            // set stream after all loaded writer plugins
+            InitialisePluginStream();
+            break;
+        case 4:
+            LOGSTRING2("RWriterController - error in loading plugins: %d", aStatus);
+            break;
+        default:
+            break;
+        }
+    }
+
+
+
+TUid CWriterController::GetPluginUID(TInt traceId)
+    {
+	LOGSTRING2(" RWriterController::GetPluginUID - checking UID for traceId = %d",traceId);	
+	// this part has to be changed for each new writer
+
+    if( iPluginArray && iPluginArray->Count() > 0 )
+        {
+        for(TInt i=0;i<iPluginArray->Count();i++)
+            {
+            CWriterPluginInterface* plugin = iPluginArray->At(i); 
+            if(plugin->Id().iUid == traceId)
+                {
+                LOGSTRING2(" RWriterController::GetPluginUID - got: 0x%X",plugin->Id());	
+                return plugin->Id();
+                }
+            }
+        }	
+	return KWriterNoneSelected;
+
+    }
+
+CWriterPluginInterface* CWriterController::GetActiveWriter()
+    {
+    CWriterPluginInterface* plugin = NULL;
+
+	if( iPluginArray )
+		{
+		TInt count(iPluginArray->Count());
+		
+		for(TInt i=0;i<count;i++)
+			{
+			plugin = iPluginArray->At(i); 
+			if(plugin->GetEnabled())
+				{
+				return plugin;
+				}
+			}
+		}
+
+    return (CWriterPluginInterface*)0;
+    }
+
+TUint32 CWriterController::GetWriterType(TUint32 writerId)
+    {
+    TUid id;
+    
+    id = this->GetPluginUID(writerId);
+    
+    if(id != KWriterNoneSelected)
+        return GetPlugin(id)->GetWriterType();
+    else
+        return 0;
+    }
+
+CWriterPluginInterface* CWriterController::GetPlugin(TUid aUid)
+    {
+    if( iPluginArray && iPluginArray->Count() > 0 )
+        {
+        for(TInt i=0;i<iPluginArray->Count();i++)
+            {
+            CWriterPluginInterface* plugin = iPluginArray->At(i); 
+            // check if searched uid found
+            if(plugin->Id().iUid == aUid.iUid)
+                {
+                // return pointer to found plugin
+                return plugin;
+                }
+            }
+        }
+    // return null plugin
+	return (CWriterPluginInterface*)0;
+    }
+
+TInt CWriterController::StartSelectedPlugin()
+	{
+	LOGTEXT(_L("RWriterController::StartSelectedPlugin - entry"));
+	
+    CWriterPluginInterface* plugin = GetActiveWriter();
+    
+    if(plugin)
+        {
+        return plugin->Start();
+		}
+    
+	LOGTEXT(_L("RWriterController::StartSelectedPlugin - exit"));
+	return KErrNotFound;
+	}
+
+void CWriterController::StopSelectedPlugin()
+	{
+	LOGTEXT(_L("RWriterController::StopSelectedPlugin - entry"));
+    
+    CWriterPluginInterface* plugin = GetActiveWriter();
+    
+	if(plugin)
+		{
+		plugin->Stop();
+		}
+	LOGTEXT(_L("RWriterController::StopSelectedPlugin - exit"));
+	}
+
+/** Set selected plugin active **/
+void CWriterController::SetPluginActive(TUid uid, const TWriterPluginValueKeys aKey)
+    {
+	CWriterPluginInterface* plugin = NULL;
+	_LIT(KDummy, "");
+	TBuf<1> buf;
+	buf.Append(KDummy);
+
+	for(TInt i(0);i<iPluginArray->Count();i++)
+	    {
+	    plugin = iPluginArray->At(i);
+	    if(plugin->Id().iUid == uid.iUid)
+	        {
+	        plugin->SetValue(aKey, buf);
+	        }
+	    else
+	        {
+	        plugin->SetValue(EWriterPluginDisabled, buf);
+	        }
+	    }
+    }
+
+TInt CWriterController::SetPluginSettings(TUid aUid, TDes& aDes)
+    {
+	LOGSTRING2(" CWriterController::SetPluginSettings, traceId = 0x%X", aUid.iUid);	
+	GetPlugin(aUid)->SetValue(EWriterPluginSettings, aDes);
+	return KErrNone;
+    }
+
+/** Get settings for a specific plugin **/
+void CWriterController::GetPluginSettings(TUid uid, TDes& aVal)
+    {
+	GetPlugin(uid)->GetValue(EWriterPluginSettings, aVal);
+    }
+
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/engine/src/WriterPluginLoader.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,565 @@
+/*
+* 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 FILES
+#include    "WriterPluginLoader.h"
+//#include	<piprofiler/EngineUIDs.h>
+#include    <utf.h> // CnvUtfConverter
+#include  	<basched.h>
+
+// constants
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::NewL
+//
+// EPOC two-phased constructor
+// ----------------------------------------------------------------------------
+//
+CWriterPluginLoader* CWriterPluginLoader::NewL()
+    {
+    CWriterPluginLoader* self = new( ELeave ) CWriterPluginLoader;
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::CWriterPluginLoader
+//
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CWriterPluginLoader::CWriterPluginLoader() : CActive( EPriorityStandard )
+    {
+    LOGTEXT(_L("CWriterPluginLoader()::CWriterPluginLoader()" ));
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::ConstructL
+//
+// EPOC default constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::ConstructL( )
+    {
+    LOGTEXT(_L("CWriterPluginLoader()::ConstructL()" ));
+    
+    // get list of implementations
+    CWriterPluginInterface::ListAllImplementationsL( iImplInfoArray );
+    
+    CActiveScheduler::Add( this );
+    }
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::~CWriterPluginLoader
+//
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CWriterPluginLoader::~CWriterPluginLoader()
+    {
+    LOGTEXT(_L("CWriterPluginLoader()::~CWriterPluginLoader()") );
+
+    AbortAsyncLoad();
+
+    Cancel();
+
+    // reset ECOM implementation info array
+    iImplInfoArray.ResetAndDestroy(); // This is needed
+    iImplInfoArray.Close();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::LoadAsync
+//
+//
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::LoadAsyncL( CArrayPtrFlat<CWriterPluginInterface>* aPluginArray )
+    {
+    iPluginArray = aPluginArray;
+    
+    // Reset iterator:
+    iImplInfoArrayIterator = 0;
+
+    LOGSTRING2( "CWriterPluginLoader()::Implementation info count: %d",
+        iImplInfoArray.Count() );
+
+    NotifyProgress();
+
+    //Begin CActive asynchronous loop.
+    CompleteOwnRequest();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::LoadSyncL
+//
+//
+// ----------------------------------------------------------------------------
+//
+CWriterPluginInterface& CWriterPluginLoader::LoadSyncL( TUid aImplementationUid )
+    {
+    Cancel();
+    CWriterPluginInterface* plugin = NULL;
+
+    // Get a list of all implementations, even though we only want one specific
+    // one. There appears to be no way to otherwise extract a specific implementation
+    // info object :(
+    // Search for the implementation that matches aImplementationUid
+    const TInt impCount = iImplInfoArray.Count();
+    for( TInt i=0; i<impCount; i++ )
+        {
+        const CImplementationInformation* info = iImplInfoArray[ i ];
+        if  ( info->ImplementationUid() == aImplementationUid )
+            {
+            TRAPD(ret, plugin = &CreatePluginInstanceL( *info ); );
+            if( ret == KErrNone )
+                {
+                // Plugin ownership is transfered to iPluginArray
+                InsertPluginInOrderL( plugin, iPluginArray );
+                }
+            else
+                {
+                // Error note is displayed even if plugin is not loaded
+                LOGSTRING2("CWriterPluginLoader::LoadSyncL() - plugin load failed, error %d", ret);
+                }
+            break;
+            }
+        }
+
+    if  ( plugin == NULL )
+        {
+        User::Leave( KErrNotFound );
+        }
+    return *plugin;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::AbortAsyncLoad
+//
+//
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::AbortAsyncLoad()
+    {
+    LOGTEXT(_L("CWriterPluginLoader()::AbortAsyncLoad()" ));
+    Cancel();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::RunL
+//
+//
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::RunL()
+    {
+    iRunLDebugCount++;
+    LoadNextPluginL();
+
+    // Check if there are still more plugins to be loaded:
+    if ( iImplInfoArrayIterator < iImplInfoArray.Count() )
+        {
+        NotifyProgress();
+        // Continue CActive asynchronous loop.
+        CompleteOwnRequest();
+        }
+    else
+        {
+        // All plugins loaded:
+        LOGTEXT(_L("CWriterPluginLoader()::Loading plugins finished." ));
+        NotifyFinished();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CScGenreItemConstructionConductor::CompleteOwnRequest
+//
+// Issue request complete notification.
+// ---------------------------------------------------------------------------
+void CWriterPluginLoader::CompleteOwnRequest()
+    {
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+    SetActive();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::RunError
+//
+//
+// ----------------------------------------------------------------------------
+//
+TInt CWriterPluginLoader::RunError( TInt aError )
+    {
+    // This method is called when a plugin loading fails.
+    // Always "fake" the return value so that ActiveSchedule
+    // keeps running and later plugins are continued to be loaded.
+    // Check if still plugins to be loaded:
+    if( iImplInfoArrayIterator < iImplInfoArray.Count() )
+        {
+        NotifyProgress();
+
+        //Continue CActive asynchronous loop.
+        CompleteOwnRequest();
+        }
+    else // All plugins loaded:
+        {
+        NotifyFinished();
+        }
+
+    if ( aError == KLeaveExit )
+        {
+        return KLeaveExit;
+        }
+
+    return KErrNone;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::DoCancel
+//
+//
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::DoCancel()
+    {
+
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::NotifyProgress
+//
+//
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::NotifyProgress()
+    {
+    if( iObserver )
+        {
+        iObserver->HandlePluginLoaded( MWriterPluginLoadObserver::EWriterSuccess);
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::NotifyFinished
+//
+//
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::NotifyFinished()
+    {
+    if( iObserver )
+        {
+        iObserver->HandlePluginLoaded( MWriterPluginLoadObserver::EWriterFinished );
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::SetObserver
+//
+//
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::SetObserver(MWriterPluginLoadObserver* aObserver)
+    {
+    LOGSTRING2("CWriterPluginLoader()::Observer set:0x%X", aObserver);
+    iObserver = aObserver;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::ParseToUid
+// Parses a UID from descriptor of form '0xNNNNNNNN' where N is hexadecimal.
+//
+// ----------------------------------------------------------------------------
+//
+TInt CWriterPluginLoader::ParseToUid( const TDesC8& aSource, TUid& aTarget )
+    {
+    // Remove "0x" from the descriptor if it exists
+    _LIT8(KHexPrefix, "0x");
+
+    TPtrC8 pSource( aSource );
+    const TInt prefixPosition = pSource.Find( KHexPrefix );
+    if  ( prefixPosition != KErrNotFound )
+        {
+        pSource.Set( aSource.Mid( prefixPosition + KHexPrefix().Length() ) );
+        }
+
+    // Parse to integer
+    TLex8 lex( pSource );
+    TUint integer = 0;
+
+    // Parse using TRadix::EHex as radix:
+    const TInt err = lex.Val( integer, EHex );
+    aTarget.iUid = integer;
+
+    if( err != KErrNone )
+        {
+        // If parsing parent UID failed, do not load plugin:
+        LOGSTRING2(
+            "CWriterPluginLoader()::Parsing parent UID failed. Error code:%d",
+            err );
+        }
+    return err;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::ParseOrderNumber
+//
+//
+// ----------------------------------------------------------------------------
+//
+TInt CWriterPluginLoader::ParseOrderNumber( const TDesC8& aSource, TInt& aOrderNumber )
+    {
+    // Parse plugin's order number from opaque_data:
+    TLex8 lex( aSource );
+    const TInt orderErr = lex.Val( aOrderNumber );
+    return orderErr;
+    }
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::LoadNextPluginL
+// Iterate through iImplInfoArray. Load the plugin if it is eligible for
+// loading. Loaded plugin is added to iPluginArray. Each time a plugin is
+// loaded, iObserver is notified.
+//
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::LoadNextPluginL()
+    {
+    // Iterate through iImplInfoArray. This loop continues between function
+    // calls. Therefore member variable iImplInfoArrayIterator is used as a
+    // counter. Loop will break when match is found and continues on next RunL.
+    for( ; iImplInfoArrayIterator < iImplInfoArray.Count();  )
+        {
+        const CImplementationInformation* info =
+            iImplInfoArray[ iImplInfoArrayIterator ];
+
+        iImplInfoArrayIterator++;
+
+        // If this plugin is OK -> load it:
+        LOGSTRING2( "CWriterPluginLoader() %S eligible for parent",
+                &info->DisplayName() );
+        CWriterPluginInterface* plugin = NULL;
+        TInt error(KErrNone);
+        // Create plugin. Trap leave for debugging purposes.
+        TRAP( error, plugin = &CreatePluginInstanceL( *info ); );
+        if( error == KErrNone )
+            {
+            // Plugin ownership is transfered to iPluginArray
+            InsertPluginInOrderL( plugin, iPluginArray );
+            }
+        else
+            {
+            LOGSTRING2("CWriterPluginLoader::LoadNextPluginL() - plugin load failed, error %d", error);
+            }
+        // Wait for next round
+        break;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::CreatePluginInstanceL
+//
+//
+// ----------------------------------------------------------------------------
+//
+
+CWriterPluginInterface& CWriterPluginLoader::CreatePluginInstanceL(
+    const CImplementationInformation& aImpInfo )
+    {
+    // Now we can load the plugin
+    const TUid implUid = aImpInfo.ImplementationUid();
+
+    CWriterPluginInterface* plugin = CWriterPluginInterface::NewL( implUid , (TAny*)&aImpInfo.DisplayName() );
+    CleanupStack::PushL ( plugin );
+   
+    TInt orderNumber(0);
+    const TInt orderErr = ParseOrderNumber( aImpInfo.OpaqueData(), orderNumber );
+    
+    if  ( orderErr == KErrNone && orderNumber >= 0 )
+        {
+        plugin->iOrder = orderNumber;
+        }
+
+    CleanupStack::Pop( plugin ); // CWriterController is now responsible for this memory.
+
+    return *plugin;
+    }
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::SortPluginsL
+//
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::SortPluginsL(
+        CArrayPtrFlat<CWriterPluginInterface>* aPlugins )
+    {
+    RPointerArray<CWriterPluginInterface> plugins;
+    TLinearOrder<CWriterPluginInterface> order( CWriterPluginLoader::Compare );
+
+    // Insertion will also order
+    for( TInt i = 0; i < aPlugins->Count(); i++ )
+        {
+        plugins.InsertInOrderL( (*aPlugins)[i], order );
+        }
+
+    // Replace original array content with sorted items
+    aPlugins->Reset();
+    for( TInt i = 0; i < plugins.Count(); i++ )
+        {
+        aPlugins->AppendL( plugins[i] );
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::Compare
+//
+// Compare two plugins.
+// Precedence:
+// [1. plugin provider category]
+// 2. plugin order number
+// 3. plugin caption
+// Plugin provider gategory is currently disabled (not supported yet).
+// ----------------------------------------------------------------------------
+//
+TInt CWriterPluginLoader::Compare( const CWriterPluginInterface& aFirst,
+                               const CWriterPluginInterface& aSecond )
+    {
+    return CompareIndex( aFirst, aSecond );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::InsertPluginInOrderL
+//
+// ----------------------------------------------------------------------------
+//
+void CWriterPluginLoader::InsertPluginInOrderL(
+    CWriterPluginInterface* aPlugin,
+    CArrayPtrFlat<CWriterPluginInterface>* aPlugins )
+    {
+    CWriterPluginInterface* comparedPlugin;
+    TInt comparison = 0;
+    TBool inserted = EFalse;
+
+    for( TInt i = 0; i < aPlugins->Count(); i++ )
+        {
+        comparedPlugin = (*aPlugins)[i];
+        // Optimization: do not call time consuming Compare() multiple times!
+        comparison = Compare( *aPlugin, *comparedPlugin );
+        if( comparison < 0 )
+            {
+            aPlugins->InsertL( i, aPlugin );
+            inserted = ETrue;
+            break;
+            }
+        else if( comparison == 0 )
+            {
+            aPlugins->InsertL( i+1, aPlugin );
+            inserted = ETrue;
+            break;
+            }
+        }
+    // Plugin was not before any other plugin - make sure it's appended
+    if( !inserted )
+        {
+        aPlugins->AppendL( aPlugin );
+        }
+
+    #ifdef _GS_PLUGINLOADER_SORTING_TRACES
+        PrintOrderTraces( aPlugins );
+    #endif // _GS_PLUGINLOADER_SORTING_TRACES
+
+    }
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::CompareIndex
+//
+//
+// ----------------------------------------------------------------------------
+//
+
+TInt CWriterPluginLoader::CompareIndex( const CWriterPluginInterface& aFirst,
+                                    const CWriterPluginInterface& aSecond )
+    {
+    TInt comparison = KWriterComparisonEqual;
+    // The plugin having index is before the one not having one
+
+    if( aFirst.iOrder  == KWriterPluginNotIndexed &&
+        aSecond.iOrder == KWriterPluginNotIndexed )
+        {
+        // Neither have index -> equal
+        comparison = KWriterComparisonEqual;
+        }
+    else if( aFirst.iOrder == KWriterPluginNotIndexed )
+        {
+        // The plugin having index is before the one not having one
+        comparison = KWriterComparisonAfter;
+        }
+    else if( aSecond.iOrder == KWriterPluginNotIndexed )
+        {
+        // The plugin having index is before the one not having one
+        comparison = KWriterComparisonBefore;
+        }
+    else if( aFirst.iOrder < aSecond.iOrder )
+        {
+        // Compare actual index values
+        comparison = KWriterComparisonBefore;
+        }
+    else if( aFirst.iOrder > aSecond.iOrder )
+        {
+        // Compare actual index values
+        comparison = KWriterComparisonAfter;
+        }
+    return comparison;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CWriterPluginLoader::GetDocument
+//
+//
+// ----------------------------------------------------------------------------
+//
+/*
+CWriterBaseDocument* CWriterPluginLoader::GetDocument()
+    {
+    CWriterBaseDocument* document = static_cast<CWriterBaseDocument*>( iAppUi->Document() );
+    return document;
+    }
+*/
+
+//  End of File
Binary file perfsrv/piprofiler/group/ReleaseNotes_PIProfiler.txt has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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:  
+*
+*/
+//PRJ_PLATFORMS
+//DEFAULT ARMV5SMP
+
+#include <platform_paths.hrh>
+
+#include "../piprofiler_plat/group/bld.inf"
+#include "../engine/group/bld.inf"
+#include "../plugins/GeneralsPlugin/group/bld.inf"
+#include "../plugins/BUPplugin/group/bld.inf"
+#include "../plugins/DebugOutputWriterPlugin/group/bld.inf"
+#include "../plugins/DiskWriterPlugin/group/bld.inf"
+
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
+    #include "../plugins/PWRPlugin/group/bld.inf"
+#endif
+
+PRJ_EXPORTS
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
+    ../rom/piprofiler.iby CORE_IBY_EXPORT_PATH(tools,piprofiler.iby)
+#else
+    ../rom/piprofiler_s2.iby CORE_IBY_EXPORT_PATH(tools,piprofiler.iby)
+#endif
+../rom/piprofiler_ldd.iby CORE_IBY_EXPORT_PATH(tools/rom,piprofiler_ldd.iby)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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:  File that exports the files belonging to 
+:                PIProfilerAPI
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+
+PRJ_EXPORTS
+../inc/ProfilerTraces.h                   OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerTraces.h)
+../inc/ProfilerVersion.h                  OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerVersion.h)
+../inc/ProfilerConfig.h                   OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerConfig.h)
+../inc/ProfilerAttributes.h               OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerAttributes.h)
+../inc/ProfilerGenericClassesUsr.h        OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerGenericClassesUsr.h)
+../inc/ProfilerGenericClassesUsr.inl      OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerGenericClassesUsr.inl)
+../inc/ProfilerGenericClassesKrn.h        OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerGenericClassesKrn.h)
+../inc/ProfilerGenericClassesKrn.inl      OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerGenericClassesKrn.inl)
+../inc/ProfilerGenericClassesCommon.h     OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerGenericClassesCommon.h)
+../inc/ProfilerEngineAPI.h 				  OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerEngineAPI.h)
+../inc/EngineUIDs.h                       OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/EngineUIDs.h)
+../inc/PluginDriver.h                     OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/PluginDriver.h)
+../inc/PluginDriver.inl                   OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/PluginDriver.inl)
+../inc/PluginSampler.h                    OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/PluginSampler.h)
+../inc/ProfilerSession.h                  OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerSession.h)
+../inc/SamplerPluginInterface.h           OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/SamplerPluginInterface.h)
+../inc/SamplerPluginInterface.inl         OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/SamplerPluginInterface.inl)
+../inc/WriterPluginInterface.h            OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/WriterPluginInterface.h)
+../inc/WriterPluginInterface.inl          OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/WriterPluginInterface.inl)
+../inc/ProfilerEngineStatusChecker.h      OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerEngineStatusChecker.h)
+../inc/ProfilerEngineStatusChecker.inl    OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerEngineStatusChecker.inl)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/EngineUIDs.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* 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 ENGINEUIDS_H
+#define ENGINEUIDS_H
+
+#include <e32cmn.h>
+
+// No item is selected in the container's listbox
+const TUid KSamplerNoneSelected = { 0x00000001 };
+const TUid KWriterNoneSelected = { 0x00000002 };
+
+#endif // ENGINEUIDS_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/PluginDriver.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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 <piprofiler/ProfilerGenericClassesKrn.h>
+
+const TInt KMinRate = 10;
+const TInt KMaxRate = 1000;
+
+enum TState{ERunning, EStopping, EStopped};
+
+const TUid KGppPropertyCat={0x20201F70};
+enum TGppPropertyKeys
+	{
+	EGppPropertySyncSampleNumber
+	};
+
+
+/*
+ *
+ *
+ *	Class DPluginDriver definition, inherited by sampler implementations except GPP
+ *
+ *
+ */
+
+class DPluginDriver : public DLogicalChannel
+{
+
+public:
+	DPluginDriver();
+	~DPluginDriver();
+
+public:	
+	TInt					ProcessStreamReadCancel();
+
+	TInt					StopSampling();
+
+private:
+	TInt					ProcessPrintStreamRequest(TDesC8* aDes/*,TRequestStatus* aStatus*/);
+	
+	void 					FastPrintf(TDesC8* aDes);
+ 
+public:
+	DThread*				iClient;
+
+	// property and value; 
+	// GPP sampler start time, needed to set other samplers in sync
+	RPropertyRef 			iSampleStartTimeProp;
+	TInt					iSampleStartTime;
+	TUint32 				iSyncOffset;		// offset from the start
+	
+	
+	TUint32					sampleRunning;
+	const TUint*			iInterruptStack;
+	TState					iState;
+	TInt					doingDfc;
+
+	// request status objects for requests
+	TRequestStatus*			iEndRequestStatus;
+	TRequestStatus*			iStreamReadCancelStatus;
+
+	// sample stream object used in stream mode
+	DProfilerSampleStream		iSampleStream;
+
+	// just for testing
+	TUint32*				stackTop;
+
+};
+
+#include <piprofiler/PluginDriver.inl>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/PluginDriver.inl	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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:  
+*
+*/
+
+
+//
+// LDD for thread time profiling
+//
+
+#include <piprofiler/ProfilerConfig.h>
+#include <piprofiler/ProfilerVersion.h>
+
+
+#include <kern_priv.h>
+#include <sproperty.h>
+
+#include <piprofiler/PluginSampler.h>
+
+
+/*
+ *
+ *
+ *	Class DPluginDriver implementation
+ *
+ *
+ */
+inline DPluginDriver::DPluginDriver() //: iSubsRequest(&HandleSubsComplete, this)
+	{
+    //iClientProcess = &Kern::CurrentProcess();
+	}
+inline DPluginDriver::~DPluginDriver()
+	{
+	
+	}
+
+/*
+ *	Methods for controlling stream read option
+ */
+ 
+inline TInt DPluginDriver::ProcessStreamReadCancel()
+{
+	return KErrNone;
+}
+
+/*
+ *	Mark traces active or inactive, this can be done
+ *	only if sampling is not running
+ */
+
+inline TInt DPluginDriver::StopSampling()
+{
+	if(this->iState == ERunning)
+	{
+		this->iState = EStopping;
+		return KErrNone;
+	}
+	else
+	{
+		return KErrGeneral;
+	}
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/PluginSampler.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,247 @@
+/*
+* 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 __PLUGINSAMPLER_H__
+#define __PLUGINSAMPLER_H__
+
+/*
+ * The user-interface to the sampling device driver sued by the profiling engine
+ */
+//	#include <piprofiler/ProfilerConfig.h>
+//	#include <piprofiler/ProfilerVersion.h>	// versions removed from ProfilerConfig.h
+
+#ifndef __KERNEL_MODE__
+#include <utf.h>
+#endif
+
+/*
+ *	Forward declarations
+ */
+class TBapBuf;
+
+/**
+ * A minimal capabilities class for the Sampling device.
+ * It just returns the version number.
+ */
+class TCapsSamplerV01
+	{
+public:
+	TVersion	iVersion;
+	};
+
+
+const TInt KMinDelay = 1;
+const TInt KMaxDelay = 10000;
+
+/**
+ * The user device driver class for controlling the plugin sampler.
+ */
+
+class RPluginSampler :  public RBusLogicalChannel
+{	
+	friend class DPluginDriver;
+	public:
+		enum TControl
+		{
+			EOutputSettingsForTrace,
+			EMarkTraceActive,
+			EMarkTraceInactive,
+			ESample,
+			EStartSampling,
+			EGetSampleTime,
+			EGetSamplerVersion,
+			EStopAndWaitForEnd,
+			ESetSamplingPeriod,
+			EAdditionalTraceSettings,
+			EAdditionalTraceSettings2,
+			EAdditionalTraceSettings3,
+			EAdditionalTraceSettings4,
+			//EPrintTraces,
+			ECancelStreamRead,
+			ERequestFillThisStreamBuffer,
+			ERequestPrintStreamBuffer,
+			ETest
+		};
+
+	public:
+		#ifndef __KERNEL_MODE__
+		
+		inline ~RPluginSampler();
+			
+		/**
+		 * 
+		 * Methods for controlling the sampler device
+		 * 
+		 **/
+		/** Open a channel to the sampling device **/
+		virtual TInt Open() = 0;
+
+		/** Set sampling period for sampler */
+		inline void SetSamplingPeriod(TInt samplerId, TInt settings);
+		
+		/** Set additional trace settings **/
+		inline void AdditionalSettingsForTrace(TInt samplerId,TInt settings);
+		inline void AdditionalSettingsForTrace2(TInt samplerId,TInt settings);
+		inline void AdditionalSettingsForTrace3(TInt samplerId,TInt settings);
+		inline void AdditionalSettingsForTrace4(TInt samplerId,TInt settings);
+		
+		/** Mark trace active **/
+		inline void MarkTraceActive(TUint32 id);
+
+		/** Mark trace inactive **/
+		inline void MarkTraceInactive(TUint32 id);
+
+		/** Sample command to kernel LDD**/
+		inline void Sample();
+		
+		/** Start tracing **/
+		inline void StartSampling();
+
+		/** Stop tracing **/
+		inline void StopSampling();
+
+		/** Get current sampling time **/
+		inline TUint32 GetSampleTime();
+
+		/** Get sampler version as descriptor **/
+		virtual void GetSamplerVersion(TDes*);
+
+		/** Get next filled buffer in stream mode **/
+		void GetNextbuffer( );
+
+		/** Request stream read **/
+		void FillThisStreamBuffer(TBapBuf* aBuffer, TRequestStatus& aStatus);
+
+		/** Request print buffer**/
+		void PrintStreamBuffer(TDesC16* aBuffer);
+		
+		/** Run test case **/
+		inline void Test(TUint32 testCase);
+
+		#endif	// !__KERNEL_MODE__	
+};
+
+
+#ifndef __KERNEL_MODE__
+inline RPluginSampler::~RPluginSampler()
+{
+}
+
+inline void RPluginSampler::AdditionalSettingsForTrace(TInt samplerId,TInt settings)
+	{
+	DoControl(EAdditionalTraceSettings,
+			reinterpret_cast<TAny*>(samplerId),
+			reinterpret_cast<TAny*>(settings));
+	}
+
+inline void RPluginSampler::AdditionalSettingsForTrace2(TInt samplerId,TInt settings)
+	{
+	DoControl(EAdditionalTraceSettings2,
+			reinterpret_cast<TAny*>(samplerId),
+			reinterpret_cast<TAny*>(settings));
+	}
+
+inline void RPluginSampler::AdditionalSettingsForTrace3(TInt samplerId,TInt settings)
+	{
+	DoControl(EAdditionalTraceSettings3,
+			reinterpret_cast<TAny*>(samplerId),
+			reinterpret_cast<TAny*>(settings));
+	}
+
+inline void RPluginSampler::AdditionalSettingsForTrace4(TInt samplerId,TInt settings)
+	{
+	DoControl(EAdditionalTraceSettings4,
+			reinterpret_cast<TAny*>(samplerId),
+			reinterpret_cast<TAny*>(settings));
+	}
+
+inline void RPluginSampler::SetSamplingPeriod(TInt samplerId, TInt settings)
+	{
+	DoControl(ESetSamplingPeriod, 
+			reinterpret_cast<TAny*>(samplerId),
+			reinterpret_cast<TAny*>(settings));
+	}
+
+
+inline void RPluginSampler::MarkTraceActive(TUint32 id)
+{
+		DoControl(EMarkTraceActive, reinterpret_cast<TAny*>(id));
+}
+
+inline void RPluginSampler::MarkTraceInactive(TUint32 id)
+{
+		DoControl(EMarkTraceInactive, reinterpret_cast<TAny*>(id));
+}
+
+inline void RPluginSampler::Sample()
+	{
+	DoControl(ESample);
+	}
+
+inline void RPluginSampler::StartSampling()
+{
+	// at first, start the kernel side samplers
+	DoControl(EStartSampling);
+}
+
+inline void RPluginSampler::StopSampling()
+{
+	// stop the device driver and the kernel mode samplers
+	TRequestStatus status;
+	status = KRequestPending;
+	DoRequest(EStopAndWaitForEnd,status);
+	User::WaitForRequest(status);
+}
+
+inline TUint32 RPluginSampler::GetSampleTime()
+{
+	TUint32* sampleTime = new TUint32;
+
+	DoControl(EGetSampleTime,reinterpret_cast<TAny*>(sampleTime));
+	TUint32 value = *sampleTime;
+	delete sampleTime;
+
+	return value;
+}
+
+inline void RPluginSampler::GetSamplerVersion(TDes* aDes)
+{
+	TBuf8<16> buf;
+	DoControl(EGetSamplerVersion,(TAny*)&buf);
+	CnvUtfConverter::ConvertToUnicodeFromUtf8(*aDes,buf);
+}
+
+inline void RPluginSampler::PrintStreamBuffer(TDesC16* aDes) 
+{
+	DoControl(ERequestPrintStreamBuffer,reinterpret_cast<TAny*>(aDes));
+}
+
+inline void RPluginSampler::FillThisStreamBuffer(TBapBuf* aBuffer, TRequestStatus& aStatus)
+{
+	aStatus = KRequestPending;
+	DoRequest(ERequestFillThisStreamBuffer,aStatus,(TAny*)aBuffer);
+
+}
+
+inline void RPluginSampler::Test(TUint32 testCase)
+{
+	DoControl(ETest,reinterpret_cast<TAny*>(testCase));
+}
+
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerAttributes.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,151 @@
+/*
+* 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 PROFILER_ATTRIBUTES_H
+#define PROFILER_ATTRIBUTES_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <s32mem.h>
+
+// LITERALS
+_LIT8(KDefaultTraceFilePrefix, "PIProfiler_#");
+_LIT8(KDefaultTraceOutput, "file_system");
+_LIT8(KDefaultTraceFileSaveDrive, "C:\\data\\");
+
+_LIT8(KEnabled, "enabled");
+_LIT8(KBracketOpen, "[");
+_LIT8(KBracketClose, "]");
+_LIT8(KSettingItemSeparator, "=");
+
+// CONSTANTS
+const TUint KPrefixMaxLength = 64;
+const TUint KShortNameMaxLength = 3;
+const TUint KNameMaxLength = 63;
+const TUint KDescriptionMaxLength = 255;
+const TInt KDefaultTimedSamplingPeriod = 60; // Sampling time in seconds 
+/*
+ * 
+ * TGeneralAttributes class definition, internal settings format
+ *  
+ */
+class TGeneralAttributes
+    {
+public:
+    TBuf8<KPrefixMaxLength> iTraceOutput;
+    TBuf8<KPrefixMaxLength> iTraceFilePrefix;
+    TBuf8<KPrefixMaxLength> iSaveFileDrive;
+    TInt                    iTimedSamplingPeriod;
+    };
+
+
+
+/*
+ * 
+ * TSettingItem class definition, internal settings format
+ *  
+ */
+class TSettingItem
+    {
+public:
+    enum 
+    {
+        ESettingItemTypeInt = 0,
+        ESettingItemTypeBool,
+        ESettingItemTypeHex,
+        ESettingItemTypeText
+    };
+    
+public:
+    TBuf<64>   iSettingText;
+    TUint32    iType;
+    TBuf<128>  iValue;
+    TBuf<256>  iSettingDescription;
+    TBuf<64>   iUIText;
+    };
+/*
+ * 
+ * TSamplerAttributes class definition, internal settings format
+ *  
+ */
+class TSamplerAttributes
+    {
+public:
+    // default constructor
+    TSamplerAttributes();
+    // constructor
+    TSamplerAttributes(TInt32 aUid,
+    const TDesC8& aShortName,
+    const TDesC8& aName,
+    const TDesC8& aDescription,
+    TInt aSampleRate,
+    TBool aEnabled,
+    TBool aHidden,
+    TInt aItemCount);
+public:
+    TInt32      iUid;
+    TBuf8<8>    iShortName;     // name of the plugin, short name
+    TBuf8<64>   iName;          // name of the plugin, long name
+    TBuf8<256>  iDescription;   // sampler description, info about HW/SW dependencies etc.
+    TInt        iSampleRate;    // sample rate of the plugin
+    TBool       iEnabled;       // enabled for profiling
+    TBool       iIsHidden;      // hidden, i.e. no start/stop controls
+    TInt        iItemCount;     // plugin specific setting item count
+    
+    // plugin specific settings, plugin implementation dependent
+    TSettingItem    iSettingItem1;
+    TSettingItem    iSettingItem2;
+    TSettingItem    iSettingItem3;
+    TSettingItem    iSettingItem4;
+    TSettingItem    iSettingItem5;
+    TSettingItem    iSettingItem6;
+    };
+
+inline TSamplerAttributes::TSamplerAttributes()
+    {}
+
+inline TSamplerAttributes::TSamplerAttributes(TInt32 aUid,
+            const TDesC8& aShortName,
+            const TDesC8& aName,
+            const TDesC8& aDescription,
+            TInt aSampleRate,
+            TBool aEnabled,
+            TBool aHidden,
+            TInt aItemCount)
+    {
+    iUid = aUid;
+    // check if given short name too long
+    aShortName.Length() > KShortNameMaxLength ? 
+        iShortName.Copy(aShortName.Left(KShortNameMaxLength)) : 
+        iShortName.Copy(aShortName);
+    // check if given name too long
+    aName.Length() > KNameMaxLength ? 
+        iName.Copy(aName.Left(KNameMaxLength)) : 
+        iName.Copy(aName);
+    // check if description too long
+    aDescription.Length() > KDescriptionMaxLength ? 
+        iDescription.Copy(aDescription.Left(KDescriptionMaxLength)) : 
+        iDescription.Copy(aDescription);
+    iSampleRate = aSampleRate;
+    iEnabled = aEnabled;
+    iIsHidden = aHidden;
+    iItemCount = aItemCount;
+    }
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerConfig.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* 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 PI_PROFILER_CONFIG_H
+#define PI_PROFILER_CONFIG_H
+
+// NCP release process will move the PIProfiler flags as Carbon feature flags
+// where the product responsibles can choose the right settings for PI Profiler
+// compilation.
+
+	/*** NOTE!!! 
+	* 	Uncomment the following definition if compiling the Profiler by your own
+	***/
+	#define PROFILER_SISX
+
+	/*
+	 *
+	 *	Filename and path for the settings file
+	 *  this file is written on application exit and
+	 *	it contains the settings of the profiler application
+	 *
+	 */	
+	 
+//	#define PROFILER_SETTINGS_DRIVE		_L("C:\\")
+//	#define PROFILER_SETTINGS_MAXLENGTH	32
+//	#define PROFILER_SETTINGS_FILENAME	_L("ProfilerSettings.txt")
+	const TInt KProfilerSettingsMaxLength = 32;
+	_LIT(KProfilerSettingsFileName, "PIProfilerSettings.txt");
+
+	// a fix for going through the different drives for settings file
+	#define PROFILER_SETTINGS_DRIVE_COUNT				3
+	#define	PROFILER_SETTINGS_DRIVE_ARRAY 			TBuf<4> settingsDrives[PROFILER_SETTINGS_DRIVE_COUNT];
+	#define PROFILER_DEFINE_SETTINGS_DRIVE(name,number)	settingsDrives[number].Append(_L(name));										
+
+	// change these to reflect the drive names and numbers
+	// the last number must be PROFILER_SETTINGS_DRIVE_COUNT-1
+	#define PROFILER_SETTINGS_DRIVES		PROFILER_DEFINE_SETTINGS_DRIVE("C:\\",0) \
+		PROFILER_DEFINE_SETTINGS_DRIVE("E:\\",1) \
+		PROFILER_DEFINE_SETTINGS_DRIVE("Z:\\",2)			
+		
+	/*
+	 *
+	 *	Locations of PI Profiler binaries
+	 *
+	 */
+
+	#define PROFILERENGINE_EXE_PATH_PRIMARY		_L("C:\\sys\\bin\\PIProfilerEngine.exe")
+	#define PROFILERENGINE_EXE_PATH_SECONDARY	_L("Z:\\sys\\bin\\PIProfilerEngine.exe")
+
+	/*
+	 *
+	 *	PI Profiler tool composition definitions
+	 *
+	 */	
+
+	// sampler codes and names
+	#define		PROFILER_USER_MODE_SAMPLER		123
+	#define		PROFILER_KERNEL_MODE_SAMPLER		321
+	#define		PROFILER_DUMMY_SAMPLER			213
+
+	// old definitions
+	#define 	PROFILER_GENERALS_SAMPLER_ID		100
+	#define 	PROFILER_INTERNALS_SAMPLER_ID		101
+	#define		PROFILER_GPP_SAMPLER_ID			1
+	#define		PROFILER_GFC_SAMPLER_ID			2
+	#define		PROFILER_ITT_SAMPLER_ID			3
+	#define		PROFILER_MEM_SAMPLER_ID			4
+	#define		PROFILER_PRI_SAMPLER_ID			5
+	#define		PROFILER_IRQ_SAMPLER_ID			6
+	#define		PROFILER_BUP_SAMPLER_ID			7
+	#define		PROFILER_SWI_SAMPLER_ID			8
+	#define		PROFILER_TIP_SAMPLER_ID			9
+	#define		PROFILER_PEC_SAMPLER_ID			10
+	#define		PROFILER_PWR_SAMPLER_ID			11
+	#define		PROFILER_IPC_SAMPLER_ID			12
+	#define 	PROFILER_ISA_SAMPLER_ID			13
+    #define     PROFILER_GPU_SAMPLER_ID         14
+
+	// sampler IDs for external, e.g. 3rd party sampler plug-ins
+	#define		PROFILER_EXT1_SAMPLER_ID			15
+	#define		PROFILER_EXT2_SAMPLER_ID			16
+	#define		PROFILER_EXT3_SAMPLER_ID			17
+	#define		PROFILER_EXT4_SAMPLER_ID			18
+	#define		PROFILER_EXT5_SAMPLER_ID			19
+	
+    #define     PROFILER_GPP_SAMPLER_NAME _L("GPP")
+    #define     PROFILER_GFC_SAMPLER_NAME _L("GFC")
+    #define     PROFILER_ITT_SAMPLER_NAME _L("ITT")
+    #define     PROFILER_MEM_SAMPLER_NAME _L("MEM")
+    #define     PROFILER_PRI_SAMPLER_NAME _L("PRI")
+    #define     PROFILER_GPU_SAMPLER_NAME _L("GPU")
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerEngineAPI.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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 PROFILERCONTROLLER_H
+#define PROFILERCONTROLLER_H
+
+#include <e32std.h>
+#include <s32stor.h>
+
+class CProfilerSettings;
+
+class CProfilerEngineAPI : public CBase
+{
+public:
+    enum TProfilerEngineTraceMode 
+        { 
+        EProfilerEngineDebugOutputMode, 
+        EProfilerEngineFileSystemMode 
+        };
+    
+	~CProfilerEngineAPI();
+
+	IMPORT_C static CProfilerEngineAPI* NewL();
+	void ConstructL();
+
+	IMPORT_C void SaveSettings();
+	IMPORT_C void LoadSettings();
+
+	// controlling all sampler plugins
+	IMPORT_C TInt StartProfiling();
+	IMPORT_C TBool StopProfiling();
+	IMPORT_C TInt LaunchProfiler();
+
+	// controlling separate plugins
+	IMPORT_C TInt StartSampler(TUint32 aUid);
+	IMPORT_C TInt StopSampler(TUint32 aUid);
+	IMPORT_C TInt EnableSampler(TUint32 aUid);
+	IMPORT_C TInt DisableSampler(TUint32 aUid);
+	IMPORT_C TInt EnableWriter(TUint32 aUid);
+	IMPORT_C TInt DisableWriter(TUint32 aUid);
+
+	// for meeting the HTI requirements
+	IMPORT_C TInt SetSettings(TUint aSamplerId, TDes& aSettings);
+    IMPORT_C TInt SetTraceMode(TProfilerEngineTraceMode aMode, TDes& aTraceDataStruct);
+    IMPORT_C TInt GetSamplerInfo(TUint aSamplerId, TDes& aCompleteSamplerInfo);
+	
+	// old implementations
+	IMPORT_C TBool GetSamplerVersion(TDes& version);
+
+	IMPORT_C void LeaveProfilerBG(TBool aVal);
+	
+	
+public:
+	TBool DriveIsValidL(const TDesC& drive);
+	IMPORT_C CProfilerSettings* Settings() const;
+
+private:
+
+	CProfilerEngineAPI();
+
+	TInt				FindProcessL();
+private:
+	CProfilerSettings* 	iSettings;
+	
+	RProcess* 			iProfilerProcess;
+
+	TBool 				iProfilerLaunched;
+	
+	TBool 				iLeaveProfilerBG;
+
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerEngineStatusChecker.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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 PROFILER_STATUS_CHECKER_H
+#define PROFILER_STATUS_CHECKER_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <e32property.h>    // RProperty
+
+// CONSTANTS
+const TUid KEngineStatusPropertyCat = { 0x2001E5AD };
+enum TEnginePropertyKeys
+    {
+    EProfilerEngineStatus = 8
+    };
+
+// CLASS DECLARATIONS
+class MProfilerStatusObserver
+    {
+    public: // Enums
+        enum KProfilerStatus
+            {
+            EIdle = 0,
+            EInitializing,
+            ERunning,
+            EStopping,
+            ERestarting
+            };
+
+    public: // New
+        virtual void HandleProfilerStatusChange(
+                KProfilerStatus aStatus ) = 0;
+        virtual void HandleProfilerErrorL(
+                TInt aError ) = 0;
+    };
+
+
+class CProfilerEngineStatusChecker : public CActive
+    {
+public:
+    inline static CProfilerEngineStatusChecker* CProfilerEngineStatusChecker::NewL();
+    inline ~CProfilerEngineStatusChecker();
+    inline void SetObserver(MProfilerStatusObserver* aObserver);
+    inline TInt GetInitialState();
+private:
+    inline CProfilerEngineStatusChecker();
+    inline void ConstructL();
+    inline void RunL();
+    inline void DoCancel();
+private:
+    TInt                        iPrevStat;
+    MProfilerStatusObserver*    iObserver;
+    RProperty                   iEngineStatus;
+    };
+
+#include <piprofiler/ProfilerEngineStatusChecker.inl>
+
+
+#endif // PROFILER_STATUS_CHECKER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerEngineStatusChecker.inl	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* 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:   
+*
+*/
+
+// ------------------------------------------------------------------------------
+//
+// class CProfilerEngineStatusChecker
+//
+// ------------------------------------------------------------------------------
+//
+inline CProfilerEngineStatusChecker* CProfilerEngineStatusChecker::NewL()
+    {
+    CProfilerEngineStatusChecker* self = new(ELeave) CProfilerEngineStatusChecker();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// --------------------------------------------------------------------------------------------
+inline CProfilerEngineStatusChecker::CProfilerEngineStatusChecker() :
+    CActive(EPriorityStandard)
+    {
+    }
+
+inline CProfilerEngineStatusChecker::~CProfilerEngineStatusChecker()
+    {
+    Cancel();
+    iEngineStatus.Close();
+    }
+
+// --------------------------------------------------------------------------------------------
+inline void CProfilerEngineStatusChecker::ConstructL()
+    {
+    User::LeaveIfError(iEngineStatus.Attach(KEngineStatusPropertyCat, EProfilerEngineStatus));
+    CActiveScheduler::Add(this);
+    
+    // check engine status, if not available set to idle
+    if(iEngineStatus.Get(iPrevStat) != KErrNone)
+        {
+        iPrevStat = MProfilerStatusObserver::EIdle;
+        }
+
+    // subscribe to P&S status property
+    iEngineStatus.Subscribe(iStatus);
+    SetActive();
+    }
+
+inline TInt CProfilerEngineStatusChecker::GetInitialState()
+    {
+    // check engine status, if not available set to idle
+    TInt err(iEngineStatus.Get(KEngineStatusPropertyCat, EProfilerEngineStatus, iPrevStat));
+    if(err != KErrNone)
+        {
+        iPrevStat = MProfilerStatusObserver::EIdle;
+        }
+    return iPrevStat;
+    }
+
+// --------------------------------------------------------------------------------------------
+inline void CProfilerEngineStatusChecker::RunL()
+    {
+    // resubscribe before processing new value to prevent missing updates
+    iEngineStatus.Subscribe(iStatus);
+    SetActive();
+
+    TInt stat(0);
+    if(iEngineStatus.Get(KEngineStatusPropertyCat, EProfilerEngineStatus, stat) == KErrNone)
+        {
+        // check if status one of error codes (< 0)
+        if(stat < KErrNone)
+            {
+            // some error occurred on engine side => set UI idle and show an error note
+            iObserver->HandleProfilerErrorL(stat);
+            }
+        else
+            {
+            if(iPrevStat != stat)
+                {
+                switch(stat)
+                    {
+                    case 0:
+                        iObserver->HandleProfilerStatusChange(MProfilerStatusObserver::EIdle);
+                        break;
+                    case 1:
+                        iObserver->HandleProfilerStatusChange(MProfilerStatusObserver::EInitializing);
+                        break;
+                    case 2:
+                        iObserver->HandleProfilerStatusChange(MProfilerStatusObserver::ERunning);
+                        break;
+                    case 3:
+                        iObserver->HandleProfilerStatusChange(MProfilerStatusObserver::EStopping);
+                        break;
+                    default:
+                        iObserver->HandleProfilerErrorL(stat);
+                        break;
+                    }
+                iPrevStat = stat;
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+ 
+inline void CProfilerEngineStatusChecker::DoCancel()
+    {
+    iEngineStatus.Cancel();
+    }
+
+// --------------------------------------------------------------------------------------------
+inline void CProfilerEngineStatusChecker::SetObserver(MProfilerStatusObserver* aObserver)
+    {
+    iObserver = aObserver;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesCommon.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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 PROFILERGENERICCLASSESCOMMON_H
+#define PROFILERGENERICCLASSESCOMMON_H
+
+	#include <e32cmn.h>
+
+/*
+ *	
+ *	Class TProfilerSampleBufStruct definition
+ *
+ */
+
+
+class TProfilerSampleBufStruct
+{
+public:
+	TUint32 iSampleRemainder;
+	TUint8	iDataStart;
+};
+
+/*
+ *  
+ *  Class TBapBuf definition
+ *
+ */
+
+class TBapBuf
+{
+public:
+	TPtr8*		iDes;
+	TPtr8*		iBufDes;
+	TInt		iBufferSize;
+	TInt		iDataSize;
+	TUint8*		iBuffer;
+	TBapBuf*	iNext;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesKrn.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,422 @@
+/*
+* 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 PROFILERGENERICCLASSESKRN_H
+#define PROFILERGENERICCLASSESKRN_H
+
+	#include <piprofiler/ProfilerGenericClassesCommon.h>
+	#include <piprofiler/ProfilerTraces.h>
+
+	#include <e32cmn.h>
+
+	#define PROFILER_KERNEL_MODE
+
+#ifdef PROFILER_KERNEL_MODE
+class DProfilerSampleBuffer;
+
+class DProfilerSampleStream
+    {
+public:
+		DProfilerSampleStream();
+		~DProfilerSampleStream();
+
+		void InsertCurrentClient(DThread* aClient);
+		void AddSampleBuffer(TBapBuf* aBuffer,TRequestStatus* aStatus);
+		void ReleaseIfPending();
+
+		void AddSamples(DProfilerSampleBuffer& aBuffer, TInt aSamplerId);
+		TInt EndSampling(DProfilerSampleBuffer& aBuffer,TInt aSamplerId);
+
+		void PerformCopy(TUint8 aSamplerId,TUint8* aSrc,TPtr8* dst,TInt aOffset,TInt aAmount);
+
+private:
+		TBapBuf*			iCurrentBuffer;
+		TRequestStatus*		iPendingRequest;
+		DThread*			iClient;
+		TInt				iAddingSamples;
+    };
+
+class DProfilerSampleBuffer : public DBase
+    {
+		friend class DProfilerSampleStream;
+public:
+
+			enum ProfilerBufferStatus 
+			    {
+				BufferOk,
+				BufferCopyAsap,
+				BufferBeingCopied,
+				BufferFull,
+				BufferDataEnd
+			    };
+
+			DProfilerSampleBuffer(TUint8* aBuffer, TUint8* aDblBuffer, TUint32 aSize);
+			~DProfilerSampleBuffer();	
+			TInt	AddSample(TUint8* aSample, TUint32 aLength);
+			TUint32 GetBufferStatus();
+			void	ClearBuffer();
+			void	EndSampling();
+			void	DataCopied();
+
+			TUint32 iBufferStatus;
+private:
+			TUint32 iBytesWritten;
+			TUint32 iDblBytesWritten;
+			TUint32 iDblBytesRead;
+
+			TUint32 iBufferDataSize;
+			TUint32 iBufferRealSize;
+
+			TProfilerSampleBufStruct* iDblBufStruct;
+			TProfilerSampleBufStruct* iBufStruct;
+    };
+
+#endif
+
+
+ 
+/*
+ *	
+ *	Abstract class CProfilerSamplerBase definition
+ *	
+ */
+
+#ifdef PROFILER_KERNEL_MODE
+class DProfilerSamplerBase : public DBase
+    {
+public:
+	DProfilerSamplerBase();
+			virtual					~DProfilerSamplerBase();
+
+			virtual	TInt			Initialise() = 0;
+			virtual	void			Sample() = 0;
+			virtual TBool			PostSampleNeeded() = 0;
+			virtual TInt			PostSample() = 0;
+			virtual TInt			EndSampling() = 0;
+
+			virtual TInt			Reset(DProfilerSampleStream* aStream = 0, TUint32 aSyncOffset = 0) = 0;
+
+			virtual void			SetEnabledFlag(TBool aFlag) = 0;
+			virtual TBool			GetEnabledFlag() = 0;
+			virtual void			SetOutputCombination(TInt aSettings) = 0;
+			virtual void 			SetSamplingPeriod(TInt aSettings) = 0;
+			virtual void			SetAdditionalSettings(TInt aSettings) = 0;
+			virtual void			SetAdditionalSettings2(TInt aSettings) = 0;
+			virtual void			SetAdditionalSettings3(TInt aSettings) = 0;
+			virtual void			SetAdditionalSettings4(TInt aSettings) = 0;
+
+			TInt					iSamplerId;
+			TInt					iOutputCombination;
+			TBool					iEnabled;
+    };
+
+/*
+ *	
+ *	Template abstract class CProfilerGenericSampler definition
+ *	
+ */
+
+// size parameter given defines the explicit buffer size in bytes for this sampler
+template <int BufferSize> 
+class DProfilerGenericSampler : public DProfilerSamplerBase
+    {
+public:
+			DProfilerGenericSampler(TInt aSamplerId);
+			virtual					~DProfilerGenericSampler();
+
+			TInt					Initialise();
+			virtual	void			Sample() = 0;
+			TBool					PostSampleNeeded();
+			TInt					PostSample();
+			TInt					EndSampling();
+			virtual TInt			Reset(DProfilerSampleStream* aStream = 0, TUint32 aSyncOffset = 0);
+
+
+			void					SetEnabledFlag(TBool aFlag);
+			TBool					GetEnabledFlag();
+			void					SetOutputCombination(TInt aComb);
+			void 					SetSamplingPeriod(TInt aSettings);
+			void					SetAdditionalSettings(TInt aSettings);
+			void					SetAdditionalSettings2(TInt aSettings);
+			void					SetAdditionalSettings3(TInt aSettings);
+			void					SetAdditionalSettings4(TInt aSettings);
+
+			DProfilerSampleBuffer*	iSampleBuffer;
+			DProfilerSampleStream*	iStream;
+
+			// for right alignment
+			TUint8					iBuffer[BufferSize+4];
+			TUint8					iDblBuffer[BufferSize+4];
+			
+			TInt					iSamplingPeriod;
+			TInt					iAdditionalSettings;
+			TInt					iAdditionalSettings2;
+			TInt					iAdditionalSettings3;
+			TInt					iAdditionalSettings4;
+    };
+
+/*
+ *	
+ *	Template abstract class CProfilerGenericSampler implementation
+ *
+ */
+
+template <int BufferSize>
+DProfilerGenericSampler<BufferSize>::DProfilerGenericSampler(TInt aSamplerId)
+    {
+	iSamplerId = aSamplerId;
+	iEnabled = false;
+	iSampleBuffer = 0;
+	iAdditionalSettings = 0;
+	iAdditionalSettings2 = 0;
+    iAdditionalSettings3 = 0;
+    iAdditionalSettings4 = 0;
+	iStream = 0;
+	Initialise();
+    }
+
+template <int BufferSize> 
+DProfilerGenericSampler<BufferSize>::~DProfilerGenericSampler()
+    {
+	LOGSTRING2("CProfilerGenericSampler<%d>::CProfilerGenericSampler",BufferSize);	
+	
+	if(iSampleBuffer != 0)
+		delete iSampleBuffer;
+
+    }
+ 
+template <int BufferSize> 
+TInt DProfilerGenericSampler<BufferSize>::Initialise()
+    {
+	LOGSTRING2("CProfilerGenericSampler<%d>::Initialise - chunk option",BufferSize);
+
+	// stream is not used in chunk mode
+	iStream = 0;
+
+	// create the sample buffer object with the buffers
+	if(iSampleBuffer == 0)
+	    {
+	    iSampleBuffer = new DProfilerSampleBuffer(iBuffer,iDblBuffer,BufferSize);
+        }
+	else
+	   {
+		LOGSTRING2("CProfilerGenericSampler<%d>::Initialise - ERROR 1",BufferSize);
+        }
+
+	return KErrNone;
+    }
+
+
+
+template <int BufferSize> 
+TInt DProfilerGenericSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
+    {
+	LOGSTRING4("CProfilerGenericSampler<%d>::Reset %d, sync offset %d",BufferSize,aStream,aSyncOffset);
+	// reset the sample buffer and resolve the chunk again
+
+	// CURRENT VERSION SUPPORTS ONLY STREAM MODE!
+	LOGSTRING2("CProfilerGenericSampler<%d>::Reset - stream option",BufferSize);
+
+	// initialise the sampler with the stream option
+	iStream = aStream;
+
+	// clear the sample buffer
+	if(iSampleBuffer != 0)
+	    {
+	    iSampleBuffer->ClearBuffer();
+        }
+	else
+	    {
+		LOGSTRING2("CProfilerGenericSampler<%d>::Initialise - ERROR no buffer",BufferSize);
+        }
+
+	return KErrNone;
+
+    }
+
+template <int BufferSize> 
+TBool DProfilerGenericSampler<BufferSize>::PostSampleNeeded()
+    {
+	LOGSTRING4("CProfilerGenericSampler<%d>::PostSampleNeeded - ID %d, state %d",iSamplerId,BufferSize,iSampleBuffer->GetBufferStatus());
+
+	TUint32 status = iSampleBuffer->iBufferStatus;
+
+	if(status == DProfilerSampleBuffer::BufferCopyAsap || status == DProfilerSampleBuffer::BufferFull)
+	    {
+		return true;
+        }
+	
+	return false;
+    }
+
+
+template <int BufferSize> 
+TInt DProfilerGenericSampler<BufferSize>::PostSample()
+    {
+	LOGSTRING4("CProfilerGenericSampler<%d>::PostSample - ID %d, state %d",iSamplerId,BufferSize,iSampleBuffer->GetBufferStatus());
+
+	TUint32 status = iSampleBuffer->iBufferStatus;
+
+	if(status == DProfilerSampleBuffer::BufferCopyAsap || status == DProfilerSampleBuffer::BufferFull)
+	    {
+        // write data to the stream
+	    iStream->AddSamples(*iSampleBuffer,iSamplerId);
+		}
+	
+	return KErrNone;
+    }
+
+template <int BufferSize>
+TInt DProfilerGenericSampler<BufferSize>::EndSampling()
+    {
+	LOGSTRING3("CProfilerGenericSampler<%d>::EndSampling, ID %d",BufferSize,iSamplerId);
+
+    // only if write to stream option is selected
+    if(iStream->EndSampling(*iSampleBuffer,iSamplerId) == 0)
+        {
+        return KErrNone;
+        }
+    else 
+        {
+        // there is still data to copy
+        return KErrNotReady;
+        }
+    }
+
+template <int BufferSize>
+void DProfilerGenericSampler<BufferSize>::SetEnabledFlag(TBool aFlag)
+    {
+	LOGSTRING2("CProfilerGenericSampler<%d>::SetEnabledFlag",BufferSize);
+	iEnabled = aFlag;
+    }
+
+template <int BufferSize>
+TBool DProfilerGenericSampler<BufferSize>::GetEnabledFlag()
+    {
+	LOGSTRING2("CProfilerGenericSampler<%d>::GetEnabledFlag",BufferSize);
+	return iEnabled;
+    }
+
+template <int BufferSize>
+void DProfilerGenericSampler<BufferSize>::SetOutputCombination(TInt aComb)
+    {
+	LOGSTRING2("CProfilerGenericSampler<%d>::SetOutputCombination",BufferSize);
+	iOutputCombination = aComb;
+    }
+
+template <int BufferSize>
+void DProfilerGenericSampler<BufferSize>::SetAdditionalSettings(TInt aSettings)
+    {
+	LOGSTRING3("CProfilerGenericSampler<%d>::SetAdditionalSettings to 0x%x",BufferSize,aSettings);
+	iAdditionalSettings = aSettings;
+    }
+
+template <int BufferSize>
+void DProfilerGenericSampler<BufferSize>::SetAdditionalSettings2(TInt aSettings)
+    {
+	LOGSTRING3("CProfilerGenericSampler<%d>::SetAdditionalSettings2 to 0x%x",BufferSize,aSettings);
+	iAdditionalSettings2 = aSettings;
+    }
+
+template <int BufferSize>
+void DProfilerGenericSampler<BufferSize>::SetAdditionalSettings3(TInt aSettings)
+    {
+	LOGSTRING3("CProfilerGenericSampler<%d>::SetAdditionalSettings3 to 0x%x",BufferSize,aSettings);
+	iAdditionalSettings3 = aSettings;
+    }
+
+template <int BufferSize>
+void DProfilerGenericSampler<BufferSize>::SetAdditionalSettings4(TInt aSettings)
+    {
+	LOGSTRING3("CProfilerGenericSampler<%d>::SetAdditionalSettings4 to 0x%x",BufferSize,aSettings);
+	iAdditionalSettings4 = aSettings;
+    }
+
+template <int BufferSize>
+void DProfilerGenericSampler<BufferSize>::SetSamplingPeriod(TInt aSettings)
+    {
+	LOGSTRING3("CProfilerGenericSampler<%d>::SetSamplingPeriod to 0x%x",BufferSize,aSettings);
+	iSamplingPeriod = aSettings;
+    }
+
+/*
+ *	
+ *	Just a test class that is derived from CProfilerGenericSampler
+ *	
+ */
+
+template <int BufferSize>
+class DProfilerExampleSampler : public DProfilerGenericSampler<BufferSize>
+    {
+public:
+	TUint32 iSampleNumber;
+
+	DProfilerExampleSampler(TInt aSamplerId);
+	~DProfilerExampleSampler();
+
+	void Sample();
+	void Sample(TInt aCount, TInt aLastPc);
+    };
+
+
+/*
+ *	
+ *	Just a test class that is derived from CProfilerGenericSampler
+ *	
+ */
+
+template <int BufferSize>
+DProfilerExampleSampler<BufferSize>::DProfilerExampleSampler(TInt aSamplerId) :
+	DProfilerGenericSampler<BufferSize>(aSamplerId) 
+    {
+    iSampleNumber = 0;
+	LOGSTRING2("CProfilerExampleSampler<%d>::CProfilerExampleSampler",BufferSize);	
+    }
+
+template <int BufferSize>
+void DProfilerExampleSampler<BufferSize>::Sample()
+    {
+	LOGSTRING2("CProfilerExampleSampler<%d>::Sample",BufferSize);
+	TBuf8<20>* testiBuf = new TBuf8<20>;
+
+	testiBuf->AppendNum((TInt)iSampleNumber);
+	iSampleNumber++;
+
+	this->iSampleBuffer->AddSample((TUint8*)testiBuf->Ptr(),testiBuf->Length());
+	delete testiBuf;
+	return;
+    }
+
+template <int BufferSize>
+void DProfilerExampleSampler<BufferSize>::Sample(TInt aCount, TInt aLastPc)
+    {
+	return;
+    }
+
+template <int BufferSize>
+DProfilerExampleSampler<BufferSize>::~DProfilerExampleSampler()
+    {
+	LOGSTRING2("CProfilerExampleSampler<%d>::~CProfilerExampleSampler",BufferSize);		
+    }
+
+#include <piprofiler/ProfilerGenericClassesKrn.inl>
+
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesKrn.inl	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,530 @@
+/*
+* 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 <kern_priv.h>
+
+#include <piprofiler/ProfilerGenericClassesKrn.h>
+
+
+/*
+ *	
+ *	Class CProfilerSamplerBase implementation
+ *
+ */
+
+inline DProfilerSamplerBase::DProfilerSamplerBase()
+    {
+	
+    }
+
+inline DProfilerSamplerBase::~DProfilerSamplerBase()
+    {
+	
+    }
+
+/*
+ *	
+ *	Class CProfilerSampleBuffer implementation
+ *
+ */
+
+inline DProfilerSampleBuffer::DProfilerSampleBuffer(TUint8* aBuffer, 
+											TUint8* aDblBuffer, 
+											TUint32 aBufferSize )
+    {
+	LOGSTRING3("CProfilerSampleBuffer::CProfilerSampleBuffer AtFirst: b:0x%x db:0x%x",aBuffer,aDblBuffer);
+
+	// make sure the alignment is right
+	if((((TUint32)aBuffer) %4) != 0)
+	    aBuffer += (4-(((TUint32)aBuffer)%4));
+	if((((TUint32)aDblBuffer) %4) != 0)
+	    aDblBuffer += (4-(((TUint32)aDblBuffer)%4));
+
+	LOGSTRING3("CProfilerSampleBuffer::CProfilerSampleBuffer b:0x%x db:0x%x",aBuffer,aDblBuffer);
+
+	iBufStruct = (TProfilerSampleBufStruct*)aBuffer;
+	iDblBufStruct = (TProfilerSampleBufStruct*)aDblBuffer;
+
+	LOGSTRING3("CProfilerSampleBuffer::CProfilerSampleBuffer bufStruct rem:0x%x dbuStruct rem:0x%x",
+						&iBufStruct->iSampleRemainder,&iDblBufStruct->iSampleRemainder);
+
+	iBufferDataSize = aBufferSize-4;
+	iBufferRealSize = aBufferSize;
+
+	ClearBuffer();
+    }
+
+inline DProfilerSampleBuffer::~DProfilerSampleBuffer()
+    {
+	
+    }
+
+inline TInt DProfilerSampleBuffer::AddSample(TUint8* aSample, TUint32 aLength)
+    {
+	TUint32 bytesTotal;
+
+	// check whether the buffer status is
+	switch (iBufferStatus)
+	    {
+		case DProfilerSampleBuffer::BufferOk:
+			// add the data normally to the buffer
+			bytesTotal = iBytesWritten+aLength;
+
+			if(bytesTotal < iBufferDataSize)
+			    {
+				memcpy((&(iBufStruct->iDataStart))+iBytesWritten,aSample,aLength);
+				iBytesWritten+=aLength;
+				return 0;
+			    }
+			else
+			    {
+
+				// the sample does not fit to the buffer
+				// first copy as much data as we can fit to the first buffer
+				TUint32 fitsToBuffer = iBufferDataSize-iBytesWritten;
+				TUint32 remaining = aLength-fitsToBuffer;
+
+				memcpy((&(iBufStruct->iDataStart))+iBytesWritten,aSample,fitsToBuffer);
+				iBytesWritten = iBufferDataSize;
+
+				// ->switch to the double buffer
+				iBufferStatus = DProfilerSampleBuffer::BufferCopyAsap;
+				
+				TProfilerSampleBufStruct* tmpPtr = iBufStruct;
+				iBufStruct = iDblBufStruct;
+				iDblBufStruct = tmpPtr;
+				
+				iDblBytesWritten = iBytesWritten;
+
+				// and this is the remainder of a sample
+				// that will be copied to the new buffer
+				// just in a while
+				iBufStruct->iSampleRemainder = remaining;
+				
+				// now that the buffers have been switched
+				// add the rest of the sample to the buffer
+				aSample+=fitsToBuffer;
+
+				// there should be room - in case the single sample
+				// is smaller than the whole buffer! so we don't
+				// bother to check
+
+				memcpy((&(iBufStruct->iDataStart)),aSample,remaining);
+				iBytesWritten = remaining;
+				return 0;
+			    }
+
+		case DProfilerSampleBuffer::BufferCopyAsap:
+
+			// no difference to the BufferOk case
+			// unless the double buffer gets filled
+			// before the data has been copied
+			// add the data normally to the buffer
+			bytesTotal = iBytesWritten+aLength;
+
+			if(bytesTotal < iBufferDataSize)
+			    {
+				memcpy((&(iBufStruct->iDataStart))+iBytesWritten,aSample,aLength);
+				iBytesWritten+=aLength;
+				return 0;
+			    }
+			else
+			    {
+				// the double buffer is now also full - there is no
+				// place to put the data -> we have to waste it!
+				// this is an indication of a too small buffer size
+				iBufferStatus = DProfilerSampleBuffer::BufferFull;
+				LOGSTRING("DProfilerSampleBuffer::AddSample - double buffer full1!!");
+				return -1;
+			    }
+
+		case DProfilerSampleBuffer::BufferBeingCopied:
+
+			// no difference to the BufferCopyAsap case
+			bytesTotal = iBytesWritten+aLength;
+
+			if(bytesTotal < iBufferDataSize)
+			    {
+				memcpy((&(iBufStruct->iDataStart))+iBytesWritten,aSample,aLength);
+				iBytesWritten+=aLength;
+				return 0;
+			    }
+			else
+			    {
+				// the double buffer is now also full - there is no
+				// place to put the data -> we have to waste it!
+				// this is an indication of a too small buffer size
+                LOGSTRING("DProfilerSampleBuffer::AddSample - double buffer full2!!");
+				
+				// don't change the state to CProfilerSampleBuffer::BufferFull, since it is
+				// already being copied
+				return -1;
+			    }
+
+		case DProfilerSampleBuffer::BufferFull:
+			// the buffer is still full, there is noting we can do
+			// about it -> return
+		    LOGSTRING("DProfilerSampleBuffer::AddSample - double buffer full3!!");
+			return -1;
+
+		default:
+		    LOGSTRING("DProfilerSampleBuffer::AddSample - wrong switch!!");
+			return -1;
+	    }
+    }
+
+inline void DProfilerSampleBuffer::EndSampling()
+    {
+    LOGSTRING("DProfilerSampleBuffer::EndSampling");
+	// this will switch to the dbl buffer even though
+	// the buffer is not full, so that data can be copied
+
+	// during this operation, no other buffer
+	// operations are allowed
+
+	// ensure that the normal buffer is in use and that the
+	// buffer is in normal state ( this procedure is performed only once )
+	if(iBufferStatus == DProfilerSampleBuffer::BufferOk)
+	    {
+		// ->switch to the double buffer
+        LOGSTRING("DProfilerSampleBuffer::EndSampling - switching to double buffer");
+		iBufferStatus = DProfilerSampleBuffer::BufferCopyAsap;
+		
+		TProfilerSampleBufStruct* tmpPtr = iBufStruct;
+		iBufStruct = iDblBufStruct;
+		iDblBufStruct = tmpPtr;
+				
+		iDblBytesWritten = iBytesWritten;
+		
+		// there is no new sample so the remainder is
+		// zero, (this shouldn't be used anyway)
+		iBufStruct->iSampleRemainder = 0;
+	    }
+    }
+
+inline TUint32 DProfilerSampleBuffer::GetBufferStatus()
+    {
+	return iBufferStatus;
+    }
+
+inline void DProfilerSampleBuffer::ClearBuffer()
+    {
+	LOGSTRING2("CProfilerSampleBuffer::ClearBuffer - %d",iBufferDataSize);
+
+	// the buffers are of same size
+	TUint8* ptr1 = (TUint8*)&(iBufStruct->iDataStart);
+	TUint8* ptr2 = (TUint8*)&(iDblBufStruct->iDataStart);
+
+	for(TUint32 i=0;i<iBufferDataSize;i++)
+	    {
+		ptr1[i] = 0;
+		ptr2[i] = 0;
+	    }
+
+
+	iBufStruct->iSampleRemainder = 0;
+	iDblBufStruct->iSampleRemainder = 0;
+
+	// written the dblBufStruct
+	iBytesWritten = 0;
+	iDblBytesWritten = 0;
+	iDblBytesRead = 0;
+
+	iBufferStatus = DProfilerSampleBuffer::BufferOk;
+    }
+
+inline void DProfilerSampleBuffer::DataCopied()
+    {
+	iDblBytesRead = 0;
+	iDblBytesWritten = 0;
+	iBufferStatus = DProfilerSampleBuffer::BufferOk;
+    }
+
+/*
+ *
+ *	Class DProfilerSampleStream implementation
+ *
+ */
+
+inline DProfilerSampleStream::DProfilerSampleStream()
+    {
+	LOGSTRING("DProfilerSampleStream::DProfilerSampleStream");
+
+	iCurrentBuffer = 0;
+	iPendingRequest = 0;
+	iAddingSamples = 0;
+	iClient = 0;
+    }
+
+inline DProfilerSampleStream::~DProfilerSampleStream()
+    {
+	LOGSTRING("DProfilerSampleStream::~DProfilerSampleStream");	
+    }
+
+inline void DProfilerSampleStream::InsertCurrentClient(DThread* aClient)
+    {
+	iClient = aClient;
+	LOGSTRING2("DProfilerSampleStream::InsertCurrentClient - iClient is 0x%x",iClient);
+    }
+
+
+inline void DProfilerSampleStream::AddSampleBuffer(TBapBuf* aBuffer,TRequestStatus* aStatus)
+    {
+	if(iCurrentBuffer != 0 || iPendingRequest != 0)
+	    {
+		LOGSTRING("DProfilerSampleStream::AddSampleBuffer - ERROR 1");
+		return;
+	    }
+
+	LOGSTRING3("DProfilerSampleStream::AddSampleBuffer - OK 0x%x,0x%x",aBuffer,aStatus);
+	iCurrentBuffer = aBuffer;
+	iPendingRequest = aStatus;
+	
+	LOGSTRING2("DProfilerSampleStream::AddSampleBuffer - Current Client is 0x%x",iClient);	
+    }
+
+
+inline void DProfilerSampleStream::ReleaseIfPending()
+    {
+    LOGSTRING("DProfilerSampleStream::ReleaseIfPending - entry");
+
+	if(iCurrentBuffer != 0 && iPendingRequest != 0 && iClient != 0)
+	    {
+		LOGSTRING("DProfilerSampleStream::ReleaseIfPending - release buffer");
+
+		LOGSTRING2("DProfilerSampleStream::AddSamples - completing request 0x%x",iPendingRequest);
+		Kern::RequestComplete(iClient,iPendingRequest,KErrNone);
+		
+		iPendingRequest = 0;
+		iCurrentBuffer = 0;
+	    }
+
+	LOGSTRING("DProfilerSampleStream::ReleaseIfPending - exit");
+    }
+
+inline void DProfilerSampleStream::AddSamples(DProfilerSampleBuffer& aBuffer, TInt aSamplerId)
+    {
+	LOGSTRING3("DProfilerSampleStream::AddSamples - entry ID: %d, currentbuffer: 0x%x", aSamplerId,iCurrentBuffer);
+	if(iCurrentBuffer != 0)
+	    {
+		// the following will perform simple mutual exclusion
+		iAddingSamples++;
+		if(iAddingSamples > 1) 
+		    {
+			// there is someone else adding samples to the buffer
+            LOGSTRING("DProfilerSampleStream::AddSamples - mutex in use");
+			iAddingSamples--;
+			return;
+		    }
+
+		LOGSTRING("DProfilerSampleStream::AddSamples - reading TBapBuf");
+		
+		// use a copy of the client TBapBuf structure during processing
+		TBapBuf realBuf;
+		TPtr8 ptr((TUint8*)&realBuf,(TInt)sizeof(TBapBuf));
+	
+		Kern::ThreadRawRead(iClient,(TAny*)(iCurrentBuffer),(TAny*)&realBuf,sizeof(TBapBuf));
+
+		ptr.SetLength(sizeof(TBapBuf));
+
+		LOGSTRING4("DProfilerSampleStream::AddSamples - read %d bytes from 0x%x of thread 0x%x",ptr.Size(),iCurrentBuffer,iClient);
+
+		LOGSTRING5("DProfilerSampleStream::AddSamples - current buffer 0x%x -> b:0x%x s:%d d:%d",
+			&realBuf,
+			realBuf.iBuffer,
+			realBuf.iBufferSize,
+			realBuf.iDataSize);
+
+		// get the address of the source buffer data
+		TUint8* src = (TUint8*)&(aBuffer.iDblBufStruct->iDataStart);
+		src += aBuffer.iDblBytesRead;
+
+		// the amount of data to copy is the 4 header bytes +
+		// the remaining data in the buffer
+		TInt amount = aBuffer.iDblBytesWritten-aBuffer.iDblBytesRead;
+
+		TUint8* dst = realBuf.iBuffer;
+
+		LOGSTRING4("DProfilerSampleStream::AddSamples - s:0x%x d:0x%x a:%d",src,dst,amount);
+
+		if(realBuf.iDataSize == 0)
+		    {
+			LOGSTRING("DProfilerSampleStream::AddSamples - case 1");
+
+			// the buffer is empty
+			if(realBuf.iBufferSize >= (amount+4))
+			    {
+				LOGSTRING("DProfilerSampleStream::AddSamples - case 1.1");
+
+				// the source buffer is smaller or of equal size than the amount of output data
+				PerformCopy((TUint8)aSamplerId,src,realBuf.iBufDes,0,amount);
+				realBuf.iDataSize += amount+4;
+				// the rest of the source buffer was copied at once, so signal the buffer
+				aBuffer.DataCopied();
+			    }
+			else
+			    {
+				LOGSTRING("DProfilerSampleStream::AddSamples - case 1.2");
+
+				// only a part of the source buffer will fit to the client side buffer
+				amount = realBuf.iBufferSize-4;
+				PerformCopy((TUint8)aSamplerId,src,realBuf.iBufDes,0,amount);
+				realBuf.iDataSize += amount+4;
+				// add the amount of bytes read to the source buffer
+				aBuffer.iDblBytesRead+=amount;
+			    }
+		    }
+		else
+		    {
+			LOGSTRING("DProfilerSampleStream::AddSamples - case 2");
+
+			// there is data in the client buffer
+			dst += realBuf.iDataSize;
+			TInt remainingSpace = realBuf.iBufferSize-realBuf.iDataSize;
+
+			if( remainingSpace >= (amount+4) )
+			    {
+				LOGSTRING("DProfilerSampleStream::AddSamples - case 2.1");
+
+				// the source buffer is smaller or of equal size than the amount of output data
+				PerformCopy((TUint8)aSamplerId,src,realBuf.iBufDes,realBuf.iDataSize,amount);
+				realBuf.iDataSize += (amount+4);
+				// the rest of the source buffer was copied at once, so signal the buffer
+				aBuffer.DataCopied();
+			    }
+			else
+			    {
+				LOGSTRING("DProfilerSampleStream::AddSamples - case 2.2");
+
+				// only a part of the source buffer will fit to the client side buffer
+				if(remainingSpace >= 12)
+				    {
+					LOGSTRING("DProfilerSampleStream::AddSamples - case 2.3");
+
+					amount = remainingSpace-4;
+					// there are at least 8 bytes left for data, write it
+					PerformCopy((TUint8)aSamplerId,src,realBuf.iBufDes,realBuf.iDataSize,amount);
+					realBuf.iDataSize += (amount+4);
+					// add the amount of bytes read to the source buffer
+					aBuffer.iDblBytesRead+=amount;				
+				    }
+			    }
+		    }
+	
+		// copy the data in the modified TBapBuf structure back to the client
+		LOGSTRING("DProfilerSampleStream::AddSamples - writing TBapBuf");
+
+		Kern::ThreadDesWrite(iClient,(TAny*)(realBuf.iDes),ptr,0,KChunkShiftBy0,iClient);
+
+		// if the client side buffer is full or nearly full, signal the client
+		LOGSTRING("DProfilerSampleStream::AddSamples - data copied");
+
+		if(realBuf.iBufferSize-realBuf.iDataSize < 12)
+		    {
+			LOGSTRING("DProfilerSampleStream::AddSamples - release buffer");
+			
+			LOGSTRING2("DProfilerSampleStream::AddSamples - completing request 0x%x",iPendingRequest);
+
+			Kern::RequestComplete(iClient,iPendingRequest,KErrNone);
+
+			iPendingRequest = 0;
+			iCurrentBuffer = 0;
+			//iClient = 0;
+		    }
+
+		// free the lock
+		iAddingSamples--;
+	    }
+	LOGSTRING("DProfilerSampleStream::AddSamples - exit");
+    }
+
+
+
+inline TInt DProfilerSampleStream::EndSampling(DProfilerSampleBuffer& aBuffer,TInt aSamplerId)
+    {
+    LOGSTRING2("DProfilerSampleStream::EndSampling, sampler ID: %d",aSamplerId);
+
+	// switch the buffer to double buffer
+	// even though it would not be full yet
+	// the switch is done only once / end sampling procedure
+	// (Only with BufferOk status)
+	aBuffer.EndSampling();
+	
+	LOGSTRING2("DProfilerSampleStream::EndSampling, iClient: 0x%x",iClient);
+	
+	if(aBuffer.iBufferStatus != DProfilerSampleBuffer::BufferDataEnd)
+	    {
+		// add these final samples to the client buffer
+		AddSamples(aBuffer,aSamplerId);
+		
+		// if all data was copied to the buffer, the buffer status is now BufferOk
+
+		if(aBuffer.iBufferStatus != DProfilerSampleBuffer::BufferOk)
+		    {
+            LOGSTRING("DProfilerSampleStream::EndSampling - more data to copy");
+			// there is still more data to copy, the pending request should have been
+			// completed in AddSamples(), because the client buffer got filled 
+			return 1;
+		    }
+		else
+		    {
+			// buffer status was changed to BufferOk in AddSamples() - 
+			// this means all data from it could be copied
+			// now we have to change the status of the buffer to BufferDataEnd, so
+			// we know that the particular buffer has no more data to copy
+            LOGSTRING("DProfilerSampleStream::EndSampling - switch to BufferDataEnd");
+			aBuffer.iBufferStatus = DProfilerSampleBuffer::BufferDataEnd;
+		    }
+	    }
+
+	// the buffer was completely emptied to the client buffer, or there was no
+	// data to copy to the client side
+	LOGSTRING("DProfilerSampleStream::EndSampling - no more data to copy");
+
+	return 0;
+    }
+
+inline void DProfilerSampleStream::PerformCopy(TUint8 aSamplerId,TUint8* aSrc,TPtr8* aDst,TInt aOffset,TInt aAmount)
+    {
+	LOGSTRING2("DProfilerSampleStream::PerformCopy for sampler ID: %d",aSamplerId);	
+	LOGSTRING5("DProfilerSampleStream::PerformCopy - 0x%x -> 0x%x - %d - offset: %d",aSrc, aDst, aAmount, aOffset);	
+	TUint32 header;
+	header = aAmount & 0x00ffffff;
+	header += (aSamplerId << 24);
+	TPtr8 ptr((TUint8*)&header,4);
+	ptr.SetLength(4);
+
+	LOGSTRING2("DProfilerSampleStream::PerformCopy - start header copy HDR = 0x%x",header);	
+
+	// write the header
+	Kern::ThreadDesWrite(iClient,(TAny*)aDst,ptr,aOffset,KChunkShiftBy0);
+
+	LOGSTRING2("DProfilerSampleStream::PerformCopy - copied header %d bytes",ptr.Size());	
+	aOffset+=4;
+
+	LOGSTRING("DProfilerSampleStream::PerformCopy - start copy");	
+	// write the data
+	ptr.Set(aSrc,aAmount,aAmount);
+	ptr.SetLength(aAmount);
+	
+	Kern::ThreadDesWrite(iClient,(TAny*)aDst,ptr,aOffset,KChunkShiftBy0);
+
+
+	LOGSTRING2("DProfilerSampleStream::PerformCopy - copied data %d bytes",ptr.Size());	
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesUsr.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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 PROFILERGENERICCLASSESUSR_H
+#define PROFILERGENERICCLASSESUSR_H
+
+#include <piprofiler/ProfilerConfig.h>
+#include <piprofiler/ProfilerVersion.h>
+#include <piprofiler/ProfilerGenericClassesCommon.h>
+#include <piprofiler/PluginSampler.h>
+#include <piprofiler/WriterPluginInterface.h>
+
+#include <e32cmn.h>
+#include <e32std.h>
+#include <f32file.h>
+
+
+/*
+ *	
+ *	Class MProfilerBufferHandlerObserver definition
+ *	
+ */
+class MProfilerBufferHandlerObserver
+	{
+public:
+	virtual TBapBuf* GetNextFreeBuffer() = 0;
+	virtual void AddToFilledBuffers(TBapBuf* aFilledBuffer) = 0;
+	};
+
+/*
+ *	
+ *	Class CProfilerBufferHandler definition
+ *	
+ */
+// forward declarations
+class CProfilerSampleStream;
+
+class CProfilerBufferHandler : public CActive
+	{
+public:
+	static CProfilerBufferHandler* CProfilerBufferHandler::NewL(CProfilerSampleStream& aStream, RPluginSampler& aSampler);
+	CProfilerBufferHandler(CProfilerSampleStream& aStream, RPluginSampler& aSampler);
+	~CProfilerBufferHandler();
+	
+	void 		ConstructL();
+	
+	// for plugins to start receiving trace data
+	void		StartReceivingData();
+private:
+	void		RunL();
+	TInt        RunError(TInt aError);
+	void		DoCancel();
+	void        HandleEndOfStream();
+public:
+	TInt					iFinished;
+private:
+	RPluginSampler&			iSampler;
+	TBapBuf*				iBufferInProcess;
+	TBool					iEndOfStreamDetected;
+	
+	CProfilerSampleStream&     iObserver;
+	};
+
+/*
+ *	
+ *	Class CProfilerSampleStream definition
+ *	
+ */
+class CWriterPluginInterface;
+
+class CProfilerSampleStream : public CBase, MProfilerBufferHandlerObserver
+{
+public:
+	static CProfilerSampleStream* CProfilerSampleStream::NewL(TInt aBufSize);
+	~CProfilerSampleStream();
+
+	void 		ConstructL();
+
+	void 		Finalise();
+	void 		EmptyBuffers();
+	inline void		AddToFreeBuffers(TBapBuf* freeBuffer);
+	void        SetWriter(CWriterPluginInterface& aWriter);
+	
+	// from MProfilerBufferHandlerObserver
+	TBapBuf* 	GetNextFreeBuffer();
+	void        AddToFilledBuffers(TBapBuf* aFilledBuffer);
+	inline TBapBuf*    GetNextFilledBuffer();
+	void        ResetBuffers();
+	void        InitialiseBuffers();
+	inline void        NotifyWriter();
+private:
+	CProfilerSampleStream(TInt aBufSize);
+	
+	
+public:
+    TInt					iFinished;
+    CWriterPluginInterface* iWriter;
+private:
+    TInt					iBufferSize;
+    TBapBuf*				iFreeBuffers;
+    TBapBuf*                iFilledBuffers;
+};
+
+#include <piprofiler/ProfilerGenericClassesUsr.inl>
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesUsr.inl	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,498 @@
+/*
+* 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 <e32svr.h>
+
+#include <piprofiler/ProfilerTraces.h>
+
+// constants
+const TInt KInitialFreeBufferAmount = 4;
+
+/*
+ *
+ *	Class CProfilerBufferHandler implementation
+ *
+ */
+inline CProfilerBufferHandler* CProfilerBufferHandler::NewL(CProfilerSampleStream& aStream, RPluginSampler& aSampler)
+	{
+	LOGTEXT(_L("CProfilerBufferHandler::NewL - entry"));
+	CProfilerBufferHandler* self = new(ELeave) CProfilerBufferHandler(aStream, aSampler);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;   
+	}
+
+inline CProfilerBufferHandler::CProfilerBufferHandler(CProfilerSampleStream& aStream, RPluginSampler& aSampler)
+    : CActive(EPriorityStandard),
+    iSampler(aSampler),
+    iObserver(aStream)
+    {
+    }
+
+inline CProfilerBufferHandler::~CProfilerBufferHandler()
+	{
+	LOGTEXT(_L("CProfilerBufferHandler::~CProfilerBufferHandler() - entry"));
+	}
+
+inline void CProfilerBufferHandler::ConstructL()
+	{
+	LOGTEXT(_L("CProfilerBufferHandler::ConstructL - entry"));
+	iBufferInProcess = 0;
+	iEndOfStreamDetected = false;
+
+	iFinished = 0;
+	// add the buffer handler to the active scheduler
+	CActiveScheduler::Add(this);
+	}
+
+inline void CProfilerBufferHandler::StartReceivingData()
+	{
+	LOGTEXT(_L("CProfilerBufferHandler::StartReceivingData - entry"));
+
+	iEndOfStreamDetected = false;
+	// this method initiates receiving data from the sampler
+	iBufferInProcess = iObserver.GetNextFreeBuffer();
+
+	LOGSTRING5("CProfilerBufferHandler::StartReceivingData - 0x%x -> b:0x%x s:%d d:%d",
+					iBufferInProcess,
+					iBufferInProcess->iBuffer,
+					iBufferInProcess->iBufferSize,
+					iBufferInProcess->iDataSize);
+
+	iSampler.FillThisStreamBuffer(iBufferInProcess,iStatus);
+
+	LOGTEXT(_L("CProfilerBufferHandler::StartReceivingData - SetActive"));
+	SetActive();
+
+	LOGTEXT(_L("CProfilerBufferHandler::StartReceivingData - exit"));
+	}
+
+inline TInt CProfilerBufferHandler::RunError(TInt aError)
+    {
+    // handle the error case by stopping the trace
+    HandleEndOfStream();
+    return aError;
+    }
+
+inline void CProfilerBufferHandler::HandleEndOfStream()
+    {
+    LOGTEXT(_L("CProfilerBufferHandler::RunError - entry"));
+    // Cancel has been called, the stream should be about to end now,
+    // we will wait for the rest of the buffers to be filled synchronously
+    // the end of the stream will be indicated through an empty buffer
+    // at first, complete the ongoing request
+    if(iStatus == KRequestPending && iBufferInProcess != 0)
+        {
+        LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 1"));
+
+        // wait for the buffer to be filled synchronously
+        User::WaitForRequest(iStatus);
+        
+        // add the received buffer to the list of filled buffers
+        iObserver.AddToFilledBuffers(iBufferInProcess);
+        // continue writing to output
+        iObserver.NotifyWriter();
+        
+        if(iBufferInProcess->iDataSize == 0)
+            {
+            // a buffer with size 0 was received
+            LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 1.1"));
+            iEndOfStreamDetected = true;
+            }
+
+        // there will be no more asynchronous requests
+        iBufferInProcess = 0;
+        }
+    else if (iBufferInProcess != 0)
+        {
+        LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 2"));
+
+        // add the buffer into filled, i.e. ready-to-write buffers
+        iObserver.AddToFilledBuffers(iBufferInProcess);
+        iObserver.NotifyWriter();
+        
+        if(iBufferInProcess->iDataSize == 0)
+            {
+            // a buffer with size 0 was received
+            LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 2.1"));
+            iEndOfStreamDetected = true;
+            }       
+        // there will be no more asynchronous requests
+        iBufferInProcess = 0;   
+        }
+
+    // then, continue until end of stream has been reached
+    while(iEndOfStreamDetected == false)
+        {
+        // the end of stream has not yet been detected, so get more
+        // buffers from the sampler, until we get an empty one
+
+        if(iStatus == KRequestPending)
+            {
+            LOGTEXT(_L("CProfilerBufferHandler::DoCancel - ERROR 1"));
+            }
+
+        LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 3"));
+
+        TBapBuf* nextFree = iObserver.GetNextFreeBuffer();  
+        iSampler.FillThisStreamBuffer(nextFree,iStatus);
+        // wait for the buffer to be filled synchronously
+        User::WaitForRequest(iStatus);
+        
+        // call the writer plugin to write data to output
+        iObserver.AddToFilledBuffers(nextFree);
+        iObserver.NotifyWriter();
+        
+        // check if end-of-data message (i.e. data size is 0 sized) received
+        if(nextFree->iDataSize == 0)
+            {
+            LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 3.1"));
+            // a buffer with size 0 was received
+            iEndOfStreamDetected = true;
+            nextFree = 0;
+            }
+        }   
+    }
+
+inline void CProfilerBufferHandler::RunL()
+	{
+	LOGTEXT(_L("CProfilerBufferHandler::RunL - entry"));
+
+	// is called by the active scheduler
+	// when a buffer has been received
+
+	// buffer with dataSize 0 is returned when the sampling ends
+	if(iBufferInProcess->iDataSize != 0)
+	    {
+	    LOGTEXT(_L("CProfilerBufferHandler::RunL - buffer received"));
+
+		TBapBuf* nextFree = iObserver.GetNextFreeBuffer();
+		
+		LOGSTRING5("CProfilerBufferHandler::RunL - 0x%x -> b:0x%x s:%d d:%d",
+					nextFree,
+					nextFree->iBuffer,
+					nextFree->iBufferSize,
+					nextFree->iDataSize);
+
+		iSampler.FillThisStreamBuffer(nextFree,iStatus);
+
+		LOGTEXT(_L("CProfilerBufferHandler::RunL - issued new sample command"));
+
+		// add the received buffer to the list of filled buffers
+		iObserver.AddToFilledBuffers(iBufferInProcess);
+		iObserver.NotifyWriter();
+
+        // the empty buffer is now the one being processed
+        iBufferInProcess = nextFree;
+        
+        LOGTEXT(_L("CProfilerBufferHandler::RunL - SetActive"));
+        SetActive();        
+		}
+	else
+		{
+		LOGTEXT(_L("CProfilerBufferHandler::RunL - end of stream detected"));
+		iEndOfStreamDetected = true;
+		
+		// add the empty buffer to the writer so that it will also get the information
+		// about the finished stream
+		iObserver.AddToFilledBuffers(iBufferInProcess);
+		iObserver.NotifyWriter();
+
+		iBufferInProcess = 0;
+		Cancel();
+
+		}
+	LOGTEXT(_L("CProfilerBufferHandler::RunL - exit"));
+	}
+
+inline void CProfilerBufferHandler::DoCancel()
+    {
+    LOGTEXT(_L("CProfilerBufferHandler::DoCancel - entry"));
+    HandleEndOfStream();
+    LOGTEXT(_L("CProfilerBufferHandler::DoCancel - exit"));
+    }
+
+
+/*
+ *
+ *	Class CProfilerSampleStream implementation
+ *
+ *  - used by Plugin
+ **/
+
+inline CProfilerSampleStream* CProfilerSampleStream::NewL(TInt aBufSize)
+	{
+	LOGTEXT(_L("CProfilerSampleStream::NewL - entry"));
+	CProfilerSampleStream* self = new(ELeave) CProfilerSampleStream(aBufSize);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;   
+	}
+
+inline CProfilerSampleStream::CProfilerSampleStream(TInt aBufSize) : 
+    iBufferSize(aBufSize)
+	{
+	LOGTEXT(_L("CProfilerSampleStream::CProfilerSampleStream - entry"));
+	
+	iFilledBuffers = 0;
+    iFreeBuffers = 0;
+    iFinished = 0;
+    
+	LOGTEXT(_L("CProfilerSampleStream::CProfilerSampleStream - exit"));	
+	}
+
+inline CProfilerSampleStream::~CProfilerSampleStream()
+	{
+	LOGTEXT(_L("CProfilerSampleStream::~CProfilerSampleStream - entry"));
+
+	// empty all buffers
+	EmptyBuffers();
+	    
+	LOGTEXT(_L("CProfilerSampleStream::~CProfilerSampleStream - exit"));
+	}
+
+inline void CProfilerSampleStream::ConstructL()
+	{
+
+	}
+
+inline void CProfilerSampleStream::SetWriter(CWriterPluginInterface& aWriter)
+    {
+    // set writer plugin
+    iWriter = &aWriter;
+    }
+
+inline void CProfilerSampleStream::Finalise()
+	{
+	LOGTEXT(_L("CProfilerSampleStream::Finalise - entry"));
+	}
+
+inline void CProfilerSampleStream::ResetBuffers()
+    {
+
+    // empty buffers
+    EmptyBuffers();
+
+    // re-initialise buffers
+    InitialiseBuffers();
+    }
+
+inline void CProfilerSampleStream::InitialiseBuffers()
+    {
+    // re-initialize member variables
+    iFilledBuffers = 0;
+    iFreeBuffers = 0;
+    iFinished = 0;
+    
+    // create three(orig. two) new TBapBuf objects and add them to the
+    // list of free buffers
+    for(TInt i(0);i<KInitialFreeBufferAmount;i++)
+        {
+        // alloc new buffer
+        TBapBuf* newBuf = (TBapBuf*)User::Alloc(sizeof(TBapBuf));
+        newBuf->iBuffer = (TUint8*)User::Alloc(iBufferSize);
+
+        // initialize the new buffer
+        newBuf->iBufferSize = iBufferSize;
+        newBuf->iDataSize = 0;
+        newBuf->iNext = 0;
+        newBuf->iDes = new TPtr8((TUint8*)newBuf,sizeof(TBapBuf));
+        newBuf->iDes->SetLength(sizeof(TBapBuf));
+        newBuf->iBufDes = new TPtr8((TUint8*)newBuf->iBuffer,iBufferSize);
+        newBuf->iBufDes->SetLength(iBufferSize);
+        AddToFreeBuffers(newBuf);
+        }
+    }
+
+inline void CProfilerSampleStream::EmptyBuffers()
+    {
+	LOGTEXT(_L("CProfilerSampleStream::EmptyBuffers - entry"));
+
+	// delete all free buffers
+	while(iFreeBuffers != 0)
+	    {
+		LOGSTRING2("CProfilerSampleStream::EmptyBuffers - deleting 0x%x",iFreeBuffers);
+
+		// store the next buffer in the list
+		TBapBuf* nextFree = iFreeBuffers->iNext;
+		// delete the first one in the list
+		delete iFreeBuffers->iBufDes;
+		delete iFreeBuffers->iDes;
+		delete iFreeBuffers->iBuffer;
+		delete iFreeBuffers;
+		// set the list start to the next buffer
+		iFreeBuffers = nextFree;
+	    }
+	iFreeBuffers = 0;
+	LOGTEXT(_L("CProfilerSampleStream::EmptyBuffers - exit"));
+    }
+
+inline TBapBuf* CProfilerSampleStream::GetNextFreeBuffer()
+    {
+    LOGTEXT(_L("CProfilerSampleStream::GetNextFreeBuffer - entry"));
+
+	// get a new buffer from the free buffers list
+	TBapBuf* nextFree = iFreeBuffers;
+	
+	// check if we got a buffer or not
+	if(nextFree == 0)
+	    {
+		// if there are no free buffers,
+		// create a new one
+		LOGTEXT(_L("CProfilerSampleStream::GetNextFreeBuffer - creating new buffer"));
+		TBapBuf* newBuf = (TBapBuf*)User::Alloc(sizeof(TBapBuf));
+		if(newBuf != 0)
+		    {
+			newBuf->iBuffer = (TUint8*)User::Alloc(iBufferSize);
+			if(newBuf->iBuffer != 0)
+			    {
+				newBuf->iBufferSize = iBufferSize;
+				newBuf->iDataSize = 0;
+				newBuf->iNext = 0;
+				newBuf->iDes = new TPtr8((TUint8*)newBuf,sizeof(TBapBuf));
+				newBuf->iDes->SetLength(sizeof(TBapBuf));
+				newBuf->iBufDes = new TPtr8((TUint8*)newBuf->iBuffer,iBufferSize);
+				newBuf->iBufDes->SetLength(iBufferSize);
+				nextFree = newBuf;
+			    }
+			else
+			    {
+				LOGTEXT(_L("CProfilerSampleStream::GetNextFreeBuffer - Out of memory (1)!!"));
+				return 0;
+			    }
+		    }
+		else
+		    {
+			LOGTEXT(_L("CProfilerSampleStream::GetNextFreeBuffer - Out of memory (2)!!"));
+			delete newBuf;
+			return 0;
+		    }		
+	    }
+	else
+	    {
+		// set the list to point to next free buffer
+		iFreeBuffers = nextFree->iNext;
+	    }
+
+	LOGTEXT(_L("CProfilerSampleStream::GetNextFreeBuffer - exit"));
+	return nextFree;
+    }
+
+inline void CProfilerSampleStream::AddToFilledBuffers(TBapBuf* aFilledBuffer)
+    {
+    LOGSTRING2("CProfilerSampleStream::AddToFilledBuffers - entry, size %d", aFilledBuffer->iDataSize);
+
+    // add this buffer to the list of filled buffers
+    if(iFilledBuffers == 0)
+        {
+        // the list is empty, so add the the beginning of the list
+        // there is no next buffer in the list at the moment
+        aFilledBuffer->iNext = 0;
+        iFilledBuffers = aFilledBuffer;
+        }
+    else
+        {
+        // there are buffers in the list, add this buffer to the beginning of the list
+        aFilledBuffer->iNext = iFilledBuffers;
+        iFilledBuffers = aFilledBuffer;
+        }
+    LOGTEXT(_L("CProfilerSampleStream::AddToFilledBuffers - exit"));
+    }
+
+TBapBuf* CProfilerSampleStream::GetNextFilledBuffer()
+    {
+    LOGTEXT(_L("CProfilerSampleStream::GetNextFilledBuffer - entry"));
+
+    if(iFilledBuffers == 0)
+        {
+        // there are no filled buffers in the list
+        LOGTEXT(_L("CProfilerSampleStream::GetNextFilledBuffer - no filled bufs"));
+        return 0;
+        }
+    else
+        {   
+        // get a buffer from the end of the list
+        TBapBuf* buf = iFilledBuffers;
+        TBapBuf* prev = 0;
+
+        if(buf->iNext == 0)
+            {
+            // this was the last (and only) buffer
+            iFilledBuffers = 0;
+            LOGTEXT(_L("CProfilerSampleStream::GetNextFilledBuffer - last filled"));
+            return buf;
+            }
+        else
+            {
+            LOGTEXT(_L("CProfilerSampleStream::GetNextFilledBuffer - searching last filled"));
+            while(buf->iNext != 0)
+                {
+                // there are two or more buffers in the list
+                // proceed until the end of the list is found
+                prev = buf;
+                buf = buf->iNext;
+                }
+            // now buf->next is 0, return buf and set the next
+            // element of prev to NULL
+            prev->iNext = 0;
+            LOGTEXT(_L("CProfilerSampleStream::GetNextFilledBuffer - found last"));
+            return buf;
+            }
+        }
+    }
+
+inline void CProfilerSampleStream::AddToFreeBuffers(TBapBuf* aFreeBuffer)
+    {
+	LOGTEXT(_L("CProfilerSampleStream::AddToFreeBuffers - entry"));
+
+	// set data size of the buffer to 0
+	aFreeBuffer->iDataSize = 0;
+
+	// add this buffer to the list of free buffers
+	if(iFreeBuffers == 0)
+	    {
+		// this is the first buffer, so set the next to point to NULL
+	    aFreeBuffer->iNext = 0;
+	    }
+	else
+	    {
+		// otherwise set to point to the beginning of the list
+	    aFreeBuffer->iNext = iFreeBuffers;
+	    }
+
+	// set this buffer to be the first one in the list
+	iFreeBuffers = aFreeBuffer;
+
+	LOGTEXT(_L("CProfilerSampleStream::AddToFreeBuffers - exit"));
+    }
+
+void CProfilerSampleStream::NotifyWriter()
+    {
+    // notify writer plugin to write data from filled buffer list
+    LOGTEXT(_L("CProfilerSampleStream::NotifyWriter() - entry"));
+    iWriter->WriteData();
+    LOGTEXT(_L("CProfilerSampleStream::NotifyWriter() - exit"));
+    }
+
+// end of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerSession.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,417 @@
+/*
+* 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 __PROFILER_SESSION_H__
+#define __PROFILER_SESSION_H__
+
+#include <e32base.h>
+#include <e32svr.h>
+#include <piprofiler/ProfilerConfig.h>
+#include <piprofiler/ProfilerVersion.h>
+#include <piprofiler/ProfilerTraces.h>
+#include <piprofiler/ProfilerAttributes.h>
+
+_LIT(KProfilerName,"PIProfilerEngine");
+
+/**
+ * The RProfiler class provides a functional interface to the sampling profiler.
+ *
+ * The engine must already be running for this interface to work, this can be
+ * achieved by executing PIProfilerEngine.exe. The control methods are all static, and 
+ * require no other context.
+ */
+NONSHARABLE_CLASS( RProfiler ) : public RSessionBase
+	{
+public:
+	enum TCommand {	
+		// profiler controls
+		EStartSampling = 1,
+		EStartTimedSampling,
+		EStopSampling,
+//		ELoadSettings,
+		EExitProfiler,
+		EFinalise,
+		EAttachClient,
+		ERemoveClient,
+
+		// general attributes
+		EGetGeneralAttributes,
+		EGetSamplerAttributes,
+		EGetSamplerAttributeCount,
+		ESetGeneralAttributes,
+		ESetSamplerAttributes,
+		
+		// generic settings
+		ESetTraceFilePrefix, 
+		ESetTraceFileDrive,
+		EGetSamplerVersion,
+		EGetFileName,
+		EGetActiveWriter,
+		ERefreshProfilerStatus
+		};
+	
+	enum TSamplerState {
+		EIdle = 0, 
+		EInitializing, 
+		ERunning, 
+		EStopping, 
+		EStopped
+		};
+	
+	enum TProfilingMode
+	    {
+	    EProfilingModeNormal = 0,
+	    EProfilingModeTimed
+	    };
+public:
+	
+	
+	/*
+	 * 
+	 *  Methods for commanding Profiler Engine
+	 *   
+	 */
+	
+	// get general settings
+	static inline TInt GetGeneralAttributes(TGeneralAttributes& aAttributes);
+	
+	// get samplers; names, settings, states, descriptions etc. in one array containing all sampler attributes
+	static inline TInt GetSamplerAttributes(CArrayFixFlat<TSamplerAttributes>& aAttributeArray);
+	
+	// save settings back to engine and plugins
+	static inline TInt SetGeneralAttributes(TGeneralAttributes aAttributes);
+
+	// save settings back to engine and plugins
+    static inline TInt SetSamplerAttributes(TSamplerAttributes aAttributes);
+    
+    // refresh profiler engine status
+    static inline TInt RefreshProfilerStatus();	
+	
+    /** Start sampling */
+	static inline TInt StartSampling(TProfilingMode aProfilingMode = EProfilingModeNormal);
+	/** Stop sampling */
+	static inline TInt StopSampling();
+    /** Load settings */
+//    static inline TInt LoadSettings(TDesC& aSettingsFile);
+	/** Exit profiler */
+	static inline TInt ExitProfiler();
+
+	/** Get file name */
+	static inline TInt GetFileName(TDes&);
+    /** Get active writer */
+    static inline TInt GetActiveWriter(TDes&);
+	/** Perform a test case */
+	static inline TInt Test(TUint32 testCase);
+	/** Issue a control request to the engine without data*/
+	static inline TInt ControlState(TCommand aRequest);
+	/** Issue a control request to the engine with descriptor data to write there*/
+	static inline TInt ControlWrite(TCommand aRequest,TDesC& data);
+	/** Issue a control request to the engine with numeric and descriptor data to write there*/
+	static inline TInt ControlWrite(TCommand aRequest,TInt numData, TDesC& data);
+	/** Issue a control request to read descriptor data from the engine*/
+	static inline TInt ControlRead(TCommand aRequest,TDes& data);
+	/** Actually sends the message to profiler engine*/	
+	static inline TInt PerformControl(	TCommand aRequest,
+										TDesC* fromDescriptor = NULL,
+										TUint32 numData1 = 0,
+										TDes* toDescriptor = NULL,
+										TUint32 numData2 = 0xffffffff);
+	
+	static inline TInt AttachClient();
+	static inline TInt RemoveClient();
+
+private:
+	inline RProfiler();
+	};
+
+inline RProfiler::RProfiler()
+	{}
+
+//
+// Connect to the profiler engine, and issue the control request if successful
+//
+inline TInt RProfiler::ControlState(TCommand aRequest)
+    { return PerformControl(aRequest); }
+
+//
+// Connect to the profiler engine, and issue the control request if successful
+//
+inline TInt RProfiler::ControlWrite(TCommand aRequest,TDesC& data)
+    { return PerformControl(aRequest,&data,0); }
+
+//
+// Connect to the profiler engine, and issue the control request if successful
+//
+inline TInt RProfiler::ControlWrite(TCommand aRequest,TInt numData, TDesC& data)
+    { return PerformControl(aRequest,&data,numData); }
+
+//
+// Connect to the profiler engine, and issue the control request if successful
+//
+inline TInt RProfiler::ControlRead(TCommand aRequest,TDes& data)
+    { return PerformControl(aRequest,0,0,&data); }
+
+inline TInt RProfiler::PerformControl(TCommand aRequest,TDesC* fromDescriptor,TUint32 numData1,TDes* toDescriptor,TUint32 numData2)
+	{
+	LOGTEXT(_L("Creating a session to profiler"));
+	RProfiler p;
+	TUint count(0);
+	TInt r(KErrNone);
+
+	// in boot measurement mode, count until 30s
+	#ifdef PROFILER_BOOT_MEASUREMENT
+	while(count < 60)
+	#else
+	while(count < 6)
+	#endif
+		{
+		r = p.CreateSession(KProfilerName, TVersion(), 0);
+		if (r == KErrNone)
+			{
+			LOGSTRING2("Succeeded, sending a message %d", aRequest);
+			LOGSTRING5(" - parameters 0x%x 0x%x 0x%x 0x%x",fromDescriptor,numData1,toDescriptor,numData2);
+			TInt err = KErrNone;
+
+			TIpcArgs a;
+			a.Set(0,fromDescriptor);
+			a.Set(1,numData1);
+			a.Set(2,toDescriptor);
+			a.Set(3,numData2);
+			err = p.SendReceive(aRequest,a);
+
+			p.RSessionBase::Close();
+			
+			if(err != KErrNone)
+				{
+				LOGSTRING2("Profiler responded with an error - code %d !!",err);		
+				return err;
+				}
+			else
+				{ 
+				LOGTEXT(_L("OK, message sent, closing"));
+				return KErrNone;
+				}
+			}
+
+		LOGSTRING2("Error in opening session to profiler - code %d !!",r);
+		//#ifdef PROFILER_BOOT_MEASUREMENT
+		// there was an error contacting the Profiler
+		// indicates that the server is most probably not up
+		// however, since it should be(unless some resource is not yet ready)
+		// we can just wait
+		User::After(500000); // wait 1/2 s
+		count++;
+		//#else
+		// exit immediately on error
+		//return r;
+		//#endif
+		}
+	return r;
+	}
+
+// the new UI access methods
+inline TInt RProfiler::GetGeneralAttributes(TGeneralAttributes& aAttributes)
+    {
+#ifdef _TEST_
+    _LIT(KDefaultTraceOutput,"debug_output");
+    _LIT(KDefaultTraceFilePrefix,"PIProfiler_#");
+    _LIT(KDefaultTraceFileSaveDrive,"E:\\");
+    aAttributes.iTraceOutput.Copy(KDefaultTraceOutput);
+    aAttributes.iTraceFilePrefix.Copy(KDefaultTraceFilePrefix);
+    aAttributes.iSaveFileDrive.Copy(KDefaultTraceFileSaveDrive);
+#else
+    LOGTEXT(_L("Creating a session to profiler"));
+    RProfiler p;
+    TInt r(KErrNone);
+    r = p.CreateSession(KProfilerName, TVersion(), 0);
+    if (r == KErrNone)
+        {
+        LOGSTRING2("Succeeded, sending a message %d", EGetGeneralAttributes);
+
+        TPckg<TGeneralAttributes> attrPckg(aAttributes);
+        TIpcArgs a(&attrPckg);
+        r = p.SendReceive(RProfiler::EGetGeneralAttributes,a);
+        
+        p.RSessionBase::Close();
+        
+        if(r != KErrNone)
+            {
+            LOGSTRING2("Profiler responded with an error - code %d !!",r);        
+            return r;
+            }
+        else
+            { 
+            LOGTEXT(_L("OK, message sent, closing"));
+            return KErrNone;
+            }
+        }
+#endif
+    return r;   // return error code  
+    }
+inline TInt RProfiler::GetSamplerAttributes(CArrayFixFlat<TSamplerAttributes>& aAttributes)
+    {
+#ifdef _TEST_
+    _LIT(KDefaultTraceOutput,"debug_output");
+    _LIT(KDefaultTraceFilePrefix,"PIProfiler_#");
+    _LIT(KDefaultTraceFileSaveDrive,"E:\\");
+    aAttributes.iTraceOutput.Copy(KDefaultTraceOutput);
+    aAttributes.iTraceFilePrefix.Copy(KDefaultTraceFilePrefix);
+    aAttributes.iSaveFileDrive.Copy(KDefaultTraceFileSaveDrive);
+#else
+    // do receive stream of TSamplerAttributes
+    LOGTEXT(_L("Creating a session to profiler"));
+    RProfiler p;
+    TInt r(KErrNone);
+    r = p.CreateSession(KProfilerName, TVersion(), 0);
+    if (r == KErrNone)
+        {
+        TInt attrCount(0);
+        TPckg<TInt> pckg(attrCount);
+        TIpcArgs args(&pckg);
+        
+        r = p.SendReceive(RProfiler::EGetSamplerAttributeCount, args);
+        
+        HBufC8* buffer = HBufC8::NewL(attrCount*sizeof(TSamplerAttributes));
+        TPtr8 ptr(buffer->Des());
+        TIpcArgs args2(&ptr);
+        r = p.SendReceive(RProfiler::EGetSamplerAttributes, args2);
+        
+        TInt len(ptr.Length());
+        TInt pos(0);
+        while (pos != len)
+           {
+           TPckgBuf<TSamplerAttributes> attrPckg;
+           attrPckg.Copy(ptr.Mid(pos, attrPckg.Length()));
+           pos += attrPckg.Length();
+    
+           aAttributes.AppendL(attrPckg());
+           }
+        
+        p.RSessionBase::Close();
+        
+        if(r != KErrNone)
+            {
+            LOGSTRING2("Profiler responded with an error - code %d !!",r);        
+            return r;
+            }
+        else
+            { 
+            LOGTEXT(_L("OK, message sent, closing"));
+            return KErrNone;
+            }
+        }
+#endif
+    return KErrNone; 
+    }
+
+inline TInt RProfiler::SetGeneralAttributes(TGeneralAttributes aAttributes)
+    {
+    // do receive stream of TSamplerAttributes
+    LOGTEXT(_L("Creating a session to profiler"));
+    RProfiler p;
+    TInt r(KErrNone);
+    r = p.CreateSession(KProfilerName, TVersion(), 0);
+    if (r == KErrNone)
+        {
+
+        TPckg<TGeneralAttributes> attrPckg(aAttributes);
+        TIpcArgs a(&attrPckg);
+        r = p.SendReceive(RProfiler::ESetGeneralAttributes,a);
+        
+        p.RSessionBase::Close();
+        
+        if(r != KErrNone)
+            {
+            LOGSTRING2("Profiler responded with an error - code %d !!",r);        
+            return r;
+            }
+        else
+            { 
+            LOGTEXT(_L("OK, message sent, closing"));
+            return KErrNone;
+            }
+        }
+    return r; 
+    }
+
+// save settings back to engine and plugins
+inline TInt RProfiler::SetSamplerAttributes(TSamplerAttributes aAttributes)
+    {
+    // do receive stream of TSamplerAttributes
+    LOGTEXT(_L("Creating a session to profiler"));
+    RProfiler p;
+    TInt r(KErrNone);
+    r = p.CreateSession(KProfilerName, TVersion(), 0);
+    if (r == KErrNone)
+        {
+
+        TPckg<TSamplerAttributes> attrPckg(aAttributes);
+        
+        TIpcArgs a;
+        a.Set(0,&attrPckg);
+
+        r = p.SendReceive(RProfiler::ESetSamplerAttributes,a);
+        
+        p.RSessionBase::Close();
+        
+        if(r != KErrNone)
+            {
+            LOGSTRING2("Profiler responded with an error - code %d !!",r);        
+            return r;
+            }
+        else
+            { 
+            LOGTEXT(_L("OK, message sent, closing"));
+            return KErrNone;
+            }
+        }
+    return r; 
+    }
+
+inline TInt RProfiler::RefreshProfilerStatus()
+    {return ControlState(RProfiler::ERefreshProfilerStatus); }
+
+inline TInt RProfiler::StartSampling(RProfiler::TProfilingMode aProfilingMode)
+	{
+    RProfiler::TCommand command = RProfiler::EStartSampling;
+    if( aProfilingMode == RProfiler::EProfilingModeTimed )
+        {
+        command = RProfiler::EStartTimedSampling;
+        }    
+    return ControlState(command);
+	}
+
+inline TInt RProfiler::StopSampling()
+	{return ControlState(RProfiler::EStopSampling);}
+
+inline TInt RProfiler::ExitProfiler()
+	{return ControlState(RProfiler::EExitProfiler);}
+
+inline TInt RProfiler::AttachClient()
+    {return ControlState(RProfiler::EAttachClient);}
+
+inline TInt RProfiler::RemoveClient()
+    {return ControlState(RProfiler::ERemoveClient);}
+
+inline TInt RProfiler::GetFileName(TDes& fileName)
+	{return ControlRead(EGetFileName,fileName);}
+
+inline TInt RProfiler::GetActiveWriter(TDes& writerDes)
+    {return ControlRead(EGetActiveWriter,writerDes);}
+
+#endif // __PROFILER_SESSION_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerTraces.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* 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 __PROFILER_TRACES_H__
+#define __PROFILER_TRACES_H__
+
+#include <e32def.h>
+
+
+// ---------------------------------------------------------------------------
+// You change these logging method values below! Recompile the application to take changes effect.
+
+    // logging methods
+    // 0 = No logging
+    // 1 = Flogger
+    // 2 = RDebug
+    // 3 = Flogger and RDebug
+
+#undef _DEBUG
+
+    #ifndef _DEBUG
+        
+        // Logging method for UREL builds:
+        #define PROFILER_LOGGING_METHOD  0
+
+    #else
+
+        // Logging method for UDEB builds:
+        #define PROFILER_LOGGING_METHOD  2
+
+    #endif    
+    
+    #ifndef _KERNEL_DEBUG
+        
+        // Logging method for UREL builds:
+        #define KERNEL_LOGGING_METHOD  0
+
+    #else
+
+        // Logging method for UDEB builds:
+        #define KERNEL_LOGGING_METHOD  1
+
+    #endif    
+
+
+
+#ifndef __KERNEL_MODE__
+
+// ---------------------------------------------------------------------------
+// Do not make any changes to lines below...
+
+    #if PROFILER_LOGGING_METHOD == 1 || PROFILER_LOGGING_METHOD == 3
+
+        #include <flogger.h>
+        _LIT(KLogFolder,"PIProfiler");
+        _LIT(KLogFile,"PIProfiler_Trace.txt");
+
+    #endif
+
+    #if PROFILER_LOGGING_METHOD == 2 || PROFILER_LOGGING_METHOD == 3
+
+        #include <e32debug.h>
+
+    #endif
+
+
+    #if PROFILER_LOGGING_METHOD == 0
+    
+        #define LOGTEXT(AAA)
+        #define LOGSTRING(AAA)
+        #define LOGSTRING2(AAA,BBB)
+        #define LOGSTRING3(AAA,BBB,CCC)
+        #define LOGSTRING4(AAA,BBB,CCC,DDD)
+		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE)
+    
+    
+    #elif PROFILER_LOGGING_METHOD == 1
+    
+        #define LOGTEXT(AAA)                RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend, AAA)
+        #define LOGSTRING(AAA)              do { _LIT(tempLogDes,AAA); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,tempLogDes()); } while (0)
+        #define LOGSTRING2(AAA,BBB)         do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB); } while (0)
+        #define LOGSTRING3(AAA,BBB,CCC)     do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); } while (0)
+        #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD); } while (0)
+		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE); } while (0)
+   
+    #elif PROFILER_LOGGING_METHOD == 2
+    
+        #define LOGTEXT(AAA)                RDebug::Print(AAA);
+        #define LOGSTRING(AAA)              do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes); } while (0)
+        #define LOGSTRING2(AAA,BBB)         do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB); } while (0)
+        #define LOGSTRING3(AAA,BBB,CCC)     do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC); } while (0)
+        #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD); } while (0)
+		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD, EEE); } while (0)
+    
+    #elif PROFILER_LOGGING_METHOD == 3
+    
+        #define LOGTEXT(AAA)                RDebug::Print(AAA); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend, AAA)
+        #define LOGSTRING(AAA)              do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,tempLogDes()); } while (0)
+        #define LOGSTRING2(AAA,BBB)         do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB); } while (0)
+        #define LOGSTRING3(AAA,BBB,CCC)     do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); } while (0)
+        #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD); } while (0)
+		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD, EEE); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE); } while (0)
+
+    #endif
+
+#else __KERNEL_MODE__
+
+	#if KERNEL_LOGGING_METHOD == 0
+	
+		#define LOGTEXT(AAA)
+		#define LOGSTRING(AAA)
+		#define LOGSTRING2(AAA,BBB)
+		#define LOGSTRING3(AAA,BBB,CCC)
+		#define LOGSTRING4(AAA,BBB,CCC,DDD)
+		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE)
+
+	#else
+	
+		#define LOGTEXT(AAA)               		Kern::Printf(AAA)
+		#define LOGSTRING(AAA)             		Kern::Printf(AAA);
+		#define LOGSTRING2(AAA,BBB)        		Kern::Printf(AAA, BBB);
+		#define LOGSTRING3(AAA,BBB,CCC)     	Kern::Printf(AAA, BBB, CCC);
+		#define LOGSTRING4(AAA,BBB,CCC,DDD) 	Kern::Printf(AAA, BBB, CCC, DDD);
+		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) Kern::Printf(AAA, BBB, CCC, DDD, EEE);
+
+	#endif
+#endif
+// ---------------------------------------------------------------------------
+
+#endif // __PROFILER_TRACES_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/ProfilerVersion.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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 PROFILER_TOOL_VERSION_H
+#define PROFILER_TOOL_VERSION_H
+
+	/*
+	 *
+	 *	PI Profiler tool composition definitions
+	 *
+	 */	
+
+	#define PROFILER_VERSION		"PI Profiler v2.1.0"
+	#define PROFILER_VERSION_SHORT	_L("2.00.0")
+	#define PROFILER_SAMPLER_VERSION	_L("2.00.0")
+	#define PROFILER_RELEASE_DATE			_L("23rd February 2009. ")
+	
+	#define PROFILER_GPP_SAMPLER_VERSION   _L("2.00")    // SMPfied v2.00
+	#define PROFILER_GFC_SAMPLER_VERSION   _L8("1.10")
+	#define PROFILER_ITT_SAMPLER_VERSION   _L8("1.22")
+	#define PROFILER_MEM_SAMPLER_VERSION	_L8("2.02")
+	#define PROFILER_PRI_SAMPLER_VERSION	_L8("1.56")
+	#define PROFILER_BUP_SAMPLER_VERSION	_L8("1.20")
+	#define PROFILER_IRQ_SAMPLER_VERSION	_L8("1.20")
+	#define PROFILER_TIP_SAMPLER_VERSION	_L8("1.10")
+	#define PROFILER_PEC_SAMPLER_VERSION  _L8("1.24")
+	#define PROFILER_PWR_SAMPLER_VERSION	_L8("1.57")
+	#define PROFILER_SCR_SAMPLER_VERSION	_L8("1.57")
+	#define PROFILER_IPC_SAMPLER_VERSION	_L8("1.59")
+    #define PROFILER_GPU_SAMPLER_VERSION    _L8("1.00")
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/SamplerPluginInterface.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,257 @@
+/*
+* 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 __SAMPLER_PLUGIN_INTERFACE__
+#define __SAMPLER_PLUGIN_INTERFACE__
+
+#include <e32base.h>
+#include <ecom/ecom.h>
+#include <badesca.h>
+#include <piprofiler/ProfilerAttributes.h>	// internal settings format presentations 
+
+
+// Constant for indexing (iOrder):
+const TInt KSamplerPluginNotIndexed      = -1;
+
+/**
+ * Constant:    KSamplerPluginInterfaceUid
+ *
+ * Description: UID of this ECOM interface. It should be unique in the system.
+ *              It is used to identify this specific custom interface.
+ *              Implementations of this interface will use this ID, when they
+ *              publish the implementation. Clients use this UID to search for
+ *              implementations for this interface (the
+ *              EcomInterfaceDefinition.inl does this).
+ */
+const TUid KSamplerPluginInterfaceUid = {0x2001E5BC};
+
+/**
+ *
+ * Description: UID of this ECOM interface. It should be unique in the system.
+ *
+ */
+enum TGenericSettingTypes
+{
+	EEnablePlugin,
+	EOutputSettings,
+	ESaveDrive,
+	EFilePrefix,
+	ETracingMode
+};
+
+
+enum TSamplerCaptionTypes
+	{
+	ECaptionLengthShort,
+	ECaptionLengthMedium,
+	ECaptionLengthLong,
+    ESettingsCaption
+	};
+
+
+/**
+* Used by GetValue(). These are the keys for retrieving a specific
+* value. This enum can be extended to provide other values as well as
+* long as the original keys are not changed.
+*/
+enum TSamplerPluginValueKeys
+    {
+
+    ESamplerPluginKeySettingsItemValueString = 1,
+    ESamplerPluginSettings,
+    ESamplerPluginEnabled,
+    ESamplerPluginDisabled,
+    ESamplerPluginType,
+    ESamplerPluginVersion
+    };
+ 
+
+/**
+ * Class:       CSamplerInterfaceDefinition
+ *
+ * Description: Custom ECOM interface definition. This interface is used by
+ *              clients to find specific instance and do corresponding
+ *              calculation operation for given too numbers. Plugin
+ *              implementations implement the Calculate function.
+ */
+class TBapBuf;
+class CProfilerSampleStream;
+
+class CSamplerPluginInterface : public CBase 
+{
+
+    // CSamplerPluginLoader accesses iOrder which should not be accessed outside.
+    friend class CSamplerPluginLoader;
+
+public: 
+	// Wrapper functions to handle ECOM "connectivity".
+    // These are implemented in EComInterfaceDefinition.inl.
+    // These functions are used only by the client.
+    
+	/**
+     * Function:   NewL
+     *
+     * Description: Wraps ECom object instantitation. Will search for
+     *              interface implementation, which matches to given
+     *              aOperationName.
+     *
+     * Param:       aOperationName name of requested implementation.
+     *              Implementations advertise their "name" as specified
+     *              in their resource file field
+     *                 IMPLEMENTATION_INFO::default_data.
+     *              For details, see EcomInterfaceDefinition.inl comments.
+     *              In this example, the allowed values are "sum" and
+     *              "multiply".
+     *
+     * Note:        This is not a "normal" NewL method, since normally NewL
+     *              methods are only defined for concrete classes.
+     *              Note that also implementations of this interface provide
+     *              NewL methods. They are the familiar NewL's, which create
+     *              instance of classes.
+     */
+    static CSamplerPluginInterface* NewL(const TUid aImplementationUid, TAny* aInitParams);
+
+    /**
+     * Function:   ~CSamplerPluginInterface
+     *
+     * Description: Wraps ECom object destruction. Notifies the ECOM
+     *              framework that specific instance is being destroyed.
+     *              See EcomInterfaceDefinition.inl for details.
+     */
+    virtual ~CSamplerPluginInterface();
+protected: // New
+
+	/**
+	* C++ constructor.
+	*/
+	CSamplerPluginInterface();
+        
+public: 
+	// Public pure virtual functions, which are implemented by
+    // interface implementations (See ..\plugin)
+    
+    /**
+     * Method for initializing and starting of profiling in single plugin implementation
+     * @param aStream is a data stream to store the gathered data, provided by engine
+     * @return TInt if no error KErrNone, else any of system-wide errors
+     */
+    virtual TInt	ResetAndActivateL(CProfilerSampleStream& aStream) = 0;
+
+	/**
+     * Method for stopping of profiling in single plugin implementation
+     * @return TInt if no error KErrNone, else any of system-wide errors
+     */
+    virtual TInt	StopSampling() = 0;
+	
+    /**
+     * Method for checking if plugin is enabled
+     * @return TBool if enabled return ETrue else EFalse
+     */
+    virtual TBool   Enabled() = 0;
+ 	
+    /**
+    * Method for getting an array of sampler attributes, size of an array: 1...n
+    * @return array of settings of one or several sampler plugins
+    */
+    virtual void GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributeArray) = 0;	
+    
+    /**
+    * Method for setting configurations of single sampler attributes
+    * @param aAttributes contains settings of a single sampler plugin 
+    */
+    virtual TInt SetAttributesL(TSamplerAttributes& aAttributes) = 0; 
+    
+    /**
+    * Method for parsing text formatted settings block and converting
+    * it to TSamplerAttributes data structure
+    * @param aSingleSettingArray containing setting lines of a single sampler
+    * @return status of conversion, if success KErrNone, else KErrGeneral
+    */
+    virtual TInt ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray) = 0;
+ 
+    /**
+    * Method for getting UID of this plugin.
+    * @param aSubId the implementation id of sub sampler
+    * @returns uid of sampler or sub sampler, if aSubId -1 uid of sampler, else uid of sub sampler
+    */
+    virtual TUid 	Id(TInt aSubId) const = 0;
+    
+    /**
+    * Method for getting locally defined sub ID value inside a specific plug-in.
+    * @param aUid of a specific sampler
+    * @returns local ID of sampler or sub sampler
+    */
+    virtual TInt 	SubId(TUid aUid) const = 0;
+    
+    /**
+    * Method for getting sampler type.
+    * @returns PROFILER_USER_MODE_SAMPLER, PROFILER_KERNEL_MODE_SAMPLER or PROFILER_DUMMY_MODE_SAMPLER
+    */
+    virtual TInt 	GetSamplerType() = 0;
+	 
+	 
+	 // some internal inline methods, used by engine
+    inline TInt     Flush();
+    inline TInt     AddSample(TUint8* sample, TUint32 length, TInt limitSize);  
+    inline void     SetOrder( TInt aOrder );
+    inline static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray);
+
+    /**
+    * Static methods for getting setting value out of descriptor
+    * 
+    * @param aBuf buffer where to convert the value
+    * @param aValue parameter where to store the requested type of value
+    */
+    inline static void     Str2Bool(const TDesC8& aBuf, TBool& aValue);
+    inline static void     Str2Int(const TDesC8& aBuf, TInt& aValue);
+    inline static void     Str2Int(const TDesC8& aBuf, TUint32& aValue);
+     
+    /** iDtor_ID_Key Instance identifier key. When instance of an
+     *               implementation is created by ECOM framework, the
+     *               framework will assign UID for it. The UID is used in
+     *               destructor to notify framework that this instance is
+     *               being destroyed and resources can be released.
+     */
+    TUid iDtor_ID_Key;
+    
+    /**
+	* Index of the plugin in listbox. Used for CSamplerPluginLoader. Default
+	* value is KSamplerPluginNotIndexed which means not ordered. This value is
+	* read, if defined, from the opaque_data field of the plugin's resource
+	* definition. Index starts from 0.
+	*/
+	TInt iOrder;
+
+public:	    
+	TInt 					iSamplerType;
+	
+	// this variable must be defined by the extending classes!!
+	TInt					iSamplerId;
+	
+	CProfilerSampleStream*	iStream;
+    TBool                   iEnabled;
+		
+private:
+	TBapBuf*				iBuffer;
+};
+
+#include <piprofiler/ProfilerGenericClassesUsr.h>
+#include <piprofiler/SamplerPluginInterface.inl>
+
+
+#endif // __SAMPLER_PLUGIN_INTERFACE__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/SamplerPluginInterface.inl	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* 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:  
+*
+*/
+
+
+// LITERALS
+_LIT8(KTrue, "true");
+_LIT8(KFalse, "false");
+
+inline CSamplerPluginInterface::CSamplerPluginInterface()
+    : iOrder( KSamplerPluginNotIndexed )
+    {
+    iBuffer = 0;
+    iStream = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CSamplerPluginInterface::~CSamplerPluginInterface()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+inline CSamplerPluginInterface::~CSamplerPluginInterface()
+    {
+    iBuffer = 0;
+    REComSession::DestroyedImplementation(iDtor_ID_Key);
+    }
+
+
+inline CSamplerPluginInterface* CSamplerPluginInterface::NewL(const TUid aImplementationUid, TAny* aInitParams)
+    {
+    // Define options, how the default resolver will find appropriate
+    // implementation.
+    return REINTERPRET_CAST(CSamplerPluginInterface*, 
+                            REComSession::CreateImplementationL(aImplementationUid,
+                                                                _FOFF( CSamplerPluginInterface, iDtor_ID_Key ),
+                                                                aInitParams)); 
+    }
+
+inline void CSamplerPluginInterface::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray)
+    {
+    REComSession::ListImplementationsL(KSamplerPluginInterfaceUid, aImplInfoArray);
+    }
+
+inline void CSamplerPluginInterface::SetOrder( TInt aOrder )
+    {
+    iOrder = aOrder;
+    }
+
+inline TInt CSamplerPluginInterface::Flush() 
+    {
+	// complete the header
+	TUint32 header;
+	header = (iBuffer->iDataSize & 0x00ffffff) - 4;
+	header += (iSamplerId << 24);
+
+	// flush the header info
+	iBuffer->iBuffer[0] = header;
+	iBuffer->iBuffer[1] = header >> 8;
+	iBuffer->iBuffer[2] = header >> 16;
+	iBuffer->iBuffer[3] = header >> 24;
+	
+    // write data to filled buffers
+    iStream->AddToFilledBuffers(iBuffer);
+    // notify selected writer plugin to write data to output
+    iStream->NotifyWriter();
+
+    iBuffer = 0;
+
+	return KErrNone;
+}
+
+
+inline TInt CSamplerPluginInterface::AddSample(TUint8* aSample, TUint32 aLength, TInt aLimitSize)
+    {
+    LOGTEXT(_L("CSamplerPluginInterface::AddSample - entry"));
+	if(iBuffer == 0) 
+	    {
+	    // get next free buffer where to write data
+		iBuffer = iStream->GetNextFreeBuffer();
+		iBuffer->iBufDes->Zero();
+		
+		// get space for the header
+		TUint32 header = 0;
+		iBuffer->iBufDes->Append((TUint8*)&header, 4);	
+		iBuffer->iDataSize += 4;
+	    }
+		
+	// add data to the buffer...
+	// if all data fit to the current buffer
+	if(iBuffer->iBufferSize - iBuffer->iDataSize >= (TInt)aLength)
+	    {
+		iBuffer->iBufDes->Append(aSample, (TInt)aLength);
+		iBuffer->iDataSize += (TInt)aLength;
+	    }
+	else 
+	    {	
+		// fill in the buffer
+		TUint32 rest = iBuffer->iBufferSize - iBuffer->iDataSize;
+		iBuffer->iBufDes->Append(aSample, rest);
+		iBuffer->iDataSize += (TInt)rest;
+		
+		// The buffer is full now, complete the header
+		TUint32 header;
+		header = (iBuffer->iDataSize & 0x00ffffff) - 4;
+		header += (iSamplerId << 24);
+		iBuffer->iBuffer[0] = header;
+		iBuffer->iBuffer[1] = header >> 8;
+		iBuffer->iBuffer[2] = header >> 16;
+		iBuffer->iBuffer[3] = header >> 24;
+		
+		// write data to filled buffers
+		iStream->AddToFilledBuffers(iBuffer);
+	    // notify selected writer plugin to write data to output
+	    iStream->NotifyWriter();
+		
+		// Fetch an empty buffer and reserve space for the header
+		iBuffer = iStream->GetNextFreeBuffer();
+		iBuffer->iBufDes->Zero();
+		header = 0;
+		iBuffer->iBufDes->Append((TUint8*)&header, 4);	
+		iBuffer->iDataSize += 4;
+			
+		// copy the rest of data to the new buffer
+		iBuffer->iBufDes->Append(aSample+rest, aLength-rest);
+		iBuffer->iDataSize += (TInt)aLength-rest;
+	    }
+	
+	// Once iBuffer->dataSize reaches the limitSize, data from iBuffer is flushed to file/debug port.
+	// If limitSize is set to zero, buffer is not changed until iBuffer gets full.
+	if(aLimitSize != 0) 
+	    {
+		if(iBuffer->iDataSize >= aLimitSize) 
+		    {
+			// The buffer is full now, complete the header
+			TUint32 header;
+			header = (iBuffer->iDataSize & 0x00ffffff) - 4;
+			header += (iSamplerId << 24);
+			iBuffer->iBuffer[0] = header;
+			iBuffer->iBuffer[1] = header >> 8;
+			iBuffer->iBuffer[2] = header >> 16;
+			iBuffer->iBuffer[3] = header >> 24;
+	
+
+            // write data to filled buffers
+            iStream->AddToFilledBuffers(iBuffer);
+            // notify selected writer plugin to write data to output
+            iStream->NotifyWriter();
+		    
+			// Fetch an empty buffer and reserve space for the header
+			iBuffer = iStream->GetNextFreeBuffer();
+			iBuffer->iBufDes->Zero();
+			header = 0;
+			iBuffer->iBufDes->Append((TUint8*)&header, 4);	
+			iBuffer->iDataSize += 4;
+		    }
+	    }
+	return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// Converts given descriptor into TBool value.
+// ----------------------------------------------------------------------------
+//
+inline void CSamplerPluginInterface::Str2Bool(const TDesC8& aBuf, TBool& aValue)
+    {
+    if (aBuf.CompareF(KFalse) == 0)
+        aValue = EFalse;
+    else
+        aValue = ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// Converts given descriptor into TInt value.
+// ----------------------------------------------------------------------------
+//
+inline void CSamplerPluginInterface::Str2Int(const TDesC8& aBuf, TInt& aValue)
+    {
+    TLex8 conv;
+    conv.Assign(aBuf);
+    
+    if (conv.Val(aValue) != KErrNone)
+        aValue = 0;
+    }
+
+// ----------------------------------------------------------------------------
+// Converts given descriptor into TInt value.
+// ----------------------------------------------------------------------------
+//
+inline void CSamplerPluginInterface::Str2Int(const TDesC8& aBuf, TUint32& aValue)
+    {
+    TInt temp(0);
+    
+    TLex8 conv;
+    conv.Assign(aBuf);
+    
+    if (conv.Val(temp) != KErrNone)
+        aValue = 0;
+    else
+        aValue = (TUint32)temp;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/WriterPluginInterface.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,174 @@
+/*
+* 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 __WRITERPLUGIN_INTERFACE__
+#define __WRITERPLUGIN_INTERFACE__
+
+#include <e32base.h>
+#include <ecom/ecom.h>
+#include <badesca.h>
+
+
+// Constant for indexing (iOrder):
+const TInt KWriterPluginNotIndexed      = -1;
+
+/**
+ * Constant:    KWriterPluginInterfaceUid
+ *
+ * Description: UID of this ECOM interface. It should be unique in the system.
+ *              It is used to identify this specific custom interface.
+ *              Implementations of this interface will use this ID, when they
+ *              publish the implementation. Clients use this UID to search for
+ *              implementations for this interface (the
+ *              EcomInterfaceDefinition.inl does this).
+ */
+const TUid KWriterPluginInterfaceUid = {0x2001E5BD};
+
+/**
+* Used by GetValue(). These are the keys for retrieving a specific
+* value. This enum can be extended to provide other values as well as
+* long as the original keys are not changed.
+*/
+enum TWriterPluginValueKeys
+    {
+    EWriterPluginKeySettingsItemValueString = 1,
+    EWriterPluginSettings,
+    EWriterPluginEnabled,
+    EWriterPluginDisabled,
+    EWriterPluginType,
+    EWriterPluginVersion
+    };
+/**
+ *
+ * Description: UID of this ECOM interface. It should be unique in the system.
+ *
+ */
+    
+/**
+ * Class:       CWriterInterfaceDefinition
+ *
+ * Description: Custom ECOM interface definition. This interface is used by
+ *              clients to find specific instance and do corresponding
+ *              calculation operation for given too numbers. Plugin
+ *              implementations implement the Calculate function.
+ */
+
+class CProfilerSampleStream;
+
+class CWriterPluginInterface : public CBase
+    {
+
+    // CSamplerPluginLoader accesses iOrder which should not be accessed outside.
+    friend class CWriterPluginLoader;
+
+public: // Wrapper functions to handle ECOM "connectivity".
+        // These are implemented in EComInterfaceDefinition.inl.
+        // These functions are used only by the client.
+    /**
+     * Function:   NewL
+     *
+     * Description: Wraps ECom object instantitation. Will search for
+     *              interface implementation, which matches to given
+     *              aOperationName.
+     *
+     * Param:       aOperationName name of requested implementation.
+     *              Implementations advertise their "name" as specified
+     *              in their resource file field
+     *                 IMPLEMENTATION_INFO::default_data.
+     *              For details, see EcomInterfaceDefinition.inl comments.
+     *              In this example, the allowed values are "sum" and
+     *              "multiply".
+     *
+     * Note:        This is not a "normal" NewL method, since normally NewL
+     *              methods are only defined for concrete classes.
+     *              Note that also implementations of this interface provide
+     *              NewL methods. They are the familiar NewL's, which create
+     *              instance of classes.
+     */
+    static CWriterPluginInterface* NewL(const TUid aImplementationUid, TAny* aInitParams);
+
+    /**
+     * Function:   ~CWriterPluginInterface
+     *
+     * Description: Wraps ECom object destruction. Notifies the ECOM
+     *              framework that specific instance is being destroyed.
+     *              See EcomInterfaceDefinition.inl for details.
+     */
+    virtual ~CWriterPluginInterface();
+protected: // New
+
+        /**
+        * C++ constructor.
+        */
+        CWriterPluginInterface();
+       
+public: 
+     /**
+      * Method for getting caption of this plugin. This should be the
+      * localized name of the settings view to be shown in parent view.
+      *
+      * @param aCaption pointer to Caption variable
+      */
+	 virtual TInt 	Start() = 0;
+	 
+	 virtual void 	Stop() = 0;
+
+	 virtual TUid 	Id() const = 0;
+	 
+	 virtual void 	GetValue( const TWriterPluginValueKeys aKey, TDes& aValue ) = 0;
+	 
+	 virtual void 	SetValue( const TWriterPluginValueKeys aKey, TDes& aValue ) = 0;
+	
+	 virtual void 	GetWriterVersion(TDes* aDes) = 0;
+
+	 virtual TUint32 GetWriterType() = 0;
+
+	 virtual TBool GetEnabled() = 0;
+
+     virtual void   WriteData() = 0;
+     virtual void   SetStream( CProfilerSampleStream& aStream ) = 0;
+     
+	 // internal inline functions
+	 inline static void ListAllImplementationsL( RImplInfoPtrArray& aImplInfoArray );
+     inline void    SetOrder( TInt aOrder );
+     
+private:
+
+    /** iDtor_ID_Key Instance identifier key. When instance of an
+    * implementation is created by ECOM framework, the
+    * framework will assign UID for it. The UID is used in
+    * destructor to notify framework that this instance is
+    * being destroyed and resources can be released.
+    */
+    TUid iDtor_ID_Key;
+    
+    /**
+    * Index of the plugin in listbox. Used for CSamplerPluginLoader. Default
+    * value is KSamplerPluginNotIndexed which means not ordered. This value is
+    * read, if defined, from the opaque_data field of the plugin's resource
+    * definition. Index starts from 0.
+    */
+    TInt iOrder;
+public:
+	TInt	                      iAdditionalSettings;	
+	TBool                         isEnabled;
+    };
+
+#include <piprofiler/WriterPluginInterface.inl>
+
+#endif // __WRITERPLUGIN_INTERFACE__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/inc/WriterPluginInterface.inl	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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:  
+*
+*/
+
+
+inline CWriterPluginInterface::CWriterPluginInterface()
+    : iOrder( KWriterPluginNotIndexed ) 
+    {
+        
+    }
+
+// -----------------------------------------------------------------------------
+// CWriterPluginInterface::~CWriterPluginInterface()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+inline CWriterPluginInterface::~CWriterPluginInterface()
+    {
+    // We don't unload the plugin object here. The loader
+    // has to do this for us. Without this kind of destruction idiom, 
+    // the view framework can potentially unload an ECOM plugin dll whilst 
+    // there are still child views (Created by the plugin) that are registered 
+    // with the view framework. If this occurs, the plugin code segment isn't 
+    // loaded anymore and so there is no way to run the subsequent destructor 
+    // code => exception.
+    
+    // If in the NewL some memory is reserved for member data, it must be
+    // released here. This interface does not have any instance variables so
+    // no need to delete anything.
+
+    // Inform the ECOM framework that this specific instance of the
+    // interface has been destroyed.
+    REComSession::DestroyedImplementation(iDtor_ID_Key);
+    }
+
+inline CWriterPluginInterface* CWriterPluginInterface::NewL(const TUid aImplementationUid, TAny* aInitParams)
+    {
+    // Define options, how the default resolver will find appropriate
+    // implementation.
+    return REINTERPRET_CAST(CWriterPluginInterface*, 
+                            REComSession::CreateImplementationL(aImplementationUid,
+                                                                _FOFF( CWriterPluginInterface, iDtor_ID_Key ),
+                                                                aInitParams)); 
+    }
+
+inline void CWriterPluginInterface::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray)
+    {
+    REComSession::ListImplementationsL(KWriterPluginInterfaceUid, aImplInfoArray);
+    }
+
+inline void CWriterPluginInterface::SetOrder( TInt aOrder )
+    {
+    iOrder = aOrder;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/piprofiler_plat/piprofiler_api.metaxml	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<api id="59f5d0509cc9c1556b04d7b6ff036bd0" dataversion="2.0">
+  <name>PIProfiler API</name>
+  <description>Defines the PIProfiler API, which is used for different PI Profiler sub projects.</description>
+  <type>c++</type>
+  <collection>piprofiler</collection>
+  <libs>
+    <lib name="piprofilerapi.lib"/>
+  </libs>
+  <release category="platform" sinceversion=""/>
+  <attributes>
+    <!-- This indicates wether the api provedes separate html documentation -->
+    <!-- or is the additional documentation generated from headers. -->
+    <!-- If you are unsuere then the value is "no" -->
+    <htmldocprovided>no</htmldocprovided>
+    <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/data/2001E5B6.rss	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 <ecom/registryinfo.rh>
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL. See mmp files
+    //__SERIES60_3X__ can't be used in resource files
+    dll_uid = 0x2001E5B6;
+
+    // Declare array of interface info. This dll contains implementations for 
+    // only one interface (CSamplerInterfaceDefinition).
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x2001E5BC;
+
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2001E5B6;
+
+                    version_no = 1;
+                    display_name = "BUP Sampler";
+                    default_data = "bup";
+                    opaque_data = "6";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/group/BUPPlugin.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 <platform_paths.hrh>
+
+
+TARGET          PIProfilerBUP.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x2001E5B6
+VENDORID        VID_DEFAULT
+CAPABILITY      ALL -TCB
+SMPSAFE
+
+OS_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../inc
+SOURCEPATH      ../src
+
+START RESOURCE  ../data/2001E5B6.rss
+TARGET PIProfilerBUP.rsc
+END
+
+SOURCE      BupPluginImplementationTable.cpp
+SOURCE      BupPlugin.cpp 
+SOURCE      TouchEventClientDll.cpp
+
+LIBRARY     euser.lib
+LIBRARY		bafl.lib
+LIBRARY     ecom.lib
+LIBRARY     apparc.lib
+LIBRARY     cone.lib
+LIBRARY     gdi.lib
+LIBRARY     ws32.lib
+LIBRARY     efsrv.lib
+LIBRARY     charconv.lib
+LIBRARY     CommonEngine.lib
+LIBRARY		flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/group/TouchAnimDll.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* 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 <platform_paths.hrh>
+
+
+TARGET      	PIProfilerTouchEventAnim.DLL
+UID 			0x10003B22 0x2001E5B7
+TARGETTYPE		ANI
+EPOCSTACKSIZE	0x5000
+VENDORID		VID_DEFAULT
+CAPABILITY		ALL -TCB // -AllFiles -NetworkControl -DiskAdmin -MultimediaDD -TCB -DRM
+SMPSAFE
+
+OS_LAYER_SYSTEMINCLUDE
+USERINCLUDE 	../inc
+SOURCEPATH		../src
+
+SOURCE 			TouchEventAnimDll.cpp
+
+LIBRARY 		euser.lib 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* 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:  
+*
+*/
+
+
+PRJ_MMPFILES
+TouchAnimDll.mmp
+BUPPlugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/inc/BupPlugin.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,211 @@
+/*
+* 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 PIPROFILER_BUPECOM_SAMPLER_H
+#define PIPROFILER_BUPECOM_SAMPLER_H
+
+#include <w32std.h>
+#include <w32std.h>			// RWsSession
+#include <w32adll.h>		// RAnim DLL
+#include <e32std.h>
+#include <e32property.h>	// RProperty
+
+#include <piprofiler/ProfilerTraces.h>
+#include <piprofiler/ProfilerConfig.h>
+#include <piprofiler/ProfilerVersion.h>
+#include <piprofiler/SamplerPluginInterface.h>
+#include <piprofiler/ProfilerGenericClassesUsr.h>
+
+#include <data_caging_path_literals.hrh> // for KDC_SHARED_LIB_DIR
+
+// Button press&touch event Anim DLL interface
+#include "TouchEventClientDll.h"
+
+// caption definitions
+_LIT8(KBUPShortName, "bup");
+_LIT8(KBUPLongName, "Button and touch event capture");
+_LIT8(KBUPDescription, "Button and touch event sampler\nTracing button and touch screen events\nHW dep: N/A\nSW dep: S60 3.0\n");
+
+const TUid KProfilerKeyEventPropertyCat={0x2001E5AD};
+enum TProfilerKeyEventPropertyKeys
+	{
+	EProfilerKeyEventPropertySample = 7
+	};
+
+const TUid KGppPropertyCat={0x20201F70};
+enum TGppPropertyKeys
+	{
+	EGppPropertySyncSampleNumber
+	};
+
+
+static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
+static _LIT_SECURITY_POLICY_C1(KCapabilityNone, ECapability_None);
+
+_LIT(KDllName, "PIProfilerTouchEventAnim.DLL");	// animation server dll	on user disk
+
+/*
+ *	
+ *	BUP sampler definition
+ *	
+ */
+class CProfilerButtonListener;
+class CSamplerPluginInterface;
+
+class CBupPlugin : public CSamplerPluginInterface
+{
+public:	
+	static CBupPlugin* NewL(const TUid aImplementationUid, TAny* aInitParams);
+			~CBupPlugin();
+
+	TInt	ResetAndActivateL(CProfilerSampleStream& aStream);
+	TInt	StopSampling();
+    TBool   Enabled() { return iEnabled; }
+
+	TInt	CreateFirstSample();
+
+	// no sub samplers, from CSamplerPluginInterface
+	TInt 	SubId(TUid /*aId*/) const {return KErrNotFound;}
+    TInt    GetSamplerType();
+	
+	void    GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes);
+    TInt    SetAttributesL(TSamplerAttributes& aAttributes);
+    void    InitiateSamplerAttributesL();
+	
+    TInt    ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray);
+    
+    TInt    DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex);
+    void    SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex);
+    
+	TUid  Id(TInt aSubId) const;
+
+	void FillThisStreamBuffer(TBapBuf* nextFree,TRequestStatus& aStatus); 
+	
+private:
+			CBupPlugin();
+	void 	ConstructL();
+
+private:
+	TUint8					iVersion[20];
+	TPtr8					iVersionDescriptor;
+	
+	TInt 					iSamplerType;
+
+	CProfilerButtonListener* 	iButtonListener;
+    CArrayFixFlat<TSamplerAttributes>* iSamplerAttributes;
+public:
+	TUint32* 				iSampleTime;
+};
+
+
+/*
+*
+*  Base class for all windows
+*
+*/
+class CWsClient : public CActive
+	{
+	protected:
+		//construct
+		CWsClient();
+		CWsScreenDevice* iScreen;
+		RWsSession iWs;
+	public:
+		void ConstructL();
+		// destruct
+		~CWsClient();
+		// main window
+		virtual void ConstructMainWindowL();
+		// terminate cleanly
+		void Exit();
+		// active object protocol
+		void IssueRequest(); // request an event
+		void DoCancel(); // cancel the request
+		virtual TInt RunError(TInt aError) = 0;
+		virtual void RunL() = 0; // handle completed request
+		virtual void HandleKeyEventL (TKeyEvent& aKeyEvent) = 0;
+
+		RWindowGroup Group() {return iGroup;};
+
+    private:
+		RWindowGroup    iGroup;
+		CWindowGc*      iGc;
+		friend class    CWindow; // needs to get at session
+		RProperty       iProperty;
+
+	};
+
+
+
+class CWindow;
+
+class CProfilerButtonListener : public CWsClient 
+{
+public:
+	static 	CProfilerButtonListener* NewL(CBupPlugin* aSamplerm);
+			~CProfilerButtonListener();
+private:
+			CProfilerButtonListener(CBupPlugin* aSampler);
+
+	
+public:
+	void 	ConstructMainWindowL();
+	void 	HandleKeyEventL (TKeyEvent& aKeyEvent);
+	void 	RunL();
+	TInt    RunError(TInt aError);
+	TInt 	StartL();
+	TInt	Stop();
+	
+private:
+	TUint8							iSample[8];
+
+	CBupPlugin*						iSampler;
+	RProfilerTouchEventAnim*			iAnim;
+	RAnimDll*						iAnimDll;
+	CWindow* 						iMainWindow;	// main window
+
+	TInt	 						iSampleStartTime;
+};
+
+
+
+/*
+*
+*  CWindow declaration
+*
+*/
+class CWindow : public CBase
+	{
+	protected:
+		RWindow iWindow; 	// window server window
+		TRect iRect; 		// rectangle re owning window
+	public:
+		CWindow(CWsClient* aClient);
+		void ConstructL (const TRect& aRect, CWindow* aParent=0);
+		~CWindow();
+		// access
+		RWindow& Window(); // our own window
+		CWindowGc* SystemGc(); // system graphics context
+
+		CWsClient* Client() {return iClient;};
+	private:
+		CWsClient* iClient; // client including session and group
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/inc/TouchEventAnimDll.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* 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 _PROFILER_TOUCH_EVENT_ANIM_DLL_
+#define _PROFILER_TOUCH_EVENT_ANIM_DLL_
+
+/*
+*
+*	TouchEventAnimDll.h
+*
+*/
+
+// system includes
+#include <w32adll.h>
+#include <e32def.h>
+
+
+
+/*
+*
+* Class definition of CProfilerTouchEventAnim
+*
+*/
+class CProfilerTouchEventAnim : public CWindowAnim
+{
+public:
+	CProfilerTouchEventAnim();
+	virtual ~CProfilerTouchEventAnim();
+
+	// from CWindowAnim
+	void ConstructL(TAny*	aAny, TBool aHasFocus);
+	void Redraw();
+	void FocusChanged(TBool aState);
+	// from MEventHandler
+	TBool OfferRawEvent(const TRawEvent& aRawEvent);
+	// from CAnim
+	void Animate(TDateTime* aDateTime);
+	void Command(TInt aOpcode, TAny* aArgs);
+	TInt CommandReplyL(TInt aOpcode, TAny* aArgs);
+	
+private:
+	TBool HandlePointerDown(TPoint aPoint);
+	TBool HandlePointerUp(TPoint aPoint);
+	TBool HandleKeyDown(TInt aScanCode);
+	TBool HandleKeyUp(TInt aScanCode);
+private:
+	TInt iState;
+};
+
+
+/*
+*
+* Class definition of CProfilerTouchEventAnimDll
+*
+*/
+
+class CProfilerTouchEventAnimDll : public CAnimDll
+{
+public:
+	CProfilerTouchEventAnimDll();
+
+public:
+	 IMPORT_C CAnim* CreateInstanceL(TInt aType);
+	
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/inc/TouchEventClientDll.h	Mon Sep 06 15:00:47 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 _PROFILER_TOUCH_EVENT_CLIENT_DLL__
+#define _PROFILER_TOUCH_EVENT_CLIENT_DLL__
+
+#include <w32adll.h>
+
+class CProfilerTouchEventControl;
+
+class RProfilerTouchEventAnim : public RAnim
+{
+   public: 
+      RProfilerTouchEventAnim( RAnimDll& aAnimDll );
+      void ConstructL( const RWindow& aParent  );
+
+	  void Activate();
+	  void Deactivate();
+
+
+      enum KAnimCommands
+      {
+         KActivate       = 70002,
+         KDeactivate	 = 70003
+      };
+      /**
+       * Closes the animation object
+       */
+   	  void Close();
+
+   private:        
+	  CProfilerTouchEventControl* iTouchEventControl;   
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/sis/BupPlugin_S60-30.pkg	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,44 @@
+;
+; 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:
+;
+; ShapeImplementation_30_gcce.pkg
+;
+
+;Language - standard language definitions
+&EN
+
+; standard sis file header
+#{"Shape plugin"},(0xE01F614F),2,0,0
+
+
+;
+;Localised Vendor name
+;
+%{"Forum Nokia"}
+
+;
+;Unique Vendor name
+;
+:"Forum Nokia"
+
+;
+;Supports Series 60 v 3.0
+;
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+
+;Files to include. Check the source paths they match your SDK setup. 
+"\Symbian\9.1\S60_3rd_MR\Epoc32\release\gcce\urel\shapeimplementation.dll"     -   "!:\sys\bin\shapeimplementation.dll"
+"\Symbian\9.1\S60_3rd_MR\epoc32\data\Z\Resource\plugins\shapeimplementation.rsc"   -   "!:\Resource\Plugins\shapeimplementation.RSC"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/src/BupPlugin.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,582 @@
+/*
+* 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 "BupPlugin.h"	
+//#include <piprofiler/EngineUIDs.h>
+
+#include <w32std.h> 	// for listening key events
+
+	
+// LITERALS
+// CONSTANTS
+const TUid KSamplerBupPluginUid = { 0x2001E5B6 };
+
+/*
+ *	
+ *	class CBupPlugin implementation
+ * 
+ */
+
+CBupPlugin* CBupPlugin::NewL(const TUid /*aImplementationUid*/, TAny* /*aInitParams*/)
+	{
+	LOGTEXT(_L("CBupPlugin::NewL() - entry"));
+    CBupPlugin* self = new (ELeave) CBupPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+	LOGTEXT(_L("CBupPlugin::NewL() - exit"));
+    return self;
+	}
+
+CBupPlugin::CBupPlugin() :
+	iVersionDescriptor(&(this->iVersion[1]),0,19), 	
+	iSamplerType(PROFILER_USER_MODE_SAMPLER)
+	{
+	iSamplerId = PROFILER_BUP_SAMPLER_ID;
+    iEnabled = EFalse;
+	LOGTEXT(_L("CBupPlugin::CBupPlugin() - konstruktori"));
+	}
+
+void CBupPlugin::ConstructL() 
+	{
+	LOGTEXT(_L("CBupPlugin::ConstructL() - entry"));
+	
+	// initiate sampler attributes array
+	iSamplerAttributes = new(ELeave) CArrayFixFlat<TSamplerAttributes>(1); // only one sampler
+	
+	// insert default attributes to array
+	InitiateSamplerAttributesL();
+	
+	LOGTEXT(_L("CBupPlugin::ConstructL() - exit"));
+	}
+
+
+CBupPlugin::~CBupPlugin()
+	{
+	LOGTEXT(_L("CBupPlugin::~CBupPlugin() - entry"));
+	if(iButtonListener)
+	    {
+	    // check if button listener still running
+	    if(Enabled())
+	        {
+	        // stop profiling
+	        iButtonListener->Stop();
+	        }
+        delete iButtonListener;
+	    }
+	
+	if(iSamplerAttributes)
+	    {
+	    iSamplerAttributes->Reset();
+	    }
+    delete iSamplerAttributes;
+	
+	LOGTEXT(_L("CBupPlugin::~CBupPlugin() - exit"));
+	}
+
+TUid CBupPlugin::Id(TInt /*aUid*/) const
+	{
+    LOGSTRING2("CBupPlugin::Id():0x%X", KSamplerBupPluginUid.iUid );
+    return KSamplerBupPluginUid;
+	}
+
+void CBupPlugin::InitiateSamplerAttributesL()
+    {
+    // create sampler attribute container
+    TSamplerAttributes attr(KSamplerBupPluginUid.iUid,
+            KBUPShortName(),
+            KBUPLongName(),
+            KBUPDescription(),
+            -1,
+            ETrue,
+            EFalse,
+            0); // default item count
+    this->iSamplerAttributes->AppendL(attr);
+    }
+
+// returns setting array
+void CBupPlugin::GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes)
+    {
+    // append my own attributes to complete array, requested by profiler engine
+    aAttributes->AppendL(iSamplerAttributes->At(0));
+    }
+
+TInt CBupPlugin::SetAttributesL(TSamplerAttributes& aAttributes)
+    {
+    TSamplerAttributes attr;
+
+    attr = iSamplerAttributes->At(0);
+    // if UIDs match replace the old 
+    if(attr.iUid == aAttributes.iUid)
+        {
+        // replace the old attribute container
+        iSamplerAttributes->Delete(0);
+        iSamplerAttributes->InsertL(0, aAttributes);
+        return KErrNone;
+        }
+    return KErrNotFound;
+    }
+
+/* 
+ * Method for parsing and transforming text array settings into TSamplerAttributes (per each sub sampler),
+ * called by CSamplerController class
+ * 
+ * @param array of raw text setting lines, e.g. [gpp]\nenabled=true\nsampling_period_ms=1\n
+ */
+TInt CBupPlugin::ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aAllSettingsArray)
+    {
+    // local literals
+    _LIT8(KBUPShort, "bup");
+
+    TInt err(KErrNone);
+    TBuf8<16> samplerSearchName;
+    samplerSearchName.Copy(KBUPShort);
+    
+    // get sampler specific settings  
+    err = DoSetSamplerSettings(aAllSettingsArray, samplerSearchName, 0);
+    
+    // returns KErrNone if settings found, otherwise KErrNotFound
+    return err;
+    }
+
+TInt CBupPlugin::DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex)
+    {
+    // 
+    TBuf8<16> samplerSearch;
+    samplerSearch.Copy(KBracketOpen);
+    samplerSearch.Append(aSamplerName);
+    samplerSearch.Append(KBracketClose);
+    
+    // read a line
+    for (TInt i(0); i<aAllSettings->MdcaCount(); i++)
+        {
+        // check if this line has a setting block start, i.e. contains [xxx] in it
+        if (aAllSettings->MdcaPoint(i).CompareF(samplerSearch) == 0)
+            {
+            // right settings block found, now loop until the next block is found
+            for(TInt j(i+1);j<aAllSettings->MdcaCount();j++)
+                {
+                // check if the next settings block was found
+                if(aAllSettings->MdcaPoint(j).Left(1).CompareF(KBracketOpen) != 0)
+                    {
+                    // save found setting value directly to its owners attributes
+                    SaveSettingToAttributes(aAllSettings->MdcaPoint(j), aIndex);
+                    }
+                else
+                    {
+                    // next block found, return KErrNone
+                    return KErrNone;
+                    }
+                }
+            }
+        }
+    
+    return KErrNotFound;
+    }
+
+/**
+ * Method for setting a specific descriptor (from settings file) to attribute structure
+ * 
+ * @param aSetting  
+ * @param aName  
+ */
+void CBupPlugin::SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex)
+    {
+    // find the equal mark from the setting line
+    TInt sepPos = aSetting.Find(KSettingItemSeparator);
+    // check that '=' is found
+    if (sepPos > 0)
+        {
+        // check that the element matches
+        if (aSetting.Left(sepPos).CompareF(KEnabled) == 0)
+            {
+            TBool en;
+            CSamplerPluginInterface::Str2Bool(aSetting.Right(aSetting.Length()-sepPos-1), en);
+            if(iSamplerAttributes->At(aIndex).iEnabled != en)
+                {
+                iSamplerAttributes->At(aIndex).iEnabled = en;
+                }
+            }
+        }
+    }
+
+TInt CBupPlugin::GetSamplerType()
+	{
+	return iSamplerType;
+	}
+
+TInt CBupPlugin::ResetAndActivateL(CProfilerSampleStream& aStream) 
+	{
+	LOGTEXT(_L("CBupPlugin::ResetAndActivate() - entry"));
+	TInt ret(KErrNone);
+	
+	// check if sampler enabled
+	if(iSamplerAttributes->At(0).iEnabled)
+	    {
+        // create first the listener instance
+        iButtonListener = CProfilerButtonListener::NewL(this);
+        
+        LOGTEXT(_L("CBupPlugin::ResetAndActivate() - listener created"));
+        
+        iStream = &aStream;
+        TInt length = this->CreateFirstSample();
+        iVersion[0] = (TUint8)length;
+        LOGSTRING2("CBupPlugin::ResetAndActivate() - AddSample, length %d",length);
+        ret = AddSample(iVersion, length+1, 0);
+        if(ret != KErrNone)
+            return ret;
+        
+        // activate button listener
+        ret = iButtonListener->StartL();
+
+        iEnabled = ETrue;
+        
+        LOGTEXT(_L("CBupPlugin::ResetAndActivate() - exit"));
+	    }
+	return ret;
+
+	}
+	
+TInt CBupPlugin::CreateFirstSample()
+	{
+	LOGTEXT(_L("CBupPlugin::CreateFirstSample - entry"));
+	this->iVersionDescriptor.Zero();
+	this->iVersionDescriptor.Append(_L8("Bappea_BUP_V"));
+	this->iVersionDescriptor.Append(PROFILER_BUP_SAMPLER_VERSION);
+	LOGTEXT(_L("CBupPlugin::CreateFirstSample - exit"));
+	return (TInt)(this->iVersionDescriptor.Length());
+	}
+
+TInt CBupPlugin::StopSampling() 
+	{
+	if(iButtonListener)
+		{
+		iButtonListener->Stop();
+		delete iButtonListener;	// delete listener after every trace
+		iButtonListener = NULL;
+		}
+	
+    // set disabled
+    iEnabled = EFalse;
+
+	return KErrNone;
+	}
+
+void CBupPlugin::FillThisStreamBuffer(TBapBuf* /*aBapBuf*/, TRequestStatus& /*aStatus*/)
+	{
+	}
+
+/*
+ * 
+ * Implementation of class CProfilerButtonListener
+ * 
+ */
+CProfilerButtonListener::CProfilerButtonListener(CBupPlugin* aSampler) 
+	{
+	LOGTEXT(_L("CProfilerButtonListener::CProfilerButtonListener() - konstuktori"));
+	this->iSampler = aSampler;
+	iSampleStartTime = 0;
+	LOGTEXT(_L("CProfilerButtonListener::CProfilerButtonListener() - konstuktori exit"));
+	}
+
+CProfilerButtonListener* CProfilerButtonListener::NewL(CBupPlugin* aSampler)
+	{
+	LOGTEXT(_L("CProfilerButtonListener::NewL() - entry"));
+	CProfilerButtonListener* self = new (ELeave) CProfilerButtonListener(aSampler);
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop();
+	LOGTEXT(_L("CProfilerButtonListener::NewL() - exit"));
+	return self;
+	}
+
+CProfilerButtonListener::~CProfilerButtonListener() 
+	{
+	LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener() - entry af"));
+
+	if(iMainWindow)
+		{
+		LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener(): flushing iWs"));
+		iWs.Flush();
+		LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener(): finishing"));
+		}
+	delete iMainWindow;
+	LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener() - exit"));
+	}
+	
+void CProfilerButtonListener::ConstructMainWindowL()
+	{
+    LOGTEXT(_L("CProfilerButtonListener::ConstructMainWindowL() - Entry"));
+
+    CWindow* window = new (ELeave) CWindow(this);
+    CleanupStack::PushL( window );
+	window->ConstructL(TRect(TPoint(0,0), TSize(0,0)));
+    delete iMainWindow;
+    iMainWindow = window;
+    CleanupStack::Pop( window );
+	
+    LOGTEXT(_L("CProfilerButtonListener::ConstructMainWindowL() - Exit"));
+	}
+
+void CProfilerButtonListener::HandleKeyEventL (TKeyEvent& /*aKeyEvent*/)
+    {
+    LOGTEXT(_L("CProfilerButtonListener::HandleKeyEventL() - Start"));
+    LOGTEXT(_L("CProfilerButtonListener::HandleKeyEventL() - End"));
+	}
+
+
+TInt CProfilerButtonListener::RunError(TInt aError)
+    {
+    // get rid of everything we allocated
+    // deactivate the anim dll before killing window, otherwise anim dll dies too early
+    iAnim->Deactivate();
+    iAnim->Close();
+
+    iAnimDll->Close();
+    
+    return aError;
+    }
+
+void CProfilerButtonListener::RunL() 
+	{	
+    // resubscribe before processing new value to prevent missing updates
+	IssueRequest();
+	
+	TInt c = 0;
+	if(RProperty::Get(KProfilerKeyEventPropertyCat, EProfilerKeyEventPropertySample, c) == KErrNone)
+		{
+		// do something with event
+		LOGSTRING2("CProfilerButtonListener::RunL() - event [%d] received",c);
+	
+		iSample[0] = c;
+		iSample[1] = c >> 8;
+		iSample[2] = c >> 16;
+		iSample[3] = c >> 24;
+		
+		// Space for GPP sample time		
+		TUint32 sampleTime = User::NTickCount() - iSampleStartTime; 
+		LOGSTRING2("CProfilerButtonListener::RunL() - sample time is %d",sampleTime);
+		
+		iSample[4] = sampleTime;
+		iSample[5] = sampleTime >> 8;
+		iSample[6] = sampleTime >> 16;
+		iSample[7] = sampleTime >> 24;
+		
+		iSampler->AddSample(iSample, 8, 0xb0);
+		}
+	}
+	
+TInt CProfilerButtonListener::StartL()
+	{
+	LOGTEXT(_L("CProfilerButtonListener::StartL() - Activate touch server dll"));
+	TInt err(KErrNone);
+	
+	// get the property value
+	TInt r = RProperty::Get(KGppPropertyCat, EGppPropertySyncSampleNumber, iSampleStartTime);
+	if(r != KErrNone)
+		{
+		LOGSTRING2("CProfilerButtonListener::StartL() - getting iSyncOffset failed, error %d", r);
+		}
+	
+	iAnimDll = new (ELeave) RAnimDll(iWs);
+	LOGTEXT(_L("CProfilerButtonListener::StartL() - #1"));
+	
+	TParse* fp = new (ELeave) TParse();
+	CleanupStack::PushL(fp);
+	fp->Set( KDllName, &KDC_SHARED_LIB_DIR , NULL );    
+	LOGSTRING2("CProfilerButtonListener::StartL() - touch event server: %S" , &(fp->FullName()));
+
+	err = iAnimDll->Load(fp->FullName());
+	// check if anim dll load failed
+	if(err != KErrNone)
+	    {
+        CleanupStack::PopAndDestroy(fp);
+	    // stop plugin if failed
+	    iAnimDll->Close();
+	    return KErrGeneral;
+	    }
+    CleanupStack::PopAndDestroy(fp);
+ 	LOGTEXT(_L("CProfilerButtonListener::StartL() - #2"));
+
+	iAnim = new (ELeave) RProfilerTouchEventAnim(*iAnimDll);
+ 	LOGTEXT(_L("CProfilerButtonListener::StartL() - #3"));
+	iAnim->ConstructL(iMainWindow->Window());
+	
+	// activate the animation dll for collecting touch and key events
+	iAnim->Activate();
+
+	// wait for a new sample
+	IssueRequest();
+	
+	// hide this window group from the app switcher
+	iMainWindow->Client()->Group().SetOrdinalPosition(-1);
+	iMainWindow->Client()->Group().EnableReceiptOfFocus(EFalse);
+	return KErrNone;
+	}
+
+TInt CProfilerButtonListener::Stop() 
+	{
+	LOGTEXT(_L("CProfilerButtonListener::Stop() - enter"));
+	// deactivate the anim dll before killing window, otherwise anim dll dies too early
+	iAnim->Deactivate();
+	iAnim->Close();
+
+	iAnimDll->Close();
+
+	Cancel();
+	LOGTEXT(_L("CProfilerButtonListener::Stop() - exit"));
+	return KErrNone;
+	}
+
+
+///////////////////////////////////////////////////////////////////////////////
+////////////////////////// CWindow implementation /////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+CWindow::CWindow(CWsClient* aClient)
+: iClient(aClient)
+	{
+    LOGTEXT(_L("CWindow::CWindow()"));
+	}
+
+void CWindow::ConstructL (const TRect& aRect, CWindow* aParent)
+	{
+	LOGTEXT(_L("CWindow::ConstructL(): Start"));
+
+	// If a parent window was specified, use it; if not, use the window group
+	// (aParent defaults to 0).
+	RWindowTreeNode* parent= aParent ? (RWindowTreeNode*) &(aParent->Window()) : &(iClient->iGroup);
+	iWindow=RWindow(iClient->iWs); // use app's session to window server
+	User::LeaveIfError(iWindow.Construct(*parent,(TUint32)this));
+	LOGSTRING2("CWindow::ConstructL(): Start - window handle is: 0x%08x", this);
+	iRect = aRect;
+	iWindow.SetExtent(iRect.iTl, iRect.Size()); // set extent relative to group coords
+	iWindow.Activate(); // window is now active
+	LOGTEXT(_L("CWindow::ConstructL(): End"));
+	}
+
+
+CWindow::~CWindow()
+	{
+    LOGTEXT(_L("CWindow::~CWindow(): Start"));
+	iWindow.Close(); // close our window
+    LOGTEXT(_L("CWindow::~CWindow(): End"));
+	}
+
+RWindow& CWindow::Window()
+	{
+    LOGTEXT(_L("CWindow::Window()"));
+	return iWindow;
+	}
+
+CWindowGc* CWindow::SystemGc()
+	{
+    LOGTEXT(_L("CWindow::SystemGc()"));
+	return iClient->iGc;
+	}
+
+/////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////// CWsClient implementation ////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////
+CWsClient::CWsClient()
+: CActive(CActive::EPriorityStandard)
+	{
+    LOGTEXT(_L("CWsClient::CWsClient()"));
+	}
+
+void CWsClient::ConstructL()
+	{
+    LOGTEXT(_L("CWsClient::ConstructL() - Start"));
+    TInt r = RProperty::Define(EProfilerKeyEventPropertySample, RProperty::EInt, KAllowAllPolicy, KCapabilityNone);
+    if (r!=KErrAlreadyExists)
+        {
+        User::LeaveIfError(r);
+        }
+    
+	CActiveScheduler::Add(this);
+
+	// attach to 
+	User::LeaveIfError(iProperty.Attach(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample));
+    
+	// get a session going
+	User::LeaveIfError(iWs.Connect());
+
+	// construct screen device and graphics context
+	iScreen=new (ELeave) CWsScreenDevice(iWs); // make device for this session
+	User::LeaveIfError(iScreen->Construct( 0 )); // and complete its construction
+	User::LeaveIfError(iScreen->CreateContext(iGc)); // create graphics context
+
+	// construct our one and only window group
+	iGroup=RWindowGroup(iWs);
+	User::LeaveIfError(iGroup.Construct((TInt)this, EFalse)); // meaningless handle; enable focus
+	
+	// construct main window
+	ConstructMainWindowL();
+
+	LOGTEXT(_L("CWsClient::CWsClient() - End"));
+	}
+
+CWsClient::~CWsClient()
+	{
+    LOGTEXT(_L("CWsClient::~CWsClient() - Start"));
+    
+	// get rid of everything we allocated
+	delete iGc;
+	delete iScreen;
+	
+	iGroup.Close();
+	// finish with window server
+	iWs.Close();
+	
+    LOGTEXT(_L("CWsClient::~CWsClient() - Exit"));
+	}
+
+void CWsClient::Exit()
+	{
+    LOGTEXT(_L("CWsClient::Exit() - Start"));
+
+	// destroy window group
+	iGroup.Close();
+	// finish with window server
+    iProperty.Close();
+	iWs.Close();
+    LOGTEXT(_L("CWsClient::Exit() - Exit"));
+	}
+
+void CWsClient::IssueRequest()
+	{
+    LOGTEXT(_L("CWsClient::IssueRequest() - Start"));
+    iProperty.Subscribe( iStatus );
+    SetActive(); // so we're now active
+    LOGTEXT(_L("CWsClient::IssueRequest() - Exit"));
+	}
+
+void CWsClient::DoCancel()
+	{
+    LOGTEXT(_L("CWsClient::DoCancel() - Start"));
+	// clean up the sample property
+    iProperty.Cancel();
+    iProperty.Close();
+    LOGTEXT(_L("CWsClient::DoCancel() - Exit"));
+	}
+
+void CWsClient::ConstructMainWindowL()
+	{
+    LOGTEXT(_L("CWsClient::ConstructMainWindowL()"));
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/src/BupPluginImplementationTable.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "BupPlugin.h"
+
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+{
+         IMPLEMENTATION_PROXY_ENTRY(0x2001E5B6,  CBupPlugin::NewL)
+};
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/src/TouchEventAnimDll.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* 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 <e32base.h>
+#include <e32cons.h>
+#include <w32std.h>
+#include <in_sock.h>
+#include <txtfrmat.h>
+#include <e32property.h>
+#include <piprofiler/ProfilerTraces.h>
+
+// user includes
+#include "TouchEventAnimDll.h"
+
+// control commands
+static const TInt KActivate   = 70002;
+static const TInt KDeactivate = 70003;
+
+// touch events
+static const TInt KTouchEventDown = 69999;
+static const TInt KTouchEventUp = 70000;
+
+static const TInt KUpEventOffset = 70000;
+
+_LIT( KTouchEventServer, "PIProfilerTouchEvent server" );
+enum TAnimationPanics
+    {
+    EProfilerTouchEventServerPanic = 100
+    };
+
+const TUid KProfilerKeyEventPropertyCat={0x2001E5AD};
+enum TProfilerKeyEventPropertyKeys
+	{
+	EProfilerKeyEventPropertySample = 7
+	};
+
+/*
+*
+* Implementation of CProfilerTouchEventAnim
+*
+*/
+CProfilerTouchEventAnim::CProfilerTouchEventAnim() : iState(EFalse)
+    {
+	LOGTEXT(_L("CProfilerTouchEventAnim::CProfilerTouchEventAnim - entry"));
+    }
+
+CProfilerTouchEventAnim::~CProfilerTouchEventAnim()
+    {
+	LOGTEXT(_L("CProfilerTouchEventAnim::~CProfilerTouchEventAnim - entry"));
+	//iFunctions->GetRawEvents( EFalse );	// disable capture
+	LOGTEXT(_L("CProfilerTouchEventAnim::~CProfilerTouchEventAnim - exit"));
+    }
+
+void CProfilerTouchEventAnim::ConstructL(TAny* /*aArgs*/, TBool /*aHasFocus*/)
+    {
+	LOGTEXT(_L("CProfilerTouchEventAnim::ConstructL - entry"));
+    iFunctions->GetRawEvents( ETrue );
+	LOGTEXT(_L("CProfilerTouchEventAnim::ConstructL - exit"));
+    }
+
+void CProfilerTouchEventAnim::Command(TInt /*aOpcode*/, TAny* /*aArgs*/)
+    {
+
+    }
+
+TInt CProfilerTouchEventAnim::CommandReplyL(TInt aOpcode, TAny* /*aArgs*/)
+    {
+	LOGSTRING2("CProfilerTouchEventAnim::CommandReplyL - entry, aOpcode: %d", aOpcode);
+	switch(aOpcode)
+	    {
+		case KActivate:	// activate
+			iState = ETrue;
+			LOGTEXT(_L("CProfilerTouchEventAnim::CommandReplyL - activate"));
+			break;
+		case KDeactivate: // deactivate
+			iState = EFalse;
+			iFunctions->GetRawEvents( EFalse );	// disable capture
+			LOGTEXT(_L("CProfilerTouchEventAnim::CommandReplyL - deactivate"));
+			break;
+		default:
+			User::Panic( KTouchEventServer, EProfilerTouchEventServerPanic );
+			LOGSTRING2("CProfilerTouchEventAnim::CommandReplyL - panic, code %d", EProfilerTouchEventServerPanic);
+			return EProfilerTouchEventServerPanic;
+
+        }
+	return KErrNone;
+    }
+
+
+TBool CProfilerTouchEventAnim::OfferRawEvent(const TRawEvent& aRawEvent)
+    {
+	LOGTEXT(_L("CProfilerTouchEventAnim::OfferRawEvent - entry"));
+	if(iState == EFalse)
+		return EFalse; // if not activated yet just pass through
+	
+
+	switch(aRawEvent.Type())
+	    {
+        // handle the pointer events here
+        case TRawEvent::EButton1Down:
+            {
+            LOGTEXT(_L("CProfilerTouchEventAnim::OfferRawEvent - pointer down"));
+            return HandlePointerDown(aRawEvent.Pos());
+            }
+        case TRawEvent::EButton1Up:
+            {
+            LOGTEXT(_L("CProfilerTouchEventAnim::OfferRawEvent - pointer up"));
+            return HandlePointerUp(aRawEvent.Pos());
+            }
+                
+            // handle the key events here, replacing the BUP trace functionality
+        case TRawEvent::EKeyDown:
+            {
+            TInt scan = aRawEvent.ScanCode() & 0xFFFF;
+                    return HandleKeyDown(scan);
+            }
+        case TRawEvent::EKeyUp:
+            {
+            TInt scan = (aRawEvent.ScanCode() & 0xFFFF)+KUpEventOffset;	// 
+                    return HandleKeyUp(scan);
+            }
+            default:
+                return EFalse;	// no action
+        }
+    }
+
+TBool CProfilerTouchEventAnim::HandlePointerDown( TPoint /*aPoint*/ )
+    {
+	RProperty::Set(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample, KTouchEventDown);
+	return EFalse;
+    }
+
+TBool CProfilerTouchEventAnim::HandlePointerUp( TPoint /*aPoint*/ )
+    {
+	RProperty::Set(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample, KTouchEventUp);
+	return EFalse;
+    }
+
+TBool CProfilerTouchEventAnim::HandleKeyDown( TInt aScanCode )
+    {
+	LOGSTRING2("CProfilerTouchEventAnim::HandleKeyDown - scancode = %d", aScanCode);
+	RProperty::Set(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample, aScanCode);
+	return EFalse;
+    }
+
+TBool CProfilerTouchEventAnim::HandleKeyUp( TInt aScanCode )
+    {
+	LOGSTRING2("CProfilerTouchEventAnim::HandleKeyUp - scancode = %d", aScanCode);
+	RProperty::Set(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample, aScanCode);
+	return EFalse;
+    }
+
+
+void CProfilerTouchEventAnim::Animate(TDateTime* /*aDateTime*/)
+    {
+    }
+
+void CProfilerTouchEventAnim::Redraw()
+    {
+    }
+
+void CProfilerTouchEventAnim::FocusChanged(TBool /*aState*/)
+    {
+    }
+
+
+/*
+*
+* Implementation of CProfilerTouchEventAnimDll
+*
+*/
+CProfilerTouchEventAnimDll::CProfilerTouchEventAnimDll() : CAnimDll()
+    {
+    }
+
+CAnim* CProfilerTouchEventAnimDll::CreateInstanceL(TInt /*aType*/)
+    {
+	LOGTEXT(_L("CProfilerTouchEventAnimDll::CreateInstanceL - entry"));
+	return (new (ELeave) CProfilerTouchEventAnim());
+    }
+
+
+// DLL entry
+EXPORT_C CAnimDll* CreateCAnimDllL()
+    {
+	return (new (ELeave) CProfilerTouchEventAnimDll);
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/BUPplugin/src/TouchEventClientDll.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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 "TouchEventClientDll.h"
+#include <piprofiler/ProfilerTraces.h>
+
+/*
+ *	
+ *	class RProfilerTouchEventAnim implementation
+ * 
+ */
+void RProfilerTouchEventAnim::ConstructL( const RWindow& aParent)
+{
+	LOGTEXT(_L("RProfilerTouchEventAnim::ConstructL - entry"));
+	LOGTEXT(_L("RProfilerTouchEventAnim::ConstructL - calling RAnim::Construct..."));
+	RAnim::Construct(aParent, 0, TPtrC8());
+}
+
+
+RProfilerTouchEventAnim::RProfilerTouchEventAnim( RAnimDll &aAnimDll ) :
+    RAnim( aAnimDll )
+{
+}
+
+void RProfilerTouchEventAnim::Activate()
+{
+	LOGTEXT(_L("RProfilerTouchEventAnim::Activate - entry"));
+	TInt err = RAnim::CommandReply(KActivate);
+	LOGSTRING2("RProfilerTouchEventAnim::Activate - error: %d", err);
+}
+
+void RProfilerTouchEventAnim::Deactivate()
+{
+	LOGTEXT(_L("RProfilerTouchEventAnim::Deactivate - entry"));
+	TInt err = RAnim::CommandReply(KDeactivate);
+	LOGSTRING2("RProfilerTouchEventAnim::Deactivate - error: %d", err);
+}
+
+void RProfilerTouchEventAnim::Close()
+	{
+	RAnim::Close();
+	}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/data/2001E5BA.rss	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 <ecom/registryinfo.rh>
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL. See mmp files
+    //__SERIES60_3X__ can't be used in resource files
+    dll_uid = 0x2001E5BA;
+
+    // Declare array of interface info. This dll contains implementations for 
+    // only one interface (CSamplerInterfaceDefinition).
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x2001E5BD;
+
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2001E5BA;
+
+                    version_no = 1;
+                    display_name = "Debug output writer implementation";
+                    default_data = "dow";
+                    opaque_data = "1";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/group/DebOutWriterPlugin.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 <platform_paths.hrh>
+
+
+TARGET		    PIProfilerDebugWriter.dll
+TARGETTYPE	    PLUGIN
+UID             0x10009D8D 0x2001E5BA
+#ifdef WINSCW
+VENDORID      0
+#else
+VENDORID      VID_DEFAULT
+#endif
+CAPABILITY 	    ALL -TCB // AllFiles ReadDeviceData ReadUserData UserEnvironment WriteDeviceData WriteUserData
+SMPSAFE
+
+OS_LAYER_SYSTEMINCLUDE
+USERINCLUDE 	../inc ../traces 
+#ifdef OST_TRACE_COMPILER_IN_USE
+USERINCLUDE 	../traces
+#endif
+SOURCEPATH		../src
+
+START RESOURCE  ../data/2001E5BA.rss
+TARGET piprofilerdebugwriter.rsc
+END
+
+SOURCE			DebOutWriterPlugin.cpp
+SOURCE 			DebOutWriterPluginImplementationTable.cpp
+
+LIBRARY		    euser.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         CommonEngine.lib
+LIBRARY			flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* 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:  
+*
+*/
+
+
+PRJ_MMPFILES
+DebOutWriterPlugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/inc/DebOutWriterPlugin.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,137 @@
+/*
+* 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:  
+*
+*/
+
+
+// This file defines the API for DebOutWriterPlugin.dll
+
+#ifndef __DEBOUTWRITERPLUGIN_H__
+#define __DEBOUTWRITERPLUGIN_H__
+
+//  Include Files
+#include <w32std.h>
+#include <piprofiler/WriterPluginInterface.h>
+#include <piprofiler/ProfilerGenericClassesUsr.h>
+#include <e32base.h>	// CBase
+#include <e32std.h>	 // TBuf
+#include <e32property.h>
+
+#ifdef OST_TRACE_COMPILER_IN_USE
+// trace core ldd activation/deactivation interface
+#include <TcDriverIf.h>
+
+// trace core ldd global definitions
+_LIT( KTcLdd, "tcldd.ldd" );
+GLDEF_D RTcDriver tcldd;
+
+#endif
+
+_LIT(KDebOutShortName, "dow");
+
+// forward declarations
+class CDebOutWriterHandler;
+
+//  Class Definitions
+
+class CDebOutWriterPlugin : public CWriterPluginInterface
+	{
+public:
+	// new function
+	static CDebOutWriterPlugin* NewL(const TUid aImplementationUid, TAny* /*aInitParams*/);
+	~CDebOutWriterPlugin();
+
+	void	DoCancel();
+	static void 	PrintDescriptorAsBase64(TDesC8& aDes, TRequestStatus* aStatus, TUint32 sampleTime, TBool aEmptying);
+
+public: // new functions
+
+	TInt 	Start();
+
+	void 	Stop();
+    
+	void 	GetValue( const TWriterPluginValueKeys aKey, TDes& aValue );
+	
+	void 	SetValue( const TWriterPluginValueKeys aKey, TDes& aValue ); 
+    
+	TUid 	Id() const;
+		 
+	void 	GetWriterVersion(TDes* aDes);
+	
+	TUint32 GetWriterType();
+	
+	void    SetStream(CProfilerSampleStream& aStream) { iStream = &aStream; }
+	
+	void   HandleError(TInt aError);
+	   
+	void   WriteData();
+private: // new functions
+	CDebOutWriterPlugin(const TUid aImplementationUid);
+	void 	ConstructL();
+	
+	void 	GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
+	void 	SetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
+	TBool	GetEnabled();
+public:
+    CProfilerSampleStream*          iStream;
+private: // data
+	TBapBuf*						iBufferBeingWritten;
+	
+	TInt 							iWriterType;
+	TInt							iWriterId;
+	CDebOutWriterHandler*			iWriterHandler;
+	RProperty                       iErrorStatus;
+
+	};
+
+/*
+ * 
+ * Definition of class CDebOutWriterHandler
+ * 
+ */
+class CDebOutWriterHandler : public CActive
+	{
+public:
+ 
+
+	static CDebOutWriterHandler* NewL(CDebOutWriterPlugin* aWriter);
+	~CDebOutWriterHandler();
+    void DoCancel();
+	void StartL();
+
+	void Stop();
+    
+    void Reset();
+private:
+	CDebOutWriterHandler(CDebOutWriterPlugin* aWriter); 
+	
+	void ConstructL();
+    void RunL();
+    
+	void WriteBufferToOutput(TBapBuf* aBuf);
+	void PrintBufferToOutput(TBapBuf* aBuffer, TRequestStatus& aStatus);
+	void HandleFullBuffers();
+private:
+	CDebOutWriterPlugin* 			iWriter;
+    RFile                           iFile;
+    RFs                             iFs;
+    TBuf<256>                       iFileName;
+//  CPeriodic*                      iTimer;
+    TBapBuf*                        iBufferBeingWritten;
+    TBool                           iStopping;
+	};
+
+#endif  // __DEBOUTWRITERPLUGIN_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/sis/DebOutWriterPlugin_EKA2.pkg	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,36 @@
+;
+; 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:
+;
+; Installation file for DebOutWriterPlugin dll
+;
+; This is an auto-generated PKG file by Carbide.
+; This file uses variables specific to Carbide builds that will not work
+; on command-line builds. If you want to use this generated PKG file from the
+; command-line tools you will need to modify the variables with the appropriate
+; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
+
+;
+; UID is the dll's UID
+;
+#{"DebOutWriterPlugin DLL"},(0x00DA58C7),1,0,0
+
+
+;Localised Vendor name
+%{"Vendor-EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\DebOutWriterPlugin.dll"		  -"!:\sys\bin\DebOutWriterPlugin.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/src/DebOutWriterPlugin.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,542 @@
+/*
+* 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 Files  
+
+#include "DebOutWriterPlugin.h"	
+#include <e32base.h>
+//#include <piprofiler/EngineUIDs.h>
+#include <piprofiler/ProfilerTraces.h>
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include <OpenSystemTrace.h>
+#include "DebOutWriterPluginTraces.h"
+#endif
+
+// engine properties
+const TUid KEngineStatusPropertyCat={0x2001E5AD};
+enum TEnginePropertyKeys
+    {
+    EProfilerEngineStatus = 8,
+    EProfilerErrorStatus
+    };
+
+// CONSTANTS
+// own UID
+const TUid KDebOutWriterPluginUid = { 0x2001E5BA };
+
+//  Member Functions
+/*
+ *
+ *	Class CDebOutWriterPlugin implementation
+ *
+ */
+
+CDebOutWriterPlugin* CDebOutWriterPlugin::NewL(const TUid /*aImplementationUid*/, TAny* /*aInitParams*/)
+{
+	LOGTEXT(_L("CDebOutWriterPlugin::NewL() - entry"));
+	CDebOutWriterPlugin* self = new (ELeave) CDebOutWriterPlugin(KDebOutWriterPluginUid);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+	LOGTEXT(_L("CDebOutWriterPlugin::NewL() - exit"));
+    return self;
+}
+
+CDebOutWriterPlugin::CDebOutWriterPlugin(const TUid aImplementationUid) :
+	iWriterType(aImplementationUid.iUid)
+    {
+    LOGTEXT(_L("CDebOutWriterPlugin::CDebOutWriterPlugin - entry"));
+    isEnabled = EFalse;
+    iWriterId = Id().iUid;
+    LOGTEXT(_L("CDebOutWriterPlugin::CDebOutWriterPlugin - exit"));
+    }
+
+CDebOutWriterPlugin::~CDebOutWriterPlugin()
+    {
+    LOGTEXT(_L("CDebOutWriterPlugin::~CDebOutWriterPlugin - entry"));
+
+    iErrorStatus.Close();
+    
+    if(iWriterHandler)
+        {
+        iWriterHandler->Cancel();
+        delete iWriterHandler;
+        }
+    LOGTEXT(_L("CDebOutWriterPlugin::~CDebOutWriterPlugin - exit"));
+    }    
+    
+void CDebOutWriterPlugin::ConstructL()
+	{
+	// second phase constructor, anything that may leave must be constructed here
+
+	LOGTEXT(_L("CDebOutWriterPlugin::ConstructL() - entry"));
+	iWriterHandler = CDebOutWriterHandler::NewL(this);
+    User::LeaveIfError(iErrorStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus));
+    
+	LOGTEXT(_L("CDebOutWriterPlugin::ConstructL() - exit"));
+	}
+
+TInt CDebOutWriterPlugin::Start()
+	{
+	LOGTEXT(_L("CDebOutWriterPlugin::Start() - entry"));
+	
+#ifdef OST_TRACE_COMPILER_IN_USE
+    TInt err(KErrNone);
+	// activate traces on TraceCore
+    RTcDriverParameters tcdp_ThreadIdentification;
+    tcdp_ThreadIdentification.iComponentId = KOstTraceComponentID;
+    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64START;
+    err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
+
+    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64LINE;
+    err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
+
+    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64FIN;
+    err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
+
+    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64END;
+    err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
+
+    RDebug::Print(_L("Debug output activated"));
+    if(err != KErrNone)
+        RDebug::Print(_L("TraceCore LDD API responded: %d"), err);
+#endif
+
+	LOGTEXT(_L("CDebOutWriterPlugin::Start() - exit"));
+	return KErrNone;
+	}
+
+void CDebOutWriterPlugin::Stop()
+	{
+	LOGTEXT(_L("CDebOutWriterPlugin::Stop() - entry"));
+	iWriterHandler->Stop();
+#ifdef OST_TRACE_COMPILER_IN_USE
+	TInt err(KErrNone);
+    // activate traces on TraceCore
+    RTcDriverParameters tcdp_ThreadIdentification;
+    tcdp_ThreadIdentification.iComponentId = KOstTraceComponentID;
+    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64START;
+    err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
+
+    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64LINE;
+    err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
+
+    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64FIN;
+    err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
+
+    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64END;
+    err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
+
+    RDebug::Print(_L("Debug output deactivated"));
+    if(err != KErrNone)
+        RDebug::Print(_L("TraceCore LDD API responded: %d"), err);
+#endif
+	LOGTEXT(_L("CDebOutWriterPlugin::Stop() - exit"));
+	}
+
+TUid CDebOutWriterPlugin::Id() const
+	{
+    LOGSTRING2("CDebOutWriterPlugin::Id(): 0x%X", KDebOutWriterPluginUid.iUid );
+    return KDebOutWriterPluginUid;
+	//return iDtor_ID_Key;
+	}
+
+TBool CDebOutWriterPlugin::GetEnabled()
+	{
+	return isEnabled;
+	}
+
+void CDebOutWriterPlugin::SetValue( const TWriterPluginValueKeys aKey,
+                                    TDes& aValue )
+    {
+    TRAP_IGNORE( SetValueL( aKey, aValue ) );
+    }
+
+
+void CDebOutWriterPlugin::GetValue( const TWriterPluginValueKeys aKey,
+                                    TDes& aValue )
+    {
+    TRAP_IGNORE( GetValueL( aKey, aValue ) );
+    }
+
+
+
+void CDebOutWriterPlugin::SetValueL( const TWriterPluginValueKeys aKey, TDes& /*aValue*/ )
+{
+	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - entry"));	
+	
+    switch( aKey )
+        {
+        case EWriterPluginEnabled:
+            isEnabled = ETrue;
+        	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin enabled"));
+        	break;
+        case EWriterPluginDisabled:
+            isEnabled = EFalse;
+        	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin disabled"));	
+            break;
+        case EWriterPluginSettings:
+        	//result = StringLoader::LoadL(PROFILER_KERNEL_MODE_SAMPLER);
+        	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - setting plugin settings"));	
+        	break;
+        default:
+        	break;
+        }
+	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - exit"));	
+
+}
+
+TUint32 CDebOutWriterPlugin::GetWriterType()
+	{
+	return iWriterType;
+	}
+
+
+void CDebOutWriterPlugin::GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue )
+    {
+    switch( aKey )
+        {
+        case EWriterPluginVersion:
+
+        	GetWriterVersion(&aValue);
+        	break;
+        case EWriterPluginType:
+        	break;
+           default:
+                break;
+        }
+    }
+
+void CDebOutWriterPlugin::GetWriterVersion(TDes* aDes)
+	{
+	_LIT(KDebugOutputWriterVersion, "1.0.0");
+	aDes->Append(KDebugOutputWriterVersion);
+	}
+
+void CDebOutWriterPlugin::DoCancel()
+{
+	LOGTEXT(_L("CDebOutWriterPlugin::DoCancel - entry"));
+}
+
+void CDebOutWriterPlugin::WriteData()
+    {
+    // Activate handler to write data from buffer to output
+    LOGTEXT(_L("CDiskWriterPlugin::WriteData() - entry"));
+    TRAP_IGNORE(iWriterHandler->StartL());
+    LOGTEXT(_L("CDiskWriterPlugin::WriteData() - exit"));
+    }
+
+void CDebOutWriterPlugin::HandleError(TInt aError)
+    {
+    TInt err(KErrNone);
+    err = iErrorStatus.Set(aError);
+    if(err != KErrNone)
+        {
+        RDebug::Print(_L("CDiskWriterPlugin::HandleError() - error: %d"), err);
+        }
+    }
+
+void CDebOutWriterPlugin::PrintDescriptorAsBase64(	TDesC8& aDes,
+                                                    TRequestStatus* aStatus,
+													TUint32 sampleTime,
+													TBool aEmptying)
+{
+	LOGTEXT(_L("CDebOutWriterPlugin::PrintDescriptorAsBase64() - entry"));
+	TUint len = aDes.Length();
+
+	// we must wait for the sample tick to be printed, in case
+	// prints are performed at user side, otherwise the kernel
+	// prints will corrupt the data
+	if(sampleTime != 0xffffffff)
+	{
+		TUint32 remains = sampleTime%1000;
+	
+		if(remains > 800) 
+		{
+			TTimeIntervalMicroSeconds32 timeToWait = ((1050-remains)*1000);
+			User::After(timeToWait);
+		}
+	}
+	
+	TBuf16<75> buf;
+
+	// Header
+#ifdef OST_TRACE_COMPILER_IN_USE
+    OstTrace0( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64START, 
+            "<PIPROF>=================================================================" );
+#else
+	RDebug::Print(_L("<PIPROF>================================================================="));
+#endif
+	buf.Zero();
+
+	// base64 encoding table
+	const char uu_base64[64] =
+	{
+		'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
+		'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
+		'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
+		'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
+		'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+		'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
+		'w', 'x', 'y', 'z', '0', '1', '2', '3',
+		'4', '5', '6', '7', '8', '9', '+', '/'
+	};
+
+	TChar byte1, byte2, byte3, byte4;
+	TUint8 count = 0x30;
+	// base64 encoding 
+	for(TUint i = 0, j = 0; i < len; i += 3, j = (j + 1) % 18) 
+	{
+    // byte 1
+		byte1 = uu_base64[(aDes[i] >> 2) & 0x3F];
+		
+		// byte 2
+		if(i+1 < len)
+			byte2 = uu_base64[(aDes[i] << 4) & 0x3f | (aDes[i+1] >> 4)];
+		else
+			byte2 = uu_base64[(aDes[i] << 4) & 0x3f];
+
+		// byte 3
+		if(i+1 < len && i+2 < len)
+			byte3 = uu_base64[(aDes[i+1] << 2) & 0x3f | (aDes[i+2] >> 6)];
+		else if(i+1 < len)
+			byte3 = uu_base64[(aDes[i+1] << 2) & 0x3f];
+		else
+			byte3 = '=';
+
+		// byte 4
+		if(i+2 < len) 
+			byte4 = uu_base64[aDes[i+2] & 0x3f];
+		else
+			byte4 = '=';
+	
+		// append to buffer
+		buf.Append(byte1);
+		buf.Append(byte2);
+		buf.Append(byte3);
+		buf.Append(byte4);
+
+		// output 72 chars / line
+		if(j == 17) 
+		{		
+			// add check number at the end of line
+			buf.Append(count);
+#ifdef OST_TRACE_COMPILER_IN_USE
+			OstTraceExt1( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64LINE, "<PIPROF>%S", &buf );
+#else
+			RDebug::Print(_L("<PIPROF>%S"),&buf);
+#endif
+			count++;
+			if(count > 0x39)
+				count = 0x30;
+			buf.Zero();
+		}
+	}
+	
+#ifdef OST_TRACE_COMPILER_IN_USE
+	OstTraceExt1( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64FIN, "<PIPROF>%S", &buf );
+#else
+	RDebug::Print(_L("<PIPROF>%S"),&buf);
+#endif
+	buf.Zero();
+
+	// footer
+#ifdef OST_TRACE_COMPILER_IN_USE
+	OstTrace0( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64END, 
+	        "<PIPROF>=================================================================" );
+#else
+	RDebug::Print(_L("<PIPROF>================================================================="));
+#endif
+
+	if(!aEmptying)
+	    {
+        if(aStatus != 0) 
+            User::RequestComplete(aStatus,0);
+	    }
+	
+	LOGTEXT(_L("CDebOutWriterPlugin::PrintDescriptorAsBase64() - exit"));
+}
+
+
+
+/*
+ * 
+ * Implementation of class CDebOutWriterHandler
+ * 
+ */
+CDebOutWriterHandler::CDebOutWriterHandler(CDebOutWriterPlugin* aWriter) :
+    CActive(EPriorityStandard)
+    {
+    LOGTEXT(_L("CDebOutWriterHandler::CDebOutWriterHandler - entry"));
+    iWriter = aWriter;
+    
+    // set initial mode to non-stopping
+    iStopping = EFalse;
+    
+    // add the handler to the active scheduler
+    CActiveScheduler::Add(this);
+    LOGTEXT(_L("CDebOutWriterHandler::CDebOutWriterHandler - exit"));
+    }
+
+CDebOutWriterHandler* CDebOutWriterHandler::NewL(CDebOutWriterPlugin* aWriter)
+{
+	LOGTEXT(_L("CDebOutWriterHandler::NewL() - entry"));
+	CDebOutWriterHandler* self = new (ELeave) CDebOutWriterHandler(aWriter);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+	LOGTEXT(_L("CDebOutWriterHandler::NewL() - exit"));
+    return self;
+}
+
+CDebOutWriterHandler::~CDebOutWriterHandler()
+    {
+	LOGTEXT(_L("CDebOutWriterHandler::~CDebOutWriterHandler - entry"));
+    
+    LOGTEXT(_L("CDebOutWriterHandler::~CDebOutWriterHandler - exit"));
+    }    
+    
+void CDebOutWriterHandler::ConstructL()
+	{
+
+	}
+
+void CDebOutWriterHandler::StartL()
+	{
+	LOGTEXT(_L("CDebOutWriterHandler::StartL - entry"));
+    if(!IsActive())
+        {
+        LOGTEXT(_L("CDiskWriterHandler::StartL - is not active"));
+    
+        TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
+        LOGSTRING2("CDiskWriterHandler::StartL - got next filled 0x%x",nextBuf);
+    
+        if(nextBuf != 0)
+            {
+            LOGTEXT(_L("CDiskWriterHandler::StartL - writing to file"));
+            WriteBufferToOutput(nextBuf);
+            }
+        }
+	LOGTEXT(_L("CDebOutWriterHandler::StartL - entry"));
+	}
+
+void CDebOutWriterHandler::Stop()
+	{
+	LOGTEXT(_L("CDebOutWriterHandler::Stop - entry"));
+   
+	// do write once more to write the logged data to output
+    // set to stopping mode, needed for emptying the remaining full buffers
+    iStopping = ETrue;
+
+    // stop the timer
+    Reset();
+
+    // set mode back to non-stopping
+    iStopping = EFalse;
+	LOGTEXT(_L("CDebOutWriterHandler::Stop - exit"));
+	}
+
+void CDebOutWriterHandler::Reset()
+    {
+  
+    // start writing new buffer if there is one available
+    TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
+    
+    // empty the rest of the buffers synchronously
+    while(nextBuf != 0)
+        {
+        if(nextBuf->iDataSize != 0)
+            {
+            LOGTEXT(_L("CDiskWriterHandler::Reset - writing to file"));
+            iWriter->PrintDescriptorAsBase64(*(nextBuf->iBufDes),&iStatus,0xffffffff, iStopping);
+            }
+        
+        // empty buffers when profiling stopped
+        iWriter->iStream->AddToFreeBuffers(nextBuf);
+
+        LOGTEXT(_L("CDiskWriterHandler::Reset - get next full buffer"));
+        // start writing new buffer if there is one available
+        nextBuf = iWriter->iStream->GetNextFilledBuffer();
+        LOGSTRING2("CDiskWriterHandler::Reset - got next filled 0x%x",nextBuf);
+        }
+    }
+
+void CDebOutWriterHandler::HandleFullBuffers()
+    {
+    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - entry"));
+    // previous write operation has finished
+    // release the previous buffer 
+    iWriter->iStream->AddToFreeBuffers(iBufferBeingWritten);
+
+    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - get next full buffer"));
+    // start writing new buffer if there is one available
+    TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
+
+    if(nextBuf != 0)
+        {
+        LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - writing to file"));
+        if(nextBuf->iDataSize != 0)
+            {
+            WriteBufferToOutput(nextBuf);
+            }
+        } 
+    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - exit"));
+    }
+
+void CDebOutWriterHandler::RunL()
+    {
+    // call function to complete full buffer handling
+    HandleFullBuffers();
+    }
+
+void CDebOutWriterHandler::DoCancel()
+    {
+    
+    }
+
+void CDebOutWriterHandler::WriteBufferToOutput(TBapBuf* aBuf)
+    {
+    LOGTEXT(_L("CDebOutWriterHandler::WriteBufferToOutput - entry"));
+    iBufferBeingWritten = aBuf;
+
+    // set the data length just to be sure
+    iBufferBeingWritten->iBufDes->SetLength(aBuf->iDataSize);
+
+    LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - writing to file"));
+//    PrintBufferToOutput(iBufferBeingWritten, iStatus);
+    iWriter->PrintDescriptorAsBase64(*(iBufferBeingWritten->iBufDes),&iStatus,0xffffffff, iStopping);
+    // set AO back to active, until filled buffers are emptied 
+    SetActive();
+    
+    LOGTEXT(_L("CDebOutWriterHandler::WriteBufferToOutput - exit"));
+    }
+
+// private
+void CDebOutWriterHandler::PrintBufferToOutput(TBapBuf* aBuffer, TRequestStatus& aStatus)
+    {
+    LOGTEXT(_L("CDebOutWriterHandler::WriteBufferToOutput() - debug out writer tick activated"));
+
+    TPtrC8& aDes = (TPtrC8&)*(aBuffer->iBufDes);
+#ifdef BAPPEA_SAMPLE_MARKS
+    TUint32 time = iSampler->GetSampleTime();
+#else
+    TUint32 time = 0xffffffff;
+#endif
+    iWriter->PrintDescriptorAsBase64(aDes,&aStatus,time, iStopping);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DebugOutputWriterPlugin/src/DebOutWriterPluginImplementationTable.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "DebOutWriterPlugin.h"
+
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+{
+         IMPLEMENTATION_PROXY_ENTRY(0x2001E5BA,  CDebOutWriterPlugin::NewL)
+};
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DiskWriterPlugin/data/2001E5BB.rss	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 <ecom/registryinfo.rh>
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL. See mmp files
+    //__SERIES60_3X__ can't be used in resource files
+    dll_uid = 0x2001E5BB;
+
+    // Declare array of interface info. This dll contains implementations for 
+    // only one interface (CSamplerInterfaceDefinition).
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x2001E5BD;
+
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2001E5BB;
+
+                    version_no = 1;
+                    display_name = "Disk output writer implementation";
+                    default_data = "dsw";
+                    opaque_data = "0";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DiskWriterPlugin/group/DiskWriterPlugin.mmp	Mon Sep 06 15:00:47 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:  
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+
+TARGET        PIProfilerDiskWriter.dll
+TARGETTYPE    PLUGIN
+UID           0x10009D8D 0x2001E5BB
+#ifdef WINSCW
+VENDORID      0
+#else
+VENDORID      VID_DEFAULT
+#endif
+CAPABILITY    ALL -TCB // AllFiles ReadDeviceData ReadUserData UserEnvironment WriteDeviceData WriteUserData
+SMPSAFE
+
+OS_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../inc
+SOURCEPATH      ../src
+
+START RESOURCE ../data/2001E5BB.rss
+TARGET piprofilerdiskwriter.rsc
+END
+
+SOURCE          DiskWriterPlugin.cpp
+SOURCE          DiskWriterPluginImplementationTable.cpp
+
+LIBRARY			sysutil.lib 
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         CommonEngine.lib
+LIBRARY			flogger.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DiskWriterPlugin/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* 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:  
+*
+*/
+
+
+PRJ_MMPFILES
+DiskWriterPlugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DiskWriterPlugin/inc/DiskWriterPlugin.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* 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 __DISKWRITERPLUGIN_H__
+#define __DISKWRITERPLUGIN_H__
+
+//  Include Files
+#include <w32std.h>
+#include <piprofiler/WriterPluginInterface.h>
+#include <piprofiler/ProfilerGenericClassesUsr.h>
+#include <e32base.h>	// CBase
+#include <e32std.h>	 // TBuf
+#include <e32property.h>
+
+_LIT(KFileOutShortName, "dsw");
+
+// forward declarations
+class CDiskWriterHandler;
+class CProfilerSampleStream;
+
+//  Class Definitions
+
+class CDiskWriterPlugin : public CWriterPluginInterface
+	{
+public:
+	// new function
+	static CDiskWriterPlugin* NewL(const TUid aImplementationUid, TAny* aInitParams);
+	~CDiskWriterPlugin();
+
+	void	DoCancel();
+
+	
+public: // new functions
+	
+	TInt 	Start();
+
+	void 	Stop();
+    
+	void 	GetValue( const TWriterPluginValueKeys aKey, TDes& aValue );
+	
+	void 	SetValue( const TWriterPluginValueKeys aKey, TDes& aValue ); 
+    
+	TUid 	Id() const;
+		 
+	void 	GetWriterVersion(TDes* aDes);
+	
+	TUint32 GetWriterType();
+
+	void   HandleError(TInt aError);
+	
+	void   WriteData();
+	
+	void   SetStream(CProfilerSampleStream& aStream) { iStream = &aStream; }
+	
+private: // new functions
+	CDiskWriterPlugin(const TUid aImplementationUid);
+	void 	ConstructL();
+
+	void 	GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
+	void 	SetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
+    TBool   GetEnabled();
+	
+	TInt   DisplayNotifier(const TDesC& aLine1, const TDesC& aLine2, const TDesC& aButton1, const TDesC& aButton2);
+public: 
+    CProfilerSampleStream*          iStream;
+private: // data
+
+    TBuf<256>                       iFileName;
+	TInt 							iWriterType;
+	TInt							iWriterId;
+	CDiskWriterHandler*				iWriterHandler;
+	RProperty                       iErrorStatus;
+	};
+
+/*
+ * 
+ * Definition of class CDiskWriterHandler
+ * 
+ */
+class CDiskWriterHandler : public CActive //CBase
+	{
+public:
+ 
+
+	static CDiskWriterHandler* NewL(CDiskWriterPlugin* aWriter);
+	~CDiskWriterHandler();
+
+	void StartL();
+
+	void Stop();
+	void RunL();
+	TInt RunError(TInt aError);
+	
+	void DoCancel();
+	void WriteBufferToOutput(TBapBuf* aBuf);
+	void Reset();
+	   
+    TInt TestFile(const TDesC& totalPrefix);
+private:
+	CDiskWriterHandler(CDiskWriterPlugin* aWriter); 
+	
+	void ConstructL();
+    void WriteMemBufferToFile(TDesC8& aDes, TRequestStatus& aStatus);
+	static TInt Write(TAny* aObject);
+	void HandleFullBuffers();
+	void DoWrite();
+	
+private:
+    RFile                           iFile;
+    RFs                             iFs;
+    TBuf<256>                       iFileName;
+	CDiskWriterPlugin* 				iWriter;
+    TBapBuf*                        iBufferBeingWritten;
+    TBool                           iStopping;
+	};
+
+#endif  // __DEBOUTWRITERPLUGIN_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DiskWriterPlugin/sis/DiskWriterPlugin_EKA2.pkg	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,36 @@
+;
+; 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:
+;
+; Installation file for DebOutWriterPlugin dll
+;
+; This is an auto-generated PKG file by Carbide.
+; This file uses variables specific to Carbide builds that will not work
+; on command-line builds. If you want to use this generated PKG file from the
+; command-line tools you will need to modify the variables with the appropriate
+; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
+
+;
+; UID is the dll's UID
+;
+#{"DebOutWriterPlugin DLL"},(0x00DA58C7),1,0,0
+
+
+;Localised Vendor name
+%{"Vendor-EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\DebOutWriterPlugin.dll"		  -"!:\sys\bin\DebOutWriterPlugin.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DiskWriterPlugin/src/DiskWriterPlugin.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,476 @@
+/*
+* 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 Files  
+
+#include "DiskWriterPlugin.h"	// CDiskWriterPlugin
+#include <e32base.h>
+#include <sysutil.h>
+//#include <piprofiler/EngineUIDs.h>
+
+// constants
+const TUid KDiskWriterPluginUid = { 0x2001E5BB };   // own UID
+
+// engine properties
+const TUid KEngineStatusPropertyCat={0x2001E5AD};
+enum TEnginePropertyKeys
+    {
+    EProfilerEngineStatus = 8,
+    EProfilerErrorStatus
+    };
+
+/*
+ *
+ *	Class CDiskWriterPlugin implementation
+ *
+ */
+
+//  Member Functions
+CDiskWriterPlugin* CDiskWriterPlugin::NewL(const TUid /*aImplementationUid*/, TAny* /*aInitParams*/)
+    {
+	LOGTEXT(_L("CDiskWriterPlugin::NewL() - entry"));
+	CDiskWriterPlugin* self = new (ELeave) CDiskWriterPlugin(KDiskWriterPluginUid);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+	LOGTEXT(_L("CDiskWriterPlugin::NewL() - exit"));
+    return self;
+    }
+
+CDiskWriterPlugin::CDiskWriterPlugin(const TUid aImplementationUid) :
+	iWriterType(aImplementationUid.iUid)
+    {
+    LOGTEXT(_L("CDiskWriterPlugin::CDiskWriterPlugin - entry"));
+    isEnabled = EFalse;
+    iWriterId = Id().iUid;
+    LOGTEXT(_L("CDiskWriterPlugin::CDiskWriterPlugin - exit"));
+    }
+
+CDiskWriterPlugin::~CDiskWriterPlugin()
+    {
+    LOGTEXT(_L("CDiskWriterPlugin::~CDiskWriterPlugin - entry"));
+
+    iErrorStatus.Close();
+    
+    if(iWriterHandler)
+        {
+        iWriterHandler->Cancel();
+        delete iWriterHandler;
+        }
+    LOGTEXT(_L("CDiskWriterPlugin::~CDiskWriterPlugin - exit"));
+    }
+
+void CDiskWriterPlugin::ConstructL()
+	{
+	// second phase constructor, anything that may leave must be constructed here
+	LOGTEXT(_L("CDiskWriterPlugin::ConstructL() - entry"));
+	iWriterHandler = CDiskWriterHandler::NewL(this);
+	User::LeaveIfError(iErrorStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus));
+	LOGTEXT(_L("CDiskWriterPlugin::ConstructL() - exit"));
+	}
+
+TUid CDiskWriterPlugin::Id() const 
+	{
+    LOGSTRING2("CDiskWriterPlugin::Id():0x%X", KDiskWriterPluginUid.iUid );
+    return KDiskWriterPluginUid;
+	}
+	 
+void CDiskWriterPlugin::GetWriterVersion(TDes* aDes)
+	{
+	_LIT(KDiskWriterVersion, "1.0.0");
+	aDes->Append(KDiskWriterVersion);
+	}
+
+TInt CDiskWriterPlugin::Start()
+	{
+//	if(isEnabled)
+//		{
+//		TRAPD(err, iWriterHandler->StartL());
+//		if( err != KErrNone)
+//		    {
+//		    LOGTEXT(_L("Could not start writer plugin"));
+//		    return err;
+//		    }
+//		}
+	return KErrNone;
+	}
+
+void CDiskWriterPlugin::Stop()
+	{
+	// stop writer handler normally
+	iWriterHandler->Stop();
+	}
+
+TBool CDiskWriterPlugin::GetEnabled()
+	{
+	return isEnabled;
+	}
+
+TUint32 CDiskWriterPlugin::GetWriterType()
+	{
+	return iWriterType;
+	}
+
+
+void CDiskWriterPlugin::SetValue( const TWriterPluginValueKeys aKey,
+                                    TDes& aValue )
+    {
+    TRAP_IGNORE( SetValueL( aKey, aValue ) );
+    }
+
+
+void CDiskWriterPlugin::GetValue( const TWriterPluginValueKeys aKey,
+                                    TDes& aValue )
+    {
+    TRAP_IGNORE( GetValueL( aKey, aValue ) );
+    }
+
+void CDiskWriterPlugin::SetValueL( const TWriterPluginValueKeys aKey, TDes& aValue )
+    {
+    TInt error(KErrNone);
+    
+    switch( aKey )
+        {
+        case EWriterPluginEnabled:
+            isEnabled = ETrue;
+        	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin enabled"));
+        	break;
+        case EWriterPluginDisabled:
+            isEnabled = EFalse;
+        	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin disabled"));	
+            break;
+        case EWriterPluginSettings:	// file name in case of disk writer plugin
+        	iFileName.Zero();
+        	iFileName.Append(aValue);
+        	error = iWriterHandler->TestFile(iFileName);
+        		User::LeaveIfError(error);
+        	break;
+        default:
+        	break;
+        }
+    }
+
+void CDiskWriterPlugin::GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue )
+    {
+    switch( aKey )
+        {
+        case EWriterPluginVersion:
+        	GetWriterVersion(&aValue);
+        	break;
+        case EWriterPluginType:
+        	break;
+        case EWriterPluginSettings:	// file name in disk writer case
+        	aValue.Copy(iFileName);
+           default:
+                break;
+        }
+    }
+
+void CDiskWriterPlugin::DoCancel()
+    {
+	LOGTEXT(_L("CDebOutWriterPlugin::DoCancel - entry"));
+    }
+
+void CDiskWriterPlugin::WriteData()
+    {
+    // Activate handler to write data from buffer to output
+    LOGTEXT(_L("CDiskWriterPlugin::WriteData() - entry"));
+    TRAP_IGNORE(iWriterHandler->StartL());
+    LOGTEXT(_L("CDiskWriterPlugin::WriteData() - exit"));
+    }
+
+void CDiskWriterPlugin::HandleError(TInt aError)
+    {
+    TInt err(KErrNone);
+    RDebug::Print(_L("CDiskWriterPlugin::HandleError() - error received: %d"), aError);
+    err = iErrorStatus.Set(aError);
+    if(err != KErrNone)
+        {
+        RDebug::Print(_L("CDiskWriterPlugin::HandleError() - error in updating property: %d"), err);
+        }
+    }
+
+/*
+ * 
+ * Implementation of class CDiskWriterHandler
+ * 
+ */
+
+CDiskWriterHandler* CDiskWriterHandler::NewL(CDiskWriterPlugin* aWriter)
+    {
+	LOGTEXT(_L("CDiskWriterHandler::NewL() - entry"));
+	CDiskWriterHandler* self = new (ELeave) CDiskWriterHandler(aWriter);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+	LOGTEXT(_L("CDiskWriterHandler::NewL() - exit"));
+    return self;
+    }
+
+CDiskWriterHandler::CDiskWriterHandler(CDiskWriterPlugin* aWriter)  :
+    CActive(EPriorityStandard)
+    {
+    LOGTEXT(_L("CDiskWriterHandler::CDiskWriterHandler - entry"));
+
+    iWriter = aWriter;
+    
+    // set initial mode to non-stopping
+    iStopping = EFalse;
+    
+    // add the handler to the active scheduler
+    CActiveScheduler::Add(this);
+    
+    LOGTEXT(_L("CDiskWriterHandler::CDiskWriterHandler - exit"));
+    }
+
+
+CDiskWriterHandler::~CDiskWriterHandler()
+    {
+	LOGTEXT(_L("CDiskWriterHandler::~CDiskWriterHandler - entry"));
+
+	LOGTEXT(_L("CDiskWriterHandler::~CDiskWriterHandler - exit"));
+    }    
+    
+void CDiskWriterHandler::ConstructL()
+	{
+	}
+
+TInt CDiskWriterHandler::TestFile(const TDesC& totalPrefix) 
+    {
+    TParse parse;
+
+    TInt err(KErrNone);
+    if((err = parse.Set(totalPrefix, NULL, NULL)) != KErrNone)
+        return err;
+
+    err = iFs.Connect();
+    if(err != KErrNone)
+        {
+        LOGTEXT(_L("CDiskWriterHandler::TestFile() - Failed to open a session to file server"));
+        return KErrNotFound;
+        }
+    
+    iFs.MkDirAll(parse.FullName());
+    
+    err = iFile.Replace(iFs,parse.FullName(),EFileWrite);
+    if(err != KErrNone)
+        {
+        iFs.Close();
+        return KErrNotFound;
+        }
+    
+    iFileName.Copy(parse.FullName());
+
+    return KErrNone;
+    }
+
+void CDiskWriterHandler::Reset()
+    {
+    // cancel active object
+    Cancel();
+    
+    // start writing new buffer if there is one available
+    TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
+    
+    // empty the rest of the buffers synchronously
+    while(nextBuf != 0)
+        {
+        LOGTEXT(_L("CDiskWriterHandler::Reset - writing to file"));
+        if(nextBuf->iDataSize != 0)
+            {
+            LOGTEXT(_L("CDiskWriterHandler::Reset - writing to file"));
+            WriteMemBufferToFile(*(nextBuf->iBufDes),iStatus);
+            }
+        
+        // empty buffers when profiling stopped
+        iWriter->iStream->AddToFreeBuffers(nextBuf);
+
+        LOGTEXT(_L("CDiskWriterHandler::Reset - get next full buffer"));
+        // start writing new buffer if there is one available
+        nextBuf = iWriter->iStream->GetNextFilledBuffer();
+        LOGSTRING2("CDiskWriterHandler::Reset - got next filled 0x%x",nextBuf);
+        }
+    }
+
+void CDiskWriterHandler::HandleFullBuffers()
+    {
+    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - entry"));
+    // previous write operation has finished
+    // release the previous buffer 
+    iWriter->iStream->AddToFreeBuffers(iBufferBeingWritten);
+
+    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - get next full buffer"));
+    // start writing new buffer if there is one available
+    TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
+
+    if(nextBuf != 0)
+        {
+        LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - writing to file"));
+        if(nextBuf->iDataSize != 0)
+            {
+            WriteBufferToOutput(nextBuf);
+            }
+        } 
+    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - exit"));
+    }
+
+void CDiskWriterHandler::RunL()
+    {
+    LOGTEXT(_L("CDiskWriterHandler::RunL - entry"));
+    // call function to complete full buffer handling
+    HandleFullBuffers();
+    LOGTEXT(_L("CDiskWriterHandler::RunL - exit"));
+    }
+
+void CDiskWriterHandler::DoCancel()
+    {
+    
+    }
+
+//-----------------------------------------------------------------------------
+// CPIProfilerTraceCoreLauncher::RunError(TInt aError)
+// Handle leaves from RunL().
+//-----------------------------------------------------------------------------
+TInt CDiskWriterHandler::RunError(TInt aError)
+    {
+    // no reason to continue if disk full or removed
+    iFile.Close();
+    // close handle to file server too
+    iFs.Close();
+    iFileName.Zero();
+    
+    iWriter->HandleError(KErrDiskFull);
+    return aError;
+    }
+
+void CDiskWriterHandler::WriteMemBufferToFile(TDesC8& aDes, TRequestStatus& aStatus)
+    {   
+    LOGTEXT(_L("CDiskWriterPlugin::WriteMemBufferToFile - entry"));
+
+    TUint sampleSize(aDes.Length());
+    TInt err(KErrNone);
+    TInt drive(0);
+    TDriveInfo info;
+    TBool noDiskSpace(EFalse);
+    
+    err = iFile.Drive(drive,info);
+
+    // test available disk space 
+    TRAP_IGNORE((noDiskSpace = SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, sampleSize, drive))); 
+    // check first if still space on disk
+    if(noDiskSpace)
+        {
+        // set error to disk full
+        err = KErrDiskFull;
+        LOGTEXT(_L("CDiskWriterPlugin::WriteMemBufferToFile - disk full, cannot write"));
+        }
+    else
+        {
+        // check if profiling in stopping mode
+        if(iStopping)
+            {
+            // RDebug::Print(_L("CDiskWriterPlugin::WriteMemBufferToFile - data written, length %d, stopping"), aDes.Length());
+            // write to file without status
+            err = iFile.Write(aDes);
+            }
+        else
+            {
+            // RDebug::Print(_L("CDiskWriterPlugin::WriteMemBufferToFile - data written, length %d"), aDes.Length());
+            // write to file with status
+            iFile.Write(aDes,aStatus);
+            }
+        }
+    
+    // check if error in write
+    if(err != KErrNone)
+        {
+        // stop writer handler (and its timer) immediately, DO NOT try write data!
+        Cancel();
+        
+        // no reason to continue if disk full or removed
+        // end of stream detected, file can be closed
+        iFile.Close();
+        // close handle to file server too
+        iFs.Close();
+        iFileName.Zero();
+        
+        // set error status for engine to read
+        iWriter->HandleError(err);
+        }
+    LOGTEXT(_L("CDiskWriterPlugin::WriteMemBufferToFile - exit"));
+    }
+
+void CDiskWriterHandler::WriteBufferToOutput(TBapBuf* aBuf)
+    {
+    LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - entry"));
+    iBufferBeingWritten = aBuf;
+
+    // set the data length just to be sure
+    iBufferBeingWritten->iBufDes->SetLength(aBuf->iDataSize);
+
+    LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - writing to file"));
+    WriteMemBufferToFile(*(iBufferBeingWritten->iBufDes), iStatus);
+
+    // set AO back to active, until filled buffers are emptied 
+    SetActive();
+    
+    LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - exit"));
+    }
+
+void CDiskWriterHandler::StartL()
+	{
+	LOGTEXT(_L("CDiskWriterHandler::StartL - entry"));
+    if(!IsActive())
+        {
+        LOGTEXT(_L("CDiskWriterHandler::StartL - is not active"));
+    
+        TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
+        LOGSTRING2("CDiskWriterHandler::StartL - got next filled 0x%x",nextBuf);
+    
+        if(nextBuf != 0)
+            {
+            LOGTEXT(_L("CDiskWriterHandler::StartL - writing to file"));
+            WriteBufferToOutput(nextBuf);
+            }
+        }
+    LOGTEXT(_L("CDiskWriterHandler::StartL - exit"));
+	}
+
+void CDiskWriterHandler::Stop()
+	{
+	LOGTEXT(_L("CDiskWriterHandler::Stop - entry"));
+	
+	// set to stopping mode, needed for emptying the remaining full buffers
+	iStopping = ETrue;
+	
+	// stop the timer
+	Reset();
+
+    // end of stream detected, file can be closed
+    iFile.Close();
+    // close handle to file server too
+    iFs.Close();
+    iFileName.Zero();
+    
+    // set mode back to non-stopping
+    iStopping = EFalse;
+    
+    LOGTEXT(_L("CDiskWriterHandler::Stop - exit"));
+	}
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/DiskWriterPlugin/src/DiskWriterPluginImplementationTable.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "DiskWriterPlugin.h"
+
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+{
+         IMPLEMENTATION_PROXY_ENTRY(0x2001E5BB,  CDiskWriterPlugin::NewL)
+};
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/data/2001E5B2.rss	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 <ecom/registryinfo.rh>
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL. See mmp files
+    //__SERIES60_3X__ can't be used in resource files
+    dll_uid = 0x2001E5B2;
+
+    // Declare array of interface info. This dll contains implementations for 
+    // only one interface (CSamplerInterfaceDefinition).
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x2001E5BC;
+
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2001E5B2;
+
+                    version_no = 1;
+                    display_name = "General Samplers; GPP, ITT, GFC, MEM, PRI";
+                    default_data = "gen";
+                    opaque_data = "0";	// the order number
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/group/GeneralsPlugin.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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 <platform_paths.hrh>
+
+
+TARGET              PIProfilerGenerals.dll
+TARGETTYPE          PLUGIN
+UID                 0x10009D8D 0x2001E5B2
+VENDORID            VID_DEFAULT
+CAPABILITY          ALL -TCB
+SMPSAFE
+
+EPOCSTACKSIZE     	0x10000
+
+OS_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../inc
+SOURCEPATH      ../src
+
+START RESOURCE  ../data/2001E5B2.rss
+TARGET PIProfilerGenerals.rsc
+END
+
+SOURCE              GeneralsPluginImplementationTable.cpp
+SOURCE              GeneralsPlugin.cpp
+
+LIBRARY             euser.lib
+LIBRARY     		bafl.lib 
+LIBRARY             ecom.lib
+LIBRARY             apparc.lib
+LIBRARY             cone.lib
+LIBRARY             ws32.lib
+LIBRARY             charconv.lib
+LIBRARY             CommonEngine.lib
+LIBRARY				flogger.lib
+
+epocallowdlldata
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/group/GeneralsSampler.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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 <platform_paths.hrh>
+#include "kernel/kern_ext.mmh"
+
+TARGET              PIProfilerGeneralsSampler.ldd
+CAPABILITY          ALL
+TARGETTYPE          LDD
+UID                 0x100000AF 0x2001E5B3
+VENDORID            VID_DEFAULT 
+SMPSAFE
+
+OS_LAYER_KERNEL_SYSTEMINCLUDE
+USERINCLUDE         ../inc
+SOURCEPATH          ../src
+
+SOURCE              GeneralsDriver.cpp 
+SOURCE              GeneralsSampler.cia
+SOURCE              GppSamplerImpl.cpp 
+SOURCE              IttEventHandler.cpp
+SOURCE              IttSamplerImpl.cpp
+SOURCE              MemoryEventHandler.cpp 
+SOURCE              MemSamplerImpl.cpp 
+SOURCE              PriSamplerImpl.cpp
+
+#ifdef SMP
+LIBRARY				ekernsmp.lib
+#else
+LIBRARY				ekern.lib
+#endif
+
+epocallowdlldata
+
+start wins
+win32_headers
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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:  
+*
+*/
+
+//PRJ_PLATFORMS
+//DEFAULT ARMV5SMP
+
+PRJ_MMPFILES
+#ifdef MARM
+  GeneralsPlugin.mmp
+  GeneralsSampler.mmp
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/inc/GeneralsConfig.h	Mon Sep 06 15:00:47 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 GENERALS_CONFIG_H
+#define GENERALS_CONFIG_H
+
+
+	// change this to reflect the ISA task amount
+	#define PROFILER_ISA_OS_TASK_AMOUNT	50	
+
+	// don't change these definitions
+	#define	PROFILER_DEFINE_ISA_TASK_NAME_ARRAY 			TBuf8<64> isaTaskNames[PROFILER_ISA_OS_TASK_AMOUNT];
+	#define PROFILER_DEFINE_ISA_TASK_NAME(name,number)	isaTaskNames[number].Append(_L8(name));										
+
+	// change these to reflect the real ISA task names and numbers
+	// the last number must be PROFILER_ISA_OS_TASK_AMOUNT-1
+
+	#define PROFILER_ISA_TASK_NAMES		PROFILER_DEFINE_ISA_TASK_NAME("SRVSCKT_TASK",0)\
+		PROFILER_DEFINE_ISA_TASK_NAME("CSD_SRV_TASK",1)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("CSD_NTB_TASK",2)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("CSD_WTB_TASK",3)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("PH_TASK",4)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("L2_TASK",5)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("RR_TASK",6)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("GPRS_RLC_TASK",7)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("GPRS_MAC_TASK",8)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("RANC_TASK",9)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("MM_TASK",10)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("CC_TASK",11)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("SMS_TASK",12)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("RM_CONTROL_TASK",13)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("GSS_SERVER_TASK",14)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("CS_MAIN_TASK",15)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("GPRS_TASK",16)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("WMAC_TASK",17)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("WMHS_TASK",18)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("WRRC_TASK",19)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("WRLC_UL_TASK",20)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("WRLC_DL_TASK",21)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("WPH_TASK",22)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("WRAN_TASK",23)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("SSOM_TASK",24)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("ACCESSORY_TASK",25)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("ADL_TASK",26)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("AUDIO_TASK",27)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("PN_TASK",28)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("CORE_HI_TASK",29)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("CORE_LO_TASK",30)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("ENERGY_TASK",31)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("FBUS_TASK",32)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("PMM_FILE2_TASK",33)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("MDI_RCV_TASK",34)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("MDI_SEND_TASK",35)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("MONITOR_TASK",36)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("MTC_CTRL_TASK",37)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("MTC_WD_TASK",38)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("OBEX_TASK",39)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("APDU_SERVER_TASK",40)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("SIMSON_SERVER_TASK",41)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("SIMLOCK_TASK",42)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("SOS_USB_MM_TASK",43)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("SOS_PROXY_AUX_TASK",44)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("TERMINAL_ADAPTER_TASK",45)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("XTI_RECEIVE_TASK",46)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("XTI_SEND_TASK",47)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("STARTUP_AND_BACKGROUND_TASK",48)						\
+		PROFILER_DEFINE_ISA_TASK_NAME("OS_IDLE_TASK",49)	
+
+	// old definitions
+	#define 	PROFILER_GENERALS_SAMPLER_ID		100
+	#define		PROFILER_GPP_SAMPLER_ID			1
+	#define		PROFILER_GFC_SAMPLER_ID			2
+	#define		PROFILER_ITT_SAMPLER_ID			3
+	#define		PROFILER_MEM_SAMPLER_ID			4
+	#define		PROFILER_PRI_SAMPLER_ID			5
+
+	#define		PROFILER_GPP_SAMPLER_NAME _L("GPP")
+	#define		PROFILER_GFC_SAMPLER_NAME _L("GFC")
+	#define		PROFILER_ITT_SAMPLER_NAME _L("ITT")
+	#define		PROFILER_MEM_SAMPLER_NAME _L("MEM")
+	#define		PROFILER_PRI_SAMPLER_NAME _L("PRI")
+
+	
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/inc/GeneralsDriver.h	Mon Sep 06 15:00:47 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:  
+*
+*/
+
+
+#ifndef __GENERALSSAMPLER_H__
+#define __GENERALSSAMPLER_H__
+
+/*
+ * The user-interface to the sampling device driver sued by the profiling engine
+ */
+#include <piprofiler/PluginSampler.h>
+
+#ifndef __KERNEL_MODE__
+#include <utf.h>
+#endif
+
+
+/**
+ * The user device driver class for controlling the plugin sampler.
+ */
+
+class RGeneralsSampler :  public RPluginSampler 
+{	
+	public:
+		#ifndef __KERNEL_MODE__
+		
+		/** Open a channel to the sampling device **/
+		inline TInt Open();
+		
+		#endif	// !__KERNEL_MODE__	
+};
+	
+_LIT(KPluginSamplerName,"PIProfilerGeneralsSampler");
+
+#ifndef __KERNEL_MODE__
+
+inline TInt RGeneralsSampler::Open()
+{
+	return DoCreate(KPluginSamplerName,TVersion(1,0,1),KNullUnit,NULL,NULL);
+}
+
+
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/inc/GeneralsPlugin.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* 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 PROFILER_GENERALSECOM_SAMPLER_H
+#define PROFILER_GENERALSECOM_SAMPLER_H
+
+#include <w32std.h>
+
+#include "GeneralsDriver.h"
+#include "GeneralsConfig.h"
+#include <piprofiler/SamplerPluginInterface.h>
+#include <piprofiler/ProfilerGenericClassesUsr.h>
+
+// constants 
+const TUint KDefaultOutputCombination = 3;
+
+const TUint KSubSamplerCount = 5;
+
+// parent itself
+_LIT(KGENShortName, "gen");
+_LIT(KGENMediumName, "Generic samplers plug-in");
+_LIT(KGENLongName, "Generic samplers plug-in");
+
+// gpp caption definitions
+_LIT8(KGPPShortName, "gpp");
+#ifdef CARBIDE_NAMES
+_LIT8(KGPPLongName, "Address/Thread sampling");
+#else
+_LIT8(KGPPLongName, "CPU load sampler");
+#endif
+_LIT8(KGPPDescription, "CPU load sampler\nSampling thread and process load\nHW dep: N/A\nSW dep: S60 3.0\n");
+
+// gfc caption definitions
+_LIT8(KGFCShortName, "gfc");
+#ifdef CARBIDE_NAMES
+_LIT8(KGFCLongName, "Function call sampling");
+#else
+_LIT8(KGFCLongName, "Function call sampler");
+#endif
+_LIT8(KGFCDescription, "Function call sampler\nCapturing function call info\nHW dep: N/A\nSW dep: S60 3.0\n");
+
+// itt caption definitions
+_LIT8(KITTShortName, "itt");
+#ifdef CARBIDE_NAMES
+_LIT8(KITTLongName, "Dynamic binary support");
+#else
+_LIT8(KITTLongName, "Dynamic binary sampler");
+#endif
+_LIT8(KITTDescription, "Dynamic binary sampler\nTracing dynamically loaded binaries, e.g. from ROFS\nHW dep: N/A\nSW dep: S60 3.0\n");
+
+// mem caption definitions
+_LIT8(KMEMShortName, "mem");
+#ifdef CARBIDE_NAMES
+_LIT8(KMEMLongName, "Memory usage sampler");
+#else
+_LIT8(KMEMLongName, "Memory trace sampler");
+#endif
+_LIT8(KMEMDescription, "Memory trace sampler\nTracing memory, i.e. stack and chunk usage\nHW dep: N/A\nSW dep: S60 3.0\n");
+
+// pri caption definitions
+_LIT8(KPRIShortName, "pri");
+#ifdef CARBIDE_NAMES
+_LIT8(KPRILongName, "Thread priority sampling");
+#else
+_LIT8(KPRILongName, "Priority trace sampler");
+#endif
+_LIT8(KPRIDescription, "Priority trace sampler\nTracing thread priorities\nHW dep: N/A\nSW dep: S60 3.0\n");
+
+
+// forward definitions
+class CConfigInfoArray;
+class CProfilerBufferHandler;
+class CProfilerSampleStream;
+class TSamplerAttributes;
+
+class CGeneralsPlugin : public CSamplerPluginInterface
+{
+public:
+	static CGeneralsPlugin* NewL(const TUid aImplementationUid, TAny* /*aInitParams*/);
+	~CGeneralsPlugin();
+
+	TUint32 GetSampleTime();
+	
+	/* 
+	 * Sub sampler specific functions
+	 * 
+	 */
+	
+	// from CSamplerPluginInterface
+	TInt 	ResetAndActivateL(CProfilerSampleStream& aStream);
+	TInt 	StopSampling();
+    TBool   Enabled() { return iEnabled; }
+
+	TUid 	Id( TInt aSubId ) const;
+	TInt 	SubId( TUid aSubId ) const;	// internal
+
+	void    GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes);
+	TInt    SetAttributesL(TSamplerAttributes& aAttributes);
+	void    InitiateSamplerAttributesL();
+	
+	TInt    ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray);
+	TInt    DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex);
+	void    SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex);
+
+	TInt 	GetSamplerType();
+	
+	void    InstallStreamForActiveTraces(RGeneralsSampler& sampler, CProfilerSampleStream& aStream);
+	
+private:
+	CGeneralsPlugin();
+	void ConstructL();
+
+	TInt InitiateSamplerL();
+	TInt CleanSampler();
+    void SetSettingsToSamplers();
+	
+private:
+	TUint8						iVersion[20];
+	TPtr8						iVersionDescriptor;
+	
+	RGeneralsSampler 			iGeneralsSampler;
+
+	CProfilerBufferHandler*		iBufferHandler;
+	
+	CArrayFixFlat<TSamplerAttributes>* iSamplerAttributes;
+
+	TBuf8<9>                    iSearchTexts;
+public:
+	TUint32* 					iSampleTime;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/inc/GfcSamplerImpl.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,249 @@
+/*
+* 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 PROFILER_GFC_SAMPLER_H
+#define PROFILER_GFC_SAMPLER_H
+
+
+#include "GeneralsConfig.h"
+
+#include <kern_priv.h>
+
+#include <piprofiler/ProfilerGenericClassesKrn.h>
+#include <piprofiler/ProfilerTraces.h>
+#include "GppSamplerImpl.h"
+
+extern void UsrModLr(TUint32*);
+
+
+/*
+ *	
+ *	GFC sampler definition
+ *	
+ */
+
+template <int BufferSize>
+class DProfilerGfcSampler : public DProfilerGenericSampler<BufferSize>
+{
+public:
+	DProfilerGfcSampler(struct TProfilerGppSamplerData* );
+	~DProfilerGfcSampler();
+
+	void	Sample();
+	TInt	Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset);
+private:
+	struct TProfilerGppSamplerData* gppSamplerData;
+	TUint32 gfcSample[3];
+
+	TUint8	encodedSample[15];
+	TUint32	repeat;
+};
+
+/*
+ *	
+ *	GFC sampler implementation
+ *	
+ */
+
+template <int BufferSize>
+DProfilerGfcSampler<BufferSize>::DProfilerGfcSampler(struct TProfilerGppSamplerData* gppSamplerDataIn) :
+	DProfilerGenericSampler<BufferSize>(PROFILER_GFC_SAMPLER_ID)
+{
+	this->gppSamplerData = gppSamplerDataIn;
+	LOGSTRING2("CProfilerGfcSampler<%d>::CProfilerGfcSampler",BufferSize);	
+}
+
+template <int BufferSize>
+TInt DProfilerGfcSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
+{
+	LOGSTRING2("CProfilerGfcSampler<BufferSize> - entry",BufferSize);
+	
+	this->repeat = 0;
+	for(TInt i(0);i<3;i++)
+	{
+		this->gfcSample[i] = 0;
+	}
+
+	LOGSTRING2("CProfilerGfcSampler<%d>::Reset - calling superclass reset",BufferSize);
+	DProfilerGenericSampler<BufferSize>::Reset(aStream);
+	LOGSTRING2("CProfilerGfcSampler<%d>::Reset - called superclass reset",BufferSize);
+	
+	// add the first sample, indicating the gfc trace version
+	TUint8 firstSample[33];
+	TPtr8 firstSampleDesc(&(firstSample[1]),32);
+	firstSampleDesc.Zero();
+
+	firstSampleDesc.Append(_L8("Bappea_V"));
+	firstSampleDesc.Append(PROFILER_GFC_SAMPLER_VERSION);
+	firstSampleDesc.Append(_L8("_GFC"));
+	firstSample[0] = firstSampleDesc.Size();
+
+	this->iSampleBuffer->AddSample(firstSample,(firstSample[0]+1));
+
+	LOGSTRING2("CProfilerGfcSampler<BufferSize> - exit",BufferSize);
+
+	return KErrNone;
+}
+
+template <int BufferSize>
+void DProfilerGfcSampler<BufferSize>::Sample()
+{
+	LOGSTRING2("CProfilerGfcSampler<%d>::Sample",BufferSize);	
+
+	TUint32 usr_mod_link_reg;
+
+	UsrModLr(&usr_mod_link_reg);
+
+	TUint32 pc(gppSamplerData->lastPcValue);
+	TUint32 lr(usr_mod_link_reg);
+	TUint32 sa(gppSamplerData->sampleNumber);
+
+	if(pc == gfcSample[0] && lr == gfcSample[1] && sa == gfcSample[2]+1)
+	{
+		// encode repeat
+		repeat++;
+		gfcSample[2] = sa;
+		LOGSTRING2("CProfilerGfcSampler<%d>::Sample - repeat",BufferSize);
+		return;
+	}
+	else if(repeat > 0)
+	{
+		TUint8 repeatSample[3];
+		repeatSample[0] = 0xff;
+		repeatSample[1] = (TUint8)(repeat>>8);
+		repeatSample[2] = (TUint8)repeat;
+		this->iSampleBuffer->AddSample(repeatSample,3);
+
+		LOGSTRING3("CProfilerGfcSampler<%d>::Sample - Encoded repeat %d",BufferSize,repeat);
+
+		repeat = 0;
+	}
+
+	TInt ptr(3);
+
+	// encode program counter value
+	if(pc>=gfcSample[0]) 
+	{
+		pc = (pc-gfcSample[0]);
+		encodedSample[0] = 0x80;
+	}
+	else 
+	{
+		pc = (gfcSample[0]-pc);
+		encodedSample[0] = 0x00;
+	}
+
+	if(pc <= (TUint32)0xff) 
+	{
+		encodedSample[0] |= 1;
+		encodedSample[ptr] = (TUint8)pc;ptr++;
+	}
+	else if(pc <= (TUint32)0xffff) 
+	{
+		encodedSample[0] |= 2;
+		encodedSample[ptr] = (TUint8)pc;ptr++;
+		encodedSample[ptr] = (TUint8)(pc>>8);ptr++;
+	}
+	else if(pc <= (TUint32)0xffffff) 
+	{
+		encodedSample[0] |= 3;
+		encodedSample[ptr] = (TUint8)pc;ptr++;
+		encodedSample[ptr] = (TUint8)(pc>>8);ptr++;
+		encodedSample[ptr] = (TUint8)(pc>>16);ptr++;
+	}
+	else 
+	{
+		encodedSample[0] |= 4;
+		encodedSample[ptr] = (TUint8)pc;ptr++;
+		encodedSample[ptr] = (TUint8)(pc>>8);ptr++;
+		encodedSample[ptr] = (TUint8)(pc>>16);ptr++;
+		encodedSample[ptr] = (TUint8)(pc>>24);ptr++;
+	}
+
+	// encode link register value
+	if(lr>=gfcSample[1]) 
+	{
+		lr = (lr-gfcSample[1]);
+		encodedSample[1] = 0x80;
+	}
+	else 
+	{
+		lr = (gfcSample[1]-lr);
+		encodedSample[1] = 0x00;
+	}
+
+	if(lr <= (TUint32)0xff) 
+	{
+		encodedSample[1] |= 1;
+		encodedSample[ptr] = (TUint8)lr;ptr++;
+	}
+	else if(lr <= (TUint32)0xffff) 
+	{
+		encodedSample[1] |= 2;
+		encodedSample[ptr] = (TUint8)lr;ptr++;
+		encodedSample[ptr] = (TUint8)(lr>>8);ptr++;
+	}
+	else if(lr <= (TUint32)0xffffff) 
+	{
+		encodedSample[1] |= 3;
+		encodedSample[ptr] = (TUint8)lr;ptr++;
+		encodedSample[ptr] = (TUint8)(lr>>8);ptr++;
+		encodedSample[ptr] = (TUint8)(lr>>16);ptr++;
+	}
+	else 
+	{
+		encodedSample[1] |= 4;
+		encodedSample[ptr] = (TUint8)lr;ptr++;
+		encodedSample[ptr] = (TUint8)(lr>>8);ptr++;
+		encodedSample[ptr] = (TUint8)(lr>>16);ptr++;
+		encodedSample[ptr] = (TUint8)(lr>>24);ptr++;
+	}
+	
+	// endcode sample number difference
+	if( (sa - gfcSample[2]) < (TUint8)0xff) 
+	{
+		encodedSample[2] = (sa-gfcSample[2]);
+	}
+	else
+	{
+		encodedSample[2] = 0xff;
+		encodedSample[ptr] = (TUint8)sa;ptr++;
+		encodedSample[ptr] = (TUint8)(sa>>8);ptr++;
+		encodedSample[ptr] = (TUint8)(sa>>16);ptr++;
+		encodedSample[ptr] = (TUint8)(sa>>24);ptr++;
+	}
+
+	// store the values for the next sample
+	gfcSample[0] = gppSamplerData->lastPcValue;
+	gfcSample[1] = usr_mod_link_reg;
+	gfcSample[2] = gppSamplerData->sampleNumber;
+	
+	this->iSampleBuffer->AddSample(encodedSample,ptr);
+
+	LOGSTRING3("CProfilerGfcSampler<%d>::Sample Size %d",BufferSize,ptr);
+
+	return;
+
+}
+
+template <int BufferSize>
+DProfilerGfcSampler<BufferSize>::~DProfilerGfcSampler()
+{
+	LOGSTRING2("CProfilerGfcSampler<%d>::~CProfilerGfcSampler",BufferSize);		
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/inc/GppSamplerImpl.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,251 @@
+/*
+* 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 PROFILER_GPP_SAMPLER_H
+#define PROFILER_GPP_SAMPLER_H
+
+#include "GeneralsConfig.h"
+
+#include <e32cmn.h>
+
+#include <piprofiler/ProfilerGenericClassesKrn.h>
+#include <piprofiler/ProfilerTraces.h>
+
+// for RPropertyRef
+#include <sproperty.h> 
+#include <e32cmn.h>
+
+/*
+ *	
+ *	GPP sampler definition
+ *	
+ */
+class DGppSamplerImpl //: public DBase
+{
+public:
+
+	DGppSamplerImpl();
+	~DGppSamplerImpl();
+
+	TUint8* EncodeTag(TUint8* aPtr);
+	TUint8* EncodeInt(TUint8* aPtr,TInt aValue);
+	TUint8* EncodeUint(TUint8* aPtr,TUint aValue);
+	TUint8* EncodeText(TUint8* aPtr, const TDesC& aDes);
+
+	TUint8* EncodeName(TUint8* aPtr, DObject& aObject,TUint32 id);
+	TUint8* EncodeThread(TUint8* aPtr, DThread& aThread);
+
+	TBool	IsaTaskKnown(TUint8 task);
+	TUint8* EncodeIsaTask(TUint8* aPtr, TUint task);
+	TUint8* EncodeIsaName(TUint8* aPtr, TUint task,TBool process);
+	
+	TUint8* EncodeRepeat(TUint8* aPtr);
+
+	TInt	CreateFirstSample();
+	TInt	SampleImpl();
+#ifdef __SMP__
+    TSpinLock* LockPtr();
+#endif
+    TInt    iGppSamplingPeriod;
+	TUint8	tempBuf[512];
+	TUint	iLastPc;
+	
+	TBool	iIsaSample;
+	TInt	knownIsaTasks[256];
+	TUint8	knownIsaTaskCount;
+	TInt*	isaOsTaskRunningAddr;
+	void	Reset();
+    TUint32 iSampleCount;
+#ifdef __SMP__
+    TInt        iCpuNumber;
+    TUint32     iStartTime;
+#endif	   
+	PROFILER_DEFINE_ISA_TASK_NAME_ARRAY
+
+private:
+	enum TState {EStop,ERunning,EStopping};
+
+	const TUint* iInterruptStack;
+	
+	TUint		iLastThread;
+	TUint		iRepeat;
+#ifndef __SMP__
+	TUint32 	iStartTime;
+#endif
+	RPropertyRef iIsaStartAddr;
+	RPropertyRef iIsaEndAddr;
+	RPropertyRef iIsaPluginStatus;
+	RPropertyRef iIsaOsTaskRunning;
+	TInt 		iIsaStatus;
+	TInt 		iIsaStart;
+	TInt 		iIsaEnd;
+	TUint32     iMask;
+	TUint32     iCpuSelector;
+};
+
+struct TProfilerGppSamplerData
+{
+//public:
+	TUint32		lastPcValue;
+	TUint32		sampleNumber;
+    TInt        samplingPeriod;
+};
+
+template <int BufferSize>
+class DProfilerGppSampler : public DProfilerGenericSampler<BufferSize>
+{
+public:
+#ifndef __SMP__
+	DProfilerGppSampler();
+#else
+    DProfilerGppSampler(TInt aCpuNumber);
+#endif
+	~DProfilerGppSampler();
+
+	struct TProfilerGppSamplerData* GetExportData();
+	void	Sample();
+	TInt	Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset);
+	TInt 	GetPeriod();
+	
+private:
+	DGppSamplerImpl gppSamplerImpl;
+	struct TProfilerGppSamplerData exportData;
+#ifdef __SMP__
+	TInt   iCpuNumber;
+#endif
+};
+
+/*
+ *	
+ *	GPP sampler implementation
+ *	
+ */
+#ifndef __SMP__
+template <int BufferSize>
+DProfilerGppSampler<BufferSize>::DProfilerGppSampler() :
+	DProfilerGenericSampler<BufferSize>(PROFILER_GPP_SAMPLER_ID) 
+    {
+	LOGSTRING2("CProfilerGppSampler<%d>::CProfilerGppSampler",BufferSize);
+    }
+#else
+template <int BufferSize>
+DProfilerGppSampler<BufferSize>::DProfilerGppSampler(TInt aCpuNumber) :
+    DProfilerGenericSampler<BufferSize>(PROFILER_GPP_SAMPLER_ID+(aCpuNumber*20)), iCpuNumber(aCpuNumber) 
+    {
+    LOGSTRING2("CProfilerGppSampler<%d>::CProfilerGppSampler",BufferSize);
+    }
+#endif
+
+template <int BufferSize>
+DProfilerGppSampler<BufferSize>::~DProfilerGppSampler()
+    {
+	LOGSTRING2("CProfilerGppSampler<%d>::~CProfilerGppSampler",BufferSize);		
+    }
+
+template <int BufferSize>
+TInt DProfilerGppSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
+        {
+	LOGSTRING2("CProfilerGppSampler<%d>::Reset - calling superclass reset",BufferSize);
+	DProfilerGenericSampler<BufferSize>::Reset(aStream, 0);
+	LOGSTRING2("CProfilerGppSampler<%d>::Reset - called superclass reset",BufferSize);
+
+	this->gppSamplerImpl.Reset();
+	
+#ifdef __SMP__
+	this->gppSamplerImpl.iCpuNumber = this->iCpuNumber;
+	
+	// set common start time for all CPU samplers
+	this->gppSamplerImpl.iStartTime = aSyncOffset;
+#endif
+	this->gppSamplerImpl.iGppSamplingPeriod = this->iSamplingPeriod;
+	this->gppSamplerImpl.iSampleCount = 0;
+	this->exportData.sampleNumber = 0;
+	this->exportData.lastPcValue = 0;
+    this->exportData.samplingPeriod = this->gppSamplerImpl.iGppSamplingPeriod;
+
+	TInt length = gppSamplerImpl.CreateFirstSample();
+	LOGSTRING3("CProfilerGPPSampler<%d>::Reset - got first sample, size %d",BufferSize,length);	
+	
+	this->iSampleBuffer->AddSample(gppSamplerImpl.tempBuf,length);
+
+	// check if sampling period > 1 ms
+	// NOTE: feature supported in Performance Investigator 2.01 and above
+	if(this->gppSamplerImpl.iGppSamplingPeriod > 1)
+	    {
+        // For Address/Thread (GPP) version 2.01 or above, the first word is the sampling period in milliseconds
+        TUint8* w = gppSamplerImpl.tempBuf;
+        
+        (*w++) = (this->gppSamplerImpl.iGppSamplingPeriod >> 24) & 0xFF;
+        (*w++) = (this->gppSamplerImpl.iGppSamplingPeriod >> 16) & 0xFF;
+        (*w++) = (this->gppSamplerImpl.iGppSamplingPeriod >>  8) & 0xFF;
+        (*w++) = (this->gppSamplerImpl.iGppSamplingPeriod) & 0xFF;
+        
+        this->iSampleBuffer->AddSample(gppSamplerImpl.tempBuf,4);
+	    }
+	
+	LOGSTRING2("CProfilerGPPSampler<%d>::Reset finished",BufferSize);
+	return KErrNone;
+    }
+
+template <int BufferSize>
+void DProfilerGppSampler<BufferSize>::Sample()
+    {
+	LOGSTRING2("CProfilerGppSampler<%d>::Sample",BufferSize);
+//	if(this->gppSamplerImpl.iSampleCount % 1000 == 0) 
+//	    {
+//#ifdef __SMP__
+//	    if(this->iCpuNumber == 0)  // print sample tick only from CPU 0 context
+//	        {
+//#endif
+//	        Kern::Printf(("PIPROF SAMPLE TICK, #%d"),exportData.sampleNumber);
+//#ifdef __SMP__
+//	        }
+//#endif
+//	    }
+	
+	TInt length(gppSamplerImpl.SampleImpl());
+
+    this->gppSamplerImpl.iSampleCount++;
+	this->exportData.sampleNumber += this->gppSamplerImpl.iGppSamplingPeriod;
+	this->exportData.lastPcValue = gppSamplerImpl.iLastPc;
+
+	if(length > 0)
+        {
+        this->iSampleBuffer->AddSample(gppSamplerImpl.tempBuf,length);
+        }
+
+	LOGSTRING3("CProfilerGppSampler<%d>::Sample - length %d",BufferSize,length);
+
+	return;
+    }
+
+
+template <int BufferSize>
+struct TProfilerGppSamplerData* DProfilerGppSampler<BufferSize>::GetExportData()
+    {
+	LOGSTRING2("CProfilerGppSampler<%d>::GetExportData",BufferSize);
+	return &(this->exportData);	
+    }
+
+template <int BufferSize>
+TInt DProfilerGppSampler<BufferSize>::GetPeriod()
+    {
+	return this->gppSamplerImpl.iGppSamplingPeriod;
+    }
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/inc/IttEventHandler.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* 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:  Event based ITT sampler skeleton copypasted from MemoryEventHandler.h
+*
+*/
+#include "IttSamplerImpl.h"
+
+#ifndef __PI_ITT_EVENT_HANDLER__
+#define __PI_ITT_EVENT_HANDLER__
+
+#include <piprofiler/ProfilerGenericClassesKrn.h>
+
+// CONSTANTS
+const TInt KITTBufferSize = 256;
+
+class DProfilerSampleBuffer;
+
+/*
+ * ITT event handler for listaning kernel events 
+ */
+class DIttEventHandler : public DKernelEventHandler
+    {
+public:
+    // constructor
+    DIttEventHandler(DProfilerSampleBuffer*  aSampleBuffer, TProfilerGppSamplerData* aGppSamplerDataIn);
+    TInt Create();
+    ~DIttEventHandler();
+    TInt Start();
+    TInt Stop();
+    TBool Tracking() {return iTracking;}
+       
+    TBool SampleNeeded();
+    
+private:
+    static TUint EventHandler(TKernelEvent aEvent, TAny* a1, TAny* a2, TAny* aThis);
+    TUint HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2);
+    // handle code segments
+    TBool HandleAddCodeSeg(DCodeSeg* aSeg);
+    TBool HandleRemoveCodeSeg(DCodeSeg* aSeg);
+
+private:
+    /** Lock serialising calls to event handler */
+        DMutex*     iLock;
+        TBool       iTracking;
+        DProfilerSampleBuffer*  iSampleBuffer;
+
+        TUint32     iCount;        
+        
+        TUint8      iSample[KITTBufferSize];
+        TPtr8       iSampleDescriptor;
+        TProfilerGppSamplerData*     gppSamplerData;
+    };
+
+#endif  //__PI_ITT_EVENT_HANDLER__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/inc/IttSamplerImpl.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,327 @@
+/*
+* 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 PROFILER_ITT_SAMPLER_H
+#define PROFILER_ITT_SAMPLER_H
+
+#include "GeneralsConfig.h"
+
+#include <kern_priv.h>
+
+#include <piprofiler/ProfilerGenericClassesKrn.h>
+#include <piprofiler/ProfilerTraces.h>
+#include "GppSamplerImpl.h"
+#include "IttEventHandler.h"
+
+// CONSTANTS
+const TInt KITTSampleBufferSize = 256;
+
+// flags
+#define ITT_EVENT_HANDLER   // enable event based ITT sampling
+
+/*
+ *	
+ *	ITT sampler definition
+ *	
+ */
+class DIttEventHandler;
+
+/*
+ * User side ITT sampler
+ */
+class IttSamplerImpl
+{
+public:
+	IttSamplerImpl();
+	~IttSamplerImpl();
+
+	TInt	SampleImpl(TUint32 pc,TUint32 sampleNum);
+	TBool	SampleNeeded(TUint32 sampleNum);
+	TInt 	CreateFirstSample();
+	void	Reset();
+	TInt    ProcessEvent();
+	
+	TUint8*         itt_sample;
+	TInt            iIttSamplingPeriod;
+	TInt            iIttSamplingPeriodDiv2;
+	TBool           iTimeToSample;
+#ifdef ITT_EVENT_HANDLER
+    TBool           iEventReceived;
+    TBool           iFirstSampleTaken;
+#endif
+	
+private:
+#ifdef ITT_EVENT_HANDLER    
+    TInt            iCount;
+#endif
+    TInt            currentLibCount;
+    TInt            currentProcCount;
+    
+	TUint8          sample[KITTSampleBufferSize ];
+	TPtr8           sampleDescriptor;
+		
+	TBuf8<64>		iVersionData;
+	SDblQue* 		codeSegList;
+
+};
+
+/*
+ * ITT sampler kernel part
+ * 
+ */
+template <int BufferSize>
+class DProfilerIttSampler : public DProfilerGenericSampler<BufferSize>
+{
+public:
+	DProfilerIttSampler(struct TProfilerGppSamplerData* gppSamplerDataIn);
+	~DProfilerIttSampler();
+
+	void	Sample();
+	TInt	Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset);
+	TInt	PostSample();
+	TBool	PostSampleNeeded();
+
+private:
+#ifdef ITT_EVENT_HANDLER
+    DIttEventHandler*               iEventHandler;
+#endif
+	IttSamplerImpl					ittSamplerImpl;
+	struct TProfilerGppSamplerData*     gppSamplerData;
+	TBool							sampleInProgress;
+	TBool							sampleNeeded;
+};
+
+/*  
+ *	ITT sampler implementation
+ *	
+ */ 
+template <int BufferSize>
+DProfilerIttSampler<BufferSize>::DProfilerIttSampler(struct TProfilerGppSamplerData* gppSamplerDataIn) :
+	DProfilerGenericSampler<BufferSize>(PROFILER_ITT_SAMPLER_ID)
+{
+	this->gppSamplerData = (struct TProfilerGppSamplerData*)gppSamplerDataIn;
+	this->sampleInProgress = false;
+	LOGSTRING2("CProfilerIttSampler<%d>::CProfilerIttSampler",BufferSize);	
+}
+
+/*
+ *  DProfilerIttSampler::Reset()
+ *  
+ *  @param DProfilerSampleStream* sample stream
+ *  @param TUint32 Offset 
+ */
+template <int BufferSize>
+TInt DProfilerIttSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
+{
+    Kern::Printf("DProfilerIttSampler<%d>::Reset - calling superclass reset",BufferSize);
+    DProfilerGenericSampler<BufferSize>::Reset(aStream);
+
+    // check if reset called in stop (by driver)
+    if(aSyncOffset != 999999)
+        {
+#ifdef ITT_EVENT_HANDLER
+        // Itt event handler
+        if(iEventHandler)
+            {
+            // stop previous sampling if still running
+            Kern::Printf("Stopping DIttEventHandler");
+            iEventHandler->Stop();
+            iEventHandler->Close();
+            iEventHandler = NULL;
+            }
+    
+        Kern::Printf("Initiating DIttEventHandler");
+        iEventHandler = new DIttEventHandler(this->iSampleBuffer, this->gppSamplerData);
+        if(iEventHandler)
+            {
+            Kern::Printf("Creating DIttEventHandler");
+            TInt err(iEventHandler->Create());
+            if(err != KErrNone)
+                {
+                Kern::Printf("Error in creation of DIttEventHandler, error %d", err);
+                return err;
+                }
+            }
+        else
+            {
+            Kern::Printf("Could not initiate DIttEventHandler");
+            return KErrGeneral;
+            }
+    
+        // set first sample at the 10 ms, should be enough
+        this->ittSamplerImpl.iIttSamplingPeriod = 10;
+#else
+        this->ittSamplerImpl.iIttSamplingPeriod = this->iSamplingPeriod;
+#endif
+        this->ittSamplerImpl.iIttSamplingPeriodDiv2 = (TInt)(this->ittSamplerImpl.iIttSamplingPeriod / 2);
+        LOGSTRING3("CProfilerIttSampler<%d>::Reset - set ITT sampling period to %d",
+                                BufferSize,this->ittSamplerImpl.iIttSamplingPeriod);
+        }
+    else
+        {
+        LOGSTRING2("DProfilerIttSampler<%d>::Reset - reset in stop", BufferSize);
+#ifdef ITT_EVENT_HANDLER
+        // destroy memory event handler
+        if(iEventHandler)
+            {
+            // stop previous sampling if still running
+            iEventHandler->Stop();
+            iEventHandler->Close();
+            iEventHandler = NULL;
+            }
+#endif
+        return KErrNone;    // return if reset called in stop
+        }
+
+    TInt length(ittSamplerImpl.CreateFirstSample());
+    this->iSampleBuffer->AddSample((TUint8*)&length,1);
+    this->iSampleBuffer->AddSample(ittSamplerImpl.itt_sample, length);
+    this->sampleInProgress = false;
+    this->sampleNeeded = false;
+    //LOGSTRING("DProfilerIttSampler::Reset - exit");
+	this->ittSamplerImpl.Reset();
+    return KErrNone;
+
+}
+
+/*
+ * DProfilerIttSampler::PostSample
+ * 
+ * Function for finishing sample
+ */
+template <int BufferSize> 
+TInt DProfilerIttSampler<BufferSize>::PostSample()
+{
+#ifdef ITT_EVENT_HANDLER
+    if(!ittSamplerImpl.iFirstSampleTaken)   // if we haven't read the initial state
+    {
+#endif
+        if(sampleNeeded)
+        {
+            this->sampleNeeded = false;
+            //LOGSTRING3("CProfilerIttSampler<%d>::PostSample - state %d",BufferSize,this->iSampleBuffer->GetBufferStatus());
+            //Kern::Printf("DProfilerIttSampler<%d>::PostSample - state %d",BufferSize,this->iSampleBuffer->GetBufferStatus());
+    
+            TInt length = this->ittSamplerImpl.SampleImpl(this->gppSamplerData->lastPcValue,
+                                                          this->gppSamplerData->sampleNumber);
+            if(length != 0)
+            {		
+                LOGSTRING("ITT sampler PostSample - starting to sample");
+    
+                while(length > 0)
+                {
+                    this->iSampleBuffer->AddSample(ittSamplerImpl.itt_sample,length);
+                    length = this->ittSamplerImpl.SampleImpl( this->gppSamplerData->lastPcValue,
+                                                          this->gppSamplerData->sampleNumber );	
+                    if(length == 0) 
+                    {
+                        LOGSTRING("MEM sampler PostSample - all samples generated!");
+                    }
+                }
+                LOGSTRING("ITT sampler PostSample - finished sampling");
+            }
+            this->sampleInProgress = false;
+        }
+#ifdef ITT_EVENT_HANDLER
+    }   
+        if(!iEventHandler->Tracking())
+            {
+            iEventHandler->Start();
+            Kern::Printf("DProfilerITTSampler<%d>::PostSample - ITT handler started",BufferSize);
+            }
+
+#endif    
+	
+    LOGSTRING2("ITT sampler PostSample - finished sampling, time: %d", gppSamplerData->sampleNumber);
+    
+	// finally perform superclass postsample
+	TInt i(this->DProfilerGenericSampler<BufferSize>::PostSample());
+	return i;
+}
+
+/*
+ *  DProfilerIttSampler::PostSampleNeeded()
+ *  
+ *  Function for deciding if sample handling is needed 
+ */
+template <int BufferSize> 
+TBool DProfilerIttSampler<BufferSize>::PostSampleNeeded()
+{
+	LOGSTRING3("CProfilerIttSampler<%d>::PostSampleNeeded - state %d",BufferSize,this->iSampleBuffer->GetBufferStatus());
+
+	TUint32 status = this->iSampleBuffer->iBufferStatus;
+
+	if(status == DProfilerSampleBuffer::BufferCopyAsap || status == DProfilerSampleBuffer::BufferFull || this->sampleNeeded == true)
+	{
+		return true;
+	}
+	
+	return false;
+}
+
+/*
+ * DProfilerIttSampler::Sample
+ * 
+ * Function for initiating sampling
+ */
+template <int BufferSize>
+void DProfilerIttSampler<BufferSize>::Sample()
+{
+	LOGSTRING2("CProfilerIttSampler<%d>::Sample",BufferSize);	
+	
+	//#ifdef ITT_TEST
+	LOGSTRING2("CProfilerIttSampler<%d>::Sample",BufferSize);	
+	
+	if(ittSamplerImpl.SampleNeeded(this->gppSamplerData->sampleNumber) && this->sampleInProgress == false) 
+	{
+		this->sampleInProgress = true;
+		this->sampleNeeded = true;
+
+		LOGSTRING2("CProfilerIttSampler<%d>::Sample - sample needed",BufferSize);	
+	}	
+#ifdef ITT_EVENT_HANDLER
+    // call this to increase the time stamp
+    else if(iEventHandler->SampleNeeded())
+        {
+        // set the flag for post sampling
+        this->sampleNeeded = true;
+        }
+#endif
+
+	LOGSTRING2("CProfilerIttSampler<%d>::Sample",BufferSize);
+	return;
+}
+
+/*
+ * Destructor
+ */
+template <int BufferSize>
+DProfilerIttSampler<BufferSize>::~DProfilerIttSampler()
+{
+	LOGSTRING2("CProfilerIttSampler<%d>::~CProfilerIttSampler",BufferSize);
+#ifdef ITT_EVENT_HANDLER
+     if(iEventHandler)
+         {
+         // stop previous sampling if still running
+         iEventHandler->Stop();
+         iEventHandler->Close();
+         iEventHandler = NULL;
+         }
+#endif
+}
+#endif
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/inc/MemSamplerImpl.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,427 @@
+/*
+* 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 PROFILER_MEM_SAMPLER_H
+#define PROFILER_MEM_SAMPLER_H
+
+#include "GeneralsConfig.h"
+
+#include <kern_priv.h>
+
+#include <piprofiler/ProfilerGenericClassesKrn.h>
+#include <piprofiler/ProfilerTraces.h>
+#include "GppSamplerImpl.h"
+#include "MemoryEventHandler.h"
+#include <e32btrace.h>
+
+
+// constants
+// defines the maximum thread amount that is assumed to
+// be possible with MEM trace
+const TInt KSampleBufferSize = 257;
+const TInt KProfilerMaxThreadsAmount = 512;
+const TInt KProfilerMaxChunksAmount = 1024;
+const TInt KProfilerMaxLibrariesAmount = 1024;
+const TInt KProfilerTotalMemorySamplePeriod = 100;
+
+// flags
+#define MEM_EVENT_HANDLER
+//#define MEM_EVENT_HANDLER_LIBRARY_EVENTS
+
+/*
+ *	
+ *	MEM sampler definition
+ *	
+ */
+
+class DMemoryEventHandler;
+
+class DMemSamplerImpl //: public DBase
+{
+public:
+	enum EProcessingState
+	{
+		EStartingToProcess,
+		EProcessingNames,
+		EProcessingData,
+		ENothingToProcess
+	};
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+	enum ESampleType
+	{
+	    ESampleChunks,
+	    ESampleThreads,
+	    ESampleLibraries
+	};
+#endif
+
+	DMemSamplerImpl();
+	~DMemSamplerImpl();
+
+	TInt	CreateFirstSample();
+	TInt	SampleImpl();
+	TBool	SampleNeeded();
+	void	Reset();
+	TInt	ProcessChunks();
+	TInt    ProcessThreads();
+    TInt    GatherChunks();
+    TInt    GatherThreads();
+
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+    TInt    GatherLibraries();
+    TInt    ProcessLibraries();
+#endif
+    
+	TInt	EncodeChunkData(DChunk& chunk);
+	TInt	EncodeChunkName(DChunk& chunk);
+	TInt	EncodeChunkData(DThread& thread);
+	TInt	EncodeChunkName(DThread& thread);
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+	TInt    EncodeChunkData(DLibrary& library);
+	TInt    EncodeChunkName(DLibrary& library);
+#endif
+
+	TInt 	EncodeTotalMemoryName();
+	TInt 	EncodeTotalMemory();
+	
+	TInt	EncodeNameCode();
+	TInt	EncodeDataCode();
+
+	DChunk*		heapChunksToSample[KProfilerMaxChunksAmount];
+	DChunk*		heapChunkNamesToReport[KProfilerMaxChunksAmount];
+	TInt		iCount;
+	TInt		iChunkCount;
+	TInt		iNewChunkCount;
+	TBuf8<0x50> name;
+	DThread*	threadsToSample[KProfilerMaxThreadsAmount];
+	DThread*	threadNamesToReport[KProfilerMaxThreadsAmount];
+	TInt		iThreadCount;
+	TInt		iNewThreadCount;
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+	DLibrary*   librariesToSample[KProfilerMaxLibrariesAmount];
+	DLibrary*   libraryNamesToReport[KProfilerMaxLibrariesAmount];
+	TInt        iLibraryCount;
+	TInt        iNewLibraryCount;
+	TInt        iLibrariesProcessing;
+#endif
+
+	TInt		iChunksProcessing;
+    TInt        iThreadsProcessing;
+	TInt		iMemSamplingPeriod;
+	TInt		iMemSamplingPeriodDiv2;
+	TInt        iMemSamplingPeriodDiv3;
+	
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+	ESampleType iSampleType;
+#else
+	TBool		iSampleThreads;
+#endif	
+	
+	TBool       iTimeToSample;
+	
+	TBool 		iTotalMemoryOk;
+	TBool		iTotalMemoryNameOk;
+
+	TUint8		sample[KSampleBufferSize];
+	TPtr8		sampleDescriptor;
+	
+	// test
+#ifdef MEM_EVENT_HANDLER
+//	DMemoryEventHandler*   iEventHandler;
+	TBool      iChunksGathered;
+	TBool      iThreadsGathered;
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+	TBool      iLibrariesGathered;
+#endif
+#endif
+};
+
+
+template <int BufferSize>
+class DProfilerMemSampler : public DProfilerGenericSampler<BufferSize>
+{
+public:
+	DProfilerMemSampler(struct TProfilerGppSamplerData*, TInt id);
+	~DProfilerMemSampler();
+
+	void	Sample();
+	TInt	Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset);
+	TInt	PostSample();
+	TBool	PostSampleNeeded();
+	
+private:
+#ifdef MEM_EVENT_HANDLER
+    DMemoryEventHandler*               iEventHandler;
+#endif
+	DMemSamplerImpl			           memSamplerImpl;
+	struct TProfilerGppSamplerData*    gppSamplerData;
+	TBool                              sampleNeeded;
+};
+
+/*
+ *	
+ *	MEM sampler implementation
+ *	
+ */
+
+template <int BufferSize>
+DProfilerMemSampler<BufferSize>::DProfilerMemSampler(struct TProfilerGppSamplerData* gppSamplerDataIn, TInt id) :
+	DProfilerGenericSampler<BufferSize>(PROFILER_MEM_SAMPLER_ID)
+    {
+    LOGSTRING2("DProfilerMemSampler<%d>::CProfilerMemSampler",BufferSize);
+	this->gppSamplerData = gppSamplerDataIn;
+	this->iSamplingPeriod = 3000;	// set default setting
+    }
+
+template <int BufferSize>
+TInt DProfilerMemSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
+    {
+//#ifdef MEM_EVENT_HANDLER
+//    Kern::Printf("DProfilerMemSampler<%d>::Reset - calling superclass reset",BufferSize);
+    
+//#endif
+    // check if reset called in stop (by driver)
+    if(aSyncOffset != 999999)
+        {
+        DProfilerGenericSampler<BufferSize>::Reset(aStream);
+        memSamplerImpl.Reset();
+
+#ifdef MEM_EVENT_HANDLER
+        // reset member variables
+        this->memSamplerImpl.iThreadsGathered = false;
+        this->memSamplerImpl.iChunksGathered = false;
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+        this->memSamplerImpl.iLibrariesGathered = false;
+#endif
+        
+        // memory event handler
+        if(iEventHandler)
+            {
+            // stop previous sampling if still running
+//            Kern::Printf("Stopping DMemoryEventHandler");
+            iEventHandler->Stop();
+            iEventHandler->Close();
+            iEventHandler = NULL;
+            }
+    
+//        Kern::Printf("Initiating DMemoryEventHandler");
+        iEventHandler = new DMemoryEventHandler(this->iSampleBuffer);
+        if(iEventHandler)
+            {
+//            Kern::Printf("Creating DMemoryEventHandler");
+            TInt err(iEventHandler->Create());
+            if(err != KErrNone)
+                {
+                Kern::Printf("Error in creation of DMemoryEventHandler, error %d", err);
+                return err;
+                }
+            }
+        else
+            {
+            Kern::Printf("Could not initiate DMemoryEventHandler");
+            return KErrGeneral;
+            }
+    
+        // set first chunk&thread memory lookup at the 5 ms, should be enough
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+        this->memSamplerImpl.iMemSamplingPeriod = 45;
+#else
+        this->memSamplerImpl.iMemSamplingPeriod = 10;
+#endif
+        
+#else
+        this->memSamplerImpl.iMemSamplingPeriod = this->iSamplingPeriod;
+#endif
+        this->memSamplerImpl.iMemSamplingPeriodDiv2 = (TInt)(this->memSamplerImpl.iMemSamplingPeriod / 2);
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+        this->memSamplerImpl.iMemSamplingPeriodDiv3 = (TInt)(this->memSamplerImpl.iMemSamplingPeriod / 3);
+#endif
+	
+        LOGSTRING3("CProfilerMemSampler<%d>::Reset - set mem sampling period to %d",
+                                BufferSize,this->memSamplerImpl.iMemSamplingPeriod);
+        }
+	else
+        {
+        LOGSTRING2("DProfilerMemSampler<%d>::Reset - reset in stop", BufferSize);
+#ifdef MEM_EVENT_HANDLER
+        // destroy memory event handler
+        if(iEventHandler)
+            {
+            // stop previous sampling if still running
+//            Kern::Printf("Stopping DMemoryEventHandler");
+            iEventHandler->Stop();
+            iEventHandler->Close();
+            iEventHandler = NULL;
+            }
+#endif
+        return KErrNone;    // return if reset called in stop
+        }
+
+	// add MEM sample header
+	TInt length(memSamplerImpl.CreateFirstSample());
+	this->iSampleBuffer->AddSample(memSamplerImpl.sample,length);
+	
+	this->sampleNeeded = false;
+	LOGSTRING("DProfilerMemSampler::Reset - exit");
+	return KErrNone;
+    }
+
+template <int BufferSize> 
+TInt DProfilerMemSampler<BufferSize>::PostSample()
+    {
+    this->sampleNeeded = false;
+
+    LOGSTRING3("DProfilerMemSampler<%d>::PostSample - state %d",BufferSize,this->iSampleBuffer->GetBufferStatus());
+    
+#ifdef MEM_EVENT_HANDLER
+    // check if all threads and chunks (and libraries) are gathered
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+    if(!memSamplerImpl.iThreadsGathered || !memSamplerImpl.iChunksGathered || !memSamplerImpl.iLibrariesGathered)
+#else
+    if(!memSamplerImpl.iThreadsGathered || !memSamplerImpl.iChunksGathered)
+#endif
+        {
+#endif
+        // disable interrupts for checking the kernel containers (EChunk, EThread)
+//        TInt interruptLevel(NKern::DisableInterrupts(0));
+        
+        // first collect chunk data
+        TInt length(this->memSamplerImpl.SampleImpl());
+        if(length != 0)
+            {
+            // then, encode the sample to the buffer until no further data available
+            while(length > 0)
+                {
+                this->iSampleBuffer->AddSample(memSamplerImpl.sample,length);
+                length = this->memSamplerImpl.SampleImpl();
+                
+                // indicate that the whole MEM sample ends by having a 0x00 in the end
+                if(length == 0)
+                    {
+                    TUint8 number(0);
+                    LOGSTRING("MEM sampler PostSample - all samples generated!");
+                    
+                    this->iSampleBuffer->AddSample(&number,1);
+                    LOGSTRING2("MEM sampler PostSample - end mark added, time: %d", gppSamplerData->sampleNumber);
+                    }
+                } 
+            }
+        // restore interrupts and continue normal execution
+//        NKern::RestoreInterrupts(interruptLevel);
+#ifdef MEM_EVENT_HANDLER
+    }
+    // check if all threads and chunks are gathered
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+    if(memSamplerImpl.iThreadsGathered && memSamplerImpl.iChunksGathered && memSamplerImpl.iLibrariesGathered)
+#else
+    if(memSamplerImpl.iThreadsGathered && memSamplerImpl.iChunksGathered)
+#endif
+        {
+        // start memory event tracking after checking the current memory status
+        if(!iEventHandler->Tracking())
+            {
+            iEventHandler->Start();
+//            Kern::Printf("DProfilerMemSampler<%d>::PostSample - memory event handler started",BufferSize);
+            }
+        
+        }
+#endif
+    
+    LOGSTRING2("MEM sampler PostSample - finished sampling, time: %d", gppSamplerData->sampleNumber);
+    
+    // finally perform superclass postsample
+	TInt i(this->DProfilerGenericSampler<BufferSize>::PostSample());
+	return i;
+    }
+
+template <int BufferSize> 
+TBool DProfilerMemSampler<BufferSize>::PostSampleNeeded()
+    {
+	LOGSTRING3("DProfilerMemSampler<%d>::PostSampleNeeded - state %d",BufferSize,this->iSampleBuffer->GetBufferStatus());
+
+	TUint32 status(this->iSampleBuffer->iBufferStatus);
+
+	if(status == DProfilerSampleBuffer::BufferCopyAsap || status == DProfilerSampleBuffer::BufferFull || this->sampleNeeded == true)
+	    {
+		return true;
+	    }
+	
+	return false;
+    }
+
+template <int BufferSize>
+void DProfilerMemSampler<BufferSize>::Sample()
+    {
+    LOGSTRING2("DProfilerMemSampler<%d>::Sample",BufferSize);	
+
+    // check if sample is needed, i.e. the sampling interval is met
+	if(memSamplerImpl.SampleNeeded()) 
+	    {
+        // set the flag for post sampling
+		this->sampleNeeded = true;
+
+		// start the MEM sample with the sample time
+		TUint8 number(4);    // mem sampler id
+		this->iSampleBuffer->AddSample(&number,1);
+		this->iSampleBuffer->AddSample((TUint8*)&(gppSamplerData->sampleNumber),4);
+
+		// leave the rest of the processing for PostSample()
+	    }	
+	
+#ifdef MEM_EVENT_HANDLER
+	// call this to increase the time stamp
+	else if(iEventHandler->SampleNeeded())
+	    {
+        // set the flag for post sampling
+        this->sampleNeeded = true;
+	    }
+	
+//	// check if time stamp is divibable with 
+//	if((memSamplerImpl.iCount % KProfilerTotalMemorySamplePeriod) == 0 && 
+//	        memSamplerImpl.iCount > 0)
+//	    {
+//        // sample total memory once per 100 ms 
+//        memSamplerImpl.EncodeTotalMemory();
+//
+//        // add end mark
+//        TUint8 number(0);
+//        this->iSampleBuffer->AddSample(&number,1);
+//	    }
+#endif
+	
+	LOGSTRING2("CProfilerMemSampler<%d>::Sample",BufferSize);
+	return;
+    }
+
+template <int BufferSize>
+DProfilerMemSampler<BufferSize>::~DProfilerMemSampler()
+    {
+	LOGSTRING2("CProfilerMemSampler<%d>::~CProfilerMemSampler",BufferSize);		
+#ifdef MEM_EVENT_HANDLER
+    // memory event handler
+     if(iEventHandler)
+         {
+         // stop previous sampling if still running
+//         Kern::Printf("Stopping DMemoryEventHandler");
+         iEventHandler->Stop();
+         iEventHandler->Close();
+         iEventHandler = NULL;
+         }
+#endif
+    }
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/inc/MemoryEventHandler.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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 "MemSamplerImpl.h"
+
+#ifndef __PI_MEMORY_EVENT_HANDLER__
+#define __PI_MEMORY_EVENT_HANDLER__
+
+#include <piprofiler/ProfilerGenericClassesKrn.h>
+
+// CONSTANTS
+const TInt KEventBufferSize = 257;
+
+class DProfilerSampleBuffer;
+
+class DMemoryEventHandler : public DKernelEventHandler
+    {
+public:
+    // constructor
+    DMemoryEventHandler(DProfilerSampleBuffer*  aSampleBuffer);
+    TInt Create();
+    ~DMemoryEventHandler();
+    TInt Start();
+    TInt Stop();
+    TBool Tracking() {return iTracking;}
+       
+    TBool SampleNeeded();
+    
+private:
+    static TUint EventHandler(TKernelEvent aEvent, TAny* a1, TAny* a2, TAny* aThis);
+    TUint HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2);
+    // handle chunk activity
+    TBool HandleAddChunk(DChunk* aChunk);
+    TBool HandleUpdateChunk(DChunk* aChunk);
+    TBool HandleDeleteChunk(DChunk* aChunk);
+    // handle chunk activity
+    TBool HandleAddThread(DThread* aThread);
+    TBool HandleUpdateThread(DThread* aThread);
+    TBool HandleDeleteThread(DThread* aThread);
+    // handle chunk activity
+    TBool HandleAddProcess(DProcess* aProcess);
+    TBool HandleUpdateProcess(DProcess* aProcess);
+    TBool HandleDeleteProcess(DProcess* aProcess);
+    // handle library activity
+    TBool HandleAddLibrary(DLibrary* aLibrary, DThread* aThread);
+    TBool HandleDeleteLibrary(DLibrary* aLibrary);
+    
+    // data handling
+    TInt AddHeader();
+    TInt AddFooter();
+    TInt EncodeTotalMemory();
+    TInt EncodeNameCode();
+    TInt EncodeNewCode();
+    TInt EncodeUpdateCode();
+    TInt EncodeRemoveCode();
+    TInt EncodeChunkName(DThread& t);
+    TInt EncodeChunkName(DChunk& c);
+    TInt EncodeChunkName(DLibrary& l);
+    TInt EncodeChunkData(DThread& t);
+    TInt EncodeChunkData(DChunk& c);
+    TInt EncodeChunkData(DLibrary& l, DThread& t);
+private:
+    /** Lock serialising calls to event handler */
+    DMutex* iLock;
+    TBool iTracking;
+
+    DProfilerSampleBuffer*  iSampleBuffer;
+    TInt iCounters[EEventLimit];
+    
+    TUint32     iCount;
+    
+    TUint8      iSample[KEventBufferSize];
+    TPtr8       iSampleDescriptor;
+    
+    TUint32     iPreviousCount;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/inc/PriSamplerImpl.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,245 @@
+/*
+* 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 PROFILER_PRI_SAMPLER_H
+#define PROFILER_PRI_SAMPLER_H
+
+#include "GeneralsConfig.h"
+
+#include <kern_priv.h>
+
+#include <piprofiler/ProfilerGenericClassesKrn.h>
+#include <piprofiler/ProfilerTraces.h>
+#include "GppSamplerImpl.h"
+
+// defines the maximum thread amount that is assumed to
+// be possible with PRI trace
+const TInt KProfilerMaxThreadAmount = 512;
+
+/*
+ *	
+ *	PRI sampler definition
+ *	
+ */
+
+class DPriSamplerImpl //: public DBase
+{
+public:
+	enum EProcessingState
+	{
+		EStartingToProcess,
+		EProcessingNames,
+		EProcessingData,
+		ENothingToProcess
+	};
+
+	DPriSamplerImpl();
+	~DPriSamplerImpl();
+
+	TInt	CreateFirstSample();
+	TInt	SampleImpl();
+	TBool	SampleNeeded();
+	void	Reset();
+	TInt	ProcessChunks();
+
+	TInt	EncodeChunkData(DThread& thread);
+	TInt	EncodeChunkName(DThread& thread);
+	
+	TInt	EncodeNameCode();
+	TInt	EncodeDataCode();
+
+	TInt		iCountti;
+	DThread*	threadsToSample[KProfilerMaxThreadAmount];
+	DThread*	threadNamesToReport[KProfilerMaxThreadAmount];
+
+	TInt		iThreadCount;
+	TInt		iNewThreadCount;
+
+	TInt		iProcessing;
+	TInt		iPriSamplingPeriod;
+
+	TUint8		sample[257];
+	TPtr8		sampleDescriptor;
+#ifdef __SMP__
+    TInt        iCpuNumber;
+    TUint32     iStartTime;
+#endif   
+
+};
+
+template <int BufferSize>
+class DProfilerPriSampler : public DProfilerGenericSampler<BufferSize>
+{
+public:
+	DProfilerPriSampler(struct TProfilerGppSamplerData*, TInt id);
+	~DProfilerPriSampler();
+
+	void	Sample();
+	TInt	Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset);
+	TInt	PostSample();
+	TBool	PostSampleNeeded();
+
+private:
+	DPriSamplerImpl				 	priSamplerImpl;
+	struct TProfilerGppSamplerData* 	    gppSamplerData;
+	TBool						 	sampleNeeded;
+	TBool							sampleInProgress;
+#ifdef __SMP__
+    TInt   iCpuNumber;
+#endif
+};
+
+/*
+ *	
+ *	PRI sampler implementation
+ *	
+ */
+//#ifndef __SMP__
+template <int BufferSize>
+DProfilerPriSampler<BufferSize>::DProfilerPriSampler(struct TProfilerGppSamplerData* gppSamplerDataIn, TInt id) :
+	DProfilerGenericSampler<BufferSize>(PROFILER_PRI_SAMPLER_ID)
+    {
+	LOGSTRING2("CProfilerPriSampler<%d>::CProfilerPriSampler",BufferSize);
+	this->gppSamplerData = gppSamplerDataIn;
+	this->sampleInProgress = false;
+	this->iSamplingPeriod = 3000;	// set default setting
+    }
+//#else
+//template <int BufferSize>
+//DProfilerPriSampler<BufferSize>::DProfilerPriSampler(struct TProfilerGppSamplerData* gppSamplerDataIn, TInt id, TInt aCpuNumber) :
+//    DProfilerGenericSampler<BufferSize>(PROFILER_PRI_SAMPLER_ID+(aCpuNumber*20)), iCpuNumber(aCpuNumber) 
+//    {
+//    LOGSTRING2("CProfilerGppSampler<%d>::CProfilerGppSampler",BufferSize);
+//    }
+//#endif
+
+template <int BufferSize>
+TInt DProfilerPriSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
+    {
+	LOGSTRING2("CProfilerPriSampler<%d>::Reset - calling superclass reset",BufferSize);
+	DProfilerGenericSampler<BufferSize>::Reset(aStream);
+	LOGSTRING2("CProfilerPriSampler<%d>::Reset - called superclass reset",BufferSize);
+	priSamplerImpl.Reset();
+
+#ifdef __SMP__
+//    this->priSamplerImpl.iCpuNumber = this->iCpuNumber;
+//    
+//    // set common start time for all CPU samplers
+//    this->priSamplerImpl.iStartTime = aSyncOffset;
+#endif
+	this->priSamplerImpl.iPriSamplingPeriod = this->iSamplingPeriod;
+
+
+	LOGSTRING3("CProfilerPriSampler<%d>::Reset - set pri sampling period to", 
+							BufferSize,this->priSamplerImpl.iPriSamplingPeriod);
+
+	TInt length(priSamplerImpl.CreateFirstSample());
+	this->iSampleBuffer->AddSample(priSamplerImpl.sample,length);
+
+	this->sampleInProgress = false;	
+	this->sampleNeeded = false;
+
+	return KErrNone;
+    }
+
+template <int BufferSize> 
+TInt DProfilerPriSampler<BufferSize>::PostSample()
+    {
+	if(sampleNeeded)
+	    {
+		this->sampleNeeded = false;
+
+		LOGSTRING3("CProfilerPriSampler<%d>::PostSample - state %d",BufferSize,this->sampleBuffer->GetBufferStatus());
+		
+		//TInt interruptLevel = NKern::DisableInterrupts(0);
+		
+		TInt length(this->priSamplerImpl.SampleImpl());
+		if(length != 0)
+		    {
+			LOGSTRING("PRI sampler PostSample - starting to sample");
+
+			// then, encode the sample to the buffer
+			while(length > 0)
+			    {
+			    this->iSampleBuffer->AddSample(priSamplerImpl.sample,length);
+				length = this->priSamplerImpl.SampleImpl();
+				// indicate that the whole PRI sample ends by having a 0x00 in the end
+				if(length == 0)
+				    {
+					TUint8 number(0);
+					LOGSTRING("PRI sampler PostSample - all samples generated!");
+					
+					this->iSampleBuffer->AddSample(&number,1);
+					LOGSTRING("PRI sampler PostSample - end mark added");
+                    }
+			    }
+			LOGSTRING("PRI sampler PostSample - finished sampling");
+		    }
+		this->sampleInProgress = false;
+		
+		//NKern::RestoreInterrupts(interruptLevel);
+	    }
+	
+	// finally perform superclass postsample
+	TInt i(this->DProfilerGenericSampler<BufferSize>::PostSample());
+	return i; 
+    }
+
+template <int BufferSize> 
+TBool DProfilerPriSampler<BufferSize>::PostSampleNeeded()
+    {
+	LOGSTRING3("CProfilerPriSampler<%d>::PostSampleNeeded - state %d",BufferSize,this->sampleBuffer->GetBufferStatus());
+
+	TUint32 status = this->iSampleBuffer->iBufferStatus;
+
+	if(status == DProfilerSampleBuffer::BufferCopyAsap || status == DProfilerSampleBuffer::BufferFull || this->sampleNeeded == true)
+	    {
+		return true;
+	    }
+	
+	return false;
+    }
+
+
+template <int BufferSize>
+void DProfilerPriSampler<BufferSize>::Sample()
+    {
+	LOGSTRING2("CProfilerPriSampler<%d>::Sample",BufferSize);	
+	
+	if(priSamplerImpl.SampleNeeded() && this->sampleInProgress == false) 
+	    {
+		this->sampleInProgress = true;
+		this->sampleNeeded = true;
+		// start the PRI sample with the sample time
+		TUint8 number(4);
+		this->iSampleBuffer->AddSample(&number,1);
+		this->iSampleBuffer->AddSample((TUint8*)&(gppSamplerData->sampleNumber),4);
+
+		// leave the rest of the processing for PostSample()
+	    }	
+
+	LOGSTRING2("CProfilerPriSampler<%d>::Sample",BufferSize);
+	return;
+    }
+
+template <int BufferSize>
+DProfilerPriSampler<BufferSize>::~DProfilerPriSampler()
+    {
+	LOGSTRING2("CProfilerPriSampler<%d>::~CProfilerPriSampler",BufferSize);		
+    }
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/src/GeneralsDriver.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,1152 @@
+/*
+* 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:  
+*
+*/
+
+
+//
+// LDD for thread time profiling
+//
+
+#include <kern_priv.h>
+#include <platform.h>
+#include <arm.h>
+
+#ifdef __SMP__
+#include <assp/naviengine/naviengine.h> 
+#include <nkernsmp/arm/arm_gic.h>
+#include <nkernsmp/arm/arm_tmr.h>
+#endif
+
+#include "GeneralsDriver.h"
+#include <piprofiler/PluginDriver.h>
+#include <piprofiler/PluginSampler.h>
+#include <piprofiler/ProfilerTraces.h>
+
+#include "GppSamplerImpl.h"
+#include "GfcSamplerImpl.h"
+#include "IttSamplerImpl.h"
+#include "MemSamplerImpl.h"
+#include "PriSamplerImpl.h"
+
+
+#ifndef __SMP__
+extern TUint* IntStackPtr();
+extern void UsrModLr(TUint32*);
+#endif
+// for security check
+#define KProfilerExeSecurUid 0x2001E5AD
+static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
+static _LIT_SECURITY_POLICY_FAIL( KDenyAllPolicy );
+
+#define SEPARATE_DFC_QUEUE
+// CONSTANTS
+
+//_LIT(DProfilerThread,"DProfilerThread");
+//const TInt KDProfilerThreadPriority = 27;
+
+#ifdef SEPARATE_DFC_QUEUE
+const TInt KGeneralsDriverThreadPriority = 24;
+_LIT(KGeneralsDriverThread, "PIGeneralsDriver");
+
+#endif
+
+// global Dfc Que
+//TDynamicDfcQue* gDfcQ;
+
+//#ifdef __SMP__
+//
+//enum  TNaviEngineAsspInterruptIdExtension
+//{
+//    KIntProfilerBase = 99      //  Sampling profiler interrupt base. 
+//    //  Each CPU is assigned a sampling interrupt from this base
+//    //  CPU-0's sampling interrupt is KIntIdSamplingBase + 0
+//    //  CPU-n's sampling interrupt is KIntIdSamplingBase + n
+//};
+//#endif
+
+/*
+ *
+ *
+ *	Class DGfcProfilerFactory definition
+ *
+ *
+ */
+
+class DGeneralsProfilerFactory : public DLogicalDevice
+{
+	public:
+		DGeneralsProfilerFactory();
+		~DGeneralsProfilerFactory();
+
+	public:
+		virtual TInt Install();
+		virtual void GetCaps(TDes8& aDes) const;
+		virtual TInt Create(DLogicalChannelBase*& aChannel);
+};
+
+/*
+ *
+ *
+ *	Class DGfcDriver definition
+ *
+ *
+ */
+class DPluginDriver;
+
+class DGeneralsDriver : public DPluginDriver
+{
+
+public:
+	DGeneralsDriver();
+	~DGeneralsDriver();
+
+private:
+	TInt					NewStart(TInt aRate);
+	static void				NewDoProfilerProfile(TAny*);
+	static void				NewDoDfc(TAny*);
+	
+	// called by each core
+	static void				Sample(TAny*);
+
+	TInt					GetSampleTime(TUint32* time);
+	//TInt					Test(TUint32 testCase); 
+
+	TInt					StartSampling();
+	TInt                    StopSampling();
+
+	void					InitialiseSamplerList(); 
+
+	DProfilerSamplerBase*	GetSamplerForId(TInt samplerId);
+	TInt					GetSamplerVersion(TDes* aDes);
+	
+#ifdef __SMP__
+	void                    UnbindInterrupts();
+#endif
+	TInt					ProcessStreamReadRequest(TBapBuf* aBuf,TRequestStatus* aStatus);
+
+	TInt					MarkTraceActive(TInt samplerIdToActivate);
+	TInt					MarkTraceInactive(TInt samplerIdToDisable);
+	TInt					OutputSettingsForTrace(TInt samplerId,TInt settings);
+	TInt					AdditionalTraceSettings(TInt samplerId,TInt settings);
+	TInt					AdditionalTraceSettings2(TInt samplerId,TInt settings);
+	TInt					SetSamplingPeriod(TInt /*samplerId*/,TInt settings);
+private:
+	// create the driver in EKA-2 version
+	TInt			        DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
+
+	// receive commands and control in EKA-2 version
+	void					HandleMsg(TMessageBase* aMsg);
+private:
+	// timer mechanism in EKA-2 version
+	NTimer						iTimer;
+	TDfc						iNewDfc;
+	TInt						iCount;
+	TInt						iLastPcVal;					
+	TInt						iPeriod;
+	
+	// sync sample number property for synchronizing other samplers
+	RPropertyRef 				iSampleStartTimeProp;
+	TInt						iSampleStartTime;
+	
+	DProfilerGppSampler<10000> 	gppSampler;
+#ifdef __SMP__
+	DProfilerGppSampler<10000>  gppSampler2;
+    DProfilerGppSampler<10000>  gppSampler3;
+    DProfilerGppSampler<10000>  gppSampler4;
+#endif
+	DProfilerGfcSampler<10000> 	gfcSampler;
+	DProfilerIttSampler<10000> 	ittSampler;
+	DProfilerMemSampler<40000> 	memSampler;
+	DProfilerPriSampler<10000> 	priSampler;
+#ifdef __SMP__
+//    DProfilerPriSampler<10000>  priSampler2;
+//    DProfilerPriSampler<10000>  priSampler3;
+//    DProfilerPriSampler<10000>  priSampler4;
+#endif
+	
+#ifndef __SMP__
+	static const TInt			KSamplerAmount = 5;
+#else
+    static const TInt           KSamplerAmount = 8;
+#endif
+	DProfilerSamplerBase*		iSamplers[KSamplerAmount];
+    TInt                        iMaxCpus;
+    TUint32                     iStartTime; 
+	
+#ifdef SEPARATE_DFC_QUEUE
+	TDynamicDfcQue*             iDfcQ;
+#endif
+};
+
+/*
+ *
+ *
+ *	Class DGeneralsProfilerFactory implementation
+ *
+ *
+ */
+
+DECLARE_STANDARD_LDD()
+    {
+	return new DGeneralsProfilerFactory();
+    }
+
+TInt DGeneralsProfilerFactory::Create(DLogicalChannelBase*& aChannel)
+    {
+	aChannel = new DGeneralsDriver;
+	return aChannel?KErrNone:KErrNoMemory;
+    }
+
+
+DGeneralsProfilerFactory::DGeneralsProfilerFactory()
+    {
+	// major, minor, and build version number
+    iVersion=TVersion(1,0,1);
+    }
+
+DGeneralsProfilerFactory::~DGeneralsProfilerFactory()
+    {
+//    if (gDfcQ)
+//        {
+//        gDfcQ->Destroy();
+//        }
+    }
+
+TInt DGeneralsProfilerFactory::Install()
+    {
+    return(SetName(&KPluginSamplerName));
+    }
+
+void DGeneralsProfilerFactory::GetCaps(TDes8& aDes) const
+    {
+    TCapsSamplerV01 b;
+    
+    b.iVersion=TVersion(1,0,1);
+    
+    aDes.FillZ(aDes.MaxLength());
+    aDes.Copy((TUint8*)&b,Min(aDes.MaxLength(),sizeof(b)));
+    }
+
+/*
+ *
+ *
+ *	Class DGeneralsDriver implementation
+ *
+ *
+ */
+ 
+DGeneralsDriver::DGeneralsDriver() :
+	iTimer(NewDoProfilerProfile,this),
+	iNewDfc(NewDoDfc,this,NULL,7),
+#ifdef __SMP__
+	gppSampler(0),
+	gppSampler2(1),
+    gppSampler3(2),
+    gppSampler4(3),
+#endif
+	gfcSampler(gppSampler.GetExportData()),
+	ittSampler(gppSampler.GetExportData()),
+	memSampler(gppSampler.GetExportData(), PROFILER_MEM_SAMPLER_ID),
+	priSampler(gppSampler.GetExportData(), PROFILER_PRI_SAMPLER_ID)
+#ifdef __SMP__
+//    ,priSampler2(gppSampler.GetExportData(), PROFILER_PRI_SAMPLER_ID),
+//    priSampler3(gppSampler.GetExportData(), PROFILER_PRI_SAMPLER_ID),
+//    priSampler4(gppSampler.GetExportData(), PROFILER_PRI_SAMPLER_ID)
+#endif
+    {
+	LOGSTRING("DGeneralsDriver::DGeneralsDriver()");
+
+	iState = EStopped;
+	iEndRequestStatus = 0;
+	doingDfc = 0;
+	sampleRunning = 0;
+	iSyncOffset = 0;
+	iStartTime = 0;
+	InitialiseSamplerList();
+    }
+
+/*
+ *
+ *	This method has to be changed for each new sampler
+ *
+ */ 
+void DGeneralsDriver::InitialiseSamplerList()
+	{
+	// initialize all samplers to zero
+	for(TInt i(0);i<KSamplerAmount;i++)
+		{
+		iSamplers[i] = 0;
+		}
+
+	TInt i(0);
+	iSamplers[i] = &gppSampler;i++;
+#ifdef __SMP__
+	iSamplers[i] = &gppSampler2;i++;
+    iSamplers[i] = &gppSampler3;i++;
+    iSamplers[i] = &gppSampler4;i++;
+#endif
+	iSamplers[i] = &gfcSampler;i++;
+	iSamplers[i] = &ittSampler;i++;
+	iSamplers[i] = &memSampler;i++;
+	iSamplers[i] = &priSampler;i++;
+	
+#ifdef __SMP__
+    // get the number of cpus
+    iMaxCpus = NKern::NumberOfCpus();
+#else
+    iMaxCpus = 0;
+#endif
+    
+	// initialize synchronizing property
+	LOGSTRING("DGeneralsDriver::InitialiseSamplerList() - initializing property");
+	TInt r(iSampleStartTimeProp.Attach(KGppPropertyCat, EGppPropertySyncSampleNumber));
+    if (r!=KErrNone)
+        {
+        LOGSTRING2("DGeneralsDriver::InitialiseSamplerList() - error in attaching counter property, error %d", r);
+        }
+    LOGSTRING("DGeneralsDriver::InitialiseSamplerList() - defining properties");
+    r = iSampleStartTimeProp.Define(RProperty::EInt, KAllowAllPolicy, KDenyAllPolicy, 0, NULL);
+    if (r!=KErrNone)
+        {
+        LOGSTRING2("DGeneralsDriver::InitialiseSamplerList() - error in defining counter property, error %d", r);
+        }	
+	}
+
+
+DProfilerSamplerBase* DGeneralsDriver::GetSamplerForId(TInt samplerIdToGet)
+    {
+	for(TInt i(0);i<KSamplerAmount;i++)
+	    {
+		if(iSamplers[i]->iSamplerId == samplerIdToGet)
+		    {
+			return iSamplers[i];
+		    }
+	    }
+	return (DProfilerSamplerBase*)0;
+    }
+
+TInt DGeneralsDriver::DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer)
+    {
+    TUint8 err(KErrNone);
+    
+    if (!Kern::QueryVersionSupported(TVersion(1,0,1),aVer))
+	   	return KErrNotSupported;
+    
+    // just for testing 
+#ifndef __SMP__
+    LOGTEXT("Initializing the stack pointer");
+    stackTop=(TUint32*)IntStackPtr();
+    LOGSTRING2("Got stack pointer 0x%x",(TUint32)stackTop);
+#endif
+
+    iClient = &Kern::CurrentThread();
+    err = iClient->Open();
+	
+    DProcess* clientProcess(iClient->iOwningProcess);
+    if (clientProcess)
+        {
+        //Require Power Management and All Files to use this driver
+        // Not ideal, but better than nothing
+        if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by GeneralsDriver.ldd")))
+            return KErrPermissionDenied;
+        if(!Kern::CurrentThreadHasCapability(ECapabilityAllFiles,__PLATSEC_DIAGNOSTIC_STRING("Checked by GeneralsDriver.ldd")))
+            return KErrPermissionDenied;  
+        
+        SSecurityInfo secureInfo = clientProcess->iS;
+        if (secureInfo.iSecureId != KProfilerExeSecurUid)
+            {
+            return KErrPermissionDenied;
+            }
+        }
+    
+    // initiate sample stream ready for collecting the trace data
+	iSampleStream.InsertCurrentClient(iClient);
+	
+	iTimer.Cancel();
+	iNewDfc.Cancel();
+
+	Kern::SetThreadPriority(24);
+
+#ifdef SEPARATE_DFC_QUEUE
+	err = Kern::DynamicDfcQCreate(iDfcQ, KGeneralsDriverThreadPriority, TBuf8<32>( KGeneralsDriverThread ));
+	if (KErrNone == err)
+        {
+        SetDfcQ(iDfcQ);
+        iNewDfc.SetDfcQ(iDfcQ);
+        iMsgQ.Receive();
+        return err;
+        }
+#else
+	SetDfcQ(Kern::DfcQue0());
+	iNewDfc.SetDfcQ(iDfcQ);
+	iMsgQ.Receive();
+#endif
+	return err;
+    }
+
+DGeneralsDriver::~DGeneralsDriver()
+    {
+	if (iState!=EStopped)
+	    iTimer.Cancel();
+	iNewDfc.Cancel();
+	
+#ifdef SEPARATE_DFC_QUEUE
+	if(iDfcQ)
+	    iDfcQ->Destroy();
+#endif
+	
+	iSampleStartTimeProp.Close();
+	Kern::SafeClose((DObject*&)iClient,NULL);
+    }
+
+
+TInt DGeneralsDriver::GetSampleTime(TUint32* time)
+    {
+	LOGSTRING("DGeneralsDriver::GetSampleTime - entry");
+
+	Kern::ThreadRawWrite(	iClient,(TAny*)time, 
+							(TAny*)&gppSampler.GetExportData()->sampleNumber, 
+							4, iClient);
+
+	LOGSTRING("DGeneralsDriver::GetSampleTime - exit");
+
+	return KErrNone;
+    }
+
+
+TInt DGeneralsDriver::GetSamplerVersion(TDes* aDes)
+    {
+	LOGSTRING2("DGeneralsDriver::GetSamplerVersion - 0x%x",aDes);
+	
+	TBuf8<16> aBuf;
+	aBuf.Append(PROFILER_SAMPLER_VERSION);
+	Kern::ThreadDesWrite(iClient,aDes,aBuf,0,KChunkShiftBy0,iClient);
+	LOGSTRING("DGeneralsDriver::GetSamplerVersion - written client descriptor");
+	return KErrNone;
+    }
+
+TInt DGeneralsDriver::NewStart(TInt aDelay)
+    {	
+	LOGSTRING("DGeneralsDriver::NewStart");
+	iEndRequestStatus = 0;
+	
+	aDelay = Min(KMaxDelay, Max(KMinDelay, aDelay));
+
+	// always use this rate
+	iPeriod = aDelay;
+	
+#ifdef __SMP__
+    /*
+     * Bind and enable the sampling interupts associated with each core. 
+     */
+    TInt err(0);
+    
+    TUint32 flags = NKern::EIrqBind_Count;
+
+//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase - 32=%d", KIntProfilerBase -32 );
+    err = NKern::InterruptBind( KIntProfilerBase - 32 , DGeneralsDriver::Sample, this, flags, 0);
+    if(err < 0)
+        Kern::Printf(" InterruptBind KIntProfilerBase - 32 ret = %d", err );
+    
+//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 1 - 32=%d", KIntProfilerBase + 1-32 );
+    err = NKern::InterruptBind( KIntProfilerBase + 1 - 32 , DGeneralsDriver::Sample, this, flags, 0);
+    if(err < 0)
+        Kern::Printf(" InterruptBind KIntProfilerBase + 1 - 32 ret = %d", err );
+
+//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 2 - 32=%d", KIntProfilerBase + 2 - 32 );
+    err = NKern::InterruptBind(KIntProfilerBase + 2 - 32 , DGeneralsDriver::Sample, this, flags, 0);
+    if(err < 0)
+        Kern::Printf(" InterruptBind KIntProfilerBase + 2 - 32 ret = %d", err );
+
+//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 3 - 32=%d", KIntProfilerBase + 3 - 32 );
+    err = NKern::InterruptBind(KIntProfilerBase + 3 - 32 , DGeneralsDriver::Sample, this, flags, 0);
+    if(err < 0)
+        Kern::Printf(" InterruptBind KIntProfilerBase + 3 - 32 ret = %d", err );
+
+
+    err = NKern::InterruptEnable(KIntProfilerBase - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptEnable KIntProfilerBase - 32 ret = %d", err );
+    
+    err = NKern::InterruptEnable(KIntProfilerBase + 1 - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptEnable KIntProfilerBase + 1 - 32 ret = %d", err );
+
+    err = NKern::InterruptEnable(KIntProfilerBase + 2 - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptEnable KIntProfilerBase + 2 - 32 ret = %d", err );
+
+    err = NKern::InterruptEnable(KIntProfilerBase + 3 - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptEnable KIntProfilerBase + 3 - 32 ret = %d", err );
+        
+#endif
+	
+	iTimer.OneShot(aDelay);
+	
+	iState = ERunning;
+
+	return KErrNone;
+    }
+
+/*
+ *	This function is run in each interrupt
+ */
+// EKA-2 implementation of the sampler method
+
+void DGeneralsDriver::NewDoProfilerProfile(TAny* aPtr)
+    {
+    LOGSTRING("DGeneralsDriver::NewDoProfilerProfile - entry");
+    
+#ifdef __SMP__      
+    TInt currCpu(NKern::CurrentCpu());
+#endif
+    TInt8 postSampleNeeded(0);
+    DGeneralsDriver& d=*(DGeneralsDriver*)aPtr;
+
+	if (d.iState == ERunning && d.sampleRunning == 0)
+	    {
+        // start timer again
+		d.iTimer.Again(d.iPeriod);
+		d.sampleRunning++;
+        
+#ifdef __SMP__      
+        // print out the sample tick
+        if(d.gppSampler.GetExportData()->sampleNumber% 1000 == 0) 
+            {
+            Kern::Printf(("PIPROF SAMPLE TICK, #%d"), d.gppSampler.GetExportData()->sampleNumber);
+            }
+        // call the actual CPU sampling function for CPU 0 (in NaviEngine), later may be on any of the CPUs
+        Sample(aPtr);
+        
+        // post-sampling for NTimer interrupted CPU
+        postSampleNeeded += d.iSamplers[currCpu]->PostSampleNeeded();
+        
+        /* 
+        This is the master sampler from the watchdog timer, so 
+        send interrupts to the other CPUs
+        */
+        TScheduler *theSched = TScheduler::Ptr();
+        GicDistributor* gicDist = (GicDistributor* )theSched->i_GicDistAddr;
+            
+        for( TInt nCpu(0); nCpu < d.iMaxCpus; nCpu++ )
+            {
+            if( nCpu != currCpu )
+                {
+                gicDist->iSoftIrq = ( 0x10000 << nCpu ) | (KIntProfilerBase + nCpu);
+                }
+            // post-sampling for CPUs with specifically generated interrupts
+            postSampleNeeded += d.iSamplers[nCpu]->PostSampleNeeded();
+            }
+        arm_dsb();
+#endif  
+        // then sample the rest of non-cpu samplers
+        for(TInt i(d.iMaxCpus);i<KSamplerAmount;i++)
+            {
+            if(d.iSamplers[i]->iEnabled)
+                {
+                d.iSamplers[i]->Sample();
+                postSampleNeeded += d.iSamplers[i]->PostSampleNeeded();
+                }
+            }
+			
+		if(postSampleNeeded > 0 && d.doingDfc == 0)
+		    {
+			d.doingDfc++;
+			d.iNewDfc.Add();
+
+			d.sampleRunning--;
+			return;
+            }
+		d.sampleRunning--;
+        }
+	else if (d.iState == EStopping && d.sampleRunning == 0)
+	    {
+		// add a dfc for this final time
+		d.iNewDfc.Add();
+        Kern::Printf("DGeneralsDriver::Sample - sampling added to dfc queue");
+        }
+	else
+	    {
+		// the previous sample has not finished,
+		Kern::Printf("DGeneralsDriver::NewDoProfilerProfile - Profiler Sampler Error - interrupted before finished sampling!!");
+        }
+        LOGSTRING("DGeneralsDriver::NewDoProfilerProfile - exit");
+    }
+
+
+
+void DGeneralsDriver::Sample(TAny* aPtr)
+    {
+    LOGSTRING("DGeneralsDriver::Sample - entry");
+
+#ifdef __SMP__
+    DGeneralsDriver& d=*(DGeneralsDriver*)aPtr;
+
+//    TInt currCpu(NKern::CurrentCpu());
+
+    // sample the current cpu load
+//    if(d.iSamplers[currCpu]->iEnabled)
+//        {
+        d.iSamplers[NKern::CurrentCpu()]->Sample();
+//        postSampleNeeded += d.iSamplers[currCpu]->PostSampleNeeded();
+//        }
+#endif
+    LOGSTRING("DGeneralsDriver::Sample - exit");
+    }
+/*
+ *	This function is run when any of the samplers
+ *	requires post sampling
+ */
+void DGeneralsDriver::NewDoDfc(TAny* pointer)
+    {
+	DGeneralsDriver& d(*((DGeneralsDriver*)pointer));
+	
+	if(d.iState == ERunning)
+	    {
+		// for all enabled samplers, perform
+		// post sample if needed
+		for(TInt i(0);i<KSamplerAmount;i++)
+		    {
+			if(d.iSamplers[i]->iEnabled)
+			    {
+				if(d.iSamplers[i]->PostSampleNeeded())
+				    {
+					d.iSamplers[i]->PostSample();
+                    }
+                }
+            }
+		d.doingDfc--;
+        }
+
+	else if(d.iState == EStopping)
+	    {
+		// for all enabled samplers,
+		// perform end sampling
+		TBool releaseBuffer(false);
+		for(TInt i(0);i<KSamplerAmount;i++)
+		    {
+			if(d.iSamplers[i]->iEnabled)
+			    {
+				LOGSTRING("DGeneralsDriver::NewDoDfc() - ending");
+				// perform end sampling for all samplers
+				// stream mode samplers may be pending, if they
+				// are still waiting for another client buffer
+				if(d.iSamplers[i]->EndSampling() == KErrNotReady) 
+				    {
+					LOGSTRING("DGeneralsDriver::NewDoDfc() - stream data pending");
+					releaseBuffer = true;
+                    }
+				else 
+				    {
+					LOGSTRING("DGeneralsDriver::NewDoDfc() - no data pending");
+					releaseBuffer = true;
+                    }		
+                }
+            }
+
+		// At the end, once all the samplers are gone through, the buffer should be released
+		if (true == releaseBuffer) 
+		    {
+			LOGSTRING("DGeneralsDriver::NewDoDfc() - release the buffer");
+			d.iSampleStream.ReleaseIfPending();	
+            }
+		
+		d.iState = EStopped;
+		if(d.iEndRequestStatus != 0 && d.iClient != 0)
+		    {
+			// sampling has ended
+			Kern::RequestComplete(d.iClient,d.iEndRequestStatus,KErrNone);
+            }
+        }
+    }
+
+
+/*
+ *	All controls are handled here
+ */
+ 
+void DGeneralsDriver::HandleMsg(TMessageBase* aMsg)
+    {
+	TInt r(KErrNone);
+	TThreadMessage& m(*(TThreadMessage*)aMsg);
+
+	LOGSTRING5("DGeneralsDriver::HandleMsg 0x%x 0x%x 0x%x 0x%x",m.Int0(),m.Int1(),m.Int2(),m.Int3());
+	
+	if(m.iValue == (TInt)ECloseMsg)
+	    {
+		LOGSTRING("DGeneralsDriver::HandleMsg - received close message");
+		iTimer.Cancel();
+		iNewDfc.Cancel();
+
+		m.Complete(KErrNone,EFalse);
+		iMsgQ.CompleteAll(KErrServerTerminated);
+		LOGSTRING("DGeneralsDriver::HandleMsg - cleaned up the driver!");
+		return;
+        }
+
+	if (m.Client()!=iClient)
+	    {
+		LOGSTRING("DGeneralsDriver::HandleMsg - ERROR, wrong client");
+		m.PanicClient(_L("GENERALSSAMPLER"),EAccessDenied);
+		return;
+        }
+
+	TInt id(m.iValue);
+	switch(id)
+	    {
+		 //Controls are handled here
+		case RPluginSampler::EMarkTraceActive:
+			LOGSTRING("DGeneralsDriver::HandleMsg - EMarkTraceActive");
+			r = MarkTraceActive((TInt)m.Int0());
+			break;
+
+		case RPluginSampler::EOutputSettingsForTrace:
+			LOGSTRING("DGeneralsDriver::HandleMsg - EOutputSettingsForTrace");
+			r = OutputSettingsForTrace((TInt)m.Int0(),(TInt)m.Int1());
+			break;
+
+		case RPluginSampler::EAdditionalTraceSettings:
+			LOGSTRING("DGeneralsDriver::HandleMsg - EAdditionalTraceSettings");
+			r = AdditionalTraceSettings((TInt)m.Int0(),(TInt)m.Int1());
+			break;
+
+		case RPluginSampler::EAdditionalTraceSettings2:
+			LOGSTRING("DGeneralsDriver::HandleMsg - EAdditionalTraceSettings2");
+			r = AdditionalTraceSettings2((TInt)m.Int0(),(TInt)m.Int1());
+			break;
+			
+		case RPluginSampler::ESetSamplingPeriod:
+		    LOGSTRING2("DGeneralsDriver::HandleMsg - ESetSamplingPeriod %d", (TInt)m.Int1());
+			r = SetSamplingPeriod((TInt)m.Int0(),(TInt)m.Int1());
+			break;
+			
+		case RPluginSampler::EMarkTraceInactive:
+			LOGSTRING("DGeneralsDriver::HandleMsg - EMarkTraceInactive");
+			r = MarkTraceInactive((TInt)m.Int0());
+			break;
+
+		case RPluginSampler::ESample:
+			LOGSTRING("DGeneralsDriver::HandleMsg - ESample");
+			//r = Sample();  // hack. Original implementation of sample just returned 0
+			r = 0;
+			break;
+
+		case RPluginSampler::EStartSampling:
+			LOGSTRING("DGeneralsDriver::HandleMsg - EStartSampling");
+			r = StartSampling();
+			break;
+
+		case RPluginSampler::EGetSampleTime:
+			LOGSTRING("DGeneralsDriver::HandleMsg - EGetSampleTime");
+			r = GetSampleTime(reinterpret_cast<TUint32*>(m.Ptr0()));
+			break;
+
+		case RPluginSampler::EGetSamplerVersion:
+			LOGSTRING("DGeneralsDriver::HandleMsg - EGetSamplerVersion");
+			r = GetSamplerVersion(reinterpret_cast<TDes*>(m.Ptr0()));
+			break;
+		
+		case RPluginSampler::ECancelStreamRead:
+			LOGSTRING("DGeneralsDriver::HandleMsg - ECancelStreamRead");
+			iStreamReadCancelStatus = reinterpret_cast<TRequestStatus*>(m.Ptr0());
+			r = ProcessStreamReadCancel();
+			break;
+
+
+		 //	Requests are handled here
+
+		case ~RPluginSampler::EStopAndWaitForEnd:
+			LOGSTRING("DGeneralsDriver::HandleMsg - EStopAndWaitForEnd");
+			iEndRequestStatus = reinterpret_cast<TRequestStatus*>(m.Ptr0());
+			r = StopSampling();
+#ifdef __SMP__
+			UnbindInterrupts();
+#endif
+			break;
+
+		case ~RPluginSampler::ERequestFillThisStreamBuffer:
+			LOGSTRING("DGeneralsDriver::HandleMsg - ERequestFillThisStreamBuffer");			
+			r = ProcessStreamReadRequest(	reinterpret_cast<TBapBuf*>(m.Ptr1()),
+											reinterpret_cast<TRequestStatus*>(m.Ptr0()));
+			break;
+
+		default:
+			LOGSTRING2("DGeneralsDriver::HandleMsg - ERROR, unknown command %d",id);
+			r = KErrNotSupported;
+			break;
+        }
+
+	LOGSTRING("DGeneralsDriver::HandleMsg - Completed");
+	m.Complete(r,ETrue);
+    }
+
+#ifdef __SMP__
+inline void DGeneralsDriver::UnbindInterrupts()
+    {
+    TInt err(0);
+
+    // disable interrupts when sampling stops, enabled again on start
+    err = NKern::InterruptDisable(KIntProfilerBase - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptDisable KIntProfilerBase - 32 ret = %d", err );
+    
+    err = NKern::InterruptDisable(KIntProfilerBase + 1 - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptDisable KIntProfilerBase + 1 - 32 ret = %d", err );
+
+    err = NKern::InterruptDisable(KIntProfilerBase + 2 - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptDisable KIntProfilerBase + 2 - 32 ret = %d", err );
+
+    err = NKern::InterruptDisable(KIntProfilerBase + 3 - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptDisable KIntProfilerBase + 3 - 32 ret = %d", err );
+    
+//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase - 32=%d", KIntProfilerBase -32 );
+    err = NKern::InterruptUnbind( KIntProfilerBase - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptUnbind KIntProfilerBase - 32 ret = %d", err );
+    
+//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 1 - 32=%d", KIntProfilerBase + 1-32 );
+    err = NKern::InterruptUnbind( KIntProfilerBase + 1 - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptUnbind KIntProfilerBase + 1 - 32 ret = %d", err );
+
+//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 2 - 32=%d", KIntProfilerBase + 2 - 32 );
+    err = NKern::InterruptUnbind(KIntProfilerBase + 2 - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptUnbind KIntProfilerBase + 2 - 32 ret = %d", err );
+
+//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 3 - 32=%d", KIntProfilerBase + 3 - 32 );
+    err = NKern::InterruptUnbind(KIntProfilerBase + 3 - 32);
+    if(err < 0)
+        Kern::Printf(" InterruptUnbind KIntProfilerBase + 3 - 32 ret = %d", err );
+
+    }
+#endif
+
+inline TInt DGeneralsDriver::ProcessStreamReadRequest(TBapBuf* aBuf,TRequestStatus* aStatus)
+	{
+	LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest - entry");
+	
+	// a new sample buffer has been received from the client
+	iSampleStream.AddSampleBuffer(aBuf,aStatus);
+	
+	// check if we are waiting for the last data to be written to the client
+	if(iState == EStopped)
+	    {
+		LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest state = EStopped");
+	
+		// sampling has stopped and stream read cancel is pending
+		// try to perform the end sampling procedure again
+		TBool releaseBuffer(false);
+		for(TInt i(0);i<KSamplerAmount;i++)
+		    {
+			// only for all enabled samplers that have stream output mode
+			if(iSamplers[i]->iEnabled /*&& samplers[i]->outputMode == 2*/)
+			    {
+				//TInt pending = 0;
+				// stream mode samplers may be pending, if they
+				// are still waiting for another client buffer,
+				// in that case, the request should be completed already
+				if(iSamplers[i]->EndSampling() == KErrNotReady) 
+				    {
+					LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest - still data pending");
+					releaseBuffer = true;
+                    }
+				else 
+				    {
+					LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest - no data pending");
+					releaseBuffer = true;
+                    }
+                }
+            }
+		// At the end, once all the samplers are gone through, the buffer should be released
+		if (true == releaseBuffer) 
+		    {
+			LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest - all data copied, release the buffer");
+			iSampleStream.ReleaseIfPending();
+		    }
+        }
+	LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest - exit");
+	
+	return KErrNone;
+	}
+
+
+/*
+ *	Mark traces active or inactive, this can be done
+ *	only if sampling is not running
+ */
+
+inline TInt DGeneralsDriver::MarkTraceActive(TInt samplerIdToActivate)
+	{
+	LOGSTRING2("DGeneralsDriver::MarkTraceActive %d",samplerIdToActivate);
+
+	TInt cpus(0);
+#ifdef __SMP__
+	cpus = NKern::NumberOfCpus();
+	if( samplerIdToActivate == PROFILER_GPP_SAMPLER_ID )
+	    {
+	    for(TInt cpu(0);cpu<cpus;cpu++)
+	         {
+	         Kern::Printf("DGeneralsDriver::MarkTraceActive - activating CPU %d",cpu);
+	         iSamplers[cpu]->SetEnabledFlag(true);
+	         }
+	    return KErrNone;
+	    }
+#endif
+	for(TInt i(cpus);i<KSamplerAmount;i++)
+	    {
+		if(iSamplers[i]->iSamplerId == samplerIdToActivate)
+		    {
+			iSamplers[i]->SetEnabledFlag(true);
+			return KErrNone;
+            }
+        }
+
+	LOGSTRING2("DGeneralsDriver::MarkTraceActive - %d not supported",samplerIdToActivate);
+	return KErrNotSupported;
+	}
+
+inline TInt DGeneralsDriver::MarkTraceInactive(TInt samplerIdToDisable)
+	{
+	LOGSTRING2("DGeneralsDriver::MarkTraceInactive %d",samplerIdToDisable);
+
+    TInt cpus(0);
+#ifdef __SMP__
+    cpus = NKern::NumberOfCpus();
+    if( samplerIdToDisable == PROFILER_GPP_SAMPLER_ID )
+        {
+        for(TInt cpu(0);cpu<cpus;cpu++)
+             {
+             iSamplers[cpu]->SetEnabledFlag(false);
+             }
+        return KErrNone;
+        }
+#endif
+    for(TInt i(cpus);i<KSamplerAmount;i++)
+	    {
+		if(iSamplers[i]->iSamplerId == samplerIdToDisable)
+		    {
+			iSamplers[i]->SetEnabledFlag(false);
+			return KErrNone;
+            }
+        }
+
+	LOGSTRING2("DGeneralsDriver::MarkTraceInactive - %d not supported",samplerIdToDisable);
+	return KErrNotSupported;
+	}
+
+/*
+ *	Set output settings for a trace
+ */
+ 
+inline TInt DGeneralsDriver::OutputSettingsForTrace(TInt samplerId,TInt settings)
+	{
+	LOGSTRING3("DGeneralsDriver::OutputSettingsForTrace id:%d set:%d",samplerId,settings);
+
+    TInt cpus(0);
+#ifdef __SMP__
+    cpus = NKern::NumberOfCpus();
+    if( samplerId == PROFILER_GPP_SAMPLER_ID )
+        {
+        for(TInt cpu(0);cpu<cpus;cpu++)
+             {
+             iSamplers[cpu]->SetOutputCombination(settings);
+             }
+        return KErrNone;
+        }
+#endif
+    for(TInt i(cpus);i<KSamplerAmount;i++)
+	    {
+		if(iSamplers[i]->iSamplerId == samplerId)
+		    {
+			iSamplers[i]->SetOutputCombination(settings);
+			return KErrNone;
+		    }
+	    }
+
+	return KErrNotSupported;	
+	}
+
+/*
+ *	Set additional settings for a trace
+ */
+
+inline TInt DGeneralsDriver::AdditionalTraceSettings(TInt samplerId,TInt settings)
+	{
+	LOGSTRING3("DGeneralsDriver::SetAdditionalTraceSettings id:%d set:%d",samplerId,settings);
+
+    TInt cpus(0);
+#ifdef __SMP__
+    cpus = NKern::NumberOfCpus();
+    if( samplerId == PROFILER_GPP_SAMPLER_ID )
+        {
+        for(TInt cpu(0);cpu<cpus;cpu++)
+             {
+             iSamplers[cpu]->SetAdditionalSettings(settings);
+             }
+        return KErrNone;
+        }
+#endif
+    for(TInt i(cpus);i<KSamplerAmount;i++)
+	    {
+		if(iSamplers[i]->iSamplerId == samplerId)
+		    {
+			iSamplers[i]->SetAdditionalSettings(settings);
+			return KErrNone;
+            }
+        }
+
+	return KErrNotSupported;	
+	}
+
+inline TInt DGeneralsDriver::AdditionalTraceSettings2(TInt samplerId,TInt settings)
+	{
+	LOGSTRING3("DGeneralsDriver::SetAdditionalTraceSettings id:%d set:%d",samplerId,settings);
+
+    TInt cpus(0);
+#ifdef __SMP__
+    cpus = NKern::NumberOfCpus();
+    if( samplerId == PROFILER_GPP_SAMPLER_ID )
+        {
+        for(TInt cpu(0);cpu<cpus;cpu++)
+             {
+             iSamplers[cpu]->SetAdditionalSettings2(settings);
+             }
+        return KErrNone;
+        }
+#endif
+    for(TInt i(cpus);i<KSamplerAmount;i++)
+	    {
+		if(iSamplers[i]->iSamplerId == samplerId)
+		    {
+			iSamplers[i]->SetAdditionalSettings2(settings);
+			return KErrNone;
+		    }
+        }
+
+	return KErrNotSupported;	
+	}
+
+inline TInt DGeneralsDriver::SetSamplingPeriod(TInt samplerId,TInt settings)
+	{
+	LOGSTRING2("DGeneralsDriver::SetSamplingPeriod - set:%d",settings);
+
+	TInt cpus(0);
+#ifdef __SMP__
+    cpus = NKern::NumberOfCpus();
+    if( samplerId == PROFILER_GPP_SAMPLER_ID )
+        {
+        for(TInt cpu(0);cpu<cpus;cpu++)
+             {
+             iSamplers[cpu]->SetSamplingPeriod(settings);
+             }
+        return KErrNone;
+        }
+#endif
+    for(TInt i(cpus);i<KSamplerAmount;i++)
+	    {
+		if(iSamplers[i]->iSamplerId == samplerId)
+		    {
+			iSamplers[i]->SetSamplingPeriod(settings);
+			return KErrNone;
+		    }
+	    }
+
+	return KErrNotSupported;	
+	}
+
+/*
+ *	Mark traces active or inactive, this can be done
+ *	only if sampling is not running
+ */
+ 
+TInt DGeneralsDriver::StartSampling()
+	{
+	LOGSTRING("DGeneralsDriver::StartSampling");
+
+	if(iState == EStopped)
+		{
+		// reset iSampleStartTimeProp property value
+		iSampleStartTime = NKern::TickCount();	// get the system tick value for sync purposes 
+#ifdef __SMP__
+		iStartTime = (iSampleStartTime & 0xfffffff0);
+#endif
+		TInt r(iSampleStartTimeProp.Set(iSampleStartTime));
+		
+		Kern::Printf(("PIPROF SAMPLE TICK, #0")); // for remote profiling with Profiler Activator
+		
+		// reset all enabled samplers
+		for(TInt i(0);i<KSamplerAmount;i++)
+			{
+			if(iSamplers[i]->iEnabled)
+				{
+				// reset with stream option
+#ifndef __SMP__
+                Kern::Printf(("DGeneralsDriver::StartSampling - stream reset for generals driver, sync offset %d"), 0);
+				iSamplers[i]->Reset(&iSampleStream, 0);
+#else
+                Kern::Printf(("DGeneralsDriver::StartSampling - stream reset for generals driver, start time %d"), iStartTime);
+                iSamplers[i]->Reset(&iSampleStream, iStartTime);
+#endif
+				}
+			}
+
+		NewStart(gppSampler.GetPeriod());
+		return KErrNone;
+		}
+	else
+		{
+		return KErrGeneral;
+		}
+	}
+
+/*
+ *  Mark traces active or inactive, this can be done
+ *  only if sampling is not running
+ */
+ 
+TInt DGeneralsDriver::StopSampling()
+    {
+    LOGSTRING("DGeneralsDriver::StopSampling");
+
+    if(iState == ERunning)
+        {
+        this->iState = EStopping;
+        // reset all enabled samplers
+        for(TInt i(0);i<KSamplerAmount;i++)
+            {
+            // do the reset only for memory sampler
+            if(iSamplers[i]->iEnabled && iSamplers[i]->iSamplerId == 4)
+                {
+                // reset with stream option
+                LOGTEXT(("DGeneralsDriver::StopSampling - stream reset for samplers"));
+                iSamplers[i]->Reset(&iSampleStream, 999999);
+                }
+            }
+
+        return KErrNone;
+        }
+    else
+        {
+        return KErrGeneral;
+        }
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/src/GeneralsPlugin.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,577 @@
+/*
+* 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 "GeneralsPlugin.h"	
+//#include <piprofiler/EngineUIDs.h>
+#include <piprofiler/ProfilerTraces.h>
+
+const TInt KMaxSamplerAmount = 20;
+
+// LITERALS
+_LIT8(KSamplingPeriod, "sampling_period_ms");
+
+// CONSTANTS
+// GeneralsPlugin UID:
+const TUid KSamplerGeneralsPluginUid = { 0x2001E5B2 };
+
+// Gpp sub-sampler UID:
+const TUid KSamplerGppPluginUid = { 0x2001E570 };
+
+// Gfc sub-sampler UID:
+const TUid KSamplerGfcPluginUid = { 0x2001E571 };
+
+// Itt sub-sampler UID:
+const TUid KSamplerIttPluginUid = { 0x2001E572 };
+
+// Mem sub-sampler UID:
+const TUid KSamplerMemPluginUid = { 0x2001E573 };
+
+// Pri sub-sampler UID:
+const TUid KSamplerPriPluginUid = { 0x2001E574 };
+
+/*
+ *	
+ *	class CGeneralsPlugin implementation
+ * 
+ */
+ 
+CGeneralsPlugin* CGeneralsPlugin::NewL(const TUid aImplementationUid, TAny* /*aInitParams*/)
+    {
+	LOGTEXT(_L("CGeneralsPlugin::NewL() - entry"));
+    CGeneralsPlugin* self = new (ELeave) CGeneralsPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+	LOGTEXT(_L("CGeneralsPlugin::NewL() - exit"));
+    return self;
+    }
+
+CGeneralsPlugin::CGeneralsPlugin() :
+	iVersionDescriptor(&(this->iVersion[1]),0,19)
+	{
+	iSamplerType = PROFILER_KERNEL_MODE_SAMPLER;
+	iSamplerId = PROFILER_GENERALS_SAMPLER_ID;
+	iBufferHandler = NULL;
+    iEnabled = EFalse;
+	LOGTEXT(_L("CGeneralsPlugin::CGeneralsPlugin() - constructor"));
+	}
+
+void CGeneralsPlugin::ConstructL() 
+    {
+	LOGTEXT(_L("CGeneralsPlugin::ConstructL() - entry"));
+	
+	// create attribute array
+	iSamplerAttributes = new(ELeave) CArrayFixFlat<TSamplerAttributes>(KSubSamplerCount);
+	
+	TInt err = InitiateSamplerL();
+	if( err != KErrNone )
+		{
+			LOGTEXT(_L("CGeneralsPlugin::ConstructL - LEAVING, failed to load open sampler device"));
+			User::Leave(err);
+		}
+	
+	// initiate sampler attributes, i.e. settings for modification
+	InitiateSamplerAttributesL();
+	
+	LOGTEXT(_L("CGeneralsPlugin::ConstructL() - exit"));
+    }
+
+
+CGeneralsPlugin::~CGeneralsPlugin()
+	{
+	// clean all the members
+	CleanSampler();	// clean the created sampler
+	}
+
+TInt CGeneralsPlugin::InitiateSamplerL()
+	{
+	RThread me;
+	
+	LOGTEXT(_L("CGeneralsPlugin::InitiateSamplerL - #1"));
+
+	me.SetPriority(EPriorityRealTime);
+
+	LOGTEXT(_L("CGeneralsPlugin::InitiateSamplerL - #2"));
+	
+	// create 
+	User::FreeLogicalDevice(KPluginSamplerName);
+	TInt err(KErrGeneral);
+	
+	LOGTEXT(_L("CGeneralsPlugin::InitiateSamplerL - #3"));
+
+    err = User::LoadLogicalDevice(KPluginSamplerName);
+    if(err != KErrNone)
+        {
+        User::Leave(err);
+        }
+
+	LOGTEXT(_L("CGeneralsPlugin::InitiateSamplerL - #4"));
+	
+	err = KErrGeneral;
+
+    err = iGeneralsSampler.Open();
+    if(err != KErrNone)
+        {
+        LOGSTRING2("CGeneralsPlugin::InitiateSamplerL - Could not open sampler device - waiting and trying again: %d", err);
+        User::Leave(err);
+        }
+
+	LOGTEXT(_L("CGeneralsPlugin::InitiateSamplerL - #5"));
+
+	return err;
+	}
+
+/* 
+ * 
+ * Default sampler attributes
+ * 
+ */
+void CGeneralsPlugin::InitiateSamplerAttributesL()
+    {
+
+    // 
+    for(TInt i(0);i<KMaxSamplerAmount;i++)
+        {
+        switch(i)
+            {
+// Usage:
+//            TSamplerAttributes(TUint32 aUid,
+//                    const TDesC8& aShortName,
+//                    const TDesC& aName,
+//                    const TDesC& aDescription,
+//                    TInt aSampleRate,
+//                    TBool aEnabled,
+//                    TBool aHidden,
+//                    TUint32 aItemCount);
+            case PROFILER_GPP_SAMPLER_ID:
+                {
+                TSamplerAttributes attr(KSamplerGppPluginUid.iUid,
+                        KGPPShortName(),
+                        KGPPLongName(),
+                        KGPPDescription(),
+                        1,
+                        ETrue,
+                        ETrue,
+                        0);
+                iSamplerAttributes->AppendL(attr);
+                break;
+                }
+            case PROFILER_GFC_SAMPLER_ID:
+                {
+                TSamplerAttributes attr2(KSamplerGfcPluginUid.iUid,
+                        KGFCShortName(),
+                        KGFCLongName(),
+                        KGFCDescription(),
+                        -1,
+                        EFalse,
+                        EFalse,
+                        0);
+                this->iSamplerAttributes->AppendL(attr2);
+                break;
+                }
+            case PROFILER_ITT_SAMPLER_ID:
+                {
+                TSamplerAttributes attr3(KSamplerIttPluginUid.iUid,
+                        KITTShortName(),
+                        KITTLongName(),
+                        KITTDescription(),
+                        -1,
+                        ETrue,
+                        EFalse,
+                        0);
+                this->iSamplerAttributes->AppendL(attr3);
+                break;
+                }
+            case PROFILER_MEM_SAMPLER_ID:
+                {
+                TSamplerAttributes attr4(KSamplerMemPluginUid.iUid,
+                        KMEMShortName(),
+                        KMEMLongName(),
+                        KMEMDescription(),
+                        -1,
+                        EFalse,
+                        EFalse,
+                        0);
+//                // select event or sampling based
+//                attr4.iSettingItem1.iSettingDescription.Copy(KMEM1Desc);
+//                attr4.iSettingItem1.iType = TSettingItem::ESettingItemTypeBool;
+//                attr4.iSettingItem1.iValue.AppendNum(0, EDecimal);
+//                attr4.iSettingItem1.iUIText.Copy(KMEM1UIText);
+//                attr4.iSettingItem1.iSettingText.Copy(KMemCounter1);
+                
+                this->iSamplerAttributes->AppendL(attr4);
+                break;
+                }
+            case PROFILER_PRI_SAMPLER_ID:
+                {
+                TSamplerAttributes attr5(KSamplerPriPluginUid.iUid,
+                        KPRIShortName(),
+                        KPRILongName(),
+                        KPRIDescription(),
+                        3000,
+                        EFalse,
+                        EFalse,
+                        0);
+                this->iSamplerAttributes->AppendL(attr5);
+                break;
+                }
+            }
+        }
+    }
+
+TInt CGeneralsPlugin::CleanSampler()
+	{
+    LOGTEXT(_L("CGeneralsPlugin::CleanSampler() - deleting buffer handler"));
+    // release the buffer handler
+    if(iBufferHandler)
+        {
+        iBufferHandler->Cancel();
+        delete iBufferHandler;
+        iBufferHandler = NULL;
+        }
+    
+    LOGTEXT(_L("CGeneralsPlugin::CleanSampler() - closing sampler"));
+	iGeneralsSampler.Close();
+	
+	LOGTEXT(_L("CGeneralsPlugin::CleanSampler() - Freeing sampler device"));
+	User::FreeLogicalDevice(KPluginSamplerName);
+	
+	// release attribute array
+	if(iSamplerAttributes)
+	    {
+	    iSamplerAttributes->Reset();
+	    }
+    delete iSamplerAttributes;
+    iSamplerAttributes = NULL;
+
+	LOGTEXT(_L("CGeneralsPlugin::CleanSampler() - exit"));
+
+	return KErrNone;
+	}
+
+// returns setting array
+void CGeneralsPlugin::GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes)
+    {
+    TInt count(iSamplerAttributes->Count());
+    // append all sampler attributes to aAttributes array
+    for(TInt i(0);i<count;i++)
+        {
+        aAttributes->AppendL(iSamplerAttributes->At(i));
+        }
+    }
+
+TInt CGeneralsPlugin::SetAttributesL(TSamplerAttributes& aAttributes)
+    {
+    TSamplerAttributes attr;
+
+    TInt count(iSamplerAttributes->Count());
+    // loop the sub sampler attributes (by UID)
+    for(TInt i(0);i<count;i++)
+        {
+        attr = iSamplerAttributes->At(i);
+        // if UIDs match replace the old 
+        if(attr.iUid == aAttributes.iUid)
+            {
+            // replace the old attribute container
+            iSamplerAttributes->Delete(i);
+            iSamplerAttributes->InsertL(i, aAttributes);
+            return KErrNone;
+            }
+        }
+    return KErrNotFound;
+    }
+
+/* 
+ * Method for parsing and transforming text array settings into TSamplerAttributes (per each sub sampler),
+ * called by CSamplerController class
+ * 
+ * @param array of raw text setting lines, e.g. [gpp]\nenabled=true\nsampling_period_ms=1\n
+ */
+TInt CGeneralsPlugin::ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aAllSettingsArray)
+    {
+    // local literals
+    _LIT8(KGPPShort, "gpp");
+    _LIT8(KGFCShort, "gfc");
+    _LIT8(KITTShort, "itt");
+    _LIT8(KMEMShort, "mem");
+    _LIT8(KPRIShort, "pri");
+
+    TInt err(KErrNone);
+    
+    TBuf8<16> samplerSearchName;
+    
+    // loop previous settings, update value if changed
+    for(TInt i(0);i<KSubSamplerCount;i++)
+        {
+        // go through all the sub samplers
+        switch (i)
+            {
+            case 0:
+                samplerSearchName.Copy(KGPPShort);
+                break;
+            case 1:
+                samplerSearchName.Copy(KGFCShort);
+                break;
+            case 2:
+                samplerSearchName.Copy(KITTShort);
+                break;
+            case 3:
+                samplerSearchName.Copy(KMEMShort);
+                break;
+            case 4:
+                samplerSearchName.Copy(KPRIShort);
+                break;
+            }
+
+        // get sampler specific settings  
+        err = DoSetSamplerSettings(aAllSettingsArray, samplerSearchName, i);
+        }
+    
+    // returns KErrNone if settings found, otherwise KErrNotFound
+    return err;
+    }
+
+/**
+ * Method for searching sampler specific settings among all settings (raw setting lines read from settings file)
+ * 
+ * @param aAllSettings array of all settings from settings file
+ * @param aSamplerName short name of sampler to be searched among the settings
+ * @param aIndex index number of sampler specific sampler attributes (TSamplerAttributes)
+ * @return KErrNone if settings found ok else KErrNotFound
+ */
+TInt CGeneralsPlugin::DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex)
+    {
+    // sampler name to be searched among the all settings
+    TBuf8<16> samplerSearch;
+    samplerSearch.Copy(KBracketOpen);
+    samplerSearch.Append(aSamplerName);
+    samplerSearch.Append(KBracketClose);
+    
+    // read a line from ALL settings array
+    for (TInt i(0); i<aAllSettings->MdcaCount(); i++)
+        {
+        // check if this line has a setting block start, i.e. contains [xxx] in it
+        if (aAllSettings->MdcaPoint(i).CompareF(samplerSearch) == 0)
+            {
+            // right settings block found, now loop until the next block is found
+            for(TInt j(i+1);j<aAllSettings->MdcaCount();j++)
+                {
+                // check if the next settings block was found
+                if(aAllSettings->MdcaPoint(j).Left(1).CompareF(KBracketOpen) != 0)
+                    {
+                    // save found setting value directly to its owners attributes
+                    SaveSettingToAttributes(aAllSettings->MdcaPoint(j), aIndex);
+                    }
+                else
+                    {
+                    // next block found, return KErrNone
+                    return KErrNone;
+                    }
+                }
+            }
+        }
+    // no settings found for specific sampler
+    return KErrNotFound;
+    }
+
+/**
+ * Method for setting a specific descriptor (from settings file) to attribute structure
+ * 
+ * @param aSetting  
+ * @param aName  
+ */
+void CGeneralsPlugin::SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex)
+    {
+    // local literals
+    _LIT8(KSettingItemSeparator, "=");
+    
+    // find the equal mark from the setting line
+    TInt sepPos = aSetting.Find(KSettingItemSeparator);
+    // check that '=' is found
+    if (sepPos > 0)
+        {
+        // check that the element matches
+        if (aSetting.Left(sepPos).CompareF(KEnabled) == 0)
+            {
+            TBool en;
+            CSamplerPluginInterface::Str2Bool(aSetting.Right(aSetting.Length()-sepPos-1), en);
+            if(en != iSamplerAttributes->At(aIndex).iEnabled)
+                {
+                iSamplerAttributes->At(aIndex).iEnabled = en;
+                }
+            }
+        else if (aSetting.Left(sepPos).CompareF(KSamplingPeriod) == 0)
+            {
+            TInt sr;
+            CSamplerPluginInterface::Str2Int(aSetting.Right(aSetting.Length()-sepPos-1), sr);
+            if(sr != iSamplerAttributes->At(aIndex).iSampleRate)
+                {
+                iSamplerAttributes->At(aIndex).iSampleRate = sr;
+                }
+            }
+        }
+    }
+
+
+TUid CGeneralsPlugin::Id(TInt aSubId) const
+	{
+		if(aSubId == PROFILER_GPP_SAMPLER_ID)		
+			return KSamplerGppPluginUid;
+		else if (aSubId == PROFILER_GFC_SAMPLER_ID)		
+			return KSamplerGfcPluginUid;
+		else if (aSubId == PROFILER_ITT_SAMPLER_ID)		
+			return KSamplerIttPluginUid;
+		else if (aSubId == PROFILER_MEM_SAMPLER_ID)		
+			return KSamplerMemPluginUid;
+		else if (aSubId == PROFILER_PRI_SAMPLER_ID)		
+			return KSamplerPriPluginUid;
+		else
+			return KSamplerGeneralsPluginUid;
+	}
+
+TInt CGeneralsPlugin::SubId(TUid aId) const
+	{
+/* definitions from ProfilerConfig.h:
+ * 	#define		PROFILER_GPP_SAMPLER_ID			1
+	#define		PROFILER_GFC_SAMPLER_ID			2
+	#define		PROFILER_ITT_SAMPLER_ID			3
+	#define		PROFILER_MEM_SAMPLER_ID			4
+	#define		PROFILER_PRI_SAMPLER_ID			5
+ */
+	
+		if(aId == KSamplerGppPluginUid)		
+			return PROFILER_GPP_SAMPLER_ID;
+		else if (aId == KSamplerGfcPluginUid)		
+			return PROFILER_GFC_SAMPLER_ID;
+		else if (aId == KSamplerIttPluginUid)		
+			return PROFILER_ITT_SAMPLER_ID;
+		else if (aId == KSamplerMemPluginUid)		
+			return PROFILER_MEM_SAMPLER_ID;
+		else if (aId == KSamplerPriPluginUid)		
+			return PROFILER_PRI_SAMPLER_ID;
+		else
+			return KErrNotFound;
+	}
+
+TInt CGeneralsPlugin::GetSamplerType()
+	{
+	return iSamplerType;
+	}
+
+
+void CGeneralsPlugin::InstallStreamForActiveTraces(RGeneralsSampler& sampler, CProfilerSampleStream& aStream)
+	{
+	// output mode for this trace is stream
+	if(!iBufferHandler)
+		{
+		// stream object has not been created yet
+		LOGTEXT(_L("CGeneralsPlugin::InstallStreamForActiveTraces - creating stream for trace"));	
+		
+		// use a 32KB buffer to transfer data from sampler to client
+		// commonStream = new RProfilerSampleStream(sampler,totalPrefix,32768);
+		TRAPD(err, iBufferHandler = CProfilerBufferHandler::NewL(aStream, sampler));
+		if(err != KErrNone)
+		    {
+		    LOGTEXT(_L("CGeneralsPlugin::InstallStreamForActiveTraces() - No memory"));
+		    return;
+		    }
+		}
+
+	// initiate receiving of data from the sampler device driver
+	if(iBufferHandler)
+		{
+		iBufferHandler->StartReceivingData();
+		}
+}
+
+void CGeneralsPlugin::SetSettingsToSamplers()
+    {
+    TSamplerAttributes attr;
+    
+    // loop through the setting attributes
+    for(TInt i(0);i<iSamplerAttributes->Count();i++)
+        {
+        // get the attribute container
+        attr = iSamplerAttributes->At(i);
+        
+        // make changes according to right sampler, NOTE! The old IDs of sub samplers (i+1)!
+        if(attr.iEnabled)
+            {
+            iGeneralsSampler.MarkTraceActive(i+1);
+            
+            // set enabled
+            iEnabled = ETrue;
+            }
+        else
+            {
+            iGeneralsSampler.MarkTraceInactive(i+1);
+            }
+        // set sampling period if available
+        if(attr.iSampleRate != KErrNotFound)
+            {
+            iGeneralsSampler.SetSamplingPeriod(i+1, attr.iSampleRate);
+            }
+        }
+    }
+
+TInt CGeneralsPlugin::ResetAndActivateL(CProfilerSampleStream& aStream) 
+    {
+	// the sampler starting functionality
+	LOGTEXT(_L("CGeneralsPlugin::ResetAndActivate() - entry"));
+
+    // now before starting the latest settings must be set to samplers itself
+	SetSettingsToSamplers();
+
+	if(Enabled())
+	    {
+        LOGTEXT(_L("CGeneralsPlugin::ResetAndActivate() - starting sampling..."));
+        // start sampling process of enabled sub samplers
+        iGeneralsSampler.StartSampling();		
+        LOGTEXT(_L("CGeneralsPlugin::ResetAndActivate() - installing stream for an active trace..."));
+    
+        // install the trace for enabled samplers
+        InstallStreamForActiveTraces(iGeneralsSampler, aStream);
+        LOGSTRING2("CGeneralsPlugin::ResetAndActivate() - stream installed: 0x%x", aStream);
+	    }
+	
+	LOGTEXT(_L("CGeneralsPlugin::ResetAndActivate() - exit"));
+	return KErrNone;
+    }
+	
+TInt CGeneralsPlugin::StopSampling() 
+    {
+    // RDebug::Print(_L("CGeneralsPlugin::StopSampling() - Stopping sampler LDD"));
+	iGeneralsSampler.StopSampling();
+	// RDebug::Print(_L("CGeneralsPlugin::StopSampling() - Sampler LDD stopped"));
+	
+	// check if bufferhandler has died
+	if(iBufferHandler)
+		{
+		// RDebug::Print(_L("CGeneralsPlugin::StopSampling() - Canceling the buffer handler"));
+		iBufferHandler->Cancel();
+		delete iBufferHandler;
+		iBufferHandler = NULL;
+		}	
+	// set enabled
+    iEnabled = EFalse;
+    // RDebug::Print(_L("CGeneralsPlugin::StopSampling() - exit"));
+	return KErrNone;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/src/GeneralsPluginImplementationTable.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "GeneralsPlugin.h"
+
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+{
+         IMPLEMENTATION_PROXY_ENTRY(0x2001E5B2,  CGeneralsPlugin::NewL)
+};
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/src/GeneralsSampler.cia	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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 <platform.h>
+
+#include "GeneralsDriver.h"
+#include <kern_priv.h>		//temporary
+
+#ifdef __SMP__
+#include <e32cia.h>
+#include <arm.h>
+#include <arm_gic.h>
+#include <arm_tmr.h>
+#endif
+
+#if defined(__GCC32__)
+// CIA symbol macros for Gcc98r2
+#define CSM__ZN5NKern14CurrentContextEv " CurrentContext__5NKern"
+#elif defined(__ARMCC__)
+// CIA symbol macros for RVCT
+#define CSM__ZN5NKern14CurrentContextEv " __cpp(NKern::CurrentContext)"
+#else
+// CIA symbol macros for EABI assemblers
+#define CSM__ZN5NKern14CurrentContextEv " _ZN5NKern14CurrentContextEv"
+#endif
+
+#ifdef __WINS__
+__NAKED__ TUint* IntStackPtr()
+{
+	return 0;
+}
+
+__NAKED__ TUint32 SPSR()
+{
+	return 0;
+}
+__NAKED__ void UsrModLr(TUint32* a)
+{
+	*a = 0;
+}
+#else
+
+__NAKED__ TUint* IntStackPtr()
+{
+#ifdef __SMP__
+    asm("stmfd sp!, {r0-r12,lr} ");
+#endif
+	asm("mrs r1, cpsr ");           // copy current program status register (cpsr) to R1 
+	asm("bic r3, r1, #0x1f ");      // compare to 0x1f, i.e. make sure that spsr is available? 
+#ifdef __SMP__
+	__ASM_CLI_MODE(MODE_IRQ);       // disable all interrupts and set to irq mode (we are in NTimer interrupt)
+#else
+	asm("orr r3, r3, #0xd2 ");		// mode_irq, all interrupts off
+	asm("msr cpsr, r3 ");           // write result on R3 back to cpsr, irqs disabled 
+#endif
+	asm("mov r0, sp ");				// read stack pointer to R0, mode r0=sp_irq
+	asm("msr cpsr, r1 ");			// restore interrupts
+#ifdef __SMP__
+    asm("ldmfd sp!, {r0-r12,pc} ");
+#endif
+	__JUMP(,lr);
+}
+
+__NAKED__ TUint32 SPSR()
+{
+	asm("mrs r0, spsr ");
+	__JUMP(,lr);
+}
+__NAKED__ void UsrModLr(TUint32*)
+{
+	// r0 = address to store
+	asm ("stmia r0,{lr}^");
+	__JUMP(,lr);
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/src/GppSamplerImpl.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,572 @@
+/*
+* 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 <piprofiler/ProfilerVersion.h>
+#include <piprofiler/ProfilerTraces.h>
+#include <kern_priv.h>
+#include <arm.h>
+
+#include "GppSamplerImpl.h"
+
+extern TUint*		IntStackPtr();
+#define	TAG(obj)	(*(TUint32*)&(obj.iAsyncDeleteNext))
+
+// properties for ISA task parsing
+const TUid KIsaPropertyCat={0x2001E5AD};
+enum TIsaPropertyKeys
+	{
+	EIsaPropertyIsaTaskParserStatus = 1,
+	EIsaPropertyIsaTaskAddressStart,
+	EIsaPropertyIsaTaskAddressEnd,
+	EIsaPropertyIsaTaskAddress,
+	EIsaPropertyIsaOsTaskRunningAddress,
+	EIsaPropertyIsaTaskParsedName
+	};
+
+
+DGppSamplerImpl::DGppSamplerImpl()
+	{
+	LOGTEXT("GppSamplerImpl::GppSamplerImpl");
+	iInterruptStack = (TUint*)IntStackPtr();
+
+	LOGTEXT("GppSamplerImpl::GppSamplerImpl - attaching to properties");
+
+	TInt err = iIsaStartAddr.Attach(KIsaPropertyCat, EIsaPropertyIsaTaskAddressStart);
+	if(err != KErrNone)
+		LOGTEXT("GppSamplerImpl::GppSamplerImpl() - Property EIsaPropertyIsaTaskAddressStart not available"); 
+	err = iIsaEndAddr.Attach(KIsaPropertyCat, EIsaPropertyIsaTaskAddressEnd);
+	if(err != KErrNone)
+		LOGTEXT("GppSamplerImpl::GppSamplerImpl() - Property EIsaPropertyIsaTaskAddressEnd not available"); 
+	err = iIsaPluginStatus.Attach(KIsaPropertyCat, EIsaPropertyIsaTaskParserStatus);
+	if(err != KErrNone)
+		LOGTEXT("GppSamplerImpl::GppSamplerImpl() - Property EIsaPropertyIsaTaskParserStatus not available"); 
+	err = iIsaOsTaskRunning.Attach(KIsaPropertyCat, EIsaPropertyIsaOsTaskRunningAddress);
+	if(err != KErrNone)
+		LOGTEXT("GppSamplerImpl::GppSamplerImpl() - Property EIsaPropertyIsaOsTaskRunningAddress not available"); 
+	
+	PROFILER_ISA_TASK_NAMES
+	
+	Reset();
+	}
+
+DGppSamplerImpl::~DGppSamplerImpl() 
+	{
+	iIsaStartAddr.Close();
+	iIsaEndAddr.Close();
+	iIsaPluginStatus.Close();
+	iIsaOsTaskRunning.Close();
+	}
+
+void DGppSamplerImpl::Reset()
+	{
+	LOGTEXT("GppSamplerImpl::Reset");
+	iLastPc = 0;
+	iLastThread = 0xfffffffe;
+	iRepeat = 0;
+	iIsaStatus = 0;
+	iIsaStart = 0;
+	iIsaEnd = 0;
+//	isaOsTaskRunningAddr = 0;
+	
+	// in SMP start time common with all CPUs, provided by DGeneralsDriver class
+#ifndef __SMP__
+	iStartTime = ( NKern::TickCount() & 0xfffffffc );
+#endif
+	
+	TPropertyStatus status;
+	TInt osAddr = 0;
+	
+	LOGTEXT("GppSamplerImpl::Reset - getting status");
+	
+	// get status of ISA plug-in
+	if(iIsaPluginStatus.GetStatus(status))
+		{
+		iIsaPluginStatus.Get(iIsaStatus);
+		LOGSTRING2("GppSamplerImpl::Reset - ISA plug-in status %d", iIsaStatus);
+		}
+	
+	if(iIsaStatus > 0)
+		{
+		LOGTEXT("GppSamplerImpl::Reset - get isa start address");
+		iIsaStartAddr.Get(iIsaStart);
+		LOGTEXT("GppSamplerImpl::Reset - get isa end address");
+		iIsaEndAddr.Get(iIsaEnd);
+		LOGTEXT("GppSamplerImpl::Reset - get isa os_task_running address");
+		iIsaOsTaskRunning.Get(osAddr);
+		isaOsTaskRunningAddr = reinterpret_cast<TInt*>(osAddr);
+		LOGSTRING2("GppSamplerImpl::Reset - got isa os_task_running address 0x%X", osAddr);
+		}
+	
+	LOGTEXT("GppSamplerImpl::Reset - initializing isa task list");
+
+	iIsaSample = false;
+	
+	for(TInt i=0;i<256;i++)
+		knownIsaTasks[i] = -1;
+	
+	knownIsaTaskCount = 0;
+    
+	iCpuSelector = 0x3;
+#ifndef __SMP__
+    iMask =  0xfffffffc;
+#else
+    iMask =  0xfffffff0;
+    switch(iCpuNumber)
+        {
+        case 0:
+            iCpuSelector = 0x1;
+            break;
+        case 1:
+            iCpuSelector = 0x2;
+            break;
+        case 2:
+            iCpuSelector = 0x4;
+            break;
+        case 3:
+            iCpuSelector = 0x8;
+            break;
+        }
+#endif
+	}
+
+TUint8* DGppSamplerImpl::EncodeTag(TUint8* aPtr)
+//
+// Encode a tag and version to the trace data. This allows the offline analyser to 
+// identify the sample data.
+//
+{	
+	_LIT(KGppSamplerVersion,"Bappea_GPP_V");
+	_LIT(KProfilerVersion,"#Prof#");
+	_LIT(KSamplerVersion,"#Samp#");
+#ifdef __SMP__
+	_LIT(KCPUNumberText,"#CPU#");
+#endif
+	
+	TBuf<64> buf;
+	buf.Zero();
+	buf.Append(KGppSamplerVersion);
+	buf.Append(PROFILER_GPP_SAMPLER_VERSION);
+	buf.Append(KProfilerVersion);
+	buf.Append(PROFILER_VERSION_SHORT);	
+	buf.Append(KSamplerVersion);
+	buf.Append(PROFILER_SAMPLER_VERSION);
+#ifdef __SMP__
+	buf.Append(KCPUNumberText);
+	buf.AppendNum(iCpuNumber);
+#endif
+	aPtr = EncodeText(aPtr, buf);
+	return aPtr;
+}
+
+TUint8* DGppSamplerImpl::EncodeInt(TUint8* aPtr,TInt aValue)
+{
+	LOGSTRING2("Encoding int 0x%x",aPtr);
+
+	LOGSTRING2("TIint = 0x%x",aValue);
+
+	TUint byte;
+	for (;;)
+		{
+		byte = aValue & 0x7f;
+		if ((aValue >> 6) == (aValue >> 7))
+			break;
+		aValue >>= 7;
+		*aPtr++ = byte;
+		}
+	*aPtr++ = byte | 0x80;
+
+	LOGSTRING2("Encoded int 0x%x",aPtr);
+
+	return aPtr;
+}
+
+TUint8* DGppSamplerImpl::EncodeUint(TUint8* aPtr,TUint aValue)
+{
+	LOGSTRING2("Encoding Uint 0x%x",aPtr);
+
+	LOGSTRING2("TUint = 0x%x",aValue);
+
+
+	TUint byte;
+	for (;;)
+		{
+		byte = aValue & 0x7f;
+		aValue >>= 7;
+		if (aValue == 0)
+			break;
+		*aPtr++ = byte;
+		}
+	*aPtr++ = byte | 0x80;
+
+	LOGSTRING2("Encoded Uint 0x%x",aPtr);
+
+	return aPtr;
+}
+
+TUint8* DGppSamplerImpl::EncodeText(TUint8* aPtr, const TDesC& aDes)
+//
+// Encode a descriptor into the data stream
+// This is currently limited to a descriptor that is up to 255 characters in length,
+// and Unicode characters are truncated to 8 bits
+//
+{
+	LOGSTRING2("Encoding text 0x%x",aPtr);
+	TInt len=aDes.Length();
+	*aPtr++ = TUint8(len);
+	const TText* p = aDes.Ptr();
+	while (--len >= 0)
+		{
+		*aPtr++ = TUint8(*p++);
+		}
+
+	LOGSTRING2("Encoded text 0x%x",aPtr);
+	return aPtr;
+}
+
+
+TUint8* DGppSamplerImpl::EncodeName(TUint8* aPtr, DObject& aObject,TUint32 id)
+//
+// Encode the name of a kernel object
+//
+{
+	LOGSTRING2("Encoding name 0x%x",aPtr);
+	TBuf8<0x5f> name;
+	aObject.TraceAppendName(name,false);
+
+	if(id != 0xffffffff)
+	{
+		name.Append('[');
+		name.AppendNum(id,EHex);
+		name.Append(']');
+	}
+	else
+	{
+		name.Append('[');
+		name.AppendNum((TUint32)((void*)&(((DThread*)&aObject)->iNThread)),EHex);
+		name.Append(']');
+	}
+
+	aPtr = EncodeText(aPtr,name);
+	LOGSTRING2("Encoded name 0x%x",aPtr);
+	return aPtr;
+}
+
+TUint8* DGppSamplerImpl::EncodeThread(TUint8* aPtr, DThread& aThread)
+//
+// Encode a thread name in the data stream.
+// The thread is identified by its name, and the identity of its owning process.
+// If the process has not been identified in the data stream already, it's name is
+// also encoded.
+//
+{
+	LOGSTRING2("Encoding thread 0x%x",aPtr);	
+
+	DProcess& p = *aThread.iOwningProcess;
+	
+	aPtr = EncodeUint(aPtr, p.iId);
+
+#ifdef __SMP__
+    // check if first time founding
+    if ((TAG(p) & iMask) != iStartTime)
+        {
+        // mark tagged for this CPU
+        TAG(p) = (iStartTime | iCpuSelector);
+
+        // The thread is 'unknown' to this sample, so encode the thread name
+        aPtr = EncodeName(aPtr, p, p.iId);     
+        }
+    // check if thread appeared already on this CPU
+    else if((TAG(p) & iCpuSelector) != iCpuSelector)
+        {
+        TAG(p) = (TAG(p) | iCpuSelector);
+        // The thread is 'unknown' to this sample, so encode the thread name
+        aPtr = EncodeName(aPtr, p, p.iId);     
+        }
+#else
+	if (TAG(p) != iStartTime)
+	    {
+		TAG(p) = iStartTime;
+		// Provide the name matching this process ID
+		aPtr = EncodeName(aPtr, p, p.iId);
+	    }
+#endif	    
+	aPtr = EncodeName(aPtr, aThread,0xffffffff);
+	
+	LOGSTRING2("Encoded thread 0x%x",aPtr);	
+
+	return aPtr;
+    }
+
+TUint8* DGppSamplerImpl::EncodeRepeat(TUint8* aPtr)
+//
+// Encode a repeated sequence of samples
+//
+{
+	LOGSTRING2("Encoding repeat, 0x%x",iRepeat);	
+
+	aPtr = EncodeInt(aPtr, 0);
+	aPtr = EncodeUint(aPtr, iRepeat);
+	iRepeat = 0;
+
+	LOGSTRING2("Encoded repeat, 0x%x",iRepeat);	
+
+	return aPtr;
+}
+
+TInt DGppSamplerImpl::CreateFirstSample()
+{
+	LOGTEXT("GppSamplerImpl::CreateFirstSample");
+	Reset();
+
+	TUint8* w = this->tempBuf;
+	w = EncodeTag(w);
+
+	TInt length = w-tempBuf;
+
+	LOGSTRING2("TAG encoded, length %d",length);
+	return length;
+}
+
+TBool DGppSamplerImpl::IsaTaskKnown(TUint8 task)
+{
+	for(TInt i=0;i<256;i++)
+	{
+		if(knownIsaTasks[i] == -1)
+		{
+			knownIsaTasks[i] = task;
+			knownIsaTaskCount++;
+			return false;
+		}
+		else if(knownIsaTasks[i] == task)
+		{
+			return true;
+		}
+	}
+
+	return false;
+}
+
+TUint8* DGppSamplerImpl::EncodeIsaTask(TUint8* aPtr, TUint task)
+
+{
+	LOGSTRING2("Encoding ISA task 0x%x",aPtr);	
+
+	aPtr = EncodeUint(aPtr,task);
+	// use the task name as the process name
+	aPtr = EncodeIsaName(aPtr,task,true);
+	// then encode the task name
+	aPtr = EncodeIsaName(aPtr,task,false);
+	
+	LOGSTRING2("Encoded ISA task 0x%x",aPtr);	
+
+	return aPtr;
+}
+
+TUint8* DGppSamplerImpl::EncodeIsaName(TUint8* aPtr, TUint task,TBool process)
+//
+// Encode a descriptor into the data stream
+// This is currently limited to a descriptor that is up to 255 characters in length,
+// and Unicode characters are truncated to 8 bits
+//
+{
+	TBuf8<256> aDes;
+	
+//	#ifdef NCP_COMMON_PROFILER_ISA_TASKS 
+	if(iIsaStatus > 0)
+		{
+		// resolve the isa task name from the task name array
+		if((task-100000) < PROFILER_ISA_OS_TASK_AMOUNT && process == false)
+			{
+			aDes.Append(isaTaskNames[(task-100000)]);
+			}
+		else
+			{
+			aDes.Append(_L8("NativeOS_Task"));
+			}
+		}
+	else
+		{
+		aDes.Append(_L8("NativeOS_Task"));
+		}
+	
+	aDes.Append('[');
+	aDes.AppendNum((task-100000),EHex);
+	aDes.Append(']');
+
+	LOGSTRING2("Encoding ISA name 0x%x",aPtr);
+	TInt len=aDes.Length();
+	*aPtr++ = TUint8(len);
+	const TText* p = aDes.Ptr();
+	while (--len >= 0)
+		{
+		*aPtr++ = TUint8(*p++);
+		}
+
+	LOGSTRING2("Encoded ISA name 0x%x",aPtr);
+	return aPtr;
+}
+
+
+TInt DGppSamplerImpl::SampleImpl()
+//
+// ISR for the profile timer
+// This extracts the thread and PC that was current when the interrupt went off and
+// encodes it into the sample data buffer. If enough data has been generated, the
+// DFC is triggered to complete a read request
+//
+    {
+	TUint8* w(this->tempBuf);
+	
+//    Kern::Printf(("Got thread 0x%08x"), &t);
+#ifdef __SMP__
+    // get the program counter of irq mode
+    TUint32 pc = (TUint32)Arm::IrqReturnAddress();
+#else
+    // get program counter of irq mode
+    TUint32 pc = iInterruptStack[-1];
+#endif
+    //LOGSTRING3("pc value 0x%x sp 0x%x",pc,iInterruptStack);
+
+	// ignore the low bit being set for THUMB mode - we use for something else
+	pc &= ~1;			
+	TInt diff = pc - iLastPc;
+	iLastPc = pc;
+
+	if(iIsaStatus > 0)
+		{
+		if((TUint32)pc > (TUint32)iIsaStart && (TUint32)pc < (TUint32)iIsaEnd)
+			{
+			LOGSTRING2("Identified ISA execution at 0x%x",pc);
+			iIsaSample = true;
+			}
+		else
+			{
+			LOGSTRING2("Normal sample at 0x%x",pc);
+			iIsaSample = false;
+			}
+		}
+
+	// request for current thread from kernel
+	DThread& t = ((DThread&)*Kern::NThreadToDThread(NKern::CurrentThread()));
+	
+	TUint tid;
+	TUint8 isaTask = 0;
+	if(iIsaSample)
+	{
+		LOGSTRING2("Reading ISA task number from 0x%x",isaOsTaskRunningAddr);
+
+		// if we don't get reasonable ISA address to read, skip ISA task handling
+		if(isaOsTaskRunningAddr == 0)
+			{
+			tid = 100000; // to tell the difference from SOS threads
+			iIsaSample = false;
+			}
+		else	// normal ISA task parsing process
+			{
+			isaTask = *isaOsTaskRunningAddr;
+			LOGSTRING2("ISA task = %d",isaTask);
+			tid = isaTask;
+			// this will make sure we don't mix ISA tasks and normal tasks
+			tid += 100000;
+			}
+
+	}
+	else
+	{
+		tid = t.iId;
+	}
+
+	if (tid != iLastThread)
+	{
+		// Change of thread is marked in the low bit of the PC difference
+		diff |= 1;
+	}
+	TUint rp = iRepeat;
+	if (diff == 0)
+	{
+		// Identical sample, bump up the repeat count
+		iRepeat = rp + 1;
+	}
+	else
+	{
+		if (rp)
+		{
+			// Encode the repeat data
+			w = EncodeRepeat(w);
+		}
+		// Encode the PC difference
+		w = EncodeInt(w, diff);
+		if (diff & 1)
+		{
+			// Encode the new thread ID
+			if(iIsaSample)
+			{
+				iLastThread = tid;
+				w = EncodeUint(w,tid);
+
+				if(!this->IsaTaskKnown(isaTask))
+				{
+					w = EncodeIsaTask(w,iLastThread);
+				}
+				//LOGSTRING2("Sample total length: %d",w-tempBuf);
+				TInt length = w-tempBuf;
+				// encoded isa task, return here
+				return length;
+			}
+		
+			iLastThread = tid;
+			w = EncodeUint(w, tid);
+
+#ifdef __SMP__
+			// iStartTime format: 0xXXXXXXX0, the last byte set to zero
+			// iMask =  0xfffffff0(0b111....1110000)
+			// iCpuSelector = 0x1(0b0001), 0x2(0b0010), 0x4(0b0100) or 0x8(0b1000) 
+			
+			// check first time founding
+			if ((TAG(t) & iMask) != iStartTime)
+			    {
+			    // mark tagged for this CPU
+				TAG(t) = (iStartTime | iCpuSelector);
+				
+				// The thread is 'unknown' to this sample, so encode the thread name
+				w = EncodeThread(w, t);		
+			    }
+			// check if thread appeared on this CPU
+			else if((TAG(t) & iCpuSelector) != iCpuSelector)
+			    {
+                TAG(t) = (TAG(t) | iCpuSelector);
+                // The thread is 'unknown' to this sample, so encode the thread name
+                w = EncodeThread(w, t);     
+			    }
+#else
+			// check if tag has not been set, neither original nor 
+            if ((TAG(t) & 0xfffffffc) != iStartTime)
+                {
+                TAG(t) = ((TAG(t) & 0x3) | iStartTime);
+                // The thread is 'unknown' to this sample, so encode the thread name
+                w = EncodeThread(w, t);     
+                }
+#endif
+		    }
+	    }
+	LOGSTRING2("Sample total length: %d",w-tempBuf);
+	TInt length = w-tempBuf;
+
+	return length;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/src/IttEventHandler.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,174 @@
+/*
+* 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:  Event based ITT sampler skeleton copypasted from MemoryEventHandler.cpp
+*
+*/
+
+#include <e32def.h>
+#include <e32cmn.h>
+#include <arm.h>
+#include <kernel.h>
+#include <kern_priv.h>
+#include <nk_trace.h>
+
+#include "IttEventHandler.h"
+
+/*
+ * Constructor
+ * 
+ * @param DProfilerSampleBuffer*    pointer to sample buffer
+ */
+DIttEventHandler::DIttEventHandler(DProfilerSampleBuffer* aSampleBuffer, TProfilerGppSamplerData* aGppSamplerDataIn)
+    :   DKernelEventHandler(EventHandler, this),
+        iSampleBuffer(aSampleBuffer),
+        iSampleDescriptor(&(this->iSample[1]),0,KITTBufferSize),
+        gppSamplerData(aGppSamplerDataIn)
+    {
+    //Kern::Printf("DIttEventHandler::DIttEventHandler()");
+
+    }
+
+/*
+ * DIttEventHandler::Create()
+ */
+TInt DIttEventHandler::Create()
+    {
+    Kern::Printf("DIttEventHandler::Create()");
+
+    TInt err(Kern::MutexCreate(iLock, _L("IttEventHandlerLock"), KMutexOrdDebug));
+    if (err != KErrNone)
+        return err;
+    
+    return Add();
+    }
+
+/*
+ * Destructor
+ */
+DIttEventHandler::~DIttEventHandler()
+    {
+    //Kern::Printf("DIttEventHandler::~DIttEventHandler()");
+
+    if (iLock)
+        iLock->Close(NULL);
+    }
+
+
+TInt DIttEventHandler::Start()
+    {
+    //Kern::Printf("DIttEventHandler::Start()");
+
+    iTracking = ETrue;
+    return KErrNone;
+    }
+
+
+TInt DIttEventHandler::Stop()
+    {
+    //Kern::Printf("DIttEventHandler::Stop()");
+
+    iTracking = EFalse;
+    return KErrNone;
+    }
+
+TBool DIttEventHandler::SampleNeeded()
+    {
+    LOGTEXT("DIttEventHandler::SampleNeeded()");
+    
+    // increase the counter by one on each round
+    iCount++;
+    
+    // check if event handler was not running
+    if(!iTracking)
+       return false;
+    
+    return true;
+    }
+
+
+TUint DIttEventHandler::EventHandler(TKernelEvent aType, TAny* a1, TAny* a2, TAny* aThis)
+    {
+    //Kern::Printf("DIttEventHandler::EventHandler()");
+    return ((DIttEventHandler*)aThis)->HandleEvent(aType, a1, a2);
+    }
+
+
+
+TUint DIttEventHandler::HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2)
+    {
+    //Kern::Printf("DIttEventHandler::HandleEvent()");
+    //Kern::Printf("New kernel event received, %d", aType);
+    
+    if (iTracking/* && iCount != iPreviousCount*/)
+        {
+        switch (aType)
+            {
+            
+            case EEventAddCodeSeg:
+                //Kern::Printf("DCodeSeg added: 0x%08x", (DCodeSeg*)a1);
+                HandleAddCodeSeg((DCodeSeg*)a1);
+                break;
+                
+            case EEventRemoveCodeSeg:
+                //Kern::Printf("DCodeSeg deleted: 0x%08x", (DCodeSeg*)a1);
+                HandleRemoveCodeSeg((DCodeSeg*)a1);
+                break;
+   
+            default:
+                break;
+            }
+        }
+//    else if(iTracking && iCount == iPreviousCount)
+//        {
+//        // if time stamp is not updated profiling has stopped
+//        Stop();
+//        }
+    return DKernelEventHandler::ERunNext;
+    }
+
+/*
+ * 
+ */
+TBool DIttEventHandler::HandleAddCodeSeg(DCodeSeg* aSeg)
+    {    
+    iSampleDescriptor.Zero();
+    //Kern::Printf("DLL ADD: NM %S : RA:0x%x SZ:0x%x SN:0x%x",aSeg->iFileName,aSeg->iRunAddress,aSeg->iSize, this->gppSamplerData->sampleNumber);
+
+    iSample[0] = aSeg->iFileName->Length();
+    iSampleDescriptor.Append(*aSeg->iFileName);
+    iSampleDescriptor.Append((TUint8*)&(aSeg->iRunAddress),4);
+    iSampleDescriptor.Append((TUint8*)&(aSeg->iSize),4);
+    iSampleDescriptor.Append((TUint8*)&(this->gppSamplerData->sampleNumber),4);
+    iSample[0] = iSampleDescriptor.Size();
+    
+    iSampleBuffer->AddSample(iSample,iSampleDescriptor.Size()+1);
+    return ETrue;
+    }
+
+TBool DIttEventHandler::HandleRemoveCodeSeg(DCodeSeg* aSeg)
+    {
+    iSampleDescriptor.Zero();
+    //Kern::Printf("DLL REM: NM %S : RA:0x%x SZ:0x%x SN:0x%x",aSeg->iFileName,aSeg->iRunAddress,aSeg->iSize, this->gppSamplerData->sampleNumber);
+
+    iSample[0] = aSeg->iFileName->Length();
+    iSampleDescriptor.Append(*aSeg->iFileName);
+    iSampleDescriptor.Append((TUint8*)&(aSeg->iRunAddress),4);
+    iSampleDescriptor.Append((TUint8*)&(aSeg->iSize),4);
+    iSampleDescriptor.Append((TUint8*)&(this->gppSamplerData->sampleNumber),4);
+    iSample[0] = iSampleDescriptor.Size();
+    
+    iSampleBuffer->AddSample(iSample,iSampleDescriptor.Size()+1);
+    return ETrue;
+    }
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/src/IttSamplerImpl.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,244 @@
+/*
+* 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 <piprofiler/ProfilerVersion.h>
+
+#include <kern_priv.h>
+#include <plat_priv.h>
+
+#include "IttSamplerImpl.h"
+
+#ifdef ITT_EVENT_HANDLER
+_LIT8(KIttVersion, "2.00");
+#else
+_LIT8(KIttVersion, "1.22");
+#endif
+
+/*
+ *	ITT sampler definition
+ *  	
+ */
+IttSamplerImpl::IttSamplerImpl():
+        sampleDescriptor(&(this->sample[1]),0,KITTSampleBufferSize)
+{
+	this->currentLibCount = 0;
+	iTimeToSample = EFalse;
+	this->Reset();
+}
+
+/*
+ * destructor
+ */
+IttSamplerImpl::~IttSamplerImpl()
+{
+
+}
+
+/*
+ * IttSamplerImpl::CreateFirstSample()
+ * 
+ * Function for creating the first sample to the log file
+ */
+TInt IttSamplerImpl::CreateFirstSample() 
+{	
+    Kern::Printf("ittSamplerImpl::createFirstSample\n");
+	this->iVersionData.Zero();
+	this->iVersionData.Append(_L8("Bappea_ITT_V"));
+	this->iVersionData.Append(KIttVersion);
+	this->itt_sample = (TUint8*)iVersionData.Ptr();
+	return iVersionData.Length();
+}
+
+/*
+ * IttSamplerImpl::SampleNeeded(TUint32 sampleNum)
+ * 
+ * @param TUint32 Sample number
+ * 
+ */
+TBool IttSamplerImpl::SampleNeeded(TUint32 sampleNum)
+{
+#ifdef ITT_EVENT_HANDLER
+    iCount++;
+    if (iCount <= iIttSamplingPeriod && ((iCount % iIttSamplingPeriod) == 0 || (iCount % iIttSamplingPeriodDiv2) == 0))
+    {
+        LOGSTRING2("IttSamplerImpl::SampleNeeded - time: %d", iCount);
+        iTimeToSample = true;
+#else
+    // no need to do anything, always a good time to sample.
+    // Sample time filtering is done in IttSamplerImpl:SampleImpl() function
+#endif
+        return true;
+#ifdef ITT_EVENT_HANDLER    
+    }
+    else 
+    {
+        return false;
+    }
+#endif
+}
+
+/*
+ * IttSamplerImpl::SampleImpl(TUint32 pc, TUint32 sampleNum)
+ * 
+ * @param TUint32 program counter
+ * @param TUint32 sample number
+ */
+TInt IttSamplerImpl::SampleImpl(TUint32 pc,TUint32 sampleNum)
+{	
+    // in order to avoid overloading the interrupt
+	// only one dynamic file in each 50ms is added to the stream
+	// with the application of the tool in mind, this is
+	// a reasonable measure
+
+    // encode a process binary
+    sampleDescriptor.Zero();
+	// original 
+	if((sampleNum % 20) != 0) return 0;
+	if((sampleNum % 40) == 0)
+	{
+		// encode a library binary
+		sampleDescriptor.Zero();
+		DObjectCon* libs = Kern::Containers()[ELibrary];
+		TInt libCount = libs->Count();
+		
+		// go 20 binaries through at a time
+		for(TInt i=0;i<20;i++)
+		{
+			if(currentLibCount >= libCount)
+			{
+				currentLibCount = 0;
+			}
+			
+			DLibrary* lib = (DLibrary*)(*libs)[currentLibCount];
+			currentLibCount++;
+			
+			DCodeSeg* seg = lib->iCodeSeg;
+			if(seg != 0)
+			{
+				if( (seg->iMark & 0x80) == 0)
+				{
+					this->sample[0] = seg->iFileName->Length();
+					sampleDescriptor.Append(*(seg->iFileName));
+					sampleDescriptor.Append((TUint8*)&(seg->iRunAddress),4);
+					sampleDescriptor.Append((TUint8*)&(seg->iSize),4);
+#ifdef ITT_EVENT_HANDLER
+					sampleDescriptor.Append((TUint8*)&(sampleNum),4);
+					//Kern::Printf("DLL: NM %S : RA:0x%x SZ:0x%x, SN:0x%x",seg->iFileName,seg->iRunAddress,seg->iSize, sampleNum);
+					this->iFirstSampleTaken = ETrue;
+#else
+		            //Kern::Printf("DLL: NM %S : RA:0x%x SZ:0x%x",seg->iFileName,seg->iRunAddress,seg->iSize);
+#endif
+					seg->iMark = (seg->iMark | 0x80);
+					
+					this->sample[0] = sampleDescriptor.Size();
+					return sampleDescriptor.Size()+1;
+				}
+			}
+		}
+	} else
+	{
+		SDblQue* codeSegList = Kern::CodeSegList();
+		//Kern::Printf("PI");
+		//TUint c = 0;
+		// the global list
+		for (SDblQueLink* codeseg= codeSegList->First(); codeseg!=(SDblQueLink*) codeSegList; codeseg=codeseg->iNext)
+		{				
+			DCodeSeg* seg = _LOFF(codeseg, DCodeSeg, iLink);
+			if(seg != 0)
+			{
+				if( (seg->iMark & 0x80) == 0)
+				{
+					this->sample[0] = seg->iFileName->Length();
+					sampleDescriptor.Append(*(seg->iFileName));
+					sampleDescriptor.Append((TUint8*)&(seg->iRunAddress),4);
+					sampleDescriptor.Append((TUint8*)&(seg->iSize),4);
+#ifdef ITT_EVENT_HANDLER
+                    sampleDescriptor.Append((TUint8*)&(sampleNum),4);
+                    //Kern::Printf("EXE2: NM %S : RA:0x%x SZ:0x%x, time: %d",seg->iFileName,seg->iRunAddress,seg->iSize, sampleNum);
+                    this->iFirstSampleTaken = ETrue;                    
+#else
+					//Kern::Printf("EXE2: NM %S : RA:0x%x SZ:0x%x, time: %d",seg->iFileName,seg->iRunAddress,seg->iSize, sampleNum);
+#endif					
+					seg->iMark = (seg->iMark | 0x80);
+					
+					this->sample[0] = sampleDescriptor.Size();
+					return sampleDescriptor.Size()+1;
+				}
+			}
+		}	
+	}
+	return 0;
+}
+
+/*
+ * IttSamplerImpl::Reset()
+ */
+void IttSamplerImpl::Reset()
+{
+    iTimeToSample = EFalse;
+#ifdef ITT_EVENT_HANDLER
+    iFirstSampleTaken = EFalse;
+#endif
+	this->currentLibCount = 0;
+	this->itt_sample = (TUint8*)&(this->sample[0]);
+	sampleDescriptor.Zero();
+
+//	#ifdef ITT_TEST	
+	SDblQue* codeSegList = Kern::CodeSegList();
+	// the global list
+	for (SDblQueLink* codeseg= codeSegList->First(); codeseg!=(SDblQueLink*) codeSegList; codeseg=codeseg->iNext)
+	{				
+		DCodeSeg* seg = _LOFF(codeseg,DCodeSeg, iLink);
+		//if(seg != 0)
+		{
+			if( (seg->iMark & 0x80) > 0)
+			{
+				seg->iMark = (seg->iMark & ~0x80);
+			}
+		}
+	}	
+	// the garbage list
+	DObjectCon* libs = Kern::Containers()[ELibrary];
+	TInt libCount = libs->Count();
+	for(TInt i=0;i<libCount;i++)
+	{
+		DLibrary* lib = (DLibrary*)(*libs)[i];
+		DCodeSeg* seg = lib->iCodeSeg;
+		if( (seg->iMark & 0x80) > 0)
+		{
+			seg->iMark = (seg->iMark & ~0x80);
+		}
+	}
+	
+	DObjectCon* procs = Kern::Containers()[EProcess];
+	TInt procCount = procs->Count();
+	for(TInt i=0;i<procCount;i++)
+	{
+		DProcess* pro = (DProcess*)(*procs)[i];
+		DCodeSeg* seg = pro->iCodeSeg;
+		if(seg != 0)
+		{
+			if( (seg->iMark & 0x80) > 0)
+			{
+				seg->iMark = (seg->iMark & ~0x80);
+			}
+		}
+	}
+	//#endif   //ITT_TEST
+}
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/src/MemSamplerImpl.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,974 @@
+/*
+* 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 <piprofiler/ProfilerVersion.h>
+#include <piprofiler/ProfilerTraces.h>
+
+#include <kern_priv.h>
+#include <plat_priv.h>
+
+#include "MemSamplerImpl.h"
+
+// for testing precise stack utilization tracing...
+// crashes at the moment
+
+#include <nk_cpu.h>
+
+#if !defined(__NKERN_H__)
+#include <nkern.h>
+#endif 
+
+#define TAG(obj) (*(TUint32*)&(obj->iAsyncDeleteNext))
+#define PROFILER_CHUNK_MARK		((TUint32)0x00001000)
+#define PROFILER_MEM_THREAD_MARK	((TUint32)0x00000001)
+#define PROFILER_LIBRARY_MARK    ((TUint32)0x10000000)
+#define PROFILER_MEM_THREAD_UNMARK  ~PROFILER_MEM_THREAD_MARK
+
+#ifdef MEM_EVENT_HANDLER
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+_LIT8(KMemVersion,"2.03");
+#else
+_LIT8(KMemVersion, "2.02");
+#endif
+#else
+_LIT8(KMemVersion, "1.56");
+#endif
+
+DMemSamplerImpl::DMemSamplerImpl() :
+	sampleDescriptor(&(this->sample[1]),0,256)
+    {
+    LOGSTRING("MemSamplerImpl::MemSamplerImpl() - konstruktori");
+
+	iCount = 0;
+		
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+	iSampleType = ESampleThreads;
+#else
+	iSampleThreads = true;
+#endif
+	iTimeToSample = false;
+	
+	iTotalMemoryOk = false;
+	iTotalMemoryNameOk = false;
+	
+	iNewChunkCount = 0;
+	iChunkCount = 0;
+	iChunksProcessing = ENothingToProcess;
+    iThreadsProcessing = ENothingToProcess;
+	
+	iNewThreadCount = 0;
+	iThreadCount = 0;
+	
+	// reset data structures
+    for(TInt i(0);i<KProfilerMaxChunksAmount;i++)
+        {
+        // heap chunks
+        this->heapChunksToSample[i] = 0;
+        this->heapChunkNamesToReport[i] = 0;
+        }
+    
+    for(TInt i(0);i<KProfilerMaxThreadsAmount;i++)
+        {
+        // threads
+        this->threadsToSample[i] = 0;
+        this->threadNamesToReport[i] = 0;
+        }
+    
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+    iLibrariesProcessing = ENothingToProcess;
+    iNewLibraryCount = 0;
+    iLibraryCount = 0;
+    
+    for(TInt i(0); i<KProfilerMaxLibrariesAmount; i++)
+        {
+        // libraries
+        this->librariesToSample[i] = 0;
+        this->libraryNamesToReport[i] = 0;
+        }
+#endif
+
+    }
+
+DMemSamplerImpl::~DMemSamplerImpl()
+    {
+
+    }
+
+TInt DMemSamplerImpl::CreateFirstSample()
+    {
+    LOGSTRING("MemSamplerImpl::CreateFirstSample - entry");
+	
+	this->sampleDescriptor.Zero();
+	this->sampleDescriptor.Append(_L8("Bappea_V"));
+	this->sampleDescriptor.Append(KMemVersion);
+	this->sampleDescriptor.Append(_L8("_MEM"));
+	
+	sample[0] = this->sampleDescriptor.Size();
+
+	LOGSTRING("MemSamplerImpl::CreateFirstSample - exit");
+
+	return (TInt)(sample[0]+1);
+    }
+
+TBool DMemSamplerImpl::SampleNeeded()
+    {
+	iCount++;
+#ifdef MEM_EVENT_HANDLER
+    // make the collection of chunks/threads only once, rest will be collected with mem event handler
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+	if (iCount <= iMemSamplingPeriod && ((iCount % iMemSamplingPeriod) == 0 || (iCount % iMemSamplingPeriodDiv3) == 0))
+#else
+    if (iCount <= iMemSamplingPeriod && ((iCount % iMemSamplingPeriod) == 0 || (iCount % iMemSamplingPeriodDiv2) == 0))
+#endif
+#else
+	if ((iCount % iMemSamplingPeriod) == 0 || (iCount % iMemSamplingPeriodDiv2) == 0)
+#endif
+	    {
+        LOGSTRING2("MemSamplerImpl::SampleNeeded - time: %d", iCount);
+		iTimeToSample = true;
+		return true;
+        }
+	else 
+	    {
+		return false;
+        }
+
+    }
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+TInt DMemSamplerImpl::SampleImpl()
+    {    
+    // Sample threads:
+    if( iSampleType == ESampleThreads )
+        {    
+        if(this->iThreadsProcessing == ENothingToProcess )
+            {     
+            if(!iTimeToSample)
+                {
+                return 0;
+                }
+            else
+                {
+                iTimeToSample = false;
+                // gather first all thread stacks
+                return GatherThreads();
+                }
+            }
+        else
+            {
+            // process now thread stack list
+            TInt length = this->ProcessThreads();
+
+            if(length == 0)
+                {
+                this->iThreadsProcessing = ENothingToProcess;
+                // switch to collect chunk data
+                iSampleType = ESampleChunks;
+                }
+            return length;
+            }
+        }
+
+    // Sample chunks:
+    if( iSampleType == ESampleChunks )
+        {
+        if(this->iChunksProcessing == ENothingToProcess)
+            {
+            if(!iTimeToSample)
+                {
+                return 0;
+                }
+            else
+                {
+                iTimeToSample = false;
+                // gather first all chunks
+                return GatherChunks();
+                }
+            }
+        else
+            {
+            // still something to go through in lists
+            TInt length = this->ProcessChunks();
+        
+            if(length == 0) 
+            {
+                this->iChunksProcessing = ENothingToProcess;
+                // switch to collect library data
+                iSampleType = ESampleLibraries;
+                //iSampleThreads = true;
+            }
+            return length;
+            }
+        }
+        
+    // Sample libraries:
+    if( iSampleType == ESampleLibraries )
+        {
+        if(this->iLibrariesProcessing == ENothingToProcess )
+            {        
+            if(!iTimeToSample)
+                {             
+                return 0;
+                }
+            else
+                {
+                iTimeToSample = false;
+                // gather libraries
+                return GatherLibraries();
+                }
+            }
+        else
+            {
+            // process now thread stack list
+            TInt length = this->ProcessLibraries();
+            if(length == 0)
+                {
+                this->iLibrariesProcessing = ENothingToProcess;
+                // switch to collect chunk data
+                iSampleType = ESampleThreads;
+                }
+            return length;
+            }
+        }
+
+    // should not reach this point...
+    return 0;
+    }
+#else
+TInt DMemSamplerImpl::SampleImpl()
+    {
+    // check if either chunk or thread lists have unprocessed items
+    if(this->iChunksProcessing == ENothingToProcess && !iSampleThreads)
+        {
+        if(!iTimeToSample)
+            {
+            return 0;
+            }
+        else
+            {
+            iTimeToSample = false;
+            // gather first all chunks
+            return GatherChunks();
+            }
+        }
+    else if(!iSampleThreads)
+        {
+        // still something to go through in lists
+        TInt length = this->ProcessChunks();
+        
+        if(length == 0) 
+            {
+            this->iChunksProcessing = ENothingToProcess;
+            // switch to collect thread data
+            iSampleThreads = true;
+            }
+        return length;
+        }
+    
+    if(this->iThreadsProcessing == ENothingToProcess && iSampleThreads)
+        {
+        if(!iTimeToSample)
+            {
+            return 0;
+            }
+        else
+            {
+            iTimeToSample = false;
+            // gather first all thread stacks
+            return GatherThreads();
+            }
+        }
+    
+    else if(iSampleThreads)
+        {
+        // process now thread stack list
+        TInt length = this->ProcessThreads();
+
+        if(length == 0)
+            {
+            this->iThreadsProcessing = ENothingToProcess;
+            // switch to collect chunk data
+            iSampleThreads = false;
+            }
+        return length;
+        }
+
+    // should not reach this point...
+    return 0;
+    }
+#endif
+
+inline TInt DMemSamplerImpl::GatherChunks()
+    {
+    // encode a process binary
+    name.Zero();
+    
+    NKern::ThreadEnterCS(); // Prevent us from dying or suspending whilst holding a DMutex
+    DObjectCon& chunks = *Kern::Containers()[EChunk];
+    chunks.Wait();  // Obtain the container mutex so the list does get changed under us
+    
+    this->iChunkCount = 0; 
+    this->iNewChunkCount = 0;
+    this->iTotalMemoryOk = false;
+    TInt totalChunkCount(chunks.Count());
+    DChunk* c; 
+    
+    for(TInt i(0);i<totalChunkCount;i++)
+        {
+        c = (DChunk*)(chunks)[i];
+
+        LOGSTRING3("Processing chunk %d, tag: 0x%x",i,TAG(c));
+        
+        if( (TAG(c) & 0x0000ffff) != PROFILER_CHUNK_MARK)
+            {
+            LOGSTRING4("Marking chunk %d/%d, old tag 0x%x",i,(totalChunkCount-1), TAG(c));
+            // this chunk has not been tagged yet
+            name.Zero();
+            c->TraceAppendName(name,false);
+            
+            TAG(c) = (PROFILER_CHUNK_MARK);
+            this->heapChunkNamesToReport[iNewChunkCount] = c;
+            iNewChunkCount++;
+            }
+
+        // the chunk has been tagged, add heap chunks to the list
+        this->heapChunksToSample[this->iChunkCount] = c;
+        this->iChunkCount++;
+        LOGSTRING2("Added chunk %d to Chunks",i);
+        }
+
+    if(this->iChunkCount > 0 || this->iNewChunkCount > 0)
+        {
+        this->iChunksProcessing = EStartingToProcess;
+        
+        // process the first sample
+        TInt length = this->ProcessChunks();
+        
+        if(length == 0)
+            {
+            this->iChunksProcessing = ENothingToProcess;
+            }
+    
+        chunks.Signal();  // Release the container mutex
+        NKern::ThreadLeaveCS();  // End of critical section
+        return length;
+        }
+
+    LOGTEXT("MemSamplerImpl::SampleImpl - Error, no threads"); 
+    chunks.Signal();  // Release the container mutex
+    NKern::ThreadLeaveCS();  // End of critical section
+    return 0;
+    }
+
+inline TInt DMemSamplerImpl::GatherThreads()
+    {
+    // The thread memory consumption
+    
+    NKern::ThreadEnterCS(); // Prevent us from dying or suspending whilst holding a DMutex
+    DObjectCon& threads = *Kern::Containers()[EThread];
+    threads.Wait(); // Obtain the container mutex so the list does get changed under us
+    
+    this->iThreadCount = 0; 
+    this->iNewThreadCount = 0;
+    this->iTotalMemoryOk = false;           
+
+    TInt totalThreadCount = threads.Count();
+
+    for(TInt i(0);i<totalThreadCount;i++)
+        {
+        DThread* t = (DThread*)(threads)[i];
+
+        LOGSTRING3("Processing thread %d, tag: 0x%x",i,TAG(t));
+
+        if( (TAG(t) & PROFILER_MEM_THREAD_MARK) == 0)
+            {
+            LOGSTRING4("Marking thread %d/%d, old tag 0x%x",i,(totalThreadCount-1), TAG(t));
+            // this thread's chunk has not been reported yet
+            this->threadNamesToReport[iNewThreadCount] = t;
+            iNewThreadCount++;
+            // tag the thread
+            TAG(t) |= PROFILER_MEM_THREAD_MARK;
+            }
+
+        // the chunk has been tagged, add heap chunks to the list
+        this->threadsToSample[this->iThreadCount] = t;
+        this->iThreadCount++;
+        LOGSTRING2("Added thread %d to threads to sample",i);
+        }
+    
+    if(this->iThreadCount > 0 || this->iNewThreadCount > 0)
+        {
+        this->iThreadsProcessing = EStartingToProcess;
+        
+        // process the first sample
+        TInt length = this->ProcessThreads();
+        
+        if(length == 0)
+            {
+            this->iThreadsProcessing = ENothingToProcess;
+            }
+        threads.Signal();  // Release the container mutex
+        NKern::ThreadLeaveCS();  // End of critical section
+        return length;
+        }
+    
+    LOGTEXT("MemSamplerImpl::SampleImpl - Error, no threads"); 
+    threads.Signal();  // Release the container mutex
+    NKern::ThreadLeaveCS();  // End of critical section
+    return 0;
+    }
+
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+
+inline TInt DMemSamplerImpl::GatherLibraries()
+    {
+    LOGTEXT("MemSamplerImpl::GatherLibraries() - entry");
+    // encode a process binary
+    name.Zero();
+    
+    NKern::ThreadEnterCS(); // Prevent us from dying or suspending whilst holding a DMutex
+    DObjectCon& libs = *Kern::Containers()[ELibrary];
+    libs.Wait();  // Obtain the container mutex so the list does get changed under us
+    
+    this->iLibraryCount = 0; 
+    this->iNewLibraryCount = 0;
+    this->iTotalMemoryOk = false;
+    TInt totalLibCount(libs.Count());
+    DLibrary* l; 
+    
+    for(TInt i(0);i<totalLibCount;i++)
+        {
+        l = (DLibrary*)(libs)[i];
+
+        LOGSTRING3("Processing library %d, tag: 0x%x",i,TAG(l));
+        
+        if( (TAG(l) & 0xffffffff) != PROFILER_LIBRARY_MARK)
+            {
+            LOGSTRING4("Marking library %d/%d, old tag 0x%x",i,(totalLibCount-1), TAG(l));
+            // this library has not been tagged yet
+            name.Zero();
+            l->TraceAppendName(name,false);
+            
+            TAG(l) = (PROFILER_LIBRARY_MARK);
+            this->libraryNamesToReport[iNewLibraryCount] = l;
+            iNewLibraryCount++;
+            }
+
+        // the library has been tagged, add library to the list
+        this->librariesToSample[this->iLibraryCount] = l;
+        this->iLibraryCount++;
+        LOGSTRING2("Added library %d to Libraries",i);
+        }
+
+    if(this->iLibraryCount > 0 || this->iNewLibraryCount > 0)
+        {
+        this->iLibrariesProcessing = EStartingToProcess;
+        
+        // process the first sample
+        TInt length = this->ProcessLibraries();
+        
+        if(length == 0)
+            {
+            this->iLibrariesProcessing = ENothingToProcess;
+            }
+    
+        libs.Signal();  // Release the container mutex
+        NKern::ThreadLeaveCS();  // End of critical section
+        return length;
+        }
+
+    LOGTEXT("MemSamplerImpl::SampleImpl - Error, no libraries"); 
+    libs.Signal();  // Release the container mutex
+    NKern::ThreadLeaveCS();  // End of critical section
+    return 0;
+    }
+#endif
+
+inline TInt DMemSamplerImpl::ProcessChunks()
+    {
+    if(iNewChunkCount > 0)
+        {
+        if(this->iChunksProcessing == EStartingToProcess)
+            {
+            // this is the first sample, encode a code for names
+            this->iChunksProcessing = EProcessingNames;
+            return EncodeNameCode();
+            }
+
+        if(iTotalMemoryNameOk == false)
+            {
+            return EncodeTotalMemoryName();
+            }
+        
+        // there are new chunk names to report
+        iNewChunkCount--;
+        DChunk* c = this->heapChunkNamesToReport[iNewChunkCount];
+        return EncodeChunkName(*c);
+        
+        }
+    else if(iChunkCount > 0)
+        {
+        if(this->iChunksProcessing == EProcessingNames || this->iChunksProcessing == EStartingToProcess)
+            {
+            // this is the first data sample, encode a code for data
+            this->iChunksProcessing = EProcessingData;
+            return EncodeDataCode();
+            }
+        
+        if(this->iTotalMemoryOk == false)
+            {
+            return EncodeTotalMemory();	
+            }
+
+        // there are no new chunks to report
+        // thus generate the real report
+        iChunkCount--;
+        DChunk* c = this->heapChunksToSample[iChunkCount];
+        return EncodeChunkData(*c);
+        }
+    else
+        {
+        // everything is processed
+        LOGSTRING2(" Chunks processed! Chunk count = %d", iChunkCount);
+#ifdef MEM_EVENT_HANDLER
+        this->iChunksGathered = true;
+        Kern::Printf("MemSamplerImpl::ProcessChunks() - chunks gathered! Time: %d",iCount);
+#endif
+        return 0;
+        }
+    }
+
+inline TInt DMemSamplerImpl::ProcessThreads()
+    {
+
+    if(iNewThreadCount > 0)
+        {
+        if(this->iThreadsProcessing == EStartingToProcess)
+            {
+            // this is the first sample, encode a code for names
+            this->iThreadsProcessing = EProcessingNames;
+            return EncodeNameCode();
+            }
+        
+        if(iTotalMemoryNameOk == false)
+            {
+            return EncodeTotalMemoryName();
+            }
+
+        iNewThreadCount--;
+        DThread* t = this->threadNamesToReport[iNewThreadCount];
+        return EncodeChunkName(*t);
+        }
+    else if(iThreadCount > 0)
+        {
+        if(this->iThreadsProcessing == EProcessingNames || this->iThreadsProcessing == EStartingToProcess)
+            {
+            // this is the first data sample, encode a code for data
+            this->iThreadsProcessing = EProcessingData;
+            return EncodeDataCode();
+            }
+
+        if(this->iTotalMemoryOk == false)
+            {
+            return EncodeTotalMemory(); 
+            }
+
+        // there are no new threads to report
+        // thus generate the real report
+        iThreadCount--;
+        DThread* t = this->threadsToSample[iThreadCount];
+        return EncodeChunkData(*t);
+        }
+    else
+        {   
+        // everything is processed
+        LOGSTRING2(" Threads processed! Thread count = %d", iThreadCount);
+#ifdef MEM_EVENT_HANDLER
+        this->iThreadsGathered = true;
+        Kern::Printf("MemSamplerImpl::ProcessThreads() - threads gathered! Time: %d", iCount);
+#endif
+        return 0;
+        }
+    }
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+inline TInt DMemSamplerImpl::ProcessLibraries()
+    {
+    LOGTEXT("ProcessLibraries - entry");
+    if(iNewLibraryCount > 0)
+        {
+        if(this->iLibrariesProcessing == EStartingToProcess)
+            {
+            // this is the first sample, encode a code for names
+            this->iLibrariesProcessing = EProcessingNames;
+            return EncodeNameCode();
+            }
+
+        if(iTotalMemoryNameOk == false)
+            {
+            return EncodeTotalMemoryName();
+            }
+        
+        // there are new library names to report
+        iNewLibraryCount--;
+        DLibrary* l = this->libraryNamesToReport[iNewLibraryCount];
+        return EncodeChunkName(*l);
+        
+        }
+    else if(iLibraryCount > 0)
+        {
+        if(this->iLibrariesProcessing == EProcessingNames || this->iLibrariesProcessing == EStartingToProcess)
+            {
+            // this is the first data sample, encode a code for data
+            this->iLibrariesProcessing = EProcessingData;
+            return EncodeDataCode();
+            }
+        
+        if(this->iTotalMemoryOk == false)
+            {
+            return EncodeTotalMemory(); 
+            }
+
+        // there are no new libraries to report
+        // thus generate the real report
+        iLibraryCount--;
+        DLibrary* l = this->librariesToSample[iLibraryCount];
+        return EncodeChunkData(*l);
+        }
+    else
+        {
+        // everything is processed
+        LOGSTRING2(" Libraries processed! Library count = %d", iLibraryCount);
+
+        this->iLibrariesGathered = true;
+        Kern::Printf("MemSamplerImpl::ProcessLibraries() - libraries gathered! Time: %d",iCount);
+
+        return 0;
+        }
+    }
+#endif
+inline TInt DMemSamplerImpl::EncodeNameCode()
+    {
+	sample[0] = 1;
+	sample[1] = 0xaa;
+	return 2;
+    }
+
+inline TInt DMemSamplerImpl::EncodeDataCode()
+    {
+	sample[0] = 1;
+	sample[1] = 0xdd;
+	return 2;
+    }
+
+inline TInt DMemSamplerImpl::EncodeTotalMemoryName()
+    {
+	this->iTotalMemoryNameOk = true;
+	
+	TUint8* size = &sample[0];
+	*size = 0;
+		
+	// encode name
+	this->sampleDescriptor.Zero();
+	this->sampleDescriptor.Append(_L("TOTAL_MEMORY"));
+	*size += this->sampleDescriptor.Size();
+		
+	// add id here
+	TUint32 id(0xbabbeaaa);
+	this->sampleDescriptor.Append((TUint8*)&(id),sizeof(TUint32));
+	*size += sizeof(TUint32);
+	
+	// the size is the descriptor length + the size field
+	return ((TInt)(*size))+1;	
+    }
+
+inline TInt DMemSamplerImpl::EncodeTotalMemory()
+    {	
+	
+	TUint8* size = &sample[0];
+	*size = 0;
+
+	NKern::LockSystem();
+	TInt freeRam = Kern::FreeRamInBytes();
+	TInt totalRam = Kern::SuperPage().iTotalRamSize;
+	NKern::UnlockSystem();
+
+	this->sampleDescriptor.Zero();
+	
+	TUint32 id(0xbabbeaaa);
+	TInt zero(0);
+		
+	this->sampleDescriptor.Append((TUint8*)&(id),sizeof(TUint32));
+	*size += sizeof(TUint);
+	
+	this->sampleDescriptor.Append((TUint8*)&(totalRam),sizeof(TInt));
+	*size += sizeof(TInt);
+		
+	// append the cell amount allocated
+	this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+	*size += sizeof(TInt);
+	
+	// append the chunk size
+	this->sampleDescriptor.Append((TUint8*)&(freeRam),sizeof(TInt));
+	*size += sizeof(TInt);
+		
+	// append the thread user stack size
+	this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+	*size += sizeof(TInt);
+
+	this->iTotalMemoryOk = true;
+
+	return ((TInt)(*size))+1;
+    }
+
+inline TInt DMemSamplerImpl::EncodeChunkName(DChunk& c)
+    {	
+	// the size of the following name is in the first byte
+	TUint8* size = &sample[0];
+	*size = 0;
+		
+	// encode chunk name
+	this->sampleDescriptor.Zero();
+	this->sampleDescriptor.Append(_L("C_"));
+	c.TraceAppendFullName(this->sampleDescriptor,false);
+	*size += this->sampleDescriptor.Size();
+		
+	// add chunk object address here
+	TUint32 chunkAddr((TUint32)&c);
+	this->sampleDescriptor.Append((TUint8*)&(chunkAddr),sizeof(TUint32));
+	*size += sizeof(TUint32);
+
+	// the size is the descriptor length + the size field
+	LOGSTRING2("Non-Heap Chunk Name - %d",*size);
+	return ((TInt)(*size))+1;			
+    }
+
+inline TInt DMemSamplerImpl::EncodeChunkName(DThread& t)
+    {		
+	// the size of the following name is in the first byte
+	TUint8* size = &sample[0];
+	*size = 0;
+	this->sampleDescriptor.Zero();
+	
+	this->sampleDescriptor.Append(_L("T_"));
+	t.TraceAppendFullName(this->sampleDescriptor,false);
+	*size += this->sampleDescriptor.Size();
+	
+	// copy the 4 bytes from the thread id field
+	this->sampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
+	*size += sizeof(TUint);
+
+	// the size is the descriptor length + the size field
+	LOGSTRING2("Name - %d",*size);
+	return ((TInt)(*size))+1;
+    }
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+inline TInt DMemSamplerImpl::EncodeChunkName(DLibrary& l)
+    {   
+    // the size of the following name is in the first byte
+    TUint8* size = &sample[0];
+    *size = 0;
+        
+    // encode library name
+    this->sampleDescriptor.Zero();
+    this->sampleDescriptor.Append(_L("L_"));
+    l.TraceAppendFullName(this->sampleDescriptor,false);
+    *size += this->sampleDescriptor.Size();
+        
+    // add chunk object address here
+    TUint32 libAddr((TUint32)&l);
+    this->sampleDescriptor.Append((TUint8*)&(libAddr),sizeof(TUint32));
+    *size += sizeof(TUint32);
+
+    // the size is the descriptor length + the size field
+    LOGSTRING2("Name - %d",*size);
+    return ((TInt)(*size))+1;           
+    }
+#endif
+inline TInt DMemSamplerImpl::EncodeChunkData(DChunk& c)
+    {
+	// the size of the following name is in the first byte
+	TUint8* size = &sample[0];
+	*size = 0;
+	this->sampleDescriptor.Zero();
+	TInt zero(0);
+
+	TUint32 address((TUint32)&c);
+		
+	this->sampleDescriptor.Append((TUint8*)&address,sizeof(TUint32));
+	*size += sizeof(TUint);
+	
+	// copy the total amount of memory allocated
+	this->sampleDescriptor.Append((TUint8*)&(c.iSize),sizeof(TInt));
+	*size += sizeof(TInt);
+		
+	// append the cell amount allocated
+	this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+	*size += sizeof(TInt);
+	
+	// append the chunk size
+	this->sampleDescriptor.Append((TUint8*)&(c.iSize),sizeof(TUint));
+	*size += sizeof(TUint);
+		
+	// append the thread user stack size
+	this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+	*size += sizeof(TInt);
+
+	LOGSTRING2("Data - %d",*size);
+	return ((TInt)(*size))+1;
+
+    }
+
+inline TInt DMemSamplerImpl::EncodeChunkData(DThread& t)
+    {
+	LOGTEXT("MemSamplerImpl::EncodeChunkData - entry");
+	//LOGSTRING2("MemSamplerImpl::EncodeChunkData - processing thread 0x%x ",&t);
+		
+	// the size of the following name is in the first byte
+	TUint8* size = &sample[0];
+	*size = 0;
+	this->sampleDescriptor.Zero();
+
+	LOGTEXT("MemSamplerImpl::EncodeChunkData - cleared");
+
+	this->sampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
+	*size += sizeof(TUint);
+		
+	// copy the total amount of memory allocated for user side stack
+	this->sampleDescriptor.Append((TUint8*)&(t.iUserStackSize),sizeof(TInt));
+	*size += sizeof(TInt);
+
+	TInt zero(0);		
+	// append the cell amount allocated (zero, not in use here)
+	this->sampleDescriptor.Append((TUint8*)&zero,sizeof(TInt));
+	*size += sizeof(TInt);
+	
+	// append the chunk size (this is not a chunk)
+	this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TUint));
+	*size += sizeof(TUint);
+
+	// append user stack (max) size
+	this->sampleDescriptor.Append((TUint8*)&(t.iUserStackSize),sizeof(TInt));
+	*size += sizeof(TInt);
+
+	LOGSTRING2("Data -> %d",*size);
+	return ((TInt)(*size))+1;
+    }
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+inline TInt DMemSamplerImpl::EncodeChunkData(DLibrary& l)
+    {
+    LOGTEXT("MemSamplerImpl::EncodeChunkData (Library) - entry");
+    // the size of the following name is in the first byte
+    TUint8* size = &sample[0];
+    *size = 0;
+    this->sampleDescriptor.Zero();
+    
+    TUint32 address((TUint32)&l);
+        
+    this->sampleDescriptor.Append((TUint8*)&address,sizeof(TUint32));
+    *size += sizeof(TUint);
+             
+	this->sampleDescriptor.Append((TUint8*)&(l.iCodeSeg->iSize),sizeof(TUint32));
+    *size += sizeof(TInt); 
+             
+    this->sampleDescriptor.Append((TUint8*)&(l.iMapCount),sizeof(TInt));
+    *size += sizeof(TInt);  
+        
+    TInt zero(0);   
+    this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+    *size += sizeof(TInt);   
+        
+    this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+    *size += sizeof(TInt);   
+
+    LOGSTRING2("LData - %d",*size);
+    return ((TInt)(*size))+1;
+
+    }
+#endif
+void DMemSamplerImpl::Reset()
+    {
+	Kern::Printf("MemSamplerImpl::Reset");
+	iCount = 0; // sample threads 1 cycle after actual MEM sample time...
+    this->iTimeToSample = false;
+    this->iChunkCount = 0;
+	this->iNewChunkCount = 0;
+	
+	this->iTotalMemoryOk = false;
+	this->iTotalMemoryNameOk = false;
+
+	this->iChunksProcessing = ENothingToProcess;
+    this->iThreadsProcessing = ENothingToProcess;
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+    this->iLibrariesProcessing = ENothingToProcess;
+    this->iSampleType = ESampleThreads;
+#else
+    this->iSampleThreads = true;
+#endif
+    
+	this->sampleDescriptor.Zero();
+	
+	// clear all chunk tags
+    NKern::ThreadEnterCS(); // Prevent us from dying or suspending whilst holding a DMutex
+	DObjectCon* chunks = Kern::Containers()[EChunk];
+    chunks->Wait(); // Obtain the container mutex so the list does get changed under us
+
+	TInt totalChunkCount = chunks->Count();
+	for(TInt i=0;i<totalChunkCount;i++)
+	    {
+		DChunk* c = (DChunk*)(*chunks)[i];
+		TAG(c) = 0;
+	    }
+	chunks->Signal();  // Release the container mutex
+
+	Kern::Printf("MemSamplerImpl::Reset");
+	this->iThreadCount = 0;
+	this->iNewThreadCount = 0;
+	this->sampleDescriptor.Zero();
+
+	// clear all chunk tags
+	DObjectCon* threads = Kern::Containers()[EThread];
+    threads->Wait(); // Obtain the container mutex so the list does get changed under us
+
+	TInt totalThreadCount = threads->Count();
+	for(TInt i=0;i<totalThreadCount;i++)
+	    {
+		DThread* t = (DThread*)(*threads)[i];
+		TAG(t) = (TAG(t) & 0xfffffffe);
+	    }
+	threads->Signal();  // Release the container mutex
+	
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+	this->iLibraryCount = 0;
+	this->iNewLibraryCount = 0;
+	this->sampleDescriptor.Zero();
+
+	// clear all library tags
+	DObjectCon* libs = Kern::Containers()[ELibrary];
+	libs->Wait(); // Obtain the container mutex so the list does get changed under us
+
+	TInt totalLibraryCount = libs->Count();
+	for(TInt i=0; i<totalLibraryCount; i++)
+	    {
+        DLibrary* l = (DLibrary*)(*libs)[i];
+        TAG(l) = (TAG(l) & 0xefffffff);
+	    }
+	libs->Signal();  // Release the container mutex
+#endif
+
+    NKern::ThreadLeaveCS();  // End of critical section
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/src/MemoryEventHandler.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,724 @@
+/*
+* 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 <e32def.h>
+#include <e32cmn.h>
+#include <arm.h>
+#include <kernel.h>
+#include <kern_priv.h>
+#include <nk_trace.h>
+
+#include "MemoryEventHandler.h"
+
+
+DMemoryEventHandler::DMemoryEventHandler(DProfilerSampleBuffer* aSampleBuffer)
+    :   DKernelEventHandler(EventHandler, this), 
+        iSampleBuffer(aSampleBuffer), 
+        iSampleDescriptor(&(this->iSample[1]),0,256)
+    {
+//    Kern::Printf("DMemoryEventHandler::DMemoryEventHandler()");
+    iCount = 0;
+    iPreviousCount = 0;
+    }
+
+
+TInt DMemoryEventHandler::Create()
+    {
+//    Kern::Printf("DMemoryEventHandler::Create()");
+
+    TInt err(Kern::MutexCreate(iLock, _L("MemoryEventHandlerLock"), KMutexOrdGeneral0));
+    if (err != KErrNone)
+        return err;
+    
+    return Add();
+    }
+
+
+DMemoryEventHandler::~DMemoryEventHandler()
+    {
+//    Kern::Printf("DMemoryEventHandler::~DMemoryEventHandler()");
+
+    if (iLock)
+        iLock->Close(NULL);
+       
+    }
+
+
+TInt DMemoryEventHandler::Start()
+    {
+//    Kern::Printf("DMemoryEventHandler::Start()");
+
+    iTracking = ETrue;
+    return KErrNone;
+    }
+
+
+TInt DMemoryEventHandler::Stop()
+    {
+//    Kern::Printf("DMemoryEventHandler::Stop()");
+
+    iTracking = EFalse;
+    return KErrNone;
+    }
+
+TBool DMemoryEventHandler::SampleNeeded()
+    {
+    LOGTEXT("DMemoryEventHandler::SampleNeeded()");
+    
+    // increase the coutner by one on each round
+    iCount++;
+    
+    // check if event handler was not running
+//    if(!iTracking)
+//        return false; // return false
+    
+    return true;
+    }
+
+
+TUint DMemoryEventHandler::EventHandler(TKernelEvent aType, TAny* a1, TAny* a2, TAny* aThis)
+    {
+    return ((DMemoryEventHandler*)aThis)->HandleEvent(aType, a1, a2);
+    }
+
+
+
+TUint DMemoryEventHandler::HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2)
+    {
+    // debug
+//    Kern::Printf("New kernel event received, %d", aType);
+    
+    if (iTracking/* && iCount != iPreviousCount*/)
+        {
+//        iPreviousCount = iCount;
+        iCounters[aType]++;
+        switch (aType)
+            {
+            // capture only chunk creation, updates and destroyal
+            case EEventNewChunk:
+                {
+                DChunk* chunk = (DChunk*)a1;
+                HandleAddChunk(chunk);
+                break;
+                }
+            case EEventUpdateChunk:   
+                HandleUpdateChunk((DChunk*)a1);
+                break;
+            case EEventDeleteChunk:      
+                HandleDeleteChunk((DChunk*)a1);
+                break;
+//            case EEventAddProcess:
+//                Kern::Printf("Process added: 0x%08x", (DProcess*)a1);
+//                break;
+//            case EEventUpdateProcess:
+//                Kern::Printf("DProcess updated: 0x%08x", (DProcess*)a1);
+//                break;
+//            case EEventRemoveProcess:
+//                Kern::Printf("DProcess removed: 0x%08x", (DProcess*)a1);
+//                break;
+//            case EEventAddCodeSeg:
+//                Kern::Printf("DCodeSeg added: 0x%08x", (DCodeSeg*)a1);
+//                break;
+//            case EEventRemoveCodeSeg:
+//                Kern::Printf("DCodeSeg deleted: 0x%08x", (DCodeSeg*)a1);
+//                break;
+            case EEventAddThread:
+                HandleAddThread((DThread*)a1);
+                break;
+            case EEventUpdateThread:    // thread renaming
+                HandleUpdateThread((DThread*)a1);
+                break;
+//            case EEventKillThread:
+            case EEventRemoveThread:
+                HandleDeleteThread((DThread*)a1);
+                break;
+#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
+            case EEventAddLibrary:
+                HandleAddLibrary((DLibrary*)a1, (DThread*)a2);
+                break;
+            case EEventRemoveLibrary:
+                HandleDeleteLibrary((DLibrary*)a1);
+                break;
+#endif
+            
+            // ignore exception events
+            case EEventSwExc:
+            case EEventHwExc:
+         
+            default:
+                break;
+            }
+        }
+//    else if(iTracking && iCount == iPreviousCount)
+//        {
+//        // if time stamp is not updated profiling has stopped
+//        Stop();
+//        }
+    return DKernelEventHandler::ERunNext;
+    }
+
+TInt DMemoryEventHandler::EncodeNameCode()
+    {
+    iSample[0] = 1;
+    iSample[1] = 0xaa;
+    return 2;
+    }
+
+// encode mark for new chunk or thread
+TInt DMemoryEventHandler::EncodeNewCode()
+    {
+    iSample[0] = 1;
+    iSample[1] = 0xda;
+    return 2;
+    }
+
+// encode mark for update of chunk or thread
+TInt DMemoryEventHandler::EncodeUpdateCode()
+    {
+    iSample[0] = 1;
+    iSample[1] = 0xdb;
+    return 2;
+    }
+
+// encode mark for removal of chunk or thread
+TInt DMemoryEventHandler::EncodeRemoveCode()
+    {
+    iSample[0] = 1;
+    iSample[1] = 0xdc;
+    return 2;
+    }
+
+// encode the memory sample header in all memory changes
+TInt DMemoryEventHandler::AddHeader()
+    {
+    TInt err(KErrNone);
+    
+    TUint8 number(4);    // mem sampler id
+
+    // check if iCount bigger than previous, i.e. at least 1 ms has passed from the previous sample
+    if(iCount > iPreviousCount)
+        {
+        err = this->iSampleBuffer->AddSample(&number,1);
+        err = this->iSampleBuffer->AddSample((TUint8*)&(iCount),4);
+    
+        // add data chunk header
+        TInt length(EncodeUpdateCode());
+        err = iSampleBuffer->AddSample(iSample, length);
+        
+        // add total memory sample in the beginning of each sample
+        length = EncodeTotalMemory();
+        err = iSampleBuffer->AddSample(iSample, length);
+        AddFooter();    // end mark for total memory sample
+        }
+    iPreviousCount = iCount;
+    
+    // add actual sample
+    err = this->iSampleBuffer->AddSample(&number,1);
+    err = this->iSampleBuffer->AddSample((TUint8*)&(iCount),4);
+
+    return err;
+    }
+
+// encode the memory sample header in all memory changes
+TInt DMemoryEventHandler::AddFooter()
+    {
+    TInt err(KErrNone);
+    
+    TUint8 number(0);    // end mark
+    err = this->iSampleBuffer->AddSample(&number,1);
+    
+    return err;
+    }
+
+TInt DMemoryEventHandler::EncodeTotalMemory()
+    {   
+    
+    TUint8* size(&iSample[0]);
+    *size = 0;
+
+    NKern::LockSystem();
+    TInt freeRam(Kern::FreeRamInBytes());
+    TInt totalRam(Kern::SuperPage().iTotalRamSize);
+    NKern::UnlockSystem();
+
+    iSampleDescriptor.Zero();
+    
+    TUint32 id(0xbabbeaaa);
+    TInt zero(0);
+        
+    iSampleDescriptor.Append((TUint8*)&(id),sizeof(TUint32));
+    *size += sizeof(TUint);
+    
+    iSampleDescriptor.Append((TUint8*)&(totalRam),sizeof(TInt));
+    *size += sizeof(TInt);
+        
+    // append the cell amount allocated
+    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+    *size += sizeof(TInt);
+    
+    // append the chunk size
+    iSampleDescriptor.Append((TUint8*)&(freeRam),sizeof(TInt));
+    *size += sizeof(TInt);
+        
+    // append the thread user stack size
+    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+    *size += sizeof(TInt);
+
+    return ((TInt)(*size))+1;
+    }
+
+// handle chunk activity
+TBool DMemoryEventHandler::HandleAddChunk(DChunk* aChunk)
+    {    
+//    Kern::Printf("New DChunk created: 0x%08x, time: %d", aChunk, iCount);
+    
+    NKern::ThreadEnterCS();
+    Kern::MutexWait(*iLock);
+    // add header first
+    TInt err(AddHeader());
+    
+    if(err != KErrNone)
+        {
+        return EFalse;
+        }
+    
+    // new chunk, add name of it
+    TInt length(EncodeNameCode());
+    iSampleBuffer->AddSample(iSample, length);
+
+    // new chunk, add name of it
+    length = EncodeChunkName(*aChunk);
+    iSampleBuffer->AddSample(iSample, length);
+    
+    // add new chunk tag
+    length = EncodeNewCode();
+    iSampleBuffer->AddSample(iSample, length);
+
+    length = EncodeChunkData(*aChunk);
+    iSampleBuffer->AddSample(iSample, length);
+    
+    // add end mark
+    AddFooter();
+    Kern::MutexSignal(*iLock);
+    NKern::ThreadLeaveCS();
+    return ETrue;
+    }
+
+TBool DMemoryEventHandler::HandleUpdateChunk(DChunk* aChunk)
+    {
+//    Kern::Printf("DChunk updated: 0x%08x, time: %d", aChunk, iCount);
+    
+    NKern::ThreadEnterCS();
+    Kern::MutexWait(*iLock);
+    // add header first
+    TInt err(AddHeader());
+    
+    if(err != KErrNone)
+        {
+        return EFalse;
+        }
+    
+    // add new chunk tag
+    TInt length(EncodeUpdateCode());
+    iSampleBuffer->AddSample(iSample, length);
+
+    length = EncodeChunkData(*aChunk);
+    iSampleBuffer->AddSample(iSample, length);
+
+    // add end mark
+    AddFooter();
+    Kern::MutexSignal(*iLock);
+    NKern::ThreadLeaveCS();
+    return ETrue;
+    }
+
+TBool DMemoryEventHandler::HandleDeleteChunk(DChunk* aChunk)
+    {
+//    Kern::Printf("DChunk deleted: 0x%08x, time: %d", aChunk, iCount);
+    NKern::ThreadEnterCS();
+    Kern::MutexWait(*iLock);
+    // add header first
+    TInt err(AddHeader());
+    
+    if(err != KErrNone)
+        {
+        return EFalse;
+        }
+    
+    // add new chunk tag
+    TInt length(EncodeRemoveCode());
+    iSampleBuffer->AddSample(iSample, length);
+
+    length = EncodeChunkData(*aChunk);
+    iSampleBuffer->AddSample(iSample, length);
+
+    // add end mark
+    AddFooter();
+    Kern::MutexSignal(*iLock);
+    NKern::ThreadLeaveCS();
+    return ETrue;
+    }
+
+// handle process activity
+TBool DMemoryEventHandler::HandleAddProcess(DProcess *aProcess)
+    {
+    return ETrue;
+    }
+
+TBool DMemoryEventHandler::HandleUpdateProcess(DProcess *aProcess)
+    {
+    return ETrue;
+    }
+
+TBool DMemoryEventHandler::HandleDeleteProcess(DProcess *aProcess)
+    {
+    return ETrue;
+    }
+
+// handle thread activity
+TBool DMemoryEventHandler::HandleAddThread(DThread* aThread)
+    {
+//    Kern::Printf("DThread added: 0x%08x, time: %d", aThread->iId, iCount);
+    NKern::ThreadEnterCS();
+    Kern::MutexWait(*iLock);
+    // add header first
+    TInt err(AddHeader());
+    
+    if(err != KErrNone)
+        {
+        return EFalse;
+        }
+    
+    // new thread, add name of it
+    TInt length(EncodeNameCode());
+    iSampleBuffer->AddSample(iSample, length);
+    
+    // new chunk, add name of it
+    length = EncodeChunkName(*aThread);
+    iSampleBuffer->AddSample(iSample, length);
+    
+    // add new chunk tag
+    length = EncodeNewCode();
+    iSampleBuffer->AddSample(iSample, length);
+
+    length = EncodeChunkData(*aThread);
+    iSampleBuffer->AddSample(iSample, length);
+
+    // add end mark
+    AddFooter();
+    Kern::MutexSignal(*iLock);
+    NKern::ThreadLeaveCS();
+    return ETrue;
+    }
+
+TBool DMemoryEventHandler::HandleUpdateThread(DThread* aThread)
+    {
+//    Kern::Printf("DThread updated: 0x%08x, time: %d", aThread->iId, iCount);
+    NKern::ThreadEnterCS();
+    Kern::MutexWait(*iLock);
+    // add header first
+    TInt err(AddHeader());
+    
+    if(err != KErrNone)
+        {
+        return EFalse;
+        }
+    
+    // add new chunk tag
+    TInt length(EncodeUpdateCode());
+    iSampleBuffer->AddSample(iSample, length);
+
+    length = EncodeChunkData(*aThread);
+    iSampleBuffer->AddSample(iSample, length);
+
+    // add end mark
+    AddFooter();
+    Kern::MutexSignal(*iLock);
+    NKern::ThreadLeaveCS();    
+    return ETrue;
+    }
+
+TBool DMemoryEventHandler::HandleDeleteThread(DThread* aThread)
+    {
+//    Kern::Printf("DThread deleted: 0x%08x, time: %d", aThread->iId, iCount);
+    NKern::ThreadEnterCS();
+    Kern::MutexWait(*iLock);
+    // add header first
+    TInt err(AddHeader());
+    
+    if(err != KErrNone)
+        {
+        return EFalse;
+        }
+    
+    // add new chunk tag
+    TInt length(EncodeRemoveCode());
+    iSampleBuffer->AddSample(iSample, length);
+
+    length = EncodeChunkData(*aThread);
+    iSampleBuffer->AddSample(iSample, length);
+
+    // add end mark
+    AddFooter();
+    Kern::MutexSignal(*iLock);
+    NKern::ThreadLeaveCS();  
+    return ETrue;
+    }
+
+TBool DMemoryEventHandler::HandleAddLibrary(DLibrary* aLibrary, DThread* aThread)
+    {
+    LOGTEXT("DMemoryEventHandler::HandleAddLibrary");
+    Kern::Printf("DLibrary added: 0x%08x, time: %d", aLibrary, iCount);
+    // add header first
+    NKern::ThreadEnterCS();
+    Kern::MutexWait(*iLock);
+    TInt err(AddHeader());
+        
+    if(err != KErrNone)
+        {
+        return EFalse;
+        }
+    
+    // new library, add name of it
+    TInt length(EncodeNameCode());
+    iSampleBuffer->AddSample(iSample, length);
+        
+    // new chunk, add name of it
+    length = EncodeChunkName(*aLibrary);
+    iSampleBuffer->AddSample(iSample, length);
+        
+    // add new chunk tag
+    length = EncodeNewCode();
+    iSampleBuffer->AddSample(iSample, length);
+
+    length = EncodeChunkData(*aLibrary, *aThread);
+    iSampleBuffer->AddSample(iSample, length);
+
+    // add end mark
+    AddFooter();
+    Kern::MutexSignal(*iLock);
+    NKern::ThreadLeaveCS();      
+    return ETrue;
+    }
+
+TBool DMemoryEventHandler::HandleDeleteLibrary(DLibrary* aLibrary)
+    {
+    Kern::Printf("DLibrary deleted: 0x%08x, time: %d", aLibrary, iCount);
+    NKern::ThreadEnterCS();
+    Kern::MutexWait(*iLock);
+    // add header first
+    TInt err(AddHeader());
+        
+    if(err != KErrNone)
+        {
+        return EFalse;
+        }
+        
+    // add new chunk tag
+    TInt length(EncodeRemoveCode());
+    iSampleBuffer->AddSample(iSample, length);
+    
+    DThread* nullPointer = NULL;
+    length = EncodeChunkData(*aLibrary, *nullPointer);
+    iSampleBuffer->AddSample(iSample, length);
+
+    // add end mark
+    AddFooter();
+    Kern::MutexSignal(*iLock);
+    NKern::ThreadLeaveCS();        
+    return ETrue;
+    }
+
+// encode chunk name 
+TInt DMemoryEventHandler::EncodeChunkName(DChunk& c)
+    {   
+    // the size of the following name is in the first byte
+    TUint8* size(&iSample[0]);
+    *size = 0;
+        
+    // encode chunk name
+    iSampleDescriptor.Zero();
+    iSampleDescriptor.Append(_L("C_"));
+    c.TraceAppendFullName(iSampleDescriptor,false);
+    *size += iSampleDescriptor.Size();
+        
+    // add chunk object address here
+    TUint32 chunkAddr((TUint32)&c);
+    iSampleDescriptor.Append((TUint8*)&(chunkAddr),sizeof(TUint32));
+    *size += sizeof(TUint32);
+
+    // the size is the descriptor length + the size field
+    LOGSTRING2("Non-Heap Chunk Name - %d",*size);
+    return ((TInt)(*size))+1;           
+    }
+
+// encode chunk name 
+TInt DMemoryEventHandler::EncodeChunkName(DThread& t)
+    {       
+    // the size of the following name is in the first byte
+    TUint8* size(&iSample[0]);
+    *size = 0;
+    iSampleDescriptor.Zero();
+    
+    iSampleDescriptor.Append(_L("T_"));
+    t.TraceAppendFullName(iSampleDescriptor,false);
+    *size += iSampleDescriptor.Size();
+    
+    // copy the 4 bytes from the thread id field
+    iSampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
+    *size += sizeof(TUint);
+
+    // the size is the descriptor length + the size field
+    LOGSTRING2("Name - %d",*size);
+    return ((TInt)(*size))+1;
+    }
+
+// encode chunk name 
+TInt DMemoryEventHandler::EncodeChunkName(DLibrary& l)
+    {       
+    LOGTEXT("DMemoryEventHandler::EncodeChunkName (LIBRARY)");
+    // the size of the following name is in the first byte
+    TUint8* size(&iSample[0]);
+    *size = 0;
+    iSampleDescriptor.Zero();
+    
+    iSampleDescriptor.Append(_L("L_"));
+    l.TraceAppendFullName(iSampleDescriptor,false);
+    *size += iSampleDescriptor.Size();
+    
+    // copy the library address here
+    TUint32 libAddr((TUint32)&l);
+    iSampleDescriptor.Append((TUint8*) &libAddr,sizeof(TUint32));
+    *size += sizeof(TUint32);
+
+    // the size is the descriptor length + the size field
+    LOGSTRING2("Name - %d",*size);
+    return ((TInt)(*size))+1;
+    }
+
+// record thread stack changes
+TInt DMemoryEventHandler::EncodeChunkData(DThread& t)
+    {
+    LOGSTRING("DMemoryEventHandler::EncodeChunkDataT - entry");
+        
+    // the size of the following name is in the first byte
+    TUint8* size(&iSample[0]);
+    *size = 0;
+    iSampleDescriptor.Zero();
+
+    iSampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
+    *size += sizeof(TUint);
+        
+    // copy the total amount of memory allocated for user side stack
+    iSampleDescriptor.Append((TUint8*)&(t.iUserStackSize),sizeof(TInt));
+    *size += sizeof(TInt);
+
+    TInt zero(0);      
+    // append the cell amount allocated (zero, not in use here)
+    iSampleDescriptor.Append((TUint8*)&zero,sizeof(TInt));
+    *size += sizeof(TInt);
+    
+    // append the chunk size (this is not a chunk)
+    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TUint));
+    *size += sizeof(TUint);
+
+    // append user stack (max) size
+    iSampleDescriptor.Append((TUint8*)&(t.iUserStackSize),sizeof(TInt));
+    *size += sizeof(TInt);
+
+//    Kern::Printf("TData -> %d",*size);
+    return ((TInt)(*size))+1;
+    }
+
+// record chunk changes
+TInt DMemoryEventHandler::EncodeChunkData(DChunk& c)
+    {
+    LOGSTRING("DMemoryEventHandler::EncodeChunkDataC - entry");
+    
+    // the size of the following name is in the first byte
+    TUint8* size(&iSample[0]);
+    *size = 0;
+    iSampleDescriptor.Zero();
+    TInt zero(0);
+
+    TUint32 address((TUint32)&c);
+        
+    iSampleDescriptor.Append((TUint8*)&address,sizeof(TUint32));
+    *size += sizeof(TUint);
+    
+    // copy the total amount of memory allocated
+    iSampleDescriptor.Append((TUint8*)&(c.iSize),sizeof(TInt));
+    *size += sizeof(TInt);
+        
+    // append the cell amount allocated
+    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+    *size += sizeof(TInt);
+    
+    // append the chunk size
+    iSampleDescriptor.Append((TUint8*)&(c.iSize),sizeof(TUint));
+    *size += sizeof(TUint);
+        
+    // append the thread user stack size
+    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+    *size += sizeof(TInt);
+
+//    Kern::Printf("CData - %d",*size);
+    return ((TInt)(*size))+1;
+    }
+
+// record loaded libraries changes
+TInt DMemoryEventHandler::EncodeChunkData(DLibrary& l, DThread& t)
+    {    
+    LOGSTRING("DMemoryEventHandler::EncodeChunkDataL - entry");
+    
+    // the size of the following name is in the first byte
+    TUint8* size(&iSample[0]);
+    *size = 0;
+    iSampleDescriptor.Zero();
+    TInt zero(0);
+
+    TUint32 address((TUint32)&l);
+    
+    iSampleDescriptor.Append((TUint8*)&address,sizeof(TUint32));
+    *size += sizeof(TUint);
+    
+    // append amount of memory that library is allocated
+    iSampleDescriptor.Append((TUint8*)&(l.iCodeSeg->iSize),sizeof(TUint32));
+    *size += sizeof(TInt);
+            
+    // append count of how many times librarys is allocated
+    iSampleDescriptor.Append((TUint8*)&(l.iMapCount),sizeof(TInt));
+    *size += sizeof(TInt);
+    
+    if(&t != NULL)
+        {
+        // created by thread
+        iSampleDescriptor.Append((TUint8*)&(t),sizeof(TUint32));
+        }
+    else
+        {
+        // removed
+        iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TUint32));
+        }
+    *size += sizeof(TUint);
+            
+    // append the thread user stack size
+    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
+    *size += sizeof(TInt);
+    return ((TInt)(*size))+1;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/GeneralsPlugin/src/PriSamplerImpl.cpp	Mon Sep 06 15:00:47 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 <piprofiler/ProfilerVersion.h>
+#include <piprofiler/ProfilerTraces.h>
+
+#include <kern_priv.h>
+#include <plat_priv.h>
+
+#include "PriSamplerImpl.h"
+
+#if !defined(__NKERN_H__)
+#include <nkern.h>
+#endif 
+
+#define TAG(obj) (*(TUint32*)&(obj->iAsyncDeleteNext))
+#define PROFILER_THREAD_MARK		((TUint32)0x00000002)
+
+
+DPriSamplerImpl::DPriSamplerImpl() :
+	sampleDescriptor(&(this->sample[1]),0,256)
+    {
+	LOGTEXT("PriSamplerImpl::PriSamplerImpl() - konstruktori");
+
+	iCountti = 50;	// sample threads 16 cycles before actual MEM and PRI sample time...
+	iNewThreadCount = 0;
+	iThreadCount = 0;
+	iProcessing = ENothingToProcess;
+	
+	for(TInt i=0;i<KProfilerMaxThreadAmount;i++)
+	    {
+		this->threadsToSample[i] = 0;
+		this->threadNamesToReport[i] = 0;
+        }
+
+    }
+
+DPriSamplerImpl::~DPriSamplerImpl()
+    {
+	
+    }
+
+TInt DPriSamplerImpl::CreateFirstSample()
+    {
+	LOGTEXT("PriSamplerImpl::CreateFirstSample - entry");
+	
+	this->sampleDescriptor.Zero();
+	this->sampleDescriptor.Append(_L8("Bappea_V"));
+	this->sampleDescriptor.Append(PROFILER_PRI_SAMPLER_VERSION);
+	this->sampleDescriptor.Append(_L8("_PRI"));
+
+	sample[0] = this->sampleDescriptor.Size();
+
+	LOGTEXT("PriSamplerImpl::CreateFirstSample - exit");
+
+	return (TInt)(sample[0]+1);
+    }
+
+TBool DPriSamplerImpl::SampleNeeded()
+    {
+	iCountti++;
+	if(iCountti % (iPriSamplingPeriod) == 0) 
+	    {
+		LOGTEXT("PriSamplerImpl::SampleNeeded - true");
+		return true;
+        }
+	else 
+	    {
+		return false;
+        }
+    }
+
+
+TInt DPriSamplerImpl::SampleImpl()
+    {
+	/*
+	 *
+	 *	EKA-2 implementation of PRI trace
+	 *
+	 */
+	if(this->iProcessing == ENothingToProcess)
+	    {
+	    if((iCountti % iPriSamplingPeriod) != 0 ) return 0;
+	    
+        LOGTEXT("Processing threads...");
+
+        DObjectCon& threads = *Kern::Containers()[EThread];
+
+        // PRI trace variables
+        this->iThreadCount = 0; 
+        this->iNewThreadCount = 0;
+        TInt totalThreadCount = threads.Count();
+
+        for(TInt i=0;i<totalThreadCount;i++)
+            {
+            DThread* t = (DThread*)(threads)[i];
+            LOGSTRING3("Processing thread %d, tag: 0x%x",i,TAG(t));
+
+            if( (TAG(t) & PROFILER_THREAD_MARK) == 0)
+                {
+                LOGSTRING2("Marking thread %d",i);
+                // this thread's chunk has not been reported yet
+                this->threadNamesToReport[iNewThreadCount] = t;
+                iNewThreadCount++;
+                // tag the thread
+                TAG(t) |= PROFILER_THREAD_MARK;
+                LOGSTRING2("New Thread %d",i);
+                }
+            else
+                {
+                LOGSTRING3("Thread %d marked already - 0x%x",i,TAG(t));
+                }
+
+            // the thread has been tagged, add heap chunks to the list
+            this->threadsToSample[this->iThreadCount] = t;
+            this->iThreadCount++;
+            LOGSTRING2("Added thread %d to threads to sample",i);
+            }
+
+        if(this->iThreadCount > 0 || this->iNewThreadCount > 0)
+            {
+            this->iProcessing = EStartingToProcess;
+            
+            // process the first sample
+            TInt length = this->ProcessChunks();
+            
+            if(length == 0)
+                {
+                this->iProcessing = ENothingToProcess;
+                }
+        
+            return length;
+            }
+        else
+            {
+            // there were no threads, should not take place
+            LOGTEXT("PriSamplerImpl::SampleImpl - Error, no threads"); 
+            return 0;
+            }
+	    }
+	else
+	    {
+		TInt length = this->ProcessChunks();
+		if(length == 0) 
+		    {
+			this->iProcessing = ENothingToProcess;
+		    }
+		return length;
+	    }
+    }
+
+inline TInt DPriSamplerImpl::ProcessChunks()
+    {
+	/*
+	 *
+	 *	EKA-2 implementation of PRI trace
+	 *
+	 */
+
+	if(iNewThreadCount > 0)
+	    {
+		if(this->iProcessing == EStartingToProcess)
+		    {
+			// this is the first sample, encode a code for names
+			this->iProcessing = EProcessingNames;
+			return EncodeNameCode();
+            }
+
+		// there are new thread names to report
+		iNewThreadCount--;
+		DThread* t = this->threadNamesToReport[iNewThreadCount];
+		return EncodeChunkName(*t);
+        }
+	else if(iThreadCount > 0)
+	    {
+		if(this->iProcessing == EProcessingNames || this->iProcessing == EStartingToProcess)
+		    {
+			// this is the first data sample, encode a code for data
+			this->iProcessing = EProcessingData;
+			return EncodeDataCode();
+            }
+
+		// there are no new chunks to report
+		// thus generate the real report
+		iThreadCount--;
+		DThread* t = this->threadsToSample[iThreadCount];
+		LOGSTRING2("PriSamplerImpl::ProcessChunks - starting to process thread 0x%x",t);
+		return EncodeChunkData(*t);
+        }
+	else
+	    {
+		// everything is processed
+		return 0;
+        }
+    }
+
+inline TInt DPriSamplerImpl::EncodeNameCode()
+    {
+	sample[0] = 1;
+	sample[1] = 0xbb;	// pri trace name code
+	return 2;
+    }
+
+inline TInt DPriSamplerImpl::EncodeDataCode()
+    {
+	sample[0] = 1;
+	sample[1] = 0xee;	// pri trace data code
+	return 2;
+    }
+
+
+inline TInt DPriSamplerImpl::EncodeChunkName(DThread& t)
+    {		
+	// the size of the following name is in the first byte
+	TUint8* size = &sample[0];
+	*size = 0;
+	this->sampleDescriptor.Zero();
+	
+	t.TraceAppendFullName(this->sampleDescriptor,false);
+	*size += this->sampleDescriptor.Size();
+	
+	// copy the 4 bytes from the thread id field
+	this->sampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
+	*size += sizeof(TUint);
+
+	// the size is the descriptor length + the size field
+	LOGSTRING2("Name size - %d",*size);
+	return ((TInt)(*size))+1;
+    }
+
+
+inline TInt DPriSamplerImpl::EncodeChunkData(DThread& t)
+    {
+	LOGTEXT("PriSamplerImpl::EncodeChunkData - entry");
+	LOGSTRING2("PriSamplerImpl::EncodeChunkData - processing thread 0x%x ",&t);
+		
+	// the size of the following name is in the first byte
+	TUint8* size = &sample[0];
+	*size = 0;
+	this->sampleDescriptor.Zero();
+
+	LOGTEXT("PriSamplerImpl::EncodeChunkData - cleared");
+
+    // append the thread id
+    this->sampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
+    *size += sizeof(TUint);
+    
+//    NKern::LockSystem();
+//    TInt priority(-1);
+//    if(&t && t.Open()== KErrNone)
+//        {
+//       priority = t.iDefaultPriority;
+//        }
+//    NKern::UnlockSystem();
+    
+    // append the priority of the nanokernel fast semaphore
+//    this->sampleDescriptor.Append((TUint8*)&priority,sizeof(TUint8));
+    // append the priority of the nanokernel fast semaphore
+    this->sampleDescriptor.Append((TUint8*)&(t.iNThread.iPriority),sizeof(TUint8));
+    // add space because EKA-1 implementation needs it
+    this->sampleDescriptor.Append((TUint8)0x0);
+    *size += 2*sizeof(TUint8);
+
+    LOGTEXT("PriSamplerImpl::EncodeChunkData - appended priority");
+        
+
+    LOGSTRING2("Data size - %d",*size);
+    return ((TInt)(*size))+1;	
+    }
+
+
+void DPriSamplerImpl::Reset()
+    {
+	/*
+	 *
+	 *	EKA-2 implementation of PRI trace
+	 *
+	 */
+
+	LOGTEXT("PriSamplerImpl::Reset");
+	iCountti = 50;	// sample threads 16 cycles before actual MEM and PRI sample time...
+	this->iThreadCount = 0;
+	this->iNewThreadCount = 0;
+	this->iProcessing = ENothingToProcess;
+	this->sampleDescriptor.Zero();
+
+
+	// clear all thread tags
+	DObjectCon* threads = Kern::Containers()[EThread];
+	TInt totalThreadCount = threads->Count();
+	for(TInt i=0;i<totalThreadCount;i++)
+	    {
+		DThread* t = (DThread*)(*threads)[i];
+		TAG(t) = (TAG(t) & 0xfffffffd);
+	    }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/PWRplugin/data/2001E5B9.rss	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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 <ecom/registryinfo.rh>
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL. See mmp files
+    //__SERIES60_3X__ can't be used in resource files
+    dll_uid = 0x2001E5B9;
+
+    // Declare array of interface info. This dll contains implementations for 
+    // only one interface (CSamplerInterfaceDefinition).
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x2001E5BC;
+
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2001E5B9;
+
+                    version_no = 1;
+                    display_name = "PWR Sampler";
+                    default_data = "pwr";
+                    opaque_data = "10";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/PWRplugin/group/PWRPlugin.mmp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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 <platform_paths.hrh>
+
+
+TARGET          PIProfilerPWR.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x2001E5B9
+VENDORID        VID_DEFAULT
+CAPABILITY      ALL -TCB
+SMPSAFE
+
+OS_LAYER_SYSTEMINCLUDE
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+SOURCEPATH      ../src
+
+START RESOURCE  ../data/2001E5B9.rss
+TARGET PIProfilerPWR.rsc
+END
+
+SOURCE          PwrPluginImplementationTable.cpp
+SOURCE          PwrPlugin.cpp
+
+LIBRARY     euser.lib
+LIBRARY     ecom.lib
+LIBRARY     apparc.lib
+LIBRARY     cone.lib
+LIBRARY     gdi.lib
+LIBRARY     ws32.lib
+LIBRARY     efsrv.lib
+LIBRARY     charconv.lib
+LIBRARY     CommonEngine.lib
+LIBRARY     flogger.lib
+LIBRARY     centralrepository.lib
+LIBRARY     HWRMPowerClient.lib
+LIBRARY     HWRMLightClient.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/PWRplugin/group/bld.inf	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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 SBSV2
+PRJ_PLATFORMS
+DEFAULT
+#endif
+
+PRJ_MMPFILES
+#ifdef MARM
+  #ifndef __SERIES60_30__
+    PWRPlugin.mmp
+  #endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/PWRplugin/inc/PwrPlugin.h	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,167 @@
+/*
+* 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 BAPPEA_PWR_SAMPLER_H
+#define BAPPEA_PWR_SAMPLER_H
+
+//#define PWR_SAMPLER_BACKLIGHT
+
+//#include "PIProfilerConfigInternal.h"
+
+// system definitions
+#include <w32std.h>
+#include <e32std.h>
+
+#include <e32property.h>
+#include <HWRMPower.h>
+#include <HWRMLight.h>
+
+// user definitions
+#include <piprofiler/SamplerPluginInterface.h>
+#include <piprofiler/ProfilerGenericClassesUsr.h>
+
+// caption definitions
+_LIT8(KPWRShortName, "pwr");
+_LIT8(KPWRMediumName, "Power sampler");
+_LIT8(KPWRLongName, "Power usage sampler");
+_LIT8(KPWRDescription, "Power sampler: \nSampling power consumption on Nokia S60 devices\nHW dep: N/A\nSW dep: S60 3.0\n");
+
+// Minimum allowed sampling interval (in ms). 0 means undefined.
+const TInt KMinSampleInterval = 250;
+const TInt KReportingPeriodInfinite = 0;
+
+const TUid KGppPropertyCat={0x20201F70};
+enum TGppPropertyKeys
+    {
+    EGppPropertySyncSampleNumber
+    };
+
+const TUid KPwrNotifierUid = { 0x2001E5B9 };
+class CProfilerPowerListener;
+
+/*
+ *
+ * PWR sampler plug-in definition
+ *
+ */
+
+class CPwrPlugin : public CSamplerPluginInterface
+{
+public:
+    static  CPwrPlugin* NewL(const TUid aImplementationUid, TAny* aInitParams);
+            ~CPwrPlugin();
+
+    TInt    ResetAndActivateL(CProfilerSampleStream& aStream);
+    TInt    StopSampling();
+    TBool   Enabled() { return iEnabled; }
+    void    SetEnabled(TBool aEnabled);
+    TInt    GetSamplerType();
+
+    TInt    CreateFirstSample();
+
+    void    GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes);
+    TInt    SetAttributesL(TSamplerAttributes& aAttributes);
+    void    InitiateSamplerAttributesL();
+
+    TInt    ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray);
+
+    TInt    DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex);
+    void    SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex);
+
+    TUid    Id(TInt aSubId) const;
+
+    // subsampler settings, i.e. samplers implemented within a plugin
+    // no sub samplers, from CSamplerPluginInterface
+    TInt    SubId(TUid aId) const {return KErrNotFound;}
+    TInt    GetSubSamplers(TDes* aDes){return KErrNotFound;}
+
+private:
+            CPwrPlugin();
+    void    ConstructL();
+
+private:
+    TUint8                  iVersion[20];
+    TPtr8                   iVersionDescriptor;
+
+    TInt                    iSamplerType;
+
+    CProfilerPowerListener* iPowerListener;
+
+    TInt                    iPeriod;
+    CArrayFixFlat<TSamplerAttributes>* iSamplerAttributes;
+public:
+    TUint32*                iSampleTime;
+};
+
+#ifdef PWR_SAMPLER_BACKLIGHT
+class CProfilerPowerListener : public CBase, public MHWRMBatteryPowerObserver, public MHWRMLightObserver
+#else
+class CProfilerPowerListener : public CBase, public MHWRMBatteryPowerObserver
+#endif
+{
+public:
+    static  CProfilerPowerListener* NewL(CPwrPlugin* aSampler);
+            ~CProfilerPowerListener();
+
+private:
+            CProfilerPowerListener(CPwrPlugin* aSampler);
+    void    ConstructL();
+
+public:
+    TInt    StartL(const TDesC8& aBuf);
+    TInt    Stop();
+    TInt    DisplayNotifierL(const TDesC& aLine1, const TDesC& aLine2, const TDesC& aButton1, const TDesC& aButton2);
+
+    // From MHWRMBatteryPowerObserver
+    virtual void PowerMeasurement(TInt aErr, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement);
+#ifdef PWR_SAMPLER_BACKLIGHT
+    // From MHWRMLightObserver
+    virtual void LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus);
+#endif
+
+private:
+    void    Sample();
+
+public:
+    TInt                    iPwrSamplingPeriod;
+    TInt                    iSampleStartTime;
+    // Value that is read from Central Repository and restored after sampling
+    TInt                    iOriginalReportingPeriod;
+
+private:
+
+#ifdef PWR_SAMPLER_BACKLIGHT
+    TUint8                  iSample[13];
+#else
+    TUint8                  iSample[12];
+#endif
+
+    TUint16                 iNominalCapa;
+    TUint16                 iVoltage;
+    TUint16                 iCurrent;
+
+    CPwrPlugin*             iSampler;
+    CHWRMPower*             iPowerAPI;
+
+#ifdef PWR_SAMPLER_BACKLIGHT
+    CHWRMLight*             iLightAPI;
+    CHWRMLight::TLightStatus iBackLightStatus;
+#endif
+};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/PWRplugin/sis/PWRPlugin.pkg	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,44 @@
+;
+; 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:
+;
+; ShapeImplementation_30_gcce.pkg
+;
+
+;Language - standard language definitions
+&EN
+
+; standard sis file header
+#{"Shape plugin"},(0xE01F614F),2,0,0
+
+
+;
+;Localised Vendor name
+;
+%{"Forum Nokia"}
+
+;
+;Unique Vendor name
+;
+:"Forum Nokia"
+
+;
+;Supports Series 60 v 3.0
+;
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+
+;Files to include. Check the source paths they match your SDK setup. 
+"\Symbian\9.1\S60_3rd_MR\Epoc32\release\gcce\urel\shapeimplementation.dll"     -   "!:\sys\bin\shapeimplementation.dll"
+"\Symbian\9.1\S60_3rd_MR\epoc32\data\Z\Resource\plugins\shapeimplementation.rsc"   -   "!:\Resource\Plugins\shapeimplementation.RSC"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/PWRplugin/src/PwrPlugin.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,623 @@
+/*
+* 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 "PwrPlugin.h"
+#include <piprofiler/ProfilerTraces.h>
+
+#include <centralrepository.h>
+#include <HWRMPower.h>
+#include <HWRMLight.h>
+#include <hwrm/hwrmpowerdomaincrkeys.h>
+
+
+// texts for notes
+_LIT(KPowerTextLine1, "Power sampler:");
+_LIT(KPowerTextLine2, "Failed to start power measurement");
+_LIT(KPowerTextErrorSampling, "Error receiving measurement data");
+_LIT(KButtonOk, "Ok");
+
+// LITERALS
+
+_LIT8(KSamplingPeriodMs, "sampling_period_ms");
+
+// CONSTANTS
+// Use this UID if plugin is PwrPlugin:
+const TUid KSamplerPwrPluginUid = { 0x2001E5B9 };
+
+/*
+ *
+ * class CPwrPlugin implementation
+ * 
+ */
+ 
+CPwrPlugin* CPwrPlugin::NewL(const TUid /*aImplementationUid*/, TAny* aInitParams)
+    {
+    LOGTEXT(_L("CPwrPlugin::NewL() - entry"));
+    CPwrPlugin* self = new (ELeave) CPwrPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    LOGTEXT(_L("CPwrPlugin::NewL() - exit"));
+    return self;
+    }
+
+CPwrPlugin::CPwrPlugin() :
+    iVersionDescriptor(&(this->iVersion[1]),0,19),
+    iSamplerType(PROFILER_USER_MODE_SAMPLER)
+    {
+    iPeriod = 250;
+    iSamplerId = PROFILER_PWR_SAMPLER_ID;
+    iEnabled = EFalse;
+    iPowerListener = NULL;
+    LOGTEXT(_L("CPwrPlugin::CPwrPlugin() - konstruktori"));
+
+    }
+
+void CPwrPlugin::ConstructL() 
+    {
+    LOGTEXT(_L("CPwrPlugin::ConstructL() - entry"));
+    // initiate sampler attributes array
+    iSamplerAttributes = new(ELeave) CArrayFixFlat<TSamplerAttributes>(1); // only one sampler
+
+    // insert default attributes to array
+    InitiateSamplerAttributesL();
+
+    LOGTEXT(_L("CPwrPlugin::ConstructL() - exit"));
+    }
+
+CPwrPlugin::~CPwrPlugin()
+    {
+    LOGTEXT(_L("CPwrPlugin::~CPwrPlugin() - entry"));
+    if(iPowerListener)
+        {
+        if(Enabled())
+            {
+            iPowerListener->Stop();
+            }
+        delete iPowerListener;
+        iPowerListener = NULL;
+        }
+
+    if(iSamplerAttributes)
+        {
+        iSamplerAttributes->Reset();
+        delete iSamplerAttributes;
+        iSamplerAttributes = NULL;
+        }
+
+    LOGTEXT(_L("CPwrPlugin::~CPwrPlugin() - exit"));
+    }
+
+TUid CPwrPlugin::Id(TInt /*aSubId*/) const
+    {
+    LOGSTRING2( "CPwrPlugin::Id():0x%X", KSamplerPwrPluginUid.iUid );
+    return KSamplerPwrPluginUid;
+    }
+
+void CPwrPlugin::InitiateSamplerAttributesL()
+    {
+    // create TSamplerAttributes
+    TSamplerAttributes attr(KSamplerPwrPluginUid.iUid,
+            KPWRShortName(),
+            KPWRLongName(),
+            KPWRDescription(),
+            250,
+            EFalse,
+            EFalse,
+            0); 
+    this->iSamplerAttributes->AppendL(attr);
+    }
+
+void CPwrPlugin::SetEnabled(TBool aEnabled)
+    {
+    iEnabled = aEnabled;
+    }
+
+// returns setting array
+void CPwrPlugin::GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes)
+    {
+    aAttributes->AppendL(iSamplerAttributes->At(0));
+    }
+
+TInt CPwrPlugin::SetAttributesL(TSamplerAttributes& aAttributes)
+    {
+    TSamplerAttributes attr;
+
+    attr = iSamplerAttributes->At(0);
+    // replace the old attribute container
+    iSamplerAttributes->Delete(0);
+    iSamplerAttributes->InsertL(0, aAttributes);
+    return KErrNone;
+    }
+
+/* 
+ * Method for parsing and transforming text array settings into TSamplerAttributes (per each sub sampler),
+ * called by CSamplerController class
+ * 
+ * @param array of raw text setting lines, e.g. [gpp]\nenabled=true\nsampling_period_ms=1\n
+ */
+TInt CPwrPlugin::ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aAllSettingsArray)
+    {
+    // local literals
+    _LIT8(KPWRShort, "pwr");
+
+    TInt err(KErrNone);
+    TBuf8<16> samplerSearchName;
+    samplerSearchName.Copy(KPWRShort);
+
+    // get sampler specific settings  
+    err = DoSetSamplerSettings(aAllSettingsArray, samplerSearchName, 0);
+
+    // returns KErrNone if settings found, otherwise KErrNotFound
+    return err;
+    }
+
+TInt CPwrPlugin::DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex)
+    {
+    // 
+    TBuf8<16> samplerSearch;
+    samplerSearch.Copy(KBracketOpen);
+    samplerSearch.Append(aSamplerName);
+    samplerSearch.Append(KBracketClose);
+
+    // read a line
+    for (TInt i(0); i<aAllSettings->MdcaCount(); i++)
+        {
+        // check if this line has a setting block start, i.e. contains [xxx] in it
+        if (aAllSettings->MdcaPoint(i).CompareF(samplerSearch) == 0)
+            {
+            // right settings block found, now loop until the next block is found
+            for(TInt j(i+1);j<aAllSettings->MdcaCount();j++)
+                {
+                // check if the next settings block was found
+                if(aAllSettings->MdcaPoint(j).Left(1).CompareF(KBracketOpen) != 0)
+                    {
+                    // save found setting value directly to its owners attributes
+                    SaveSettingToAttributes(aAllSettings->MdcaPoint(j), aIndex);
+                    }
+                else
+                    {
+                    // next block found, return KErrNone
+                    return KErrNone;
+                    }
+                }
+            }
+        }
+
+    return KErrNotFound;
+    }
+
+/**
+ * Method for setting a specific descriptor (from settings file) to attribute structure
+ * 
+ * @param aSetting  
+ * @param aName  
+ */
+void CPwrPlugin::SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex)
+    {
+    // find the equal mark from the setting line
+    TInt sepPos = aSetting.Find(KSettingItemSeparator);
+    // check that '=' is found
+    if (sepPos > 0)
+        {
+        // check that the element matches
+        if (aSetting.Left(sepPos).CompareF(KEnabled) == 0)
+            {
+            TBool en;
+            CSamplerPluginInterface::Str2Bool(aSetting.Right(aSetting.Length()-sepPos-1), en);
+            if(en != iSamplerAttributes->At(aIndex).iEnabled)
+                {
+                iSamplerAttributes->At(aIndex).iEnabled = en;
+                }
+            }
+        else if (aSetting.Left(sepPos).CompareF(KSamplingPeriodMs) == 0)
+            {
+            TInt sr;
+            CSamplerPluginInterface::Str2Int(aSetting.Right(aSetting.Length()-sepPos-1), sr);
+            if(sr != iSamplerAttributes->At(aIndex).iSampleRate)
+                {
+                iSamplerAttributes->At(aIndex).iSampleRate = sr;
+                }
+            }
+        }
+    }
+
+TInt CPwrPlugin::GetSamplerType()
+    {
+    return iSamplerType;
+    }
+
+TInt CPwrPlugin::ResetAndActivateL(CProfilerSampleStream& aStream) 
+    {
+    LOGTEXT(_L("CPwrPlugin::ResetAndActivate() - entry"));
+    // check if sampler enabled
+    if(iSamplerAttributes->At(0).iEnabled)
+        {
+        // create a new listener instance for every trace, destroy it on stop
+        iPowerListener = CProfilerPowerListener::NewL(this);
+
+        iStream = &aStream;
+        TInt length = this->CreateFirstSample();
+        iVersion[0] = (TUint8)length;
+        LOGSTRING2("CPwrPlugin::ResetAndActivate() - AddSample, length %d", length);
+        TInt ret = this->AddSample(iVersion, length+1, 0);
+
+        LOGSTRING2("CPwrPlugin::ConstructL() - sampling period %d", this->iPeriod);
+
+        HBufC8* iBufRes = HBufC8::NewMaxLC(10);
+        TPtr8 iPtrRes = iBufRes->Des();
+
+        // check if sampling rate set to something reasonable, relevant only in SYNC case
+        if(iSamplerAttributes->At(0).iSampleRate != -1)
+            {
+            iPtrRes.Num(iSamplerAttributes->At(0).iSampleRate);
+            }
+        else
+            {
+            iPtrRes.Append(KNullDesC8);
+            }
+
+        // set disabled
+        SetEnabled(ETrue); 
+
+        // activate power listener
+        ret = iPowerListener->StartL(iPtrRes);
+        LOGTEXT(_L("CPwrPlugin::ResetAndActivate() - exit"));
+
+        CleanupStack::PopAndDestroy();
+        
+        if(ret != KErrNone)
+            return ret;
+        }
+    return KErrNone;
+    }
+
+TInt CPwrPlugin::CreateFirstSample() 
+    {
+    LOGTEXT(_L("CPwrPlugin::CreateFirstSample - entry"));
+    this->iVersionDescriptor.Zero();
+    this->iVersionDescriptor.Append(_L8("Bappea_PWR_V"));
+    this->iVersionDescriptor.Append(PROFILER_PWR_SAMPLER_VERSION);
+    LOGTEXT(_L("CPwrPlugin::CreateFirstSample - exit"));
+    return (TInt)(this->iVersionDescriptor.Length());
+    }
+
+TInt CPwrPlugin::StopSampling() 
+    {
+    if(iPowerListener)
+        {
+        iPowerListener->Stop();
+        delete iPowerListener;
+        iPowerListener = NULL;
+        }
+
+    // set disabled
+    SetEnabled(EFalse);
+
+    return KErrNone;
+    }
+
+
+/*
+ *
+ * class CProfilerPowerListener implementation
+ * 
+ */
+
+CProfilerPowerListener::CProfilerPowerListener(CPwrPlugin* aSampler) :
+    iPwrSamplingPeriod(0),
+    iOriginalReportingPeriod(0),
+    iNominalCapa(0),
+    iVoltage(0), 
+    iCurrent(0),
+    iPowerAPI(0)
+#ifdef PWR_SAMPLER_BACKLIGHT
+    ,iLightAPI(0),
+    iBackLightStatus(CHWRMLight::ELightStatusUnknown)
+#endif
+
+    {
+    LOGTEXT(_L("CProfilerPowerListener::CProfilerPowerListener() - konstuktori"));
+    this->iSampler = aSampler;
+    LOGTEXT(_L("CProfilerPowerListener::CProfilerPowerListener() - konstuktori exit"));
+    }
+
+CProfilerPowerListener* CProfilerPowerListener::NewL(CPwrPlugin* aSampler)
+    {
+    LOGTEXT(_L("CProfilerPowerListener::NewL() - entry"));
+    CProfilerPowerListener* self = new (ELeave) CProfilerPowerListener(aSampler);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    LOGTEXT(_L("CProfilerPowerListener::NewL() - exit"));
+    return self;
+    }
+
+void CProfilerPowerListener::ConstructL()
+    {
+    LOGTEXT(_L("CProfilerPowerListener::ConstructL() - entry"));
+    iSampleStartTime = 0;
+    LOGTEXT(_L("CProfilerPowerListener::ConstructL() - exit"));
+    }
+
+CProfilerPowerListener::~CProfilerPowerListener() 
+    {
+    LOGTEXT(_L("CProfilerPowerListener::~CProfilerPowerListener() - entry"));
+
+    if (iPowerAPI)
+        {
+        delete iPowerAPI;
+        iPowerAPI = 0;
+        }
+#ifdef PWR_SAMPLER_BACKLIGHT
+    if (iLightAPI)
+        {
+        delete iLightAPI;
+        iLightAPI = 0;
+        }
+#endif
+
+    LOGTEXT(_L("CProfilerPowerListener::~CProfilerPowerListener() - exit"));
+    }
+
+TInt CProfilerPowerListener::DisplayNotifierL(const TDesC& aLine1, const TDesC& aLine2, const TDesC& aButton1, const TDesC& aButton2)
+    {
+    RNotifier notifier;
+    TRequestStatus stat;
+
+    TInt buttonValue(0);
+
+    User::LeaveIfError(notifier.Connect());
+
+    notifier.Notify(aLine1, aLine2, aButton1, aButton2, buttonValue, stat);
+    User::WaitForRequest(stat);
+
+    notifier.Close();
+    return buttonValue;
+    }
+
+
+TInt CProfilerPowerListener::StartL(const TDesC8& aBuf)
+    {
+    LOGTEXT(_L("CProfilerPowerListener::StartL() - entry"));
+
+    // get the property value
+    TInt r = RProperty::Get(KGppPropertyCat, EGppPropertySyncSampleNumber, iSampleStartTime);
+    if(r != KErrNone)
+        {
+        LOGSTRING2("CProfilerPowerListener::StartL() - getting iSyncOffset failed, error %d", r);
+        }
+
+   // check if given sampling period is valid
+    if(aBuf.CompareF(KNullDesC8)!= 0)
+        {
+        TLex8* lex = new TLex8(aBuf);
+        lex->Val(iPwrSamplingPeriod);
+        delete lex;
+        }
+    else
+        {
+        // set default period
+        iPwrSamplingPeriod = 250;
+        }
+
+    // Check that sampling period is in allowed range
+    if (KMinSampleInterval > 0 && iPwrSamplingPeriod < KMinSampleInterval)
+        {
+        iPwrSamplingPeriod = KMinSampleInterval;
+        }
+
+    LOGSTRING2("CProfilerPowerListener::StartL() - Sampling period %d", iPwrSamplingPeriod);
+
+    // Start monitoring voltage and current
+    iPowerAPI = CHWRMPower::NewL();
+    iPowerAPI->SetPowerReportObserver(this);
+
+    // Read HWRM reporting settings from central repository
+    CRepository* centRep = CRepository::NewL(KCRUidPowerSettings);
+    TInt baseInterval(0);
+    User::LeaveIfError(centRep->Get(KPowerBaseTimeInterval, baseInterval));
+    User::LeaveIfError(centRep->Get(KPowerMaxReportingPeriod, iOriginalReportingPeriod));
+
+    LOGSTRING2("CProfilerPowerListener::StartL() - HWRM base power report interval: %d", baseInterval);
+    LOGSTRING2("CProfilerPowerListener::StartL() - Original HWRM max power reporting period: %d", iOriginalReportingPeriod);
+
+    User::LeaveIfError(centRep->Set(KPowerMaxReportingPeriod, KReportingPeriodInfinite));
+
+    // Power reporting interval reading may return too low value sometimes. Minimum value expected to be 250ms.
+    if ( baseInterval < KMinSampleInterval )
+        {
+        baseInterval = KMinSampleInterval;
+        LOGSTRING2("CProfilerPowerListener::StartL() - Power report interval too low. Changed to: %d", baseInterval);
+        }
+
+    // Power reporting period is multiplier of HWRM base period
+    TInt intervalMultiplier = iPwrSamplingPeriod / baseInterval;
+
+    if (intervalMultiplier < 1)
+        {
+        intervalMultiplier = 1;
+        }
+
+    LOGSTRING2("CProfilerPowerListener::StartL() - Reporting period multiplier: %d", intervalMultiplier);
+
+    TRequestStatus status(KRequestPending);
+    iPowerAPI->StartAveragePowerReporting(status, intervalMultiplier);
+    User::WaitForRequest(status);
+
+    if (status.Int() != KErrNone)
+        {
+        LOGTEXT(_L("CProfilerPowerListener::StartL() - Failed to initialize power reporting"));
+
+        DisplayNotifierL(KPowerTextLine1, KPowerTextLine2, KButtonOk, KNullDesC);
+
+        return status.Int();
+        }
+
+#ifdef PWR_SAMPLER_BACKLIGHT
+    // Start monitoring backlight status
+    iLightAPI = CHWRMLight::NewL(this);
+#endif
+
+    LOGTEXT(_L("CProfilerPowerListener::StartL() - exit"));
+    return KErrNone;
+    }
+
+void CProfilerPowerListener::Sample()
+    {
+    LOGTEXT(_L("CProfilerPowerListener::Sample() - entry"));
+
+    TRequestStatus status;
+    CHWRMPower::TBatteryConsumptionData consumptionData;
+
+    iPowerAPI->GetBatteryInfo(status, consumptionData);
+    User::WaitForRequest(status);
+
+    // Data is valid only if status == KErrNone 
+    if (status.Int() != KErrNone)
+        {
+        LOGSTRING2("CProfilerPowerListener::Sample() - Getting battery info failed with code: ", status.Int());
+        iNominalCapa = 0;
+        }
+    else
+        {
+        iNominalCapa = consumptionData.iNominalCapacity;
+        }
+
+    // Space for GPP sample time        
+    //TUint32 sampleTime = iSampler->iStream->iSampler->GetSampleTime();
+    TUint32 sampleTime = User::NTickCount() - iSampleStartTime;
+    LOGSTRING2("CProfilerPowerListener::Sample() - Sample time: %d", sampleTime);
+    LOGSTRING2("CProfilerPowerListener::Sample() - Nominal capacitance: %d", iNominalCapa);
+    LOGSTRING2("CProfilerPowerListener::Sample() - Voltage: %d", iVoltage);
+    LOGSTRING2("CProfilerPowerListener::Sample() - Current: %d", iCurrent);
+#ifdef PWR_SAMPLER_BACKLIGHT
+    LOGSTRING2("CProfilerPowerListener::Sample() - Backlight status: %d", (TUint8)iBackLightStatus);
+#endif
+
+    iSample[0] = iNominalCapa;
+    iSample[1] = iNominalCapa >> 8;
+    iSample[2] = iVoltage;
+    iSample[3] = iVoltage >> 8;
+    iSample[4] = iCurrent;
+    iSample[5] = iCurrent >> 8;
+    iSample[6] = iCurrent >> 16;
+    iSample[7] = iCurrent >> 24;
+#ifdef PWR_SAMPLER_BACKLIGHT
+    iSample[8] = (TUint8)iBackLightStatus;
+    iSample[9] = sampleTime;
+    iSample[10] = sampleTime >> 8;
+    iSample[11] = sampleTime >> 16;
+    iSample[12] = sampleTime >> 24;
+
+    iSampler->AddSample(iSample, 13, 0);
+#else
+    iSample[8] = sampleTime;
+    iSample[9] = sampleTime >> 8;
+    iSample[10] = sampleTime >> 16;
+    iSample[11] = sampleTime >> 24;
+
+    iSampler->AddSample(iSample, 12, 0);
+#endif
+
+    LOGTEXT(_L("CProfilerPowerListener::Sample() - exit"));
+    }
+
+TInt CProfilerPowerListener::Stop() 
+    {
+    LOGTEXT(_L("CProfilerPowerListener::Stop() - entry"));
+
+    if (iPowerAPI)
+        {
+        TRAPD(err, iPowerAPI->StopAveragePowerReportingL());
+        if(err != KErrNone)
+            {
+            LOGSTRING2("CProfilerPowerListener::Stop() - Failed to stop power reporting: %d", err);
+            }
+        else
+            {
+            LOGTEXT(_L("CProfilerPowerListener::Stop() - Stopped power monitoring"));
+            }
+        delete iPowerAPI;
+        iPowerAPI = 0;
+
+        // Restore original value to max sampling period
+        CRepository* centRep = 0;
+        TRAP(err, centRep = CRepository::NewL(KCRUidPowerSettings));
+        if (err != KErrNone)
+            {
+            LOGSTRING2("CProfilerPowerListener::Stop() - Failed to open Central Repository: %d", err);
+            }
+        else
+            {
+            err = centRep->Set(KPowerMaxReportingPeriod, iOriginalReportingPeriod);
+            if(err != KErrNone)
+                {
+                LOGSTRING2("CProfilerPowerListener::Stop() - Failed to restore max sampling period: %d", err);
+                }
+            }
+        }
+#ifdef PWR_SAMPLER_BACKLIGHT
+    if (iLightAPI)
+        {
+        delete iLightAPI;
+        iLightAPI = 0;
+        }
+#endif
+
+    LOGTEXT(_L("CProfilerPowerListener::Stop() - exit"));
+    return KErrNone;
+    }
+
+void CProfilerPowerListener::PowerMeasurement(TInt aErr, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement)
+    {
+    LOGTEXT(_L("CProfilerPowerListener::PowerMeasurement - entry"));
+
+    if (aErr == KErrNone)
+        {
+        LOGSTRING3("CProfilerPowerListener::PowerMeasurement - Previous values - Voltage: %d Current: %d", iVoltage, iCurrent);
+        iVoltage = aMeasurement.iAverageVoltage;
+        iCurrent = aMeasurement.iAverageCurrent;
+        LOGSTRING3("CProfilerPowerListener::PowerMeasurement - New values - Voltage: %d Current: %d", iVoltage, iCurrent);
+
+        this->Sample();
+        }
+    else
+        {
+        LOGSTRING2("CProfilerPowerListener::PowerMeasurement - Failed with error code: %d", aErr);
+        DisplayNotifierL(KPowerTextLine1, KPowerTextErrorSampling, KButtonOk, KNullDesC);
+        }
+    LOGTEXT(_L("CProfilerPowerListener::PowerMeasurement - exit"));
+    }
+
+#ifdef PWR_SAMPLER_BACKLIGHT
+void CProfilerPowerListener::LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus)
+    {
+    LOGTEXT(_L("CProfilerPowerListener::LightStatusChanged - entry"));
+    LOGSTRING3("CProfilerPowerListener::LightStatusChanged - Target: %d Status: %d", aTarget, aStatus);
+
+    if (aTarget == CHWRMLight::EPrimaryDisplay)
+        {
+        LOGSTRING2("CProfilerPowerListener::LightStatusChanged - Previous light status: %d", iBackLightStatus);
+        iBackLightStatus = aStatus;
+        LOGSTRING2("CProfilerPowerListener::LightStatusChanged - New light status: %d", iBackLightStatus);
+
+        this->Sample();
+        }
+    LOGTEXT(_L("CProfilerPowerListener::LightStatusChanged - exit"));
+    }
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/plugins/PWRplugin/src/PwrPluginImplementationTable.cpp	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "PwrPlugin.h"
+
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+{
+         IMPLEMENTATION_PROXY_ENTRY(0x2001E5B9,  CPwrPlugin::NewL),
+};
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/rom/piprofiler.iby	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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 __PIPROFILER__
+#define __PIPROFILER__
+
+// PI Profiler Engine itself 
+file=ABI_DIR\BUILD_DIR\PIProfilerEngine.exe						sys\bin\PIProfilerEngine.exe
+file=ABI_DIR\BUILD_DIR\PIProfiler.exe							sys\bin\PIProfiler.exe
+
+// sampler plugins
+// NOTE: Mandatory kernel driver included in piprofiler_ldd.iby
+ECOM_PLUGIN(PIProfilerGenerals.dll, PIProfilerGenerals.rsc)
+ECOM_PLUGIN(PIProfilerPWR.dll, PIProfilerPWR.rsc)
+
+ECOM_PLUGIN(PIProfilerBUP.dll, PIProfilerBUP.rsc)
+file=ABI_DIR\BUILD_DIR\PIProfilerTouchEventAnim.dll				sys\bin\PIProfilerTouchEventAnim.dll
+
+// Writer plugins
+ECOM_PLUGIN(piprofilerdebugwriter.dll, piprofilerdebugwriter.rsc)
+ECOM_PLUGIN(piprofilerdiskwriter.dll, piprofilerdiskwriter.rsc)
+
+#endif //__PIPROFILER__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/rom/piprofiler_ldd.iby	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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 __PIPROFILER_LDD__
+#define __PIPROFILER_LDD__
+
+// kernel side driver
+device[VARID]=KERNEL_DIR\BUILD_DIR\PIProfilerGeneralsSampler.ldd				sys\bin\PIProfilerGeneralsSampler.ldd
+
+#endif //__PIPROFILER_LDD__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/rom/piprofiler_s2.iby	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 __PIPROFILER__
+#define __PIPROFILER__
+
+// PI Profiler Engine itself 
+file=ABI_DIR\BUILD_DIR\PIProfilerEngine.exe						sys\bin\PIProfilerEngine.exe
+file=ABI_DIR\BUILD_DIR\PIProfiler.exe							sys\bin\PIProfiler.exe
+
+// sampler plugins
+// NOTE: Mandatory kernel driver included in piprofiler_ldd.iby
+ECOM_PLUGIN(PIProfilerGenerals.dll, PIProfilerGenerals.rsc)
+
+ECOM_PLUGIN(PIProfilerBUP.dll, PIProfilerBUP.rsc)
+file=ABI_DIR\BUILD_DIR\PIProfilerTouchEventAnim.dll				sys\bin\PIProfilerTouchEventAnim.dll
+
+// Writer plugins
+ECOM_PLUGIN(piprofilerdebugwriter.dll, piprofilerdebugwriter.rsc)
+ECOM_PLUGIN(piprofilerdiskwriter.dll, piprofilerdiskwriter.rsc)
+
+#endif //__PIPROFILER__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/piprofiler/symbian_version.hrh	Mon Sep 06 15:00:47 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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: Symbian version configuration file 
+*
+*/
+
+#ifndef __SYMBIAN_VERSION_HRH
+#define __SYMBIAN_VERSION_HRH
+
+// S60 and Symbian version number enumeration definitions
+
+#define S60_30                                              30
+#define S60_31                                              31
+#define S60_32                                              32
+#define S60_50                                              50
+#define S60_51                                              91
+#define S60_52                                              92
+#define SYMBIAN_1                                           50
+#define SYMBIAN_2                                           91
+#define SYMBIAN_3                                           92
+#define SYMBIAN_4                                           101
+
+
+/**
+ * Defines the S60 or Symbian version used by this component. This flag can be
+ * used to variate the source code based on the SDK in use. The value of the
+ * flag should be always changed to reflect the current build environment.
+ */
+#define SYMBIAN_VERSION_SUPPORT                              SYMBIAN_4
+
+
+#endif  // __SYMBIAN_VERSION_HRH
--- a/piprofiler/engine/group/ProfilerEngine.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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 <platform_paths.hrh>
-
-
-TARGET      PIProfilerEngine.exe
-TARGETTYPE  EXE
-UID         0x100039CE 0x2001E5AD
-VENDORID    VID_DEFAULT
-CAPABILITY  ALL -TCB
-SMPSAFE
-
-EPOCSTACKSIZE     	0x10000
-EPOCHEAPSIZE        0x100000 0x2000000  // Min 1MB, Max 32MB
-
-OS_LAYER_SYSTEMINCLUDE
-USERINCLUDE     ../inc
-SOURCEPATH      ../src
-
-SOURCE		ProfilerErrorChecker.cpp
-SOURCE      ProfilerEngine.cpp 
-SOURCE      SamplerController.cpp
-SOURCE      SamplerPluginLoader.cpp 
-SOURCE      WriterController.cpp
-SOURCE      WriterPluginLoader.cpp 
-SOURCE		ProfilerTimer.cpp 
-
-LIBRARY		sysutil.lib 
-LIBRARY     efsrv.lib
-LIBRARY     c32.lib
-LIBRARY     euser.lib 
-LIBRARY     estor.lib 
-LIBRARY     fbscli.lib
-LIBRARY     ws32.lib
-LIBRARY     bafl.lib 
-LIBRARY     charconv.lib
-LIBRARY     ecom.lib
-LIBRARY		platformenv.lib
--- a/piprofiler/engine/group/ProfilerEshell.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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 <platform_paths.hrh>
-
-
-TARGET      PIProfiler.exe
-TARGETTYPE  EXE
-UID         0x100039CE 0x2021E5AD	// test UID, get an official
-VENDORID    VID_DEFAULT
-CAPABILITY  ALL -TCB
-SMPSAFE
-
-EPOCSTACKSIZE     	0x10000
-
-OS_LAYER_SYSTEMINCLUDE
-USERINCLUDE     ../inc
-SOURCEPATH      ../src
-
-
-SOURCE      ProfilerEshell.cpp 
-
-LIBRARY     c32.lib
-LIBRARY     euser.lib 
-LIBRARY     bafl.lib 
-LIBRARY		efsrv.lib 
--- a/piprofiler/engine/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-/*
-* Copyright (c) 2007 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:  
-*
-*/
-
-
-PRJ_MMPFILES
-ProfilerEngine.mmp
-ProfilerEshell.mmp
-
--- a/piprofiler/engine/inc/ProfilerEngine.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +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 __PROFILERENGINE__
-#define __PROFILERENGINE__
-
-#include <e32base.h>
-#include <e32svr.h>
-#include <e32property.h> 
-
-#include <piprofiler/SamplerPluginInterface.h>
-#include <piprofiler/WriterPluginInterface.h>
-#include <piprofiler/ProfilerSession.h>
-#include <piprofiler/ProfilerAttributes.h>	// internal settings format presentations 
-
-#include "SamplerController.h"
-#include "WriterController.h"
-#include "ProfilerErrorChecker.h"
-#include "ProfilerTimer.h"
-
-// CONSTANTS
-const TInt KProfilerPrefixMaxLength = 32;
-const TInt KSettingsFileSize = 4096;
-
-/*
- * This is an internal interface to the profiling engine which allows
- * an additional control DLL to be loaded, replacing the profiler's
- * default console UI
- */
-
-/**
- * Implementation class providing access to the profiler engine
- */
-
-class MProfilerEngine
-{
-public:
-	virtual TInt				ControlL(TInt aCommand) =0;
-	virtual TInt				ControlDataL(TInt aCommand, TAny* data1 = 0, TAny* data2 = 0) = 0; 
-	
-	virtual TInt                GetSamplerAttributesL(const RMessage2& aMessage) = 0;
-    virtual TInt                GetSamplerAttributeCountL(const RMessage2& aMessage) = 0;
-	virtual TInt                SetSamplerAttributesL(const RMessage2& aMessage) = 0;
-	virtual TInt                GetGeneralAttributesL(const RMessage2& aMessage) = 0;
-	virtual TInt                SetGeneralAttributesL(const RMessage2& aMessage) = 0;
-    virtual TInt                 RefreshStatus(const RMessage2& aMessage) = 0;
-	virtual RProfiler::TSamplerState 	State() const =0;
-};
-
-/**
- * The interface that the extra controller must implement to access
- * the profiler.
- */
-class MProfilerController
-{
-	public:
-		/** Release the controller from the profiler. This is invoked when the profiler is unloading. */
-		virtual void				Release() = 0;
-		/** Ask the profiler to change state */
-		inline TInt					ControlL(TInt aCommand) const;
-		/** Ask the profiler to change state */
-		inline TInt					ControlDataL(TInt aCommand, TAny* data1 = 0, TAny* data2 = 0) const;
-		
-		inline TInt                 GetSamplerAttributesL(const RMessage2& aMessage) const;
-        inline TInt                 SetSamplerAttributesL(const RMessage2& aMessage) const;
-        inline TInt                 GetGeneralAttributesL(const RMessage2& aMessage) const;
-        inline TInt                 SetGeneralAttributesL(const RMessage2& aMessage) const;
-        inline TInt                 GetSamplerAttributeCountL(const RMessage2& aMessage) const;
-        inline TInt                 RefreshStatus(const RMessage2& aMessage) const;
-		/* Query the profiler state */
-		inline RProfiler::TSamplerState	GeTComand() const;
-	protected:
-		inline						MProfilerController(MProfilerEngine& aEngine);
-	private:
-		MProfilerEngine& iEngine;
-};
-
-/** The signature of ordinal 1 in the controller DLL */
-typedef MProfilerController* (*TProfilerControllerFactoryL)(TInt aPriority, MProfilerEngine& aEngine);
-/** The second UID required by the controller DLL */
-const TUid KUidProfilerKeys={0x1000945c};
-
-inline MProfilerController::MProfilerController(MProfilerEngine& aEngine)
-	:iEngine(aEngine)
-{
-
-}
-
-inline TInt MProfilerController::ControlL(TInt aCommand) const
-{
-	return iEngine.ControlL(aCommand);
-}
-
-inline TInt MProfilerController::ControlDataL(TInt aCommand,TAny* data1, TAny* data2) const
-{
-	return iEngine.ControlDataL(aCommand,data1,data2);
-}
-
-inline TInt MProfilerController::GetSamplerAttributesL(const RMessage2& aMessage) const
-{
-    return iEngine.GetSamplerAttributesL(aMessage);
-}
-
-inline TInt MProfilerController::SetSamplerAttributesL(const RMessage2& aMessage) const
-{
-    return iEngine.SetSamplerAttributesL(aMessage);
-}
-
-inline TInt MProfilerController::GetGeneralAttributesL(const RMessage2& aMessage) const
-{
-    return iEngine.GetGeneralAttributesL(aMessage);
-}
-
-inline TInt MProfilerController::GetSamplerAttributeCountL(const RMessage2& aMessage) const
-{
-    return iEngine.GetSamplerAttributeCountL(aMessage);
-}
-
-inline TInt MProfilerController::SetGeneralAttributesL(const RMessage2& aMessage) const
-{
-    return iEngine.SetGeneralAttributesL(aMessage);
-}
-
-inline TInt MProfilerController::RefreshStatus(const RMessage2& aMessage) const
-{
-    return iEngine.RefreshStatus(aMessage);
-}
-
-inline RProfiler::TSamplerState MProfilerController::GeTComand() const
-{
-	return iEngine.State();
-}
-
-class CSamplerController;
-class CWriterController;
-class MSamplerControllerObserver;
-class MProfilerErrorObserver;
-
-class CProfiler : public CBase, private MProfilerEngine, 
-    MSamplerControllerObserver, 
-    MProfilerErrorObserver,
-    MProfilerTimerObserver
-{
-	public:
-		
-		static CProfiler*	NewLC(const TDesC& aSettingsFile);
-
-		/**
-		 * Method for control commands, i.e. start, stop and exit 
-		 * 
-		 * @param aCommand command to be parsed and executed
-		 * @return TInt KErrNone if succeed, else error code
-		 */
-		TInt				ControlL(TInt aCommand);
-
-		/**
-         * Method for control data, e.g. settings
-         * 
-         * @param aCommand command to be parsed and executed
-         * @param value1 can contain any value, integer or string, depends on use case 
-         * @param value2 can contain any value, integer or string, depends on use case 
-         * @return TInt KErrNone if succeed, else error code
-         */
-		TInt				ControlDataL(TInt aCommand, TAny* value1 = 0, TAny* value2 = 0);	
-
-		// setting attributes manipulation
-		TInt  GetGeneralAttributesL(const RMessage2& aMessage);
-		TInt  GetSamplerAttributesL(const RMessage2& aMessage);
-		TInt  SetGeneralAttributesL(const RMessage2& aMessage);
-		TInt  SetSamplerAttributesL(const RMessage2& aMessage);
-		TInt  GetSamplerAttributeCountL(const RMessage2& aMessage);
-		TInt  RefreshStatus(const RMessage2& /*aMessage*/);
-
-		// from CProfilerErrorChecker
-		void  HandleSamplerControllerReadyL();
-		void  NotifyRequesterForSettingsUpdate();
-		void  HandleProfilerErrorChangeL( TInt aError );
-		
-		// from MProfilerTimerObserver
-		void HandleTimerExpiresL(TInt aError);
-	    
-		void 				Finalise();
-		CProfilerSampleStream* GetSamplerStream();
-	    void  HandleError(TInt aErr);
-	    static TBool CheckLocationSanity(RFs& fs, const TDesC8& aLocation);
-private:
-							CProfiler(const TDesC& aSettingsFile);
-							~CProfiler();
-		void				ConstructL();
-		TInt 				LoadSettingsL(/*const TDesC& configFile*/);		
-		void                DoGetValueFromSettingsArray(CDesC8ArrayFlat* aLineArray, const TDesC8& aAttribute, TDes8& aValue);
-		void                DoGetValueFromSettingsArray(CDesC8ArrayFlat* aLineArray, const TDesC8& aAttribute, TInt& aValue);
-		void                UpdateSavedGeneralAttributes(CDesC8ArrayFlat* aSavedAttributes);
-		template<class T> CBufFlat* ExternalizeLC(const T& aElements);
-		
-		RProfiler::TSamplerState	State() const;
-
-		void DrainSampleStream();
-		void InstallStreamForActiveTraces(CSamplerPluginInterface& aSampler, CWriterPluginInterface& aWriter, TDesC& totalPrefix);
-		void SaveSettingsL();
-		
-		TInt HandleGeneralSettingsChange();
-		TInt CheckOldProfilerRunning();
-public:
-        // trace file settings
-		TBuf8<KProfilerPrefixMaxLength>	iFilePrefix;
-		TBuf8<KProfilerPrefixMaxLength>	iDriveLetter;
-		TBuf8<KProfilerPrefixMaxLength*2> iTotalPrefix;
-
-		TBuf<256>                       iSettingsFileLocation;
-		
-		MProfilerController*			iServer;
-		RProfiler::TSamplerState		iState;
-		
-		CProfilerSampleStream* 			iUserStream;
-		
-		// plug-in controllers
-		CWriterController*				iWriterHandler;
-		CSamplerController*				iSamplerHandler;
-
-		// setting attribute containers
-		TGeneralAttributes				iGeneralAttributes;
-		CArrayFixFlat<TSamplerAttributes>*	iDefaultSamplerAttributesArray;
-		
-		// temporary settings file array container
-		CDesC8ArrayFlat*                iSavedLineArray;	
-		TInt                            iSavedLinesCount;
-	    // saved settings, add extra 1 byte space to end buffer with a '\n'
-	    TBuf8<KSettingsFileSize + 1>   iSettingsBuffer;   
-
-	    // P&S status properties
-		RProperty						iEngineStatus;
-        RProperty                       iUpdateStatus;
-	    TBuf<128>                       iFileNameStream;
-private:
-        TBool                           iSettingsFileLoaded;
-        CProfilerErrorChecker*          iErrorChecker;
-        CProfilerTimer*                 iTimer;
-};
-
-#include <piprofiler/ProfilerGenericClassesUsr.h>
-#endif	// __PROFILERENGINE__
-
--- a/piprofiler/engine/inc/ProfilerErrorChecker.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +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 PROFILERERRORCHECKER_H_
-#define PROFILERERRORCHECKER_H_
-
-// CLASS DECLARATIONS
-class MProfilerErrorObserver
-    {
-    public: // New
-        virtual void HandleProfilerErrorChangeL( TInt aError ) = 0;
-    };
-
-
-class CProfilerErrorChecker : public CActive
-    {
-public:
-    static CProfilerErrorChecker* CProfilerErrorChecker::NewL();
-    ~CProfilerErrorChecker();
-    void SetObserver(MProfilerErrorObserver* aObserver);
-private:
-    CProfilerErrorChecker();
-    void ConstructL();
-    void RunL();
-    TInt RunError(TInt aError);
-    void DoCancel();
-private:
-    MProfilerErrorObserver*     iObserver;
-    RProperty                   iErrorStatus;
-    };
-
-#endif /* PROFILERERRORCHECKER_H_ */
--- a/piprofiler/engine/inc/ProfilerEshell.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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 PROFILERESHELL_H_
-#define PROFILERESHELL_H_
-
-#include <e32base.h>
-#include <e32std.h>  
-#include <bacline.h>    // CCommandLineArguments
-
-class CProfilerEShell : public CBase
-    {
-public:
-    static CProfilerEShell* NewL();
-    ~CProfilerEShell();
-    
-    void ConstructL();
-private:
-    CProfilerEShell();
-    
-    };
-
-#endif /* PROFILERESHELL_H_ */
--- a/piprofiler/engine/inc/ProfilerTimer.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +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 PROFILERTIMER_H_
-#define PROFILERTIMER_H_
-
-#include <e32std.h>
-#include <e32base.h>
-
-class MProfilerTimerObserver
-    {
-public:
-    virtual void HandleTimerExpiresL(TInt aError) = 0;
-    };
-
-class CProfilerTimer : public CActive
-    {
-public:
-    static CProfilerTimer* NewL(const TInt aPriority, MProfilerTimerObserver& aObserver);
-    ~CProfilerTimer();
-    
-public:
-    
-    void After(TUint aPeriodInSeconds);
-    
-protected:
-    
-    // From CActive
-    void RunL();
-    void DoCancel();
-    
-private:
-    
-    CProfilerTimer(const TInt aPriority, MProfilerTimerObserver& aObserver);
-    void ConstructL(void);
-    
-private:
-    
-    RTimer      iTimer;
-    MProfilerTimerObserver&    iObserver;
-    };
-
-#endif /* PROFILERTIMER_H_ */
--- a/piprofiler/engine/inc/SamplerController.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +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 __SAMPLERCONTROLLER_H__
-#define __SAMPLERCONTROLLER_H__
-
-// system includes
-#include <utf.h>
-#include <e32cmn.h>
-
-
-// The user-interface to the sampling device driver sued by the profiling engine
-// user includes
-#include <piprofiler/ProfilerConfig.h>
-#include <piprofiler/ProfilerVersion.h>
-#include <piprofiler/SamplerPluginInterface.h>
-
-#include "SamplerPluginLoader.h"
-
-/*
- *	Forward declarations
- */
-class TBapBuf;
-class CProfilerSampleStream;
-class CSamplerPluginLoader;
-class CSamplerPluginInterface;
-class MSamplerControllerObserver;
-/**
- * The sampler controller for handling the actual sampler plugins.
- */
-
-class CSamplerController : public CBase, MSamplerPluginLoadObserver
-	{
-	
-public:
-	static CSamplerController* NewL(CProfilerSampleStream& aStream);
-	void ConstructL();
-	
-	CSamplerController(CProfilerSampleStream& aStream);
-	~CSamplerController();
-	
-	/** 
-	 * 
-	 * Methods for user mode sampling
-	 * 
-	 **/
-	
-	/** Initialise the user mode samplers **/					
-	void InitialiseSamplerListL();
-		 
-	/* Overrider of MSamplerPluginLoaderObserver class **/
-	void HandlePluginLoaded( KSamplerPluginLoaderStatus aStatus );
-	
-	/* returns the name matching plugin Uid */
-	TUid GetPluginUID(TDesC8& name);
-
-	/** Start enabled samplers **/				
-	void StartSamplerPluginsL();
-
-	/** Stop enabled samplers **/				
-	TInt StopSamplerPlugins();
-
-public:
-
-	CSamplerPluginInterface* GetPlugin(TUid aUid);
-
-	TInt GetPluginList(TDes* aList);
-	
-    TInt SetSamplerSettingsL(TInt aUid, TSamplerAttributes aAttributes);
-
-    void GetSamplerAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes);
-	
-	TInt UpdateSavedSamplerAttributesL(CDesC8ArrayFlat* aSavedLineArray, CArrayFixFlat<TSamplerAttributes>* aAttributes);
-	
-	/*
-	 * Compose all sampler (sampler or sub-sampler) attributes as text array for saving to settings file, 
-	 * called by CSamplerController (and Profiler Engine) 
-	 * 
-	 * @param aFile settings file where to write the settings 
-	 */
-	void ComposeAttributesToSettingsFileFormat(RFile& aFile, CArrayFixFlat<TSamplerAttributes>* aAttributes);
-	
-	/*
-	 * Compose all sampler (sampler or sub-sampler) attributes as text array for saving to settings file, 
-	 * called by CSamplerController (and Profiler Engine) 
-	 * 
-     * @param aFile settings file where to write the settings 
-	 * @param aAttrArray is container for saving the text to 
-	 */
-	void ComposeSettingsText(RFile& aFile, CArrayFixFlat<TSamplerAttributes>* aAttrArray);
-	
-	void SetObserver(MSamplerControllerObserver* aObserver);
-	
-	void     Str2Bool(const TDesC8& aBuf, TBool& aValue);
-    
-    void     Str2Int(const TDesC8& aBuf, TInt& aValue);
-    
-    void     Str2Int(const TDesC8& aBuf, TUint32& aValue);
-    
-    TBuf8<16> Bool2Str(const TBool& aValue);
-    
-    TBuf8<16> Int2Str(const TInt& aValue);
-public:
-
-    CArrayPtrFlat<CSamplerPluginInterface>* iPluginArray;
-    
-    // Asynchronous loader for the sampler plug-ins.
-    CSamplerPluginLoader*     iPluginLoader;
-    
-    // UID of the selected plugin in the container's lbx.
-    TUid                      iSelectedPluginUid;
-    
-    // shared sample stream for all plugin samplers
-    CProfilerSampleStream&    iStream;
-
-private:
-	MSamplerControllerObserver* iObserver;
-};
-
-/**
-* Interface for SamplerPluginLoader observer. MSamplerPluginLoadObserver gets
-* notifications when plugins are loaded.
-*
-* @lib ProfilerEngine.exe/.lib
-* @since Series60_30.1
-*/
-
-class MSamplerControllerObserver
-    {
-    public: // New
-
-        //CSamplerController calls this function when each plug-in is loaded or
-        //loading is finished..
-        
-        virtual void HandleSamplerControllerReadyL() = 0;
-        virtual void HandleError(TInt aError) = 0;
-    };
-    
-#endif	// __SAMPLERCONTROLLER_H__
--- a/piprofiler/engine/inc/SamplerPluginLoader.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,291 +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  SAMPLERPLUGINLOADER_H
-#define  SAMPLERPLUGINLOADER_H
-
-// INCLUDES
-#include    <e32base.h>
-#include    <ecom/implementationinformation.h>
-#include 	<piprofiler/ProfilerConfig.h>
-#include 	<piprofiler/SamplerPluginInterface.h>
-
-// CONSTANTS
-// Value for a to b comparison result when logically a == b.
-const TInt KSamplerComparisonEqual     = 0;
-
-// Value for a to b comparison result when logically a < b.
-const TInt KSamplerComparisonBefore    = -1;
-
-// Value for a to b comparison result when logically a > b.
-const TInt KSamplerComparisonAfter     = 1;
-
-// CLASS DEFINITIONS
-class CSamplerPluginInterface;
-class MSamplerPluginLoadObserver;
-class REComSession;
-
-/**
-* CSamplerPluginLoader. Mechanism used to load plugins asynchronously. Uses
-* MSamplerPluginLoadObserver as a callback.
-*
-* @lib ProfilerEngine.exe/.lib???????????
-* @since Series60_30.1
-*/
-class CSamplerPluginLoader : public CActive
-    {
-    public:  // Constructor and destructor
-
-        /**
-        * Two-phased constructor.
-        *
-        * @param aAppUi Pointer to application UI. Does not take ownership.
-        */
-        static CSamplerPluginLoader* NewL();
-
-        /**
-        * Destructor
-        */
-        ~CSamplerPluginLoader();
-
-    private: // Internal construction
-
-        /**
-        * Default C++ contructor
-        */
-        CSamplerPluginLoader();
-
-        /**
-        * Symbian OS default constructor
-        * @return void
-        */
-        void ConstructL();
-
-    public: // API
-
-        /**
-        * Starts loading GS plug-ins asynchronously. Will call
-        * MSamplerPluginLoadObserver::HandlePluginLoaded() each time a plug-in is
-        * loaded and when all plugins are loaded.
-        *
-        * CSamplerPluginLoader transfers the ownership of each loaded plugin view to
-        * CAknViewAppUi. It is client's responsibility to remove the views from
-        * CAknViewAppUi and delete the plugins if necessary.
-        *
-        * @param aInterfaceUid Uid ofthe interfaces to be loaded.
-        * @param aParentUid Uid of the parent. Only children of this parent
-        *        will be loaded.
-        * @param aPluginArray An array for the loaded GS plug-ins.
-        *        CSamplerPluginLoader does not take the ownership of this array.
-        */
-        void LoadAsyncL( CArrayPtrFlat<CSamplerPluginInterface>* aPluginArray );
-
-        /**
-        * Load a specific plugin instance synchronously.
-        *
-        * @param aInterfaceUid Uid ofthe interfaces to be loaded.
-        * @param aImplementationUid Uid of the implementation to load
-        */
-        void LoadSyncL( CArrayPtrFlat<CSamplerPluginInterface>* aPluginArray );
-
-        /**
-        * Sets observer for this loader. Only one observer per loader in one
-        * time is possible.
-        */
-        void SetObserver(MSamplerPluginLoadObserver* aObserver);
-
-        /**
-        * Aborts asynchronous loading of the GS plug-ins.
-        */
-        void AbortAsyncLoad();
-
-
-        /**
-        * Sorts the plugin array.
-        *
-        * Sorting criterias:
-        *
-        * 1. Order number if provider category is Internal.
-        * 2. Provider category. Precedence as follows:
-        *       1. KGSPluginProviderInternal
-        *       2. EGSPluginProviderOEM
-        *       3. EGSPluginProviderOperator
-        *       4. EGSPluginProvider3rdParty
-        * 3. Alphabetical
-        *
-        * @param aPlugins The array which will be sorted.
-        */
-        void SortPluginsL( CArrayPtrFlat<CSamplerPluginInterface>* aPlugins );
-
-    private: // Internal methods
-
-        /**
-        * Starts loading next plugin.
-        */
-        void LoadNextPluginL();
-
-        /**
-        * Creates a plugin instance from given UID. Ownership is transferred.
-        */
-        CSamplerPluginInterface& CreatePluginInstanceL( 
-                const CImplementationInformation& aImpInfo );
-
-        /**
-        * Notifies MPluginLoadObserver.
-        */
-        void NotifyProgress();
-
-        /**
-        * Notifies MPluginLoadObserver.
-        */
-        void NotifyFinished();
-
-        /**
-        * Wait for the next round of CActive execution.
-        */
-        void CompleteOwnRequest();
-
-        // Insertion function used by sorting:
-
-        /**
-        * Inserts plugin in the correct position in the array using sorting 
-        * criterias. Assumes aPlugins is ordered.
-        *
-        * @param aPlugin The plugin to be inserted.
-        * @param aPlugins Array in which the plugin is inserted into the
-        *        corresponding location.
-        */
-        void InsertPluginInOrderL(
-            CSamplerPluginInterface* aPlugin,
-            CArrayPtrFlat<CSamplerPluginInterface>* aPlugins );
-
-        // Comparison functions:
-
-        /**
-        * Compares plugins according to comparison criterias.
-        * 
-        * Note: GS internal comparison constants such as KGSComparisonEqual are 
-        * different from the ones outputted by this function. This is because 
-        * this function is also usable by RArray sort -functionality but BC 
-        * cannot be broken in GS.
-        * 
-        * @return Negative value: If aFirst before aSecond.
-        *                      0: If equal.
-        *         Positive value: If aSecond before aFirst.
-        */
-        static TInt Compare( const CSamplerPluginInterface& aFirst,    
-                             const CSamplerPluginInterface& aSecond );
-
-        /**
-        *
-        * @return   KGSComparisonEqual  = equal indexes
-        *           KGSComparisonBefore = aFirst is before aSecond
-        *           KGSComparisonAfter  = aFirst is after aSecond
-        */
-
-        static TInt CompareIndex( 
-                const CSamplerPluginInterface& aFirst,
-                const CSamplerPluginInterface& aSecond );
-
-    private: // Utility methods
-
-        /**
-        * Parses descriptor to UID.
-        */
-        static TInt ParseToUid( const TDesC8& aSource, TUid& aTarget );
-
-        /**
-        * Parsers plugin's order number
-        */
-        static TInt ParseOrderNumber( const TDesC8& aSource, TInt& aOrderNumber );
-
-    private: // From CActive
-
-        /**
-        * See base class.
-        */
-        void RunL();
-
-        /**
-        * See base class.
-        */
-        TInt RunError( TInt aError );
-
-        /**
-        * See base class.
-        */
-        void DoCancel();
-
-    private: // Data
-        // Pluginloader goes through this array and loads the plugins into
-        // iPluginArray if they fulfill the criterias.
-        RImplInfoPtrArray iImplInfoArray;
-
-        // Used as an iterator to maintain location in iImplInfoArray.
-        TInt iImplInfoArrayIterator;
-
-        // Array of loaded plugins.Plugins are owned by iAppUi. Only the array
-        // pointers are owned by this class and therefore only reset array.
-        CArrayPtrFlat<CSamplerPluginInterface>* iPluginArray;
-
-        // Pointer to observer. Not owned.
-        MSamplerPluginLoadObserver* iObserver;
-
-        // Number of RunL calls.
-        TInt iRunLDebugCount;
-
-    };
-
-
-/**
-* Interface for SamplerPluginLoader observer. MSamplerPluginLoadObserver gets
-* notifications when plugins are loaded.
-*
-* @lib ProfilerEngine.exe/.lib???????????
-* @since Series60_30.1
-*/
-
-class MSamplerPluginLoadObserver
-    {
-    public: // Enums
-        enum KSamplerPluginLoaderStatus
-            {
-            // One plugin loaded successfully, continue to next.
-            ESamplerSuccess,
-            // Loading one plugin failed, contiue to next.
-            ESamplerFail,
-            // Client called AbortAsyncLoad(), finished loading.
-            ESamplerAborted,
-            // All plugins loaded successfully, finished loading.
-            ESamplerFinished,
-            // Severe error with loader, finished loading.
-            ESamplerError
-            };
-
-    public: // New
-
-        //CSamplerPluginLoader calls this function when each plug-in is loaded or
-        //loading is finished..
-        
-        IMPORT_C virtual void HandlePluginLoaded(
-            KSamplerPluginLoaderStatus aStatus ) = 0;
-    };
-
-
-#endif // SAMPLERPLUGINLOADER_H
-// End of File
--- a/piprofiler/engine/inc/WriterController.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +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 __WRITERCONTROLLER_H__
-#define __WRITERCONTROLLER_H__
-
-// system includes
-#include <utf.h>
-#include <e32cmn.h>
-
-
-// The user-interface to the sampling device driver sued by the profiling engine
-// user includes
-#include <piprofiler/ProfilerConfig.h>
-#include <piprofiler/ProfilerVersion.h>
-#include <piprofiler/WriterPluginInterface.h>
-
-#include "WriterPluginLoader.h"
-
-/*
- *	Forward declarations
- */
-class TBapBuf;
-class CWriterPluginLoader;
-class CWriterPluginInterface;
-
-/**
- * The writer controller for handling the available Data writer plugins.
- */
-  
-class CWriterController : public CBase, MWriterPluginLoadObserver
-	{
-	
-public:
-	static CWriterController* NewL(CProfilerSampleStream& aStream);
-	void ConstructL();
-	
-	CWriterController(CProfilerSampleStream& aStream);
-    ~CWriterController();
-	
-	/** 
-	 * 
-	 * Methods for user mode sampling
-	 * 
-	 **/
-	
-	/** Initialise the user mode samplers **/					
-	void InitialiseWriterListL();
-	
-	/* Overrider of MSamplerPluginLoaderObserver class **/
-	void HandlePluginLoaded( KWriterPluginLoaderStatus /*aStatus*/ );
-	
-	/* returns the matching plugin Uid */
-	TUid GetPluginUID(TInt traceId);
-	
-	CWriterPluginInterface* GetActiveWriter();
-	
-	 /** Returns the sampler type (kernel/user) **/
-	TUint32 GetWriterType(TUint32 samplerId);
-
-	/** Set additional settings for a trace **/			
-	TInt AdditionalUserTraceSettings(TInt traceId, TInt settings);
-
-	/** Set data stream for samplers **/
-	//void SetSampleStream(RProfilerSampleStream* iStream);
-
-	TInt StartSelectedPlugin();
-
-	void StopSelectedPlugin();
-
-	/** Set selected plugin active **/
-	void SetPluginActive(TUid uid, const TWriterPluginValueKeys aKey);
-
-	TInt SetPluginSettings(TUid aUid, TDes& aDes);
-	
-	/** Get settings for a specific plugin **/
-	void GetPluginSettings(TUid uid, TDes& aVal);
-	
-	/** Request stream read **/
-	//void FillThisStreamBuffer(TBapBuf* aBuffer, TRequestStatus& aStatus);
-	
-	CWriterPluginInterface* GetPlugin(TUid aUid);
-	
-	CArrayPtrFlat<CWriterPluginInterface>* GetPluginList();
-	
-	void InitialisePluginStream();
-public:
-    CArrayPtrFlat<CWriterPluginInterface>* iPluginArray;
-    
-    // Asynchronous loader for the writer plug-ins.
-    CWriterPluginLoader* iPluginLoader;
-    
-    // UID of the selected plugin in the container's lbx.
-    TUid iSelectedPluginUid;
-    
-    CProfilerSampleStream& iStream;
-};
-
-	
-#endif	// __WRITERCONTROLLER_H__
--- a/piprofiler/engine/inc/WriterPluginLoader.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,302 +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  WRITERPLUGINLOADER_H
-#define  WRITERPLUGINLOADER_H
-
-// INCLUDES
-#include    <e32base.h>
-#include    <ecom/implementationinformation.h>
-#include 	<piprofiler/ProfilerConfig.h>
-#include 	<piprofiler/WriterPluginInterface.h>
-#include    <piprofiler/ProfilerTraces.h>
-
-// CONSTANTS
-
-// Value for a to b comparison result when logically a == b.
-const TInt KWriterComparisonEqual     = 0;
-
-// Value for a to b comparison result when logically a < b.
-const TInt KWriterComparisonBefore    = -1;
-
-// Value for a to b comparison result when logically a > b.
-const TInt KWriterComparisonAfter     = 1;
-
-// CLASS DEFINITIONS
-class CWriterPluginInterface;
-class MWriterPluginLoadObserver;
-class REComSession;
-
-/**
-* CWriterPluginLoader. Mechanism used to load plugins asynchronously. Uses
-* MWriterPluginLoadObserver as a callback.
-*
-* @lib ProfilerEngine.exe/.lib???????????
-* @since Series60_30.1
-*/
-class CWriterPluginLoader : public CActive
-    {
-    public:  // Constructor and destructor
-
-        /**
-        * Two-phased constructor.
-        *
-        * @param aAppUi Pointer to application UI. Does not take ownership.
-        */
-        static CWriterPluginLoader* NewL();
-
-        /**
-        * Destructor
-        */
-        ~CWriterPluginLoader();
-
-    private: // Internal construction
-
-        /**
-        * Default C++ contructor
-        */
-        CWriterPluginLoader();
-
-        /**
-        * Symbian OS default constructor
-        * @return void
-        */
-        void ConstructL();
-
-    public: // API
-
-        /**
-        * Starts loading GS plug-ins asynchronously. Will call
-        * MWriterPluginLoadObserver::HandlePluginLoaded() each time a plug-in is
-        * loaded and when all plugins are loaded.
-        *
-        * CWriterPluginLoader transfers the ownership of each loaded plugin view to
-        * CAknViewAppUi. It is client's responsibility to remove the views from
-        * CAknViewAppUi and delete the plugins if necessary.
-        *
-        * @param aInterfaceUid Uid ofthe interfaces to be loaded.
-        * @param aParentUid Uid of the parent. Only children of this parent
-        *        will be loaded.
-        * @param aPluginArray An array for the loaded GS plug-ins.
-        *        CWriterPluginLoader does not take the ownership of this array.
-        */
-        void LoadAsyncL( CArrayPtrFlat<CWriterPluginInterface>* aPluginArray );
-
-        /**
-        * Load a specific plugin instance synchronously.
-        *
-        * @param aInterfaceUid Uid ofthe interfaces to be loaded.
-        * @param aImplementationUid Uid of the implementation to load
-        */
-        CWriterPluginInterface& LoadSyncL( TUid aImplementationUid );
-
-        /**
-        * Sets observer for this loader. Only one observer per loader in one
-        * time is possible.
-        */
-        void SetObserver(MWriterPluginLoadObserver* aObserver);
-
-        /**
-        * Aborts asynchronous loading of the GS plug-ins.
-        */
-        void AbortAsyncLoad();
-
-        /**
-        * Sorts the plugin array.
-        *
-        * Sorting criterias:
-        *
-        * 1. Order number if provider category is Internal.
-        * 2. Provider category. Precedence as follows:
-        * 3. Alphabetical
-        *
-        * @param aPlugins The array which will be sorted.
-        */
-        void SortPluginsL( CArrayPtrFlat<CWriterPluginInterface>* aPlugins );
-
-    private: // Internal methods
-
-        /**
-        * Starts loading next plugin.
-        */
-        void LoadNextPluginL();
-
-        /**
-        * Creates a plugin instance from given UID. Ownership is transferred.
-        */
-        CWriterPluginInterface& CreatePluginInstanceL( 
-                const CImplementationInformation& aImpInfo );
-
-        /**
-        * Notifies MGSPluginLoadObserver.
-        */
-        void NotifyProgress();
-
-        /**
-        * Notifies MGSPluginLoadObserver.
-        */
-        void NotifyFinished();
-
-        /**
-        * Wait for the next round of CActive execution.
-        */
-        void CompleteOwnRequest();
-
-        // Insertion function used by sorting:
-
-        /**
-        * Inserts plugin in the correct position in the array using sorting 
-        * criterias. Assumes aPlugins is ordered.
-        *
-        * @param aPlugin The plugin to be inserted.
-        * @param aPlugins Array in which the plugin is inserted into the
-        *        corresponding location.
-        */
-        void InsertPluginInOrderL(
-        		CWriterPluginInterface* aPlugin,
-            CArrayPtrFlat<CWriterPluginInterface>* aPlugins );
-
-        // Comparison functions:
-
-        /**
-        * Compares plugins according to comparison criterias.
-        * 
-        * Note: GS internal comparison constants such as KGSComparisonEqual are 
-        * different from the ones outputted by this function. This is because 
-        * this function is also usable by RArray sort -functionality but BC 
-        * cannot be broken in GS.
-        * 
-        * @return Negative value: If aFirst before aSecond.
-        *                      0: If equal.
-        *         Positive value: If aSecond before aFirst.
-        */
-        static TInt Compare( const CWriterPluginInterface& aFirst,    
-                             const CWriterPluginInterface& aSecond );
-
-        /**
-        *
-        * @return   KGSComparisonEqual  = equal indexes
-        *           KGSComparisonBefore = aFirst is before aSecond
-        *           KGSComparisonAfter  = aFirst is after aSecond
-        */
-
-        static TInt CompareIndex( 
-                const CWriterPluginInterface& aFirst,
-                const CWriterPluginInterface& aSecond );
-
-    private: // Utility methods
-
-        /**
-        * Parses descriptor to UID.
-        */
-        static TInt ParseToUid( const TDesC8& aSource, TUid& aTarget );
-
-        /**
-        * Parsers plugin's order number
-        */
-        static TInt ParseOrderNumber( const TDesC8& aSource, TInt& aOrderNumber );
-
-        /**
-        * Print debug information.
-        */
-        static void PrintInfoDebug( const CImplementationInformation& aInfo,
-                                    TInt aIterator,
-                                    TInt aPluginCount );
-        
-        /**
-         * Display loading error popup message.
-         */
-        void DisplayErrorPopupL( TInt aError, 
-                                 const CImplementationInformation* aInfo );
-        
-    private: // From CActive
-
-        /**
-        * See base class.
-        */
-        void RunL();
-
-        /**
-        * See base class.
-        */
-        TInt RunError( TInt aError );
-
-        /**
-        * See base class.
-        */
-        void DoCancel();
-
-    private: // Data
-
-
-        // Pluginloader goes through this array and loads the plugins into
-        // iPluginArray if they fulfill the criterias.
-        RImplInfoPtrArray iImplInfoArray;
-
-        // Used as an iterator to maintain location in iImplInfoArray.
-        TInt iImplInfoArrayIterator;
-
-        // Array of loaded plugins.Plugins are owned by iAppUi. Only the array
-        // pointers are owned by this class and therefore only reset array.
-        CArrayPtrFlat<CWriterPluginInterface>* iPluginArray;
-
-        // Pointer to observer. Not owned.
-        MWriterPluginLoadObserver* iObserver;
-
-        // Number of RunL calls.
-        TInt iRunLDebugCount;
-    };
-
-
-/**
-* Interface for WriterPluginLoader observer. MWriterPluginLoadObserver gets
-* notifications when plugins are loaded.
-*
-* @lib ProfilerEngine.exe/.lib???????????
-* @since Series60_30.1
-*/
-
-class MWriterPluginLoadObserver
-    {
-    public: // Enums
-        enum KWriterPluginLoaderStatus
-            {
-            // One plugin loaded successfully, continue to next.
-            EWriterSuccess,
-            // Loading one plugin failed, contiue to next.
-            EWriterFail,
-            // Client called AbortAsyncLoad(), finished loading.
-            EWriterAborted,
-            // All plugins loaded successfully, finished loading.
-            EWriterFinished,
-            // Severe error with loader, finished loading.
-            EWriterError
-            };
-
-    public: // New
-
-        //CWriterPluginLoader calls this function when each plug-in is loaded or
-        //loading is finished..
-        
-        IMPORT_C virtual void HandlePluginLoaded(
-            KWriterPluginLoaderStatus aStatus ) = 0;
-    };
-
-
-#endif // WRITERPLUGINLOADER_H
-// End of File
--- a/piprofiler/engine/src/ProfilerEngine.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1515 +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 <e32cons.h>
-#include <e32base.h>
-#include <f32file.h>
-#include <c32comm.h>
-#include <s32file.h>
-#include <pathinfo.h>
-#include <s32mem.h>
-#include <bautils.h>
-#include <sysutil.h>
-#include <piprofiler/ProfilerConfig.h>
-#include "ProfilerEngine.h"
-#include <piprofiler/ProfilerTraces.h>
-
-// properties
-const TUid KEngineStatusPropertyCat={0x2001E5AD};
-enum TEnginePropertyKeys
-	{
-	EProfilerEngineStatus = 8,
-	EProfilerErrorStatus
-	};
-
-static _LIT_SECURITY_POLICY_PASS( KAllowAllPolicy );
-
-// CONSTANTS 
-const TInt KStreamBufferSize = 32768;
-const TInt KSavedLineCount = 64;
-const TInt KFileNameBufSize = 128;
-// Use this UID if plugin belongs to DebOutWriterPlugin:
-const TUid KDebOutWriterPluginUid = { 0x2001E5BA };
-// Use this UID if plugin belongs to MmcOutWriterPlugin:
-const TUid KDiskWriterPluginUid = { 0x2001E5BB };
-
-// LITERALS
-_LIT8(KGenericTraceOutput, "output_type");
-_LIT8(KGenericTraceFilePrefix, "file_prefix");
-_LIT8(KGenericTraceFileSaveDrive, "save_file_location");
-_LIT8(KGenericTimedProfilingPeriod, "profiling_period");
-_LIT8(KEquals, "=");
-_LIT8(KNewLineSeparator, "\n");
-_LIT8(KProfilerVersionTag, "version");
-_LIT8(KEndMark, "[end]");
-_LIT8(KOutputToDebugOutput, "debug_output");
-
-/** 
- * 
- * The controller class used to provide the Profiler functions. 
- * This runs as a server in the engine thread
- * 
- */
-class CPServer : public CServer2, public MProfilerController
-    {
-public:
-    static MProfilerController*		NewL(TInt aPriority, MProfilerEngine& aEngine);
-
-private:
-                        CPServer(TInt aPriority, MProfilerEngine& aEngine);
-    void				Release();
-    CSession2*			NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
-    
-public:
-    static TInt         iClientCount;
-    };
-
-TInt CPServer::iClientCount = 0;
-
-// The session class used by the server controller
-class CPSession : public CSession2
-    {
-private:
-    inline const CPServer&	Server() const;
-    void					ServiceL(const RMessage2& aMessage);
-    };
-
-/*
- *
- *	CProfiler class implementation
- *
- */
-// --------------------------------------------------------------------------------------------
-CProfiler* CProfiler::NewLC(const TDesC& aSettingsFile)
-    {
-	CProfiler* self = new(ELeave) CProfiler(aSettingsFile);
-	CleanupStack::PushL(self);
-	self->ConstructL();
-	return self;
-    }
-
-// --------------------------------------------------------------------------------------------
-CProfiler::CProfiler(const TDesC& aSettingsFile) : 
-    iSettingsFileLocation(aSettingsFile)
-	{
-	// define property for Profiler Engine status, UI may read it for control purposes
-	if ( RProperty::Define(KEngineStatusPropertyCat, 
-	        EProfilerEngineStatus, 
-	        RProperty::EInt, 
-	        KAllowAllPolicy, 
-	        KAllowAllPolicy, 
-	        0) != KErrAlreadyExists )
-	    {
-	    LOGTEXT(_L("CProfiler::CProfiler - status property already defined"));
-	    }
-
-	if ( RProperty::Define(KEngineStatusPropertyCat, 
-	        EProfilerErrorStatus, 
-            RProperty::EInt, 
-            KAllowAllPolicy, 
-            KAllowAllPolicy, 
-            0) != KErrAlreadyExists )
-        {
-        LOGTEXT(_L("CProfiler::CProfiler - status property already defined"));
-        }
-
-	// attach to own property
-	iEngineStatus.Attach(KEngineStatusPropertyCat, EProfilerEngineStatus);
-	// set status idle
-	iEngineStatus.Set(KEngineStatusPropertyCat, EProfilerEngineStatus, RProfiler::EIdle);
-	
-    // attach to own property
-    iUpdateStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus);
-    // set status idle
-    iUpdateStatus.Set(KEngineStatusPropertyCat, EProfilerErrorStatus, EFalse);
-	}
-
-// --------------------------------------------------------------------------------------------
-CProfiler::~CProfiler()
-    {
-	LOGTEXT(_L("CProfiler::~CProfiler - Enter"));
-
-	// delete error checker
-    if(iErrorChecker)
-        {
-        iErrorChecker->Cancel();
-        delete iErrorChecker;
-        iErrorChecker = NULL;
-        }
-	
-	// delete settings array
-	if(iDefaultSamplerAttributesArray)
-	    {
-	    iDefaultSamplerAttributesArray->Reset();
-	    delete iDefaultSamplerAttributesArray;
-	    iDefaultSamplerAttributesArray = NULL;
-	    }
-
-    // delete settings file raw line array
-    if(iSavedLineArray)
-        {
-        iSavedLineArray->Reset();
-        delete iSavedLineArray;
-        iSavedLineArray = NULL;
-        }
-		
-	// delete sampler controller, cleans up the sampler plugin instances
-	if(iSamplerHandler)
-		{
-		delete iSamplerHandler;
-		iSamplerHandler = NULL;
-		}
-	// delete writer controller, cleans up the writer plugin instances
-	if(iWriterHandler)
-		{
-		delete iWriterHandler;
-		iWriterHandler = NULL;
-		}
-
-    // delete user side sampler stream 
-	if(iUserStream)
-		{
-		delete iUserStream;
-		iUserStream = NULL;
-		}
-
-	// close engine status property
-	iEngineStatus.Close();
-	if (RProperty::Delete(KEngineStatusPropertyCat, EProfilerEngineStatus) != KErrNotFound)
-	    {
-	    LOGTEXT(_L("CProfiler::~CProfiler - cannot close status property"));
-	    }
-    // close engine update property
-    iUpdateStatus.Close();
-    if (RProperty::Delete(KEngineStatusPropertyCat, EProfilerErrorStatus) != KErrNotFound)
-        {
-        LOGTEXT(_L("CProfiler::~CProfiler - cannot close update property"));
-        }
-    
-    // close server process
-    if (iServer)
-        {
-        LOGTEXT(_L("CProfiler::~CProfiler - Releasing server"));
-        iServer->Release();        
-        }
-    
-    if( iTimer )
-        {
-        iTimer->Cancel();
-        delete iTimer;
-        iTimer = 0;
-        }
-    
-	LOGTEXT(_L("CProfiler::~CProfiler - Finished"));
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfiler::ConstructL()
-    {
-	LOGTEXT(_L("CProfiler::ConstructL - Enter"));
-	TInt err(0);
-	TLex lex;
-	
-	if ( iSettingsFileLocation.CompareF(KNullDesC) != 0 )
-	    {
-        lex=(iSettingsFileLocation);
-        // parse the first command line argument, the command itself
-        lex.Mark();
-        lex.SkipCharacters();
-        if(lex.TokenLength() != 0)
-            {
-            // there is another item in the list
-            TPtrC filename = lex.MarkedToken();
-            LOGSTRING2("filename %S", &filename);
-            lex.SkipSpace();
-            lex.Mark();
-            lex.SkipCharacters();
-            if(lex.TokenLength() != 0)
-                {
-                TPtrC boot = lex.MarkedToken();
-                LOGTEXT(_L("boot mode"));
-                }
-            }
-	    }
-	
-    // create new sampler stream instance
-    iUserStream = CProfilerSampleStream::NewL(KStreamBufferSize);
-    if(!iUserStream)
-        {
-        LOGTEXT(_L("Profiler engine cannot reserve memory"));
-        User::Leave(KErrCancel);   // operation cancelled
-        }
-	
-    // engine status checker
-    iErrorChecker = CProfilerErrorChecker::NewL();
-    iErrorChecker->SetObserver(this);
-
-	// create and initiate plug-in controller instances
-    iSamplerHandler = CSamplerController::NewL(*iUserStream);
-    iWriterHandler = CWriterController::NewL(*iUserStream);
-    
-    iWriterHandler->InitialiseWriterListL();
-    
-    // set engine as an observer to sampler controller to get the notification of plugin load has ended
-    iSamplerHandler->SetObserver(this);
-    
-    // default settings from sampler plugins, maximum 20 sampler plugins
-    iDefaultSamplerAttributesArray = new(ELeave) CArrayFixFlat<TSamplerAttributes>(20); 
-    
-    // set profiler status to initializing
-    iState = RProfiler::EInitializing;
-	iEngineStatus.Set(RProfiler::EInitializing);
-	
-	// set default general settings, will be overdriven if changed in settings file
-	iGeneralAttributes.iTraceOutput.Copy(KDefaultTraceOutput);
-	iGeneralAttributes.iTraceFilePrefix.Copy(KDefaultTraceFilePrefix);
-	iGeneralAttributes.iSaveFileDrive.Copy(KDefaultTraceFileSaveDrive);
-	iGeneralAttributes.iTimedSamplingPeriod = KDefaultTimedSamplingPeriod;
-	
-	RThread me;
-	
-	me.SetPriority(EPriorityRealTime);
-
-	err = KErrGeneral;
-	TInt count = 0;
-
-	while(err != KErrNone && count < 30)
-	    {
-		err = User::RenameThread(KProfilerName);
-		if(err != KErrNone)
-		    {
-		    LOGSTRING2("CProfiler: error renaming the thread, err %d", err);
-			User::Leave(err);
-		    }
-		else break;
-	    }
-
-	// set settings file loading preferences
-	iSettingsFileLoaded = EFalse;
-
-	// change status property to idle since initialization successfull
-	iState = RProfiler::EIdle;
-	if( iEngineStatus.Set((TInt)RProfiler::EIdle) != KErrNone )
-	    {
-	    LOGTEXT(_L("CProfiler::ConstructL - engine status property change failed"));
-	    }
-
-    if( iUpdateStatus.Set(EFalse) != KErrNone )
-        {
-        LOGTEXT(_L("CProfiler::ConstructL - engine status property change failed"));
-        }
-
-	// create a server instance for clients to communicate with 
-	iServer = CPServer::NewL(10,*this);
-	
-	// close the handle 
-	me.Close();
-	
-	iTimer = CProfilerTimer::NewL(CActive::EPriorityStandard, *this);
-	
-	LOGTEXT(_L("CProfiler::ConstructL - Exit"));
-	
-    }
-
-CProfilerSampleStream* CProfiler::GetSamplerStream()
-    {
-    return iUserStream;
-    }
-
-void CProfiler::HandleSamplerControllerReadyL()
-    {
-    // load settings
-    // check if settings file already loaded
-    if(!iSettingsFileLoaded)
-        {
-        // load default settings file
-        LoadSettingsL();
-
-        iSettingsFileLoaded = ETrue;
-        }
-    
-    // notify engine's launcher(UI or PIProfilerLauncher) to continue launch
-    RProcess::Rendezvous(KErrNone); 
-    }
-
-void CProfiler::NotifyRequesterForSettingsUpdate()
-    {
-    // set update status P&S property true => update needed on UI side
-    iUpdateStatus.Set(ETrue);
-    }
-
-void CProfiler::HandleProfilerErrorChangeL(TInt aError)
-    {
-    LOGSTRING2("CProfiler::HandleProfilerErrorChangeL() - error received, %d", aError);
-    
-    // check if profiler running
-    if(iState == RProfiler::ERunning)
-        {
-        // stop profiler if error occurred during the trace
-        iEngineStatus.Set(aError);
-        
-        // stop samplers, NOTE! Writer plugins not stopped since 
-        iSamplerHandler->StopSamplerPlugins();
-
-        // stop debug output plugin and write the rest of the trace data to output
-        if(iGeneralAttributes.iTraceOutput.CompareF(KOutputToDebugOutput) == 0)   
-            {
-            // write the rest of trace data only if debug output selected
-            iWriterHandler->StopSelectedPlugin();
-            }
-        LOGSTRING2("CProfiler::HandleProfilerErrorChangeL - sampling stopped, going to state %d", RProfiler::EIdle);
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// Gets a value from settings file for certain attribute.
-// ----------------------------------------------------------------------------
-void CProfiler::DoGetValueFromSettingsArray(CDesC8ArrayFlat* aLineArray, const TDesC8& aAttribute, TDes8& aValue)
-    {
-    LOGTEXT(_L("CProfiler::DoGetValueFromSettingsFile()"));
-    _LIT8(KSettingItemSeparator, "=");
-    
-    // read a line of given array
-    for (TInt i=0; i<aLineArray->MdcaCount(); i++)
-        {
-        // check if this line has a separator
-        TInt sepPos = aLineArray->MdcaPoint(i).Find(KSettingItemSeparator);
-        if (sepPos > 0)
-            {
-            // check that the element matches
-            if (aLineArray->MdcaPoint(i).Left(sepPos).CompareF(aAttribute) == 0)
-                {
-                // get the value
-                aValue.Copy(aLineArray->MdcaPoint(i).Right(aLineArray->MdcaPoint(i).Length()-sepPos-1));
-                break;
-                }
-            }
-        }
-    }
-
-void CProfiler::DoGetValueFromSettingsArray(CDesC8ArrayFlat* aLineArray, const TDesC8& aAttribute, TInt& aValue)
-    {
-    LOGTEXT(_L("CProfiler::DoGetValueFromSettingsFile()"));
-    _LIT8(KSettingItemSeparator, "=");
-    
-    // read a line of given array
-    for (TInt i=0; i<aLineArray->MdcaCount(); i++)
-        {
-        // check if this line has a separator
-        TInt sepPos = aLineArray->MdcaPoint(i).Find(KSettingItemSeparator);
-        if (sepPos > 0)
-            {
-            // check that the element matches
-            if (aLineArray->MdcaPoint(i).Left(sepPos).CompareF(aAttribute) == 0)
-                {
-                // get the value                
-                TLex8 parser(aLineArray->MdcaPoint(i).Right(aLineArray->MdcaPoint(i).Length()-sepPos-1));
-                parser.Val(aValue);
-                break;
-                }
-            }
-        }
-    }
-
-// --------------------------------------------------------------------------------------------
-TInt CProfiler::GetSamplerAttributesL(const RMessage2& aMessage)
-    {
-    TInt err(KErrNone);
-    TInt pos(0);
-
-    // get sampler count
-    TInt count(iDefaultSamplerAttributesArray->Count());
-
-    // write each of the default sampler plugin setting attributes over client-server session 
-    for (TInt i(0); i<count; ++i)
-       {
-       TSamplerAttributes attr = iDefaultSamplerAttributesArray->At(i);
-       TPckgC<TSamplerAttributes> attrPckg(attr);
-       
-       // write a TSamplerAttributes container at a time
-       aMessage.WriteL(0, attrPckg, pos);
-       pos += attrPckg.Length();
-       }
-
-    aMessage.Complete(err);
-    return err;
-    }
-
-// --------------------------------------------------------------------------------------------
-TInt CProfiler::SetSamplerAttributesL(const RMessage2& aMessage)
-    {
-    TSamplerAttributes attr;
-    TPckg<TSamplerAttributes> inAttr(attr);
-    
-    TInt err = aMessage.Read(0, inAttr, 0);    
-    
-    // apply the changes directly to a plugin
-    iSamplerHandler->SetSamplerSettingsL(attr.iUid, attr);
-    
-    aMessage.Complete(err);
-    return err;
-    }
-
-// --------------------------------------------------------------------------------------------
-TInt CProfiler::GetGeneralAttributesL(const RMessage2& aMessage)
-    {
-    TPckgBuf<TGeneralAttributes> generalSettings( iGeneralAttributes );
-    
-    // write general attributes over client-server session
-    TInt err = aMessage.Write(0, generalSettings);
-    
-    aMessage.Complete(err);
-    return err;
-    }
-
-// --------------------------------------------------------------------------------------------
-TInt CProfiler::SetGeneralAttributesL(const RMessage2& aMessage)
-    {
-    // read the general settings from message
-    TGeneralAttributes attr;
-    TPckg<TGeneralAttributes> inPckg(attr);
-    TInt err = aMessage.Read(0, inPckg, 0);
-    
-    // copy to the general attributes
-    iGeneralAttributes.iSaveFileDrive.Copy(attr.iSaveFileDrive);
-    iGeneralAttributes.iTraceFilePrefix.Copy(attr.iTraceFilePrefix);
-    iGeneralAttributes.iTraceOutput.Copy(attr.iTraceOutput);
-    iGeneralAttributes.iTimedSamplingPeriod = attr.iTimedSamplingPeriod;
-    
-    aMessage.Complete(err);
-    return err;
-    }
-
-TInt CProfiler::GetSamplerAttributeCountL(const RMessage2& aMessage)
-    {
-    // get the plugin array count and wrap it to TPckgBuf<>
-    TPckgBuf<TInt> attributeCount(iDefaultSamplerAttributesArray->Count());
-    
-    // write general attributes over client-server session
-    TInt err = aMessage.Write(0, attributeCount);
-    
-    aMessage.Complete(err);
-    return err;
-    }
-
-TInt CProfiler::RefreshStatus(const RMessage2& aMessage)
-    {
-    TInt err(KErrNone);
-    
-    // update profiler status for requester
-    iEngineStatus.Set(iState);
-    
-    aMessage.Complete(err);
-    return err;
-    }
-
-// --------------------------------------------------------------------------------------------
-TInt CProfiler::LoadSettingsL(/*const TDesC& configFile*/)
-    {
-	RFs fileServer;
-	RFile file;
-	TInt err(KErrNone);
-    
-	// connect to file server 
-	err = fileServer.Connect();
-	
-	// check if file server can be connected
-	if (err != KErrNone)
-	    {
-		// file server couldn't be connected
-		return KErrGeneral;
-	    }
-
-	// check if settings file location length reasonable
-	if ( iSettingsFileLocation.CompareF(KNullDesC) == 0 )
-	    {
-		// open the file with the default path and name
-		TBuf<256> pathAndName;
-		pathAndName.Append(PathInfo::PhoneMemoryRootPath());
-		pathAndName.Append(KProfilerSettingsFileName);
-		iSettingsFileLocation.Copy(pathAndName);
-		LOGTEXT(_L("CProfiler::LoadSettings - Opening settings file with name (with the default path)"));
-		LOGTEXT(pathAndName);
-	    }
-
-    // open the file with the given path and name
-    err = file.Open(fileServer,iSettingsFileLocation,EFileRead);
-
-	
-	// check if RFile::Open() returned error
-	if (err != KErrNone)
-	    {
-		// file couldn't be opened
-		LOGTEXT(_L("CProfiler::LoadSettings - Failed to open settings, using default"));
-
-		// check if settings already loaded
-		if(iDefaultSamplerAttributesArray->Count() > 0)
-		    {
-		    // reset default settings array
-		    iDefaultSamplerAttributesArray->Reset();
-		    }
-		
-		// load default settings, instead of settings file ones
-		iSamplerHandler->GetSamplerAttributesL(iDefaultSamplerAttributesArray);
-		
-		fileServer.Close();
-		return KErrNone;
-	    }
-	
-	// initialize iSavedLineArray, initial settings file lines 64
-	if(iSavedLineArray)
-	    {
-        iSavedLineArray->Reset();
-	    }
-	else
-	    {
-        iSavedLineArray = new (ELeave) CDesC8ArrayFlat(KSavedLineCount);
-	    }
-	
-	iSavedLinesCount = KSavedLineCount;
-	
-    // get size of the file
-    TInt fileSize(0);
-    err = file.Size(fileSize);
-    // check if an error occurred reading the file size
-    if(err != KErrNone)
-        {
-        return KErrGeneral; // could not find the size
-        }
-        
-    // sanity check for the file size
-    if (fileSize < 3 || fileSize > 20000)
-        {
-        fileSize = KSettingsFileSize;
-        return KErrNotSupported;
-        }
-    
-	// read the contents of the file to buffer. 
-	iSettingsBuffer.Zero();
-	file.Read(iSettingsBuffer, fileSize);
-	file.Close();
-	fileServer.Close();
-	LOGSTRING2("CProfiler::LoadSettings: read %d bytes",iSettingsBuffer.Length());
-
-	// append end mark "[end]"
-    iSettingsBuffer.Append(KEndMark);
-	// force an ending newline
-	iSettingsBuffer.Append('\n');
-
-	// next fill the saved settings array (CDesC8ArrayFlat) for further comparison with changes and default values
-    TBuf8<384> tmpBuf;
-    TInt lineCount(0);
-    TBool commentFound(EFalse);
-    for (TInt i(0); i<iSettingsBuffer.Length(); i++)  // loop all chars
-        {
-        // if new line char found, create a new text line
-        if (iSettingsBuffer[i]=='\r' || iSettingsBuffer[i]=='\n')
-            {
-            // check if collected string has reasonable length
-            if (tmpBuf.Length() > 0)
-                {
-                // remove extra spaces
-                tmpBuf.TrimAll();
-                // check if the size of the array too small
-                if(lineCount >= iSavedLinesCount)
-                    {
-                    iSavedLineArray->ExpandL(20);   // expand by 20 lines
-                    iSavedLinesCount += 20;
-                    }
-                iSavedLineArray->AppendL(tmpBuf);
-                tmpBuf.Copy(KNullDesC8);
-                lineCount++;
-                }
-            commentFound = EFalse;
-            }
-        // check if comment mark ';' is found on the line, skip the rest of the line
-        else if(iSettingsBuffer[i]==';')
-            {
-            commentFound = ETrue;
-            }
-        // otherwise append a char to the temp line buffer if it is a wanted ASCII char
-        else if (iSettingsBuffer[i]>=32 && iSettingsBuffer[i]<=127 && !commentFound)
-            {
-            tmpBuf.Append(iSettingsBuffer[i]);
-            }
-        }
-    
-    // empty tmpBuf
-    tmpBuf.Copy(KNullDesC8);
-    // check settings file version
-    DoGetValueFromSettingsArray(iSavedLineArray, KProfilerVersionTag, tmpBuf); 
-
-    TBuf8<32> version;
-    version.Copy(PROFILER_VERSION_SHORT);
-    
-    // check if settings file version is 
-    if(tmpBuf.CompareF(version) >= 0)
-        {
-        // update general attributes
-        UpdateSavedGeneralAttributes(iSavedLineArray);
-        
-        // update settings to sampler plugins and save the attributes to default array
-        iSamplerHandler->UpdateSavedSamplerAttributesL(iSavedLineArray, iDefaultSamplerAttributesArray);
-        }
-    else
-        {
-        // check if settings already loaded
-        if(iDefaultSamplerAttributesArray)
-            {
-            // reset default settings array
-            iDefaultSamplerAttributesArray->Reset();
-
-			// get the default settings if settings file version too old
-			iSamplerHandler->GetSamplerAttributesL(iDefaultSamplerAttributesArray);
-			}
-        }
-    
-	return err; 
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfiler::UpdateSavedGeneralAttributes(CDesC8ArrayFlat* aSavedAttributes)
-    {
-    // get saved general settings
-    DoGetValueFromSettingsArray(aSavedAttributes, KGenericTraceOutput, iGeneralAttributes.iTraceOutput);
-    DoGetValueFromSettingsArray(aSavedAttributes, KGenericTraceFilePrefix, iGeneralAttributes.iTraceFilePrefix);
-    DoGetValueFromSettingsArray(aSavedAttributes, KGenericTraceFileSaveDrive, iGeneralAttributes.iSaveFileDrive);
-    DoGetValueFromSettingsArray(aSavedAttributes, KGenericTimedProfilingPeriod, iGeneralAttributes.iTimedSamplingPeriod);
-    }
-
-TBool CProfiler::CheckLocationSanity(RFs& fs, const TDesC8& aLocation)
-    {
-    TBool ret(EFalse);
-    TBool noDiskSpace(EFalse);
-    TBuf<32> drive;
-    
-    CnvUtfConverter::ConvertToUnicodeFromUtf8(drive, aLocation);
-    TDriveUnit driveUnit = TDriveUnit(drive);
-    
-    // check that the root folder is correct
-    if (drive.Length() > 2 && BaflUtils::CheckFolder(fs, drive.Left(3)) == KErrNone)
-        {
-        // test available disk space 
-        TRAP_IGNORE((noDiskSpace = SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, driveUnit)));
-        if(!noDiskSpace)
-            ret = ETrue;
-        }
-    
-    return ret;
-    }
-
-TInt CProfiler::HandleGeneralSettingsChange()
-    {
-    // local literals
-    _LIT8(KBackSlash, "\\");
-    _LIT8(KTraceFileExtension, ".dat");
-    
-    TBuf8<KFileNameBufSize> fileNameBuf;
-    TBuf8<10> number;
-    TInt result(0);
-    TInt index(1);
-    TInt hashLocation(0);
-    TParse parse;
-
-    // check if plugin writer changed
-    if(iGeneralAttributes.iTraceOutput.CompareF(KOutputToDebugOutput) == 0)
-        {
-        iWriterHandler->SetPluginActive( KDebOutWriterPluginUid, EWriterPluginEnabled );
-        }
-    else
-        {
-        RFs fileServer;
-        RFile file;
-        
-        // connect to the file server
-        result = fileServer.Connect();
-        if(result == KErrNone)
-            {
-            // disk writer plugin will be activated
-            iWriterHandler->SetPluginActive( KDiskWriterPluginUid, EWriterPluginEnabled );
-            
-            // fix the trace data file location as well
-            iTotalPrefix.Zero();
-            iTotalPrefix.Append(iGeneralAttributes.iSaveFileDrive);
-            
-            // check that trace file location sane
-            if(!CProfiler::CheckLocationSanity(fileServer, iTotalPrefix))
-                {
-                fileServer.Close();
-                return KErrPathNotFound;
-                }
-            
-            // remove extra spaces
-            iTotalPrefix.TrimAll();
-            
-            // check the directory contains a trailing backlash
-            if(iTotalPrefix.Right(1) != _L8("\\") && 
-                    iTotalPrefix.Right(1) != _L8("/"))
-                {
-                // append backslash to end
-                iTotalPrefix.Append(KBackSlash);
-                }
-            
-            // append trace file name prefix e.g. PIProfiler_#
-            iTotalPrefix.Append(iGeneralAttributes.iTraceFilePrefix);
-    
-            // locate '#' mark for finding the next free trace file name, e.g. E:\data\PIProfiler_4.dat
-            hashLocation = iTotalPrefix.Locate('#');
-            if( hashLocation == KErrNotFound )
-                {
-                // append simply at the end of the trace file prefix, no need to inform user
-                iTotalPrefix.Append('#');
-                // get new hash mark location
-                hashLocation = iTotalPrefix.Locate('#');
-                }
-    
-            // add the file extension
-            iTotalPrefix.Append(KTraceFileExtension);
-
-            // search for files with different indices
-            // until a free filename is found
-            while(result != KErrNotFound)
-                {
-                fileNameBuf.Zero();
-                // start with the original prefix
-                fileNameBuf.Append(iTotalPrefix);
-                // convert the number to a descriptor
-                number.Num(index);
-                // replace the hashmark with the real number
-                fileNameBuf.Replace(hashLocation,1,number);
-                
-                // make a copy to the iFileNameStream descriptor
-                iFileNameStream.Zero();
-                CnvUtfConverter::ConvertToUnicodeFromUtf8(iFileNameStream, fileNameBuf);
-                
-                LOGSTRING2("CProfiler::HandleGeneralSettingsChange() - trying to open files %S ",&iFileNameStream);
-
-                if((result = parse.Set(iFileNameStream, NULL, NULL)) != KErrNone)
-                    {
-                    // break loop if fails, problems in file name => change to log into debug output
-                    break;
-                    }
-                
-                // create directory for trace files if not exists
-                result = fileServer.MkDirAll(parse.FullName());
-
-                // check that file server responded with KErrNone or KErrAlreadyExists
-                if( result != KErrNone && result != KErrAlreadyExists)
-                    {
-                    // if some other result, e.g. memory full => break
-                    break;
-                    }
-
-                // attempt opening the file
-                result = file.Open(fileServer,parse.FullName(),EFileShareReadersOnly);
-                if(result != KErrNotFound)
-                    {
-                    if( result != KErrNotReady && 
-                        result != KErrServerBusy ) 
-                        {
-                        // close the file if it could be opened
-                        LOGSTRING2("Found STREAM file with index %d",index);
-                        index++;
-                        }
-                    else 
-                        {
-                        // in boot measurements the file system might not be ready yet.
-                        LOGSTRING2("Problem in opening STREAM file %d",index);
-                        }
-                    file.Close();
-                    }
-                } // while
-            }
-        else
-            {
-            // return error code
-            return result;
-            }
-        
-        TUint32 id(iWriterHandler->GetActiveWriter()->GetWriterType());
-        
-        // check if a file name is one that does not exist and selected plugin is disk writer
-        if(result == KErrNotFound && id == KDiskWriterPluginUid.iUid)
-            {
-            // write right trace data file name to disk writer plugin
-            iWriterHandler->SetPluginSettings( KDiskWriterPluginUid, iFileNameStream );
-            }
-        else
-            {
-            // return error if could not create trace log file
-            return result;
-            }
-        // close file server
-        fileServer.Close();
-        }   // if output == KOutputToDebugOutput
-    return KErrNone;
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfiler::HandleTimerExpiresL(TInt aError)
-    {
-    LOGSTRING2("CProfiler::HandleTimerExpiresL - Error: %d", aError);
-    this->ControlL(RProfiler::EStopSampling);
-    if( CPServer::iClientCount <= 0 )
-        {
-        LOGSTRING("CProfiler::HandleTimerExpiresL - No clients attached, shutting down server...");
-        this->ControlL(RProfiler::EExitProfiler);                
-        }
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfiler::SaveSettingsL()
-    {
-    LOGTEXT(_L("CProfiler::SaveSettings()"));
-    
-    // local literal
-    _LIT(KGeneralHeader, "[general]");
-    _LIT(KVersionHeader, "version");
-    _LIT8(KPIProfilerSettingsHeader, "; PI Profiler Settings File");
-    _LIT8(KGeneralSettingsHeader, "; general settings");
-    _LIT8(KOutputFileDescription,"; \"output_type=file_system\" writes *.dat file to external memory");
-    _LIT8(KOutputDebugDescription,"; \"output_type=debug_output\" writes *.dat file to debug port");
-    _LIT8(KOutputFilePrefixDescription,"; if writing to file, prefix of the *.dat file\r\n; first '#' in the prefix is replaced with an integer");
-    _LIT8(KOutputSaveDriveDescription,"; if writing to file, the location to store the *.dat file");
-    _LIT8(KTimedProfilingPeriod,"; period (in seconds) used when using timed profiling");
-    
-    RFs fs;
-    RFile settingsFile;
-    TInt err(KErrNone);
-    TBuf8<384> line;
-    
-    // connect to file server
-    err = fs.Connect();
-    if( err != KErrNone )
-        {
-        // failed to write settings to settings file
-        return;
-        }
-    
-    // create and set the private path
-    fs.CreatePrivatePath(EDriveC);
-    fs.SetSessionToPrivate(EDriveC);
-  
-    // create the new settings file
-    err = settingsFile.Replace(fs, iSettingsFileLocation, EFileWrite);
-    if(err != KErrNone)
-        return;
-    
-    CleanupClosePushL(settingsFile);  
-
-    // write the header
-    line.Copy(KPIProfilerSettingsHeader);
-    line.Append(KNewLineSeparator);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-    
-    // write the header
-    line.Copy(KGeneralSettingsHeader);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-
-    // write all generic settings
-    line.Copy(KGeneralHeader);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-
-    // write version info
-    line.Copy(KVersionHeader);
-    line.Append(KEquals);
-    line.Append(PROFILER_VERSION_SHORT);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-
-    // output explanation
-    line.Copy(KOutputFileDescription);
-    line.Append(KNewLineSeparator);
-    line.Append(KOutputDebugDescription);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-    
-    // write trace output
-    line.Copy(KGenericTraceOutput);
-    line.Append(KEquals);
-    line.Append(iGeneralAttributes.iTraceOutput);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-    
-    // file prefix explanation
-    line.Copy(KOutputFilePrefixDescription);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-
-    // write trace file prefix
-    line.Copy(KGenericTraceFilePrefix);
-    line.Append(KEquals);
-    line.Append(iGeneralAttributes.iTraceFilePrefix);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-    
-    // file prefix explanation
-    line.Copy(KOutputSaveDriveDescription);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-
-    // write trace file location
-    line.Copy(KGenericTraceFileSaveDrive);
-    line.Append(KEquals);
-    line.Append(iGeneralAttributes.iSaveFileDrive);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-    
-    // timed profiling period explanation
-    line.Copy(KTimedProfilingPeriod);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-    
-    // Write timed profiling period value
-    line.Copy(KGenericTimedProfilingPeriod);
-    line.Append(KEquals);
-    TBuf<16> tmpNum;
-    tmpNum.AppendNum(iGeneralAttributes.iTimedSamplingPeriod);
-    line.Append(tmpNum);
-    line.Append(KNewLineSeparator);
-    settingsFile.Write(line);
-        
-    // reset the default attributes array
-    iDefaultSamplerAttributesArray->Reset();
-    
-    // update the latest changes from plugins
-    iSamplerHandler->GetSamplerAttributesL(iDefaultSamplerAttributesArray);
-    
-    // call CSamplerController to write all sampler settings
-    iSamplerHandler->ComposeAttributesToSettingsFileFormat(settingsFile, iDefaultSamplerAttributesArray);
-    
-    CleanupStack::PopAndDestroy(); //settingsFile
-    // close file
-    fs.Close();
-    }
-
-TInt CProfiler::CheckOldProfilerRunning()
-    {
-    TFindProcess procName;
-    procName.Find(_L("BappeaProf.exe*"));
-    TFullName aResult;
-    TInt err(KErrNone);
-    RProcess proc;    
-    
-    // now check if old Profiler is still running on
-    err = procName.Next(aResult);
-    // check if old profiler process found 
-    if(err == KErrNone)
-        {
-        // other process found, i.e. right process to communicate with, in case started from eshell
-        err = proc.Open(procName);
-        if(err == KErrNone)
-            {
-            if(proc.ExitCategory().Length() > 0)
-                {
-                proc.Close();
-                // process already exited => create a new one
-                return KErrNotFound;
-                }
-            proc.Close();
-            }
-        // return error for error handling
-        return KErrAlreadyExists;
-        }
-    return err;
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfiler::HandleError(TInt aErr)
-    {
-    // write error to status property to inform requester
-    TInt err(iEngineStatus.Set(KEngineStatusPropertyCat, EProfilerEngineStatus, aErr));
-    if(err != KErrNone)
-        RDebug::Print(_L("CProfiler::HandleError() - error setting status: %d"), err);
-    }
-
-// --------------------------------------------------------------------------------------------
-TInt CProfiler::ControlDataL(TInt aCommand,TAny* value1,TAny* /*value2*/)
-    {
-	LOGSTRING3("CProfiler::ControlData %d, 0x%x",aCommand,value1);
-
-	_LIT(KDebugOutput, "debug_output");
-	_LIT(KFileOutput, "file_system");
-	_LIT8(KOutputToDebugOutput, "debug_output");
-	
-	TDes* desc;
-	TPtrC ptrDesc;
-	
-	switch(aCommand)
-	    {
-		// new controls
-	    case RProfiler::EGetFileName:
-	        {
-            LOGTEXT(_L("Profiler::EGetFileName - start"));
-            LOGSTRING2("Profiler::EGetFileName - total file name is: %S",(TDes*)value1);
-            desc = (TDes*)value1;
-            desc->Zero();
-            desc->Append(iFileNameStream);
-            LOGSTRING2("Profiler::EGetFileName - now total file name is: %S",(TDes*)value1);
-            return KErrNone;
-	        }
-        case RProfiler::EGetActiveWriter:
-            {
-            LOGTEXT(_L("Profiler::EGetActiveWriter - start"));
-            desc = (TDes*)value1;
-            desc->Zero();
-            if(iGeneralAttributes.iTraceOutput.CompareF(KOutputToDebugOutput) == 0)
-                {
-                desc->Append(KDebugOutput);
-                }
-            else
-                {
-                desc->Append(KFileOutput);
-                }
-            return KErrNone;
-            }
-	    }
-
-	return KErrNone;
-    }
-
-// --------------------------------------------------------------------------------------------
-TInt CProfiler::ControlL(TInt aCommand)
-    {
-	LOGSTRING2("CProfiler::Control - Controlling ProfilerEngine %d",aCommand);
-	TInt err(KErrNone);
-	
-	switch (aCommand)
-	    {
-		case RProfiler::EStartSampling:
-		case RProfiler::EStartTimedSampling:
-		    {
-		    // check first if old Profiler already running
-		    err = CheckOldProfilerRunning();
-		    if(err == KErrAlreadyExists)
-		        {
-		        // if exists do not start a profiling process since corrupts the collected trace data  
-		        HandleError(err);
-		        err = KErrNone;
-		        return err;
-		        }
-		    
-		    // save settings before launching the profiler
-		    // reason: the profiling may have set to the background => need for get right settings
-		    SaveSettingsL();
-		    
-		    // set the general settings to writer plugins to reflect the latest changes
-		    err = HandleGeneralSettingsChange();
-		    if(err == KErrNone)
-		        {
-                // reset the buffers before new profiling
-                iUserStream->ResetBuffers();
-    
-                // give the CProfilerSampleStream a handle to current writer
-                iUserStream->SetWriter(*iWriterHandler->GetActiveWriter());
-                
-                // set initially debug output writer active
-                err = iWriterHandler->StartSelectedPlugin();
-    
-                // check that writer plugin started
-                if(err != KErrNone)
-                    {
-                    // if not started handle error
-                    HandleError(err);
-                    }
-                else
-                    {
-                    // start activated sampler plug-in, NOTE: plugins check if errors occur in startup for some reason
-                    iSamplerHandler->StartSamplerPluginsL();
-        
-                    // set engine state P&S property to running, e.g. for PIProfiler UI to read
-                    iState = RProfiler::ERunning;
-        
-                    // set the engine into running mode
-                    iEngineStatus.Set(iState);
-                    }
-                }
-		    else
-		        {
-		        // handle error and notify requester
-		        HandleError(err);
-		        }
-		    
-		    if( aCommand == RProfiler::EStartTimedSampling )
-		        {
-                iTimer->After(iGeneralAttributes.iTimedSamplingPeriod);
-                LOGTEXT(_L("CProfiler::Control - Finished processing EStartTimedSampling!"));
-		        }
-		    else
-		        {
-                LOGTEXT(_L("CProfiler::Control - Finished processing EStartSampling!"));
-		        }
-
-			return err;
-		    }
-		case RProfiler::EStopSampling:
-			LOGTEXT(_L("CProfiler::Control - Starting to stop sampling..."));
-			// stop sampler plugins
-			if(iState == RProfiler::ERunning)
-				{
-				iState = RProfiler::EStopping;
-				iEngineStatus.Set(RProfiler::EStopping);
-				
-				iSamplerHandler->StopSamplerPlugins();
-	
-				// finalize the filled buffer writing
-				iUserStream->Finalise();
-				
-				// stop output plugin and write the rest of the trace data to output
-				LOGTEXT(_L("CProfiler::Control - stopping writer"));
-				iWriterHandler->StopSelectedPlugin();
-	
-				// set engine state P&S property idle 
-				iState = RProfiler::EIdle;
-				iEngineStatus.Set(RProfiler::EIdle);
-				
-				LOGSTRING2("CProfiler::Control - sampling stopped, going to state %d", RProfiler::EIdle);
-				}
-			return KErrNone;
-
-		case RProfiler::EExitProfiler:
-		    {
-		    // save settings into settings file when exiting
-		    SaveSettingsL();
-
-            if(iUserStream)
-                {
-                delete iUserStream;
-                iUserStream = NULL;
-                }
-		    
-            // set engine state P&S property idle 
-            iState = RProfiler::EIdle;
-            iEngineStatus.Set(RProfiler::EIdle);
-               
-            LOGTEXT(_L("Stopping Activer Scheduler"));
-            CActiveScheduler::Stop();
-            LOGTEXT(_L("Stopped Activer Scheduler"));
-
-            return KErrNone;
-		    }
-		    
-		case RProfiler::EAttachClient:
-		    {
-		    // Increase client reference count
-		    ++CPServer::iClientCount;
-		    LOGSTRING2("Increased client reference count to: %d", CPServer::iClientCount);
-		    return KErrNone;
-		    }
-		case RProfiler::ERemoveClient:
-		    {
-		    // Decrease client reference count
-		    --CPServer::iClientCount;
-		    LOGSTRING2("Decreasing client reference count to: %d", CPServer::iClientCount);
-		    return KErrNone;
-		    }
-	    }
-
-	LOGTEXT(_L("CProfiler::Control - returning"));
-
-	return err;
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfiler::Finalise()
-    {	
-	LOGTEXT(_L("CProfiler::Finalise - Finished processing EStopSampling!"));
-    }
-
-// --------------------------------------------------------------------------------------------
-RProfiler::TSamplerState CProfiler::State() const
-    {
-	return iState;
-    }
-
-/*
- *
- *	Class CPServer definition
- *
- */
-// --------------------------------------------------------------------------------------------
-inline const CPServer& CPSession::Server() const
-    {
-	return *static_cast<const CPServer*>(CSession2::Server());
-    }
-
-// --------------------------------------------------------------------------------------------
-void CPSession::ServiceL(const RMessage2& aMessage)
-    {
-	LOGTEXT(_L("CPSession::ServiceL - Starting to process message"));
-	TInt err(KErrNone);
-	
-	if(aMessage.Function() == RProfiler::EGetGeneralAttributes)
-	    {
-	    Server().GetGeneralAttributesL(aMessage);
-	    }
-	else if(aMessage.Function() == RProfiler::ESetGeneralAttributes)
-	    {
-        Server().SetGeneralAttributesL(aMessage);
-	    }
-	else if(aMessage.Function() == RProfiler::EGetSamplerAttributes)
-	    {
-        Server().GetSamplerAttributesL(aMessage);
-	    }
-    else if(aMessage.Function() == RProfiler::EGetSamplerAttributeCount)
-        {
-        Server().GetSamplerAttributeCountL(aMessage);
-        }
-    else if(aMessage.Function() == RProfiler::ESetSamplerAttributes)
-        {
-        Server().SetSamplerAttributesL(aMessage);
-        }
-    else if(aMessage.Function() == RProfiler::ERefreshProfilerStatus)
-        {
-        Server().RefreshStatus(aMessage);
-        }
-	else if(aMessage.Ptr0() == 0 && aMessage.Ptr1() == 0 && aMessage.Ptr2() == 0)
-		{	
-		LOGTEXT(_L("Ptr0 && Ptr1 == 0 && Ptr2 == 0"));
-		aMessage.Complete(Server().ControlL(RProfiler::TCommand(aMessage.Function())));
-		LOGTEXT(_L("CPSession::ServiceL - Message completed"));
-		} 
-	else if(aMessage.Ptr0() != 0 && aMessage.Ptr1() != 0 && aMessage.Ptr2() != 0)
-		{
-		LOGTEXT(_L("Error with message, all pointers contain data!"));
-		}
-		
-	else if (aMessage.Ptr0() != 0)
-		{
-		if(aMessage.Ptr1() == 0)
-			{
-			LOGTEXT(_L("ServiceL: Ptr0 != 0 && Ptr1 == 0"));
-			// provided value is a descriptor
-			TBuf<64>* dst = new TBuf<64>;
-			aMessage.ReadL(0,*dst,0);
-	
-			err = Server().ControlDataL(aMessage.Function(),(TAny*)dst);
-			delete dst;
-			aMessage.Complete(err);
-			LOGTEXT(_L("CPSession::ServiceL - Message completed"));
-			}
-		else
-			{
-			LOGTEXT(_L("ServiceL: Ptr0 != 0 && Ptr1 != 0"));
-			// provided value is a descriptor
-			TBuf<64>* dst = new TBuf<64>;
-			aMessage.ReadL(0,*dst,0);
-			
-			TUint32 num1 = (TUint32)aMessage.Ptr1();
-			
-			err = Server().ControlDataL(aMessage.Function(),(TAny*)dst, (TAny*)num1);
-			delete dst;
-			aMessage.Complete(err);
-			LOGTEXT(_L("CPSession::ServiceL - Message completed"));
-			}
-		}
-	else if (aMessage.Ptr1() != 0)
-		{
-		LOGTEXT(_L("ServiceL: Ptr1 != 0"));
-		// provided value is a TUint32
-		if( ((TUint32)aMessage.Ptr3()) == 0xffffffff)
-			{
-			TUint32 num = (TUint32)aMessage.Ptr1();
-			err = Server().ControlDataL(aMessage.Function(),(TAny*)num);
-			aMessage.Complete(err);
-			LOGTEXT(_L("CPSession::ServiceL - Message completed"));
-			}
-		else
-			{
-			LOGTEXT(_L("ServiceL: Ptr3 != 0xffffffff"));
-			TUint32 num1 = (TUint32)aMessage.Ptr1();
-			TUint32 num2 = (TUint32)aMessage.Ptr3();
-			err = Server().ControlDataL(aMessage.Function(),(TAny*)num1,(TAny*)num2);
-			aMessage.Complete(err);
-			LOGTEXT(_L("CPSession::ServiceL - Message completed"));
-			}
-		}
-	else if (aMessage.Ptr2() != 0)
-		{
-		// command requests for data, provided 
-		// value should be a descriptor
-		if( ((TUint32)aMessage.Ptr3()) == 0xffffffff)
-			{
-			LOGTEXT(_L("ServiceL: Ptr2 != 0 && Ptr3 == 0xffffffff"));
-	
-			TBuf<256>* src = new TBuf<256>;
-			src->Zero();
-			err = Server().ControlDataL(aMessage.Function(),(TAny*)src);
-	
-			LOGSTRING2("Got sampler data %S",src);
-			
-			aMessage.WriteL(2, *src, 0);
-	
-			delete src;
-			aMessage.Complete(err);
-			LOGTEXT(_L("CPSession::ServiceL - Message completed"));
-			}
-		else 
-			{
-			LOGTEXT(_L("ServiceL: Ptr2 != 0 && Ptr3 != 0xffffffff"));
-			
-			TUint32 num1 = (TUint32)aMessage.Ptr2();	// containing id
-			TBuf<256>* buffer = new TBuf<256>;		// Text data, e.g. plug-in name or description
-
-			LOGSTRING3("Getting data for sampler: 0x%X, buffer max len %d",num1, aMessage.GetDesMaxLength(3));
-
-			err = Server().ControlDataL(aMessage.Function(), (TAny*)num1, (TAny*)buffer);
-
-			LOGSTRING2("Got sampler data %S",&buffer);
-			
-			// write back to same parameter
-			aMessage.WriteL(3, *buffer, 0);
-			
-			delete buffer;
-			aMessage.Complete(err);
-			LOGTEXT(_L("CPSession::ServiceL - Message completed"));	
-			}
-		}
-	LOGTEXT(_L("CPSession::ServiceL - Message processed"));
-    }
-
-// --------------------------------------------------------------------------------------------
-MProfilerController* CPServer::NewL(TInt aPriority, MProfilerEngine& aEngine)
-    {
-	LOGTEXT(_L("CPServer::NewL - Enter"));
-	CPServer* self = new(ELeave) CPServer(aPriority, aEngine);
-	CleanupStack::PushL(self);
-	self->StartL(KProfilerName);
-	CleanupStack::Pop();
-	LOGTEXT(_L("CPSession::NewL - Exit"));
-	return self;
-    }
-
-// --------------------------------------------------------------------------------------------
-CPServer::CPServer(TInt aPriority, MProfilerEngine& aEngine)
-	: CServer2(aPriority), MProfilerController(aEngine)
-    {
-
-    }
-
-// --------------------------------------------------------------------------------------------
-void CPServer::Release()
-    {
-	delete this;
-    }
-
-// --------------------------------------------------------------------------------------------
-CSession2* CPServer::NewSessionL(const TVersion&,const RMessage2&) const
-    {
-	return new(ELeave) CPSession();
-    }
-
-/*
- *
- * Static methods for controlling the profiler
- * through command line
- *
- */
-// --------------------------------------------------------------------------------------------
-static void RunEngineServerL(const TDesC& aSettingsFile)
-    {
-	RDebug::Print(_L("Profiler: RunEngineServerL() - Install active scheduler"));
-	CActiveScheduler* pS = new CActiveScheduler;
-	CActiveScheduler::Install(pS);
-	CProfiler* p = CProfiler::NewLC(aSettingsFile);
-	CActiveScheduler::Start();
-	p->Finalise();
-	CleanupStack::PopAndDestroy(p);
-	delete pS;
-    }
-
-// --------------------------------------------------------------------------------------------
-static TInt TestSettingsFile(const TDesC& configFile)
-    {
-    RFs fs;
-    LOGSTRING2("TestSettingsFile: entry %S", &configFile);
-    // check if file server can be connected
-    if (fs.Connect() != KErrNone)
-        {
-        LOGTEXT(_L("TestSettingsFile: could not connect file server"));
-        // file server couldn't be connected, return false
-        return KErrNotFound;
-        }
-
-    // check if config file name length is > 0
-    if (configFile.Length() > 0)
-        {
-        LOGTEXT(_L("TestSettingsFile: checking location sanity"));
-        // check sanity of settings file location
-        if(BaflUtils::CheckFolder(fs, configFile) != KErrNone)
-            {
-            LOGTEXT(_L("TestSettingsFile: location sanity check failed"));
-            fs.Close();
-            return KErrGeneral;
-            }
-        }
-    else
-        {
-        // configFile length 0, return false
-        LOGTEXT(_L("TestSettingsFile: config file string null length"));
-        fs.Close();
-        return KErrNotFound;
-        }
-    // return true if tests passed
-    LOGTEXT(_L("TestSettingsFile: exiting..."));
-    fs.Close();
-    return KErrNone;
-    }
-
-// --------------------------------------------------------------------------------------------
-GLDEF_C TInt E32Main()
-    {
-    // parse command line arguments 
-    TBuf<256> c;
-    TInt err(KErrNone);
-    
-    // copy the full command line with arguments into a buffer
-    User::CommandLine(c);
-
-    TBuf<256> fileName;
-    fileName.Append(c); // only one settings param should be
-    LOGSTRING3("Filename is %S, response %d 1", &fileName, err);
-    err = TestSettingsFile(fileName);
-    if(err != KErrNone)
-        {
-        LOGSTRING3("Filename is %S, response %d 2", &fileName, err);
-        // settings file does not exist, copy null desc to file name
-        fileName.Copy(KNullDesC);
-        }
-
-    LOGSTRING3("Filename is %S, response %d 3", &fileName, err);
-    
-    // if no command line arguments found just start the profiler process
-    __UHEAP_MARK;
-    CTrapCleanup* cleanup = CTrapCleanup::New();
-    TInt ret(KErrNoMemory);
-    if( cleanup )
-        {
-        TRAPD( ret, RunEngineServerL(fileName) );
-        RDebug::Print(_L("Profiler: E32Main() - ret %d"), ret);
-        delete cleanup;
-        } 
-    __UHEAP_MARKEND;
-
-    return ret;
-    } 
-
-
--- a/piprofiler/engine/src/ProfilerErrorChecker.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +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 <e32std.h>
-#include <e32base.h>
-#include <e32property.h>
-
-#include <piprofiler/ProfilerTraces.h>
-
-#include "ProfilerErrorChecker.h"
-
-// properties
-const TUid KEngineStatusPropertyCat={0x2001E5AD};
-enum TEnginePropertyKeys
-    {
-    EProfilerEngineStatus = 8,
-    EProfilerErrorStatus
-    };
-
-/*
- *
- *  CProfilerErrorChecker class implementation
- *
- */
-CProfilerErrorChecker* CProfilerErrorChecker::NewL()
-    {
-    CProfilerErrorChecker* self = new(ELeave) CProfilerErrorChecker;
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop();
-    return self;
-    }
-
-// --------------------------------------------------------------------------------------------
-CProfilerErrorChecker::CProfilerErrorChecker() :
-    CActive(EPriorityStandard)
-    {
-    }
-
-CProfilerErrorChecker::~CProfilerErrorChecker()
-    {
-    Cancel();
-    iErrorStatus.Close();
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfilerErrorChecker::ConstructL()
-    {
-    
-    LOGTEXT(_L("Trying to attach to profiler engine error status property"));
-    User::LeaveIfError(iErrorStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus));
-    CActiveScheduler::Add(this);
-
-    // subscribe to P&S status property
-    iErrorStatus.Subscribe(iStatus);
-    SetActive();
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfilerErrorChecker::SetObserver(MProfilerErrorObserver* aObserver)
-    {
-    iObserver = aObserver;
-    }
-
-// --------------------------------------------------------------------------------------------
-TInt CProfilerErrorChecker::RunError(TInt aError)
-    {
-    iErrorStatus.Close();
-    return aError;
-    }
-// --------------------------------------------------------------------------------------------
-void CProfilerErrorChecker::RunL()
-    {
-    // resubscribe before processing new value to prevent missing updates
-    iErrorStatus.Subscribe(iStatus);
-    SetActive();
-
-    TInt stat(0);
-    if(iErrorStatus.Get(stat) != KErrNone)
-        {
-        // check if error status != KErrNone
-        if(stat != 0)
-            {
-            iObserver->HandleProfilerErrorChangeL(stat);
-            }
-        
-        // reset error code
-        iErrorStatus.Set(KErrNone);
-        }
-    }
-
-// --------------------------------------------------------------------------------------------
- 
-void CProfilerErrorChecker::DoCancel()
-    {
-    iErrorStatus.Cancel();
-    }
-
-// end of file
-    
--- a/piprofiler/engine/src/ProfilerEshell.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,440 +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 <f32file.h>
-#include <e32cons.h>
-
-#include "ProfilerEshell.h"
-#include <piprofiler/ProfilerSession.h>
-
-
-
-_LIT(KProfilerEngineExe, "PIProfilerEngine.exe");
-
-/*
- *
- * Static methods for controlling the profiler
- * through command line
- *
- */
-// --------------------------------------------------------------------------------------------
-static void PrintUsageInfo(const TDesC& aAdditionalInfo)
-    {
-    _LIT(KConsoleName, "Console");
-    _LIT(KLegalNote, "PIProfiler Version 2.2.0.2 Copyright @ 2009 Nokia\n");
-    _LIT(KUsageNote, "Usage: PIProfiler [start/end/timed] settingsfile [time to run]\n");
-    _LIT(KExample, "Example: PIProfiler timed C:\\data\\piprofilersettings.txt 60\n");
-
-    TRAP_IGNORE(CConsoleBase* console = Console::NewL(KConsoleName,TSize(KConsFullScreen,KConsFullScreen));
-        console->Printf(KLegalNote);
-        console->Printf(KUsageNote);
-        console->Printf(KExample);
-        console->Write(aAdditionalInfo);
-    
-        console->Printf(_L("\n[Press any key]"));
-        console->Getch();
-        delete console;);
-    }
-
-// --------------------------------------------------------------------------------------------
-static TInt FindProcess()
-    {
-    TFindProcess procName;
-    procName.Find(_L("PIProfilerEngine.exe*"));
-    TFullName aResult;
-    
-    // find the first appearance, i.e. "myself"...
-    TInt err(procName.Next(aResult));  // the first appearance
-    if(err == KErrNotFound)
-        {
-        // now check if old Profiler is still running on
-        procName.Find(_L("BappeaProf.exe*"));
-        err = procName.Next(aResult);
-        // check if old profiler process found 
-        if(err == KErrNone)
-            {
-            // return error for error handling
-            return KErrAlreadyExists;
-            }
-        // return KErrNotFound and a new profiler engine process can be started
-        return KErrNotFound;
-        }
-    return err;
-    }
-
-/**
- * Function for starting profiler engine in the background,
- * call profiler to load settings
- * and start sampling process
- * 
- * @param configFile name and location of settings file
- * @param aRunTimeInSeconds run time in seconds
- * @param aBootTime run boot time sampling or not.
- */
-// --------------------------------------------------------------------------------------------
-static TInt StartProfilerProcess(const TDesC& configFile, TInt aRunTimeInSeconds, TBool aBootTime)
-    {
-    TInt err(KErrNone);
-    RProcess proc;
-    TRequestStatus status = KRequestPending;
-    TBuf<256> conf;
-    conf.Zero();
-    conf.Append(configFile);
-    if(aBootTime)
-        {
-        RDebug::Printf("boot time measurement");
-        conf.Append(_L(" "));
-        conf.Append(_L("boot"));
-        }
-    RDebug::RawPrint(conf);
-    // check if process exists
-    err = FindProcess();
-    LOGSTRING2("PIProfiler: tried to find process, response %d", err); 
-
-    // check if already exists and don't start a new eshell profiling
-    if( err == KErrNotFound )
-        {
-        // try create new process
-        err = proc.Create(KProfilerEngineExe, conf);
-
-        LOGSTRING2("PIProfiler: created process, response %d", err); 
-
-        // check if RProcess::Create() succeeded
-        if( err == KErrNone )
-            {
-            // Trigger rendezvous on the supplied TRequestStatus object
-            proc.Rendezvous(status); 
-
-            // kick off the engine process
-            proc.Resume();
-            
-            // wait for the constructor to complete 
-            User::WaitForRequest(status); 
-            
-            // just lose the handle
-            proc.Close();
-            
-            // start sampling, using settings found in settings file or if not found the default settings
-            err = RProfiler::StartSampling();
-            // check if command succesful
-            if( err != KErrNone )
-                {
-                LOGSTRING2("PI Profiler start: err %d", err);
-                _LIT(KNoteProfilerCannotStart, "PI Profiler: cannot start PI Profiler, check settings!");
-                PrintUsageInfo(KNoteProfilerCannotStart);
-                
-                // check if process still alive
-                if(err != KErrNotFound)
-                    {
-                    // exit the profiler process since process was started
-                    RProfiler::ExitProfiler();
-                    }
-                return err;
-                }
-            
-            if(aRunTimeInSeconds > 0)
-                {
-                RDebug::Print(_L("Profiler running for %d s... "), aRunTimeInSeconds);
-                User::After(aRunTimeInSeconds*1000000);
-                RDebug::Print(_L("************* Profiler process closing *********"));
-        
-                // stop sampling process
-                err = RProfiler::StopSampling();
-                // check if command succesfull
-                if( err != KErrNone )
-                    {
-                    LOGTEXT(_L("Profiler: could not connect engine, stop failed"));
-                    return err;
-                    }
-                
-                // exit the profiler process
-                err = RProfiler::ExitProfiler();
-                // check if command succesfull
-                if( err != KErrNone )
-                    {
-                    LOGTEXT(_L("Profiler: could not connect engine, exit failed"));
-                    return err;
-                    }
-                }
-            } 
-        else
-            {
-            _LIT(KNoteCannotFindProfiler, "PI Profiler: could not find PIProfilerEngine.exe");
-            PrintUsageInfo(KNoteCannotFindProfiler);
-            }
-        }
-    // check if old Profiler is already running
-    else if( err == KErrAlreadyExists )
-        {
-        _LIT(KNoteAlreadyRunning, "PI Profiler: old Profiler process already running, close it down before launching the new!");
-        PrintUsageInfo(KNoteAlreadyRunning);
-        }
-    // otherwise show error note
-    else
-        {
-        _LIT(KNoteAlreadyRunning, "PI Profiler: already running, not able to launch new one. NOTE: check if UI running!");
-        PrintUsageInfo(KNoteAlreadyRunning);
-        }
-    return KErrNone;
-    }
-
-// --------------------------------------------------------------------------------------------
-static TInt EndProfilerProcess()
-    {
-    LOGTEXT(_L("EndProfilerProcess() ..."));
-
-    // call profiler to stop sampling
-    TInt err = RProfiler::StopSampling();
-    
-    // check if command succesfull
-    if( err != KErrNone )
-        {
-        LOGTEXT(_L("Profiler: could not connect engine, stop failed"));
-        return err;
-        }
-    
-    // exit the profiler process
-    err = RProfiler::ExitProfiler();
-    // check if command succesfull
-    if( err != KErrNone )
-        {
-        LOGTEXT(_L("Profiler: could not connect engine, exit failed"));
-        return err;
-        }
-    
-    return KErrNone;
-    }
-
-// --------------------------------------------------------------------------------------------
-static TInt TestSettingsFile(const TDesC& configFile)
-    {
-    RFs fs;
-    RFile file;
-    TInt err(KErrNone);
-
-    // check if file server can be connected
-    if (fs.Connect() != KErrNone)
-        {
-        // file server couldn't be connected, return false
-        return KErrNotFound;
-        }
-
-    // check if config file name length is > 0
-    if (configFile.Length() > 0)
-        {
-        // open the file with the given path and name
-        err = file.Open(fs,configFile,EFileRead);
-        // check if file open was succesfull 
-        if(err != KErrNone)
-            {
-            // return false if failed
-            fs.Close();
-            return err;
-            }
-        
-        }
-    else
-        {
-        // configFile length 0, return false
-        fs.Close();
-        return KErrNotFound;
-        }
-    // return true if tests passed
-    file.Close();
-    fs.Close();
-    return KErrNone;
-    }
-
-// --------------------------------------------------------------------------------------------
-static TInt ParseCommandAndExecute()
-    {
-    // commands literals for finding the right keyword 
-    _LIT(KAutomatedTestStart,"start*");
-    _LIT(KAutomatedTestEnd,"end*");
-    _LIT(KAutomatedTestTimed,"timed*");
-    _LIT(KBootMeasurement,"boot*");
-    TBuf<256> c;
-    TInt match(KErrNotFound);
-    TInt bootmatch(KErrNotFound);
-    TBool myBoot=false;
-    // copy the full command line with arguments into a buffer
-    User::CommandLine(c);
-    LOGSTRING2("command: %S", &c);
-
-    // try to match with each of the literals defined above
-    // (commands in atf format)
-    
-    // check if command is "start"
-    match = c.Match(KAutomatedTestStart);
-    if (match != KErrNotFound)
-        {
-        LOGTEXT(_L("Found keyword start"));
-
-        TBuf<256> fileName;
-        fileName.Append(c.Right(c.Length()-6));
-        LOGSTRING2("Filename is %S", &fileName);
-        if(TestSettingsFile(fileName) != KErrNone)
-            {
-            _LIT(KSettingsFileFailed, "False settings file");
-            PrintUsageInfo(KSettingsFileFailed);
-            return -2;
-            }
-        // execute Profile process 
-        if( StartProfilerProcess(fileName, 0, myBoot) == KErrNone )
-            {
-            return -10;
-            }
-        return -2;
-        }
-
-    // check if command is "end"
-    match = c.Match(KAutomatedTestEnd);
-    if (match != KErrNotFound)
-        {
-        LOGTEXT(_L("Found keyword end"));
-
-        // stop the profiling process
-        EndProfilerProcess();
-        return -10;
-        }
-
-    // check if command is "timed"
-    match = c.Match(KAutomatedTestTimed);
-    // check if command is "boot"
-    bootmatch = c.Match(KBootMeasurement);
-    if ((match!= KErrNotFound) || (bootmatch != KErrNotFound))
-        {
-        // command "timed" or " boot" found, need for finding settings file and run time next
-        if(bootmatch != KErrNotFound)
-            {
-            LOGTEXT(_L("Found keyword boot"));
-            myBoot = TRUE;
-            }
-        if(match != KErrNotFound)
-            {
-            LOGTEXT(_L("Found keyword timed"));
-            }
-        
-        TBuf<256> temp;
-        temp.Append(c);
-        TLex lex(temp);
-        
-        TBuf<256> fileName;
-        TInt seconds;
-
-        // parse the first command line argument, the command itself
-        lex.Mark();
-        lex.SkipCharacters();
-        if(lex.TokenLength() != 0)
-            {
-            #ifdef PIPROFILER_PRINTS
-            TPtrC token = lex.MarkedToken();
-            LOGSTRING2("Token 1 %S",&token);
-            #endif
-            }
-        else
-            {
-            LOGTEXT(_L("Problem 1 in parsing command line"));
-            _LIT(KSettingsFileFailed, "Failure: False argument");
-            PrintUsageInfo(KSettingsFileFailed);
-            return -2;
-            }
-
-        // parse the second command line argument, the settings file name
-        lex.SkipSpace();
-        lex.Mark();
-        lex.SkipCharacters();
-        if(lex.TokenLength() != 0)
-            {
-            TPtrC token2 = lex.MarkedToken();
-            LOGSTRING2("Token 2 %S",&token2);
-            fileName.Append(token2);
-            LOGSTRING2("Value of fileName is %S",&fileName);
-//            if(TestSettingsFile(fileName) != KErrNone)
-//                {
-//                _LIT(KSettingsFileFailed, "Failure: False settings file");
-//                PrintUsageInfo(KSettingsFileFailed);
-//                return -2;
-//                }
-            }
-        else
-            {
-            LOGTEXT(_L("Problem 2 in parsing command line"));
-            _LIT(KSettingsFileFailed, "Failure: No settings file specified");
-            PrintUsageInfo(KSettingsFileFailed);
-            return -2;
-            }
-
-        // parse the third command line argument, the run time in seconds
-        lex.SkipSpace();
-        lex.Mark();
-        lex.SkipCharacters();
-        if(lex.TokenLength() != 0)
-            {
-            // third token ok, try to convert into TInt value
-            TPtrC token3 = lex.MarkedToken();
-            LOGSTRING2("Token 3 %S",&token3);
-            TLex num(token3);
-            TInt err = num.Val(seconds);
-            // check if given time value acceptable 
-            if (err != KErrNone)
-                {
-                // value parsing failed, show info note to user
-                _LIT(KSecondsFailed, "Failure: False time value");
-                PrintUsageInfo(KSecondsFailed);
-                return -2;
-                }
-            }
-        else
-            {
-            LOGTEXT(_L("Problem 3 in parsing command line"));
-            _LIT(KSecondsFailed, "Failure: False time value");
-            PrintUsageInfo(KSecondsFailed);
-            return -2;
-            }           
-        
-        LOGSTRING3("Filename is %S, seconds is %d", &fileName, seconds);
-        // execute Profile process 
-        if( StartProfilerProcess(fileName, seconds, myBoot) == KErrNone )
-            {
-            return -10;
-            }
-        return -2;
-        }
-    
-    // check if space character in the middle of command line string 
-    if( c.LocateReverse(' ') != KErrNotFound)
-        {
-        _LIT(KWrongParameters, "Failure: Check command line parameters");
-        PrintUsageInfo(KWrongParameters);
-        return -2;
-        }
-    
-    // return -1 if no command found
-    LOGTEXT(_L("No keyword found"));
-    return -1;
-    }
-
-// --------------------------------------------------------------------------------------------
-GLDEF_C TInt E32Main()
-    {
-    // parse command line arguments
-    ParseCommandAndExecute();
-
-    return KErrNone;
-
-    } 
--- a/piprofiler/engine/src/ProfilerTimer.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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 "ProfilerTimer.h"
-
-/*
- *
- *  CProfilerTimer class implementation
- *
- */
-// --------------------------------------------------------------------------------------------
-CProfilerTimer::CProfilerTimer(const TInt aPriority, MProfilerTimerObserver& aObserver)
-: 
-CActive(aPriority),
-iObserver(aObserver)
-    {    
-    } 
-
-// --------------------------------------------------------------------------------------------
-CProfilerTimer::~CProfilerTimer()
-    {
-    Cancel();
-    iTimer.Close();
-    } 
-
-// --------------------------------------------------------------------------------------------
-CProfilerTimer* CProfilerTimer::NewL(const TInt aPriority, MProfilerTimerObserver& aObserver)
-    {
-    CProfilerTimer* self = new (ELeave) CProfilerTimer(aPriority, aObserver);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop();
-    return self;
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfilerTimer::ConstructL(void)
-    {
-    CActiveScheduler::Add(this);
-    iTimer.CreateLocal();
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfilerTimer::After(TUint aPeriodInSeconds)
-    {
-    Cancel();
-    TTimeIntervalMicroSeconds32 period = aPeriodInSeconds * 1000000;
-    iTimer.After(iStatus, period);
-    SetActive();
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfilerTimer::DoCancel()
-    {
-    iTimer.Cancel();
-    }
-
-// --------------------------------------------------------------------------------------------
-void CProfilerTimer::RunL()
-    {
-    iObserver.HandleTimerExpiresL(iStatus.Int());
-    }
--- a/piprofiler/engine/src/SamplerController.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,500 +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 "SamplerController.h"
-//#include <piprofiler/EngineUIDs.h>
-
-// CONSTANTS
-const TInt KMaxSamplerPluginCount = 20;
-const TInt KMaxExtraSettingsItemCount = 6;
-
-// LITERALS
-_LIT8(KSamplingPeriod, "sampling_period_ms");
-_LIT8(KNewLine8, "\n");
-_LIT8(KEquals8, "=");
-_LIT8(KSettingsText, " settings");
-_LIT(KNewLine, "\n");
-_LIT(KEquals, "=");
-_LIT(KCommentSeparator, " ; ");
-
-CSamplerController* CSamplerController::NewL(CProfilerSampleStream& aStream)
-    {
-    CSamplerController* self = new( ELeave ) CSamplerController(aStream);
-    CleanupStack::PushL( self );
-    self->ConstructL( );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-void CSamplerController::ConstructL()
-	{
-	// initiate sampler plugin list
-	InitialiseSamplerListL();
-	}
-
-
-CSamplerController::CSamplerController(CProfilerSampleStream& aStream) : 
-    iStream(aStream)
-	{
-	}
-
-void CSamplerController::InitialiseSamplerListL()
-    {
-    // create new sampler plugin array
-    iPluginArray = new (ELeave) CArrayPtrFlat<CSamplerPluginInterface>( KMaxSamplerPluginCount );
-    
-    // create plugin loader instance
-    iPluginLoader = CSamplerPluginLoader::NewL();
-    
-    // register sampler controller to get notifications of succesfull plugin load
-    iPluginLoader->SetObserver( this );
-    
-    // load sampler plugins asynchronously
-    iPluginLoader->LoadAsyncL( iPluginArray );
-    
-    LOGTEXT(_L(" RSamplerController::InitialiseUserSideSamplerList - exit"));	
-    }
-
-CSamplerController::~CSamplerController()
-	{
-	LOGTEXT(_L("CSamplerController::~CSamplerController - entry" ));
-	
-    if ( iPluginArray )
-        {
-        // destroy the plugin instances
-        // empty loaded plugins from array
-        for(TInt i(0);i<iPluginArray->Count();i++)
-            {
-            if(iPluginArray->At(i))
-                {
-                delete iPluginArray->At(i);
-                iPluginArray->At(i) = NULL;
-                }
-            }
-        iPluginArray->Reset();
-        delete iPluginArray;
-        iPluginArray = NULL;
-        }
-	
-	if ( iPluginLoader )
-	    {
-	    iPluginLoader->AbortAsyncLoad();
-	    delete iPluginLoader;
-	    iPluginLoader = NULL;
-	    }
-    
-	LOGTEXT(_L("CSamplerController::~CSamplerController - exit" ));
-	}
-
-void CSamplerController::SetObserver(MSamplerControllerObserver* aObserver)
-    {
-    iObserver = aObserver;
-    }
-    
-TInt CSamplerController::UpdateSavedSamplerAttributesL(CDesC8ArrayFlat* aSavedLineArray, CArrayFixFlat<TSamplerAttributes>* aAttributes)
-    {
-    TInt err(KErrNone);
-    TInt count(iPluginArray->Count());
-    // all plugins get their own settings among whole lump of setting strings
-    CSamplerPluginInterface* plugin = NULL;
-    
-    // loop through the plugin array
-    for(TInt i(0);i<count;i++)
-        {
-        // get each plugin at a time
-        plugin = iPluginArray->At(i);
-        
-        // call each plugin to sort out its own settings 
-        err = plugin->ConvertRawSettingsToAttributes(aSavedLineArray);
-        
-        // get plugin specific attributes, array may contain attributes of several sub samplers
-        plugin->GetAttributesL(aAttributes); 
-        }
-    
-    return err;
-    }
-
-TInt CSamplerController::SetSamplerSettingsL(TInt aUid, TSamplerAttributes aAttributes)
-    {
-    // parse right plugin based on UID
-    CSamplerPluginInterface* plugin = GetPlugin(TUid::Uid(aUid));
-    
-    // set the sampler attributes of a sampler plugin
-    plugin->SetAttributesL(aAttributes);
-    
-    return KErrNone;
-    }
-
-void CSamplerController::GetSamplerAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes)
-    {
-    CSamplerPluginInterface* plugin = NULL;
-    
-    TInt count(iPluginArray->Count());
-    
-    // get first all the attributes from all the sampler plugins listed in iPluginArray
-    for(TInt i(0);i<count;i++)
-        {
-        // get the plugin first
-        plugin = iPluginArray->At(i);
-        
-        // get plugin specific attributes, array may contain attributes of several sub samplers
-        plugin->GetAttributesL(aAttributes); 
-        }
-    }
-
-void CSamplerController::ComposeAttributesToSettingsFileFormat(RFile& aFile, CArrayFixFlat<TSamplerAttributes>* aAttributes)
-    {
-    // write immediately to settings file
-    ComposeSettingsText(aFile, aAttributes);
-    }
-
-void CSamplerController::ComposeSettingsText(RFile& aFile, CArrayFixFlat<TSamplerAttributes>* aAttrArray)
-    {
-    // temporary buffer for a setting line
-    TBuf<384> settingLine;
-    TBuf8<384> settingLine8;
-    TInt itemCount(0);
-    TBuf<266> tBuf;
-    
-    TSamplerAttributes attr;
-    
-    for(TInt i(0);i<aAttrArray->Count();i++)
-        {
-        // get the attribute container 
-        attr = aAttrArray->At(i);
-        
-        // add the name and description of the sampler in brackets first
-        settingLine8.Copy(KBracketOpen);
-        settingLine8.Append(attr.iShortName);
-        settingLine8.Append(KBracketClose);
-        settingLine8.Append(KCommentSeparator());
-        settingLine8.Append(attr.iName);
-        settingLine8.Append(KSettingsText);
-        settingLine8.Append(KNewLine8);
-        aFile.Write(settingLine8);
-        
-        // enabled
-        settingLine8.Copy(KEnabled);
-        settingLine8.Append(KEquals8);
-        settingLine8.Append(Bool2Str(attr.iEnabled));
-        settingLine8.Append(KNewLine8);
-        aFile.Write(settingLine8);
-        
-        // sampling rate (if set)
-        if( attr.iSampleRate != -1 )
-            {
-            settingLine8.Copy(KSamplingPeriod);
-            settingLine8.Append(KEquals8);
-            settingLine8.Append(Int2Str(attr.iSampleRate));
-            settingLine8.Append(KNewLine8);
-            aFile.Write(settingLine8);
-            }
-        
-        itemCount = attr.iItemCount;
-        
-        // check if item count set is sane, max extra settings item count 6
-        if(itemCount > KMaxExtraSettingsItemCount)
-            {
-            // probably forgot to set the item count value in plugin => safe to set it 0
-            itemCount = 0;
-            }
-        
-        // setting items
-        for (TInt j(0);j<itemCount;j++)
-            {
-            switch(j)
-                {
-                case 0: // settingItem1
-                    {
-                    settingLine.Copy(attr.iSettingItem1.iSettingText);
-                    settingLine.Append(KEquals());
-                    settingLine.Append(attr.iSettingItem1.iValue);
-                    settingLine.Append(KCommentSeparator());
-                    settingLine.Append(attr.iSettingItem1.iUIText);
-                    settingLine.Append(KNewLine());
-                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
-                    aFile.Write(settingLine8);
-                    break;
-                    }
-                case 1: // settingItem2
-                    {
-                    settingLine.Copy(attr.iSettingItem2.iSettingText);
-                    settingLine.Append(KEquals());
-                    settingLine.Append(attr.iSettingItem2.iValue);
-                    settingLine.Append(KCommentSeparator());
-                    settingLine.Append(attr.iSettingItem2.iUIText);
-                    settingLine.Append(KNewLine());
-                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
-                    aFile.Write(settingLine8);
-                    break;
-                    }
-                case 2: // settingItem3
-                    {
-                    settingLine.Copy(attr.iSettingItem3.iSettingText);
-                    settingLine.Append(KEquals());
-                    settingLine.Append(attr.iSettingItem3.iValue);
-                    settingLine.Append(KCommentSeparator());
-                    settingLine.Append(attr.iSettingItem3.iUIText);
-                    settingLine.Append(KNewLine());
-                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
-                    aFile.Write(settingLine8);
-                    break;
-                    }
-                case 3: // settingItem4
-                    {
-                    settingLine.Copy(attr.iSettingItem4.iSettingText);
-                    settingLine.Append(KEquals());
-                    settingLine.Append(attr.iSettingItem4.iValue);
-                    settingLine.Append(KCommentSeparator());
-                    settingLine.Append(attr.iSettingItem4.iUIText);
-                    settingLine.Append(KNewLine());
-                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
-                    aFile.Write(settingLine8);
-                    break;
-                    }
-                case 4: // settingItem5
-                    {
-                    settingLine.Copy(attr.iSettingItem5.iSettingText);
-                    settingLine.Append(KEquals());
-                    settingLine.Append(attr.iSettingItem5.iValue);
-                    settingLine.Append(KCommentSeparator());
-                    settingLine.Append(attr.iSettingItem5.iUIText);
-                    settingLine.Append(KNewLine());
-                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
-                    aFile.Write(settingLine8);
-                    break;
-                    }
-                case 5: // settingItem6
-                    {
-                    settingLine.Copy(attr.iSettingItem6.iSettingText);
-                    settingLine.Append(KEquals());
-                    settingLine.Append(attr.iSettingItem6.iValue);
-                    settingLine.Append(KCommentSeparator());
-                    settingLine.Append(attr.iSettingItem6.iUIText);
-                    settingLine.Append(KNewLine());
-                    CnvUtfConverter::ConvertFromUnicodeToUtf8(settingLine8, settingLine);
-                    aFile.Write(settingLine8);
-                    break;
-                    }
-                }
-            }
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// Converts given descriptor into TBool value.
-// ----------------------------------------------------------------------------
-//
-inline void CSamplerController::Str2Bool(const TDesC8& aBuf, TBool& aValue)
-    {
-    if (aBuf.CompareF(KFalse) == 0)
-        aValue = EFalse;
-    else
-        aValue = ETrue;
-    }
-
-// ----------------------------------------------------------------------------
-// Converts given descriptor into TInt value.
-// ----------------------------------------------------------------------------
-//
-inline void CSamplerController::Str2Int(const TDesC8& aBuf, TInt& aValue)
-    {
-    TLex8 conv;
-    conv.Assign(aBuf);
-    
-    if (conv.Val(aValue) != KErrNone)
-        aValue = 0;
-    }
-
-// ----------------------------------------------------------------------------
-// Converts given descriptor into TInt value.
-// ----------------------------------------------------------------------------
-//
-inline void CSamplerController::Str2Int(const TDesC8& aBuf, TUint32& aValue)
-    {
-    TInt temp(0);
-    
-    TLex8 conv;
-    conv.Assign(aBuf);
-    
-    if (conv.Val(temp) != KErrNone)
-        aValue = 0;
-    else
-        aValue = (TUint32)temp;
-    }
-
-// ----------------------------------------------------------------------------
-// Converts given boolean into a descriptor.
-// ----------------------------------------------------------------------------
-//
-inline TBuf8<16> CSamplerController::Bool2Str(const TBool& aValue)
-    {
-    TBuf8<16> buf;
-    
-    if (aValue)
-        buf.Copy(KTrue);
-    else
-        buf.Copy(KFalse);
-    
-    return buf;
-    }
-
-// ----------------------------------------------------------------------------
-// Converts given integer into a descriptor.
-// ----------------------------------------------------------------------------
-//
-inline TBuf8<16> CSamplerController::Int2Str(const TInt& aValue)
-    {
-    TBuf8<16> buf;
-    buf.AppendNum(aValue);
-   
-    return buf;
-    }
-
-
-void CSamplerController::HandlePluginLoaded( KSamplerPluginLoaderStatus aStatus )
-    {
-    
-    // process status value
-    switch(aStatus)
-        {
-        case 0:
-            LOGSTRING2("RSamplerController - one plugin loaded, status: %d", aStatus);
-            break;
-        case 1:
-            LOGSTRING2("RSamplerController - a plugin load failed: %d", aStatus);
-            break;
-        case 2:
-            LOGSTRING2("RSamplerController - plugin loading aborted: %d", aStatus);
-            break;
-        case 3:
-            LOGSTRING2("RSamplerController - all plugins loaded: %d", aStatus);
-            TRAPD(err, iPluginLoader->SortPluginsL(iPluginArray));
-            if(err != KErrNone)
-                {
-                LOGTEXT(_L("Sampler controller unable to sort plugins"));
-                }
-            
-            // call engine to finalize the startup
-            TRAPD(result, iObserver->HandleSamplerControllerReadyL(););
-            if(result != KErrNone)
-                {
-                LOGTEXT(_L("Failed to notify engine"));
-                }
-            break;
-        case 4:
-            LOGSTRING2("RSamplerController - error in loading plugins: %d", aStatus);
-            break;
-        default:
-            break;
-        }
-    }
-
-
-CSamplerPluginInterface* CSamplerController::GetPlugin(TUid aUid)
-	{
-	LOGTEXT(_L("RSamplerController::GetPlugin - entry"));
-	// check that plugin array contains samplers
-	if( iPluginArray && iPluginArray->Count() > 0 )
-	  {
-    	for(TInt i=0;i<iPluginArray->Count();i++)
-    		{
-	    	CSamplerPluginInterface* plugin = iPluginArray->At(i);
-	    	TUid uid = plugin->Id(-1);	// get parent uid first
-	    	if(uid == aUid)
-	    		{
-	    		LOGTEXT(_L("CSamplerController::GetPlugin() - main plug-in found!"));
-    			return plugin;
-				} 
-
-            if(plugin->SubId(aUid) != KErrNotFound)
-                {
-                LOGTEXT(_L("CSamplerController::GetPlugin() - subsampler found!"));
-                return plugin;
-                }
-    		}
-		}	
-	LOGTEXT(_L("CSamplerController::GetPlugin() - No plug-in found for UID"));
-
-	return (CSamplerPluginInterface*)0;
-	}
-
-// start user mode samplers
-void CSamplerController::StartSamplerPluginsL()
-    {
-    CSamplerPluginInterface* plugin = NULL;
-
-	if( iPluginArray )
-		{
-		TInt count(iPluginArray->Count());
-	
-		for(TInt i(0);i<count;i++)
-			{
-			plugin = iPluginArray->At(i);
-			// check if some error received when starting profiling
-			TRAPD(err, plugin->ResetAndActivateL(iStream));
-			LOGSTRING2(" RSamplerController::StartSamplerPlugin - plugin activated (0x%X)", plugin->Id(-1));  
-			if( err != KErrNone)
-				{
-				LOGSTRING2(" RSamplerController::StartSamplerPlugin - error %d", i);  
-				// handle received error, need to update UI!
-				iObserver->HandleError(err);
-				}
-            }
-	    }
-    }
-
-// stop user mode samplers
-TInt CSamplerController::StopSamplerPlugins()
-	{
-	TInt count(0);
-
-	if( iPluginArray && iPluginArray->Count() > 0 )
-		{
-		TInt i(0);
-		CSamplerPluginInterface* plugin = NULL;
-		// stop kernel mode samplers
-    	for(;i<iPluginArray->Count();i++)
-    		{
-			plugin = iPluginArray->At(i); 
-			TUint32 id = plugin->Id(-1).iUid;
-            LOGSTRING2(" CSamplerController::StopSamplerPlugins - traceId = %d",
-                        id);
-            // stop only started samplers
-            if(plugin->Enabled())
-                {
-                // stop selected plugin
-                plugin->StopSampling();
-                // check if user mode sampler, special flush needed to direct data to stream
-                if(plugin->GetSamplerType() == PROFILER_USER_MODE_SAMPLER)
-                    {
-                    LOGTEXT(_L(" CSamplerController::StopSamplerPlugins - flushing user mode sampler stream"));
-                    plugin->Flush();
-                    }
-                }
-            count++;
-    		}
-		}
-	return count; 	
-	}
-
-// end of file
-
-
-
-
--- a/piprofiler/engine/src/SamplerPluginLoader.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,539 +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 FILES
-#include    "SamplerPluginLoader.h"
-//#include	<piprofiler/EngineUIDs.h>
-#include    <utf.h> // CnvUtfConverter
-#include  	<basched.h>
-
-// CONSTANTS
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::NewL
-//
-// EPOC two-phased constructor
-// ----------------------------------------------------------------------------
-//
-CSamplerPluginLoader* CSamplerPluginLoader::NewL()
-    {
-    CSamplerPluginLoader* self = new( ELeave ) CSamplerPluginLoader;
-    CleanupStack::PushL( self );
-    self->ConstructL( );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::CSamplerPluginLoader
-//
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// ----------------------------------------------------------------------------
-//
-CSamplerPluginLoader::CSamplerPluginLoader() : CActive( EPriorityStandard )
-    {
-    LOGSTRING( "CSamplerPluginLoader()::CSamplerPluginLoader()" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::ConstructL
-//
-// EPOC default constructor can leave.
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::ConstructL( )
-    {
-    LOGSTRING( "CSamplerPluginLoader()::ConstructL()" );
-
-    // get list of implementations
-    CSamplerPluginInterface::ListAllImplementationsL( iImplInfoArray );
-
-    CActiveScheduler::Add( this );
-    }
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::~CSamplerPluginLoader
-//
-// Destructor
-// ----------------------------------------------------------------------------
-//
-CSamplerPluginLoader::~CSamplerPluginLoader()
-    {
-    LOGSTRING( "CSamplerPluginLoader()::~CSamplerPluginLoader()" );
-
-    AbortAsyncLoad();
-
-    Cancel();
-    
-    // reset ECOM implementation info array
-    iImplInfoArray.ResetAndDestroy();   // This is needed
-    iImplInfoArray.Close();
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::LoadAsync
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::LoadAsyncL(CArrayPtrFlat<CSamplerPluginInterface>* aPluginArray )
-    {
-    iPluginArray = aPluginArray;
-
-    // Reset iterator
-    iImplInfoArrayIterator = 0;
-
-    LOGSTRING2( "CSamplerPluginLoader()::Implementation info count: %d",
-        iImplInfoArray.Count() );
-
-    NotifyProgress();
-
-    //Begin CActive asynchronous loop.
-    CompleteOwnRequest();
-    }
-    
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::LoadSyncL
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::LoadSyncL(CArrayPtrFlat<CSamplerPluginInterface>* aPluginArray)
-    {
-    // cancel first active object from loading samplers dynamically
-    Cancel();
-    CSamplerPluginInterface* plugin = NULL;
-    
-    iPluginArray = aPluginArray;
-
-    // Get a list of all implementations, even though we only want one specific
-    // one. There appears to be no way to otherwise extract a specific implementation
-    // info object :(
-    // Search for the implementation that matches aImplementationUid
-    const TInt impCount = iImplInfoArray.Count();
-    for( TInt i=0; i<impCount; i++ )
-        {
-        const CImplementationInformation* info = iImplInfoArray[ i ];
-            {
-            TRAPD(ret, plugin = &CreatePluginInstanceL( *info ); );
-            if( ret == KErrNone )
-                {
-                // Plugin ownership is transfered to iPluginArray
-                InsertPluginInOrderL( plugin, iPluginArray );
-                }
-            else
-                {
-                // Error note is displayed even if plugin is not loaded
-                LOGSTRING2("CSamplerPluginLoader::LoadSyncL() - plugin load failed, error %d", ret);
-                }
-            break;
-            }
-        }
-
-    if  ( plugin == NULL )
-        {
-        User::Leave( KErrNotFound );
-        }
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::AbortAsyncLoad
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::AbortAsyncLoad()
-    {
-    LOGSTRING( "CSamplerPluginLoader()::AbortAsyncLoad()" );
-    Cancel();
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::RunL
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::RunL()
-    {
-    iRunLDebugCount++;
-    LoadNextPluginL();
-
-    // Check if there are still more plugins to be loaded:
-    if ( iImplInfoArrayIterator < iImplInfoArray.Count() )
-        {
-        NotifyProgress();
-        // Continue CActive asynchronous loop.
-        CompleteOwnRequest();
-        }
-    else
-        {
-        // All plugins loaded:
-        LOGSTRING( "CSamplerPluginLoader()::Loading plugins finished." );
-        NotifyFinished();
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-// CScGenreItemConstructionConductor::CompleteOwnRequest
-//
-// Issue request complete notification.
-// ---------------------------------------------------------------------------
-void CSamplerPluginLoader::CompleteOwnRequest()
-    {
-    TRequestStatus* status = &iStatus;
-    User::RequestComplete( status, KErrNone );
-    SetActive();
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::RunError
-// ----------------------------------------------------------------------------
-//
-TInt CSamplerPluginLoader::RunError( TInt aError )
-    {
-    // This method is called when a plugin loading fails.
-    // Always "fake" the return value so that ActiveSchedule
-    // keeps running and later plugins are continued to be loaded.
-    // Check if still plugins to be loaded:
-    LOGTEXT(_L("CSamplerPluginLoader::RunError() - error in loading plugin"));
-    if( iImplInfoArrayIterator < iImplInfoArray.Count() )
-        {
-        NotifyProgress();
-
-        //Continue CActive asynchronous loop.
-        CompleteOwnRequest();
-        }
-    else // All plugins loaded:
-        {
-        NotifyFinished();
-        }
-
-    if ( aError == KLeaveExit )
-        {
-        return KLeaveExit;
-        }
-
-    return KErrNone;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::DoCancel
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::DoCancel()
-    {
-
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::NotifyProgress
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::NotifyProgress()
-    {
-    if( iObserver )
-        {
-        iObserver->HandlePluginLoaded( MSamplerPluginLoadObserver::ESamplerSuccess);
-        }
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::NotifyFinished
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::NotifyFinished()
-    {
-    if( iObserver )
-        {
-        iObserver->HandlePluginLoaded( MSamplerPluginLoadObserver::ESamplerFinished );
-        }
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::SetObserver
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::SetObserver(MSamplerPluginLoadObserver* aObserver)
-    {
-    LOGSTRING2("CSamplerPluginLoader()::Observer set:0x%X", aObserver);
-    iObserver = aObserver;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::ParseToUid
-// Parses a UID from descriptor of form '0xNNNNNNNN' where N is hexadecimal.
-//
-// ----------------------------------------------------------------------------
-//
-TInt CSamplerPluginLoader::ParseToUid( const TDesC8& aSource, TUid& aTarget )
-    {
-    // Remove "0x" from the descriptor if it exists
-    _LIT8(KHexPrefix, "0x");
-
-    TPtrC8 pSource( aSource );
-    const TInt prefixPosition = pSource.Find( KHexPrefix );
-    if  ( prefixPosition != KErrNotFound )
-        {
-        pSource.Set( aSource.Mid( prefixPosition + KHexPrefix().Length() ) );
-        }
-
-    // Parse to integer
-    TLex8 lex( pSource );
-    TUint integer = 0;
-
-    // Parse using TRadix::EHex as radix:
-    const TInt err = lex.Val( integer, EHex );
-    aTarget.iUid = integer;
-
-    if( err != KErrNone )
-        {
-        // If parsing parent UID failed, do not load plugin:
-        LOGSTRING2(
-            "CSamplerPluginLoader()::Parsing parent UID failed. Error code:%d",
-            err );
-        }
-    return err;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::ParseOrderNumber
-//
-//
-// ----------------------------------------------------------------------------
-//
-TInt CSamplerPluginLoader::ParseOrderNumber( const TDesC8& aSource, TInt& aOrderNumber )
-    {
-    // Parse plugin's order number from opaque_data:
-    TLex8 lex( aSource );
-    const TInt orderErr = lex.Val( aOrderNumber );
-    return orderErr;
-    }
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::LoadNextPluginL
-// Iterate through iImplInfoArray. Load the plugin if it is eligible for
-// loading. Loaded plugin is added to iPluginArray. Each time a plugin is
-// loaded, iObserver is notified.
-//
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::LoadNextPluginL()
-    {
-    // Iterate through iImplInfoArray. This loop continues between function
-    // calls. Therefore member variable iImplInfoArrayIterator is used as a
-    // counter. Loop will break when match is found and continues on next RunL.
-    for( ; iImplInfoArrayIterator < iImplInfoArray.Count();  )
-        {
-        const CImplementationInformation* info =
-            iImplInfoArray[ iImplInfoArrayIterator ];
-
-        iImplInfoArrayIterator++;
-
-//        PrintInfoDebug( *info, iImplInfoArrayIterator, iImplInfoArray.Count() );
-        LOGSTRING3("CSamplerPluginLoader() - iImplInfoArrayIterator %d, iImplInfoArray.Count() %d", 
-                iImplInfoArrayIterator, 
-                iImplInfoArray.Count() );
-        
-        // If this plugin is OK -> load it:
-        LOGSTRING2( "CSamplerPluginLoader() %S eligible for parent",
-                &info->DisplayName());
-        CSamplerPluginInterface* plugin = NULL;
-        TInt error(KErrNone);
-        // Create plugin. Trap leave for debugging purposes.
-        TRAP( error, plugin = &CreatePluginInstanceL( *info ); );
-
-        if( error == KErrNone )
-            {
-            // Plugin ownership is transfered to iPluginArray
-            InsertPluginInOrderL( plugin, iPluginArray );
-            }
-        else
-            {
-            // Error note is displayed even if plugin is not loaded
-            LOGSTRING2("CSamplerPluginLoader::LoadNextPluginL() - plugin load failed, error %d", error);
-            }
-        // Wait for next round
-        break;
-        }
-    }
- 
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::CreatePluginInstanceL
-//
-//
-// ----------------------------------------------------------------------------
-//
-
-CSamplerPluginInterface& CSamplerPluginLoader::CreatePluginInstanceL(
-    const CImplementationInformation& aImpInfo )
-    {
-    // Now we can load the plugin
-    const TUid implUid = aImpInfo.ImplementationUid();
-
-    CSamplerPluginInterface* plugin = CSamplerPluginInterface::NewL( implUid , (TAny*)&aImpInfo.DisplayName() );
-    CleanupStack::PushL ( plugin );
-
-    // Parse plugin's order number from opaque_data:
-    TInt orderNumber(0);
-    const TInt orderErr = ParseOrderNumber( aImpInfo.OpaqueData(), orderNumber );
-
-    if  ( orderErr == KErrNone && orderNumber >= 0 )
-        {
-        	plugin->iOrder = orderNumber;
-        }
-    CleanupStack::Pop( plugin ); // CSamplerController is now responsible for this memory.
-
-    return *plugin;
-    }
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::SortPluginsL
-//
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::SortPluginsL(
-        CArrayPtrFlat<CSamplerPluginInterface>* aPlugins )
-    {
-    RPointerArray<CSamplerPluginInterface> plugins;
-    TLinearOrder<CSamplerPluginInterface> order( CSamplerPluginLoader::Compare );
-
-    // Insertion will also order
-    for( TInt i = 0; i < aPlugins->Count(); i++ )
-        {
-        plugins.InsertInOrderL( (*aPlugins)[i], order );
-        }
-
-    // Replace original array content with sorted items
-    aPlugins->Reset();
-    for( TInt i = 0; i < plugins.Count(); i++ )
-        {
-        aPlugins->AppendL( plugins[i] );
-        }
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::Compare
-//
-// Compare two plugins.
-// Precedence:
-// [1. plugin provider category]
-// 2. plugin order number
-// 3. plugin caption
-// Plugin provider gategory is currently disabled (not supported yet).
-// ----------------------------------------------------------------------------
-//
-TInt CSamplerPluginLoader::Compare( const CSamplerPluginInterface& aFirst,
-                               const CSamplerPluginInterface& aSecond )
-    {
-    // compare indexes and sort
-    return CompareIndex( aFirst, aSecond );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::InsertPluginInOrderL
-//
-// ----------------------------------------------------------------------------
-//
-void CSamplerPluginLoader::InsertPluginInOrderL(
-    CSamplerPluginInterface* aPlugin,
-    CArrayPtrFlat<CSamplerPluginInterface>* aPlugins )
-    {
-    CSamplerPluginInterface* comparedPlugin;
-    TInt comparison = 0;
-    TBool inserted = EFalse;
-
-    for( TInt i = 0; i < aPlugins->Count(); i++ )
-        {
-        comparedPlugin = (*aPlugins)[i];
-        // Optimization: do not call time consuming Compare() multiple times!
-        comparison = Compare( *aPlugin, *comparedPlugin );
-        if( comparison < 0 )
-            {
-            aPlugins->InsertL( i, aPlugin );
-            inserted = ETrue;
-            break;
-            }
-        else if( comparison == 0 )
-            {
-            aPlugins->InsertL( i+1, aPlugin );
-            inserted = ETrue;
-            break;
-            }
-        }
-    // Plugin was not before any other plugin - make sure it's appended
-    if( !inserted )
-        {
-        aPlugins->AppendL( aPlugin );
-        }
-
-    #ifdef _GS_PLUGINLOADER_SORTING_TRACES
-        PrintOrderTraces( aPlugins );
-    #endif // _GS_PLUGINLOADER_SORTING_TRACES
-
-    }
-
-// ----------------------------------------------------------------------------
-// CSamplerPluginLoader::CompareIndex
-// ----------------------------------------------------------------------------
-//
-TInt CSamplerPluginLoader::CompareIndex( const CSamplerPluginInterface& aFirst,
-                                    const CSamplerPluginInterface& aSecond )
-    {
-    TInt comparison = KSamplerComparisonEqual;
-    // The plugin having index is before the one not having one
-
-    if( aFirst.iOrder  == KSamplerPluginNotIndexed &&
-        aSecond.iOrder == KSamplerPluginNotIndexed )
-        {
-        // Neither have index -> equal
-        comparison = KSamplerComparisonEqual;
-        }
-    else if( aFirst.iOrder == KSamplerPluginNotIndexed )
-        {
-        // The plugin having index is before the one not having one
-        comparison = KSamplerComparisonAfter;
-        }
-    else if( aSecond.iOrder == KSamplerPluginNotIndexed )
-        {
-        // The plugin having index is before the one not having one
-        comparison = KSamplerComparisonBefore;
-        }
-    else if( aFirst.iOrder < aSecond.iOrder )
-        {
-        // Compare actual index values
-        comparison = KSamplerComparisonBefore;
-        }
-    else if( aFirst.iOrder > aSecond.iOrder )
-        {
-        // Compare actual index values
-        comparison = KSamplerComparisonAfter;
-        }
-    return comparison;
-    }
-
-//  End of File
--- a/piprofiler/engine/src/WriterController.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,283 +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 <piprofiler/EngineUIDs.h>
-#include <piprofiler/ProfilerTraces.h>
-
-#include "WriterController.h"
-
-const TInt KMaxWriterPluginCount = 10;
-
-
-CWriterController* CWriterController::NewL(CProfilerSampleStream& aStream)
-    {
-    CWriterController* self = new( ELeave ) CWriterController(aStream);
-    CleanupStack::PushL( self );
-    self->ConstructL( );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-CWriterController::CWriterController(CProfilerSampleStream& aStream) : 
-    iStream(aStream)
-    {
-    }
-
-void CWriterController::ConstructL()
-	{
-	// initiate writer plugin list
-
-	}
-
-
-void CWriterController::InitialiseWriterListL()
-    {
-    // create new writer plugin array
-    iPluginArray = new(ELeave) CArrayPtrFlat<CWriterPluginInterface>( KMaxWriterPluginCount );
-    
-    // create new writer plugin loader
-    iPluginLoader = CWriterPluginLoader::NewL();
-    iPluginLoader->SetObserver( this );
-    iPluginLoader->LoadAsyncL( iPluginArray );
-
-    LOGTEXT(_L(" RWriterController::InitialiseWriterList - exit"));	
-    }
-
-CWriterController::~CWriterController()
-    {
-    LOGTEXT(_L("RWriterController::~RWriterController" ));
-    if ( iPluginArray )
-        {
-        // destroy the plugin instances
-        // empty loaded plugins from array
-        for(TInt i(0);i<iPluginArray->Count();i++)
-            {
-            if(iPluginArray->At(i))
-                {
-                delete iPluginArray->At(i);
-                iPluginArray->At(i) = NULL;
-                }
-            }
-        iPluginArray->Reset();
-        delete iPluginArray;
-        iPluginArray = NULL;
-        }
-    
-    if ( iPluginLoader )
-        {
-        iPluginLoader->AbortAsyncLoad();
-        delete iPluginLoader;
-        iPluginLoader = NULL;
-        }
-
-    }
-
-
-void CWriterController::InitialisePluginStream()
-	{
-	LOGTEXT(_L("RWriterController::InitialisePluginStream - entry"));
-	if( iPluginArray )
-		{
-		TInt pluginCount(iPluginArray->Count());
-	
-		LOGSTRING2("RWriterController::InitialisePluginStream - plugin count %d, searching through", pluginCount);
-	  	for(TInt i=0;i<pluginCount;i++)
-	  	    {
-  			LOGSTRING2("RWriterController::InitialisePluginStream - getting plugin n:o: %d...", i);
-	    	CWriterPluginInterface* plugin = iPluginArray->At(i);
-	  		LOGSTRING2("RWriterController::InitialisePluginStream - writer found, 0x%x, initializing stream...", plugin->Id());
-    		plugin->SetStream(iStream);
-	  		LOGTEXT(_L("RSamplerController::InitialisePluginStream - succeeded!"));
-	  	    }
-	  	}
-	LOGTEXT(_L("RSamplerController::InitialisePluginStream - exit"));
-
-	}
-
-CArrayPtrFlat<CWriterPluginInterface>* CWriterController::GetPluginList()
-    {
-	return iPluginArray;
-    }
-
-void CWriterController::HandlePluginLoaded( KWriterPluginLoaderStatus aStatus )
-    {
-    
-    switch(aStatus)
-        {
-        case 0:
-            LOGSTRING2("RWriterController - one plugin loaded, status: %d", aStatus);
-            break;
-        case 1:
-            LOGSTRING2("RWriterController - a plugin load failed: %d", aStatus);
-            break;
-        case 2:
-            LOGSTRING2("RWriterController - plugin loading aborted: %d", aStatus);
-            break;
-        case 3:
-            LOGSTRING2("RWriterController - all plugins loaded: %d", aStatus);
-            // set stream after all loaded writer plugins
-            InitialisePluginStream();
-            break;
-        case 4:
-            LOGSTRING2("RWriterController - error in loading plugins: %d", aStatus);
-            break;
-        default:
-            break;
-        }
-    }
-
-
-
-TUid CWriterController::GetPluginUID(TInt traceId)
-    {
-	LOGSTRING2(" RWriterController::GetPluginUID - checking UID for traceId = %d",traceId);	
-	// this part has to be changed for each new writer
-
-    if( iPluginArray && iPluginArray->Count() > 0 )
-        {
-        for(TInt i=0;i<iPluginArray->Count();i++)
-            {
-            CWriterPluginInterface* plugin = iPluginArray->At(i); 
-            if(plugin->Id().iUid == traceId)
-                {
-                LOGSTRING2(" RWriterController::GetPluginUID - got: 0x%X",plugin->Id());	
-                return plugin->Id();
-                }
-            }
-        }	
-	return KWriterNoneSelected;
-
-    }
-
-CWriterPluginInterface* CWriterController::GetActiveWriter()
-    {
-    CWriterPluginInterface* plugin = NULL;
-
-	if( iPluginArray )
-		{
-		TInt count(iPluginArray->Count());
-		
-		for(TInt i=0;i<count;i++)
-			{
-			plugin = iPluginArray->At(i); 
-			if(plugin->GetEnabled())
-				{
-				return plugin;
-				}
-			}
-		}
-
-    return (CWriterPluginInterface*)0;
-    }
-
-TUint32 CWriterController::GetWriterType(TUint32 writerId)
-    {
-    TUid id;
-    
-    id = this->GetPluginUID(writerId);
-    
-    if(id != KWriterNoneSelected)
-        return GetPlugin(id)->GetWriterType();
-    else
-        return 0;
-    }
-
-CWriterPluginInterface* CWriterController::GetPlugin(TUid aUid)
-    {
-    if( iPluginArray && iPluginArray->Count() > 0 )
-        {
-        for(TInt i=0;i<iPluginArray->Count();i++)
-            {
-            CWriterPluginInterface* plugin = iPluginArray->At(i); 
-            // check if searched uid found
-            if(plugin->Id().iUid == aUid.iUid)
-                {
-                // return pointer to found plugin
-                return plugin;
-                }
-            }
-        }
-    // return null plugin
-	return (CWriterPluginInterface*)0;
-    }
-
-TInt CWriterController::StartSelectedPlugin()
-	{
-	LOGTEXT(_L("RWriterController::StartSelectedPlugin - entry"));
-	
-    CWriterPluginInterface* plugin = GetActiveWriter();
-    
-    if(plugin)
-        {
-        return plugin->Start();
-		}
-    
-	LOGTEXT(_L("RWriterController::StartSelectedPlugin - exit"));
-	return KErrNotFound;
-	}
-
-void CWriterController::StopSelectedPlugin()
-	{
-	LOGTEXT(_L("RWriterController::StopSelectedPlugin - entry"));
-    
-    CWriterPluginInterface* plugin = GetActiveWriter();
-    
-	if(plugin)
-		{
-		plugin->Stop();
-		}
-	LOGTEXT(_L("RWriterController::StopSelectedPlugin - exit"));
-	}
-
-/** Set selected plugin active **/
-void CWriterController::SetPluginActive(TUid uid, const TWriterPluginValueKeys aKey)
-    {
-	CWriterPluginInterface* plugin = NULL;
-	_LIT(KDummy, "");
-	TBuf<1> buf;
-	buf.Append(KDummy);
-
-	for(TInt i(0);i<iPluginArray->Count();i++)
-	    {
-	    plugin = iPluginArray->At(i);
-	    if(plugin->Id().iUid == uid.iUid)
-	        {
-	        plugin->SetValue(aKey, buf);
-	        }
-	    else
-	        {
-	        plugin->SetValue(EWriterPluginDisabled, buf);
-	        }
-	    }
-    }
-
-TInt CWriterController::SetPluginSettings(TUid aUid, TDes& aDes)
-    {
-	LOGSTRING2(" CWriterController::SetPluginSettings, traceId = 0x%X", aUid.iUid);	
-	GetPlugin(aUid)->SetValue(EWriterPluginSettings, aDes);
-	return KErrNone;
-    }
-
-/** Get settings for a specific plugin **/
-void CWriterController::GetPluginSettings(TUid uid, TDes& aVal)
-    {
-	GetPlugin(uid)->GetValue(EWriterPluginSettings, aVal);
-    }
-
-
-// end of file
--- a/piprofiler/engine/src/WriterPluginLoader.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,565 +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 FILES
-#include    "WriterPluginLoader.h"
-//#include	<piprofiler/EngineUIDs.h>
-#include    <utf.h> // CnvUtfConverter
-#include  	<basched.h>
-
-// constants
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::NewL
-//
-// EPOC two-phased constructor
-// ----------------------------------------------------------------------------
-//
-CWriterPluginLoader* CWriterPluginLoader::NewL()
-    {
-    CWriterPluginLoader* self = new( ELeave ) CWriterPluginLoader;
-    CleanupStack::PushL( self );
-    self->ConstructL( );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::CWriterPluginLoader
-//
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// ----------------------------------------------------------------------------
-//
-CWriterPluginLoader::CWriterPluginLoader() : CActive( EPriorityStandard )
-    {
-    LOGTEXT(_L("CWriterPluginLoader()::CWriterPluginLoader()" ));
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::ConstructL
-//
-// EPOC default constructor can leave.
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::ConstructL( )
-    {
-    LOGTEXT(_L("CWriterPluginLoader()::ConstructL()" ));
-    
-    // get list of implementations
-    CWriterPluginInterface::ListAllImplementationsL( iImplInfoArray );
-    
-    CActiveScheduler::Add( this );
-    }
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::~CWriterPluginLoader
-//
-// Destructor
-// ----------------------------------------------------------------------------
-//
-CWriterPluginLoader::~CWriterPluginLoader()
-    {
-    LOGTEXT(_L("CWriterPluginLoader()::~CWriterPluginLoader()") );
-
-    AbortAsyncLoad();
-
-    Cancel();
-
-    // reset ECOM implementation info array
-    iImplInfoArray.ResetAndDestroy(); // This is needed
-    iImplInfoArray.Close();
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::LoadAsync
-//
-//
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::LoadAsyncL( CArrayPtrFlat<CWriterPluginInterface>* aPluginArray )
-    {
-    iPluginArray = aPluginArray;
-    
-    // Reset iterator:
-    iImplInfoArrayIterator = 0;
-
-    LOGSTRING2( "CWriterPluginLoader()::Implementation info count: %d",
-        iImplInfoArray.Count() );
-
-    NotifyProgress();
-
-    //Begin CActive asynchronous loop.
-    CompleteOwnRequest();
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::LoadSyncL
-//
-//
-// ----------------------------------------------------------------------------
-//
-CWriterPluginInterface& CWriterPluginLoader::LoadSyncL( TUid aImplementationUid )
-    {
-    Cancel();
-    CWriterPluginInterface* plugin = NULL;
-
-    // Get a list of all implementations, even though we only want one specific
-    // one. There appears to be no way to otherwise extract a specific implementation
-    // info object :(
-    // Search for the implementation that matches aImplementationUid
-    const TInt impCount = iImplInfoArray.Count();
-    for( TInt i=0; i<impCount; i++ )
-        {
-        const CImplementationInformation* info = iImplInfoArray[ i ];
-        if  ( info->ImplementationUid() == aImplementationUid )
-            {
-            TRAPD(ret, plugin = &CreatePluginInstanceL( *info ); );
-            if( ret == KErrNone )
-                {
-                // Plugin ownership is transfered to iPluginArray
-                InsertPluginInOrderL( plugin, iPluginArray );
-                }
-            else
-                {
-                // Error note is displayed even if plugin is not loaded
-                LOGSTRING2("CWriterPluginLoader::LoadSyncL() - plugin load failed, error %d", ret);
-                }
-            break;
-            }
-        }
-
-    if  ( plugin == NULL )
-        {
-        User::Leave( KErrNotFound );
-        }
-    return *plugin;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::AbortAsyncLoad
-//
-//
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::AbortAsyncLoad()
-    {
-    LOGTEXT(_L("CWriterPluginLoader()::AbortAsyncLoad()" ));
-    Cancel();
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::RunL
-//
-//
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::RunL()
-    {
-    iRunLDebugCount++;
-    LoadNextPluginL();
-
-    // Check if there are still more plugins to be loaded:
-    if ( iImplInfoArrayIterator < iImplInfoArray.Count() )
-        {
-        NotifyProgress();
-        // Continue CActive asynchronous loop.
-        CompleteOwnRequest();
-        }
-    else
-        {
-        // All plugins loaded:
-        LOGTEXT(_L("CWriterPluginLoader()::Loading plugins finished." ));
-        NotifyFinished();
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-// CScGenreItemConstructionConductor::CompleteOwnRequest
-//
-// Issue request complete notification.
-// ---------------------------------------------------------------------------
-void CWriterPluginLoader::CompleteOwnRequest()
-    {
-    TRequestStatus* status = &iStatus;
-    User::RequestComplete( status, KErrNone );
-    SetActive();
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::RunError
-//
-//
-// ----------------------------------------------------------------------------
-//
-TInt CWriterPluginLoader::RunError( TInt aError )
-    {
-    // This method is called when a plugin loading fails.
-    // Always "fake" the return value so that ActiveSchedule
-    // keeps running and later plugins are continued to be loaded.
-    // Check if still plugins to be loaded:
-    if( iImplInfoArrayIterator < iImplInfoArray.Count() )
-        {
-        NotifyProgress();
-
-        //Continue CActive asynchronous loop.
-        CompleteOwnRequest();
-        }
-    else // All plugins loaded:
-        {
-        NotifyFinished();
-        }
-
-    if ( aError == KLeaveExit )
-        {
-        return KLeaveExit;
-        }
-
-    return KErrNone;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::DoCancel
-//
-//
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::DoCancel()
-    {
-
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::NotifyProgress
-//
-//
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::NotifyProgress()
-    {
-    if( iObserver )
-        {
-        iObserver->HandlePluginLoaded( MWriterPluginLoadObserver::EWriterSuccess);
-        }
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::NotifyFinished
-//
-//
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::NotifyFinished()
-    {
-    if( iObserver )
-        {
-        iObserver->HandlePluginLoaded( MWriterPluginLoadObserver::EWriterFinished );
-        }
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::SetObserver
-//
-//
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::SetObserver(MWriterPluginLoadObserver* aObserver)
-    {
-    LOGSTRING2("CWriterPluginLoader()::Observer set:0x%X", aObserver);
-    iObserver = aObserver;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::ParseToUid
-// Parses a UID from descriptor of form '0xNNNNNNNN' where N is hexadecimal.
-//
-// ----------------------------------------------------------------------------
-//
-TInt CWriterPluginLoader::ParseToUid( const TDesC8& aSource, TUid& aTarget )
-    {
-    // Remove "0x" from the descriptor if it exists
-    _LIT8(KHexPrefix, "0x");
-
-    TPtrC8 pSource( aSource );
-    const TInt prefixPosition = pSource.Find( KHexPrefix );
-    if  ( prefixPosition != KErrNotFound )
-        {
-        pSource.Set( aSource.Mid( prefixPosition + KHexPrefix().Length() ) );
-        }
-
-    // Parse to integer
-    TLex8 lex( pSource );
-    TUint integer = 0;
-
-    // Parse using TRadix::EHex as radix:
-    const TInt err = lex.Val( integer, EHex );
-    aTarget.iUid = integer;
-
-    if( err != KErrNone )
-        {
-        // If parsing parent UID failed, do not load plugin:
-        LOGSTRING2(
-            "CWriterPluginLoader()::Parsing parent UID failed. Error code:%d",
-            err );
-        }
-    return err;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::ParseOrderNumber
-//
-//
-// ----------------------------------------------------------------------------
-//
-TInt CWriterPluginLoader::ParseOrderNumber( const TDesC8& aSource, TInt& aOrderNumber )
-    {
-    // Parse plugin's order number from opaque_data:
-    TLex8 lex( aSource );
-    const TInt orderErr = lex.Val( aOrderNumber );
-    return orderErr;
-    }
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::LoadNextPluginL
-// Iterate through iImplInfoArray. Load the plugin if it is eligible for
-// loading. Loaded plugin is added to iPluginArray. Each time a plugin is
-// loaded, iObserver is notified.
-//
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::LoadNextPluginL()
-    {
-    // Iterate through iImplInfoArray. This loop continues between function
-    // calls. Therefore member variable iImplInfoArrayIterator is used as a
-    // counter. Loop will break when match is found and continues on next RunL.
-    for( ; iImplInfoArrayIterator < iImplInfoArray.Count();  )
-        {
-        const CImplementationInformation* info =
-            iImplInfoArray[ iImplInfoArrayIterator ];
-
-        iImplInfoArrayIterator++;
-
-        // If this plugin is OK -> load it:
-        LOGSTRING2( "CWriterPluginLoader() %S eligible for parent",
-                &info->DisplayName() );
-        CWriterPluginInterface* plugin = NULL;
-        TInt error(KErrNone);
-        // Create plugin. Trap leave for debugging purposes.
-        TRAP( error, plugin = &CreatePluginInstanceL( *info ); );
-        if( error == KErrNone )
-            {
-            // Plugin ownership is transfered to iPluginArray
-            InsertPluginInOrderL( plugin, iPluginArray );
-            }
-        else
-            {
-            LOGSTRING2("CWriterPluginLoader::LoadNextPluginL() - plugin load failed, error %d", error);
-            }
-        // Wait for next round
-        break;
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::CreatePluginInstanceL
-//
-//
-// ----------------------------------------------------------------------------
-//
-
-CWriterPluginInterface& CWriterPluginLoader::CreatePluginInstanceL(
-    const CImplementationInformation& aImpInfo )
-    {
-    // Now we can load the plugin
-    const TUid implUid = aImpInfo.ImplementationUid();
-
-    CWriterPluginInterface* plugin = CWriterPluginInterface::NewL( implUid , (TAny*)&aImpInfo.DisplayName() );
-    CleanupStack::PushL ( plugin );
-   
-    TInt orderNumber(0);
-    const TInt orderErr = ParseOrderNumber( aImpInfo.OpaqueData(), orderNumber );
-    
-    if  ( orderErr == KErrNone && orderNumber >= 0 )
-        {
-        plugin->iOrder = orderNumber;
-        }
-
-    CleanupStack::Pop( plugin ); // CWriterController is now responsible for this memory.
-
-    return *plugin;
-    }
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::SortPluginsL
-//
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::SortPluginsL(
-        CArrayPtrFlat<CWriterPluginInterface>* aPlugins )
-    {
-    RPointerArray<CWriterPluginInterface> plugins;
-    TLinearOrder<CWriterPluginInterface> order( CWriterPluginLoader::Compare );
-
-    // Insertion will also order
-    for( TInt i = 0; i < aPlugins->Count(); i++ )
-        {
-        plugins.InsertInOrderL( (*aPlugins)[i], order );
-        }
-
-    // Replace original array content with sorted items
-    aPlugins->Reset();
-    for( TInt i = 0; i < plugins.Count(); i++ )
-        {
-        aPlugins->AppendL( plugins[i] );
-        }
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::Compare
-//
-// Compare two plugins.
-// Precedence:
-// [1. plugin provider category]
-// 2. plugin order number
-// 3. plugin caption
-// Plugin provider gategory is currently disabled (not supported yet).
-// ----------------------------------------------------------------------------
-//
-TInt CWriterPluginLoader::Compare( const CWriterPluginInterface& aFirst,
-                               const CWriterPluginInterface& aSecond )
-    {
-    return CompareIndex( aFirst, aSecond );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::InsertPluginInOrderL
-//
-// ----------------------------------------------------------------------------
-//
-void CWriterPluginLoader::InsertPluginInOrderL(
-    CWriterPluginInterface* aPlugin,
-    CArrayPtrFlat<CWriterPluginInterface>* aPlugins )
-    {
-    CWriterPluginInterface* comparedPlugin;
-    TInt comparison = 0;
-    TBool inserted = EFalse;
-
-    for( TInt i = 0; i < aPlugins->Count(); i++ )
-        {
-        comparedPlugin = (*aPlugins)[i];
-        // Optimization: do not call time consuming Compare() multiple times!
-        comparison = Compare( *aPlugin, *comparedPlugin );
-        if( comparison < 0 )
-            {
-            aPlugins->InsertL( i, aPlugin );
-            inserted = ETrue;
-            break;
-            }
-        else if( comparison == 0 )
-            {
-            aPlugins->InsertL( i+1, aPlugin );
-            inserted = ETrue;
-            break;
-            }
-        }
-    // Plugin was not before any other plugin - make sure it's appended
-    if( !inserted )
-        {
-        aPlugins->AppendL( aPlugin );
-        }
-
-    #ifdef _GS_PLUGINLOADER_SORTING_TRACES
-        PrintOrderTraces( aPlugins );
-    #endif // _GS_PLUGINLOADER_SORTING_TRACES
-
-    }
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::CompareIndex
-//
-//
-// ----------------------------------------------------------------------------
-//
-
-TInt CWriterPluginLoader::CompareIndex( const CWriterPluginInterface& aFirst,
-                                    const CWriterPluginInterface& aSecond )
-    {
-    TInt comparison = KWriterComparisonEqual;
-    // The plugin having index is before the one not having one
-
-    if( aFirst.iOrder  == KWriterPluginNotIndexed &&
-        aSecond.iOrder == KWriterPluginNotIndexed )
-        {
-        // Neither have index -> equal
-        comparison = KWriterComparisonEqual;
-        }
-    else if( aFirst.iOrder == KWriterPluginNotIndexed )
-        {
-        // The plugin having index is before the one not having one
-        comparison = KWriterComparisonAfter;
-        }
-    else if( aSecond.iOrder == KWriterPluginNotIndexed )
-        {
-        // The plugin having index is before the one not having one
-        comparison = KWriterComparisonBefore;
-        }
-    else if( aFirst.iOrder < aSecond.iOrder )
-        {
-        // Compare actual index values
-        comparison = KWriterComparisonBefore;
-        }
-    else if( aFirst.iOrder > aSecond.iOrder )
-        {
-        // Compare actual index values
-        comparison = KWriterComparisonAfter;
-        }
-    return comparison;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CWriterPluginLoader::GetDocument
-//
-//
-// ----------------------------------------------------------------------------
-//
-/*
-CWriterBaseDocument* CWriterPluginLoader::GetDocument()
-    {
-    CWriterBaseDocument* document = static_cast<CWriterBaseDocument*>( iAppUi->Document() );
-    return document;
-    }
-*/
-
-//  End of File
Binary file piprofiler/group/ReleaseNotes_PIProfiler.txt has changed
--- a/piprofiler/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +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:  
-*
-*/
-//PRJ_PLATFORMS
-//DEFAULT ARMV5SMP
-
-#include <platform_paths.hrh>
-
-#include "../piprofiler_plat/group/bld.inf"
-#include "../engine/group/bld.inf"
-#include "../plugins/GeneralsPlugin/group/bld.inf"
-#include "../plugins/BUPplugin/group/bld.inf"
-#include "../plugins/DebugOutputWriterPlugin/group/bld.inf"
-#include "../plugins/DiskWriterPlugin/group/bld.inf"
-
-#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
-    #include "../plugins/PWRPlugin/group/bld.inf"
-#endif
-
-PRJ_EXPORTS
-#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3 )
-    ../rom/piprofiler.iby CORE_IBY_EXPORT_PATH(tools,piprofiler.iby)
-#else
-    ../rom/piprofiler_s2.iby CORE_IBY_EXPORT_PATH(tools,piprofiler.iby)
-#endif
-../rom/piprofiler_ldd.iby CORE_IBY_EXPORT_PATH(tools/rom,piprofiler_ldd.iby)
-
--- a/piprofiler/piprofiler_plat/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +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:  File that exports the files belonging to 
-:                PIProfilerAPI
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-
-PRJ_EXPORTS
-../inc/ProfilerTraces.h                   OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerTraces.h)
-../inc/ProfilerVersion.h                  OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerVersion.h)
-../inc/ProfilerConfig.h                   OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerConfig.h)
-../inc/ProfilerAttributes.h               OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerAttributes.h)
-../inc/ProfilerGenericClassesUsr.h        OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerGenericClassesUsr.h)
-../inc/ProfilerGenericClassesUsr.inl      OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerGenericClassesUsr.inl)
-../inc/ProfilerGenericClassesKrn.h        OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerGenericClassesKrn.h)
-../inc/ProfilerGenericClassesKrn.inl      OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerGenericClassesKrn.inl)
-../inc/ProfilerGenericClassesCommon.h     OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerGenericClassesCommon.h)
-../inc/ProfilerEngineAPI.h 				  OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerEngineAPI.h)
-../inc/EngineUIDs.h                       OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/EngineUIDs.h)
-../inc/PluginDriver.h                     OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/PluginDriver.h)
-../inc/PluginDriver.inl                   OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/PluginDriver.inl)
-../inc/PluginSampler.h                    OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/PluginSampler.h)
-../inc/ProfilerSession.h                  OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerSession.h)
-../inc/SamplerPluginInterface.h           OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/SamplerPluginInterface.h)
-../inc/SamplerPluginInterface.inl         OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/SamplerPluginInterface.inl)
-../inc/WriterPluginInterface.h            OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/WriterPluginInterface.h)
-../inc/WriterPluginInterface.inl          OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/WriterPluginInterface.inl)
-../inc/ProfilerEngineStatusChecker.h      OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerEngineStatusChecker.h)
-../inc/ProfilerEngineStatusChecker.inl    OS_LAYER_PLATFORM_EXPORT_PATH(piprofiler/ProfilerEngineStatusChecker.inl)
--- a/piprofiler/piprofiler_plat/inc/EngineUIDs.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +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 ENGINEUIDS_H
-#define ENGINEUIDS_H
-
-#include <e32cmn.h>
-
-// No item is selected in the container's listbox
-const TUid KSamplerNoneSelected = { 0x00000001 };
-const TUid KWriterNoneSelected = { 0x00000002 };
-
-#endif // ENGINEUIDS_H
-// End of File
--- a/piprofiler/piprofiler_plat/inc/PluginDriver.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +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 <piprofiler/ProfilerGenericClassesKrn.h>
-
-const TInt KMinRate = 10;
-const TInt KMaxRate = 1000;
-
-enum TState{ERunning, EStopping, EStopped};
-
-const TUid KGppPropertyCat={0x20201F70};
-enum TGppPropertyKeys
-	{
-	EGppPropertySyncSampleNumber
-	};
-
-
-/*
- *
- *
- *	Class DPluginDriver definition, inherited by sampler implementations except GPP
- *
- *
- */
-
-class DPluginDriver : public DLogicalChannel
-{
-
-public:
-	DPluginDriver();
-	~DPluginDriver();
-
-public:	
-	TInt					ProcessStreamReadCancel();
-
-	TInt					StopSampling();
-
-private:
-	TInt					ProcessPrintStreamRequest(TDesC8* aDes/*,TRequestStatus* aStatus*/);
-	
-	void 					FastPrintf(TDesC8* aDes);
- 
-public:
-	DThread*				iClient;
-
-	// property and value; 
-	// GPP sampler start time, needed to set other samplers in sync
-	RPropertyRef 			iSampleStartTimeProp;
-	TInt					iSampleStartTime;
-	TUint32 				iSyncOffset;		// offset from the start
-	
-	
-	TUint32					sampleRunning;
-	const TUint*			iInterruptStack;
-	TState					iState;
-	TInt					doingDfc;
-
-	// request status objects for requests
-	TRequestStatus*			iEndRequestStatus;
-	TRequestStatus*			iStreamReadCancelStatus;
-
-	// sample stream object used in stream mode
-	DProfilerSampleStream		iSampleStream;
-
-	// just for testing
-	TUint32*				stackTop;
-
-};
-
-#include <piprofiler/PluginDriver.inl>
--- a/piprofiler/piprofiler_plat/inc/PluginDriver.inl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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:  
-*
-*/
-
-
-//
-// LDD for thread time profiling
-//
-
-#include <piprofiler/ProfilerConfig.h>
-#include <piprofiler/ProfilerVersion.h>
-
-
-#include <kern_priv.h>
-#include <sproperty.h>
-
-#include <piprofiler/PluginSampler.h>
-
-
-/*
- *
- *
- *	Class DPluginDriver implementation
- *
- *
- */
-inline DPluginDriver::DPluginDriver() //: iSubsRequest(&HandleSubsComplete, this)
-	{
-    //iClientProcess = &Kern::CurrentProcess();
-	}
-inline DPluginDriver::~DPluginDriver()
-	{
-	
-	}
-
-/*
- *	Methods for controlling stream read option
- */
- 
-inline TInt DPluginDriver::ProcessStreamReadCancel()
-{
-	return KErrNone;
-}
-
-/*
- *	Mark traces active or inactive, this can be done
- *	only if sampling is not running
- */
-
-inline TInt DPluginDriver::StopSampling()
-{
-	if(this->iState == ERunning)
-	{
-		this->iState = EStopping;
-		return KErrNone;
-	}
-	else
-	{
-		return KErrGeneral;
-	}
-}
-
-
-
--- a/piprofiler/piprofiler_plat/inc/PluginSampler.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +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 __PLUGINSAMPLER_H__
-#define __PLUGINSAMPLER_H__
-
-/*
- * The user-interface to the sampling device driver sued by the profiling engine
- */
-//	#include <piprofiler/ProfilerConfig.h>
-//	#include <piprofiler/ProfilerVersion.h>	// versions removed from ProfilerConfig.h
-
-#ifndef __KERNEL_MODE__
-#include <utf.h>
-#endif
-
-/*
- *	Forward declarations
- */
-class TBapBuf;
-
-/**
- * A minimal capabilities class for the Sampling device.
- * It just returns the version number.
- */
-class TCapsSamplerV01
-	{
-public:
-	TVersion	iVersion;
-	};
-
-
-const TInt KMinDelay = 1;
-const TInt KMaxDelay = 10000;
-
-/**
- * The user device driver class for controlling the plugin sampler.
- */
-
-class RPluginSampler :  public RBusLogicalChannel
-{	
-	friend class DPluginDriver;
-	public:
-		enum TControl
-		{
-			EOutputSettingsForTrace,
-			EMarkTraceActive,
-			EMarkTraceInactive,
-			ESample,
-			EStartSampling,
-			EGetSampleTime,
-			EGetSamplerVersion,
-			EStopAndWaitForEnd,
-			ESetSamplingPeriod,
-			EAdditionalTraceSettings,
-			EAdditionalTraceSettings2,
-			EAdditionalTraceSettings3,
-			EAdditionalTraceSettings4,
-			//EPrintTraces,
-			ECancelStreamRead,
-			ERequestFillThisStreamBuffer,
-			ERequestPrintStreamBuffer,
-			ETest
-		};
-
-	public:
-		#ifndef __KERNEL_MODE__
-		
-		inline ~RPluginSampler();
-			
-		/**
-		 * 
-		 * Methods for controlling the sampler device
-		 * 
-		 **/
-		/** Open a channel to the sampling device **/
-		virtual TInt Open() = 0;
-
-		/** Set sampling period for sampler */
-		inline void SetSamplingPeriod(TInt samplerId, TInt settings);
-		
-		/** Set additional trace settings **/
-		inline void AdditionalSettingsForTrace(TInt samplerId,TInt settings);
-		inline void AdditionalSettingsForTrace2(TInt samplerId,TInt settings);
-		inline void AdditionalSettingsForTrace3(TInt samplerId,TInt settings);
-		inline void AdditionalSettingsForTrace4(TInt samplerId,TInt settings);
-		
-		/** Mark trace active **/
-		inline void MarkTraceActive(TUint32 id);
-
-		/** Mark trace inactive **/
-		inline void MarkTraceInactive(TUint32 id);
-
-		/** Sample command to kernel LDD**/
-		inline void Sample();
-		
-		/** Start tracing **/
-		inline void StartSampling();
-
-		/** Stop tracing **/
-		inline void StopSampling();
-
-		/** Get current sampling time **/
-		inline TUint32 GetSampleTime();
-
-		/** Get sampler version as descriptor **/
-		virtual void GetSamplerVersion(TDes*);
-
-		/** Get next filled buffer in stream mode **/
-		void GetNextbuffer( );
-
-		/** Request stream read **/
-		void FillThisStreamBuffer(TBapBuf* aBuffer, TRequestStatus& aStatus);
-
-		/** Request print buffer**/
-		void PrintStreamBuffer(TDesC16* aBuffer);
-		
-		/** Run test case **/
-		inline void Test(TUint32 testCase);
-
-		#endif	// !__KERNEL_MODE__	
-};
-
-
-#ifndef __KERNEL_MODE__
-inline RPluginSampler::~RPluginSampler()
-{
-}
-
-inline void RPluginSampler::AdditionalSettingsForTrace(TInt samplerId,TInt settings)
-	{
-	DoControl(EAdditionalTraceSettings,
-			reinterpret_cast<TAny*>(samplerId),
-			reinterpret_cast<TAny*>(settings));
-	}
-
-inline void RPluginSampler::AdditionalSettingsForTrace2(TInt samplerId,TInt settings)
-	{
-	DoControl(EAdditionalTraceSettings2,
-			reinterpret_cast<TAny*>(samplerId),
-			reinterpret_cast<TAny*>(settings));
-	}
-
-inline void RPluginSampler::AdditionalSettingsForTrace3(TInt samplerId,TInt settings)
-	{
-	DoControl(EAdditionalTraceSettings3,
-			reinterpret_cast<TAny*>(samplerId),
-			reinterpret_cast<TAny*>(settings));
-	}
-
-inline void RPluginSampler::AdditionalSettingsForTrace4(TInt samplerId,TInt settings)
-	{
-	DoControl(EAdditionalTraceSettings4,
-			reinterpret_cast<TAny*>(samplerId),
-			reinterpret_cast<TAny*>(settings));
-	}
-
-inline void RPluginSampler::SetSamplingPeriod(TInt samplerId, TInt settings)
-	{
-	DoControl(ESetSamplingPeriod, 
-			reinterpret_cast<TAny*>(samplerId),
-			reinterpret_cast<TAny*>(settings));
-	}
-
-
-inline void RPluginSampler::MarkTraceActive(TUint32 id)
-{
-		DoControl(EMarkTraceActive, reinterpret_cast<TAny*>(id));
-}
-
-inline void RPluginSampler::MarkTraceInactive(TUint32 id)
-{
-		DoControl(EMarkTraceInactive, reinterpret_cast<TAny*>(id));
-}
-
-inline void RPluginSampler::Sample()
-	{
-	DoControl(ESample);
-	}
-
-inline void RPluginSampler::StartSampling()
-{
-	// at first, start the kernel side samplers
-	DoControl(EStartSampling);
-}
-
-inline void RPluginSampler::StopSampling()
-{
-	// stop the device driver and the kernel mode samplers
-	TRequestStatus status;
-	status = KRequestPending;
-	DoRequest(EStopAndWaitForEnd,status);
-	User::WaitForRequest(status);
-}
-
-inline TUint32 RPluginSampler::GetSampleTime()
-{
-	TUint32* sampleTime = new TUint32;
-
-	DoControl(EGetSampleTime,reinterpret_cast<TAny*>(sampleTime));
-	TUint32 value = *sampleTime;
-	delete sampleTime;
-
-	return value;
-}
-
-inline void RPluginSampler::GetSamplerVersion(TDes* aDes)
-{
-	TBuf8<16> buf;
-	DoControl(EGetSamplerVersion,(TAny*)&buf);
-	CnvUtfConverter::ConvertToUnicodeFromUtf8(*aDes,buf);
-}
-
-inline void RPluginSampler::PrintStreamBuffer(TDesC16* aDes) 
-{
-	DoControl(ERequestPrintStreamBuffer,reinterpret_cast<TAny*>(aDes));
-}
-
-inline void RPluginSampler::FillThisStreamBuffer(TBapBuf* aBuffer, TRequestStatus& aStatus)
-{
-	aStatus = KRequestPending;
-	DoRequest(ERequestFillThisStreamBuffer,aStatus,(TAny*)aBuffer);
-
-}
-
-inline void RPluginSampler::Test(TUint32 testCase)
-{
-	DoControl(ETest,reinterpret_cast<TAny*>(testCase));
-}
-
-#endif
-#endif
--- a/piprofiler/piprofiler_plat/inc/ProfilerAttributes.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +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 PROFILER_ATTRIBUTES_H
-#define PROFILER_ATTRIBUTES_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-#include <s32mem.h>
-
-// LITERALS
-_LIT8(KDefaultTraceFilePrefix, "PIProfiler_#");
-_LIT8(KDefaultTraceOutput, "file_system");
-_LIT8(KDefaultTraceFileSaveDrive, "C:\\data\\");
-
-_LIT8(KEnabled, "enabled");
-_LIT8(KBracketOpen, "[");
-_LIT8(KBracketClose, "]");
-_LIT8(KSettingItemSeparator, "=");
-
-// CONSTANTS
-const TUint KPrefixMaxLength = 64;
-const TUint KShortNameMaxLength = 3;
-const TUint KNameMaxLength = 63;
-const TUint KDescriptionMaxLength = 255;
-const TInt KDefaultTimedSamplingPeriod = 60; // Sampling time in seconds 
-/*
- * 
- * TGeneralAttributes class definition, internal settings format
- *  
- */
-class TGeneralAttributes
-    {
-public:
-    TBuf8<KPrefixMaxLength> iTraceOutput;
-    TBuf8<KPrefixMaxLength> iTraceFilePrefix;
-    TBuf8<KPrefixMaxLength> iSaveFileDrive;
-    TInt                    iTimedSamplingPeriod;
-    };
-
-
-
-/*
- * 
- * TSettingItem class definition, internal settings format
- *  
- */
-class TSettingItem
-    {
-public:
-    enum 
-    {
-        ESettingItemTypeInt = 0,
-        ESettingItemTypeBool,
-        ESettingItemTypeHex,
-        ESettingItemTypeText
-    };
-    
-public:
-    TBuf<64>   iSettingText;
-    TUint32    iType;
-    TBuf<128>  iValue;
-    TBuf<256>  iSettingDescription;
-    TBuf<64>   iUIText;
-    };
-/*
- * 
- * TSamplerAttributes class definition, internal settings format
- *  
- */
-class TSamplerAttributes
-    {
-public:
-    // default constructor
-    TSamplerAttributes();
-    // constructor
-    TSamplerAttributes(TInt32 aUid,
-    const TDesC8& aShortName,
-    const TDesC8& aName,
-    const TDesC8& aDescription,
-    TInt aSampleRate,
-    TBool aEnabled,
-    TBool aHidden,
-    TInt aItemCount);
-public:
-    TInt32      iUid;
-    TBuf8<8>    iShortName;     // name of the plugin, short name
-    TBuf8<64>   iName;          // name of the plugin, long name
-    TBuf8<256>  iDescription;   // sampler description, info about HW/SW dependencies etc.
-    TInt        iSampleRate;    // sample rate of the plugin
-    TBool       iEnabled;       // enabled for profiling
-    TBool       iIsHidden;      // hidden, i.e. no start/stop controls
-    TInt        iItemCount;     // plugin specific setting item count
-    
-    // plugin specific settings, plugin implementation dependent
-    TSettingItem    iSettingItem1;
-    TSettingItem    iSettingItem2;
-    TSettingItem    iSettingItem3;
-    TSettingItem    iSettingItem4;
-    TSettingItem    iSettingItem5;
-    TSettingItem    iSettingItem6;
-    };
-
-inline TSamplerAttributes::TSamplerAttributes()
-    {}
-
-inline TSamplerAttributes::TSamplerAttributes(TInt32 aUid,
-            const TDesC8& aShortName,
-            const TDesC8& aName,
-            const TDesC8& aDescription,
-            TInt aSampleRate,
-            TBool aEnabled,
-            TBool aHidden,
-            TInt aItemCount)
-    {
-    iUid = aUid;
-    // check if given short name too long
-    aShortName.Length() > KShortNameMaxLength ? 
-        iShortName.Copy(aShortName.Left(KShortNameMaxLength)) : 
-        iShortName.Copy(aShortName);
-    // check if given name too long
-    aName.Length() > KNameMaxLength ? 
-        iName.Copy(aName.Left(KNameMaxLength)) : 
-        iName.Copy(aName);
-    // check if description too long
-    aDescription.Length() > KDescriptionMaxLength ? 
-        iDescription.Copy(aDescription.Left(KDescriptionMaxLength)) : 
-        iDescription.Copy(aDescription);
-    iSampleRate = aSampleRate;
-    iEnabled = aEnabled;
-    iIsHidden = aHidden;
-    iItemCount = aItemCount;
-    }
-
-#endif
--- a/piprofiler/piprofiler_plat/inc/ProfilerConfig.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +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 PI_PROFILER_CONFIG_H
-#define PI_PROFILER_CONFIG_H
-
-// NCP release process will move the PIProfiler flags as Carbon feature flags
-// where the product responsibles can choose the right settings for PI Profiler
-// compilation.
-
-	/*** NOTE!!! 
-	* 	Uncomment the following definition if compiling the Profiler by your own
-	***/
-	#define PROFILER_SISX
-
-	/*
-	 *
-	 *	Filename and path for the settings file
-	 *  this file is written on application exit and
-	 *	it contains the settings of the profiler application
-	 *
-	 */	
-	 
-//	#define PROFILER_SETTINGS_DRIVE		_L("C:\\")
-//	#define PROFILER_SETTINGS_MAXLENGTH	32
-//	#define PROFILER_SETTINGS_FILENAME	_L("ProfilerSettings.txt")
-	const TInt KProfilerSettingsMaxLength = 32;
-	_LIT(KProfilerSettingsFileName, "PIProfilerSettings.txt");
-
-	// a fix for going through the different drives for settings file
-	#define PROFILER_SETTINGS_DRIVE_COUNT				3
-	#define	PROFILER_SETTINGS_DRIVE_ARRAY 			TBuf<4> settingsDrives[PROFILER_SETTINGS_DRIVE_COUNT];
-	#define PROFILER_DEFINE_SETTINGS_DRIVE(name,number)	settingsDrives[number].Append(_L(name));										
-
-	// change these to reflect the drive names and numbers
-	// the last number must be PROFILER_SETTINGS_DRIVE_COUNT-1
-	#define PROFILER_SETTINGS_DRIVES		PROFILER_DEFINE_SETTINGS_DRIVE("C:\\",0) \
-		PROFILER_DEFINE_SETTINGS_DRIVE("E:\\",1) \
-		PROFILER_DEFINE_SETTINGS_DRIVE("Z:\\",2)			
-		
-	/*
-	 *
-	 *	Locations of PI Profiler binaries
-	 *
-	 */
-
-	#define PROFILERENGINE_EXE_PATH_PRIMARY		_L("C:\\sys\\bin\\PIProfilerEngine.exe")
-	#define PROFILERENGINE_EXE_PATH_SECONDARY	_L("Z:\\sys\\bin\\PIProfilerEngine.exe")
-
-	/*
-	 *
-	 *	PI Profiler tool composition definitions
-	 *
-	 */	
-
-	// sampler codes and names
-	#define		PROFILER_USER_MODE_SAMPLER		123
-	#define		PROFILER_KERNEL_MODE_SAMPLER		321
-	#define		PROFILER_DUMMY_SAMPLER			213
-
-	// old definitions
-	#define 	PROFILER_GENERALS_SAMPLER_ID		100
-	#define 	PROFILER_INTERNALS_SAMPLER_ID		101
-	#define		PROFILER_GPP_SAMPLER_ID			1
-	#define		PROFILER_GFC_SAMPLER_ID			2
-	#define		PROFILER_ITT_SAMPLER_ID			3
-	#define		PROFILER_MEM_SAMPLER_ID			4
-	#define		PROFILER_PRI_SAMPLER_ID			5
-	#define		PROFILER_IRQ_SAMPLER_ID			6
-	#define		PROFILER_BUP_SAMPLER_ID			7
-	#define		PROFILER_SWI_SAMPLER_ID			8
-	#define		PROFILER_TIP_SAMPLER_ID			9
-	#define		PROFILER_PEC_SAMPLER_ID			10
-	#define		PROFILER_PWR_SAMPLER_ID			11
-	#define		PROFILER_IPC_SAMPLER_ID			12
-	#define 	PROFILER_ISA_SAMPLER_ID			13
-    #define     PROFILER_GPU_SAMPLER_ID         14
-
-	// sampler IDs for external, e.g. 3rd party sampler plug-ins
-	#define		PROFILER_EXT1_SAMPLER_ID			15
-	#define		PROFILER_EXT2_SAMPLER_ID			16
-	#define		PROFILER_EXT3_SAMPLER_ID			17
-	#define		PROFILER_EXT4_SAMPLER_ID			18
-	#define		PROFILER_EXT5_SAMPLER_ID			19
-	
-    #define     PROFILER_GPP_SAMPLER_NAME _L("GPP")
-    #define     PROFILER_GFC_SAMPLER_NAME _L("GFC")
-    #define     PROFILER_ITT_SAMPLER_NAME _L("ITT")
-    #define     PROFILER_MEM_SAMPLER_NAME _L("MEM")
-    #define     PROFILER_PRI_SAMPLER_NAME _L("PRI")
-    #define     PROFILER_GPU_SAMPLER_NAME _L("GPU")
-
-#endif
--- a/piprofiler/piprofiler_plat/inc/ProfilerEngineAPI.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +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 PROFILERCONTROLLER_H
-#define PROFILERCONTROLLER_H
-
-#include <e32std.h>
-#include <s32stor.h>
-
-class CProfilerSettings;
-
-class CProfilerEngineAPI : public CBase
-{
-public:
-    enum TProfilerEngineTraceMode 
-        { 
-        EProfilerEngineDebugOutputMode, 
-        EProfilerEngineFileSystemMode 
-        };
-    
-	~CProfilerEngineAPI();
-
-	IMPORT_C static CProfilerEngineAPI* NewL();
-	void ConstructL();
-
-	IMPORT_C void SaveSettings();
-	IMPORT_C void LoadSettings();
-
-	// controlling all sampler plugins
-	IMPORT_C TInt StartProfiling();
-	IMPORT_C TBool StopProfiling();
-	IMPORT_C TInt LaunchProfiler();
-
-	// controlling separate plugins
-	IMPORT_C TInt StartSampler(TUint32 aUid);
-	IMPORT_C TInt StopSampler(TUint32 aUid);
-	IMPORT_C TInt EnableSampler(TUint32 aUid);
-	IMPORT_C TInt DisableSampler(TUint32 aUid);
-	IMPORT_C TInt EnableWriter(TUint32 aUid);
-	IMPORT_C TInt DisableWriter(TUint32 aUid);
-
-	// for meeting the HTI requirements
-	IMPORT_C TInt SetSettings(TUint aSamplerId, TDes& aSettings);
-    IMPORT_C TInt SetTraceMode(TProfilerEngineTraceMode aMode, TDes& aTraceDataStruct);
-    IMPORT_C TInt GetSamplerInfo(TUint aSamplerId, TDes& aCompleteSamplerInfo);
-	
-	// old implementations
-	IMPORT_C TBool GetSamplerVersion(TDes& version);
-
-	IMPORT_C void LeaveProfilerBG(TBool aVal);
-	
-	
-public:
-	TBool DriveIsValidL(const TDesC& drive);
-	IMPORT_C CProfilerSettings* Settings() const;
-
-private:
-
-	CProfilerEngineAPI();
-
-	TInt				FindProcessL();
-private:
-	CProfilerSettings* 	iSettings;
-	
-	RProcess* 			iProfilerProcess;
-
-	TBool 				iProfilerLaunched;
-	
-	TBool 				iLeaveProfilerBG;
-
-	};
-
-#endif
--- a/piprofiler/piprofiler_plat/inc/ProfilerEngineStatusChecker.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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 PROFILER_STATUS_CHECKER_H
-#define PROFILER_STATUS_CHECKER_H
-
-#include <e32std.h>
-#include <e32base.h>
-#include <e32property.h>    // RProperty
-
-// CONSTANTS
-const TUid KEngineStatusPropertyCat = { 0x2001E5AD };
-enum TEnginePropertyKeys
-    {
-    EProfilerEngineStatus = 8
-    };
-
-// CLASS DECLARATIONS
-class MProfilerStatusObserver
-    {
-    public: // Enums
-        enum KProfilerStatus
-            {
-            EIdle = 0,
-            EInitializing,
-            ERunning,
-            EStopping,
-            ERestarting
-            };
-
-    public: // New
-        virtual void HandleProfilerStatusChange(
-                KProfilerStatus aStatus ) = 0;
-        virtual void HandleProfilerErrorL(
-                TInt aError ) = 0;
-    };
-
-
-class CProfilerEngineStatusChecker : public CActive
-    {
-public:
-    inline static CProfilerEngineStatusChecker* CProfilerEngineStatusChecker::NewL();
-    inline ~CProfilerEngineStatusChecker();
-    inline void SetObserver(MProfilerStatusObserver* aObserver);
-    inline TInt GetInitialState();
-private:
-    inline CProfilerEngineStatusChecker();
-    inline void ConstructL();
-    inline void RunL();
-    inline void DoCancel();
-private:
-    TInt                        iPrevStat;
-    MProfilerStatusObserver*    iObserver;
-    RProperty                   iEngineStatus;
-    };
-
-#include <piprofiler/ProfilerEngineStatusChecker.inl>
-
-
-#endif // PROFILER_STATUS_CHECKER_H
--- a/piprofiler/piprofiler_plat/inc/ProfilerEngineStatusChecker.inl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +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:   
-*
-*/
-
-// ------------------------------------------------------------------------------
-//
-// class CProfilerEngineStatusChecker
-//
-// ------------------------------------------------------------------------------
-//
-inline CProfilerEngineStatusChecker* CProfilerEngineStatusChecker::NewL()
-    {
-    CProfilerEngineStatusChecker* self = new(ELeave) CProfilerEngineStatusChecker();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop();
-    return self;
-    }
-
-// --------------------------------------------------------------------------------------------
-inline CProfilerEngineStatusChecker::CProfilerEngineStatusChecker() :
-    CActive(EPriorityStandard)
-    {
-    }
-
-inline CProfilerEngineStatusChecker::~CProfilerEngineStatusChecker()
-    {
-    Cancel();
-    iEngineStatus.Close();
-    }
-
-// --------------------------------------------------------------------------------------------
-inline void CProfilerEngineStatusChecker::ConstructL()
-    {
-    User::LeaveIfError(iEngineStatus.Attach(KEngineStatusPropertyCat, EProfilerEngineStatus));
-    CActiveScheduler::Add(this);
-    
-    // check engine status, if not available set to idle
-    if(iEngineStatus.Get(iPrevStat) != KErrNone)
-        {
-        iPrevStat = MProfilerStatusObserver::EIdle;
-        }
-
-    // subscribe to P&S status property
-    iEngineStatus.Subscribe(iStatus);
-    SetActive();
-    }
-
-inline TInt CProfilerEngineStatusChecker::GetInitialState()
-    {
-    // check engine status, if not available set to idle
-    TInt err(iEngineStatus.Get(KEngineStatusPropertyCat, EProfilerEngineStatus, iPrevStat));
-    if(err != KErrNone)
-        {
-        iPrevStat = MProfilerStatusObserver::EIdle;
-        }
-    return iPrevStat;
-    }
-
-// --------------------------------------------------------------------------------------------
-inline void CProfilerEngineStatusChecker::RunL()
-    {
-    // resubscribe before processing new value to prevent missing updates
-    iEngineStatus.Subscribe(iStatus);
-    SetActive();
-
-    TInt stat(0);
-    if(iEngineStatus.Get(KEngineStatusPropertyCat, EProfilerEngineStatus, stat) == KErrNone)
-        {
-        // check if status one of error codes (< 0)
-        if(stat < KErrNone)
-            {
-            // some error occurred on engine side => set UI idle and show an error note
-            iObserver->HandleProfilerErrorL(stat);
-            }
-        else
-            {
-            if(iPrevStat != stat)
-                {
-                switch(stat)
-                    {
-                    case 0:
-                        iObserver->HandleProfilerStatusChange(MProfilerStatusObserver::EIdle);
-                        break;
-                    case 1:
-                        iObserver->HandleProfilerStatusChange(MProfilerStatusObserver::EInitializing);
-                        break;
-                    case 2:
-                        iObserver->HandleProfilerStatusChange(MProfilerStatusObserver::ERunning);
-                        break;
-                    case 3:
-                        iObserver->HandleProfilerStatusChange(MProfilerStatusObserver::EStopping);
-                        break;
-                    default:
-                        iObserver->HandleProfilerErrorL(stat);
-                        break;
-                    }
-                iPrevStat = stat;
-                }
-            }
-        }
-    }
-
-// --------------------------------------------------------------------------------------------
- 
-inline void CProfilerEngineStatusChecker::DoCancel()
-    {
-    iEngineStatus.Cancel();
-    }
-
-// --------------------------------------------------------------------------------------------
-inline void CProfilerEngineStatusChecker::SetObserver(MProfilerStatusObserver* aObserver)
-    {
-    iObserver = aObserver;
-    }
--- a/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesCommon.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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 PROFILERGENERICCLASSESCOMMON_H
-#define PROFILERGENERICCLASSESCOMMON_H
-
-	#include <e32cmn.h>
-
-/*
- *	
- *	Class TProfilerSampleBufStruct definition
- *
- */
-
-
-class TProfilerSampleBufStruct
-{
-public:
-	TUint32 iSampleRemainder;
-	TUint8	iDataStart;
-};
-
-/*
- *  
- *  Class TBapBuf definition
- *
- */
-
-class TBapBuf
-{
-public:
-	TPtr8*		iDes;
-	TPtr8*		iBufDes;
-	TInt		iBufferSize;
-	TInt		iDataSize;
-	TUint8*		iBuffer;
-	TBapBuf*	iNext;
-};
-
-#endif
--- a/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesKrn.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,422 +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 PROFILERGENERICCLASSESKRN_H
-#define PROFILERGENERICCLASSESKRN_H
-
-	#include <piprofiler/ProfilerGenericClassesCommon.h>
-	#include <piprofiler/ProfilerTraces.h>
-
-	#include <e32cmn.h>
-
-	#define PROFILER_KERNEL_MODE
-
-#ifdef PROFILER_KERNEL_MODE
-class DProfilerSampleBuffer;
-
-class DProfilerSampleStream
-    {
-public:
-		DProfilerSampleStream();
-		~DProfilerSampleStream();
-
-		void InsertCurrentClient(DThread* aClient);
-		void AddSampleBuffer(TBapBuf* aBuffer,TRequestStatus* aStatus);
-		void ReleaseIfPending();
-
-		void AddSamples(DProfilerSampleBuffer& aBuffer, TInt aSamplerId);
-		TInt EndSampling(DProfilerSampleBuffer& aBuffer,TInt aSamplerId);
-
-		void PerformCopy(TUint8 aSamplerId,TUint8* aSrc,TPtr8* dst,TInt aOffset,TInt aAmount);
-
-private:
-		TBapBuf*			iCurrentBuffer;
-		TRequestStatus*		iPendingRequest;
-		DThread*			iClient;
-		TInt				iAddingSamples;
-    };
-
-class DProfilerSampleBuffer : public DBase
-    {
-		friend class DProfilerSampleStream;
-public:
-
-			enum ProfilerBufferStatus 
-			    {
-				BufferOk,
-				BufferCopyAsap,
-				BufferBeingCopied,
-				BufferFull,
-				BufferDataEnd
-			    };
-
-			DProfilerSampleBuffer(TUint8* aBuffer, TUint8* aDblBuffer, TUint32 aSize);
-			~DProfilerSampleBuffer();	
-			TInt	AddSample(TUint8* aSample, TUint32 aLength);
-			TUint32 GetBufferStatus();
-			void	ClearBuffer();
-			void	EndSampling();
-			void	DataCopied();
-
-			TUint32 iBufferStatus;
-private:
-			TUint32 iBytesWritten;
-			TUint32 iDblBytesWritten;
-			TUint32 iDblBytesRead;
-
-			TUint32 iBufferDataSize;
-			TUint32 iBufferRealSize;
-
-			TProfilerSampleBufStruct* iDblBufStruct;
-			TProfilerSampleBufStruct* iBufStruct;
-    };
-
-#endif
-
-
- 
-/*
- *	
- *	Abstract class CProfilerSamplerBase definition
- *	
- */
-
-#ifdef PROFILER_KERNEL_MODE
-class DProfilerSamplerBase : public DBase
-    {
-public:
-	DProfilerSamplerBase();
-			virtual					~DProfilerSamplerBase();
-
-			virtual	TInt			Initialise() = 0;
-			virtual	void			Sample() = 0;
-			virtual TBool			PostSampleNeeded() = 0;
-			virtual TInt			PostSample() = 0;
-			virtual TInt			EndSampling() = 0;
-
-			virtual TInt			Reset(DProfilerSampleStream* aStream = 0, TUint32 aSyncOffset = 0) = 0;
-
-			virtual void			SetEnabledFlag(TBool aFlag) = 0;
-			virtual TBool			GetEnabledFlag() = 0;
-			virtual void			SetOutputCombination(TInt aSettings) = 0;
-			virtual void 			SetSamplingPeriod(TInt aSettings) = 0;
-			virtual void			SetAdditionalSettings(TInt aSettings) = 0;
-			virtual void			SetAdditionalSettings2(TInt aSettings) = 0;
-			virtual void			SetAdditionalSettings3(TInt aSettings) = 0;
-			virtual void			SetAdditionalSettings4(TInt aSettings) = 0;
-
-			TInt					iSamplerId;
-			TInt					iOutputCombination;
-			TBool					iEnabled;
-    };
-
-/*
- *	
- *	Template abstract class CProfilerGenericSampler definition
- *	
- */
-
-// size parameter given defines the explicit buffer size in bytes for this sampler
-template <int BufferSize> 
-class DProfilerGenericSampler : public DProfilerSamplerBase
-    {
-public:
-			DProfilerGenericSampler(TInt aSamplerId);
-			virtual					~DProfilerGenericSampler();
-
-			TInt					Initialise();
-			virtual	void			Sample() = 0;
-			TBool					PostSampleNeeded();
-			TInt					PostSample();
-			TInt					EndSampling();
-			virtual TInt			Reset(DProfilerSampleStream* aStream = 0, TUint32 aSyncOffset = 0);
-
-
-			void					SetEnabledFlag(TBool aFlag);
-			TBool					GetEnabledFlag();
-			void					SetOutputCombination(TInt aComb);
-			void 					SetSamplingPeriod(TInt aSettings);
-			void					SetAdditionalSettings(TInt aSettings);
-			void					SetAdditionalSettings2(TInt aSettings);
-			void					SetAdditionalSettings3(TInt aSettings);
-			void					SetAdditionalSettings4(TInt aSettings);
-
-			DProfilerSampleBuffer*	iSampleBuffer;
-			DProfilerSampleStream*	iStream;
-
-			// for right alignment
-			TUint8					iBuffer[BufferSize+4];
-			TUint8					iDblBuffer[BufferSize+4];
-			
-			TInt					iSamplingPeriod;
-			TInt					iAdditionalSettings;
-			TInt					iAdditionalSettings2;
-			TInt					iAdditionalSettings3;
-			TInt					iAdditionalSettings4;
-    };
-
-/*
- *	
- *	Template abstract class CProfilerGenericSampler implementation
- *
- */
-
-template <int BufferSize>
-DProfilerGenericSampler<BufferSize>::DProfilerGenericSampler(TInt aSamplerId)
-    {
-	iSamplerId = aSamplerId;
-	iEnabled = false;
-	iSampleBuffer = 0;
-	iAdditionalSettings = 0;
-	iAdditionalSettings2 = 0;
-    iAdditionalSettings3 = 0;
-    iAdditionalSettings4 = 0;
-	iStream = 0;
-	Initialise();
-    }
-
-template <int BufferSize> 
-DProfilerGenericSampler<BufferSize>::~DProfilerGenericSampler()
-    {
-	LOGSTRING2("CProfilerGenericSampler<%d>::CProfilerGenericSampler",BufferSize);	
-	
-	if(iSampleBuffer != 0)
-		delete iSampleBuffer;
-
-    }
- 
-template <int BufferSize> 
-TInt DProfilerGenericSampler<BufferSize>::Initialise()
-    {
-	LOGSTRING2("CProfilerGenericSampler<%d>::Initialise - chunk option",BufferSize);
-
-	// stream is not used in chunk mode
-	iStream = 0;
-
-	// create the sample buffer object with the buffers
-	if(iSampleBuffer == 0)
-	    {
-	    iSampleBuffer = new DProfilerSampleBuffer(iBuffer,iDblBuffer,BufferSize);
-        }
-	else
-	   {
-		LOGSTRING2("CProfilerGenericSampler<%d>::Initialise - ERROR 1",BufferSize);
-        }
-
-	return KErrNone;
-    }
-
-
-
-template <int BufferSize> 
-TInt DProfilerGenericSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
-    {
-	LOGSTRING4("CProfilerGenericSampler<%d>::Reset %d, sync offset %d",BufferSize,aStream,aSyncOffset);
-	// reset the sample buffer and resolve the chunk again
-
-	// CURRENT VERSION SUPPORTS ONLY STREAM MODE!
-	LOGSTRING2("CProfilerGenericSampler<%d>::Reset - stream option",BufferSize);
-
-	// initialise the sampler with the stream option
-	iStream = aStream;
-
-	// clear the sample buffer
-	if(iSampleBuffer != 0)
-	    {
-	    iSampleBuffer->ClearBuffer();
-        }
-	else
-	    {
-		LOGSTRING2("CProfilerGenericSampler<%d>::Initialise - ERROR no buffer",BufferSize);
-        }
-
-	return KErrNone;
-
-    }
-
-template <int BufferSize> 
-TBool DProfilerGenericSampler<BufferSize>::PostSampleNeeded()
-    {
-	LOGSTRING4("CProfilerGenericSampler<%d>::PostSampleNeeded - ID %d, state %d",iSamplerId,BufferSize,iSampleBuffer->GetBufferStatus());
-
-	TUint32 status = iSampleBuffer->iBufferStatus;
-
-	if(status == DProfilerSampleBuffer::BufferCopyAsap || status == DProfilerSampleBuffer::BufferFull)
-	    {
-		return true;
-        }
-	
-	return false;
-    }
-
-
-template <int BufferSize> 
-TInt DProfilerGenericSampler<BufferSize>::PostSample()
-    {
-	LOGSTRING4("CProfilerGenericSampler<%d>::PostSample - ID %d, state %d",iSamplerId,BufferSize,iSampleBuffer->GetBufferStatus());
-
-	TUint32 status = iSampleBuffer->iBufferStatus;
-
-	if(status == DProfilerSampleBuffer::BufferCopyAsap || status == DProfilerSampleBuffer::BufferFull)
-	    {
-        // write data to the stream
-	    iStream->AddSamples(*iSampleBuffer,iSamplerId);
-		}
-	
-	return KErrNone;
-    }
-
-template <int BufferSize>
-TInt DProfilerGenericSampler<BufferSize>::EndSampling()
-    {
-	LOGSTRING3("CProfilerGenericSampler<%d>::EndSampling, ID %d",BufferSize,iSamplerId);
-
-    // only if write to stream option is selected
-    if(iStream->EndSampling(*iSampleBuffer,iSamplerId) == 0)
-        {
-        return KErrNone;
-        }
-    else 
-        {
-        // there is still data to copy
-        return KErrNotReady;
-        }
-    }
-
-template <int BufferSize>
-void DProfilerGenericSampler<BufferSize>::SetEnabledFlag(TBool aFlag)
-    {
-	LOGSTRING2("CProfilerGenericSampler<%d>::SetEnabledFlag",BufferSize);
-	iEnabled = aFlag;
-    }
-
-template <int BufferSize>
-TBool DProfilerGenericSampler<BufferSize>::GetEnabledFlag()
-    {
-	LOGSTRING2("CProfilerGenericSampler<%d>::GetEnabledFlag",BufferSize);
-	return iEnabled;
-    }
-
-template <int BufferSize>
-void DProfilerGenericSampler<BufferSize>::SetOutputCombination(TInt aComb)
-    {
-	LOGSTRING2("CProfilerGenericSampler<%d>::SetOutputCombination",BufferSize);
-	iOutputCombination = aComb;
-    }
-
-template <int BufferSize>
-void DProfilerGenericSampler<BufferSize>::SetAdditionalSettings(TInt aSettings)
-    {
-	LOGSTRING3("CProfilerGenericSampler<%d>::SetAdditionalSettings to 0x%x",BufferSize,aSettings);
-	iAdditionalSettings = aSettings;
-    }
-
-template <int BufferSize>
-void DProfilerGenericSampler<BufferSize>::SetAdditionalSettings2(TInt aSettings)
-    {
-	LOGSTRING3("CProfilerGenericSampler<%d>::SetAdditionalSettings2 to 0x%x",BufferSize,aSettings);
-	iAdditionalSettings2 = aSettings;
-    }
-
-template <int BufferSize>
-void DProfilerGenericSampler<BufferSize>::SetAdditionalSettings3(TInt aSettings)
-    {
-	LOGSTRING3("CProfilerGenericSampler<%d>::SetAdditionalSettings3 to 0x%x",BufferSize,aSettings);
-	iAdditionalSettings3 = aSettings;
-    }
-
-template <int BufferSize>
-void DProfilerGenericSampler<BufferSize>::SetAdditionalSettings4(TInt aSettings)
-    {
-	LOGSTRING3("CProfilerGenericSampler<%d>::SetAdditionalSettings4 to 0x%x",BufferSize,aSettings);
-	iAdditionalSettings4 = aSettings;
-    }
-
-template <int BufferSize>
-void DProfilerGenericSampler<BufferSize>::SetSamplingPeriod(TInt aSettings)
-    {
-	LOGSTRING3("CProfilerGenericSampler<%d>::SetSamplingPeriod to 0x%x",BufferSize,aSettings);
-	iSamplingPeriod = aSettings;
-    }
-
-/*
- *	
- *	Just a test class that is derived from CProfilerGenericSampler
- *	
- */
-
-template <int BufferSize>
-class DProfilerExampleSampler : public DProfilerGenericSampler<BufferSize>
-    {
-public:
-	TUint32 iSampleNumber;
-
-	DProfilerExampleSampler(TInt aSamplerId);
-	~DProfilerExampleSampler();
-
-	void Sample();
-	void Sample(TInt aCount, TInt aLastPc);
-    };
-
-
-/*
- *	
- *	Just a test class that is derived from CProfilerGenericSampler
- *	
- */
-
-template <int BufferSize>
-DProfilerExampleSampler<BufferSize>::DProfilerExampleSampler(TInt aSamplerId) :
-	DProfilerGenericSampler<BufferSize>(aSamplerId) 
-    {
-    iSampleNumber = 0;
-	LOGSTRING2("CProfilerExampleSampler<%d>::CProfilerExampleSampler",BufferSize);	
-    }
-
-template <int BufferSize>
-void DProfilerExampleSampler<BufferSize>::Sample()
-    {
-	LOGSTRING2("CProfilerExampleSampler<%d>::Sample",BufferSize);
-	TBuf8<20>* testiBuf = new TBuf8<20>;
-
-	testiBuf->AppendNum((TInt)iSampleNumber);
-	iSampleNumber++;
-
-	this->iSampleBuffer->AddSample((TUint8*)testiBuf->Ptr(),testiBuf->Length());
-	delete testiBuf;
-	return;
-    }
-
-template <int BufferSize>
-void DProfilerExampleSampler<BufferSize>::Sample(TInt aCount, TInt aLastPc)
-    {
-	return;
-    }
-
-template <int BufferSize>
-DProfilerExampleSampler<BufferSize>::~DProfilerExampleSampler()
-    {
-	LOGSTRING2("CProfilerExampleSampler<%d>::~CProfilerExampleSampler",BufferSize);		
-    }
-
-#include <piprofiler/ProfilerGenericClassesKrn.inl>
-
-#endif
-
-
-#endif
--- a/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesKrn.inl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,530 +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 <kern_priv.h>
-
-#include <piprofiler/ProfilerGenericClassesKrn.h>
-
-
-/*
- *	
- *	Class CProfilerSamplerBase implementation
- *
- */
-
-inline DProfilerSamplerBase::DProfilerSamplerBase()
-    {
-	
-    }
-
-inline DProfilerSamplerBase::~DProfilerSamplerBase()
-    {
-	
-    }
-
-/*
- *	
- *	Class CProfilerSampleBuffer implementation
- *
- */
-
-inline DProfilerSampleBuffer::DProfilerSampleBuffer(TUint8* aBuffer, 
-											TUint8* aDblBuffer, 
-											TUint32 aBufferSize )
-    {
-	LOGSTRING3("CProfilerSampleBuffer::CProfilerSampleBuffer AtFirst: b:0x%x db:0x%x",aBuffer,aDblBuffer);
-
-	// make sure the alignment is right
-	if((((TUint32)aBuffer) %4) != 0)
-	    aBuffer += (4-(((TUint32)aBuffer)%4));
-	if((((TUint32)aDblBuffer) %4) != 0)
-	    aDblBuffer += (4-(((TUint32)aDblBuffer)%4));
-
-	LOGSTRING3("CProfilerSampleBuffer::CProfilerSampleBuffer b:0x%x db:0x%x",aBuffer,aDblBuffer);
-
-	iBufStruct = (TProfilerSampleBufStruct*)aBuffer;
-	iDblBufStruct = (TProfilerSampleBufStruct*)aDblBuffer;
-
-	LOGSTRING3("CProfilerSampleBuffer::CProfilerSampleBuffer bufStruct rem:0x%x dbuStruct rem:0x%x",
-						&iBufStruct->iSampleRemainder,&iDblBufStruct->iSampleRemainder);
-
-	iBufferDataSize = aBufferSize-4;
-	iBufferRealSize = aBufferSize;
-
-	ClearBuffer();
-    }
-
-inline DProfilerSampleBuffer::~DProfilerSampleBuffer()
-    {
-	
-    }
-
-inline TInt DProfilerSampleBuffer::AddSample(TUint8* aSample, TUint32 aLength)
-    {
-	TUint32 bytesTotal;
-
-	// check whether the buffer status is
-	switch (iBufferStatus)
-	    {
-		case DProfilerSampleBuffer::BufferOk:
-			// add the data normally to the buffer
-			bytesTotal = iBytesWritten+aLength;
-
-			if(bytesTotal < iBufferDataSize)
-			    {
-				memcpy((&(iBufStruct->iDataStart))+iBytesWritten,aSample,aLength);
-				iBytesWritten+=aLength;
-				return 0;
-			    }
-			else
-			    {
-
-				// the sample does not fit to the buffer
-				// first copy as much data as we can fit to the first buffer
-				TUint32 fitsToBuffer = iBufferDataSize-iBytesWritten;
-				TUint32 remaining = aLength-fitsToBuffer;
-
-				memcpy((&(iBufStruct->iDataStart))+iBytesWritten,aSample,fitsToBuffer);
-				iBytesWritten = iBufferDataSize;
-
-				// ->switch to the double buffer
-				iBufferStatus = DProfilerSampleBuffer::BufferCopyAsap;
-				
-				TProfilerSampleBufStruct* tmpPtr = iBufStruct;
-				iBufStruct = iDblBufStruct;
-				iDblBufStruct = tmpPtr;
-				
-				iDblBytesWritten = iBytesWritten;
-
-				// and this is the remainder of a sample
-				// that will be copied to the new buffer
-				// just in a while
-				iBufStruct->iSampleRemainder = remaining;
-				
-				// now that the buffers have been switched
-				// add the rest of the sample to the buffer
-				aSample+=fitsToBuffer;
-
-				// there should be room - in case the single sample
-				// is smaller than the whole buffer! so we don't
-				// bother to check
-
-				memcpy((&(iBufStruct->iDataStart)),aSample,remaining);
-				iBytesWritten = remaining;
-				return 0;
-			    }
-
-		case DProfilerSampleBuffer::BufferCopyAsap:
-
-			// no difference to the BufferOk case
-			// unless the double buffer gets filled
-			// before the data has been copied
-			// add the data normally to the buffer
-			bytesTotal = iBytesWritten+aLength;
-
-			if(bytesTotal < iBufferDataSize)
-			    {
-				memcpy((&(iBufStruct->iDataStart))+iBytesWritten,aSample,aLength);
-				iBytesWritten+=aLength;
-				return 0;
-			    }
-			else
-			    {
-				// the double buffer is now also full - there is no
-				// place to put the data -> we have to waste it!
-				// this is an indication of a too small buffer size
-				iBufferStatus = DProfilerSampleBuffer::BufferFull;
-				LOGSTRING("DProfilerSampleBuffer::AddSample - double buffer full1!!");
-				return -1;
-			    }
-
-		case DProfilerSampleBuffer::BufferBeingCopied:
-
-			// no difference to the BufferCopyAsap case
-			bytesTotal = iBytesWritten+aLength;
-
-			if(bytesTotal < iBufferDataSize)
-			    {
-				memcpy((&(iBufStruct->iDataStart))+iBytesWritten,aSample,aLength);
-				iBytesWritten+=aLength;
-				return 0;
-			    }
-			else
-			    {
-				// the double buffer is now also full - there is no
-				// place to put the data -> we have to waste it!
-				// this is an indication of a too small buffer size
-                LOGSTRING("DProfilerSampleBuffer::AddSample - double buffer full2!!");
-				
-				// don't change the state to CProfilerSampleBuffer::BufferFull, since it is
-				// already being copied
-				return -1;
-			    }
-
-		case DProfilerSampleBuffer::BufferFull:
-			// the buffer is still full, there is noting we can do
-			// about it -> return
-		    LOGSTRING("DProfilerSampleBuffer::AddSample - double buffer full3!!");
-			return -1;
-
-		default:
-		    LOGSTRING("DProfilerSampleBuffer::AddSample - wrong switch!!");
-			return -1;
-	    }
-    }
-
-inline void DProfilerSampleBuffer::EndSampling()
-    {
-    LOGSTRING("DProfilerSampleBuffer::EndSampling");
-	// this will switch to the dbl buffer even though
-	// the buffer is not full, so that data can be copied
-
-	// during this operation, no other buffer
-	// operations are allowed
-
-	// ensure that the normal buffer is in use and that the
-	// buffer is in normal state ( this procedure is performed only once )
-	if(iBufferStatus == DProfilerSampleBuffer::BufferOk)
-	    {
-		// ->switch to the double buffer
-        LOGSTRING("DProfilerSampleBuffer::EndSampling - switching to double buffer");
-		iBufferStatus = DProfilerSampleBuffer::BufferCopyAsap;
-		
-		TProfilerSampleBufStruct* tmpPtr = iBufStruct;
-		iBufStruct = iDblBufStruct;
-		iDblBufStruct = tmpPtr;
-				
-		iDblBytesWritten = iBytesWritten;
-		
-		// there is no new sample so the remainder is
-		// zero, (this shouldn't be used anyway)
-		iBufStruct->iSampleRemainder = 0;
-	    }
-    }
-
-inline TUint32 DProfilerSampleBuffer::GetBufferStatus()
-    {
-	return iBufferStatus;
-    }
-
-inline void DProfilerSampleBuffer::ClearBuffer()
-    {
-	LOGSTRING2("CProfilerSampleBuffer::ClearBuffer - %d",iBufferDataSize);
-
-	// the buffers are of same size
-	TUint8* ptr1 = (TUint8*)&(iBufStruct->iDataStart);
-	TUint8* ptr2 = (TUint8*)&(iDblBufStruct->iDataStart);
-
-	for(TUint32 i=0;i<iBufferDataSize;i++)
-	    {
-		ptr1[i] = 0;
-		ptr2[i] = 0;
-	    }
-
-
-	iBufStruct->iSampleRemainder = 0;
-	iDblBufStruct->iSampleRemainder = 0;
-
-	// written the dblBufStruct
-	iBytesWritten = 0;
-	iDblBytesWritten = 0;
-	iDblBytesRead = 0;
-
-	iBufferStatus = DProfilerSampleBuffer::BufferOk;
-    }
-
-inline void DProfilerSampleBuffer::DataCopied()
-    {
-	iDblBytesRead = 0;
-	iDblBytesWritten = 0;
-	iBufferStatus = DProfilerSampleBuffer::BufferOk;
-    }
-
-/*
- *
- *	Class DProfilerSampleStream implementation
- *
- */
-
-inline DProfilerSampleStream::DProfilerSampleStream()
-    {
-	LOGSTRING("DProfilerSampleStream::DProfilerSampleStream");
-
-	iCurrentBuffer = 0;
-	iPendingRequest = 0;
-	iAddingSamples = 0;
-	iClient = 0;
-    }
-
-inline DProfilerSampleStream::~DProfilerSampleStream()
-    {
-	LOGSTRING("DProfilerSampleStream::~DProfilerSampleStream");	
-    }
-
-inline void DProfilerSampleStream::InsertCurrentClient(DThread* aClient)
-    {
-	iClient = aClient;
-	LOGSTRING2("DProfilerSampleStream::InsertCurrentClient - iClient is 0x%x",iClient);
-    }
-
-
-inline void DProfilerSampleStream::AddSampleBuffer(TBapBuf* aBuffer,TRequestStatus* aStatus)
-    {
-	if(iCurrentBuffer != 0 || iPendingRequest != 0)
-	    {
-		LOGSTRING("DProfilerSampleStream::AddSampleBuffer - ERROR 1");
-		return;
-	    }
-
-	LOGSTRING3("DProfilerSampleStream::AddSampleBuffer - OK 0x%x,0x%x",aBuffer,aStatus);
-	iCurrentBuffer = aBuffer;
-	iPendingRequest = aStatus;
-	
-	LOGSTRING2("DProfilerSampleStream::AddSampleBuffer - Current Client is 0x%x",iClient);	
-    }
-
-
-inline void DProfilerSampleStream::ReleaseIfPending()
-    {
-    LOGSTRING("DProfilerSampleStream::ReleaseIfPending - entry");
-
-	if(iCurrentBuffer != 0 && iPendingRequest != 0 && iClient != 0)
-	    {
-		LOGSTRING("DProfilerSampleStream::ReleaseIfPending - release buffer");
-
-		LOGSTRING2("DProfilerSampleStream::AddSamples - completing request 0x%x",iPendingRequest);
-		Kern::RequestComplete(iClient,iPendingRequest,KErrNone);
-		
-		iPendingRequest = 0;
-		iCurrentBuffer = 0;
-	    }
-
-	LOGSTRING("DProfilerSampleStream::ReleaseIfPending - exit");
-    }
-
-inline void DProfilerSampleStream::AddSamples(DProfilerSampleBuffer& aBuffer, TInt aSamplerId)
-    {
-	LOGSTRING3("DProfilerSampleStream::AddSamples - entry ID: %d, currentbuffer: 0x%x", aSamplerId,iCurrentBuffer);
-	if(iCurrentBuffer != 0)
-	    {
-		// the following will perform simple mutual exclusion
-		iAddingSamples++;
-		if(iAddingSamples > 1) 
-		    {
-			// there is someone else adding samples to the buffer
-            LOGSTRING("DProfilerSampleStream::AddSamples - mutex in use");
-			iAddingSamples--;
-			return;
-		    }
-
-		LOGSTRING("DProfilerSampleStream::AddSamples - reading TBapBuf");
-		
-		// use a copy of the client TBapBuf structure during processing
-		TBapBuf realBuf;
-		TPtr8 ptr((TUint8*)&realBuf,(TInt)sizeof(TBapBuf));
-	
-		Kern::ThreadRawRead(iClient,(TAny*)(iCurrentBuffer),(TAny*)&realBuf,sizeof(TBapBuf));
-
-		ptr.SetLength(sizeof(TBapBuf));
-
-		LOGSTRING4("DProfilerSampleStream::AddSamples - read %d bytes from 0x%x of thread 0x%x",ptr.Size(),iCurrentBuffer,iClient);
-
-		LOGSTRING5("DProfilerSampleStream::AddSamples - current buffer 0x%x -> b:0x%x s:%d d:%d",
-			&realBuf,
-			realBuf.iBuffer,
-			realBuf.iBufferSize,
-			realBuf.iDataSize);
-
-		// get the address of the source buffer data
-		TUint8* src = (TUint8*)&(aBuffer.iDblBufStruct->iDataStart);
-		src += aBuffer.iDblBytesRead;
-
-		// the amount of data to copy is the 4 header bytes +
-		// the remaining data in the buffer
-		TInt amount = aBuffer.iDblBytesWritten-aBuffer.iDblBytesRead;
-
-		TUint8* dst = realBuf.iBuffer;
-
-		LOGSTRING4("DProfilerSampleStream::AddSamples - s:0x%x d:0x%x a:%d",src,dst,amount);
-
-		if(realBuf.iDataSize == 0)
-		    {
-			LOGSTRING("DProfilerSampleStream::AddSamples - case 1");
-
-			// the buffer is empty
-			if(realBuf.iBufferSize >= (amount+4))
-			    {
-				LOGSTRING("DProfilerSampleStream::AddSamples - case 1.1");
-
-				// the source buffer is smaller or of equal size than the amount of output data
-				PerformCopy((TUint8)aSamplerId,src,realBuf.iBufDes,0,amount);
-				realBuf.iDataSize += amount+4;
-				// the rest of the source buffer was copied at once, so signal the buffer
-				aBuffer.DataCopied();
-			    }
-			else
-			    {
-				LOGSTRING("DProfilerSampleStream::AddSamples - case 1.2");
-
-				// only a part of the source buffer will fit to the client side buffer
-				amount = realBuf.iBufferSize-4;
-				PerformCopy((TUint8)aSamplerId,src,realBuf.iBufDes,0,amount);
-				realBuf.iDataSize += amount+4;
-				// add the amount of bytes read to the source buffer
-				aBuffer.iDblBytesRead+=amount;
-			    }
-		    }
-		else
-		    {
-			LOGSTRING("DProfilerSampleStream::AddSamples - case 2");
-
-			// there is data in the client buffer
-			dst += realBuf.iDataSize;
-			TInt remainingSpace = realBuf.iBufferSize-realBuf.iDataSize;
-
-			if( remainingSpace >= (amount+4) )
-			    {
-				LOGSTRING("DProfilerSampleStream::AddSamples - case 2.1");
-
-				// the source buffer is smaller or of equal size than the amount of output data
-				PerformCopy((TUint8)aSamplerId,src,realBuf.iBufDes,realBuf.iDataSize,amount);
-				realBuf.iDataSize += (amount+4);
-				// the rest of the source buffer was copied at once, so signal the buffer
-				aBuffer.DataCopied();
-			    }
-			else
-			    {
-				LOGSTRING("DProfilerSampleStream::AddSamples - case 2.2");
-
-				// only a part of the source buffer will fit to the client side buffer
-				if(remainingSpace >= 12)
-				    {
-					LOGSTRING("DProfilerSampleStream::AddSamples - case 2.3");
-
-					amount = remainingSpace-4;
-					// there are at least 8 bytes left for data, write it
-					PerformCopy((TUint8)aSamplerId,src,realBuf.iBufDes,realBuf.iDataSize,amount);
-					realBuf.iDataSize += (amount+4);
-					// add the amount of bytes read to the source buffer
-					aBuffer.iDblBytesRead+=amount;				
-				    }
-			    }
-		    }
-	
-		// copy the data in the modified TBapBuf structure back to the client
-		LOGSTRING("DProfilerSampleStream::AddSamples - writing TBapBuf");
-
-		Kern::ThreadDesWrite(iClient,(TAny*)(realBuf.iDes),ptr,0,KChunkShiftBy0,iClient);
-
-		// if the client side buffer is full or nearly full, signal the client
-		LOGSTRING("DProfilerSampleStream::AddSamples - data copied");
-
-		if(realBuf.iBufferSize-realBuf.iDataSize < 12)
-		    {
-			LOGSTRING("DProfilerSampleStream::AddSamples - release buffer");
-			
-			LOGSTRING2("DProfilerSampleStream::AddSamples - completing request 0x%x",iPendingRequest);
-
-			Kern::RequestComplete(iClient,iPendingRequest,KErrNone);
-
-			iPendingRequest = 0;
-			iCurrentBuffer = 0;
-			//iClient = 0;
-		    }
-
-		// free the lock
-		iAddingSamples--;
-	    }
-	LOGSTRING("DProfilerSampleStream::AddSamples - exit");
-    }
-
-
-
-inline TInt DProfilerSampleStream::EndSampling(DProfilerSampleBuffer& aBuffer,TInt aSamplerId)
-    {
-    LOGSTRING2("DProfilerSampleStream::EndSampling, sampler ID: %d",aSamplerId);
-
-	// switch the buffer to double buffer
-	// even though it would not be full yet
-	// the switch is done only once / end sampling procedure
-	// (Only with BufferOk status)
-	aBuffer.EndSampling();
-	
-	LOGSTRING2("DProfilerSampleStream::EndSampling, iClient: 0x%x",iClient);
-	
-	if(aBuffer.iBufferStatus != DProfilerSampleBuffer::BufferDataEnd)
-	    {
-		// add these final samples to the client buffer
-		AddSamples(aBuffer,aSamplerId);
-		
-		// if all data was copied to the buffer, the buffer status is now BufferOk
-
-		if(aBuffer.iBufferStatus != DProfilerSampleBuffer::BufferOk)
-		    {
-            LOGSTRING("DProfilerSampleStream::EndSampling - more data to copy");
-			// there is still more data to copy, the pending request should have been
-			// completed in AddSamples(), because the client buffer got filled 
-			return 1;
-		    }
-		else
-		    {
-			// buffer status was changed to BufferOk in AddSamples() - 
-			// this means all data from it could be copied
-			// now we have to change the status of the buffer to BufferDataEnd, so
-			// we know that the particular buffer has no more data to copy
-            LOGSTRING("DProfilerSampleStream::EndSampling - switch to BufferDataEnd");
-			aBuffer.iBufferStatus = DProfilerSampleBuffer::BufferDataEnd;
-		    }
-	    }
-
-	// the buffer was completely emptied to the client buffer, or there was no
-	// data to copy to the client side
-	LOGSTRING("DProfilerSampleStream::EndSampling - no more data to copy");
-
-	return 0;
-    }
-
-inline void DProfilerSampleStream::PerformCopy(TUint8 aSamplerId,TUint8* aSrc,TPtr8* aDst,TInt aOffset,TInt aAmount)
-    {
-	LOGSTRING2("DProfilerSampleStream::PerformCopy for sampler ID: %d",aSamplerId);	
-	LOGSTRING5("DProfilerSampleStream::PerformCopy - 0x%x -> 0x%x - %d - offset: %d",aSrc, aDst, aAmount, aOffset);	
-	TUint32 header;
-	header = aAmount & 0x00ffffff;
-	header += (aSamplerId << 24);
-	TPtr8 ptr((TUint8*)&header,4);
-	ptr.SetLength(4);
-
-	LOGSTRING2("DProfilerSampleStream::PerformCopy - start header copy HDR = 0x%x",header);	
-
-	// write the header
-	Kern::ThreadDesWrite(iClient,(TAny*)aDst,ptr,aOffset,KChunkShiftBy0);
-
-	LOGSTRING2("DProfilerSampleStream::PerformCopy - copied header %d bytes",ptr.Size());	
-	aOffset+=4;
-
-	LOGSTRING("DProfilerSampleStream::PerformCopy - start copy");	
-	// write the data
-	ptr.Set(aSrc,aAmount,aAmount);
-	ptr.SetLength(aAmount);
-	
-	Kern::ThreadDesWrite(iClient,(TAny*)aDst,ptr,aOffset,KChunkShiftBy0);
-
-
-	LOGSTRING2("DProfilerSampleStream::PerformCopy - copied data %d bytes",ptr.Size());	
-
-    }
--- a/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesUsr.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +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 PROFILERGENERICCLASSESUSR_H
-#define PROFILERGENERICCLASSESUSR_H
-
-#include <piprofiler/ProfilerConfig.h>
-#include <piprofiler/ProfilerVersion.h>
-#include <piprofiler/ProfilerGenericClassesCommon.h>
-#include <piprofiler/PluginSampler.h>
-#include <piprofiler/WriterPluginInterface.h>
-
-#include <e32cmn.h>
-#include <e32std.h>
-#include <f32file.h>
-
-
-/*
- *	
- *	Class MProfilerBufferHandlerObserver definition
- *	
- */
-class MProfilerBufferHandlerObserver
-	{
-public:
-	virtual TBapBuf* GetNextFreeBuffer() = 0;
-	virtual void AddToFilledBuffers(TBapBuf* aFilledBuffer) = 0;
-	};
-
-/*
- *	
- *	Class CProfilerBufferHandler definition
- *	
- */
-// forward declarations
-class CProfilerSampleStream;
-
-class CProfilerBufferHandler : public CActive
-	{
-public:
-	static CProfilerBufferHandler* CProfilerBufferHandler::NewL(CProfilerSampleStream& aStream, RPluginSampler& aSampler);
-	CProfilerBufferHandler(CProfilerSampleStream& aStream, RPluginSampler& aSampler);
-	~CProfilerBufferHandler();
-	
-	void 		ConstructL();
-	
-	// for plugins to start receiving trace data
-	void		StartReceivingData();
-private:
-	void		RunL();
-	TInt        RunError(TInt aError);
-	void		DoCancel();
-	void        HandleEndOfStream();
-public:
-	TInt					iFinished;
-private:
-	RPluginSampler&			iSampler;
-	TBapBuf*				iBufferInProcess;
-	TBool					iEndOfStreamDetected;
-	
-	CProfilerSampleStream&     iObserver;
-	};
-
-/*
- *	
- *	Class CProfilerSampleStream definition
- *	
- */
-class CWriterPluginInterface;
-
-class CProfilerSampleStream : public CBase, MProfilerBufferHandlerObserver
-{
-public:
-	static CProfilerSampleStream* CProfilerSampleStream::NewL(TInt aBufSize);
-	~CProfilerSampleStream();
-
-	void 		ConstructL();
-
-	void 		Finalise();
-	void 		EmptyBuffers();
-	inline void		AddToFreeBuffers(TBapBuf* freeBuffer);
-	void        SetWriter(CWriterPluginInterface& aWriter);
-	
-	// from MProfilerBufferHandlerObserver
-	TBapBuf* 	GetNextFreeBuffer();
-	void        AddToFilledBuffers(TBapBuf* aFilledBuffer);
-	inline TBapBuf*    GetNextFilledBuffer();
-	void        ResetBuffers();
-	void        InitialiseBuffers();
-	inline void        NotifyWriter();
-private:
-	CProfilerSampleStream(TInt aBufSize);
-	
-	
-public:
-    TInt					iFinished;
-    CWriterPluginInterface* iWriter;
-private:
-    TInt					iBufferSize;
-    TBapBuf*				iFreeBuffers;
-    TBapBuf*                iFilledBuffers;
-};
-
-#include <piprofiler/ProfilerGenericClassesUsr.inl>
-
-#endif
--- a/piprofiler/piprofiler_plat/inc/ProfilerGenericClassesUsr.inl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,498 +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 <f32file.h>
-#include <e32svr.h>
-
-#include <piprofiler/ProfilerTraces.h>
-
-// constants
-const TInt KInitialFreeBufferAmount = 4;
-
-/*
- *
- *	Class CProfilerBufferHandler implementation
- *
- */
-inline CProfilerBufferHandler* CProfilerBufferHandler::NewL(CProfilerSampleStream& aStream, RPluginSampler& aSampler)
-	{
-	LOGTEXT(_L("CProfilerBufferHandler::NewL - entry"));
-	CProfilerBufferHandler* self = new(ELeave) CProfilerBufferHandler(aStream, aSampler);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;   
-	}
-
-inline CProfilerBufferHandler::CProfilerBufferHandler(CProfilerSampleStream& aStream, RPluginSampler& aSampler)
-    : CActive(EPriorityStandard),
-    iSampler(aSampler),
-    iObserver(aStream)
-    {
-    }
-
-inline CProfilerBufferHandler::~CProfilerBufferHandler()
-	{
-	LOGTEXT(_L("CProfilerBufferHandler::~CProfilerBufferHandler() - entry"));
-	}
-
-inline void CProfilerBufferHandler::ConstructL()
-	{
-	LOGTEXT(_L("CProfilerBufferHandler::ConstructL - entry"));
-	iBufferInProcess = 0;
-	iEndOfStreamDetected = false;
-
-	iFinished = 0;
-	// add the buffer handler to the active scheduler
-	CActiveScheduler::Add(this);
-	}
-
-inline void CProfilerBufferHandler::StartReceivingData()
-	{
-	LOGTEXT(_L("CProfilerBufferHandler::StartReceivingData - entry"));
-
-	iEndOfStreamDetected = false;
-	// this method initiates receiving data from the sampler
-	iBufferInProcess = iObserver.GetNextFreeBuffer();
-
-	LOGSTRING5("CProfilerBufferHandler::StartReceivingData - 0x%x -> b:0x%x s:%d d:%d",
-					iBufferInProcess,
-					iBufferInProcess->iBuffer,
-					iBufferInProcess->iBufferSize,
-					iBufferInProcess->iDataSize);
-
-	iSampler.FillThisStreamBuffer(iBufferInProcess,iStatus);
-
-	LOGTEXT(_L("CProfilerBufferHandler::StartReceivingData - SetActive"));
-	SetActive();
-
-	LOGTEXT(_L("CProfilerBufferHandler::StartReceivingData - exit"));
-	}
-
-inline TInt CProfilerBufferHandler::RunError(TInt aError)
-    {
-    // handle the error case by stopping the trace
-    HandleEndOfStream();
-    return aError;
-    }
-
-inline void CProfilerBufferHandler::HandleEndOfStream()
-    {
-    LOGTEXT(_L("CProfilerBufferHandler::RunError - entry"));
-    // Cancel has been called, the stream should be about to end now,
-    // we will wait for the rest of the buffers to be filled synchronously
-    // the end of the stream will be indicated through an empty buffer
-    // at first, complete the ongoing request
-    if(iStatus == KRequestPending && iBufferInProcess != 0)
-        {
-        LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 1"));
-
-        // wait for the buffer to be filled synchronously
-        User::WaitForRequest(iStatus);
-        
-        // add the received buffer to the list of filled buffers
-        iObserver.AddToFilledBuffers(iBufferInProcess);
-        // continue writing to output
-        iObserver.NotifyWriter();
-        
-        if(iBufferInProcess->iDataSize == 0)
-            {
-            // a buffer with size 0 was received
-            LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 1.1"));
-            iEndOfStreamDetected = true;
-            }
-
-        // there will be no more asynchronous requests
-        iBufferInProcess = 0;
-        }
-    else if (iBufferInProcess != 0)
-        {
-        LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 2"));
-
-        // add the buffer into filled, i.e. ready-to-write buffers
-        iObserver.AddToFilledBuffers(iBufferInProcess);
-        iObserver.NotifyWriter();
-        
-        if(iBufferInProcess->iDataSize == 0)
-            {
-            // a buffer with size 0 was received
-            LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 2.1"));
-            iEndOfStreamDetected = true;
-            }       
-        // there will be no more asynchronous requests
-        iBufferInProcess = 0;   
-        }
-
-    // then, continue until end of stream has been reached
-    while(iEndOfStreamDetected == false)
-        {
-        // the end of stream has not yet been detected, so get more
-        // buffers from the sampler, until we get an empty one
-
-        if(iStatus == KRequestPending)
-            {
-            LOGTEXT(_L("CProfilerBufferHandler::DoCancel - ERROR 1"));
-            }
-
-        LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 3"));
-
-        TBapBuf* nextFree = iObserver.GetNextFreeBuffer();  
-        iSampler.FillThisStreamBuffer(nextFree,iStatus);
-        // wait for the buffer to be filled synchronously
-        User::WaitForRequest(iStatus);
-        
-        // call the writer plugin to write data to output
-        iObserver.AddToFilledBuffers(nextFree);
-        iObserver.NotifyWriter();
-        
-        // check if end-of-data message (i.e. data size is 0 sized) received
-        if(nextFree->iDataSize == 0)
-            {
-            LOGTEXT(_L("CProfilerBufferHandler::DoCancel - case 3.1"));
-            // a buffer with size 0 was received
-            iEndOfStreamDetected = true;
-            nextFree = 0;
-            }
-        }   
-    }
-
-inline void CProfilerBufferHandler::RunL()
-	{
-	LOGTEXT(_L("CProfilerBufferHandler::RunL - entry"));
-
-	// is called by the active scheduler
-	// when a buffer has been received
-
-	// buffer with dataSize 0 is returned when the sampling ends
-	if(iBufferInProcess->iDataSize != 0)
-	    {
-	    LOGTEXT(_L("CProfilerBufferHandler::RunL - buffer received"));
-
-		TBapBuf* nextFree = iObserver.GetNextFreeBuffer();
-		
-		LOGSTRING5("CProfilerBufferHandler::RunL - 0x%x -> b:0x%x s:%d d:%d",
-					nextFree,
-					nextFree->iBuffer,
-					nextFree->iBufferSize,
-					nextFree->iDataSize);
-
-		iSampler.FillThisStreamBuffer(nextFree,iStatus);
-
-		LOGTEXT(_L("CProfilerBufferHandler::RunL - issued new sample command"));
-
-		// add the received buffer to the list of filled buffers
-		iObserver.AddToFilledBuffers(iBufferInProcess);
-		iObserver.NotifyWriter();
-
-        // the empty buffer is now the one being processed
-        iBufferInProcess = nextFree;
-        
-        LOGTEXT(_L("CProfilerBufferHandler::RunL - SetActive"));
-        SetActive();        
-		}
-	else
-		{
-		LOGTEXT(_L("CProfilerBufferHandler::RunL - end of stream detected"));
-		iEndOfStreamDetected = true;
-		
-		// add the empty buffer to the writer so that it will also get the information
-		// about the finished stream
-		iObserver.AddToFilledBuffers(iBufferInProcess);
-		iObserver.NotifyWriter();
-
-		iBufferInProcess = 0;
-		Cancel();
-
-		}
-	LOGTEXT(_L("CProfilerBufferHandler::RunL - exit"));
-	}
-
-inline void CProfilerBufferHandler::DoCancel()
-    {
-    LOGTEXT(_L("CProfilerBufferHandler::DoCancel - entry"));
-    HandleEndOfStream();
-    LOGTEXT(_L("CProfilerBufferHandler::DoCancel - exit"));
-    }
-
-
-/*
- *
- *	Class CProfilerSampleStream implementation
- *
- *  - used by Plugin
- **/
-
-inline CProfilerSampleStream* CProfilerSampleStream::NewL(TInt aBufSize)
-	{
-	LOGTEXT(_L("CProfilerSampleStream::NewL - entry"));
-	CProfilerSampleStream* self = new(ELeave) CProfilerSampleStream(aBufSize);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;   
-	}
-
-inline CProfilerSampleStream::CProfilerSampleStream(TInt aBufSize) : 
-    iBufferSize(aBufSize)
-	{
-	LOGTEXT(_L("CProfilerSampleStream::CProfilerSampleStream - entry"));
-	
-	iFilledBuffers = 0;
-    iFreeBuffers = 0;
-    iFinished = 0;
-    
-	LOGTEXT(_L("CProfilerSampleStream::CProfilerSampleStream - exit"));	
-	}
-
-inline CProfilerSampleStream::~CProfilerSampleStream()
-	{
-	LOGTEXT(_L("CProfilerSampleStream::~CProfilerSampleStream - entry"));
-
-	// empty all buffers
-	EmptyBuffers();
-	    
-	LOGTEXT(_L("CProfilerSampleStream::~CProfilerSampleStream - exit"));
-	}
-
-inline void CProfilerSampleStream::ConstructL()
-	{
-
-	}
-
-inline void CProfilerSampleStream::SetWriter(CWriterPluginInterface& aWriter)
-    {
-    // set writer plugin
-    iWriter = &aWriter;
-    }
-
-inline void CProfilerSampleStream::Finalise()
-	{
-	LOGTEXT(_L("CProfilerSampleStream::Finalise - entry"));
-	}
-
-inline void CProfilerSampleStream::ResetBuffers()
-    {
-
-    // empty buffers
-    EmptyBuffers();
-
-    // re-initialise buffers
-    InitialiseBuffers();
-    }
-
-inline void CProfilerSampleStream::InitialiseBuffers()
-    {
-    // re-initialize member variables
-    iFilledBuffers = 0;
-    iFreeBuffers = 0;
-    iFinished = 0;
-    
-    // create three(orig. two) new TBapBuf objects and add them to the
-    // list of free buffers
-    for(TInt i(0);i<KInitialFreeBufferAmount;i++)
-        {
-        // alloc new buffer
-        TBapBuf* newBuf = (TBapBuf*)User::Alloc(sizeof(TBapBuf));
-        newBuf->iBuffer = (TUint8*)User::Alloc(iBufferSize);
-
-        // initialize the new buffer
-        newBuf->iBufferSize = iBufferSize;
-        newBuf->iDataSize = 0;
-        newBuf->iNext = 0;
-        newBuf->iDes = new TPtr8((TUint8*)newBuf,sizeof(TBapBuf));
-        newBuf->iDes->SetLength(sizeof(TBapBuf));
-        newBuf->iBufDes = new TPtr8((TUint8*)newBuf->iBuffer,iBufferSize);
-        newBuf->iBufDes->SetLength(iBufferSize);
-        AddToFreeBuffers(newBuf);
-        }
-    }
-
-inline void CProfilerSampleStream::EmptyBuffers()
-    {
-	LOGTEXT(_L("CProfilerSampleStream::EmptyBuffers - entry"));
-
-	// delete all free buffers
-	while(iFreeBuffers != 0)
-	    {
-		LOGSTRING2("CProfilerSampleStream::EmptyBuffers - deleting 0x%x",iFreeBuffers);
-
-		// store the next buffer in the list
-		TBapBuf* nextFree = iFreeBuffers->iNext;
-		// delete the first one in the list
-		delete iFreeBuffers->iBufDes;
-		delete iFreeBuffers->iDes;
-		delete iFreeBuffers->iBuffer;
-		delete iFreeBuffers;
-		// set the list start to the next buffer
-		iFreeBuffers = nextFree;
-	    }
-	iFreeBuffers = 0;
-	LOGTEXT(_L("CProfilerSampleStream::EmptyBuffers - exit"));
-    }
-
-inline TBapBuf* CProfilerSampleStream::GetNextFreeBuffer()
-    {
-    LOGTEXT(_L("CProfilerSampleStream::GetNextFreeBuffer - entry"));
-
-	// get a new buffer from the free buffers list
-	TBapBuf* nextFree = iFreeBuffers;
-	
-	// check if we got a buffer or not
-	if(nextFree == 0)
-	    {
-		// if there are no free buffers,
-		// create a new one
-		LOGTEXT(_L("CProfilerSampleStream::GetNextFreeBuffer - creating new buffer"));
-		TBapBuf* newBuf = (TBapBuf*)User::Alloc(sizeof(TBapBuf));
-		if(newBuf != 0)
-		    {
-			newBuf->iBuffer = (TUint8*)User::Alloc(iBufferSize);
-			if(newBuf->iBuffer != 0)
-			    {
-				newBuf->iBufferSize = iBufferSize;
-				newBuf->iDataSize = 0;
-				newBuf->iNext = 0;
-				newBuf->iDes = new TPtr8((TUint8*)newBuf,sizeof(TBapBuf));
-				newBuf->iDes->SetLength(sizeof(TBapBuf));
-				newBuf->iBufDes = new TPtr8((TUint8*)newBuf->iBuffer,iBufferSize);
-				newBuf->iBufDes->SetLength(iBufferSize);
-				nextFree = newBuf;
-			    }
-			else
-			    {
-				LOGTEXT(_L("CProfilerSampleStream::GetNextFreeBuffer - Out of memory (1)!!"));
-				return 0;
-			    }
-		    }
-		else
-		    {
-			LOGTEXT(_L("CProfilerSampleStream::GetNextFreeBuffer - Out of memory (2)!!"));
-			delete newBuf;
-			return 0;
-		    }		
-	    }
-	else
-	    {
-		// set the list to point to next free buffer
-		iFreeBuffers = nextFree->iNext;
-	    }
-
-	LOGTEXT(_L("CProfilerSampleStream::GetNextFreeBuffer - exit"));
-	return nextFree;
-    }
-
-inline void CProfilerSampleStream::AddToFilledBuffers(TBapBuf* aFilledBuffer)
-    {
-    LOGSTRING2("CProfilerSampleStream::AddToFilledBuffers - entry, size %d", aFilledBuffer->iDataSize);
-
-    // add this buffer to the list of filled buffers
-    if(iFilledBuffers == 0)
-        {
-        // the list is empty, so add the the beginning of the list
-        // there is no next buffer in the list at the moment
-        aFilledBuffer->iNext = 0;
-        iFilledBuffers = aFilledBuffer;
-        }
-    else
-        {
-        // there are buffers in the list, add this buffer to the beginning of the list
-        aFilledBuffer->iNext = iFilledBuffers;
-        iFilledBuffers = aFilledBuffer;
-        }
-    LOGTEXT(_L("CProfilerSampleStream::AddToFilledBuffers - exit"));
-    }
-
-TBapBuf* CProfilerSampleStream::GetNextFilledBuffer()
-    {
-    LOGTEXT(_L("CProfilerSampleStream::GetNextFilledBuffer - entry"));
-
-    if(iFilledBuffers == 0)
-        {
-        // there are no filled buffers in the list
-        LOGTEXT(_L("CProfilerSampleStream::GetNextFilledBuffer - no filled bufs"));
-        return 0;
-        }
-    else
-        {   
-        // get a buffer from the end of the list
-        TBapBuf* buf = iFilledBuffers;
-        TBapBuf* prev = 0;
-
-        if(buf->iNext == 0)
-            {
-            // this was the last (and only) buffer
-            iFilledBuffers = 0;
-            LOGTEXT(_L("CProfilerSampleStream::GetNextFilledBuffer - last filled"));
-            return buf;
-            }
-        else
-            {
-            LOGTEXT(_L("CProfilerSampleStream::GetNextFilledBuffer - searching last filled"));
-            while(buf->iNext != 0)
-                {
-                // there are two or more buffers in the list
-                // proceed until the end of the list is found
-                prev = buf;
-                buf = buf->iNext;
-                }
-            // now buf->next is 0, return buf and set the next
-            // element of prev to NULL
-            prev->iNext = 0;
-            LOGTEXT(_L("CProfilerSampleStream::GetNextFilledBuffer - found last"));
-            return buf;
-            }
-        }
-    }
-
-inline void CProfilerSampleStream::AddToFreeBuffers(TBapBuf* aFreeBuffer)
-    {
-	LOGTEXT(_L("CProfilerSampleStream::AddToFreeBuffers - entry"));
-
-	// set data size of the buffer to 0
-	aFreeBuffer->iDataSize = 0;
-
-	// add this buffer to the list of free buffers
-	if(iFreeBuffers == 0)
-	    {
-		// this is the first buffer, so set the next to point to NULL
-	    aFreeBuffer->iNext = 0;
-	    }
-	else
-	    {
-		// otherwise set to point to the beginning of the list
-	    aFreeBuffer->iNext = iFreeBuffers;
-	    }
-
-	// set this buffer to be the first one in the list
-	iFreeBuffers = aFreeBuffer;
-
-	LOGTEXT(_L("CProfilerSampleStream::AddToFreeBuffers - exit"));
-    }
-
-void CProfilerSampleStream::NotifyWriter()
-    {
-    // notify writer plugin to write data from filled buffer list
-    LOGTEXT(_L("CProfilerSampleStream::NotifyWriter() - entry"));
-    iWriter->WriteData();
-    LOGTEXT(_L("CProfilerSampleStream::NotifyWriter() - exit"));
-    }
-
-// end of file
-
-
-
--- a/piprofiler/piprofiler_plat/inc/ProfilerSession.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,417 +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 __PROFILER_SESSION_H__
-#define __PROFILER_SESSION_H__
-
-#include <e32base.h>
-#include <e32svr.h>
-#include <piprofiler/ProfilerConfig.h>
-#include <piprofiler/ProfilerVersion.h>
-#include <piprofiler/ProfilerTraces.h>
-#include <piprofiler/ProfilerAttributes.h>
-
-_LIT(KProfilerName,"PIProfilerEngine");
-
-/**
- * The RProfiler class provides a functional interface to the sampling profiler.
- *
- * The engine must already be running for this interface to work, this can be
- * achieved by executing PIProfilerEngine.exe. The control methods are all static, and 
- * require no other context.
- */
-NONSHARABLE_CLASS( RProfiler ) : public RSessionBase
-	{
-public:
-	enum TCommand {	
-		// profiler controls
-		EStartSampling = 1,
-		EStartTimedSampling,
-		EStopSampling,
-//		ELoadSettings,
-		EExitProfiler,
-		EFinalise,
-		EAttachClient,
-		ERemoveClient,
-
-		// general attributes
-		EGetGeneralAttributes,
-		EGetSamplerAttributes,
-		EGetSamplerAttributeCount,
-		ESetGeneralAttributes,
-		ESetSamplerAttributes,
-		
-		// generic settings
-		ESetTraceFilePrefix, 
-		ESetTraceFileDrive,
-		EGetSamplerVersion,
-		EGetFileName,
-		EGetActiveWriter,
-		ERefreshProfilerStatus
-		};
-	
-	enum TSamplerState {
-		EIdle = 0, 
-		EInitializing, 
-		ERunning, 
-		EStopping, 
-		EStopped
-		};
-	
-	enum TProfilingMode
-	    {
-	    EProfilingModeNormal = 0,
-	    EProfilingModeTimed
-	    };
-public:
-	
-	
-	/*
-	 * 
-	 *  Methods for commanding Profiler Engine
-	 *   
-	 */
-	
-	// get general settings
-	static inline TInt GetGeneralAttributes(TGeneralAttributes& aAttributes);
-	
-	// get samplers; names, settings, states, descriptions etc. in one array containing all sampler attributes
-	static inline TInt GetSamplerAttributes(CArrayFixFlat<TSamplerAttributes>& aAttributeArray);
-	
-	// save settings back to engine and plugins
-	static inline TInt SetGeneralAttributes(TGeneralAttributes aAttributes);
-
-	// save settings back to engine and plugins
-    static inline TInt SetSamplerAttributes(TSamplerAttributes aAttributes);
-    
-    // refresh profiler engine status
-    static inline TInt RefreshProfilerStatus();	
-	
-    /** Start sampling */
-	static inline TInt StartSampling(TProfilingMode aProfilingMode = EProfilingModeNormal);
-	/** Stop sampling */
-	static inline TInt StopSampling();
-    /** Load settings */
-//    static inline TInt LoadSettings(TDesC& aSettingsFile);
-	/** Exit profiler */
-	static inline TInt ExitProfiler();
-
-	/** Get file name */
-	static inline TInt GetFileName(TDes&);
-    /** Get active writer */
-    static inline TInt GetActiveWriter(TDes&);
-	/** Perform a test case */
-	static inline TInt Test(TUint32 testCase);
-	/** Issue a control request to the engine without data*/
-	static inline TInt ControlState(TCommand aRequest);
-	/** Issue a control request to the engine with descriptor data to write there*/
-	static inline TInt ControlWrite(TCommand aRequest,TDesC& data);
-	/** Issue a control request to the engine with numeric and descriptor data to write there*/
-	static inline TInt ControlWrite(TCommand aRequest,TInt numData, TDesC& data);
-	/** Issue a control request to read descriptor data from the engine*/
-	static inline TInt ControlRead(TCommand aRequest,TDes& data);
-	/** Actually sends the message to profiler engine*/	
-	static inline TInt PerformControl(	TCommand aRequest,
-										TDesC* fromDescriptor = NULL,
-										TUint32 numData1 = 0,
-										TDes* toDescriptor = NULL,
-										TUint32 numData2 = 0xffffffff);
-	
-	static inline TInt AttachClient();
-	static inline TInt RemoveClient();
-
-private:
-	inline RProfiler();
-	};
-
-inline RProfiler::RProfiler()
-	{}
-
-//
-// Connect to the profiler engine, and issue the control request if successful
-//
-inline TInt RProfiler::ControlState(TCommand aRequest)
-    { return PerformControl(aRequest); }
-
-//
-// Connect to the profiler engine, and issue the control request if successful
-//
-inline TInt RProfiler::ControlWrite(TCommand aRequest,TDesC& data)
-    { return PerformControl(aRequest,&data,0); }
-
-//
-// Connect to the profiler engine, and issue the control request if successful
-//
-inline TInt RProfiler::ControlWrite(TCommand aRequest,TInt numData, TDesC& data)
-    { return PerformControl(aRequest,&data,numData); }
-
-//
-// Connect to the profiler engine, and issue the control request if successful
-//
-inline TInt RProfiler::ControlRead(TCommand aRequest,TDes& data)
-    { return PerformControl(aRequest,0,0,&data); }
-
-inline TInt RProfiler::PerformControl(TCommand aRequest,TDesC* fromDescriptor,TUint32 numData1,TDes* toDescriptor,TUint32 numData2)
-	{
-	LOGTEXT(_L("Creating a session to profiler"));
-	RProfiler p;
-	TUint count(0);
-	TInt r(KErrNone);
-
-	// in boot measurement mode, count until 30s
-	#ifdef PROFILER_BOOT_MEASUREMENT
-	while(count < 60)
-	#else
-	while(count < 6)
-	#endif
-		{
-		r = p.CreateSession(KProfilerName, TVersion(), 0);
-		if (r == KErrNone)
-			{
-			LOGSTRING2("Succeeded, sending a message %d", aRequest);
-			LOGSTRING5(" - parameters 0x%x 0x%x 0x%x 0x%x",fromDescriptor,numData1,toDescriptor,numData2);
-			TInt err = KErrNone;
-
-			TIpcArgs a;
-			a.Set(0,fromDescriptor);
-			a.Set(1,numData1);
-			a.Set(2,toDescriptor);
-			a.Set(3,numData2);
-			err = p.SendReceive(aRequest,a);
-
-			p.RSessionBase::Close();
-			
-			if(err != KErrNone)
-				{
-				LOGSTRING2("Profiler responded with an error - code %d !!",err);		
-				return err;
-				}
-			else
-				{ 
-				LOGTEXT(_L("OK, message sent, closing"));
-				return KErrNone;
-				}
-			}
-
-		LOGSTRING2("Error in opening session to profiler - code %d !!",r);
-		//#ifdef PROFILER_BOOT_MEASUREMENT
-		// there was an error contacting the Profiler
-		// indicates that the server is most probably not up
-		// however, since it should be(unless some resource is not yet ready)
-		// we can just wait
-		User::After(500000); // wait 1/2 s
-		count++;
-		//#else
-		// exit immediately on error
-		//return r;
-		//#endif
-		}
-	return r;
-	}
-
-// the new UI access methods
-inline TInt RProfiler::GetGeneralAttributes(TGeneralAttributes& aAttributes)
-    {
-#ifdef _TEST_
-    _LIT(KDefaultTraceOutput,"debug_output");
-    _LIT(KDefaultTraceFilePrefix,"PIProfiler_#");
-    _LIT(KDefaultTraceFileSaveDrive,"E:\\");
-    aAttributes.iTraceOutput.Copy(KDefaultTraceOutput);
-    aAttributes.iTraceFilePrefix.Copy(KDefaultTraceFilePrefix);
-    aAttributes.iSaveFileDrive.Copy(KDefaultTraceFileSaveDrive);
-#else
-    LOGTEXT(_L("Creating a session to profiler"));
-    RProfiler p;
-    TInt r(KErrNone);
-    r = p.CreateSession(KProfilerName, TVersion(), 0);
-    if (r == KErrNone)
-        {
-        LOGSTRING2("Succeeded, sending a message %d", EGetGeneralAttributes);
-
-        TPckg<TGeneralAttributes> attrPckg(aAttributes);
-        TIpcArgs a(&attrPckg);
-        r = p.SendReceive(RProfiler::EGetGeneralAttributes,a);
-        
-        p.RSessionBase::Close();
-        
-        if(r != KErrNone)
-            {
-            LOGSTRING2("Profiler responded with an error - code %d !!",r);        
-            return r;
-            }
-        else
-            { 
-            LOGTEXT(_L("OK, message sent, closing"));
-            return KErrNone;
-            }
-        }
-#endif
-    return r;   // return error code  
-    }
-inline TInt RProfiler::GetSamplerAttributes(CArrayFixFlat<TSamplerAttributes>& aAttributes)
-    {
-#ifdef _TEST_
-    _LIT(KDefaultTraceOutput,"debug_output");
-    _LIT(KDefaultTraceFilePrefix,"PIProfiler_#");
-    _LIT(KDefaultTraceFileSaveDrive,"E:\\");
-    aAttributes.iTraceOutput.Copy(KDefaultTraceOutput);
-    aAttributes.iTraceFilePrefix.Copy(KDefaultTraceFilePrefix);
-    aAttributes.iSaveFileDrive.Copy(KDefaultTraceFileSaveDrive);
-#else
-    // do receive stream of TSamplerAttributes
-    LOGTEXT(_L("Creating a session to profiler"));
-    RProfiler p;
-    TInt r(KErrNone);
-    r = p.CreateSession(KProfilerName, TVersion(), 0);
-    if (r == KErrNone)
-        {
-        TInt attrCount(0);
-        TPckg<TInt> pckg(attrCount);
-        TIpcArgs args(&pckg);
-        
-        r = p.SendReceive(RProfiler::EGetSamplerAttributeCount, args);
-        
-        HBufC8* buffer = HBufC8::NewL(attrCount*sizeof(TSamplerAttributes));
-        TPtr8 ptr(buffer->Des());
-        TIpcArgs args2(&ptr);
-        r = p.SendReceive(RProfiler::EGetSamplerAttributes, args2);
-        
-        TInt len(ptr.Length());
-        TInt pos(0);
-        while (pos != len)
-           {
-           TPckgBuf<TSamplerAttributes> attrPckg;
-           attrPckg.Copy(ptr.Mid(pos, attrPckg.Length()));
-           pos += attrPckg.Length();
-    
-           aAttributes.AppendL(attrPckg());
-           }
-        
-        p.RSessionBase::Close();
-        
-        if(r != KErrNone)
-            {
-            LOGSTRING2("Profiler responded with an error - code %d !!",r);        
-            return r;
-            }
-        else
-            { 
-            LOGTEXT(_L("OK, message sent, closing"));
-            return KErrNone;
-            }
-        }
-#endif
-    return KErrNone; 
-    }
-
-inline TInt RProfiler::SetGeneralAttributes(TGeneralAttributes aAttributes)
-    {
-    // do receive stream of TSamplerAttributes
-    LOGTEXT(_L("Creating a session to profiler"));
-    RProfiler p;
-    TInt r(KErrNone);
-    r = p.CreateSession(KProfilerName, TVersion(), 0);
-    if (r == KErrNone)
-        {
-
-        TPckg<TGeneralAttributes> attrPckg(aAttributes);
-        TIpcArgs a(&attrPckg);
-        r = p.SendReceive(RProfiler::ESetGeneralAttributes,a);
-        
-        p.RSessionBase::Close();
-        
-        if(r != KErrNone)
-            {
-            LOGSTRING2("Profiler responded with an error - code %d !!",r);        
-            return r;
-            }
-        else
-            { 
-            LOGTEXT(_L("OK, message sent, closing"));
-            return KErrNone;
-            }
-        }
-    return r; 
-    }
-
-// save settings back to engine and plugins
-inline TInt RProfiler::SetSamplerAttributes(TSamplerAttributes aAttributes)
-    {
-    // do receive stream of TSamplerAttributes
-    LOGTEXT(_L("Creating a session to profiler"));
-    RProfiler p;
-    TInt r(KErrNone);
-    r = p.CreateSession(KProfilerName, TVersion(), 0);
-    if (r == KErrNone)
-        {
-
-        TPckg<TSamplerAttributes> attrPckg(aAttributes);
-        
-        TIpcArgs a;
-        a.Set(0,&attrPckg);
-
-        r = p.SendReceive(RProfiler::ESetSamplerAttributes,a);
-        
-        p.RSessionBase::Close();
-        
-        if(r != KErrNone)
-            {
-            LOGSTRING2("Profiler responded with an error - code %d !!",r);        
-            return r;
-            }
-        else
-            { 
-            LOGTEXT(_L("OK, message sent, closing"));
-            return KErrNone;
-            }
-        }
-    return r; 
-    }
-
-inline TInt RProfiler::RefreshProfilerStatus()
-    {return ControlState(RProfiler::ERefreshProfilerStatus); }
-
-inline TInt RProfiler::StartSampling(RProfiler::TProfilingMode aProfilingMode)
-	{
-    RProfiler::TCommand command = RProfiler::EStartSampling;
-    if( aProfilingMode == RProfiler::EProfilingModeTimed )
-        {
-        command = RProfiler::EStartTimedSampling;
-        }    
-    return ControlState(command);
-	}
-
-inline TInt RProfiler::StopSampling()
-	{return ControlState(RProfiler::EStopSampling);}
-
-inline TInt RProfiler::ExitProfiler()
-	{return ControlState(RProfiler::EExitProfiler);}
-
-inline TInt RProfiler::AttachClient()
-    {return ControlState(RProfiler::EAttachClient);}
-
-inline TInt RProfiler::RemoveClient()
-    {return ControlState(RProfiler::ERemoveClient);}
-
-inline TInt RProfiler::GetFileName(TDes& fileName)
-	{return ControlRead(EGetFileName,fileName);}
-
-inline TInt RProfiler::GetActiveWriter(TDes& writerDes)
-    {return ControlRead(EGetActiveWriter,writerDes);}
-
-#endif // __PROFILER_SESSION_H__
--- a/piprofiler/piprofiler_plat/inc/ProfilerTraces.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +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 __PROFILER_TRACES_H__
-#define __PROFILER_TRACES_H__
-
-#include <e32def.h>
-
-
-// ---------------------------------------------------------------------------
-// You change these logging method values below! Recompile the application to take changes effect.
-
-    // logging methods
-    // 0 = No logging
-    // 1 = Flogger
-    // 2 = RDebug
-    // 3 = Flogger and RDebug
-
-#undef _DEBUG
-
-    #ifndef _DEBUG
-        
-        // Logging method for UREL builds:
-        #define PROFILER_LOGGING_METHOD  0
-
-    #else
-
-        // Logging method for UDEB builds:
-        #define PROFILER_LOGGING_METHOD  2
-
-    #endif    
-    
-    #ifndef _KERNEL_DEBUG
-        
-        // Logging method for UREL builds:
-        #define KERNEL_LOGGING_METHOD  0
-
-    #else
-
-        // Logging method for UDEB builds:
-        #define KERNEL_LOGGING_METHOD  1
-
-    #endif    
-
-
-
-#ifndef __KERNEL_MODE__
-
-// ---------------------------------------------------------------------------
-// Do not make any changes to lines below...
-
-    #if PROFILER_LOGGING_METHOD == 1 || PROFILER_LOGGING_METHOD == 3
-
-        #include <flogger.h>
-        _LIT(KLogFolder,"PIProfiler");
-        _LIT(KLogFile,"PIProfiler_Trace.txt");
-
-    #endif
-
-    #if PROFILER_LOGGING_METHOD == 2 || PROFILER_LOGGING_METHOD == 3
-
-        #include <e32debug.h>
-
-    #endif
-
-
-    #if PROFILER_LOGGING_METHOD == 0
-    
-        #define LOGTEXT(AAA)
-        #define LOGSTRING(AAA)
-        #define LOGSTRING2(AAA,BBB)
-        #define LOGSTRING3(AAA,BBB,CCC)
-        #define LOGSTRING4(AAA,BBB,CCC,DDD)
-		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE)
-    
-    
-    #elif PROFILER_LOGGING_METHOD == 1
-    
-        #define LOGTEXT(AAA)                RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend, AAA)
-        #define LOGSTRING(AAA)              do { _LIT(tempLogDes,AAA); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,tempLogDes()); } while (0)
-        #define LOGSTRING2(AAA,BBB)         do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB); } while (0)
-        #define LOGSTRING3(AAA,BBB,CCC)     do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); } while (0)
-        #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD); } while (0)
-		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE); } while (0)
-   
-    #elif PROFILER_LOGGING_METHOD == 2
-    
-        #define LOGTEXT(AAA)                RDebug::Print(AAA);
-        #define LOGSTRING(AAA)              do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes); } while (0)
-        #define LOGSTRING2(AAA,BBB)         do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB); } while (0)
-        #define LOGSTRING3(AAA,BBB,CCC)     do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC); } while (0)
-        #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD); } while (0)
-		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD, EEE); } while (0)
-    
-    #elif PROFILER_LOGGING_METHOD == 3
-    
-        #define LOGTEXT(AAA)                RDebug::Print(AAA); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend, AAA)
-        #define LOGSTRING(AAA)              do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,tempLogDes()); } while (0)
-        #define LOGSTRING2(AAA,BBB)         do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB); } while (0)
-        #define LOGSTRING3(AAA,BBB,CCC)     do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); } while (0)
-        #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD); } while (0)
-		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD, EEE); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE); } while (0)
-
-    #endif
-
-#else __KERNEL_MODE__
-
-	#if KERNEL_LOGGING_METHOD == 0
-	
-		#define LOGTEXT(AAA)
-		#define LOGSTRING(AAA)
-		#define LOGSTRING2(AAA,BBB)
-		#define LOGSTRING3(AAA,BBB,CCC)
-		#define LOGSTRING4(AAA,BBB,CCC,DDD)
-		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE)
-
-	#else
-	
-		#define LOGTEXT(AAA)               		Kern::Printf(AAA)
-		#define LOGSTRING(AAA)             		Kern::Printf(AAA);
-		#define LOGSTRING2(AAA,BBB)        		Kern::Printf(AAA, BBB);
-		#define LOGSTRING3(AAA,BBB,CCC)     	Kern::Printf(AAA, BBB, CCC);
-		#define LOGSTRING4(AAA,BBB,CCC,DDD) 	Kern::Printf(AAA, BBB, CCC, DDD);
-		#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) Kern::Printf(AAA, BBB, CCC, DDD, EEE);
-
-	#endif
-#endif
-// ---------------------------------------------------------------------------
-
-#endif // __PROFILER_TRACES_H__
-
--- a/piprofiler/piprofiler_plat/inc/ProfilerVersion.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +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 PROFILER_TOOL_VERSION_H
-#define PROFILER_TOOL_VERSION_H
-
-	/*
-	 *
-	 *	PI Profiler tool composition definitions
-	 *
-	 */	
-
-	#define PROFILER_VERSION		"PI Profiler v2.1.0"
-	#define PROFILER_VERSION_SHORT	_L("2.00.0")
-	#define PROFILER_SAMPLER_VERSION	_L("2.00.0")
-	#define PROFILER_RELEASE_DATE			_L("23rd February 2009. ")
-	
-	#define PROFILER_GPP_SAMPLER_VERSION   _L("2.00")    // SMPfied v2.00
-	#define PROFILER_GFC_SAMPLER_VERSION   _L8("1.10")
-	#define PROFILER_ITT_SAMPLER_VERSION   _L8("1.22")
-	#define PROFILER_MEM_SAMPLER_VERSION	_L8("2.02")
-	#define PROFILER_PRI_SAMPLER_VERSION	_L8("1.56")
-	#define PROFILER_BUP_SAMPLER_VERSION	_L8("1.20")
-	#define PROFILER_IRQ_SAMPLER_VERSION	_L8("1.20")
-	#define PROFILER_TIP_SAMPLER_VERSION	_L8("1.10")
-	#define PROFILER_PEC_SAMPLER_VERSION  _L8("1.24")
-	#define PROFILER_PWR_SAMPLER_VERSION	_L8("1.57")
-	#define PROFILER_SCR_SAMPLER_VERSION	_L8("1.57")
-	#define PROFILER_IPC_SAMPLER_VERSION	_L8("1.59")
-    #define PROFILER_GPU_SAMPLER_VERSION    _L8("1.00")
-
-#endif
--- a/piprofiler/piprofiler_plat/inc/SamplerPluginInterface.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +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 __SAMPLER_PLUGIN_INTERFACE__
-#define __SAMPLER_PLUGIN_INTERFACE__
-
-#include <e32base.h>
-#include <ecom/ecom.h>
-#include <badesca.h>
-#include <piprofiler/ProfilerAttributes.h>	// internal settings format presentations 
-
-
-// Constant for indexing (iOrder):
-const TInt KSamplerPluginNotIndexed      = -1;
-
-/**
- * Constant:    KSamplerPluginInterfaceUid
- *
- * Description: UID of this ECOM interface. It should be unique in the system.
- *              It is used to identify this specific custom interface.
- *              Implementations of this interface will use this ID, when they
- *              publish the implementation. Clients use this UID to search for
- *              implementations for this interface (the
- *              EcomInterfaceDefinition.inl does this).
- */
-const TUid KSamplerPluginInterfaceUid = {0x2001E5BC};
-
-/**
- *
- * Description: UID of this ECOM interface. It should be unique in the system.
- *
- */
-enum TGenericSettingTypes
-{
-	EEnablePlugin,
-	EOutputSettings,
-	ESaveDrive,
-	EFilePrefix,
-	ETracingMode
-};
-
-
-enum TSamplerCaptionTypes
-	{
-	ECaptionLengthShort,
-	ECaptionLengthMedium,
-	ECaptionLengthLong,
-    ESettingsCaption
-	};
-
-
-/**
-* Used by GetValue(). These are the keys for retrieving a specific
-* value. This enum can be extended to provide other values as well as
-* long as the original keys are not changed.
-*/
-enum TSamplerPluginValueKeys
-    {
-
-    ESamplerPluginKeySettingsItemValueString = 1,
-    ESamplerPluginSettings,
-    ESamplerPluginEnabled,
-    ESamplerPluginDisabled,
-    ESamplerPluginType,
-    ESamplerPluginVersion
-    };
- 
-
-/**
- * Class:       CSamplerInterfaceDefinition
- *
- * Description: Custom ECOM interface definition. This interface is used by
- *              clients to find specific instance and do corresponding
- *              calculation operation for given too numbers. Plugin
- *              implementations implement the Calculate function.
- */
-class TBapBuf;
-class CProfilerSampleStream;
-
-class CSamplerPluginInterface : public CBase 
-{
-
-    // CSamplerPluginLoader accesses iOrder which should not be accessed outside.
-    friend class CSamplerPluginLoader;
-
-public: 
-	// Wrapper functions to handle ECOM "connectivity".
-    // These are implemented in EComInterfaceDefinition.inl.
-    // These functions are used only by the client.
-    
-	/**
-     * Function:   NewL
-     *
-     * Description: Wraps ECom object instantitation. Will search for
-     *              interface implementation, which matches to given
-     *              aOperationName.
-     *
-     * Param:       aOperationName name of requested implementation.
-     *              Implementations advertise their "name" as specified
-     *              in their resource file field
-     *                 IMPLEMENTATION_INFO::default_data.
-     *              For details, see EcomInterfaceDefinition.inl comments.
-     *              In this example, the allowed values are "sum" and
-     *              "multiply".
-     *
-     * Note:        This is not a "normal" NewL method, since normally NewL
-     *              methods are only defined for concrete classes.
-     *              Note that also implementations of this interface provide
-     *              NewL methods. They are the familiar NewL's, which create
-     *              instance of classes.
-     */
-    static CSamplerPluginInterface* NewL(const TUid aImplementationUid, TAny* aInitParams);
-
-    /**
-     * Function:   ~CSamplerPluginInterface
-     *
-     * Description: Wraps ECom object destruction. Notifies the ECOM
-     *              framework that specific instance is being destroyed.
-     *              See EcomInterfaceDefinition.inl for details.
-     */
-    virtual ~CSamplerPluginInterface();
-protected: // New
-
-	/**
-	* C++ constructor.
-	*/
-	CSamplerPluginInterface();
-        
-public: 
-	// Public pure virtual functions, which are implemented by
-    // interface implementations (See ..\plugin)
-    
-    /**
-     * Method for initializing and starting of profiling in single plugin implementation
-     * @param aStream is a data stream to store the gathered data, provided by engine
-     * @return TInt if no error KErrNone, else any of system-wide errors
-     */
-    virtual TInt	ResetAndActivateL(CProfilerSampleStream& aStream) = 0;
-
-	/**
-     * Method for stopping of profiling in single plugin implementation
-     * @return TInt if no error KErrNone, else any of system-wide errors
-     */
-    virtual TInt	StopSampling() = 0;
-	
-    /**
-     * Method for checking if plugin is enabled
-     * @return TBool if enabled return ETrue else EFalse
-     */
-    virtual TBool   Enabled() = 0;
- 	
-    /**
-    * Method for getting an array of sampler attributes, size of an array: 1...n
-    * @return array of settings of one or several sampler plugins
-    */
-    virtual void GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributeArray) = 0;	
-    
-    /**
-    * Method for setting configurations of single sampler attributes
-    * @param aAttributes contains settings of a single sampler plugin 
-    */
-    virtual TInt SetAttributesL(TSamplerAttributes aAttributes) = 0; 
-    
-    /**
-    * Method for parsing text formatted settings block and converting
-    * it to TSamplerAttributes data structure
-    * @param aSingleSettingArray containing setting lines of a single sampler
-    * @return status of conversion, if success KErrNone, else KErrGeneral
-    */
-    virtual TInt ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray) = 0;
- 
-    /**
-    * Method for getting UID of this plugin.
-    * @param aSubId the implementation id of sub sampler
-    * @returns uid of sampler or sub sampler, if aSubId -1 uid of sampler, else uid of sub sampler
-    */
-    virtual TUid 	Id(TInt aSubId) const = 0;
-    
-    /**
-    * Method for getting locally defined sub ID value inside a specific plug-in.
-    * @param aUid of a specific sampler
-    * @returns local ID of sampler or sub sampler
-    */
-    virtual TInt 	SubId(TUid aUid) const = 0;
-    
-    /**
-    * Method for getting sampler type.
-    * @returns PROFILER_USER_MODE_SAMPLER, PROFILER_KERNEL_MODE_SAMPLER or PROFILER_DUMMY_MODE_SAMPLER
-    */
-    virtual TInt 	GetSamplerType() = 0;
-	 
-	 
-	 // some internal inline methods, used by engine
-    inline TInt     Flush();
-    inline TInt     AddSample(TUint8* sample, TUint32 length, TInt limitSize);  
-    inline void     SetOrder( TInt aOrder );
-    inline static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray);
-
-    /**
-    * Static methods for getting setting value out of descriptor
-    * 
-    * @param aBuf buffer where to convert the value
-    * @param aValue parameter where to store the requested type of value
-    */
-    inline static void     Str2Bool(const TDesC8& aBuf, TBool& aValue);
-    inline static void     Str2Int(const TDesC8& aBuf, TInt& aValue);
-    inline static void     Str2Int(const TDesC8& aBuf, TUint32& aValue);
-     
-    /** iDtor_ID_Key Instance identifier key. When instance of an
-     *               implementation is created by ECOM framework, the
-     *               framework will assign UID for it. The UID is used in
-     *               destructor to notify framework that this instance is
-     *               being destroyed and resources can be released.
-     */
-    TUid iDtor_ID_Key;
-    
-    /**
-	* Index of the plugin in listbox. Used for CSamplerPluginLoader. Default
-	* value is KSamplerPluginNotIndexed which means not ordered. This value is
-	* read, if defined, from the opaque_data field of the plugin's resource
-	* definition. Index starts from 0.
-	*/
-	TInt iOrder;
-
-public:	    
-	TInt 					iSamplerType;
-	
-	// this variable must be defined by the extending classes!!
-	TInt					iSamplerId;
-	
-	CProfilerSampleStream*	iStream;
-    TBool                   iEnabled;
-		
-private:
-	TBapBuf*				iBuffer;
-};
-
-#include <piprofiler/ProfilerGenericClassesUsr.h>
-#include <piprofiler/SamplerPluginInterface.inl>
-
-
-#endif // __SAMPLER_PLUGIN_INTERFACE__
--- a/piprofiler/piprofiler_plat/inc/SamplerPluginInterface.inl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +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:  
-*
-*/
-
-
-// LITERALS
-_LIT8(KTrue, "true");
-_LIT8(KFalse, "false");
-
-inline CSamplerPluginInterface::CSamplerPluginInterface()
-    : iOrder( KSamplerPluginNotIndexed )
-    {
-    iBuffer = 0;
-    iStream = 0;
-    }
-
-// -----------------------------------------------------------------------------
-// CSamplerPluginInterface::~CSamplerPluginInterface()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-inline CSamplerPluginInterface::~CSamplerPluginInterface()
-    {
-    iBuffer = 0;
-    REComSession::DestroyedImplementation(iDtor_ID_Key);
-    }
-
-
-inline CSamplerPluginInterface* CSamplerPluginInterface::NewL(const TUid aImplementationUid, TAny* aInitParams)
-    {
-    // Define options, how the default resolver will find appropriate
-    // implementation.
-    return REINTERPRET_CAST(CSamplerPluginInterface*, 
-                            REComSession::CreateImplementationL(aImplementationUid,
-                                                                _FOFF( CSamplerPluginInterface, iDtor_ID_Key ),
-                                                                aInitParams)); 
-    }
-
-inline void CSamplerPluginInterface::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray)
-    {
-    REComSession::ListImplementationsL(KSamplerPluginInterfaceUid, aImplInfoArray);
-    }
-
-inline void CSamplerPluginInterface::SetOrder( TInt aOrder )
-    {
-    iOrder = aOrder;
-    }
-
-inline TInt CSamplerPluginInterface::Flush() 
-    {
-	// complete the header
-	TUint32 header;
-	header = (iBuffer->iDataSize & 0x00ffffff) - 4;
-	header += (iSamplerId << 24);
-
-	// flush the header info
-	iBuffer->iBuffer[0] = header;
-	iBuffer->iBuffer[1] = header >> 8;
-	iBuffer->iBuffer[2] = header >> 16;
-	iBuffer->iBuffer[3] = header >> 24;
-	
-    // write data to filled buffers
-    iStream->AddToFilledBuffers(iBuffer);
-    // notify selected writer plugin to write data to output
-    iStream->NotifyWriter();
-
-    iBuffer = 0;
-
-	return KErrNone;
-}
-
-
-inline TInt CSamplerPluginInterface::AddSample(TUint8* aSample, TUint32 aLength, TInt aLimitSize)
-    {
-    LOGTEXT(_L("CSamplerPluginInterface::AddSample - entry"));
-	if(iBuffer == 0) 
-	    {
-	    // get next free buffer where to write data
-		iBuffer = iStream->GetNextFreeBuffer();
-		iBuffer->iBufDes->Zero();
-		
-		// get space for the header
-		TUint32 header = 0;
-		iBuffer->iBufDes->Append((TUint8*)&header, 4);	
-		iBuffer->iDataSize += 4;
-	    }
-		
-	// add data to the buffer...
-	// if all data fit to the current buffer
-	if(iBuffer->iBufferSize - iBuffer->iDataSize >= (TInt)aLength)
-	    {
-		iBuffer->iBufDes->Append(aSample, (TInt)aLength);
-		iBuffer->iDataSize += (TInt)aLength;
-	    }
-	else 
-	    {	
-		// fill in the buffer
-		TUint32 rest = iBuffer->iBufferSize - iBuffer->iDataSize;
-		iBuffer->iBufDes->Append(aSample, rest);
-		iBuffer->iDataSize += (TInt)rest;
-		
-		// The buffer is full now, complete the header
-		TUint32 header;
-		header = (iBuffer->iDataSize & 0x00ffffff) - 4;
-		header += (iSamplerId << 24);
-		iBuffer->iBuffer[0] = header;
-		iBuffer->iBuffer[1] = header >> 8;
-		iBuffer->iBuffer[2] = header >> 16;
-		iBuffer->iBuffer[3] = header >> 24;
-		
-		// write data to filled buffers
-		iStream->AddToFilledBuffers(iBuffer);
-	    // notify selected writer plugin to write data to output
-	    iStream->NotifyWriter();
-		
-		// Fetch an empty buffer and reserve space for the header
-		iBuffer = iStream->GetNextFreeBuffer();
-		iBuffer->iBufDes->Zero();
-		header = 0;
-		iBuffer->iBufDes->Append((TUint8*)&header, 4);	
-		iBuffer->iDataSize += 4;
-			
-		// copy the rest of data to the new buffer
-		iBuffer->iBufDes->Append(aSample+rest, aLength-rest);
-		iBuffer->iDataSize += (TInt)aLength-rest;
-	    }
-	
-	// Once iBuffer->dataSize reaches the limitSize, data from iBuffer is flushed to file/debug port.
-	// If limitSize is set to zero, buffer is not changed until iBuffer gets full.
-	if(aLimitSize != 0) 
-	    {
-		if(iBuffer->iDataSize >= aLimitSize) 
-		    {
-			// The buffer is full now, complete the header
-			TUint32 header;
-			header = (iBuffer->iDataSize & 0x00ffffff) - 4;
-			header += (iSamplerId << 24);
-			iBuffer->iBuffer[0] = header;
-			iBuffer->iBuffer[1] = header >> 8;
-			iBuffer->iBuffer[2] = header >> 16;
-			iBuffer->iBuffer[3] = header >> 24;
-	
-
-            // write data to filled buffers
-            iStream->AddToFilledBuffers(iBuffer);
-            // notify selected writer plugin to write data to output
-            iStream->NotifyWriter();
-		    
-			// Fetch an empty buffer and reserve space for the header
-			iBuffer = iStream->GetNextFreeBuffer();
-			iBuffer->iBufDes->Zero();
-			header = 0;
-			iBuffer->iBufDes->Append((TUint8*)&header, 4);	
-			iBuffer->iDataSize += 4;
-		    }
-	    }
-	return KErrNone;
-    }
-
-// ----------------------------------------------------------------------------
-// Converts given descriptor into TBool value.
-// ----------------------------------------------------------------------------
-//
-inline void CSamplerPluginInterface::Str2Bool(const TDesC8& aBuf, TBool& aValue)
-    {
-    if (aBuf.CompareF(KFalse) == 0)
-        aValue = EFalse;
-    else
-        aValue = ETrue;
-    }
-
-// ----------------------------------------------------------------------------
-// Converts given descriptor into TInt value.
-// ----------------------------------------------------------------------------
-//
-inline void CSamplerPluginInterface::Str2Int(const TDesC8& aBuf, TInt& aValue)
-    {
-    TLex8 conv;
-    conv.Assign(aBuf);
-    
-    if (conv.Val(aValue) != KErrNone)
-        aValue = 0;
-    }
-
-// ----------------------------------------------------------------------------
-// Converts given descriptor into TInt value.
-// ----------------------------------------------------------------------------
-//
-inline void CSamplerPluginInterface::Str2Int(const TDesC8& aBuf, TUint32& aValue)
-    {
-    TInt temp(0);
-    
-    TLex8 conv;
-    conv.Assign(aBuf);
-    
-    if (conv.Val(temp) != KErrNone)
-        aValue = 0;
-    else
-        aValue = (TUint32)temp;
-    }
-
-// End of file
--- a/piprofiler/piprofiler_plat/inc/WriterPluginInterface.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +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 __WRITERPLUGIN_INTERFACE__
-#define __WRITERPLUGIN_INTERFACE__
-
-#include <e32base.h>
-#include <ecom/ecom.h>
-#include <badesca.h>
-
-
-// Constant for indexing (iOrder):
-const TInt KWriterPluginNotIndexed      = -1;
-
-/**
- * Constant:    KWriterPluginInterfaceUid
- *
- * Description: UID of this ECOM interface. It should be unique in the system.
- *              It is used to identify this specific custom interface.
- *              Implementations of this interface will use this ID, when they
- *              publish the implementation. Clients use this UID to search for
- *              implementations for this interface (the
- *              EcomInterfaceDefinition.inl does this).
- */
-const TUid KWriterPluginInterfaceUid = {0x2001E5BD};
-
-/**
-* Used by GetValue(). These are the keys for retrieving a specific
-* value. This enum can be extended to provide other values as well as
-* long as the original keys are not changed.
-*/
-enum TWriterPluginValueKeys
-    {
-    EWriterPluginKeySettingsItemValueString = 1,
-    EWriterPluginSettings,
-    EWriterPluginEnabled,
-    EWriterPluginDisabled,
-    EWriterPluginType,
-    EWriterPluginVersion
-    };
-/**
- *
- * Description: UID of this ECOM interface. It should be unique in the system.
- *
- */
-    
-/**
- * Class:       CWriterInterfaceDefinition
- *
- * Description: Custom ECOM interface definition. This interface is used by
- *              clients to find specific instance and do corresponding
- *              calculation operation for given too numbers. Plugin
- *              implementations implement the Calculate function.
- */
-
-class CProfilerSampleStream;
-
-class CWriterPluginInterface : public CBase
-    {
-
-    // CSamplerPluginLoader accesses iOrder which should not be accessed outside.
-    friend class CWriterPluginLoader;
-
-public: // Wrapper functions to handle ECOM "connectivity".
-        // These are implemented in EComInterfaceDefinition.inl.
-        // These functions are used only by the client.
-    /**
-     * Function:   NewL
-     *
-     * Description: Wraps ECom object instantitation. Will search for
-     *              interface implementation, which matches to given
-     *              aOperationName.
-     *
-     * Param:       aOperationName name of requested implementation.
-     *              Implementations advertise their "name" as specified
-     *              in their resource file field
-     *                 IMPLEMENTATION_INFO::default_data.
-     *              For details, see EcomInterfaceDefinition.inl comments.
-     *              In this example, the allowed values are "sum" and
-     *              "multiply".
-     *
-     * Note:        This is not a "normal" NewL method, since normally NewL
-     *              methods are only defined for concrete classes.
-     *              Note that also implementations of this interface provide
-     *              NewL methods. They are the familiar NewL's, which create
-     *              instance of classes.
-     */
-    static CWriterPluginInterface* NewL(const TUid aImplementationUid, TAny* aInitParams);
-
-    /**
-     * Function:   ~CWriterPluginInterface
-     *
-     * Description: Wraps ECom object destruction. Notifies the ECOM
-     *              framework that specific instance is being destroyed.
-     *              See EcomInterfaceDefinition.inl for details.
-     */
-    virtual ~CWriterPluginInterface();
-protected: // New
-
-        /**
-        * C++ constructor.
-        */
-        CWriterPluginInterface();
-       
-public: 
-     /**
-      * Method for getting caption of this plugin. This should be the
-      * localized name of the settings view to be shown in parent view.
-      *
-      * @param aCaption pointer to Caption variable
-      */
-	 virtual TInt 	Start() = 0;
-	 
-	 virtual void 	Stop() = 0;
-
-	 virtual TUid 	Id() const = 0;
-	 
-	 virtual void 	GetValue( const TWriterPluginValueKeys aKey, TDes& aValue ) = 0;
-	 
-	 virtual void 	SetValue( const TWriterPluginValueKeys aKey, TDes& aValue ) = 0;
-	
-	 virtual void 	GetWriterVersion(TDes* aDes) = 0;
-
-	 virtual TUint32 GetWriterType() = 0;
-
-	 virtual TBool GetEnabled() = 0;
-
-     virtual void   WriteData() = 0;
-     virtual void   SetStream( CProfilerSampleStream& aStream ) = 0;
-     
-	 // internal inline functions
-	 inline static void ListAllImplementationsL( RImplInfoPtrArray& aImplInfoArray );
-     inline void    SetOrder( TInt aOrder );
-     
-private:
-
-    /** iDtor_ID_Key Instance identifier key. When instance of an
-    * implementation is created by ECOM framework, the
-    * framework will assign UID for it. The UID is used in
-    * destructor to notify framework that this instance is
-    * being destroyed and resources can be released.
-    */
-    TUid iDtor_ID_Key;
-    
-    /**
-    * Index of the plugin in listbox. Used for CSamplerPluginLoader. Default
-    * value is KSamplerPluginNotIndexed which means not ordered. This value is
-    * read, if defined, from the opaque_data field of the plugin's resource
-    * definition. Index starts from 0.
-    */
-    TInt iOrder;
-public:
-	TInt	                      iAdditionalSettings;	
-	TBool                         isEnabled;
-    };
-
-#include <piprofiler/WriterPluginInterface.inl>
-
-#endif // __WRITERPLUGIN_INTERFACE__
--- a/piprofiler/piprofiler_plat/inc/WriterPluginInterface.inl	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +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:  
-*
-*/
-
-
-inline CWriterPluginInterface::CWriterPluginInterface()
-    : iOrder( KWriterPluginNotIndexed ) 
-    {
-        
-    }
-
-// -----------------------------------------------------------------------------
-// CWriterPluginInterface::~CWriterPluginInterface()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-inline CWriterPluginInterface::~CWriterPluginInterface()
-    {
-    // We don't unload the plugin object here. The loader
-    // has to do this for us. Without this kind of destruction idiom, 
-    // the view framework can potentially unload an ECOM plugin dll whilst 
-    // there are still child views (Created by the plugin) that are registered 
-    // with the view framework. If this occurs, the plugin code segment isn't 
-    // loaded anymore and so there is no way to run the subsequent destructor 
-    // code => exception.
-    
-    // If in the NewL some memory is reserved for member data, it must be
-    // released here. This interface does not have any instance variables so
-    // no need to delete anything.
-
-    // Inform the ECOM framework that this specific instance of the
-    // interface has been destroyed.
-    REComSession::DestroyedImplementation(iDtor_ID_Key);
-    }
-
-inline CWriterPluginInterface* CWriterPluginInterface::NewL(const TUid aImplementationUid, TAny* aInitParams)
-    {
-    // Define options, how the default resolver will find appropriate
-    // implementation.
-    return REINTERPRET_CAST(CWriterPluginInterface*, 
-                            REComSession::CreateImplementationL(aImplementationUid,
-                                                                _FOFF( CWriterPluginInterface, iDtor_ID_Key ),
-                                                                aInitParams)); 
-    }
-
-inline void CWriterPluginInterface::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray)
-    {
-    REComSession::ListImplementationsL(KWriterPluginInterfaceUid, aImplInfoArray);
-    }
-
-inline void CWriterPluginInterface::SetOrder( TInt aOrder )
-    {
-    iOrder = aOrder;
-    }
-
-// end of file
--- a/piprofiler/piprofiler_plat/piprofiler_api.metaxml	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<api id="59f5d0509cc9c1556b04d7b6ff036bd0" dataversion="2.0">
-  <name>PIProfiler API</name>
-  <description>Defines the PIProfiler API, which is used for different PI Profiler sub projects.</description>
-  <type>c++</type>
-  <collection>piprofiler</collection>
-  <libs>
-    <lib name="piprofilerapi.lib"/>
-  </libs>
-  <release category="platform" sinceversion=""/>
-  <attributes>
-    <!-- This indicates wether the api provedes separate html documentation -->
-    <!-- or is the additional documentation generated from headers. -->
-    <!-- If you are unsuere then the value is "no" -->
-    <htmldocprovided>no</htmldocprovided>
-    <adaptation>no</adaptation>
-  </attributes>
-</api>
--- a/piprofiler/plugins/BUPplugin/data/2001E5B6.rss	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 <ecom/registryinfo.rh>
-
-// Declares info for two implementations
-RESOURCE REGISTRY_INFO theInfo
-    {
-    // UID for the DLL. See mmp files
-    //__SERIES60_3X__ can't be used in resource files
-    dll_uid = 0x2001E5B6;
-
-    // Declare array of interface info. This dll contains implementations for 
-    // only one interface (CSamplerInterfaceDefinition).
-    interfaces = 
-        {
-        INTERFACE_INFO
-            {
-            // UID of interface that is implemented
-            interface_uid = 0x2001E5BC;
-
-            implementations = 
-                {
-                IMPLEMENTATION_INFO
-                    {
-                    implementation_uid = 0x2001E5B6;
-
-                    version_no = 1;
-                    display_name = "BUP Sampler";
-                    default_data = "bup";
-                    opaque_data = "6";
-                    }
-                };
-            }
-        };
-    }
--- a/piprofiler/plugins/BUPplugin/group/BUPPlugin.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 <platform_paths.hrh>
-
-
-TARGET          PIProfilerBUP.dll
-TARGETTYPE      PLUGIN
-UID             0x10009D8D 0x2001E5B6
-VENDORID        VID_DEFAULT
-CAPABILITY      ALL -TCB
-SMPSAFE
-
-OS_LAYER_SYSTEMINCLUDE
-USERINCLUDE     ../inc
-SOURCEPATH      ../src
-
-START RESOURCE  ../data/2001E5B6.rss
-TARGET PIProfilerBUP.rsc
-END
-
-SOURCE      BupPluginImplementationTable.cpp
-SOURCE      BupPlugin.cpp 
-SOURCE      TouchEventClientDll.cpp
-
-LIBRARY     euser.lib
-LIBRARY		bafl.lib
-LIBRARY     ecom.lib
-LIBRARY     apparc.lib
-LIBRARY     cone.lib
-LIBRARY     gdi.lib
-LIBRARY     ws32.lib
-LIBRARY     efsrv.lib
-LIBRARY     charconv.lib
-LIBRARY     CommonEngine.lib
-LIBRARY		flogger.lib
--- a/piprofiler/plugins/BUPplugin/group/TouchAnimDll.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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 <platform_paths.hrh>
-
-
-TARGET      	PIProfilerTouchEventAnim.DLL
-UID 			0x10003B22 0x2001E5B7
-TARGETTYPE		ANI
-EPOCSTACKSIZE	0x5000
-VENDORID		VID_DEFAULT
-CAPABILITY		ALL -TCB // -AllFiles -NetworkControl -DiskAdmin -MultimediaDD -TCB -DRM
-SMPSAFE
-
-OS_LAYER_SYSTEMINCLUDE
-USERINCLUDE 	../inc
-SOURCEPATH		../src
-
-SOURCE 			TouchEventAnimDll.cpp
-
-LIBRARY 		euser.lib 
--- a/piprofiler/plugins/BUPplugin/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +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:  
-*
-*/
-
-
-PRJ_MMPFILES
-TouchAnimDll.mmp
-BUPPlugin.mmp
--- a/piprofiler/plugins/BUPplugin/inc/BupPlugin.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +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 PIPROFILER_BUPECOM_SAMPLER_H
-#define PIPROFILER_BUPECOM_SAMPLER_H
-
-#include <w32std.h>
-#include <w32std.h>			// RWsSession
-#include <w32adll.h>		// RAnim DLL
-#include <e32std.h>
-#include <e32property.h>	// RProperty
-
-#include <piprofiler/ProfilerTraces.h>
-#include <piprofiler/ProfilerConfig.h>
-#include <piprofiler/ProfilerVersion.h>
-#include <piprofiler/SamplerPluginInterface.h>
-#include <piprofiler/ProfilerGenericClassesUsr.h>
-
-#include <data_caging_path_literals.hrh> // for KDC_SHARED_LIB_DIR
-
-// Button press&touch event Anim DLL interface
-#include "TouchEventClientDll.h"
-
-// caption definitions
-_LIT8(KBUPShortName, "bup");
-_LIT8(KBUPLongName, "Button and touch event capture");
-_LIT8(KBUPDescription, "Button and touch event sampler\nTracing button and touch screen events\nHW dep: N/A\nSW dep: S60 3.0\n");
-
-const TUid KProfilerKeyEventPropertyCat={0x2001E5AD};
-enum TProfilerKeyEventPropertyKeys
-	{
-	EProfilerKeyEventPropertySample = 7
-	};
-
-const TUid KGppPropertyCat={0x20201F70};
-enum TGppPropertyKeys
-	{
-	EGppPropertySyncSampleNumber
-	};
-
-
-static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
-static _LIT_SECURITY_POLICY_C1(KCapabilityNone, ECapability_None);
-
-_LIT(KDllName, "PIProfilerTouchEventAnim.DLL");	// animation server dll	on user disk
-
-/*
- *	
- *	BUP sampler definition
- *	
- */
-class CProfilerButtonListener;
-class CSamplerPluginInterface;
-
-class CBupPlugin : public CSamplerPluginInterface
-{
-public:	
-	static CBupPlugin* NewL(const TUid aImplementationUid, TAny* aInitParams);
-			~CBupPlugin();
-
-	TInt	ResetAndActivateL(CProfilerSampleStream& aStream);
-	TInt	StopSampling();
-    TBool   Enabled() { return iEnabled; }
-
-	TInt	CreateFirstSample();
-
-	// no sub samplers, from CSamplerPluginInterface
-	TInt 	SubId(TUid /*aId*/) const {return KErrNotFound;}
-    TInt    GetSamplerType();
-	
-	void    GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes);
-    TInt    SetAttributesL(TSamplerAttributes aAttributes);
-    void    InitiateSamplerAttributesL();
-	
-    TInt    ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray);
-    
-    TInt    DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex);
-    void    SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex);
-    
-	TUid  Id(TInt aSubId) const;
-
-	void FillThisStreamBuffer(TBapBuf* nextFree,TRequestStatus& aStatus); 
-	
-private:
-			CBupPlugin();
-	void 	ConstructL();
-
-private:
-	TUint8					iVersion[20];
-	TPtr8					iVersionDescriptor;
-	
-	TInt 					iSamplerType;
-
-	CProfilerButtonListener* 	iButtonListener;
-    CArrayFixFlat<TSamplerAttributes>* iSamplerAttributes;
-public:
-	TUint32* 				iSampleTime;
-};
-
-
-/*
-*
-*  Base class for all windows
-*
-*/
-class CWsClient : public CActive
-	{
-	protected:
-		//construct
-		CWsClient();
-		CWsScreenDevice* iScreen;
-		RWsSession iWs;
-	public:
-		void ConstructL();
-		// destruct
-		~CWsClient();
-		// main window
-		virtual void ConstructMainWindowL();
-		// terminate cleanly
-		void Exit();
-		// active object protocol
-		void IssueRequest(); // request an event
-		void DoCancel(); // cancel the request
-		virtual TInt RunError(TInt aError) = 0;
-		virtual void RunL() = 0; // handle completed request
-		virtual void HandleKeyEventL (TKeyEvent& aKeyEvent) = 0;
-
-		RWindowGroup Group() {return iGroup;};
-
-    private:
-		RWindowGroup    iGroup;
-		CWindowGc*      iGc;
-		friend class    CWindow; // needs to get at session
-		RProperty       iProperty;
-
-	};
-
-
-
-class CWindow;
-
-class CProfilerButtonListener : public CWsClient 
-{
-public:
-	static 	CProfilerButtonListener* NewL(CBupPlugin* aSamplerm);
-			~CProfilerButtonListener();
-private:
-			CProfilerButtonListener(CBupPlugin* aSampler);
-
-	
-public:
-	void 	ConstructMainWindowL();
-	void 	HandleKeyEventL (TKeyEvent& aKeyEvent);
-	void 	RunL();
-	TInt    RunError(TInt aError);
-	TInt 	StartL();
-	TInt	Stop();
-	
-private:
-	TUint8							iSample[8];
-
-	CBupPlugin*						iSampler;
-	RProfilerTouchEventAnim*			iAnim;
-	RAnimDll*						iAnimDll;
-	CWindow* 						iMainWindow;	// main window
-
-	TInt	 						iSampleStartTime;
-};
-
-
-
-/*
-*
-*  CWindow declaration
-*
-*/
-class CWindow : public CBase
-	{
-	protected:
-		RWindow iWindow; 	// window server window
-		TRect iRect; 		// rectangle re owning window
-	public:
-		CWindow(CWsClient* aClient);
-		void ConstructL (const TRect& aRect, CWindow* aParent=0);
-		~CWindow();
-		// access
-		RWindow& Window(); // our own window
-		CWindowGc* SystemGc(); // system graphics context
-
-		CWsClient* Client() {return iClient;};
-	private:
-		CWsClient* iClient; // client including session and group
-	};
-
-
-#endif
--- a/piprofiler/plugins/BUPplugin/inc/TouchEventAnimDll.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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 _PROFILER_TOUCH_EVENT_ANIM_DLL_
-#define _PROFILER_TOUCH_EVENT_ANIM_DLL_
-
-/*
-*
-*	TouchEventAnimDll.h
-*
-*/
-
-// system includes
-#include <w32adll.h>
-#include <e32def.h>
-
-
-
-/*
-*
-* Class definition of CProfilerTouchEventAnim
-*
-*/
-class CProfilerTouchEventAnim : public CWindowAnim
-{
-public:
-	CProfilerTouchEventAnim();
-	virtual ~CProfilerTouchEventAnim();
-
-	// from CWindowAnim
-	void ConstructL(TAny*	aAny, TBool aHasFocus);
-	void Redraw();
-	void FocusChanged(TBool aState);
-	// from MEventHandler
-	TBool OfferRawEvent(const TRawEvent& aRawEvent);
-	// from CAnim
-	void Animate(TDateTime* aDateTime);
-	void Command(TInt aOpcode, TAny* aArgs);
-	TInt CommandReplyL(TInt aOpcode, TAny* aArgs);
-	
-private:
-	TBool HandlePointerDown(TPoint aPoint);
-	TBool HandlePointerUp(TPoint aPoint);
-	TBool HandleKeyDown(TInt aScanCode);
-	TBool HandleKeyUp(TInt aScanCode);
-private:
-	TInt iState;
-};
-
-
-/*
-*
-* Class definition of CProfilerTouchEventAnimDll
-*
-*/
-
-class CProfilerTouchEventAnimDll : public CAnimDll
-{
-public:
-	CProfilerTouchEventAnimDll();
-
-public:
-	 IMPORT_C CAnim* CreateInstanceL(TInt aType);
-	
-};
-
-
-#endif
--- a/piprofiler/plugins/BUPplugin/inc/TouchEventClientDll.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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 _PROFILER_TOUCH_EVENT_CLIENT_DLL__
-#define _PROFILER_TOUCH_EVENT_CLIENT_DLL__
-
-#include <w32adll.h>
-
-class CProfilerTouchEventControl;
-
-class RProfilerTouchEventAnim : public RAnim
-{
-   public: 
-      RProfilerTouchEventAnim( RAnimDll& aAnimDll );
-      void ConstructL( const RWindow& aParent  );
-
-	  void Activate();
-	  void Deactivate();
-
-
-      enum KAnimCommands
-      {
-         KActivate       = 70002,
-         KDeactivate	 = 70003
-      };
-      /**
-       * Closes the animation object
-       */
-   	  void Close();
-
-   private:        
-	  CProfilerTouchEventControl* iTouchEventControl;   
-};
-
-#endif
--- a/piprofiler/plugins/BUPplugin/sis/BupPlugin_S60-30.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +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:
-;
-; ShapeImplementation_30_gcce.pkg
-;
-
-;Language - standard language definitions
-&EN
-
-; standard sis file header
-#{"Shape plugin"},(0xE01F614F),2,0,0
-
-
-;
-;Localised Vendor name
-;
-%{"Forum Nokia"}
-
-;
-;Unique Vendor name
-;
-:"Forum Nokia"
-
-;
-;Supports Series 60 v 3.0
-;
-[0x101F7961], 0, 0, 0, {"Series60ProductID"}
-
-
-;Files to include. Check the source paths they match your SDK setup. 
-"\Symbian\9.1\S60_3rd_MR\Epoc32\release\gcce\urel\shapeimplementation.dll"     -   "!:\sys\bin\shapeimplementation.dll"
-"\Symbian\9.1\S60_3rd_MR\epoc32\data\Z\Resource\plugins\shapeimplementation.rsc"   -   "!:\Resource\Plugins\shapeimplementation.RSC"
--- a/piprofiler/plugins/BUPplugin/src/BupPlugin.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,582 +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 "BupPlugin.h"	
-//#include <piprofiler/EngineUIDs.h>
-
-#include <w32std.h> 	// for listening key events
-
-	
-// LITERALS
-// CONSTANTS
-const TUid KSamplerBupPluginUid = { 0x2001E5B6 };
-
-/*
- *	
- *	class CBupPlugin implementation
- * 
- */
-
-CBupPlugin* CBupPlugin::NewL(const TUid /*aImplementationUid*/, TAny* /*aInitParams*/)
-	{
-	LOGTEXT(_L("CBupPlugin::NewL() - entry"));
-    CBupPlugin* self = new (ELeave) CBupPlugin();
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-	LOGTEXT(_L("CBupPlugin::NewL() - exit"));
-    return self;
-	}
-
-CBupPlugin::CBupPlugin() :
-	iVersionDescriptor(&(this->iVersion[1]),0,19), 	
-	iSamplerType(PROFILER_USER_MODE_SAMPLER)
-	{
-	iSamplerId = PROFILER_BUP_SAMPLER_ID;
-    iEnabled = EFalse;
-	LOGTEXT(_L("CBupPlugin::CBupPlugin() - konstruktori"));
-	}
-
-void CBupPlugin::ConstructL() 
-	{
-	LOGTEXT(_L("CBupPlugin::ConstructL() - entry"));
-	
-	// initiate sampler attributes array
-	iSamplerAttributes = new(ELeave) CArrayFixFlat<TSamplerAttributes>(1); // only one sampler
-	
-	// insert default attributes to array
-	InitiateSamplerAttributesL();
-	
-	LOGTEXT(_L("CBupPlugin::ConstructL() - exit"));
-	}
-
-
-CBupPlugin::~CBupPlugin()
-	{
-	LOGTEXT(_L("CBupPlugin::~CBupPlugin() - entry"));
-	if(iButtonListener)
-	    {
-	    // check if button listener still running
-	    if(Enabled())
-	        {
-	        // stop profiling
-	        iButtonListener->Stop();
-	        }
-        delete iButtonListener;
-	    }
-	
-	if(iSamplerAttributes)
-	    {
-	    iSamplerAttributes->Reset();
-	    }
-    delete iSamplerAttributes;
-	
-	LOGTEXT(_L("CBupPlugin::~CBupPlugin() - exit"));
-	}
-
-TUid CBupPlugin::Id(TInt /*aUid*/) const
-	{
-    LOGSTRING2("CBupPlugin::Id():0x%X", KSamplerBupPluginUid.iUid );
-    return KSamplerBupPluginUid;
-	}
-
-void CBupPlugin::InitiateSamplerAttributesL()
-    {
-    // create sampler attribute container
-    TSamplerAttributes attr(KSamplerBupPluginUid.iUid,
-            KBUPShortName(),
-            KBUPLongName(),
-            KBUPDescription(),
-            -1,
-            ETrue,
-            EFalse,
-            0); // default item count
-    this->iSamplerAttributes->AppendL(attr);
-    }
-
-// returns setting array
-void CBupPlugin::GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes)
-    {
-    // append my own attributes to complete array, requested by profiler engine
-    aAttributes->AppendL(iSamplerAttributes->At(0));
-    }
-
-TInt CBupPlugin::SetAttributesL(TSamplerAttributes aAttributes)
-    {
-    TSamplerAttributes attr;
-
-    attr = iSamplerAttributes->At(0);
-    // if UIDs match replace the old 
-    if(attr.iUid == aAttributes.iUid)
-        {
-        // replace the old attribute container
-        iSamplerAttributes->Delete(0);
-        iSamplerAttributes->InsertL(0, aAttributes);
-        return KErrNone;
-        }
-    return KErrNotFound;
-    }
-
-/* 
- * Method for parsing and transforming text array settings into TSamplerAttributes (per each sub sampler),
- * called by CSamplerController class
- * 
- * @param array of raw text setting lines, e.g. [gpp]\nenabled=true\nsampling_period_ms=1\n
- */
-TInt CBupPlugin::ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aAllSettingsArray)
-    {
-    // local literals
-    _LIT8(KBUPShort, "bup");
-
-    TInt err(KErrNone);
-    TBuf8<16> samplerSearchName;
-    samplerSearchName.Copy(KBUPShort);
-    
-    // get sampler specific settings  
-    err = DoSetSamplerSettings(aAllSettingsArray, samplerSearchName, 0);
-    
-    // returns KErrNone if settings found, otherwise KErrNotFound
-    return err;
-    }
-
-TInt CBupPlugin::DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex)
-    {
-    // 
-    TBuf8<16> samplerSearch;
-    samplerSearch.Copy(KBracketOpen);
-    samplerSearch.Append(aSamplerName);
-    samplerSearch.Append(KBracketClose);
-    
-    // read a line
-    for (TInt i(0); i<aAllSettings->MdcaCount(); i++)
-        {
-        // check if this line has a setting block start, i.e. contains [xxx] in it
-        if (aAllSettings->MdcaPoint(i).CompareF(samplerSearch) == 0)
-            {
-            // right settings block found, now loop until the next block is found
-            for(TInt j(i+1);j<aAllSettings->MdcaCount();j++)
-                {
-                // check if the next settings block was found
-                if(aAllSettings->MdcaPoint(j).Left(1).CompareF(KBracketOpen) != 0)
-                    {
-                    // save found setting value directly to its owners attributes
-                    SaveSettingToAttributes(aAllSettings->MdcaPoint(j), aIndex);
-                    }
-                else
-                    {
-                    // next block found, return KErrNone
-                    return KErrNone;
-                    }
-                }
-            }
-        }
-    
-    return KErrNotFound;
-    }
-
-/**
- * Method for setting a specific descriptor (from settings file) to attribute structure
- * 
- * @param aSetting  
- * @param aName  
- */
-void CBupPlugin::SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex)
-    {
-    // find the equal mark from the setting line
-    TInt sepPos = aSetting.Find(KSettingItemSeparator);
-    // check that '=' is found
-    if (sepPos > 0)
-        {
-        // check that the element matches
-        if (aSetting.Left(sepPos).CompareF(KEnabled) == 0)
-            {
-            TBool en;
-            CSamplerPluginInterface::Str2Bool(aSetting.Right(aSetting.Length()-sepPos-1), en);
-            if(iSamplerAttributes->At(aIndex).iEnabled != en)
-                {
-                iSamplerAttributes->At(aIndex).iEnabled = en;
-                }
-            }
-        }
-    }
-
-TInt CBupPlugin::GetSamplerType()
-	{
-	return iSamplerType;
-	}
-
-TInt CBupPlugin::ResetAndActivateL(CProfilerSampleStream& aStream) 
-	{
-	LOGTEXT(_L("CBupPlugin::ResetAndActivate() - entry"));
-	TInt ret(KErrNone);
-	
-	// check if sampler enabled
-	if(iSamplerAttributes->At(0).iEnabled)
-	    {
-        // create first the listener instance
-        iButtonListener = CProfilerButtonListener::NewL(this);
-        
-        LOGTEXT(_L("CBupPlugin::ResetAndActivate() - listener created"));
-        
-        iStream = &aStream;
-        TInt length = this->CreateFirstSample();
-        iVersion[0] = (TUint8)length;
-        LOGSTRING2("CBupPlugin::ResetAndActivate() - AddSample, length %d",length);
-        ret = AddSample(iVersion, length+1, 0);
-        if(ret != KErrNone)
-            return ret;
-        
-        // activate button listener
-        ret = iButtonListener->StartL();
-
-        iEnabled = ETrue;
-        
-        LOGTEXT(_L("CBupPlugin::ResetAndActivate() - exit"));
-	    }
-	return ret;
-
-	}
-	
-TInt CBupPlugin::CreateFirstSample()
-	{
-	LOGTEXT(_L("CBupPlugin::CreateFirstSample - entry"));
-	this->iVersionDescriptor.Zero();
-	this->iVersionDescriptor.Append(_L8("Bappea_BUP_V"));
-	this->iVersionDescriptor.Append(PROFILER_BUP_SAMPLER_VERSION);
-	LOGTEXT(_L("CBupPlugin::CreateFirstSample - exit"));
-	return (TInt)(this->iVersionDescriptor.Length());
-	}
-
-TInt CBupPlugin::StopSampling() 
-	{
-	if(iButtonListener)
-		{
-		iButtonListener->Stop();
-		delete iButtonListener;	// delete listener after every trace
-		iButtonListener = NULL;
-		}
-	
-    // set disabled
-    iEnabled = EFalse;
-
-	return KErrNone;
-	}
-
-void CBupPlugin::FillThisStreamBuffer(TBapBuf* /*aBapBuf*/, TRequestStatus& /*aStatus*/)
-	{
-	}
-
-/*
- * 
- * Implementation of class CProfilerButtonListener
- * 
- */
-CProfilerButtonListener::CProfilerButtonListener(CBupPlugin* aSampler) 
-	{
-	LOGTEXT(_L("CProfilerButtonListener::CProfilerButtonListener() - konstuktori"));
-	this->iSampler = aSampler;
-	iSampleStartTime = 0;
-	LOGTEXT(_L("CProfilerButtonListener::CProfilerButtonListener() - konstuktori exit"));
-	}
-
-CProfilerButtonListener* CProfilerButtonListener::NewL(CBupPlugin* aSampler)
-	{
-	LOGTEXT(_L("CProfilerButtonListener::NewL() - entry"));
-	CProfilerButtonListener* self = new (ELeave) CProfilerButtonListener(aSampler);
-	CleanupStack::PushL( self );
-	self->ConstructL();
-	CleanupStack::Pop();
-	LOGTEXT(_L("CProfilerButtonListener::NewL() - exit"));
-	return self;
-	}
-
-CProfilerButtonListener::~CProfilerButtonListener() 
-	{
-	LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener() - entry af"));
-
-	if(iMainWindow)
-		{
-		LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener(): flushing iWs"));
-		iWs.Flush();
-		LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener(): finishing"));
-		}
-	delete iMainWindow;
-	LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener() - exit"));
-	}
-	
-void CProfilerButtonListener::ConstructMainWindowL()
-	{
-    LOGTEXT(_L("CProfilerButtonListener::ConstructMainWindowL() - Entry"));
-
-    CWindow* window = new (ELeave) CWindow(this);
-    CleanupStack::PushL( window );
-	window->ConstructL(TRect(TPoint(0,0), TSize(0,0)));
-    delete iMainWindow;
-    iMainWindow = window;
-    CleanupStack::Pop( window );
-	
-    LOGTEXT(_L("CProfilerButtonListener::ConstructMainWindowL() - Exit"));
-	}
-
-void CProfilerButtonListener::HandleKeyEventL (TKeyEvent& /*aKeyEvent*/)
-    {
-    LOGTEXT(_L("CProfilerButtonListener::HandleKeyEventL() - Start"));
-    LOGTEXT(_L("CProfilerButtonListener::HandleKeyEventL() - End"));
-	}
-
-
-TInt CProfilerButtonListener::RunError(TInt aError)
-    {
-    // get rid of everything we allocated
-    // deactivate the anim dll before killing window, otherwise anim dll dies too early
-    iAnim->Deactivate();
-    iAnim->Close();
-
-    iAnimDll->Close();
-    
-    return aError;
-    }
-
-void CProfilerButtonListener::RunL() 
-	{	
-    // resubscribe before processing new value to prevent missing updates
-	IssueRequest();
-	
-	TInt c = 0;
-	if(RProperty::Get(KProfilerKeyEventPropertyCat, EProfilerKeyEventPropertySample, c) == KErrNone)
-		{
-		// do something with event
-		LOGSTRING2("CProfilerButtonListener::RunL() - event [%d] received",c);
-	
-		iSample[0] = c;
-		iSample[1] = c >> 8;
-		iSample[2] = c >> 16;
-		iSample[3] = c >> 24;
-		
-		// Space for GPP sample time		
-		TUint32 sampleTime = User::NTickCount() - iSampleStartTime; 
-		LOGSTRING2("CProfilerButtonListener::RunL() - sample time is %d",sampleTime);
-		
-		iSample[4] = sampleTime;
-		iSample[5] = sampleTime >> 8;
-		iSample[6] = sampleTime >> 16;
-		iSample[7] = sampleTime >> 24;
-		
-		iSampler->AddSample(iSample, 8, 0xb0);
-		}
-	}
-	
-TInt CProfilerButtonListener::StartL()
-	{
-	LOGTEXT(_L("CProfilerButtonListener::StartL() - Activate touch server dll"));
-	TInt err(KErrNone);
-	
-	// get the property value
-	TInt r = RProperty::Get(KGppPropertyCat, EGppPropertySyncSampleNumber, iSampleStartTime);
-	if(r != KErrNone)
-		{
-		LOGSTRING2("CProfilerButtonListener::StartL() - getting iSyncOffset failed, error %d", r);
-		}
-	
-	iAnimDll = new (ELeave) RAnimDll(iWs);
-	LOGTEXT(_L("CProfilerButtonListener::StartL() - #1"));
-	
-	TParse* fp = new (ELeave) TParse();
-	CleanupStack::PushL(fp);
-	fp->Set( KDllName, &KDC_SHARED_LIB_DIR , NULL );    
-	LOGSTRING2("CProfilerButtonListener::StartL() - touch event server: %S" , &(fp->FullName()));
-
-	err = iAnimDll->Load(fp->FullName());
-	// check if anim dll load failed
-	if(err != KErrNone)
-	    {
-        CleanupStack::PopAndDestroy(fp);
-	    // stop plugin if failed
-	    iAnimDll->Close();
-	    return KErrGeneral;
-	    }
-    CleanupStack::PopAndDestroy(fp);
- 	LOGTEXT(_L("CProfilerButtonListener::StartL() - #2"));
-
-	iAnim = new (ELeave) RProfilerTouchEventAnim(*iAnimDll);
- 	LOGTEXT(_L("CProfilerButtonListener::StartL() - #3"));
-	iAnim->ConstructL(iMainWindow->Window());
-	
-	// activate the animation dll for collecting touch and key events
-	iAnim->Activate();
-
-	// wait for a new sample
-	IssueRequest();
-	
-	// hide this window group from the app switcher
-	iMainWindow->Client()->Group().SetOrdinalPosition(-1);
-	iMainWindow->Client()->Group().EnableReceiptOfFocus(EFalse);
-	return KErrNone;
-	}
-
-TInt CProfilerButtonListener::Stop() 
-	{
-	LOGTEXT(_L("CProfilerButtonListener::Stop() - enter"));
-	// deactivate the anim dll before killing window, otherwise anim dll dies too early
-	iAnim->Deactivate();
-	iAnim->Close();
-
-	iAnimDll->Close();
-
-	Cancel();
-	LOGTEXT(_L("CProfilerButtonListener::Stop() - exit"));
-	return KErrNone;
-	}
-
-
-///////////////////////////////////////////////////////////////////////////////
-////////////////////////// CWindow implementation /////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-CWindow::CWindow(CWsClient* aClient)
-: iClient(aClient)
-	{
-    LOGTEXT(_L("CWindow::CWindow()"));
-	}
-
-void CWindow::ConstructL (const TRect& aRect, CWindow* aParent)
-	{
-	LOGTEXT(_L("CWindow::ConstructL(): Start"));
-
-	// If a parent window was specified, use it; if not, use the window group
-	// (aParent defaults to 0).
-	RWindowTreeNode* parent= aParent ? (RWindowTreeNode*) &(aParent->Window()) : &(iClient->iGroup);
-	iWindow=RWindow(iClient->iWs); // use app's session to window server
-	User::LeaveIfError(iWindow.Construct(*parent,(TUint32)this));
-	LOGSTRING2("CWindow::ConstructL(): Start - window handle is: 0x%08x", this);
-	iRect = aRect;
-	iWindow.SetExtent(iRect.iTl, iRect.Size()); // set extent relative to group coords
-	iWindow.Activate(); // window is now active
-	LOGTEXT(_L("CWindow::ConstructL(): End"));
-	}
-
-
-CWindow::~CWindow()
-	{
-    LOGTEXT(_L("CWindow::~CWindow(): Start"));
-	iWindow.Close(); // close our window
-    LOGTEXT(_L("CWindow::~CWindow(): End"));
-	}
-
-RWindow& CWindow::Window()
-	{
-    LOGTEXT(_L("CWindow::Window()"));
-	return iWindow;
-	}
-
-CWindowGc* CWindow::SystemGc()
-	{
-    LOGTEXT(_L("CWindow::SystemGc()"));
-	return iClient->iGc;
-	}
-
-/////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////// CWsClient implementation ////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////
-CWsClient::CWsClient()
-: CActive(CActive::EPriorityStandard)
-	{
-    LOGTEXT(_L("CWsClient::CWsClient()"));
-	}
-
-void CWsClient::ConstructL()
-	{
-    LOGTEXT(_L("CWsClient::ConstructL() - Start"));
-    TInt r = RProperty::Define(EProfilerKeyEventPropertySample, RProperty::EInt, KAllowAllPolicy, KCapabilityNone);
-    if (r!=KErrAlreadyExists)
-        {
-        User::LeaveIfError(r);
-        }
-    
-	CActiveScheduler::Add(this);
-
-	// attach to 
-	User::LeaveIfError(iProperty.Attach(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample));
-    
-	// get a session going
-	User::LeaveIfError(iWs.Connect());
-
-	// construct screen device and graphics context
-	iScreen=new (ELeave) CWsScreenDevice(iWs); // make device for this session
-	User::LeaveIfError(iScreen->Construct( 0 )); // and complete its construction
-	User::LeaveIfError(iScreen->CreateContext(iGc)); // create graphics context
-
-	// construct our one and only window group
-	iGroup=RWindowGroup(iWs);
-	User::LeaveIfError(iGroup.Construct((TInt)this, EFalse)); // meaningless handle; enable focus
-	
-	// construct main window
-	ConstructMainWindowL();
-
-	LOGTEXT(_L("CWsClient::CWsClient() - End"));
-	}
-
-CWsClient::~CWsClient()
-	{
-    LOGTEXT(_L("CWsClient::~CWsClient() - Start"));
-    
-	// get rid of everything we allocated
-	delete iGc;
-	delete iScreen;
-	
-	iGroup.Close();
-	// finish with window server
-	iWs.Close();
-	
-    LOGTEXT(_L("CWsClient::~CWsClient() - Exit"));
-	}
-
-void CWsClient::Exit()
-	{
-    LOGTEXT(_L("CWsClient::Exit() - Start"));
-
-	// destroy window group
-	iGroup.Close();
-	// finish with window server
-    iProperty.Close();
-	iWs.Close();
-    LOGTEXT(_L("CWsClient::Exit() - Exit"));
-	}
-
-void CWsClient::IssueRequest()
-	{
-    LOGTEXT(_L("CWsClient::IssueRequest() - Start"));
-    iProperty.Subscribe( iStatus );
-    SetActive(); // so we're now active
-    LOGTEXT(_L("CWsClient::IssueRequest() - Exit"));
-	}
-
-void CWsClient::DoCancel()
-	{
-    LOGTEXT(_L("CWsClient::DoCancel() - Start"));
-	// clean up the sample property
-    iProperty.Cancel();
-    iProperty.Close();
-    LOGTEXT(_L("CWsClient::DoCancel() - Exit"));
-	}
-
-void CWsClient::ConstructMainWindowL()
-	{
-    LOGTEXT(_L("CWsClient::ConstructMainWindowL()"));
-	}
-
--- a/piprofiler/plugins/BUPplugin/src/BupPluginImplementationTable.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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 FILES
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-
-#include "BupPlugin.h"
-
-
-// Provides a key value pair table, this is used to identify
-// the correct construction function for the requested interface.
-const TImplementationProxy ImplementationTable[] =
-{
-         IMPLEMENTATION_PROXY_ENTRY(0x2001E5B6,  CBupPlugin::NewL)
-};
-
-// Function used to return an instance of the proxy table.
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-{
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-    return ImplementationTable;
-}
-
--- a/piprofiler/plugins/BUPplugin/src/TouchEventAnimDll.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +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 <e32base.h>
-#include <e32cons.h>
-#include <w32std.h>
-#include <in_sock.h>
-#include <txtfrmat.h>
-#include <e32property.h>
-#include <piprofiler/ProfilerTraces.h>
-
-// user includes
-#include "TouchEventAnimDll.h"
-
-// control commands
-static const TInt KActivate   = 70002;
-static const TInt KDeactivate = 70003;
-
-// touch events
-static const TInt KTouchEventDown = 69999;
-static const TInt KTouchEventUp = 70000;
-
-static const TInt KUpEventOffset = 70000;
-
-_LIT( KTouchEventServer, "PIProfilerTouchEvent server" );
-enum TAnimationPanics
-    {
-    EProfilerTouchEventServerPanic = 100
-    };
-
-const TUid KProfilerKeyEventPropertyCat={0x2001E5AD};
-enum TProfilerKeyEventPropertyKeys
-	{
-	EProfilerKeyEventPropertySample = 7
-	};
-
-/*
-*
-* Implementation of CProfilerTouchEventAnim
-*
-*/
-CProfilerTouchEventAnim::CProfilerTouchEventAnim() : iState(EFalse)
-    {
-	LOGTEXT(_L("CProfilerTouchEventAnim::CProfilerTouchEventAnim - entry"));
-    }
-
-CProfilerTouchEventAnim::~CProfilerTouchEventAnim()
-    {
-	LOGTEXT(_L("CProfilerTouchEventAnim::~CProfilerTouchEventAnim - entry"));
-	//iFunctions->GetRawEvents( EFalse );	// disable capture
-	LOGTEXT(_L("CProfilerTouchEventAnim::~CProfilerTouchEventAnim - exit"));
-    }
-
-void CProfilerTouchEventAnim::ConstructL(TAny* /*aArgs*/, TBool /*aHasFocus*/)
-    {
-	LOGTEXT(_L("CProfilerTouchEventAnim::ConstructL - entry"));
-    iFunctions->GetRawEvents( ETrue );
-	LOGTEXT(_L("CProfilerTouchEventAnim::ConstructL - exit"));
-    }
-
-void CProfilerTouchEventAnim::Command(TInt /*aOpcode*/, TAny* /*aArgs*/)
-    {
-
-    }
-
-TInt CProfilerTouchEventAnim::CommandReplyL(TInt aOpcode, TAny* /*aArgs*/)
-    {
-	LOGSTRING2("CProfilerTouchEventAnim::CommandReplyL - entry, aOpcode: %d", aOpcode);
-	switch(aOpcode)
-	    {
-		case KActivate:	// activate
-			iState = ETrue;
-			LOGTEXT(_L("CProfilerTouchEventAnim::CommandReplyL - activate"));
-			break;
-		case KDeactivate: // deactivate
-			iState = EFalse;
-			iFunctions->GetRawEvents( EFalse );	// disable capture
-			LOGTEXT(_L("CProfilerTouchEventAnim::CommandReplyL - deactivate"));
-			break;
-		default:
-			User::Panic( KTouchEventServer, EProfilerTouchEventServerPanic );
-			LOGSTRING2("CProfilerTouchEventAnim::CommandReplyL - panic, code %d", EProfilerTouchEventServerPanic);
-			return EProfilerTouchEventServerPanic;
-
-        }
-	return KErrNone;
-    }
-
-
-TBool CProfilerTouchEventAnim::OfferRawEvent(const TRawEvent& aRawEvent)
-    {
-	LOGTEXT(_L("CProfilerTouchEventAnim::OfferRawEvent - entry"));
-	if(iState == EFalse)
-		return EFalse; // if not activated yet just pass through
-	
-
-	switch(aRawEvent.Type())
-	    {
-        // handle the pointer events here
-        case TRawEvent::EButton1Down:
-            {
-            LOGTEXT(_L("CProfilerTouchEventAnim::OfferRawEvent - pointer down"));
-            return HandlePointerDown(aRawEvent.Pos());
-            }
-        case TRawEvent::EButton1Up:
-            {
-            LOGTEXT(_L("CProfilerTouchEventAnim::OfferRawEvent - pointer up"));
-            return HandlePointerUp(aRawEvent.Pos());
-            }
-                
-            // handle the key events here, replacing the BUP trace functionality
-        case TRawEvent::EKeyDown:
-            {
-            TInt scan = aRawEvent.ScanCode() & 0xFFFF;
-                    return HandleKeyDown(scan);
-            }
-        case TRawEvent::EKeyUp:
-            {
-            TInt scan = (aRawEvent.ScanCode() & 0xFFFF)+KUpEventOffset;	// 
-                    return HandleKeyUp(scan);
-            }
-            default:
-                return EFalse;	// no action
-        }
-    }
-
-TBool CProfilerTouchEventAnim::HandlePointerDown( TPoint /*aPoint*/ )
-    {
-	RProperty::Set(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample, KTouchEventDown);
-	return EFalse;
-    }
-
-TBool CProfilerTouchEventAnim::HandlePointerUp( TPoint /*aPoint*/ )
-    {
-	RProperty::Set(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample, KTouchEventUp);
-	return EFalse;
-    }
-
-TBool CProfilerTouchEventAnim::HandleKeyDown( TInt aScanCode )
-    {
-	LOGSTRING2("CProfilerTouchEventAnim::HandleKeyDown - scancode = %d", aScanCode);
-	RProperty::Set(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample, aScanCode);
-	return EFalse;
-    }
-
-TBool CProfilerTouchEventAnim::HandleKeyUp( TInt aScanCode )
-    {
-	LOGSTRING2("CProfilerTouchEventAnim::HandleKeyUp - scancode = %d", aScanCode);
-	RProperty::Set(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample, aScanCode);
-	return EFalse;
-    }
-
-
-void CProfilerTouchEventAnim::Animate(TDateTime* /*aDateTime*/)
-    {
-    }
-
-void CProfilerTouchEventAnim::Redraw()
-    {
-    }
-
-void CProfilerTouchEventAnim::FocusChanged(TBool /*aState*/)
-    {
-    }
-
-
-/*
-*
-* Implementation of CProfilerTouchEventAnimDll
-*
-*/
-CProfilerTouchEventAnimDll::CProfilerTouchEventAnimDll() : CAnimDll()
-    {
-    }
-
-CAnim* CProfilerTouchEventAnimDll::CreateInstanceL(TInt /*aType*/)
-    {
-	LOGTEXT(_L("CProfilerTouchEventAnimDll::CreateInstanceL - entry"));
-	return (new (ELeave) CProfilerTouchEventAnim());
-    }
-
-
-// DLL entry
-EXPORT_C CAnimDll* CreateCAnimDllL()
-    {
-	return (new (ELeave) CProfilerTouchEventAnimDll);
-    }
-
-
--- a/piprofiler/plugins/BUPplugin/src/TouchEventClientDll.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +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 "TouchEventClientDll.h"
-#include <piprofiler/ProfilerTraces.h>
-
-/*
- *	
- *	class RProfilerTouchEventAnim implementation
- * 
- */
-void RProfilerTouchEventAnim::ConstructL( const RWindow& aParent)
-{
-	LOGTEXT(_L("RProfilerTouchEventAnim::ConstructL - entry"));
-	LOGTEXT(_L("RProfilerTouchEventAnim::ConstructL - calling RAnim::Construct..."));
-	RAnim::Construct(aParent, 0, TPtrC8());
-}
-
-
-RProfilerTouchEventAnim::RProfilerTouchEventAnim( RAnimDll &aAnimDll ) :
-    RAnim( aAnimDll )
-{
-}
-
-void RProfilerTouchEventAnim::Activate()
-{
-	LOGTEXT(_L("RProfilerTouchEventAnim::Activate - entry"));
-	TInt err = RAnim::CommandReply(KActivate);
-	LOGSTRING2("RProfilerTouchEventAnim::Activate - error: %d", err);
-}
-
-void RProfilerTouchEventAnim::Deactivate()
-{
-	LOGTEXT(_L("RProfilerTouchEventAnim::Deactivate - entry"));
-	TInt err = RAnim::CommandReply(KDeactivate);
-	LOGSTRING2("RProfilerTouchEventAnim::Deactivate - error: %d", err);
-}
-
-void RProfilerTouchEventAnim::Close()
-	{
-	RAnim::Close();
-	}
-
-
-
--- a/piprofiler/plugins/DebugOutputWriterPlugin/data/2001E5BA.rss	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 <ecom/registryinfo.rh>
-
-// Declares info for two implementations
-RESOURCE REGISTRY_INFO theInfo
-    {
-    // UID for the DLL. See mmp files
-    //__SERIES60_3X__ can't be used in resource files
-    dll_uid = 0x2001E5BA;
-
-    // Declare array of interface info. This dll contains implementations for 
-    // only one interface (CSamplerInterfaceDefinition).
-    interfaces = 
-        {
-        INTERFACE_INFO
-            {
-            // UID of interface that is implemented
-            interface_uid = 0x2001E5BD;
-
-            implementations = 
-                {
-                IMPLEMENTATION_INFO
-                    {
-                    implementation_uid = 0x2001E5BA;
-
-                    version_no = 1;
-                    display_name = "Debug output writer implementation";
-                    default_data = "dow";
-                    opaque_data = "1";
-                    }
-                };
-            }
-        };
-    }
--- a/piprofiler/plugins/DebugOutputWriterPlugin/group/DebOutWriterPlugin.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 <platform_paths.hrh>
-
-
-TARGET		    PIProfilerDebugWriter.dll
-TARGETTYPE	    PLUGIN
-UID             0x10009D8D 0x2001E5BA
-#ifdef WINSCW
-VENDORID      0
-#else
-VENDORID      VID_DEFAULT
-#endif
-CAPABILITY 	    ALL -TCB // AllFiles ReadDeviceData ReadUserData UserEnvironment WriteDeviceData WriteUserData
-SMPSAFE
-
-OS_LAYER_SYSTEMINCLUDE
-USERINCLUDE 	../inc ../traces 
-#ifdef OST_TRACE_COMPILER_IN_USE
-USERINCLUDE 	../traces
-#endif
-SOURCEPATH		../src
-
-START RESOURCE  ../data/2001E5BA.rss
-TARGET piprofilerdebugwriter.rsc
-END
-
-SOURCE			DebOutWriterPlugin.cpp
-SOURCE 			DebOutWriterPluginImplementationTable.cpp
-
-LIBRARY		    euser.lib
-LIBRARY         ecom.lib
-LIBRARY         efsrv.lib
-LIBRARY         CommonEngine.lib
-LIBRARY			flogger.lib
--- a/piprofiler/plugins/DebugOutputWriterPlugin/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +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:  
-*
-*/
-
-
-PRJ_MMPFILES
-DebOutWriterPlugin.mmp
--- a/piprofiler/plugins/DebugOutputWriterPlugin/inc/DebOutWriterPlugin.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +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:  
-*
-*/
-
-
-// This file defines the API for DebOutWriterPlugin.dll
-
-#ifndef __DEBOUTWRITERPLUGIN_H__
-#define __DEBOUTWRITERPLUGIN_H__
-
-//  Include Files
-#include <w32std.h>
-#include <piprofiler/WriterPluginInterface.h>
-#include <piprofiler/ProfilerGenericClassesUsr.h>
-#include <e32base.h>	// CBase
-#include <e32std.h>	 // TBuf
-#include <e32property.h>
-
-#ifdef OST_TRACE_COMPILER_IN_USE
-// trace core ldd activation/deactivation interface
-#include <TcDriverIf.h>
-
-// trace core ldd global definitions
-_LIT( KTcLdd, "tcldd.ldd" );
-GLDEF_D RTcDriver tcldd;
-
-#endif
-
-_LIT(KDebOutShortName, "dow");
-
-// forward declarations
-class CDebOutWriterHandler;
-
-//  Class Definitions
-
-class CDebOutWriterPlugin : public CWriterPluginInterface
-	{
-public:
-	// new function
-	static CDebOutWriterPlugin* NewL(const TUid aImplementationUid, TAny* /*aInitParams*/);
-	~CDebOutWriterPlugin();
-
-	void	DoCancel();
-	static void 	PrintDescriptorAsBase64(TDesC8& aDes, TRequestStatus* aStatus, TUint32 sampleTime, TBool aEmptying);
-
-public: // new functions
-
-	TInt 	Start();
-
-	void 	Stop();
-    
-	void 	GetValue( const TWriterPluginValueKeys aKey, TDes& aValue );
-	
-	void 	SetValue( const TWriterPluginValueKeys aKey, TDes& aValue ); 
-    
-	TUid 	Id() const;
-		 
-	void 	GetWriterVersion(TDes* aDes);
-	
-	TUint32 GetWriterType();
-	
-	void    SetStream(CProfilerSampleStream& aStream) { iStream = &aStream; }
-	
-	void   HandleError(TInt aError);
-	   
-	void   WriteData();
-private: // new functions
-	CDebOutWriterPlugin(const TUid aImplementationUid);
-	void 	ConstructL();
-	
-	void 	GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
-	void 	SetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
-	TBool	GetEnabled();
-public:
-    CProfilerSampleStream*          iStream;
-private: // data
-	TBapBuf*						iBufferBeingWritten;
-	
-	TInt 							iWriterType;
-	TInt							iWriterId;
-	CDebOutWriterHandler*			iWriterHandler;
-	RProperty                       iErrorStatus;
-
-	};
-
-/*
- * 
- * Definition of class CDebOutWriterHandler
- * 
- */
-class CDebOutWriterHandler : public CActive
-	{
-public:
- 
-
-	static CDebOutWriterHandler* NewL(CDebOutWriterPlugin* aWriter);
-	~CDebOutWriterHandler();
-    void DoCancel();
-	void StartL();
-
-	void Stop();
-    
-    void Reset();
-private:
-	CDebOutWriterHandler(CDebOutWriterPlugin* aWriter); 
-	
-	void ConstructL();
-    void RunL();
-    
-	void WriteBufferToOutput(TBapBuf* aBuf);
-	void PrintBufferToOutput(TBapBuf* aBuffer, TRequestStatus& aStatus);
-	void HandleFullBuffers();
-private:
-	CDebOutWriterPlugin* 			iWriter;
-    RFile                           iFile;
-    RFs                             iFs;
-    TBuf<256>                       iFileName;
-//  CPeriodic*                      iTimer;
-    TBapBuf*                        iBufferBeingWritten;
-    TBool                           iStopping;
-	};
-
-#endif  // __DEBOUTWRITERPLUGIN_H__
-
--- a/piprofiler/plugins/DebugOutputWriterPlugin/sis/DebOutWriterPlugin_EKA2.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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:
-;
-; Installation file for DebOutWriterPlugin dll
-;
-; This is an auto-generated PKG file by Carbide.
-; This file uses variables specific to Carbide builds that will not work
-; on command-line builds. If you want to use this generated PKG file from the
-; command-line tools you will need to modify the variables with the appropriate
-; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
-
-;
-; UID is the dll's UID
-;
-#{"DebOutWriterPlugin DLL"},(0x00DA58C7),1,0,0
-
-
-;Localised Vendor name
-%{"Vendor-EN"}
-
-;Unique Vendor name
-:"Vendor"
-
-"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\DebOutWriterPlugin.dll"		  -"!:\sys\bin\DebOutWriterPlugin.dll"
--- a/piprofiler/plugins/DebugOutputWriterPlugin/src/DebOutWriterPlugin.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,542 +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 Files  
-
-#include "DebOutWriterPlugin.h"	
-#include <e32base.h>
-//#include <piprofiler/EngineUIDs.h>
-#include <piprofiler/ProfilerTraces.h>
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include <OpenSystemTrace.h>
-#include "DebOutWriterPluginTraces.h"
-#endif
-
-// engine properties
-const TUid KEngineStatusPropertyCat={0x2001E5AD};
-enum TEnginePropertyKeys
-    {
-    EProfilerEngineStatus = 8,
-    EProfilerErrorStatus
-    };
-
-// CONSTANTS
-// own UID
-const TUid KDebOutWriterPluginUid = { 0x2001E5BA };
-
-//  Member Functions
-/*
- *
- *	Class CDebOutWriterPlugin implementation
- *
- */
-
-CDebOutWriterPlugin* CDebOutWriterPlugin::NewL(const TUid /*aImplementationUid*/, TAny* /*aInitParams*/)
-{
-	LOGTEXT(_L("CDebOutWriterPlugin::NewL() - entry"));
-	CDebOutWriterPlugin* self = new (ELeave) CDebOutWriterPlugin(KDebOutWriterPluginUid);
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-	LOGTEXT(_L("CDebOutWriterPlugin::NewL() - exit"));
-    return self;
-}
-
-CDebOutWriterPlugin::CDebOutWriterPlugin(const TUid aImplementationUid) :
-	iWriterType(aImplementationUid.iUid)
-    {
-    LOGTEXT(_L("CDebOutWriterPlugin::CDebOutWriterPlugin - entry"));
-    isEnabled = EFalse;
-    iWriterId = Id().iUid;
-    LOGTEXT(_L("CDebOutWriterPlugin::CDebOutWriterPlugin - exit"));
-    }
-
-CDebOutWriterPlugin::~CDebOutWriterPlugin()
-    {
-    LOGTEXT(_L("CDebOutWriterPlugin::~CDebOutWriterPlugin - entry"));
-
-    iErrorStatus.Close();
-    
-    if(iWriterHandler)
-        {
-        iWriterHandler->Cancel();
-        delete iWriterHandler;
-        }
-    LOGTEXT(_L("CDebOutWriterPlugin::~CDebOutWriterPlugin - exit"));
-    }    
-    
-void CDebOutWriterPlugin::ConstructL()
-	{
-	// second phase constructor, anything that may leave must be constructed here
-
-	LOGTEXT(_L("CDebOutWriterPlugin::ConstructL() - entry"));
-	iWriterHandler = CDebOutWriterHandler::NewL(this);
-    User::LeaveIfError(iErrorStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus));
-    
-	LOGTEXT(_L("CDebOutWriterPlugin::ConstructL() - exit"));
-	}
-
-TInt CDebOutWriterPlugin::Start()
-	{
-	LOGTEXT(_L("CDebOutWriterPlugin::Start() - entry"));
-	
-#ifdef OST_TRACE_COMPILER_IN_USE
-    TInt err(KErrNone);
-	// activate traces on TraceCore
-    RTcDriverParameters tcdp_ThreadIdentification;
-    tcdp_ThreadIdentification.iComponentId = KOstTraceComponentID;
-    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64START;
-    err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
-
-    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64LINE;
-    err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
-
-    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64FIN;
-    err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
-
-    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64END;
-    err = tcldd.ActivateTrace(tcdp_ThreadIdentification);
-
-    RDebug::Print(_L("Debug output activated"));
-    if(err != KErrNone)
-        RDebug::Print(_L("TraceCore LDD API responded: %d"), err);
-#endif
-
-	LOGTEXT(_L("CDebOutWriterPlugin::Start() - exit"));
-	return KErrNone;
-	}
-
-void CDebOutWriterPlugin::Stop()
-	{
-	LOGTEXT(_L("CDebOutWriterPlugin::Stop() - entry"));
-	iWriterHandler->Stop();
-#ifdef OST_TRACE_COMPILER_IN_USE
-	TInt err(KErrNone);
-    // activate traces on TraceCore
-    RTcDriverParameters tcdp_ThreadIdentification;
-    tcdp_ThreadIdentification.iComponentId = KOstTraceComponentID;
-    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64START;
-    err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
-
-    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64LINE;
-    err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
-
-    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64FIN;
-    err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
-
-    tcdp_ThreadIdentification.iGroupId = CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64END;
-    err = tcldd.DeactivateTrace(tcdp_ThreadIdentification);
-
-    RDebug::Print(_L("Debug output deactivated"));
-    if(err != KErrNone)
-        RDebug::Print(_L("TraceCore LDD API responded: %d"), err);
-#endif
-	LOGTEXT(_L("CDebOutWriterPlugin::Stop() - exit"));
-	}
-
-TUid CDebOutWriterPlugin::Id() const
-	{
-    LOGSTRING2("CDebOutWriterPlugin::Id(): 0x%X", KDebOutWriterPluginUid.iUid );
-    return KDebOutWriterPluginUid;
-	//return iDtor_ID_Key;
-	}
-
-TBool CDebOutWriterPlugin::GetEnabled()
-	{
-	return isEnabled;
-	}
-
-void CDebOutWriterPlugin::SetValue( const TWriterPluginValueKeys aKey,
-                                    TDes& aValue )
-    {
-    TRAP_IGNORE( SetValueL( aKey, aValue ) );
-    }
-
-
-void CDebOutWriterPlugin::GetValue( const TWriterPluginValueKeys aKey,
-                                    TDes& aValue )
-    {
-    TRAP_IGNORE( GetValueL( aKey, aValue ) );
-    }
-
-
-
-void CDebOutWriterPlugin::SetValueL( const TWriterPluginValueKeys aKey, TDes& /*aValue*/ )
-{
-	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - entry"));	
-	
-    switch( aKey )
-        {
-        case EWriterPluginEnabled:
-            isEnabled = ETrue;
-        	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin enabled"));
-        	break;
-        case EWriterPluginDisabled:
-            isEnabled = EFalse;
-        	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin disabled"));	
-            break;
-        case EWriterPluginSettings:
-        	//result = StringLoader::LoadL(PROFILER_KERNEL_MODE_SAMPLER);
-        	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - setting plugin settings"));	
-        	break;
-        default:
-        	break;
-        }
-	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - exit"));	
-
-}
-
-TUint32 CDebOutWriterPlugin::GetWriterType()
-	{
-	return iWriterType;
-	}
-
-
-void CDebOutWriterPlugin::GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue )
-    {
-    switch( aKey )
-        {
-        case EWriterPluginVersion:
-
-        	GetWriterVersion(&aValue);
-        	break;
-        case EWriterPluginType:
-        	break;
-           default:
-                break;
-        }
-    }
-
-void CDebOutWriterPlugin::GetWriterVersion(TDes* aDes)
-	{
-	_LIT(KDebugOutputWriterVersion, "1.0.0");
-	aDes->Append(KDebugOutputWriterVersion);
-	}
-
-void CDebOutWriterPlugin::DoCancel()
-{
-	LOGTEXT(_L("CDebOutWriterPlugin::DoCancel - entry"));
-}
-
-void CDebOutWriterPlugin::WriteData()
-    {
-    // Activate handler to write data from buffer to output
-    LOGTEXT(_L("CDiskWriterPlugin::WriteData() - entry"));
-    TRAP_IGNORE(iWriterHandler->StartL());
-    LOGTEXT(_L("CDiskWriterPlugin::WriteData() - exit"));
-    }
-
-void CDebOutWriterPlugin::HandleError(TInt aError)
-    {
-    TInt err(KErrNone);
-    err = iErrorStatus.Set(aError);
-    if(err != KErrNone)
-        {
-        RDebug::Print(_L("CDiskWriterPlugin::HandleError() - error: %d"), err);
-        }
-    }
-
-void CDebOutWriterPlugin::PrintDescriptorAsBase64(	TDesC8& aDes,
-                                                    TRequestStatus* aStatus,
-													TUint32 sampleTime,
-													TBool aEmptying)
-{
-	LOGTEXT(_L("CDebOutWriterPlugin::PrintDescriptorAsBase64() - entry"));
-	TUint len = aDes.Length();
-
-	// we must wait for the sample tick to be printed, in case
-	// prints are performed at user side, otherwise the kernel
-	// prints will corrupt the data
-	if(sampleTime != 0xffffffff)
-	{
-		TUint32 remains = sampleTime%1000;
-	
-		if(remains > 800) 
-		{
-			TTimeIntervalMicroSeconds32 timeToWait = ((1050-remains)*1000);
-			User::After(timeToWait);
-		}
-	}
-	
-	TBuf16<75> buf;
-
-	// Header
-#ifdef OST_TRACE_COMPILER_IN_USE
-    OstTrace0( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64START, 
-            "<PIPROF>=================================================================" );
-#else
-	RDebug::Print(_L("<PIPROF>================================================================="));
-#endif
-	buf.Zero();
-
-	// base64 encoding table
-	const char uu_base64[64] =
-	{
-		'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
-		'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
-		'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
-		'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
-		'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
-		'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
-		'w', 'x', 'y', 'z', '0', '1', '2', '3',
-		'4', '5', '6', '7', '8', '9', '+', '/'
-	};
-
-	TChar byte1, byte2, byte3, byte4;
-	TUint8 count = 0x30;
-	// base64 encoding 
-	for(TUint i = 0, j = 0; i < len; i += 3, j = (j + 1) % 18) 
-	{
-    // byte 1
-		byte1 = uu_base64[(aDes[i] >> 2) & 0x3F];
-		
-		// byte 2
-		if(i+1 < len)
-			byte2 = uu_base64[(aDes[i] << 4) & 0x3f | (aDes[i+1] >> 4)];
-		else
-			byte2 = uu_base64[(aDes[i] << 4) & 0x3f];
-
-		// byte 3
-		if(i+1 < len && i+2 < len)
-			byte3 = uu_base64[(aDes[i+1] << 2) & 0x3f | (aDes[i+2] >> 6)];
-		else if(i+1 < len)
-			byte3 = uu_base64[(aDes[i+1] << 2) & 0x3f];
-		else
-			byte3 = '=';
-
-		// byte 4
-		if(i+2 < len) 
-			byte4 = uu_base64[aDes[i+2] & 0x3f];
-		else
-			byte4 = '=';
-	
-		// append to buffer
-		buf.Append(byte1);
-		buf.Append(byte2);
-		buf.Append(byte3);
-		buf.Append(byte4);
-
-		// output 72 chars / line
-		if(j == 17) 
-		{		
-			// add check number at the end of line
-			buf.Append(count);
-#ifdef OST_TRACE_COMPILER_IN_USE
-			OstTraceExt1( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64LINE, "<PIPROF>%S", &buf );
-#else
-			RDebug::Print(_L("<PIPROF>%S"),&buf);
-#endif
-			count++;
-			if(count > 0x39)
-				count = 0x30;
-			buf.Zero();
-		}
-	}
-	
-#ifdef OST_TRACE_COMPILER_IN_USE
-	OstTraceExt1( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64FIN, "<PIPROF>%S", &buf );
-#else
-	RDebug::Print(_L("<PIPROF>%S"),&buf);
-#endif
-	buf.Zero();
-
-	// footer
-#ifdef OST_TRACE_COMPILER_IN_USE
-	OstTrace0( PIPROFILER_TRACE_OUT, CDEBOUTWRITERPLUGIN_PRINTDESCRIPTORASBASE64END, 
-	        "<PIPROF>=================================================================" );
-#else
-	RDebug::Print(_L("<PIPROF>================================================================="));
-#endif
-
-	if(!aEmptying)
-	    {
-        if(aStatus != 0) 
-            User::RequestComplete(aStatus,0);
-	    }
-	
-	LOGTEXT(_L("CDebOutWriterPlugin::PrintDescriptorAsBase64() - exit"));
-}
-
-
-
-/*
- * 
- * Implementation of class CDebOutWriterHandler
- * 
- */
-CDebOutWriterHandler::CDebOutWriterHandler(CDebOutWriterPlugin* aWriter) :
-    CActive(EPriorityStandard)
-    {
-    LOGTEXT(_L("CDebOutWriterHandler::CDebOutWriterHandler - entry"));
-    iWriter = aWriter;
-    
-    // set initial mode to non-stopping
-    iStopping = EFalse;
-    
-    // add the handler to the active scheduler
-    CActiveScheduler::Add(this);
-    LOGTEXT(_L("CDebOutWriterHandler::CDebOutWriterHandler - exit"));
-    }
-
-CDebOutWriterHandler* CDebOutWriterHandler::NewL(CDebOutWriterPlugin* aWriter)
-{
-	LOGTEXT(_L("CDebOutWriterHandler::NewL() - entry"));
-	CDebOutWriterHandler* self = new (ELeave) CDebOutWriterHandler(aWriter);
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-	LOGTEXT(_L("CDebOutWriterHandler::NewL() - exit"));
-    return self;
-}
-
-CDebOutWriterHandler::~CDebOutWriterHandler()
-    {
-	LOGTEXT(_L("CDebOutWriterHandler::~CDebOutWriterHandler - entry"));
-    
-    LOGTEXT(_L("CDebOutWriterHandler::~CDebOutWriterHandler - exit"));
-    }    
-    
-void CDebOutWriterHandler::ConstructL()
-	{
-
-	}
-
-void CDebOutWriterHandler::StartL()
-	{
-	LOGTEXT(_L("CDebOutWriterHandler::StartL - entry"));
-    if(!IsActive())
-        {
-        LOGTEXT(_L("CDiskWriterHandler::StartL - is not active"));
-    
-        TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
-        LOGSTRING2("CDiskWriterHandler::StartL - got next filled 0x%x",nextBuf);
-    
-        if(nextBuf != 0)
-            {
-            LOGTEXT(_L("CDiskWriterHandler::StartL - writing to file"));
-            WriteBufferToOutput(nextBuf);
-            }
-        }
-	LOGTEXT(_L("CDebOutWriterHandler::StartL - entry"));
-	}
-
-void CDebOutWriterHandler::Stop()
-	{
-	LOGTEXT(_L("CDebOutWriterHandler::Stop - entry"));
-   
-	// do write once more to write the logged data to output
-    // set to stopping mode, needed for emptying the remaining full buffers
-    iStopping = ETrue;
-
-    // stop the timer
-    Reset();
-
-    // set mode back to non-stopping
-    iStopping = EFalse;
-	LOGTEXT(_L("CDebOutWriterHandler::Stop - exit"));
-	}
-
-void CDebOutWriterHandler::Reset()
-    {
-  
-    // start writing new buffer if there is one available
-    TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
-    
-    // empty the rest of the buffers synchronously
-    while(nextBuf != 0)
-        {
-        if(nextBuf->iDataSize != 0)
-            {
-            LOGTEXT(_L("CDiskWriterHandler::Reset - writing to file"));
-            iWriter->PrintDescriptorAsBase64(*(nextBuf->iBufDes),&iStatus,0xffffffff, iStopping);
-            }
-        
-        // empty buffers when profiling stopped
-        iWriter->iStream->AddToFreeBuffers(nextBuf);
-
-        LOGTEXT(_L("CDiskWriterHandler::Reset - get next full buffer"));
-        // start writing new buffer if there is one available
-        nextBuf = iWriter->iStream->GetNextFilledBuffer();
-        LOGSTRING2("CDiskWriterHandler::Reset - got next filled 0x%x",nextBuf);
-        }
-    }
-
-void CDebOutWriterHandler::HandleFullBuffers()
-    {
-    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - entry"));
-    // previous write operation has finished
-    // release the previous buffer 
-    iWriter->iStream->AddToFreeBuffers(iBufferBeingWritten);
-
-    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - get next full buffer"));
-    // start writing new buffer if there is one available
-    TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
-
-    if(nextBuf != 0)
-        {
-        LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - writing to file"));
-        if(nextBuf->iDataSize != 0)
-            {
-            WriteBufferToOutput(nextBuf);
-            }
-        } 
-    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - exit"));
-    }
-
-void CDebOutWriterHandler::RunL()
-    {
-    // call function to complete full buffer handling
-    HandleFullBuffers();
-    }
-
-void CDebOutWriterHandler::DoCancel()
-    {
-    
-    }
-
-void CDebOutWriterHandler::WriteBufferToOutput(TBapBuf* aBuf)
-    {
-    LOGTEXT(_L("CDebOutWriterHandler::WriteBufferToOutput - entry"));
-    iBufferBeingWritten = aBuf;
-
-    // set the data length just to be sure
-    iBufferBeingWritten->iBufDes->SetLength(aBuf->iDataSize);
-
-    LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - writing to file"));
-//    PrintBufferToOutput(iBufferBeingWritten, iStatus);
-    iWriter->PrintDescriptorAsBase64(*(iBufferBeingWritten->iBufDes),&iStatus,0xffffffff, iStopping);
-    // set AO back to active, until filled buffers are emptied 
-    SetActive();
-    
-    LOGTEXT(_L("CDebOutWriterHandler::WriteBufferToOutput - exit"));
-    }
-
-// private
-void CDebOutWriterHandler::PrintBufferToOutput(TBapBuf* aBuffer, TRequestStatus& aStatus)
-    {
-    LOGTEXT(_L("CDebOutWriterHandler::WriteBufferToOutput() - debug out writer tick activated"));
-
-    TPtrC8& aDes = (TPtrC8&)*(aBuffer->iBufDes);
-#ifdef BAPPEA_SAMPLE_MARKS
-    TUint32 time = iSampler->GetSampleTime();
-#else
-    TUint32 time = 0xffffffff;
-#endif
-    iWriter->PrintDescriptorAsBase64(aDes,&aStatus,time, iStopping);
-    }
-
--- a/piprofiler/plugins/DebugOutputWriterPlugin/src/DebOutWriterPluginImplementationTable.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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 FILES
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-
-#include "DebOutWriterPlugin.h"
-
-
-// Provides a key value pair table, this is used to identify
-// the correct construction function for the requested interface.
-const TImplementationProxy ImplementationTable[] =
-{
-         IMPLEMENTATION_PROXY_ENTRY(0x2001E5BA,  CDebOutWriterPlugin::NewL)
-};
-
-// Function used to return an instance of the proxy table.
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-{
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-    return ImplementationTable;
-}
-
--- a/piprofiler/plugins/DiskWriterPlugin/data/2001E5BB.rss	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 <ecom/registryinfo.rh>
-
-// Declares info for two implementations
-RESOURCE REGISTRY_INFO theInfo
-    {
-    // UID for the DLL. See mmp files
-    //__SERIES60_3X__ can't be used in resource files
-    dll_uid = 0x2001E5BB;
-
-    // Declare array of interface info. This dll contains implementations for 
-    // only one interface (CSamplerInterfaceDefinition).
-    interfaces = 
-        {
-        INTERFACE_INFO
-            {
-            // UID of interface that is implemented
-            interface_uid = 0x2001E5BD;
-
-            implementations = 
-                {
-                IMPLEMENTATION_INFO
-                    {
-                    implementation_uid = 0x2001E5BB;
-
-                    version_no = 1;
-                    display_name = "Disk output writer implementation";
-                    default_data = "dsw";
-                    opaque_data = "0";
-                    }
-                };
-            }
-        };
-    }
--- a/piprofiler/plugins/DiskWriterPlugin/group/DiskWriterPlugin.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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 <platform_paths.hrh>
-
-
-TARGET        PIProfilerDiskWriter.dll
-TARGETTYPE    PLUGIN
-UID           0x10009D8D 0x2001E5BB
-#ifdef WINSCW
-VENDORID      0
-#else
-VENDORID      VID_DEFAULT
-#endif
-CAPABILITY    ALL -TCB // AllFiles ReadDeviceData ReadUserData UserEnvironment WriteDeviceData WriteUserData
-SMPSAFE
-
-OS_LAYER_SYSTEMINCLUDE
-USERINCLUDE     ../inc
-SOURCEPATH      ../src
-
-START RESOURCE ../data/2001E5BB.rss
-TARGET piprofilerdiskwriter.rsc
-END
-
-SOURCE          DiskWriterPlugin.cpp
-SOURCE          DiskWriterPluginImplementationTable.cpp
-
-LIBRARY			sysutil.lib 
-LIBRARY         euser.lib
-LIBRARY         ecom.lib
-LIBRARY         efsrv.lib
-LIBRARY         CommonEngine.lib
-LIBRARY			flogger.lib
-
--- a/piprofiler/plugins/DiskWriterPlugin/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +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:  
-*
-*/
-
-
-PRJ_MMPFILES
-DiskWriterPlugin.mmp
--- a/piprofiler/plugins/DiskWriterPlugin/inc/DiskWriterPlugin.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +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 __DISKWRITERPLUGIN_H__
-#define __DISKWRITERPLUGIN_H__
-
-//  Include Files
-#include <w32std.h>
-#include <piprofiler/WriterPluginInterface.h>
-#include <piprofiler/ProfilerGenericClassesUsr.h>
-#include <e32base.h>	// CBase
-#include <e32std.h>	 // TBuf
-#include <e32property.h>
-
-_LIT(KFileOutShortName, "dsw");
-
-// forward declarations
-class CDiskWriterHandler;
-class CProfilerSampleStream;
-
-//  Class Definitions
-
-class CDiskWriterPlugin : public CWriterPluginInterface
-	{
-public:
-	// new function
-	static CDiskWriterPlugin* NewL(const TUid aImplementationUid, TAny* aInitParams);
-	~CDiskWriterPlugin();
-
-	void	DoCancel();
-
-	
-public: // new functions
-	
-	TInt 	Start();
-
-	void 	Stop();
-    
-	void 	GetValue( const TWriterPluginValueKeys aKey, TDes& aValue );
-	
-	void 	SetValue( const TWriterPluginValueKeys aKey, TDes& aValue ); 
-    
-	TUid 	Id() const;
-		 
-	void 	GetWriterVersion(TDes* aDes);
-	
-	TUint32 GetWriterType();
-
-	void   HandleError(TInt aError);
-	
-	void   WriteData();
-	
-	void   SetStream(CProfilerSampleStream& aStream) { iStream = &aStream; }
-	
-private: // new functions
-	CDiskWriterPlugin(const TUid aImplementationUid);
-	void 	ConstructL();
-
-	void 	GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
-	void 	SetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
-    TBool   GetEnabled();
-	
-	TInt   DisplayNotifier(const TDesC& aLine1, const TDesC& aLine2, const TDesC& aButton1, const TDesC& aButton2);
-public: 
-    CProfilerSampleStream*          iStream;
-private: // data
-
-    TBuf<256>                       iFileName;
-	TInt 							iWriterType;
-	TInt							iWriterId;
-	CDiskWriterHandler*				iWriterHandler;
-	RProperty                       iErrorStatus;
-	};
-
-/*
- * 
- * Definition of class CDiskWriterHandler
- * 
- */
-class CDiskWriterHandler : public CActive //CBase
-	{
-public:
- 
-
-	static CDiskWriterHandler* NewL(CDiskWriterPlugin* aWriter);
-	~CDiskWriterHandler();
-
-	void StartL();
-
-	void Stop();
-	void RunL();
-	TInt RunError(TInt aError);
-	
-	void DoCancel();
-	void WriteBufferToOutput(TBapBuf* aBuf);
-	void Reset();
-	   
-    TInt TestFile(const TDesC& totalPrefix);
-private:
-	CDiskWriterHandler(CDiskWriterPlugin* aWriter); 
-	
-	void ConstructL();
-    void WriteMemBufferToFile(TDesC8& aDes, TRequestStatus& aStatus);
-	static TInt Write(TAny* aObject);
-	void HandleFullBuffers();
-	void DoWrite();
-	
-private:
-    RFile                           iFile;
-    RFs                             iFs;
-    TBuf<256>                       iFileName;
-	CDiskWriterPlugin* 				iWriter;
-    TBapBuf*                        iBufferBeingWritten;
-    TBool                           iStopping;
-	};
-
-#endif  // __DEBOUTWRITERPLUGIN_H__
-
--- a/piprofiler/plugins/DiskWriterPlugin/sis/DiskWriterPlugin_EKA2.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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:
-;
-; Installation file for DebOutWriterPlugin dll
-;
-; This is an auto-generated PKG file by Carbide.
-; This file uses variables specific to Carbide builds that will not work
-; on command-line builds. If you want to use this generated PKG file from the
-; command-line tools you will need to modify the variables with the appropriate
-; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
-
-;
-; UID is the dll's UID
-;
-#{"DebOutWriterPlugin DLL"},(0x00DA58C7),1,0,0
-
-
-;Localised Vendor name
-%{"Vendor-EN"}
-
-;Unique Vendor name
-:"Vendor"
-
-"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\DebOutWriterPlugin.dll"		  -"!:\sys\bin\DebOutWriterPlugin.dll"
--- a/piprofiler/plugins/DiskWriterPlugin/src/DiskWriterPlugin.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,476 +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 Files  
-
-#include "DiskWriterPlugin.h"	// CDiskWriterPlugin
-#include <e32base.h>
-#include <sysutil.h>
-//#include <piprofiler/EngineUIDs.h>
-
-// constants
-const TUid KDiskWriterPluginUid = { 0x2001E5BB };   // own UID
-
-// engine properties
-const TUid KEngineStatusPropertyCat={0x2001E5AD};
-enum TEnginePropertyKeys
-    {
-    EProfilerEngineStatus = 8,
-    EProfilerErrorStatus
-    };
-
-/*
- *
- *	Class CDiskWriterPlugin implementation
- *
- */
-
-//  Member Functions
-CDiskWriterPlugin* CDiskWriterPlugin::NewL(const TUid /*aImplementationUid*/, TAny* /*aInitParams*/)
-    {
-	LOGTEXT(_L("CDiskWriterPlugin::NewL() - entry"));
-	CDiskWriterPlugin* self = new (ELeave) CDiskWriterPlugin(KDiskWriterPluginUid);
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-	LOGTEXT(_L("CDiskWriterPlugin::NewL() - exit"));
-    return self;
-    }
-
-CDiskWriterPlugin::CDiskWriterPlugin(const TUid aImplementationUid) :
-	iWriterType(aImplementationUid.iUid)
-    {
-    LOGTEXT(_L("CDiskWriterPlugin::CDiskWriterPlugin - entry"));
-    isEnabled = EFalse;
-    iWriterId = Id().iUid;
-    LOGTEXT(_L("CDiskWriterPlugin::CDiskWriterPlugin - exit"));
-    }
-
-CDiskWriterPlugin::~CDiskWriterPlugin()
-    {
-    LOGTEXT(_L("CDiskWriterPlugin::~CDiskWriterPlugin - entry"));
-
-    iErrorStatus.Close();
-    
-    if(iWriterHandler)
-        {
-        iWriterHandler->Cancel();
-        delete iWriterHandler;
-        }
-    LOGTEXT(_L("CDiskWriterPlugin::~CDiskWriterPlugin - exit"));
-    }
-
-void CDiskWriterPlugin::ConstructL()
-	{
-	// second phase constructor, anything that may leave must be constructed here
-	LOGTEXT(_L("CDiskWriterPlugin::ConstructL() - entry"));
-	iWriterHandler = CDiskWriterHandler::NewL(this);
-	User::LeaveIfError(iErrorStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus));
-	LOGTEXT(_L("CDiskWriterPlugin::ConstructL() - exit"));
-	}
-
-TUid CDiskWriterPlugin::Id() const 
-	{
-    LOGSTRING2("CDiskWriterPlugin::Id():0x%X", KDiskWriterPluginUid.iUid );
-    return KDiskWriterPluginUid;
-	}
-	 
-void CDiskWriterPlugin::GetWriterVersion(TDes* aDes)
-	{
-	_LIT(KDiskWriterVersion, "1.0.0");
-	aDes->Append(KDiskWriterVersion);
-	}
-
-TInt CDiskWriterPlugin::Start()
-	{
-//	if(isEnabled)
-//		{
-//		TRAPD(err, iWriterHandler->StartL());
-//		if( err != KErrNone)
-//		    {
-//		    LOGTEXT(_L("Could not start writer plugin"));
-//		    return err;
-//		    }
-//		}
-	return KErrNone;
-	}
-
-void CDiskWriterPlugin::Stop()
-	{
-	// stop writer handler normally
-	iWriterHandler->Stop();
-	}
-
-TBool CDiskWriterPlugin::GetEnabled()
-	{
-	return isEnabled;
-	}
-
-TUint32 CDiskWriterPlugin::GetWriterType()
-	{
-	return iWriterType;
-	}
-
-
-void CDiskWriterPlugin::SetValue( const TWriterPluginValueKeys aKey,
-                                    TDes& aValue )
-    {
-    TRAP_IGNORE( SetValueL( aKey, aValue ) );
-    }
-
-
-void CDiskWriterPlugin::GetValue( const TWriterPluginValueKeys aKey,
-                                    TDes& aValue )
-    {
-    TRAP_IGNORE( GetValueL( aKey, aValue ) );
-    }
-
-void CDiskWriterPlugin::SetValueL( const TWriterPluginValueKeys aKey, TDes& aValue )
-    {
-    TInt error(KErrNone);
-    
-    switch( aKey )
-        {
-        case EWriterPluginEnabled:
-            isEnabled = ETrue;
-        	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin enabled"));
-        	break;
-        case EWriterPluginDisabled:
-            isEnabled = EFalse;
-        	LOGTEXT(_L("CDebOutWriterPlugin::SetValueL - plugin disabled"));	
-            break;
-        case EWriterPluginSettings:	// file name in case of disk writer plugin
-        	iFileName.Zero();
-        	iFileName.Append(aValue);
-        	error = iWriterHandler->TestFile(iFileName);
-        		User::LeaveIfError(error);
-        	break;
-        default:
-        	break;
-        }
-    }
-
-void CDiskWriterPlugin::GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue )
-    {
-    switch( aKey )
-        {
-        case EWriterPluginVersion:
-        	GetWriterVersion(&aValue);
-        	break;
-        case EWriterPluginType:
-        	break;
-        case EWriterPluginSettings:	// file name in disk writer case
-        	aValue.Copy(iFileName);
-           default:
-                break;
-        }
-    }
-
-void CDiskWriterPlugin::DoCancel()
-    {
-	LOGTEXT(_L("CDebOutWriterPlugin::DoCancel - entry"));
-    }
-
-void CDiskWriterPlugin::WriteData()
-    {
-    // Activate handler to write data from buffer to output
-    LOGTEXT(_L("CDiskWriterPlugin::WriteData() - entry"));
-    TRAP_IGNORE(iWriterHandler->StartL());
-    LOGTEXT(_L("CDiskWriterPlugin::WriteData() - exit"));
-    }
-
-void CDiskWriterPlugin::HandleError(TInt aError)
-    {
-    TInt err(KErrNone);
-    RDebug::Print(_L("CDiskWriterPlugin::HandleError() - error received: %d"), aError);
-    err = iErrorStatus.Set(aError);
-    if(err != KErrNone)
-        {
-        RDebug::Print(_L("CDiskWriterPlugin::HandleError() - error in updating property: %d"), err);
-        }
-    }
-
-/*
- * 
- * Implementation of class CDiskWriterHandler
- * 
- */
-
-CDiskWriterHandler* CDiskWriterHandler::NewL(CDiskWriterPlugin* aWriter)
-    {
-	LOGTEXT(_L("CDiskWriterHandler::NewL() - entry"));
-	CDiskWriterHandler* self = new (ELeave) CDiskWriterHandler(aWriter);
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-	LOGTEXT(_L("CDiskWriterHandler::NewL() - exit"));
-    return self;
-    }
-
-CDiskWriterHandler::CDiskWriterHandler(CDiskWriterPlugin* aWriter)  :
-    CActive(EPriorityStandard)
-    {
-    LOGTEXT(_L("CDiskWriterHandler::CDiskWriterHandler - entry"));
-
-    iWriter = aWriter;
-    
-    // set initial mode to non-stopping
-    iStopping = EFalse;
-    
-    // add the handler to the active scheduler
-    CActiveScheduler::Add(this);
-    
-    LOGTEXT(_L("CDiskWriterHandler::CDiskWriterHandler - exit"));
-    }
-
-
-CDiskWriterHandler::~CDiskWriterHandler()
-    {
-	LOGTEXT(_L("CDiskWriterHandler::~CDiskWriterHandler - entry"));
-
-	LOGTEXT(_L("CDiskWriterHandler::~CDiskWriterHandler - exit"));
-    }    
-    
-void CDiskWriterHandler::ConstructL()
-	{
-	}
-
-TInt CDiskWriterHandler::TestFile(const TDesC& totalPrefix) 
-    {
-    TParse parse;
-
-    TInt err(KErrNone);
-    if((err = parse.Set(totalPrefix, NULL, NULL)) != KErrNone)
-        return err;
-
-    err = iFs.Connect();
-    if(err != KErrNone)
-        {
-        LOGTEXT(_L("CDiskWriterHandler::TestFile() - Failed to open a session to file server"));
-        return KErrNotFound;
-        }
-    
-    iFs.MkDirAll(parse.FullName());
-    
-    err = iFile.Replace(iFs,parse.FullName(),EFileWrite);
-    if(err != KErrNone)
-        {
-        iFs.Close();
-        return KErrNotFound;
-        }
-    
-    iFileName.Copy(parse.FullName());
-
-    return KErrNone;
-    }
-
-void CDiskWriterHandler::Reset()
-    {
-    // cancel active object
-    Cancel();
-    
-    // start writing new buffer if there is one available
-    TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
-    
-    // empty the rest of the buffers synchronously
-    while(nextBuf != 0)
-        {
-        LOGTEXT(_L("CDiskWriterHandler::Reset - writing to file"));
-        if(nextBuf->iDataSize != 0)
-            {
-            LOGTEXT(_L("CDiskWriterHandler::Reset - writing to file"));
-            WriteMemBufferToFile(*(nextBuf->iBufDes),iStatus);
-            }
-        
-        // empty buffers when profiling stopped
-        iWriter->iStream->AddToFreeBuffers(nextBuf);
-
-        LOGTEXT(_L("CDiskWriterHandler::Reset - get next full buffer"));
-        // start writing new buffer if there is one available
-        nextBuf = iWriter->iStream->GetNextFilledBuffer();
-        LOGSTRING2("CDiskWriterHandler::Reset - got next filled 0x%x",nextBuf);
-        }
-    }
-
-void CDiskWriterHandler::HandleFullBuffers()
-    {
-    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - entry"));
-    // previous write operation has finished
-    // release the previous buffer 
-    iWriter->iStream->AddToFreeBuffers(iBufferBeingWritten);
-
-    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - get next full buffer"));
-    // start writing new buffer if there is one available
-    TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
-
-    if(nextBuf != 0)
-        {
-        LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - writing to file"));
-        if(nextBuf->iDataSize != 0)
-            {
-            WriteBufferToOutput(nextBuf);
-            }
-        } 
-    LOGTEXT(_L("CDiskWriterHandler::HandleFullBuffers - exit"));
-    }
-
-void CDiskWriterHandler::RunL()
-    {
-    LOGTEXT(_L("CDiskWriterHandler::RunL - entry"));
-    // call function to complete full buffer handling
-    HandleFullBuffers();
-    LOGTEXT(_L("CDiskWriterHandler::RunL - exit"));
-    }
-
-void CDiskWriterHandler::DoCancel()
-    {
-    
-    }
-
-//-----------------------------------------------------------------------------
-// CPIProfilerTraceCoreLauncher::RunError(TInt aError)
-// Handle leaves from RunL().
-//-----------------------------------------------------------------------------
-TInt CDiskWriterHandler::RunError(TInt aError)
-    {
-    // no reason to continue if disk full or removed
-    iFile.Close();
-    // close handle to file server too
-    iFs.Close();
-    iFileName.Zero();
-    
-    iWriter->HandleError(KErrDiskFull);
-    return aError;
-    }
-
-void CDiskWriterHandler::WriteMemBufferToFile(TDesC8& aDes, TRequestStatus& aStatus)
-    {   
-    LOGTEXT(_L("CDiskWriterPlugin::WriteMemBufferToFile - entry"));
-
-    TUint sampleSize(aDes.Length());
-    TInt err(KErrNone);
-    TInt drive(0);
-    TDriveInfo info;
-    TBool noDiskSpace(EFalse);
-    
-    err = iFile.Drive(drive,info);
-
-    // test available disk space 
-    TRAP_IGNORE((noDiskSpace = SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, sampleSize, drive))); 
-    // check first if still space on disk
-    if(noDiskSpace)
-        {
-        // set error to disk full
-        err = KErrDiskFull;
-        LOGTEXT(_L("CDiskWriterPlugin::WriteMemBufferToFile - disk full, cannot write"));
-        }
-    else
-        {
-        // check if profiling in stopping mode
-        if(iStopping)
-            {
-            // RDebug::Print(_L("CDiskWriterPlugin::WriteMemBufferToFile - data written, length %d, stopping"), aDes.Length());
-            // write to file without status
-            err = iFile.Write(aDes);
-            }
-        else
-            {
-            // RDebug::Print(_L("CDiskWriterPlugin::WriteMemBufferToFile - data written, length %d"), aDes.Length());
-            // write to file with status
-            iFile.Write(aDes,aStatus);
-            }
-        }
-    
-    // check if error in write
-    if(err != KErrNone)
-        {
-        // stop writer handler (and its timer) immediately, DO NOT try write data!
-        Cancel();
-        
-        // no reason to continue if disk full or removed
-        // end of stream detected, file can be closed
-        iFile.Close();
-        // close handle to file server too
-        iFs.Close();
-        iFileName.Zero();
-        
-        // set error status for engine to read
-        iWriter->HandleError(err);
-        }
-    LOGTEXT(_L("CDiskWriterPlugin::WriteMemBufferToFile - exit"));
-    }
-
-void CDiskWriterHandler::WriteBufferToOutput(TBapBuf* aBuf)
-    {
-    LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - entry"));
-    iBufferBeingWritten = aBuf;
-
-    // set the data length just to be sure
-    iBufferBeingWritten->iBufDes->SetLength(aBuf->iDataSize);
-
-    LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - writing to file"));
-    WriteMemBufferToFile(*(iBufferBeingWritten->iBufDes), iStatus);
-
-    // set AO back to active, until filled buffers are emptied 
-    SetActive();
-    
-    LOGTEXT(_L("CDiskWriterPlugin::WriteBufferToOutput - exit"));
-    }
-
-void CDiskWriterHandler::StartL()
-	{
-	LOGTEXT(_L("CDiskWriterHandler::StartL - entry"));
-    if(!IsActive())
-        {
-        LOGTEXT(_L("CDiskWriterHandler::StartL - is not active"));
-    
-        TBapBuf* nextBuf = iWriter->iStream->GetNextFilledBuffer();
-        LOGSTRING2("CDiskWriterHandler::StartL - got next filled 0x%x",nextBuf);
-    
-        if(nextBuf != 0)
-            {
-            LOGTEXT(_L("CDiskWriterHandler::StartL - writing to file"));
-            WriteBufferToOutput(nextBuf);
-            }
-        }
-    LOGTEXT(_L("CDiskWriterHandler::StartL - exit"));
-	}
-
-void CDiskWriterHandler::Stop()
-	{
-	LOGTEXT(_L("CDiskWriterHandler::Stop - entry"));
-	
-	// set to stopping mode, needed for emptying the remaining full buffers
-	iStopping = ETrue;
-	
-	// stop the timer
-	Reset();
-
-    // end of stream detected, file can be closed
-    iFile.Close();
-    // close handle to file server too
-    iFs.Close();
-    iFileName.Zero();
-    
-    // set mode back to non-stopping
-    iStopping = EFalse;
-    
-    LOGTEXT(_L("CDiskWriterHandler::Stop - exit"));
-	}
-
-// end of file
--- a/piprofiler/plugins/DiskWriterPlugin/src/DiskWriterPluginImplementationTable.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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 FILES
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-
-#include "DiskWriterPlugin.h"
-
-
-// Provides a key value pair table, this is used to identify
-// the correct construction function for the requested interface.
-const TImplementationProxy ImplementationTable[] =
-{
-         IMPLEMENTATION_PROXY_ENTRY(0x2001E5BB,  CDiskWriterPlugin::NewL)
-};
-
-// Function used to return an instance of the proxy table.
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-{
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-    return ImplementationTable;
-}
-
--- a/piprofiler/plugins/GeneralsPlugin/data/2001E5B2.rss	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 <ecom/registryinfo.rh>
-
-// Declares info for two implementations
-RESOURCE REGISTRY_INFO theInfo
-    {
-    // UID for the DLL. See mmp files
-    //__SERIES60_3X__ can't be used in resource files
-    dll_uid = 0x2001E5B2;
-
-    // Declare array of interface info. This dll contains implementations for 
-    // only one interface (CSamplerInterfaceDefinition).
-    interfaces = 
-        {
-        INTERFACE_INFO
-            {
-            // UID of interface that is implemented
-            interface_uid = 0x2001E5BC;
-
-            implementations = 
-                {
-                IMPLEMENTATION_INFO
-                    {
-                    implementation_uid = 0x2001E5B2;
-
-                    version_no = 1;
-                    display_name = "General Samplers; GPP, ITT, GFC, MEM, PRI";
-                    default_data = "gen";
-                    opaque_data = "0";	// the order number
-                    }
-                };
-            }
-        };
-    }
--- a/piprofiler/plugins/GeneralsPlugin/group/GeneralsPlugin.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +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 <platform_paths.hrh>
-
-
-TARGET              PIProfilerGenerals.dll
-TARGETTYPE          PLUGIN
-UID                 0x10009D8D 0x2001E5B2
-VENDORID            VID_DEFAULT
-CAPABILITY          ALL -TCB
-SMPSAFE
-
-EPOCSTACKSIZE     	0x10000
-
-OS_LAYER_SYSTEMINCLUDE
-USERINCLUDE     ../inc
-SOURCEPATH      ../src
-
-START RESOURCE  ../data/2001E5B2.rss
-TARGET PIProfilerGenerals.rsc
-END
-
-SOURCE              GeneralsPluginImplementationTable.cpp
-SOURCE              GeneralsPlugin.cpp
-
-LIBRARY             euser.lib
-LIBRARY     		bafl.lib 
-LIBRARY             ecom.lib
-LIBRARY             apparc.lib
-LIBRARY             cone.lib
-LIBRARY             ws32.lib
-LIBRARY             charconv.lib
-LIBRARY             CommonEngine.lib
-LIBRARY				flogger.lib
-
-epocallowdlldata
--- a/piprofiler/plugins/GeneralsPlugin/group/GeneralsSampler.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +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 <platform_paths.hrh>
-#include "kernel/kern_ext.mmh"
-
-TARGET              PIProfilerGeneralsSampler.ldd
-CAPABILITY          ALL
-TARGETTYPE          LDD
-UID                 0x100000AF 0x2001E5B3
-VENDORID            VID_DEFAULT 
-SMPSAFE
-
-OS_LAYER_KERNEL_SYSTEMINCLUDE
-USERINCLUDE         ../inc
-SOURCEPATH          ../src
-
-SOURCE              GeneralsDriver.cpp 
-SOURCE              GeneralsSampler.cia
-SOURCE              GppSamplerImpl.cpp 
-SOURCE              IttEventHandler.cpp
-SOURCE              IttSamplerImpl.cpp
-SOURCE              MemoryEventHandler.cpp 
-SOURCE              MemSamplerImpl.cpp 
-SOURCE              PriSamplerImpl.cpp
-
-#ifdef SMP
-LIBRARY				ekernsmp.lib
-#else
-LIBRARY				ekern.lib
-#endif
-
-epocallowdlldata
-
-start wins
-win32_headers
-end
--- a/piprofiler/plugins/GeneralsPlugin/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +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:  
-*
-*/
-
-//PRJ_PLATFORMS
-//DEFAULT ARMV5SMP
-
-PRJ_MMPFILES
-#ifdef MARM
-  GeneralsPlugin.mmp
-  GeneralsSampler.mmp
-#endif
--- a/piprofiler/plugins/GeneralsPlugin/inc/GeneralsConfig.h	Fri Aug 27 11:37:29 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 GENERALS_CONFIG_H
-#define GENERALS_CONFIG_H
-
-
-	// change this to reflect the ISA task amount
-	#define PROFILER_ISA_OS_TASK_AMOUNT	50	
-
-	// don't change these definitions
-	#define	PROFILER_DEFINE_ISA_TASK_NAME_ARRAY 			TBuf8<64> isaTaskNames[PROFILER_ISA_OS_TASK_AMOUNT];
-	#define PROFILER_DEFINE_ISA_TASK_NAME(name,number)	isaTaskNames[number].Append(_L8(name));										
-
-	// change these to reflect the real ISA task names and numbers
-	// the last number must be PROFILER_ISA_OS_TASK_AMOUNT-1
-
-	#define PROFILER_ISA_TASK_NAMES		PROFILER_DEFINE_ISA_TASK_NAME("SRVSCKT_TASK",0)\
-		PROFILER_DEFINE_ISA_TASK_NAME("CSD_SRV_TASK",1)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("CSD_NTB_TASK",2)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("CSD_WTB_TASK",3)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("PH_TASK",4)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("L2_TASK",5)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("RR_TASK",6)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("GPRS_RLC_TASK",7)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("GPRS_MAC_TASK",8)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("RANC_TASK",9)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("MM_TASK",10)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("CC_TASK",11)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("SMS_TASK",12)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("RM_CONTROL_TASK",13)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("GSS_SERVER_TASK",14)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("CS_MAIN_TASK",15)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("GPRS_TASK",16)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("WMAC_TASK",17)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("WMHS_TASK",18)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("WRRC_TASK",19)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("WRLC_UL_TASK",20)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("WRLC_DL_TASK",21)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("WPH_TASK",22)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("WRAN_TASK",23)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("SSOM_TASK",24)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("ACCESSORY_TASK",25)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("ADL_TASK",26)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("AUDIO_TASK",27)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("PN_TASK",28)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("CORE_HI_TASK",29)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("CORE_LO_TASK",30)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("ENERGY_TASK",31)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("FBUS_TASK",32)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("PMM_FILE2_TASK",33)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("MDI_RCV_TASK",34)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("MDI_SEND_TASK",35)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("MONITOR_TASK",36)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("MTC_CTRL_TASK",37)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("MTC_WD_TASK",38)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("OBEX_TASK",39)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("APDU_SERVER_TASK",40)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("SIMSON_SERVER_TASK",41)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("SIMLOCK_TASK",42)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("SOS_USB_MM_TASK",43)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("SOS_PROXY_AUX_TASK",44)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("TERMINAL_ADAPTER_TASK",45)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("XTI_RECEIVE_TASK",46)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("XTI_SEND_TASK",47)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("STARTUP_AND_BACKGROUND_TASK",48)						\
-		PROFILER_DEFINE_ISA_TASK_NAME("OS_IDLE_TASK",49)	
-
-	// old definitions
-	#define 	PROFILER_GENERALS_SAMPLER_ID		100
-	#define		PROFILER_GPP_SAMPLER_ID			1
-	#define		PROFILER_GFC_SAMPLER_ID			2
-	#define		PROFILER_ITT_SAMPLER_ID			3
-	#define		PROFILER_MEM_SAMPLER_ID			4
-	#define		PROFILER_PRI_SAMPLER_ID			5
-
-	#define		PROFILER_GPP_SAMPLER_NAME _L("GPP")
-	#define		PROFILER_GFC_SAMPLER_NAME _L("GFC")
-	#define		PROFILER_ITT_SAMPLER_NAME _L("ITT")
-	#define		PROFILER_MEM_SAMPLER_NAME _L("MEM")
-	#define		PROFILER_PRI_SAMPLER_NAME _L("PRI")
-
-	
-#endif
--- a/piprofiler/plugins/GeneralsPlugin/inc/GeneralsDriver.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +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 __GENERALSSAMPLER_H__
-#define __GENERALSSAMPLER_H__
-
-/*
- * The user-interface to the sampling device driver sued by the profiling engine
- */
-#include <piprofiler/PluginSampler.h>
-
-#ifndef __KERNEL_MODE__
-#include <utf.h>
-#endif
-
-
-/**
- * The user device driver class for controlling the plugin sampler.
- */
-
-class RGeneralsSampler :  public RPluginSampler 
-{	
-	public:
-		#ifndef __KERNEL_MODE__
-		
-		/** Open a channel to the sampling device **/
-		inline TInt Open();
-		
-		#endif	// !__KERNEL_MODE__	
-};
-	
-_LIT(KPluginSamplerName,"PIProfilerGeneralsSampler");
-
-#ifndef __KERNEL_MODE__
-
-inline TInt RGeneralsSampler::Open()
-{
-	return DoCreate(KPluginSamplerName,TVersion(1,0,1),KNullUnit,NULL,NULL);
-}
-
-
-#endif
-#endif
-
--- a/piprofiler/plugins/GeneralsPlugin/inc/GeneralsPlugin.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +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 PROFILER_GENERALSECOM_SAMPLER_H
-#define PROFILER_GENERALSECOM_SAMPLER_H
-
-#include <w32std.h>
-
-#include "GeneralsDriver.h"
-#include "GeneralsConfig.h"
-#include <piprofiler/SamplerPluginInterface.h>
-#include <piprofiler/ProfilerGenericClassesUsr.h>
-
-// constants 
-const TUint KDefaultOutputCombination = 3;
-
-const TUint KSubSamplerCount = 5;
-
-// parent itself
-_LIT(KGENShortName, "gen");
-_LIT(KGENMediumName, "Generic samplers plug-in");
-_LIT(KGENLongName, "Generic samplers plug-in");
-
-// gpp caption definitions
-_LIT8(KGPPShortName, "gpp");
-#ifdef CARBIDE_NAMES
-_LIT8(KGPPLongName, "Address/Thread sampling");
-#else
-_LIT8(KGPPLongName, "CPU load sampler");
-#endif
-_LIT8(KGPPDescription, "CPU load sampler\nSampling thread and process load\nHW dep: N/A\nSW dep: S60 3.0\n");
-
-// gfc caption definitions
-_LIT8(KGFCShortName, "gfc");
-#ifdef CARBIDE_NAMES
-_LIT8(KGFCLongName, "Function call sampling");
-#else
-_LIT8(KGFCLongName, "Function call sampler");
-#endif
-_LIT8(KGFCDescription, "Function call sampler\nCapturing function call info\nHW dep: N/A\nSW dep: S60 3.0\n");
-
-// itt caption definitions
-_LIT8(KITTShortName, "itt");
-#ifdef CARBIDE_NAMES
-_LIT8(KITTLongName, "Dynamic binary support");
-#else
-_LIT8(KITTLongName, "Dynamic binary sampler");
-#endif
-_LIT8(KITTDescription, "Dynamic binary sampler\nTracing dynamically loaded binaries, e.g. from ROFS\nHW dep: N/A\nSW dep: S60 3.0\n");
-
-// mem caption definitions
-_LIT8(KMEMShortName, "mem");
-#ifdef CARBIDE_NAMES
-_LIT8(KMEMLongName, "Memory usage sampler");
-#else
-_LIT8(KMEMLongName, "Memory trace sampler");
-#endif
-_LIT8(KMEMDescription, "Memory trace sampler\nTracing memory, i.e. stack and chunk usage\nHW dep: N/A\nSW dep: S60 3.0\n");
-
-// pri caption definitions
-_LIT8(KPRIShortName, "pri");
-#ifdef CARBIDE_NAMES
-_LIT8(KPRILongName, "Thread priority sampling");
-#else
-_LIT8(KPRILongName, "Priority trace sampler");
-#endif
-_LIT8(KPRIDescription, "Priority trace sampler\nTracing thread priorities\nHW dep: N/A\nSW dep: S60 3.0\n");
-
-
-// forward definitions
-class CConfigInfoArray;
-class CProfilerBufferHandler;
-class CProfilerSampleStream;
-class TSamplerAttributes;
-
-class CGeneralsPlugin : public CSamplerPluginInterface
-{
-public:
-	static CGeneralsPlugin* NewL(const TUid aImplementationUid, TAny* /*aInitParams*/);
-	~CGeneralsPlugin();
-
-	TUint32 GetSampleTime();
-	
-	/* 
-	 * Sub sampler specific functions
-	 * 
-	 */
-	
-	// from CSamplerPluginInterface
-	TInt 	ResetAndActivateL(CProfilerSampleStream& aStream);
-	TInt 	StopSampling();
-    TBool   Enabled() { return iEnabled; }
-
-	TUid 	Id( TInt aSubId ) const;
-	TInt 	SubId( TUid aSubId ) const;	// internal
-
-	void    GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes);
-	TInt    SetAttributesL(TSamplerAttributes aAttributes);
-	void    InitiateSamplerAttributesL();
-	
-	TInt    ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray);
-	TInt    DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex);
-	void    SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex);
-
-	TInt 	GetSamplerType();
-	
-	void    InstallStreamForActiveTraces(RGeneralsSampler& sampler, CProfilerSampleStream& aStream);
-	
-private:
-	CGeneralsPlugin();
-	void ConstructL();
-
-	TInt InitiateSamplerL();
-	TInt CleanSampler();
-    void SetSettingsToSamplers();
-	
-private:
-	TUint8						iVersion[20];
-	TPtr8						iVersionDescriptor;
-	
-	RGeneralsSampler 			iGeneralsSampler;
-
-	CProfilerBufferHandler*		iBufferHandler;
-	
-	CArrayFixFlat<TSamplerAttributes>* iSamplerAttributes;
-
-	TBuf8<9>                    iSearchTexts;
-public:
-	TUint32* 					iSampleTime;
-};
-
-#endif
--- a/piprofiler/plugins/GeneralsPlugin/inc/GfcSamplerImpl.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +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 PROFILER_GFC_SAMPLER_H
-#define PROFILER_GFC_SAMPLER_H
-
-
-#include "GeneralsConfig.h"
-
-#include <kern_priv.h>
-
-#include <piprofiler/ProfilerGenericClassesKrn.h>
-#include <piprofiler/ProfilerTraces.h>
-#include "GppSamplerImpl.h"
-
-extern void UsrModLr(TUint32*);
-
-
-/*
- *	
- *	GFC sampler definition
- *	
- */
-
-template <int BufferSize>
-class DProfilerGfcSampler : public DProfilerGenericSampler<BufferSize>
-{
-public:
-	DProfilerGfcSampler(struct TProfilerGppSamplerData* );
-	~DProfilerGfcSampler();
-
-	void	Sample();
-	TInt	Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset);
-private:
-	struct TProfilerGppSamplerData* gppSamplerData;
-	TUint32 gfcSample[3];
-
-	TUint8	encodedSample[15];
-	TUint32	repeat;
-};
-
-/*
- *	
- *	GFC sampler implementation
- *	
- */
-
-template <int BufferSize>
-DProfilerGfcSampler<BufferSize>::DProfilerGfcSampler(struct TProfilerGppSamplerData* gppSamplerDataIn) :
-	DProfilerGenericSampler<BufferSize>(PROFILER_GFC_SAMPLER_ID)
-{
-	this->gppSamplerData = gppSamplerDataIn;
-	LOGSTRING2("CProfilerGfcSampler<%d>::CProfilerGfcSampler",BufferSize);	
-}
-
-template <int BufferSize>
-TInt DProfilerGfcSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
-{
-	LOGSTRING2("CProfilerGfcSampler<BufferSize> - entry",BufferSize);
-	
-	this->repeat = 0;
-	for(TInt i(0);i<3;i++)
-	{
-		this->gfcSample[i] = 0;
-	}
-
-	LOGSTRING2("CProfilerGfcSampler<%d>::Reset - calling superclass reset",BufferSize);
-	DProfilerGenericSampler<BufferSize>::Reset(aStream);
-	LOGSTRING2("CProfilerGfcSampler<%d>::Reset - called superclass reset",BufferSize);
-	
-	// add the first sample, indicating the gfc trace version
-	TUint8 firstSample[33];
-	TPtr8 firstSampleDesc(&(firstSample[1]),32);
-	firstSampleDesc.Zero();
-
-	firstSampleDesc.Append(_L8("Bappea_V"));
-	firstSampleDesc.Append(PROFILER_GFC_SAMPLER_VERSION);
-	firstSampleDesc.Append(_L8("_GFC"));
-	firstSample[0] = firstSampleDesc.Size();
-
-	this->iSampleBuffer->AddSample(firstSample,(firstSample[0]+1));
-
-	LOGSTRING2("CProfilerGfcSampler<BufferSize> - exit",BufferSize);
-
-	return KErrNone;
-}
-
-template <int BufferSize>
-void DProfilerGfcSampler<BufferSize>::Sample()
-{
-	LOGSTRING2("CProfilerGfcSampler<%d>::Sample",BufferSize);	
-
-	TUint32 usr_mod_link_reg;
-
-	UsrModLr(&usr_mod_link_reg);
-
-	TUint32 pc(gppSamplerData->lastPcValue);
-	TUint32 lr(usr_mod_link_reg);
-	TUint32 sa(gppSamplerData->sampleNumber);
-
-	if(pc == gfcSample[0] && lr == gfcSample[1] && sa == gfcSample[2]+1)
-	{
-		// encode repeat
-		repeat++;
-		gfcSample[2] = sa;
-		LOGSTRING2("CProfilerGfcSampler<%d>::Sample - repeat",BufferSize);
-		return;
-	}
-	else if(repeat > 0)
-	{
-		TUint8 repeatSample[3];
-		repeatSample[0] = 0xff;
-		repeatSample[1] = (TUint8)(repeat>>8);
-		repeatSample[2] = (TUint8)repeat;
-		this->iSampleBuffer->AddSample(repeatSample,3);
-
-		LOGSTRING3("CProfilerGfcSampler<%d>::Sample - Encoded repeat %d",BufferSize,repeat);
-
-		repeat = 0;
-	}
-
-	TInt ptr(3);
-
-	// encode program counter value
-	if(pc>=gfcSample[0]) 
-	{
-		pc = (pc-gfcSample[0]);
-		encodedSample[0] = 0x80;
-	}
-	else 
-	{
-		pc = (gfcSample[0]-pc);
-		encodedSample[0] = 0x00;
-	}
-
-	if(pc <= (TUint32)0xff) 
-	{
-		encodedSample[0] |= 1;
-		encodedSample[ptr] = (TUint8)pc;ptr++;
-	}
-	else if(pc <= (TUint32)0xffff) 
-	{
-		encodedSample[0] |= 2;
-		encodedSample[ptr] = (TUint8)pc;ptr++;
-		encodedSample[ptr] = (TUint8)(pc>>8);ptr++;
-	}
-	else if(pc <= (TUint32)0xffffff) 
-	{
-		encodedSample[0] |= 3;
-		encodedSample[ptr] = (TUint8)pc;ptr++;
-		encodedSample[ptr] = (TUint8)(pc>>8);ptr++;
-		encodedSample[ptr] = (TUint8)(pc>>16);ptr++;
-	}
-	else 
-	{
-		encodedSample[0] |= 4;
-		encodedSample[ptr] = (TUint8)pc;ptr++;
-		encodedSample[ptr] = (TUint8)(pc>>8);ptr++;
-		encodedSample[ptr] = (TUint8)(pc>>16);ptr++;
-		encodedSample[ptr] = (TUint8)(pc>>24);ptr++;
-	}
-
-	// encode link register value
-	if(lr>=gfcSample[1]) 
-	{
-		lr = (lr-gfcSample[1]);
-		encodedSample[1] = 0x80;
-	}
-	else 
-	{
-		lr = (gfcSample[1]-lr);
-		encodedSample[1] = 0x00;
-	}
-
-	if(lr <= (TUint32)0xff) 
-	{
-		encodedSample[1] |= 1;
-		encodedSample[ptr] = (TUint8)lr;ptr++;
-	}
-	else if(lr <= (TUint32)0xffff) 
-	{
-		encodedSample[1] |= 2;
-		encodedSample[ptr] = (TUint8)lr;ptr++;
-		encodedSample[ptr] = (TUint8)(lr>>8);ptr++;
-	}
-	else if(lr <= (TUint32)0xffffff) 
-	{
-		encodedSample[1] |= 3;
-		encodedSample[ptr] = (TUint8)lr;ptr++;
-		encodedSample[ptr] = (TUint8)(lr>>8);ptr++;
-		encodedSample[ptr] = (TUint8)(lr>>16);ptr++;
-	}
-	else 
-	{
-		encodedSample[1] |= 4;
-		encodedSample[ptr] = (TUint8)lr;ptr++;
-		encodedSample[ptr] = (TUint8)(lr>>8);ptr++;
-		encodedSample[ptr] = (TUint8)(lr>>16);ptr++;
-		encodedSample[ptr] = (TUint8)(lr>>24);ptr++;
-	}
-	
-	// endcode sample number difference
-	if( (sa - gfcSample[2]) < (TUint8)0xff) 
-	{
-		encodedSample[2] = (sa-gfcSample[2]);
-	}
-	else
-	{
-		encodedSample[2] = 0xff;
-		encodedSample[ptr] = (TUint8)sa;ptr++;
-		encodedSample[ptr] = (TUint8)(sa>>8);ptr++;
-		encodedSample[ptr] = (TUint8)(sa>>16);ptr++;
-		encodedSample[ptr] = (TUint8)(sa>>24);ptr++;
-	}
-
-	// store the values for the next sample
-	gfcSample[0] = gppSamplerData->lastPcValue;
-	gfcSample[1] = usr_mod_link_reg;
-	gfcSample[2] = gppSamplerData->sampleNumber;
-	
-	this->iSampleBuffer->AddSample(encodedSample,ptr);
-
-	LOGSTRING3("CProfilerGfcSampler<%d>::Sample Size %d",BufferSize,ptr);
-
-	return;
-
-}
-
-template <int BufferSize>
-DProfilerGfcSampler<BufferSize>::~DProfilerGfcSampler()
-{
-	LOGSTRING2("CProfilerGfcSampler<%d>::~CProfilerGfcSampler",BufferSize);		
-}
-#endif
--- a/piprofiler/plugins/GeneralsPlugin/inc/GppSamplerImpl.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,251 +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 PROFILER_GPP_SAMPLER_H
-#define PROFILER_GPP_SAMPLER_H
-
-#include "GeneralsConfig.h"
-
-#include <e32cmn.h>
-
-#include <piprofiler/ProfilerGenericClassesKrn.h>
-#include <piprofiler/ProfilerTraces.h>
-
-// for RPropertyRef
-#include <sproperty.h> 
-#include <e32cmn.h>
-
-/*
- *	
- *	GPP sampler definition
- *	
- */
-class DGppSamplerImpl //: public DBase
-{
-public:
-
-	DGppSamplerImpl();
-	~DGppSamplerImpl();
-
-	TUint8* EncodeTag(TUint8* aPtr);
-	TUint8* EncodeInt(TUint8* aPtr,TInt aValue);
-	TUint8* EncodeUint(TUint8* aPtr,TUint aValue);
-	TUint8* EncodeText(TUint8* aPtr, const TDesC& aDes);
-
-	TUint8* EncodeName(TUint8* aPtr, DObject& aObject,TUint32 id);
-	TUint8* EncodeThread(TUint8* aPtr, DThread& aThread);
-
-	TBool	IsaTaskKnown(TUint8 task);
-	TUint8* EncodeIsaTask(TUint8* aPtr, TUint task);
-	TUint8* EncodeIsaName(TUint8* aPtr, TUint task,TBool process);
-	
-	TUint8* EncodeRepeat(TUint8* aPtr);
-
-	TInt	CreateFirstSample();
-	TInt	SampleImpl();
-#ifdef __SMP__
-    TSpinLock* LockPtr();
-#endif
-    TInt    iGppSamplingPeriod;
-	TUint8	tempBuf[512];
-	TUint	iLastPc;
-	
-	TBool	iIsaSample;
-	TInt	knownIsaTasks[256];
-	TUint8	knownIsaTaskCount;
-	TInt*	isaOsTaskRunningAddr;
-	void	Reset();
-    TUint32 iSampleCount;
-#ifdef __SMP__
-    TInt        iCpuNumber;
-    TUint32     iStartTime;
-#endif	   
-	PROFILER_DEFINE_ISA_TASK_NAME_ARRAY
-
-private:
-	enum TState {EStop,ERunning,EStopping};
-
-	const TUint* iInterruptStack;
-	
-	TUint		iLastThread;
-	TUint		iRepeat;
-#ifndef __SMP__
-	TUint32 	iStartTime;
-#endif
-	RPropertyRef iIsaStartAddr;
-	RPropertyRef iIsaEndAddr;
-	RPropertyRef iIsaPluginStatus;
-	RPropertyRef iIsaOsTaskRunning;
-	TInt 		iIsaStatus;
-	TInt 		iIsaStart;
-	TInt 		iIsaEnd;
-	TUint32     iMask;
-	TUint32     iCpuSelector;
-};
-
-struct TProfilerGppSamplerData
-{
-//public:
-	TUint32		lastPcValue;
-	TUint32		sampleNumber;
-    TInt        samplingPeriod;
-};
-
-template <int BufferSize>
-class DProfilerGppSampler : public DProfilerGenericSampler<BufferSize>
-{
-public:
-#ifndef __SMP__
-	DProfilerGppSampler();
-#else
-    DProfilerGppSampler(TInt aCpuNumber);
-#endif
-	~DProfilerGppSampler();
-
-	struct TProfilerGppSamplerData* GetExportData();
-	void	Sample();
-	TInt	Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset);
-	TInt 	GetPeriod();
-	
-private:
-	DGppSamplerImpl gppSamplerImpl;
-	struct TProfilerGppSamplerData exportData;
-#ifdef __SMP__
-	TInt   iCpuNumber;
-#endif
-};
-
-/*
- *	
- *	GPP sampler implementation
- *	
- */
-#ifndef __SMP__
-template <int BufferSize>
-DProfilerGppSampler<BufferSize>::DProfilerGppSampler() :
-	DProfilerGenericSampler<BufferSize>(PROFILER_GPP_SAMPLER_ID) 
-    {
-	LOGSTRING2("CProfilerGppSampler<%d>::CProfilerGppSampler",BufferSize);
-    }
-#else
-template <int BufferSize>
-DProfilerGppSampler<BufferSize>::DProfilerGppSampler(TInt aCpuNumber) :
-    DProfilerGenericSampler<BufferSize>(PROFILER_GPP_SAMPLER_ID+(aCpuNumber*20)), iCpuNumber(aCpuNumber) 
-    {
-    LOGSTRING2("CProfilerGppSampler<%d>::CProfilerGppSampler",BufferSize);
-    }
-#endif
-
-template <int BufferSize>
-DProfilerGppSampler<BufferSize>::~DProfilerGppSampler()
-    {
-	LOGSTRING2("CProfilerGppSampler<%d>::~CProfilerGppSampler",BufferSize);		
-    }
-
-template <int BufferSize>
-TInt DProfilerGppSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
-        {
-	LOGSTRING2("CProfilerGppSampler<%d>::Reset - calling superclass reset",BufferSize);
-	DProfilerGenericSampler<BufferSize>::Reset(aStream, 0);
-	LOGSTRING2("CProfilerGppSampler<%d>::Reset - called superclass reset",BufferSize);
-
-	this->gppSamplerImpl.Reset();
-	
-#ifdef __SMP__
-	this->gppSamplerImpl.iCpuNumber = this->iCpuNumber;
-	
-	// set common start time for all CPU samplers
-	this->gppSamplerImpl.iStartTime = aSyncOffset;
-#endif
-	this->gppSamplerImpl.iGppSamplingPeriod = this->iSamplingPeriod;
-	this->gppSamplerImpl.iSampleCount = 0;
-	this->exportData.sampleNumber = 0;
-	this->exportData.lastPcValue = 0;
-    this->exportData.samplingPeriod = this->gppSamplerImpl.iGppSamplingPeriod;
-
-	TInt length = gppSamplerImpl.CreateFirstSample();
-	LOGSTRING3("CProfilerGPPSampler<%d>::Reset - got first sample, size %d",BufferSize,length);	
-	
-	this->iSampleBuffer->AddSample(gppSamplerImpl.tempBuf,length);
-
-	// check if sampling period > 1 ms
-	// NOTE: feature supported in Performance Investigator 2.01 and above
-	if(this->gppSamplerImpl.iGppSamplingPeriod > 1)
-	    {
-        // For Address/Thread (GPP) version 2.01 or above, the first word is the sampling period in milliseconds
-        TUint8* w = gppSamplerImpl.tempBuf;
-        
-        (*w++) = (this->gppSamplerImpl.iGppSamplingPeriod >> 24) & 0xFF;
-        (*w++) = (this->gppSamplerImpl.iGppSamplingPeriod >> 16) & 0xFF;
-        (*w++) = (this->gppSamplerImpl.iGppSamplingPeriod >>  8) & 0xFF;
-        (*w++) = (this->gppSamplerImpl.iGppSamplingPeriod) & 0xFF;
-        
-        this->iSampleBuffer->AddSample(gppSamplerImpl.tempBuf,4);
-	    }
-	
-	LOGSTRING2("CProfilerGPPSampler<%d>::Reset finished",BufferSize);
-	return KErrNone;
-    }
-
-template <int BufferSize>
-void DProfilerGppSampler<BufferSize>::Sample()
-    {
-	LOGSTRING2("CProfilerGppSampler<%d>::Sample",BufferSize);
-//	if(this->gppSamplerImpl.iSampleCount % 1000 == 0) 
-//	    {
-//#ifdef __SMP__
-//	    if(this->iCpuNumber == 0)  // print sample tick only from CPU 0 context
-//	        {
-//#endif
-//	        Kern::Printf(("PIPROF SAMPLE TICK, #%d"),exportData.sampleNumber);
-//#ifdef __SMP__
-//	        }
-//#endif
-//	    }
-	
-	TInt length(gppSamplerImpl.SampleImpl());
-
-    this->gppSamplerImpl.iSampleCount++;
-	this->exportData.sampleNumber += this->gppSamplerImpl.iGppSamplingPeriod;
-	this->exportData.lastPcValue = gppSamplerImpl.iLastPc;
-
-	if(length > 0)
-        {
-        this->iSampleBuffer->AddSample(gppSamplerImpl.tempBuf,length);
-        }
-
-	LOGSTRING3("CProfilerGppSampler<%d>::Sample - length %d",BufferSize,length);
-
-	return;
-    }
-
-
-template <int BufferSize>
-struct TProfilerGppSamplerData* DProfilerGppSampler<BufferSize>::GetExportData()
-    {
-	LOGSTRING2("CProfilerGppSampler<%d>::GetExportData",BufferSize);
-	return &(this->exportData);	
-    }
-
-template <int BufferSize>
-TInt DProfilerGppSampler<BufferSize>::GetPeriod()
-    {
-	return this->gppSamplerImpl.iGppSamplingPeriod;
-    }
-
-#endif
--- a/piprofiler/plugins/GeneralsPlugin/inc/IttEventHandler.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +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:  Event based ITT sampler skeleton copypasted from MemoryEventHandler.h
-*
-*/
-#include "IttSamplerImpl.h"
-
-#ifndef __PI_ITT_EVENT_HANDLER__
-#define __PI_ITT_EVENT_HANDLER__
-
-#include <piprofiler/ProfilerGenericClassesKrn.h>
-
-// CONSTANTS
-const TInt KITTBufferSize = 256;
-
-class DProfilerSampleBuffer;
-
-/*
- * ITT event handler for listaning kernel events 
- */
-class DIttEventHandler : public DKernelEventHandler
-    {
-public:
-    // constructor
-    DIttEventHandler(DProfilerSampleBuffer*  aSampleBuffer, TProfilerGppSamplerData* aGppSamplerDataIn);
-    TInt Create();
-    ~DIttEventHandler();
-    TInt Start();
-    TInt Stop();
-    TBool Tracking() {return iTracking;}
-       
-    TBool SampleNeeded();
-    
-private:
-    static TUint EventHandler(TKernelEvent aEvent, TAny* a1, TAny* a2, TAny* aThis);
-    TUint HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2);
-    // handle code segments
-    TBool HandleAddCodeSeg(DCodeSeg* aSeg);
-    TBool HandleRemoveCodeSeg(DCodeSeg* aSeg);
-
-private:
-    /** Lock serialising calls to event handler */
-        DMutex*     iLock;
-        TBool       iTracking;
-        DProfilerSampleBuffer*  iSampleBuffer;
-
-        TUint32     iCount;        
-        
-        TUint8      iSample[KITTBufferSize];
-        TPtr8       iSampleDescriptor;
-        TProfilerGppSamplerData*     gppSamplerData;
-    };
-
-#endif  //__PI_ITT_EVENT_HANDLER__
--- a/piprofiler/plugins/GeneralsPlugin/inc/IttSamplerImpl.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,327 +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 PROFILER_ITT_SAMPLER_H
-#define PROFILER_ITT_SAMPLER_H
-
-#include "GeneralsConfig.h"
-
-#include <kern_priv.h>
-
-#include <piprofiler/ProfilerGenericClassesKrn.h>
-#include <piprofiler/ProfilerTraces.h>
-#include "GppSamplerImpl.h"
-#include "IttEventHandler.h"
-
-// CONSTANTS
-const TInt KITTSampleBufferSize = 256;
-
-// flags
-#define ITT_EVENT_HANDLER   // enable event based ITT sampling
-
-/*
- *	
- *	ITT sampler definition
- *	
- */
-class DIttEventHandler;
-
-/*
- * User side ITT sampler
- */
-class IttSamplerImpl
-{
-public:
-	IttSamplerImpl();
-	~IttSamplerImpl();
-
-	TInt	SampleImpl(TUint32 pc,TUint32 sampleNum);
-	TBool	SampleNeeded(TUint32 sampleNum);
-	TInt 	CreateFirstSample();
-	void	Reset();
-	TInt    ProcessEvent();
-	
-	TUint8*         itt_sample;
-	TInt            iIttSamplingPeriod;
-	TInt            iIttSamplingPeriodDiv2;
-	TBool           iTimeToSample;
-#ifdef ITT_EVENT_HANDLER
-    TBool           iEventReceived;
-    TBool           iFirstSampleTaken;
-#endif
-	
-private:
-#ifdef ITT_EVENT_HANDLER    
-    TInt            iCount;
-#endif
-    TInt            currentLibCount;
-    TInt            currentProcCount;
-    
-	TUint8          sample[KITTSampleBufferSize ];
-	TPtr8           sampleDescriptor;
-		
-	TBuf8<64>		iVersionData;
-	SDblQue* 		codeSegList;
-
-};
-
-/*
- * ITT sampler kernel part
- * 
- */
-template <int BufferSize>
-class DProfilerIttSampler : public DProfilerGenericSampler<BufferSize>
-{
-public:
-	DProfilerIttSampler(struct TProfilerGppSamplerData* gppSamplerDataIn);
-	~DProfilerIttSampler();
-
-	void	Sample();
-	TInt	Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset);
-	TInt	PostSample();
-	TBool	PostSampleNeeded();
-
-private:
-#ifdef ITT_EVENT_HANDLER
-    DIttEventHandler*               iEventHandler;
-#endif
-	IttSamplerImpl					ittSamplerImpl;
-	struct TProfilerGppSamplerData*     gppSamplerData;
-	TBool							sampleInProgress;
-	TBool							sampleNeeded;
-};
-
-/*  
- *	ITT sampler implementation
- *	
- */ 
-template <int BufferSize>
-DProfilerIttSampler<BufferSize>::DProfilerIttSampler(struct TProfilerGppSamplerData* gppSamplerDataIn) :
-	DProfilerGenericSampler<BufferSize>(PROFILER_ITT_SAMPLER_ID)
-{
-	this->gppSamplerData = (struct TProfilerGppSamplerData*)gppSamplerDataIn;
-	this->sampleInProgress = false;
-	LOGSTRING2("CProfilerIttSampler<%d>::CProfilerIttSampler",BufferSize);	
-}
-
-/*
- *  DProfilerIttSampler::Reset()
- *  
- *  @param DProfilerSampleStream* sample stream
- *  @param TUint32 Offset 
- */
-template <int BufferSize>
-TInt DProfilerIttSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
-{
-    Kern::Printf("DProfilerIttSampler<%d>::Reset - calling superclass reset",BufferSize);
-    DProfilerGenericSampler<BufferSize>::Reset(aStream);
-
-    // check if reset called in stop (by driver)
-    if(aSyncOffset != 999999)
-        {
-#ifdef ITT_EVENT_HANDLER
-        // Itt event handler
-        if(iEventHandler)
-            {
-            // stop previous sampling if still running
-            Kern::Printf("Stopping DIttEventHandler");
-            iEventHandler->Stop();
-            iEventHandler->Close();
-            iEventHandler = NULL;
-            }
-    
-        Kern::Printf("Initiating DIttEventHandler");
-        iEventHandler = new DIttEventHandler(this->iSampleBuffer, this->gppSamplerData);
-        if(iEventHandler)
-            {
-            Kern::Printf("Creating DIttEventHandler");
-            TInt err(iEventHandler->Create());
-            if(err != KErrNone)
-                {
-                Kern::Printf("Error in creation of DIttEventHandler, error %d", err);
-                return err;
-                }
-            }
-        else
-            {
-            Kern::Printf("Could not initiate DIttEventHandler");
-            return KErrGeneral;
-            }
-    
-        // set first sample at the 10 ms, should be enough
-        this->ittSamplerImpl.iIttSamplingPeriod = 10;
-#else
-        this->ittSamplerImpl.iIttSamplingPeriod = this->iSamplingPeriod;
-#endif
-        this->ittSamplerImpl.iIttSamplingPeriodDiv2 = (TInt)(this->ittSamplerImpl.iIttSamplingPeriod / 2);
-        LOGSTRING3("CProfilerIttSampler<%d>::Reset - set ITT sampling period to %d",
-                                BufferSize,this->ittSamplerImpl.iIttSamplingPeriod);
-        }
-    else
-        {
-        LOGSTRING2("DProfilerIttSampler<%d>::Reset - reset in stop", BufferSize);
-#ifdef ITT_EVENT_HANDLER
-        // destroy memory event handler
-        if(iEventHandler)
-            {
-            // stop previous sampling if still running
-            iEventHandler->Stop();
-            iEventHandler->Close();
-            iEventHandler = NULL;
-            }
-#endif
-        return KErrNone;    // return if reset called in stop
-        }
-
-    TInt length(ittSamplerImpl.CreateFirstSample());
-    this->iSampleBuffer->AddSample((TUint8*)&length,1);
-    this->iSampleBuffer->AddSample(ittSamplerImpl.itt_sample, length);
-    this->sampleInProgress = false;
-    this->sampleNeeded = false;
-    //LOGSTRING("DProfilerIttSampler::Reset - exit");
-	this->ittSamplerImpl.Reset();
-    return KErrNone;
-
-}
-
-/*
- * DProfilerIttSampler::PostSample
- * 
- * Function for finishing sample
- */
-template <int BufferSize> 
-TInt DProfilerIttSampler<BufferSize>::PostSample()
-{
-#ifdef ITT_EVENT_HANDLER
-    if(!ittSamplerImpl.iFirstSampleTaken)   // if we haven't read the initial state
-    {
-#endif
-        if(sampleNeeded)
-        {
-            this->sampleNeeded = false;
-            //LOGSTRING3("CProfilerIttSampler<%d>::PostSample - state %d",BufferSize,this->iSampleBuffer->GetBufferStatus());
-            //Kern::Printf("DProfilerIttSampler<%d>::PostSample - state %d",BufferSize,this->iSampleBuffer->GetBufferStatus());
-    
-            TInt length = this->ittSamplerImpl.SampleImpl(this->gppSamplerData->lastPcValue,
-                                                          this->gppSamplerData->sampleNumber);
-            if(length != 0)
-            {		
-                LOGSTRING("ITT sampler PostSample - starting to sample");
-    
-                while(length > 0)
-                {
-                    this->iSampleBuffer->AddSample(ittSamplerImpl.itt_sample,length);
-                    length = this->ittSamplerImpl.SampleImpl( this->gppSamplerData->lastPcValue,
-                                                          this->gppSamplerData->sampleNumber );	
-                    if(length == 0) 
-                    {
-                        LOGSTRING("MEM sampler PostSample - all samples generated!");
-                    }
-                }
-                LOGSTRING("ITT sampler PostSample - finished sampling");
-            }
-            this->sampleInProgress = false;
-        }
-#ifdef ITT_EVENT_HANDLER
-    }   
-        if(!iEventHandler->Tracking())
-            {
-            iEventHandler->Start();
-            Kern::Printf("DProfilerITTSampler<%d>::PostSample - ITT handler started",BufferSize);
-            }
-
-#endif    
-	
-    LOGSTRING2("ITT sampler PostSample - finished sampling, time: %d", gppSamplerData->sampleNumber);
-    
-	// finally perform superclass postsample
-	TInt i(this->DProfilerGenericSampler<BufferSize>::PostSample());
-	return i;
-}
-
-/*
- *  DProfilerIttSampler::PostSampleNeeded()
- *  
- *  Function for deciding if sample handling is needed 
- */
-template <int BufferSize> 
-TBool DProfilerIttSampler<BufferSize>::PostSampleNeeded()
-{
-	LOGSTRING3("CProfilerIttSampler<%d>::PostSampleNeeded - state %d",BufferSize,this->iSampleBuffer->GetBufferStatus());
-
-	TUint32 status = this->iSampleBuffer->iBufferStatus;
-
-	if(status == DProfilerSampleBuffer::BufferCopyAsap || status == DProfilerSampleBuffer::BufferFull || this->sampleNeeded == true)
-	{
-		return true;
-	}
-	
-	return false;
-}
-
-/*
- * DProfilerIttSampler::Sample
- * 
- * Function for initiating sampling
- */
-template <int BufferSize>
-void DProfilerIttSampler<BufferSize>::Sample()
-{
-	LOGSTRING2("CProfilerIttSampler<%d>::Sample",BufferSize);	
-	
-	//#ifdef ITT_TEST
-	LOGSTRING2("CProfilerIttSampler<%d>::Sample",BufferSize);	
-	
-	if(ittSamplerImpl.SampleNeeded(this->gppSamplerData->sampleNumber) && this->sampleInProgress == false) 
-	{
-		this->sampleInProgress = true;
-		this->sampleNeeded = true;
-
-		LOGSTRING2("CProfilerIttSampler<%d>::Sample - sample needed",BufferSize);	
-	}	
-#ifdef ITT_EVENT_HANDLER
-    // call this to increase the time stamp
-    else if(iEventHandler->SampleNeeded())
-        {
-        // set the flag for post sampling
-        this->sampleNeeded = true;
-        }
-#endif
-
-	LOGSTRING2("CProfilerIttSampler<%d>::Sample",BufferSize);
-	return;
-}
-
-/*
- * Destructor
- */
-template <int BufferSize>
-DProfilerIttSampler<BufferSize>::~DProfilerIttSampler()
-{
-	LOGSTRING2("CProfilerIttSampler<%d>::~CProfilerIttSampler",BufferSize);
-#ifdef ITT_EVENT_HANDLER
-     if(iEventHandler)
-         {
-         // stop previous sampling if still running
-         iEventHandler->Stop();
-         iEventHandler->Close();
-         iEventHandler = NULL;
-         }
-#endif
-}
-#endif
-// end of file
--- a/piprofiler/plugins/GeneralsPlugin/inc/MemSamplerImpl.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,427 +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 PROFILER_MEM_SAMPLER_H
-#define PROFILER_MEM_SAMPLER_H
-
-#include "GeneralsConfig.h"
-
-#include <kern_priv.h>
-
-#include <piprofiler/ProfilerGenericClassesKrn.h>
-#include <piprofiler/ProfilerTraces.h>
-#include "GppSamplerImpl.h"
-#include "MemoryEventHandler.h"
-#include <e32btrace.h>
-
-
-// constants
-// defines the maximum thread amount that is assumed to
-// be possible with MEM trace
-const TInt KSampleBufferSize = 257;
-const TInt KProfilerMaxThreadsAmount = 512;
-const TInt KProfilerMaxChunksAmount = 1024;
-const TInt KProfilerMaxLibrariesAmount = 1024;
-const TInt KProfilerTotalMemorySamplePeriod = 100;
-
-// flags
-#define MEM_EVENT_HANDLER
-//#define MEM_EVENT_HANDLER_LIBRARY_EVENTS
-
-/*
- *	
- *	MEM sampler definition
- *	
- */
-
-class DMemoryEventHandler;
-
-class DMemSamplerImpl //: public DBase
-{
-public:
-	enum EProcessingState
-	{
-		EStartingToProcess,
-		EProcessingNames,
-		EProcessingData,
-		ENothingToProcess
-	};
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-	enum ESampleType
-	{
-	    ESampleChunks,
-	    ESampleThreads,
-	    ESampleLibraries
-	};
-#endif
-
-	DMemSamplerImpl();
-	~DMemSamplerImpl();
-
-	TInt	CreateFirstSample();
-	TInt	SampleImpl();
-	TBool	SampleNeeded();
-	void	Reset();
-	TInt	ProcessChunks();
-	TInt    ProcessThreads();
-    TInt    GatherChunks();
-    TInt    GatherThreads();
-
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-    TInt    GatherLibraries();
-    TInt    ProcessLibraries();
-#endif
-    
-	TInt	EncodeChunkData(DChunk& chunk);
-	TInt	EncodeChunkName(DChunk& chunk);
-	TInt	EncodeChunkData(DThread& thread);
-	TInt	EncodeChunkName(DThread& thread);
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-	TInt    EncodeChunkData(DLibrary& library);
-	TInt    EncodeChunkName(DLibrary& library);
-#endif
-
-	TInt 	EncodeTotalMemoryName();
-	TInt 	EncodeTotalMemory();
-	
-	TInt	EncodeNameCode();
-	TInt	EncodeDataCode();
-
-	DChunk*		heapChunksToSample[KProfilerMaxChunksAmount];
-	DChunk*		heapChunkNamesToReport[KProfilerMaxChunksAmount];
-	TInt		iCount;
-	TInt		iChunkCount;
-	TInt		iNewChunkCount;
-	TBuf8<0x50> name;
-	DThread*	threadsToSample[KProfilerMaxThreadsAmount];
-	DThread*	threadNamesToReport[KProfilerMaxThreadsAmount];
-	TInt		iThreadCount;
-	TInt		iNewThreadCount;
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-	DLibrary*   librariesToSample[KProfilerMaxLibrariesAmount];
-	DLibrary*   libraryNamesToReport[KProfilerMaxLibrariesAmount];
-	TInt        iLibraryCount;
-	TInt        iNewLibraryCount;
-	TInt        iLibrariesProcessing;
-#endif
-
-	TInt		iChunksProcessing;
-    TInt        iThreadsProcessing;
-	TInt		iMemSamplingPeriod;
-	TInt		iMemSamplingPeriodDiv2;
-	TInt        iMemSamplingPeriodDiv3;
-	
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-	ESampleType iSampleType;
-#else
-	TBool		iSampleThreads;
-#endif	
-	
-	TBool       iTimeToSample;
-	
-	TBool 		iTotalMemoryOk;
-	TBool		iTotalMemoryNameOk;
-
-	TUint8		sample[KSampleBufferSize];
-	TPtr8		sampleDescriptor;
-	
-	// test
-#ifdef MEM_EVENT_HANDLER
-//	DMemoryEventHandler*   iEventHandler;
-	TBool      iChunksGathered;
-	TBool      iThreadsGathered;
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-	TBool      iLibrariesGathered;
-#endif
-#endif
-};
-
-
-template <int BufferSize>
-class DProfilerMemSampler : public DProfilerGenericSampler<BufferSize>
-{
-public:
-	DProfilerMemSampler(struct TProfilerGppSamplerData*, TInt id);
-	~DProfilerMemSampler();
-
-	void	Sample();
-	TInt	Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset);
-	TInt	PostSample();
-	TBool	PostSampleNeeded();
-	
-private:
-#ifdef MEM_EVENT_HANDLER
-    DMemoryEventHandler*               iEventHandler;
-#endif
-	DMemSamplerImpl			           memSamplerImpl;
-	struct TProfilerGppSamplerData*    gppSamplerData;
-	TBool                              sampleNeeded;
-};
-
-/*
- *	
- *	MEM sampler implementation
- *	
- */
-
-template <int BufferSize>
-DProfilerMemSampler<BufferSize>::DProfilerMemSampler(struct TProfilerGppSamplerData* gppSamplerDataIn, TInt id) :
-	DProfilerGenericSampler<BufferSize>(PROFILER_MEM_SAMPLER_ID)
-    {
-    LOGSTRING2("DProfilerMemSampler<%d>::CProfilerMemSampler",BufferSize);
-	this->gppSamplerData = gppSamplerDataIn;
-	this->iSamplingPeriod = 3000;	// set default setting
-    }
-
-template <int BufferSize>
-TInt DProfilerMemSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
-    {
-//#ifdef MEM_EVENT_HANDLER
-//    Kern::Printf("DProfilerMemSampler<%d>::Reset - calling superclass reset",BufferSize);
-    
-//#endif
-    // check if reset called in stop (by driver)
-    if(aSyncOffset != 999999)
-        {
-        DProfilerGenericSampler<BufferSize>::Reset(aStream);
-        memSamplerImpl.Reset();
-
-#ifdef MEM_EVENT_HANDLER
-        // reset member variables
-        this->memSamplerImpl.iThreadsGathered = false;
-        this->memSamplerImpl.iChunksGathered = false;
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-        this->memSamplerImpl.iLibrariesGathered = false;
-#endif
-        
-        // memory event handler
-        if(iEventHandler)
-            {
-            // stop previous sampling if still running
-//            Kern::Printf("Stopping DMemoryEventHandler");
-            iEventHandler->Stop();
-            iEventHandler->Close();
-            iEventHandler = NULL;
-            }
-    
-//        Kern::Printf("Initiating DMemoryEventHandler");
-        iEventHandler = new DMemoryEventHandler(this->iSampleBuffer);
-        if(iEventHandler)
-            {
-//            Kern::Printf("Creating DMemoryEventHandler");
-            TInt err(iEventHandler->Create());
-            if(err != KErrNone)
-                {
-                Kern::Printf("Error in creation of DMemoryEventHandler, error %d", err);
-                return err;
-                }
-            }
-        else
-            {
-            Kern::Printf("Could not initiate DMemoryEventHandler");
-            return KErrGeneral;
-            }
-    
-        // set first chunk&thread memory lookup at the 5 ms, should be enough
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-        this->memSamplerImpl.iMemSamplingPeriod = 45;
-#else
-        this->memSamplerImpl.iMemSamplingPeriod = 10;
-#endif
-        
-#else
-        this->memSamplerImpl.iMemSamplingPeriod = this->iSamplingPeriod;
-#endif
-        this->memSamplerImpl.iMemSamplingPeriodDiv2 = (TInt)(this->memSamplerImpl.iMemSamplingPeriod / 2);
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-        this->memSamplerImpl.iMemSamplingPeriodDiv3 = (TInt)(this->memSamplerImpl.iMemSamplingPeriod / 3);
-#endif
-	
-        LOGSTRING3("CProfilerMemSampler<%d>::Reset - set mem sampling period to %d",
-                                BufferSize,this->memSamplerImpl.iMemSamplingPeriod);
-        }
-	else
-        {
-        LOGSTRING2("DProfilerMemSampler<%d>::Reset - reset in stop", BufferSize);
-#ifdef MEM_EVENT_HANDLER
-        // destroy memory event handler
-        if(iEventHandler)
-            {
-            // stop previous sampling if still running
-//            Kern::Printf("Stopping DMemoryEventHandler");
-            iEventHandler->Stop();
-            iEventHandler->Close();
-            iEventHandler = NULL;
-            }
-#endif
-        return KErrNone;    // return if reset called in stop
-        }
-
-	// add MEM sample header
-	TInt length(memSamplerImpl.CreateFirstSample());
-	this->iSampleBuffer->AddSample(memSamplerImpl.sample,length);
-	
-	this->sampleNeeded = false;
-	LOGSTRING("DProfilerMemSampler::Reset - exit");
-	return KErrNone;
-    }
-
-template <int BufferSize> 
-TInt DProfilerMemSampler<BufferSize>::PostSample()
-    {
-    this->sampleNeeded = false;
-
-    LOGSTRING3("DProfilerMemSampler<%d>::PostSample - state %d",BufferSize,this->iSampleBuffer->GetBufferStatus());
-    
-#ifdef MEM_EVENT_HANDLER
-    // check if all threads and chunks (and libraries) are gathered
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-    if(!memSamplerImpl.iThreadsGathered || !memSamplerImpl.iChunksGathered || !memSamplerImpl.iLibrariesGathered)
-#else
-    if(!memSamplerImpl.iThreadsGathered || !memSamplerImpl.iChunksGathered)
-#endif
-        {
-#endif
-        // disable interrupts for checking the kernel containers (EChunk, EThread)
-//        TInt interruptLevel(NKern::DisableInterrupts(0));
-        
-        // first collect chunk data
-        TInt length(this->memSamplerImpl.SampleImpl());
-        if(length != 0)
-            {
-            // then, encode the sample to the buffer until no further data available
-            while(length > 0)
-                {
-                this->iSampleBuffer->AddSample(memSamplerImpl.sample,length);
-                length = this->memSamplerImpl.SampleImpl();
-                
-                // indicate that the whole MEM sample ends by having a 0x00 in the end
-                if(length == 0)
-                    {
-                    TUint8 number(0);
-                    LOGSTRING("MEM sampler PostSample - all samples generated!");
-                    
-                    this->iSampleBuffer->AddSample(&number,1);
-                    LOGSTRING2("MEM sampler PostSample - end mark added, time: %d", gppSamplerData->sampleNumber);
-                    }
-                } 
-            }
-        // restore interrupts and continue normal execution
-//        NKern::RestoreInterrupts(interruptLevel);
-#ifdef MEM_EVENT_HANDLER
-    }
-    // check if all threads and chunks are gathered
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-    if(memSamplerImpl.iThreadsGathered && memSamplerImpl.iChunksGathered && memSamplerImpl.iLibrariesGathered)
-#else
-    if(memSamplerImpl.iThreadsGathered && memSamplerImpl.iChunksGathered)
-#endif
-        {
-        // start memory event tracking after checking the current memory status
-        if(!iEventHandler->Tracking())
-            {
-            iEventHandler->Start();
-//            Kern::Printf("DProfilerMemSampler<%d>::PostSample - memory event handler started",BufferSize);
-            }
-        
-        }
-#endif
-    
-    LOGSTRING2("MEM sampler PostSample - finished sampling, time: %d", gppSamplerData->sampleNumber);
-    
-    // finally perform superclass postsample
-	TInt i(this->DProfilerGenericSampler<BufferSize>::PostSample());
-	return i;
-    }
-
-template <int BufferSize> 
-TBool DProfilerMemSampler<BufferSize>::PostSampleNeeded()
-    {
-	LOGSTRING3("DProfilerMemSampler<%d>::PostSampleNeeded - state %d",BufferSize,this->iSampleBuffer->GetBufferStatus());
-
-	TUint32 status(this->iSampleBuffer->iBufferStatus);
-
-	if(status == DProfilerSampleBuffer::BufferCopyAsap || status == DProfilerSampleBuffer::BufferFull || this->sampleNeeded == true)
-	    {
-		return true;
-	    }
-	
-	return false;
-    }
-
-template <int BufferSize>
-void DProfilerMemSampler<BufferSize>::Sample()
-    {
-    LOGSTRING2("DProfilerMemSampler<%d>::Sample",BufferSize);	
-
-    // check if sample is needed, i.e. the sampling interval is met
-	if(memSamplerImpl.SampleNeeded()) 
-	    {
-        // set the flag for post sampling
-		this->sampleNeeded = true;
-
-		// start the MEM sample with the sample time
-		TUint8 number(4);    // mem sampler id
-		this->iSampleBuffer->AddSample(&number,1);
-		this->iSampleBuffer->AddSample((TUint8*)&(gppSamplerData->sampleNumber),4);
-
-		// leave the rest of the processing for PostSample()
-	    }	
-	
-#ifdef MEM_EVENT_HANDLER
-	// call this to increase the time stamp
-	else if(iEventHandler->SampleNeeded())
-	    {
-        // set the flag for post sampling
-        this->sampleNeeded = true;
-	    }
-	
-//	// check if time stamp is divibable with 
-//	if((memSamplerImpl.iCount % KProfilerTotalMemorySamplePeriod) == 0 && 
-//	        memSamplerImpl.iCount > 0)
-//	    {
-//        // sample total memory once per 100 ms 
-//        memSamplerImpl.EncodeTotalMemory();
-//
-//        // add end mark
-//        TUint8 number(0);
-//        this->iSampleBuffer->AddSample(&number,1);
-//	    }
-#endif
-	
-	LOGSTRING2("CProfilerMemSampler<%d>::Sample",BufferSize);
-	return;
-    }
-
-template <int BufferSize>
-DProfilerMemSampler<BufferSize>::~DProfilerMemSampler()
-    {
-	LOGSTRING2("CProfilerMemSampler<%d>::~CProfilerMemSampler",BufferSize);		
-#ifdef MEM_EVENT_HANDLER
-    // memory event handler
-     if(iEventHandler)
-         {
-         // stop previous sampling if still running
-//         Kern::Printf("Stopping DMemoryEventHandler");
-         iEventHandler->Stop();
-         iEventHandler->Close();
-         iEventHandler = NULL;
-         }
-#endif
-    }
-#endif
--- a/piprofiler/plugins/GeneralsPlugin/inc/MemoryEventHandler.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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 "MemSamplerImpl.h"
-
-#ifndef __PI_MEMORY_EVENT_HANDLER__
-#define __PI_MEMORY_EVENT_HANDLER__
-
-#include <piprofiler/ProfilerGenericClassesKrn.h>
-
-// CONSTANTS
-const TInt KEventBufferSize = 257;
-
-class DProfilerSampleBuffer;
-
-class DMemoryEventHandler : public DKernelEventHandler
-    {
-public:
-    // constructor
-    DMemoryEventHandler(DProfilerSampleBuffer*  aSampleBuffer);
-    TInt Create();
-    ~DMemoryEventHandler();
-    TInt Start();
-    TInt Stop();
-    TBool Tracking() {return iTracking;}
-       
-    TBool SampleNeeded();
-    
-private:
-    static TUint EventHandler(TKernelEvent aEvent, TAny* a1, TAny* a2, TAny* aThis);
-    TUint HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2);
-    // handle chunk activity
-    TBool HandleAddChunk(DChunk* aChunk);
-    TBool HandleUpdateChunk(DChunk* aChunk);
-    TBool HandleDeleteChunk(DChunk* aChunk);
-    // handle chunk activity
-    TBool HandleAddThread(DThread* aThread);
-    TBool HandleUpdateThread(DThread* aThread);
-    TBool HandleDeleteThread(DThread* aThread);
-    // handle chunk activity
-    TBool HandleAddProcess(DProcess* aProcess);
-    TBool HandleUpdateProcess(DProcess* aProcess);
-    TBool HandleDeleteProcess(DProcess* aProcess);
-    // handle library activity
-    TBool HandleAddLibrary(DLibrary* aLibrary, DThread* aThread);
-    TBool HandleDeleteLibrary(DLibrary* aLibrary);
-    
-    // data handling
-    TInt AddHeader();
-    TInt AddFooter();
-    TInt EncodeTotalMemory();
-    TInt EncodeNameCode();
-    TInt EncodeNewCode();
-    TInt EncodeUpdateCode();
-    TInt EncodeRemoveCode();
-    TInt EncodeChunkName(DThread& t);
-    TInt EncodeChunkName(DChunk& c);
-    TInt EncodeChunkName(DLibrary& l);
-    TInt EncodeChunkData(DThread& t);
-    TInt EncodeChunkData(DChunk& c);
-    TInt EncodeChunkData(DLibrary& l, DThread& t);
-private:
-    /** Lock serialising calls to event handler */
-    DMutex* iLock;
-    TBool iTracking;
-
-    DProfilerSampleBuffer*  iSampleBuffer;
-    TInt iCounters[EEventLimit];
-    
-    TUint32     iCount;
-    
-    TUint8      iSample[KEventBufferSize];
-    TPtr8       iSampleDescriptor;
-    
-    TUint32     iPreviousCount;
-    };
-
-#endif
--- a/piprofiler/plugins/GeneralsPlugin/inc/PriSamplerImpl.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,245 +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 PROFILER_PRI_SAMPLER_H
-#define PROFILER_PRI_SAMPLER_H
-
-#include "GeneralsConfig.h"
-
-#include <kern_priv.h>
-
-#include <piprofiler/ProfilerGenericClassesKrn.h>
-#include <piprofiler/ProfilerTraces.h>
-#include "GppSamplerImpl.h"
-
-// defines the maximum thread amount that is assumed to
-// be possible with PRI trace
-const TInt KProfilerMaxThreadAmount = 512;
-
-/*
- *	
- *	PRI sampler definition
- *	
- */
-
-class DPriSamplerImpl //: public DBase
-{
-public:
-	enum EProcessingState
-	{
-		EStartingToProcess,
-		EProcessingNames,
-		EProcessingData,
-		ENothingToProcess
-	};
-
-	DPriSamplerImpl();
-	~DPriSamplerImpl();
-
-	TInt	CreateFirstSample();
-	TInt	SampleImpl();
-	TBool	SampleNeeded();
-	void	Reset();
-	TInt	ProcessChunks();
-
-	TInt	EncodeChunkData(DThread& thread);
-	TInt	EncodeChunkName(DThread& thread);
-	
-	TInt	EncodeNameCode();
-	TInt	EncodeDataCode();
-
-	TInt		iCountti;
-	DThread*	threadsToSample[KProfilerMaxThreadAmount];
-	DThread*	threadNamesToReport[KProfilerMaxThreadAmount];
-
-	TInt		iThreadCount;
-	TInt		iNewThreadCount;
-
-	TInt		iProcessing;
-	TInt		iPriSamplingPeriod;
-
-	TUint8		sample[257];
-	TPtr8		sampleDescriptor;
-#ifdef __SMP__
-    TInt        iCpuNumber;
-    TUint32     iStartTime;
-#endif   
-
-};
-
-template <int BufferSize>
-class DProfilerPriSampler : public DProfilerGenericSampler<BufferSize>
-{
-public:
-	DProfilerPriSampler(struct TProfilerGppSamplerData*, TInt id);
-	~DProfilerPriSampler();
-
-	void	Sample();
-	TInt	Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset);
-	TInt	PostSample();
-	TBool	PostSampleNeeded();
-
-private:
-	DPriSamplerImpl				 	priSamplerImpl;
-	struct TProfilerGppSamplerData* 	    gppSamplerData;
-	TBool						 	sampleNeeded;
-	TBool							sampleInProgress;
-#ifdef __SMP__
-    TInt   iCpuNumber;
-#endif
-};
-
-/*
- *	
- *	PRI sampler implementation
- *	
- */
-//#ifndef __SMP__
-template <int BufferSize>
-DProfilerPriSampler<BufferSize>::DProfilerPriSampler(struct TProfilerGppSamplerData* gppSamplerDataIn, TInt id) :
-	DProfilerGenericSampler<BufferSize>(PROFILER_PRI_SAMPLER_ID)
-    {
-	LOGSTRING2("CProfilerPriSampler<%d>::CProfilerPriSampler",BufferSize);
-	this->gppSamplerData = gppSamplerDataIn;
-	this->sampleInProgress = false;
-	this->iSamplingPeriod = 3000;	// set default setting
-    }
-//#else
-//template <int BufferSize>
-//DProfilerPriSampler<BufferSize>::DProfilerPriSampler(struct TProfilerGppSamplerData* gppSamplerDataIn, TInt id, TInt aCpuNumber) :
-//    DProfilerGenericSampler<BufferSize>(PROFILER_PRI_SAMPLER_ID+(aCpuNumber*20)), iCpuNumber(aCpuNumber) 
-//    {
-//    LOGSTRING2("CProfilerGppSampler<%d>::CProfilerGppSampler",BufferSize);
-//    }
-//#endif
-
-template <int BufferSize>
-TInt DProfilerPriSampler<BufferSize>::Reset(DProfilerSampleStream* aStream, TUint32 aSyncOffset)
-    {
-	LOGSTRING2("CProfilerPriSampler<%d>::Reset - calling superclass reset",BufferSize);
-	DProfilerGenericSampler<BufferSize>::Reset(aStream);
-	LOGSTRING2("CProfilerPriSampler<%d>::Reset - called superclass reset",BufferSize);
-	priSamplerImpl.Reset();
-
-#ifdef __SMP__
-//    this->priSamplerImpl.iCpuNumber = this->iCpuNumber;
-//    
-//    // set common start time for all CPU samplers
-//    this->priSamplerImpl.iStartTime = aSyncOffset;
-#endif
-	this->priSamplerImpl.iPriSamplingPeriod = this->iSamplingPeriod;
-
-
-	LOGSTRING3("CProfilerPriSampler<%d>::Reset - set pri sampling period to", 
-							BufferSize,this->priSamplerImpl.iPriSamplingPeriod);
-
-	TInt length(priSamplerImpl.CreateFirstSample());
-	this->iSampleBuffer->AddSample(priSamplerImpl.sample,length);
-
-	this->sampleInProgress = false;	
-	this->sampleNeeded = false;
-
-	return KErrNone;
-    }
-
-template <int BufferSize> 
-TInt DProfilerPriSampler<BufferSize>::PostSample()
-    {
-	if(sampleNeeded)
-	    {
-		this->sampleNeeded = false;
-
-		LOGSTRING3("CProfilerPriSampler<%d>::PostSample - state %d",BufferSize,this->sampleBuffer->GetBufferStatus());
-		
-		//TInt interruptLevel = NKern::DisableInterrupts(0);
-		
-		TInt length(this->priSamplerImpl.SampleImpl());
-		if(length != 0)
-		    {
-			LOGSTRING("PRI sampler PostSample - starting to sample");
-
-			// then, encode the sample to the buffer
-			while(length > 0)
-			    {
-			    this->iSampleBuffer->AddSample(priSamplerImpl.sample,length);
-				length = this->priSamplerImpl.SampleImpl();
-				// indicate that the whole PRI sample ends by having a 0x00 in the end
-				if(length == 0)
-				    {
-					TUint8 number(0);
-					LOGSTRING("PRI sampler PostSample - all samples generated!");
-					
-					this->iSampleBuffer->AddSample(&number,1);
-					LOGSTRING("PRI sampler PostSample - end mark added");
-                    }
-			    }
-			LOGSTRING("PRI sampler PostSample - finished sampling");
-		    }
-		this->sampleInProgress = false;
-		
-		//NKern::RestoreInterrupts(interruptLevel);
-	    }
-	
-	// finally perform superclass postsample
-	TInt i(this->DProfilerGenericSampler<BufferSize>::PostSample());
-	return i; 
-    }
-
-template <int BufferSize> 
-TBool DProfilerPriSampler<BufferSize>::PostSampleNeeded()
-    {
-	LOGSTRING3("CProfilerPriSampler<%d>::PostSampleNeeded - state %d",BufferSize,this->sampleBuffer->GetBufferStatus());
-
-	TUint32 status = this->iSampleBuffer->iBufferStatus;
-
-	if(status == DProfilerSampleBuffer::BufferCopyAsap || status == DProfilerSampleBuffer::BufferFull || this->sampleNeeded == true)
-	    {
-		return true;
-	    }
-	
-	return false;
-    }
-
-
-template <int BufferSize>
-void DProfilerPriSampler<BufferSize>::Sample()
-    {
-	LOGSTRING2("CProfilerPriSampler<%d>::Sample",BufferSize);	
-	
-	if(priSamplerImpl.SampleNeeded() && this->sampleInProgress == false) 
-	    {
-		this->sampleInProgress = true;
-		this->sampleNeeded = true;
-		// start the PRI sample with the sample time
-		TUint8 number(4);
-		this->iSampleBuffer->AddSample(&number,1);
-		this->iSampleBuffer->AddSample((TUint8*)&(gppSamplerData->sampleNumber),4);
-
-		// leave the rest of the processing for PostSample()
-	    }	
-
-	LOGSTRING2("CProfilerPriSampler<%d>::Sample",BufferSize);
-	return;
-    }
-
-template <int BufferSize>
-DProfilerPriSampler<BufferSize>::~DProfilerPriSampler()
-    {
-	LOGSTRING2("CProfilerPriSampler<%d>::~CProfilerPriSampler",BufferSize);		
-    }
-#endif
--- a/piprofiler/plugins/GeneralsPlugin/src/GeneralsDriver.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1152 +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:  
-*
-*/
-
-
-//
-// LDD for thread time profiling
-//
-
-#include <kern_priv.h>
-#include <platform.h>
-#include <arm.h>
-
-#ifdef __SMP__
-#include <assp/naviengine/naviengine.h> 
-#include <nkernsmp/arm/arm_gic.h>
-#include <nkernsmp/arm/arm_tmr.h>
-#endif
-
-#include "GeneralsDriver.h"
-#include <piprofiler/PluginDriver.h>
-#include <piprofiler/PluginSampler.h>
-#include <piprofiler/ProfilerTraces.h>
-
-#include "GppSamplerImpl.h"
-#include "GfcSamplerImpl.h"
-#include "IttSamplerImpl.h"
-#include "MemSamplerImpl.h"
-#include "PriSamplerImpl.h"
-
-
-#ifndef __SMP__
-extern TUint* IntStackPtr();
-extern void UsrModLr(TUint32*);
-#endif
-// for security check
-#define KProfilerExeSecurUid 0x2001E5AD
-static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
-static _LIT_SECURITY_POLICY_FAIL( KDenyAllPolicy );
-
-#define SEPARATE_DFC_QUEUE
-// CONSTANTS
-
-//_LIT(DProfilerThread,"DProfilerThread");
-//const TInt KDProfilerThreadPriority = 27;
-
-#ifdef SEPARATE_DFC_QUEUE
-const TInt KGeneralsDriverThreadPriority = 24;
-_LIT(KGeneralsDriverThread, "PIGeneralsDriver");
-
-#endif
-
-// global Dfc Que
-//TDynamicDfcQue* gDfcQ;
-
-//#ifdef __SMP__
-//
-//enum  TNaviEngineAsspInterruptIdExtension
-//{
-//    KIntProfilerBase = 99      //  Sampling profiler interrupt base. 
-//    //  Each CPU is assigned a sampling interrupt from this base
-//    //  CPU-0's sampling interrupt is KIntIdSamplingBase + 0
-//    //  CPU-n's sampling interrupt is KIntIdSamplingBase + n
-//};
-//#endif
-
-/*
- *
- *
- *	Class DGfcProfilerFactory definition
- *
- *
- */
-
-class DGeneralsProfilerFactory : public DLogicalDevice
-{
-	public:
-		DGeneralsProfilerFactory();
-		~DGeneralsProfilerFactory();
-
-	public:
-		virtual TInt Install();
-		virtual void GetCaps(TDes8& aDes) const;
-		virtual TInt Create(DLogicalChannelBase*& aChannel);
-};
-
-/*
- *
- *
- *	Class DGfcDriver definition
- *
- *
- */
-class DPluginDriver;
-
-class DGeneralsDriver : public DPluginDriver
-{
-
-public:
-	DGeneralsDriver();
-	~DGeneralsDriver();
-
-private:
-	TInt					NewStart(TInt aRate);
-	static void				NewDoProfilerProfile(TAny*);
-	static void				NewDoDfc(TAny*);
-	
-	// called by each core
-	static void				Sample(TAny*);
-
-	TInt					GetSampleTime(TUint32* time);
-	//TInt					Test(TUint32 testCase); 
-
-	TInt					StartSampling();
-	TInt                    StopSampling();
-
-	void					InitialiseSamplerList(); 
-
-	DProfilerSamplerBase*	GetSamplerForId(TInt samplerId);
-	TInt					GetSamplerVersion(TDes* aDes);
-	
-#ifdef __SMP__
-	void                    UnbindInterrupts();
-#endif
-	TInt					ProcessStreamReadRequest(TBapBuf* aBuf,TRequestStatus* aStatus);
-
-	TInt					MarkTraceActive(TInt samplerIdToActivate);
-	TInt					MarkTraceInactive(TInt samplerIdToDisable);
-	TInt					OutputSettingsForTrace(TInt samplerId,TInt settings);
-	TInt					AdditionalTraceSettings(TInt samplerId,TInt settings);
-	TInt					AdditionalTraceSettings2(TInt samplerId,TInt settings);
-	TInt					SetSamplingPeriod(TInt /*samplerId*/,TInt settings);
-private:
-	// create the driver in EKA-2 version
-	TInt			        DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
-
-	// receive commands and control in EKA-2 version
-	void					HandleMsg(TMessageBase* aMsg);
-private:
-	// timer mechanism in EKA-2 version
-	NTimer						iTimer;
-	TDfc						iNewDfc;
-	TInt						iCount;
-	TInt						iLastPcVal;					
-	TInt						iPeriod;
-	
-	// sync sample number property for synchronizing other samplers
-	RPropertyRef 				iSampleStartTimeProp;
-	TInt						iSampleStartTime;
-	
-	DProfilerGppSampler<10000> 	gppSampler;
-#ifdef __SMP__
-	DProfilerGppSampler<10000>  gppSampler2;
-    DProfilerGppSampler<10000>  gppSampler3;
-    DProfilerGppSampler<10000>  gppSampler4;
-#endif
-	DProfilerGfcSampler<10000> 	gfcSampler;
-	DProfilerIttSampler<10000> 	ittSampler;
-	DProfilerMemSampler<40000> 	memSampler;
-	DProfilerPriSampler<10000> 	priSampler;
-#ifdef __SMP__
-//    DProfilerPriSampler<10000>  priSampler2;
-//    DProfilerPriSampler<10000>  priSampler3;
-//    DProfilerPriSampler<10000>  priSampler4;
-#endif
-	
-#ifndef __SMP__
-	static const TInt			KSamplerAmount = 5;
-#else
-    static const TInt           KSamplerAmount = 8;
-#endif
-	DProfilerSamplerBase*		iSamplers[KSamplerAmount];
-    TInt                        iMaxCpus;
-    TUint32                     iStartTime; 
-	
-#ifdef SEPARATE_DFC_QUEUE
-	TDynamicDfcQue*             iDfcQ;
-#endif
-};
-
-/*
- *
- *
- *	Class DGeneralsProfilerFactory implementation
- *
- *
- */
-
-DECLARE_STANDARD_LDD()
-    {
-	return new DGeneralsProfilerFactory();
-    }
-
-TInt DGeneralsProfilerFactory::Create(DLogicalChannelBase*& aChannel)
-    {
-	aChannel = new DGeneralsDriver;
-	return aChannel?KErrNone:KErrNoMemory;
-    }
-
-
-DGeneralsProfilerFactory::DGeneralsProfilerFactory()
-    {
-	// major, minor, and build version number
-    iVersion=TVersion(1,0,1);
-    }
-
-DGeneralsProfilerFactory::~DGeneralsProfilerFactory()
-    {
-//    if (gDfcQ)
-//        {
-//        gDfcQ->Destroy();
-//        }
-    }
-
-TInt DGeneralsProfilerFactory::Install()
-    {
-    return(SetName(&KPluginSamplerName));
-    }
-
-void DGeneralsProfilerFactory::GetCaps(TDes8& aDes) const
-    {
-    TCapsSamplerV01 b;
-    
-    b.iVersion=TVersion(1,0,1);
-    
-    aDes.FillZ(aDes.MaxLength());
-    aDes.Copy((TUint8*)&b,Min(aDes.MaxLength(),sizeof(b)));
-    }
-
-/*
- *
- *
- *	Class DGeneralsDriver implementation
- *
- *
- */
- 
-DGeneralsDriver::DGeneralsDriver() :
-	iTimer(NewDoProfilerProfile,this),
-	iNewDfc(NewDoDfc,this,NULL,7),
-#ifdef __SMP__
-	gppSampler(0),
-	gppSampler2(1),
-    gppSampler3(2),
-    gppSampler4(3),
-#endif
-	gfcSampler(gppSampler.GetExportData()),
-	ittSampler(gppSampler.GetExportData()),
-	memSampler(gppSampler.GetExportData(), PROFILER_MEM_SAMPLER_ID),
-	priSampler(gppSampler.GetExportData(), PROFILER_PRI_SAMPLER_ID)
-#ifdef __SMP__
-//    ,priSampler2(gppSampler.GetExportData(), PROFILER_PRI_SAMPLER_ID),
-//    priSampler3(gppSampler.GetExportData(), PROFILER_PRI_SAMPLER_ID),
-//    priSampler4(gppSampler.GetExportData(), PROFILER_PRI_SAMPLER_ID)
-#endif
-    {
-	LOGSTRING("DGeneralsDriver::DGeneralsDriver()");
-
-	iState = EStopped;
-	iEndRequestStatus = 0;
-	doingDfc = 0;
-	sampleRunning = 0;
-	iSyncOffset = 0;
-	iStartTime = 0;
-	InitialiseSamplerList();
-    }
-
-/*
- *
- *	This method has to be changed for each new sampler
- *
- */ 
-void DGeneralsDriver::InitialiseSamplerList()
-	{
-	// initialize all samplers to zero
-	for(TInt i(0);i<KSamplerAmount;i++)
-		{
-		iSamplers[i] = 0;
-		}
-
-	TInt i(0);
-	iSamplers[i] = &gppSampler;i++;
-#ifdef __SMP__
-	iSamplers[i] = &gppSampler2;i++;
-    iSamplers[i] = &gppSampler3;i++;
-    iSamplers[i] = &gppSampler4;i++;
-#endif
-	iSamplers[i] = &gfcSampler;i++;
-	iSamplers[i] = &ittSampler;i++;
-	iSamplers[i] = &memSampler;i++;
-	iSamplers[i] = &priSampler;i++;
-	
-#ifdef __SMP__
-    // get the number of cpus
-    iMaxCpus = NKern::NumberOfCpus();
-#else
-    iMaxCpus = 0;
-#endif
-    
-	// initialize synchronizing property
-	LOGSTRING("DGeneralsDriver::InitialiseSamplerList() - initializing property");
-	TInt r(iSampleStartTimeProp.Attach(KGppPropertyCat, EGppPropertySyncSampleNumber));
-    if (r!=KErrNone)
-        {
-        LOGSTRING2("DGeneralsDriver::InitialiseSamplerList() - error in attaching counter property, error %d", r);
-        }
-    LOGSTRING("DGeneralsDriver::InitialiseSamplerList() - defining properties");
-    r = iSampleStartTimeProp.Define(RProperty::EInt, KAllowAllPolicy, KDenyAllPolicy, 0, NULL);
-    if (r!=KErrNone)
-        {
-        LOGSTRING2("DGeneralsDriver::InitialiseSamplerList() - error in defining counter property, error %d", r);
-        }	
-	}
-
-
-DProfilerSamplerBase* DGeneralsDriver::GetSamplerForId(TInt samplerIdToGet)
-    {
-	for(TInt i(0);i<KSamplerAmount;i++)
-	    {
-		if(iSamplers[i]->iSamplerId == samplerIdToGet)
-		    {
-			return iSamplers[i];
-		    }
-	    }
-	return (DProfilerSamplerBase*)0;
-    }
-
-TInt DGeneralsDriver::DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer)
-    {
-    TUint8 err(KErrNone);
-    
-    if (!Kern::QueryVersionSupported(TVersion(1,0,1),aVer))
-	   	return KErrNotSupported;
-    
-    // just for testing 
-#ifndef __SMP__
-    LOGTEXT("Initializing the stack pointer");
-    stackTop=(TUint32*)IntStackPtr();
-    LOGSTRING2("Got stack pointer 0x%x",(TUint32)stackTop);
-#endif
-
-    iClient = &Kern::CurrentThread();
-    err = iClient->Open();
-	
-    DProcess* clientProcess(iClient->iOwningProcess);
-    if (clientProcess)
-        {
-        //Require Power Management and All Files to use this driver
-        // Not ideal, but better than nothing
-        if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by GeneralsDriver.ldd")))
-            return KErrPermissionDenied;
-        if(!Kern::CurrentThreadHasCapability(ECapabilityAllFiles,__PLATSEC_DIAGNOSTIC_STRING("Checked by GeneralsDriver.ldd")))
-            return KErrPermissionDenied;  
-        
-        SSecurityInfo secureInfo = clientProcess->iS;
-        if (secureInfo.iSecureId != KProfilerExeSecurUid)
-            {
-            return KErrPermissionDenied;
-            }
-        }
-    
-    // initiate sample stream ready for collecting the trace data
-	iSampleStream.InsertCurrentClient(iClient);
-	
-	iTimer.Cancel();
-	iNewDfc.Cancel();
-
-	Kern::SetThreadPriority(24);
-
-#ifdef SEPARATE_DFC_QUEUE
-	err = Kern::DynamicDfcQCreate(iDfcQ, KGeneralsDriverThreadPriority, TBuf8<32>( KGeneralsDriverThread ));
-	if (KErrNone == err)
-        {
-        SetDfcQ(iDfcQ);
-        iNewDfc.SetDfcQ(iDfcQ);
-        iMsgQ.Receive();
-        return err;
-        }
-#else
-	SetDfcQ(Kern::DfcQue0());
-	iNewDfc.SetDfcQ(iDfcQ);
-	iMsgQ.Receive();
-#endif
-	return err;
-    }
-
-DGeneralsDriver::~DGeneralsDriver()
-    {
-	if (iState!=EStopped)
-	    iTimer.Cancel();
-	iNewDfc.Cancel();
-	
-#ifdef SEPARATE_DFC_QUEUE
-	if(iDfcQ)
-	    iDfcQ->Destroy();
-#endif
-	
-	iSampleStartTimeProp.Close();
-	Kern::SafeClose((DObject*&)iClient,NULL);
-    }
-
-
-TInt DGeneralsDriver::GetSampleTime(TUint32* time)
-    {
-	LOGSTRING("DGeneralsDriver::GetSampleTime - entry");
-
-	Kern::ThreadRawWrite(	iClient,(TAny*)time, 
-							(TAny*)&gppSampler.GetExportData()->sampleNumber, 
-							4, iClient);
-
-	LOGSTRING("DGeneralsDriver::GetSampleTime - exit");
-
-	return KErrNone;
-    }
-
-
-TInt DGeneralsDriver::GetSamplerVersion(TDes* aDes)
-    {
-	LOGSTRING2("DGeneralsDriver::GetSamplerVersion - 0x%x",aDes);
-	
-	TBuf8<16> aBuf;
-	aBuf.Append(PROFILER_SAMPLER_VERSION);
-	Kern::ThreadDesWrite(iClient,aDes,aBuf,0,KChunkShiftBy0,iClient);
-	LOGSTRING("DGeneralsDriver::GetSamplerVersion - written client descriptor");
-	return KErrNone;
-    }
-
-TInt DGeneralsDriver::NewStart(TInt aDelay)
-    {	
-	LOGSTRING("DGeneralsDriver::NewStart");
-	iEndRequestStatus = 0;
-	
-	aDelay = Min(KMaxDelay, Max(KMinDelay, aDelay));
-
-	// always use this rate
-	iPeriod = aDelay;
-	
-#ifdef __SMP__
-    /*
-     * Bind and enable the sampling interupts associated with each core. 
-     */
-    TInt err(0);
-    
-    TUint32 flags = NKern::EIrqBind_Count;
-
-//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase - 32=%d", KIntProfilerBase -32 );
-    err = NKern::InterruptBind( KIntProfilerBase - 32 , DGeneralsDriver::Sample, this, flags, 0);
-    if(err < 0)
-        Kern::Printf(" InterruptBind KIntProfilerBase - 32 ret = %d", err );
-    
-//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 1 - 32=%d", KIntProfilerBase + 1-32 );
-    err = NKern::InterruptBind( KIntProfilerBase + 1 - 32 , DGeneralsDriver::Sample, this, flags, 0);
-    if(err < 0)
-        Kern::Printf(" InterruptBind KIntProfilerBase + 1 - 32 ret = %d", err );
-
-//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 2 - 32=%d", KIntProfilerBase + 2 - 32 );
-    err = NKern::InterruptBind(KIntProfilerBase + 2 - 32 , DGeneralsDriver::Sample, this, flags, 0);
-    if(err < 0)
-        Kern::Printf(" InterruptBind KIntProfilerBase + 2 - 32 ret = %d", err );
-
-//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 3 - 32=%d", KIntProfilerBase + 3 - 32 );
-    err = NKern::InterruptBind(KIntProfilerBase + 3 - 32 , DGeneralsDriver::Sample, this, flags, 0);
-    if(err < 0)
-        Kern::Printf(" InterruptBind KIntProfilerBase + 3 - 32 ret = %d", err );
-
-
-    err = NKern::InterruptEnable(KIntProfilerBase - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptEnable KIntProfilerBase - 32 ret = %d", err );
-    
-    err = NKern::InterruptEnable(KIntProfilerBase + 1 - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptEnable KIntProfilerBase + 1 - 32 ret = %d", err );
-
-    err = NKern::InterruptEnable(KIntProfilerBase + 2 - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptEnable KIntProfilerBase + 2 - 32 ret = %d", err );
-
-    err = NKern::InterruptEnable(KIntProfilerBase + 3 - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptEnable KIntProfilerBase + 3 - 32 ret = %d", err );
-        
-#endif
-	
-	iTimer.OneShot(aDelay);
-	
-	iState = ERunning;
-
-	return KErrNone;
-    }
-
-/*
- *	This function is run in each interrupt
- */
-// EKA-2 implementation of the sampler method
-
-void DGeneralsDriver::NewDoProfilerProfile(TAny* aPtr)
-    {
-    LOGSTRING("DGeneralsDriver::NewDoProfilerProfile - entry");
-    
-#ifdef __SMP__      
-    TInt currCpu(NKern::CurrentCpu());
-#endif
-    TInt8 postSampleNeeded(0);
-    DGeneralsDriver& d=*(DGeneralsDriver*)aPtr;
-
-	if (d.iState == ERunning && d.sampleRunning == 0)
-	    {
-        // start timer again
-		d.iTimer.Again(d.iPeriod);
-		d.sampleRunning++;
-        
-#ifdef __SMP__      
-        // print out the sample tick
-        if(d.gppSampler.GetExportData()->sampleNumber% 1000 == 0) 
-            {
-            Kern::Printf(("PIPROF SAMPLE TICK, #%d"), d.gppSampler.GetExportData()->sampleNumber);
-            }
-        // call the actual CPU sampling function for CPU 0 (in NaviEngine), later may be on any of the CPUs
-        Sample(aPtr);
-        
-        // post-sampling for NTimer interrupted CPU
-        postSampleNeeded += d.iSamplers[currCpu]->PostSampleNeeded();
-        
-        /* 
-        This is the master sampler from the watchdog timer, so 
-        send interrupts to the other CPUs
-        */
-        TScheduler *theSched = TScheduler::Ptr();
-        GicDistributor* gicDist = (GicDistributor* )theSched->i_GicDistAddr;
-            
-        for( TInt nCpu(0); nCpu < d.iMaxCpus; nCpu++ )
-            {
-            if( nCpu != currCpu )
-                {
-                gicDist->iSoftIrq = ( 0x10000 << nCpu ) | (KIntProfilerBase + nCpu);
-                }
-            // post-sampling for CPUs with specifically generated interrupts
-            postSampleNeeded += d.iSamplers[nCpu]->PostSampleNeeded();
-            }
-        arm_dsb();
-#endif  
-        // then sample the rest of non-cpu samplers
-        for(TInt i(d.iMaxCpus);i<KSamplerAmount;i++)
-            {
-            if(d.iSamplers[i]->iEnabled)
-                {
-                d.iSamplers[i]->Sample();
-                postSampleNeeded += d.iSamplers[i]->PostSampleNeeded();
-                }
-            }
-			
-		if(postSampleNeeded > 0 && d.doingDfc == 0)
-		    {
-			d.doingDfc++;
-			d.iNewDfc.Add();
-
-			d.sampleRunning--;
-			return;
-            }
-		d.sampleRunning--;
-        }
-	else if (d.iState == EStopping && d.sampleRunning == 0)
-	    {
-		// add a dfc for this final time
-		d.iNewDfc.Add();
-        Kern::Printf("DGeneralsDriver::Sample - sampling added to dfc queue");
-        }
-	else
-	    {
-		// the previous sample has not finished,
-		Kern::Printf("DGeneralsDriver::NewDoProfilerProfile - Profiler Sampler Error - interrupted before finished sampling!!");
-        }
-        LOGSTRING("DGeneralsDriver::NewDoProfilerProfile - exit");
-    }
-
-
-
-void DGeneralsDriver::Sample(TAny* aPtr)
-    {
-    LOGSTRING("DGeneralsDriver::Sample - entry");
-
-#ifdef __SMP__
-    DGeneralsDriver& d=*(DGeneralsDriver*)aPtr;
-
-//    TInt currCpu(NKern::CurrentCpu());
-
-    // sample the current cpu load
-//    if(d.iSamplers[currCpu]->iEnabled)
-//        {
-        d.iSamplers[NKern::CurrentCpu()]->Sample();
-//        postSampleNeeded += d.iSamplers[currCpu]->PostSampleNeeded();
-//        }
-#endif
-    LOGSTRING("DGeneralsDriver::Sample - exit");
-    }
-/*
- *	This function is run when any of the samplers
- *	requires post sampling
- */
-void DGeneralsDriver::NewDoDfc(TAny* pointer)
-    {
-	DGeneralsDriver& d(*((DGeneralsDriver*)pointer));
-	
-	if(d.iState == ERunning)
-	    {
-		// for all enabled samplers, perform
-		// post sample if needed
-		for(TInt i(0);i<KSamplerAmount;i++)
-		    {
-			if(d.iSamplers[i]->iEnabled)
-			    {
-				if(d.iSamplers[i]->PostSampleNeeded())
-				    {
-					d.iSamplers[i]->PostSample();
-                    }
-                }
-            }
-		d.doingDfc--;
-        }
-
-	else if(d.iState == EStopping)
-	    {
-		// for all enabled samplers,
-		// perform end sampling
-		TBool releaseBuffer(false);
-		for(TInt i(0);i<KSamplerAmount;i++)
-		    {
-			if(d.iSamplers[i]->iEnabled)
-			    {
-				LOGSTRING("DGeneralsDriver::NewDoDfc() - ending");
-				// perform end sampling for all samplers
-				// stream mode samplers may be pending, if they
-				// are still waiting for another client buffer
-				if(d.iSamplers[i]->EndSampling() == KErrNotReady) 
-				    {
-					LOGSTRING("DGeneralsDriver::NewDoDfc() - stream data pending");
-					releaseBuffer = true;
-                    }
-				else 
-				    {
-					LOGSTRING("DGeneralsDriver::NewDoDfc() - no data pending");
-					releaseBuffer = true;
-                    }		
-                }
-            }
-
-		// At the end, once all the samplers are gone through, the buffer should be released
-		if (true == releaseBuffer) 
-		    {
-			LOGSTRING("DGeneralsDriver::NewDoDfc() - release the buffer");
-			d.iSampleStream.ReleaseIfPending();	
-            }
-		
-		d.iState = EStopped;
-		if(d.iEndRequestStatus != 0 && d.iClient != 0)
-		    {
-			// sampling has ended
-			Kern::RequestComplete(d.iClient,d.iEndRequestStatus,KErrNone);
-            }
-        }
-    }
-
-
-/*
- *	All controls are handled here
- */
- 
-void DGeneralsDriver::HandleMsg(TMessageBase* aMsg)
-    {
-	TInt r(KErrNone);
-	TThreadMessage& m(*(TThreadMessage*)aMsg);
-
-	LOGSTRING5("DGeneralsDriver::HandleMsg 0x%x 0x%x 0x%x 0x%x",m.Int0(),m.Int1(),m.Int2(),m.Int3());
-	
-	if(m.iValue == (TInt)ECloseMsg)
-	    {
-		LOGSTRING("DGeneralsDriver::HandleMsg - received close message");
-		iTimer.Cancel();
-		iNewDfc.Cancel();
-
-		m.Complete(KErrNone,EFalse);
-		iMsgQ.CompleteAll(KErrServerTerminated);
-		LOGSTRING("DGeneralsDriver::HandleMsg - cleaned up the driver!");
-		return;
-        }
-
-	if (m.Client()!=iClient)
-	    {
-		LOGSTRING("DGeneralsDriver::HandleMsg - ERROR, wrong client");
-		m.PanicClient(_L("GENERALSSAMPLER"),EAccessDenied);
-		return;
-        }
-
-	TInt id(m.iValue);
-	switch(id)
-	    {
-		 //Controls are handled here
-		case RPluginSampler::EMarkTraceActive:
-			LOGSTRING("DGeneralsDriver::HandleMsg - EMarkTraceActive");
-			r = MarkTraceActive((TInt)m.Int0());
-			break;
-
-		case RPluginSampler::EOutputSettingsForTrace:
-			LOGSTRING("DGeneralsDriver::HandleMsg - EOutputSettingsForTrace");
-			r = OutputSettingsForTrace((TInt)m.Int0(),(TInt)m.Int1());
-			break;
-
-		case RPluginSampler::EAdditionalTraceSettings:
-			LOGSTRING("DGeneralsDriver::HandleMsg - EAdditionalTraceSettings");
-			r = AdditionalTraceSettings((TInt)m.Int0(),(TInt)m.Int1());
-			break;
-
-		case RPluginSampler::EAdditionalTraceSettings2:
-			LOGSTRING("DGeneralsDriver::HandleMsg - EAdditionalTraceSettings2");
-			r = AdditionalTraceSettings2((TInt)m.Int0(),(TInt)m.Int1());
-			break;
-			
-		case RPluginSampler::ESetSamplingPeriod:
-		    LOGSTRING2("DGeneralsDriver::HandleMsg - ESetSamplingPeriod %d", (TInt)m.Int1());
-			r = SetSamplingPeriod((TInt)m.Int0(),(TInt)m.Int1());
-			break;
-			
-		case RPluginSampler::EMarkTraceInactive:
-			LOGSTRING("DGeneralsDriver::HandleMsg - EMarkTraceInactive");
-			r = MarkTraceInactive((TInt)m.Int0());
-			break;
-
-		case RPluginSampler::ESample:
-			LOGSTRING("DGeneralsDriver::HandleMsg - ESample");
-			//r = Sample();  // hack. Original implementation of sample just returned 0
-			r = 0;
-			break;
-
-		case RPluginSampler::EStartSampling:
-			LOGSTRING("DGeneralsDriver::HandleMsg - EStartSampling");
-			r = StartSampling();
-			break;
-
-		case RPluginSampler::EGetSampleTime:
-			LOGSTRING("DGeneralsDriver::HandleMsg - EGetSampleTime");
-			r = GetSampleTime(reinterpret_cast<TUint32*>(m.Ptr0()));
-			break;
-
-		case RPluginSampler::EGetSamplerVersion:
-			LOGSTRING("DGeneralsDriver::HandleMsg - EGetSamplerVersion");
-			r = GetSamplerVersion(reinterpret_cast<TDes*>(m.Ptr0()));
-			break;
-		
-		case RPluginSampler::ECancelStreamRead:
-			LOGSTRING("DGeneralsDriver::HandleMsg - ECancelStreamRead");
-			iStreamReadCancelStatus = reinterpret_cast<TRequestStatus*>(m.Ptr0());
-			r = ProcessStreamReadCancel();
-			break;
-
-
-		 //	Requests are handled here
-
-		case ~RPluginSampler::EStopAndWaitForEnd:
-			LOGSTRING("DGeneralsDriver::HandleMsg - EStopAndWaitForEnd");
-			iEndRequestStatus = reinterpret_cast<TRequestStatus*>(m.Ptr0());
-			r = StopSampling();
-#ifdef __SMP__
-			UnbindInterrupts();
-#endif
-			break;
-
-		case ~RPluginSampler::ERequestFillThisStreamBuffer:
-			LOGSTRING("DGeneralsDriver::HandleMsg - ERequestFillThisStreamBuffer");			
-			r = ProcessStreamReadRequest(	reinterpret_cast<TBapBuf*>(m.Ptr1()),
-											reinterpret_cast<TRequestStatus*>(m.Ptr0()));
-			break;
-
-		default:
-			LOGSTRING2("DGeneralsDriver::HandleMsg - ERROR, unknown command %d",id);
-			r = KErrNotSupported;
-			break;
-        }
-
-	LOGSTRING("DGeneralsDriver::HandleMsg - Completed");
-	m.Complete(r,ETrue);
-    }
-
-#ifdef __SMP__
-inline void DGeneralsDriver::UnbindInterrupts()
-    {
-    TInt err(0);
-
-    // disable interrupts when sampling stops, enabled again on start
-    err = NKern::InterruptDisable(KIntProfilerBase - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptDisable KIntProfilerBase - 32 ret = %d", err );
-    
-    err = NKern::InterruptDisable(KIntProfilerBase + 1 - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptDisable KIntProfilerBase + 1 - 32 ret = %d", err );
-
-    err = NKern::InterruptDisable(KIntProfilerBase + 2 - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptDisable KIntProfilerBase + 2 - 32 ret = %d", err );
-
-    err = NKern::InterruptDisable(KIntProfilerBase + 3 - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptDisable KIntProfilerBase + 3 - 32 ret = %d", err );
-    
-//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase - 32=%d", KIntProfilerBase -32 );
-    err = NKern::InterruptUnbind( KIntProfilerBase - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptUnbind KIntProfilerBase - 32 ret = %d", err );
-    
-//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 1 - 32=%d", KIntProfilerBase + 1-32 );
-    err = NKern::InterruptUnbind( KIntProfilerBase + 1 - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptUnbind KIntProfilerBase + 1 - 32 ret = %d", err );
-
-//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 2 - 32=%d", KIntProfilerBase + 2 - 32 );
-    err = NKern::InterruptUnbind(KIntProfilerBase + 2 - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptUnbind KIntProfilerBase + 2 - 32 ret = %d", err );
-
-//    Kern::Printf(" > Interrupt::InterruptBind KIntProfilerBase + 3 - 32=%d", KIntProfilerBase + 3 - 32 );
-    err = NKern::InterruptUnbind(KIntProfilerBase + 3 - 32);
-    if(err < 0)
-        Kern::Printf(" InterruptUnbind KIntProfilerBase + 3 - 32 ret = %d", err );
-
-    }
-#endif
-
-inline TInt DGeneralsDriver::ProcessStreamReadRequest(TBapBuf* aBuf,TRequestStatus* aStatus)
-	{
-	LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest - entry");
-	
-	// a new sample buffer has been received from the client
-	iSampleStream.AddSampleBuffer(aBuf,aStatus);
-	
-	// check if we are waiting for the last data to be written to the client
-	if(iState == EStopped)
-	    {
-		LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest state = EStopped");
-	
-		// sampling has stopped and stream read cancel is pending
-		// try to perform the end sampling procedure again
-		TBool releaseBuffer(false);
-		for(TInt i(0);i<KSamplerAmount;i++)
-		    {
-			// only for all enabled samplers that have stream output mode
-			if(iSamplers[i]->iEnabled /*&& samplers[i]->outputMode == 2*/)
-			    {
-				//TInt pending = 0;
-				// stream mode samplers may be pending, if they
-				// are still waiting for another client buffer,
-				// in that case, the request should be completed already
-				if(iSamplers[i]->EndSampling() == KErrNotReady) 
-				    {
-					LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest - still data pending");
-					releaseBuffer = true;
-                    }
-				else 
-				    {
-					LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest - no data pending");
-					releaseBuffer = true;
-                    }
-                }
-            }
-		// At the end, once all the samplers are gone through, the buffer should be released
-		if (true == releaseBuffer) 
-		    {
-			LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest - all data copied, release the buffer");
-			iSampleStream.ReleaseIfPending();
-		    }
-        }
-	LOGSTRING("DGeneralsDriver::ProcessStreamReadRequest - exit");
-	
-	return KErrNone;
-	}
-
-
-/*
- *	Mark traces active or inactive, this can be done
- *	only if sampling is not running
- */
-
-inline TInt DGeneralsDriver::MarkTraceActive(TInt samplerIdToActivate)
-	{
-	LOGSTRING2("DGeneralsDriver::MarkTraceActive %d",samplerIdToActivate);
-
-	TInt cpus(0);
-#ifdef __SMP__
-	cpus = NKern::NumberOfCpus();
-	if( samplerIdToActivate == PROFILER_GPP_SAMPLER_ID )
-	    {
-	    for(TInt cpu(0);cpu<cpus;cpu++)
-	         {
-	         Kern::Printf("DGeneralsDriver::MarkTraceActive - activating CPU %d",cpu);
-	         iSamplers[cpu]->SetEnabledFlag(true);
-	         }
-	    return KErrNone;
-	    }
-#endif
-	for(TInt i(cpus);i<KSamplerAmount;i++)
-	    {
-		if(iSamplers[i]->iSamplerId == samplerIdToActivate)
-		    {
-			iSamplers[i]->SetEnabledFlag(true);
-			return KErrNone;
-            }
-        }
-
-	LOGSTRING2("DGeneralsDriver::MarkTraceActive - %d not supported",samplerIdToActivate);
-	return KErrNotSupported;
-	}
-
-inline TInt DGeneralsDriver::MarkTraceInactive(TInt samplerIdToDisable)
-	{
-	LOGSTRING2("DGeneralsDriver::MarkTraceInactive %d",samplerIdToDisable);
-
-    TInt cpus(0);
-#ifdef __SMP__
-    cpus = NKern::NumberOfCpus();
-    if( samplerIdToDisable == PROFILER_GPP_SAMPLER_ID )
-        {
-        for(TInt cpu(0);cpu<cpus;cpu++)
-             {
-             iSamplers[cpu]->SetEnabledFlag(false);
-             }
-        return KErrNone;
-        }
-#endif
-    for(TInt i(cpus);i<KSamplerAmount;i++)
-	    {
-		if(iSamplers[i]->iSamplerId == samplerIdToDisable)
-		    {
-			iSamplers[i]->SetEnabledFlag(false);
-			return KErrNone;
-            }
-        }
-
-	LOGSTRING2("DGeneralsDriver::MarkTraceInactive - %d not supported",samplerIdToDisable);
-	return KErrNotSupported;
-	}
-
-/*
- *	Set output settings for a trace
- */
- 
-inline TInt DGeneralsDriver::OutputSettingsForTrace(TInt samplerId,TInt settings)
-	{
-	LOGSTRING3("DGeneralsDriver::OutputSettingsForTrace id:%d set:%d",samplerId,settings);
-
-    TInt cpus(0);
-#ifdef __SMP__
-    cpus = NKern::NumberOfCpus();
-    if( samplerId == PROFILER_GPP_SAMPLER_ID )
-        {
-        for(TInt cpu(0);cpu<cpus;cpu++)
-             {
-             iSamplers[cpu]->SetOutputCombination(settings);
-             }
-        return KErrNone;
-        }
-#endif
-    for(TInt i(cpus);i<KSamplerAmount;i++)
-	    {
-		if(iSamplers[i]->iSamplerId == samplerId)
-		    {
-			iSamplers[i]->SetOutputCombination(settings);
-			return KErrNone;
-		    }
-	    }
-
-	return KErrNotSupported;	
-	}
-
-/*
- *	Set additional settings for a trace
- */
-
-inline TInt DGeneralsDriver::AdditionalTraceSettings(TInt samplerId,TInt settings)
-	{
-	LOGSTRING3("DGeneralsDriver::SetAdditionalTraceSettings id:%d set:%d",samplerId,settings);
-
-    TInt cpus(0);
-#ifdef __SMP__
-    cpus = NKern::NumberOfCpus();
-    if( samplerId == PROFILER_GPP_SAMPLER_ID )
-        {
-        for(TInt cpu(0);cpu<cpus;cpu++)
-             {
-             iSamplers[cpu]->SetAdditionalSettings(settings);
-             }
-        return KErrNone;
-        }
-#endif
-    for(TInt i(cpus);i<KSamplerAmount;i++)
-	    {
-		if(iSamplers[i]->iSamplerId == samplerId)
-		    {
-			iSamplers[i]->SetAdditionalSettings(settings);
-			return KErrNone;
-            }
-        }
-
-	return KErrNotSupported;	
-	}
-
-inline TInt DGeneralsDriver::AdditionalTraceSettings2(TInt samplerId,TInt settings)
-	{
-	LOGSTRING3("DGeneralsDriver::SetAdditionalTraceSettings id:%d set:%d",samplerId,settings);
-
-    TInt cpus(0);
-#ifdef __SMP__
-    cpus = NKern::NumberOfCpus();
-    if( samplerId == PROFILER_GPP_SAMPLER_ID )
-        {
-        for(TInt cpu(0);cpu<cpus;cpu++)
-             {
-             iSamplers[cpu]->SetAdditionalSettings2(settings);
-             }
-        return KErrNone;
-        }
-#endif
-    for(TInt i(cpus);i<KSamplerAmount;i++)
-	    {
-		if(iSamplers[i]->iSamplerId == samplerId)
-		    {
-			iSamplers[i]->SetAdditionalSettings2(settings);
-			return KErrNone;
-		    }
-        }
-
-	return KErrNotSupported;	
-	}
-
-inline TInt DGeneralsDriver::SetSamplingPeriod(TInt samplerId,TInt settings)
-	{
-	LOGSTRING2("DGeneralsDriver::SetSamplingPeriod - set:%d",settings);
-
-	TInt cpus(0);
-#ifdef __SMP__
-    cpus = NKern::NumberOfCpus();
-    if( samplerId == PROFILER_GPP_SAMPLER_ID )
-        {
-        for(TInt cpu(0);cpu<cpus;cpu++)
-             {
-             iSamplers[cpu]->SetSamplingPeriod(settings);
-             }
-        return KErrNone;
-        }
-#endif
-    for(TInt i(cpus);i<KSamplerAmount;i++)
-	    {
-		if(iSamplers[i]->iSamplerId == samplerId)
-		    {
-			iSamplers[i]->SetSamplingPeriod(settings);
-			return KErrNone;
-		    }
-	    }
-
-	return KErrNotSupported;	
-	}
-
-/*
- *	Mark traces active or inactive, this can be done
- *	only if sampling is not running
- */
- 
-TInt DGeneralsDriver::StartSampling()
-	{
-	LOGSTRING("DGeneralsDriver::StartSampling");
-
-	if(iState == EStopped)
-		{
-		// reset iSampleStartTimeProp property value
-		iSampleStartTime = NKern::TickCount();	// get the system tick value for sync purposes 
-#ifdef __SMP__
-		iStartTime = (iSampleStartTime & 0xfffffff0);
-#endif
-		TInt r(iSampleStartTimeProp.Set(iSampleStartTime));
-		
-		Kern::Printf(("PIPROF SAMPLE TICK, #0")); // for remote profiling with Profiler Activator
-		
-		// reset all enabled samplers
-		for(TInt i(0);i<KSamplerAmount;i++)
-			{
-			if(iSamplers[i]->iEnabled)
-				{
-				// reset with stream option
-#ifndef __SMP__
-                Kern::Printf(("DGeneralsDriver::StartSampling - stream reset for generals driver, sync offset %d"), 0);
-				iSamplers[i]->Reset(&iSampleStream, 0);
-#else
-                Kern::Printf(("DGeneralsDriver::StartSampling - stream reset for generals driver, start time %d"), iStartTime);
-                iSamplers[i]->Reset(&iSampleStream, iStartTime);
-#endif
-				}
-			}
-
-		NewStart(gppSampler.GetPeriod());
-		return KErrNone;
-		}
-	else
-		{
-		return KErrGeneral;
-		}
-	}
-
-/*
- *  Mark traces active or inactive, this can be done
- *  only if sampling is not running
- */
- 
-TInt DGeneralsDriver::StopSampling()
-    {
-    LOGSTRING("DGeneralsDriver::StopSampling");
-
-    if(iState == ERunning)
-        {
-        this->iState = EStopping;
-        // reset all enabled samplers
-        for(TInt i(0);i<KSamplerAmount;i++)
-            {
-            // do the reset only for memory sampler
-            if(iSamplers[i]->iEnabled && iSamplers[i]->iSamplerId == 4)
-                {
-                // reset with stream option
-                LOGTEXT(("DGeneralsDriver::StopSampling - stream reset for samplers"));
-                iSamplers[i]->Reset(&iSampleStream, 999999);
-                }
-            }
-
-        return KErrNone;
-        }
-    else
-        {
-        return KErrGeneral;
-        }
-    }
-
-
--- a/piprofiler/plugins/GeneralsPlugin/src/GeneralsPlugin.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,577 +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 "GeneralsPlugin.h"	
-//#include <piprofiler/EngineUIDs.h>
-#include <piprofiler/ProfilerTraces.h>
-
-const TInt KMaxSamplerAmount = 20;
-
-// LITERALS
-_LIT8(KSamplingPeriod, "sampling_period_ms");
-
-// CONSTANTS
-// GeneralsPlugin UID:
-const TUid KSamplerGeneralsPluginUid = { 0x2001E5B2 };
-
-// Gpp sub-sampler UID:
-const TUid KSamplerGppPluginUid = { 0x2001E570 };
-
-// Gfc sub-sampler UID:
-const TUid KSamplerGfcPluginUid = { 0x2001E571 };
-
-// Itt sub-sampler UID:
-const TUid KSamplerIttPluginUid = { 0x2001E572 };
-
-// Mem sub-sampler UID:
-const TUid KSamplerMemPluginUid = { 0x2001E573 };
-
-// Pri sub-sampler UID:
-const TUid KSamplerPriPluginUid = { 0x2001E574 };
-
-/*
- *	
- *	class CGeneralsPlugin implementation
- * 
- */
- 
-CGeneralsPlugin* CGeneralsPlugin::NewL(const TUid aImplementationUid, TAny* /*aInitParams*/)
-    {
-	LOGTEXT(_L("CGeneralsPlugin::NewL() - entry"));
-    CGeneralsPlugin* self = new (ELeave) CGeneralsPlugin();
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-	LOGTEXT(_L("CGeneralsPlugin::NewL() - exit"));
-    return self;
-    }
-
-CGeneralsPlugin::CGeneralsPlugin() :
-	iVersionDescriptor(&(this->iVersion[1]),0,19)
-	{
-	iSamplerType = PROFILER_KERNEL_MODE_SAMPLER;
-	iSamplerId = PROFILER_GENERALS_SAMPLER_ID;
-	iBufferHandler = NULL;
-    iEnabled = EFalse;
-	LOGTEXT(_L("CGeneralsPlugin::CGeneralsPlugin() - constructor"));
-	}
-
-void CGeneralsPlugin::ConstructL() 
-    {
-	LOGTEXT(_L("CGeneralsPlugin::ConstructL() - entry"));
-	
-	// create attribute array
-	iSamplerAttributes = new(ELeave) CArrayFixFlat<TSamplerAttributes>(KSubSamplerCount);
-	
-	TInt err = InitiateSamplerL();
-	if( err != KErrNone )
-		{
-			LOGTEXT(_L("CGeneralsPlugin::ConstructL - LEAVING, failed to load open sampler device"));
-			User::Leave(err);
-		}
-	
-	// initiate sampler attributes, i.e. settings for modification
-	InitiateSamplerAttributesL();
-	
-	LOGTEXT(_L("CGeneralsPlugin::ConstructL() - exit"));
-    }
-
-
-CGeneralsPlugin::~CGeneralsPlugin()
-	{
-	// clean all the members
-	CleanSampler();	// clean the created sampler
-	}
-
-TInt CGeneralsPlugin::InitiateSamplerL()
-	{
-	RThread me;
-	
-	LOGTEXT(_L("CGeneralsPlugin::InitiateSamplerL - #1"));
-
-	me.SetPriority(EPriorityRealTime);
-
-	LOGTEXT(_L("CGeneralsPlugin::InitiateSamplerL - #2"));
-	
-	// create 
-	User::FreeLogicalDevice(KPluginSamplerName);
-	TInt err(KErrGeneral);
-	
-	LOGTEXT(_L("CGeneralsPlugin::InitiateSamplerL - #3"));
-
-    err = User::LoadLogicalDevice(KPluginSamplerName);
-    if(err != KErrNone)
-        {
-        User::Leave(err);
-        }
-
-	LOGTEXT(_L("CGeneralsPlugin::InitiateSamplerL - #4"));
-	
-	err = KErrGeneral;
-
-    err = iGeneralsSampler.Open();
-    if(err != KErrNone)
-        {
-        LOGSTRING2("CGeneralsPlugin::InitiateSamplerL - Could not open sampler device - waiting and trying again: %d", err);
-        User::Leave(err);
-        }
-
-	LOGTEXT(_L("CGeneralsPlugin::InitiateSamplerL - #5"));
-
-	return err;
-	}
-
-/* 
- * 
- * Default sampler attributes
- * 
- */
-void CGeneralsPlugin::InitiateSamplerAttributesL()
-    {
-
-    // 
-    for(TInt i(0);i<KMaxSamplerAmount;i++)
-        {
-        switch(i)
-            {
-// Usage:
-//            TSamplerAttributes(TUint32 aUid,
-//                    const TDesC8& aShortName,
-//                    const TDesC& aName,
-//                    const TDesC& aDescription,
-//                    TInt aSampleRate,
-//                    TBool aEnabled,
-//                    TBool aHidden,
-//                    TUint32 aItemCount);
-            case PROFILER_GPP_SAMPLER_ID:
-                {
-                TSamplerAttributes attr(KSamplerGppPluginUid.iUid,
-                        KGPPShortName(),
-                        KGPPLongName(),
-                        KGPPDescription(),
-                        1,
-                        ETrue,
-                        ETrue,
-                        0);
-                iSamplerAttributes->AppendL(attr);
-                break;
-                }
-            case PROFILER_GFC_SAMPLER_ID:
-                {
-                TSamplerAttributes attr2(KSamplerGfcPluginUid.iUid,
-                        KGFCShortName(),
-                        KGFCLongName(),
-                        KGFCDescription(),
-                        -1,
-                        EFalse,
-                        EFalse,
-                        0);
-                this->iSamplerAttributes->AppendL(attr2);
-                break;
-                }
-            case PROFILER_ITT_SAMPLER_ID:
-                {
-                TSamplerAttributes attr3(KSamplerIttPluginUid.iUid,
-                        KITTShortName(),
-                        KITTLongName(),
-                        KITTDescription(),
-                        -1,
-                        ETrue,
-                        EFalse,
-                        0);
-                this->iSamplerAttributes->AppendL(attr3);
-                break;
-                }
-            case PROFILER_MEM_SAMPLER_ID:
-                {
-                TSamplerAttributes attr4(KSamplerMemPluginUid.iUid,
-                        KMEMShortName(),
-                        KMEMLongName(),
-                        KMEMDescription(),
-                        -1,
-                        EFalse,
-                        EFalse,
-                        0);
-//                // select event or sampling based
-//                attr4.iSettingItem1.iSettingDescription.Copy(KMEM1Desc);
-//                attr4.iSettingItem1.iType = TSettingItem::ESettingItemTypeBool;
-//                attr4.iSettingItem1.iValue.AppendNum(0, EDecimal);
-//                attr4.iSettingItem1.iUIText.Copy(KMEM1UIText);
-//                attr4.iSettingItem1.iSettingText.Copy(KMemCounter1);
-                
-                this->iSamplerAttributes->AppendL(attr4);
-                break;
-                }
-            case PROFILER_PRI_SAMPLER_ID:
-                {
-                TSamplerAttributes attr5(KSamplerPriPluginUid.iUid,
-                        KPRIShortName(),
-                        KPRILongName(),
-                        KPRIDescription(),
-                        3000,
-                        EFalse,
-                        EFalse,
-                        0);
-                this->iSamplerAttributes->AppendL(attr5);
-                break;
-                }
-            }
-        }
-    }
-
-TInt CGeneralsPlugin::CleanSampler()
-	{
-    LOGTEXT(_L("CGeneralsPlugin::CleanSampler() - deleting buffer handler"));
-    // release the buffer handler
-    if(iBufferHandler)
-        {
-        iBufferHandler->Cancel();
-        delete iBufferHandler;
-        iBufferHandler = NULL;
-        }
-    
-    LOGTEXT(_L("CGeneralsPlugin::CleanSampler() - closing sampler"));
-	iGeneralsSampler.Close();
-	
-	LOGTEXT(_L("CGeneralsPlugin::CleanSampler() - Freeing sampler device"));
-	User::FreeLogicalDevice(KPluginSamplerName);
-	
-	// release attribute array
-	if(iSamplerAttributes)
-	    {
-	    iSamplerAttributes->Reset();
-	    }
-    delete iSamplerAttributes;
-    iSamplerAttributes = NULL;
-
-	LOGTEXT(_L("CGeneralsPlugin::CleanSampler() - exit"));
-
-	return KErrNone;
-	}
-
-// returns setting array
-void CGeneralsPlugin::GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes)
-    {
-    TInt count(iSamplerAttributes->Count());
-    // append all sampler attributes to aAttributes array
-    for(TInt i(0);i<count;i++)
-        {
-        aAttributes->AppendL(iSamplerAttributes->At(i));
-        }
-    }
-
-TInt CGeneralsPlugin::SetAttributesL(TSamplerAttributes aAttributes)
-    {
-    TSamplerAttributes attr;
-
-    TInt count(iSamplerAttributes->Count());
-    // loop the sub sampler attributes (by UID)
-    for(TInt i(0);i<count;i++)
-        {
-        attr = iSamplerAttributes->At(i);
-        // if UIDs match replace the old 
-        if(attr.iUid == aAttributes.iUid)
-            {
-            // replace the old attribute container
-            iSamplerAttributes->Delete(i);
-            iSamplerAttributes->InsertL(i, aAttributes);
-            return KErrNone;
-            }
-        }
-    return KErrNotFound;
-    }
-
-/* 
- * Method for parsing and transforming text array settings into TSamplerAttributes (per each sub sampler),
- * called by CSamplerController class
- * 
- * @param array of raw text setting lines, e.g. [gpp]\nenabled=true\nsampling_period_ms=1\n
- */
-TInt CGeneralsPlugin::ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aAllSettingsArray)
-    {
-    // local literals
-    _LIT8(KGPPShort, "gpp");
-    _LIT8(KGFCShort, "gfc");
-    _LIT8(KITTShort, "itt");
-    _LIT8(KMEMShort, "mem");
-    _LIT8(KPRIShort, "pri");
-
-    TInt err(KErrNone);
-    
-    TBuf8<16> samplerSearchName;
-    
-    // loop previous settings, update value if changed
-    for(TInt i(0);i<KSubSamplerCount;i++)
-        {
-        // go through all the sub samplers
-        switch (i)
-            {
-            case 0:
-                samplerSearchName.Copy(KGPPShort);
-                break;
-            case 1:
-                samplerSearchName.Copy(KGFCShort);
-                break;
-            case 2:
-                samplerSearchName.Copy(KITTShort);
-                break;
-            case 3:
-                samplerSearchName.Copy(KMEMShort);
-                break;
-            case 4:
-                samplerSearchName.Copy(KPRIShort);
-                break;
-            }
-
-        // get sampler specific settings  
-        err = DoSetSamplerSettings(aAllSettingsArray, samplerSearchName, i);
-        }
-    
-    // returns KErrNone if settings found, otherwise KErrNotFound
-    return err;
-    }
-
-/**
- * Method for searching sampler specific settings among all settings (raw setting lines read from settings file)
- * 
- * @param aAllSettings array of all settings from settings file
- * @param aSamplerName short name of sampler to be searched among the settings
- * @param aIndex index number of sampler specific sampler attributes (TSamplerAttributes)
- * @return KErrNone if settings found ok else KErrNotFound
- */
-TInt CGeneralsPlugin::DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex)
-    {
-    // sampler name to be searched among the all settings
-    TBuf8<16> samplerSearch;
-    samplerSearch.Copy(KBracketOpen);
-    samplerSearch.Append(aSamplerName);
-    samplerSearch.Append(KBracketClose);
-    
-    // read a line from ALL settings array
-    for (TInt i(0); i<aAllSettings->MdcaCount(); i++)
-        {
-        // check if this line has a setting block start, i.e. contains [xxx] in it
-        if (aAllSettings->MdcaPoint(i).CompareF(samplerSearch) == 0)
-            {
-            // right settings block found, now loop until the next block is found
-            for(TInt j(i+1);j<aAllSettings->MdcaCount();j++)
-                {
-                // check if the next settings block was found
-                if(aAllSettings->MdcaPoint(j).Left(1).CompareF(KBracketOpen) != 0)
-                    {
-                    // save found setting value directly to its owners attributes
-                    SaveSettingToAttributes(aAllSettings->MdcaPoint(j), aIndex);
-                    }
-                else
-                    {
-                    // next block found, return KErrNone
-                    return KErrNone;
-                    }
-                }
-            }
-        }
-    // no settings found for specific sampler
-    return KErrNotFound;
-    }
-
-/**
- * Method for setting a specific descriptor (from settings file) to attribute structure
- * 
- * @param aSetting  
- * @param aName  
- */
-void CGeneralsPlugin::SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex)
-    {
-    // local literals
-    _LIT8(KSettingItemSeparator, "=");
-    
-    // find the equal mark from the setting line
-    TInt sepPos = aSetting.Find(KSettingItemSeparator);
-    // check that '=' is found
-    if (sepPos > 0)
-        {
-        // check that the element matches
-        if (aSetting.Left(sepPos).CompareF(KEnabled) == 0)
-            {
-            TBool en;
-            CSamplerPluginInterface::Str2Bool(aSetting.Right(aSetting.Length()-sepPos-1), en);
-            if(en != iSamplerAttributes->At(aIndex).iEnabled)
-                {
-                iSamplerAttributes->At(aIndex).iEnabled = en;
-                }
-            }
-        else if (aSetting.Left(sepPos).CompareF(KSamplingPeriod) == 0)
-            {
-            TInt sr;
-            CSamplerPluginInterface::Str2Int(aSetting.Right(aSetting.Length()-sepPos-1), sr);
-            if(sr != iSamplerAttributes->At(aIndex).iSampleRate)
-                {
-                iSamplerAttributes->At(aIndex).iSampleRate = sr;
-                }
-            }
-        }
-    }
-
-
-TUid CGeneralsPlugin::Id(TInt aSubId) const
-	{
-		if(aSubId == PROFILER_GPP_SAMPLER_ID)		
-			return KSamplerGppPluginUid;
-		else if (aSubId == PROFILER_GFC_SAMPLER_ID)		
-			return KSamplerGfcPluginUid;
-		else if (aSubId == PROFILER_ITT_SAMPLER_ID)		
-			return KSamplerIttPluginUid;
-		else if (aSubId == PROFILER_MEM_SAMPLER_ID)		
-			return KSamplerMemPluginUid;
-		else if (aSubId == PROFILER_PRI_SAMPLER_ID)		
-			return KSamplerPriPluginUid;
-		else
-			return KSamplerGeneralsPluginUid;
-	}
-
-TInt CGeneralsPlugin::SubId(TUid aId) const
-	{
-/* definitions from ProfilerConfig.h:
- * 	#define		PROFILER_GPP_SAMPLER_ID			1
-	#define		PROFILER_GFC_SAMPLER_ID			2
-	#define		PROFILER_ITT_SAMPLER_ID			3
-	#define		PROFILER_MEM_SAMPLER_ID			4
-	#define		PROFILER_PRI_SAMPLER_ID			5
- */
-	
-		if(aId == KSamplerGppPluginUid)		
-			return PROFILER_GPP_SAMPLER_ID;
-		else if (aId == KSamplerGfcPluginUid)		
-			return PROFILER_GFC_SAMPLER_ID;
-		else if (aId == KSamplerIttPluginUid)		
-			return PROFILER_ITT_SAMPLER_ID;
-		else if (aId == KSamplerMemPluginUid)		
-			return PROFILER_MEM_SAMPLER_ID;
-		else if (aId == KSamplerPriPluginUid)		
-			return PROFILER_PRI_SAMPLER_ID;
-		else
-			return KErrNotFound;
-	}
-
-TInt CGeneralsPlugin::GetSamplerType()
-	{
-	return iSamplerType;
-	}
-
-
-void CGeneralsPlugin::InstallStreamForActiveTraces(RGeneralsSampler& sampler, CProfilerSampleStream& aStream)
-	{
-	// output mode for this trace is stream
-	if(!iBufferHandler)
-		{
-		// stream object has not been created yet
-		LOGTEXT(_L("CGeneralsPlugin::InstallStreamForActiveTraces - creating stream for trace"));	
-		
-		// use a 32KB buffer to transfer data from sampler to client
-		// commonStream = new RProfilerSampleStream(sampler,totalPrefix,32768);
-		TRAPD(err, iBufferHandler = CProfilerBufferHandler::NewL(aStream, sampler));
-		if(err != KErrNone)
-		    {
-		    LOGTEXT(_L("CGeneralsPlugin::InstallStreamForActiveTraces() - No memory"));
-		    return;
-		    }
-		}
-
-	// initiate receiving of data from the sampler device driver
-	if(iBufferHandler)
-		{
-		iBufferHandler->StartReceivingData();
-		}
-}
-
-void CGeneralsPlugin::SetSettingsToSamplers()
-    {
-    TSamplerAttributes attr;
-    
-    // loop through the setting attributes
-    for(TInt i(0);i<iSamplerAttributes->Count();i++)
-        {
-        // get the attribute container
-        attr = iSamplerAttributes->At(i);
-        
-        // make changes according to right sampler, NOTE! The old IDs of sub samplers (i+1)!
-        if(attr.iEnabled)
-            {
-            iGeneralsSampler.MarkTraceActive(i+1);
-            
-            // set enabled
-            iEnabled = ETrue;
-            }
-        else
-            {
-            iGeneralsSampler.MarkTraceInactive(i+1);
-            }
-        // set sampling period if available
-        if(attr.iSampleRate != KErrNotFound)
-            {
-            iGeneralsSampler.SetSamplingPeriod(i+1, attr.iSampleRate);
-            }
-        }
-    }
-
-TInt CGeneralsPlugin::ResetAndActivateL(CProfilerSampleStream& aStream) 
-    {
-	// the sampler starting functionality
-	LOGTEXT(_L("CGeneralsPlugin::ResetAndActivate() - entry"));
-
-    // now before starting the latest settings must be set to samplers itself
-	SetSettingsToSamplers();
-
-	if(Enabled())
-	    {
-        LOGTEXT(_L("CGeneralsPlugin::ResetAndActivate() - starting sampling..."));
-        // start sampling process of enabled sub samplers
-        iGeneralsSampler.StartSampling();		
-        LOGTEXT(_L("CGeneralsPlugin::ResetAndActivate() - installing stream for an active trace..."));
-    
-        // install the trace for enabled samplers
-        InstallStreamForActiveTraces(iGeneralsSampler, aStream);
-        LOGSTRING2("CGeneralsPlugin::ResetAndActivate() - stream installed: 0x%x", aStream);
-	    }
-	
-	LOGTEXT(_L("CGeneralsPlugin::ResetAndActivate() - exit"));
-	return KErrNone;
-    }
-	
-TInt CGeneralsPlugin::StopSampling() 
-    {
-    // RDebug::Print(_L("CGeneralsPlugin::StopSampling() - Stopping sampler LDD"));
-	iGeneralsSampler.StopSampling();
-	// RDebug::Print(_L("CGeneralsPlugin::StopSampling() - Sampler LDD stopped"));
-	
-	// check if bufferhandler has died
-	if(iBufferHandler)
-		{
-		// RDebug::Print(_L("CGeneralsPlugin::StopSampling() - Canceling the buffer handler"));
-		iBufferHandler->Cancel();
-		delete iBufferHandler;
-		iBufferHandler = NULL;
-		}	
-	// set enabled
-    iEnabled = EFalse;
-    // RDebug::Print(_L("CGeneralsPlugin::StopSampling() - exit"));
-	return KErrNone;
-    }
-
-
-
--- a/piprofiler/plugins/GeneralsPlugin/src/GeneralsPluginImplementationTable.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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 FILES
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-
-#include "GeneralsPlugin.h"
-
-
-// Provides a key value pair table, this is used to identify
-// the correct construction function for the requested interface.
-const TImplementationProxy ImplementationTable[] =
-{
-         IMPLEMENTATION_PROXY_ENTRY(0x2001E5B2,  CGeneralsPlugin::NewL)
-};
-
-// Function used to return an instance of the proxy table.
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-{
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-    return ImplementationTable;
-}
-
--- a/piprofiler/plugins/GeneralsPlugin/src/GeneralsSampler.cia	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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 <platform.h>
-
-#include "GeneralsDriver.h"
-#include <kern_priv.h>		//temporary
-
-#ifdef __SMP__
-#include <e32cia.h>
-#include <arm.h>
-#include <arm_gic.h>
-#include <arm_tmr.h>
-#endif
-
-#if defined(__GCC32__)
-// CIA symbol macros for Gcc98r2
-#define CSM__ZN5NKern14CurrentContextEv " CurrentContext__5NKern"
-#elif defined(__ARMCC__)
-// CIA symbol macros for RVCT
-#define CSM__ZN5NKern14CurrentContextEv " __cpp(NKern::CurrentContext)"
-#else
-// CIA symbol macros for EABI assemblers
-#define CSM__ZN5NKern14CurrentContextEv " _ZN5NKern14CurrentContextEv"
-#endif
-
-#ifdef __WINS__
-__NAKED__ TUint* IntStackPtr()
-{
-	return 0;
-}
-
-__NAKED__ TUint32 SPSR()
-{
-	return 0;
-}
-__NAKED__ void UsrModLr(TUint32* a)
-{
-	*a = 0;
-}
-#else
-
-__NAKED__ TUint* IntStackPtr()
-{
-#ifdef __SMP__
-    asm("stmfd sp!, {r0-r12,lr} ");
-#endif
-	asm("mrs r1, cpsr ");           // copy current program status register (cpsr) to R1 
-	asm("bic r3, r1, #0x1f ");      // compare to 0x1f, i.e. make sure that spsr is available? 
-#ifdef __SMP__
-	__ASM_CLI_MODE(MODE_IRQ);       // disable all interrupts and set to irq mode (we are in NTimer interrupt)
-#else
-	asm("orr r3, r3, #0xd2 ");		// mode_irq, all interrupts off
-	asm("msr cpsr, r3 ");           // write result on R3 back to cpsr, irqs disabled 
-#endif
-	asm("mov r0, sp ");				// read stack pointer to R0, mode r0=sp_irq
-	asm("msr cpsr, r1 ");			// restore interrupts
-#ifdef __SMP__
-    asm("ldmfd sp!, {r0-r12,pc} ");
-#endif
-	__JUMP(,lr);
-}
-
-__NAKED__ TUint32 SPSR()
-{
-	asm("mrs r0, spsr ");
-	__JUMP(,lr);
-}
-__NAKED__ void UsrModLr(TUint32*)
-{
-	// r0 = address to store
-	asm ("stmia r0,{lr}^");
-	__JUMP(,lr);
-}
-
-#endif
--- a/piprofiler/plugins/GeneralsPlugin/src/GppSamplerImpl.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,572 +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 <piprofiler/ProfilerVersion.h>
-#include <piprofiler/ProfilerTraces.h>
-#include <kern_priv.h>
-#include <arm.h>
-
-#include "GppSamplerImpl.h"
-
-extern TUint*		IntStackPtr();
-#define	TAG(obj)	(*(TUint32*)&(obj.iAsyncDeleteNext))
-
-// properties for ISA task parsing
-const TUid KIsaPropertyCat={0x2001E5AD};
-enum TIsaPropertyKeys
-	{
-	EIsaPropertyIsaTaskParserStatus = 1,
-	EIsaPropertyIsaTaskAddressStart,
-	EIsaPropertyIsaTaskAddressEnd,
-	EIsaPropertyIsaTaskAddress,
-	EIsaPropertyIsaOsTaskRunningAddress,
-	EIsaPropertyIsaTaskParsedName
-	};
-
-
-DGppSamplerImpl::DGppSamplerImpl()
-	{
-	LOGTEXT("GppSamplerImpl::GppSamplerImpl");
-	iInterruptStack = (TUint*)IntStackPtr();
-
-	LOGTEXT("GppSamplerImpl::GppSamplerImpl - attaching to properties");
-
-	TInt err = iIsaStartAddr.Attach(KIsaPropertyCat, EIsaPropertyIsaTaskAddressStart);
-	if(err != KErrNone)
-		LOGTEXT("GppSamplerImpl::GppSamplerImpl() - Property EIsaPropertyIsaTaskAddressStart not available"); 
-	err = iIsaEndAddr.Attach(KIsaPropertyCat, EIsaPropertyIsaTaskAddressEnd);
-	if(err != KErrNone)
-		LOGTEXT("GppSamplerImpl::GppSamplerImpl() - Property EIsaPropertyIsaTaskAddressEnd not available"); 
-	err = iIsaPluginStatus.Attach(KIsaPropertyCat, EIsaPropertyIsaTaskParserStatus);
-	if(err != KErrNone)
-		LOGTEXT("GppSamplerImpl::GppSamplerImpl() - Property EIsaPropertyIsaTaskParserStatus not available"); 
-	err = iIsaOsTaskRunning.Attach(KIsaPropertyCat, EIsaPropertyIsaOsTaskRunningAddress);
-	if(err != KErrNone)
-		LOGTEXT("GppSamplerImpl::GppSamplerImpl() - Property EIsaPropertyIsaOsTaskRunningAddress not available"); 
-	
-	PROFILER_ISA_TASK_NAMES
-	
-	Reset();
-	}
-
-DGppSamplerImpl::~DGppSamplerImpl() 
-	{
-	iIsaStartAddr.Close();
-	iIsaEndAddr.Close();
-	iIsaPluginStatus.Close();
-	iIsaOsTaskRunning.Close();
-	}
-
-void DGppSamplerImpl::Reset()
-	{
-	LOGTEXT("GppSamplerImpl::Reset");
-	iLastPc = 0;
-	iLastThread = 0xfffffffe;
-	iRepeat = 0;
-	iIsaStatus = 0;
-	iIsaStart = 0;
-	iIsaEnd = 0;
-//	isaOsTaskRunningAddr = 0;
-	
-	// in SMP start time common with all CPUs, provided by DGeneralsDriver class
-#ifndef __SMP__
-	iStartTime = ( NKern::TickCount() & 0xfffffffc );
-#endif
-	
-	TPropertyStatus status;
-	TInt osAddr = 0;
-	
-	LOGTEXT("GppSamplerImpl::Reset - getting status");
-	
-	// get status of ISA plug-in
-	if(iIsaPluginStatus.GetStatus(status))
-		{
-		iIsaPluginStatus.Get(iIsaStatus);
-		LOGSTRING2("GppSamplerImpl::Reset - ISA plug-in status %d", iIsaStatus);
-		}
-	
-	if(iIsaStatus > 0)
-		{
-		LOGTEXT("GppSamplerImpl::Reset - get isa start address");
-		iIsaStartAddr.Get(iIsaStart);
-		LOGTEXT("GppSamplerImpl::Reset - get isa end address");
-		iIsaEndAddr.Get(iIsaEnd);
-		LOGTEXT("GppSamplerImpl::Reset - get isa os_task_running address");
-		iIsaOsTaskRunning.Get(osAddr);
-		isaOsTaskRunningAddr = reinterpret_cast<TInt*>(osAddr);
-		LOGSTRING2("GppSamplerImpl::Reset - got isa os_task_running address 0x%X", osAddr);
-		}
-	
-	LOGTEXT("GppSamplerImpl::Reset - initializing isa task list");
-
-	iIsaSample = false;
-	
-	for(TInt i=0;i<256;i++)
-		knownIsaTasks[i] = -1;
-	
-	knownIsaTaskCount = 0;
-    
-	iCpuSelector = 0x3;
-#ifndef __SMP__
-    iMask =  0xfffffffc;
-#else
-    iMask =  0xfffffff0;
-    switch(iCpuNumber)
-        {
-        case 0:
-            iCpuSelector = 0x1;
-            break;
-        case 1:
-            iCpuSelector = 0x2;
-            break;
-        case 2:
-            iCpuSelector = 0x4;
-            break;
-        case 3:
-            iCpuSelector = 0x8;
-            break;
-        }
-#endif
-	}
-
-TUint8* DGppSamplerImpl::EncodeTag(TUint8* aPtr)
-//
-// Encode a tag and version to the trace data. This allows the offline analyser to 
-// identify the sample data.
-//
-{	
-	_LIT(KGppSamplerVersion,"Bappea_GPP_V");
-	_LIT(KProfilerVersion,"#Prof#");
-	_LIT(KSamplerVersion,"#Samp#");
-#ifdef __SMP__
-	_LIT(KCPUNumberText,"#CPU#");
-#endif
-	
-	TBuf<64> buf;
-	buf.Zero();
-	buf.Append(KGppSamplerVersion);
-	buf.Append(PROFILER_GPP_SAMPLER_VERSION);
-	buf.Append(KProfilerVersion);
-	buf.Append(PROFILER_VERSION_SHORT);	
-	buf.Append(KSamplerVersion);
-	buf.Append(PROFILER_SAMPLER_VERSION);
-#ifdef __SMP__
-	buf.Append(KCPUNumberText);
-	buf.AppendNum(iCpuNumber);
-#endif
-	aPtr = EncodeText(aPtr, buf);
-	return aPtr;
-}
-
-TUint8* DGppSamplerImpl::EncodeInt(TUint8* aPtr,TInt aValue)
-{
-	LOGSTRING2("Encoding int 0x%x",aPtr);
-
-	LOGSTRING2("TIint = 0x%x",aValue);
-
-	TUint byte;
-	for (;;)
-		{
-		byte = aValue & 0x7f;
-		if ((aValue >> 6) == (aValue >> 7))
-			break;
-		aValue >>= 7;
-		*aPtr++ = byte;
-		}
-	*aPtr++ = byte | 0x80;
-
-	LOGSTRING2("Encoded int 0x%x",aPtr);
-
-	return aPtr;
-}
-
-TUint8* DGppSamplerImpl::EncodeUint(TUint8* aPtr,TUint aValue)
-{
-	LOGSTRING2("Encoding Uint 0x%x",aPtr);
-
-	LOGSTRING2("TUint = 0x%x",aValue);
-
-
-	TUint byte;
-	for (;;)
-		{
-		byte = aValue & 0x7f;
-		aValue >>= 7;
-		if (aValue == 0)
-			break;
-		*aPtr++ = byte;
-		}
-	*aPtr++ = byte | 0x80;
-
-	LOGSTRING2("Encoded Uint 0x%x",aPtr);
-
-	return aPtr;
-}
-
-TUint8* DGppSamplerImpl::EncodeText(TUint8* aPtr, const TDesC& aDes)
-//
-// Encode a descriptor into the data stream
-// This is currently limited to a descriptor that is up to 255 characters in length,
-// and Unicode characters are truncated to 8 bits
-//
-{
-	LOGSTRING2("Encoding text 0x%x",aPtr);
-	TInt len=aDes.Length();
-	*aPtr++ = TUint8(len);
-	const TText* p = aDes.Ptr();
-	while (--len >= 0)
-		{
-		*aPtr++ = TUint8(*p++);
-		}
-
-	LOGSTRING2("Encoded text 0x%x",aPtr);
-	return aPtr;
-}
-
-
-TUint8* DGppSamplerImpl::EncodeName(TUint8* aPtr, DObject& aObject,TUint32 id)
-//
-// Encode the name of a kernel object
-//
-{
-	LOGSTRING2("Encoding name 0x%x",aPtr);
-	TBuf8<0x5f> name;
-	aObject.TraceAppendName(name,false);
-
-	if(id != 0xffffffff)
-	{
-		name.Append('[');
-		name.AppendNum(id,EHex);
-		name.Append(']');
-	}
-	else
-	{
-		name.Append('[');
-		name.AppendNum((TUint32)((void*)&(((DThread*)&aObject)->iNThread)),EHex);
-		name.Append(']');
-	}
-
-	aPtr = EncodeText(aPtr,name);
-	LOGSTRING2("Encoded name 0x%x",aPtr);
-	return aPtr;
-}
-
-TUint8* DGppSamplerImpl::EncodeThread(TUint8* aPtr, DThread& aThread)
-//
-// Encode a thread name in the data stream.
-// The thread is identified by its name, and the identity of its owning process.
-// If the process has not been identified in the data stream already, it's name is
-// also encoded.
-//
-{
-	LOGSTRING2("Encoding thread 0x%x",aPtr);	
-
-	DProcess& p = *aThread.iOwningProcess;
-	
-	aPtr = EncodeUint(aPtr, p.iId);
-
-#ifdef __SMP__
-    // check if first time founding
-    if ((TAG(p) & iMask) != iStartTime)
-        {
-        // mark tagged for this CPU
-        TAG(p) = (iStartTime | iCpuSelector);
-
-        // The thread is 'unknown' to this sample, so encode the thread name
-        aPtr = EncodeName(aPtr, p, p.iId);     
-        }
-    // check if thread appeared already on this CPU
-    else if((TAG(p) & iCpuSelector) != iCpuSelector)
-        {
-        TAG(p) = (TAG(p) | iCpuSelector);
-        // The thread is 'unknown' to this sample, so encode the thread name
-        aPtr = EncodeName(aPtr, p, p.iId);     
-        }
-#else
-	if (TAG(p) != iStartTime)
-	    {
-		TAG(p) = iStartTime;
-		// Provide the name matching this process ID
-		aPtr = EncodeName(aPtr, p, p.iId);
-	    }
-#endif	    
-	aPtr = EncodeName(aPtr, aThread,0xffffffff);
-	
-	LOGSTRING2("Encoded thread 0x%x",aPtr);	
-
-	return aPtr;
-    }
-
-TUint8* DGppSamplerImpl::EncodeRepeat(TUint8* aPtr)
-//
-// Encode a repeated sequence of samples
-//
-{
-	LOGSTRING2("Encoding repeat, 0x%x",iRepeat);	
-
-	aPtr = EncodeInt(aPtr, 0);
-	aPtr = EncodeUint(aPtr, iRepeat);
-	iRepeat = 0;
-
-	LOGSTRING2("Encoded repeat, 0x%x",iRepeat);	
-
-	return aPtr;
-}
-
-TInt DGppSamplerImpl::CreateFirstSample()
-{
-	LOGTEXT("GppSamplerImpl::CreateFirstSample");
-	Reset();
-
-	TUint8* w = this->tempBuf;
-	w = EncodeTag(w);
-
-	TInt length = w-tempBuf;
-
-	LOGSTRING2("TAG encoded, length %d",length);
-	return length;
-}
-
-TBool DGppSamplerImpl::IsaTaskKnown(TUint8 task)
-{
-	for(TInt i=0;i<256;i++)
-	{
-		if(knownIsaTasks[i] == -1)
-		{
-			knownIsaTasks[i] = task;
-			knownIsaTaskCount++;
-			return false;
-		}
-		else if(knownIsaTasks[i] == task)
-		{
-			return true;
-		}
-	}
-
-	return false;
-}
-
-TUint8* DGppSamplerImpl::EncodeIsaTask(TUint8* aPtr, TUint task)
-
-{
-	LOGSTRING2("Encoding ISA task 0x%x",aPtr);	
-
-	aPtr = EncodeUint(aPtr,task);
-	// use the task name as the process name
-	aPtr = EncodeIsaName(aPtr,task,true);
-	// then encode the task name
-	aPtr = EncodeIsaName(aPtr,task,false);
-	
-	LOGSTRING2("Encoded ISA task 0x%x",aPtr);	
-
-	return aPtr;
-}
-
-TUint8* DGppSamplerImpl::EncodeIsaName(TUint8* aPtr, TUint task,TBool process)
-//
-// Encode a descriptor into the data stream
-// This is currently limited to a descriptor that is up to 255 characters in length,
-// and Unicode characters are truncated to 8 bits
-//
-{
-	TBuf8<256> aDes;
-	
-//	#ifdef NCP_COMMON_PROFILER_ISA_TASKS 
-	if(iIsaStatus > 0)
-		{
-		// resolve the isa task name from the task name array
-		if((task-100000) < PROFILER_ISA_OS_TASK_AMOUNT && process == false)
-			{
-			aDes.Append(isaTaskNames[(task-100000)]);
-			}
-		else
-			{
-			aDes.Append(_L8("NativeOS_Task"));
-			}
-		}
-	else
-		{
-		aDes.Append(_L8("NativeOS_Task"));
-		}
-	
-	aDes.Append('[');
-	aDes.AppendNum((task-100000),EHex);
-	aDes.Append(']');
-
-	LOGSTRING2("Encoding ISA name 0x%x",aPtr);
-	TInt len=aDes.Length();
-	*aPtr++ = TUint8(len);
-	const TText* p = aDes.Ptr();
-	while (--len >= 0)
-		{
-		*aPtr++ = TUint8(*p++);
-		}
-
-	LOGSTRING2("Encoded ISA name 0x%x",aPtr);
-	return aPtr;
-}
-
-
-TInt DGppSamplerImpl::SampleImpl()
-//
-// ISR for the profile timer
-// This extracts the thread and PC that was current when the interrupt went off and
-// encodes it into the sample data buffer. If enough data has been generated, the
-// DFC is triggered to complete a read request
-//
-    {
-	TUint8* w(this->tempBuf);
-	
-//    Kern::Printf(("Got thread 0x%08x"), &t);
-#ifdef __SMP__
-    // get the program counter of irq mode
-    TUint32 pc = (TUint32)Arm::IrqReturnAddress();
-#else
-    // get program counter of irq mode
-    TUint32 pc = iInterruptStack[-1];
-#endif
-    //LOGSTRING3("pc value 0x%x sp 0x%x",pc,iInterruptStack);
-
-	// ignore the low bit being set for THUMB mode - we use for something else
-	pc &= ~1;			
-	TInt diff = pc - iLastPc;
-	iLastPc = pc;
-
-	if(iIsaStatus > 0)
-		{
-		if((TUint32)pc > (TUint32)iIsaStart && (TUint32)pc < (TUint32)iIsaEnd)
-			{
-			LOGSTRING2("Identified ISA execution at 0x%x",pc);
-			iIsaSample = true;
-			}
-		else
-			{
-			LOGSTRING2("Normal sample at 0x%x",pc);
-			iIsaSample = false;
-			}
-		}
-
-	// request for current thread from kernel
-	DThread& t = ((DThread&)*Kern::NThreadToDThread(NKern::CurrentThread()));
-	
-	TUint tid;
-	TUint8 isaTask = 0;
-	if(iIsaSample)
-	{
-		LOGSTRING2("Reading ISA task number from 0x%x",isaOsTaskRunningAddr);
-
-		// if we don't get reasonable ISA address to read, skip ISA task handling
-		if(isaOsTaskRunningAddr == 0)
-			{
-			tid = 100000; // to tell the difference from SOS threads
-			iIsaSample = false;
-			}
-		else	// normal ISA task parsing process
-			{
-			isaTask = *isaOsTaskRunningAddr;
-			LOGSTRING2("ISA task = %d",isaTask);
-			tid = isaTask;
-			// this will make sure we don't mix ISA tasks and normal tasks
-			tid += 100000;
-			}
-
-	}
-	else
-	{
-		tid = t.iId;
-	}
-
-	if (tid != iLastThread)
-	{
-		// Change of thread is marked in the low bit of the PC difference
-		diff |= 1;
-	}
-	TUint rp = iRepeat;
-	if (diff == 0)
-	{
-		// Identical sample, bump up the repeat count
-		iRepeat = rp + 1;
-	}
-	else
-	{
-		if (rp)
-		{
-			// Encode the repeat data
-			w = EncodeRepeat(w);
-		}
-		// Encode the PC difference
-		w = EncodeInt(w, diff);
-		if (diff & 1)
-		{
-			// Encode the new thread ID
-			if(iIsaSample)
-			{
-				iLastThread = tid;
-				w = EncodeUint(w,tid);
-
-				if(!this->IsaTaskKnown(isaTask))
-				{
-					w = EncodeIsaTask(w,iLastThread);
-				}
-				//LOGSTRING2("Sample total length: %d",w-tempBuf);
-				TInt length = w-tempBuf;
-				// encoded isa task, return here
-				return length;
-			}
-		
-			iLastThread = tid;
-			w = EncodeUint(w, tid);
-
-#ifdef __SMP__
-			// iStartTime format: 0xXXXXXXX0, the last byte set to zero
-			// iMask =  0xfffffff0(0b111....1110000)
-			// iCpuSelector = 0x1(0b0001), 0x2(0b0010), 0x4(0b0100) or 0x8(0b1000) 
-			
-			// check first time founding
-			if ((TAG(t) & iMask) != iStartTime)
-			    {
-			    // mark tagged for this CPU
-				TAG(t) = (iStartTime | iCpuSelector);
-				
-				// The thread is 'unknown' to this sample, so encode the thread name
-				w = EncodeThread(w, t);		
-			    }
-			// check if thread appeared on this CPU
-			else if((TAG(t) & iCpuSelector) != iCpuSelector)
-			    {
-                TAG(t) = (TAG(t) | iCpuSelector);
-                // The thread is 'unknown' to this sample, so encode the thread name
-                w = EncodeThread(w, t);     
-			    }
-#else
-			// check if tag has not been set, neither original nor 
-            if ((TAG(t) & 0xfffffffc) != iStartTime)
-                {
-                TAG(t) = ((TAG(t) & 0x3) | iStartTime);
-                // The thread is 'unknown' to this sample, so encode the thread name
-                w = EncodeThread(w, t);     
-                }
-#endif
-		    }
-	    }
-	LOGSTRING2("Sample total length: %d",w-tempBuf);
-	TInt length = w-tempBuf;
-
-	return length;
-}
-
--- a/piprofiler/plugins/GeneralsPlugin/src/IttEventHandler.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +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:  Event based ITT sampler skeleton copypasted from MemoryEventHandler.cpp
-*
-*/
-
-#include <e32def.h>
-#include <e32cmn.h>
-#include <arm.h>
-#include <kernel.h>
-#include <kern_priv.h>
-#include <nk_trace.h>
-
-#include "IttEventHandler.h"
-
-/*
- * Constructor
- * 
- * @param DProfilerSampleBuffer*    pointer to sample buffer
- */
-DIttEventHandler::DIttEventHandler(DProfilerSampleBuffer* aSampleBuffer, TProfilerGppSamplerData* aGppSamplerDataIn)
-    :   DKernelEventHandler(EventHandler, this),
-        iSampleBuffer(aSampleBuffer),
-        iSampleDescriptor(&(this->iSample[1]),0,KITTBufferSize),
-        gppSamplerData(aGppSamplerDataIn)
-    {
-    //Kern::Printf("DIttEventHandler::DIttEventHandler()");
-
-    }
-
-/*
- * DIttEventHandler::Create()
- */
-TInt DIttEventHandler::Create()
-    {
-    Kern::Printf("DIttEventHandler::Create()");
-
-    TInt err(Kern::MutexCreate(iLock, _L("IttEventHandlerLock"), KMutexOrdDebug));
-    if (err != KErrNone)
-        return err;
-    
-    return Add();
-    }
-
-/*
- * Destructor
- */
-DIttEventHandler::~DIttEventHandler()
-    {
-    //Kern::Printf("DIttEventHandler::~DIttEventHandler()");
-
-    if (iLock)
-        iLock->Close(NULL);
-    }
-
-
-TInt DIttEventHandler::Start()
-    {
-    //Kern::Printf("DIttEventHandler::Start()");
-
-    iTracking = ETrue;
-    return KErrNone;
-    }
-
-
-TInt DIttEventHandler::Stop()
-    {
-    //Kern::Printf("DIttEventHandler::Stop()");
-
-    iTracking = EFalse;
-    return KErrNone;
-    }
-
-TBool DIttEventHandler::SampleNeeded()
-    {
-    LOGTEXT("DIttEventHandler::SampleNeeded()");
-    
-    // increase the counter by one on each round
-    iCount++;
-    
-    // check if event handler was not running
-    if(!iTracking)
-       return false;
-    
-    return true;
-    }
-
-
-TUint DIttEventHandler::EventHandler(TKernelEvent aType, TAny* a1, TAny* a2, TAny* aThis)
-    {
-    //Kern::Printf("DIttEventHandler::EventHandler()");
-    return ((DIttEventHandler*)aThis)->HandleEvent(aType, a1, a2);
-    }
-
-
-
-TUint DIttEventHandler::HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2)
-    {
-    //Kern::Printf("DIttEventHandler::HandleEvent()");
-    //Kern::Printf("New kernel event received, %d", aType);
-    
-    if (iTracking/* && iCount != iPreviousCount*/)
-        {
-        switch (aType)
-            {
-            
-            case EEventAddCodeSeg:
-                //Kern::Printf("DCodeSeg added: 0x%08x", (DCodeSeg*)a1);
-                HandleAddCodeSeg((DCodeSeg*)a1);
-                break;
-                
-            case EEventRemoveCodeSeg:
-                //Kern::Printf("DCodeSeg deleted: 0x%08x", (DCodeSeg*)a1);
-                HandleRemoveCodeSeg((DCodeSeg*)a1);
-                break;
-   
-            default:
-                break;
-            }
-        }
-//    else if(iTracking && iCount == iPreviousCount)
-//        {
-//        // if time stamp is not updated profiling has stopped
-//        Stop();
-//        }
-    return DKernelEventHandler::ERunNext;
-    }
-
-/*
- * 
- */
-TBool DIttEventHandler::HandleAddCodeSeg(DCodeSeg* aSeg)
-    {    
-    iSampleDescriptor.Zero();
-    //Kern::Printf("DLL ADD: NM %S : RA:0x%x SZ:0x%x SN:0x%x",aSeg->iFileName,aSeg->iRunAddress,aSeg->iSize, this->gppSamplerData->sampleNumber);
-
-    iSample[0] = aSeg->iFileName->Length();
-    iSampleDescriptor.Append(*aSeg->iFileName);
-    iSampleDescriptor.Append((TUint8*)&(aSeg->iRunAddress),4);
-    iSampleDescriptor.Append((TUint8*)&(aSeg->iSize),4);
-    iSampleDescriptor.Append((TUint8*)&(this->gppSamplerData->sampleNumber),4);
-    iSample[0] = iSampleDescriptor.Size();
-    
-    iSampleBuffer->AddSample(iSample,iSampleDescriptor.Size()+1);
-    return ETrue;
-    }
-
-TBool DIttEventHandler::HandleRemoveCodeSeg(DCodeSeg* aSeg)
-    {
-    iSampleDescriptor.Zero();
-    //Kern::Printf("DLL REM: NM %S : RA:0x%x SZ:0x%x SN:0x%x",aSeg->iFileName,aSeg->iRunAddress,aSeg->iSize, this->gppSamplerData->sampleNumber);
-
-    iSample[0] = aSeg->iFileName->Length();
-    iSampleDescriptor.Append(*aSeg->iFileName);
-    iSampleDescriptor.Append((TUint8*)&(aSeg->iRunAddress),4);
-    iSampleDescriptor.Append((TUint8*)&(aSeg->iSize),4);
-    iSampleDescriptor.Append((TUint8*)&(this->gppSamplerData->sampleNumber),4);
-    iSample[0] = iSampleDescriptor.Size();
-    
-    iSampleBuffer->AddSample(iSample,iSampleDescriptor.Size()+1);
-    return ETrue;
-    }
-// end of file
--- a/piprofiler/plugins/GeneralsPlugin/src/IttSamplerImpl.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +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 <piprofiler/ProfilerVersion.h>
-
-#include <kern_priv.h>
-#include <plat_priv.h>
-
-#include "IttSamplerImpl.h"
-
-#ifdef ITT_EVENT_HANDLER
-_LIT8(KIttVersion, "2.00");
-#else
-_LIT8(KIttVersion, "1.22");
-#endif
-
-/*
- *	ITT sampler definition
- *  	
- */
-IttSamplerImpl::IttSamplerImpl():
-        sampleDescriptor(&(this->sample[1]),0,KITTSampleBufferSize)
-{
-	this->currentLibCount = 0;
-	iTimeToSample = EFalse;
-	this->Reset();
-}
-
-/*
- * destructor
- */
-IttSamplerImpl::~IttSamplerImpl()
-{
-
-}
-
-/*
- * IttSamplerImpl::CreateFirstSample()
- * 
- * Function for creating the first sample to the log file
- */
-TInt IttSamplerImpl::CreateFirstSample() 
-{	
-    Kern::Printf("ittSamplerImpl::createFirstSample\n");
-	this->iVersionData.Zero();
-	this->iVersionData.Append(_L8("Bappea_ITT_V"));
-	this->iVersionData.Append(KIttVersion);
-	this->itt_sample = (TUint8*)iVersionData.Ptr();
-	return iVersionData.Length();
-}
-
-/*
- * IttSamplerImpl::SampleNeeded(TUint32 sampleNum)
- * 
- * @param TUint32 Sample number
- * 
- */
-TBool IttSamplerImpl::SampleNeeded(TUint32 sampleNum)
-{
-#ifdef ITT_EVENT_HANDLER
-    iCount++;
-    if (iCount <= iIttSamplingPeriod && ((iCount % iIttSamplingPeriod) == 0 || (iCount % iIttSamplingPeriodDiv2) == 0))
-    {
-        LOGSTRING2("IttSamplerImpl::SampleNeeded - time: %d", iCount);
-        iTimeToSample = true;
-#else
-    // no need to do anything, always a good time to sample.
-    // Sample time filtering is done in IttSamplerImpl:SampleImpl() function
-#endif
-        return true;
-#ifdef ITT_EVENT_HANDLER    
-    }
-    else 
-    {
-        return false;
-    }
-#endif
-}
-
-/*
- * IttSamplerImpl::SampleImpl(TUint32 pc, TUint32 sampleNum)
- * 
- * @param TUint32 program counter
- * @param TUint32 sample number
- */
-TInt IttSamplerImpl::SampleImpl(TUint32 pc,TUint32 sampleNum)
-{	
-    // in order to avoid overloading the interrupt
-	// only one dynamic file in each 50ms is added to the stream
-	// with the application of the tool in mind, this is
-	// a reasonable measure
-
-    // encode a process binary
-    sampleDescriptor.Zero();
-	// original 
-	if((sampleNum % 20) != 0) return 0;
-	if((sampleNum % 40) == 0)
-	{
-		// encode a library binary
-		sampleDescriptor.Zero();
-		DObjectCon* libs = Kern::Containers()[ELibrary];
-		TInt libCount = libs->Count();
-		
-		// go 20 binaries through at a time
-		for(TInt i=0;i<20;i++)
-		{
-			if(currentLibCount >= libCount)
-			{
-				currentLibCount = 0;
-			}
-			
-			DLibrary* lib = (DLibrary*)(*libs)[currentLibCount];
-			currentLibCount++;
-			
-			DCodeSeg* seg = lib->iCodeSeg;
-			if(seg != 0)
-			{
-				if( (seg->iMark & 0x80) == 0)
-				{
-					this->sample[0] = seg->iFileName->Length();
-					sampleDescriptor.Append(*(seg->iFileName));
-					sampleDescriptor.Append((TUint8*)&(seg->iRunAddress),4);
-					sampleDescriptor.Append((TUint8*)&(seg->iSize),4);
-#ifdef ITT_EVENT_HANDLER
-					sampleDescriptor.Append((TUint8*)&(sampleNum),4);
-					//Kern::Printf("DLL: NM %S : RA:0x%x SZ:0x%x, SN:0x%x",seg->iFileName,seg->iRunAddress,seg->iSize, sampleNum);
-					this->iFirstSampleTaken = ETrue;
-#else
-		            //Kern::Printf("DLL: NM %S : RA:0x%x SZ:0x%x",seg->iFileName,seg->iRunAddress,seg->iSize);
-#endif
-					seg->iMark = (seg->iMark | 0x80);
-					
-					this->sample[0] = sampleDescriptor.Size();
-					return sampleDescriptor.Size()+1;
-				}
-			}
-		}
-	} else
-	{
-		SDblQue* codeSegList = Kern::CodeSegList();
-		//Kern::Printf("PI");
-		//TUint c = 0;
-		// the global list
-		for (SDblQueLink* codeseg= codeSegList->First(); codeseg!=(SDblQueLink*) codeSegList; codeseg=codeseg->iNext)
-		{				
-			DCodeSeg* seg = _LOFF(codeseg, DCodeSeg, iLink);
-			if(seg != 0)
-			{
-				if( (seg->iMark & 0x80) == 0)
-				{
-					this->sample[0] = seg->iFileName->Length();
-					sampleDescriptor.Append(*(seg->iFileName));
-					sampleDescriptor.Append((TUint8*)&(seg->iRunAddress),4);
-					sampleDescriptor.Append((TUint8*)&(seg->iSize),4);
-#ifdef ITT_EVENT_HANDLER
-                    sampleDescriptor.Append((TUint8*)&(sampleNum),4);
-                    //Kern::Printf("EXE2: NM %S : RA:0x%x SZ:0x%x, time: %d",seg->iFileName,seg->iRunAddress,seg->iSize, sampleNum);
-                    this->iFirstSampleTaken = ETrue;                    
-#else
-					//Kern::Printf("EXE2: NM %S : RA:0x%x SZ:0x%x, time: %d",seg->iFileName,seg->iRunAddress,seg->iSize, sampleNum);
-#endif					
-					seg->iMark = (seg->iMark | 0x80);
-					
-					this->sample[0] = sampleDescriptor.Size();
-					return sampleDescriptor.Size()+1;
-				}
-			}
-		}	
-	}
-	return 0;
-}
-
-/*
- * IttSamplerImpl::Reset()
- */
-void IttSamplerImpl::Reset()
-{
-    iTimeToSample = EFalse;
-#ifdef ITT_EVENT_HANDLER
-    iFirstSampleTaken = EFalse;
-#endif
-	this->currentLibCount = 0;
-	this->itt_sample = (TUint8*)&(this->sample[0]);
-	sampleDescriptor.Zero();
-
-//	#ifdef ITT_TEST	
-	SDblQue* codeSegList = Kern::CodeSegList();
-	// the global list
-	for (SDblQueLink* codeseg= codeSegList->First(); codeseg!=(SDblQueLink*) codeSegList; codeseg=codeseg->iNext)
-	{				
-		DCodeSeg* seg = _LOFF(codeseg,DCodeSeg, iLink);
-		//if(seg != 0)
-		{
-			if( (seg->iMark & 0x80) > 0)
-			{
-				seg->iMark = (seg->iMark & ~0x80);
-			}
-		}
-	}	
-	// the garbage list
-	DObjectCon* libs = Kern::Containers()[ELibrary];
-	TInt libCount = libs->Count();
-	for(TInt i=0;i<libCount;i++)
-	{
-		DLibrary* lib = (DLibrary*)(*libs)[i];
-		DCodeSeg* seg = lib->iCodeSeg;
-		if( (seg->iMark & 0x80) > 0)
-		{
-			seg->iMark = (seg->iMark & ~0x80);
-		}
-	}
-	
-	DObjectCon* procs = Kern::Containers()[EProcess];
-	TInt procCount = procs->Count();
-	for(TInt i=0;i<procCount;i++)
-	{
-		DProcess* pro = (DProcess*)(*procs)[i];
-		DCodeSeg* seg = pro->iCodeSeg;
-		if(seg != 0)
-		{
-			if( (seg->iMark & 0x80) > 0)
-			{
-				seg->iMark = (seg->iMark & ~0x80);
-			}
-		}
-	}
-	//#endif   //ITT_TEST
-}
-// end of file
--- a/piprofiler/plugins/GeneralsPlugin/src/MemSamplerImpl.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,976 +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 <piprofiler/ProfilerVersion.h>
-#include <piprofiler/ProfilerTraces.h>
-
-#include <kern_priv.h>
-#include <plat_priv.h>
-
-#include "MemSamplerImpl.h"
-
-// for testing precise stack utilization tracing...
-// crashes at the moment
-
-#include <nk_cpu.h>
-
-#if !defined(__NKERN_H__)
-#include <nkern.h>
-#endif 
-
-#define TAG(obj) (*(TUint32*)&(obj->iAsyncDeleteNext))
-#define PROFILER_CHUNK_MARK		((TUint32)0x00001000)
-#define PROFILER_MEM_THREAD_MARK	((TUint32)0x00000001)
-#define PROFILER_LIBRARY_MARK    ((TUint32)0x10000000)
-#define PROFILER_MEM_THREAD_UNMARK  ~PROFILER_MEM_THREAD_MARK
-
-#ifdef MEM_EVENT_HANDLER
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-_LIT8(KMemVersion,"2.03");
-#else
-_LIT8(KMemVersion, "2.02");
-#endif
-#else
-_LIT8(KMemVersion, "1.56");
-#endif
-
-DMemSamplerImpl::DMemSamplerImpl() :
-	sampleDescriptor(&(this->sample[1]),0,256)
-    {
-    LOGSTRING("MemSamplerImpl::MemSamplerImpl() - konstruktori");
-
-	iCount = 0;
-		
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-	iSampleType = ESampleThreads;
-#else
-	iSampleThreads = true;
-#endif
-	iTimeToSample = false;
-	
-	iTotalMemoryOk = false;
-	iTotalMemoryNameOk = false;
-	
-	iNewChunkCount = 0;
-	iChunkCount = 0;
-	iChunksProcessing = ENothingToProcess;
-    iThreadsProcessing = ENothingToProcess;
-	
-	iNewThreadCount = 0;
-	iThreadCount = 0;
-	
-	// reset data structures
-    for(TInt i(0);i<KProfilerMaxChunksAmount;i++)
-        {
-        // heap chunks
-        this->heapChunksToSample[i] = 0;
-        this->heapChunkNamesToReport[i] = 0;
-        }
-    
-    for(TInt i(0);i<KProfilerMaxThreadsAmount;i++)
-        {
-        // threads
-        this->threadsToSample[i] = 0;
-        this->threadNamesToReport[i] = 0;
-        }
-    
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-    iLibrariesProcessing = ENothingToProcess;
-    iNewLibraryCount = 0;
-    iLibraryCount = 0;
-    
-    for(TInt i(0); i<KProfilerMaxLibrariesAmount; i++)
-        {
-        // libraries
-        this->librariesToSample[i] = 0;
-        this->libraryNamesToReport[i] = 0;
-        }
-#endif
-
-    }
-
-DMemSamplerImpl::~DMemSamplerImpl()
-    {
-
-    }
-
-TInt DMemSamplerImpl::CreateFirstSample()
-    {
-    LOGSTRING("MemSamplerImpl::CreateFirstSample - entry");
-	
-	this->sampleDescriptor.Zero();
-	this->sampleDescriptor.Append(_L8("Bappea_V"));
-	this->sampleDescriptor.Append(KMemVersion);
-	this->sampleDescriptor.Append(_L8("_MEM"));
-	
-	sample[0] = this->sampleDescriptor.Size();
-
-	LOGSTRING("MemSamplerImpl::CreateFirstSample - exit");
-
-	return (TInt)(sample[0]+1);
-    }
-
-TBool DMemSamplerImpl::SampleNeeded()
-    {
-	iCount++;
-#ifdef MEM_EVENT_HANDLER
-    // make the collection of chunks/threads only once, rest will be collected with mem event handler
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-	if (iCount <= iMemSamplingPeriod && ((iCount % iMemSamplingPeriod) == 0 || (iCount % iMemSamplingPeriodDiv3) == 0))
-#else
-    if (iCount <= iMemSamplingPeriod && ((iCount % iMemSamplingPeriod) == 0 || (iCount % iMemSamplingPeriodDiv2) == 0))
-#endif
-#else
-	if ((iCount % iMemSamplingPeriod) == 0 || (iCount % iMemSamplingPeriodDiv2) == 0)
-#endif
-	    {
-        LOGSTRING2("MemSamplerImpl::SampleNeeded - time: %d", iCount);
-		iTimeToSample = true;
-		return true;
-        }
-	else 
-	    {
-		return false;
-        }
-
-    }
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-TInt DMemSamplerImpl::SampleImpl()
-    {    
-    // Sample threads:
-    if( iSampleType == ESampleThreads )
-        {    
-        if(this->iThreadsProcessing == ENothingToProcess )
-            {     
-            if(!iTimeToSample)
-                {
-                return 0;
-                }
-            else
-                {
-                iTimeToSample = false;
-                // gather first all thread stacks
-                return GatherThreads();
-                }
-            }
-        else
-            {
-            // process now thread stack list
-            TInt length = this->ProcessThreads();
-
-            if(length == 0)
-                {
-                this->iThreadsProcessing = ENothingToProcess;
-                // switch to collect chunk data
-                iSampleType = ESampleChunks;
-                }
-            return length;
-            }
-        }
-
-    // Sample chunks:
-    if( iSampleType == ESampleChunks )
-        {
-        if(this->iChunksProcessing == ENothingToProcess)
-            {
-            if(!iTimeToSample)
-                {
-                return 0;
-                }
-            else
-                {
-                iTimeToSample = false;
-                // gather first all chunks
-                return GatherChunks();
-                }
-            }
-        else
-            {
-            // still something to go through in lists
-            TInt length = this->ProcessChunks();
-        
-            if(length == 0) 
-            {
-                this->iChunksProcessing = ENothingToProcess;
-                // switch to collect library data
-                iSampleType = ESampleLibraries;
-                //iSampleThreads = true;
-            }
-            return length;
-            }
-        }
-        
-    // Sample libraries:
-    if( iSampleType == ESampleLibraries )
-        {
-        if(this->iLibrariesProcessing == ENothingToProcess )
-            {        
-            if(!iTimeToSample)
-                {             
-                return 0;
-                }
-            else
-                {
-                iTimeToSample = false;
-                // gather libraries
-                return GatherLibraries();
-                }
-            }
-        else
-            {
-            // process now thread stack list
-            TInt length = this->ProcessLibraries();
-            if(length == 0)
-                {
-                this->iLibrariesProcessing = ENothingToProcess;
-                // switch to collect chunk data
-                iSampleType = ESampleThreads;
-                }
-            return length;
-            }
-        }
-
-    // should not reach this point...
-    return 0;
-    }
-#else
-TInt DMemSamplerImpl::SampleImpl()
-    {
-    // check if either chunk or thread lists have unprocessed items
-    if(this->iChunksProcessing == ENothingToProcess && !iSampleThreads)
-        {
-        if(!iTimeToSample)
-            {
-            return 0;
-            }
-        else
-            {
-            iTimeToSample = false;
-            // gather first all chunks
-            return GatherChunks();
-            }
-        }
-    else if(!iSampleThreads)
-        {
-        // still something to go through in lists
-        TInt length = this->ProcessChunks();
-        
-        if(length == 0) 
-            {
-            this->iChunksProcessing = ENothingToProcess;
-            // switch to collect thread data
-            iSampleThreads = true;
-            }
-        return length;
-        }
-    
-    if(this->iThreadsProcessing == ENothingToProcess && iSampleThreads)
-        {
-        if(!iTimeToSample)
-            {
-            return 0;
-            }
-        else
-            {
-            iTimeToSample = false;
-            // gather first all thread stacks
-            return GatherThreads();
-            }
-        }
-    
-    else if(iSampleThreads)
-        {
-        // process now thread stack list
-        TInt length = this->ProcessThreads();
-
-        if(length == 0)
-            {
-            this->iThreadsProcessing = ENothingToProcess;
-            // switch to collect chunk data
-            iSampleThreads = false;
-            }
-        return length;
-        }
-
-    // should not reach this point...
-    return 0;
-    }
-#endif
-
-inline TInt DMemSamplerImpl::GatherChunks()
-    {
-    // encode a process binary
-    name.Zero();
-    
-    NKern::ThreadEnterCS(); // Prevent us from dying or suspending whilst holding a DMutex
-    DObjectCon& chunks = *Kern::Containers()[EChunk];
-    chunks.Wait();  // Obtain the container mutex so the list does get changed under us
-    
-    this->iChunkCount = 0; 
-    this->iNewChunkCount = 0;
-    this->iTotalMemoryOk = false;
-    TInt totalChunkCount(chunks.Count());
-    DChunk* c; 
-    
-    for(TInt i(0);i<totalChunkCount;i++)
-        {
-        c = (DChunk*)(chunks)[i];
-
-        LOGSTRING3("Processing chunk %d, tag: 0x%x",i,TAG(c));
-        
-        if( (TAG(c) & 0x0000ffff) != PROFILER_CHUNK_MARK)
-            {
-            LOGSTRING4("Marking chunk %d/%d, old tag 0x%x",i,(totalChunkCount-1), TAG(c));
-            // this chunk has not been tagged yet
-            name.Zero();
-            c->TraceAppendName(name,false);
-            const TUint8* ptr = name.Ptr();
-            
-            TAG(c) = (PROFILER_CHUNK_MARK);
-            this->heapChunkNamesToReport[iNewChunkCount] = c;
-            iNewChunkCount++;
-            }
-
-        // the chunk has been tagged, add heap chunks to the list
-        this->heapChunksToSample[this->iChunkCount] = c;
-        this->iChunkCount++;
-        LOGSTRING2("Added chunk %d to Chunks",i);
-        }
-
-    if(this->iChunkCount > 0 || this->iNewChunkCount > 0)
-        {
-        this->iChunksProcessing = EStartingToProcess;
-        
-        // process the first sample
-        TInt length = this->ProcessChunks();
-        
-        if(length == 0)
-            {
-            this->iChunksProcessing = ENothingToProcess;
-            }
-    
-        chunks.Signal();  // Release the container mutex
-        NKern::ThreadLeaveCS();  // End of critical section
-        return length;
-        }
-
-    LOGTEXT("MemSamplerImpl::SampleImpl - Error, no threads"); 
-    chunks.Signal();  // Release the container mutex
-    NKern::ThreadLeaveCS();  // End of critical section
-    return 0;
-    }
-
-inline TInt DMemSamplerImpl::GatherThreads()
-    {
-    // The thread memory consumption
-    
-    NKern::ThreadEnterCS(); // Prevent us from dying or suspending whilst holding a DMutex
-    DObjectCon& threads = *Kern::Containers()[EThread];
-    threads.Wait(); // Obtain the container mutex so the list does get changed under us
-    
-    this->iThreadCount = 0; 
-    this->iNewThreadCount = 0;
-    this->iTotalMemoryOk = false;           
-
-    TInt totalThreadCount = threads.Count();
-
-    for(TInt i(0);i<totalThreadCount;i++)
-        {
-        DThread* t = (DThread*)(threads)[i];
-
-        LOGSTRING3("Processing thread %d, tag: 0x%x",i,TAG(t));
-
-        if( (TAG(t) & PROFILER_MEM_THREAD_MARK) == 0)
-            {
-            LOGSTRING4("Marking thread %d/%d, old tag 0x%x",i,(totalThreadCount-1), TAG(t));
-            // this thread's chunk has not been reported yet
-            this->threadNamesToReport[iNewThreadCount] = t;
-            iNewThreadCount++;
-            // tag the thread
-            TAG(t) |= PROFILER_MEM_THREAD_MARK;
-            }
-
-        // the chunk has been tagged, add heap chunks to the list
-        this->threadsToSample[this->iThreadCount] = t;
-        this->iThreadCount++;
-        LOGSTRING2("Added thread %d to threads to sample",i);
-        }
-    
-    if(this->iThreadCount > 0 || this->iNewThreadCount > 0)
-        {
-        this->iThreadsProcessing = EStartingToProcess;
-        
-        // process the first sample
-        TInt length = this->ProcessThreads();
-        
-        if(length == 0)
-            {
-            this->iThreadsProcessing = ENothingToProcess;
-            }
-        threads.Signal();  // Release the container mutex
-        NKern::ThreadLeaveCS();  // End of critical section
-        return length;
-        }
-    
-    LOGTEXT("MemSamplerImpl::SampleImpl - Error, no threads"); 
-    threads.Signal();  // Release the container mutex
-    NKern::ThreadLeaveCS();  // End of critical section
-    return 0;
-    }
-
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-
-inline TInt DMemSamplerImpl::GatherLibraries()
-    {
-    LOGTEXT("MemSamplerImpl::GatherLibraries() - entry");
-    // encode a process binary
-    name.Zero();
-    
-    NKern::ThreadEnterCS(); // Prevent us from dying or suspending whilst holding a DMutex
-    DObjectCon& libs = *Kern::Containers()[ELibrary];
-    libs.Wait();  // Obtain the container mutex so the list does get changed under us
-    
-    this->iLibraryCount = 0; 
-    this->iNewLibraryCount = 0;
-    this->iTotalMemoryOk = false;
-    TInt totalLibCount(libs.Count());
-    DLibrary* l; 
-    
-    for(TInt i(0);i<totalLibCount;i++)
-        {
-        l = (DLibrary*)(libs)[i];
-
-        LOGSTRING3("Processing library %d, tag: 0x%x",i,TAG(l));
-        
-        if( (TAG(l) & 0xffffffff) != PROFILER_LIBRARY_MARK)
-            {
-            LOGSTRING4("Marking library %d/%d, old tag 0x%x",i,(totalLibCount-1), TAG(l));
-            // this library has not been tagged yet
-            name.Zero();
-            l->TraceAppendName(name,false);
-            const TUint8* ptr = name.Ptr();
-            
-            TAG(l) = (PROFILER_LIBRARY_MARK);
-            this->libraryNamesToReport[iNewLibraryCount] = l;
-            iNewLibraryCount++;
-            }
-
-        // the library has been tagged, add library to the list
-        this->librariesToSample[this->iLibraryCount] = l;
-        this->iLibraryCount++;
-        LOGSTRING2("Added library %d to Libraries",i);
-        }
-
-    if(this->iLibraryCount > 0 || this->iNewLibraryCount > 0)
-        {
-        this->iLibrariesProcessing = EStartingToProcess;
-        
-        // process the first sample
-        TInt length = this->ProcessLibraries();
-        
-        if(length == 0)
-            {
-            this->iLibrariesProcessing = ENothingToProcess;
-            }
-    
-        libs.Signal();  // Release the container mutex
-        NKern::ThreadLeaveCS();  // End of critical section
-        return length;
-        }
-
-    LOGTEXT("MemSamplerImpl::SampleImpl - Error, no libraries"); 
-    libs.Signal();  // Release the container mutex
-    NKern::ThreadLeaveCS();  // End of critical section
-    return 0;
-    }
-#endif
-
-inline TInt DMemSamplerImpl::ProcessChunks()
-    {
-    if(iNewChunkCount > 0)
-        {
-        if(this->iChunksProcessing == EStartingToProcess)
-            {
-            // this is the first sample, encode a code for names
-            this->iChunksProcessing = EProcessingNames;
-            return EncodeNameCode();
-            }
-
-        if(iTotalMemoryNameOk == false)
-            {
-            return EncodeTotalMemoryName();
-            }
-        
-        // there are new chunk names to report
-        iNewChunkCount--;
-        DChunk* c = this->heapChunkNamesToReport[iNewChunkCount];
-        return EncodeChunkName(*c);
-        
-        }
-    else if(iChunkCount > 0)
-        {
-        if(this->iChunksProcessing == EProcessingNames || this->iChunksProcessing == EStartingToProcess)
-            {
-            // this is the first data sample, encode a code for data
-            this->iChunksProcessing = EProcessingData;
-            return EncodeDataCode();
-            }
-        
-        if(this->iTotalMemoryOk == false)
-            {
-            return EncodeTotalMemory();	
-            }
-
-        // there are no new chunks to report
-        // thus generate the real report
-        iChunkCount--;
-        DChunk* c = this->heapChunksToSample[iChunkCount];
-        return EncodeChunkData(*c);
-        }
-    else
-        {
-        // everything is processed
-        LOGSTRING2(" Chunks processed! Chunk count = %d", iChunkCount);
-#ifdef MEM_EVENT_HANDLER
-        this->iChunksGathered = true;
-        Kern::Printf("MemSamplerImpl::ProcessChunks() - chunks gathered! Time: %d",iCount);
-#endif
-        return 0;
-        }
-    }
-
-inline TInt DMemSamplerImpl::ProcessThreads()
-    {
-
-    if(iNewThreadCount > 0)
-        {
-        if(this->iThreadsProcessing == EStartingToProcess)
-            {
-            // this is the first sample, encode a code for names
-            this->iThreadsProcessing = EProcessingNames;
-            return EncodeNameCode();
-            }
-        
-        if(iTotalMemoryNameOk == false)
-            {
-            return EncodeTotalMemoryName();
-            }
-
-        iNewThreadCount--;
-        DThread* t = this->threadNamesToReport[iNewThreadCount];
-        return EncodeChunkName(*t);
-        }
-    else if(iThreadCount > 0)
-        {
-        if(this->iThreadsProcessing == EProcessingNames || this->iThreadsProcessing == EStartingToProcess)
-            {
-            // this is the first data sample, encode a code for data
-            this->iThreadsProcessing = EProcessingData;
-            return EncodeDataCode();
-            }
-
-        if(this->iTotalMemoryOk == false)
-            {
-            return EncodeTotalMemory(); 
-            }
-
-        // there are no new threads to report
-        // thus generate the real report
-        iThreadCount--;
-        DThread* t = this->threadsToSample[iThreadCount];
-        return EncodeChunkData(*t);
-        }
-    else
-        {   
-        // everything is processed
-        LOGSTRING2(" Threads processed! Thread count = %d", iThreadCount);
-#ifdef MEM_EVENT_HANDLER
-        this->iThreadsGathered = true;
-        Kern::Printf("MemSamplerImpl::ProcessThreads() - threads gathered! Time: %d", iCount);
-#endif
-        return 0;
-        }
-    }
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-inline TInt DMemSamplerImpl::ProcessLibraries()
-    {
-    LOGTEXT("ProcessLibraries - entry");
-    if(iNewLibraryCount > 0)
-        {
-        if(this->iLibrariesProcessing == EStartingToProcess)
-            {
-            // this is the first sample, encode a code for names
-            this->iLibrariesProcessing = EProcessingNames;
-            return EncodeNameCode();
-            }
-
-        if(iTotalMemoryNameOk == false)
-            {
-            return EncodeTotalMemoryName();
-            }
-        
-        // there are new library names to report
-        iNewLibraryCount--;
-        DLibrary* l = this->libraryNamesToReport[iNewLibraryCount];
-        return EncodeChunkName(*l);
-        
-        }
-    else if(iLibraryCount > 0)
-        {
-        if(this->iLibrariesProcessing == EProcessingNames || this->iLibrariesProcessing == EStartingToProcess)
-            {
-            // this is the first data sample, encode a code for data
-            this->iLibrariesProcessing = EProcessingData;
-            return EncodeDataCode();
-            }
-        
-        if(this->iTotalMemoryOk == false)
-            {
-            return EncodeTotalMemory(); 
-            }
-
-        // there are no new libraries to report
-        // thus generate the real report
-        iLibraryCount--;
-        DLibrary* l = this->librariesToSample[iLibraryCount];
-        return EncodeChunkData(*l);
-        }
-    else
-        {
-        // everything is processed
-        LOGSTRING2(" Libraries processed! Library count = %d", iLibraryCount);
-
-        this->iLibrariesGathered = true;
-        Kern::Printf("MemSamplerImpl::ProcessLibraries() - libraries gathered! Time: %d",iCount);
-
-        return 0;
-        }
-    }
-#endif
-inline TInt DMemSamplerImpl::EncodeNameCode()
-    {
-	sample[0] = 1;
-	sample[1] = 0xaa;
-	return 2;
-    }
-
-inline TInt DMemSamplerImpl::EncodeDataCode()
-    {
-	sample[0] = 1;
-	sample[1] = 0xdd;
-	return 2;
-    }
-
-inline TInt DMemSamplerImpl::EncodeTotalMemoryName()
-    {
-	this->iTotalMemoryNameOk = true;
-	
-	TUint8* size = &sample[0];
-	*size = 0;
-		
-	// encode name
-	this->sampleDescriptor.Zero();
-	this->sampleDescriptor.Append(_L("TOTAL_MEMORY"));
-	*size += this->sampleDescriptor.Size();
-		
-	// add id here
-	TUint32 id(0xbabbeaaa);
-	this->sampleDescriptor.Append((TUint8*)&(id),sizeof(TUint32));
-	*size += sizeof(TUint32);
-	
-	// the size is the descriptor length + the size field
-	return ((TInt)(*size))+1;	
-    }
-
-inline TInt DMemSamplerImpl::EncodeTotalMemory()
-    {	
-	
-	TUint8* size = &sample[0];
-	*size = 0;
-
-	NKern::LockSystem();
-	TInt freeRam = Kern::FreeRamInBytes();
-	TInt totalRam = Kern::SuperPage().iTotalRamSize;
-	NKern::UnlockSystem();
-
-	this->sampleDescriptor.Zero();
-	
-	TUint32 id(0xbabbeaaa);
-	TInt zero(0);
-		
-	this->sampleDescriptor.Append((TUint8*)&(id),sizeof(TUint32));
-	*size += sizeof(TUint);
-	
-	this->sampleDescriptor.Append((TUint8*)&(totalRam),sizeof(TInt));
-	*size += sizeof(TInt);
-		
-	// append the cell amount allocated
-	this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-	*size += sizeof(TInt);
-	
-	// append the chunk size
-	this->sampleDescriptor.Append((TUint8*)&(freeRam),sizeof(TInt));
-	*size += sizeof(TInt);
-		
-	// append the thread user stack size
-	this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-	*size += sizeof(TInt);
-
-	this->iTotalMemoryOk = true;
-
-	return ((TInt)(*size))+1;
-    }
-
-inline TInt DMemSamplerImpl::EncodeChunkName(DChunk& c)
-    {	
-	// the size of the following name is in the first byte
-	TUint8* size = &sample[0];
-	*size = 0;
-		
-	// encode chunk name
-	this->sampleDescriptor.Zero();
-	this->sampleDescriptor.Append(_L("C_"));
-	c.TraceAppendFullName(this->sampleDescriptor,false);
-	*size += this->sampleDescriptor.Size();
-		
-	// add chunk object address here
-	TUint32 chunkAddr((TUint32)&c);
-	this->sampleDescriptor.Append((TUint8*)&(chunkAddr),sizeof(TUint32));
-	*size += sizeof(TUint32);
-
-	// the size is the descriptor length + the size field
-	LOGSTRING2("Non-Heap Chunk Name - %d",*size);
-	return ((TInt)(*size))+1;			
-    }
-
-inline TInt DMemSamplerImpl::EncodeChunkName(DThread& t)
-    {		
-	// the size of the following name is in the first byte
-	TUint8* size = &sample[0];
-	*size = 0;
-	this->sampleDescriptor.Zero();
-	
-	this->sampleDescriptor.Append(_L("T_"));
-	t.TraceAppendFullName(this->sampleDescriptor,false);
-	*size += this->sampleDescriptor.Size();
-	
-	// copy the 4 bytes from the thread id field
-	this->sampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
-	*size += sizeof(TUint);
-
-	// the size is the descriptor length + the size field
-	LOGSTRING2("Name - %d",*size);
-	return ((TInt)(*size))+1;
-    }
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-inline TInt DMemSamplerImpl::EncodeChunkName(DLibrary& l)
-    {   
-    // the size of the following name is in the first byte
-    TUint8* size = &sample[0];
-    *size = 0;
-        
-    // encode library name
-    this->sampleDescriptor.Zero();
-    this->sampleDescriptor.Append(_L("L_"));
-    l.TraceAppendFullName(this->sampleDescriptor,false);
-    *size += this->sampleDescriptor.Size();
-        
-    // add chunk object address here
-    TUint32 libAddr((TUint32)&l);
-    this->sampleDescriptor.Append((TUint8*)&(libAddr),sizeof(TUint32));
-    *size += sizeof(TUint32);
-
-    // the size is the descriptor length + the size field
-    LOGSTRING2("Name - %d",*size);
-    return ((TInt)(*size))+1;           
-    }
-#endif
-inline TInt DMemSamplerImpl::EncodeChunkData(DChunk& c)
-    {
-	// the size of the following name is in the first byte
-	TUint8* size = &sample[0];
-	*size = 0;
-	this->sampleDescriptor.Zero();
-	TInt zero(0);
-
-	TUint32 address((TUint32)&c);
-		
-	this->sampleDescriptor.Append((TUint8*)&address,sizeof(TUint32));
-	*size += sizeof(TUint);
-	
-	// copy the total amount of memory allocated
-	this->sampleDescriptor.Append((TUint8*)&(c.iSize),sizeof(TInt));
-	*size += sizeof(TInt);
-		
-	// append the cell amount allocated
-	this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-	*size += sizeof(TInt);
-	
-	// append the chunk size
-	this->sampleDescriptor.Append((TUint8*)&(c.iSize),sizeof(TUint));
-	*size += sizeof(TUint);
-		
-	// append the thread user stack size
-	this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-	*size += sizeof(TInt);
-
-	LOGSTRING2("Data - %d",*size);
-	return ((TInt)(*size))+1;
-
-    }
-
-inline TInt DMemSamplerImpl::EncodeChunkData(DThread& t)
-    {
-	LOGTEXT("MemSamplerImpl::EncodeChunkData - entry");
-	//LOGSTRING2("MemSamplerImpl::EncodeChunkData - processing thread 0x%x ",&t);
-		
-	// the size of the following name is in the first byte
-	TUint8* size = &sample[0];
-	*size = 0;
-	this->sampleDescriptor.Zero();
-
-	LOGTEXT("MemSamplerImpl::EncodeChunkData - cleared");
-
-	this->sampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
-	*size += sizeof(TUint);
-		
-	// copy the total amount of memory allocated for user side stack
-	this->sampleDescriptor.Append((TUint8*)&(t.iUserStackSize),sizeof(TInt));
-	*size += sizeof(TInt);
-
-	TInt zero(0);		
-	// append the cell amount allocated (zero, not in use here)
-	this->sampleDescriptor.Append((TUint8*)&zero,sizeof(TInt));
-	*size += sizeof(TInt);
-	
-	// append the chunk size (this is not a chunk)
-	this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TUint));
-	*size += sizeof(TUint);
-
-	// append user stack (max) size
-	this->sampleDescriptor.Append((TUint8*)&(t.iUserStackSize),sizeof(TInt));
-	*size += sizeof(TInt);
-
-	LOGSTRING2("Data -> %d",*size);
-	return ((TInt)(*size))+1;
-    }
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-inline TInt DMemSamplerImpl::EncodeChunkData(DLibrary& l)
-    {
-    LOGTEXT("MemSamplerImpl::EncodeChunkData (Library) - entry");
-    // the size of the following name is in the first byte
-    TUint8* size = &sample[0];
-    *size = 0;
-    this->sampleDescriptor.Zero();
-    
-    TUint32 address((TUint32)&l);
-        
-    this->sampleDescriptor.Append((TUint8*)&address,sizeof(TUint32));
-    *size += sizeof(TUint);
-             
-	this->sampleDescriptor.Append((TUint8*)&(l.iCodeSeg->iSize),sizeof(TUint32));
-    *size += sizeof(TInt); 
-             
-    this->sampleDescriptor.Append((TUint8*)&(l.iMapCount),sizeof(TInt));
-    *size += sizeof(TInt);  
-        
-    TInt zero(0);   
-    this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-    *size += sizeof(TInt);   
-        
-    this->sampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-    *size += sizeof(TInt);   
-
-    LOGSTRING2("LData - %d",*size);
-    return ((TInt)(*size))+1;
-
-    }
-#endif
-void DMemSamplerImpl::Reset()
-    {
-	Kern::Printf("MemSamplerImpl::Reset");
-	iCount = 0; // sample threads 1 cycle after actual MEM sample time...
-    this->iTimeToSample = false;
-    this->iChunkCount = 0;
-	this->iNewChunkCount = 0;
-	
-	this->iTotalMemoryOk = false;
-	this->iTotalMemoryNameOk = false;
-
-	this->iChunksProcessing = ENothingToProcess;
-    this->iThreadsProcessing = ENothingToProcess;
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-    this->iLibrariesProcessing = ENothingToProcess;
-    this->iSampleType = ESampleThreads;
-#else
-    this->iSampleThreads = true;
-#endif
-    
-	this->sampleDescriptor.Zero();
-	
-	// clear all chunk tags
-    NKern::ThreadEnterCS(); // Prevent us from dying or suspending whilst holding a DMutex
-	DObjectCon* chunks = Kern::Containers()[EChunk];
-    chunks->Wait(); // Obtain the container mutex so the list does get changed under us
-
-	TInt totalChunkCount = chunks->Count();
-	for(TInt i=0;i<totalChunkCount;i++)
-	    {
-		DChunk* c = (DChunk*)(*chunks)[i];
-		TAG(c) = 0;
-	    }
-	chunks->Signal();  // Release the container mutex
-
-	Kern::Printf("MemSamplerImpl::Reset");
-	this->iThreadCount = 0;
-	this->iNewThreadCount = 0;
-	this->sampleDescriptor.Zero();
-
-	// clear all chunk tags
-	DObjectCon* threads = Kern::Containers()[EThread];
-    threads->Wait(); // Obtain the container mutex so the list does get changed under us
-
-	TInt totalThreadCount = threads->Count();
-	for(TInt i=0;i<totalThreadCount;i++)
-	    {
-		DThread* t = (DThread*)(*threads)[i];
-		TAG(t) = (TAG(t) & 0xfffffffe);
-	    }
-	threads->Signal();  // Release the container mutex
-	
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-	this->iLibraryCount = 0;
-	this->iNewLibraryCount = 0;
-	this->sampleDescriptor.Zero();
-
-	// clear all library tags
-	DObjectCon* libs = Kern::Containers()[ELibrary];
-	libs->Wait(); // Obtain the container mutex so the list does get changed under us
-
-	TInt totalLibraryCount = libs->Count();
-	for(TInt i=0; i<totalLibraryCount; i++)
-	    {
-        DLibrary* l = (DLibrary*)(*libs)[i];
-        TAG(l) = (TAG(l) & 0xefffffff);
-	    }
-	libs->Signal();  // Release the container mutex
-#endif
-
-    NKern::ThreadLeaveCS();  // End of critical section
-    }
-
--- a/piprofiler/plugins/GeneralsPlugin/src/MemoryEventHandler.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,724 +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 <e32def.h>
-#include <e32cmn.h>
-#include <arm.h>
-#include <kernel.h>
-#include <kern_priv.h>
-#include <nk_trace.h>
-
-#include "MemoryEventHandler.h"
-
-
-DMemoryEventHandler::DMemoryEventHandler(DProfilerSampleBuffer* aSampleBuffer)
-    :   DKernelEventHandler(EventHandler, this), 
-        iSampleBuffer(aSampleBuffer), 
-        iSampleDescriptor(&(this->iSample[1]),0,256)
-    {
-//    Kern::Printf("DMemoryEventHandler::DMemoryEventHandler()");
-    iCount = 0;
-    iPreviousCount = 0;
-    }
-
-
-TInt DMemoryEventHandler::Create()
-    {
-//    Kern::Printf("DMemoryEventHandler::Create()");
-
-    TInt err(Kern::MutexCreate(iLock, _L("MemoryEventHandlerLock"), KMutexOrdGeneral0));
-    if (err != KErrNone)
-        return err;
-    
-    return Add();
-    }
-
-
-DMemoryEventHandler::~DMemoryEventHandler()
-    {
-//    Kern::Printf("DMemoryEventHandler::~DMemoryEventHandler()");
-
-    if (iLock)
-        iLock->Close(NULL);
-       
-    }
-
-
-TInt DMemoryEventHandler::Start()
-    {
-//    Kern::Printf("DMemoryEventHandler::Start()");
-
-    iTracking = ETrue;
-    return KErrNone;
-    }
-
-
-TInt DMemoryEventHandler::Stop()
-    {
-//    Kern::Printf("DMemoryEventHandler::Stop()");
-
-    iTracking = EFalse;
-    return KErrNone;
-    }
-
-TBool DMemoryEventHandler::SampleNeeded()
-    {
-    LOGTEXT("DMemoryEventHandler::SampleNeeded()");
-    
-    // increase the coutner by one on each round
-    iCount++;
-    
-    // check if event handler was not running
-//    if(!iTracking)
-//        return false; // return false
-    
-    return true;
-    }
-
-
-TUint DMemoryEventHandler::EventHandler(TKernelEvent aType, TAny* a1, TAny* a2, TAny* aThis)
-    {
-    return ((DMemoryEventHandler*)aThis)->HandleEvent(aType, a1, a2);
-    }
-
-
-
-TUint DMemoryEventHandler::HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2)
-    {
-    // debug
-//    Kern::Printf("New kernel event received, %d", aType);
-    
-    if (iTracking/* && iCount != iPreviousCount*/)
-        {
-//        iPreviousCount = iCount;
-        iCounters[aType]++;
-        switch (aType)
-            {
-            // capture only chunk creation, updates and destroyal
-            case EEventNewChunk:
-                {
-                DChunk* chunk = (DChunk*)a1;
-                HandleAddChunk(chunk);
-                break;
-                }
-            case EEventUpdateChunk:   
-                HandleUpdateChunk((DChunk*)a1);
-                break;
-            case EEventDeleteChunk:      
-                HandleDeleteChunk((DChunk*)a1);
-                break;
-//            case EEventAddProcess:
-//                Kern::Printf("Process added: 0x%08x", (DProcess*)a1);
-//                break;
-//            case EEventUpdateProcess:
-//                Kern::Printf("DProcess updated: 0x%08x", (DProcess*)a1);
-//                break;
-//            case EEventRemoveProcess:
-//                Kern::Printf("DProcess removed: 0x%08x", (DProcess*)a1);
-//                break;
-//            case EEventAddCodeSeg:
-//                Kern::Printf("DCodeSeg added: 0x%08x", (DCodeSeg*)a1);
-//                break;
-//            case EEventRemoveCodeSeg:
-//                Kern::Printf("DCodeSeg deleted: 0x%08x", (DCodeSeg*)a1);
-//                break;
-            case EEventAddThread:
-                HandleAddThread((DThread*)a1);
-                break;
-            case EEventUpdateThread:    // thread renaming
-                HandleUpdateThread((DThread*)a1);
-                break;
-//            case EEventKillThread:
-            case EEventRemoveThread:
-                HandleDeleteThread((DThread*)a1);
-                break;
-#ifdef MEM_EVENT_HANDLER_LIBRARY_EVENTS
-            case EEventAddLibrary:
-                HandleAddLibrary((DLibrary*)a1, (DThread*)a2);
-                break;
-            case EEventRemoveLibrary:
-                HandleDeleteLibrary((DLibrary*)a1);
-                break;
-#endif
-            
-            // ignore exception events
-            case EEventSwExc:
-            case EEventHwExc:
-         
-            default:
-                break;
-            }
-        }
-//    else if(iTracking && iCount == iPreviousCount)
-//        {
-//        // if time stamp is not updated profiling has stopped
-//        Stop();
-//        }
-    return DKernelEventHandler::ERunNext;
-    }
-
-TInt DMemoryEventHandler::EncodeNameCode()
-    {
-    iSample[0] = 1;
-    iSample[1] = 0xaa;
-    return 2;
-    }
-
-// encode mark for new chunk or thread
-TInt DMemoryEventHandler::EncodeNewCode()
-    {
-    iSample[0] = 1;
-    iSample[1] = 0xda;
-    return 2;
-    }
-
-// encode mark for update of chunk or thread
-TInt DMemoryEventHandler::EncodeUpdateCode()
-    {
-    iSample[0] = 1;
-    iSample[1] = 0xdb;
-    return 2;
-    }
-
-// encode mark for removal of chunk or thread
-TInt DMemoryEventHandler::EncodeRemoveCode()
-    {
-    iSample[0] = 1;
-    iSample[1] = 0xdc;
-    return 2;
-    }
-
-// encode the memory sample header in all memory changes
-TInt DMemoryEventHandler::AddHeader()
-    {
-    TInt err(KErrNone);
-    
-    TUint8 number(4);    // mem sampler id
-
-    // check if iCount bigger than previous, i.e. at least 1 ms has passed from the previous sample
-    if(iCount > iPreviousCount)
-        {
-        err = this->iSampleBuffer->AddSample(&number,1);
-        err = this->iSampleBuffer->AddSample((TUint8*)&(iCount),4);
-    
-        // add data chunk header
-        TInt length(EncodeUpdateCode());
-        err = iSampleBuffer->AddSample(iSample, length);
-        
-        // add total memory sample in the beginning of each sample
-        length = EncodeTotalMemory();
-        err = iSampleBuffer->AddSample(iSample, length);
-        AddFooter();    // end mark for total memory sample
-        }
-    iPreviousCount = iCount;
-    
-    // add actual sample
-    err = this->iSampleBuffer->AddSample(&number,1);
-    err = this->iSampleBuffer->AddSample((TUint8*)&(iCount),4);
-
-    return err;
-    }
-
-// encode the memory sample header in all memory changes
-TInt DMemoryEventHandler::AddFooter()
-    {
-    TInt err(KErrNone);
-    
-    TUint8 number(0);    // end mark
-    err = this->iSampleBuffer->AddSample(&number,1);
-    
-    return err;
-    }
-
-TInt DMemoryEventHandler::EncodeTotalMemory()
-    {   
-    
-    TUint8* size(&iSample[0]);
-    *size = 0;
-
-    NKern::LockSystem();
-    TInt freeRam(Kern::FreeRamInBytes());
-    TInt totalRam(Kern::SuperPage().iTotalRamSize);
-    NKern::UnlockSystem();
-
-    iSampleDescriptor.Zero();
-    
-    TUint32 id(0xbabbeaaa);
-    TInt zero(0);
-        
-    iSampleDescriptor.Append((TUint8*)&(id),sizeof(TUint32));
-    *size += sizeof(TUint);
-    
-    iSampleDescriptor.Append((TUint8*)&(totalRam),sizeof(TInt));
-    *size += sizeof(TInt);
-        
-    // append the cell amount allocated
-    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-    *size += sizeof(TInt);
-    
-    // append the chunk size
-    iSampleDescriptor.Append((TUint8*)&(freeRam),sizeof(TInt));
-    *size += sizeof(TInt);
-        
-    // append the thread user stack size
-    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-    *size += sizeof(TInt);
-
-    return ((TInt)(*size))+1;
-    }
-
-// handle chunk activity
-TBool DMemoryEventHandler::HandleAddChunk(DChunk* aChunk)
-    {    
-//    Kern::Printf("New DChunk created: 0x%08x, time: %d", aChunk, iCount);
-    
-    NKern::ThreadEnterCS();
-    Kern::MutexWait(*iLock);
-    // add header first
-    TInt err(AddHeader());
-    
-    if(err != KErrNone)
-        {
-        return EFalse;
-        }
-    
-    // new chunk, add name of it
-    TInt length(EncodeNameCode());
-    iSampleBuffer->AddSample(iSample, length);
-
-    // new chunk, add name of it
-    length = EncodeChunkName(*aChunk);
-    iSampleBuffer->AddSample(iSample, length);
-    
-    // add new chunk tag
-    length = EncodeNewCode();
-    iSampleBuffer->AddSample(iSample, length);
-
-    length = EncodeChunkData(*aChunk);
-    iSampleBuffer->AddSample(iSample, length);
-    
-    // add end mark
-    AddFooter();
-    Kern::MutexSignal(*iLock);
-    NKern::ThreadLeaveCS();
-    return ETrue;
-    }
-
-TBool DMemoryEventHandler::HandleUpdateChunk(DChunk* aChunk)
-    {
-//    Kern::Printf("DChunk updated: 0x%08x, time: %d", aChunk, iCount);
-    
-    NKern::ThreadEnterCS();
-    Kern::MutexWait(*iLock);
-    // add header first
-    TInt err(AddHeader());
-    
-    if(err != KErrNone)
-        {
-        return EFalse;
-        }
-    
-    // add new chunk tag
-    TInt length(EncodeUpdateCode());
-    iSampleBuffer->AddSample(iSample, length);
-
-    length = EncodeChunkData(*aChunk);
-    iSampleBuffer->AddSample(iSample, length);
-
-    // add end mark
-    AddFooter();
-    Kern::MutexSignal(*iLock);
-    NKern::ThreadLeaveCS();
-    return ETrue;
-    }
-
-TBool DMemoryEventHandler::HandleDeleteChunk(DChunk* aChunk)
-    {
-//    Kern::Printf("DChunk deleted: 0x%08x, time: %d", aChunk, iCount);
-    NKern::ThreadEnterCS();
-    Kern::MutexWait(*iLock);
-    // add header first
-    TInt err(AddHeader());
-    
-    if(err != KErrNone)
-        {
-        return EFalse;
-        }
-    
-    // add new chunk tag
-    TInt length(EncodeRemoveCode());
-    iSampleBuffer->AddSample(iSample, length);
-
-    length = EncodeChunkData(*aChunk);
-    iSampleBuffer->AddSample(iSample, length);
-
-    // add end mark
-    AddFooter();
-    Kern::MutexSignal(*iLock);
-    NKern::ThreadLeaveCS();
-    return ETrue;
-    }
-
-// handle process activity
-TBool DMemoryEventHandler::HandleAddProcess(DProcess *aProcess)
-    {
-    return ETrue;
-    }
-
-TBool DMemoryEventHandler::HandleUpdateProcess(DProcess *aProcess)
-    {
-    return ETrue;
-    }
-
-TBool DMemoryEventHandler::HandleDeleteProcess(DProcess *aProcess)
-    {
-    return ETrue;
-    }
-
-// handle thread activity
-TBool DMemoryEventHandler::HandleAddThread(DThread* aThread)
-    {
-//    Kern::Printf("DThread added: 0x%08x, time: %d", aThread->iId, iCount);
-    NKern::ThreadEnterCS();
-    Kern::MutexWait(*iLock);
-    // add header first
-    TInt err(AddHeader());
-    
-    if(err != KErrNone)
-        {
-        return EFalse;
-        }
-    
-    // new thread, add name of it
-    TInt length(EncodeNameCode());
-    iSampleBuffer->AddSample(iSample, length);
-    
-    // new chunk, add name of it
-    length = EncodeChunkName(*aThread);
-    iSampleBuffer->AddSample(iSample, length);
-    
-    // add new chunk tag
-    length = EncodeNewCode();
-    iSampleBuffer->AddSample(iSample, length);
-
-    length = EncodeChunkData(*aThread);
-    iSampleBuffer->AddSample(iSample, length);
-
-    // add end mark
-    AddFooter();
-    Kern::MutexSignal(*iLock);
-    NKern::ThreadLeaveCS();
-    return ETrue;
-    }
-
-TBool DMemoryEventHandler::HandleUpdateThread(DThread* aThread)
-    {
-//    Kern::Printf("DThread updated: 0x%08x, time: %d", aThread->iId, iCount);
-    NKern::ThreadEnterCS();
-    Kern::MutexWait(*iLock);
-    // add header first
-    TInt err(AddHeader());
-    
-    if(err != KErrNone)
-        {
-        return EFalse;
-        }
-    
-    // add new chunk tag
-    TInt length(EncodeUpdateCode());
-    iSampleBuffer->AddSample(iSample, length);
-
-    length = EncodeChunkData(*aThread);
-    iSampleBuffer->AddSample(iSample, length);
-
-    // add end mark
-    AddFooter();
-    Kern::MutexSignal(*iLock);
-    NKern::ThreadLeaveCS();    
-    return ETrue;
-    }
-
-TBool DMemoryEventHandler::HandleDeleteThread(DThread* aThread)
-    {
-//    Kern::Printf("DThread deleted: 0x%08x, time: %d", aThread->iId, iCount);
-    NKern::ThreadEnterCS();
-    Kern::MutexWait(*iLock);
-    // add header first
-    TInt err(AddHeader());
-    
-    if(err != KErrNone)
-        {
-        return EFalse;
-        }
-    
-    // add new chunk tag
-    TInt length(EncodeRemoveCode());
-    iSampleBuffer->AddSample(iSample, length);
-
-    length = EncodeChunkData(*aThread);
-    iSampleBuffer->AddSample(iSample, length);
-
-    // add end mark
-    AddFooter();
-    Kern::MutexSignal(*iLock);
-    NKern::ThreadLeaveCS();  
-    return ETrue;
-    }
-
-TBool DMemoryEventHandler::HandleAddLibrary(DLibrary* aLibrary, DThread* aThread)
-    {
-    LOGTEXT("DMemoryEventHandler::HandleAddLibrary");
-    Kern::Printf("DLibrary added: 0x%08x, time: %d", aLibrary, iCount);
-    // add header first
-    NKern::ThreadEnterCS();
-    Kern::MutexWait(*iLock);
-    TInt err(AddHeader());
-        
-    if(err != KErrNone)
-        {
-        return EFalse;
-        }
-    
-    // new library, add name of it
-    TInt length(EncodeNameCode());
-    iSampleBuffer->AddSample(iSample, length);
-        
-    // new chunk, add name of it
-    length = EncodeChunkName(*aLibrary);
-    iSampleBuffer->AddSample(iSample, length);
-        
-    // add new chunk tag
-    length = EncodeNewCode();
-    iSampleBuffer->AddSample(iSample, length);
-
-    length = EncodeChunkData(*aLibrary, *aThread);
-    iSampleBuffer->AddSample(iSample, length);
-
-    // add end mark
-    AddFooter();
-    Kern::MutexSignal(*iLock);
-    NKern::ThreadLeaveCS();      
-    return ETrue;
-    }
-
-TBool DMemoryEventHandler::HandleDeleteLibrary(DLibrary* aLibrary)
-    {
-    Kern::Printf("DLibrary deleted: 0x%08x, time: %d", aLibrary, iCount);
-    NKern::ThreadEnterCS();
-    Kern::MutexWait(*iLock);
-    // add header first
-    TInt err(AddHeader());
-        
-    if(err != KErrNone)
-        {
-        return EFalse;
-        }
-        
-    // add new chunk tag
-    TInt length(EncodeRemoveCode());
-    iSampleBuffer->AddSample(iSample, length);
-    
-    DThread* nullPointer = NULL;
-    length = EncodeChunkData(*aLibrary, *nullPointer);
-    iSampleBuffer->AddSample(iSample, length);
-
-    // add end mark
-    AddFooter();
-    Kern::MutexSignal(*iLock);
-    NKern::ThreadLeaveCS();        
-    return ETrue;
-    }
-
-// encode chunk name 
-TInt DMemoryEventHandler::EncodeChunkName(DChunk& c)
-    {   
-    // the size of the following name is in the first byte
-    TUint8* size(&iSample[0]);
-    *size = 0;
-        
-    // encode chunk name
-    iSampleDescriptor.Zero();
-    iSampleDescriptor.Append(_L("C_"));
-    c.TraceAppendFullName(iSampleDescriptor,false);
-    *size += iSampleDescriptor.Size();
-        
-    // add chunk object address here
-    TUint32 chunkAddr((TUint32)&c);
-    iSampleDescriptor.Append((TUint8*)&(chunkAddr),sizeof(TUint32));
-    *size += sizeof(TUint32);
-
-    // the size is the descriptor length + the size field
-    LOGSTRING2("Non-Heap Chunk Name - %d",*size);
-    return ((TInt)(*size))+1;           
-    }
-
-// encode chunk name 
-TInt DMemoryEventHandler::EncodeChunkName(DThread& t)
-    {       
-    // the size of the following name is in the first byte
-    TUint8* size(&iSample[0]);
-    *size = 0;
-    iSampleDescriptor.Zero();
-    
-    iSampleDescriptor.Append(_L("T_"));
-    t.TraceAppendFullName(iSampleDescriptor,false);
-    *size += iSampleDescriptor.Size();
-    
-    // copy the 4 bytes from the thread id field
-    iSampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
-    *size += sizeof(TUint);
-
-    // the size is the descriptor length + the size field
-    LOGSTRING2("Name - %d",*size);
-    return ((TInt)(*size))+1;
-    }
-
-// encode chunk name 
-TInt DMemoryEventHandler::EncodeChunkName(DLibrary& l)
-    {       
-    LOGTEXT("DMemoryEventHandler::EncodeChunkName (LIBRARY)");
-    // the size of the following name is in the first byte
-    TUint8* size(&iSample[0]);
-    *size = 0;
-    iSampleDescriptor.Zero();
-    
-    iSampleDescriptor.Append(_L("L_"));
-    l.TraceAppendFullName(iSampleDescriptor,false);
-    *size += iSampleDescriptor.Size();
-    
-    // copy the library address here
-    TUint32 libAddr((TUint32)&l);
-    iSampleDescriptor.Append((TUint8*) &libAddr,sizeof(TUint32));
-    *size += sizeof(TUint32);
-
-    // the size is the descriptor length + the size field
-    LOGSTRING2("Name - %d",*size);
-    return ((TInt)(*size))+1;
-    }
-
-// record thread stack changes
-TInt DMemoryEventHandler::EncodeChunkData(DThread& t)
-    {
-    LOGSTRING("DMemoryEventHandler::EncodeChunkDataT - entry");
-        
-    // the size of the following name is in the first byte
-    TUint8* size(&iSample[0]);
-    *size = 0;
-    iSampleDescriptor.Zero();
-
-    iSampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
-    *size += sizeof(TUint);
-        
-    // copy the total amount of memory allocated for user side stack
-    iSampleDescriptor.Append((TUint8*)&(t.iUserStackSize),sizeof(TInt));
-    *size += sizeof(TInt);
-
-    TInt zero(0);      
-    // append the cell amount allocated (zero, not in use here)
-    iSampleDescriptor.Append((TUint8*)&zero,sizeof(TInt));
-    *size += sizeof(TInt);
-    
-    // append the chunk size (this is not a chunk)
-    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TUint));
-    *size += sizeof(TUint);
-
-    // append user stack (max) size
-    iSampleDescriptor.Append((TUint8*)&(t.iUserStackSize),sizeof(TInt));
-    *size += sizeof(TInt);
-
-//    Kern::Printf("TData -> %d",*size);
-    return ((TInt)(*size))+1;
-    }
-
-// record chunk changes
-TInt DMemoryEventHandler::EncodeChunkData(DChunk& c)
-    {
-    LOGSTRING("DMemoryEventHandler::EncodeChunkDataC - entry");
-    
-    // the size of the following name is in the first byte
-    TUint8* size(&iSample[0]);
-    *size = 0;
-    iSampleDescriptor.Zero();
-    TInt zero(0);
-
-    TUint32 address((TUint32)&c);
-        
-    iSampleDescriptor.Append((TUint8*)&address,sizeof(TUint32));
-    *size += sizeof(TUint);
-    
-    // copy the total amount of memory allocated
-    iSampleDescriptor.Append((TUint8*)&(c.iSize),sizeof(TInt));
-    *size += sizeof(TInt);
-        
-    // append the cell amount allocated
-    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-    *size += sizeof(TInt);
-    
-    // append the chunk size
-    iSampleDescriptor.Append((TUint8*)&(c.iSize),sizeof(TUint));
-    *size += sizeof(TUint);
-        
-    // append the thread user stack size
-    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-    *size += sizeof(TInt);
-
-//    Kern::Printf("CData - %d",*size);
-    return ((TInt)(*size))+1;
-    }
-
-// record loaded libraries changes
-TInt DMemoryEventHandler::EncodeChunkData(DLibrary& l, DThread& t)
-    {    
-    LOGSTRING("DMemoryEventHandler::EncodeChunkDataL - entry");
-    
-    // the size of the following name is in the first byte
-    TUint8* size(&iSample[0]);
-    *size = 0;
-    iSampleDescriptor.Zero();
-    TInt zero(0);
-
-    TUint32 address((TUint32)&l);
-    
-    iSampleDescriptor.Append((TUint8*)&address,sizeof(TUint32));
-    *size += sizeof(TUint);
-    
-    // append amount of memory that library is allocated
-    iSampleDescriptor.Append((TUint8*)&(l.iCodeSeg->iSize),sizeof(TUint32));
-    *size += sizeof(TInt);
-            
-    // append count of how many times librarys is allocated
-    iSampleDescriptor.Append((TUint8*)&(l.iMapCount),sizeof(TInt));
-    *size += sizeof(TInt);
-    
-    if(&t != NULL)
-        {
-        // created by thread
-        iSampleDescriptor.Append((TUint8*)&(t),sizeof(TUint32));
-        }
-    else
-        {
-        // removed
-        iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TUint32));
-        }
-    *size += sizeof(TUint);
-            
-    // append the thread user stack size
-    iSampleDescriptor.Append((TUint8*)&(zero),sizeof(TInt));
-    *size += sizeof(TInt);
-    return ((TInt)(*size))+1;
-    }
-
--- a/piprofiler/plugins/GeneralsPlugin/src/PriSamplerImpl.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,312 +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 <piprofiler/ProfilerVersion.h>
-#include <piprofiler/ProfilerTraces.h>
-
-#include <kern_priv.h>
-#include <plat_priv.h>
-
-#include "PriSamplerImpl.h"
-
-#if !defined(__NKERN_H__)
-#include <nkern.h>
-#endif 
-
-#define TAG(obj) (*(TUint32*)&(obj->iAsyncDeleteNext))
-#define PROFILER_THREAD_MARK		((TUint32)0x00000002)
-
-
-DPriSamplerImpl::DPriSamplerImpl() :
-	sampleDescriptor(&(this->sample[1]),0,256)
-    {
-	LOGTEXT("PriSamplerImpl::PriSamplerImpl() - konstruktori");
-
-	iCountti = 50;	// sample threads 16 cycles before actual MEM and PRI sample time...
-	iNewThreadCount = 0;
-	iThreadCount = 0;
-	iProcessing = ENothingToProcess;
-	
-	for(TInt i=0;i<KProfilerMaxThreadAmount;i++)
-	    {
-		this->threadsToSample[i] = 0;
-		this->threadNamesToReport[i] = 0;
-        }
-
-    }
-
-DPriSamplerImpl::~DPriSamplerImpl()
-    {
-	
-    }
-
-TInt DPriSamplerImpl::CreateFirstSample()
-    {
-	LOGTEXT("PriSamplerImpl::CreateFirstSample - entry");
-	
-	this->sampleDescriptor.Zero();
-	this->sampleDescriptor.Append(_L8("Bappea_V"));
-	this->sampleDescriptor.Append(PROFILER_PRI_SAMPLER_VERSION);
-	this->sampleDescriptor.Append(_L8("_PRI"));
-
-	sample[0] = this->sampleDescriptor.Size();
-
-	LOGTEXT("PriSamplerImpl::CreateFirstSample - exit");
-
-	return (TInt)(sample[0]+1);
-    }
-
-TBool DPriSamplerImpl::SampleNeeded()
-    {
-	iCountti++;
-	if(iCountti % (iPriSamplingPeriod) == 0) 
-	    {
-		LOGTEXT("PriSamplerImpl::SampleNeeded - true");
-		return true;
-        }
-	else 
-	    {
-		return false;
-        }
-    }
-
-
-TInt DPriSamplerImpl::SampleImpl()
-    {
-	/*
-	 *
-	 *	EKA-2 implementation of PRI trace
-	 *
-	 */
-	if(this->iProcessing == ENothingToProcess)
-	    {
-	    if((iCountti % iPriSamplingPeriod) != 0 ) return 0;
-	    
-        LOGTEXT("Processing threads...");
-
-        DObjectCon& threads = *Kern::Containers()[EThread];
-
-        // PRI trace variables
-        this->iThreadCount = 0; 
-        this->iNewThreadCount = 0;
-        TInt totalThreadCount = threads.Count();
-
-        for(TInt i=0;i<totalThreadCount;i++)
-            {
-            DThread* t = (DThread*)(threads)[i];
-            LOGSTRING3("Processing thread %d, tag: 0x%x",i,TAG(t));
-
-            if( (TAG(t) & PROFILER_THREAD_MARK) == 0)
-                {
-                LOGSTRING2("Marking thread %d",i);
-                // this thread's chunk has not been reported yet
-                this->threadNamesToReport[iNewThreadCount] = t;
-                iNewThreadCount++;
-                // tag the thread
-                TAG(t) |= PROFILER_THREAD_MARK;
-                LOGSTRING2("New Thread %d",i);
-                }
-            else
-                {
-                LOGSTRING3("Thread %d marked already - 0x%x",i,TAG(t));
-                }
-
-            // the thread has been tagged, add heap chunks to the list
-            this->threadsToSample[this->iThreadCount] = t;
-            this->iThreadCount++;
-            LOGSTRING2("Added thread %d to threads to sample",i);
-            }
-
-        if(this->iThreadCount > 0 || this->iNewThreadCount > 0)
-            {
-            this->iProcessing = EStartingToProcess;
-            
-            // process the first sample
-            TInt length = this->ProcessChunks();
-            
-            if(length == 0)
-                {
-                this->iProcessing = ENothingToProcess;
-                }
-        
-            return length;
-            }
-        else
-            {
-            // there were no threads, should not take place
-            LOGTEXT("PriSamplerImpl::SampleImpl - Error, no threads"); 
-            return 0;
-            }
-	    }
-	else
-	    {
-		TInt length = this->ProcessChunks();
-		if(length == 0) 
-		    {
-			this->iProcessing = ENothingToProcess;
-		    }
-		return length;
-	    }
-    }
-
-inline TInt DPriSamplerImpl::ProcessChunks()
-    {
-	/*
-	 *
-	 *	EKA-2 implementation of PRI trace
-	 *
-	 */
-
-	if(iNewThreadCount > 0)
-	    {
-		if(this->iProcessing == EStartingToProcess)
-		    {
-			// this is the first sample, encode a code for names
-			this->iProcessing = EProcessingNames;
-			return EncodeNameCode();
-            }
-
-		// there are new thread names to report
-		iNewThreadCount--;
-		DThread* t = this->threadNamesToReport[iNewThreadCount];
-		return EncodeChunkName(*t);
-        }
-	else if(iThreadCount > 0)
-	    {
-		if(this->iProcessing == EProcessingNames || this->iProcessing == EStartingToProcess)
-		    {
-			// this is the first data sample, encode a code for data
-			this->iProcessing = EProcessingData;
-			return EncodeDataCode();
-            }
-
-		// there are no new chunks to report
-		// thus generate the real report
-		iThreadCount--;
-		DThread* t = this->threadsToSample[iThreadCount];
-		LOGSTRING2("PriSamplerImpl::ProcessChunks - starting to process thread 0x%x",t);
-		return EncodeChunkData(*t);
-        }
-	else
-	    {
-		// everything is processed
-		return 0;
-        }
-    }
-
-inline TInt DPriSamplerImpl::EncodeNameCode()
-    {
-	sample[0] = 1;
-	sample[1] = 0xbb;	// pri trace name code
-	return 2;
-    }
-
-inline TInt DPriSamplerImpl::EncodeDataCode()
-    {
-	sample[0] = 1;
-	sample[1] = 0xee;	// pri trace data code
-	return 2;
-    }
-
-
-inline TInt DPriSamplerImpl::EncodeChunkName(DThread& t)
-    {		
-	// the size of the following name is in the first byte
-	TUint8* size = &sample[0];
-	*size = 0;
-	this->sampleDescriptor.Zero();
-	
-	t.TraceAppendFullName(this->sampleDescriptor,false);
-	*size += this->sampleDescriptor.Size();
-	
-	// copy the 4 bytes from the thread id field
-	this->sampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
-	*size += sizeof(TUint);
-
-	// the size is the descriptor length + the size field
-	LOGSTRING2("Name size - %d",*size);
-	return ((TInt)(*size))+1;
-    }
-
-
-inline TInt DPriSamplerImpl::EncodeChunkData(DThread& t)
-    {
-	LOGTEXT("PriSamplerImpl::EncodeChunkData - entry");
-	LOGSTRING2("PriSamplerImpl::EncodeChunkData - processing thread 0x%x ",&t);
-		
-	// the size of the following name is in the first byte
-	TUint8* size = &sample[0];
-	*size = 0;
-	this->sampleDescriptor.Zero();
-
-	LOGTEXT("PriSamplerImpl::EncodeChunkData - cleared");
-
-    // append the thread id
-    this->sampleDescriptor.Append((TUint8*)&(t.iId),sizeof(TUint));
-    *size += sizeof(TUint);
-    
-//    NKern::LockSystem();
-//    TInt priority(-1);
-//    if(&t && t.Open()== KErrNone)
-//        {
-//       priority = t.iDefaultPriority;
-//        }
-//    NKern::UnlockSystem();
-    
-    // append the priority of the nanokernel fast semaphore
-//    this->sampleDescriptor.Append((TUint8*)&priority,sizeof(TUint8));
-    // append the priority of the nanokernel fast semaphore
-    this->sampleDescriptor.Append((TUint8*)&(t.iNThread.iPriority),sizeof(TUint8));
-    // add space because EKA-1 implementation needs it
-    this->sampleDescriptor.Append((TUint8)0x0);
-    *size += 2*sizeof(TUint8);
-
-    LOGTEXT("PriSamplerImpl::EncodeChunkData - appended priority");
-        
-
-    LOGSTRING2("Data size - %d",*size);
-    return ((TInt)(*size))+1;	
-    }
-
-
-void DPriSamplerImpl::Reset()
-    {
-	/*
-	 *
-	 *	EKA-2 implementation of PRI trace
-	 *
-	 */
-
-	LOGTEXT("PriSamplerImpl::Reset");
-	iCountti = 50;	// sample threads 16 cycles before actual MEM and PRI sample time...
-	this->iThreadCount = 0;
-	this->iNewThreadCount = 0;
-	this->iProcessing = ENothingToProcess;
-	this->sampleDescriptor.Zero();
-
-
-	// clear all thread tags
-	DObjectCon* threads = Kern::Containers()[EThread];
-	TInt totalThreadCount = threads->Count();
-	for(TInt i=0;i<totalThreadCount;i++)
-	    {
-		DThread* t = (DThread*)(*threads)[i];
-		TAG(t) = (TAG(t) & 0xfffffffd);
-	    }
-    }
-
--- a/piprofiler/plugins/PWRplugin/data/2001E5B9.rss	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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 <ecom/registryinfo.rh>
-
-// Declares info for two implementations
-RESOURCE REGISTRY_INFO theInfo
-    {
-    // UID for the DLL. See mmp files
-    //__SERIES60_3X__ can't be used in resource files
-    dll_uid = 0x2001E5B9;
-
-    // Declare array of interface info. This dll contains implementations for 
-    // only one interface (CSamplerInterfaceDefinition).
-    interfaces = 
-        {
-        INTERFACE_INFO
-            {
-            // UID of interface that is implemented
-            interface_uid = 0x2001E5BC;
-
-            implementations = 
-                {
-                IMPLEMENTATION_INFO
-                    {
-                    implementation_uid = 0x2001E5B9;
-
-                    version_no = 1;
-                    display_name = "PWR Sampler";
-                    default_data = "pwr";
-                    opaque_data = "10";
-                    }
-                };
-            }
-        };
-    }
--- a/piprofiler/plugins/PWRplugin/group/PWRPlugin.mmp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +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 <platform_paths.hrh>
-
-
-TARGET          PIProfilerPWR.dll
-TARGETTYPE      PLUGIN
-UID             0x10009D8D 0x2001E5B9
-VENDORID        VID_DEFAULT
-CAPABILITY      ALL -TCB
-SMPSAFE
-
-OS_LAYER_SYSTEMINCLUDE
-USERINCLUDE     ../inc
-USERINCLUDE     ../../../inc
-SOURCEPATH      ../src
-
-START RESOURCE  ../data/2001E5B9.rss
-TARGET PIProfilerPWR.rsc
-END
-
-SOURCE          PwrPluginImplementationTable.cpp
-SOURCE          PwrPlugin.cpp
-
-LIBRARY     euser.lib
-LIBRARY     ecom.lib
-LIBRARY     apparc.lib
-LIBRARY     cone.lib
-LIBRARY     gdi.lib
-LIBRARY     ws32.lib
-LIBRARY     efsrv.lib
-LIBRARY     charconv.lib
-LIBRARY     CommonEngine.lib
-LIBRARY     flogger.lib
-LIBRARY     centralrepository.lib
-LIBRARY     HWRMPowerClient.lib
-LIBRARY     HWRMLightClient.lib
--- a/piprofiler/plugins/PWRplugin/group/bld.inf	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +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 SBSV2
-PRJ_PLATFORMS
-DEFAULT
-#endif
-
-PRJ_MMPFILES
-#ifdef MARM
-  #ifndef __SERIES60_30__
-    PWRPlugin.mmp
-  #endif
-#endif
--- a/piprofiler/plugins/PWRplugin/inc/PwrPlugin.h	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +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 BAPPEA_PWR_SAMPLER_H
-#define BAPPEA_PWR_SAMPLER_H
-
-//#define PWR_SAMPLER_BACKLIGHT
-
-//#include "PIProfilerConfigInternal.h"
-
-// system definitions
-#include <w32std.h>
-#include <e32std.h>
-
-#include <e32property.h>
-#include <HWRMPower.h>
-#include <HWRMLight.h>
-
-// user definitions
-#include <piprofiler/SamplerPluginInterface.h>
-#include <piprofiler/ProfilerGenericClassesUsr.h>
-
-// caption definitions
-_LIT8(KPWRShortName, "pwr");
-_LIT8(KPWRMediumName, "Power sampler");
-_LIT8(KPWRLongName, "Power usage sampler");
-_LIT8(KPWRDescription, "Power sampler: \nSampling power consumption on Nokia S60 devices\nHW dep: N/A\nSW dep: S60 3.0\n");
-
-// Minimum allowed sampling interval (in ms). 0 means undefined.
-const TInt KMinSampleInterval = 250;
-const TInt KReportingPeriodInfinite = 0;
-
-const TUid KGppPropertyCat={0x20201F70};
-enum TGppPropertyKeys
-    {
-    EGppPropertySyncSampleNumber
-    };
-
-const TUid KPwrNotifierUid = { 0x2001E5B9 };
-class CProfilerPowerListener;
-
-/*
- *
- * PWR sampler plug-in definition
- *
- */
-
-class CPwrPlugin : public CSamplerPluginInterface
-{
-public:
-    static  CPwrPlugin* NewL(const TUid aImplementationUid, TAny* aInitParams);
-            ~CPwrPlugin();
-
-    TInt    ResetAndActivateL(CProfilerSampleStream& aStream);
-    TInt    StopSampling();
-    TBool   Enabled() { return iEnabled; }
-    void    SetEnabled(TBool aEnabled);
-    TInt    GetSamplerType();
-
-    TInt    CreateFirstSample();
-
-    void    GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes);
-    TInt    SetAttributesL(TSamplerAttributes aAttributes);
-    void    InitiateSamplerAttributesL();
-
-    TInt    ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray);
-
-    TInt    DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex);
-    void    SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex);
-
-    TUid    Id(TInt aSubId) const;
-
-    // subsampler settings, i.e. samplers implemented within a plugin
-    // no sub samplers, from CSamplerPluginInterface
-    TInt    SubId(TUid aId) const {return KErrNotFound;}
-    TInt    GetSubSamplers(TDes* aDes){return KErrNotFound;}
-
-private:
-            CPwrPlugin();
-    void    ConstructL();
-
-private:
-    TUint8                  iVersion[20];
-    TPtr8                   iVersionDescriptor;
-
-    TInt                    iSamplerType;
-
-    CProfilerPowerListener* iPowerListener;
-
-    TInt                    iPeriod;
-    CArrayFixFlat<TSamplerAttributes>* iSamplerAttributes;
-public:
-    TUint32*                iSampleTime;
-};
-
-#ifdef PWR_SAMPLER_BACKLIGHT
-class CProfilerPowerListener : public MHWRMBatteryPowerObserver, public MHWRMLightObserver
-#else
-class CProfilerPowerListener : public MHWRMBatteryPowerObserver
-#endif
-{
-public:
-    static  CProfilerPowerListener* NewL(CPwrPlugin* aSampler);
-            ~CProfilerPowerListener();
-
-private:
-            CProfilerPowerListener(CPwrPlugin* aSampler);
-    void    ConstructL();
-
-public:
-    TInt    StartL(const TDesC8& aBuf);
-    TInt    Stop();
-    TInt    DisplayNotifierL(const TDesC& aLine1, const TDesC& aLine2, const TDesC& aButton1, const TDesC& aButton2);
-
-    // From MHWRMBatteryPowerObserver
-    virtual void PowerMeasurement(TInt aErr, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement);
-#ifdef PWR_SAMPLER_BACKLIGHT
-    // From MHWRMLightObserver
-    virtual void LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus);
-#endif
-
-private:
-    void    Sample();
-
-public:
-    TInt                    iPwrSamplingPeriod;
-    TInt                    iSampleStartTime;
-    // Value that is read from Central Repository and restored after sampling
-    TInt                    iOriginalReportingPeriod;
-
-private:
-
-#ifdef PWR_SAMPLER_BACKLIGHT
-    TUint8                  iSample[13];
-#else
-    TUint8                  iSample[12];
-#endif
-
-    TUint16                 iNominalCapa;
-    TUint16                 iVoltage;
-    TUint16                 iCurrent;
-
-    CPwrPlugin*             iSampler;
-    CHWRMPower*             iPowerAPI;
-
-#ifdef PWR_SAMPLER_BACKLIGHT
-    CHWRMLight*             iLightAPI;
-    CHWRMLight::TLightStatus iBackLightStatus;
-#endif
-};
-
-#endif
-
--- a/piprofiler/plugins/PWRplugin/sis/PWRPlugin.pkg	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +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:
-;
-; ShapeImplementation_30_gcce.pkg
-;
-
-;Language - standard language definitions
-&EN
-
-; standard sis file header
-#{"Shape plugin"},(0xE01F614F),2,0,0
-
-
-;
-;Localised Vendor name
-;
-%{"Forum Nokia"}
-
-;
-;Unique Vendor name
-;
-:"Forum Nokia"
-
-;
-;Supports Series 60 v 3.0
-;
-[0x101F7961], 0, 0, 0, {"Series60ProductID"}
-
-
-;Files to include. Check the source paths they match your SDK setup. 
-"\Symbian\9.1\S60_3rd_MR\Epoc32\release\gcce\urel\shapeimplementation.dll"     -   "!:\sys\bin\shapeimplementation.dll"
-"\Symbian\9.1\S60_3rd_MR\epoc32\data\Z\Resource\plugins\shapeimplementation.rsc"   -   "!:\Resource\Plugins\shapeimplementation.RSC"
--- a/piprofiler/plugins/PWRplugin/src/PwrPlugin.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,623 +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 "PwrPlugin.h"
-#include <piprofiler/ProfilerTraces.h>
-
-#include <centralrepository.h>
-#include <HWRMPower.h>
-#include <HWRMLight.h>
-#include <hwrm/hwrmpowerdomaincrkeys.h>
-
-
-// texts for notes
-_LIT(KPowerTextLine1, "Power sampler:");
-_LIT(KPowerTextLine2, "Failed to start power measurement");
-_LIT(KPowerTextErrorSampling, "Error receiving measurement data");
-_LIT(KButtonOk, "Ok");
-
-// LITERALS
-
-_LIT8(KSamplingPeriodMs, "sampling_period_ms");
-
-// CONSTANTS
-// Use this UID if plugin is PwrPlugin:
-const TUid KSamplerPwrPluginUid = { 0x2001E5B9 };
-
-/*
- *
- * class CPwrPlugin implementation
- * 
- */
- 
-CPwrPlugin* CPwrPlugin::NewL(const TUid /*aImplementationUid*/, TAny* aInitParams)
-    {
-    LOGTEXT(_L("CPwrPlugin::NewL() - entry"));
-    CPwrPlugin* self = new (ELeave) CPwrPlugin();
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-    LOGTEXT(_L("CPwrPlugin::NewL() - exit"));
-    return self;
-    }
-
-CPwrPlugin::CPwrPlugin() :
-    iVersionDescriptor(&(this->iVersion[1]),0,19),
-    iSamplerType(PROFILER_USER_MODE_SAMPLER)
-    {
-    iPeriod = 250;
-    iSamplerId = PROFILER_PWR_SAMPLER_ID;
-    iEnabled = EFalse;
-    iPowerListener = NULL;
-    LOGTEXT(_L("CPwrPlugin::CPwrPlugin() - konstruktori"));
-
-    }
-
-void CPwrPlugin::ConstructL() 
-    {
-    LOGTEXT(_L("CPwrPlugin::ConstructL() - entry"));
-    // initiate sampler attributes array
-    iSamplerAttributes = new(ELeave) CArrayFixFlat<TSamplerAttributes>(1); // only one sampler
-
-    // insert default attributes to array
-    InitiateSamplerAttributesL();
-
-    LOGTEXT(_L("CPwrPlugin::ConstructL() - exit"));
-    }
-
-CPwrPlugin::~CPwrPlugin()
-    {
-    LOGTEXT(_L("CPwrPlugin::~CPwrPlugin() - entry"));
-    if(iPowerListener)
-        {
-        if(Enabled())
-            {
-            iPowerListener->Stop();
-            }
-        delete iPowerListener;
-        iPowerListener = NULL;
-        }
-
-    if(iSamplerAttributes)
-        {
-        iSamplerAttributes->Reset();
-        delete iSamplerAttributes;
-        iSamplerAttributes = NULL;
-        }
-
-    LOGTEXT(_L("CPwrPlugin::~CPwrPlugin() - exit"));
-    }
-
-TUid CPwrPlugin::Id(TInt /*aSubId*/) const
-    {
-    LOGSTRING2( "CPwrPlugin::Id():0x%X", KSamplerPwrPluginUid.iUid );
-    return KSamplerPwrPluginUid;
-    }
-
-void CPwrPlugin::InitiateSamplerAttributesL()
-    {
-    // create TSamplerAttributes
-    TSamplerAttributes attr(KSamplerPwrPluginUid.iUid,
-            KPWRShortName(),
-            KPWRLongName(),
-            KPWRDescription(),
-            250,
-            EFalse,
-            EFalse,
-            0); 
-    this->iSamplerAttributes->AppendL(attr);
-    }
-
-void CPwrPlugin::SetEnabled(TBool aEnabled)
-    {
-    iEnabled = aEnabled;
-    }
-
-// returns setting array
-void CPwrPlugin::GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes)
-    {
-    aAttributes->AppendL(iSamplerAttributes->At(0));
-    }
-
-TInt CPwrPlugin::SetAttributesL(TSamplerAttributes aAttributes)
-    {
-    TSamplerAttributes attr;
-
-    attr = iSamplerAttributes->At(0);
-    // replace the old attribute container
-    iSamplerAttributes->Delete(0);
-    iSamplerAttributes->InsertL(0, aAttributes);
-    return KErrNone;
-    }
-
-/* 
- * Method for parsing and transforming text array settings into TSamplerAttributes (per each sub sampler),
- * called by CSamplerController class
- * 
- * @param array of raw text setting lines, e.g. [gpp]\nenabled=true\nsampling_period_ms=1\n
- */
-TInt CPwrPlugin::ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aAllSettingsArray)
-    {
-    // local literals
-    _LIT8(KPWRShort, "pwr");
-
-    TInt err(KErrNone);
-    TBuf8<16> samplerSearchName;
-    samplerSearchName.Copy(KPWRShort);
-
-    // get sampler specific settings  
-    err = DoSetSamplerSettings(aAllSettingsArray, samplerSearchName, 0);
-
-    // returns KErrNone if settings found, otherwise KErrNotFound
-    return err;
-    }
-
-TInt CPwrPlugin::DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex)
-    {
-    // 
-    TBuf8<16> samplerSearch;
-    samplerSearch.Copy(KBracketOpen);
-    samplerSearch.Append(aSamplerName);
-    samplerSearch.Append(KBracketClose);
-
-    // read a line
-    for (TInt i(0); i<aAllSettings->MdcaCount(); i++)
-        {
-        // check if this line has a setting block start, i.e. contains [xxx] in it
-        if (aAllSettings->MdcaPoint(i).CompareF(samplerSearch) == 0)
-            {
-            // right settings block found, now loop until the next block is found
-            for(TInt j(i+1);j<aAllSettings->MdcaCount();j++)
-                {
-                // check if the next settings block was found
-                if(aAllSettings->MdcaPoint(j).Left(1).CompareF(KBracketOpen) != 0)
-                    {
-                    // save found setting value directly to its owners attributes
-                    SaveSettingToAttributes(aAllSettings->MdcaPoint(j), aIndex);
-                    }
-                else
-                    {
-                    // next block found, return KErrNone
-                    return KErrNone;
-                    }
-                }
-            }
-        }
-
-    return KErrNotFound;
-    }
-
-/**
- * Method for setting a specific descriptor (from settings file) to attribute structure
- * 
- * @param aSetting  
- * @param aName  
- */
-void CPwrPlugin::SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex)
-    {
-    // find the equal mark from the setting line
-    TInt sepPos = aSetting.Find(KSettingItemSeparator);
-    // check that '=' is found
-    if (sepPos > 0)
-        {
-        // check that the element matches
-        if (aSetting.Left(sepPos).CompareF(KEnabled) == 0)
-            {
-            TBool en;
-            CSamplerPluginInterface::Str2Bool(aSetting.Right(aSetting.Length()-sepPos-1), en);
-            if(en != iSamplerAttributes->At(aIndex).iEnabled)
-                {
-                iSamplerAttributes->At(aIndex).iEnabled = en;
-                }
-            }
-        else if (aSetting.Left(sepPos).CompareF(KSamplingPeriodMs) == 0)
-            {
-            TInt sr;
-            CSamplerPluginInterface::Str2Int(aSetting.Right(aSetting.Length()-sepPos-1), sr);
-            if(sr != iSamplerAttributes->At(aIndex).iSampleRate)
-                {
-                iSamplerAttributes->At(aIndex).iSampleRate = sr;
-                }
-            }
-        }
-    }
-
-TInt CPwrPlugin::GetSamplerType()
-    {
-    return iSamplerType;
-    }
-
-TInt CPwrPlugin::ResetAndActivateL(CProfilerSampleStream& aStream) 
-    {
-    LOGTEXT(_L("CPwrPlugin::ResetAndActivate() - entry"));
-    // check if sampler enabled
-    if(iSamplerAttributes->At(0).iEnabled)
-        {
-        // create a new listener instance for every trace, destroy it on stop
-        iPowerListener = CProfilerPowerListener::NewL(this);
-
-        iStream = &aStream;
-        TInt length = this->CreateFirstSample();
-        iVersion[0] = (TUint8)length;
-        LOGSTRING2("CPwrPlugin::ResetAndActivate() - AddSample, length %d", length);
-        TInt ret = this->AddSample(iVersion, length+1, 0);
-
-        LOGSTRING2("CPwrPlugin::ConstructL() - sampling period %d", this->iPeriod);
-
-        HBufC8* iBufRes = HBufC8::NewMaxLC(10);
-        TPtr8 iPtrRes = iBufRes->Des();
-
-        // check if sampling rate set to something reasonable, relevant only in SYNC case
-        if(iSamplerAttributes->At(0).iSampleRate != -1)
-            {
-            iPtrRes.Num(iSamplerAttributes->At(0).iSampleRate);
-            }
-        else
-            {
-            iPtrRes.Append(KNullDesC8);
-            }
-
-        // set disabled
-        SetEnabled(ETrue); 
-
-        // activate power listener
-        ret = iPowerListener->StartL(iPtrRes);
-        LOGTEXT(_L("CPwrPlugin::ResetAndActivate() - exit"));
-
-        CleanupStack::PopAndDestroy();
-        
-        if(ret != KErrNone)
-            return ret;
-        }
-    return KErrNone;
-    }
-
-TInt CPwrPlugin::CreateFirstSample() 
-    {
-    LOGTEXT(_L("CPwrPlugin::CreateFirstSample - entry"));
-    this->iVersionDescriptor.Zero();
-    this->iVersionDescriptor.Append(_L8("Bappea_PWR_V"));
-    this->iVersionDescriptor.Append(PROFILER_PWR_SAMPLER_VERSION);
-    LOGTEXT(_L("CPwrPlugin::CreateFirstSample - exit"));
-    return (TInt)(this->iVersionDescriptor.Length());
-    }
-
-TInt CPwrPlugin::StopSampling() 
-    {
-    if(iPowerListener)
-        {
-        iPowerListener->Stop();
-        delete iPowerListener;
-        iPowerListener = NULL;
-        }
-
-    // set disabled
-    SetEnabled(EFalse);
-
-    return KErrNone;
-    }
-
-
-/*
- *
- * class CProfilerPowerListener implementation
- * 
- */
-
-CProfilerPowerListener::CProfilerPowerListener(CPwrPlugin* aSampler) :
-    iPwrSamplingPeriod(0),
-    iOriginalReportingPeriod(0),
-    iNominalCapa(0),
-    iVoltage(0), 
-    iCurrent(0),
-    iPowerAPI(0)
-#ifdef PWR_SAMPLER_BACKLIGHT
-    ,iLightAPI(0),
-    iBackLightStatus(CHWRMLight::ELightStatusUnknown)
-#endif
-
-    {
-    LOGTEXT(_L("CProfilerPowerListener::CProfilerPowerListener() - konstuktori"));
-    this->iSampler = aSampler;
-    LOGTEXT(_L("CProfilerPowerListener::CProfilerPowerListener() - konstuktori exit"));
-    }
-
-CProfilerPowerListener* CProfilerPowerListener::NewL(CPwrPlugin* aSampler)
-    {
-    LOGTEXT(_L("CProfilerPowerListener::NewL() - entry"));
-    CProfilerPowerListener* self = new (ELeave) CProfilerPowerListener(aSampler);
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-    LOGTEXT(_L("CProfilerPowerListener::NewL() - exit"));
-    return self;
-    }
-
-void CProfilerPowerListener::ConstructL()
-    {
-    LOGTEXT(_L("CProfilerPowerListener::ConstructL() - entry"));
-    iSampleStartTime = 0;
-    LOGTEXT(_L("CProfilerPowerListener::ConstructL() - exit"));
-    }
-
-CProfilerPowerListener::~CProfilerPowerListener() 
-    {
-    LOGTEXT(_L("CProfilerPowerListener::~CProfilerPowerListener() - entry"));
-
-    if (iPowerAPI)
-        {
-        delete iPowerAPI;
-        iPowerAPI = 0;
-        }
-#ifdef PWR_SAMPLER_BACKLIGHT
-    if (iLightAPI)
-        {
-        delete iLightAPI;
-        iLightAPI = 0;
-        }
-#endif
-
-    LOGTEXT(_L("CProfilerPowerListener::~CProfilerPowerListener() - exit"));
-    }
-
-TInt CProfilerPowerListener::DisplayNotifierL(const TDesC& aLine1, const TDesC& aLine2, const TDesC& aButton1, const TDesC& aButton2)
-    {
-    RNotifier notifier;
-    TRequestStatus stat;
-
-    TInt buttonValue(0);
-
-    User::LeaveIfError(notifier.Connect());
-
-    notifier.Notify(aLine1, aLine2, aButton1, aButton2, buttonValue, stat);
-    User::WaitForRequest(stat);
-
-    notifier.Close();
-    return buttonValue;
-    }
-
-
-TInt CProfilerPowerListener::StartL(const TDesC8& aBuf)
-    {
-    LOGTEXT(_L("CProfilerPowerListener::StartL() - entry"));
-
-    // get the property value
-    TInt r = RProperty::Get(KGppPropertyCat, EGppPropertySyncSampleNumber, iSampleStartTime);
-    if(r != KErrNone)
-        {
-        LOGSTRING2("CProfilerPowerListener::StartL() - getting iSyncOffset failed, error %d", r);
-        }
-
-   // check if given sampling period is valid
-    if(aBuf.CompareF(KNullDesC8)!= 0)
-        {
-        TLex8* lex = new TLex8(aBuf);
-        lex->Val(iPwrSamplingPeriod);
-        delete lex;
-        }
-    else
-        {
-        // set default period
-        iPwrSamplingPeriod = 250;
-        }
-
-    // Check that sampling period is in allowed range
-    if (KMinSampleInterval > 0 && iPwrSamplingPeriod < KMinSampleInterval)
-        {
-        iPwrSamplingPeriod = KMinSampleInterval;
-        }
-
-    LOGSTRING2("CProfilerPowerListener::StartL() - Sampling period %d", iPwrSamplingPeriod);
-
-    // Start monitoring voltage and current
-    iPowerAPI = CHWRMPower::NewL();
-    iPowerAPI->SetPowerReportObserver(this);
-
-    // Read HWRM reporting settings from central repository
-    CRepository* centRep = CRepository::NewL(KCRUidPowerSettings);
-    TInt baseInterval(0);
-    User::LeaveIfError(centRep->Get(KPowerBaseTimeInterval, baseInterval));
-    User::LeaveIfError(centRep->Get(KPowerMaxReportingPeriod, iOriginalReportingPeriod));
-
-    LOGSTRING2("CProfilerPowerListener::StartL() - HWRM base power report interval: %d", baseInterval);
-    LOGSTRING2("CProfilerPowerListener::StartL() - Original HWRM max power reporting period: %d", iOriginalReportingPeriod);
-
-    User::LeaveIfError(centRep->Set(KPowerMaxReportingPeriod, KReportingPeriodInfinite));
-
-    // Power reporting interval reading may return too low value sometimes. Minimum value expected to be 250ms.
-    if ( baseInterval < KMinSampleInterval )
-        {
-        baseInterval = KMinSampleInterval;
-        LOGSTRING2("CProfilerPowerListener::StartL() - Power report interval too low. Changed to: %d", baseInterval);
-        }
-
-    // Power reporting period is multiplier of HWRM base period
-    TInt intervalMultiplier = iPwrSamplingPeriod / baseInterval;
-
-    if (intervalMultiplier < 1)
-        {
-        intervalMultiplier = 1;
-        }
-
-    LOGSTRING2("CProfilerPowerListener::StartL() - Reporting period multiplier: %d", intervalMultiplier);
-
-    TRequestStatus status(KRequestPending);
-    iPowerAPI->StartAveragePowerReporting(status, intervalMultiplier);
-    User::WaitForRequest(status);
-
-    if (status.Int() != KErrNone)
-        {
-        LOGTEXT(_L("CProfilerPowerListener::StartL() - Failed to initialize power reporting"));
-
-        DisplayNotifierL(KPowerTextLine1, KPowerTextLine2, KButtonOk, KNullDesC);
-
-        return status.Int();
-        }
-
-#ifdef PWR_SAMPLER_BACKLIGHT
-    // Start monitoring backlight status
-    iLightAPI = CHWRMLight::NewL(this);
-#endif
-
-    LOGTEXT(_L("CProfilerPowerListener::StartL() - exit"));
-    return KErrNone;
-    }
-
-void CProfilerPowerListener::Sample()
-    {
-    LOGTEXT(_L("CProfilerPowerListener::Sample() - entry"));
-
-    TRequestStatus status;
-    CHWRMPower::TBatteryConsumptionData consumptionData;
-
-    iPowerAPI->GetBatteryInfo(status, consumptionData);
-    User::WaitForRequest(status);
-
-    // Data is valid only if status == KErrNone 
-    if (status.Int() != KErrNone)
-        {
-        LOGSTRING2("CProfilerPowerListener::Sample() - Getting battery info failed with code: ", status.Int());
-        iNominalCapa = 0;
-        }
-    else
-        {
-        iNominalCapa = consumptionData.iNominalCapacity;
-        }
-
-    // Space for GPP sample time        
-    //TUint32 sampleTime = iSampler->iStream->iSampler->GetSampleTime();
-    TUint32 sampleTime = User::NTickCount() - iSampleStartTime;
-    LOGSTRING2("CProfilerPowerListener::Sample() - Sample time: %d", sampleTime);
-    LOGSTRING2("CProfilerPowerListener::Sample() - Nominal capacitance: %d", iNominalCapa);
-    LOGSTRING2("CProfilerPowerListener::Sample() - Voltage: %d", iVoltage);
-    LOGSTRING2("CProfilerPowerListener::Sample() - Current: %d", iCurrent);
-#ifdef PWR_SAMPLER_BACKLIGHT
-    LOGSTRING2("CProfilerPowerListener::Sample() - Backlight status: %d", (TUint8)iBackLightStatus);
-#endif
-
-    iSample[0] = iNominalCapa;
-    iSample[1] = iNominalCapa >> 8;
-    iSample[2] = iVoltage;
-    iSample[3] = iVoltage >> 8;
-    iSample[4] = iCurrent;
-    iSample[5] = iCurrent >> 8;
-    iSample[6] = iCurrent >> 16;
-    iSample[7] = iCurrent >> 24;
-#ifdef PWR_SAMPLER_BACKLIGHT
-    iSample[8] = (TUint8)iBackLightStatus;
-    iSample[9] = sampleTime;
-    iSample[10] = sampleTime >> 8;
-    iSample[11] = sampleTime >> 16;
-    iSample[12] = sampleTime >> 24;
-
-    iSampler->AddSample(iSample, 13, 0);
-#else
-    iSample[8] = sampleTime;
-    iSample[9] = sampleTime >> 8;
-    iSample[10] = sampleTime >> 16;
-    iSample[11] = sampleTime >> 24;
-
-    iSampler->AddSample(iSample, 12, 0);
-#endif
-
-    LOGTEXT(_L("CProfilerPowerListener::Sample() - exit"));
-    }
-
-TInt CProfilerPowerListener::Stop() 
-    {
-    LOGTEXT(_L("CProfilerPowerListener::Stop() - entry"));
-
-    if (iPowerAPI)
-        {
-        TRAPD(err, iPowerAPI->StopAveragePowerReportingL());
-        if(err != KErrNone)
-            {
-            LOGSTRING2("CProfilerPowerListener::Stop() - Failed to stop power reporting: %d", err);
-            }
-        else
-            {
-            LOGTEXT(_L("CProfilerPowerListener::Stop() - Stopped power monitoring"));
-            }
-        delete iPowerAPI;
-        iPowerAPI = 0;
-
-        // Restore original value to max sampling period
-        CRepository* centRep = 0;
-        TRAP(err, centRep = CRepository::NewL(KCRUidPowerSettings));
-        if (err != KErrNone)
-            {
-            LOGSTRING2("CProfilerPowerListener::Stop() - Failed to open Central Repository: %d", err);
-            }
-        else
-            {
-            err = centRep->Set(KPowerMaxReportingPeriod, iOriginalReportingPeriod);
-            if(err != KErrNone)
-                {
-                LOGSTRING2("CProfilerPowerListener::Stop() - Failed to restore max sampling period: %d", err);
-                }
-            }
-        }
-#ifdef PWR_SAMPLER_BACKLIGHT
-    if (iLightAPI)
-        {
-        delete iLightAPI;
-        iLightAPI = 0;
-        }
-#endif
-
-    LOGTEXT(_L("CProfilerPowerListener::Stop() - exit"));
-    return KErrNone;
-    }
-
-void CProfilerPowerListener::PowerMeasurement(TInt aErr, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement)
-    {
-    LOGTEXT(_L("CProfilerPowerListener::PowerMeasurement - entry"));
-
-    if (aErr == KErrNone)
-        {
-        LOGSTRING3("CProfilerPowerListener::PowerMeasurement - Previous values - Voltage: %d Current: %d", iVoltage, iCurrent);
-        iVoltage = aMeasurement.iAverageVoltage;
-        iCurrent = aMeasurement.iAverageCurrent;
-        LOGSTRING3("CProfilerPowerListener::PowerMeasurement - New values - Voltage: %d Current: %d", iVoltage, iCurrent);
-
-        this->Sample();
-        }
-    else
-        {
-        LOGSTRING2("CProfilerPowerListener::PowerMeasurement - Failed with error code: %d", aErr);
-        DisplayNotifierL(KPowerTextLine1, KPowerTextErrorSampling, KButtonOk, KNullDesC);
-        }
-    LOGTEXT(_L("CProfilerPowerListener::PowerMeasurement - exit"));
-    }
-
-#ifdef PWR_SAMPLER_BACKLIGHT
-void CProfilerPowerListener::LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus)
-    {
-    LOGTEXT(_L("CProfilerPowerListener::LightStatusChanged - entry"));
-    LOGSTRING3("CProfilerPowerListener::LightStatusChanged - Target: %d Status: %d", aTarget, aStatus);
-
-    if (aTarget == CHWRMLight::EPrimaryDisplay)
-        {
-        LOGSTRING2("CProfilerPowerListener::LightStatusChanged - Previous light status: %d", iBackLightStatus);
-        iBackLightStatus = aStatus;
-        LOGSTRING2("CProfilerPowerListener::LightStatusChanged - New light status: %d", iBackLightStatus);
-
-        this->Sample();
-        }
-    LOGTEXT(_L("CProfilerPowerListener::LightStatusChanged - exit"));
-    }
-#endif
--- a/piprofiler/plugins/PWRplugin/src/PwrPluginImplementationTable.cpp	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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 FILES
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-
-#include "PwrPlugin.h"
-
-
-// Provides a key value pair table, this is used to identify
-// the correct construction function for the requested interface.
-const TImplementationProxy ImplementationTable[] =
-{
-         IMPLEMENTATION_PROXY_ENTRY(0x2001E5B9,  CPwrPlugin::NewL),
-};
-
-// Function used to return an instance of the proxy table.
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-{
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-    return ImplementationTable;
-}
-
--- a/piprofiler/rom/piprofiler.iby	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +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 __PIPROFILER__
-#define __PIPROFILER__
-
-// PI Profiler Engine itself 
-file=ABI_DIR\BUILD_DIR\PIProfilerEngine.exe						sys\bin\PIProfilerEngine.exe
-file=ABI_DIR\BUILD_DIR\PIProfiler.exe							sys\bin\PIProfiler.exe
-
-// sampler plugins
-// NOTE: Mandatory kernel driver included in piprofiler_ldd.iby
-ECOM_PLUGIN(PIProfilerGenerals.dll, PIProfilerGenerals.rsc)
-ECOM_PLUGIN(PIProfilerPWR.dll, PIProfilerPWR.rsc)
-
-ECOM_PLUGIN(PIProfilerBUP.dll, PIProfilerBUP.rsc)
-file=ABI_DIR\BUILD_DIR\PIProfilerTouchEventAnim.dll				sys\bin\PIProfilerTouchEventAnim.dll
-
-// Writer plugins
-ECOM_PLUGIN(piprofilerdebugwriter.dll, piprofilerdebugwriter.rsc)
-ECOM_PLUGIN(piprofilerdiskwriter.dll, piprofilerdiskwriter.rsc)
-
-#endif //__PIPROFILER__
--- a/piprofiler/rom/piprofiler_ldd.iby	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +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 __PIPROFILER_LDD__
-#define __PIPROFILER_LDD__
-
-// kernel side driver
-device[VARID]=KERNEL_DIR\BUILD_DIR\PIProfilerGeneralsSampler.ldd				sys\bin\PIProfilerGeneralsSampler.ldd
-
-#endif //__PIPROFILER_LDD__
--- a/piprofiler/rom/piprofiler_s2.iby	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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 __PIPROFILER__
-#define __PIPROFILER__
-
-// PI Profiler Engine itself 
-file=ABI_DIR\BUILD_DIR\PIProfilerEngine.exe						sys\bin\PIProfilerEngine.exe
-file=ABI_DIR\BUILD_DIR\PIProfiler.exe							sys\bin\PIProfiler.exe
-
-// sampler plugins
-// NOTE: Mandatory kernel driver included in piprofiler_ldd.iby
-ECOM_PLUGIN(PIProfilerGenerals.dll, PIProfilerGenerals.rsc)
-
-ECOM_PLUGIN(PIProfilerBUP.dll, PIProfilerBUP.rsc)
-file=ABI_DIR\BUILD_DIR\PIProfilerTouchEventAnim.dll				sys\bin\PIProfilerTouchEventAnim.dll
-
-// Writer plugins
-ECOM_PLUGIN(piprofilerdebugwriter.dll, piprofilerdebugwriter.rsc)
-ECOM_PLUGIN(piprofilerdiskwriter.dll, piprofilerdiskwriter.rsc)
-
-#endif //__PIPROFILER__
--- a/piprofiler/symbian_version.hrh	Fri Aug 27 11:37:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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: Symbian version configuration file 
-*
-*/
-
-#ifndef __SYMBIAN_VERSION_HRH
-#define __SYMBIAN_VERSION_HRH
-
-// S60 and Symbian version number enumeration definitions
-
-#define S60_30                                              30
-#define S60_31                                              31
-#define S60_32                                              32
-#define S60_50                                              50
-#define S60_51                                              91
-#define S60_52                                              92
-#define SYMBIAN_1                                           50
-#define SYMBIAN_2                                           91
-#define SYMBIAN_3                                           92
-#define SYMBIAN_4                                           101
-
-
-/**
- * Defines the S60 or Symbian version used by this component. This flag can be
- * used to variate the source code based on the SDK in use. The value of the
- * flag should be always changed to reflect the current build environment.
- */
-#define SYMBIAN_VERSION_SUPPORT                              SYMBIAN_4
-
-
-#endif  // __SYMBIAN_VERSION_HRH